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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f68f6f092925708641002c9a801e7d3c6147baff | 8802adfc955c8d4319423f4d85861c2896785f03 | /admin.java | c90ff18c57fbf444ec3729b15a85e4ff7ad9df07 | [] | no_license | Abishekrabs/MVC | babc5e80731d224fb93c688fddce34adccdd9cb2 | 4a0968e01590c27e1964bf805d5181b5103743f7 | refs/heads/master | 2020-04-12T10:50:38.468328 | 2018-12-19T13:52:50 | 2018-12-19T13:52:50 | 162,442,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.VO;
public class admin {
String userId;
String password;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"noreply@github.com"
] | Abishekrabs.noreply@github.com |
9ac2047f0912576c38c1a9913a1c1c01c1255743 | f747c749d9fdaf610a353e7541de1cafb56eb0a2 | /test/src/test/java/info/clo5de/asuka/rpg/item/TestExEnchant.java | 87111f036c5dfa487a585072f16167030ff58477 | [] | no_license | jackey8616/AsukaRPG | b04d6cea861292bba672015344270bde7c49c660 | 807ee7cd8108d2d2dd82c23ad7db2ba3cbb83018 | refs/heads/master | 2020-04-10T08:46:07.948087 | 2018-12-21T18:46:52 | 2018-12-21T19:53:40 | 160,914,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,140 | java | package info.clo5de.asuka.rpg.item;
import info.clo5de.asuka.rpg.AsukaRPG;
import info.clo5de.asuka.rpg.utils;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.Random;
import static org.assertj.core.api.Assertions.assertThat;
import static org.powermock.api.mockito.PowerMockito.spy;
import static org.powermock.api.mockito.PowerMockito.when;
public class TestExEnchant {
private static Random mockRandom;
private static ExEnchant ex, ex1, ex2;
@BeforeClass
public static void setup () throws Exception {
mockRandom = spy(new Random());
utils.setFinalStatic(AsukaRPG.class.getField("random"), mockRandom);
new TestExEnchant().resetAll();
}
@Before
public void resetAll () {
ex = new ExEnchant("TEST1", 0);
ex1 = new ExEnchant("TEST2", 3, 4);
ex2 = new ExEnchant("TEST3", 0.0005, 0.0004);
}
@Test
public void testGetName () {
assertThat(ex.getName().equals("TEST1")).isTrue();
assertThat(ex1.getName().equals("TEST2")).isTrue();
assertThat(ex2.getName().equals("TEST3")).isTrue();
}
@Test
public void testGetAbility () {
assertThat(ex.getAbility()).isEqualTo(0);
assertThat(ex1.getAbility()).isEqualTo(0.03);
assertThat(ex2.getAbility()).isEqualTo(0.0005);
}
@Test
public void testSetAbility () {
ex.setAbility(5.0D);
assertThat(ex.getAbility()).isEqualTo(5.0D);
}
@Test
public void testGetEffect () {
assertThat(ex.getEffect()).isEqualTo(0);
assertThat(ex1.getEffect()).isEqualTo(0.04);
assertThat(ex2.getEffect()).isEqualTo(0.0004);
}
@Test
public void testSetEffect () {
ex1.setEffect(6.0D);
assertThat(ex1.getEffect()).isEqualTo(6.0D);
}
@Test
public void testIsTriggered () {
ex1.setAbility(0.5D);
when(mockRandom.nextDouble()).thenReturn(0.4D);
assertThat(ex1.isTriggered()).isTrue();
when(mockRandom.nextDouble()).thenReturn(0.6D);
assertThat(ex1.isTriggered()).isFalse();
}
} | [
"jackey8616@gmail.com"
] | jackey8616@gmail.com |
2e08bee6035d31c23a02f134ee9d00d9939c1a01 | 636a49054c30ee15ff78746f7e720172af08c0f9 | /airbd-api/src/main/java/com/airboard/api/config/PermissionCollect.java | 8ceefbbf6a8852a9430aa880530c448e7c4ae054 | [] | no_license | w10511026/AirBoard | 661ccba501cd0bd65850e2ea6f73d84f08c429ce | dde75e91a45a5c6c463ee3a7d6e74edf8e7c98fd | refs/heads/master | 2020-03-21T15:02:41.143489 | 2018-12-06T09:44:49 | 2018-12-06T09:44:49 | 138,691,091 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,140 | java | package com.airboard.api.config;
import com.airboard.api.model.system.SysPermission;
import com.airboard.api.service.system.SysPermissionService;
import com.airboard.core.annotation.BasePermission;
import com.airboard.core.enums.PermissionTypeEnum;
import com.airboard.core.util.NumberUtils;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import java.lang.reflect.Method;
/**
* @Description 启动时收集所有的权限菜单
*/
@Log4j2
@Component
public class PermissionCollect implements BeanPostProcessor {
@Autowired
private SysPermissionService sysPermissionService;
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
Method[] methods = ReflectionUtils.getAllDeclaredMethods(bean.getClass());
if (ArrayUtils.isNotEmpty(methods)) {
for (Method method : methods) {
BasePermission basePermission = AnnotationUtils.findAnnotation(method, BasePermission.class);
if (null != basePermission) {
String permission = basePermission.value();
Integer count = sysPermissionService.countByPermission(permission);
if (NumberUtils.isEmpty(count)) {
RequestMapping clazzUrl = AnnotationUtils.findAnnotation(bean.getClass(), RequestMapping.class);
RequestMapping methodUrl = AnnotationUtils.findAnnotation(method, RequestMapping.class);
String requestUrl = "";
if (null != clazzUrl && null != methodUrl) {
requestUrl = clazzUrl.value()[0] + methodUrl.value()[0];
}
SysPermission sysPermission = new SysPermission();
sysPermission.setName(basePermission.name());
sysPermission.setPermission(permission);
sysPermission.setParentId(basePermission.parent());
if (basePermission.isMenu()) {
sysPermission.setType(PermissionTypeEnum.MENU.type);
} else {
sysPermission.setType(PermissionTypeEnum.PERMISSION.type);
}
sysPermission.setUrl(requestUrl);
sysPermissionService.save(sysPermission);
}
}
}
}
return bean;
}
}
| [
"Wangshuo"
] | Wangshuo |
86e16c8c4b67e7c784edfbe45f7d9ef536075eb5 | a6d25db048e1e0e3f51245cf3623f9e67a120115 | /src/com/atguigu/test/UserServiceTest.java | 84b1e3b519df49049d21bc3bf95260085badf679 | [] | no_license | YUEXINGBAIWAN/book-web | b1d870a20b2da6dd33fc5c86f3bd720fe0e7ce4f | 64c3b319767f8401391914006a5aa2fdcb4fcd29 | refs/heads/master | 2023-07-16T07:36:34.380230 | 2021-09-06T11:34:57 | 2021-09-06T11:34:57 | 403,598,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 823 | java | package com.atguigu.test;
import com.atguigu.pojo.User;
import com.atguigu.service.UserService;
import com.atguigu.service.impl.UserServiceImpl;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* @author shkstart
* @create 2021-08-25 9:27
*/
public class UserServiceTest {
UserService userService = new UserServiceImpl();
@Test
public void registUser() {
userService.registUser(new User(null, "wdf", "123456", "wdf123@qq.com"));
}
@Test
public void login() {
System.out.println(userService.login(new User(null, "chp1", "123456", null)));
}
@Test
public void existUsername() {
if (userService.existUsername("root")){
System.out.println("用户名存在");
}else{
System.out.println("可用");
}
}
} | [
"1272356245@qq.com"
] | 1272356245@qq.com |
18923c9ea08a723e4238f1767187131f03f62493 | 31703986366e1ea30ea2ad4639fd2d854817dc74 | /java-basic/src/main/java/bitcamp/java100/ch07/ex2/Test1.java | fd9e79b87c52aac4671172a5b5291d5466b5478b | [] | no_license | ji881111/bitcamp | 8c793d14d67b8646a7f9747cc34df795fe7aaca6 | 59b511dd8e5609a00e5e5f7af8d976216f8c0e29 | refs/heads/master | 2021-09-08T21:28:39.953027 | 2018-03-12T10:18:28 | 2018-03-12T10:18:28 | 104,423,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package bitcamp.java100.ch07.ex2;
public class Test1 {
public static void main(String[] args) {
Calculator calc = new Calculator();
calc.result=10;
calc.multiple(2);
calc.multiple(3);
calc.divide(10);
System.out.println(calc.result);
}
}
| [
"ji881111@naver.com"
] | ji881111@naver.com |
d6d0468423874f65bb2ff3f4874ad614cef83241 | a8e9047dc58e191ff1beaf06fcfde58d3b5675cc | /src/java/net/eckenfels/etotp/Base32.java | e26158d4d47ea127b8fb1d091de6dc3a84c9e9f7 | [] | no_license | Svangorden/et-otp | 2f91e5d6992c0b73d9f4e36c1fb4108954a30153 | eedb19ce0a6eb165b48b3b46cc382aed4c665029 | refs/heads/master | 2021-01-18T11:20:58.662970 | 2012-02-21T02:53:59 | 2012-02-21T02:53:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,788 | java | /*
* Base32.java - et-otp: GPL Java TOTP soft token by Bernd Eckenfels.
*/
package net.eckenfels.etotp;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* Encodes arbitrary byte arrays as case-insensitive BASE32 strings.
* <P>
* This is based on the Google code from Steve Weis and Neal Gafter
* http://code.google.com/p/google-authenticator/source/browse/mobile/android/src/com/google/android/apps/authenticator/Base32String.java
*/
public class Base32
{
private static final Base32 INSTANCE = new Base32();
private final char[] DIGITS;
private final int MASK;
private final int SHIFT;
private final Map<Character, Integer> CHAR_MAP;
protected Base32()
{
DIGITS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".toCharArray(); // RFC 4668/3548
MASK = DIGITS.length - 1;
SHIFT = Integer.numberOfTrailingZeros(DIGITS.length);
CHAR_MAP = new HashMap<Character, Integer>(DIGITS.length);
for (int i = 0; i < DIGITS.length; i++)
{
CHAR_MAP.put(DIGITS[i], i);
}
}
public static Base32 getInstance()
{
return INSTANCE;
}
public static byte[] decode(String encoded)
throws DecodingException
{
return getInstance().decodeInternal(encoded);
}
protected byte[] decodeInternal(String encodedArg)
throws DecodingException
{
// Remove all '-', ' ', '.' (seperators, trimming). Might throw NPE if encodedArg is null
String encoded = encodedArg.replaceAll("-? ?\\.?", "");
// Canonicalize to all upper case
encoded = encoded.toUpperCase(Locale.ENGLISH);
encoded = encoded.replaceAll("8", "B").replaceAll("1", "I");
if (encoded.length() == 0) {
return new byte[0];
}
int encodedLength = encoded.length();
int outLength = encodedLength * SHIFT / 8;
byte[] result = new byte[outLength];
int buffer = 0;
int next = 0;
int bitsLeft = 0;
for (char c : encoded.toCharArray())
{
Integer i = CHAR_MAP.get(c);
if (i==null) {
throw new DecodingException("Illegal character: " + c);
}
buffer <<= SHIFT;
buffer |= i.intValue() & MASK;
bitsLeft += SHIFT;
if (bitsLeft >= 8) {
result[next++] = (byte) (buffer >> (bitsLeft - 8));
bitsLeft -= 8;
}
}
// We'll ignore leftover bits for now.
// if (next != outLength || bitsLeft >= SHIFT) {
// throw new DecodingException("Bits left: " + bitsLeft);}
return result;
}
public static String encode(byte[] data)
{
return getInstance().encodeInternal(data);
}
protected String encodeInternal(byte[] data)
{
if (data.length == 0) {
return "";
}
// SHIFT is the number of bits per output character, so the length of the
// output is the length of the input multiplied by 8/SHIFT, rounded up.
if (data.length >= (1 << 28)) {
// The computation below will fail, so don't do it.
throw new IllegalArgumentException();
}
int outputLength = (data.length * 8 + SHIFT - 1) / SHIFT;
StringBuilder result = new StringBuilder(outputLength);
int buffer = data[0];
int next = 1;
int bitsLeft = 8;
while (bitsLeft > 0 || next < data.length) {
if (bitsLeft < SHIFT) {
if (next < data.length) {
buffer <<= 8;
buffer |= (data[next++] & 0xff);
bitsLeft += 8;
} else {
int pad = SHIFT - bitsLeft;
buffer <<= pad;
bitsLeft += pad;
}
}
int index = MASK & (buffer >> (bitsLeft - SHIFT));
bitsLeft -= SHIFT;
result.append(DIGITS[index]);
}
return result.toString();
}
static class DecodingException extends Exception
{
/** field <code>serialVersionUID</code> */
private static final long serialVersionUID = 20111119L;
public DecodingException(String message)
{
super(message);
}
}
}
| [
"bernd@eckenfels.net"
] | bernd@eckenfels.net |
681d75faa734c920002112f344ee188dbebcab00 | 5fe6550bdf1f168e1a7207000b369d0ced3ca0ad | /analysisTools/src/main/java/insertionsort/InsertionSortPone3.java | 79ae6dde10a8f266785a3b809c76bd997ee4959b | [] | no_license | btellstrom/analysisToolsKex | 33b52c0ed1c78f71591ffdf5fdc61e462353c682 | 9958f01bee085ffe7a9cdcf9688fc7bd8b44bc36 | refs/heads/master | 2020-03-10T11:07:09.873311 | 2018-06-08T05:01:48 | 2018-06-08T05:01:48 | 129,349,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package insertionsort;
public class InsertionSortPone3 {
public static int[] sort(int[] array) {
for (int i = 1; i < array.length; i++) {
int temp = array[i];
int j = i - 1;
while (j >= 0 && array[j] > temp+1) { //PONE
array[j + 1] = array[j];
j--;
}
array[j + 1] = temp;
}
return array;
}
} | [
"benjamin.tellstrom@gmail.com"
] | benjamin.tellstrom@gmail.com |
b80ab81abb7d9fa27529a0ba381a644238215c48 | 6855aa4d7c44462fd817d188a3241885534add4c | /JavaBasic/java10_collection/ComparatorEx.java | 2c504bfbb4be909cd9f914dd04ef7421c6167e44 | [] | no_license | GuDongyeong/Java_Study | e42bbb15afdebcd3adbb9d8b6a6c767c558e62e6 | 072ecc9bc614a21766a00a90e2fecd5d7033ec90 | refs/heads/master | 2021-05-19T08:10:29.526108 | 2020-06-10T03:52:47 | 2020-06-10T03:52:47 | 252,118,177 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,956 | java | package java10_collection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class ComparatorEx {
public static void main(String[] args) {
Person p1 = new Person(2, "Alice", "Swimming");
Person p2 = new Person(3, "Andy", "Soccer");
Person p3 = new Person(1, "Kim", "Golf");
List<Person> list = new ArrayList<>();
list.add( p1 );
list.add( p2 );
list.add( p3 );
// 정렬 전 출력
for( Person p : list) {
System.out.println( p );
}
Comparator<Person> comp = new Comparator<Person>() {
@Override
public int compare(Person o1, Person o2) {
// 반환값
// 음수 : o1의 데이터가 작다, 정렬할 때 앞으로 보낸다
// 0 : o1 과 o2의 데이터가 같다
// 양수 : o1 의 데이터가 크다, 정렬할 때 뒤로 보낸다
// no 를 기준으로 오름차순 정렬
// if( o1.getNo() < o2.getNo() ) {
// return -1;
// }else if( o1.getNo() > o2.getNo() ) {
// return 1;
// }else {
// return 0;
// }
// no 를 기준으로 내림차순 정렬
// if( o1.getNo() < o2.getNo() ) {
// return 1;
// }else if( o1.getNo() > o2.getNo() ) {
// return -1;
// }else {
// return 0;
// }
//----------------------------------------
// "String".compareTo("String") : ASCII 코드 기반 왼쪽이 작으면 음수, 크면 양수 반환
//name을 기준으로 오름차순 정렬
// if( o1.getName().compareTo(o2.getName() ) < 0 ){//왼쪽이 작은 경우
// return -1; // 정렬할 때 앞으로 보내기
// } else if( o1.getName().compareTo(o2.getName() ) > 0 ) { // 왼쪽이 큰 경우
// return 1; // 정렬할 때 뒤로 보내기
// } else {
// return 0;
// }
//name을 기준으로 내림차순 정렬
// if( o1.getName().compareTo(o2.getName() ) < 0 ){//왼쪽이 작은 경우
// return 1; // 정렬할 때 뒤로 보내기
// } else if( o1.getName().compareTo(o2.getName() ) > 0 ) { // 왼쪽이 큰 경우
// return -1; // 정렬할 때 앞으로 보내기
// } else {
// return 0;
// }
// hobby를 기준으로 오름차순 정렬
// if( o1.getHobby().compareTo(o2.getHobby()) <0 ) {
// return -1;
// } else if ( o1.getHobby().compareTo(o2.getHobby()) > 0 ) {
// return 1;
// } else {
// return 0;
// }
// hobby를 기준으로 내림차순 정렬
if( o1.getHobby().compareTo(o2.getHobby()) <0 ) {
return 1;
} else if ( o1.getHobby().compareTo(o2.getHobby()) > 0 ) {
return -1;
} else {
return 0;
}
}
};
// compare 메소드가 있어야만 정렬을 수행한다. compare메소드는 우리가 직접 구현
Collections.sort(list, comp);
System.out.println("-------");
// 정렬 후 출력
for( Person p : list) {
System.out.println( p );
}
}
}
| [
"noreply@github.com"
] | GuDongyeong.noreply@github.com |
4e40cde3f8de7e4e0889dcdff1a40eb749790a3f | 39b49d355249f5807007b9415b875afe881674db | /FlowControl/3.java | 178ba78e4431ef9798300b5ed5b09f585465d8ba | [] | no_license | Chanakacds/Java_example- | 7a3aac8d916d74bd279a24c8043d09f43ff5b695 | a8ec7cd92bca1a6450af84eba3a967adb9dd7536 | refs/heads/master | 2022-11-25T00:20:30.825146 | 2020-07-30T07:49:09 | 2020-07-30T07:49:09 | 281,550,703 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | class A{
public static void main(String [] args){
int x = 2;
if(x == 3){
System.out.println("January");
}else if(x == 2) {
System.out.println("February");
}
}
} | [
"Chnakad.cd@gmail.com"
] | Chnakad.cd@gmail.com |
e6e8e98b7b475a27d396ec26763a650265871976 | 07010d3eb2edde734b4de0685cb69dda290eee68 | /src/StartScreen.java | 3701bcee729e6e1c6958eb22d4a7df2537b7acc3 | [] | no_license | mhnaeem/Game_Of_Chomp | 1b7e4d7c07e525761a14e01357b7a8f857e5c0cd | 13b9a68b1e97334048381a6c32269a199a654ed9 | refs/heads/master | 2020-07-22T12:23:16.842129 | 2019-09-17T21:50:19 | 2019-09-17T21:50:19 | 207,200,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,346 | java | import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
public class StartScreen extends JFrame {
private JLabel mainLbl, wLbl, hLbl;
private JTextField wFld, hFld;
private JButton start, cancel, small, medium, large;
private Container contentPane = getContentPane();
private JPanel mainPanel;
public StartScreen(){
setFrameDetails();
createLabels();
addLabelsToScreen();
createLabels();
createButtons();
addButtonsToScreen();
addButtonFunctionality();
pack();
setVisible(true);
}
private void setFrameDetails(){
setSize(500,300);
setPreferredSize(new Dimension(500,300));
setTitle("Welcome to Game of Chomp");
mainPanel = new JPanel();
contentPane.add(mainPanel);
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
setResizable(false);
}
private void createButtons(){
start = new JButton("Send");
cancel = new JButton("Cancel");
small = new JButton("Small");
medium = new JButton("Medium");
large = new JButton("Large");
}
private void addButtonsToScreen(){
//Dimensions for the button panels
Dimension size = new Dimension(500, 150);
JPanel btnPan = new JPanel();
btnPan.setPreferredSize(size);
btnPan.setLayout(new FlowLayout());
JPanel btnPan1 = new JPanel();
btnPan1.setPreferredSize(size);
btnPan1.setLayout(new FlowLayout());
btnPan1.add(small);
btnPan1.add(medium);
btnPan1.add(large);
btnPan.add(start);
btnPan.add(cancel);
mainPanel.add(btnPan1);
mainPanel.add(btnPan);
}
private void createLabels(){
mainLbl = new JLabel("Welcome to Chomp");
wLbl = new JLabel("Desired Columns: ");
hLbl = new JLabel("Desired Rows: ");
}
private void addLabelsToScreen(){
Dimension size = new Dimension(500, 100);
JPanel mainLblPan = new JPanel();
mainLblPan.setPreferredSize(size);
mainLbl.setFont(new Font(Font.SERIF, Font.BOLD, 20));
mainLbl.setAlignmentX(Font.CENTER_BASELINE);
mainLblPan.add(mainLbl);
mainPanel.add(mainLblPan);
JPanel wPan = new JPanel();
wPan.setPreferredSize(size);
wPan.setLayout(new FlowLayout());
wFld = new JTextField(30);
wPan.add(wLbl);
wPan.add(wFld);
mainPanel.add(wPan);
JPanel hPan = new JPanel();
hPan.setPreferredSize(size);
hPan.setLayout(new FlowLayout());
hFld = new JTextField(30);
hPan.add(hLbl);
hPan.add(hFld);
mainPanel.add(hPan);
}
private void addButtonFunctionality(){
cancel.addActionListener((ActionEvent ev) -> {
System.exit(0);
});
small.addActionListener((ActionEvent ev) -> {
hFld.setText("4");
wFld.setText("4");
start.doClick();
});
medium.addActionListener((ActionEvent ev) -> {
hFld.setText("4");
wFld.setText("6");
start.doClick();
});
large.addActionListener((ActionEvent ev) -> {
hFld.setText("4");
wFld.setText("10");
start.doClick();
});
start.addActionListener((ActionEvent ev) -> {
try {
if (!(Integer.parseInt(wFld.getText()) > 0) && !(Integer.parseInt(hFld.getText()) > 0)) {
JOptionPane.showMessageDialog(null, "Columns or Rows are less than or equal to 0", "Error!", JOptionPane.ERROR_MESSAGE);
}
else {
new GameAI(Integer.parseInt(wFld.getText()), Integer.parseInt(hFld.getText()));
StartScreen.this.dispose();
}
}
catch (NumberFormatException e){
JOptionPane.showMessageDialog(null, "Columns and Rows should be numbers", "Error!", JOptionPane.ERROR_MESSAGE);
}
});
//Set start button as default key
JRootPane rootPane = getRootPane();
rootPane.setDefaultButton(start);
}
public static void main(String[] args) {
new StartScreen();
}}
| [
"mhnaeem@mun.ca"
] | mhnaeem@mun.ca |
a6237140d448f124ff82a1db7abe1f34d33f01c0 | 758031fc2e05545443edfd17c3a07fe0a49252ed | /Android/TP/Module03/Module03-3/AndroKado/app/src/main/java/fr/eni/ecole/androkado/MainActivity.java | bf959f4a02829fb205f7e3fd3c2a7f8f9609167e | [] | no_license | lanaflonPerso/ENI-Project-s | 1715c3081e5118201efd778658da61027e981c2e | add39af06c461dd528391d6267755c4914c54cf9 | refs/heads/master | 2020-12-04T01:18:39.449457 | 2019-12-04T08:36:58 | 2019-12-04T08:36:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,017 | java | package fr.eni.ecole.androkado;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import fr.eni.ecole.androkado.bll.ArticleManager;
import fr.eni.ecole.androkado.bo.Article;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "TAG_ANDROKADO";
private Article article = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
article = ArticleManager.getArticle(1);
TextView tvNom = findViewById(R.id.tv_article);
TextView tvDescription = findViewById(R.id.tv_description);
TextView tvPrix = findViewById(R.id.tv_prix);
RatingBar rating = findViewById(R.id.rating_article);
ToggleButton toggle = findViewById(R.id.btn_achete);
CheckBox ckActive = findViewById(R.id.ck_active);
tvNom.setText(article.getNom());
tvDescription.setText(article.getDescription());
tvPrix.setText(String.valueOf(article.getPrix()));
rating.setRating(article.getNote());
toggle.setChecked(article.isAchete());
ckActive.setChecked(article.isActive());
}
public void onClickUrl(View view)
{
//Toast.makeText(this, article.getUrl(), Toast.LENGTH_LONG).show();
Intent intent = new Intent(MainActivity.this
,InfoUrlActivity.class);
//Transférer l'article à la seconde activité
intent.putExtra("article", article);
startActivity(intent);
}
public void onClickAchat(View view)
{
article.setAchete(!article.isAchete());
Log.i(TAG,"L'article est il acheté : "
+ ((ToggleButton)view).isChecked());
}
@Override
public void onBackPressed() {
//super.onBackPressed();
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Quitter")
.setMessage("Voulez-vous quitter l'application?")
.setCancelable(false)
.setPositiveButton("Oui", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MainActivity.super.onBackPressed();
}
})
.setNegativeButton("Non", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
}).show();
}
}
| [
"quentin.martinez2018@campus-eni.fr"
] | quentin.martinez2018@campus-eni.fr |
c8c2fab10a4d1e9b87516f61f7933cb9f0715886 | 196e65068c62a44730ebc0c4af799516a1efc902 | /busanbus/src/com/kmshack/BusanBus/database/Constants.java | 1ad86f72594895e22209da88a847eda79b1d7e54 | [] | no_license | moonsungpark/Busanbus-Android-master | 979bab1167eb6258b314997b1f33ec1bd4223b3e | af86e434d8d6d5b34976e64b118e9b1ef073f480 | refs/heads/master | 2021-08-23T14:13:53.825956 | 2017-12-05T06:26:41 | 2017-12-05T06:26:41 | 113,142,286 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 993 | java | package com.kmshack.BusanBus.database;
import android.provider.BaseColumns;
public final class Constants implements BaseColumns{
private Constants(){
}
public static final class UserData implements BaseColumns {
private UserData() {
}
// DB name & version
public static final String DB_NAME = "BusFavorite.kms";
public static final int DB_VERSION = 3;
// Table name
public static final String FAVORITE ="Favorite";
public static final String FAVORITE2 ="Favorite2";
public static final String NOSUN ="NOSUN";
public static final String STOPID ="STOPID";
public static final String STOPNAME ="STOPNAME";
public static final String UPDOWN ="UPDOWN";
public static final String REALTIME ="REALTIME";
public static final String ORD ="ORD";
//DB_VERSION 3ºÎÅÍ Àû¿ë
public static final String ORDERING ="ORDERING";
public static final String NOSUNNAME ="NOSUNNAME";
public static final String NOSUNNO ="NOSUNNO";
}
}
| [
"jinmeiluo888@gmail.com"
] | jinmeiluo888@gmail.com |
5feea4c88ddda2e6758725f1c097e759b32687f3 | 8075842e8ebd7812c9635c20b8e19ce83277b4ba | /chapter21-invade/src/test/java/me/kafeitu/activiti/chapter7/engine/ProcessEngineConfigurationTest.java | 0e461b40a6239836f59c21e6fe32117234a7ff5b | [
"Apache-2.0"
] | permissive | zengqingfa88/activiti-in-action-code | 6159a7781d79de39f05c92bab8524279b4d93291 | a7dd3240da86daf6f7d252445634f9957c6f269e | refs/heads/master | 2022-07-23T06:56:37.786466 | 2019-10-24T07:03:19 | 2019-10-24T07:03:19 | 217,230,037 | 1 | 0 | Apache-2.0 | 2022-07-08T19:05:04 | 2019-10-24T06:43:50 | Java | UTF-8 | Java | false | false | 1,849 | java | package me.kafeitu.activiti.chapter7.engine;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.ProcessEngines;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/* 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.
*/
/**
* @author henryyan
*/
public class ProcessEngineConfigurationTest {
@Test
public void userDefaultName() {
ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().buildProcessEngine();
System.out.println(processEngine.hashCode());
assertEquals("default", processEngine.getName());
}
/**
* 此测试会失败,因为本例没有配置oracle驱动
*/
@Test
public void specialName() {
ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault().setProcessEngineName("oracleEngine").setJdbcDriver("oracle.jdbc.Driver")
.setJdbcUrl("jdbc:oracle:thin:@localhost:1521:XE").setJdbcUsername("dbusername").setJdbcPassword("password").setDatabaseType("oracle")
.buildProcessEngine();
ProcessEngine oracleEngine = ProcessEngines.getProcessEngine("oracleEngine");
assertNotNull(oracleEngine);
}
}
| [
"1658666509@qq.com"
] | 1658666509@qq.com |
56f671d870b414a40680f095a7590b0ebbf648f3 | d41c9f8c0ea11d53dd9ef9f842cdc5afd02f9d12 | /BAE/Tests/MOCKITO/test/xlCollaborationservletTest.java | 68b29c9a71a774c202e374349457fd93cbf36d6f | [] | no_license | rahulvaradkar/RestApiV2DesignForJenkin | 429e32c66a684ce7e7acf12411ea28415f0fce0b | b132434cc7ab4a33f7c1fc1ac60231d3f607ea53 | refs/heads/master | 2020-03-28T19:49:04.861943 | 2018-09-22T13:26:51 | 2018-09-22T13:26:51 | 149,012,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,104 | java | package test;
/**
*
* @author Jaydeep bobade
* */
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Reader;
import java.io.StringReader;
import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import servlets.xlCollaborationService;
public class xlCollaborationservletTest
{
@Mock
HttpServletRequest request;
@Mock
HttpServletResponse response;
@Mock
HttpSession session;
@Mock
RequestDispatcher rd;
@Mock
ServletOutputStream servletOut;
public final static String Seperator = new Character((char)1).toString();
@BeforeClass
protected void setUp() throws Exception
{
MockitoAnnotations.initMocks(this);
}
@Test
public void test() throws Exception {
DataSet ds=new DataSet();
Random rand = new Random();
int n = rand.nextInt(100) + 1;
String buffer=ds.getUserId()+Seperator+ds.getUsername()+Seperator+ds.getMemberID()+Seperator+ds.getNHID()+Seperator+"10"+Seperator+ds.getCollabName()+Seperator+ds.getWbName()+Seperator+"testxlcoll_"+n+"";
System.out.println("\nbuffer :"+buffer);
ByteArrayOutputStream bos = new ByteArrayOutputStream ();
ZipOutputStream out = new ZipOutputStream(bos);
out.putNextEntry(new ZipEntry("request.txt"));
out.write(buffer.getBytes("UTF-8"));
out.closeEntry();
out.close ();
bos.close();
// encode to Base64 string
String b64String = Base64.encodeBase64String(bos.toByteArray());
Reader inputString = new StringReader(b64String);
BufferedReader reqbuffer = new BufferedReader(inputString);
when(request.getReader()).thenReturn(reqbuffer);
when(response.getOutputStream()).thenReturn(servletOut);
new xlCollaborationService().service(request, response);
ArgumentCaptor<String> bufferCaptor = ArgumentCaptor.forClass(String.class);
verify(servletOut).print(bufferCaptor.capture());
String responseBody = bufferCaptor.getValue();
ZipInputStream zipIn = new ZipInputStream(new ByteArrayInputStream(Base64.decodeBase64(responseBody.toString().getBytes())));
zipIn.getNextEntry();
StringBuffer sb = new StringBuffer();
ByteArrayOutputStream out1 = new ByteArrayOutputStream();
IOUtils.copy(zipIn, out1);
sb = new StringBuffer();
sb.append(out1.toString("UTF-8"));
String[] res=sb.toString().split(Seperator);
AssertJUnit.assertEquals(2, res.length);
AssertJUnit.assertEquals("Success",res[0]);
}
}
| [
"pranav@techvision.net.in"
] | pranav@techvision.net.in |
54c29643c708ad2b01a87537afe597f43b4ad476 | 7d529f70de982345490f7e66404e0cc37645c50c | /Updated_files__2.8__to__2.9/Android Project (client)/Dating App/app/src/main/java/ru/ifsoft/chat/constants/Constants.java | 0c09e4a8271c6bf71bf9d310857f5dde35274114 | [] | no_license | LiandroMilani/Dating_Android_Template | 0f023e88669b382306cdc7289ffd6efe758f8ffb | 4ba7a093bbbb8ef8ef9583f835693cc0a72cc01a | refs/heads/master | 2021-01-08T06:19:14.426430 | 2019-10-16T07:13:54 | 2019-10-16T07:13:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,120 | java | package ru.ifsoft.chat.constants;
public interface Constants {
public static final Boolean EMOJI_KEYBOARD = true; // false = Do not display your own Emoji keyboard | true = allow display your own Emoji keyboard
public static final Boolean FACEBOOK_AUTHORIZATION = true; // false = Do not show buttons Login/Signup with Facebook | true = allow display buttons Login/Signup with Facebook
public static final Boolean WEB_SITE_AVAILABLE = false; // false = Do not show menu items (Open in browser, Copy profile link) in profile page | true = show menu items (Open in browser, Copy profile link) in profile page
public static final Boolean GOOGLE_PAY_TEST_BUTTON = false; // false = Do not show google pay test button in section upgrades
public static final int VIDEO_FILE_MAX_SIZE = 7340035; //Max size for video file in bytes | For example 5mb = 5*1024*1024
// Google Pay settings | Settings from In-App Purchasing for Android | See documentation
public static final String BILLING_KEY = "MIIBIjANBgkqhkiG9w0BAQDFGGTHH1TGHT";
public static final String CLIENT_ID = "1"; //Client ID | For identify the application | Example: 12567
public static final String API_DOMAIN = "http://chat.ifsoft.ru/"; //url address to which the application sends requests
public static final String API_FILE_EXTENSION = ".inc.php";
public static final String API_VERSION = "v2";
public static final String METHOD_NOTIFICATIONS_CLEAR = API_DOMAIN + "api/" + API_VERSION + "/method/notifications.clear" + API_FILE_EXTENSION;
public static final String METHOD_GUESTS_CLEAR = API_DOMAIN + "api/" + API_VERSION + "/method/guests.clear" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_GET_SETTINGS = API_DOMAIN + "api/" + API_VERSION + "/method/account.getSettings" + API_FILE_EXTENSION;
public static final String METHOD_DIALOGS_GET = API_DOMAIN + "api/" + API_VERSION + "/method/dialogs.get" + API_FILE_EXTENSION;
public static final String METHOD_DIALOGS_NEW_GET = API_DOMAIN + "api/" + API_VERSION + "/method/dialogs_new.get" + API_FILE_EXTENSION;
public static final String METHOD_CHAT_UPDATE = API_DOMAIN + "api/" + API_VERSION + "/method/chat.update" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_LOGIN = API_DOMAIN + "api/" + API_VERSION + "/method/account.signIn" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SIGNUP = API_DOMAIN + "api/" + API_VERSION + "/method/account.signUp" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_AUTHORIZE = API_DOMAIN + "api/" + API_VERSION + "/method/account.authorize" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_ADD_FUNDS = API_DOMAIN + "api/" + API_VERSION + "/method/account.addFunds" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SET_GCM_TOKEN = API_DOMAIN + "api/" + API_VERSION + "/method/account.setGcmToken" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_LOGINBYFACEBOOK = API_DOMAIN + "api/" + API_VERSION + "/method/account.signInByFacebook" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_RECOVERY = API_DOMAIN + "api/" + API_VERSION + "/method/account.recovery" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SETPASSWORD = API_DOMAIN + "api/" + API_VERSION + "/method/account.setPassword" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_DEACTIVATE = API_DOMAIN + "api/" + API_VERSION + "/method/account.deactivate" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SAVE_SETTINGS = API_DOMAIN + "api/" + API_VERSION + "/method/account.saveSettings" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_CONNECT_TO_FACEBOOK = API_DOMAIN + "api/" + API_VERSION + "/method/account.connectToFacebook" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_DISCONNECT_FROM_FACEBOOK = API_DOMAIN + "api/" + API_VERSION + "/method/account.disconnectFromFacebook" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_LOGOUT = API_DOMAIN + "api/" + API_VERSION + "/method/account.logOut" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SET_ALLOW_MESSAGES = API_DOMAIN + "api/" + API_VERSION + "/method/account.setAllowMessages" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SET_GEO_LOCATION = API_DOMAIN + "api/" + API_VERSION + "/method/account.setGeoLocation" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_UPLOADPHOTO = API_DOMAIN + "api/" + API_VERSION + "/method/account.uploadPhoto" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SET_ALLOW_PHOTOS_COMMENTS = API_DOMAIN + "api/" + API_VERSION + "/method/account.setAllowPhotosComments" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SET_GHOST_MODE = API_DOMAIN + "api/" + API_VERSION + "/method/account.setGhostMode" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SET_VERIFIED_BADGE = API_DOMAIN + "api/" + API_VERSION + "/method/account.setVerifiedBadge" + API_FILE_EXTENSION;
public static final String METHOD_ACCOUNT_SET_DISABLE_ADS = API_DOMAIN + "api/" + API_VERSION + "/method/account.disableAds" + API_FILE_EXTENSION;
public static final String METHOD_SUPPORT_SEND_TICKET = API_DOMAIN + "api/" + API_VERSION + "/method/support.sendTicket" + API_FILE_EXTENSION;
public static final String METHOD_SETTINGS_LIKES_GCM = API_DOMAIN + "api/" + API_VERSION + "/method/account.setAllowLikesGCM" + API_FILE_EXTENSION;
public static final String METHOD_SETTINGS_COMMENTS_GCM = API_DOMAIN + "api/" + API_VERSION + "/method/account.setAllowCommentsGCM" + API_FILE_EXTENSION;
public static final String METHOD_SETTINGS_FOLLOWERS_GCM = API_DOMAIN + "api/" + API_VERSION + "/method/account.setAllowFollowersGCM" + API_FILE_EXTENSION;
public static final String METHOD_SETTINGS_MESSAGES_GCM = API_DOMAIN + "api/" + API_VERSION + "/method/account.setAllowMessagesGCM" + API_FILE_EXTENSION;
public static final String METHOD_SETTINGS_GIFTS_GCM = API_DOMAIN + "api/" + API_VERSION + "/method/account.setAllowGiftsGCM" + API_FILE_EXTENSION;
public static final String METHOD_SETTINGS_COMMENT_REPLY_GCM = API_DOMAIN + "api/" + API_VERSION + "/method/account.setAllowCommentReplyGCM" + API_FILE_EXTENSION;
public static final String METHOD_SETTINGS_PRIVACY = API_DOMAIN + "api/" + API_VERSION + "/method/account.privacy" + API_FILE_EXTENSION;
public static final String METHOD_PROFILE_GET = API_DOMAIN + "api/" + API_VERSION + "/method/profile.get" + API_FILE_EXTENSION;
public static final String METHOD_PROFILE_FOLLOW = API_DOMAIN + "api/" + API_VERSION + "/method/profile.follow" + API_FILE_EXTENSION;
public static final String METHOD_PROFILE_REPORT = API_DOMAIN + "api/" + API_VERSION + "/method/profile.report" + API_FILE_EXTENSION;
public static final String METHOD_PROFILE_UPLOADPHOTO = API_DOMAIN + "api/" + API_VERSION + "/method/profile.uploadPhoto" + API_FILE_EXTENSION;
public static final String METHOD_PROFILE_UPLOADCOVER = API_DOMAIN + "api/" + API_VERSION + "/method/profile.uploadCover" + API_FILE_EXTENSION;
public static final String METHOD_WALL_GET = API_DOMAIN + "api/" + API_VERSION + "/method/wall.get" + API_FILE_EXTENSION;
public static final String METHOD_PROFILE_FANS_GET = API_DOMAIN + "api/" + API_VERSION + "/method/profile.getFans" + API_FILE_EXTENSION;
public static final String METHOD_PROFILE_PEOPLE_NEARBY_GET = API_DOMAIN + "api/" + API_VERSION + "/method/profile.getPeopleNearby" + API_FILE_EXTENSION;
public static final String METHOD_PROFILE_ILIKED_GET = API_DOMAIN + "api/" + API_VERSION + "/method/profile.getILiked" + API_FILE_EXTENSION;
public static final String METHOD_PROFILE_LIKE = API_DOMAIN + "api/" + API_VERSION + "/method/profile.like" + API_FILE_EXTENSION;
public static final String METHOD_BLACKLIST_GET = API_DOMAIN + "api/" + API_VERSION + "/method/blacklist.get" + API_FILE_EXTENSION;
public static final String METHOD_BLACKLIST_ADD = API_DOMAIN + "api/" + API_VERSION + "/method/blacklist.add" + API_FILE_EXTENSION;
public static final String METHOD_BLACKLIST_REMOVE = API_DOMAIN + "api/" + API_VERSION + "/method/blacklist.remove" + API_FILE_EXTENSION;
public static final String METHOD_FRIENDS_GET = API_DOMAIN + "api/" + API_VERSION + "/method/friends.get" + API_FILE_EXTENSION;
public static final String METHOD_FRIENDS_ACCEPT = API_DOMAIN + "api/" + API_VERSION + "/method/friends.acceptRequest" + API_FILE_EXTENSION;
public static final String METHOD_FRIENDS_REJECT = API_DOMAIN + "api/" + API_VERSION + "/method/friends.rejectRequest" + API_FILE_EXTENSION;
public static final String METHOD_FRIENDS_REMOVE = API_DOMAIN + "api/" + API_VERSION + "/method/friends.remove" + API_FILE_EXTENSION;
public static final String METHOD_NOTIFICATIONS_GET = API_DOMAIN + "api/" + API_VERSION + "/method/notifications.get" + API_FILE_EXTENSION;
public static final String METHOD_APP_CHECKUSERNAME = API_DOMAIN + "api/" + API_VERSION + "/method/app.checkUsername" + API_FILE_EXTENSION;
public static final String METHOD_APP_TERMS = API_DOMAIN + "api/" + API_VERSION + "/method/app.terms" + API_FILE_EXTENSION;
public static final String METHOD_APP_THANKS = API_DOMAIN + "api/" + API_VERSION + "/method/app.thanks" + API_FILE_EXTENSION;
public static final String METHOD_APP_SEARCH = API_DOMAIN + "api/" + API_VERSION + "/method/app.search" + API_FILE_EXTENSION;
public static final String METHOD_APP_SEARCH_PRELOAD = API_DOMAIN + "api/" + API_VERSION + "/method/app.searchPreload" + API_FILE_EXTENSION;
public static final String METHOD_ITEMS_LIKE = API_DOMAIN + "api/" + API_VERSION + "/method/items.like" + API_FILE_EXTENSION;
public static final String METHOD_PHOTOS_REMOVE = API_DOMAIN + "api/" + API_VERSION + "/method/photos.remove" + API_FILE_EXTENSION;
public static final String METHOD_PHOTOS_GET = API_DOMAIN + "api/" + API_VERSION + "/method/photos.get" + API_FILE_EXTENSION;
public static final String METHOD_PHOTOS_NEW = API_DOMAIN + "api/" + API_VERSION + "/method/photos.new" + API_FILE_EXTENSION;
public static final String METHOD_PHOTOS_REPORT = API_DOMAIN + "api/" + API_VERSION + "/method/photos.report" + API_FILE_EXTENSION;
public static final String METHOD_PHOTOS_UPLOAD_IMG = API_DOMAIN + "api/" + API_VERSION + "/method/photos.uploadImg" + API_FILE_EXTENSION;
public static final String METHOD_VIDEO_UPLOAD = API_DOMAIN + "api/" + API_VERSION + "/method/video.upload" + API_FILE_EXTENSION;
public static final String METHOD_PHOTOS_STREAM = API_DOMAIN + "api/" + API_VERSION + "/method/photos.stream" + API_FILE_EXTENSION;
public static final String METHOD_PHOTOS_FEED = API_DOMAIN + "api/" + API_VERSION + "/method/photos.feed" + API_FILE_EXTENSION;
public static final String METHOD_IMAGE_GET = API_DOMAIN + "api/" + API_VERSION + "/method/images.get" + API_FILE_EXTENSION;
public static final String METHOD_IMAGE_COMMENTS_NEW = API_DOMAIN + "api/" + API_VERSION + "/method/images.comment" + API_FILE_EXTENSION;
public static final String METHOD_IMAGE_COMMENTS_REMOVE = API_DOMAIN + "api/" + API_VERSION + "/method/images.commentRemove" + API_FILE_EXTENSION;
public static final String METHOD_IMAGE_LIKE = API_DOMAIN + "api/" + API_VERSION + "/method/images.like" + API_FILE_EXTENSION;
public static final String METHOD_IMAGE_LIKES = API_DOMAIN + "api/" + API_VERSION + "/method/images.likes" + API_FILE_EXTENSION;
public static final String METHOD_GIFTS_REMOVE = API_DOMAIN + "api/" + API_VERSION + "/method/gifts.remove" + API_FILE_EXTENSION;
public static final String METHOD_GIFTS_GET = API_DOMAIN + "api/" + API_VERSION + "/method/gifts.get" + API_FILE_EXTENSION;
public static final String METHOD_GIFTS_SELECT = API_DOMAIN + "api/" + API_VERSION + "/method/gifts.select" + API_FILE_EXTENSION;
public static final String METHOD_GIFTS_SEND = API_DOMAIN + "api/" + API_VERSION + "/method/gifts.send" + API_FILE_EXTENSION;
public static final String METHOD_GUESTS_GET = API_DOMAIN + "api/" + API_VERSION + "/method/guests.get" + API_FILE_EXTENSION;
public static final String METHOD_CHAT_GET = API_DOMAIN + "api/" + API_VERSION + "/method/chat.get" + API_FILE_EXTENSION;
public static final String METHOD_CHAT_REMOVE = API_DOMAIN + "api/" + API_VERSION + "/method/chat.remove" + API_FILE_EXTENSION;
public static final String METHOD_CHAT_GET_PREVIOUS = API_DOMAIN + "api/" + API_VERSION + "/method/chat.getPrevious" + API_FILE_EXTENSION;
public static final String METHOD_CHAT_GET_NEXT = API_DOMAIN + "api/" + API_VERSION + "/method/chat.getNext" + API_FILE_EXTENSION;
public static final String METHOD_CONVERSATIONS_GET = API_DOMAIN + "api/" + API_VERSION + "/method/conversations.get" + API_FILE_EXTENSION;
public static final String METHOD_MSG_NEW = API_DOMAIN + "api/" + API_VERSION + "/method/msg.new" + API_FILE_EXTENSION;
public static final String METHOD_MSG_UPLOAD_IMG = API_DOMAIN + "api/" + API_VERSION + "/method/msg.uploadImg" + API_FILE_EXTENSION;
public static final int MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE_PHOTO = 1; //WRITE_EXTERNAL_STORAGE
public static final int MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE_COVER = 2; //WRITE_EXTERNAL_STORAGE
public static final int MY_PERMISSIONS_REQUEST_ACCESS_LOCATION = 3; //ACCESS_COARSE_LOCATION
public static final int MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 4; //WRITE_EXTERNAL_STORAGE
public static final String WEB_SITE = "http://chat.ifsoft.ru/"; //web site url address
public static final String APP_TEMP_FOLDER = "chat"; //directory for temporary storage of images from the camera
public static final int GHOST_MODE_COST = 100; //Cost in Credits
public static final int VERIFIED_BADGE_COST = 150; //Cost in Credits
public static final int DISABLE_ADS_COST = 200; //Cost in Credits
public static final int LIST_ITEMS = 20;
public static final int ENABLED = 1;
public static final int DISABLED = 0;
public static final int GCM_ENABLED = 1;
public static final int GCM_DISABLED = 0;
public static final int ADMOB_ENABLED = 1;
public static final int ADMOB_DISABLED = 0;
public static final int COMMENTS_ENABLED = 1;
public static final int COMMENTS_DISABLED = 0;
public static final int MESSAGES_ENABLED = 1;
public static final int MESSAGES_DISABLED = 0;
public static final int ERROR_SUCCESS = 0;
public static final int SEX_MALE = 0;
public static final int SEX_FEMALE = 1;
public static final int SEX_UNKNOWN = 2;
public static final int NOTIFY_TYPE_LIKE = 0;
public static final int NOTIFY_TYPE_FOLLOWER = 1;
public static final int NOTIFY_TYPE_MESSAGE = 2;
public static final int NOTIFY_TYPE_COMMENT = 3;
public static final int NOTIFY_TYPE_COMMENT_REPLY = 4;
public static final int NOTIFY_TYPE_FRIEND_REQUEST_ACCEPTED = 5;
public static final int NOTIFY_TYPE_GIFT = 6;
public static final int NOTIFY_TYPE_IMAGE_COMMENT = 7;
public static final int NOTIFY_TYPE_IMAGE_COMMENT_REPLY = 8;
public static final int NOTIFY_TYPE_IMAGE_LIKE = 9;
public static final int GCM_NOTIFY_CONFIG = 0;
public static final int GCM_NOTIFY_SYSTEM = 1;
public static final int GCM_NOTIFY_CUSTOM = 2;
public static final int GCM_NOTIFY_LIKE = 3;
public static final int GCM_NOTIFY_ANSWER = 4;
public static final int GCM_NOTIFY_QUESTION = 5;
public static final int GCM_NOTIFY_COMMENT = 6;
public static final int GCM_NOTIFY_FOLLOWER = 7;
public static final int GCM_NOTIFY_PERSONAL = 8;
public static final int GCM_NOTIFY_MESSAGE = 9;
public static final int GCM_NOTIFY_COMMENT_REPLY = 10;
public static final int GCM_FRIEND_REQUEST_INBOX = 11;
public static final int GCM_FRIEND_REQUEST_ACCEPTED = 12;
public static final int GCM_NOTIFY_GIFT = 14;
public static final int GCM_NOTIFY_SEEN = 15;
public static final int GCM_NOTIFY_TYPING = 16;
public static final int GCM_NOTIFY_URL = 17;
public static final int GCM_NOTIFY_IMAGE_COMMENT_REPLY = 18;
public static final int GCM_NOTIFY_IMAGE_COMMENT = 19;
public static final int GCM_NOTIFY_IMAGE_LIKE = 20;
public static final int ERROR_LOGIN_TAKEN = 300;
public static final int ERROR_EMAIL_TAKEN = 301;
public static final int ERROR_FACEBOOK_ID_TAKEN = 302;
public static final int ACCOUNT_STATE_ENABLED = 0;
public static final int ACCOUNT_STATE_DISABLED = 1;
public static final int ACCOUNT_STATE_BLOCKED = 2;
public static final int ACCOUNT_STATE_DEACTIVATED = 3;
public static final int ACCOUNT_TYPE_USER = 0;
public static final int ACCOUNT_TYPE_GROUP = 1;
public static final int GALLERY_ITEM_TYPE_IMAGE = 0;
public static final int GALLERY_ITEM_TYPE_VIDEO = 1;
public static final int ERROR_UNKNOWN = 100;
public static final int ERROR_ACCESS_TOKEN = 101;
public static final int ERROR_ACCOUNT_ID = 400;
public static final int UPLOAD_TYPE_PHOTO = 0;
public static final int UPLOAD_TYPE_COVER = 1;
public static final int ACTION_NEW = 1;
public static final int ACTION_EDIT = 2;
public static final int SELECT_POST_IMG = 3;
public static final int VIEW_CHAT = 4;
public static final int CREATE_POST_IMG = 5;
public static final int SELECT_CHAT_IMG = 6;
public static final int CREATE_CHAT_IMG = 7;
public static final int FEED_NEW_POST = 8;
public static final int FRIENDS_SEARCH = 9;
public static final int ITEM_EDIT = 10;
public static final int STREAM_NEW_POST = 11;
public static final int SELECT_PHOTO_IMG = 20;
public static final int CREATE_PHOTO_IMG = 21;
public static final String TAG = "TAG";
public static final String HASHTAGS_COLOR = "#5BCFF2";
} | [
"star.master.1126@outlook.com"
] | star.master.1126@outlook.com |
9d70caa050eda057071100ff4242ac113290a740 | 2c921dc158cef1ad03f2fca35d9b8d05a9c1ac8e | /src/cn/ucai/ship/activity/BaseActivity.java | fcb6f0c597d72379638566f0888e1bfc96d068ec | [
"Apache-2.0"
] | permissive | qililong/ship | fe448cdc3c8e8b88f460245c7fd4f224bd9de245 | 9787cb3d50a1dbf1cc8c1d273a4afae31e7ba65d | refs/heads/master | 2021-01-20T20:21:43.491603 | 2016-06-29T11:51:45 | 2016-06-29T11:51:45 | 62,189,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,505 | java | /**
* Copyright (C) 2013-2014 EaseMob Technologies. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ucai.ship.activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import cn.ucai.ship.applib.controller.HXSDKHelper;
import com.umeng.analytics.MobclickAgent;
public class BaseActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
}
@Override
protected void onResume() {
super.onResume();
// onresume时,取消notification显示
HXSDKHelper.getInstance().getNotifier().reset();
// umeng
MobclickAgent.onResume(this);
}
@Override
protected void onStart() {
super.onStart();
// umeng
MobclickAgent.onPause(this);
}
/**
* 返回
*
* @param view
*/
public void back(View view) {
finish();
}
}
| [
"530505193@qq.com"
] | 530505193@qq.com |
50c65dc709ecb81234cfd7be34257e444f1489ed | 3c347a87f9010d908f11ca4eb69ae80dffe168b0 | /icaro/src/icaro/infraestructura/patronAgenteReactivoSCXML/imp/ItfPercepcionEventos.java | 2e1b717f60b6fcd20633a27b7080bcfe40ca56fa | [] | no_license | CarlosQuintoHuaman/finca | 2441a126c8865feee486631abd83ef3d0767f1ba | aea68d4b0b179a5e18b8ebc351e0fbb3c610ba1c | refs/heads/master | 2021-01-10T18:13:08.614698 | 2009-05-24T19:53:25 | 2009-05-24T19:53:25 | 36,877,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | /*
* IPercepcionAgente.java
*
* Creado en 20 de noviembre de 2007, 11:56
*
*Telefónica I+D. © 2007
*/
package icaro.infraestructura.patronAgenteReactivoSCXML.imp;
import icaro.infraestructura.entidadesBasicas.EventoInput;
/**
* Percepción del agente.
* @author Carlos Rodríguez Fernández
*/
public interface ItfPercepcionEventos {
public void aceptaEvento(EventoInput e);
}
| [
"camilobenito@bbece73a-fde4-11dd-8c4e-4bbb75a408b7"
] | camilobenito@bbece73a-fde4-11dd-8c4e-4bbb75a408b7 |
1b6c72746786fcf4eada1a7fc3a104060863969f | a1c6d69209473d53a3ea377d0f0621a4a42d707a | /openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainMastershipState.java | 129c3e1dc8cc71ea1deda386360fc93029ccc2e8 | [] | no_license | Offo11/OpenDaylight_modul | c7b4e496cfc8d4f4305cfed4b5a92b4349af25af | 326759113327fb19c2cb91956291b32a13446a0e | refs/heads/master | 2020-04-07T00:13:30.918584 | 2018-11-16T18:43:04 | 2018-11-16T18:43:04 | 157,895,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 858 | java | /*
* Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.openflowplugin.api.openflow.lifecycle;
public enum ContextChainMastershipState {
/**
* Device has role MASTER set.
*/
MASTER_ON_DEVICE,
/**
* Initial statics gathering done ok.
*/
INITIAL_GATHERING,
/**
* Initial submit ok.
*/
INITIAL_SUBMIT,
/**
* Initial flow registry fill is done.
*/
INITIAL_FLOW_REGISTRY_FILL,
/**
* Registration of RPC services
*/
RPC_REGISTRATION,
/**
* Check mastership.
*/
CHECK
}
| [
"ofcarovic.tomas@gmail.com"
] | ofcarovic.tomas@gmail.com |
2cdcee97165cef7f559de142c6041adc83e557dc | 52ce1137ab71ce2926b5587d3704e7dd31adc38e | /gof/src/main/java/br/unibh/designpatterns/state/Demo.java | 8e895b5b07cd4c05e54b8a603dcf85722e0edf90 | [] | no_license | jhcruvinel/arqs | 3a5eb6cccb7d811e7e63a8c0be1f8ccc5659c1fe | deda22c5bf74e5685cb06370db13811ab498a908 | refs/heads/master | 2021-01-25T12:43:01.229515 | 2018-06-28T16:25:57 | 2018-06-28T16:25:57 | 123,498,371 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | package br.unibh.designpatterns.state;
public class Demo {
public static void main(String[] args) {
System.out.println("***Demo: State pattern");
System.out.println("Creating: State factory");
StateFactory factory = new StateFactory();
System.out.println("Creating: Context instance with name=file.txt");
Context context = new Context("file.txt", factory);
System.out.println("Adding: Context object to version control");
context.add();
System.out.println("Removing: Context object from version control");
context.revert();
}
}
| [
"jhcru@DESKTOP-OK4V0A9"
] | jhcru@DESKTOP-OK4V0A9 |
474f6756825565938cdad4a6a2f5cfb785123272 | 13550e8fbae589af18a0af93962c10b27ac50ff6 | /src/programmersLevel0/Solution14.java | a49349d45a5d39331592d4732b14996a4ca1dd18 | [] | no_license | SungWoo824/JavaAlgorithm | 824fff65bee375694cbf3272789c113661d9bee2 | 66e7a4893abace8ffa85f7ef1d2a26b28caa51f3 | refs/heads/master | 2023-08-17T07:12:17.690567 | 2023-08-08T14:09:32 | 2023-08-08T14:09:32 | 214,786,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 978 | java | package programmersLevel0;
import java.util.ArrayList;
import java.util.List;
public class Solution14 {
public int[] solution(int n, int[] numlist) {
List<Integer> checkArr = new ArrayList<>();
for (int i : numlist) {
if (i % n == 0) {
checkArr.add(i);
}
}
int[] answer = new int[checkArr.size()];
for (int i = 0 ; i < checkArr.size() ; i++) {
answer[i] = checkArr.get(i);
}
return answer;
}
}
/*
문제 설명
정수 n과 정수 배열 numlist가 매개변수로 주어질 때, numlist에서 n의 배수가 아닌 수들을 제거한 배열을 return하도록 solution 함수를 완성해주세요.
제한사항
1 ≤ n ≤ 10,000
1 ≤ numlist의 크기 ≤ 100
1 ≤ numlist의 원소 ≤ 100,000
입출력 예
n numlist result
3 [4, 5, 6, 7, 8, 9, 10, 11, 12] [6, 9, 12]
5 [1, 9, 3, 10, 13, 5] [10, 5]
12 [2, 100, 120, 600, 12, 12] [120, 600, 12, 12]
*/
| [
"scody1219@gmail.com"
] | scody1219@gmail.com |
8b00a7dd54b2541ff771b6337c2917eef441ced4 | a62474ebf5aa09337adc8c23684f0089d8f19a90 | /src/test/java/io/github/raffaeleflorio/pastryshop/domain/showcase/ShowcaseTest.java | cef75f79f7561fe506073dc32d3664c251a6c1e6 | [] | no_license | raffaeleflorio/pastryshop | 90fc0333195d69350feb61bf55287540e2494f40 | 36ed09fd67130d4f6f7d28c6bca5265102f64e93 | refs/heads/main | 2023-08-29T11:41:43.659403 | 2021-10-03T19:46:58 | 2021-10-03T19:46:58 | 412,739,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 887 | java | package io.github.raffaeleflorio.pastryshop.domain.showcase;
import jakarta.json.Json;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import static io.github.raffaeleflorio.pastryshop.hamcrest.IsThrowedWithMessage.throwsWithMessage;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
class ShowcaseTest {
@Nested
class FakeTest {
@Test
void testDefaultAddingException() {
assertThat(
() -> new Showcase.Fake().add(Json.createObjectBuilder().build(), 123),
throwsWithMessage(IllegalStateException.class, "Unable to add to a fake")
);
}
@Test
void testDefaultDescriptionToEmptyJsonArray() {
var description = Json.createArrayBuilder().build();
assertThat(
new Showcase.Fake().description(),
equalTo(description)
);
}
}
}
| [
"raffaeleflorio@protonmail.com"
] | raffaeleflorio@protonmail.com |
972df0c6cbb417cb4f96c1296c21bb5f7f137a18 | 9cfb58c8bebc04ec1756f2dde392f8e179f53d2a | /src/main/java/de/difuture/ekut/pht/train/office/repository/TrainEntityRepository.java | a61a2be787a45bba11e174981d4f6294aaf0662d | [] | no_license | jbjares/pht-train-office | be40ae6d4065074da33f7887b3130260a1e3e35e | 85290966057a14fe07dc01b0881fb9f6bfd93875 | refs/heads/master | 2020-04-17T18:40:48.166976 | 2018-05-06T18:47:26 | 2018-05-06T18:47:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 260 | java | package de.difuture.ekut.pht.train.office.repository;
import de.difuture.ekut.pht.lib.core.neo4j.entity.Train;
import org.springframework.data.neo4j.repository.Neo4jRepository;
public interface TrainEntityRepository extends Neo4jRepository<Train, Long> {}
| [
"lukas.zimmermann@informatik.uni-tuebingen.de"
] | lukas.zimmermann@informatik.uni-tuebingen.de |
7a28d8487aa8c3192c2edcd134a1e843cdaca36a | d40b5d9524e4eecb5c72b7aab99a1b7fdaaf6398 | /Source Code/MyJavaDev/InfiniteLoop.java | 57bf8f93040e78ffe9ae70680ba8c7c25e209a69 | [
"Unlicense"
] | permissive | HelloHadi/JavaTraining | 9380c4edfaff39fd78a4d137e16f54728520d9ee | b815f3d2ce9ee7d4abaf406805ebdbc843160266 | refs/heads/master | 2021-01-24T04:13:03.578796 | 2018-02-26T06:43:05 | 2018-02-26T06:43:05 | 122,925,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | // Infinite for Loop
class InfiniteLoop {
public static void main(String[] args) {
int sum = 0;
for (int i = 1; i <= 10; --i) {
System.out.println("Hello");
}
}
}
| [
"36830321+HelloHadi@users.noreply.github.com"
] | 36830321+HelloHadi@users.noreply.github.com |
ad0190ee6b9375835522cf9e66fdd119e049100c | 2020388e5725a78643eab195e3e3567995de4212 | /src/datastructures/dynamicarray/DynamicArray.java | 07fc2e9ee352eafb6c54c89fd0bc0b240ba8019f | [] | no_license | Amirparsa-Sal/Data-Structure-Algorithms | 46346cd5d89a7eb8b81755f4eb2b9bce02985b18 | 64f2b70828c4f37abba740a8ffe8269646f5df3a | refs/heads/master | 2023-03-11T21:09:00.266014 | 2021-02-26T12:23:39 | 2021-02-26T12:23:39 | 330,047,603 | 9 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,008 | java | package datastructures.dynamicarray;
import java.util.Iterator;
import java.util.List;
import java.lang.StringBuilder;
import java.util.Arrays;
public class DynamicArray<T> implements Iterable<T>{
private int capacity;
private int size;
private T[] arr;
public DynamicArray(){
this(4);
}
public DynamicArray(int capacity){
this.capacity = capacity;
this.size = 0;
this.arr = (T[]) new Object[capacity];
}
public T get(int index){
//Checking bounds
if (index<0 || index >= size)
throw new ArrayIndexOutOfBoundsException("Index " + index + " out of range!");
return arr[index];
}
public int size() {return this.size;}
public boolean isEmpty() {return size == 0;}
public boolean contains(Object o) {return indexOf(o)!=-1;}
@Override public Iterator<T> iterator() {return new ArrayIterator<T>(this);}
public Object[] toArray() {
Object[] arr = new Object[size];
for(int i = 0; i < size; i++)
arr[i] = this.arr[i];
return arr;
}
public <E> E[] toArray(E[] a) {
//if a has not enough space return new array
if(a.length < size)
return (E[]) Arrays.copyOf(arr, size, a.getClass());
//filling a if a has enough space
System.arraycopy(arr,0,a,0,size);
if(a.length>size)
a[size] = null;
return a;
}
public boolean add(T t) {
//Checking if resize is required. Resize is required when the array is full. each resize doubles the size of the array.
if (size == capacity)
addCapacity();
//Putting object in array
arr[size] = t;
size++;
return true;
}
public void add(int index, T element) {
//checking if index is in range
if (index<0 || index>=size)
throw new ArrayIndexOutOfBoundsException("Index " + index + " out of range!");
//Checking if resize is required. Resize is required when the array is full. each resize doubles the size of the array.
if (size==capacity)
addCapacity();
for(int i = size; i > index; i--)
arr[i] = arr[i-1];
arr[index] = element;
size++;
}
private void addCapacity(){
if (size == 0)
capacity = 1;
else
capacity *= 2;
T[] arr = (T[]) new Object[capacity];
System.arraycopy(this.arr,0,arr,0,size);
this.arr = arr;
}
public boolean remove(Object o) {
int index = indexOf(o);
if (index == -1)
return false;
remove(index);
return true;
}
public void clear() {
capacity = 4;
arr = (T[]) new Object[capacity];
size = 0;
}
public T set(int index, T element) {
if (index<=0 || index>=size)
throw new ArrayIndexOutOfBoundsException("Index " + index + " out of range!");
T prevElement = arr[index];
arr[index] = element;
return prevElement;
}
public T remove(int index) {
//Checking bound
if (index<0 || index>=size)
throw new ArrayIndexOutOfBoundsException("Index " + index + " out of range!");
//Checking if resize is needed. Resize happens when array size is 1/4 of the capacity.
T[] arr = this.arr;
if (size-1 == capacity/4){
capacity /= 2;
this.arr = (T[]) new Object[capacity];
}
//Deleting and shifting
T result = null;
for (int i = 0, j = 0; i < size; i++, j++){
if (i == index){
j--;
result = arr[i];
}
else
this.arr[j] = arr[i];
}
size--;
return result;
}
public int indexOf(Object o) {
for(int i = 0; i < size; i++){
if (o == null && arr[i]==null)
return i;
if(o.equals(arr[i]))
return i;
}
return -1;
}
public int lastIndexOf(Object o) {
if (size == 0)
return -1;
for(int i = size-1; i >= 0; i++){
if (o == null && arr[i]==null)
return i;
if(o.equals(arr[i]))
return i;
}
return -1;
}
@Override public String toString(){
if (size == 0)
return new String("[]");
StringBuilder sb = new StringBuilder("Array(" + size + ")[");
for (int i = 0; i < size-1; i++)
sb.append(arr[i] + ", ");
return sb.append(arr[size-1] + "]").toString();
}
private class ArrayIterator<T> implements Iterator<T>{
private DynamicArray<T> arr;
private int index;
public ArrayIterator(DynamicArray<T> arr){
this.arr = arr;
index = 0;
}
@Override public boolean hasNext() {return index!=arr.size;}
@Override public T next() {
if (!hasNext())
throw new ArrayIndexOutOfBoundsException("Index " + index + " out of range!");
T result = arr.get(index);
index++;
return result;
}
@Override public void remove() {
if (index == size)
throw new ArrayIndexOutOfBoundsException("Index " + index + " out of range!");
arr.remove(index);
}
}
} | [
"amirparsa.s@aut.ac.ir"
] | amirparsa.s@aut.ac.ir |
28b484f34ab3db7c7a97340800e0983381ae71db | 6768749857c3f874a3cd1438c35045221fdd5083 | /PonyExpress/PonyClient.java | 5a3691830343e5145f2962c4ef8725fa51042cff | [] | no_license | Hitscotty/SimpleEncryptions | 2d3a068a9aaea5aa74ff2d14a361e35d41beb226 | 8b0020d642423f4b5b468f84b5d7c7c2e38baf14 | refs/heads/master | 2016-08-12T21:39:31.403289 | 2015-12-31T01:02:45 | 2015-12-31T01:02:45 | 48,825,651 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package PonyExpress;
/**
* @author Jonathan Portorreal
*/
import java.io.IOException;
import java.net.Socket;
public class PonyClient extends OneTimePad{
private static final long serialVersionUID = 1L;
public PonyClient(){
super();
}
public Socket connect() throws IOException{
Socket socket = new Socket("localhost", 8080);
return socket;
}
}
| [
"Jportorreal77@gmail.com"
] | Jportorreal77@gmail.com |
d68a58889e67a50bc564ad4e32573bab998f9dd5 | aab4a8b34830845e0779a1364cab5d0556f8a75a | /app/src/main/java/com/example/dominic/clickngo/activity/SettingsActivity.java | b67200f2f36a58f228195c6bc364284b2e5260ee | [] | no_license | didagu/clickngo | 21599ce5411a258f5e778ccc2eefef155222cb82 | 792fe3658d02e82efb2f99023a8bfc13f8ea4e11 | refs/heads/master | 2021-01-22T03:05:18.489969 | 2016-09-08T11:54:40 | 2016-09-08T11:54:40 | 38,152,443 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,708 | java | /*
* Copyright 2014 A.C.R. Development
*/
package com.example.dominic.clickngo.activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.example.dominic.clickngo.R;
import com.example.dominic.clickngo.constant.Constants;
import com.example.dominic.clickngo.preference.PreferenceManager;
import com.example.dominic.clickngo.utils.Utils;
public class SettingsActivity extends ThemableSettingsActivity {
private static final int API = android.os.Build.VERSION.SDK_INT;
private PreferenceManager mPreferences;
private Context mContext;
private Activity mActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
mContext = this;
mActivity = this;
init();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
finish();
return true;
}
@SuppressLint("NewApi")
public void init() {
// set up ActionBar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// mPreferences storage
mPreferences = PreferenceManager.getInstance();
// initialize UI
RelativeLayout layoutFlash = (RelativeLayout) findViewById(R.id.layoutFlash);
RelativeLayout layoutBlockAds = (RelativeLayout) findViewById(R.id.layoutAdBlock);
layoutBlockAds.setEnabled(Constants.FULL_VERSION);
RelativeLayout layoutImages = (RelativeLayout) findViewById(R.id.layoutImages);
RelativeLayout layoutEnableJS = (RelativeLayout) findViewById(R.id.layoutEnableJS);
RelativeLayout layoutColor = (RelativeLayout) findViewById(R.id.layoutColorMode);
RelativeLayout layoutBookmarks = (RelativeLayout) findViewById(R.id.layoutBookmarks);
layoutBookmarks.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(mContext, BookmarkActivity.class));
}
});
if (API >= 19) {
mPreferences.setFlashSupport(0);
}
int flashNum = mPreferences.getFlashSupport();
boolean imagesBool = mPreferences.getBlockImagesEnabled();
boolean enableJSBool = mPreferences.getJavaScriptEnabled();
CheckBox flash = (CheckBox) findViewById(R.id.cbFlash);
CheckBox adblock = (CheckBox) findViewById(R.id.cbAdblock);
adblock.setEnabled(Constants.FULL_VERSION);
CheckBox images = (CheckBox) findViewById(R.id.cbImageBlock);
CheckBox enablejs = (CheckBox) findViewById(R.id.cbJavascript);
CheckBox color = (CheckBox) findViewById(R.id.cbColorMode);
images.setChecked(imagesBool);
enablejs.setChecked(enableJSBool);
if (flashNum > 0) {
flash.setChecked(true);
} else {
flash.setChecked(false);
}
adblock.setChecked(mPreferences.getAdBlockEnabled());
color.setChecked(mPreferences.getColorModeEnabled());
initCheckBox(flash, adblock, images, enablejs, color);
clickListenerForCheckBoxes(layoutFlash, layoutBlockAds, layoutImages, layoutEnableJS,
layoutColor, flash, adblock, images, enablejs, color);
RelativeLayout general = (RelativeLayout) findViewById(R.id.layoutGeneral);
RelativeLayout display = (RelativeLayout) findViewById(R.id.layoutDisplay);
RelativeLayout privacy = (RelativeLayout) findViewById(R.id.layoutPrivacy);
RelativeLayout advanced = (RelativeLayout) findViewById(R.id.layoutAdvanced);
RelativeLayout about = (RelativeLayout) findViewById(R.id.layoutAbout);
general(general);
display(display);
privacy(privacy);
advanced(advanced);
about(about);
}
public void clickListenerForCheckBoxes(RelativeLayout layoutFlash,
RelativeLayout layoutBlockAds, RelativeLayout layoutImages,
RelativeLayout layoutEnableJS, RelativeLayout layoutColor,
final CheckBox flash, final CheckBox adblock, final CheckBox images,
final CheckBox enablejs, final CheckBox color) {
layoutFlash.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (API < 19) {
flash.setChecked(!flash.isChecked());
} else {
Utils.createInformativeDialog(mContext,
getResources().getString(R.string.title_warning), getResources()
.getString(R.string.dialog_adobe_dead));
}
}
});
layoutBlockAds.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
adblock.setChecked(!adblock.isChecked());
}
});
layoutImages.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
images.setChecked(!images.isChecked());
}
});
layoutEnableJS.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
enablejs.setChecked(!enablejs.isChecked());
}
});
layoutColor.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
color.setChecked(!color.isChecked());
}
});
}
public void initCheckBox(CheckBox flash, CheckBox adblock, CheckBox images, CheckBox enablejs,
CheckBox color) {
flash.setEnabled(API < 19);
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
getFlashChoice();
} else {
mPreferences.setFlashSupport(0);
}
boolean flashInstalled = false;
try {
PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
if (ai != null) {
flashInstalled = true;
}
} catch (NameNotFoundException e) {
flashInstalled = false;
}
if (!flashInstalled && isChecked) {
Utils.createInformativeDialog(SettingsActivity.this,
getResources().getString(R.string.title_warning), getResources()
.getString(R.string.dialog_adobe_not_installed));
buttonView.setChecked(false);
mPreferences.setFlashSupport(0);
} else if ((API >= 17) && isChecked) {
Utils.createInformativeDialog(SettingsActivity.this,
getResources().getString(R.string.title_warning), getResources()
.getString(R.string.dialog_adobe_unsupported));
}
}
});
adblock.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPreferences.setAdBlockEnabled(isChecked);
}
});
images.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPreferences.setBlockImagesEnabled(isChecked);
}
});
enablejs.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPreferences.setJavaScriptEnabled(isChecked);
}
});
color.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPreferences.setColorModeEnabled(isChecked);
}
});
}
private void getFlashChoice() {
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
builder.setTitle(mContext.getResources().getString(R.string.title_flash));
builder.setMessage(getResources().getString(R.string.flash))
.setCancelable(true)
.setPositiveButton(getResources().getString(R.string.action_manual),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
mPreferences.setFlashSupport(1);
}
})
.setNegativeButton(getResources().getString(R.string.action_auto),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mPreferences.setFlashSupport(2);
}
}).setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
mPreferences.setFlashSupport(0);
}
});
AlertDialog alert = builder.create();
alert.show();
}
public void agentPicker() {
final AlertDialog.Builder agentStringPicker = new AlertDialog.Builder(mActivity);
agentStringPicker.setTitle(getResources().getString(R.string.title_user_agent));
final EditText getAgent = new EditText(this);
getAgent.append(mPreferences.getUserAgentString(""));
agentStringPicker.setView(getAgent);
agentStringPicker.setPositiveButton(getResources().getString(R.string.action_ok),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String text = getAgent.getText().toString();
mPreferences.setUserAgentString(text);
getAgent.setText(getResources().getString(R.string.agent_custom));
}
});
agentStringPicker.show();
}
public void general(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(mContext, GeneralSettingsActivity.class));
}
});
}
public void display(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(mContext, DisplaySettingsActivity.class));
}
});
}
public void privacy(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(mContext, PrivacySettingsActivity.class));
}
});
}
public void advanced(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(mContext, AdvancedSettingsActivity.class));
}
});
}
public void about(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(mContext, AboutSettingsActivity.class));
}
});
}
}
| [
"didagou@gmail.com"
] | didagou@gmail.com |
6c42ce62d084bc5095c1f122cc4967aac988b0a5 | 8909a9697ba0f08f627c903dff860a178c60cab3 | /src/com/gsu/gg/ui/CourseSearchResults.java | bbedb3bd9bc9b507a074fc318569dc99d19c3697 | [] | no_license | jchemma/Ghost-Solar | 46ee087e6fe25fab2413facd286a64f74c795140 | 7ae1f4055d046c8188937b1c22fc5ee48360794b | refs/heads/master | 2020-06-17T08:27:58.596269 | 2016-12-01T17:02:36 | 2016-12-01T17:02:36 | 68,240,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,421 | java | package com.gsu.gg.ui;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import com.gsu.gg.to.Course;
import com.gsu.gg.to.CourseSearch;
import com.gsu.gg.to.CourseSection;
import com.gsu.gg.to.CourseSearch;
import com.gsu.gg.to.User;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.gsu.gg.dao.RegistrationDAO;
import com.gsu.gg.manager.RegistrationManager;
public class CourseSearchResults {
Label response;
CourseSearch search;
//Create Observable list of items to populate list.
ObservableList<Course> lookUpRes =FXCollections.observableArrayList();
//public void display() {
public void display(){
try {
List<Course> courseList = RegistrationManager.getSearchCourses(search);
lookUpRes.addAll(courseList);
} catch (Exception ex) {
Logger.getLogger(CourseSearchResults.class.getName()).log(Level.SEVERE, null, ex);
}
//Create a stage.
Stage lookResults = new Stage();
//Set stage title.
lookResults.setTitle("Look-UP Classes to Add");
//Create root Node as BorderPane.
BorderPane rootNode = new BorderPane();
//create scene.
Scene myScene = new Scene(rootNode, 800, 600);
//set Scene to Stage.
lookResults.setScene(myScene);
lookResults.setMinHeight(680);
lookResults.setMaxHeight(680);
lookResults.setMinWidth(750);
lookResults.setMaxWidth(750);
//Create TableView of CourseSearch
TableView<Course> cSec = new TableView<Course>(lookUpRes);
//Add Headings and Specify cell Factories.
TableColumn<Course, String> crn =
new TableColumn<>("CRN");
crn.setCellValueFactory(new PropertyValueFactory<>("crn"));
cSec.getColumns().add(crn);
TableColumn<Course, String> name =
new TableColumn<>("Name");
name.setCellValueFactory(new PropertyValueFactory<>("name"));
cSec.getColumns().add(name);
TableColumn<Course, String> creditHours =
new TableColumn<>("Credit Hours");
creditHours.setCellValueFactory(new PropertyValueFactory<>("creditHours"));
cSec.getColumns().add(creditHours);
cSec.setItems(lookUpRes);
//Size the table.
cSec.setPrefSize(360, 196);
//Get the TableView selection model.
TableView.TableViewSelectionModel<Course> secSelModel = cSec.getSelectionModel();
//Use a change listener to respond to a change of selection within the table view.
secSelModel.selectedIndexProperty().addListener(new ChangeListener<Number>(){
public void changed(ObservableValue<? extends Number> changed,
Number oldVal, Number newVal){
//Display the index of the selction.
response.setText("Selected row is " + newVal);
}
});
VBox tRes = new VBox();
tRes.getChildren().addAll(cSec, response);
//Add controls to the scene graph.
rootNode.setCenter(tRes);
//show the stage and its scene.
lookResults.show();
}
}
| [
"KeyJerome@gmail.com"
] | KeyJerome@gmail.com |
78b7b8d96817994603390458f6380ab3dd6af012 | 8300c1fe01308be6f0fa2769c7893de73dff338f | /test/src/test/范围.java | c1a0736d887c8fa939606fa79a7640c307105943 | [] | no_license | lsx888/test | d800cec2de8ce7652d7c1e3227062030d61f6022 | d87942329e03507673228364f3c5acea35e4fe2a | refs/heads/master | 2021-05-04T17:28:51.926730 | 2018-03-09T15:40:34 | 2018-03-09T15:40:34 | 120,271,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package test;
/**
*
* @author lisx
* @2017年7月11日
*/
public class 范围 {
public static void main(String[] args) {
String str="";
for (int i = 0; i<2; i++) {
// String str=""; 不可以再到里面定义一个同明德str了
}
}
}
| [
"18381336637@163.com"
] | 18381336637@163.com |
b4ef488709cf11dde84c472a3096bcacdc9abe53 | 3418ad6e81cbf6777f69d83d15cce7f27b58e329 | /question2/src/question2/PaintPanel.java | c24943f662bad7dac005f61493cab80d13cdd08d | [] | no_license | harsh91/design-patterns | a2e04753da0e27c51d9015e2700a3bd3de6922a6 | c0456cff586ae05e2b7bb7cd1401e89598eac77d | refs/heads/master | 2021-01-23T13:08:42.098433 | 2017-06-03T05:49:53 | 2017-06-03T05:49:53 | 93,226,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,098 | java | package question2;
// File : gui-lowlevel/paintpanel/PaintPanel.java
// Purpose: Draws graphics, handles mouse events.
// Has setters for shape and color.
// Author : Fred Swartz - October 12, 2006 - Placed in public domain.
// Possible enhancements:
// * Allow dragging shapes up or to left, not just down+right.
// by using max/min of coordinates.
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import javax.imageio.ImageIO;
import javax.swing.*;
///////////////////////////////////////////////////////////////////// PaintPanel
class PaintPanel extends JPanel implements MouseListener, MouseMotionListener,command {
//================================================================ constants
private static final int SIZE = 500; // Size of paint area.
private static final Shape INIIIAL_SHAPE = Shape.RECTANGLE;
private static final Color INITIAL_COLOR = Color.RED;
private static final Color COLOR_BACKGROUND = Color.WHITE;
private enum State { IDLE, DRAGGING }
//=================================================================== fields
private State _state = State.IDLE;
private Shape _shape = INIIIAL_SHAPE;
private Color _color = INITIAL_COLOR;
private Point _start = null; // Where mouse is pressed.
private Point _end = null; // Where mouse is dragged to or released.
// Initialized first time paintComponent is called.
private BufferedImage _bufImage = null;
private Graphics2D g2 = null;
//============================================================== constructor
public PaintPanel() {
setPreferredSize(new Dimension(1000, 1000));
setOpaque(true);
setBackground(Color.WHITE);
this.addMouseListener(this);
this.addMouseMotionListener(this);
}
//================================================================= setShape
public void setShape(Shape shape) {
_shape = shape;
}
//================================================================= setColor
public void setColor(Color color) {
_color = color;
}
public Stack<BufferedImage> onStack = new Stack<BufferedImage>();
public Stack<BufferedImage> offStack = new Stack<BufferedImage>();
public Map<String, Coloring> mappedColors = new HashMap<String, Coloring>();
//=========================================================== paintComponent
@Override public void paint(Graphics g) {
g2 = (Graphics2D)g; // Downcast to Graphics2D
//... One time initialization of in-memory, saved image.
if (_bufImage == null) {
//... This is the first time, initialize _bufImage
int w = this.getWidth();
int h = this.getHeight();
_bufImage = (BufferedImage)this.createImage(w, h);
Graphics2D gc = _bufImage.createGraphics();
gc.setColor(Color.white);
gc.fillRect(0, 0, w, h); // fill in background
}
//... Display the saved image.
g2.drawImage(_bufImage, null, 0, 0);
//... Overwrite the screen display with currently dragged image.
if (_state == State.DRAGGING) {
//... Write shape that is being dragged over the screen image,
// but not into the saved buffered image. It will be written
// on the saved image when the mouse is released.
drawCurrentShape(g2);
}
}
@Override
public void undo() {
System.out.println("Stack size after undo : "+ onStack.size());
if(onStack.size()>0){
BufferedImage bi = onStack.pop();
try {
setImage(bi);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
offStack.push(bi);
}else{
JOptionPane.showMessageDialog(null, "No more undo");
}
}
public void undo_function()throws IOException{
if(onStack.size()>0){
BufferedImage bi = onStack.pop();
setImage(bi);
offStack.push(bi);
}else{
JOptionPane.showMessageDialog(null, "No more undo");
}
}
@Override
public void redo() {
System.out.println("Stack size after redo: " + offStack.size());
if(offStack.size()>0){
BufferedImage bi = offStack.pop();
try {
setImage(bi);
} catch (IOException e) {
e.printStackTrace();
}
}else{
JOptionPane.showMessageDialog(null, "No more redo");
}
}
public void redo_function() throws IOException{
System.out.println(offStack.size());
if(offStack.size()>0){
BufferedImage bi = offStack.pop();
setImage(bi);
}else{
JOptionPane.showMessageDialog(null, "No more redo");
}
}
public void setImage(BufferedImage img)throws IOException {
g2 = (Graphics2D) img.getGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(Color.black);
_bufImage = img;
this.repaint();
}
//========================================================= drawCurrentShape
private void drawCurrentShape(Graphics2D g2) {
//... Draws current shape on a graphics context, either
// on the context passed to paintComponent, or the
// context for the BufferedImage.
g2.setColor(_color); // Set the color.
switch (_shape) {
case OVAL:
g2.fillOval(_start.x, _start.y, _end.x - _start.x, _end.y - _start.y);
break;
case RECTANGLE:
g2.fillRect(_start.x, _start.y, _end.x - _start.x, _end.y - _start.y);
break;
case LINE:
g2.drawLine(_start.x, _start.y, _end.x , _end.y);
break;
default: // Should never happen!
g2.drawString("Huh?", 10, 20);
break;
}
}
//============================================================= mousePressed
public void mousePressed(MouseEvent e) {
onStack.push(_bufImage); //pushing the previous buffered image on to the stack
System.out.println("Image pushed on to undo stack");
//un.push_item(copyImage(_bufImage));
_state = State.DRAGGING; // Assume we're starting a drag.
_start = e.getPoint(); // Save start point, and also initially
_end = _start; // as end point, which drag will change.
}
//============================================================= mouseDragged
public void mouseDragged(MouseEvent e) {
_state = State.DRAGGING; // We're dragging to create a shape.
_end = e.getPoint(); // Set end point of drag. May change.
this.repaint(); // After change, show new shape
}
//============================================================ mouseReleased
public void mouseReleased(MouseEvent e) {
//... If released at end of drag, write shape into the BufferedImage,
// which saves it in the drawing.
_end = e.getPoint(); // Set end point of drag.
if (_state == State.DRAGGING) {
_state = State.IDLE;
//... Draw current shape in saved buffered image.
drawCurrentShape(_bufImage.createGraphics());
this.repaint();
offStack.push(_bufImage);
}
}
//================================================== ignored mouse listeners
public void mouseMoved (MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseExited (MouseEvent e) {}
public void mouseClicked(MouseEvent e) {}
} | [
"girdharharsh01@gmail.com"
] | girdharharsh01@gmail.com |
5df51053b683fdfbb81003dc488ab96faa39ef95 | dfd7e70936b123ee98e8a2d34ef41e4260ec3ade | /analysis/reverse-engineering/decompile-fitts-20191031-2200/sources/kr/co/popone/fitts/feature/collection/MixedCollectionActivity$onPostClicked$1.java | c2b4eadd908a059df14c001120544bb6fbf3b1da | [
"Apache-2.0"
] | permissive | skkuse-adv/2019Fall_team2 | 2d4f75bc793368faac4ca8a2916b081ad49b7283 | 3ea84c6be39855f54634a7f9b1093e80893886eb | refs/heads/master | 2020-08-07T03:41:11.447376 | 2019-12-21T04:06:34 | 2019-12-21T04:06:34 | 213,271,174 | 5 | 5 | Apache-2.0 | 2019-12-12T09:15:32 | 2019-10-07T01:18:59 | Java | UTF-8 | Java | false | false | 479 | java | package kr.co.popone.fitts.feature.collection;
import com.orhanobut.logger.Logger;
import io.reactivex.functions.Action;
final class MixedCollectionActivity$onPostClicked$1 implements Action {
public static final MixedCollectionActivity$onPostClicked$1 INSTANCE = new MixedCollectionActivity$onPostClicked$1();
MixedCollectionActivity$onPostClicked$1() {
}
public final void run() {
Logger.d("ActionLogSuccess", new Object[0]);
}
}
| [
"33246398+ajid951125@users.noreply.github.com"
] | 33246398+ajid951125@users.noreply.github.com |
885475590843f4bc1a3c3381219ac6d3ffc27d55 | 15e91037fe2dca7320536dc56f0194bf3196847b | /javatasks/src/test/Reflections.java | af13bde1729d5fa1393a3f401c77e0d611fc4cd8 | [] | no_license | Maxkile/javaTasks | 928ba899a23fd12183bfa330b55c454b177d981e | 6429845ed00280edfb329511e7d470cec767ed38 | refs/heads/master | 2020-07-23T01:25:36.382114 | 2019-09-22T18:44:33 | 2019-09-22T18:44:45 | 196,874,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,202 | java | package test;
import ru.skillbench.tasks.basics.entity.Employee;
import ru.skillbench.tasks.basics.entity.EmployeeImpl;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Reflections {
public static void main(String[] args) throws NoSuchFieldException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
Employee man = null;
Class cls = Class.forName(EmployeeImpl.class.getName());
// man = (EmployeeImpl)cls.newInstance();
Constructor m = cls.getConstructor(String.class,String.class,int.class);
man = (EmployeeImpl)m.newInstance("Dyadya","Vasya",12000);
Field field = cls.getDeclaredField("salary");
field.setAccessible(true);
field.set(man,1200);
Method salary = man.getClass().getMethod("getSalary");
Object sal = salary.invoke(man);
System.out.println(sal.getClass().getName());
Class clss = Class.forName("test.Reflections");
}
}
| [
"pavel.sivashchenko@mail.ru"
] | pavel.sivashchenko@mail.ru |
e970bc9f4bc6cec781603f48292c56f79c662596 | c60f8163c203ca565abca8b5e91d3b0dd55ba487 | /src/main/java/com/p8499/pacu/model/Fields.java | 5da3337ecb8db0b80db04f6931abdbe5caff38ab | [] | no_license | p8499/pac | fbb88f1eaeac493e9d70a99aac4e9bf94a781d14 | 0495f3843b8a0a0e4d592c16c1f7aa22158389ce | refs/heads/master | 2021-01-22T02:24:31.432334 | 2019-02-01T07:36:23 | 2019-02-01T07:36:23 | 80,704,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,364 | java | package com.p8499.pacu.model;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
import javafx.beans.property.ListProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.collections.FXCollections;
import javafx.event.Event;
import javafx.scene.control.TreeItem;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 6/20/2018.
*/
@JsonSerialize(using = Fields.Serializer.class)
public class Fields implements Serializable, TreeItemContainer {
private TreeItem mTreeItem;
public Module mParent;
public final ListProperty<Field> mFields;
public Fields() {
mFields = new SimpleListProperty<>(FXCollections.observableArrayList());
}
public Fields(Object list) {
DocumentContext fieldsContext = JsonPath.parse(list);
List<Field> fieldList = new ArrayList<>();
fieldsContext.<List>read("$").forEach(fieldMap -> {
Field field = new Field(fieldMap);
field.mParent = this;
fieldList.add(field);
});
mFields = new SimpleListProperty<>(FXCollections.observableList(fieldList));
}
public TreeItem getTreeItem() {
if (mTreeItem == null) {
mTreeItem = new TreeItem(this);
}
mTreeItem.getChildren().clear();
mFields.forEach(field -> mTreeItem.getChildren().add(field.getTreeItem()));
return mTreeItem;
}
public void refreshTreeItem() {
Event.fireEvent(getTreeItem(), new TreeItem.TreeModificationEvent(TreeItem.valueChangedEvent(), getTreeItem(), getTreeItem().getValue()));
}
@Override
public String toString() {
return "Fields";
}
static class Serializer extends JsonSerializer<Fields> {
@Override
public void serialize(Fields value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartArray();
for (Field field : value.mFields)
gen.writeObject(field);
gen.writeEndArray();
}
}
}
| [
"p8499@126.com"
] | p8499@126.com |
6f7e101e22256d7fcdca1edbd3384fd6e378b86c | c79f3640640fdc932f3010adf330d8680debf0d0 | /app/src/main/java/com/example/day0320/presenter/ShouPresenter.java | e6378f32551697c6bb5e7e1c84ad2635d38445dd | [] | no_license | 1311620120/Day03201 | 6f5da84ea7a9936f34ee7442585dc1a3f9a39cd5 | b807d5f032ef02ecf146c479782c9742ec8b36c2 | refs/heads/master | 2020-05-01T10:16:04.677841 | 2019-03-24T13:18:43 | 2019-03-24T13:18:43 | 177,417,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,041 | java | package com.example.day0320.presenter;
import android.util.Log;
import com.example.day0320.model.Constant;
import com.example.day0320.model.DataBean;
import com.example.day0320.model.HttpUitls;
import com.example.day0320.view.activity.LoginActivity;
import com.example.day0320.view.fragment.OneFragment;
import com.example.day0320.view.interfaces.IMainView;
public class ShouPresenter extends BasePresenter<IMainView<DataBean>> {
private final HttpUitls instance;
public ShouPresenter(OneFragment oneFragment){
instance = HttpUitls.getInstance();
}
public void ShowData(String keyword,int page,int count){
instance.getData(Constant.SHOU + "?" + "keyword=" + keyword + "&" + "page=" + page + "&" + "count=" + count, DataBean.class, new HttpUitls.CallBackData() {
@Override
public void onResponse(Object o) {
getView().onSuccess((DataBean)o);
}
@Override
public void onFail(String err) {
}
});
}
}
| [
"1311620120@qq.com"
] | 1311620120@qq.com |
bf92d6db01e27ff494c177761b7fb5ca2245c4f2 | 3259b76c5337a9c87412f9bd02c37bdffee7b84d | /src/main/java/com/jiaboyan/generic/test/ParameterizedTypeTest.java | 36ab8f8d30a44b812316703a77e91b982847a82d | [] | no_license | jiaboyan/genericLearn | 877ff28d1603bb8153ec73f74d593b2501ddeb9f | 353a7b7a6e575e90a18b08ee7f84f9a88135eace | refs/heads/master | 2020-04-07T07:20:50.278098 | 2018-11-19T06:32:51 | 2018-11-19T06:32:51 | 158,173,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,942 | java | package com.jiaboyan.generic.test;
import com.jiaboyan.generic.entity.Test1111;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by jiaboyan on 2017/4/23.
*/
public class ParameterizedTypeTest<T extends Number> {
public static void testGetActualTypeArguments() throws NoSuchFieldException {
Field fieldMap = ParameterizedTypeTest.class.getDeclaredField("map");
Type typeMap = fieldMap.getGenericType();
ParameterizedType parameterizedTypeMap = (ParameterizedType) typeMap;
//获取泛型中的实际类型:
Type[] types = parameterizedTypeMap.getActualTypeArguments();
System.out.println(types[0]);//class java.lang.String
System.out.println(types[1]);//class java.lang.Integer
}
private Map<String,Integer> map = null;
public static void testGetRawType() throws NoSuchFieldException {
Field fieldMap = ParameterizedTypeTest.class.getDeclaredField("map");
Type typeMap = fieldMap.getGenericType();
ParameterizedType parameterizedTypeMap = (ParameterizedType) typeMap;
//获取声明泛型的类/接口:
Type type = parameterizedTypeMap.getRawType();
}
public static void main(String[] agrs) throws NoSuchFieldException {
testGetRawType();
}
// private Map<String,Integer> map = null;
private Map.Entry<String,Integer> mapEntry;
public static void testGetOwnerType() throws NoSuchFieldException {
Field fieldMapEntry = ParameterizedTypeTest.class.getDeclaredField("mapEntry");
Type typeMapEntry = fieldMapEntry.getGenericType();
ParameterizedType parameterizedTypeMapEntry = (ParameterizedType) typeMapEntry;
//获取泛型的拥有者:
Type type = parameterizedTypeMapEntry.getOwnerType();
}
}
| [
"303408568@qq.com"
] | 303408568@qq.com |
f2e271c81ff16e57403d992f4c527f9fe245bba4 | 7359854b8d8e52a8b2525de28732a7987c17ac2a | /COMP261 Assignment 4 - Robo Game/src/Main/ExpressionNode.java | 326f6b1c58ae39190d63a266a742efa6095b69df | [] | no_license | tezz99/COMP261-Assignments | 6031a8e6e6455099627fcf17931bd82648157d1b | 121fd16e52488378890c9b09be86f40c955ca8c0 | refs/heads/master | 2021-01-17T04:40:36.738090 | 2017-02-24T06:19:40 | 2017-02-24T06:19:40 | 83,008,281 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 144 | java | package Main;
interface ExpressionNode {
public int evaluate(Robot robot);
public String toString();
//public String getValue();
}
| [
"tezz995@gmail.com"
] | tezz995@gmail.com |
37fd607298fc670449679500156b6afd3a3785c9 | 22c962996e6ea003a3a2f14609947c924183383c | /androidhttpdemo/src/main/java/com/example/androidhttpdemo/DBOpenHelper.java | 0f1a0b852d780a8e0e55c7f8db9c77fb331daa8a | [] | no_license | LingWu0/AndroidHttp | bcf9012ee9e62e667d921be662517144ea2ed994 | fe70dc931f3fb3e0f3c896cb0172e985019f7297 | refs/heads/master | 2021-08-22T04:00:36.810001 | 2017-11-29T07:07:22 | 2017-11-29T07:07:22 | 112,439,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | package com.example.androidhttpdemo;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by xxsj on 2017/11/29.
*/
public class DBOpenHelper extends SQLiteOpenHelper {
private static final String DBNAME = "down.db";
private static final int VERSION = 1;
public DBOpenHelper(Context context) {
super(context, DBNAME, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE IF NOT EXISTS filedownlog (id integer primary key autoincrement, downpath varchar(100), threadid INTEGER, downlength INTEGER)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS filedownlog");
onCreate(db);
}
}
| [
"1420969425@qq.com"
] | 1420969425@qq.com |
1bc06a0446e18bd1bc7fdff18a3714b8b8714f6e | 3e3aab5b77063c665667fb7ed834f58f7e8ab795 | /app/src/main/java/com/zty/yisheng/presenter/presenter/BannerImagePresenter.java | cc7747e23015c24c1b4c3727800608e213111232 | [] | no_license | Marsboxiao/YiSheng | d47d0e6aa8c40143d1810df2288d6ad0d0d54e48 | e3af8b62f69bc97b306275480ca42c684f7d2d3b | refs/heads/master | 2020-03-19T01:26:13.442721 | 2018-06-16T08:44:23 | 2018-06-16T08:44:23 | 135,545,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,232 | java | package com.zty.yisheng.presenter.presenter;
import com.zty.yisheng.common.base.RxPresenter;
import com.zty.yisheng.model.api.RetrofitHelper;
import com.zty.yisheng.model.bean.BannerImageBean;
import com.zty.yisheng.presenter.contract.BannerImageContract;
import javax.inject.Inject;
import io.reactivex.Flowable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.observers.DisposableObserver;
import io.reactivex.schedulers.Schedulers;
/**
* Created by 92915 on 2018/3/29.
*/
public class BannerImagePresenter extends RxPresenter<BannerImageContract.View> implements BannerImageContract.Presenter {
private RetrofitHelper mRetrofitHelper;
@Inject
public BannerImagePresenter(RetrofitHelper mRetrofitHelper) {
this.mRetrofitHelper = mRetrofitHelper;
}
@Override
public void getBannerAttribute() {
// .doOnSubscribe(new Consumer<Disposable>() {
// @Override
// public void accept(Disposable disposable) throws Exception {
// //成功了怎么处理
// }
// })
Disposable disposable = mRetrofitHelper.getBannerImageApproveInfo()
.subscribe(
new Consumer<BannerImageBean>() {
@Override
public void accept(BannerImageBean bannerImageBean) throws Exception {
//成功获取数据
}
},
new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
//未成功获取数据
}
},
new Action() {
@Override
public void run() throws Exception {
//已经执行
}
});
addSubscrebe(disposable);
}
}
| [
"15101124794@sina.cn"
] | 15101124794@sina.cn |
213ae4d0db5f2e6bfb469a3c026547ab60a9b915 | bc034e4963c69676bb18b67cc4dcb8b125b66688 | /src/main/java/jpabook/jpashop/domain/item/Book.java | 004ac3e4336868487f75971b2f1431469d5903a2 | [] | no_license | LastCow9000/LearnJPA | f4ca2da6cbd743e9267d170a374f6743ccb125af | 99990deb57318805cd9efd0e08312ecf9200ded8 | refs/heads/master | 2023-05-15T03:10:30.087997 | 2021-06-06T08:37:30 | 2021-06-06T08:37:30 | 374,308,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package jpabook.jpashop.domain.item;
import jpabook.jpashop.domain.item.Item;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
@Entity
@DiscriminatorValue("B")
@Getter
@Setter
public class Book extends Item {
private String author;
private String isbn;
}
| [
"sys19912002@hanmail.net"
] | sys19912002@hanmail.net |
ed9570dd2a998a69128cca06d7236807cfa8d602 | a3957a1e6cd63e6a9ed618b477dc85b6a47f5862 | /60.concrete-attachments/src/main/java/org/coodex/concrete/attachments/Attachment.java | 488869217fc97c4aec1de5f088c905ac3ebf0e1c | [] | no_license | RoadCan/concrete.coodex.org | efe5efde62e4c35bfbf05decc694de8df4f2e918 | 5ae95bfec3e6f939ed63b65eb6e16c39d58a895e | refs/heads/master | 2021-01-25T13:19:12.435352 | 2017-03-18T00:42:34 | 2017-03-18T00:42:34 | 123,558,846 | 1 | 0 | null | 2018-03-02T09:24:26 | 2018-03-02T09:24:26 | null | UTF-8 | Java | false | false | 852 | java | /*
* Copyright (c) 2017 coodex.org (jujus.shen@126.com)
*
* 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.coodex.concrete.attachments;
import java.lang.annotation.*;
/**
* Created by davidoff shen on 2016-12-13.
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Attachment {
}
| [
"jujus.shen@126.com"
] | jujus.shen@126.com |
8c4769c7e908b793d96c4b3583fd8f7fe351345a | 3ef55e152decb43bdd90e3de821ffea1a2ec8f75 | /large/module0927_internal/src/java/module0927_internal/a/IFoo0.java | b8a17e4dd76203cd6146d89f9dcb3b5007dba5fb | [
"BSD-3-Clause"
] | permissive | salesforce/bazel-ls-demo-project | 5cc6ef749d65d6626080f3a94239b6a509ef145a | 948ed278f87338edd7e40af68b8690ae4f73ebf0 | refs/heads/master | 2023-06-24T08:06:06.084651 | 2023-03-14T11:54:29 | 2023-03-14T11:54:29 | 241,489,944 | 0 | 5 | BSD-3-Clause | 2023-03-27T11:28:14 | 2020-02-18T23:30:47 | Java | UTF-8 | Java | false | false | 871 | java | package module0927_internal.a;
import java.nio.file.*;
import java.sql.*;
import java.util.logging.*;
/**
* Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
* labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
* Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
*
* @see javax.annotation.processing.Completion
* @see javax.lang.model.AnnotatedConstruct
* @see javax.management.Attribute
*/
@SuppressWarnings("all")
public interface IFoo0<M> extends java.util.concurrent.Callable<M> {
javax.naming.directory.DirContext f0 = null;
javax.net.ssl.ExtendedSSLSession f1 = null;
javax.rmi.ssl.SslRMIClientSocketFactory f2 = null;
String getName();
void setName(String s);
M get();
void set(M e);
}
| [
"gwagenknecht@salesforce.com"
] | gwagenknecht@salesforce.com |
84f38b97d934d61b4c1aa9791b691827a8b3ac30 | 4116593925e6b52b8bd72c38aca97152ba66943b | /Hashing/diff2.java | 6978dab3b47659175ca400f0aa29af69510d1225 | [] | no_license | shivani26shinde/InterviewBit | b4d114e41f34c4415080a5849b71a707ddf72d77 | e6a48593cad18c59935155d4b0211e6f952ac01c | refs/heads/master | 2021-01-23T00:53:02.754813 | 2017-07-11T03:20:22 | 2017-07-11T03:20:22 | 85,845,292 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | # Difference2
public class Solution {
public int diffPossible(final List<Integer> a, int b) {
if(a.size()< 2){
return 0;
}
Set<Integer> set = new HashSet<Integer>();
for(int i=0;i<a.size();i++){
if(a.get(i) < b){
if(set.contains(a.get(i))){
return 1;
}
else{
set.add(a.get(i));
}
}
else{
int val = a.get(i) - b;
if(set.contains(val)){
return 1;
}
else{
set.add(val);
}
}
}
return 0;
}
}
| [
"shindeshivani26@gmail.com"
] | shindeshivani26@gmail.com |
3737db35b21fad369cc00e6cb22c7cd8318b45d6 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/8/8_37db8a6902fe2015b2c40095b43c4a4185d60108/CheckoutMojoTest/8_37db8a6902fe2015b2c40095b43c4a4185d60108_CheckoutMojoTest_s.java | 301f0cfaf05231555520976c836659589ff5350b | [] | 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 | 5,598 | java | package org.apache.maven.scm.plugin;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.provider.svn.SvnScmTestUtils;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
*/
public class CheckoutMojoTest
extends AbstractMojoTestCase
{
File checkoutDir;
File repository;
protected void setUp()
throws Exception
{
super.setUp();
checkoutDir = getTestFile( "target/checkout" );
repository = getTestFile( "target/repository" );
FileUtils.forceDelete( checkoutDir );
}
public void testSkipCheckoutWhenCheckoutDirectoryExistsAndSkip()
throws Exception
{
FileUtils.forceDelete( checkoutDir );
checkoutDir.mkdirs();
CheckoutMojo mojo = (CheckoutMojo) lookupMojo( "checkout", getTestFile(
"src/test/resources/mojos/checkout/checkoutWhenCheckoutDirectoryExistsAndSkip.xml" ) );
mojo.setCheckoutDirectory( checkoutDir );
mojo.execute();
assertEquals( 0, checkoutDir.listFiles().length );
}
public void testSkipCheckoutWithConnectionUrl()
throws Exception
{
if ( !ScmTestCase.isSystemCmd( SvnScmTestUtils.SVNADMIN_COMMAND_LINE ) )
{
System.err.println( "'" + SvnScmTestUtils.SVNADMIN_COMMAND_LINE
+ "' is not a system command. Ignored " + getName() + "." );
return;
}
FileUtils.forceDelete( checkoutDir );
SvnScmTestUtils.initializeRepository( repository );
CheckoutMojo mojo = (CheckoutMojo) lookupMojo( "checkout", getTestFile(
"src/test/resources/mojos/checkout/checkoutWithConnectionUrl.xml" ) );
mojo.setWorkingDirectory( new File( getBasedir() ) );
String connectionUrl = mojo.getConnectionUrl();
connectionUrl = StringUtils.replace( connectionUrl, "${basedir}", getBasedir() );
connectionUrl = StringUtils.replace( connectionUrl, "\\", "/" );
mojo.setConnectionUrl( connectionUrl );
mojo.setCheckoutDirectory( checkoutDir );
mojo.execute();
}
public void testSkipCheckoutWithoutConnectionUrl()
throws Exception
{
FileUtils.forceDelete( checkoutDir );
checkoutDir.mkdirs();
CheckoutMojo mojo = (CheckoutMojo) lookupMojo( "checkout", getTestFile(
"src/test/resources/mojos/checkout/checkoutWithoutConnectionUrl.xml" ) );
try
{
mojo.execute();
fail( "mojo execution must fail." );
}
catch ( MojoExecutionException e )
{
assertTrue( true );
}
}
public void testUseExport()
throws Exception
{
FileUtils.forceDelete( checkoutDir );
checkoutDir.mkdirs();
CheckoutMojo mojo = (CheckoutMojo) lookupMojo( "checkout", getTestFile(
"src/test/resources/mojos/checkout/checkoutUsingExport.xml" ) );
mojo.setCheckoutDirectory( checkoutDir );
mojo.execute();
assertTrue( checkoutDir.listFiles().length > 0 );
assertFalse( new File( checkoutDir, ".svn" ).exists() );
}
public void testExcludeInclude()
throws Exception
{
try
{
FileUtils.forceDelete( checkoutDir );
checkoutDir.mkdirs();
SvnScmTestUtils.initializeRepository( repository );
CheckoutMojo mojo = (CheckoutMojo) lookupMojo(
"checkout",
getTestFile( "src/test/resources/mojos/checkout/checkoutWithExcludesIncludes.xml" ) );
mojo.setCheckoutDirectory( checkoutDir );
mojo.execute();
assertTrue( checkoutDir.listFiles().length > 0 );
assertTrue( new File( checkoutDir, ".svn").exists() );
assertTrue( new File( checkoutDir, "pom.xml" ).exists() );
assertFalse( new File( checkoutDir, "readme.txt" ).exists() );
assertFalse( new File( checkoutDir, "src/test" ).exists() );
assertTrue( new File( checkoutDir, "src/main/java" ).exists() );
assertTrue( new File( checkoutDir, "src/main/java/.svn" ).exists() );
assertTrue( new File( checkoutDir, "src/main/.svn" ).exists() );
} catch (Exception e)
{
e.printStackTrace();
throw e;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
2147d333a27deb95bb5cc593250bfc1f886ddf3b | dfeebff812ee66a1a4bfc8dae6f7eebab25c7c17 | /Java/src/USACO/Silver/u2016/Dec/CitiesandStates/City.java | bbbbfaae86283e7c5c624804b8160feb94e99c27 | [] | no_license | kushnayak/competitive-programming | ee7c709969bd69cb31837a0639af661c672c504d | 785a03323b956fdb0618e92dd54db9b141191205 | refs/heads/master | 2023-03-21T01:54:33.813007 | 2021-03-17T18:54:53 | 2021-03-17T18:54:53 | 277,401,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,805 | java |
import java.io.*;
import java.util.*;
public class City {
public static void main(String[] args) throws IOException {
InputReader reader = new InputReader("citystate.in");
PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("citystate.out")));
int n =reader.nextInt();
HashMap<String,Integer> map = new HashMap<>(n);
int ans = 0;
for (int i=0;i<n;i++) {
String city = reader.next();
String state = reader.next();
String uniqueCode = (city.substring(0,2) + state).toLowerCase();
if (!city.substring(0,2).equals(state)) {
map.putIfAbsent(uniqueCode, 0);
map.replace(uniqueCode, map.get(uniqueCode) + 1);
} }
for (String key: map.keySet()) {
String reversed = key.substring(2) + key.substring(0,2);
if (map.containsKey(reversed)) {
ans += map.get(key) * map.get(reversed);
}
}
writer.println(ans/2);
writer.close();
}
static class InputReader {
BufferedReader reader;
StringTokenizer tokenizer;
public InputReader(String file) throws FileNotFoundException {
reader = new BufferedReader(new FileReader(file));
tokenizer = null;
}
String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
}
}
| [
"kushnayak123@gmail.com"
] | kushnayak123@gmail.com |
90e51221dc30c73fa175f4f532dc4b21d20a864a | df484743755c29ff497a682f251e4bfdba91c8a5 | /common/src/main/java/org/glowroot/common/repo/util/RollupLevelService.java | 4a9a1c1b9f2e43e2c35a9ac69c0181311422e33a | [
"Apache-2.0"
] | permissive | BurnningHotel/glowroot | 7e4be000d1367b63181aced4667b3317391d08c4 | 4889ac3bfdfcf6229bd22d1df44aa1284fd884ee | refs/heads/master | 2021-01-22T20:21:51.099859 | 2017-08-13T00:27:20 | 2017-08-13T00:27:20 | 100,702,599 | 1 | 0 | null | 2017-08-18T10:42:46 | 2017-08-18T10:42:46 | null | UTF-8 | Java | false | false | 4,803 | java | /*
* Copyright 2015-2017 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.glowroot.common.repo.util;
import java.util.List;
import org.glowroot.common.repo.ConfigRepository;
import org.glowroot.common.repo.ConfigRepository.RollupConfig;
import org.glowroot.common.util.Clock;
import static java.util.concurrent.TimeUnit.HOURS;
public class RollupLevelService {
private final ConfigRepository configRepository;
private final Clock clock;
public RollupLevelService(ConfigRepository configRepository, Clock clock) {
this.configRepository = configRepository;
this.clock = clock;
}
public int getRollupLevelForView(long from, long to) throws Exception {
long millis = to - from;
long timeAgoMillis = clock.currentTimeMillis() - from;
List<Integer> rollupExpirationHours =
configRepository.getStorageConfig().rollupExpirationHours();
List<RollupConfig> rollupConfigs = configRepository.getRollupConfigs();
for (int i = 0; i < rollupConfigs.size() - 1; i++) {
RollupConfig nextRollupConfig = rollupConfigs.get(i + 1);
int expirationHours = rollupExpirationHours.get(i);
if (millis < nextRollupConfig.viewThresholdMillis()
&& (expirationHours == 0 || HOURS.toMillis(expirationHours) > timeAgoMillis)) {
return i;
}
}
return rollupConfigs.size() - 1;
}
public int getGaugeRollupLevelForView(long from, long to) throws Exception {
long millis = to - from;
long timeAgoMillis = clock.currentTimeMillis() - from;
List<Integer> rollupExpirationHours =
configRepository.getStorageConfig().rollupExpirationHours();
List<RollupConfig> rollupConfigs = configRepository.getRollupConfigs();
// gauge point rollup level 0 shares rollup level 1's expiration
long viewThresholdMillis = rollupConfigs.get(0).viewThresholdMillis();
int expirationHours = rollupExpirationHours.get(0);
if (millis < viewThresholdMillis * ConfigRepository.GAUGE_VIEW_THRESHOLD_MULTIPLIER
&& (expirationHours == 0 || HOURS.toMillis(expirationHours) > timeAgoMillis)) {
return 0;
}
for (int i = 0; i < rollupConfigs.size() - 1; i++) {
viewThresholdMillis = rollupConfigs.get(i + 1).viewThresholdMillis();
expirationHours = rollupExpirationHours.get(i);
if (millis < viewThresholdMillis * ConfigRepository.GAUGE_VIEW_THRESHOLD_MULTIPLIER
&& (expirationHours == 0 || HOURS.toMillis(expirationHours) > timeAgoMillis)) {
return i + 1;
}
}
return rollupConfigs.size();
}
public long getDataPointIntervalMillis(long from, long to) throws Exception {
long millis = to - from;
long timeAgoMillis = clock.currentTimeMillis() - from;
List<Integer> rollupExpirationHours =
configRepository.getStorageConfig().rollupExpirationHours();
List<RollupConfig> rollupConfigs = configRepository.getRollupConfigs();
for (int i = 0; i < rollupConfigs.size() - 1; i++) {
RollupConfig currRollupConfig = rollupConfigs.get(i);
RollupConfig nextRollupConfig = rollupConfigs.get(i + 1);
int expirationHours = rollupExpirationHours.get(i);
if (millis < nextRollupConfig.viewThresholdMillis()
&& (expirationHours == 0 || HOURS.toMillis(expirationHours) > timeAgoMillis)) {
return currRollupConfig.intervalMillis();
}
}
return rollupConfigs.get(rollupConfigs.size() - 1).intervalMillis();
}
public static long getSafeRollupTime(long safeCurrentTime, long intervalMillis) {
return getFloorRollupTime(safeCurrentTime, intervalMillis);
}
public static long getFloorRollupTime(long captureTime, long intervalMillis) {
return (long) Math.floor(captureTime / (double) intervalMillis) * intervalMillis;
}
public static long getCeilRollupTime(long captureTime, long intervalMillis) {
return (long) Math.ceil(captureTime / (double) intervalMillis) * intervalMillis;
}
}
| [
"trask.stalnaker@gmail.com"
] | trask.stalnaker@gmail.com |
5b167bef371bef32be4ffd5fff70409605a322fe | 41acea3785317c2627ef5c624ebb8a956620956e | /Graydon Webservices Examples/src/uk/co/graydon/ws/GraydonDataService/types/GetCompanyMatchesByKeyword_ParametersType.java | de11ecb8e402894ed6cadee72dd090ad7c4b105b | [] | no_license | adham89/graydon-companydata-webservice-axis-client | 7e6259349dc1f7d0d5cf04b1adc354d41e1be75f | bd0f5f2b83318348fc2129ad3c5d5fbf51585a4b | refs/heads/master | 2021-01-01T05:23:58.045925 | 2008-07-17T11:59:17 | 2008-07-17T11:59:17 | 56,504,550 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,471 | java | /**
* GetCompanyMatchesByKeyword_ParametersType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package uk.co.graydon.ws.GraydonDataService.types;
/**
* All the request parameters for the 'getCompanyMatchesByKeyword'
* operation.
*/
public class GetCompanyMatchesByKeyword_ParametersType implements java.io.Serializable {
private uk.co.graydon.ws.GraydonDataService.types.Authentication_ParametersType authentication_Parameters;
private uk.co.graydon.ws.GraydonDataService.types.CompanyMatches_ParametersType companyMatches_Parameters;
/* Keyword to perform the match with. This should be one or part
* of one of the words the company name is constituted of. */
private java.lang.String keyword;
/* The city name of the company to be matched. Use exclusively
* with the 'Keyword' parameter. */
private java.lang.String city;
/* Postcode of the company being matched. Use exclusively with
* the 'Keyword' parameter. */
private java.lang.String postCode;
public GetCompanyMatchesByKeyword_ParametersType() {
}
public GetCompanyMatchesByKeyword_ParametersType(
uk.co.graydon.ws.GraydonDataService.types.Authentication_ParametersType authentication_Parameters,
uk.co.graydon.ws.GraydonDataService.types.CompanyMatches_ParametersType companyMatches_Parameters,
java.lang.String keyword,
java.lang.String city,
java.lang.String postCode) {
this.authentication_Parameters = authentication_Parameters;
this.companyMatches_Parameters = companyMatches_Parameters;
this.keyword = keyword;
this.city = city;
this.postCode = postCode;
}
/**
* Gets the authentication_Parameters value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @return authentication_Parameters
*/
public uk.co.graydon.ws.GraydonDataService.types.Authentication_ParametersType getAuthentication_Parameters() {
return authentication_Parameters;
}
/**
* Sets the authentication_Parameters value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @param authentication_Parameters
*/
public void setAuthentication_Parameters(uk.co.graydon.ws.GraydonDataService.types.Authentication_ParametersType authentication_Parameters) {
this.authentication_Parameters = authentication_Parameters;
}
/**
* Gets the companyMatches_Parameters value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @return companyMatches_Parameters
*/
public uk.co.graydon.ws.GraydonDataService.types.CompanyMatches_ParametersType getCompanyMatches_Parameters() {
return companyMatches_Parameters;
}
/**
* Sets the companyMatches_Parameters value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @param companyMatches_Parameters
*/
public void setCompanyMatches_Parameters(uk.co.graydon.ws.GraydonDataService.types.CompanyMatches_ParametersType companyMatches_Parameters) {
this.companyMatches_Parameters = companyMatches_Parameters;
}
/**
* Gets the keyword value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @return keyword * Keyword to perform the match with. This should be one or part
* of one of the words the company name is constituted of.
*/
public java.lang.String getKeyword() {
return keyword;
}
/**
* Sets the keyword value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @param keyword * Keyword to perform the match with. This should be one or part
* of one of the words the company name is constituted of.
*/
public void setKeyword(java.lang.String keyword) {
this.keyword = keyword;
}
/**
* Gets the city value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @return city * The city name of the company to be matched. Use exclusively
* with the 'Keyword' parameter.
*/
public java.lang.String getCity() {
return city;
}
/**
* Sets the city value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @param city * The city name of the company to be matched. Use exclusively
* with the 'Keyword' parameter.
*/
public void setCity(java.lang.String city) {
this.city = city;
}
/**
* Gets the postCode value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @return postCode * Postcode of the company being matched. Use exclusively with
* the 'Keyword' parameter.
*/
public java.lang.String getPostCode() {
return postCode;
}
/**
* Sets the postCode value for this GetCompanyMatchesByKeyword_ParametersType.
*
* @param postCode * Postcode of the company being matched. Use exclusively with
* the 'Keyword' parameter.
*/
public void setPostCode(java.lang.String postCode) {
this.postCode = postCode;
}
private java.lang.Object __equalsCalc = null;
@Override
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof GetCompanyMatchesByKeyword_ParametersType)) return false;
GetCompanyMatchesByKeyword_ParametersType other = (GetCompanyMatchesByKeyword_ParametersType) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.authentication_Parameters==null && other.getAuthentication_Parameters()==null) ||
(this.authentication_Parameters!=null &&
this.authentication_Parameters.equals(other.getAuthentication_Parameters()))) &&
((this.companyMatches_Parameters==null && other.getCompanyMatches_Parameters()==null) ||
(this.companyMatches_Parameters!=null &&
this.companyMatches_Parameters.equals(other.getCompanyMatches_Parameters()))) &&
((this.keyword==null && other.getKeyword()==null) ||
(this.keyword!=null &&
this.keyword.equals(other.getKeyword()))) &&
((this.city==null && other.getCity()==null) ||
(this.city!=null &&
this.city.equals(other.getCity()))) &&
((this.postCode==null && other.getPostCode()==null) ||
(this.postCode!=null &&
this.postCode.equals(other.getPostCode())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
@Override
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getAuthentication_Parameters() != null) {
_hashCode += getAuthentication_Parameters().hashCode();
}
if (getCompanyMatches_Parameters() != null) {
_hashCode += getCompanyMatches_Parameters().hashCode();
}
if (getKeyword() != null) {
_hashCode += getKeyword().hashCode();
}
if (getCity() != null) {
_hashCode += getCity().hashCode();
}
if (getPostCode() != null) {
_hashCode += getPostCode().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(GetCompanyMatchesByKeyword_ParametersType.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://ws.graydon.co.uk/GraydonDataService/types", "GetCompanyMatchesByKeyword_ParametersType"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("authentication_Parameters");
elemField.setXmlName(new javax.xml.namespace.QName("http://ws.graydon.co.uk/GraydonDataService/types", "Authentication_Parameters"));
elemField.setXmlType(new javax.xml.namespace.QName("http://ws.graydon.co.uk/GraydonDataService/types", "Authentication_ParametersType"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("companyMatches_Parameters");
elemField.setXmlName(new javax.xml.namespace.QName("http://ws.graydon.co.uk/GraydonDataService/types", "CompanyMatches_Parameters"));
elemField.setXmlType(new javax.xml.namespace.QName("http://ws.graydon.co.uk/GraydonDataService/types", "CompanyMatches_ParametersType"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("keyword");
elemField.setXmlName(new javax.xml.namespace.QName("http://ws.graydon.co.uk/GraydonDataService/types", "Keyword"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("city");
elemField.setXmlName(new javax.xml.namespace.QName("http://ws.graydon.co.uk/GraydonDataService/types", "City"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("postCode");
elemField.setXmlName(new javax.xml.namespace.QName("http://ws.graydon.co.uk/GraydonDataService/types", "PostCode"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| [
"DunicaBoy@fbdaf552-744f-0410-a151-f363ac942479"
] | DunicaBoy@fbdaf552-744f-0410-a151-f363ac942479 |
34e752b50c30867f6ccc2079ba567dd21ee1e47c | c1a21d08b4da129d42c2de8efb1c7ec2a9f06bd5 | /Lamda2/src/FunctionalInterR.java | 50f885c2f1723abee145f02505ff652d9150721e | [] | no_license | qkrekfthsus/Java_Practice | 9d55175bfa919f05ca500b73a237860e69405ca0 | a83dd02f538885f14488bc695cf251e2a07c30ba | refs/heads/main | 2023-04-10T23:03:34.012867 | 2021-04-22T06:22:28 | 2021-04-22T06:22:28 | 360,390,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 92 | java | @FunctionalInterface
public interface FunctionalInterR {
public int method(int x, int y);
} | [
"qkrekfthsus@naver.com"
] | qkrekfthsus@naver.com |
86bd830135bc75ea64073f93be28fd5449d09d0f | 933fbb7770d09afdf122522df49a51aa94620574 | /example/maven-root/project2/src/test/java/org/gradle/test/performance/smalljavamultiproject/project2/p5/Test118.java | 3730ff9d2f32fe77acfccc2d645cbc3fdcbba24a | [] | no_license | hoanghainguyen/gradle-maven-transform | cc62b277dfd821c828d51f1eb828036bf4fa1e6e | 7fe1bcaf564c5ccee7aa3458adc8e6b5385adf87 | refs/heads/master | 2020-03-22T07:53:29.514636 | 2017-12-10T20:57:48 | 2017-12-10T20:57:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,109 | java | package org.gradle.test.performance.smalljavamultiproject.project2.p5;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test118 {
Production118 objectUnderTest = new Production118();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"uklance@gmail.com"
] | uklance@gmail.com |
62498fa74ab9f36bea9b4e8583cc8affc9c3b10b | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/JacksonDatabind-111/com.fasterxml.jackson.databind.deser.CreatorProperty/default/9/com/fasterxml/jackson/databind/deser/CreatorProperty_ESTest.java | 3cf7600562ef3c692b28dc1b4c562b8288be4ccb | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 50,550 | java | /*
* This file was automatically generated by EvoSuite
* Fri Jul 30 03:19:12 GMT 2021
*/
package com.fasterxml.jackson.databind.deser;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.fasterxml.jackson.annotation.ObjectIdResolver;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.PropertyMetadata;
import com.fasterxml.jackson.databind.PropertyName;
import com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig;
import com.fasterxml.jackson.databind.deser.BasicDeserializerFactory;
import com.fasterxml.jackson.databind.deser.BeanDeserializerBase;
import com.fasterxml.jackson.databind.deser.BeanDeserializerFactory;
import com.fasterxml.jackson.databind.deser.CreatorProperty;
import com.fasterxml.jackson.databind.deser.DefaultDeserializationContext;
import com.fasterxml.jackson.databind.deser.NullValueProvider;
import com.fasterxml.jackson.databind.deser.SettableBeanProperty;
import com.fasterxml.jackson.databind.ext.CoreXMLDeserializers;
import com.fasterxml.jackson.databind.introspect.AnnotatedMember;
import com.fasterxml.jackson.databind.introspect.AnnotatedParameter;
import com.fasterxml.jackson.databind.introspect.AnnotatedWithParams;
import com.fasterxml.jackson.databind.introspect.AnnotationMap;
import com.fasterxml.jackson.databind.introspect.TypeResolutionContext;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
import com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer;
import com.fasterxml.jackson.databind.jsontype.impl.AsWrapperTypeDeserializer;
import com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver;
import com.fasterxml.jackson.databind.type.ArrayType;
import com.fasterxml.jackson.databind.type.MapType;
import com.fasterxml.jackson.databind.type.TypeBindings;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.databind.util.Annotations;
import java.io.DataInputStream;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.util.HashMap;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class CreatorProperty_ESTest extends CreatorProperty_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
PropertyName propertyName0 = PropertyName.USE_DEFAULT;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<HashMap> class0 = HashMap.class;
MapType mapType0 = typeFactory0.constructRawMapType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(mapType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(mapType0, classNameIdResolver0, "=j!Kt", true, mapType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, mapType0, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, 291, asPropertyTypeDeserializer0, propertyMetadata0);
creatorProperty0.setFallbackSetter(creatorProperty0);
BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance;
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// Undeclared exception!
// try {
creatorProperty0.deserializeAndSet((JsonParser) null, defaultDeserializationContext_Impl0, (Object) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.SettableBeanProperty", e);
// }
}
@Test(timeout = 4000)
public void test01() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.WRAPPER_OBJECT;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer((JavaType) null, classNameIdResolver0, "Su1;sLrm5^O]Cl3Ac!p", false, (JavaType) null, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4078), (Object) null, propertyMetadata0);
JsonDeserializer<Object> jsonDeserializer0 = creatorProperty0.getValueDeserializer();
JsonDeserializer<JsonFormat.Shape> jsonDeserializer1 = (JsonDeserializer<JsonFormat.Shape>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer());
CreatorProperty creatorProperty1 = new CreatorProperty(creatorProperty0, jsonDeserializer1, jsonDeserializer1);
SettableBeanProperty settableBeanProperty0 = creatorProperty1.withValueDeserializer(jsonDeserializer0);
assertEquals((-4078), creatorProperty1.getCreatorIndex());
assertFalse(settableBeanProperty0.hasValueDeserializer());
}
@Test(timeout = 4000)
public void test02() throws Throwable {
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<Integer> class0 = Integer.class;
ArrayType arrayType0 = typeFactory0.constructArrayType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(arrayType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXISTING_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(arrayType0, classNameIdResolver0, "oX$\"I$L{]", false, arrayType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
Class<HashMap> class1 = HashMap.class;
Class<Annotation> class2 = Annotation.class;
MapType mapType0 = typeFactory0.constructMapType(class1, class0, class2);
CreatorProperty creatorProperty0 = new CreatorProperty((PropertyName) null, mapType0, (PropertyName) null, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4091), jsonTypeInfo_As0, propertyMetadata0);
PropertyName propertyName0 = PropertyName.construct("[creator property, name '");
SettableBeanProperty settableBeanProperty0 = creatorProperty0.withName(propertyName0);
assertEquals((-4091), settableBeanProperty0.getCreatorIndex());
assertEquals("[creator property, name '", settableBeanProperty0.getName());
}
@Test(timeout = 4000)
public void test03() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
AsWrapperTypeDeserializer asWrapperTypeDeserializer0 = new AsWrapperTypeDeserializer((JavaType) null, classNameIdResolver0, "Su1;sLrm5^O]Cl3Ac!p", false, (JavaType) null);
Boolean boolean0 = Boolean.TRUE;
Integer integer0 = new Integer(86);
PropertyMetadata propertyMetadata0 = PropertyMetadata.construct(boolean0, "Su1;sLrm5^O]Cl3Ac!p", integer0, "Su1;sLrm5^O]Cl3Ac!p");
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asWrapperTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, 1112, classNameIdResolver0, propertyMetadata0);
JsonDeserializer<String> jsonDeserializer0 = (JsonDeserializer<String>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer());
creatorProperty0.markAsIgnorable();
creatorProperty0.withValueDeserializer(jsonDeserializer0);
assertTrue(creatorProperty0.isIgnorable());
}
@Test(timeout = 4000)
public void test04() throws Throwable {
PropertyName propertyName0 = PropertyName.USE_DEFAULT;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
AnnotationMap annotationMap0 = new AnnotationMap();
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 518, (Object) null, propertyMetadata0);
Class<DataInputStream>[] classArray0 = (Class<DataInputStream>[]) Array.newInstance(Class.class, 9);
creatorProperty0.setViews(classArray0);
SettableBeanProperty settableBeanProperty0 = creatorProperty0.withValueDeserializer((JsonDeserializer<?>) null);
assertEquals(518, settableBeanProperty0.getCreatorIndex());
assertNotSame(settableBeanProperty0, creatorProperty0);
}
@Test(timeout = 4000)
public void test05() throws Throwable {
AnnotationMap annotationMap0 = new AnnotationMap();
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED_OR_OPTIONAL;
CreatorProperty creatorProperty0 = new CreatorProperty((PropertyName) null, (JavaType) null, (PropertyName) null, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 134, (Object) null, propertyMetadata0);
creatorProperty0._propertyIndex = 134;
JsonDeserializer<String> jsonDeserializer0 = (JsonDeserializer<String>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer());
SettableBeanProperty settableBeanProperty0 = creatorProperty0.withValueDeserializer(jsonDeserializer0);
assertEquals(134, settableBeanProperty0.getCreatorIndex());
assertTrue(settableBeanProperty0.hasValueDeserializer());
}
@Test(timeout = 4000)
public void test06() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
AsWrapperTypeDeserializer asWrapperTypeDeserializer0 = new AsWrapperTypeDeserializer((JavaType) null, classNameIdResolver0, "Su1;sLrm5^O]Cl3Ac!p", false, (JavaType) null);
Class<Integer> class0 = Integer.class;
Boolean boolean0 = Boolean.TRUE;
Integer integer0 = new Integer(86);
PropertyMetadata propertyMetadata0 = PropertyMetadata.construct(boolean0, "Su1;sLrm5^O]Cl3Ac!p", integer0, "Su1;sLrm5^O]Cl3Ac!p");
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asWrapperTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, 1112, classNameIdResolver0, propertyMetadata0);
creatorProperty0.markAsIgnorable();
CoreXMLDeserializers.Std coreXMLDeserializers_Std0 = new CoreXMLDeserializers.Std(class0, 1112);
creatorProperty0.withNullProvider(coreXMLDeserializers_Std0);
assertTrue(creatorProperty0.isIgnorable());
}
@Test(timeout = 4000)
public void test07() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, (Annotations) null, (AnnotatedParameter) null, (-3362), (Object) null, propertyMetadata0);
Class<ObjectIdResolver>[] classArray0 = (Class<ObjectIdResolver>[]) Array.newInstance(Class.class, 1);
creatorProperty0.setViews(classArray0);
JsonDeserializer<Object> jsonDeserializer0 = SettableBeanProperty.MISSING_VALUE_DESERIALIZER;
SettableBeanProperty settableBeanProperty0 = creatorProperty0.withNullProvider(jsonDeserializer0);
assertEquals((-3362), settableBeanProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test08() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.WRAPPER_OBJECT;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer((JavaType) null, classNameIdResolver0, "Su1;sLrm5^O]Cl3Ac!p", false, (JavaType) null, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4078), (Object) null, propertyMetadata0);
JsonDeserializer<Object> jsonDeserializer0 = creatorProperty0.getValueDeserializer();
JsonDeserializer<JsonFormat.Shape> jsonDeserializer1 = (JsonDeserializer<JsonFormat.Shape>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer());
CreatorProperty creatorProperty1 = new CreatorProperty(creatorProperty0, jsonDeserializer1, jsonDeserializer1);
SettableBeanProperty settableBeanProperty0 = creatorProperty1.withNullProvider(jsonDeserializer0);
assertEquals((-4078), creatorProperty1.getCreatorIndex());
assertTrue(settableBeanProperty0.hasValueDeserializer());
}
@Test(timeout = 4000)
public void test09() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_OPTIONAL;
AnnotationMap annotationMap0 = new AnnotationMap();
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 3012, propertyName0, propertyMetadata0);
creatorProperty0._propertyIndex = 2144;
SettableBeanProperty settableBeanProperty0 = creatorProperty0.withNullProvider((NullValueProvider) null);
assertEquals(3012, settableBeanProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test10() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
AsWrapperTypeDeserializer asWrapperTypeDeserializer0 = new AsWrapperTypeDeserializer((JavaType) null, classNameIdResolver0, "Su1;sLrm5^O]Cl3Ac!p", false, (JavaType) null);
Boolean boolean0 = Boolean.TRUE;
Integer integer0 = new Integer(86);
PropertyMetadata propertyMetadata0 = PropertyMetadata.construct(boolean0, "Su1;sLrm5^O]Cl3Ac!p", integer0, "Su1;sLrm5^O]Cl3Ac!p");
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asWrapperTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, 1112, classNameIdResolver0, propertyMetadata0);
creatorProperty0.markAsIgnorable();
creatorProperty0.withName(propertyName0);
assertTrue(creatorProperty0.isIgnorable());
}
@Test(timeout = 4000)
public void test11() throws Throwable {
PropertyName propertyName0 = BeanDeserializerBase.TEMP_PROPERTY_NAME;
AnnotationMap annotationMap0 = new AnnotationMap();
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED_OR_OPTIONAL;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 3476, propertyMetadata0, propertyMetadata0);
Class<JavaType>[] classArray0 = (Class<JavaType>[]) Array.newInstance(Class.class, 6);
creatorProperty0.setViews(classArray0);
SettableBeanProperty settableBeanProperty0 = creatorProperty0.withName(propertyName0);
assertEquals(3476, settableBeanProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test12() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<HashMap> class0 = HashMap.class;
MapType mapType0 = typeFactory0.constructRawMapType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(mapType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXISTING_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(mapType0, classNameIdResolver0, "=j!Kt", true, mapType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, mapType0, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4091), typeFactory0, propertyMetadata0);
JsonDeserializer<ObjectIdGenerators.UUIDGenerator> jsonDeserializer0 = (JsonDeserializer<ObjectIdGenerators.UUIDGenerator>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer());
CreatorProperty creatorProperty1 = new CreatorProperty(creatorProperty0, jsonDeserializer0, jsonDeserializer0);
SettableBeanProperty settableBeanProperty0 = creatorProperty1.withName(propertyName0);
assertEquals((-4091), settableBeanProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test13() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<HashMap> class0 = HashMap.class;
MapType mapType0 = typeFactory0.constructRawMapType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(mapType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXISTING_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(mapType0, classNameIdResolver0, "=j!Kt", true, mapType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, mapType0, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4091), typeFactory0, propertyMetadata0);
creatorProperty0.assignIndex(0);
SettableBeanProperty settableBeanProperty0 = creatorProperty0.withName(propertyName0);
assertEquals((-4091), settableBeanProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test14() throws Throwable {
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_OPTIONAL;
AnnotationMap annotationMap0 = new AnnotationMap();
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 0, propertyMetadata0, propertyMetadata0);
creatorProperty0.assignIndex(1664);
SettableBeanProperty settableBeanProperty0 = creatorProperty0.withName(propertyName0);
assertEquals(0, settableBeanProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test15() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
AsWrapperTypeDeserializer asWrapperTypeDeserializer0 = new AsWrapperTypeDeserializer((JavaType) null, classNameIdResolver0, "Su1;sLrm5^O]Cl3Ac!p", false, (JavaType) null);
Boolean boolean0 = Boolean.TRUE;
Integer integer0 = new Integer(86);
PropertyMetadata propertyMetadata0 = PropertyMetadata.construct(boolean0, "Su1;sLrm5^O]Cl3Ac!p", integer0, "Su1;sLrm5^O]Cl3Ac!p");
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asWrapperTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, 1112, classNameIdResolver0, propertyMetadata0);
creatorProperty0.markAsIgnorable();
boolean boolean1 = creatorProperty0.isIgnorable();
assertTrue(boolean1);
}
@Test(timeout = 4000)
public void test16() throws Throwable {
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, (Annotations) null, (AnnotatedParameter) null, 0, (Object) null, propertyMetadata0);
creatorProperty0.getMember();
assertEquals(0, creatorProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test17() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.WRAPPER_OBJECT;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer((JavaType) null, classNameIdResolver0, "Su1;sLrm5^O]Cl3Ac!p", false, (JavaType) null, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty((PropertyName) null, (JavaType) null, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, 0, (Object) null, propertyMetadata0);
creatorProperty0.getInjectableValueId();
assertEquals(0, creatorProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test18() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.WRAPPER_ARRAY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer((JavaType) null, classNameIdResolver0, "", false, (JavaType) null, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, 2801, (Object) null, propertyMetadata0);
int int0 = creatorProperty0.getCreatorIndex();
assertEquals(2801, int0);
}
@Test(timeout = 4000)
public void test19() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXISTING_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer((JavaType) null, classNameIdResolver0, "Su1;sLrm5^O]Cl3Ac!p", false, (JavaType) null, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4078), jsonTypeInfo_As0, propertyMetadata0);
int int0 = creatorProperty0.getCreatorIndex();
assertEquals((-4078), int0);
}
@Test(timeout = 4000)
public void test20() throws Throwable {
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_OPTIONAL;
AnnotationMap annotationMap0 = new AnnotationMap();
CreatorProperty creatorProperty0 = new CreatorProperty((PropertyName) null, (JavaType) null, (PropertyName) null, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 1, (Object) null, propertyMetadata0);
CreatorProperty creatorProperty1 = new CreatorProperty(creatorProperty0, (PropertyName) null);
// Undeclared exception!
// try {
creatorProperty1.toString();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.SettableBeanProperty", e);
// }
}
@Test(timeout = 4000)
public void test21() throws Throwable {
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_OPTIONAL;
CreatorProperty creatorProperty0 = new CreatorProperty((PropertyName) null, (JavaType) null, (PropertyName) null, (TypeDeserializer) null, (Annotations) null, (AnnotatedParameter) null, 0, (Object) null, propertyMetadata0);
CreatorProperty creatorProperty1 = new CreatorProperty(creatorProperty0, (PropertyName) null);
// Undeclared exception!
// try {
creatorProperty1.setAndReturn((Object) null, (Object) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.SettableBeanProperty", e);
// }
}
@Test(timeout = 4000)
public void test22() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
AnnotationMap annotationMap0 = new AnnotationMap();
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, (PropertyName) null, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 1995, propertyName0, propertyMetadata0);
CreatorProperty creatorProperty1 = new CreatorProperty(creatorProperty0, (PropertyName) null);
// Undeclared exception!
// try {
creatorProperty1.set((Object) null, (Object) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.SettableBeanProperty", e);
// }
}
@Test(timeout = 4000)
public void test23() throws Throwable {
PropertyName propertyName0 = PropertyName.USE_DEFAULT;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
AnnotationMap annotationMap0 = new AnnotationMap();
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 518, (Object) null, propertyMetadata0);
DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig();
BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0);
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// try {
creatorProperty0.findInjectableValue(defaultDeserializationContext_Impl0, (Object) null);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Property '' (type com.fasterxml.jackson.databind.deser.CreatorProperty) has no injectable value id configured
// //
// verifyException("com.fasterxml.jackson.databind.exc.InvalidDefinitionException", e);
// }
}
@Test(timeout = 4000)
public void test24() throws Throwable {
PropertyName propertyName0 = PropertyName.USE_DEFAULT;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<HashMap> class0 = HashMap.class;
MapType mapType0 = typeFactory0.constructRawMapType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(mapType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(mapType0, classNameIdResolver0, "=~0K\"t", true, mapType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, mapType0, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, 291, asPropertyTypeDeserializer0, propertyMetadata0);
creatorProperty0.setFallbackSetter(creatorProperty0);
BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance;
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// Undeclared exception!
// try {
creatorProperty0.deserializeSetAndReturn((JsonParser) null, defaultDeserializationContext_Impl0, jsonTypeInfo_As0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.SettableBeanProperty", e);
// }
}
@Test(timeout = 4000)
public void test25() throws Throwable {
PropertyName propertyName0 = BeanDeserializerBase.TEMP_PROPERTY_NAME;
CreatorProperty creatorProperty0 = null;
// try {
creatorProperty0 = new CreatorProperty((CreatorProperty) null, propertyName0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase", e);
// }
}
@Test(timeout = 4000)
public void test26() throws Throwable {
CreatorProperty creatorProperty0 = null;
// try {
creatorProperty0 = new CreatorProperty((CreatorProperty) null, (JsonDeserializer<?>) null, (NullValueProvider) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase", e);
// }
}
@Test(timeout = 4000)
public void test27() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<HashMap> class0 = HashMap.class;
MapType mapType0 = typeFactory0.constructRawMapType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(mapType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXISTING_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(mapType0, classNameIdResolver0, "=j!Kt", true, mapType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, mapType0, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4091), typeFactory0, propertyMetadata0);
DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig();
BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0);
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// Undeclared exception!
// try {
creatorProperty0.findInjectableValue(defaultDeserializationContext_Impl0, typeFactory0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.DeserializationContext", e);
// }
}
@Test(timeout = 4000)
public void test28() throws Throwable {
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED_OR_OPTIONAL;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, (Annotations) null, (AnnotatedParameter) null, 0, (Object) null, propertyMetadata0);
// Undeclared exception!
// try {
creatorProperty0.findInjectableValue((DeserializationContext) null, propertyMetadata0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.CreatorProperty", e);
// }
}
@Test(timeout = 4000)
public void test29() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_OPTIONAL;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, (Annotations) null, (AnnotatedParameter) null, (-2306), propertyName0, propertyMetadata0);
CreatorProperty creatorProperty1 = new CreatorProperty(creatorProperty0, propertyName0);
creatorProperty0._fallbackSetter = (SettableBeanProperty) creatorProperty1;
// try {
creatorProperty0.set((Object) null, (Object) null);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // No fallback setter/field defined for creator property '@JsonUnwrapped'
// //
// verifyException("com.fasterxml.jackson.databind.exc.InvalidDefinitionException", e);
// }
}
@Test(timeout = 4000)
public void test30() throws Throwable {
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
AnnotationMap annotationMap0 = new AnnotationMap();
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 361, propertyMetadata0, propertyMetadata0);
Class<Annotation> class0 = Annotation.class;
creatorProperty0.getAnnotation(class0);
assertEquals(361, creatorProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test31() throws Throwable {
PropertyName propertyName0 = PropertyName.NO_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.WRAPPER_ARRAY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer((JavaType) null, classNameIdResolver0, "Duplicate field '", true, (JavaType) null, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED_OR_OPTIONAL;
AnnotatedParameter annotatedParameter0 = new AnnotatedParameter((AnnotatedWithParams) null, (JavaType) null, (TypeResolutionContext) null, (AnnotationMap) null, (-140));
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, annotatedParameter0, (-140), (Object) null, propertyMetadata0);
Class<Annotation> class0 = Annotation.class;
creatorProperty0.getAnnotation(class0);
assertEquals((-140), creatorProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test32() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED_OR_OPTIONAL;
AnnotationMap annotationMap0 = new AnnotationMap();
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 56320, (Object) null, propertyMetadata0);
BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance;
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// try {
creatorProperty0.inject(defaultDeserializationContext_Impl0, (Object) null);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Property '@JsonUnwrapped' (type com.fasterxml.jackson.databind.deser.CreatorProperty) has no injectable value id configured
// //
// verifyException("com.fasterxml.jackson.databind.exc.InvalidDefinitionException", e);
// }
}
@Test(timeout = 4000)
public void test33() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<HashMap> class0 = HashMap.class;
MapType mapType0 = typeFactory0.constructRawMapType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(mapType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXISTING_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(mapType0, classNameIdResolver0, "=j!Kt", true, mapType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, mapType0, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4091), typeFactory0, propertyMetadata0);
JsonDeserializer<ObjectIdGenerators.UUIDGenerator> jsonDeserializer0 = (JsonDeserializer<ObjectIdGenerators.UUIDGenerator>) mock(JsonDeserializer.class, new ViolatedAssumptionAnswer());
CreatorProperty creatorProperty1 = new CreatorProperty(creatorProperty0, jsonDeserializer0, jsonDeserializer0);
creatorProperty1.setFallbackSetter(creatorProperty0);
creatorProperty1.fixAccess((DeserializationConfig) null);
assertEquals((-4091), creatorProperty1.getCreatorIndex());
}
@Test(timeout = 4000)
public void test34() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<HashMap> class0 = HashMap.class;
MapType mapType0 = typeFactory0.constructRawMapType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(mapType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXISTING_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(mapType0, classNameIdResolver0, "=j!Kt", true, mapType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, mapType0, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4091), typeFactory0, propertyMetadata0);
creatorProperty0.fixAccess((DeserializationConfig) null);
assertEquals((-4091), creatorProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test35() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_OPTIONAL;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, (Annotations) null, (AnnotatedParameter) null, 0, (Object) null, propertyMetadata0);
JsonDeserializer<Object> jsonDeserializer0 = creatorProperty0._valueDeserializer;
SettableBeanProperty settableBeanProperty0 = creatorProperty0.withValueDeserializer(jsonDeserializer0);
assertSame(settableBeanProperty0, creatorProperty0);
assertEquals(0, settableBeanProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test36() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<HashMap> class0 = HashMap.class;
MapType mapType0 = typeFactory0.constructRawMapType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(mapType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXISTING_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(mapType0, classNameIdResolver0, "=j!Kt", true, mapType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, mapType0, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4091), typeFactory0, propertyMetadata0);
creatorProperty0.isIgnorable();
assertEquals((-4091), creatorProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test37() throws Throwable {
PropertyName propertyName0 = PropertyName.NO_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver((JavaType) null, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXTERNAL_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer((JavaType) null, classNameIdResolver0, "", true, (JavaType) null, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, 0, jsonTypeInfo_As0, propertyMetadata0);
int int0 = creatorProperty0.getCreatorIndex();
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test38() throws Throwable {
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED_OR_OPTIONAL;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, (Annotations) null, (AnnotatedParameter) null, (-1145), propertyName0, propertyMetadata0);
// try {
creatorProperty0.deserializeAndSet((JsonParser) null, (DeserializationContext) null, creatorProperty0);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // No fallback setter/field defined for creator property ''
// //
// verifyException("com.fasterxml.jackson.databind.exc.InvalidDefinitionException", e);
// }
}
@Test(timeout = 4000)
public void test39() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_OPTIONAL;
AnnotationMap annotationMap0 = new AnnotationMap();
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 3012, propertyName0, propertyMetadata0);
// Undeclared exception!
// try {
creatorProperty0.inject((DeserializationContext) null, (Object) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.CreatorProperty", e);
// }
}
@Test(timeout = 4000)
public void test40() throws Throwable {
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, (Annotations) null, (AnnotatedParameter) null, 0, (Object) null, propertyMetadata0);
String string0 = creatorProperty0.toString();
assertEquals("[creator property, name ''; inject id 'null']", string0);
assertEquals(0, creatorProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test41() throws Throwable {
PropertyName propertyName0 = BasicDeserializerFactory.UNWRAPPED_CREATOR_PARAM_NAME;
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<HashMap> class0 = HashMap.class;
MapType mapType0 = typeFactory0.constructRawMapType(class0);
ClassNameIdResolver classNameIdResolver0 = new ClassNameIdResolver(mapType0, typeFactory0);
JsonTypeInfo.As jsonTypeInfo_As0 = JsonTypeInfo.As.EXISTING_PROPERTY;
AsPropertyTypeDeserializer asPropertyTypeDeserializer0 = new AsPropertyTypeDeserializer(mapType0, classNameIdResolver0, "=j!Kt", true, mapType0, jsonTypeInfo_As0);
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, mapType0, propertyName0, asPropertyTypeDeserializer0, (Annotations) null, (AnnotatedParameter) null, (-4091), typeFactory0, propertyMetadata0);
Object object0 = creatorProperty0.getInjectableValueId();
assertEquals((-4091), creatorProperty0.getCreatorIndex());
assertNotNull(object0);
}
@Test(timeout = 4000)
public void test42() throws Throwable {
PropertyName propertyName0 = PropertyName.USE_DEFAULT;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_OPTIONAL;
Class<TypeIdResolver> class0 = TypeIdResolver.class;
JavaType[] javaTypeArray0 = new JavaType[5];
TypeBindings typeBindings0 = TypeBindings.createIfNeeded(class0, javaTypeArray0);
TypeResolutionContext.Basic typeResolutionContext_Basic0 = new TypeResolutionContext.Basic((TypeFactory) null, typeBindings0);
AnnotationMap annotationMap0 = new AnnotationMap();
AnnotatedParameter annotatedParameter0 = new AnnotatedParameter((AnnotatedWithParams) null, (JavaType) null, typeResolutionContext_Basic0, annotationMap0, 202);
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, (Annotations) null, annotatedParameter0, 202, javaTypeArray0[0], propertyMetadata0);
AnnotatedMember annotatedMember0 = creatorProperty0.getMember();
assertNotNull(annotatedMember0);
assertEquals(202, creatorProperty0.getCreatorIndex());
}
@Test(timeout = 4000)
public void test43() throws Throwable {
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_OPTIONAL;
PropertyName propertyName0 = PropertyName.NO_NAME;
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, (Annotations) null, (AnnotatedParameter) null, 0, (Object) null, propertyMetadata0);
// try {
creatorProperty0.deserializeSetAndReturn((JsonParser) null, (DeserializationContext) null, (Object) null);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // No fallback setter/field defined for creator property ''
// //
// verifyException("com.fasterxml.jackson.databind.exc.InvalidDefinitionException", e);
// }
}
@Test(timeout = 4000)
public void test44() throws Throwable {
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyMetadata propertyMetadata0 = PropertyMetadata.STD_REQUIRED;
AnnotationMap annotationMap0 = new AnnotationMap();
CreatorProperty creatorProperty0 = new CreatorProperty(propertyName0, (JavaType) null, propertyName0, (TypeDeserializer) null, annotationMap0, (AnnotatedParameter) null, 361, propertyMetadata0, propertyMetadata0);
// try {
creatorProperty0.setAndReturn((Object) null, (Object) null);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // No fallback setter/field defined for creator property ''
// //
// verifyException("com.fasterxml.jackson.databind.exc.InvalidDefinitionException", e);
// }
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
95769dbc1dbacbf9b9c3696d4c2bbc2311279d2c | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/11838/tar_0.java | 30a8563c955cc62708d4264b949a8d0ad6c38073 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,630 | java | package org.eclipse.swt.widgets;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.graphics.*;
/**
* Instances of this class are controls which are capable
* of containing other controls.
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE</dd>
* <dt><b>Events:</b></dt>
* <dd>(none)</dd>
* </dl>
* <p>
* This class may be subclassed by custom control implementors
* who are building controls that are constructed from aggregates
* of other controls.
* </p>
*
* @see Canvas
*/
public class Composite extends Scrollable {
/* boxHandle is temporarily here, until eclipsefixed gets fixed */
int boxHandle, fixedHandle, radioHandle;
Layout layout;
/*
* === CONSTRUCTORS ===
*/
Composite () {
/* Do nothing */
}
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
* <p>
* The style value is either one of the style constants defined in
* class <code>SWT</code> which is applicable to instances of this
* class, or must be built by <em>bitwise OR</em>'ing together
* (that is, using the <code>int</code> "|" operator) two or more
* of those <code>SWT</code> style constants. The class description
* for all SWT widget classes should include a comment which
* describes the style constants which are applicable to the class.
* </p>
*
* @param parent a widget which will be the parent of the new instance (cannot be null)
* @param style the style of widget to construct
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
* </ul>
*
* @see SWT
* @see Widget#checkSubclass
* @see Widget#getStyle
*/
public Composite (Composite parent, int style) {
super (parent, style);
}
/*
* === Handle code begins ===
*/
void createHandle (int index) {
state |= HANDLE | CANVAS;
scrolledHandle = OS.gtk_scrolled_window_new(0,0);
if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
boxHandle = OS.gtk_event_box_new();
if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
fixedHandle = OS.eclipse_fixed_new();
if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
handle = OS.gtk_drawing_area_new();
if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_CAN_FOCUS);
}
void configure() {
parent._connectChild(scrolledHandle);
OS.gtk_container_add(scrolledHandle, boxHandle);
OS.gtk_container_add(boxHandle, fixedHandle);
OS.gtk_container_add(fixedHandle, handle);
}
void setHandleStyle() {
setScrollingPolicy();
}
void showHandle() {
OS.gtk_widget_show_now (scrolledHandle);
OS.gtk_widget_show_now (boxHandle);
OS.gtk_widget_show_now (fixedHandle);
OS.gtk_widget_realize (handle);
OS.gtk_widget_show_now (handle);
}
void hookEvents () {
signal_connect_after (handle, "expose_event", SWT.Paint, 3);
int mask =
OS.GDK_POINTER_MOTION_MASK |
OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK |
OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK |
OS.GDK_FOCUS_CHANGE_MASK;
OS.gtk_widget_add_events (handle, mask);
signal_connect_after (handle, "motion_notify_event", SWT.MouseMove, 3);
signal_connect_after (handle, "button_press_event", SWT.MouseDown, 3);
signal_connect_after (handle, "button_release_event", SWT.MouseUp, 3);
signal_connect_after (handle, "enter_notify_event", SWT.MouseEnter, 3);
signal_connect_after (handle, "leave_notify_event", SWT.MouseExit, 3);
signal_connect_after (handle, "key_press_event", SWT.KeyDown, 3);
signal_connect_after (handle, "key_release_event", SWT.KeyUp, 3);
signal_connect_after (handle, "focus_in_event", SWT.FocusIn, 3);
signal_connect_after (handle, "focus_out_event", SWT.FocusOut, 3);
}
int topHandle() { return scrolledHandle; }
int parentingHandle() { return fixedHandle; }
boolean isMyHandle(int h) {
if (h==boxHandle) return true;
if (h==fixedHandle) return true;
return super.isMyHandle(h);
}
/*
* === GEOMETRY - PHYSICAL ===
*/
public void setBounds (int x, int y, int width, int height) {
super.setBounds (x, y, width, height);
layout();
}
public void setSize (int width, int height) {
super.setSize(width, height);
layout();
}
void _setSize(int width, int height) {
OS.eclipse_fixed_set_size(parent.parentingHandle(), topHandle(), width, height);
/* FIXME */
if ((style&SWT.V_SCROLL) != 0) width -= 18; width = Math.max(width, 0);
if ((style&SWT.H_SCROLL) != 0) height -= 18; height = Math.max(height, 0);
OS.eclipse_fixed_set_size(fixedHandle, handle, width, height);
}
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
Point size;
if (layout != null) {
if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
size = layout.computeSize (this, wHint, hHint, changed);
} else {
size = new Point (wHint, hHint);
}
} else {
size = minimumSize ();
}
if (size.x == 0) size.x = DEFAULT_WIDTH;
if (size.y == 0) size.y = DEFAULT_HEIGHT;
if (wHint != SWT.DEFAULT) size.x = wHint;
if (hHint != SWT.DEFAULT) size.y = hHint;
Rectangle trim = computeTrim (0, 0, size.x, size.y);
return new Point (trim.width, trim.height);
}
/*
* === GEOMETRY - LAYOUT ===
*/
/**
* Returns layout which is associated with the receiver, or
* null if one has not been set.
*
* @return the receiver's layout or null
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Layout getLayout () {
checkWidget();
return layout;
}
/**
* Gets the last specified tabbing order for the control.
*
* @return tabList the ordered list of controls representing the tab order
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #setTabList
*/
public Control [] getTabList () {
return new Control [0];
}
/**
* Sets the layout which is associated with the receiver to be
* the argument which may be null.
*
* @param layout the receiver's new layout or null
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setLayout (Layout layout) {
checkWidget();
this.layout = layout;
}
/**
* Returns an array containing the receiver's children.
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of children, so modifying the array will
* not affect the receiver.
* </p>
*
* @return an array of children
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Control [] getChildren () {
checkWidget();
return _getChildren(parentingHandle());
}
/**
* Answer the array of the children of the specified handle,
* filtering out widgets we don't consider our children.
* That is, the OS may return some children that don't qualify
* as such under SWT terminology - e.g., Items are not children.
*/
Control [] _getChildren (int h) {
if (h==0) {
error(SWT.ERROR_UNSPECIFIED);
}
int list = OS.gtk_container_children (h);
int count = OS.g_list_length (list);
java.util.Vector children = new java.util.Vector();
for (int i=0; i<count; i++) {
int data = OS.g_list_nth_data (list, i);
if (!isMyHandle(data)) {
Control child = _childFromHandle(data);
if (child != null) children.addElement(child);
}
}
Control[] answer = new Control[children.size()];
children.copyInto(answer);
return answer;
}
/**
* Consider the argument a handle of one of the receiver's children.
* If the argument is not a handle to a widget, or the widget is
* not our child in SWT (not OS) terminology, return null.
*/
Control _childFromHandle(int h) {
Widget child = WidgetTable.get(h);
return (Control)child;
}
public Rectangle getClientArea () {
checkWidget();
/* We can not measure the actual size of the client area,
* because it may not have propagated down yet.
*/
Point size = _getSize();
/* FIXME - this code assumes the scrollbars are to the right */
/* FIXME - I just measured the size on one particular theme. */
if ((style & SWT.V_SCROLL) != 0) size.x -= 18;
if ((style & SWT.H_SCROLL) != 0) size.y -= 18;
return new Rectangle(0,0, size.x, size.y);
}
/**
* If the receiver has a layout, asks the layout to <em>lay out</em>
* (that is, set the size and location of) the receiver's children.
* If the receiver does not have a layout, do nothing.
* <p>
* This is equivalent to calling <code>layout(true)</code>.
* </p>
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void layout () {
layout (true);
}
/**
* If the receiver has a layout, asks the layout to <em>lay out</em>
* (that is, set the size and location of) the receiver's children.
* If the the argument is <code>true</code> the layout must not rely
* on any cached information it is keeping about the children. If it
* is <code>false</code> the layout may (potentially) simplify the
* work it is doing by assuming that the state of the none of the
* receiver's children has changed since the last layout.
* If the receiver does not have a layout, do nothing.
*
* @param changed <code>true</code> if the layout must flush its caches, and <code>false</code> otherwise
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void layout (boolean changed) {
checkWidget();
if (layout == null) return;
layout.layout (this, changed);
}
Point minimumSize () {
Control [] children = _getChildren (parentingHandle());
int width = 0, height = 0;
for (int i=0; i<children.length; i++) {
Rectangle rect = children [i].getBounds ();
width = Math.max (width, rect.x + rect.width);
height = Math.max (height, rect.y + rect.height);
}
return new Point (width, height);
}
int radioGroup() {
if (radioHandle==0) _initializeRadioGroup();
return OS.gtk_radio_button_group(radioHandle);
}
public void redraw () {
checkWidget();
OS.gtk_widget_queue_draw(paintHandle());
}
void _initializeRadioGroup() {
radioHandle = OS.gtk_radio_button_new(0);
}
/**
* Adopt the widget h as our child.
*/
void _connectChild (int h) {
OS.gtk_container_add (parentingHandle(), h);
}
void releaseChildren () {
Control [] children = _getChildren (parentingHandle());
for (int i=0; i<children.length; i++) {
Control child = children [i];
if (child != null && !child.isDisposed ()) {
child.releaseWidget ();
child.releaseHandle ();
}
}
}
void releaseWidget () {
releaseChildren ();
super.releaseWidget ();
layout = null;
}
void releaseHandle () {
super.releaseHandle ();
boxHandle = radioHandle = 0;
}
int processMouseDown (int callData, int arg1, int int2) {
//NOT DONE - only grab when not already grabbing
if ((state & CANVAS) != 0) OS.gtk_grab_add (handle);
return super.processMouseDown (callData, arg1, int2);
}
int processMouseUp (int callData, int arg1, int int2) {
//NOT DONE - only release when last button goes up
if ((state & CANVAS) != 0) OS.gtk_grab_remove (handle);
return super.processMouseUp (callData, arg1, int2);
}
int processFocusIn(int int0, int int1, int int2) {
OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_HAS_FOCUS);
return super.processFocusIn(int0, int1, int2);
}
int processFocusOut(int int0, int int1, int int2) {
OS.GTK_WIDGET_UNSET_FLAGS(handle, OS.GTK_HAS_FOCUS);
return super.processFocusOut(int0, int1, int2);
}
public boolean setFocus () {
checkWidget();
Control [] children = _getChildren (parentingHandle());
for (int i=0; i<children.length; i++) {
Control child = children [i];
if (child.getVisible () && child.setFocus ()) return true;
}
return super.setFocus ();
}
/**
* Sets the tabbing order for the specified controls to
* match the order that they occur in the argument list.
*
* @param tabList the ordered list of controls representing the tab order; must not be null
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the tabList is null</li>
* <li>ERROR_INVALID_ARGUMENT - if a widget in the tabList is null or has been disposed</li>
* <li>ERROR_INVALID_PARENT - if widget in the tabList is not in the same widget tree</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setTabList (Control [] tabList) {
}
protected void checkSubclass () {
/* Do nothing - Subclassing is allowed */
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
e43c4eee3b9638a121ee2a6a85794469622f4cf8 | d98484ae7fc1a911b4e8e0fc18adba68bc30820b | /src/main/java/com/github/drxaos/edu/spacerace/Models/Model.java | f88705e13ea6ea00eb690308bacf70150644b4b4 | [] | no_license | KiraTanaka/spacerace | 5d388abca70332535c6fa31f6d4767083e284044 | b126ed5458e7de5815627d2b3851ed8da4fc8eea | refs/heads/master | 2020-05-23T08:14:48.298981 | 2016-10-08T07:54:46 | 2016-10-08T07:54:46 | 70,272,904 | 0 | 0 | null | 2016-10-08T07:54:46 | 2016-10-07T18:33:53 | Java | UTF-8 | Java | false | false | 985 | java | package com.github.drxaos.edu.spacerace.Models;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
/**
* Created by Akira on 20.09.2016.
*/
public abstract class Model {
protected Point2D.Double point=point=new Point2D.Double();
public Model(){
}
BufferedImage image;
public double getX(){
return point.getX();
}
public double getY(){
return point.getY();
}
public Point2D.Double getPoint(){
return point;
}
public void setPosition(double value_x, double value_y)
{
point.setLocation(value_x,value_y);
}
public void addPosition(double value_x, double value_y) {
point.setLocation(point.getX()+value_x,point.getY()+value_y);
}
public void speedChangeInCollision(double ax, double ay,double multiplier_x,double multiplier_y){}
public void speedChangeInCollision(double ax, double ay){}
public void speedChangeInCollision(){}
public void move(){}
}
| [
"suein_i@mail.ru"
] | suein_i@mail.ru |
14872b753a26dba296162f76893c0ec099fa3803 | 00cf8141ddf54700c5b0c54cd696ca17c7ee67b1 | /TestTen-master/src/main/java/com/bwie/testten/classify/ClassifyConstract.java | 1e18d4fda1cea0a67c9cb86ca4d48630c78d98ec | [] | no_license | wuzijingwu/Tent | 646ce475e98e7a3318091436d9f1d14c13ac1ec0 | aefc156ee49dc74bd829369227838e15e5e86c37 | refs/heads/master | 2021-09-01T06:29:28.004138 | 2017-12-25T10:36:03 | 2017-12-25T10:36:03 | 115,309,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 930 | java | package com.bwie.testten.classify;
import com.bwie.testten.classify.bean.OneBean;
import com.bwie.testten.classify.bean.TwoBean;
import java.util.List;
public interface ClassifyConstract {
interface IClassifyView{
void ShowList(List<OneBean.DataBean> list);
void ShowRight(List<TwoBean.DataBean> list);
void ShowError(String e);
}
interface IClassifyModel{
void OnRequestsListener(String url,OnRequestListener onRequestListener);
void OnRightData(String url,int cid,OnRightListener onRightListener);
}
interface OnRightListener{
void OnSuccess(List<TwoBean.DataBean> list);
void OnError(String e);
}
interface OnRequestListener{
void OnSuccess(List<OneBean.DataBean> list);
void OnError(String e);
}
interface IClassifyPresenter{
void LoadList(String url);
void LoadRight(String url,int cid);
}
}
| [
"1944379174@qq.com"
] | 1944379174@qq.com |
25335ce1c7b43b2fda86bb8a820108b6b1b3a605 | 1209c73cf6aa253fb92f3b47a3826d115eee0e1f | /app/src/test/java/com/mantis/ipc/ExampleUnitTest.java | a0de55bc1ae0a0f2af773732c23ebf74a14402ea | [] | no_license | zq019633/MantisIpc | 105eb55539d858a4f18ffd43e1925e87db76e90e | 7e77d67bc4eebeb8eea088de779f2eab4535d9ea | refs/heads/master | 2020-07-20T21:10:28.035033 | 2019-09-06T04:02:48 | 2019-09-06T04:02:48 | 206,709,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package com.mantis.ipc;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"1020498110@qq.com"
] | 1020498110@qq.com |
bb817c2aaa94aed8aba1d88b606195ae3dae9e2e | b46c8c47be6526824d040ae7717c1ab59700e926 | /src/main/java/com/tsystems/logiweb/services/TransactionManager.java | 7cf7ab17f103cc342814ca090b11386780704203 | [] | no_license | mvolkov1/Logiweb | 8b5a1efa0a68ee6837c3e1025daddce99687b361 | 18d154a67f26bab699269fe866e0eca4ae65eb29 | refs/heads/master | 2021-01-20T19:36:31.300575 | 2017-12-20T09:56:11 | 2017-12-20T09:56:11 | 61,067,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,568 | java | package com.tsystems.logiweb.services;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
/**
* Created by mvolkov on 17.06.2016.
*/
public class TransactionManager {
private static final EntityManagerFactory emf;
private static final ThreadLocal<EntityManager> tlEntityManager;
static{
emf = Persistence.createEntityManagerFactory("logiweb");
tlEntityManager = new ThreadLocal<EntityManager>();
}
public static EntityManager getEntityManager() {
EntityManager entityManager = tlEntityManager.get();
if (entityManager==null){
entityManager = emf.createEntityManager();
tlEntityManager.set(entityManager);
}
return entityManager;
}
public static void closeEntityManager() {
EntityManager entityManager = tlEntityManager.get();
if (entityManager != null) {
entityManager.close();
tlEntityManager.set(null);
}
}
public static void closeEntityManagerFactory() {
emf.close();
}
public static void beginTransaction() {
getEntityManager().getTransaction().begin();
}
public static void rollback() {
if (getEntityManager().getTransaction().isActive())
getEntityManager().getTransaction().rollback();
}
public static void commit() {
getEntityManager().getTransaction().commit();
// getEntityManager().flush();
getEntityManager().clear();
}
}
| [
"mvvolkov@mail.ru"
] | mvvolkov@mail.ru |
0bec94daafb5947ceeb95571d898f448d5c414c1 | 94b7b681568b6eef1276619cb9d753cd08c4b9c3 | /mingle/src/ly/nativeapp/mingle/ResizableImageView.java | 693041cf1f1ed627ada76eda9120003678011ba1 | [] | no_license | dokwon/mingle_final_client | 8612a9516cec1044e28d802796f4862af050b4b8 | a6b5edbb49e1554c629e16099b8bace516138caf | refs/heads/master | 2020-04-23T20:31:11.840716 | 2014-09-15T08:23:22 | 2014-09-15T08:23:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | package ly.nativeapp.mingle;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
public class ResizableImageView extends ImageView {
public ResizableImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
Drawable d = getDrawable();
if(d!=null){
// ceil not round - avoid thin vertical gaps along the left/right edges
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = (int) Math.ceil((float) width * (float) d.getIntrinsicHeight() / (float) d.getIntrinsicWidth());
setMeasuredDimension(width, height);
}else{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
} | [
"dokwon@stanford.edu"
] | dokwon@stanford.edu |
8960d97c9c6bc459133a585221928a39321d80d9 | c410d90987c58b13510d05a19db709d7d13ece07 | /src/chap02/PasswordChangeService.java | 5efe002e053c8171fdc3e506695122b659a33a6b | [] | no_license | xodgree/springPro01 | b473208bb57a5659e96250f429b4426a2ec56998 | e2fe29146c73e954d0057b58f1972fbe1f61175d | refs/heads/master | 2021-04-09T11:40:07.322017 | 2018-03-22T08:48:02 | 2018-03-22T08:48:02 | null | 0 | 0 | null | null | null | null | UHC | Java | false | false | 574 | java | package chap02;
public class PasswordChangeService {
private UserRepository userRepository;
//생성자를 통해서 필요한 값을 전달받는다.(생성자 방식)
public PasswordChangeService(UserRepository userRepository) {
this.userRepository = userRepository;
}
public void changePassword(String userId, String oldPw, String newPw) {
User user = userRepository.findUserById(userId);
if(user == null)
throw new UserNotFoundException();
user.changePassword(oldPw, newPw);
System.out.println("changePassword"+":"+newPw);
}
}
| [
"zhdzhdgl@gmail.com"
] | zhdzhdgl@gmail.com |
ed9ab453090b04f7902445f03f2c93f816e47bb7 | 6c3528d04e4ff956af8e5cd8d5fde03199ed7b7b | /alojinha/app/src/main/java/br/com/alojinha/ui/activity/HomeActivity.java | e35027f24d922d25fc50bbf36a443e1842ba5ae4 | [] | no_license | AndersonPacheco/aLojinha | f2fbef5ec9eb4cacbcd30b8731dbba5f9f1197d7 | 3bf70c94cef02468c051bf8139f8b13429ed412f | refs/heads/master | 2020-04-29T13:01:59.347092 | 2019-03-17T21:45:01 | 2019-03-17T21:45:01 | 176,158,098 | 0 | 0 | null | 2019-04-16T12:28:11 | 2019-03-17T20:40:29 | Java | UTF-8 | Java | false | false | 3,534 | java | package br.com.alojinha.ui.activity;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import br.com.alojinha.R;
public class HomeActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_camera) {
// Handle the camera action
} else if (id == R.id.nav_gallery) {
} else if (id == R.id.nav_slideshow) {
} else if (id == R.id.nav_manage) {
} else if (id == R.id.nav_share) {
} else if (id == R.id.nav_send) {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
| [
"derson_rpm@hotmail.com"
] | derson_rpm@hotmail.com |
6ead6d8a86fc696f62a443343eaf39d375435ec6 | 5bb4a4b0364ec05ffb422d8b2e76374e81c8c979 | /sdk/subscription/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/subscription/v2019_10_01_preview/implementation/EnabledSubscriptionIdImpl.java | 5f20630a7f4de0bcf928e03dad685861ff0c08ff | [
"MIT",
"LicenseRef-scancode-generic-cla",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | FabianMeiswinkel/azure-sdk-for-java | bd14579af2f7bc63e5c27c319e2653db990056f1 | 41d99a9945a527b6d3cc7e1366e1d9696941dbe3 | refs/heads/main | 2023-08-04T20:38:27.012783 | 2020-07-15T21:56:57 | 2020-07-15T21:56:57 | 251,590,939 | 3 | 1 | MIT | 2023-09-02T00:50:23 | 2020-03-31T12:05:12 | Java | UTF-8 | Java | false | false | 965 | java | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.subscription.v2019_10_01_preview.implementation;
import com.microsoft.azure.management.subscription.v2019_10_01_preview.EnabledSubscriptionId;
import com.microsoft.azure.arm.model.implementation.WrapperImpl;
class EnabledSubscriptionIdImpl extends WrapperImpl<EnabledSubscriptionIdInner> implements EnabledSubscriptionId {
private final BillingManager manager;
EnabledSubscriptionIdImpl(EnabledSubscriptionIdInner inner, BillingManager manager) {
super(inner);
this.manager = manager;
}
@Override
public BillingManager manager() {
return this.manager;
}
@Override
public String value() {
return this.inner().value();
}
}
| [
"noreply@github.com"
] | FabianMeiswinkel.noreply@github.com |
af564ce20b8f88f12afefb92b268164335fc5dca | 67e28fd80f796ed2e8ab57fa978f1e7e846571e6 | /src/main/java/pl/sda/controler/HelloControler.java | 5ff682ee64b051bb722526f8617cf98c0fc35589 | [] | no_license | tyrontundrom/spring-mvc1 | be92df916705a8138248a59fe5c9cd8597e83850 | 3496b6bafbf501b884d63dd8efaca80ec1a1b1f8 | refs/heads/master | 2023-06-23T20:26:08.328197 | 2021-07-18T20:51:25 | 2021-07-18T20:51:25 | 387,266,745 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package pl.sda.controler;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HelloControler {
@GetMapping("/hello")
public String page() {
return "hello";
}
}
| [
"tyrontundrom@gmail.com"
] | tyrontundrom@gmail.com |
dca5c06190ed92b4803e4c1177b504ef3c11af63 | 65c11b84ad73995308bfcb3babe7d2acec1602dd | /ComparatorByEntropy.java | 77768cf9187a904abadcca8c884952fa17bcecd7 | [] | no_license | haohunghan/DecesionTree | 1baf0f814fcadb45f3eb7c6275ff6c46658c590b | 86245fa1e39e5b45ba50a489ace1e25ca7c967fd | refs/heads/master | 2020-05-18T11:35:19.233238 | 2019-05-07T16:04:47 | 2019-05-07T16:04:47 | 184,383,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java |
import java.util.Comparator;
/*
* 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 anhha
*/
//sap xep theo tu nho den lon
public class ComparatorByEntropy implements Comparator<Property> {
@Override
public int compare(Property o1, Property o2) {
if (o1.getEntropy() == o2.getEntropy() )
return 0;
else if (o1.getEntropy() > o2.getEntropy())
return 1;
return -1;
}
}
| [
"noreply@github.com"
] | haohunghan.noreply@github.com |
c3fe0272cbc7f09c200999769dd5e5b3218833f7 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-14227-14-18-FEMO-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/store/XWikiHibernateStore_ESTest.java | ce35ee89dfe0d08f0a1d6af837c3d2275895cd0a | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | /*
* This file was automatically generated by EvoSuite
* Mon Jan 20 11:39:21 UTC 2020
*/
package com.xpn.xwiki.store;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class XWikiHibernateStore_ESTest extends XWikiHibernateStore_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
fd7c70ed2bda52c7f0f4cc3080c8cedb59aa51a8 | 0e4e6b95b94f9a8d77a8f620992ef4d5f0e45e76 | /graduationDesignUtil/src/main/java/graduationDesign/util/HxlsOptRowsInterfaceImpl.java | 0608ebc40f06896115d78e0336844644d1b05685 | [] | no_license | Fingthingman/graduationDesign | 8712956bf368f9d31aff40da3b9f70e13055af9a | 8fdaf68af63f6c2c3d3a6e25a4478ea87b9e44a7 | refs/heads/master | 2021-04-29T08:01:44.594044 | 2017-01-05T00:57:10 | 2017-01-05T00:57:10 | 77,971,994 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package graduationDesign.util;
import java.util.List;
/**
* 测试导入数据接口
* @author Thinkpad
*
*/
public class HxlsOptRowsInterfaceImpl implements HxlsOptRowsInterface {
@Override
public String optRows(int sheetIndex, int curRow, List<String> rowlist)
throws Exception {
//插入数据库
System.out.println("sheetIndex="+sheetIndex+"curRow="+curRow+rowlist);
return null;
}
}
| [
"851696643@qq.com"
] | 851696643@qq.com |
ae45cdd8ba846a2378d2fa3ea87616076a34a2ef | 28cacaa7dfeb0abcb60e2294221b941f23d19e03 | /src/test/java/com/mycompany/myapp/web/rest/LinkResourceIntTest.java | 75f46040b4fd1b1c5d574c10c72903711946169c | [] | no_license | VolunteeringOrg/Volunteering | 7602a8aeb80051a7fff557f0e05672c8fd4a2c2a | 6b6a1d837732cf3b080bf6a64a585ae66ef7f122 | refs/heads/master | 2020-09-15T12:29:44.796200 | 2017-06-19T16:29:45 | 2017-06-19T16:29:45 | 94,477,990 | 1 | 0 | null | 2017-06-15T20:52:42 | 2017-06-15T20:52:42 | null | UTF-8 | Java | false | false | 10,711 | java | package com.mycompany.myapp.web.rest;
import com.mycompany.myapp.MyappApp;
import com.mycompany.myapp.domain.Link;
import com.mycompany.myapp.domain.Provider;
import com.mycompany.myapp.domain.LinkType;
import com.mycompany.myapp.repository.LinkRepository;
import com.mycompany.myapp.repository.search.LinkSearchRepository;
import com.mycompany.myapp.web.rest.errors.ExceptionTranslator;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
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 javax.persistence.EntityManager;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the LinkResource REST controller.
*
* @see LinkResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = MyappApp.class)
public class LinkResourceIntTest {
private static final String DEFAULT_VALUE = "AAAAAAAAAA";
private static final String UPDATED_VALUE = "BBBBBBBBBB";
@Autowired
private LinkRepository linkRepository;
@Autowired
private LinkSearchRepository linkSearchRepository;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
private MockMvc restLinkMockMvc;
private Link link;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
LinkResource linkResource = new LinkResource(linkRepository, linkSearchRepository);
this.restLinkMockMvc = MockMvcBuilders.standaloneSetup(linkResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Link createEntity(EntityManager em) {
Link link = new Link()
.value(DEFAULT_VALUE);
// Add required entity
Provider provider = ProviderResourceIntTest.createEntity(em);
em.persist(provider);
em.flush();
link.setProvider(provider);
// Add required entity
LinkType linkType = LinkTypeResourceIntTest.createEntity(em);
em.persist(linkType);
em.flush();
link.setLinkType(linkType);
return link;
}
@Before
public void initTest() {
linkSearchRepository.deleteAll();
link = createEntity(em);
}
@Test
@Transactional
public void createLink() throws Exception {
int databaseSizeBeforeCreate = linkRepository.findAll().size();
// Create the Link
restLinkMockMvc.perform(post("/api/links")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(link)))
.andExpect(status().isCreated());
// Validate the Link in the database
List<Link> linkList = linkRepository.findAll();
assertThat(linkList).hasSize(databaseSizeBeforeCreate + 1);
Link testLink = linkList.get(linkList.size() - 1);
assertThat(testLink.getValue()).isEqualTo(DEFAULT_VALUE);
// Validate the Link in Elasticsearch
Link linkEs = linkSearchRepository.findOne(testLink.getId());
assertThat(linkEs).isEqualToComparingFieldByField(testLink);
}
@Test
@Transactional
public void createLinkWithExistingId() throws Exception {
int databaseSizeBeforeCreate = linkRepository.findAll().size();
// Create the Link with an existing ID
link.setId(1L);
// An entity with an existing ID cannot be created, so this API call must fail
restLinkMockMvc.perform(post("/api/links")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(link)))
.andExpect(status().isBadRequest());
// Validate the Alice in the database
List<Link> linkList = linkRepository.findAll();
assertThat(linkList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void checkValueIsRequired() throws Exception {
int databaseSizeBeforeTest = linkRepository.findAll().size();
// set the field null
link.setValue(null);
// Create the Link, which fails.
restLinkMockMvc.perform(post("/api/links")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(link)))
.andExpect(status().isBadRequest());
List<Link> linkList = linkRepository.findAll();
assertThat(linkList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllLinks() throws Exception {
// Initialize the database
linkRepository.saveAndFlush(link);
// Get all the linkList
restLinkMockMvc.perform(get("/api/links?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(link.getId().intValue())))
.andExpect(jsonPath("$.[*].value").value(hasItem(DEFAULT_VALUE.toString())));
}
@Test
@Transactional
public void getLink() throws Exception {
// Initialize the database
linkRepository.saveAndFlush(link);
// Get the link
restLinkMockMvc.perform(get("/api/links/{id}", link.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(link.getId().intValue()))
.andExpect(jsonPath("$.value").value(DEFAULT_VALUE.toString()));
}
@Test
@Transactional
public void getNonExistingLink() throws Exception {
// Get the link
restLinkMockMvc.perform(get("/api/links/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateLink() throws Exception {
// Initialize the database
linkRepository.saveAndFlush(link);
linkSearchRepository.save(link);
int databaseSizeBeforeUpdate = linkRepository.findAll().size();
// Update the link
Link updatedLink = linkRepository.findOne(link.getId());
updatedLink
.value(UPDATED_VALUE);
restLinkMockMvc.perform(put("/api/links")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(updatedLink)))
.andExpect(status().isOk());
// Validate the Link in the database
List<Link> linkList = linkRepository.findAll();
assertThat(linkList).hasSize(databaseSizeBeforeUpdate);
Link testLink = linkList.get(linkList.size() - 1);
assertThat(testLink.getValue()).isEqualTo(UPDATED_VALUE);
// Validate the Link in Elasticsearch
Link linkEs = linkSearchRepository.findOne(testLink.getId());
assertThat(linkEs).isEqualToComparingFieldByField(testLink);
}
@Test
@Transactional
public void updateNonExistingLink() throws Exception {
int databaseSizeBeforeUpdate = linkRepository.findAll().size();
// Create the Link
// If the entity doesn't have an ID, it will be created instead of just being updated
restLinkMockMvc.perform(put("/api/links")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(link)))
.andExpect(status().isCreated());
// Validate the Link in the database
List<Link> linkList = linkRepository.findAll();
assertThat(linkList).hasSize(databaseSizeBeforeUpdate + 1);
}
@Test
@Transactional
public void deleteLink() throws Exception {
// Initialize the database
linkRepository.saveAndFlush(link);
linkSearchRepository.save(link);
int databaseSizeBeforeDelete = linkRepository.findAll().size();
// Get the link
restLinkMockMvc.perform(delete("/api/links/{id}", link.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate Elasticsearch is empty
boolean linkExistsInEs = linkSearchRepository.exists(link.getId());
assertThat(linkExistsInEs).isFalse();
// Validate the database is empty
List<Link> linkList = linkRepository.findAll();
assertThat(linkList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void searchLink() throws Exception {
// Initialize the database
linkRepository.saveAndFlush(link);
linkSearchRepository.save(link);
// Search the link
restLinkMockMvc.perform(get("/api/_search/links?query=id:" + link.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(link.getId().intValue())))
.andExpect(jsonPath("$.[*].value").value(hasItem(DEFAULT_VALUE.toString())));
}
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Link.class);
Link link1 = new Link();
link1.setId(1L);
Link link2 = new Link();
link2.setId(link1.getId());
assertThat(link1).isEqualTo(link2);
link2.setId(2L);
assertThat(link1).isNotEqualTo(link2);
link1.setId(null);
assertThat(link1).isNotEqualTo(link2);
}
}
| [
"zalewmic@gmail.com"
] | zalewmic@gmail.com |
a9549ed43f88cee8bf2106ed66a7a2a11b592f26 | bcbfa0d0f680ddd2920224ed8b7e8906a1c77c07 | /leyou/ly-page/src/main/java/com/leyou/page/mq/ItemListener.java | 874b36b1d2de6fa3bc27f28295ad1a4bbacb66f7 | [] | no_license | johnqwq/leyou-mall | 71d6fc78a163e7ae60a9e9e35c0846b8ebc8b195 | edf11d84b52b9d64c98ec8a05681e9b25a954d1f | refs/heads/master | 2022-12-21T14:03:55.849604 | 2020-02-21T10:29:52 | 2020-02-21T10:29:52 | 242,102,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,652 | java | package com.leyou.page.mq;
import com.leyou.page.service.PageService;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ItemListener {
@Autowired
private PageService pageService;
/**
* 处理insert和update的消息
* @param spuId
*/
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = "page.item.insert.queue", durable = "true"),
exchange = @Exchange(name = "ly.item.exchange", type = ExchangeTypes.TOPIC),
key = {"item.insert", "item.update"}
))
public void listenInsertOrUpdate(Long spuId) {
if (spuId == null) {
return;
}
// 处理消息,创建相应的静态页面
pageService.createHtml(spuId);
}
/**
* 处理delete的消息
* @param spuId
*/
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = "page.item.delete.queue", durable = "true"),
exchange = @Exchange(name = "ly.item.exchange", type = ExchangeTypes.TOPIC),
key = "item.delete"
))
public void listenDelete(Long spuId) {
if (spuId == null) {
return;
}
// 处理消息,删除相应的静态页面
pageService.deleteHtml(spuId);
}
}
| [
"im.zhuwk@gmail.com"
] | im.zhuwk@gmail.com |
15780f25f7758bdcf7351eb219e8ce39b52ccdad | 67f68b51c87e181fb242d094ce9febc270bf462b | /src/main/java/com/sundaysee/hrm/dao/provider/EmployeeDynaSqlProvider.java | 0b318528e298a288115045c2b4b8c61ea6be3de3 | [
"Apache-2.0"
] | permissive | niubility2018/hrm | 679fbdef9d118ba47d6029c16ca2e83f61b884e6 | f6978a13775d24b0abfe89ab451395e3081d9c8d | refs/heads/master | 2020-04-07T09:16:16.725000 | 2018-12-20T14:57:23 | 2018-12-20T14:57:23 | 158,245,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,421 | java | package com.sundaysee.hrm.dao.provider;
import java.util.Map;
import com.sundaysee.hrm.entity.Employee;
import com.sundaysee.hrm.utils.HrmConstants;
import org.apache.ibatis.jdbc.SQL;
public class EmployeeDynaSqlProvider {
//分页动态查询
public String selectWithParam(Map<String,Object> params) {
String sql = new SQL(){
{
SELECT("*");
FROM(HrmConstants.EMPLOYEETABLE);
if (params.get("employee") != null) {
Employee employee = (Employee)params.get(("employee"));
if (employee.getDept() != null && employee.getDept().getId() != null
&& employee.getDept().getId() != 0) {
WHERE(" DEPT_ID = #{employee.dept.id}");
}
if (employee.getJob() != null && employee.getJob().getId() != null
&& employee.getJob().getId() != 0) {
WHERE(" JOB_ID = #{employee.job.id}");
}
if (employee.getName() != null && !employee.getName().equals("")) {
WHERE(" name like concat('%',#{employee.name},'%')");
}
if (employee.getPhone() != null && !employee.getPhone().equals("")) {
WHERE("phone like concat('%',employee.phone,'%')");
}
if (employee.getCardId() != null && !employee.getCardId().equals("")) {
WHERE("card_id like concat('%',employee.cardId,'%')");
}
if (employee.getSex() != null && employee.getSex() != 0) {
WHERE(" sex = #{employee.sex}");
}
}
}
}.toString();
if (params.get("pageModel") != null) {
sql += "limit #{pageModel.firstLimitParam},#{pageModel.pageSize} ";
}
return sql;
}
//动态查询总量
public String count(Map<String,Object> params) {
return new SQL(){
{
SELECT("count(*)");
FROM(HrmConstants.EMPLOYEETABLE);
if (params.get("employee") != null) {
Employee employee = (Employee) params.get("params");
if (employee.getDept() != null
&& employee.getDept().getId() != null && employee.getDept().getId() != 0) {
WHERE(" dept_id = #{employee.dept.id}");
}
if (employee.getJob() != null
&& employee.getJob().getId() != null && employee.getJob().getId() != 0) {
WHERE(" job_id = #{employee.job.id}");
}
if (employee.getName() != null && !employee.getName().equals("")) {
WHERE(" name like concat('%',#{employee.name},'%')");
}
if (employee.getPhone() != null && !employee.getPhone().equals("")) {
WHERE("phone like concat('%',#{employee.phone},'%')");
}
if (employee.getCardId() != null && !employee.getCardId().equals("")) {
WHERE("card_id like concat('%',#{employee.cardId,'%'})");
}
if (employee.getSex() != null && employee.getSex() != 0) {
WHERE("sex = #{employee.sex}");
}
}
}
}.toString();
}
//动态插入
public String insertEmployee(Employee employee) {
return new SQL(){
{
INSERT_INTO(HrmConstants.EMPLOYEETABLE);
if (employee.getName() != null) {
VALUES("name", "#{name}");
}
if (employee.getCardId() != null) {
VALUES("card_id", "#{cardId}");
}
if (employee.getPostCode() != null) {
VALUES("post_code", "#{postCode}");
}
if (employee.getTel() != null) {
VALUES("tel", "#{tel}");
}
if (employee.getBirthday() != null) {
VALUES("birthday", "#{birthday}");
}
if (employee.getEducation() != null) {
VALUES("education", "#{education}");
}
if (employee.getSpeciality() != null) {
VALUES("speciality", "#{speciality}");
}
if (employee.getCreateDate() != null) {
VALUES("createDate", "#{createDate}");
}
if (employee.getDept() != null) {
VALUES("dept_id", "#{dept.id}");
}
if (employee.getJob() != null) {
VALUES("job_id", "#{job.id}");
}
}
}.toString();
}
//动态更新
public String updateEmployee(Employee employee) {
return new SQL(){
{
UPDATE(HrmConstants.EMPLOYEETABLE);
if (employee.getName() != null) {
SET(" name = ${name} ");
}
if (employee.getCardId() != null) {
SET(" card_id = #{cardId}");
}
if (employee.getAddress() != null) {
SET(" address = ${address} ");
}
if (employee.getPostCode() != null) {
SET(" post_code = #{postCode} ");
}
if (employee.getTel() != null) {
SET(" tel = #{tel} ");
}
if (employee.getPhone() != null) {
SET(" phone = #{phone} ");
}
if (employee.getQqNum() != null) {
SET(" qq_num = #{qqNum} ");
}
if (employee.getEmail() != null) {
SET(" email = #{email} ");
}
if (employee.getSex() != null) {
SET(" sex = #{sex} ");
}
if (employee.getParty() != null) {
SET(" party = #{party} ");
}
if (employee.getBirthday() != null) {
SET(" birthday = #{birthday} ");
}
if (employee.getRace() != null) {
SET(" race = #{race} ");
}
if (employee.getEducation() != null) {
SET( " education = #{education} ");
}
if (employee.getSpeciality() != null) {
SET(" speciality = #{speciality} ");
}
if (employee.getRemark() != null) {
SET(" remark = #{remark} ");
}
if (employee.getCreateDate() != null) {
SET(" create_Date #{createDate} ");
}
if (employee.getDept() != null) {
SET(" dept_id = #{dept.id} ");
}
if (employee.getJob() != null) {
SET(" job_id = #{job.id} ");
}
WHERE(" id = #{id} ");
}
}.toString();
}
} | [
"xgybdcb@163.com"
] | xgybdcb@163.com |
4094fe3f60c79f866deb1caa5f8c2c8ad24fc6e1 | c6a8042af5a706f2fdd5f919e723e21d3947d542 | /part01-Part01_33.Password/src/main/java/Password.java | d6ec6e21a262bf6e3b55d5477a208017eb224d42 | [] | no_license | lui-esse/Java-Programming-I- | 0d4ec0ceeb3956fadee5b32f76e239f4abf8902f | d33dabf540080f5cd5f3713f18a80748cd043c4e | refs/heads/master | 2022-12-07T07:35:23.899513 | 2020-08-31T13:11:53 | 2020-08-31T13:11:53 | 291,716,882 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 498 | java |
import java.util.Scanner;
public class Password {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
// Write your program here
String password = "Caput Draconis";
System.out.println("Password?");
String input = scan.nextLine();
if(input.equals(password)){
System.out.println("Welcome!");
} else {
System.out.println("Off with you!");
}
}
}
| [
"luigi.scognamiglio2010@gmail.com"
] | luigi.scognamiglio2010@gmail.com |
c9355bf32bf9cf02ab77eb48c757247f95ddc8aa | d3ca1b951fca38b2e146a23a0e90ed50d1899735 | /Fractional.java | 5bbebb10f4dbf2f8d32f49c15db1e4654d212b02 | [] | no_license | yeswanthsv8/JAVA-Tech-Problems-2020 | 01924e737c8ba4d48f889c6f6802afe561701458 | c067f60acbda6d11bafd5f506620ca3ad079b262 | refs/heads/master | 2022-12-01T09:19:05.908204 | 2020-08-16T06:55:29 | 2020-08-16T06:55:29 | 287,886,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | import java.util.*;
class Fractional
{
public static void main(String args[])
{
float Input1,Input2;
Scanner sc= new Scanner(System.in);
System.out.println("Enter The Input1 :");
Input1= sc.nextFloat();
System.out.println("The Output1 Is:\n"+Input1);
}
}
/*
Explanation :
Scanner is a function available(predefined) in java library to get input from user via keyboard and stores the same in a variable. Here it reads input number and stores it in a variable num.
Format Specifier "%f" reads input as floating number. (fractional number)
System.out.println is a function available(pre defined) in java library which is used to print the specified content in Monitor. Here it prints the value of the variable num.
Format Specifier "%f" prints value as Floating Point Number.
*/
| [
"noreply@github.com"
] | yeswanthsv8.noreply@github.com |
3790b7cb12b17a615883536900523375e5200b73 | fc726fec491b1a74b913fb5ff305eda372252c4f | /org/apache/axis/holders/UnsignedShortHolder.java | c1c4ca76f20ab1f9df69db40eb32b0e07d324f77 | [] | no_license | roman5566/ProjectFlashToolV0.01 | 4048b6b1ef9655cb98da5db08da2e8bb3c13830e | 2932248f79fe43335d0cf11242973a78a5e8efa2 | refs/heads/master | 2021-01-02T08:40:25.520771 | 2012-11-17T21:29:53 | 2012-11-17T21:29:53 | 10,467,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 693 | java | /* */ package org.apache.axis.holders;
/* */
/* */ import javax.xml.rpc.holders.Holder;
/* */ import org.apache.axis.types.UnsignedShort;
/* */
/* */ public final class UnsignedShortHolder
/* */ implements Holder
/* */ {
/* */ public UnsignedShort value;
/* */
/* */ public UnsignedShortHolder()
/* */ {
/* */ }
/* */
/* */ public UnsignedShortHolder(UnsignedShort value)
/* */ {
/* 44 */ this.value = value;
/* */ }
/* */ }
/* Location: E:\Windows\Documents\flashdmp\New folder\ProjectFlashToolV0.01.jar
* Qualified Name: org.apache.axis.holders.UnsignedShortHolder
* JD-Core Version: 0.6.0
*/ | [
"tom@tomrosier.co.uk"
] | tom@tomrosier.co.uk |
dd2dafbee3575d373ddf622ce860682c5689af92 | c13f1cdf225c59e3c2bba983132c558e1fe94194 | /src/test/java/WebSeleniumDatePicker.java | 131112ceb7f92a8d34a7100c7bbc077ca0445adb | [] | no_license | penikurniawati/basicAutomationWebUI | 438a0fa6f03e868d6e185f67d50a86aa2f6760dd | 4329b9609129d7fb113a3959f3bff83493249207 | refs/heads/master | 2022-12-30T15:02:53.567920 | 2020-10-05T15:11:16 | 2020-10-05T15:11:16 | 295,474,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,116 | java | import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.Date;
public class WebSeleniumDatePicker extends PageObject{
Date date = new Date();
@FindBy(xpath = "//*[@id=\"sandbox-container1\"]/div/span")
public WebElement button_date;
@FindBy(css = "td.today.day")
public WebElement today_day;
@FindBy(css = "td.day")
public WebElement day;
@FindBy(css = "td.old.day")
public WebElement old_day;
@FindBy(css = "td.disabled.disabled-date.day")
public WebElement disable_date_day;
@FindBy(css = "td.disabled.day")
public WebElement disabled_day;
@FindBy(xpath = "//td[@class]")
public WebElement test_day;
// public String Dis = today_day.getText()+1;
// public Integer dis = date_day + 1;
public WebSeleniumDatePicker(WebDriver driver){
super(driver);
}
public void showDatePicker(){
this.button_date.click();
}
public void validateTodayDay(){
if (today_day.isEnabled()){
System.out.println("Today enable is true");
}else
System.out.println("Today enable is false");
}
public void validateDay(){
if (day.isEnabled()){
System.out.println("Day enable is true");
}else
System.out.println(("Day enable is false"));
}
public void setTest_day(){
this.test_day.isDisplayed();
}
public void dday(){
if (test_day.isSelected()){
System.out.println(test_day.getText());
}else
System.out.println("salah");
}
public void set_dday(){
if (test_day.getText().equals(date.toString())){
System.out.println("yes");
}else {
System.out.println(test_day.getText());
}
}
public void validateDisableDay(){
if (disable_date_day.isDisplayed() && disable_date_day.isEnabled()){
System.out.println(disable_date_day.getText());
}else
System.out.println(disable_date_day.getText());
}
}
| [
"you@example.com"
] | you@example.com |
2be2e91699e247283bdc90baf4b7b6c4c1fe8a54 | d5f09c7b0e954cd20dd613af600afd91b039c48a | /sources/com/facebook/stetho/inspector/elements/android/DialogFragmentDescriptor.java | bfaa1d83202de11bd81dd84f6ba6fec280f00afb | [] | no_license | t0HiiBwn/CoolapkRelease | af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3 | a6a2b03e32cde0e5163016e0078391271a8d33ab | refs/heads/main | 2022-07-29T23:28:35.867734 | 2021-03-26T11:41:18 | 2021-03-26T11:41:18 | 345,290,891 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 6,359 | java | package com.facebook.stetho.inspector.elements.android;
import android.app.Dialog;
import android.graphics.Rect;
import android.view.View;
import com.facebook.stetho.common.Accumulator;
import com.facebook.stetho.common.LogUtil;
import com.facebook.stetho.common.Util;
import com.facebook.stetho.common.android.DialogFragmentAccessor;
import com.facebook.stetho.common.android.FragmentCompat;
import com.facebook.stetho.inspector.elements.AttributeAccumulator;
import com.facebook.stetho.inspector.elements.ChainedDescriptor;
import com.facebook.stetho.inspector.elements.ComputedStyleAccumulator;
import com.facebook.stetho.inspector.elements.Descriptor;
import com.facebook.stetho.inspector.elements.DescriptorMap;
import com.facebook.stetho.inspector.elements.NodeType;
import com.facebook.stetho.inspector.elements.StyleAccumulator;
import com.facebook.stetho.inspector.elements.StyleRuleNameAccumulator;
import javax.annotation.Nullable;
final class DialogFragmentDescriptor extends Descriptor<Object> implements ChainedDescriptor<Object>, HighlightableDescriptor<Object> {
private final DialogFragmentAccessor mAccessor;
private Descriptor<? super Object> mSuper;
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public void getComputedStyles(Object obj, ComputedStyleAccumulator computedStyleAccumulator) {
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public void getStyleRuleNames(Object obj, StyleRuleNameAccumulator styleRuleNameAccumulator) {
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public void getStyles(Object obj, String str, StyleAccumulator styleAccumulator) {
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public void setStyle(Object obj, String str, String str2, String str3) {
}
public static DescriptorMap register(DescriptorMap descriptorMap) {
maybeRegister(descriptorMap, FragmentCompat.getSupportLibInstance());
maybeRegister(descriptorMap, FragmentCompat.getFrameworkInstance());
return descriptorMap;
}
private static void maybeRegister(DescriptorMap descriptorMap, @Nullable FragmentCompat fragmentCompat) {
if (fragmentCompat != null) {
Class<?> dialogFragmentClass = fragmentCompat.getDialogFragmentClass();
LogUtil.d("Adding support for %s", dialogFragmentClass);
descriptorMap.registerDescriptor(dialogFragmentClass, (Descriptor) new DialogFragmentDescriptor(fragmentCompat));
}
}
private DialogFragmentDescriptor(FragmentCompat fragmentCompat) {
this.mAccessor = fragmentCompat.forDialogFragment();
}
@Override // com.facebook.stetho.inspector.elements.ChainedDescriptor
public void setSuper(Descriptor<? super Object> descriptor) {
Util.throwIfNull(descriptor);
Descriptor<? super Object> descriptor2 = this.mSuper;
if (descriptor == descriptor2) {
return;
}
if (descriptor2 == null) {
this.mSuper = descriptor;
return;
}
throw new IllegalStateException();
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public void hook(Object obj) {
this.mSuper.hook(obj);
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public void unhook(Object obj) {
this.mSuper.unhook(obj);
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public NodeType getNodeType(Object obj) {
return this.mSuper.getNodeType(obj);
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public String getNodeName(Object obj) {
return this.mSuper.getNodeName(obj);
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public String getLocalName(Object obj) {
return this.mSuper.getLocalName(obj);
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
@Nullable
public String getNodeValue(Object obj) {
return this.mSuper.getNodeValue(obj);
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public void getChildren(Object obj, Accumulator<Object> accumulator) {
accumulator.store(this.mAccessor.getDialog(obj));
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public void getAttributes(Object obj, AttributeAccumulator attributeAccumulator) {
this.mSuper.getAttributes(obj, attributeAccumulator);
}
@Override // com.facebook.stetho.inspector.elements.NodeDescriptor
public void setAttributesAsText(Object obj, String str) {
this.mSuper.setAttributesAsText(obj, str);
}
@Override // com.facebook.stetho.inspector.elements.android.HighlightableDescriptor
@Nullable
public View getViewAndBoundsForHighlighting(Object obj, Rect rect) {
Dialog dialog;
HighlightableDescriptor highlightableDescriptor;
Descriptor.Host host = getHost();
if (host instanceof AndroidDescriptorHost) {
dialog = this.mAccessor.getDialog(obj);
highlightableDescriptor = ((AndroidDescriptorHost) host).getHighlightableDescriptor(dialog);
} else {
dialog = null;
highlightableDescriptor = null;
}
if (highlightableDescriptor == null) {
return null;
}
return highlightableDescriptor.getViewAndBoundsForHighlighting(dialog, rect);
}
@Override // com.facebook.stetho.inspector.elements.android.HighlightableDescriptor
@Nullable
public Object getElementToHighlightAtPosition(Object obj, int i, int i2, Rect rect) {
Dialog dialog;
HighlightableDescriptor highlightableDescriptor;
Descriptor.Host host = getHost();
if (host instanceof AndroidDescriptorHost) {
dialog = this.mAccessor.getDialog(obj);
highlightableDescriptor = ((AndroidDescriptorHost) host).getHighlightableDescriptor(dialog);
} else {
dialog = null;
highlightableDescriptor = null;
}
if (highlightableDescriptor == null) {
return null;
}
return highlightableDescriptor.getElementToHighlightAtPosition(dialog, i, i2, rect);
}
}
| [
"test@gmail.com"
] | test@gmail.com |
7a4217249060b9b512bd83eebc80cbd93b3ad7d6 | 9f9ac6f5fe960ee38b7bfc8432bdc8aa2abdbbad | /src/main/java/com/kronsoft/internship/ui/controller/AppointmentController.java | d0963eac83637aebc25f7e312b74ec843105020a | [] | no_license | CiobanuMarian/interns-project | 92aec7954323eeb2cf54e091226b04ed026618da | cf3e570a1495bfa60bb49ce1f4e814832ebd4c2b | refs/heads/master | 2020-06-24T20:20:59.225125 | 2019-08-05T17:37:10 | 2019-08-05T17:37:10 | 199,076,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,378 | java | package com.kronsoft.internship.ui.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.kronsoft.internship.ui.model.AppointmentModel;
import com.kronsoft.internship.ui.model.PatientModel;
import com.kronsoft.internship.ui.rest.AppointmentRestService;
import com.kronsoft.internship.ui.rest.dto.AppointmentDto;
import com.kronsoft.internship.ui.rest.dto.PatientDto;
@ManagedBean
@RequestScoped
public class AppointmentController {
@ManagedProperty(value = "#{appointmentModel}")
private AppointmentModel model;
@ManagedProperty(value = "#{patientModel}")
private PatientModel modelPatient;
private static AppointmentRestService appointmentRestService = AppointmentRestService.getInstance();
private static final Logger LOGGER = LogManager.getLogger(AppointmentController.class);
@PostConstruct
public void init() {
if (!model.isInitFromDB()) {
model.setAppointments(appointmentRestService.getAllAppointments());
model.setInitFromDB(true);
}
}
public void deleteAppointment() {
AppointmentDto deletedAppointment = model.getSelectedAppointment();
LOGGER.info("Deleting Appointment with id: " + deletedAppointment.getId());
appointmentRestService.deleteAppointment(deletedAppointment.getId());
model.getAppointments().remove(deletedAppointment);
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage("Deleted Appointment " + deletedAppointment.getId()));
}
public void createAppointment() {
AppointmentDto createdAppointment = appointmentRestService.createAppointment(model.getNewAppointment());
model.getAppointments().add(createdAppointment);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Created appointment succesfully!"));
LOGGER.info("Creating appointment with id:" + createdAppointment.getId());
}
public AppointmentModel getModel() {
return model;
}
public void setModel(AppointmentModel model) {
this.model = model;
}
public void updateAppointment() {
AppointmentDto appointmentToBeUpdated = model.getUpdatedAppointment();
appointmentRestService.updateAppointment(appointmentToBeUpdated);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Changes Saved!"));
}
public void cancelUpdate() {
model.setUpdatedAppointment(new AppointmentDto());
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Edit canceled!"));
}
public PatientModel getModelPatient() {
return modelPatient;
}
public void setModelPatient(PatientModel modelPatient) {
this.modelPatient = modelPatient;
}
public void findPatientAppointments() {
PatientDto patient = modelPatient.getSelectedPatient();
List<AppointmentDto> appointments = new ArrayList<AppointmentDto>();
Stream<AppointmentDto> appoimentsStream = model.getAppointments().stream()
.filter(appointment -> appointment.getPatient().getId() == patient.getId());
appoimentsStream.forEach(appointment -> appointments.add(appointment));
model.setPatientAppointments(appointments);
}
}
| [
"c.marian98@yahoo.com"
] | c.marian98@yahoo.com |
289b63c57e28e03785e0291f797fd77545b6d55f | 799be9d6b15dc6148e1d5c065690538050c55053 | /codegen-Dolphins/src/main/java/com/codegen/jet/dolphins/domains/Table.java | 8b72c04cba95d98859ff3d1933b911d995b11629 | [
"MIT"
] | permissive | RoyWorld/codegen_new | bc0e645b51a5553560425b4b70cade72669a2479 | cdc1592843c83eeab9d3ea2086bdf710f939b187 | refs/heads/master | 2021-07-17T05:57:21.170386 | 2018-10-25T07:54:04 | 2018-10-25T07:54:04 | 134,828,692 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,560 | java | package com.codegen.jet.dolphins.domains;
import com.codegen.jet.dolphins.TableFactory;
import com.codegen.jet.dolphins.tools.StringHelper;
import com.codegen.jet.dolphins.util.ReadProperties;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.util.*;
/**
* 用于生成代码的Table对象.对应数据库的table
*
* @author badqiu
* @email badqiu(a)gmail.com
*/
public class Table implements java.io.Serializable, Cloneable {
public static final String PKTABLE_NAME = "PKTABLE_NAME";
public static final String PKCOLUMN_NAME = "PKCOLUMN_NAME";
public static final String FKTABLE_NAME = "FKTABLE_NAME";
public static final String FKCOLUMN_NAME = "FKCOLUMN_NAME";
public static final String KEY_SEQ = "KEY_SEQ";
protected static final Set<String> ORACLE_KEY_COLUMN_SETS = new HashSet<String>();
static {
ORACLE_KEY_COLUMN_SETS.add("name");
ORACLE_KEY_COLUMN_SETS.add("type");
ORACLE_KEY_COLUMN_SETS.add("sequence");
ORACLE_KEY_COLUMN_SETS.add("start");
}
//分表 变量名称
protected String submeterTablePrefixName;
protected boolean submeterTable = false;
protected String subSqlName;
protected String sqlName;
protected String remarks;
protected String className;
protected String instanceName;
/**
* 序列 生成的自增id值
*/
int seq;
/**
* 编码 有些是树形结构需要确定上下级关系
*/
String number;
String longnumber;
/**
* 业务模型名称
*/
String name;
/**
* 菜单名称
*/
String resName;
/**
* 父菜单名称
*/
String parentResName;
/**
* 继承父类名称
*/
String parentClassName;
String description;
int parentId;
LinkedHashSet<Column> columns = new LinkedHashSet<Column>();
List<Column> primaryKeyColumns = new ArrayList<Column>();
protected String catalog = TableFactory.getInstance().getCatalog();
protected String schema = TableFactory.getInstance().getSchema();
/**
* the name of the owner of the synonym if this table is a synonym
*/
protected String ownerSynonymName = null;
/**
* real table name for oracle SYNONYM
*/
protected String tableSynonymName = null;
protected String tableAlias;
protected ForeignKeys exportedKeys;
protected ForeignKeys importedKeys;
public Table() {
}
public Table(Table t) {
setSqlName(t.getSqlName());
this.remarks = t.getRemarks();
this.className = t.getClassName();
this.ownerSynonymName = t.getOwnerSynonymName();
this.columns = t.getColumns();
this.primaryKeyColumns = t.getPrimaryKeyColumns();
this.tableAlias = t.getTableAlias();
this.exportedKeys = t.exportedKeys;
this.importedKeys = t.importedKeys;
}
public static String removeTableSqlNamePrefix(String sqlName) {
String prefixs = ReadProperties.getProperty("tableRemovePrefixes", "");
for (String prefix : prefixs.split(",")) {
String removedPrefixSqlName = StringHelper.removePrefix(sqlName, prefix, true);
if (!removedPrefixSqlName.equals(sqlName)) {
return removedPrefixSqlName;
}
}
return sqlName;
}
protected static String getDbType(String url) {
if (url.toLowerCase().indexOf("mysql") != -1) {
return "mysql";
} else if (url.toLowerCase().indexOf("oracle") != -1) {
return "oracle";
}
return "mysql";
}
public String getSubmeterTablePrefixName() {
return submeterTablePrefixName;
}
public void setSubmeterTablePrefixName(String submeterTablePrefixName) {
this.submeterTablePrefixName = submeterTablePrefixName;
}
public boolean isSubmeterTable() {
return submeterTable;
}
public void setSubmeterTable(boolean submeterTable) {
this.submeterTable = submeterTable;
}
public String getSubSqlName() {
return subSqlName;
}
public void setSubSqlName(String subSqlName) {
this.subSqlName = subSqlName;
}
public String getInstanceName() {
return instanceName;
}
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
public int getParentId() {
return parentId;
}
public void setParentId(int parentId) {
this.parentId = parentId;
}
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getLongnumber() {
return longnumber;
}
public void setLongnumber(String longnumber) {
this.longnumber = longnumber;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getResName() {
return resName;
}
public void setResName(String resName) {
this.resName = resName;
}
public String getParentResName() {
return parentResName;
}
public void setParentResName(String parentResName) {
this.parentResName = parentResName;
}
public String getParentClassName() {
return parentClassName;
}
public void setParentClassName(String parentClassName) {
this.parentClassName = parentClassName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public LinkedHashSet<Column> getColumns() {
//针对 oracle 做特殊处理 name,type,sequence,start
String url = ReadProperties.getRequiredProperty("jdbc.url");
String dbType = getDbType(url);
if (JdbcConstants.ORACLE.equals(dbType)) { //oracle
LinkedHashSet<Column> newColumns = new LinkedHashSet<Column>();
for (Column column : columns) {
if (ORACLE_KEY_COLUMN_SETS.contains(column.getName())) {
column.setName("\"" + column.getName().toUpperCase() + "\"");
}
newColumns.add(column);
}
return newColumns;
} else {
return columns;
}
}
public void setColumns(LinkedHashSet<Column> columns) {
this.columns = columns;
}
public String getOwnerSynonymName() {
return ownerSynonymName;
}
public void setOwnerSynonymName(String ownerSynonymName) {
this.ownerSynonymName = ownerSynonymName;
}
public String getTableSynonymName() {
return tableSynonymName;
}
public void setTableSynonymName(String tableSynonymName) {
this.tableSynonymName = tableSynonymName;
}
/**
* 使用 getPkColumns() 替换
*/
@Deprecated
public List<Column> getPrimaryKeyColumns() {
return primaryKeyColumns;
}
/**
* 使用 setPkColumns() 替换
*/
@Deprecated
public void setPrimaryKeyColumns(List<Column> primaryKeyColumns) {
this.primaryKeyColumns = primaryKeyColumns;
}
/**
* 数据库中表的表名称,其它属性很多都是根据此属性派生
*/
public String getSqlName() {
return sqlName;
}
public void setSqlName(String sqlName) {
this.sqlName = sqlName;
}
/**
* 数据库中表的表备注
*/
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public void addColumn(Column column) {
columns.add(column);
}
/**
* 根据sqlName得到的类名称,示例值: UserInfo
*
* @return
*/
public String getClassName() {
if (StringHelper.isBlank(className)) {
String removedPrefixSqlName = removeTableSqlNamePrefix(sqlName);
return StringHelper.makeAllWordFirstLetterUpperCase(StringHelper.toUnderscoreName(removedPrefixSqlName));
} else {
return className;
}
}
public void setClassName(String customClassName) {
this.className = customClassName;
}
/**
* 数据库中表的别名,等价于: getRemarks().isEmpty() ? getClassName() : getRemarks()
*/
public String getTableAlias() {
if (StringHelper.isNotBlank(tableAlias)) return tableAlias;
return StringHelper.removeCrlf(StringHelper.defaultIfEmpty(getRemarks(), getClassName()));
}
public void setTableAlias(String v) {
this.tableAlias = v;
}
/**
* 等价于getClassName().toLowerCase()
*
* @return
*/
public String getClassNameLowerCase() {
return getClassName().toLowerCase();
}
/**
* 得到用下划线分隔的类名称,如className=UserInfo,则underscoreName=user_info
*
* @return
*/
public String getUnderscoreName() {
return StringHelper.toUnderscoreName(getClassName()).toLowerCase();
}
/**
* 返回值为getClassName()的第一个字母小写,如className=UserInfo,则ClassNameFirstLower=userInfo
*
* @return
*/
public String getClassNameFirstLower() {
return StringHelper.uncapitalize(getClassName());
}
/**
* ZhangHuihua@msn.com 根据sqlName得到的类名称,示例值: PO:SysUser则BO:User,去除模块前缀
*
* @return
*/
public String getClassNameBo() {
String _className = getClassName();
for (int i = 1; i < _className.length(); i++) {
char c = _className.charAt(i);
if (Character.isUpperCase(c)) {
_className = _className.substring(i);
System.out.println("############" + _className);
break;
}
}
return _className;
}
public String getClassNameBoLowerCase() {
return getClassNameBo().toLowerCase();
}
/**
* ZhangHuihua@msn.com 返回值为getClassNameBo()的第一个字母小写,如className=User,则ClassNameFirstLower=user
*
* @return
*/
public String getClassNameFirstLowerBo() {
return StringHelper.uncapitalize(getClassNameBo());
}
/**
* 根据getClassName()计算而来,用于得到常量名,如className=UserInfo,则constantName=USER_INFO
*
* @return
*/
public String getConstantName() {
return StringHelper.toUnderscoreName(getClassName()).toUpperCase();
}
/**
* 使用 getPkCount() 替换
*/
@Deprecated
public boolean isSingleId() {
return getPkCount() == 1 ? true : false;
}
/**
* 使用 getPkCount() 替换
*/
@Deprecated
public boolean isCompositeId() {
return getPkCount() > 1 ? true : false;
}
/**
* 使用 getPkCount() 替换
*/
@Deprecated
public boolean isNotCompositeId() {
return !isCompositeId();
}
/**
* 得到主键总数
*
* @return
*/
public int getPkCount() {
int pkCount = 0;
for (Column c : columns) {
if (c.isPk()) {
pkCount++;
}
}
return pkCount;
}
/**
* use getPkColumns()
*
* @deprecated
*/
public List getCompositeIdColumns() {
return getPkColumns();
}
/**
* 得到是主键的全部column
*
* @return
*/
public List<Column> getPkColumns() {
List results = new ArrayList();
for (Column c : getColumns()) {
if (c.isPk())
results.add(c);
}
return results;
}
/**
* 得到不是主键的全部column
*
* @return
*/
public List<Column> getNotPkColumns() {
List results = new ArrayList();
for (Column c : getColumns()) {
if (!c.isPk())
results.add(c);
}
return results;
}
/**
* 得到单主键,等价于getPkColumns().get(0)
*/
public Column getPkColumn() {
// if(getPkColumns().isEmpty()) {
// throw new IllegalStateException("not found primary key on table:"+getSqlName());
// }
if (getPkColumns().isEmpty()) {
return null;
}
return getPkColumns().get(0);
}
/**
* 使用 getPkColumn()替换
*/
@Deprecated
public Column getIdColumn() {
return getPkColumn();
}
public List<Column> getEnumColumns() {
List results = new ArrayList();
for (Column c : getColumns()) {
if (!c.isEnumColumn())
results.add(c);
}
return results;
}
public Column getColumnByName(String name) {
Column c = getColumnBySqlName(name);
if (c == null) {
c = getColumnBySqlName(StringHelper.toUnderscoreName(name));
}
return c;
}
public Column getColumnBySqlName(String sqlName) {
for (Column c : getColumns()) {
if (c.getSqlName().equalsIgnoreCase(sqlName)) {
return c;
}
}
return null;
}
public Column getRequiredColumnBySqlName(String sqlName) {
if (getColumnBySqlName(sqlName) == null) {
throw new IllegalArgumentException("not found column with sqlName:" + sqlName + " on table:" + getSqlName());
}
return getColumnBySqlName(sqlName);
}
/**
* 忽略过滤掉某些关键字的列,关键字不区分大小写,以逗号分隔
*
* @param ignoreKeywords
* @return
*/
public List<Column> getIgnoreKeywordsColumns(String ignoreKeywords) {
List results = new ArrayList();
for (Column c : getColumns()) {
String sqlname = c.getSqlName().toLowerCase();
if (StringHelper.contains(sqlname, ignoreKeywords.split(","))) {
continue;
}
results.add(c);
}
return results;
}
/**
* This method was created in VisualAge.
*/
public void initImportedKeys(DatabaseMetaData dbmd) throws java.sql.SQLException {
// get imported keys a
ResultSet fkeys = dbmd.getImportedKeys(catalog, schema, this.sqlName);
while (fkeys.next()) {
String pktable = fkeys.getString(PKTABLE_NAME);
String pkcol = fkeys.getString(PKCOLUMN_NAME);
String fktable = fkeys.getString(FKTABLE_NAME);
String fkcol = fkeys.getString(FKCOLUMN_NAME);
String seq = fkeys.getString(KEY_SEQ);
Integer iseq = new Integer(seq);
getImportedKeys().addForeignKey(pktable, pkcol, fkcol, iseq);
}
fkeys.close();
}
/**
* This method was created in VisualAge.
*/
public void initExportedKeys(DatabaseMetaData dbmd) throws java.sql.SQLException {
// get Exported keys
// 取外键关系,没什么用,因为太慢了
// ResultSet fkeys = dbmd.getExportedKeys(catalog,schema,this.sqlName);
//
// while ( fkeys.next()) {
// String pktable = fkeys.getString(PKTABLE_NAME);
// String pkcol = fkeys.getString(PKCOLUMN_NAME);
// String fktable = fkeys.getString(FKTABLE_NAME);
// String fkcol = fkeys.getString(FKCOLUMN_NAME);
// String seq = fkeys.getString(KEY_SEQ);
// Integer iseq = new Integer(seq);
// getExportedKeys().addForeignKey(fktable,fkcol,pkcol,iseq);
// }
// fkeys.close();
}
/**
* @return Returns the exportedKeys.
*/
public ForeignKeys getExportedKeys() {
if (exportedKeys == null) {
exportedKeys = new ForeignKeys(this);
}
return exportedKeys;
}
/**
* @return Returns the importedKeys.
*/
public ForeignKeys getImportedKeys() {
if (importedKeys == null) {
importedKeys = new ForeignKeys(this);
}
return importedKeys;
}
public String toString() {
return "Database Table:" + getSqlName() + " to ClassName:" + getClassName();
}
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
//ignore
return null;
}
}
}
| [
"690374857@qq.com"
] | 690374857@qq.com |
b16b908bc9eb7c6c5e368e13bbbdb831e7837c0e | 6271cc0519b8b1f13fc9416acee18e44e7b0389f | /src/PeopleDetection.java | 3605005aff171a64f4c2dad8f5b7fff321c6a8d9 | [] | no_license | IonutSabau/Test | 322a5f7037b8cd9608578778c131612514bbd239 | 73cf261b4427bd53059b982a5c92b993e1e2cc55 | refs/heads/master | 2023-01-15T08:21:16.670548 | 2020-11-25T08:52:57 | 2020-11-25T08:52:57 | 315,865,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | public class PeopleDetection implements Detection{
public CameraSensor detect(CameraSensor camera){
camera.set(camera.get()+" -->> PeopleDetection");
return camera;
}
} | [
"ionut.sabau98@e-uvt.ro"
] | ionut.sabau98@e-uvt.ro |
8f06fb4c842230c06bd3506230d51d6c5add7883 | 4c94ad8f933a8c62ab3eb0609700b4aad9708668 | /src/main/java/exceptions/ThrowsUsage.java | b043f5eb1f30d686e8263ba37dd28e029d072a79 | [] | no_license | marshmallowInna/QATEST | e38695cd15011ba8c165014d03e42c8e383ba618 | 6fbc3d4983018517e313fa07f5a55b7fc1e048fd | refs/heads/main | 2023-02-28T14:59:39.786003 | 2021-01-29T14:01:15 | 2021-01-29T14:01:15 | 311,744,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,702 | java | package exceptions;
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Scanner;
/**
* Task:
* Uncomment code and modify "outputContentOfFile" method declaration
* to specify that it might throw an exception.
* Other parts of a program, modify accordingly.
*
* Задача:
* Раскомментируйте код и измените объявление метода outputContentOfFile, чтобы указать, что он может вызвать исключение.
* Соответственно измените другие части программы.
*/
public class ThrowsUsage {
public static void main(String[] args) {
final Path folderPath = Paths.get(System.getProperty("user.dir") + "/src/main/java/exceptions");
final Scanner scanner = new Scanner(System.in);
System.out.print("Enter a file name to read: ");
String fileName = scanner.nextLine();
Path fullFilePath = folderPath.resolve(fileName);
try {
outputContentOfFile(fullFilePath);
throw new Error();
} catch (IOException e) {
e.printStackTrace();
}catch (Error e){
System.out.println(" error");
}
}
private static void outputContentOfFile(Path fullFilePath) throws IOException {
BufferedReader reader = Files.newBufferedReader(fullFilePath);
String nextLine = reader.readLine();
while (nextLine != null) {
System.out.println(nextLine);
nextLine = reader.readLine();
}
}
}
| [
"Zotova7inna@gmail.com"
] | Zotova7inna@gmail.com |
1f72fdcbc18960466528c58de07c890724bbc3fb | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-11113-111111/u-11-111-1112-11113-111111-f1427.java | a1a3489ce3b0e15be5ac2c8f038dc2e33b12996e | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
3989338020456 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
c0595c1c445a64e5d1b809c606ff1ea82c1da00d | 389703d61b7e138ab82a1a358e500f7502b9947a | /src/com/barton/LibraryCatalogue.java | d8bac64cf3dbe175dd3331497e7fdbb7b1226798 | [] | no_license | JGarswood93/HackerRankHashMap | a0b507b612b6aef1fa028b02fd91ad3f128f7376 | 2ebf31fb9a2472846dca9dd579b2e7f84740a20c | refs/heads/master | 2020-06-27T22:32:01.792067 | 2019-08-01T14:53:24 | 2019-08-01T14:53:24 | 200,069,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,343 | java | package com.barton;
import java.util.HashMap;
import java.util.Map;
public class LibraryCatalogue {
/**
* Map is like a dictionary it has a word and then a definition to it
*
* In this case it has we have string which will be a title and data associated with that book
* shown below
*/
Map<String, Book> bookCollection = new HashMap<String, Book>();
int currentDay = 0;
int lengthOfCheckoutPeriod = 7;
double initialLateFee = 0.50;
double feePerLateDay = 1.00;
public LibraryCatalogue(Map<String, Book> bookCollection) {
this.bookCollection = bookCollection;
}
public LibraryCatalogue(Map<String, Book> bookCollection, int currentDay, int lengthOfCheckoutPeriod, double initialLateFee, double feePerLateDay) {
this.bookCollection = bookCollection;
this.currentDay = currentDay;
this.lengthOfCheckoutPeriod = lengthOfCheckoutPeriod;
this.initialLateFee = initialLateFee;
this.feePerLateDay = feePerLateDay;
}
public int getCurrentDay() {
return this.currentDay;
}
public Map<String, Book> getBookCollection() {
return this.bookCollection;
}
public Book getBook(String bookTitle) {
return this.getBookCollection().get(bookTitle);
}
public int getLengthOfCheckoutPeriod() {
return this.lengthOfCheckoutPeriod;
}
public double getInitialLateFee() {
return this.initialLateFee;
}
public double getFeePerLateDay() {
return this.feePerLateDay;
}
public void nextDay() {
currentDay++;
}
public void setDay(int day) {
currentDay = day;
}
public void checkOutBook(String title) {
Book book = getBook(title);
if (book.getisCheckedOut()) {
sorryBookAlreadyCheckedOut(book);
} else {
book.setIsCheckedOut(true, currentDay);
System.out.println("You just checked out" + title + ". It is due on day " + (getCurrentDay() + getLengthOfCheckoutPeriod()+"."));
}
}
public void returnBook(String title) {
Book book = getBook(title);
int daysLate = currentDay - (book.getDayCheckedOut() + getLengthOfCheckoutPeriod());
if(daysLate > 0){
System.out.println("You owe the library $" + (getInitialLateFee() + daysLate * getFeePerLateDay()) + " because your book is " + daysLate + " days Overdue.");
} else{
System.out.println("Book returned. Thank you");
}
book.setIsCheckedOut(false, -1);
}
private void sorryBookAlreadyCheckedOut(Book book) {
System.out.println("Sorry, " + book.getTitle()+ " is already checked out. " + "It should be back on day " + (book.getDayCheckedOut() + getLengthOfCheckoutPeriod()) + ". ");
}
public static void main(String[] args) {
Map<String, Book>bookCollection = new HashMap<String, Book>();
Book Richard = new Book("Richard Dawkins", 4555666, 112);
bookCollection.put("Richard Dawkins", Richard);
LibraryCatalogue lib = new LibraryCatalogue(bookCollection);
lib.nextDay();
lib.nextDay();
lib.checkOutBook("Richard Dawkins");
lib.setDay(12);
lib.returnBook("Richard Dawkins");
lib.checkOutBook("Richard Dawkins");
}
}
| [
"jacobbarton@rentalcars.com"
] | jacobbarton@rentalcars.com |
822a45ce9d9b1dea7a31b2a6eda7f8860d5b5b8d | e83881215bd002da769c8cf6df14d8994d9a6923 | /server/src/main/java/com/blocklang/develop/service/RepositoryPermissionService.java | 3f9cd526f4c5f85e5d0050ad1e3df97e9790da27 | [
"MIT"
] | permissive | xintao222/blocklang.com | 34627e613526b49000998e63a0a8b1016e862d68 | 939074c9df037c0780e01e9a73ee724b3dcc1dc0 | refs/heads/master | 2023-04-08T02:12:57.845570 | 2020-12-13T09:06:44 | 2020-12-13T09:06:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,614 | java | package com.blocklang.develop.service;
import java.security.Principal;
import java.util.Optional;
import com.blocklang.develop.constant.AccessLevel;
import com.blocklang.develop.model.Repository;
/**
* 仓库类型:公开和私有;权限类型:只读(READ)、可写(WRITE)和管理(ADMIN)。
*
* <p>匿名用户
* <ol>
* <li>匿名用户可以 READ 所有公开仓库</li>
* <li>匿名用户不能 READ 所有私有仓库</li>
*
* <li>匿名用户不能 WRITE 所有公开仓库</li>
* <li>匿名用户不能 WRITE 所有私有仓库</li>
*
* <li>匿名用户不能 ADMIN 所有公开仓库</li>
* <li>匿名用户不能 ADMIN 所有私有仓库</li>
* </ol>
* <p>
*
* <p>登录用户
* <ol>
* <li>登录用户可以 READ 所有公开仓库</li>
* <li>登录用户不能 READ 无任何权限的私有仓库</li>
* <li>登录用户可以 READ 有 READ 权限的私有仓库</li>
* <li>登录用户可以 READ 有 WRITE 权限的私有仓库</li>
* <li>登录用户可以 READ 有 ADMIN 权限的私有仓库</li>
*
* <li>登录用户不能 WRITE 无任何权限的公开仓库</li>
* <li>登录用户不能 WRITE 有 READ 权限的公开仓库</li>
* <li>登录用户可以 WRITE 有 WRITE 权限的公开仓库</li>
* <li>登录用户可以 WRITE 有 ADMIN 权限的公开仓库</li>
* <li>登录用户不能 WRITE 无任何权限的私有仓库</li>
* <li>登录用户不能 WRITE 有 READ 权限的私有仓库</li>
* <li>登录用户可以 WRITE 有 WRITE 权限的私有仓库</li>
* <li>登录用户可以 WRITE 有 ADMIN 权限的私有仓库</li>
*
* <li>登录用户不能 ADMIN 无任何权限的公开仓库</li>
* <li>登录用户不能 ADMIN 有 READ 权限的公开仓库</li>
* <li>登录用户不能 ADMIN 有 WRITE 权限的公开仓库</li>
* <li>登录用户可以 ADMIN 有 ADMIN 权限的公开仓库</li>
* <li>登录用户不能 ADMIN 无任何权限的私有仓库</li>
* <li>登录用户不能 ADMIN 有 READ 权限的私有仓库</li>
* <li>登录用户不能 ADMIN 有 WRITE 权限的私有仓库</li>
* <li>登录用户可以 ADMIN 有 ADMIN 权限的私有仓库</li>
* </ol>
* </p>
*
* @author jinzw
*
*/
public interface RepositoryPermissionService {
/**
* 校验登录用户对仓库是否有读取权限。
*
* @param loginUser 登录用户信息
* @param repository 仓库基本信息
* @return 如果登录用户可以访问仓库,则返回权限信息,否则返回 <code>Optional.empty()</code>。
* <p>注意,不要使用返回的权限信息,此处本应返回 <code>Boolean</code> 类型,
* 之所以返回 <code>Optional<AccessLevel></code>,
* 是为了使用 {@link Optional#orElseThrow(java.util.function.Supplier)} </p>
*/
Optional<AccessLevel> canRead(Principal loginUser, Repository repository);
/**
* 校验登录用户对仓库是否有写入权限。
*
* @param loginUser 登录用户信息
* @param repository 仓库基本信息
* @return 如果登录用户可以写入仓库,则返回权限信息,否则返回 <code>Optional.empty()</code>
* <p>注意,不要使用返回的权限信息,此处本应返回 <code>Boolean</code> 类型,
* 之所以返回 <code>Optional<AccessLevel></code>,
* 是为了使用 {@link Optional#orElseThrow(java.util.function.Supplier)} </p>
*/
Optional<AccessLevel> canWrite(Principal loginUser, Repository repository);
/**
* 校验登录用户对仓库是否有管理权限。
*
* @param loginUser 登录用户信息
* @param repository 仓库基本信息
* @return 如果登录用户可以管理仓库,则返回权限信息,否则返回 <code>Optional.empty()</code>
* <p>注意,不要使用返回的权限信息,此处本应返回 <code>Boolean</code> 类型,
* 之所以返回 <code>Optional<AccessLevel></code>,
* 是为了使用 {@link Optional#orElseThrow(java.util.function.Supplier)} </p>
*/
Optional<AccessLevel> canAdmin(Principal loginUser, Repository repository);
/**
* 如果要获取用户对仓库拥有的最高权限,则应使用此方法,
* 因为权限是分等级的,canRead 等方法是用于校验用户对仓库是否拥有某项权限,返回的权限信息不一定是实际拥有的最高权限。
*
* @param loginUser 登录用户信息
* @param repository 仓库基本信息
* @return 权限信息
*/
AccessLevel findTopestPermission(Principal loginUser, Repository repository);
}
| [
"idocument@qq.com"
] | idocument@qq.com |
01ef55a1eb08ab20d74852e193a88256d794eb43 | a92bba9923cb5cb7b37a91e09ccb70c70103375d | /LP01T5BM/app/src/test/java/cibertec/dam1/lp01_t5bm/ExampleUnitTest.java | f1fcd0a5eadbc2cf910cd7b55302489633eb5529 | [] | no_license | pelguera/EjemplosAndroid | b4b88d6db3c780d8f1cd6b6c8034c12fd7954a6e | f786c5eeb2431c21b2b6d839b28500e802ddb572 | refs/heads/master | 2020-07-09T16:57:38.973170 | 2019-08-23T16:04:28 | 2019-08-23T16:04:28 | 204,027,509 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package cibertec.dam1.lp01_t5bm;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"paul.elguera@bbva.com"
] | paul.elguera@bbva.com |
6f254194565593560cf54e15cf9f8f3e7083833c | 524f7bba8e6f7283b278a469466e538c7f63701e | /贝王-App源码/MStore安卓/mdwmall/src/main/java/com/xxmassdeveloper/mpchartexample/listviewitems/PieChartItem.java | 0f402f1da4bc0c3f59401ce7e6da5fc4d312373b | [] | no_license | xiongdaxionger/BSLIFE | e63e3582f6eec8c95636be39839c5f29b69b36ee | 198a8c15ad32de493404022b9e00b0fe7202de08 | refs/heads/master | 2020-05-16T10:00:49.652335 | 2019-04-24T08:56:29 | 2019-04-24T08:56:29 | 182,962,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,430 | java |
package com.xxmassdeveloper.mpchartexample.listviewitems;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.Legend.LegendPosition;
import com.github.mikephil.charting.data.ChartData;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.utils.PercentFormatter;
import com.beiwangfx.R;
public class PieChartItem extends ChartItem {
private Typeface mTf;
public PieChartItem(ChartData<?> cd, Context c) {
super(cd);
mTf = Typeface.createFromAsset(c.getAssets(), "OpenSans-Regular.ttf");
}
@Override
public int getItemType() {
return TYPE_PIECHART;
}
@Override
public View getView(int position, View convertView, Context c) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = LayoutInflater.from(c).inflate(
R.layout.list_item_piechart, null);
holder.chart = (PieChart) convertView.findViewById(R.id.chart);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// apply styling
holder.chart.setDescription("");
holder.chart.setHoleRadius(52f);
holder.chart.setTransparentCircleRadius(57f);
holder.chart.setCenterText("MPChart\nAndroid");
holder.chart.setCenterTextTypeface(mTf);
holder.chart.setCenterTextSize(18f);
holder.chart.setUsePercentValues(true);
mChartData.setValueFormatter(new PercentFormatter());
mChartData.setValueTypeface(mTf);
mChartData.setValueTextSize(11f);
mChartData.setValueTextColor(Color.WHITE);
// set data
holder.chart.setData((PieData) mChartData);
Legend l = holder.chart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
l.setYEntrySpace(0f);
l.setYOffset(0f);
// do not forget to refresh the chart
// holder.chart.invalidate();
holder.chart.animateXY(900, 900);
return convertView;
}
private static class ViewHolder {
PieChart chart;
}
}
| [
"xiongerxiongda@gmail.com"
] | xiongerxiongda@gmail.com |
6f5b72ae358bb155d417477ad9e6fab1aeaea453 | c9d01cff1061983e3dde5ec3394d98c62858bdb3 | /apple_mango.java | 3c19d1dfd3c6ae2ce16d4bb75523eb1c939ff639 | [] | no_license | amandeepfull/new-hacker-rank | 4e59330657850a005337d95391cf3cb9efc9111d | a66104dae846f6c04bf40f8a176a8a9accb7cfb2 | refs/heads/master | 2021-01-19T08:18:16.322440 | 2017-04-08T08:37:28 | 2017-04-08T08:37:28 | 87,619,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java | import java.io.*;
import java.util.*;
class abc
{
public static void main(String arf[])
{
Scanner sc=new Scanner(System.in);
int s,t;
s=sc.nextInt();
t=sc.nextInt();
int a,b;
a=sc.nextInt();
b=sc.nextInt();
int m,n;
m=sc.nextInt();
n=sc.nextInt();
int arr4[]=new int[m];
int arr5[]=new int[n];
int count_a=0,count_b=0;
for(int i=0;i<m;i++)
{
arr4[i]=sc.nextInt();
}
for(int i=0;i<n;i++)
{
arr5[i]=sc.nextInt();
}
for(int i=0;i<m;i++)
{
arr4[i]=a+arr4[i];
if(arr4[i]>=s && arr4[i]<=t)
{
count_a++;
}
}
for(int i=0;i<n;i++)
{
arr5[i]=b+arr5[i];
if(arr5[i]>=s && arr5[i]<=t)
{
count_b++;
}
}
System.out.println(count_a+" "+count_b);
}
} | [
"noreply@github.com"
] | amandeepfull.noreply@github.com |
6b91d5245c5f6637d4dabf71008e0312b297d9c9 | cecc6f277fda3fed2f6c42a658ff1fd1fc6b3a38 | /src/main/java/com/yh/spring/ssm/sendMail/MailUtils.java | 8fccfe17161a83b21e2a008643ae18e0b96f82d3 | [] | no_license | dongjiashun/otter_auto_tools | 87c61a85001aef36020c53f12376bc267a3108e8 | c1ca775619c537db909908fa803e15fe9b14177e | refs/heads/master | 2022-12-23T01:37:28.850709 | 2019-11-05T11:20:41 | 2019-11-05T11:20:41 | 193,625,255 | 29 | 17 | null | 2022-12-16T03:31:41 | 2019-06-25T03:07:25 | Java | UTF-8 | Java | false | false | 5,626 | java | package com.yh.spring.ssm.sendMail;
import javax.mail.*;
import javax.mail.internet.AddressException;
import javax.mail.internet.MimeMessage;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import com.yh.spring.ssm.service.templeteMail.EmailDo;
import com.yh.spring.ssm.service.templeteMail.EmailService;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MailUtils {
public static void sendMail(Mail mail,Session session) {
mail.setFrom(MailConfig.getString("userName"));
try {
Transport transport = session.getTransport(); // 获取传输对象
transport.connect();
Message message = new MimeMessage(session); // 邮件消息对象
message.setFrom(mail.getFrom()); // 发送者
message.setSubject(mail.getSubject());
if (mail.getContent() != null) {
message.setContent(mail.getContent(), mail.getContentType());
} else {
message.setContent(mail.getMultipart());
}
message.setRecipients(Message.RecipientType.TO, mail.getTo());
message.setRecipients(Message.RecipientType.CC, mail.getCc());
message.setRecipients(Message.RecipientType.BCC, mail.getBcc());
transport.sendMessage(message, message.getAllRecipients()); // 发送邮件
transport.close();
} catch (NoSuchProviderException e) {
e.printStackTrace();
} catch (AddressException e) {
e.printStackTrace();
} catch (MessagingException e) {
e.printStackTrace();
}
}
public static void prepareSendMail(String html,String send){
// 判断是否发邮件
if(StringUtils.isNotBlank(send)&&send.equals("true")){
html = html.replaceAll("告警主机", "<br/>告警主机");
html = html.replaceAll("主机IP", "<br/>主机IP");
html = html.replaceAll("告警时间", "<br/>告警时间");
html = html.replaceAll("告警等级", "<br/>告警等级");
html = html.replaceAll("告警信息:", "<br/>告警信息:");
html = html.replaceAll("问题详情", "<br/>问题详情");
html = html.replaceAll("事件ID", "<br/>事件ID");
html = html.replaceAll("产生时间", "<br/>产生时间");
html = html.replaceAll("恢复时间", "<br/>恢复时间");
MailUtils.sendMail(html);
System.out.println("邮件发送成功");
}
}
public static void sendMail(String html){
Session session = Session.getInstance(MailConfig.build("resources/mail.properties"),
new MailAuthenticator(MailConfig.getString("userName"), MailConfig.getString("passWord")));
String sendWhos = MailConfig.getString("sendWhos");
String subject = MailConfig.getString("subject");
Mail mail = new Mail();
mail.setSubject(subject);
mail.setContentType("text/html;charset=utf-8");
mail.setContent(html);
mail.setTo(sendWhos);//输入邮箱
mail.setCc(sendWhos);
mail.setBcc(sendWhos);
MailUtils.sendMail(mail,session);
}
// public static void main(String[] args) {
// Mail mail = new Mail();
// mail.setSubject("国庆中秋8天乐");
// mail.setContentType("text/html;charset=utf-8");
// mail.setContent("放假啦");
//// mail.setBodyContent("放假啦");
//// List<String> files = new ArrayList<String>();
//// files.add("src/main/resources/mail.properties");//添加附件
//// files.add("src/main/resources/邮件测试.txt");
//// mail.setFilePathes(files);
//// mail.setTo("1115170465@qq.com");//输入邮箱
//// mail.setCc("1115170465@qq.com");
//// mail.setBcc("1115170465@qq.com");
// mail.setTo("22216@etransfar.comm");//输入邮箱
// mail.setCc("22216@etransfar.com");
// mail.setBcc("22216@etransfar.com");
// MailUtils.sendMail("testttest");
// }
//
public static void main(String[] args) {
// String txt = "Zabbix商用环境异常告警信息<br/>告警主机:db-tffwalletmysql-1-m1 <br/>主机IP: 10.33.102.120 <br/>告警时间:2019.05.03 18:32:40 \n\r告警等级:Average <br/>告警信息:db-tffwalletmysql-1-m1Mysql Query_timeout_10s <br/>问题详情:mysql_Query_timeout_10s:3 <br/>事件ID: 31754939";
String txt = "Zabbix商用环境异常告警信息 告警主机:db-tffwalletmysql-1-m1 主机IP: 10.33.102.120 告警时间:2019.05.03 18:32:40 告警等级:Average 告警信息:db-tffwalletmysql-1-m1Mysql Query_timeout_10s 问题详情:mysql_Query_timeout_10s:3 事件ID: 31754939";
// String newString = txt.replaceAll("(\r\n|\r|\n|\n\r)", "<br/>");
txt = txt.replaceAll("告警主机", "<br/>告警主机");
txt = txt.replaceAll("主机IP", "<br/>主机IP");
txt = txt.replaceAll("告警时间", "<br/>告警时间");
txt = txt.replaceAll("告警等级", "<br/>告警等级");
txt = txt.replaceAll("告警信息:", "<br/>告警信息:");
txt = txt.replaceAll("问题详情", "<br/>问题详情");
txt = txt.replaceAll("事件ID", "<br/>事件ID");
txt = txt.replaceAll("产生时间", "<br/>产生时间");
txt = txt.replaceAll("恢复时间", "<br/>恢复时间");
System.out.println(txt);
// MailUtils.prepareSendMail(txt,"true");
}
}
| [
"1115170465@qq.com"
] | 1115170465@qq.com |
c1ff45fabf2d01c41d3e9a173b9cb37fe008e94c | 950a1bf0f8c9ca6165548779f863f26a0923c406 | /src/ajmal/BagOfVisualWords/Functions/QueryPerformer.java | bae952a2dca576944731629b420c26b0882b9657 | [] | no_license | ForeverAct/Grire-example | bcb5ec2dc751d4f4c848d752b6aaddf87078421c | 47f0ca75e804522a575aa02ccd80fa54ba7a51b7 | refs/heads/master | 2021-01-02T08:34:38.732003 | 2016-04-25T05:22:35 | 2016-04-25T05:22:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,305 | java | /* This file is part of the GRire project: https://code.google.com/p/grire/
*
* GRire is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRire is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2012 Lazaros Tsochatzidis <ltsochat at ee.duth.gr>
*/
package ajmal.BagOfVisualWords.Functions;
import ajmal.BagOfVisualWords.BOVWSystem;
import ajmal.BagOfVisualWords.Interfaces.VisualWordDescriptor;
import ajmal.BagOfVisualWords.Interfaces.WeightingScheme;
import ajmal.BagOfVisualWords.Structures.Index;
import ajmal.GeneralUtilities.Interfaces.SimilarityMeasure;
import ajmal.Helpers.Listeners.Listened;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.*;
/**
* This class is used to perform a query to the database previously created. It opens a new specified image and compares its
* bag from the VisualWordDescriptor to all the other bags, after applying a WeightingScheme to both vectors, by using the
* Similarity specified.
*/
public class QueryPerformer {
protected WeightingScheme scheme;
protected VisualWordDescriptor descriptor;
protected SimilarityMeasure similarity;
protected TreeSet<setItem> Scores=null;
protected Index index;
protected BOVWSystem system;
public QueryPerformer(BOVWSystem system, WeightingScheme scheme, SimilarityMeasure similarity){
this.scheme = scheme;
this.descriptor = system.descriptor;
this.similarity=similarity;
this.index=system.getIndex();
this.system=system;
scheme.setIndex(index);
}
/**
* Perform the query using the specified image as input.
* @param img
* @return
* @throws Exception
*/
public TreeSet NewQuery(File img) {
float[] vector = descriptor.extract(img);
int sign=(similarity.smallerTheBetter()?1:-1);
vector= scheme.formQueryVector(vector);
Scores = new TreeSet<>();
Set<Long> ids = index.lookUp(vector);
float temp[],v;
for (Object o : ids) {
temp= scheme.formVector(index.getImageDescriptor(((Long) o).longValue()));
v = sign * similarity.calculate(vector, temp);
setItem item=new setItem(v,(Long)o);
while (Scores.contains(item)) {
item.score+=Float.MIN_VALUE;
}
Scores.add(item);
}
for (Object o : index)
if (!ids.contains(o))
Scores.add(new setItem(Scores.last().score+Float.MIN_VALUE,(Long)o));
return Scores;
}
public TreeSet NewQuery(File img, int numOfResults) {
final long it2 = System.currentTimeMillis();
float[] vector = descriptor.extract(img);
final long it3 = System.currentTimeMillis();
//System.out.println("[INFO] Feature Extraction took: " + ((it3 - it2) / 1000.0) + " secs");
int sign=(similarity.smallerTheBetter()?1:-1),counter=0;
vector= scheme.formQueryVector(vector);
Scores = new TreeSet<>();
Set<Long> ids = index.lookUp(vector);
float temp[],v;
for (Object o : ids) {
temp= scheme.formVector(index.getImageDescriptor(((Long) o).longValue()));
v = sign * similarity.calculate(vector, temp);
setItem item=new setItem(v,(Long)o);
while (Scores.contains(item)) {
item.score+=Float.MIN_VALUE;
}
counter++;
Scores.add(item);
}
Iterator iterator = index.iterator();
while (counter<numOfResults && iterator.hasNext()) {
Object next = iterator.next();
if (!ids.contains(next)) {
Scores.add(new setItem(Scores.last().score+Float.MIN_VALUE,(Long)next));
counter++;
}
}
final long it4 = System.currentTimeMillis();
//System.out.println("[INFO] Search took: " + ((it4 - it3) / 1000.0) + " secs");
return Scores;
}
/**
* Return a Listened object that will perform a multiple query to the databse fetching the query images
* from a text file
* @param ExperimentName
* @param Query
* @param Results
* @param imagesPerQuery
* @return
* @throws Exception
*/
public Listened NewTRECQuery(final String ExperimentName, final InputStream Query, final OutputStream Results , final int imagesPerQuery) throws Exception {
return new Listened() {
@Override
public void run() {
Scanner sc=new Scanner(Query);
PrintStream ps = new PrintStream(Results);
String line,name;
TreeSet<setItem> results;
int curr,query=1,sign=(similarity.smallerTheBetter()?-1:1);
while (sc.hasNextLine()) {
curr=0;
if (!"".equals(line=sc.nextLine())) {
results = NewQuery(new File(line),imagesPerQuery);
for (setItem item : results) {
try {
name=new File(system.getCollection().getImage(item.id)).getName();
ps.println(query +" 1 "+name.substring(0, name.lastIndexOf('.'))+" "+(++curr)+" "+sign*(item.score));
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
query++;
}
}
}
@Override
public String toString() {
return "TREC From file Experiment";
}
};
}
/**
* Return a Listened object that will perform a multiple query to the databse fetching the query images
* from a List of Strings.
* @param ExperimentName
* @param querylist
* @param Results
* @param imagesPerQuery
* @return
* @throws Exception
*/
public Listened NewTRECQuery(final String ExperimentName, final List<String> querylist, final OutputStream Results , final int imagesPerQuery) throws Exception {
return new Listened() {
@Override
public void run() {
PrintStream ps = new PrintStream(Results);
String name;
TreeSet<setItem> results;
int curr,query=1,sign=(similarity.smallerTheBetter()?-1:1);
int size = querylist.size();
for (String line:querylist) {
curr=0;
results = NewQuery(new File(line.replace(" ","\\ ")));
for (setItem item : results){
try {
name=new File(system.getCollection().getImage(item.id)).getName();
System.out.println(name.substring(0, name.lastIndexOf('.')));
ps.println("CC="+imagesPerQuery);
ps.println(query +" 1 "+name.substring(0, name.lastIndexOf('.'))+" "+(++curr)+" "+sign*item.score+" "+ExperimentName+" inter");
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
if (curr<=imagesPerQuery)
{
ps.println("Breakpoint"+curr+" "+imagesPerQuery);
break;
}
}
progressMade(query++, size);
}
ps.close();
actionCompleted();
}
@Override
public String toString() {
return "TREC Query";
}
};
}
public SimilarityMeasure getSimilarity() {
return similarity;
}
public WeightingScheme getScheme() {
return scheme;
}
public class setItem implements Comparable {
public float score;
public long id;
setItem(float score, long id) {
this.score = score;
this.id = id;
}
@Override
public boolean equals(Object obj) {
return ((setItem) obj).score==score;
}
@Override
public int compareTo(Object o) {
setItem other=(setItem) o;
if (other.score==score) return 0;
else if (other.score < score) return 1;
else if (other.score > score) return -1;
return 0;
}
}
}
| [
"ajmalmsali@ajmalmsali-SATELLITE-L735.(none)"
] | ajmalmsali@ajmalmsali-SATELLITE-L735.(none) |
eeb725d522f9ffa402740d17ec6cd95a8be8d0e6 | 8c95a07e466a66b8eb9d34826063a5135f0197bd | /src/main/java/com/city/score/calculator/service/PersonServiceImpl.java | 2cd63bb58408ee744509ad0897ed6566e3c95461 | [] | no_license | minnela/calculateScore | 17dfda5fbcc67b2694c2470e3203b8274a33a0d3 | 673cc2da88cfea19faed5412453c831b00fc1b06 | refs/heads/master | 2023-02-16T15:49:44.179623 | 2021-01-17T16:04:46 | 2021-01-17T16:04:46 | 329,979,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package com.city.score.calculator.service;
import com.city.score.calculator.domain.Person;
import org.springframework.stereotype.Service;
@Service
public class PersonServiceImpl implements PersonService {
@Override
public double calculateScore(int personScore, int salaryMultiplier, int cityScore) {
double score = personScore*salaryMultiplier+cityScore;
return score;
}
@Override
public int sendSmsToUser(Person person) {
int mobileNumber = person.getMobilePhoneNumber();
return mobileNumber;
}
}
| [
"49316771+minnela@users.noreply.github.com"
] | 49316771+minnela@users.noreply.github.com |
aefb325a1d9bc2a8f31983841ec4cc375ae4f9f9 | b76237635eb8e827b5474f303f2d240394294247 | /src/main/java/it/olegna/test/basic/svc/impl/BasicServiceImpl.java | 7d17201e100a223baf21fe832537f1058ea12659 | [] | no_license | angeloimm/springbasicauth | 00135ce2a9d0126e57ee6b7b75699e02a6c4d3cd | 7aca48b44042a5258599cbe4586a44964a84e04b | refs/heads/master | 2020-03-27T23:28:20.197155 | 2018-09-05T13:15:08 | 2018-09-05T13:15:08 | 147,320,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,560 | java | package it.olegna.test.basic.svc.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import it.olegna.test.basic.dao.BasicUserDao;
import it.olegna.test.basic.dao.RoleDao;
import it.olegna.test.basic.models.BasicUser;
import it.olegna.test.basic.models.UserRole;
import it.olegna.test.basic.svc.BasicService;
@Service
public class BasicServiceImpl implements BasicService {
private static final Logger logger = LoggerFactory.getLogger(BasicServiceImpl.class.getName());
@Autowired
private BasicUserDao bud;
@Autowired
private RoleDao rd;
@Override
@Transactional(transactionManager = "hibTx", rollbackFor = Exception.class, readOnly = false)
public void createUser(BasicUser bu) {
try {
bud.persist(bu);
} catch (Exception e) {
logger.error("Error user creation", e);
throw e;
}
}
@Override
@Transactional(transactionManager = "hibTx", rollbackFor = Exception.class, readOnly = false)
public void createRole(UserRole ur) {
try {
rd.persist(ur);
} catch (Exception e) {
logger.error("Error role creation", e);
throw e;
}
}
@Override
@Transactional(transactionManager = "hibTx", rollbackFor = Exception.class, readOnly = true)
public BasicUser findByUsername(String username) {
try {
return bud.findByUsername(username);
} catch (Exception e) {
logger.error("Error user finding", e);
throw e;
}
}
}
| [
"angelo.immediata@eng.it"
] | angelo.immediata@eng.it |
db08cbecf77bcd63aca7e5f552ccc0f95f489abf | 08b62f6eb907d12c0aa97f877f6e31fc4ffd1ae7 | /Projects/idea-maven-spring/d-spring-aop-aspectj-04/src/main/java/com/studymyself/bao02/MyAspectJ.java | a86adcc1ad30208cda8836135736a1b85932fa64 | [] | no_license | Milianjie/Spring | ffc1631d18dc50062dfecfcb46f0f2733c4f6f21 | ac285f14c61c837a0f4684da330174f57499cbf2 | refs/heads/master | 2023-03-03T04:47:41.207527 | 2021-02-13T15:48:27 | 2021-02-13T15:48:57 | 338,592,983 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,467 | java | package com.studymyself.bao02;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import java.sql.ResultSet;
import java.util.Date;
/**
* @Aspect:这是AspectJ框架的注解
* 作用:表示当前类是切面类
* 切面类:用来给业务方法增加功能的类,里面有切面功能的代码
* 位置:写在定义类的上面
*/
@Aspect
public class MyAspectJ {
/**
* @Before前置通知
* @param jp
*/
@Before(value = "execution( public void *..SomeServiceImpl.doSome(..))")
public void myBefore(JoinPoint jp){
//获取方法否完整定义
System.out.println("方法的签名(定义)="+jp.getSignature());
System.out.println("方法名="+jp.getSignature().getName());
//获取方法的实参,有两个,一个返回的是Object数组,一个返回的是第一个实参
Object[] args = jp.getArgs();
for (Object arg:args){
System.out.println("参数="+arg);
}
//增加的功能,即切面代码
System.out.println("使用@Before前置通知的切面功能:输出目标方法执行时间\n"+new Date());
}
/**
* 后置通知定义方法规则:
* 1、公共方法,public修饰
* 2、无返回值,void
* 3、方法名自定义,但要见名知意
* 4、方法有参数。建议Object,参数名自定义。
* 从@AfterReturning就可以看出,其作用就是得等到目标方法执行后返回一个值
* 然后后置通知方法才能把这个值作为其参数,然后功能代码中就有对返回值的条件
* 语句判断,进行实现相应功能
*/
/**
* @AfterReturning:后置通知
* 属性:
* value:切人入点表达式
* returning:自定义的变量名,存储目标方法返回值的。
* 所以下面通知方法中的形参名就得和这个变量名的名称一致
* 位置:通知方法上面
* 特点:
* 1、目标方法执行后执行
* 2、能够获取目标方法的返回值,通知方法中可通过条件语句用该返回值
* 进行不同的功能实现
* 3、可以修改这个返回值。但是能否影响到目标方法的返回值可以根据自己之前学过的
* 参数传递进行思考。返回值是一个值,存储在栈内存,一个方法一个栈,肯定无法影响
* 返回值是一个引用,保存的是一个内存地址,内存地址唯一指向堆中的对象,可以说内存地址就
* 是这个对象,这个引用就是这个对象,我们把另一个对象的内存地址赋给这个引用后,之前的内存
* 地址就没了,也就是说返回值的内存地址变了,对象就变了。而这里的Object
* @param res
*/
@AfterReturning(value = "execution(* *..SomeServiceImpl.doOther(..))",returning = "res")
public void myAfterReturning(Object res){
//Object res;是目标方法执行后的返回值,根据返回值做切面功能的不同处理
if (res!=null){
System.out.println("后置通知:添加对返回值的判断做出的功能,输出返回值:"+res);
}else {
System.out.println("参数为空");
}
}
}
| [
"1256478773@qq.com"
] | 1256478773@qq.com |
260fcb6070e0895525ac8d119d6d085787c9deb2 | 4c313c2df430abc96186e7443c552554de6a2e4b | /src/main/java/org/vhmml/service/OliverServiceImpl.java | edd3392a9ed8fdbdaa30981f208a2507dd3ccde2 | [] | no_license | Williamstraub/vhmml | 1be8f5748087a356e250ed5d64e44b63a9681952 | 2d8721456680b37a59b58d1c9ca6fee64f794f38 | refs/heads/master | 2021-01-11T12:30:49.390505 | 2017-02-24T16:54:44 | 2017-02-24T16:54:44 | 76,292,036 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59,914 | java | package org.vhmml.service;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.log4j.Logger;
import org.elasticsearch.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.vhmml.dto.elasticsearch.IndexedType;
import org.vhmml.entity.readingroom.AlternateSurrogate;
import org.vhmml.entity.readingroom.ArchivalContributor;
import org.vhmml.entity.readingroom.ArchivalData;
import org.vhmml.entity.readingroom.ArchivalDataLanguage;
import org.vhmml.entity.readingroom.ArchivalObject;
import org.vhmml.entity.readingroom.BibliographyUrl;
import org.vhmml.entity.readingroom.City;
import org.vhmml.entity.readingroom.Content;
import org.vhmml.entity.readingroom.ContentContributor;
import org.vhmml.entity.readingroom.ContentLanguage;
import org.vhmml.entity.readingroom.Contributor;
import org.vhmml.entity.readingroom.Country;
import org.vhmml.entity.readingroom.Extent;
import org.vhmml.entity.readingroom.FacsimileUrl;
import org.vhmml.entity.readingroom.Feature;
import org.vhmml.entity.readingroom.Genre;
import org.vhmml.entity.readingroom.Image;
import org.vhmml.entity.readingroom.Import;
import org.vhmml.entity.readingroom.Institution;
import org.vhmml.entity.readingroom.Language;
import org.vhmml.entity.readingroom.Manuscript;
import org.vhmml.entity.readingroom.ManuscriptAndPrinted;
import org.vhmml.entity.readingroom.PrintedObject;
import org.vhmml.entity.readingroom.ReadingRoomObject;
import org.vhmml.entity.readingroom.ReadingRoomObject.AccessRestriction;
import org.vhmml.entity.readingroom.ReadingRoomObject.Status;
import org.vhmml.entity.readingroom.ReadingRoomObject.Type;
import org.vhmml.entity.readingroom.ReadingRoomObjectContributor;
import org.vhmml.entity.readingroom.ReadingRoomObjectFeature;
import org.vhmml.entity.readingroom.ReadingRoomObjectGenre;
import org.vhmml.entity.readingroom.ReadingRoomObjectPart;
import org.vhmml.entity.readingroom.ReadingRoomObjectSubject;
import org.vhmml.entity.readingroom.ReadingRoomPartContributor;
import org.vhmml.entity.readingroom.Repository;
import org.vhmml.entity.readingroom.Subject;
import org.vhmml.entity.readingroom.Support;
import org.vhmml.entity.readingroom.UniformTitle;
import org.vhmml.entity.readingroom.WritingSystem;
import org.vhmml.repository.CityRepository;
import org.vhmml.repository.CountryRepository;
import org.vhmml.repository.readingroom.AlternateTitleRepository;
import org.vhmml.repository.readingroom.ArchivalContributorRepository;
import org.vhmml.repository.readingroom.ArchivalDataLanguageRepository;
import org.vhmml.repository.readingroom.ArchivalDataRepository;
import org.vhmml.repository.readingroom.ImportRepository;
import org.vhmml.repository.readingroom.ReadingRoomAlternateSurrogateRepository;
import org.vhmml.repository.readingroom.ReadingRoomContentContributorRepository;
import org.vhmml.repository.readingroom.ReadingRoomContentLanguageRepository;
import org.vhmml.repository.readingroom.ReadingRoomContentRepository;
import org.vhmml.repository.readingroom.ReadingRoomContributorRepository;
import org.vhmml.repository.readingroom.ReadingRoomFeatureRepository;
import org.vhmml.repository.readingroom.ReadingRoomFormatRepository;
import org.vhmml.repository.readingroom.ReadingRoomGenreRepository;
import org.vhmml.repository.readingroom.ReadingRoomImageRepository;
import org.vhmml.repository.readingroom.ReadingRoomInstitutionRepository;
import org.vhmml.repository.readingroom.ReadingRoomLanguageRepository;
import org.vhmml.repository.readingroom.ReadingRoomObjectBibUrlRepository;
import org.vhmml.repository.readingroom.ReadingRoomObjectContributorRepository;
import org.vhmml.repository.readingroom.ReadingRoomObjectExtentRepository;
import org.vhmml.repository.readingroom.ReadingRoomObjectFacsimileUrlRepository;
import org.vhmml.repository.readingroom.ReadingRoomObjectFeatureRepository;
import org.vhmml.repository.readingroom.ReadingRoomObjectGenreRepository;
import org.vhmml.repository.readingroom.ReadingRoomObjectRepository;
import org.vhmml.repository.readingroom.ReadingRoomObjectSubjectRepository;
import org.vhmml.repository.readingroom.ReadingRoomPartCenturyRepository;
import org.vhmml.repository.readingroom.ReadingRoomPartContributorRepository;
import org.vhmml.repository.readingroom.ReadingRoomPartRepository;
import org.vhmml.repository.readingroom.ReadingRoomSubjectRepository;
import org.vhmml.repository.readingroom.RepositoryRepository;
import org.vhmml.repository.readingroom.UniformTitleRepository;
import org.vhmml.repository.readingroom.WritingSystemRepository;
import org.vhmml.util.AttributeUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
@Service
public class OliverServiceImpl implements OliverService {
private static final Logger LOG = Logger.getLogger(OliverServiceImpl.class);
private static final ObjectMapper objectMapper = new ObjectMapper();
@Autowired
private ReadingRoomObjectRepository readingRoomObjectRepository;
@Autowired
private ArchivalDataRepository archivalDataRepository;
@Autowired
private ArchivalContributorRepository archivalContributorRepository;
@Autowired
private ReadingRoomPartRepository readingRoomPartRepository;
@Autowired
private ReadingRoomPartContributorRepository readingRoomPartContributorRepository;
@Autowired
private ReadingRoomPartCenturyRepository readingRoomPartCenturyRepository;
@Autowired
private ReadingRoomContentRepository readingRoomContentRepository;
@Autowired
private ReadingRoomContentContributorRepository contentContributorRepository;
@Autowired
private ReadingRoomContentLanguageRepository contentLanguageRepository;
@Autowired
private ReadingRoomImageRepository readingRoomImageRepository;
@Autowired
private ReadingRoomLanguageRepository languageRepository;
@Autowired
private CountryRepository countryRepository;
@Autowired
private CityRepository cityRepository;
@Autowired
private ReadingRoomService readingRoomService;
@Autowired
private RepositoryRepository repoRepository;
@Autowired
private ReadingRoomContentLanguageRepository contentLangRepository;
@Autowired
private ReadingRoomContributorRepository contributorRepository;
@Autowired
private ReadingRoomGenreRepository genreRepository;
@Autowired
private UniformTitleRepository uniformTitleRepository;
@Autowired
private ReadingRoomSubjectRepository subjectRepository;
@Autowired
private ReadingRoomFormatRepository formatRepository;
@Autowired
private WritingSystemRepository writingSystemRepository;
@Autowired
private ReadingRoomInstitutionRepository institutionRepository;
@Autowired
private ReadingRoomObjectGenreRepository objectGenreRepository;
@Autowired
private ReadingRoomObjectSubjectRepository objectSubjectRepository;
@Autowired
private AlternateTitleRepository alternateTitleRepository;
@Autowired
private ReadingRoomAlternateSurrogateRepository alternateSurrogateRepository;
@Autowired
private ReadingRoomObjectBibUrlRepository bibUrlRepository;
@Autowired
private ReadingRoomObjectFacsimileUrlRepository facsimileUrlRepository;
@Autowired
private ReadingRoomObjectContributorRepository objectContributorRepository;
@Autowired
private ReadingRoomObjectExtentRepository objectExtentRepository;
@Autowired
private ReadingRoomFeatureRepository featureRepository;
@Autowired
private ReadingRoomObjectFeatureRepository objectFeatureRepository;
@Autowired
private ArchivalDataLanguageRepository archivalDataLanguageRepository;
@Autowired
private ImportRepository importRepository;
@Autowired
private ElasticSearchService elasticSearchService;
private static Map<String, Country> countryCache = new HashMap<>();
private static Map<City, City> cityCache = new HashMap<>();
private static Map<Repository, Repository> repoCache = new HashMap<>();
private static Map<String, Language> languageCache = new HashMap<>();
private static Map<String, WritingSystem> writingSystemCache = new HashMap<>();
private static Map<String, Contributor> contributorCache = new HashMap<>();
private static Map<String, Genre> genreCache = new HashMap<>();
private static Map<String, UniformTitle> uniformTitleCache = new HashMap<>();
private static Map<String, Subject> subjectCache = new HashMap<>();
private static Map<String, Institution> institutionCache = new HashMap<>();
private static Map<String, Feature> featureCache = new HashMap<>();
public List<Import> getImports() {
return Lists.newArrayList(importRepository.findAllByOrderByImportDateDesc());
}
@Transactional
public void deleteImportedData(Long importId) {
Import importResult = getImportResult(importId);
if(importResult != null) {
String importFileName = importResult.getImportFile();
List<Integer> objectIds = readingRoomObjectRepository.selectObjectIdsByDataSource(importFileName);
readingRoomImageRepository.deleteByImportSource(importFileName);
contentContributorRepository.deleteByImportSource(importFileName);
contentLangRepository.deleteByImportSource(importFileName);
alternateTitleRepository.deleteByImportSource(importFileName);
readingRoomContentRepository.deleteByImportSource(importFileName);
alternateSurrogateRepository.deleteByImportSource(importFileName);
bibUrlRepository.deleteByImportSource(importFileName);
facsimileUrlRepository.deleteByImportSource(importFileName);
objectContributorRepository.deleteByImportSource(importFileName);
objectExtentRepository.deleteByImportSource(importFileName);
objectFeatureRepository.deleteByImportSource(importFileName);
objectGenreRepository.deleteByImportSource(importFileName);
objectSubjectRepository.deleteByImportSource(importFileName);
readingRoomPartContributorRepository.deleteByImportSource(importFileName);
readingRoomPartCenturyRepository.deleteByImportSource(importFileName);
readingRoomPartRepository.deleteByImportSource(importFileName);
archivalDataLanguageRepository.deleteByImportSource(importFileName);
archivalContributorRepository.deleteByImportSource(importFileName);
archivalDataRepository.deleteByImportSource(importFileName);
readingRoomObjectRepository.deleteByImportSource(importFileName);
importResult.setStatus(Import.Status.DELETED);
importRepository.save(importResult);
elasticSearchService.delete(IndexedType.READING_ROOM_OBJECT, objectIds);
}
}
public Import getImportResult(Long id) {
return importRepository.findOne(id);
}
public Import createImportJob(String databaseLocation) {
Import importJob = new Import();
importJob.setImportFile(databaseLocation);
importJob.setStatus(Import.Status.CREATED);
return importRepository.save(importJob);
}
@Transactional
public Import runImportJob(Import importJob) {
clearCache();
String databaseLocation = importJob.getImportFile();
Date now = new Date();
Long start = now.getTime();
importJob.setStatus(Import.Status.STARTED);
importJob.setImportDate(now);
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
importJob.setObjectsBeforeImport(new Long(readingRoomObjectRepository.count()).intValue());
importJob.setPartsBeforeImport(new Long(readingRoomPartRepository.count()).intValue());
importJob.setContentsBeforeImport(new Long(readingRoomContentRepository.count()).intValue());
importJob.setImagesBeforeImport(new Long(readingRoomImageRepository.count()).intValue());
importJob.setContentContributorsBeforeImport(new Long(contentContributorRepository.count()).intValue());
importJob.setContentLanguagesBeforeImport(new Long(contentLanguageRepository.count()).intValue());
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
conn = DriverManager.getConnection("jdbc:ucanaccess://" + databaseLocation);
stmt = conn.createStatement();
// grab these first, need to check the header records to see if it's archival or not because we only import header records for archival
rs = stmt.executeQuery("select * from tblMs");
rs.next();
String recordTypeName = StringUtils.trim(rs.getString("RecordType"));
Map<Long, List<ReadingRoomObjectPart>> partsByObjectId = new HashMap<>();
if(!ReadingRoomObject.Type.ARCHIVAL_OBJECT.getDisplayName().equals(recordTypeName)) {
rs = stmt.executeQuery("select * from tblLink3");
Map<Long, List<Image>> imagesByContentId = importReadingRoomImages(rs, importJob);
rs = stmt.executeQuery("select * from tblEDoc");
Map<Long, List<Content>> contentByPartId = importReadingRoomContent(rs, importJob);
rs = stmt.executeQuery("select * from tblMsPt");
partsByObjectId = importReadingRoomObjectParts(rs, importJob, contentByPartId, imagesByContentId);
}
// have to re-read all the header records because the MS Access driver doesn't support the first() or previous() methods on the result set object
rs = stmt.executeQuery("select * from tblMs");
importReadingRoomObjects(rs, importJob, partsByObjectId, recordTypeName);
importJob.setObjectsAfterImport(new Long(readingRoomObjectRepository.count()).intValue());
importJob.setPartsAfterImport(new Long(readingRoomPartRepository.count()).intValue());
importJob.setContentsAfterImport(new Long(readingRoomContentRepository.count()).intValue());
importJob.setImagesAfterImport(new Long(readingRoomImageRepository.count()).intValue());
importJob.setContentContributorsAfterImport(new Long(contentContributorRepository.count()).intValue());
importJob.setContentLanguagesAfterImport(new Long(contentLanguageRepository.count()).intValue());
importJob.setDurationSeconds((new Date().getTime() - start)/1000);
elasticSearchService.reindex(IndexedType.READING_ROOM_OBJECT);
importJob.setStatus(Import.Status.COMPLETED);
saveImportJob(importJob);
} catch (Exception e) {
LOG.error("Unexpected exception attempting to import data from location " + databaseLocation, e);
throw new RuntimeException(e);
} finally {
try {
if(rs != null) {
rs.close();
}
if(stmt != null) {
stmt.close();
}
if(conn != null) {
conn.close();
}
} catch(Exception e) {
LOG.error("Exception closing resource after import of file " + databaseLocation, e);
throw new RuntimeException(e);
}
}
LOG.info("import of " + databaseLocation + " took " + importJob.getDurationSeconds());
return importJob;
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void saveImportJob(Import importJob) {
importRepository.save(importJob);
}
private List<ReadingRoomObject> importReadingRoomObjects(ResultSet rs, Import importResult, Map<Long, List<ReadingRoomObjectPart>> partsByObjectId, String expectedRecordType) throws Exception {
List<ReadingRoomObject> readingRoomObjects = new ArrayList<>();
List<Extent> extents = new ArrayList<Extent>();
List<ReadingRoomObjectGenre> genres = new ArrayList<>();
List<ReadingRoomObjectFeature> features = new ArrayList<>();
List<ReadingRoomObjectSubject> subjects = new ArrayList<>();
List<ReadingRoomObjectContributor> formerOwners = new ArrayList<>();
List<AlternateSurrogate> altSurrogates = new ArrayList<>();
List<BibliographyUrl> bibUrls = new ArrayList<>();
List<FacsimileUrl> facsimileUrls = new ArrayList<>();
List<ArchivalData> archivalDataList = new ArrayList<>();
List<ArchivalContributor> archivalContributors = new ArrayList<>();
List<ArchivalDataLanguage> archivalLanguages = new ArrayList<>();
// colophon was on the object in the old database, it's on the part now, need to pull the colophon
// off the object and set it on the first part for the object
List<ReadingRoomObjectPart> updatedParts = new ArrayList<>();
String importFileName = importResult.getImportFile();
while(rs.next()) {
Long id = rs.getLong("MsID");
String recordTypeName = StringUtils.trim(rs.getString("RecordType"));
// for archival object imports, all records must be archival because we only import header records for archival, therefore if
// there are archival items mixed in with manuscript/print records we want to fail the whole import
boolean unexpectedNonArchival = "Archival Material".equalsIgnoreCase(expectedRecordType) && !recordTypeName.equals(expectedRecordType);
boolean unexpectedArchival = !"Archival Material".equalsIgnoreCase(expectedRecordType) && "Archival Material".equalsIgnoreCase(recordTypeName);
if(unexpectedNonArchival || unexpectedArchival) {
throw new RuntimeException("An import cannot contain both archival records and non-archival records. Invalid record type on record with ID " + id + ", expected " + expectedRecordType + " but was " + recordTypeName);
}
ReadingRoomObject.Type recordType = StringUtils.isNotEmpty(recordTypeName) ? Type.forDisplayName(recordTypeName) : Type.READING_ROOM_OBJECT;
ReadingRoomObject readingRoomObject = new ReadingRoomObject();
switch(recordType) {
case READING_ROOM_OBJECT:
break;
case MANUSCRIPT:
readingRoomObject = new Manuscript();
break;
case MANUSCRIPT_PRINT:
readingRoomObject = new ManuscriptAndPrinted();
break;
case PRINT:
readingRoomObject = new PrintedObject();
break;
case ARCHIVAL_OBJECT:
readingRoomObject = new ArchivalObject();
// foliation is at the object level for archival because it's normally at the part level in Oliver, but archival items have no parts
// readingRoomObject.setFoliation(StringUtils.trim(rs.getString("Foliation")));
archivalDataList.add(getArchivalData(rs));
archivalContributors.addAll(getArchivalContributors(rs));
archivalLanguages.addAll(getArchivalDataLanguages(rs));
break;
}
readingRoomObject.setDataSource(importFileName);
readingRoomObject.setId(id);
Country country = findOrCreateCountry(
StringUtils.trim(rs.getString("Country")),
StringUtils.trim(rs.getString("CountryAuthorityURI_LC")),
StringUtils.trim(rs.getString("CountryAuthorityURI_VIAF")),
StringUtils.trim(rs.getString("CountryISO3166")));
City city = findOrCreateCity(country != null ? country.getId() : null, StringUtils.trim(rs.getString("City")), StringUtils.trim(rs.getString("CityAuthorityURI_LC")), StringUtils.trim(rs.getString("CityAuthorityURI_VIAF")));
readingRoomObject.setCountry(country);
readingRoomObject.setCity(city);
readingRoomObject.setProcessedBy(StringUtils.trim(rs.getString("Institution")));
readingRoomObject.setRepository(findOrCreateRepo(
city != null ? city.getId() : null,
StringUtils.trim(rs.getString("Library")),
StringUtils.trim(rs.getString("RepositoryAuthorityURI_LC")),
StringUtils.trim(rs.getString("RepositoryAuthorityURI_VIAF"))));
List<Subject> subjectsForObject = findOrCreateSubject(
StringUtils.trim(rs.getString("Subject")),
StringUtils.trim(rs.getString("SubjectURI_LC")),
StringUtils.trim(rs.getString("SubjectURI_VIAF")));
if(CollectionUtils.isNotEmpty(subjectsForObject)) {
for(Subject subject : subjectsForObject) {
subjects.add(new ReadingRoomObjectSubject(id, subject.getId()));
}
}
String shelfMark = StringUtils.trim(rs.getString("ShelfMark"));
if(!"NA".equalsIgnoreCase(shelfMark)) {
readingRoomObject.setShelfMark(shelfMark);
}
readingRoomObject.setCommonName(StringUtils.trim(rs.getString("NickName")));
String folio = StringUtils.trim(rs.getString("Folio"));
if(StringUtils.isNotEmpty(folio) && !"NA".equalsIgnoreCase(folio)) {
Extent extent = new Extent();
extent.setFolioImported(folio);
extent.setReadingRoomObjectId(id);
extents.add(extent);
}
readingRoomObject.setCollation(StringUtils.trim(rs.getString("Collation")));
readingRoomObject.setPhysicalNotes(StringUtils.trim(rs.getString("PhysicalIssues")));
readingRoomObject.setBinding(StringUtils.trim(rs.getString("Binding")));
setBindingDimensions(readingRoomObject, StringUtils.trim(rs.getString("BindingDimensions")));
readingRoomObject.setProvenance(StringUtils.trim(rs.getString("Provenance")));
readingRoomObject.setBibliography(StringUtils.trim(rs.getString("Bibliography")));
readingRoomObject.setNotes(StringUtils.trim(rs.getString("Notes")));
readingRoomObject.setHmmlProjectNumber(StringUtils.trim(rs.getString("Source")));
// both inputter & input date are stored in the InputterDate field,
// we're just putting it all in the inputter field for now, clean up work
// will have to be done by meta data librarian
readingRoomObject.setInputter(StringUtils.trim(rs.getString("InputterDate")));
readingRoomObject.setReproductionNotes(StringUtils.trim(rs.getString("Reproduction")));
readingRoomObject.setAcknowledgments(StringUtils.trim(rs.getString("Acknowledgments")));
readingRoomObject.setCaptureDate(rs.getDate("FacsCapDate"));
String accessRestrictionName = StringUtils.trim(rs.getString("AccessRestriction"));
AccessRestriction accessRestriction = null;
if(StringUtils.isNotEmpty(accessRestrictionName)) {
accessRestriction = AccessRestriction.forDisplayName(accessRestrictionName);
}
readingRoomObject.setAccessRestriction(accessRestriction);
readingRoomObject.setMedium(StringUtils.trim(rs.getString("Medium")));
readingRoomObject.setViewableOnline(rs.getBoolean("Online"));
readingRoomObject.setDownloadOption(StringUtils.trim(rs.getString("Download")));
readingRoomObject.setIconName(StringUtils.trim(rs.getString("IconName")));
readingRoomObject.setCiteAs(StringUtils.trim(rs.getString("CiteAs")));
readingRoomObject.setCurrentStatus(Status.forDisplayName(StringUtils.trim(rs.getString("CurrentStatus"))));
readingRoomObject.setConditionNotes(StringUtils.trim(rs.getString("ConditionNotes")));
readingRoomObject.setSummary(StringUtils.trim(rs.getString("Summary")));
String featureList = StringUtils.trim(rs.getString("features"));
features.addAll(getObjectFeatures(id, featureList));
readingRoomObject.setFeaturesImported(featureList);
String surrogateFormat = StringUtils.trim(rs.getString("SurrogateFormat"));
String holdingInstitution = StringUtils.trim(rs.getString("HoldingInstitution"));
String alternateSurrogate = StringUtils.trim(rs.getString("AlternateSurrogate"));
String genre = StringUtils.trim(rs.getString("GenreForm"));
String externalLinkBibUrl = StringUtils.trim(rs.getString("ExternalLinkBib"));
String externalLinkBibText = StringUtils.trim(rs.getString("ExternalBibText"));
String externalFacsimileUrl = StringUtils.trim(rs.getString("ExternalLinkFacsimile"));
String formerOwnersString = StringUtils.trim(rs.getString("FormerOwner"));
readingRoomObject.setRightToLeft(BooleanUtils.toBoolean(StringUtils.trim(rs.getString("RightToLeft"))));
List<ReadingRoomObjectPart> parts = partsByObjectId.get(id);
StringBuilder foliation = new StringBuilder();
if(CollectionUtils.isNotEmpty(parts)) {
// colophon gets moved from the object level to the part level on import
String colophon = StringUtils.trim(rs.getString("Colophon"));
if(StringUtils.isNotEmpty(colophon)) {
ReadingRoomObjectPart firstPart = parts.get(0);
firstPart.setColophonPart(colophon);
}
for(ReadingRoomObjectPart part : parts) {
// foliation gets moved up from the part level to the object
if(StringUtils.isNotEmpty(part.getFoliationImported())) {
String nextFoliation = part.getFoliationImported().trim();
if(StringUtils.isNotEmpty(nextFoliation)) {
if(foliation.length() > 0) {
foliation.append("; ");
}
foliation.append(nextFoliation);
}
}
ReadingRoomObjectPart.Type partType = ReadingRoomObjectPart.Type.UNKNOWN;
if(recordType == Type.MANUSCRIPT) {
partType = ReadingRoomObjectPart.Type.MANUSCRIPT;
} else if(recordType == Type.PRINT) {
partType = ReadingRoomObjectPart.Type.PRINTED;
}
part.setType(partType);
updatedParts.add(part);
}
}
readingRoomObject.setFoliation(foliation.toString());
formerOwners.addAll(getFormerOwners(rs));
if(StringUtils.isNotEmpty(surrogateFormat)) {
readingRoomObject.setSurrogateFormat(formatRepository.findByName(surrogateFormat));
}
if(StringUtils.isNotEmpty(holdingInstitution)) {
readingRoomObject.setHoldingInstitution(findOrCreateInstitution(holdingInstitution));
}
if(StringUtils.isNotEmpty(alternateSurrogate)) {
altSurrogates.add(new AlternateSurrogate(alternateSurrogate, id));
}
if(StringUtils.isNotEmpty(genre)) {
genres.add(new ReadingRoomObjectGenre(id, findOrCreateGenre(genre, StringUtils.trim(rs.getString("GenreFormURI"))).getId()));
}
if(StringUtils.isNotEmpty(externalLinkBibUrl)) {
bibUrls.add(new BibliographyUrl(id, externalLinkBibUrl, externalLinkBibText));
}
if(StringUtils.isNotEmpty(externalFacsimileUrl)) {
facsimileUrls.add(new FacsimileUrl(id, externalFacsimileUrl));
}
readingRoomObjects.add(readingRoomObject);
}
importResult.setObjectsFromSource(readingRoomObjects.size());
if(CollectionUtils.isNotEmpty(formerOwners)) {
readingRoomService.bulkInsertReadingRoomObjectContributors(formerOwners);
}
if(CollectionUtils.isNotEmpty(extents)) {
readingRoomService.bulkInsertReadingRoomObjectExtents(extents);
}
if(CollectionUtils.isNotEmpty(altSurrogates)) {
readingRoomService.bulkInsertReadingRoomObjectAltSurrogates(altSurrogates);
}
if(CollectionUtils.isNotEmpty(genres)) {
readingRoomService.bulkInsertReadingRoomObjectGenres(genres);
}
if(CollectionUtils.isNotEmpty(subjects)) {
readingRoomService.bulkInsertReadingRoomObjectSubjects(subjects);
}
if(CollectionUtils.isNotEmpty(bibUrls)) {
readingRoomService.bulkInsertReadingRoomObjectBibUrls(bibUrls);
}
if(CollectionUtils.isNotEmpty(facsimileUrls)) {
readingRoomService.bulkInsertReadingRoomObjectFacsimileUrl(facsimileUrls);
}
if(CollectionUtils.isNotEmpty(features)) {
readingRoomService.bulkInsertReadingRoomObjectFeatures(features);
}
if(CollectionUtils.isNotEmpty(archivalDataList)) {
readingRoomService.bulkInsertArchivalData(archivalDataList);
}
if(CollectionUtils.isNotEmpty(archivalContributors)) {
readingRoomService.bulkInsertArchivalContributors(archivalContributors);
}
if(CollectionUtils.isNotEmpty(archivalLanguages)) {
readingRoomService.bulkInsertArchivalLanguages(archivalLanguages);
}
readingRoomService.bulkInsertReadingRoomObjects(readingRoomObjects);
// have to store these in a separate list because we can't update the parts until after we've saved the object
readingRoomPartRepository.save(updatedParts);
return readingRoomObjects;
}
private List<ReadingRoomObjectFeature> getObjectFeatures(Long objectId, String featureList) {
List<ReadingRoomObjectFeature> features = new ArrayList<>();
if(StringUtils.isNotEmpty(featureList)) {
String[] featureNames = featureList.split(";");
if(featureNames != null) {
for(String featureName : featureNames) {
featureName = featureName.trim();
if(StringUtils.isNotEmpty(featureName)) {
Feature feature = featureCache.get(featureName);
if(feature == null) {
feature = featureRepository.findByName(featureName);
if(feature != null) {
featureCache.put(featureName, feature);
}
}
if(feature != null) {
features.add(new ReadingRoomObjectFeature(objectId, feature.getId()));
}
}
}
}
}
return features;
}
private Map<Long, List<ReadingRoomObjectPart>> importReadingRoomObjectParts(ResultSet rs, Import importResult, Map<Long, List<Content>> contentByPart, Map<Long, List<Image>> imagesByContent) throws Exception {
Map<Long, List<ReadingRoomObjectPart>> partsByObjectId = new HashMap<Long, List<ReadingRoomObjectPart>>();
List<ReadingRoomObjectPart> allParts = new ArrayList<>();
List<ReadingRoomPartContributor> partContributors = new ArrayList<>();
while(rs.next()) {
ReadingRoomObjectPart readingRoomObjectPart = new ReadingRoomObjectPart();
Long objectId = rs.getLong("MsID");
Long partId = rs.getLong("MsPtID");
readingRoomObjectPart.setId(partId);
readingRoomObjectPart.setParentObject(new ReadingRoomObject(objectId));
readingRoomObjectPart.setPartNumber(rs.getInt("PartNumber"));
readingRoomObjectPart.setPartLocation(StringUtils.trim(rs.getString("Folio")));
readingRoomObjectPart.setFoliationImported(StringUtils.trim(rs.getString("Foliation")));
String supportDimensions = StringUtils.trim(rs.getString("OuterDimensions"));
readingRoomObjectPart.setSupportDimensionsImported(supportDimensions);
setSupportDimensions(readingRoomObjectPart, supportDimensions);
String writingSpace = StringUtils.trim(rs.getString("WritingSpace"));
readingRoomObjectPart.setWritingSpaceImported(writingSpace);
setWritingSpace(readingRoomObjectPart, writingSpace);
String countryName = StringUtils.trim(rs.getString("Country"));
if(StringUtils.isNotEmpty(countryName)) {
readingRoomObjectPart.setCountryOfOriginUncertain(StringUtils.contains(countryName, "?"));
readingRoomObjectPart.setCountryOfOrigin(StringUtils.remove(countryName, "(?)").trim());
}
String cityName = StringUtils.trim(rs.getString("City"));
if(StringUtils.isNotEmpty(cityName)) {
readingRoomObjectPart.setCityOfOriginUncertain(StringUtils.contains(cityName, "?"));
readingRoomObjectPart.setCityOfOrigin(StringUtils.remove(cityName, "(?)").trim());
}
readingRoomObjectPart.setRegionOfOrigin(StringUtils.trim(rs.getString("Region")));
readingRoomObjectPart.setCardinalOfOrigin(StringUtils.trim(rs.getString("Cardinal")));
String centuryDate = StringUtils.trim(rs.getString("Date"));
if(!"Unknown".equals(centuryDate)) {
readingRoomObjectPart.setCenturyImported(centuryDate);
}
readingRoomObjectPart.setCenturyUncertain(StringUtils.contains(centuryDate, "?"));
readingRoomObjectPart.setLayout(StringUtils.trim(rs.getString("Layout")));
readingRoomObjectPart.setScriptImported(StringUtils.trim(rs.getString("Script")));
readingRoomObjectPart.setNumberScribes(StringUtils.trim(rs.getString("NumberScribes")));
String supportList = StringUtils.trim(rs.getString("Support"));
readingRoomObjectPart.setSupportImported(supportList);
readingRoomObjectPart.setSupport(getValidSupportString(supportList));
readingRoomObjectPart.setArtist(StringUtils.trim(rs.getString("Artist")));
readingRoomObjectPart.setPartNotes(StringUtils.trim(rs.getString("Notes")));
readingRoomObjectPart.setMedium(StringUtils.trim(rs.getString("Medium")));
Integer beginDate = rs.getInt("BeginDate");
Integer endDate = rs.getInt("EndDate");
if(beginDate != 0) {
readingRoomObjectPart.setBeginDate(beginDate);
}
if(endDate != 0) {
readingRoomObjectPart.setEndDate(endDate);
}
readingRoomObjectPart.setSeq(rs.getInt("Seq"));
readingRoomObjectPart.setAcknowledgments(StringUtils.trim(rs.getString("Acknowledgments")));
readingRoomObjectPart.setWritingSystemImported(StringUtils.trim(rs.getString("Alphabet")));
readingRoomObjectPart.setNativeDatePrecise(StringUtils.trim(rs.getString("NativeDate")));
readingRoomObjectPart.setSignatures(rs.getBoolean("Signatures"));
readingRoomObjectPart.setCatchwords(rs.getBoolean("Catchwords"));
String preciseDate = StringUtils.trim(rs.getString("YearMonthDay"));
readingRoomObjectPart.setYmdDateImported(preciseDate);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
if(StringUtils.isNotEmpty(preciseDate)) {
try {
Date date = formatter.parse(preciseDate);
Calendar cal = new GregorianCalendar();
cal.setTime(date);
readingRoomObjectPart.setDatePreciseYear(cal.get(Calendar.YEAR));
readingRoomObjectPart.setDatePreciseMonth(cal.get(Calendar.MONTH));
readingRoomObjectPart.setDatePreciseDay(cal.get(Calendar.DAY_OF_MONTH));
} catch(ParseException e) {
LOG.warn("Unable to parse YearMonthDate from Oliver, imported value will be stored in ymd_date_imported");
}
}
List<String> decorations = new ArrayList<String>();
addNonNullToList(decorations, StringUtils.trim(rs.getString("RepresentationalDecoration")));
addNonNullToList(decorations, StringUtils.trim(rs.getString("OtherDecoration")));
List<Content> contentsForPart = contentByPart.get(partId);
readingRoomObjectPart.setContents(contentsForPart);
if(CollectionUtils.isNotEmpty(contentsForPart)) {
for(Content content : contentsForPart) {
List<Image> images = imagesByContent.get(content.getId());
if(CollectionUtils.isNotEmpty(images)) {
for(Image image : images) {
addNonNullToList(decorations, image.getFolioNumber());
addNonNullToList(decorations, image.getCaption());
}
content.setImages(images);
}
}
}
readingRoomObjectPart.setDecoration(StringUtils.join(decorations, "; "));
String scribesString = StringUtils.trim(rs.getString("Scribe"));
readingRoomObjectPart.setScribe(scribesString);
List<Contributor> scribes = findOrCreateContributor(scribesString, null, null, null);
if(CollectionUtils.isNotEmpty(scribes)) {
for(Contributor scribe : scribes) {
partContributors.add(new ReadingRoomPartContributor(readingRoomObjectPart, scribe, Contributor.Type.SCRIBE, StringUtils.trim(rs.getString("ScribeNS"))));
}
}
List<Contributor> artists = findOrCreateContributor(
StringUtils.trim(rs.getString("Artist")),
StringUtils.trim(rs.getString("ArtistURI_LC")),
StringUtils.trim(rs.getString("ArtistURI_VIAF")),
null);
if(CollectionUtils.isNotEmpty(artists)) {
for(Contributor artist : artists) {
partContributors.add(new ReadingRoomPartContributor(readingRoomObjectPart, artist, Contributor.Type.ARTIST, null));
}
}
List<ReadingRoomObjectPart> partsForObject = partsByObjectId.get(objectId);
if(CollectionUtils.isEmpty(partsForObject)) {
partsForObject = new ArrayList<ReadingRoomObjectPart>();
}
partsForObject.add(readingRoomObjectPart);
partsByObjectId.put(objectId, partsForObject);
allParts.add(readingRoomObjectPart);
}
importResult.setPartsFromSource(allParts.size());
readingRoomService.bulkInsertReadingRoomObjectParts(allParts);
if(CollectionUtils.isNotEmpty(partContributors)) {
readingRoomService.bulkInsertReadingRoomPartContributors(partContributors);
}
return partsByObjectId;
}
private Map<Long, List<Content>> importReadingRoomContent(ResultSet rs, Import importResult) throws Exception {
Map<Long, List<Content>> contentByPartId = new HashMap<>();
List<Content> contents = new ArrayList<>();
List<ContentLanguage> contentLanguages = new ArrayList<>();
List<ContentContributor> contentContributors = new ArrayList<>();
while(rs.next()) {
Content content = new Content();
Long contentId = rs.getLong("EDocID");
Long partId = rs.getLong("MSptID");
List<Content> contentForPart = contentByPartId.get(partId);
if(contentForPart == null) {
contentForPart = new ArrayList<Content>();
}
content.setId(contentId);
content.setParentPart(new ReadingRoomObjectPart(partId));
content.setItemLocation(StringUtils.trim(rs.getString("Folio")));
content.setTitleInMs(StringUtils.trim(rs.getString("Title")));
List<String> alternateTitles = new ArrayList<>();
String altTitleString = StringUtils.trim(rs.getString("AlternateTitle"));
if(altTitleString != null) {
String[] altTitles = altTitleString.split(";");
for(String altTitle : altTitles) {
alternateTitles.add(altTitle.trim());
}
}
content.setAlternateTitles(alternateTitles);
content.setProvisionalTitle(StringUtils.trim(rs.getString("SuppliedTitle")));
content.setTitleNs(StringUtils.trim(rs.getString("SuppliedTitleNS")));
content.setUniformTitle(
findOrCreateUniformTitle(
StringUtils.trim(rs.getString("UniformTitle")),
StringUtils.trim(rs.getString("UniformTitleURI_LC")),
StringUtils.trim(rs.getString("UniformTitleURI_VIAF"))));
content.setItemCondition(StringUtils.trim(rs.getString("StatusOfText")));
content.setRubric(StringUtils.trim(rs.getString("Rubric")));
String incipit = StringUtils.trim(rs.getString("Incipit"));
incipit = StringUtils.isNotEmpty(incipit) ? incipit : StringUtils.trim(rs.getString("IncipitNS"));
content.setIncipit(incipit);
String explicit = StringUtils.trim(rs.getString("Explicit"));
explicit = StringUtils.isNotEmpty(explicit) ? explicit : StringUtils.trim(rs.getString("ExplicitNS"));
content.setExplicit(explicit);
content.setItemNotes(StringUtils.trim(rs.getString("NotesToText")));
content.setRevisit(rs.getBoolean("Revisit"));
content.setItemNumber(rs.getInt("ItemNumber"));
content.setAcknowledgments(StringUtils.trim(rs.getString("Acknowledgments")));
content.setCatalogerTags(StringUtils.trim(rs.getString("Subject")));
content.setTextBibliography(StringUtils.trim(rs.getString("TextBibliography")));
List<Contributor> authors = findOrCreateContributor(
StringUtils.trim(rs.getString("Author")),
StringUtils.trim(rs.getString("AuthorURI_LC")),
StringUtils.trim(rs.getString("AuthorURI_VIAF")),
StringUtils.trim(rs.getString("AuthorDisplay")));
if(CollectionUtils.isNotEmpty(authors)) {
for(Contributor author : authors) {
contentContributors.add(new ContentContributor(content, author, Contributor.Type.AUTHOR, StringUtils.trim(rs.getString("AuthorNS"))));
}
}
List<Contributor> otherContributors = findOrCreateContributor(
StringUtils.trim(rs.getString("AssociatedName")),
StringUtils.trim(rs.getString("AssociatedNameURI_LC")),
StringUtils.trim(rs.getString("AssociatedNameURI_VIAF")),
StringUtils.trim(rs.getString("AssociatedNameDisplay")));
if(CollectionUtils.isNotEmpty(otherContributors)) {
for(Contributor contributor : otherContributors) {
contentContributors.add(new ContentContributor(content, contributor, Contributor.Type.OTHER, null));
}
}
List<Language> languages = findOrCreateLanguage(StringUtils.trim(rs.getString("Language(s)")));
if(CollectionUtils.isNotEmpty(languages)) {
for(Language language : languages) {
contentLanguages.add(new ContentLanguage(contentId, language.getId()));
}
content.setLanguages(languages);
}
contents.add(content);
contentForPart.add(content);
contentByPartId.put(partId, contentForPart);
}
importResult.setContentsFromSource(contents.size());
readingRoomService.bulkInsertReadingRoomContent(contents);
readingRoomService.bulkInsertReadingRoomContentLanguages(contentLanguages);
readingRoomService.bulkInsertReadingRoomContentContributors(contentContributors);
return contentByPartId;
}
private Map<Long, List<Image>> importReadingRoomImages(ResultSet rs, Import importResult) throws Exception {
Map<Long, List<Image>> imagesByContentId = new HashMap<>();
List<Image> images = new ArrayList<>();
while(rs.next()) {
Image image = new Image();
image.setId(rs.getLong("LinkID"));
Long contentId = rs.getLong("EDocID");
List<Image> imagesForContent = imagesByContentId.get(contentId);
if(imagesForContent == null) {
imagesForContent = new ArrayList<Image>();
}
image.setParentContent(new Content(contentId));
image.setImgId(rs.getInt("EDocID"));
image.setFolioNumber(StringUtils.trim(rs.getString("FolioNumber")));
image.setCaption(StringUtils.trim(rs.getString("Caption")));
image.setNotesToPhotographer(StringUtils.trim(rs.getString("NotesToPhotographer")));
image.setIconClass(StringUtils.trim(rs.getString("Iconclass")));
image.setRevisit(rs.getBoolean("Revisit"));
image.setSeq(rs.getInt("Seq"));
images.add(image);
imagesForContent.add(image);
imagesByContentId.put(contentId, imagesForContent);
}
importResult.setImagesFromSource(images.size());
readingRoomService.bulkInsertReadingRoomImage(images);
return imagesByContentId;
}
private Country findOrCreateCountry(String countryName, String authUriLc, String authUriViaf, String nameIso3166) {
Country country = null;
if(StringUtils.isNotEmpty(countryName)) {
// names have question marks in parenthesis to indicate if country is unknown, remove them
countryName = StringUtils.remove(countryName, "(?)").trim();
country = countryCache.get(countryName);
if(country == null && StringUtils.isNotEmpty(countryName)) {
country = countryRepository.findByName(countryName);
if(country == null) {
country = countryRepository.save(new Country(countryName, authUriLc, authUriViaf));
}
countryCache.put(countryName, country);
}
}
return country;
}
private City findOrCreateCity(Long countryId, String cityName, String authUriLc, String authUriViaf) {
City city = null;
if(StringUtils.isNotEmpty(cityName)) {
cityName = StringUtils.remove(cityName, "(?)").trim();
City newCity = new City(cityName, authUriLc, authUriViaf, countryId);
city = cityCache.get(newCity);
if(city == null) {
city = cityRepository.findByNameAndCountryId(cityName, countryId);
if(city == null) {
city = cityRepository.save(newCity);
}
cityCache.put(city, city);
}
}
return city;
}
private Repository findOrCreateRepo(Long cityId, String repoName, String authUriLc, String authUriViaf) {
Repository repo = null;
if(StringUtils.isNotEmpty(repoName)) {
repoName = repoName.trim();
Repository newRepo = new Repository(repoName, authUriLc, authUriViaf,cityId);
repo = repoCache.get(newRepo);
if(repo == null) {
repo = repoRepository.findByNameAndCityId(repoName, cityId);
if(repo == null) {
repo = repoRepository.save(newRepo);
}
repoCache.put(repo, repo);
}
}
return repo;
}
private List<Language> findOrCreateLanguage(String languageNamesString) {
List<Language> languages = new ArrayList<Language>();
if(StringUtils.isNotEmpty(languageNamesString)) {
String[] languageNames = languageNamesString.split(";");
for(String languageName : languageNames) {
languageName = languageName.trim();
Language language = languageCache.get(languageName);
if(language == null && StringUtils.isNotEmpty(languageName)) {
language = languageRepository.findByName(languageName);
if(language == null) {
language = languageRepository.save(new Language(languageName));
}
languageCache.put(languageName, language);
}
languages.add(language);
}
}
return languages;
}
private List<WritingSystem> findOrCreateWritingSystem(String writingSystemString) {
List<WritingSystem> writingSystems = new ArrayList<WritingSystem>();
if(StringUtils.isNotEmpty(writingSystemString)) {
String[] writingSystemNames = writingSystemString.split(";");
for(String writingSystemName : writingSystemNames) {
writingSystemName = writingSystemName.trim();
WritingSystem writingSystem = writingSystemCache.get(writingSystemName);
if(writingSystem == null && StringUtils.isNotEmpty(writingSystemName)) {
writingSystem = writingSystemRepository.findByName(writingSystemName);
if(writingSystem == null) {
writingSystem = writingSystemRepository.save(new WritingSystem(writingSystemName));
}
writingSystemCache.put(writingSystemName, writingSystem);
}
writingSystems.add(writingSystem);
}
}
return writingSystems;
}
private List<Contributor> findOrCreateContributor(String contributorNamesString, String authorityUriLC, String authorityUriVIAF, String displayName) throws IOException {
List<Contributor> contributors = new ArrayList<Contributor>();
if(StringUtils.isNoneEmpty(contributorNamesString)) {
String[] contributorNames = contributorNamesString.split(";");
for(String contributorName : contributorNames) {
contributorName = contributorName.trim();
Contributor contributor = contributorCache.get(contributorName);
if(contributor == null && StringUtils.isNotEmpty(contributorName)) {
contributor = contributorRepository.findByName(contributorName);
if(contributor == null) {
contributor = contributorRepository.save(new Contributor(contributorName, authorityUriLC, authorityUriVIAF, displayName));
elasticSearchService.updateIndexedObject(IndexedType.READING_ROOM_CONTRIBUTOR, contributor.getId().toString(), objectMapper.writeValueAsString(contributor));
}
contributorCache.put(contributorName, contributor);
}
contributors.add(contributor);
}
}
return contributors;
}
private Genre findOrCreateGenre(String genreName, String uri) {
Genre genre = null;
if(StringUtils.isNotEmpty(genreName)) {
genreName = genreName.trim();
genre = genreCache.get(genreName);
if(genre == null && StringUtils.isNotEmpty(genreName)) {
genre = genreRepository.findByName(genreName);
if(genre == null) {
Genre newGenre = new Genre(genreName);
newGenre.setUri(uri);
genre = genreRepository.save(newGenre);
}
genreCache.put(genreName, genre);
}
}
return genre;
}
private Institution findOrCreateInstitution(String institutionName) {
Institution institution = null;
if(StringUtils.isNotEmpty(institutionName)) {
institutionName = institutionName.trim();
institution = institutionCache.get(institutionName);
if(institution == null && StringUtils.isNotEmpty(institutionName)) {
institution = institutionRepository.findByName(institutionName);
if(institution == null) {
institution = institutionRepository.save(new Institution(institutionName));
}
institutionCache.put(institutionName, institution);
}
}
return institution;
}
private UniformTitle findOrCreateUniformTitle(String name, String authorityUriLC, String authorityUriVIAF) {
UniformTitle uniformTitle = null;
if(StringUtils.isNotEmpty(name)) {
name = name.trim();
uniformTitle = uniformTitleCache.get(name);
if(uniformTitle == null && StringUtils.isNotEmpty(name)) {
uniformTitle = uniformTitleRepository.findByName(name);
if(uniformTitle == null) {
UniformTitle newUniformTitle = new UniformTitle(name, authorityUriLC, authorityUriVIAF);
uniformTitle = uniformTitleRepository.save(newUniformTitle);
}
uniformTitleCache.put(name, uniformTitle);
}
}
return uniformTitle;
}
private List<Subject> findOrCreateSubject(String namesString, String authorityUriLC, String authorityUriVIAF) {
List<Subject> subjects = new ArrayList<>();
if(StringUtils.isNotEmpty(namesString)) {
String[] names = namesString.split(";");
for(String name : names) {
name = name.trim();
Subject subject = subjectCache.get(name);
if(subject == null && StringUtils.isNotEmpty(name)) {
subject = subjectRepository.findByName(name);
if(subject == null) {
Subject newSubject = new Subject(name, authorityUriLC, authorityUriVIAF);
subject = subjectRepository.save(newSubject);
}
subjectCache.put(name, subject);
}
subjects.add(subject);
}
}
return subjects;
}
private void setWritingSpace(ReadingRoomObjectPart part, String writingSpaceString) {
if(StringUtils.isNotEmpty(writingSpaceString)) {
writingSpaceString = writingSpaceString.trim();
part.setWritingSpaceImported(writingSpaceString);
Map<String, Float> dimensions = getDimensions(writingSpaceString);
part.setWritingSpaceHeight(dimensions.get("height"));
part.setWritingSpaceWidth(dimensions.get("width"));
}
}
private void setSupportDimensions(ReadingRoomObjectPart part, String supportDimensionsString) {
if(StringUtils.isNotEmpty(supportDimensionsString)) {
supportDimensionsString = supportDimensionsString.trim();
part.setSupportDimensionsImported(supportDimensionsString);
Map<String, Float> dimensions = getDimensions(supportDimensionsString);
part.setSupportDimensionsHeight(dimensions.get("height"));
part.setSupportDimensionsWidth(dimensions.get("width"));
}
}
private void setBindingDimensions(ReadingRoomObject object, String bindingDimensionsString) {
if(StringUtils.isNotEmpty(bindingDimensionsString)) {
bindingDimensionsString = bindingDimensionsString.trim();
object.setBindingDimensionsImported(bindingDimensionsString);
Map<String, Float> dimensions = getDimensions(bindingDimensionsString);
object.setBindingHeight(dimensions.get("height"));
object.setBindingWidth(dimensions.get("width"));
object.setBindingDepth(dimensions.get("depth"));
}
}
private Map<String, Float> getDimensions(String dimensionsString) {
Map<String, Float> dimensions = new HashMap<>();
if(StringUtils.isNotEmpty(dimensionsString)) {
dimensionsString = dimensionsString.trim();
dimensionsString = StringUtils.removeEnd(dimensionsString, "cm");
dimensionsString = StringUtils.removeEnd(dimensionsString, "cm."); // sometimes the catalogers put a period on the end
String[] dimensionList = dimensionsString.split("[Xx×]"); // various forms of x are used by the catalogers, this regex says "any one of these"
for(int i = 0; i < dimensionList.length; i++) {
String dimension = dimensionList[i].trim();
if(NumberUtils.isNumber(dimension)) {
if(i == 0) {
dimensions.put("height", Float.parseFloat(dimension));
} else if(i == 1) {
dimensions.put("width", Float.parseFloat(dimension));
} else {
dimensions.put("depth", Float.parseFloat(dimension));
}
}
}
}
return dimensions;
}
private String getValidSupportString(String supportString) {
String validSupportString = null;
if(StringUtils.isNotEmpty(supportString)) {
String[] supportList = supportString.split(";");
List<String> validSupports = new ArrayList<>();
for(String support : supportList) {
try {
Support validSupport = Support.forName(support.trim());
if(validSupport != null) {
validSupports.add(validSupport.name());
}
} catch(IllegalArgumentException e) {
LOG.warn("Invalid support name on import", e);
}
}
if(CollectionUtils.isNotEmpty(validSupports)) {
validSupportString = AttributeUtil.getListAttributeAsString(validSupports);
}
}
return validSupportString;
}
private void addNonNullToList(List<String> list, String value) {
if(StringUtils.isNoneEmpty(value)) {
list.add(value);
}
}
private void clearCache() {
countryCache = new HashMap<String, Country>();
cityCache = new HashMap<City, City>();
repoCache = new HashMap<Repository, Repository>();
languageCache = new HashMap<String, Language>();
contributorCache = new HashMap<String, Contributor>();
genreCache = new HashMap<String, Genre>();
institutionCache = new HashMap<String, Institution>();
uniformTitleCache = new HashMap<String, UniformTitle>();
featureCache = new HashMap<String, Feature>();
subjectCache = new HashMap<String, Subject>();
}
private ArchivalData getArchivalData(ResultSet rs) throws SQLException, IOException {
Long id = rs.getLong("MsID");
ArchivalData archivalData = new ArchivalData(id);
ArchivalObject parentObject = new ArchivalObject(id);
archivalData.setParentObject(parentObject);
archivalData.setCollectionFond(StringUtils.trim(rs.getString("ArcCollectionFond")));
archivalData.setSeries(StringUtils.trim(rs.getString("ArcArchivalSeries")));
archivalData.setSubSeries(StringUtils.trim(rs.getString("ArcArchivalSubseries")));
archivalData.setSubSubSeries(StringUtils.trim(rs.getString("ArcArchivalSubsubseries")));
archivalData.setContainerCount(rs.getInt("ArcContainer"));
archivalData.setContainerType(StringUtils.trim(rs.getString("ArcContainerType")));
archivalData.setCreator(StringUtils.trim(rs.getString("ArcCreator")));
archivalData.setTitle(StringUtils.trim(rs.getString("ArcTitle")));
archivalData.setScopeContent(StringUtils.trim(rs.getString("ArcScopeContent")));
archivalData.setHistoricalNote(StringUtils.trim(rs.getString("ArcHistoricalNotes")));
archivalData.setCustodialHistory(StringUtils.trim(rs.getString("ArcCustodialHistory")));
archivalData.setCenturyImported(StringUtils.trim(rs.getString("ArcDateCentury")));
archivalData.setNativeDate(StringUtils.trim(rs.getString("ArcNativeDate")));
archivalData.setDecoration(StringUtils.trim(rs.getString("DecorationIllustration")));
String yearString = StringUtils.trim(rs.getString("ArcYear"));
String monthString = StringUtils.trim(rs.getString("ArcMonth"));
String dayString = StringUtils.trim(rs.getString("ArcDay"));
String beginDateString = StringUtils.trim(rs.getString("ArcBeginDate"));
String endDateString = StringUtils.trim(rs.getString("ArcEndDate"));
if(StringUtils.isNotEmpty(yearString)) {
archivalData.setDatePreciseYear(Integer.valueOf(yearString));
}
if(StringUtils.isNotEmpty(monthString)) {
archivalData.setDatePreciseMonth(Integer.valueOf(monthString) - 1);
}
if(StringUtils.isNotEmpty(dayString)) {
archivalData.setDatePreciseDay(Integer.valueOf(dayString));
}
if(StringUtils.isNotEmpty(beginDateString)) {
archivalData.setBeginDate(Integer.valueOf(beginDateString));
}
if(StringUtils.isNotEmpty(endDateString)) {
archivalData.setEndDate(Integer.valueOf(endDateString));
}
archivalData.setSupport(getSupport(rs));
String writingSystemString = StringUtils.trim(rs.getString("ArcWritingSystem"));
// writing systems are store in writing system table because catalogers can add new ones
if(StringUtils.isNotEmpty(writingSystemString)) {
findOrCreateWritingSystem(writingSystemString);
archivalData.setWritingSystem(writingSystemString.replaceAll(";", ","));
}
return archivalData;
}
private String getSupport(ResultSet rs) throws SQLException {
StringBuilder enumString = new StringBuilder();
String supportString = StringUtils.trim(rs.getString("ArcSupport"));
if(StringUtils.isNotEmpty(supportString)) {
// we store the list of supports comma delimited but they might be semi colon delimited coming from Oliver
List<String> supports = AttributeUtil.getStringAttributeAsList(supportString.replaceAll(";", ","));
// need to convert display names used in Oliver to typed enum values
for(int i = 0; i < supports.size(); i++) {
if(i > 0) {
enumString.append(", ");
}
enumString.append(Support.forName(supports.get(i)));
}
}
return enumString.toString();
}
private List<ReadingRoomObjectContributor> getFormerOwners(ResultSet rs) throws SQLException, IOException {
List<ReadingRoomObjectContributor> formerOwners = new ArrayList<>();
String formerOwnerName = rs.getString("FormerOwner");
if(StringUtils.isNotEmpty(formerOwnerName)) {
List<Contributor> contributors = findOrCreateContributor(formerOwnerName, null, null, null);
Long id = rs.getLong("MsID");
for(int i = 0; i < contributors.size(); i++) {
ReadingRoomObject parentObject = new ReadingRoomObject(id);
ReadingRoomObjectContributor objectContributor = new ReadingRoomObjectContributor();
objectContributor.setContributor(contributors.get(i));
objectContributor.setReadingRoomObject(parentObject);
objectContributor.setType(Contributor.Type.FORMER_OWNER);
formerOwners.add(objectContributor);
}
}
return formerOwners;
}
private List<ArchivalContributor> getArchivalContributors(ResultSet rs) throws SQLException, IOException {
List<ArchivalContributor> archivalContributors = new ArrayList<>();
Long id = rs.getLong("MsID");
ArchivalData parentArchivalData = new ArchivalData(id);
List<Contributor> contributors = findOrCreateContributor(
StringUtils.trim(rs.getString("ArcAssociatedName")),
StringUtils.trim(rs.getString("AssociatedNamesURI_LC")),
StringUtils.trim(rs.getString("AssociatedNamesURI_VIAF")),
StringUtils.trim(rs.getString("ArcAssociatedNameDisplay")));
String associatedNameType = rs.getString("ArcAssociatedNameValue");
String associatedNameNs = rs.getString("ArcAssociatedNameNS");
String[] associatedNameTypes = StringUtils.isNotEmpty(associatedNameType) ? StringUtils.trim(associatedNameType).split(";") : new String[] {Contributor.Type.OTHER.getDisplayName()};
String[] associatedNamesNs = StringUtils.isNotEmpty(associatedNameNs) ? StringUtils.trim(associatedNameNs).split(";") : new String[] {""};
for(int i = 0; i < contributors.size(); i++) {
String contributorType = associatedNameTypes.length == contributors.size() ? associatedNameTypes[i] : associatedNameTypes[0];
String nameNs = associatedNamesNs.length == contributors.size() ? associatedNamesNs[i] : associatedNamesNs[0];
ArchivalContributor archivalContributor = new ArchivalContributor();
archivalContributor.setContributor(contributors.get(i));
archivalContributor.setNameNs(nameNs);
archivalContributor.setParentArchivalData(parentArchivalData);
try {
Contributor.Type type = Contributor.Type.forDisplayName(contributorType);
archivalContributor.setType(type);
} catch(IllegalArgumentException e) {
LOG.error("Invalid contributor type on archival record being imported with id " + id + ", default contributor type of \"Other\" will be used.", e);
archivalContributor.setType(Contributor.Type.OTHER);
}
archivalContributors.add(archivalContributor);
}
return archivalContributors;
}
private List<ArchivalDataLanguage> getArchivalDataLanguages(ResultSet rs) throws SQLException {
Long id = rs.getLong("MsID");
List<ArchivalDataLanguage> archivalDataLanguages = new ArrayList<>();
List<Language> languages = findOrCreateLanguage(StringUtils.trim(rs.getString("ArcLanguage")));
if(CollectionUtils.isNotEmpty(languages)) {
for(Language language : languages) {
archivalDataLanguages.add(new ArchivalDataLanguage(id, language.getId()));
}
}
return archivalDataLanguages;
}
}
| [
"herman_schmigitz@yahoo.com"
] | herman_schmigitz@yahoo.com |
cec3f1b2dc18aad873280e8c538d8be3925f8303 | 1d32aa38e4e0e0c93fbb0cc259bc3ab3b1385afc | /app/src/main/java/com/bigpumpkin/app/ddng_android/bean/AdoptAdapter.java | d3c355596679e69e8b2f75faeda47127914cfa38 | [] | no_license | GuYou957641694/ddng_android | 196df72fde36a64108a3cbb6fe980a3a256f1d86 | 70ff91b03001db3c3a69d63ab86a89ade013115c | refs/heads/master | 2020-07-11T16:07:17.255963 | 2019-12-12T03:01:59 | 2019-12-12T03:01:59 | 204,591,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,436 | java | package com.bigpumpkin.app.ddng_android.bean;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.bigpumpkin.app.ddng_android.R;
import java.util.List;
public class AdoptAdapter extends RecyclerView.Adapter<AdoptAdapter.MyViewHolder> {
private Context context;
List<String> list;
public AdoptAdapter(Context context, List<String> list) {
this.context = context;
this.list = list;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
//获取相应的布局
View view = LayoutInflater.from(context).inflate(R.layout.adopt_item, viewGroup, false);
final MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
myViewHolder.tv_name.setText(list.get(i));
}
@Override
public int getItemCount() {
return list.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
private TextView tv_name;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
tv_name = itemView.findViewById(R.id.tv_name);
}
}
}
| [
"j957641694@163.com"
] | j957641694@163.com |
afb61ad7e627d788d02e7c3bde32eaa0aede47f3 | 2030feff14fe2fcf344f9fb36e48663bff2ef2a2 | /MyApplication/app/src/main/java/com/example/hojunson/myapplication/MainActivity.java | e2c911250189827a2619478a1f30054a89e5134d | [] | no_license | hojunson/GogoR7 | 9959c0a8be751578e38d3e2fa3c0f0e0fd49d20b | a34a707a50ea463a664f9576ef64e3bed8ce9148 | refs/heads/master | 2021-01-20T07:53:32.055820 | 2017-05-02T17:21:34 | 2017-05-02T17:21:34 | 90,058,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,792 | java | package com.example.hojunson.myapplication;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"hojunson@umich.edu"
] | hojunson@umich.edu |
61c332bbc764bcb060b84b4de426b904f625a22c | 5fce6045dc17b3d700bf5b11f34bdb3b0415386f | /src/main/java/com/camunda/demo/springboot/adapter/LoggerDelegate.java | 414f0919af9dc42e2b84ca3961af43e078f26eab | [] | no_license | dorababu5757/Camunda_Demo | bb9b09b7e3462b40a59ef5f0c6c1ff1d1b2348c3 | cffbb1bbc4ecaf234c8e71447251e3d4f6015f8b | refs/heads/master | 2020-05-30T07:43:18.590945 | 2019-05-31T14:18:55 | 2019-05-31T14:18:55 | 189,604,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 721 | java | package com.camunda.demo.springboot.adapter;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Component;
@Component
public class LoggerDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
System.out.println("************Failed Weather******" + execution.getActivityInstanceId());
System.out.println("***********Process Id*****" + execution.getProcessDefinitionId());
System.out.println("*********Activity Name*********" + execution.getCurrentActivityName());
System.out.println("*********************************************************************");
}
}
| [
"pakkurthi.dorababu@1rivet.local"
] | pakkurthi.dorababu@1rivet.local |
3fb7d8d2dccf70c62ce1903fb65f1a46398a7663 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project468/src/test/java/org/gradle/test/performance/largejavamultiproject/project468/p2343/Test46876.java | 7f4f7b3bf89bbc47c19d765e6852c061520972c7 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | package org.gradle.test.performance.largejavamultiproject.project468.p2343;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test46876 {
Production46876 objectUnderTest = new Production46876();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
47ced3ca13fcbdb7552521bc4d6fd6c5470e0e99 | 5a766d1c5168be62773643ab35cfd53b0f9ce2b9 | /Hoan/Animal/app/src/main/java/com/example/animal/PrefManager.java | b7fdb03ac35d8bf3b0d35b0af19aa3f15ef8c148 | [] | no_license | VRARGroup/researchVRAR | 603591c144dc16d1d66bed62b790bc68bc31e78a | ee9777fb8eefb582176ab4f8797822642b045b92 | refs/heads/master | 2020-08-28T23:10:16.474761 | 2019-12-29T09:29:15 | 2019-12-29T09:29:15 | 217,849,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 896 | java | package com.example.animal;
import android.content.Context;
import android.content.SharedPreferences;
public class PrefManager {
SharedPreferences pref;
SharedPreferences.Editor editor;
Context _context;
// shared pref mode
int PRIVATE_MODE = 0;
// Shared preferences file name
private static final String PREF_NAME = "androidhive-welcome";
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
public PrefManager(Context context) {
this._context = context;
pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
editor = pref.edit();
}
public void setFirstTimeLaunch(boolean isFirstTime) {
editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime);
editor.commit();
}
public boolean isFirstTimeLaunch() {
return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true);
}
}
| [
"49841280+vinh123nguyen@users.noreply.github.com"
] | 49841280+vinh123nguyen@users.noreply.github.com |
4340286d39864c53d003c916a72e1413a4d60961 | 766b6f271fea863991d9897eb4869b16c0cdccfb | /Decorator_Pattern/src/TypePC/Laptop.java | 570740b1d90c223ea6c5c4756126c5f46b920bf3 | [] | no_license | VadimBir/Decorator_Patterns | b68273664a3b32a4859debdaec82f631f848100f | 950cc09410c1b922067ce3cfd9ce40a72f0e6b4c | refs/heads/master | 2022-12-09T14:00:34.610743 | 2020-09-05T01:02:02 | 2020-09-05T01:02:02 | 292,690,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package TypePC;
public class Laptop implements TypePC{
public void NameTypePC()
{
System.out.print("\n Type of computer: Laptop");
}
} | [
"vasumrus@gmail.com"
] | vasumrus@gmail.com |
68b42af35f060f076cbe7baa208d327c74aafdf1 | bf812baa4cfd31d22d74ac7ec1a324641a991ede | /kadry/src/main/java/pl/gov/crd/xml/schematy/dziedzinowe/mf/_2020/_07/_06/ed/pitr/ObjectFactory.java | 36374010f3ba27771129ff52079867a40fe88255 | [] | no_license | brzaskun/NetBeansProjects | f5d0abc95a29681fab87e6a039a7f925edab3dc6 | aa67838735901cc9171c49600348eaea8e35e523 | refs/heads/masterpozmianach | 2023-08-31T23:32:37.748389 | 2023-08-30T21:30:09 | 2023-08-30T21:30:09 | 40,359,654 | 0 | 0 | null | 2023-03-27T22:22:00 | 2015-08-07T12:35:43 | Java | UTF-8 | Java | false | false | 2,225 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2021.10.23 at 05:41:27 PM CEST
//
package pl.gov.crd.xml.schematy.dziedzinowe.mf._2020._07._06.ed.pitr;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the pl.gov.crd.xml.schematy.dziedzinowe.mf._2020._07._06.ed.pitr package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.gov.crd.xml.schematy.dziedzinowe.mf._2020._07._06.ed.pitr
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ZalacznikPITR }
*
*/
public ZalacznikPITR createZalacznikPITR() {
return new ZalacznikPITR();
}
/**
* Create an instance of {@link TNaglowekPITR }
*
*/
public TNaglowekPITR createTNaglowekPITR() {
return new TNaglowekPITR();
}
/**
* Create an instance of {@link ZalacznikPITR.PozycjeSzczegolowe }
*
*/
public ZalacznikPITR.PozycjeSzczegolowe createZalacznikPITRPozycjeSzczegolowe() {
return new ZalacznikPITR.PozycjeSzczegolowe();
}
/**
* Create an instance of {@link TNaglowekPITR.KodFormularza }
*
*/
public TNaglowekPITR.KodFormularza createTNaglowekPITRKodFormularza() {
return new TNaglowekPITR.KodFormularza();
}
}
| [
"Osito@DESKTOP-DVFG0DI"
] | Osito@DESKTOP-DVFG0DI |
39c537d4aa28375d4f03307dbe8440dee453101a | 0a4464334ee2c6c131430020740ca77d80d992e0 | /src/BienesMuebles/registro/autobus/AutobusRegistro.java | bcad464ff3db8ee15efe2507bce03631a4945f24 | [] | no_license | Esauceda/PII_2021_1_P2_PROYECTO2 | 7afe3b6118e4faac6ddf81582996bb7af15bd208 | 386c495c7d52f4ef34b4e3bcf5924142aa9ec2ef | refs/heads/master | 2023-03-27T13:24:34.635632 | 2021-03-27T23:31:01 | 2021-03-27T23:31:01 | 352,006,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,451 | java | package BienesMuebles.registro.autobus;
import BienesMuebles.datos.autobus.AutobusesDatos;
import BienesMuebles.recursos.clases.Autobus;
import java.util.ArrayList;
import java.util.List;
public class AutobusRegistro {
public List<Autobus> Leer(){
List<Autobus> listaAutobuses = new ArrayList<>();
try{
listaAutobuses = AutobusesDatos.LeerAutobuses();
}catch (Exception e){
}
return listaAutobuses;
//-----
}
public String Insertar(Autobus autobus1){
String respuesta = "Error";
try {
if (autobus1.getPlaca().isEmpty() ){
throw new Exception("Error: La placa no puede estar vacia");
}
if (autobus1.getPlaca().length() > 7){
throw new Exception("Error: La placa no puede tener mas de 7 digitos");
}
if (autobus1.getColor().isEmpty()){
throw new Exception("Error: El color no puede estar vacio");
}
if (autobus1.getNumeroAsientos() <= 6 || autobus1.getNumeroAsientos() > 30){
throw new Exception("Error: Numero de asientos no valido para un autobus");
}
/*if (String.valueOf(autobus1.getNumeroAsientos()).isEmpty()){
throw new Exception("Error: Numero de asientos no puede estar vacio");
}*/
if (autobus1.getNumeroDeSerieMotor().isEmpty()){
throw new Exception("Error: Es obligatorio el numero de serie del motor");
}
if (autobus1.getNombrePropietario().isEmpty()){
throw new Exception("Error: El nombre del propietario esta vacio");
}
respuesta = AutobusesDatos.InsertarAutobus(autobus1);
if (respuesta == null){
respuesta = "Guardado Exitosamente";
}
}catch (Exception e){
respuesta = e.getMessage();
}
return respuesta;
//-----
}
public String Actualizar(Autobus autobus1){
String respuesta = "Error";
try {
if (autobus1.getPlaca().isEmpty()){
throw new Exception("Error: No puede actualizar la palca a un valor vacio");
}
if (autobus1.getPlaca().length() > 7){
throw new Exception("Error: La placa no puede tener mas de 7 digitos");
}
if (autobus1.getNumeroAsientos() <= 6 || autobus1.getNumeroAsientos() > 30 ){
throw new Exception("Error: Numero de asientos no valido");
}
if (autobus1.getColor().isEmpty()){
throw new Exception("Error: El color esta vacio, no se puede actulizar");
}
if (autobus1.getNumeroDeSerieMotor().isEmpty()){
throw new Exception("Error: No se puede cambiar el numero de serie del motor");
}
if (autobus1.getNombrePropietario().isEmpty()){
throw new Exception("Error: No se puede actualizar el nombre del propietario esta vacio");
}
respuesta = AutobusesDatos.ActualizarAutobus(autobus1);
if (respuesta == null){
respuesta = "Actualizado Exitosamente";
}
}catch (Exception e){
respuesta = e.getMessage();
}
return respuesta;
//-----
}
public String Eliminar(Autobus autobus1){
String respuesta = "Error";
try {
if (autobus1.getNumeroDeSerieMotor().isEmpty()){
throw new Exception("Error: no se puedo eliminar del registro, el numero de serie de motor esta vacio");
}
respuesta = AutobusesDatos.EliminarAutobus(autobus1);
if (respuesta == null){
respuesta = "Eliminado Exitosamente";
}
}catch (Exception e){
respuesta = e.getMessage();
}
return respuesta;
//-----
}
public List<Autobus> Buscar(Autobus autobus1) throws Exception{
List<Autobus> listaAutobuses = new ArrayList<>();
try {
listaAutobuses = AutobusesDatos.BuscarAutobus(autobus1);
}catch (Exception e){
throw new Exception(e.getMessage());
}
return listaAutobuses;
}
//------------------------------------------------------------------------------------------------------------------
}
| [
"saucedaedu15@gmail.com"
] | saucedaedu15@gmail.com |
e71be99937bd007584d912d0d09a6825c71c4f34 | 2d1e76d3f59996205082f4d623b954d38e9b8cd1 | /Attacks/Peck.java | f80b7e664ccb73152e5edb5f9f17790e840796c3 | [] | no_license | cthomp18/Pokemon | f54312fbbd763fb3f489e119be129e685ef70846 | 12b250d940e2d89f8f9617f32b196b35d935f8d2 | refs/heads/master | 2016-09-05T13:43:01.108298 | 2014-12-07T00:23:47 | 2014-12-07T00:23:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | public class Peck extends Attack
{
public Peck()
{
//Attack(name, base, type, baseAccuracy);
super("Peck", 60.0, new PokeType("Flying"), 1.0);
}
}
| [
"rocker5893@yahoo.com"
] | rocker5893@yahoo.com |
bce85cd18ac6df21ac2d40b9df3a56e0c22ed43b | 2ee2e93868292e08143eaa2c6a94a6ff502d8345 | /src/com/dotuian/dp/templatemethod/HtmlEncoder.java | 768600bb994a1449aae20d4b8f1ffcdb68a77338 | [] | no_license | dotuian/JavaDesignPatterns | 0b3c3df21af79b0b895f3c38b028c97869851fa4 | 127c965ada9d1385b471834d07f5b705096db851 | refs/heads/master | 2020-12-24T20:43:06.215444 | 2016-06-01T07:02:24 | 2016-06-01T07:02:24 | 57,189,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 709 | java | package com.dotuian.dp.templatemethod;
public class HtmlEncoder extends Encoder {
private static String ALPHAS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static String NUMBERICS = "0123456789";
public HtmlEncoder() {
this.addNoConversion(ALPHAS.toCharArray());
this.addNoConversion(ALPHAS.toLowerCase().toCharArray());
this.addNoConversion(NUMBERICS.toCharArray());
this.addConversion('>', ">");
this.addConversion('<', "<");
this.addConversion('&', "&");
this.addConversion('"', """);
}
@Override
protected String encode(char c) {
return "&#" + (int) c + ";";
}
}
| [
"dotuian@outlook.com"
] | dotuian@outlook.com |
7f596ef394a54450f8d6ce5ade6214e1c0084dbb | 90717191e2ed9e91a6b9dfaca5c5f5d76e5188ea | /backoffice-automation/src/main/java/com/backoffice/automation/file_handler/ITF_FileHandler/PIP_ITF_FileHandler.java | a8bbb666260de1f84c711c89e715d082019dd315 | [] | no_license | anantsinghal/Automation | 12b41e23581e43c5746f3aa0257a2a28270cf19a | 8934d8d903b7ca09208633a84bd6f07a29632100 | refs/heads/master | 2020-03-30T13:32:26.253491 | 2018-10-02T15:21:20 | 2018-10-02T15:21:20 | 151,268,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,580 | java | package com.backoffice.automation.file_handler.ITF_FileHandler;
import com.backoffice.automation.POJO.JSON_POJO.FileErrorLogger;
import com.backoffice.automation.POJO.JSON_POJO.FileErrorLoggers;
import com.backoffice.automation.POJO.broker_POJO.ITF.XBEC_POJOS.Policies;
import com.backoffice.automation.POJO.broker_POJO.ITF.XBEC_POJOS.Policy;
import com.backoffice.automation.POJO.broker_POJO.ITF.XBEC_POJOS.Sku;
import com.backoffice.automation.file_handler.FileHandler;
import com.backoffice.automation.utils.Utility;
import com.backoffice.automation.utils.XstreamUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Created by NEX9ZKA on 28/08/2018.
*/
@Component(value = "pip_itf_fileHandler")
public class PIP_ITF_FileHandler implements FileHandler {
@Autowired
private Validator validator;
public FileErrorLoggers validateAndGetLogs(File file) throws IOException {
Policies policies = getXmlObject(file);
List<Policy> policiesList = policies.getPolicy();
FileErrorLoggers fileErrorLoggers = (Utility.isNotEmpty(policiesList) ? validatePolicy(validator, policiesList) : null);
return fileErrorLoggers;
}
private Policies getXmlObject(File xmlFile) throws IOException {
Policies policies = XstreamUtils.getPoliciesFromFileStream(xmlFile);
return policies;
}
private FileErrorLoggers validatePolicy(Validator validator, List<Policy> policies) {
int policiesSize = policies.size();
FileErrorLoggers fileErrorLoggers = new FileErrorLoggers();
for (int i = 0; i < policiesSize; i++) {
Policy policy = policies.get(i);
String policyId = policy.getTransactionID();
Set<ConstraintViolation<Policy>> constraintViolations = validator.validate(policy);
List<String> policyErrorMessages = getAllPipPolicyErrorMessages(constraintViolations);
List<String> skuErrorMessages = validateSku(validator, policy.getSkuList().getSku());
FileErrorLogger fileErrorLogger = getFileErrorLogger(policyId, policyErrorMessages, skuErrorMessages);
if (Utility.isNotEmpty(fileErrorLogger.getMessages())) {
fileErrorLoggers.getFileErrorLoggerList().add(fileErrorLogger);
}
}
return fileErrorLoggers;
}
private List<String> validateSku(Validator validator, List<Sku> skuList) {
List<String> skuErrorMessages = new ArrayList<>(skuList.size());
for (Sku sku : skuList) {
Set<ConstraintViolation<Sku>> constraintViolations = validator.validate(sku);
List<String> skuErrors = getAllSkuErrorMessages(constraintViolations);
skuErrorMessages.addAll(skuErrors);
}
return skuErrorMessages;
}
private List<String> getAllSkuErrorMessages(Set<ConstraintViolation<Sku>> skuConstraints) {
List<String> skuMessages = new ArrayList<>(skuConstraints.size());
for (ConstraintViolation<Sku> skuConstraint : skuConstraints) {
String message = skuConstraint.getMessage();
skuMessages.add(message);
}
return skuMessages;
}
private List<String> getAllPipPolicyErrorMessages(Set<ConstraintViolation<Policy>> policyConstraints) {
List<String> skuMessages = new ArrayList<>(policyConstraints.size());
for (ConstraintViolation<Policy> policyConstraintViolation : policyConstraints) {
String message = policyConstraintViolation.getMessage();
skuMessages.add(message);
}
return skuMessages;
}
private FileErrorLogger getFileErrorLogger(String policyID, List<String>... errorMessages) {
FileErrorLogger fileErrorLogger = null;
if (errorMessages != null && errorMessages.length > 0) {
fileErrorLogger = new FileErrorLogger();
fileErrorLogger.setPolicyId(policyID);
addErrorsInFileError(fileErrorLogger, errorMessages);
}
return fileErrorLogger;
}
private void addErrorsInFileError(FileErrorLogger fileErrorLogger, List<String>[] errorMessages) {
for (int i = 0; i < errorMessages.length; i++) {
List<String> errors = errorMessages[i];
fileErrorLogger.getMessages().addAll(errors);
}
}
} | [
"singhal.anant4@gmail.com"
] | singhal.anant4@gmail.com |
4575cc305766be073ae8efab517c2d34deaa3136 | 74d15477c5640bd66cd13db0323030a16f52a25c | /26 EXAM PREPARATION/cresla/src/cresla/core/Generator.java | d8b821012837310ea94b42729206ce9280f5772c | [
"MIT"
] | permissive | VasAtanasov/SoftUni-Java-OOP-February-2019 | 98dc1ecb826fc40528f0a47e3cd7f7d9162a7d1e | f9c61daca5c0db283f556417e00f703eac2b5af6 | refs/heads/master | 2020-04-25T03:31:58.387323 | 2019-04-28T20:30:12 | 2019-04-28T20:30:12 | 172,480,196 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package cresla.core;
public final class Generator {
private static int id = 1;
private Generator() {
}
public static int generateId() {
return id++;
}
}
| [
"vas.atanasov@gmail.com"
] | vas.atanasov@gmail.com |
d24bb769b5e5adf4b364ddd5354e0134122a843d | b8de3cef0bb0fd95485c3ff2c764bcb88e5a14ee | /app/src/main/java/com/coolweathertyb/android/gson/Weather.java | 8c0d736314cc8474a3ba9462dae34edaeda93028 | [
"Apache-2.0"
] | permissive | XiaoHuoGuo/coolweather | 698d27548b331de8baa9e020aed1bf0bbf3982f5 | 725086b1544376ae40fd4bab9df976a8be352d5d | refs/heads/master | 2021-01-15T09:32:12.923613 | 2017-08-09T14:32:07 | 2017-08-09T14:32:07 | 99,577,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.coolweathertyb.android.gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by 78472 on 2017/8/8.
*/
public class Weather {
public String status;
public Basic basic;
public AQI aqi;
public Now now;
public Suggestion suggestion;
@SerializedName("daily_forecast")
public List<Forecast>forecastList;
}
| [
"784725795@qq.com"
] | 784725795@qq.com |
7fd820696ea73f017e8288e6bdfbc1f8143cfc41 | 411817d7cbd1a1f5220b393453747eacf5c56fd8 | /shop/src/main/java/edu/oliflor/ro/shop/App.java | 8f358c22ee3980dc5a1c0a5dd1b7fa70db708ed1 | [] | no_license | BaciuFlorin/webApplication | 09c657ae67318a3e9b4879d2b36303b34a875a09 | dcfdca519fa33b51abb988d2e71569c198aa8dfa | refs/heads/master | 2020-04-04T21:11:20.347108 | 2018-11-05T22:01:01 | 2018-11-05T22:01:01 | 156,259,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 182 | java | package edu.oliflor.ro.shop;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"florin.baciu96@gmail.com"
] | florin.baciu96@gmail.com |
2f0b17245afce53261278b710becf90aa8b6cd4f | 5d76b555a3614ab0f156bcad357e45c94d121e2d | /src-v3/com/google/android/gms/games/internal/IGamesSignInCallbacks.java | 1d29733c0c23a11ca313aae1b58885ead83136b1 | [] | no_license | BinSlashBash/xcrumby | 8e09282387e2e82d12957d22fa1bb0322f6e6227 | 5b8b1cc8537ae1cfb59448d37b6efca01dded347 | refs/heads/master | 2016-09-01T05:58:46.144411 | 2016-02-15T13:23:25 | 2016-02-15T13:23:25 | 51,755,603 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,728 | java | package com.google.android.gms.games.internal;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import com.google.android.gms.common.data.DataHolder;
public interface IGamesSignInCallbacks extends IInterface {
public static abstract class Stub extends Binder implements IGamesSignInCallbacks {
private static class Proxy implements IGamesSignInCallbacks {
private IBinder kn;
Proxy(IBinder remote) {
this.kn = remote;
}
public void m1953H(DataHolder dataHolder) throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.games.internal.IGamesSignInCallbacks");
if (dataHolder != null) {
obtain.writeInt(1);
dataHolder.writeToParcel(obtain, 0);
} else {
obtain.writeInt(0);
}
this.kn.transact(5002, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public void m1954I(DataHolder dataHolder) throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.games.internal.IGamesSignInCallbacks");
if (dataHolder != null) {
obtain.writeInt(1);
dataHolder.writeToParcel(obtain, 0);
} else {
obtain.writeInt(0);
}
this.kn.transact(5003, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public void aZ(int i) throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.games.internal.IGamesSignInCallbacks");
obtain.writeInt(i);
this.kn.transact(5004, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public IBinder asBinder() {
return this.kn;
}
public void m1955b(int i, Intent intent) throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.games.internal.IGamesSignInCallbacks");
obtain.writeInt(i);
if (intent != null) {
obtain.writeInt(1);
intent.writeToParcel(obtain, 0);
} else {
obtain.writeInt(0);
}
this.kn.transact(5001, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public void ba(int i) throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.games.internal.IGamesSignInCallbacks");
obtain.writeInt(i);
this.kn.transact(5006, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public void m1956e(DataHolder dataHolder) throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.games.internal.IGamesSignInCallbacks");
if (dataHolder != null) {
obtain.writeInt(1);
dataHolder.writeToParcel(obtain, 0);
} else {
obtain.writeInt(0);
}
this.kn.transact(5005, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
}
public Stub() {
attachInterface(this, "com.google.android.gms.games.internal.IGamesSignInCallbacks");
}
public static IGamesSignInCallbacks m1957O(IBinder iBinder) {
if (iBinder == null) {
return null;
}
IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.games.internal.IGamesSignInCallbacks");
return (queryLocalInterface == null || !(queryLocalInterface instanceof IGamesSignInCallbacks)) ? new Proxy(iBinder) : (IGamesSignInCallbacks) queryLocalInterface;
}
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
DataHolder dataHolder = null;
switch (code) {
case 5001:
Intent intent;
data.enforceInterface("com.google.android.gms.games.internal.IGamesSignInCallbacks");
int readInt = data.readInt();
if (data.readInt() != 0) {
intent = (Intent) Intent.CREATOR.createFromParcel(data);
}
m535b(readInt, intent);
reply.writeNoException();
return true;
case 5002:
data.enforceInterface("com.google.android.gms.games.internal.IGamesSignInCallbacks");
if (data.readInt() != 0) {
dataHolder = DataHolder.CREATOR.createFromParcel(data);
}
m533H(dataHolder);
reply.writeNoException();
return true;
case 5003:
data.enforceInterface("com.google.android.gms.games.internal.IGamesSignInCallbacks");
if (data.readInt() != 0) {
dataHolder = DataHolder.CREATOR.createFromParcel(data);
}
m534I(dataHolder);
reply.writeNoException();
return true;
case 5004:
data.enforceInterface("com.google.android.gms.games.internal.IGamesSignInCallbacks");
aZ(data.readInt());
reply.writeNoException();
return true;
case 5005:
data.enforceInterface("com.google.android.gms.games.internal.IGamesSignInCallbacks");
if (data.readInt() != 0) {
dataHolder = DataHolder.CREATOR.createFromParcel(data);
}
m536e(dataHolder);
reply.writeNoException();
return true;
case 5006:
data.enforceInterface("com.google.android.gms.games.internal.IGamesSignInCallbacks");
ba(data.readInt());
reply.writeNoException();
return true;
case 1598968902:
reply.writeString("com.google.android.gms.games.internal.IGamesSignInCallbacks");
return true;
default:
return super.onTransact(code, data, reply, flags);
}
}
}
void m533H(DataHolder dataHolder) throws RemoteException;
void m534I(DataHolder dataHolder) throws RemoteException;
void aZ(int i) throws RemoteException;
void m535b(int i, Intent intent) throws RemoteException;
void ba(int i) throws RemoteException;
void m536e(DataHolder dataHolder) throws RemoteException;
}
| [
"binslashbash@otaking.top"
] | binslashbash@otaking.top |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.