blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5df9378cbe7457313f3f19d08b8575aba17f3f4e | 92bea743c7c4317aa4d75e6f8c0f9dd1bed6e652 | /src/test/java/com/alibaba/json/test/jackson/JacksonInnerClassTest.java | 19d4c3457f240a9780950524b24b9b844d745361 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | ziqin/fastjson | 89e4361d7923ec242e9817c7d8456a6363c7b05c | 5bdc3592655c6850eb59f89b09a7dbd19ed1ca75 | refs/heads/master | 2022-09-06T12:09:07.941718 | 2020-06-01T05:51:57 | 2020-06-01T05:53:36 | 254,939,238 | 3 | 0 | Apache-2.0 | 2020-04-13T13:10:24 | 2020-04-11T19:23:43 | null | UTF-8 | Java | false | false | 872 | java | package com.alibaba.json.test.jackson;
import com.fasterxml.jackson.core.JsonParser.Feature;
import com.fasterxml.jackson.databind.ObjectMapper;
import junit.framework.TestCase;
import java.util.Map;
public class JacksonInnerClassTest extends TestCase {
public void test_0() throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
mapper.readValue("{a:3}", Map.class);
}
public void test_1() throws Exception {
Model model = new Model();
model.id = 1001;
ObjectMapper mapper = new ObjectMapper();
String text = mapper.writeValueAsString(model);
mapper.readValue(text, Model.class);
}
public class Model {
public Model() {
}
public int id;
}
}
| [
"szujobs@hotmail.com"
] | szujobs@hotmail.com |
d84cbaa9b2b58e2fda9000da1192729aeeb926f5 | 9d1cf1253c2e43ab78408e0feb15c2cafd4f6e49 | /_021_MergeTwoLists_0413/MyMergeTwoLists.java | 583442f3569df905e7fdc6b0d88a5dcad27eecf9 | [] | no_license | panxya/LearnInLeetCode | 37920f6dc9ccfccbcd708b604c157774b54e7cc1 | dbe48dd0e92c8f61287e27db9955366b26ed9d68 | refs/heads/master | 2020-06-02T19:35:08.156791 | 2019-08-10T03:21:27 | 2019-08-10T03:21:27 | 187,987,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,200 | java | package _021_MergeTwoLists_0413;
public class MyMergeTwoLists {
public static void main(String[] args) {
ListNode l1 = new ListNode(0);
l1.next=new ListNode(2);
l1.next.next=new ListNode(4);
ListNode l2 = new ListNode(1);
l2.next=new ListNode(3);
l2.next.next=new ListNode(4);
ListNode n = mergeTwoLists(l1, l2);
int[] b = new int[3];
b[0] = n.val;
b[1] = n.next.val;
b[2] = n.next.next.val;
b[3] = n.next.next.next.val;
b[4] = n.next.next.next.next.val;
b[5] = n.next.next.next.next.next.val;
for (int s : b) {
System.out.println(b[s]);
}
}
public static ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if(l1==null&&l2==null) {
return null;
}
ListNode result = new ListNode(0);
ListNode carry = result;
while(l1!=null||l2!=null) {
if(l1==null) {
carry.next=new ListNode(l2.val);
carry=carry.next;
l2=l2.next;
}else if(l2==null) {
carry.next =new ListNode(l1.val);
carry=carry.next;
l1=l1.next;
}else if(l1.val>l2.val) {
carry.next =new ListNode(l2.val);
carry=carry.next;
l2=l2.next;
}else {
carry.next =new ListNode(l1.val);
carry=carry.next;
l1=l1.next;
}
}
return result.next;
}
}
| [
"pxy6032@163.com"
] | pxy6032@163.com |
5abc9ab56e41c315ba4dda810303fb7fbdff6dfc | 35df4656ad13c8dfe4f35519493ecd8817a26ad7 | /src/test/java/interfaces/SqlLocationInterfaceTest.java | f03369d78153787e42895bc168c04880f72782f7 | [
"MIT"
] | permissive | lendilai/Wildlife-tracker | f5371315e9f09a77babc9a0838e6a09b0d25a8a6 | 4d9c3589af933acfcf9a0b5b913a11d95e52105d | refs/heads/master | 2022-09-29T20:00:48.731186 | 2019-07-04T17:08:21 | 2019-07-04T17:08:21 | 194,511,047 | 0 | 0 | NOASSERTION | 2022-09-22T18:47:17 | 2019-06-30T12:01:32 | Java | UTF-8 | Java | false | false | 1,748 | java | package interfaces;
import models.Location;
import org.junit.*;
import org.sql2o.*;
import static org.junit.Assert.*;
public class SqlLocationInterfaceTest {
private static Connection conn;
private static SqlLocationInterface sqlLocationInterface;
@BeforeClass
public static void setUp() throws Exception{
String establishConn = "jdbc:postgresql://localhost:5432/wildlife_tracker_test";
Sql2o sql2o = new Sql2o(establishConn,"rlgriff","547");
sqlLocationInterface = new SqlLocationInterface(sql2o);
conn = sql2o.open();
}
@After
public void tearDown() throws Exception{
System.out.println("Clearing database");
sqlLocationInterface.clearAllLocations();
}
@AfterClass
public static void shutDown() throws Exception{
conn.close();
System.out.println("Connection closed");
}
@Test
public void addsLocationAndSetsId() throws Exception{
Location newLocation = new Location("Kenya");
sqlLocationInterface.add(newLocation);
int theId = newLocation.getId();
assertEquals(theId, newLocation.getId());
}
@Test
public void getsAllLocationsAdded() {
Location first = new Location("Kenya");
Location second = new Location("Senegal");
sqlLocationInterface.add(first);
sqlLocationInterface.add(second);
assertEquals(2,sqlLocationInterface.getAll().size());
}
@Test
public void findsALocationByItsId() {
Location myLocation = new Location("Kenya");
sqlLocationInterface.add(myLocation);
Location fetchLocation = sqlLocationInterface.findById(myLocation.getId());
assertEquals(myLocation, fetchLocation);
}
} | [
"ngethenan768@gmail.com"
] | ngethenan768@gmail.com |
41d105902acfbd9ef3fd1565a9845e62b3da87a5 | 7ec1980ba71bdb62c287201a0412cb16cb62eba8 | /src/main/java/com/example/service/impl/EmailService.java | 901f16a6827aab78ae5127043cf64b4cd2f11e21 | [] | no_license | nitin-/wannaryde | 9868340294a8357c02ada3720243311a0f467fed | 404095d4ee81c54520440dcbfad666f205793132 | refs/heads/master | 2020-03-30T19:50:49.146719 | 2016-08-13T03:12:08 | 2016-08-13T03:12:08 | 65,596,583 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,715 | java | package com.example.service.impl;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Set;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.mail.MailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;
@Component
public class EmailService {
private static Logger logger = LoggerFactory.getLogger(EmailService.class);
private static final String VELOCITY_TEMPLATE_FILE_ENCODING = "UTF-8";
private static String FROM = "support@wannaryde.com";
private static String REPLY_TO = "support@wannaryde.com" ;
@Autowired
private MailSender mailSender;
/*@Autowired
private VelocityEngine velocityEngine;
*/
/*private void sendMail(final MimeMessage message) {
new Thread() {
public void run() {
if(mailSender instanceof JavaMailSenderImpl) {
((JavaMailSenderImpl) mailSender).send(message);
} else {
logger.warn("JavaMailSenderImpl is not used");
}
}
}.start();
}*/
private void sendMail(MimeMessage message) {
/*JavaMailSenderImpl javaMailSender = (JavaMailSenderImpl)mailSender;
javaMailSender.send(message);*/
try {
Thread mailThread = new Thread(new EmailUtil(message));
mailThread.start();
} catch (MailException ex) {
logger.error("Error in sending email: " + ex, ex);
}
}
/**
*
* @param to
* @param from
* @param bcc
* @param cc
* @param subject
* @param body
* @param attachmentName
* @param resourceStream
* @param isHtml
* @throws Exception
*/
public void sendMail(String[] to, String from, String[] bcc, String[] cc, String subject, String body, String attachmentName, InputStream resourceStream, boolean isHtml) throws Exception {
JavaMailSenderImpl javaMailSender = ((JavaMailSenderImpl) mailSender);
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
try {
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);
mimeMessageHelper.setTo(to);
if (bcc != null) {
mimeMessageHelper.setBcc(bcc);
}
if (cc != null) {
mimeMessageHelper.setCc(cc);
}
mimeMessageHelper.setReplyTo(REPLY_TO);
setMimeMessage(mimeMessageHelper, from, subject, body, isHtml);
/* if (resourceStream != null) {
mimeMessageHelper.addAttachment(attachmentName, new ByteArrayResource(IOUtils.toByteArray(resourceStream)));
}*/
sendMail(mimeMessage);
} catch (MessagingException e) {
throw new Exception(e);
}
}
public void sendMail(String to, String from, String[] bcc, String[] cc, String subject, String body, boolean isHtml) throws Exception {
JavaMailSenderImpl javaMailSender = ((JavaMailSenderImpl) mailSender);
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
try {
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);
mimeMessageHelper.setTo(to);
if (bcc != null) {
mimeMessageHelper.setBcc(bcc);
}
if (cc != null) {
mimeMessageHelper.setCc(cc);
}
mimeMessageHelper.setReplyTo(REPLY_TO);
setMimeMessage(mimeMessageHelper, from, subject, body, isHtml);
sendMail(mimeMessage);
} catch (MessagingException e) {
throw new Exception(e);
}
}
/**
* Sets the common part of the mimemessage from, subject and body
*
* @param mimeMessageHelper
* @param from
* @param subject
* @param body
* @throws javax.mail.MessagingException
*/
private static void setMimeMessage(MimeMessageHelper mimeMessageHelper, String from, String subject, String body, boolean isHtml) throws MessagingException {
mimeMessageHelper.setFrom(from);
mimeMessageHelper.setReplyTo(REPLY_TO);
mimeMessageHelper.setSubject(subject);
mimeMessageHelper.setText(body, isHtml);
}
/**
* this constructs a body from a jsp template
*
* @param request
* @param response
* @param servletContext
* @param templateName
* @param attributes
* @return
* @throws javax.servlet.ServletException
* @throws java.io.IOException
*/
public static String constructEmailBodyFromJspTemplate(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, String templateName, Map<String, String> attributes) throws ServletException, IOException {
if (attributes != null) {
Set<String> keys = attributes.keySet();
for (String key : keys) {
String attr = attributes.get(key);
request.setAttribute(key, attr);
}
}
RequestDispatcher rd = servletContext.getRequestDispatcher(templateName);
CharResponseWrapper wrapper = new CharResponseWrapper((HttpServletResponse) response);
rd.include(request, wrapper);
return new String(wrapper.toString());
}
/*
* Wrapper for servlet response to trap the output
*/
private static class CharResponseWrapper extends HttpServletResponseWrapper {
private CharArrayWriter output;
public String toString() {
return output.toString();
}
public CharResponseWrapper(HttpServletResponse response) {
super(response);
output = new CharArrayWriter();
}
public PrintWriter getWriter() {
return new PrintWriter(output);
}
}
class EmailUtil implements Runnable {
private MimeMessage mimeMessage;
EmailUtil(MimeMessage mimeMessage) {
this.mimeMessage = mimeMessage;
}
public void run() {
JavaMailSenderImpl javaMailSender = (JavaMailSenderImpl)mailSender;
logger.debug("Sending email through : " + javaMailSender.getHost());
// try email sending for maximum allowable number of trials
int maxemailtrials = 5;
for (int i = 1; i <= maxemailtrials; i++) {
try {
javaMailSender.send(this.mimeMessage);
logger.info("email sent successfully");
break;
} catch (MailException ex) {
if (i == maxemailtrials) {
logger.error("Error in sending email: " + ex, ex);
}
}
}
}
}
}
| [
"nitin.jha@geminisolutions.in"
] | nitin.jha@geminisolutions.in |
aaed3939a908aeecfb333562aeeb764ad39b682c | 928b371104f5e8be0c27a3ecf832e5b8b5333b16 | /ioc/src/test/java/org/mjz/ioc/Ce.java | 4ec9caf87c3f33531f7f591f13422aa5c4d085c8 | [] | no_license | tengfei7890/shenbaiselib | 8536335afb41a66fc7af220be0df00f38840315d | ec840714b916207c3c7c8e00f843532eb2996dd9 | refs/heads/master | 2021-01-01T05:37:26.055576 | 2012-01-04T05:01:30 | 2012-01-04T05:01:30 | 34,447,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48 | java | package org.mjz.ioc;
public class Ce {
}
| [
"greatwhite1001@gmail.com@6583177d-3207-e7dc-e47e-9647f72e5ef6"
] | greatwhite1001@gmail.com@6583177d-3207-e7dc-e47e-9647f72e5ef6 |
3f11cbb92abf5b2e30815371afe848a0caee480c | 6a20b2f49e4830858c0c8d87e8d7c232ccefe05f | /src/com/cognizant/salary/predictor/SalaryIncomePredictor.java | 21a46d862cbc3ea1815b8c548d45a45663ffa865 | [] | no_license | suriyakalavathi/IIHT_SalaryIncomePredictor | 2d7bdca0cdd4716d11117e78858275a53594f80e | 7a34141b4a87cbdc482e9b887f96bf125d8822f1 | refs/heads/master | 2020-12-06T09:41:37.481548 | 2020-01-20T04:07:34 | 2020-01-20T04:07:34 | 232,426,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,316 | java | package com.cognizant.salary.predictor;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.cognizant.salary.bean.CalculatorObject;
import com.cognizant.salary.bean.DeductionCalculator;
import com.cognizant.salary.bean.DeductionObject;
import com.cognizant.salary.bean.IncrementCalculator;
import com.cognizant.salary.bean.IncrementObject;
import com.cognizant.salary.bean.PredictionCalculator;
import com.cognizant.salary.bean.PredictionObject;
import com.cognizant.salary.display.DisplayHelper;
import com.cognizant.salary.userinput.DeductionFrequency;
import com.cognizant.salary.userinput.Deduction;
import com.cognizant.salary.userinput.IncrementFrequency;
import com.cognizant.salary.userinput.Increment;
import com.cognizant.salary.userinput.Prediction;
import com.cognizant.salary.userinput.Salary;
public class SalaryIncomePredictor {
public void execute() {
float salary = new Salary().get();
int incrementPercentage = new Increment().get();
int incrementFrequency = new IncrementFrequency().get();
float deductionAmount = new Deduction().get();
int deductionFrequency = new DeductionFrequency().get();
int predictionYears = new Prediction().get();
// Increment Calculation
IncrementCalculator incrementCalculator = (years, startingSalary, changeFrequency, changePercentage) -> {
List<CalculatorObject> calcs = Calculator.calculateIncrement(years, startingSalary, changeFrequency,
changePercentage);
List<IncrementObject> increments = calcs.stream().map(calc -> new IncrementObject(calc))
.collect(Collectors.toList());
return increments;
};
List<IncrementObject> increments = incrementCalculator.calc(predictionYears, salary, incrementFrequency,
incrementPercentage);
// Deduction Calculation
DeductionCalculator deductionCalculator = (years, deducts, deductionFreq, changeAmount) -> {
List<CalculatorObject> calcs = Calculator.calculateDeduction(years, deducts, deductionFrequency,
changeAmount);
List<DeductionObject> deductions = calcs.stream().map(calc -> new DeductionObject(calc))
.collect(Collectors.toList());
return deductions;
};
List<DeductionObject> deductions = deductionCalculator.calc(predictionYears, increments, deductionFrequency,
deductionAmount);
// Predition Calculation
PredictionCalculator predictionCalculator = (incs, deducts) -> {
List<PredictionObject> salPredictions = new ArrayList<>();
for (int i = 1; i <= incs.size(); i++) {
float yearlyStartingSal = incs.get(i - 1).getStartingSal();
float incAmount = incs.get(i - 1).getIncrementAmount();
float dedAmount = deducts.get(i - 1).getDeductionAmount();
salPredictions.add(new PredictionObject(i, yearlyStartingSal, incAmount, dedAmount,
PredictionCalculator.generateSalaryGrowth(yearlyStartingSal, incAmount, dedAmount)));
}
return salPredictions;
};
List<PredictionObject> predictions = predictionCalculator.predict(increments, deductions);
System.out.format("\n\n");
DisplayHelper displayHelper = new DisplayHelper();
displayHelper.incrementReport(increments);
displayHelper.deductionReport(deductions);
displayHelper.predictionReport(predictions);
}
public static void main(String args[]) {
new SalaryIncomePredictor().execute();
}
}
| [
"skalimuthu@metlife.com"
] | skalimuthu@metlife.com |
13eeaec495b7247c4bd1926bc01d1053d12458e6 | 64a57283d422fd17b9cdac0c4528059008002d5c | /Project-new-spring/boost-server-master/boost-server-api/src/test/java/com/qooco/boost/business/impl/BusinessPersonalAssessmentServiceImplTest.java | ac06e5ff72de155c817021b71a304276c9859f71 | [
"BSL-1.0"
] | permissive | dolynhan15/Java-spring-boot | b2ff6785b45577a5e16b016d8eeab00cf0dec56b | 3541b6ba1b0e6a2c254f29bf29cf90d7efd1479a | refs/heads/main | 2023-08-13T11:53:57.369574 | 2021-10-19T07:36:42 | 2021-10-19T07:36:42 | 397,813,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,265 | java | package com.qooco.boost.business.impl;
import com.google.common.collect.Lists;
import com.qooco.boost.business.BusinessPersonalAssessmentService;
import com.qooco.boost.business.BusinessValidatorService;
import com.qooco.boost.constants.QoocoApiConstants;
import com.qooco.boost.core.model.authentication.AuthenticatedUser;
import com.qooco.boost.data.oracle.entities.PersonalAssessment;
import com.qooco.boost.data.oracle.entities.PersonalAssessmentQuestion;
import com.qooco.boost.data.oracle.entities.UserPersonality;
import com.qooco.boost.data.oracle.entities.UserProfile;
import com.qooco.boost.data.oracle.services.PersonalAssessmentQuestionService;
import com.qooco.boost.data.oracle.services.PersonalAssessmentService;
import com.qooco.boost.data.oracle.services.UserPersonalityService;
import com.qooco.boost.enumeration.ResponseStatus;
import com.qooco.boost.exception.EntityNotFoundException;
import com.qooco.boost.exception.InvalidParamException;
import com.qooco.boost.threads.BoostActorManager;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
@RunWith(PowerMockRunner.class)
@PowerMockIgnore({"javax.management.*", "javax.security.*", "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
public class BusinessPersonalAssessmentServiceImplTest {
@InjectMocks
private BusinessPersonalAssessmentService unitService = new BusinessPersonalAssessmentServiceImpl();
@Mock
private PersonalAssessmentService personalAssessmentService = Mockito.mock(PersonalAssessmentService.class);
@Mock
private UserPersonalityService userPersonalityService = Mockito.mock(UserPersonalityService.class);
@Autowired
private PersonalAssessmentQuestionService personalAssessmentQuestionService = Mockito.mock(PersonalAssessmentQuestionService.class);
@Autowired
private BoostActorManager boostActorManager = Mockito.mock(BoostActorManager.class);
@Rule
private ExpectedException thrown = ExpectedException.none();
@Mock
private Authentication authentication = Mockito.mock(Authentication.class);
@Mock
private BusinessValidatorService businessValidatorService = Mockito.mock(BusinessValidatorService.class);
@Test
public void getPersonalAssessment_whenInputIsValid_thenReturnSuccess() {
mockitoGetPersonalAssessment();
AuthenticatedUser authenticatedUser = BaseUserService.initAuthenticatedUser();
Mockito.when(authentication.getPrincipal()).thenReturn(authenticatedUser);
Mockito.when(businessValidatorService.checkExistsUserProfile(1L)).thenReturn(new UserProfile(1L));
Assert.assertEquals(ResponseStatus.SUCCESS.getCode(), unitService.getPersonalAssessment(1L, QoocoApiConstants.LOCALE_ZH_CN, authentication).getCode());
}
@Test
public void getQuestions_whenPersonalAssessmentIdIsNull_thenReturnErrorException() {
thrown.expect(InvalidParamException.class);
unitService.getQuestions(null, QoocoApiConstants.LOCALE_ZH_CN, 1L);
}
@Test
public void getQuestions_whenNotFoundPersonalAssessmentId_thenReturnErrorException() {
thrown.expect(EntityNotFoundException.class);
Long id = 1L;
mockitoGetQuestions(id);
Mockito.when(personalAssessmentService.findById(id)).thenReturn(null);
unitService.getQuestions(id, QoocoApiConstants.LOCALE_ZH_CN, 1L);
}
@Test
public void getQuestions_whenInputsAreValid_thenReturnSuccess() {
Long id = 1L;
mockitoGetQuestions(id);
unitService.getQuestions(id, QoocoApiConstants.LOCALE_ZH_CN, 1L);
}
@Test
public void getPersonalTestResult_whenNotFoundPersonalAssessment_thenReturnErrorException() {
thrown.expect(EntityNotFoundException.class);
Long id = 1L;
AuthenticatedUser authenticatedUser = BaseUserService.initAuthenticatedUser();
Mockito.when(authentication.getPrincipal()).thenReturn(authenticatedUser);
Mockito.when(personalAssessmentService.findById(id)).thenReturn(null);
unitService.getPersonalTestResult(1L, QoocoApiConstants.LOCALE_ZH_CN, id, authentication);
}
@Test
public void getPersonalTestResult_whenInputsAreValid_thenReturnSuccess() {
Long id = 1L;
mockitoGetPersonalTestResult(id);
AuthenticatedUser authenticatedUser = BaseUserService.initAuthenticatedUser();
Mockito.when(authentication.getPrincipal()).thenReturn(authenticatedUser);
Assert.assertEquals(ResponseStatus.SUCCESS.getCode(), unitService.getPersonalTestResult(1L, QoocoApiConstants.LOCALE_ZH_CN, id, authentication).getCode());
}
/*==================================== Prepare for testing ==================================================*/
private void mockitoGetPersonalAssessment() {
Long userId = 1L;
Mockito.when(personalAssessmentService.getActivePersonalAssessment()).thenReturn(Lists.newArrayList(new PersonalAssessment(1L)));
Mockito.when(userPersonalityService.getPersonalAssessmentIdByUserProfileId(userId)).thenReturn(Lists.newArrayList(1L));
}
private void mockitoGetQuestions(Long id) {
Mockito.when(personalAssessmentService.findById(id)).thenReturn(new PersonalAssessment(id));
Mockito.when(personalAssessmentQuestionService.getByPersonalAssessmentId(id))
.thenReturn(Lists.newArrayList(new PersonalAssessmentQuestion(1L)));
Mockito.when(userPersonalityService.countPersonalAssessmentByUserProfileId(1L, id)).thenReturn(1);
}
private void mockitoGetPersonalTestResult(Long id) {
Mockito.when(personalAssessmentService.findById(id)).thenReturn(new PersonalAssessment(id));
Mockito.when(userPersonalityService.getByUserProfileIdAndPersonalAssessmentId(1L, id))
.thenReturn(Lists.newArrayList(new UserPersonality(1L)));
}
} | [
"dolynhan15@gmail.com"
] | dolynhan15@gmail.com |
5bc9142751b3856e56e7b867d7a9e83a2e17fb51 | 91dd515a935cca7622eaa478bd8022e9b1fe0a45 | /core/SessionHttpServletRequestWrapper.java | 625dac89d7dc4b154da92d1c4b634a03f2f9c2e7 | [] | no_license | suYaoXing/suYaoXing.github.io.demo | da6872ee32d41c80315a11cfc17139f10ef6811f | dd99376636199c746dc1ea8b78ee890cb3397def | refs/heads/master | 2021-05-11T12:23:19.279711 | 2018-01-16T08:44:41 | 2018-01-16T08:44:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,507 | java | package com.suyaoxing.core;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import javax.servlet.AsyncContext;
import javax.servlet.DispatcherType;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.Part;
import com.nubia.oa.util.CookieUtil;
public class SessionHttpServletRequestWrapper extends HttpServletRequestWrapper{
private HttpServletRequest request;
private HttpServletResponse response;
private HttpSession session;
private String sessionId = "";
public SessionHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
}
public SessionHttpServletRequestWrapper(String sessionId, HttpServletRequest request) {
super(request);
this.sessionId = sessionId;
}
public SessionHttpServletRequestWrapper(String sessionId, HttpServletRequest request,
HttpServletResponse response) {
super(request);
this.request = request;
this.response = response;
this.sessionId = sessionId;
if (this.session == null) {
this.session = new RedisSavedSession(sessionId, super.getSession(false),
request, response);
}
}
@Override
public HttpSession getSession(boolean create) {
if (this.session == null) {
if (create) {
this.session = new RedisSavedSession(this.sessionId,
super.getSession(create), this.request, this.response);
return this.session;
} else {
return null;
}
}
return this.session;
}
@Override
public HttpSession getSession() {
if (this.session == null) {
this.session = new RedisSavedSession(this.sessionId, super.getSession(),
this.request, this.response);
}
return this.session;
}
}
| [
"1243327019@qq.com"
] | 1243327019@qq.com |
9b79771672e68366919bf03d81d5d4dfd3e5822d | f00470f8f0bbdaed7203cb1d1a79d62f11b2ddbf | /leisure/src/main/java/annotation/FieldName.java | 6b1de2aa11468e82197701167834400df10b336a | [] | no_license | shoutAtBadRoad/micro-oauth2-main | 59a6cd1fb8ed0d05a056ec81ec5f2a5ad6ba9627 | 4afaa87232b740268451f8f22e4e5293c1d0f1a3 | refs/heads/main | 2023-07-09T00:08:21.791050 | 2021-03-18T15:35:11 | 2021-03-18T15:35:11 | 342,865,716 | 0 | 0 | null | 2021-06-12T07:11:10 | 2021-02-27T13:41:35 | Java | UTF-8 | Java | false | false | 309 | java | package annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface FieldName {
String value() default "";
}
| [
"79404434+shoutAtBadRoad@users.noreply.github.com"
] | 79404434+shoutAtBadRoad@users.noreply.github.com |
eeeb8f132aaa62b5fd7f5e1737d40b0a3d6f11d2 | 30c051d709e6a7f8407551588a47453f5374cc36 | /src/main/java/com/countrycontacts/NoPrefixAnnounceActivity.java | 05cf967b4a8fa2f93d8fd4dd725d0d103415e160 | [] | no_license | adev-be/countrycontacts | 2b1154f76443b4f58386ec07f48d5866783055ac | f48b4fcf372cfa3900072ff54f2135478e6ae9f7 | refs/heads/master | 2020-04-09T08:41:19.239757 | 2014-09-25T06:06:41 | 2014-09-25T06:06:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 539 | java | package com.countrycontacts;
import com.nationalcontacts.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
public class NoPrefixAnnounceActivity extends Activity {
private ImageView announce;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.no_prefix_announce);
announce = (ImageView) findViewById(R.id.announce);
}
}
| [
"training@pc19.home"
] | training@pc19.home |
274bcf476b7f8fdaeb6a8aa6c43ba2505bf1291b | 261b1ff89712e05ad8ac589ea5d980066f8b8b19 | /src/main/java/mcp/mobius/betterbarrels/common/JabbaCreativeTab.java | 3d85171b322f1844e8f1f298a1142e30374f258c | [] | no_license | IdealIndustrial/Jabba | 9aafd49425e861fbfe866b6178f4b8beefa9d360 | 4bf33a6c7d6af9c946339c5c6e760d6ab19ff7d0 | refs/heads/master | 2023-04-30T12:27:38.437710 | 2020-12-09T05:24:01 | 2020-12-09T05:24:01 | 285,618,979 | 0 | 0 | null | 2021-05-16T18:24:30 | 2020-08-06T16:27:55 | Java | UTF-8 | Java | false | false | 585 | java | package mcp.mobius.betterbarrels.common;
import mcp.mobius.betterbarrels.BetterBarrels;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class JabbaCreativeTab extends CreativeTabs {
public static JabbaCreativeTab tab = new JabbaCreativeTab();
public JabbaCreativeTab() {
super("jabba");
}
@Override
public ItemStack getIconItemStack() {
return new ItemStack(BetterBarrels.blockBarrel);
}
@Override
public Item getTabIconItem() {
return Item.getItemFromBlock(BetterBarrels.blockBarrel);
}
}
| [
"dream-master@gmx.net"
] | dream-master@gmx.net |
deeeaa30d8f6df14e9905b7350b994e4957b5efd | 8866b9f54cf7c083154a9e80d262123fc3ebe2f9 | /Original/src/bin/PacketEat.java | 515dddb076c04807b11065b2fe2344aebfa24627 | [] | no_license | guialara/CMSC-137-Group-De5 | d284e19b43e4801f57d16c40e982d31940fedd73 | 3a01ae93a3b798b1b0ff32b2e9130a93c5a0950e | refs/heads/master | 2021-01-12T14:42:50.212776 | 2016-12-07T15:42:46 | 2016-12-07T15:42:46 | 72,066,707 | 0 | 0 | null | 2016-12-07T11:28:05 | 2016-10-27T03:15:56 | Java | UTF-8 | Java | false | false | 957 | java | package bin;
public class PacketEat extends Packet{
public float x, y;
public PacketEat(byte[] data) {
super(07);
String[] dataArray = readData(data).split(",");
this.x = Float.parseFloat(dataArray[0]);
this.y = Float.parseFloat(dataArray[1]);
}
public PacketEat(float x, float y){
super(07);
this.x = x;
this.y = y;
}
public void writeData(GameClient client) {
client.sendData(getData());
}
public void writeData(GameServer server) {
server.sendDataToAllClients(getData());
}
public byte[] getData() {
return ("07"+this.x+","+this.y+",extra").getBytes();
}
public float getXPos() {
return x;
}
public float getYPos() {
return y;
}
public int getX() {
return 0;
}
public int getY() {
return 0;
}
public int getH() {
return 0;
}
public int getW() {
return 0;
}
public String getUsername() {
return null;
}
public ObjectId getId() {
return null;
}
}
| [
"xyrus.cruz23@gmail.com"
] | xyrus.cruz23@gmail.com |
6daefc732b835a7468acaa99267c56636265005b | eab0be0eeaf1cecca71c97f1623f126e844148b6 | /src/problem/DDBoard/BoardDAO.java | 5f6e5834601805a9cbb92169e2c56844a784eb1f | [] | no_license | NAYEONSEUNG/191220 | 8fe5c6c07e40602dfd504db3827b53eada9b1834 | 42bbc1a6dd1588a7022a7fb592dfdfc806c50db0 | refs/heads/master | 2020-11-26T20:36:44.728353 | 2019-12-20T06:08:08 | 2019-12-20T06:08:08 | 229,200,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,298 | java | package problem.DDBoard;
//boardSelect(){
// ArrayList<BoardDTO>list = ArrayList<>();
// boardSelect(){
// list.clear();
// } 리스트는 1회만 생성하고 메서드 실행시마다 리스트에 값을 전부
//} 삭제하고 값을 담음.
//dao에 필요한 메서들부터 쫙 생성
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import jdbc.DBManager;
public class BoardDAO {//게시글 관련 애들이 모여있는데 데이터베이스 사용하네
Connection conn;
PreparedStatement pstmt;
ResultSet rs;
ArrayList<BoardDTO>list = new ArrayList<>();
BoardDTO bDto;
int result;
public void BoardInsert(BoardDTO bDto) {
try {
conn = DBManager.getConnection();//드라이버로드, 커넥션생성
String sql = "INSERT INTO tbl_board (ano, title, content, writer) "
+ "VALUES (seq_board.NEXTVAL, ?,?,?)";//질의어작성
pstmt = conn.prepareStatement(sql); //질의어 준비 이거없으면 널값이 들어온다.
pstmt.setString(1,bDto.getTitle());//미완성된질의어 (?부분 삽입)
pstmt.setString(2,bDto.getContent());
pstmt.setString(3,bDto.getWriter());
//질의어 실행
int result = pstmt.executeUpdate();
//실행한 질의어 결과값으로 실행성공여부 확인
if(result > 0) {
System.out.println("등록성공");
}else {
System.out.println("등록실패");
}
//커넥션 끊기
} catch (Exception e) {
e.printStackTrace();
}finally {
}
}
public void BoardUpdate(BoardDTO bDto) {
System.out.println(bDto.toString());
try {
conn = DBManager.getConnection();
String sql="UPDATE tbl_board SET "
+ "title = ?, "
+ "content = ?, "
+ "writer = ? "
+ "WHERE ano =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, bDto.getTitle());
pstmt.setString(2, bDto.getContent());
pstmt.setString(3, bDto.getWriter());
pstmt.setInt(4, bDto.getAno());
int result = pstmt.executeUpdate();
if(result > 0) {
System.out.println("수정성공");
}else {
System.out.println("수정실패");
}
} catch (Exception e) {
e.printStackTrace();
}finally {
}
}
public void BoardDelete(int ano) {
try {
conn = DBManager.getConnection();
String sql = "DELETE FROM tbl_board "
+"WHERE ano = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, ano);
int result = pstmt.executeUpdate();
if(result >0) {
System.out.println("삭제성공");
}else {
System.out.println("삭제실패");
}
} catch (Exception e) {
e.printStackTrace();
}finally {
}
}
public void BoardSelect() {//상세게시글 출력
try {
conn = DBManager.getConnection();
String sql = "SELECT * FROM tbl_board "
+ "ORDER BY ano DESC";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
list.clear();
while(rs.next()) {
int ano = rs.getInt("ano");
String title = rs.getString("title");
String content = rs.getString("content");
String writer = rs.getString("writer");
Date regdate = rs.getDate("regdate");
BoardDTO bDto = new BoardDTO(ano, title, content, writer, regdate);//꺼낸것을 한줄로 담는다
list.add(bDto);//한줄짜리를 다시 리스트에 담고
}
printQuery(list);
} catch (Exception e) {
e.printStackTrace();
}finally {
}
}
public void BoardSearch(String keyword) {
try {
conn = DBManager.getConnection();
String sql = "SELECT * FROM tbl_board "
+ "WHERE title LIKE ? or "
+ "content LIKE ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,"%" + keyword + "%");
pstmt.setString(2,"%" + keyword + "%");
rs = pstmt.executeQuery();
list.clear();
while(rs.next()) {
int ano = rs.getInt("ano");
String title = rs.getString("title");
String content = rs.getString("content");
String writer = rs.getString("writer");
Date regdate = rs.getDate("regdate");
BoardDTO bDto = new BoardDTO(ano, title, content, writer, regdate);//꺼낸것을 한줄로 담는다
list.add(bDto);//한줄짜리를 다시 리스트에 담고
}
System.out.println("\""+keyword + "\"로 검색한결과 총" + list.size() + "검색되었습니다.");// ' \" ' 역슬러시 쌍따옴표는 출력문이다.
printQuery(list);
} catch (Exception e) {
e.printStackTrace();
}finally {
}
}
public void BoardView(int ano) {
int result = viewCntPlus(ano);
if(!(result >0)) {//느낌표있으니까 리절트가 0보다 크지않은 ㄱ뎡우
System.out.println("조회수 증가 실패, 관리자에게 문의");
return;
}
try {
conn = DBManager.getConnection();
String sql = "SELECT * "
+"FROM tbl_board "
+"WHERE ano = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, ano);
rs = pstmt.executeQuery();
while(rs.next()) {
ano = rs.getInt("ano");
String title = rs.getString("title");
String content = rs.getString("content");
String writer = rs.getString("writer");
Date regdate = rs.getDate("regdate");
int viewcnt = rs.getInt("viewcnt");
bDto = new BoardDTO(ano, title, content, writer, viewcnt, regdate);
}
System.out.println("★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★");
System.out.println("★★게시글번호"+ano);
System.out.println("★★작성일자"+bDto.getRegdate());
System.out.println("★★제목|"+bDto.getTitle());
System.out.println("★★내용|"+bDto.getContent());
System.out.println("★★작성자|"+bDto.getWriter());
System.out.println("★★조회수:"+bDto.getViewcnt());
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
pstmt.close();
rs.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public void Boardsort() {
try {
conn = DBManager.getConnection();
String sql = "SELECT * FROM tbl_board "
+ "ORDER BY viewcnt DESC";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
list.clear();
while(rs.next()) {
int ano = rs.getInt("ano");
String title = rs.getString("title");
String content = rs.getString("content");
String writer = rs.getString("writer");
int viewcnt = rs.getInt("viewcnt");
Date regdate = rs.getDate("regdate");
BoardDTO bDto = new BoardDTO(ano, title, content, writer, viewcnt, regdate);
list.add(bDto);
}
System.out.println("=================================");
System.out.println("번호\t제목\t\t\t내용\t작성자\t작성일자\t");
for (BoardDTO line : list) {
System.out.println(line.toString());
}
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
conn.close();
rs.close();
pstmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public int viewCntPlus(int ano) {//상세게시글 조회수 + 1 증가
try {
conn = DBManager.getConnection();
String sql = "UPDATE tbl_board "
+"SET viewcnt = viewcnt + 1 "
+"WHERE ano = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1,ano);//물음표 수만큼 pstmt._____나온다
result = pstmt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}finally {
}
return result;
}
//조회된 결과를 출력하는 함수
public void printQuery(ArrayList<BoardDTO>list) {
System.out.println("========================================");
System.out.println("번호\t제목\t\t내용\t작성자\t작성일자\t");
System.out.println("========================================");
for (BoardDTO line : list) {
System.out.println(line.toString());
}
}
}//class
| [
"noreply@github.com"
] | noreply@github.com |
2ee25c418758fab95793cd67fca2b0f4d1277031 | 63cd77588c8f6b690837ca0e7d3d72e9f577e60d | /src/main/java/comee/App.java | 0e8e3fabdd544c3b25e296b8d26c6ca1cd1e7dbe | [] | no_license | amorKarl/scanCode | fc6068e05d4f8bb88a507d904116a44e9fc285c8 | 0d381137c2b53f02b67b840d89a371b2b42a9644 | refs/heads/master | 2020-12-30T13:28:10.319314 | 2017-05-14T05:45:02 | 2017-05-14T05:45:02 | 91,218,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package comee;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"1064691217@qq.com"
] | 1064691217@qq.com |
da74df3a30ca3069b329ee786f43902ed77a03d4 | b172dc9041ab4e7b27db5a2408a2842dfcaf3503 | /src/main/java/hw3/ex2/MainPageEx2.java | 789ca813776290de985f2f50fb778b9cc9297d39 | [] | no_license | AleksandraMalygina/AleksandraMalygina | 3d81bd006cfe1c09b3a4c7fe546eaf591b311a36 | 860f99f3e24df7633267c870eb7151593e31ea6e | refs/heads/master | 2023-02-20T12:40:05.197869 | 2020-10-01T16:06:26 | 2020-10-01T16:06:26 | 285,267,874 | 0 | 0 | null | 2020-09-25T08:03:59 | 2020-08-05T11:26:34 | Java | UTF-8 | Java | false | false | 2,214 | java | package hw3.ex2;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import java.util.List;
public class MainPageEx2 {
private WebDriver driver;
private HeaderMenu headerMenu;
private LeftSideMenu leftSideMenu;
private DifferentElementsPage differentElementsPage;
public MainPageEx2(WebDriver driver) {
PageFactory.initElements(driver, this);
this.driver = driver;
headerMenu = new HeaderMenu(driver);
leftSideMenu = new LeftSideMenu(driver);
differentElementsPage = new DifferentElementsPage(driver);
}
@FindBy(xpath = "//div[@class='benefit-icon']/span[contains(@class, 'icons-benefit')]")
private List<WebElement> benefitIcons;
@FindBy(xpath = "//span[@class='benefit-txt']")
private List<WebElement> benefitTexts;
@FindBy(className = "main-title")
private WebElement mainTitle;
@FindBy(className = "main-txt")
private WebElement mainText;
@FindBy(id = "second_frame")
private List<WebElement> iframeList;
@FindBy(id = "epam-logo")
private WebElement frameLogo;
private WebElement iframe;
@FindBy(xpath = "//a[@ui='link']")
private WebElement subHeader;
@FindBy(name = "navigation-sidebar")
private WebElement leftSection;
@FindBy(className = "footer-bg")
private WebElement footer;
public void openPage(String pageUrl) {
driver.get(pageUrl);
}
public String returnPageTitle() {
return driver.getTitle();
}
public void enterCreds(String login, String password) {
headerMenu.enterCreds(login, password);
}
public List<String> returnHeaderServiceElementsTexts() {
return headerMenu.returnServiceElementsTexts();
}
public List<String> returnSideServiceElementsTexts() {
return leftSideMenu.returnServiceElementsTexts();
}
public String returnUserName() {
return headerMenu.returnUserName();
}
public DifferentElementsPage goToDifElementsPage() {
headerMenu.goToDifElementsPage();
return differentElementsPage;
}
}
| [
"malygina.a.g@gmail.com"
] | malygina.a.g@gmail.com |
d2f5bfe23ccd87b202f202da21f96eb9ef228088 | 681fb922ee3fdd2d79049d0d8c5eae94476d7cad | /src/com/sunil/daily/TwoSum.java | 5da1b6c152ac7c26b3c6c88d833d77cb124d6d92 | [] | no_license | sunilvakotar/Algorithms | bfaf29547cb9f8674f1a5df2f81a8ffff417d16a | 6eac4592d78f87ebb1f00a9e9e4888fbd5502c4d | refs/heads/master | 2021-05-19T04:49:14.865385 | 2020-04-14T04:39:00 | 2020-04-14T04:39:00 | 251,535,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,389 | java | package com.sunil.daily;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;
public class TwoSum {
public static void main(String[] args) {
int[] list = {10, 15, 3, 7, 3, 15};
int k = 30;
//System.out.println(twoSumSet(list, k));
System.out.println(twoSumBinarySearch(list, k));
}
// This would be O(N) since lookups of sets are O(1) each.
private static boolean twoSumSet(int[] list, int k) {
Set<Integer> set = new HashSet<>();
for (int num : list) {
if(set.contains(k - num)) return true;
set.add(num);
}
return false;
}
private static boolean twoSumBinarySearch(int[] list, int k) {
sort(list);
for (int i=0;i<list.length;i++) {
int target = k - list[i];
//System.out.println("target="+target);
int j = binarySearch(list, target);
//System.out.println(j);
if(j < 0){
continue;
}else if(j != i){
return true;
}else if(j-1 >= 0 && target == list[j-1]){
return true;
}else if(j+1 < list.length && target == list[j+1]){
return true;
}
}
return false;
}
}
| [
"sunil.vakotar@emirates.com"
] | sunil.vakotar@emirates.com |
162513457abfac8bbff6f9a44b497c9d45d1ba1a | 9796d3ac1077ff433978b0d60956da3cc204acc2 | /Thong/FormDN/Do An Gk/src/java/dao/ProductDAO.java | b12a16c975aa47b98522208f1568ca1c4c86ece5 | [] | no_license | luuvinhhung/CSDLPT | 6fcec621757d851344e3c57c8f55a707c0e7ff0a | b2578670f84b7f29c90c174386137572a56067cd | refs/heads/master | 2020-03-23T17:30:27.500879 | 2018-07-22T03:26:37 | 2018-07-22T03:26:37 | 141,862,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,810 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dao;
import connect.DBconnect;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import model.Product;
import org.jboss.logging.Logger;
import sun.util.logging.PlatformLogger;
/**
*
* @author Van Khoa
*/
public class ProductDAO {
// get danh sach phim
public ArrayList<Product> getListProduct() throws SQLException {
Connection connection = DBconnect.getConnecttion();
String sql = "SELECT * FROM product";
PreparedStatement ps = connection.prepareCall(sql);
ResultSet rs = ps.executeQuery();
ArrayList<Product> list = new ArrayList<>();
while (rs.next()) {
Product product = new Product();
product.setProductID(rs.getLong("product_id"));
product.setProductname(rs.getString("product_name"));
product.setImg(rs.getString("product_img"));
product.setCategoryID(rs.getLong("category_id"));
product.setDetail(rs.getString("detail"));
list.add(product);
}
return list;
}
public ArrayList<Product> getListProductByCategory(long category_id) throws SQLException {
Connection connection = DBconnect.getConnecttion();
String sql = "SELECT * FROM product WHERE category_id = '" + category_id + "'";
PreparedStatement ps = connection.prepareCall(sql);
ResultSet rs = ps.executeQuery();
ArrayList<Product> list = new ArrayList<>();
while (rs.next()) {
Product product = new Product();
product.setProductID(rs.getLong("product_id"));
product.setProductname(rs.getString("product_name"));
product.setImg(rs.getString("product_img"));
product.setDetail(rs.getString("detail"));
list.add(product);
}
return list;
}
public Product getProduct(long productID) throws SQLException {
Connection connection = DBconnect.getConnecttion();
String sql = "SELECT * FROM product WHERE product_id = '" + productID + "'";
PreparedStatement ps = connection.prepareCall(sql);
ResultSet rs = ps.executeQuery();
Product product = new Product();
while (rs.next()) {
product.setProductID(rs.getLong("product_id"));
product.setProductname(rs.getString("product_name"));
product.setImg(rs.getString("product_img"));
product.setDetail(rs.getString("detail"));
}
return product;
}
// them du lieu
public boolean insert(Product c) throws SQLException {
Connection connection = DBconnect.getConnecttion();
String sql = "INSERT INTO product VALUES (?,?,?,?,?)";
try {
PreparedStatement ps = connection.prepareCall(sql);
ps.setLong(1, c.getProductID());
ps.setString(2, c.getProductname());
ps.setString(3, c.getImg());
ps.setLong(4, c.getCategoryID());
ps.setString(5, c.getDetail());
int temp = ps.executeUpdate();
return temp == 1;
} catch (SQLException ex) {
//Logger.getLogger(ProductDAO.class.getName()).log(Level.SEVERE,null,ex);
return false;
}
}
public boolean update(Product c) throws SQLException {
try {
Connection connection = DBconnect.getConnecttion();
String sql = "UPDATE product SET product_name = ? , product_img = ? , detail = ? WHERE product_id = ?";
PreparedStatement ps = connection.prepareCall(sql);
ps.setString(1, c.getProductname());
ps.setString(2, c.getImg());
ps.setString(3, c.getDetail());
ps.setLong(4, c.getProductID());
//ps.setLong(5, c.getCategoryID());
int temp = ps.executeUpdate();
return temp == 1;
} catch (Exception ex) {
return false;
}
}
public boolean delete(long product_id) throws SQLException {
try {
Connection connection = DBconnect.getConnecttion();
String sql = "DELETE FROM product WHERE product_id = ?";
PreparedStatement ps = connection.prepareCall(sql);
ps.setLong(1, product_id);
int temp = ps.executeUpdate();
return temp == 1;
} catch (Exception e) {
return false;
}
}
public static void main(String[] args) throws SQLException {
ProductDAO dao = new ProductDAO();
}
}
| [
"luuvinhhung159@gmail.com"
] | luuvinhhung159@gmail.com |
e74e9ba358ccdce40d9f63ef1d207d7d4ea1b16e | f902b0dda3de3809646653f50a74e8e79714950d | /01. Getting Started/06. Interacting with Other Apps/OtherAppsInteraction/app/src/test/java/com/codeburrow/otherappsinteraction/ExampleUnitTest.java | beab119db4f9a538222b1d1240ce416e12bba180 | [] | no_license | george-sp/android_develop_training | 2c5526c25ca51774cbaeef5dadc3f7b6e7bd98c6 | 0ec557879c1695bc64233acda6bc4b4181753a08 | refs/heads/master | 2020-12-21T22:07:22.267493 | 2016-08-16T11:35:50 | 2016-08-16T11:36:52 | 58,736,613 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package com.codeburrow.otherappsinteraction;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"spiridakis.grg@gmail.com"
] | spiridakis.grg@gmail.com |
11efbb75099d548d6366590e8cc841c03281bcc9 | 8ffeba718f090a905341f94056a088c734f9aa1b | /src/main/java/com/akalanka/springangular/lecturemanagement/serviceImp/LectureHallServiceImp.java | dd0a1ec3778512ef31edf38aa429e1ea72a82483 | [] | no_license | akalanka95/LectureManagement-Rest-Api-Angular-2- | a1ab28303958ab5233b1f738a0a7680a1b882823 | 03032daef2c2ad29a37fe24d5b3b14535c7b21fa | refs/heads/master | 2020-03-09T06:51:52.075545 | 2018-04-13T03:30:53 | 2018-04-13T03:30:53 | 128,650,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,171 | java | package com.akalanka.springangular.lecturemanagement.serviceImp;
import com.akalanka.springangular.lecturemanagement.dao.LectureHallDao;
import com.akalanka.springangular.lecturemanagement.dto.Lecture;
import com.akalanka.springangular.lecturemanagement.dto.LectureHall;
import com.akalanka.springangular.lecturemanagement.service.LectureHallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service("lectureHallService")
public class LectureHallServiceImp implements LectureHallService {
@Autowired
private LectureHallDao lectureHallDao;
@Override
public Iterable<LectureHall> list() {
return this.lectureHallDao.findAll();
}
@Override
public LectureHall save(LectureHall lectureHall) {
return this.lectureHallDao.save(lectureHall);
}
@Override
public void delete(Integer id) {
this.lectureHallDao.deleteById(id);
}
@Override
public LectureHall findById(Integer id) {
Optional<LectureHall> lectureHall = this.lectureHallDao.findById(id);
return lectureHall.get();
}
}
| [
"akalankamaduka95@gmail.com"
] | akalankamaduka95@gmail.com |
333266fb46a5b9c6916f2ca6f5113cca7a199eca | 0418e9d7059c894836b9266cabefa9558e5a7b47 | /Project/Unit2/Unit2_PartA/src/indi/yuanyuam/proj1/driver/TestException.java | 5a3fa166a75d57e49e21dad853330419e110f6de | [] | no_license | JasmineOnly/Java-Smart-Phone-Development | 998a011b125d18894c6aeea963de7976a8ce7553 | f2e4ab6ee7a0078fa6b2561cb9da20756c202b51 | refs/heads/master | 2016-09-05T11:25:13.364532 | 2015-10-07T21:25:31 | 2015-10-07T21:25:31 | 42,184,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | java | package indi.yuanyuam.proj1.driver;
import indi.yuanyuam.proj1.exception.*;
import indi.yuanyuam.proj1.adapter.*;
import indi.yuanyuam.proj1.model.*;
public class TestException {
public static void main(String[] args) {
BuildAuto auto = new BuildAuto();
System.out.println("****** Test AutoException *******");
auto.buildAuto("FocusWagonZTW 002.txt");
auto.printAuto("Focus Wagon ZTW");
}
}
| [
"yuanyuam@andrew.cmu.edu"
] | yuanyuam@andrew.cmu.edu |
716dab40f0afa41fd2f262327a8db40fbda0fd05 | 3106b762670ffdd9ada9b49e455eb30270a99aad | /C2H6O/app/src/main/java/com/example/team1288/c2h6o/App.java | 5ea19e0f60240a201d58e3d92264348542fdfa6e | [] | no_license | ssoso27/C2H6O | 4400c5bb9766c03809f5fc57c74de871423d6256 | e1bd951203b9d4886cea4f1352a0af0fa732c473 | refs/heads/master | 2021-01-24T06:42:56.614045 | 2017-11-09T21:28:55 | 2017-11-09T21:28:55 | 93,313,555 | 0 | 0 | null | 2017-06-04T12:57:50 | 2017-06-04T12:57:50 | null | UTF-8 | Java | false | false | 657 | java | package com.example.team1288.c2h6o;
import android.app.Application;
import com.tsengvn.typekit.Typekit;
/**
* Created by ssoso on 2017-11-08.
*/
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
Typekit.getInstance()
.addNormal(Typekit.createFromAsset(this, "fonts/동그라미재단M.ttf"))
.addBold(Typekit.createFromAsset(this, "fonts/동그라미재단M.ttf"))
.addCustom1(Typekit.createFromAsset(this, "fonts/JejuHallasan.ttf"))
.addCustom2(Typekit.createFromAsset(this, "fonts/Spoqa Han Sans Light.ttf"));
}
}
| [
"sohi8290@jejunu.ac.kr"
] | sohi8290@jejunu.ac.kr |
bc44dc1f8a917492b0d9b6e6bba5930f063ed844 | 52d17d7eb9007e3371288b16fa595c727a6693d3 | /src/gr/hua/hellu/GUI/ApplicationForm.java | 9c3c4f8c60acfa9181f3036e7028c094b576f2d3 | [] | no_license | moujan/hellu | 6382ef0b6ec6372a80f380010334ded1460cbad7 | 0c8fdf6138fa08b21e6f393f9a0b7d04e13d3e11 | refs/heads/master | 2022-05-01T11:25:56.257727 | 2022-04-11T11:02:09 | 2022-04-11T11:02:09 | 9,283,335 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 82,942 | java |
package gr.hua.hellu.GUI;
import gr.hua.hellu.Objects.CitedPublication;
import gr.hua.hellu.Objects.Publication;
import gr.hua.hellu.processData.Charts.AxisChart;
import gr.hua.hellu.processData.Charts.CreateDatasets;
import gr.hua.hellu.processData.Compare.CitationType;
import gr.hua.hellu.processData.Metrics.Metrics;
import gr.hua.hellu.processData.externalFiles.ExportFile;
import gr.hua.hellu.searchData.googleResults.DataFromCitations;
import gr.hua.hellu.searchData.googleResults.DataFromPublications;
import gr.hua.hellu.searchData.googleResults.Extract;
import gr.hua.hellu.searchData.googleResults.GoogleRequest;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Formatter;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
/**
*
* @author Moulou
* @version 1.0
* contact me: moujan21@gmail.com
* site: www.dit.hua.gr/~it20818/
*/
public class ApplicationForm extends javax.swing.JFrame {
/**
* Creates new form ApplicationForm
*/
public ApplicationForm() {
BufferedImage image = null;
try {
File imageFile = new File("applicationlogo.png");
image = ImageIO.read(imageFile);
} catch (IOException ex) {
Logger.getLogger(ApplicationForm.class.getName()).log(Level.SEVERE, null, ex);
}
this.setIconImage(image);
initComponents();
//window
this.addWindowListener(new windowCloseListener());
//listeners for menu
this.addMenuListeners();
//Search Panel listeners
this.searchButton.addActionListener(new SearchButtonActionListener());
this.searchButton.addKeyListener(new SearchButtonKeyListener());
this.AuthorTextField.addKeyListener(new AuthorInputTextKeyListener());
//creat Tables
this.createMainTable();
this.createHeteroCitationsTable();
this.createSelfCitationsTable();
//properties for components
PrBar.setVisible(false);
searchingLabel.setVisible(false);
Labelous.setVisible(false);
timeElapsedLabel.setVisible(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
SearchPanel = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
AuthorTextField = new javax.swing.JTextField();
searchButton = new javax.swing.JButton();
MainTable = new javax.swing.JScrollPane();
publicationsTbl = new javax.swing.JTable();
ForeignTable = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
SelfCitationsTbl = new javax.swing.JTable();
jScrollPane2 = new javax.swing.JScrollPane();
HeteroCitationsTbl = new javax.swing.JTable();
SummaryPanel = new javax.swing.JPanel();
jPanel12 = new javax.swing.JPanel();
jPanel10 = new javax.swing.JPanel();
numSCLabel = new javax.swing.JLabel();
numHCLabel = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
numPLabel = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
AuthorLabel = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
numCLabel = new javax.swing.JLabel();
jPanel11 = new javax.swing.JPanel();
jLabel12 = new javax.swing.JLabel();
hindexHCLabel = new javax.swing.JLabel();
gindexCLabel = new javax.swing.JLabel();
arindexCLabel = new javax.swing.JLabel();
jLabel21 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
gindexHCLabel = new javax.swing.JLabel();
arindexHCLabel = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
hindexCLabel = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jPanel13 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jPanel2 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jLabel15 = new javax.swing.JLabel();
PDetailsYearLabel = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
PDetailsAuthorsLabel = new javax.swing.JLabel();
jPanel6 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
PDetailsTitleLabel = new javax.swing.JLabel();
jScrollPane4 = new javax.swing.JScrollPane();
jPanel3 = new javax.swing.JPanel();
jPanel7 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
CDetailsTitleLabel = new javax.swing.JLabel();
jPanel8 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
CDetailsAuthorsLabel = new javax.swing.JLabel();
jPanel9 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
CDetailsYearLabel = new javax.swing.JLabel();
StatusPanel = new javax.swing.JPanel();
Labelous = new javax.swing.JLabel();
timeElapsedLabel = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
PrBar = new javax.swing.JProgressBar();
searchingLabel = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
ExportResultsMenuChoice = new javax.swing.JMenuItem();
exitMenuChoice = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenu5 = new javax.swing.JMenu();
publicationsChartMenuItem = new javax.swing.JMenuItem();
heteroChartMenuItem = new javax.swing.JMenuItem();
selfChartMenuItem = new javax.swing.JMenuItem();
CitationsMenuItem = new javax.swing.JMenuItem();
h = new javax.swing.JMenu();
AboutMenu = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setTitle("HL Application");
getContentPane().setLayout(new java.awt.GridLayout(1, 0));
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel1.setText("Author's name:");
AuthorTextField.setToolTipText(toolTipInputAuthor);
searchButton.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
searchButton.setText("Search");
javax.swing.GroupLayout SearchPanelLayout = new javax.swing.GroupLayout(SearchPanel);
SearchPanel.setLayout(SearchPanelLayout);
SearchPanelLayout.setHorizontalGroup(
SearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(SearchPanelLayout.createSequentialGroup()
.addGap(60, 60, 60)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(AuthorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(searchButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
SearchPanelLayout.setVerticalGroup(
SearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SearchPanelLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(SearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(AuthorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(searchButton))
.addContainerGap())
);
MainTable.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true), javax.swing.BorderFactory.createEtchedBorder()))), "Publications", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N
publicationsTbl.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{}
},
new String [] {
}
));
publicationsTbl.setRowHeight(20);
publicationsTbl.setRowMargin(2);
publicationsTbl.getTableHeader().setReorderingAllowed(false);
MainTable.setViewportView(publicationsTbl);
ForeignTable.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true), javax.swing.BorderFactory.createEtchedBorder()))), "Citations", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N
ForeignTable.setLayout(new java.awt.GridLayout(1, 0));
jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Self-citations", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
SelfCitationsTbl.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{}
},
new String [] {
}
));
SelfCitationsTbl.setRowHeight(20);
SelfCitationsTbl.setRowMargin(2);
SelfCitationsTbl.getTableHeader().setReorderingAllowed(false);
jScrollPane3.setViewportView(SelfCitationsTbl);
ForeignTable.add(jScrollPane3);
jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Hetero-citations", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
HeteroCitationsTbl.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{}
},
new String [] {
}
));
HeteroCitationsTbl.setMaximumSize(new java.awt.Dimension(200, 16));
HeteroCitationsTbl.setRowHeight(20);
HeteroCitationsTbl.setRowMargin(2);
HeteroCitationsTbl.getTableHeader().setReorderingAllowed(false);
jScrollPane2.setViewportView(HeteroCitationsTbl);
ForeignTable.add(jScrollPane2);
jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Summary", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N
jPanel10.setBackground(new java.awt.Color(239, 255, 255));
jPanel10.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true)), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true), javax.swing.BorderFactory.createEtchedBorder()))));
numSCLabel.setText("-");
numHCLabel.setText("-");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel2.setText("Author:");
jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel8.setText("Self-citations:");
numPLabel.setText("-");
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel3.setText("Publications:");
AuthorLabel.setText("-");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel4.setText("Citations:");
jLabel9.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel9.setText("Hetero-citations:");
numCLabel.setText("-");
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(AuthorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE))
.addGroup(jPanel10Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(numPLabel))
.addGroup(jPanel10Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(numSCLabel))
.addGroup(jPanel10Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(numHCLabel))
.addGroup(jPanel10Layout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(6, 6, 6)
.addComponent(numCLabel)))
.addContainerGap())
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(AuthorLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(numPLabel)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(numCLabel))
.addGap(11, 11, 11)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(numSCLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(numHCLabel)
.addComponent(jLabel9))
.addContainerGap(24, Short.MAX_VALUE))
);
jPanel11.setBackground(new java.awt.Color(239, 255, 255));
jPanel11.setBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true), new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED))))));
jLabel12.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel12.setText("h-index:");
hindexHCLabel.setText("-");
gindexCLabel.setText("-");
arindexCLabel.setText("-");
jLabel21.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel21.setText("Citations");
jLabel14.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel14.setText("AR-index:");
gindexHCLabel.setText("-");
arindexHCLabel.setText("-");
jLabel13.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel13.setText("g-index:");
hindexCLabel.setText("-");
jLabel22.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel22.setText("Hetero-citations");
javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
jPanel11.setLayout(jPanel11Layout);
jPanel11Layout.setHorizontalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel12)
.addGap(30, 30, 30)
.addComponent(hindexCLabel)
.addGap(86, 86, 86)
.addComponent(hindexHCLabel))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel13)
.addGap(30, 30, 30)
.addComponent(gindexCLabel)
.addGap(86, 86, 86)
.addComponent(gindexHCLabel))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(2, 2, 2)
.addComponent(jLabel14)
.addGap(30, 30, 30)
.addComponent(arindexCLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(40, 40, 40)
.addComponent(arindexHCLabel))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(67, 67, 67)
.addComponent(jLabel21)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel22)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel11Layout.setVerticalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(16, 16, 16)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel21)
.addComponent(jLabel22))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(hindexCLabel)
.addComponent(hindexHCLabel))
.addGap(5, 5, 5)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel13)
.addComponent(gindexCLabel)
.addComponent(gindexHCLabel))
.addGap(5, 5, 5)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(arindexCLabel)
.addComponent(arindexHCLabel))
.addContainerGap(50, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
jPanel12.setLayout(jPanel12Layout);
jPanel12Layout.setHorizontalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel12Layout.setVerticalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(""), "Details", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N
jPanel13.setLayout(new java.awt.GridLayout(1, 0));
jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true))), "Publication", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
jPanel2.setBackground(new java.awt.Color(255, 255, 255));
jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel4.setBackground(new java.awt.Color(255, 255, 255));
jPanel4.setPreferredSize(new java.awt.Dimension(100, 48));
jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel15.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel15.setText("Year:");
jPanel4.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
PDetailsYearLabel.setText("-");
jPanel4.add(PDetailsYearLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 0, 90, -1));
jPanel2.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, 190, 20));
jPanel5.setBackground(new java.awt.Color(255, 255, 255));
jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel10.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel10.setText("Authors:");
jPanel5.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
PDetailsAuthorsLabel.setText("-");
jPanel5.add(PDetailsAuthorsLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 0, -1, -1));
jPanel2.add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, 20));
jPanel6.setBackground(new java.awt.Color(255, 255, 255));
jPanel6.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel11.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel11.setText("Title:");
jPanel6.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
PDetailsTitleLabel.setText("-");
jPanel6.add(PDetailsTitleLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 0, -1, -1));
jPanel2.add(jPanel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, 20));
jScrollPane1.setViewportView(jPanel2);
jPanel13.add(jScrollPane1);
jScrollPane4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true))), "Citation ", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
jPanel3.setBackground(new java.awt.Color(255, 255, 255));
jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel7.setBackground(new java.awt.Color(255, 255, 255));
jPanel7.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel5.setText("Title:");
jPanel7.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
CDetailsTitleLabel.setText("-");
jPanel7.add(CDetailsTitleLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 0, -1, -1));
jPanel3.add(jPanel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, 20));
jPanel8.setBackground(new java.awt.Color(255, 255, 255));
jPanel8.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel6.setText("Authors:");
jPanel8.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
CDetailsAuthorsLabel.setText("-");
jPanel8.add(CDetailsAuthorsLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 0, -1, -1));
jPanel3.add(jPanel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, 20));
jPanel9.setBackground(new java.awt.Color(255, 255, 255));
jPanel9.setPreferredSize(new java.awt.Dimension(100, 48));
jPanel9.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel7.setText("Year:");
jPanel9.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
CDetailsYearLabel.setText("-");
jPanel9.add(CDetailsYearLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 0, 100, -1));
jPanel3.add(jPanel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, 170, 20));
jScrollPane4.setViewportView(jPanel3);
jPanel13.add(jScrollPane4);
javax.swing.GroupLayout SummaryPanelLayout = new javax.swing.GroupLayout(SummaryPanel);
SummaryPanel.setLayout(SummaryPanelLayout);
SummaryPanelLayout.setHorizontalGroup(
SummaryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(SummaryPanelLayout.createSequentialGroup()
.addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, 467, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
SummaryPanelLayout.setVerticalGroup(
SummaryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
);
Labelous.setText("Time Elapsed:");
timeElapsedLabel.setText("-");
searchingLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
searchingLabel.setText("searching...");
javax.swing.GroupLayout StatusPanelLayout = new javax.swing.GroupLayout(StatusPanel);
StatusPanel.setLayout(StatusPanelLayout);
StatusPanelLayout.setHorizontalGroup(
StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(StatusPanelLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(Labelous, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(4, 4, 4)
.addComponent(timeElapsedLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(118, 118, 118)
.addComponent(searchingLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(12, 12, 12)
.addComponent(PrBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(4, 4, 4))
.addComponent(jSeparator2)
);
StatusPanelLayout.setVerticalGroup(
StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(StatusPanelLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Labelous)
.addComponent(timeElapsedLabel)
.addComponent(searchingLabel)
.addComponent(PrBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(MainTable, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ForeignTable, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 1039, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(StatusPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(SearchPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(SummaryPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(15, 15, 15))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(SearchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(MainTable, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ForeignTable, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(SummaryPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(StatusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(25, 25, 25))
);
getContentPane().add(jPanel1);
jMenu1.setText("File");
ExportResultsMenuChoice.setText("Export Results");
jMenu1.add(ExportResultsMenuChoice);
exitMenuChoice.setText("Exit");
jMenu1.add(exitMenuChoice);
jMenuBar1.add(jMenu1);
jMenu2.setText("View");
jMenu5.setText("Charts");
publicationsChartMenuItem.setText("Publications per Year");
jMenu5.add(publicationsChartMenuItem);
heteroChartMenuItem.setText("Hetero-Citations per Year");
jMenu5.add(heteroChartMenuItem);
selfChartMenuItem.setText("Self-Citations per Year");
jMenu5.add(selfChartMenuItem);
CitationsMenuItem.setText("Combine Citations");
jMenu5.add(CitationsMenuItem);
jMenu2.add(jMenu5);
jMenuBar1.add(jMenu2);
h.setText("Help");
AboutMenu.setText("About...");
AboutMenu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AboutMenuActionPerformed(evt);
}
});
h.add(AboutMenu);
jMenuBar1.add(h);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>//GEN-END:initComponents
private void AboutMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AboutMenuActionPerformed
AboutPanel about = new AboutPanel(this, true);
about.setVisible(true);
}//GEN-LAST:event_AboutMenuActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (ClassNotFoundException ex) {
Logger.getLogger(ApplicationForm.class.getName()).log(Level.SEVERE, null, ex);
}catch (InstantiationException ex) {
Logger.getLogger(ApplicationForm.class.getName()).log(Level.SEVERE, null, ex);
}catch ( IllegalAccessException ex) {
Logger.getLogger(ApplicationForm.class.getName()).log(Level.SEVERE, null, ex);
}catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(ApplicationForm.class.getName()).log(Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new ApplicationForm().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem AboutMenu;
private javax.swing.JLabel AuthorLabel;
private javax.swing.JTextField AuthorTextField;
private javax.swing.JLabel CDetailsAuthorsLabel;
private javax.swing.JLabel CDetailsTitleLabel;
private javax.swing.JLabel CDetailsYearLabel;
private javax.swing.JMenuItem CitationsMenuItem;
private javax.swing.JMenuItem ExportResultsMenuChoice;
private javax.swing.JPanel ForeignTable;
private javax.swing.JTable HeteroCitationsTbl;
private javax.swing.JLabel Labelous;
private javax.swing.JScrollPane MainTable;
private javax.swing.JLabel PDetailsAuthorsLabel;
private javax.swing.JLabel PDetailsTitleLabel;
private javax.swing.JLabel PDetailsYearLabel;
private javax.swing.JProgressBar PrBar;
private javax.swing.JPanel SearchPanel;
private javax.swing.JTable SelfCitationsTbl;
private javax.swing.JPanel StatusPanel;
private javax.swing.JPanel SummaryPanel;
private javax.swing.JLabel arindexCLabel;
private javax.swing.JLabel arindexHCLabel;
private javax.swing.JMenuItem exitMenuChoice;
private javax.swing.JLabel gindexCLabel;
private javax.swing.JLabel gindexHCLabel;
private javax.swing.JMenu h;
private javax.swing.JMenuItem heteroChartMenuItem;
private javax.swing.JLabel hindexCLabel;
private javax.swing.JLabel hindexHCLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JLabel numCLabel;
private javax.swing.JLabel numHCLabel;
private javax.swing.JLabel numPLabel;
private javax.swing.JLabel numSCLabel;
private javax.swing.JMenuItem publicationsChartMenuItem;
private javax.swing.JTable publicationsTbl;
private javax.swing.JButton searchButton;
private javax.swing.JLabel searchingLabel;
private javax.swing.JMenuItem selfChartMenuItem;
private javax.swing.JLabel timeElapsedLabel;
// End of variables declaration//GEN-END:variables
//global variables and methods
protected Thread myThread;
private double START;
private double END;
private ArrayList <CitedPublication> Publications;
private ArrayList<CitedPublication> keepIncludedOnly() {
ArrayList <CitedPublication> pureList = new ArrayList <CitedPublication>();
boolean isExcluded = false;
for ( int i = 0; i < Publications.size(); i++ ){
for ( int j = 0; j < ExcludeIndexes.size(); j++ ){
if ( i == ExcludeIndexes.get(j)){
isExcluded = true;
}
}
if( isExcluded )
isExcluded = false;
else
pureList.add(Publications.get(i));
}
return pureList;
}
private void clearExcluded() {
for ( int i = 0; i < ExcludeIndexes.size(); i++ ){
for ( int j = 0; j < ExcludeIndexes.size(); j++ ){
if ( i == j )continue;
if (ExcludeIndexes.get(i) == ExcludeIndexes.get(j)){
ExcludeIndexes.remove(j);
}
}
}
}
private class MainThread implements Runnable {
@Override
public void run() {
try {
startSearching();
} catch (IOException ex) {
Logger.getLogger(ApplicationForm.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
private void setTimeEllapsed(){
double timeEllapsed = END - START;
BigDecimal d = new BigDecimal(timeEllapsed);
BigDecimal seconds = d.divide(new BigDecimal(1000));
BigDecimal hours = new BigDecimal(0), minutes = new BigDecimal(0);
Formatter secondsFormat = new Formatter();
//set hours
//seconds greater than 3600
if ( seconds.compareTo(new BigDecimal(3600)) == 1 ){
hours = seconds.divideToIntegralValue(new BigDecimal(3600));
seconds = seconds.add(hours.multiply(new BigDecimal(3600)).negate());
}
//set minutes
//seconds greater than 60
if ( seconds.compareTo(new BigDecimal(60)) == 1 ){
minutes = seconds.divideToIntegralValue(new BigDecimal(60));
seconds = seconds.add(minutes.multiply(new BigDecimal(60)).negate());
}
secondsFormat.format("%.2f", seconds);
System.out.println(hours.intValue() + " hrs "+ minutes.intValue() + " min " + secondsFormat.toString() + " sec");
timeElapsedLabel.setText(hours.intValue() + " hrs "+ minutes.intValue() + " min " + secondsFormat.toString() + " sec");
}
private void setDefaultDetails(){
PDetailsTitleLabel.setText("-");
PDetailsAuthorsLabel.setText("-");
PDetailsYearLabel.setText("-");
jPanel2.repaint();
jPanel2.revalidate();
CDetailsTitleLabel.setText("-");
CDetailsAuthorsLabel.setText("-");
CDetailsYearLabel.setText("-");
jPanel3.repaint();
jPanel3.revalidate();
}
private void startSearching()throws IOException{
clearTables(true);
setDefaultDetails();
searchingLabel.setText("Searching...");
searchingLabel.repaint();
searchButton.setEnabled(false);
AuthorTextField.setEnabled(false);
PrBar.setValue(0);
PrBar.setVisible(true);
searchingLabel.setVisible(true);
Labelous.setVisible(false);
timeElapsedLabel.setVisible(false);
setDefaultSummary();
repaintSummary();
PrBar.setIndeterminate(true);
START = (double)System.currentTimeMillis();
ArrayList<String> Lista = new ArrayList<String>();
Publications = new ArrayList<CitedPublication>();
//HttpRequest.ParseQueryToGoogleScholarForAuthor(Lista, AuthorTextField.getText(), HttpRequest.AUTHOR);
GoogleRequest request = new GoogleRequest(AuthorTextField.getText());
Lista = request.getPublications(true);
if ( Lista.isEmpty() ){
AuthorTextField.setEnabled(true);
searchButton.setEnabled(true);
PrBar.setIndeterminate(false);
PrBar.setVisible(false);
searchingLabel.setVisible(false);
Labelous.setVisible(true);
timeElapsedLabel.setVisible(true);
JOptionPane.showMessageDialog(this, "Service unavailable", "Cannot process queries.", JOptionPane.ERROR_MESSAGE);
return;
}
//here we have the publications for the author with their data ( type, name, site, citations, authors.... )
DataFromPublications dataP = new DataFromPublications(Lista);
Publications = dataP.parseData();
PrBar.setIndeterminate(false);
int valueBar = 25;
PrBar.setValue(valueBar);
PrBar.repaint();
//now we have to see the citations for each publication,
//compare the authors between each citation and the specific publication and
//export - separate citations (self-cited and hetero-cited publications)
for (int i = 0; i < Publications.size(); i++) {
searchingLabel.setText("Retrieving data, "+ (Publications.size() - i)+" remaining");
searchingLabel.repaint();
ArrayList<Publication> citations = new ArrayList<Publication>();
ArrayList<String> CitationList = new ArrayList<String>();
GoogleRequest request2 = new GoogleRequest(Publications.get(i).getHrefCitations());
CitationList = request2.getPublications(false);
if ( CitationList != null ){
//HttpParse.httpExportDataForCitations(CitationList, citations);
DataFromCitations parse = new DataFromCitations(CitationList);
citations = parse.parseData();
//set correct year for citations
Extract.cleanData(Publications.get(i), citations);
//here we can see the comparison for the authors
CitationType compare = new CitationType(Publications.get(i), citations);
compare.setCitationType();
Publications.remove(i);
Publications.add(i, compare.getCitedPulication());
}
//updateTable
Object [] o;
if( Publications.get(i).getYear() == 0 ){
o = new Object[]{true,Publications.get(i).getTitle(), Publications.get(i).printAuthors()
, "Unknown year", Publications.get(i).getCitations()};
}else
o = new Object[]{true,Publications.get(i).getTitle(), Publications.get(i).printAuthors()
, Publications.get(i).getYear(), Publications.get(i).getCitations()};
publicationsTblModel.addRow(o);
valueBar += 75 / Publications.size();
PrBar.setValue(valueBar);
PrBar.repaint();
publicationsTbl.revalidate();
publicationsTbl.repaint();
}
END = (double)System.currentTimeMillis();
setTimeEllapsed();
AUTHOR = AuthorTextField.getText();
AuthorTextField.setEnabled(true);
searchButton.setEnabled(true);
PrBar.setVisible(false);
searchingLabel.setVisible(false);
Labelous.setVisible(true);
timeElapsedLabel.setVisible(true);
ExcludeIndexes = new ArrayList<Integer>();
// PublicationForSummary = Publications;
// delete = new ModifyList(Publications);
setSummary();
repaintSummary();
}
//window application
private void openExitChoiceForWindow(WindowEvent we){
JFrame frame = (JFrame)we.getSource();
int result = JOptionPane.showConfirmDialog(
frame,
"Are you sure you want to exit the application?",
"Exit Application",
JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION)
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
private class windowCloseListener extends WindowAdapter{
@Override
public void windowClosing(WindowEvent we) {
openExitChoiceForWindow(we);
}
}
//end window application
//Menu Panel variable and methods
private void openExportResults(){
if (AUTHOR == null) {
JOptionPane.showMessageDialog(this, "There isn't any author to export results.", "No author found.", JOptionPane.WARNING_MESSAGE);
} else if (myThread.isAlive()) {
JOptionPane.showMessageDialog(this, "Process on work", "Unable to export file.", JOptionPane.WARNING_MESSAGE);
} else {
JFileChooser fileChooser = new JFileChooser(".");
fileChooser.setAcceptAllFileFilterUsed(false);
FileNameExtensionFilter filter = new FileNameExtensionFilter(
"bibTex file", "bib");
FileNameExtensionFilter fil = new FileNameExtensionFilter("XML file", "xml");
fileChooser.setFileFilter(filter);
fileChooser.addChoosableFileFilter(fil);
int option = fileChooser.showSaveDialog(this);
if (option == JFileChooser.APPROVE_OPTION) {
clearExcluded();
ArrayList<CitedPublication> PureList = keepIncludedOnly();
String selectedFile = fileChooser.getSelectedFile().getAbsolutePath();
if ( fileChooser.getFileFilter().getDescription().equals("XML file") ){
ExportFile.createXMLFILE(PureList, AUTHOR, selectedFile);
}
else{
ExportFile.createBibTexFile(PureList, selectedFile);
}
}
}
}
private class ExportResultsActionListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
openExportResults();
}
}
private void openExitChoice(){
int result = JOptionPane.showConfirmDialog(
this,
"Are you sure you want to exit the application?",
"Exit Application",
JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION)
System.exit(0);
}
private class ExitActionListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
openExitChoice();
}
}
private void openPublicationsChart(){
if (AUTHOR == null) {
JOptionPane.showMessageDialog(this, "There isn't any author to show chart.", "Unable to show chart.", JOptionPane.WARNING_MESSAGE);
} else if (myThread.isAlive()) {
JOptionPane.showMessageDialog(this, "Process on work", "Unable to show chart.", JOptionPane.WARNING_MESSAGE);
} else {
ArrayList<CitedPublication> PureList = keepIncludedOnly();
int [][] result = CreateDatasets.createArrayDataYear(PureList, "PUBLICATION");
String [] bars = new String[1];
bars[0] = "Publication";
AxisChart chart = new AxisChart("Publication chart", "Publication per Year", result, bars, "Publications");
chart.pack();
chart.setLocation(this.getX() + this.getHeight() / 2 - chart.getHeight() / 2, this.getY() + this.getWidth() / 2 - chart.getWidth() / 2);
chart.setVisible(true);
}
}
private class PublicationChartActionListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
openPublicationsChart();
}
}
private void openHeteroChart(){
if (AUTHOR == null) {
JOptionPane.showMessageDialog(this, "There isn't any author to show chart.", "Unable to show chart.", JOptionPane.WARNING_MESSAGE);
} else if (myThread.isAlive()) {
JOptionPane.showMessageDialog(this, "Process on work", "Unable to show chart.", JOptionPane.WARNING_MESSAGE);
} else {
clearExcluded();
ArrayList<CitedPublication> PureList = keepIncludedOnly();
int [][] result = CreateDatasets.createArrayDataYear(PureList, "HETERO");
String [] bars = new String[1];
bars[0] = "Hetero - citation";
AxisChart chart = new AxisChart("Hetero-Citation chart", "Citations per Year", result, bars, "Citations");
chart.pack();
chart.setLocation(this.getX() + this.getHeight() / 2 - chart.getHeight() / 2, this.getY() + this.getWidth() / 2 - chart.getWidth() / 2);
chart.setVisible(true);
}
}
private class HeteroChartActionListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
openHeteroChart();
}
}
private void openSelfChart(){
if (AUTHOR == null) {
JOptionPane.showMessageDialog(this, "There isn't any author to show chart.", "Unable to show chart.", JOptionPane.WARNING_MESSAGE);
} else if (myThread.isAlive()) {
JOptionPane.showMessageDialog(this, "Process on work", "Unable to show chart.", JOptionPane.WARNING_MESSAGE);
} else {
clearExcluded();
ArrayList<CitedPublication> PureList = keepIncludedOnly();
int [][] result = CreateDatasets.createArrayDataYear(PureList, "SELF");
String [] bars = new String[1];
bars[0] = "Self - citation";
AxisChart chart = new AxisChart("Self-Citation chart", "Citations per Year", result, bars, "Citations");
chart.pack();
chart.setLocation(this.getX() + this.getHeight() / 2 - chart.getHeight() / 2, this.getY() + this.getWidth() / 2 - chart.getWidth() / 2);
chart.setVisible(true);
}
}
private class SelfChartActionListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
openSelfChart();
}
}
private void openCombine(){
if (AUTHOR == null) {
JOptionPane.showMessageDialog(this, "There isn't any author to show chart.", "Unable to show chart.", JOptionPane.WARNING_MESSAGE);
} else if (myThread.isAlive()) {
JOptionPane.showMessageDialog(this, "Process on work", "Unable to show chart.", JOptionPane.WARNING_MESSAGE);
} else {
clearExcluded();
ArrayList<CitedPublication> PureList = keepIncludedOnly();
int [][] result1 = CreateDatasets.createArrayDataYear(PureList, "SELF");
int [][] result2 = CreateDatasets.createArrayDataYear(PureList, "HETERO");
int [][] result = CreateDatasets.mergeData(result1, result2);
String [] bars = new String[2];
bars[0] = "Self - citation";
bars[1] = "Hetero - citation";
AxisChart chart = new AxisChart("Combine Citation chart", "Citations per Year", result, bars, "Citations");
chart.pack();
chart.setLocation(this.getX() + this.getHeight() / 2 - chart.getHeight() / 2, this.getY() + this.getWidth() / 2 - chart.getWidth() / 2);
chart.setVisible(true);
}
}
private class CombineCitationsActionListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
openCombine();
}
}
private void addMenuListeners(){
ExportResultsMenuChoice.addActionListener(new ExportResultsActionListener());
exitMenuChoice.addActionListener(new ExitActionListener());
publicationsChartMenuItem.addActionListener(new PublicationChartActionListener());
heteroChartMenuItem.addActionListener(new HeteroChartActionListener());
selfChartMenuItem.addActionListener(new SelfChartActionListener());
CitationsMenuItem.addActionListener(new CombineCitationsActionListener());
}
//End Menu Panel
//Search Panel variables methods
protected boolean Valid_Insert;
final private String toolTipInputAuthor = "<html><body>Only letters are allowed.<br/>e.g. Mouzos L, or Mouzos Loukas.</body></html>";
private class SearchButtonActionListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
runSearch();
}
}
private class SearchButtonKeyListener extends KeyAdapter {
@Override
public void keyPressed(KeyEvent e) {
if ( e.getKeyCode() == KeyEvent.VK_ENTER ){
runSearch();
}
}
}
private class AuthorInputTextKeyListener extends KeyAdapter {
@Override
public void keyPressed(KeyEvent e) {
if ( e.getKeyCode() == KeyEvent.VK_ENTER ){
runSearch();
}
}
}
private void runSearch(){
String input = AuthorTextField.getText();
Valid_Insert = isInsertValid(input);
if (!input.equals("")) {
if (!Valid_Insert) {
JOptionPane.showMessageDialog(this, "Only letters are allowed.", "Wrong Input", JOptionPane.WARNING_MESSAGE);
} else {
myThread = new Thread(new MainThread());
myThread.start();
}
} else {
JOptionPane.showMessageDialog(this, "You must enter something!", "Error Entry", JOptionPane.WARNING_MESSAGE);
}
}
private boolean isInsertValid(String text) {
for (int i = 0; i < text.length(); i++) {
if (!Character.isLetter(text.charAt(i)) && !Character.isSpaceChar(text.charAt(i))) {
return false;
}
}
return true;
}
//end Search Panel!!!!!!!!!!
//Tables
protected DefaultTableModel publicationsTblModel;
protected DefaultTableModel heterocitationsTblModel;
protected DefaultTableModel selfcitationsTblModel;
private int lastSelectedPub;
private int lastSelectedHCite;
private int lastSelectedSCite;
private final String selectSite = "<html><body>Press <b>Ctrl</b> + click<br/>"
+ "to go to website.</body></html>";
private void createMainTable(){
publicationsTblModel = new DefaultTableModel(new Object [][] {},
new String [] {"Include ", "Title ", "Authors", "Year", "Cited by"}){
Class[] types = new Class [] {
java.lang.Boolean.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
true, false, false, false, false
};
@Override
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
};
publicationsTbl.setModel(publicationsTblModel);
// set columns preferences
publicationsTbl.getColumnModel().getColumn(0).setResizable(false);
publicationsTbl.getColumnModel().getColumn(0).setMaxWidth(60);
publicationsTbl.getColumnModel().getColumn(1).setPreferredWidth(250);
publicationsTbl.getColumnModel().getColumn(2).setPreferredWidth(250);
publicationsTbl.getColumnModel().getColumn(3).setMaxWidth(60);
publicationsTbl.getColumnModel().getColumn(3).setResizable(false);
publicationsTbl.getColumnModel().getColumn(4).setMaxWidth(60);
publicationsTbl.getColumnModel().getColumn(4).setResizable(false);
ListSelectionModel listMod = publicationsTbl.getSelectionModel();
listMod.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
publicationsTbl.addKeyListener(new TableKeyListener());
publicationsTbl.addMouseListener(new TableMouseListener());
listMod.addListSelectionListener(new TablePublicationListChanged());
publicationsTbl.getModel().addTableModelListener(new PublicationsTableListener());
publicationsTbl.addFocusListener(new TableFocusListener());
publicationsTbl.setShowGrid(false);
publicationsTbl.setName("Pub");
publicationsTbl.setToolTipText(selectSite);
}
private void createHeteroCitationsTable(){
heterocitationsTblModel = new DefaultTableModel(new Object [][] {},
new String [] {"Title ", "Authors", "Year"}){
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false
};
@Override
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
};
HeteroCitationsTbl.setModel(heterocitationsTblModel);
// set columns preferences
HeteroCitationsTbl.getColumnModel().getColumn(0).setPreferredWidth(200);
HeteroCitationsTbl.getColumnModel().getColumn(1).setPreferredWidth(200);
HeteroCitationsTbl.getColumnModel().getColumn(2).setPreferredWidth(50);
ListSelectionModel listMod = HeteroCitationsTbl.getSelectionModel();
listMod.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
listMod.addListSelectionListener(new TableHeteroListChanged());
HeteroCitationsTbl.addKeyListener(new TableKeyListener());
HeteroCitationsTbl.addMouseListener(new TableMouseListener());
HeteroCitationsTbl.addFocusListener(new TableFocusListener());
HeteroCitationsTbl.setShowGrid(false);
HeteroCitationsTbl.setName("Hetero");
HeteroCitationsTbl.setToolTipText(selectSite);
}
private void createSelfCitationsTable(){
selfcitationsTblModel = new DefaultTableModel(new Object [][] {},
new String [] {"Title", "Authors", "Year"}){
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false
};
@Override
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
};
SelfCitationsTbl.setModel(selfcitationsTblModel);
// set columns preferences
SelfCitationsTbl.getColumnModel().getColumn(0).setPreferredWidth(200);
SelfCitationsTbl.getColumnModel().getColumn(1).setPreferredWidth(200);
SelfCitationsTbl.getColumnModel().getColumn(2).setPreferredWidth(50);
ListSelectionModel listMod = SelfCitationsTbl.getSelectionModel();
listMod.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
SelfCitationsTbl.addFocusListener(new TableFocusListener());
SelfCitationsTbl.addKeyListener(new TableKeyListener());
SelfCitationsTbl.addMouseListener(new TableMouseListener());
listMod.addListSelectionListener(new TableSelfListChanged());
SelfCitationsTbl.setShowGrid(false);
SelfCitationsTbl.setName("Self");
SelfCitationsTbl.setToolTipText(selectSite);
}
private void clearTables(boolean whole){
if(whole){
if ( publicationsTblModel != null ){
int rows = publicationsTblModel.getRowCount();
if (rows > 0)
for ( int i = rows-1; i>=0; i--)
publicationsTblModel.removeRow(i);
}
}
if ( heterocitationsTblModel != null ){
int rows = heterocitationsTblModel.getRowCount();
if (rows > 0)
for ( int i = rows-1; i>=0; i--)
heterocitationsTblModel.removeRow(i);
}
if ( selfcitationsTblModel != null ){
int rows = selfcitationsTblModel.getRowCount();
if (rows > 0)
for ( int i = rows-1; i>=0; i--)
selfcitationsTblModel.removeRow(i);
}
jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Hetero-citations", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Self-citations", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
jScrollPane2.repaint();
jScrollPane3.repaint();
jScrollPane2.revalidate();
jScrollPane3.revalidate();
}
//ctrl option for Open Site
private class TableKeyListener extends KeyAdapter {
@Override
public void keyPressed(KeyEvent e) {
JTable table = (JTable)e.getSource();
if (e.isControlDown())
table.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
@Override
public void keyReleased(KeyEvent e) {
JTable table = (JTable)e.getSource();
table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
}
//ctrl + click combination for Open Site
private class TableMouseListener extends MouseAdapter {
//PROBLEM MAYBE
@Override
public void mouseClicked(MouseEvent e) {
if (e.isControlDown()) {
JTable table = (JTable)e.getSource();
if (table.getSelectedRow() == -1) {
if ( table.getName().equals("Pub"))
table.setRowSelectionInterval(lastSelectedPub, lastSelectedPub);
else if (table.getName().equals("Hetero"))table.setRowSelectionInterval(lastSelectedHCite, lastSelectedHCite);
else table.setRowSelectionInterval(lastSelectedSCite, lastSelectedSCite);
}
/*GO TO HOMEPAGE CODE*/
String url = "NO";
if ( table.getName().equals("Pub"))
url = Publications.get(publicationsTbl.getSelectedRow()).getHrefPage();
else if ( table.getName().equals("Hetero"))
url = Publications.get(lastSelectedPub).getHeteroCitations().get(table.getSelectedRow()).getHrefPage();
else if ( table.getName().equals("Self"))
url = Publications.get(lastSelectedPub).getSelfCitations().get(table.getSelectedRow()).getHrefPage();
if (url.startsWith("http")) {
URI uri;
try {
uri = new URI(url);
Desktop.getDesktop().browse(uri);
} catch (URISyntaxException ex) {
Logger.getLogger(ApplicationForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(ApplicationForm.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println(table.getName()+" url:"+url);
}
}
}
}
private void setDetailsForPublication(int index){
PDetailsTitleLabel.setText(Publications.get(index).getTitle());
PDetailsAuthorsLabel.setText(Publications.get(index).printAuthors());
if (Publications.get(index).getYear() == 0)
PDetailsYearLabel.setText("Unknown year");
else
PDetailsYearLabel.setText(Publications.get(index).getYear()+"");
jPanel2.repaint();
jPanel2.revalidate();
}
private void showCitationsTable(int index){
//creat Tables
clearTables(false);
CitedPublication selectedP = Publications.get(index);
//fill tableModel for HETERO
ArrayList <Publication> hetero = selectedP.getHeteroCitations();
jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Hetero-citations ("+hetero.size()+")", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
for ( int i = 0; i < hetero.size(); i++ ){
String year;
if ( hetero.get(i).getYear() == 0) year = "Unknown Year";
else year = hetero.get(i).getYear()+"";
Object [] o = new Object[]{hetero.get(i).getTitle()
, hetero.get(i).printAuthors(), year};
heterocitationsTblModel.addRow(o);
}
//fill tableModel for SELF
ArrayList <Publication> self = selectedP.getSelfCitations();
jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Self-citations ("+self.size()+")", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
for ( int i = 0; i < self.size(); i++ ){
String year;
if ( self.get(i).getYear() == 0) year = "Unknown Year";
else year = self.get(i).getYear()+"";
Object [] o = new Object[]{self.get(i).getTitle()
, self.get(i).printAuthors(), year};
selfcitationsTblModel.addRow(o);
}
setDetailsForPublication(index);
jScrollPane2.repaint();
jScrollPane3.repaint();
jScrollPane2.revalidate();
jScrollPane3.revalidate();
}
//select a row from the table
private class TablePublicationListChanged implements ListSelectionListener {
@Override
public void valueChanged(ListSelectionEvent e) {
int selRow;
if (!e.getValueIsAdjusting()) {
setDefaultDetails();
selRow = publicationsTbl.getSelectedRow();
if ( selRow == -1 )return;
lastSelectedPub = selRow;
setDetailsForPublication(selRow);
showCitationsTable( selRow );
System.out.println("show " + selRow+"s citations");
}
}
}
private class TableHeteroListChanged implements ListSelectionListener {
@Override
public void valueChanged(ListSelectionEvent e) {
int selRow;
if (!e.getValueIsAdjusting()) {
selRow = HeteroCitationsTbl.getSelectedRow();
if ( selRow == -1 )return;
lastSelectedHCite = selRow;
showDetailsForCitation(selRow, true);
SelfCitationsTbl.clearSelection();
}
}
}
private class TableSelfListChanged implements ListSelectionListener {
@Override
public void valueChanged(ListSelectionEvent e) {
int selRow;
if (!e.getValueIsAdjusting()) {
selRow = SelfCitationsTbl.getSelectedRow();
if ( selRow == -1 )return;
lastSelectedSCite = selRow;
showDetailsForCitation(selRow, false);
HeteroCitationsTbl.clearSelection();
}
}
}
private void showDetailsForCitation( int index, boolean isHetero ){
if (isHetero){
CDetailsTitleLabel.setText(Publications.get(publicationsTbl.getSelectedRow()).getHeteroCitations().get(index).getTitle());
CDetailsAuthorsLabel.setText(Publications.get(publicationsTbl.getSelectedRow()).getHeteroCitations().get(index).printAuthors());
if (Publications.get(publicationsTbl.getSelectedRow()).getHeteroCitations().get(index).getYear() == 0)
CDetailsYearLabel.setText("Unknown year");
else CDetailsYearLabel.setText(Publications.get(publicationsTbl.getSelectedRow()).getHeteroCitations().get(index).getYear()+"");
}else{
CDetailsTitleLabel.setText(Publications.get(publicationsTbl.getSelectedRow()).getSelfCitations().get(index).getTitle());
CDetailsAuthorsLabel.setText(Publications.get(publicationsTbl.getSelectedRow()).getSelfCitations().get(index).printAuthors());
if (Publications.get(publicationsTbl.getSelectedRow()).getSelfCitations().get(index).getYear() == 0)
CDetailsYearLabel.setText("Unknown year");
else CDetailsYearLabel.setText(Publications.get(publicationsTbl.getSelectedRow()).getSelfCitations().get(index).getYear()+"");
}
jPanel3.repaint();
jPanel3.revalidate();
}
class TableFocusListener implements FocusListener{
@Override
public void focusGained(FocusEvent e) {
JTable OnTable = (JTable)e.getSource();
OnTable.setSelectionBackground(new Color(51, 153, 255));
// if ( OnTable.getName().equals("Pub") ){
// MainTable.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(Color.MAGENTA, 1, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true), javax.swing.BorderFactory.createEtchedBorder()))), "Publications", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N
// }
// else
// ForeignTable.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(Color.MAGENTA, 1, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true), javax.swing.BorderFactory.createEtchedBorder()))), "Publications", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N
}
@Override
public void focusLost(FocusEvent e) {
JTable OffTable = (JTable)e.getSource();
// if ( OffTable.getName().equals("Pub") ){
// MainTable.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true), javax.swing.BorderFactory.createEtchedBorder()))), "Publications", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N
//
// }else
// ForeignTable.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 2, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(new java.awt.Color(240, 240, 240), 1, true), javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.LineBorder(java.awt.SystemColor.windowBorder, 1, true), javax.swing.BorderFactory.createEtchedBorder()))), "Publications", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N
//
OffTable.setSelectionBackground(new Color(191, 205, 219));
}
}
class PublicationsTableListener implements TableModelListener{
@Override
public void tableChanged(TableModelEvent e) {
if ( myThread.isAlive()) return;
if( e.getType() == TableModelEvent.DELETE)return;
int selRow;
boolean value;
selRow = publicationsTbl.getSelectedRow();
// get Table data
TableModel tm = publicationsTbl.getModel();
value = (Boolean)tm.getValueAt(selRow, 0);
updateSummary(selRow, value);
System.out.println("changed to " +value +" the "+ selRow + " row");
}
}
//end Tables
//summary Panel
protected String AUTHOR;
private ArrayList<Integer> ExcludeIndexes;
private void setSummary(){
int numHCite = 0;
int numSCite = 0;
clearExcluded();
ArrayList<CitedPublication> PureList= keepIncludedOnly();
for ( int i = 0; i < PureList.size(); i++ ){
numHCite += PureList.get(i).getHeteroCitations().size();
numSCite += PureList.get(i).getSelfCitations().size();
}
AuthorLabel.setText(AUTHOR);
numPLabel.setText(PureList.size()+"");
numCLabel.setText((numHCite+numSCite)+"");
numHCLabel.setText(numHCite+"");
numSCLabel.setText(numSCite+"");
Metrics metrics = new Metrics(PureList);
int h_indexCite = metrics.gethIndex(Metrics.CITATION_CHOICE);
int h_indexHete = metrics.gethIndex(Metrics.HETERO_CHOICE);
int g_indexCite = metrics.getgIndex(Metrics.CITATION_CHOICE);
int g_indexHete = metrics.getgIndex(Metrics.HETERO_CHOICE);
double ARindexCite = metrics.getARindex(Metrics.CITATION_CHOICE);
double ARindexHete = metrics.getARindex(Metrics.HETERO_CHOICE);
Formatter formatter1 = new Formatter();
formatter1.format("%.3f", ARindexCite);
Formatter formatter2 = new Formatter();
formatter2.format("%.3f", ARindexHete);
hindexCLabel.setText(""+h_indexCite);
hindexHCLabel.setText(""+h_indexHete);
gindexCLabel.setText(""+g_indexCite);
gindexHCLabel.setText(""+g_indexHete);
arindexCLabel.setText(""+formatter1);
arindexHCLabel.setText(""+formatter2);
}
private void repaintSummary(){
this.hindexCLabel.repaint();
this.hindexHCLabel.repaint();
this.gindexCLabel.repaint();
this.gindexHCLabel.repaint();
this.arindexCLabel.repaint();
this.arindexHCLabel.repaint();
AuthorLabel.repaint();
numPLabel.repaint();
numCLabel.repaint();
numHCLabel.repaint();
numSCLabel.repaint();
}
private void updateSummary(int index, boolean value){
if ( value ){
for ( int i = 0; i < ExcludeIndexes.size(); i++ ){
if ( index == ExcludeIndexes.get(i)){
ExcludeIndexes.remove(i);
break;
}
}
}
else{
ExcludeIndexes.add(index);
}
//revalidate Summary
setSummary();
repaintSummary();
}
private void setDefaultSummary(){
AuthorLabel.setText("-");
numPLabel.setText("-");
numCLabel.setText("-");
numHCLabel.setText("-");
numSCLabel.setText("-");
hindexCLabel.setText("-");
hindexHCLabel.setText("-");
gindexCLabel.setText("-");
gindexHCLabel.setText("-");
arindexCLabel.setText("-");
arindexHCLabel.setText("-");
}
//end summary Panel
}
| [
"moujan21@gmail.com"
] | moujan21@gmail.com |
8169e0f7770ef9900d446639e13a834cb6bfb442 | ca38ce183c6cdf0af27752a8eea7afa11521c7cc | /NMSUtils-API/src/main/java/net/tangentmc/nmsUtils/resourcepacks/predicates/BowPullingDamagePredicate.java | 83702ade493915aedea7b7899adcb1dae281735f | [] | no_license | sanjay900/NMSUtilsV2 | 6fa674228081876c113c612637fb3c5518124f1f | 83798cac78bf0f998c2a8226b9d2d02457b51c81 | refs/heads/master | 2021-05-01T21:41:50.170281 | 2017-10-11T23:43:45 | 2017-10-11T23:43:45 | 56,222,833 | 0 | 1 | null | 2017-03-28T06:43:22 | 2016-04-14T09:03:46 | Java | UTF-8 | Java | false | false | 273 | java | package net.tangentmc.nmsUtils.resourcepacks.predicates;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@AllArgsConstructor
@Getter
@Setter
public class BowPullingDamagePredicate implements Predicate {
int pulling;
double damage;
}
| [
"sanjay.govind9@gmail.com"
] | sanjay.govind9@gmail.com |
16562d0a2154dfa0b6d08750f9b93bf2db9c7d27 | a7e662d03a1369c1431808b5e47501674f2f3143 | /aop/src/main/java/io/github/xbeeant/aop/AspectHelper.java | 8377f98a5335c7ab858a9f37bf48544d78cf4672 | [
"MIT"
] | permissive | richwxd/xstudio | 6c07479214996e5d7eb87b309590708cf331962b | 958b2c16d520b8dc4c98c282e60cdc513ded6e30 | refs/heads/master | 2023-06-17T13:24:50.123878 | 2021-07-12T15:07:55 | 2021-07-12T15:07:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 789 | java | package io.github.xbeeant.aop;
import org.aspectj.lang.JoinPoint;
/**
* Aspect工具类
*
* @author xiaobiao
* @version 2020/2/16
*/
public class AspectHelper {
private AspectHelper() {
throw new UnsupportedOperationException("AspectJUtil can't be instantiated");
}
/**
* 获取方法名
*
* @param joinPoint {@link JoinPoint}
* @return 方法名
*/
public static String getMethodName(JoinPoint joinPoint) {
String methodName = joinPoint.getSignature().toShortString();
String shortMethodNameSuffix = "(..)";
if (methodName.endsWith(shortMethodNameSuffix)) {
methodName = methodName.substring(0, methodName.length() - shortMethodNameSuffix.length());
}
return methodName;
}
}
| [
"huangxb0512@gmail.com"
] | huangxb0512@gmail.com |
a0a87b9deb143f51e15a6ca15c5a65c1316bbdb3 | 92fceb76e5f728a691a7a2d54ddb526ddf8e12bc | /platform-biz/src/main/java/com/platform/config/WxMaConfiguration.java | c6627563117211c5199cff2f9c96b0ba1cdabc75 | [] | no_license | liutaojava/platform-plus | 782de161154d87f363220fe8fcf504c9c5bf2303 | 5df47d1ffdff96b0af2f33c09e152804a83d6cb0 | refs/heads/master | 2021-05-20T02:41:14.429113 | 2020-04-01T11:23:44 | 2020-04-01T11:23:44 | 252,151,409 | 2 | 0 | null | 2020-10-13T20:49:43 | 2020-04-01T11:08:24 | JavaScript | UTF-8 | Java | false | false | 5,195 | java | package com.platform.config;
import cn.binarywang.wx.miniapp.api.WxMaMsgService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaMsgServiceImpl;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage;
import cn.binarywang.wx.miniapp.bean.WxMaTemplateData;
import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage;
import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig;
import cn.binarywang.wx.miniapp.message.WxMaMessageHandler;
import cn.binarywang.wx.miniapp.message.WxMaMessageRouter;
import com.google.common.collect.Lists;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.File;
/**
* wechat ma configuration
*
* @author
*/
@Configuration
@EnableConfigurationProperties(WxMaProperties.class)
public class WxMaConfiguration {
private WxMaProperties properties;
@Autowired
public WxMaConfiguration(WxMaProperties properties) {
this.properties = properties;
}
@Bean
public WxMaService wxMaService() {
WxMaService wxMaService = new WxMaServiceImpl();
WxMaInMemoryConfig wxMaInMemoryConfig = new WxMaInMemoryConfig();
wxMaInMemoryConfig.setAppid(properties.getAppid());
wxMaInMemoryConfig.setSecret(properties.getSecret());
wxMaInMemoryConfig.setToken(properties.getToken());
wxMaInMemoryConfig.setAesKey(properties.getAesKey());
wxMaInMemoryConfig.setMsgDataFormat(properties.getMsgDataFormat());
wxMaService.setWxMaConfig(wxMaInMemoryConfig);
return wxMaService;
}
@Bean
public WxMaMsgService wxMaMsgService(WxMaService service) {
return new WxMaMsgServiceImpl(service);
}
@Bean
public WxMaMessageRouter newRouter(WxMaService service) {
final WxMaMessageRouter router = new WxMaMessageRouter(service);
router.rule().handler(logHandler).next()
.rule().async(false).content("模板").handler(templateMsgHandler).end()
.rule().async(false).content("文本").handler(textHandler).end()
.rule().async(false).content("图片").handler(picHandler).end()
.rule().async(false).content("二维码").handler(qrcodeHandler).end();
return router;
}
private final WxMaMessageHandler templateMsgHandler = (wxMessage, context, service, sessionManager) ->
service.getMsgService().sendTemplateMsg(WxMaTemplateMessage.builder()
.templateId("此处更换为自己的模板id")
.formId("自己替换可用的formid")
.data(Lists.newArrayList(
new WxMaTemplateData("keyword1", "339208499", "#173177")))
.toUser(wxMessage.getFromUser())
.build());
private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> {
System.out.println("收到消息:" + wxMessage.toString());
service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson())
.toUser(wxMessage.getFromUser()).build());
};
private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) ->
service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息")
.toUser(wxMessage.getFromUser()).build());
private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> {
try {
WxMediaUploadResult uploadResult = service.getMediaService()
.uploadMedia("image", "png",
ClassLoader.getSystemResourceAsStream("tmp.png"));
service.getMsgService().sendKefuMsg(
WxMaKefuMessage
.newImageBuilder()
.mediaId(uploadResult.getMediaId())
.toUser(wxMessage.getFromUser())
.build());
} catch (WxErrorException e) {
e.printStackTrace();
}
};
private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> {
try {
final File file = service.getQrcodeService().createQrcode("123", 430);
WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file);
service.getMsgService().sendKefuMsg(
WxMaKefuMessage
.newImageBuilder()
.mediaId(uploadResult.getMediaId())
.toUser(wxMessage.getFromUser())
.build());
} catch (WxErrorException e) {
e.printStackTrace();
}
};
}
| [
"liutao12@renmaitech.com"
] | liutao12@renmaitech.com |
90c3161e77f0f1a9eb3987b9a71a5036c50c5de0 | 4d86dee7678d2312588ab2e5ad1fccea4bd2b8e7 | /src/main/java/com/aiops/uim/mcs/models/FieldBean.java | 88eef21d679d9b4d760e782b951421510ceb5b83 | [
"Unlicense"
] | permissive | srikirreddy/mcs | 65eded24210dc03e18091c5ea333d523407a4086 | 5458ef398dd2db8d1052da2f94c5a0c8f1105c54 | refs/heads/master | 2023-01-11T20:23:48.502661 | 2020-01-22T05:18:33 | 2020-01-22T05:18:33 | 231,561,373 | 0 | 0 | Unlicense | 2022-12-11T19:12:35 | 2020-01-03T10:05:14 | Java | UTF-8 | Java | false | false | 9,536 | java | package com.aiops.uim.mcs.models;
import java.util.ArrayList;
import java.util.Arrays;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.nimsoft.selfservice.v2.marshaling.AdapterCDATA;
import com.nimsoft.selfservice.v2.model.Context;
//import com.nimsoft.selfservice.v2.model.SelectableObject;
@XmlAccessorType(XmlAccessType.FIELD)
public class FieldBean {
@XmlElement(name = "id")
protected Integer id;
@XmlElement(name = "type")
protected String type;
@XmlElement(name = "name")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected String name;
@JsonProperty("cfgkey")
@XmlElement(name = "cfgkey")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected String cfgkey;
@XmlElement(name = "variable")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected String variable;
@XmlElement(name = "validation")
protected String validation;
@XmlElement(name = "datatype")
protected String datatype;
@XmlElement(name = "position")
protected Integer position;
@XmlElement(name = "label")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected String label;
@JsonProperty("labelposition")
@XmlElement(name = "labelposition")
protected String labelPosition;
@XmlElement(name = "helptext")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected String helptext;
@XmlElement(name = "url")
protected String url;
@XmlElement(name = "length")
protected Integer length;
//protected Integer numlines;
@XmlElement(name = "data")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected String data;
@XmlElement(name = "required")
protected Boolean required;
@XmlElement(name = "value")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected Object value;
@XmlElement(name = "readonly")
protected Boolean readonly;
@XmlElement(name = "immutable")
protected Boolean immutable;
@XmlElement(name = "editable")
protected Boolean editable;
@XmlElement(name = "hidden")
protected Boolean hidden;
@XmlElement(name = "relatedField")
protected Integer relatedField = null;
@XmlElement(name = "relatedFieldValue")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected String relatedFieldValue = null;
@XmlElement(name = "values")
protected ArrayList<SelectableObject> values;
@JsonIgnore
protected ArrayList<String> options;
@JsonIgnore
protected Integer numlines;
@JsonProperty("containerpath")
@XmlElement(name = "containerpath")
protected String containerPath;
@XmlElement(name = "callback")
protected Integer callback;
@XmlElement(name = "template")
protected Integer template;
@XmlElement(name = "acl")
protected String acl;
@XmlElement(name = "legacyVariable")
protected String legacyVariable;
@XmlElement(name = "omitSectionCondition")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected String omitSectionCondition;
@XmlElement(name = "salt")
@XmlJavaTypeAdapter(AdapterCDATA.class)
protected String salt;
@XmlElement(name = "persist")
protected Boolean persist;
@JsonProperty("context")
@XmlElement(name = "context")
protected Context[] contexts;
@XmlElement(name = "defaultcfgkey")
protected String defaultcfgkey = null;
@JsonProperty("defaultvalue")
@XmlElement(name = "defaultvalue")
protected String defaultValue = null;
@XmlElement(name = "calculation")
protected String calculation = null;
public String getAcl() {
return acl;
}
public Integer getCallback() {
return callback;
}
public String getContainerPath() {
return containerPath;
}
public String getData() {
return data;
}
public Context[] getContext() {
if (contexts == null) {
return null;
}
return Arrays.copyOf(contexts, contexts.length);
}
public void setContexts(Context[] contexts) {
if (contexts == null) {
this.contexts = null;
} else {
this.contexts = Arrays.copyOf(contexts, contexts.length);
}
}
public String getDatatype() {
return datatype;
}
public void setDefaultValue(String defaultValue) {
/*
* if (this.defaultValue != null) {
* Thread.dumpStack();
* System.exit(1);
* }
*/
this.defaultValue = defaultValue;
}
public String getDefaultValue() {
return defaultValue;
}
public String getHelptext() {
return helptext;
}
public String getLabel() {
return label;
}
public String getLabelPosition() {
return labelPosition;
}
public String getLegacyVariable() {
return legacyVariable;
}
public int getLength() {
if (length == null) {
return 0;
}
return length;
}
public String getName() {
return name;
}
/*
* public Integer getNumlines() { return numlines; }
*/
public String getOmitSectionCondition() {
return omitSectionCondition;
}
public Integer getPosition() {
return position;
}
public Boolean getReadonly() {
return readonly;
}
public Integer getRelatedField() {
return relatedField;
}
public String getRelatedFieldValue() {
return relatedFieldValue;
}
public String getSalt() {
return salt;
}
public Integer getTemplate() {
return template;
}
public String getType() {
return type;
}
public String getUrl() {
return url;
}
public String getCalculation() {
return calculation;
}
public void setCalculation(String calculation) {
this.calculation = calculation;
}
public void setVariable(String variable) {
this.variable = variable;
}
public void setValidation(String validation) {
this.validation = validation;
}
public void setRequired(boolean required) {
this.required = required;
}
public void setSalt(String salt) {
this.salt = salt;
}
public void setTemplate(Integer template) {
this.template = template;
}
public void setType(String type) {
this.type = type;
}
public void setUrl(String url) {
this.url = url;
}
public void setRelatedFieldValue(String relatedFieldValue) {
this.relatedFieldValue = relatedFieldValue;
}
public void setPosition(Integer position) {
this.position = position;
}
public void setReadonly(boolean readonly) {
this.readonly = readonly;
}
@XmlTransient
public void setReadonly(Boolean readonly) {
this.readonly = readonly;
}
public void setRelatedField(Integer relatedField) {
this.relatedField = relatedField;
}
public void setEditable(Boolean editable) {
this.editable = editable;
}
public void setHelptext(String helptext) {
this.helptext = helptext;
}
public void setHidden(Boolean hidden) {
this.hidden = hidden;
}
public void setPersist(Boolean persist) {
this.persist = persist;
}
public void setId(Integer id) {
this.id = id;
}
public void setImmutable(Boolean immutable) {
this.immutable = immutable;
}
public void setLabel(String label) {
this.label = label;
}
public void setLabelPosition(String labelPosition) {
this.labelPosition = labelPosition;
}
public void setLegacyVariable(String legacyVariable) {
this.legacyVariable = legacyVariable;
}
public void setLength(Integer length) {
this.length = length;
}
public void setName(String name) {
this.name = name;
}
/*
* public void setNumlines(Integer numlines) { this.numlines = numlines; }
*/
public void setOmitSectionCondition(String omitSectionCondition) {
this.omitSectionCondition = omitSectionCondition;
}
public void setContainerPath(String containerPath) {
this.containerPath = containerPath;
}
public void setData(String data) {
this.data = data;
}
public void setDatatype(String datatype) {
this.datatype = datatype;
}
public void setCfgkey(String cfgkey) {
this.cfgkey = cfgkey;
}
public void setCallback(Integer callback) {
this.callback = callback;
}
public void setAcl(String acl) {
this.acl = acl;
}
public boolean isRequired() {
return required == null ? false : required;
}
public boolean isEditable() {
return editable == null ? false : editable;
}
public boolean isHidden() {
return hidden == null ? false : hidden;
}
public Boolean shouldPersist() {
// If persist is not present in the field, calculate value based on cfgkey
// and variable
if (persist == null) {
persist = cfgkey != null || variable != null;
}
return persist;
}
public boolean isImmutable() {
return immutable == null ? false : immutable;
}
public String getVariable() {
return variable;
}
public String getValidation() {
return validation;
}
public Integer getId() {
return id;
}
public String getCfgkey() {
return cfgkey;
}
} | [
"kondaveti.srikanth@broadcom.com"
] | kondaveti.srikanth@broadcom.com |
de8788cb0ccbbda917da74424c6a3bfbda4acaa4 | 8efcb7cfc556a53f985d2fe4c394e42a23047257 | /forum/service/src/main/java/org/exoplatform/forum/service/ForumNodeTypes.java | 9bfb0887b9e2150d67ad66c8406af677a3d753b4 | [] | no_license | phuonglm/forum | 160c4bf6027f8c1a6a4baace84f63ad022b3cf9d | da640a7a984f5c1ba24dff1f7a0e959d4997a804 | refs/heads/master | 2021-01-18T13:40:26.004078 | 2012-06-25T15:34:13 | 2012-06-25T15:34:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,401 | java | /*
* Copyright (C) 2003-2010 eXo Platform SAS.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see<http://www.gnu.org/licenses/>.
*/
package org.exoplatform.forum.service;
/**
* Constants for Forum nodetypes and properties.
*
* @author <a href="mailto:patrice.lamarque@exoplatform.com">Patrice
* Lamarque</a>
* @version $Revision$
*/
public interface ForumNodeTypes {
public static final String EXO_FORUM_TAG = "exo:forumTag";
public static final String EXO_USER_TAG = "exo:userTag";
public static final String EXO_USE_COUNT = "exo:useCount";
public static final String EXO_POLL = "exo:poll";
public static final String EXO_IS_AGAIN_VOTE = "exo:isAgainVote";
public static final String EXO_IS_MULTI_CHECK = "exo:isMultiCheck";
public static final String EXO_USER_VOTE = "exo:userVote";
public static final String EXO_VOTE = "exo:vote";
public static final String EXO_OPTION = "exo:option";
public static final String EXO_QUESTION = "exo:question";
public static final String EXO_TIME_OUT = "exo:timeOut";
public static final String EXO_USER_WATCHING = "exo:userWatching";
public static final String EXO_USER_PRI = "exoUserPri";
public static final String EXO_READ_FORUM = "exo:readForum";
public static final String EXO_LAST_READ_POST_OF_TOPIC = "exo:lastReadPostOfTopic";
public static final String EXO_LAST_READ_POST_OF_FORUM = "exo:lastReadPostOfForum";
public static final String TEXT_HTML = "text/html";
public static final String EXO_EMAIL = "exo:email";
public static final String EXO_FULL_NAME = "exo:fullName";
public static final String KNOWLEDGE_SUITE_FORUM_JOBS = "KnowledgeSuite-forum";
public static final String EXO_TOTAL_TOPIC = "exo:totalTopic";
public static final String EXO_IS_STICKY = "exo:isSticky";
public static final String EXO_VOTE_RATING = "exo:voteRating";
public static final String EXO_TAG_ID = "exo:tagId";
public static final String EXO_IS_NOTIFY_WHEN_ADD_POST = "exo:isNotifyWhenAddPost";
public static final String EXO_USER_VOTE_RATING = "exo:userVoteRating";
public static final String EXO_NUMBER_ATTACHMENTS = "exo:numberAttachments";
public static final String EXO_TOPIC_TYPE = "exo:topicType";
public static final String EXO_IS_POLL = "exo:isPoll";
public static final String EXO_LAST_POST_BY = "exo:lastPostBy";
public static final String EXO_VIEW_COUNT = "exo:viewCount";
public static final String JCR_ROOT = "/jcr:root";
public static final String EXO_IS_ACTIVE = "exo:isActive";
public static final String EXO_IS_WAITING = "exo:isWaiting";
public static final String EXO_IS_ACTIVE_BY_FORUM = "exo:isActiveByForum";
public static final String EXO_TOPIC = "exo:topic";
public static final String EXO_IS_LOCK = "exo:isLock";
public static final String EXO_IS_CLOSED = "exo:isClosed";
public static final String EXO_IS_MODERATE_POST = "exo:isModeratePost";
public static final String EXO_NOTIFY_WHEN_ADD_TOPIC = "exo:notifyWhenAddTopic";
public static final String EXO_NOTIFY_WHEN_ADD_POST = "exo:notifyWhenAddPost";
public static final String EXO_IS_AUTO_ADD_EMAIL_NOTIFY = "exo:isAutoAddEmailNotify";
public static final String EXO_FORUM_ORDER = "exo:forumOrder";
public static final String EXO_IS_MODERATE_TOPIC = "exo:isModerateTopic";
public static final String EXO_BAN_I_PS = "exo:banIPs";
public static final String EXO_TOPIC_COUNT = "exo:topicCount";
public static final String EXO_POST_COUNT = "exo:postCount";
public static final String EXO_LAST_TOPIC_PATH = "exo:lastTopicPath";
public static final String EXO_USER_ROLE = "exo:userRole";
public static final String EXO_MODERATE_FORUMS = "exo:moderateForums";
public static final String EXO_MODERATE_CATEGORY = "exo:moderateCategory";
public static final String EXO_EMAIL_WATCHING = "exo:emailWatching";
public static final String EXO_FORUM_WATCHING = "exo:forumWatching";
public static final String EXO_FORUM_COUNT = "exo:forumCount";
public static final String EXO_CAN_VIEW = "exo:canView";
public static final String EXO_CAN_POST = "exo:canPost";
public static final String EXO_CREATE_TOPIC_ROLE = "exo:createTopicRole";
public static final String EXO_DESCRIPTION = "exo:description";
public static final String EXO_CATEGORY_ORDER = "exo:categoryOrder";
public static final String EXO_VIEWER = "exo:viewer";
public static final String EXO_POSTER = "exo:poster";
public static final String EXO_TEMP_MODERATORS = "exo:tempModerators";
public static final String EXO_MODERATORS = "exo:moderators";
public static final String EXO_ADMINISTRATION = "exo:administration";
public static final String EXO_NOTIFY_EMAIL_MOVED = "exo:notifyEmailMoved";
public static final String EXO_NOTIFY_EMAIL_CONTENT = "exo:notifyEmailContent";
public static final String EXO_HEADER_SUBJECT = "exo:headerSubject";
public static final String EXO_ENABLE_HEADER_SUBJECT = "exo:enableHeaderSubject";
public static final String EXO_CENSORED_KEYWORD = "exo:censoredKeyword";
public static final String EXO_TOPIC_SORT_BY_TYPE = "exo:topicSortByType";
public static final String EXO_TOPIC_SORT_BY = "exo:topicSortBy";
public static final String EXO_FORUM_SORT_BY_TYPE = "exo:forumSortByType";
public static final String EXO_FORUM_SORT_BY = "exo:forumSortBy";
public static final String EXO_FORUM_RESOURCE = "exo:forumResource";
public static final String EXO_LAST_POST_DATE = "exo:lastPostDate";
public static final String EXO_USER_TITLE = "exo:userTitle";
public static final String EXO_USER_ID = "exo:userId";
public static final String EXO_TOTAL_POST = "exo:totalPost";
public static final String EXO_IS_FIRST_POST = "exo:isFirstPost";
public static final String EXO_PATH = "exo:path";
public static final String EXO_ID = "exo:id";
public static final String EXO_POST = "exo:post";
public static final String EXO_FILE_NAME = "exo:fileName";
public static final String EXO_FILE_SIZE = "exo:fileSize";
public static final String EXO_FORUM_ATTACHMENT = "exo:forumAttachment";
public static final String EXO_NUMBER_ATTACH = "exo:numberAttach";
public static final String EXO_USER_PRIVATE = "exo:userPrivate";
public static final String EXO_IS_ACTIVE_BY_TOPIC = "exo:isActiveByTopic";
public static final String EXO_IS_HIDDEN = "exo:isHidden";
public static final String EXO_IS_APPROVED = "exo:isApproved";
public static final String EXO_LINK = "exo:link";
public static final String EXO_ICON = "exo:icon";
public static final String EXO_REMOTE_ADDR = "exo:remoteAddr";
public static final String EXO_MESSAGE = "exo:message";
public static final String EXO_NAME = "exo:name";
public static final String EXO_EDIT_REASON = "exo:editReason";
public static final String EXO_MODIFIED_DATE = "exo:modifiedDate";
public static final String EXO_MODIFIED_BY = "exo:modifiedBy";
public static final String EXO_CREATED_DATE = "exo:createdDate";
public static final String EXO_OWNER = "exo:owner";
public static final String EXO_FORUM = "exo:forum";
public static final String EXO_FORUM_CATEGORY = "exo:forumCategory";
public static final String EXO_IS_AUTO_WATCH_MY_TOPICS = "exo:isAutoWatchMyTopics";
public static final String EXO_IS_AUTO_WATCH_TOPIC_I_POST = "exo:isAutoWatchTopicIPost";
public static final String EXO_USER_DELETED = "exo:userDeleted";
public static final String EXO_SCREEN_NAME = "exo:screenName";
public static final String EXO_FIRST_NAME = "exo:firstName";
public static final String EXO_LAST_NAME = "exo:lastName";
public static final String EXO_SIGNATURE = "exo:signature";
public static final String EXO_IS_DISPLAY_SIGNATURE = "exo:isDisplaySignature";
public static final String EXO_IS_DISPLAY_AVATAR = "exo:isDisplayAvatar";
public static final String EXO_TIME_ZONE = "exo:timeZone";
public static final String EXO_SHORT_DATEFORMAT = "exo:shortDateformat";
public static final String EXO_LONG_DATEFORMAT = "exo:longDateformat";
public static final String EXO_TIME_FORMAT = "exo:timeFormat";
public static final String EXO_MAX_POST = "exo:maxPost";
public static final String EXO_MAX_TOPIC = "exo:maxTopic";
public static final String EXO_IS_SHOW_FORUM_JUMP = "exo:isShowForumJump";
public static final String EXO_BAN_UNTIL = "exo:banUntil";
public static final String EXO_BAN_REASON = "exo:banReason";
public static final String EXO_BAN_COUNTER = "exo:banCounter";
public static final String EXO_BAN_REASON_SUMMARY = "exo:banReasonSummary";
public static final String EXO_CREATED_DATE_BAN = "exo:createdDateBan";
public static final String EXO_COLLAP_CATEGORIES = "exo:collapCategories";
public static final String EXO_IS_BANNED = "exo:isBanned";
public static final String EXO_PRIVATE_MESSAGE = "exo:privateMessage";
public static final String EXO_FROM = "exo:from";
public static final String EXO_SEND_TO = "exo:sendTo";
public static final String EXO_RECEIVED_DATE = "exo:receivedDate";
public static final String EXO_TYPE = "exo:type";
public static final String EXO_IS_UNREAD = "exo:isUnread";
public static final String EXO_NEW_MESSAGE = "exo:newMessage";
public static final String EXO_FORUM_SUBSCRIPTION = "exo:forumSubscription";
public static final String EXO_CATEGORY_IDS = "exo:categoryIds";
public static final String EXO_FORUM_IDS = "exo:forumIds";
public static final String EXO_TOPIC_IDS = "exo:topicIds";
public static final String EXO_MEMBERS_COUNT = "exo:membersCount";
public static final String EXO_NEW_MEMBERS = "exo:newMembers";
public static final String EXO_MOST_USERS_ONLINE = "exo:mostUsersOnline";
public static final String EXO_RSS_WATCHING = "exo:rssWatching";
public static final String EXO_JOB_WATTING_FOR_MODERATOR = "exo:jobWattingForModerator";
public static final String EXO_ACTIVE_USERS = "exo:activeUsers";
public static final String EXO_CATEGORY_HOME = "exo:categoryHome";
public static final String EXO_USER_PROFILE_HOME = "exo:userProfileHome";
public static final String EXO_TAG_HOME = "exo:tagHome";
public static final String EXO_FORUM_BB_CODE_HOME = "exo:forumBBCodeHome";
public static final String EXO_ADMINISTRATION_HOME = "exo:administrationHome";
public static final String EXO_BAN_IP_HOME = "exo:banIPHome";
public static final String EXO_JOINED_DATE = "exo:joinedDate";
public static final String EXO_LAST_LOGIN_DATE = "exo:lastLoginDate";
public static final String EXO_PRUNE_SETTING = "exo:pruneSetting";
public static final String EXO_LAST_RUN_DATE = "exo:lastRunDate";
public static final String EXO_PERIOD_TIME = "exo:periodTime";
public static final String EXO_IN_ACTIVE_DAY = "exo:inActiveDay";
public static final String EXO_IPS = "exo:ips";
public static final String EXO_BOOKMARK = "exo:bookmark";
public static final String EXO_READ_TOPIC = "exo:readTopic";
public static final String NT_FILE = "nt:file";
public static final String JCR_CONTENT = "jcr:content";
public static final String JCR_MIME_TYPE = "jcr:mimeType";
public static final String JCR_LAST_MODIFIED = "jcr:lastModified";
public static final String JCR_DATA = "jcr:data";
public static final String NT_RESOURCE = "nt:resource";
public static final String ASCENDING = " ascending";
public static final String DESCENDING = " descending";
}
| [
"tuvd@exoplatform.com"
] | tuvd@exoplatform.com |
a3a858d2c28a9c93f7bf60b9b1f703d26c067fa3 | 705daa87f084213563efb58e6800951736d7fea0 | /app/src/main/java/com/example/rec/deltatask/Main2Activity.java | 7e5a29e44ff4174d0192fc0724095ffa3a583d12 | [] | no_license | gouthamcm/deltatask1 | 2f07afb04d2d547cd4ac8ef6a8e81acde2793003 | 7c7c2cd8440d216200c1907eb96a13996f0c3060 | refs/heads/master | 2020-03-17T23:50:26.476798 | 2018-05-19T18:19:24 | 2018-05-19T18:19:24 | 134,063,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package com.example.rec.deltatask;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Main2Activity extends AppCompatActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Button bt=findViewById(R.id.button);
bt.setOnClickListener(this);
}
public void onClick(View v)
{
openActivity2();
}
public void openActivity2(){
Intent i=new Intent(this,MainActivity.class);
startActivity(i);
}
}
| [
"goutham.898@gmail.com"
] | goutham.898@gmail.com |
71896463a08506d7f0c15b34c863fe9b0e60ec3f | c043c4067caa9e97e6c7a8671f24507be49a4920 | /src/main/java/com/ecommerce/shoppinghub/domain/RoleType.java | ed57af1bc7097ce33ec707c07bfa98592c97d55c | [] | no_license | rjtsaraf/ecomm | b2be3d93860d7530b347419d9f51c7f482412125 | 3d8cca359e23a7de764eca05ec18a764799643fe | refs/heads/master | 2022-12-18T14:52:50.631052 | 2020-09-27T09:24:16 | 2020-09-27T09:24:16 | 265,322,054 | 0 | 1 | null | 2020-08-01T11:28:40 | 2020-05-19T17:54:59 | Java | UTF-8 | Java | false | false | 154 | java | package com.ecommerce.shoppinghub.domain;
/**
* @author Virender Bhargav
*/
public enum RoleType {
ROLE_USER,
ROLE_MODERATOR,
ROLE_ADMIN
}
| [
"virender.bhargav@paytm.com"
] | virender.bhargav@paytm.com |
4fbba4fc0a26dd27e152e5fee841936ecfedd0a8 | 6e39b5d1145864861e82e988a7a9b10aefc08542 | /src/main/java/be/vdab/advancedtaken/services/DefaultWeerService.java | bfab714f63fef97f74266b849e70019c82d43bf4 | [] | no_license | nickloquet/advancedtaken | e324ef6fefc1b10449c94c27de740267f01a98d4 | 81080e81ff8ee0bbf45977227a74eb8736854025 | refs/heads/master | 2023-08-07T17:23:10.346749 | 2019-08-19T11:38:26 | 2019-08-19T11:38:26 | 197,158,508 | 0 | 0 | null | 2023-07-22T10:59:18 | 2019-07-16T09:00:51 | Java | UTF-8 | Java | false | false | 484 | java | package be.vdab.advancedtaken.services;
import be.vdab.advancedtaken.restclients.WeerClient;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@Service
public class DefaultWeerService implements WeerService{
private final WeerClient client;
public DefaultWeerService(WeerClient client) {
this.client = client;
}
@Override
public BigDecimal getTemperatuur(String plaats){
return client.getTemperatuur(plaats);
}
}
| [
"nick_loquet@live.be"
] | nick_loquet@live.be |
2f5b1a846fd903c60e76efc224fc4f2091e64414 | 8eb059ab34cb24751e9d9a04d49c4cd5d53d20ce | /metadata/src/main/java/org/jboss/ejb3/metadata/plugins/loader/BridgedMetaDataLoader.java | 05f02bdd11da03003e6d77b5a254ef69259ab2d9 | [] | no_license | wolfc/jboss-ejb3.obsolete | 0109c9f12100e0983333cb11803d18b073b0dbb5 | 4df1234e2f81312b3ff608f9965f9a6ad4191c92 | refs/heads/master | 2020-04-07T03:03:19.723537 | 2009-12-02T11:37:57 | 2009-12-02T11:37:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,244 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2007, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.ejb3.metadata.plugins.loader;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
import org.jboss.ejb3.metadata.ComponentMetaDataLoaderFactory;
import org.jboss.ejb3.metadata.MetaDataBridge;
import org.jboss.logging.Logger;
import org.jboss.metadata.spi.retrieval.AnnotationItem;
import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem;
import org.jboss.metadata.spi.scope.ScopeKey;
import org.jboss.metadata.spi.signature.DeclaredMethodSignature;
import org.jboss.metadata.spi.signature.Signature;
/**
* Comment
*
* @author <a href="mailto:carlo.dewolf@jboss.com">Carlo de Wolf</a>
* @version $Revision$
*/
public class BridgedMetaDataLoader<M> extends AbstractMetaDataLoader
{
private static final Logger log = Logger.getLogger(BridgedMetaDataLoader.class);
/**
* MethodMetaDataRetrieval.
*/
private class MethodMetaDataRetrieval extends AbstractMethodMetaDataLoader
{
/** The signature */
private DeclaredMethodSignature signature;
/**
* Create a new MethodMetaDataRetrieval.
*
* @param methodSignature the signature
*/
public MethodMetaDataRetrieval(DeclaredMethodSignature methodSignature)
{
this.signature = methodSignature;
}
public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
{
if(metaData == null)
return null;
for(MetaDataBridge<M> bridge : bridges)
{
T annotation = bridge.retrieveAnnotation(annotationType, metaData, classLoader, signature);
if(annotation != null)
return new SimpleAnnotationItem<T>(annotation);
}
return null;
}
}
private List<ComponentMetaDataLoaderFactory<M>> factories = new ArrayList<ComponentMetaDataLoaderFactory<M>>();
private List<MetaDataBridge<M>> bridges = new ArrayList<MetaDataBridge<M>>();
private M metaData;
private ClassLoader classLoader;
/**
*
* @param key
* @param metaData the meta data or null
* @param classLoader
*/
public BridgedMetaDataLoader(ScopeKey key, M metaData, ClassLoader classLoader)
{
this(key, metaData, classLoader, null);
}
public BridgedMetaDataLoader(ScopeKey key, M metaData, ClassLoader classLoader, List<MetaDataBridge<M>> defaultBridges)
{
super(key);
assert classLoader != null : "classLoader is null";
this.metaData = metaData;
this.classLoader = classLoader;
if(defaultBridges != null)
bridges.addAll(defaultBridges);
}
public boolean addComponentMetaDataLoaderFactory(ComponentMetaDataLoaderFactory<M> componentMetaDataLoaderFactory)
{
return factories.add(componentMetaDataLoaderFactory);
}
public boolean addMetaDataBridge(MetaDataBridge<M> bridge)
{
return bridges.add(bridge);
}
@Override
public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
{
if(metaData == null)
return null;
for(ComponentMetaDataLoaderFactory<M> factory : factories)
{
MetaDataRetrieval retrieval = factory.createComponentMetaDataRetrieval(metaData, signature, getScope(), classLoader);
if(retrieval != null)
return retrieval;
}
// TODO: shouldn't this be a factory?
if(signature instanceof DeclaredMethodSignature)
return new MethodMetaDataRetrieval((DeclaredMethodSignature) signature);
return super.getComponentMetaDataRetrieval(signature);
}
@Override
public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
{
if(metaData == null)
return null;
// Resources, EJBs etc
for(MetaDataBridge<M> bridge : bridges)
{
T annotation = bridge.retrieveAnnotation(annotationType, metaData, classLoader);
if(annotation != null)
return new SimpleAnnotationItem<T>(annotation);
}
return null;
}
}
| [
"cdewolf@redhat.com"
] | cdewolf@redhat.com |
002fb7f63a5460c4136253736ed589088bd23dde | 1c3969fb0a8ff27f99ff352ec89a3282ae250d35 | /PrimeraInstancia/org.xtext.catalogo.tests/src-gen/org/xtext/CatalogoUiInjectorProvider.java | 3368efa3121fca03eba3ced8e7b23373e8377ea9 | [] | no_license | ifgs1/Automatizacion-Catalogos-Catalina | 057c45c7b37af7c402f09d8ab663c23dd1c72f69 | 22fdba67bc847e95da41ddd7fc30b38f66155325 | refs/heads/master | 2021-01-10T10:17:49.923640 | 2015-05-26T00:37:29 | 2015-05-26T00:37:29 | 36,207,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | /*
* generated by Xtext
*/
package org.xtext;
import org.eclipse.xtext.junit4.IInjectorProvider;
import com.google.inject.Injector;
public class CatalogoUiInjectorProvider implements IInjectorProvider {
public Injector getInjector() {
return org.xtext.ui.internal.CatalogoActivator.getInstance().getInjector("org.xtext.Catalogo");
}
}
| [
"a.perez15@MISOEST-21.virtual.uniandes.edu.co"
] | a.perez15@MISOEST-21.virtual.uniandes.edu.co |
e1dd53e1e50f32e4dea136a4e55ec2b5a189c413 | a6b99dd7e4c315f21c8f5cd0eff57d4e05edaf67 | /app/src/main/java/com/hbandroid/fragmentactivitydemo/app/MyApp.java | 80f6e9009c3642db4507b33b80605111628c1127 | [] | no_license | chenbaige/singleActivityDemo | 91ce26a3d7991a79964524a582ad48548bfa2ba6 | 463ebd4d7399e1e1aaa53b77bf56b9b8b0d307ee | refs/heads/master | 2018-11-22T16:46:36.390792 | 2018-09-04T08:09:25 | 2018-09-04T08:09:25 | 115,268,482 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,744 | java | package com.hbandroid.fragmentactivitydemo.app;
import android.app.Application;
import com.hbandroid.fragmentactivitydemo.BuildConfig;
import com.hbandroid.fragmentactivitydemo.di.component.AppComponent;
import com.hbandroid.fragmentactivitydemo.di.component.DaggerAppComponent;
import com.hbandroid.fragmentactivitydemo.di.module.AppModule;
import com.hbandroid.fragmentactivitydemo.di.module.HttpModule;
import me.yokeyword.fragmentation.Fragmentation;
import me.yokeyword.fragmentation.helper.ExceptionHandler;
/**
* Title: fragmentActivityDemo
* <p>
* Description:
* <p>
* Author:baigege (baigegechen@gmail.com)
* <p>
* Date:2017-12-23
*/
public class MyApp extends Application {
private AppComponent mAppComponent;
@Override
public void onCreate() {
super.onCreate();
mAppComponent = DaggerAppComponent.builder().appModule(new AppModule(this)).httpModule(new HttpModule(this)).build();
// 建议在Application里初始化
Fragmentation.builder()
// 显示悬浮球 ; 其他Mode:SHAKE: 摇一摇唤出 NONE:隐藏
.stackViewMode(Fragmentation.BUBBLE)
.debug(BuildConfig.DEBUG)
.handleException(new ExceptionHandler() {
@Override
public void onException(Exception e) {
// 建议在该回调处上传至我们的Crash监测服务器
// 以Bugtags为例子: 手动把捕获到的 Exception 传到 Bugtags 后台。
// Bugtags.sendException(e);
}
})
.install();
}
public AppComponent getAppComponent() {
return mAppComponent;
}
}
| [
"416794267@qq.com"
] | 416794267@qq.com |
50761acd4027cd19ba0171ae2ef166d6b2a34efd | ef051d6d77fec2ca7d40daccfd6da5c561b983ad | /src/main/java/ndvi/agro/service/impl/UserServiceImpl.java | 276446a952581402b87ed0d084e868caa2e7823e | [] | no_license | petrovp/NdviAgro | bdcdff5c58721ab316dbbfbc67256345267f910f | 2e79830924a1d9e06e890499dac1ed889db6af08 | refs/heads/master | 2021-01-17T17:09:56.497831 | 2016-07-27T16:23:13 | 2016-07-27T16:23:13 | 61,425,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package ndvi.agro.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ndvi.agro.persistance.datamodel.User;
import ndvi.agro.persistance.repostories.UserRepository;
import ndvi.agro.service.UserService;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository userRepository;
@Override
public User findByUsername(String username) {
User user = userRepository.findByUsername(username);
return user;
}
}
| [
"petrepp4@gmail.com"
] | petrepp4@gmail.com |
0def3d0236fabecff4a2ec8a5742248dfd546e0d | c87325b1a3845e53b0e4bcb13741e3066cbb31b7 | /src/getStockData.java | 7e7e48b5675c657754d221f772995f277769ecf7 | [] | no_license | aashithk/Investor | b2234168486eb7e13819cbe9acb5c6afb3cc2751 | 02180c58c1f4d84542f208cb1c9384c3af341dd9 | refs/heads/master | 2021-04-26T16:44:03.082967 | 2015-11-11T11:22:19 | 2015-11-11T11:22:19 | 45,589,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,406 | java | import java.io.*;
import java.net.URL;
import java.util.ArrayList;
/**
* Created by aashithk on 9/26/15.
*/
class Row{
Double month;
Double date;
Double open;
Double high;
Double low;
Double close;
Double volume;
Double change;
Row( Double month,Double date,Double open,Double high,Double low,Double close,Double volume)
{
this.date = date;
this.month = month;
this.open = open;
this.high = high;
this.low = low;
this.close = close;
this.volume = volume;
}
void calculateChange()
{
change = close - open;
}
@Override
public String toString()
{
return (month+","+date+","+ open+","+high+","+ low+ ","+close+ ","+volume+","+ change);
}
}
public class getStockData {
// http://ichart.finance.yahoo.com/table.csv?s=AAPL&c=1962
static ArrayList<Row> getStockData(String symbol) {
ArrayList<Row> res = new ArrayList<Row>();
try {
URL myURL = new URL("http://ichart.finance.yahoo.com/table.csv?s="+symbol+"&g=d&c=1962");
InputStream stream = myURL.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(myURL.openStream()));
String line=null;
ArrayList<String> arr = new ArrayList<String>();
int current = 0;
while ((line = reader.readLine()) != null) {
if(current == 0)
{
current++;
continue;
}
arr.add(line);
}
for( String s : arr) {
String[] tokens = s.split(",");
String [] d = tokens[0].split("-");
Double month=Double.parseDouble(d[1]);
Double date=Double.parseDouble(d[2]);
Double open=Double.parseDouble(tokens[1]);
Double high=Double.parseDouble(tokens[2]);
Double low=Double.parseDouble(tokens[3]);
Double close=Double.parseDouble(tokens[4]);
Double volume=Double.parseDouble(tokens[5]);
Row each = new Row(month,date,open,high,low,close,volume);
each.calculateChange();
res.add(each);
}
System.out.print(res.size()+" ");
}
catch(Exception e)
{
System.out.print(e.toString());
}
return res;
}
static ArrayList<Row> getTestStockData(String symbol) {
ArrayList<Row> res = new ArrayList<Row>();
try {
URL myURL = new URL("http://ichart.finance.yahoo.com/table.csv?s="+symbol+"&g=d&a=0&b=1&c=2013");
InputStream stream = myURL.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(myURL.openStream()));
String line=null;
ArrayList<String> arr = new ArrayList<String>();
int current = 0;
while ((line = reader.readLine()) != null) {
if(current == 0)
{
current++;
continue;
}
arr.add(line);
}
for( String s : arr) {
String[] tokens = s.split(",");
String [] d = tokens[0].split("-");
Double month=Double.parseDouble(d[1]);
Double date=Double.parseDouble(d[2]);
Double open=Double.parseDouble(tokens[1]);
Double high=Double.parseDouble(tokens[2]);
Double low=Double.parseDouble(tokens[3]);
Double close=Double.parseDouble(tokens[4]);
Double volume=Double.parseDouble(tokens[5]);
Row each = new Row(month,date,open,high,low,close,volume);
each.calculateChange();
res.add(each);
}
}
catch(Exception e)
{
System.out.print(e.toString());
}
return res;
}
/*
* Original get data function to get data on over 25000 stock symbols found in Yahoo's Database before
* processing and filtering the dataset.
* Can read from Valid tickers file for future use cases
*/
static void getAllSymbolsData()
{
try{
BufferedReader br = new BufferedReader(new FileReader("data/tickers.csv"));
String sCurrentLine;
int record= 0;
while ((sCurrentLine = br.readLine()) != null) {
String [] arr = sCurrentLine.split(",");
String ticker = arr[0].substring(1, arr[0].length() - 1);
ArrayList<Row> temp = getStockData(ticker);
if( temp.size()> 90) {
PrintWriter writer = new PrintWriter("data/stockData/"+ticker, "UTF-8");
for(Row row: temp) {
writer.println(row);
}
writer.close();
System.out.println(++record + " " + arr[0].substring(1, arr[0].length() - 1) + " " + temp.size());
}
}
}
catch(Exception e)
{
System.out.print("");
}
}
/*
* Get all data necessary to test the model for valid tickers
*/
static void getAllValidSymbolsTestData()
{
try{
BufferedReader br = new BufferedReader(new FileReader("data/predictionProcessingData.txt"));
String sCurrentLine;
int record= 0;
while ((sCurrentLine = br.readLine()) != null) {
String [] arr = sCurrentLine.split(",");
String ticker = arr[0];
ArrayList<Row> temp = getTestStockData(ticker);
PrintWriter writer = new PrintWriter("data/TestStockData/"+ticker, "UTF-8");
for(Row row: temp) {
writer.println(row);
}
writer.close();
System.out.println(++record + " " + ticker + " " + temp.size());
}
}
catch(Exception e)
{
System.out.print(e.toString());
}
}
public static void main(String[] args)
{
// example.getStockData("AAPL");
// getAllSymbolsData();
getAllValidSymbolsTestData();
}
}
| [
"aashith_kamath@hotmail.com"
] | aashith_kamath@hotmail.com |
5ea45096bb2e0febf161c866691f18594a45b11d | 12cc14e3a322c3a7e7827a6877ce8bbcd8ad3eda | /src/main/java/com/myPollingPlaceProject/QuickPoll/repositories/OptionRepository.java | f0d078b21b15153627b3904cba2671b352879875 | [] | no_license | Jacenter/SpringRest | f267187a5fc5681028832338acf38d8d71c3cd48 | 5ccd18a886c9643d5828928a88a6d24d415a10b3 | refs/heads/main | 2023-04-14T21:59:57.412130 | 2021-05-04T19:54:32 | 2021-05-04T19:54:32 | 362,135,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package com.myPollingPlaceProject.QuickPoll.repositories;
import com.myPollingPlaceProject.QuickPoll.domain.Option;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface OptionRepository extends CrudRepository <Option, Long> {
}
| [
"JNovack1501@gmail.com"
] | JNovack1501@gmail.com |
15e67b34c244af9703704e39d0123d01e026281c | 61954be59eadaefc54644e6027bf9d96e866fa5b | /app/src/main/java/com/example/muqitt/activities/MyAppointmentsActivity.java | 3fc8d8fa92dfe3ee6a0ba072a386d05bdbe8a536 | [] | no_license | 5Mujahid/Muqit-android- | a46663b554d40dd0ec5d2e17cb1009cdf6cc3fc2 | d570a0ee54e1e17256f49d5d59f43b1465307a74 | refs/heads/master | 2020-08-05T00:19:56.459996 | 2019-10-02T11:42:41 | 2019-10-02T11:42:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | package com.example.muqitt.activities;
import com.example.muqitt.Model.Appointment;
import com.example.muqitt.Model.Login.User;
import com.example.muqitt.Retrofit.RetrofitUtil;
import com.example.muqitt.Utils.AppUtils;
import com.example.muqitt.Utils.DatabaseUtil;
import com.example.muqitt.adapters.MyAppointmentsRecyclerViewAdapter;
import java.util.List;
import static com.example.muqitt.Retrofit.RetrofitUtil.getUserAppointments;
public class MyAppointmentsActivity extends CommonProviderInfoActivity {
@Override
public void onAppointmentsLoad(List<Appointment> items) {
if(items != null && items.size() >0) {
getRecyclerView().setAdapter(new MyAppointmentsRecyclerViewAdapter(items,this));
}else{
showNoData();
}
}
@Override
protected void setAdapter() {
User user = DatabaseUtil.getInstance().getUser();
RetrofitUtil.createProviderAPI().getUserAppointments(user.getData().getID()).
enqueue(getUserAppointments(MyAppointmentsActivity.this));
}
@Override
public void onAppointmentInteraction(Appointment item, int pos) {
AppUtils.showDialog(this,item.toString(),null);
}
}
| [
"shoaib_sheikh@ucp.edu.pk"
] | shoaib_sheikh@ucp.edu.pk |
27a7f2c1e38b742a0c81664203e8a4e7f2cc6d62 | 9c69257f89881ed603c5d9744116f5d49355a289 | /src/main/java/todoapplication/model/DateSorter.java | 1e7bd4fbbfbf412eabb77a6d6619aa1983b0d437 | [] | no_license | chiangp168/ToDo-Application | 9e50f674ef16711402f7b05e50bc4f89186d54c7 | af1bc7b384baa0d5f746c035a0c6aaeb11daf309 | refs/heads/master | 2023-01-11T01:16:15.858814 | 2020-11-10T01:37:51 | 2020-11-10T01:37:51 | 311,505,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,627 | java | package todoapplication.model;
import java.util.Comparator;
import java.util.List;
/**
* A class that implements functionality to sort a collection of ToDos. This class utilizes
* the singleton pattern (eager instantiation)
*/
public class DateSorter implements Comparator<ToDo> {
private static DateSorter dateSorter;
/**
* Private constructor to instantiate the Sort by Date object
*/
private DateSorter() {};
/**
* Returns the DateSorter sort by date object
* @return the DateSorter sort by date object
*/
public static DateSorter getDateSorter() {
if (dateSorter == null) {
dateSorter = new DateSorter();
}
return dateSorter;
}
/**
* Compare method override for comparing on date
* @param toDo1 first object to be compared
* @param toDo2 second object to be compared
* @return a negative integer, zero, or a positive integer as the first argument has priority
* less than, equal to, or greater than the priority of the second.
*/
@Override
public int compare(ToDo toDo1, ToDo toDo2) {
if(toDo2.getDueDate().isBefore(toDo1.getDueDate()) == true) {
return 1;
} else if (toDo2.getDueDate().isAfter(toDo1.getDueDate()) == true) {
return -1;
} else {
return 0;
}
}
/**
* Given a list of ToDos, sorts the list by date
* @param toDos - the list of ToDos to sort by due date
* @return the sorted list of ToDos
*/
public List<ToDo> sortByDate(List<ToDo> toDos) {
toDos.sort(DateSorter.getDateSorter());
return toDos;
}
@Override
public String toString() {
return "SortByDate";
}
}
| [
"chiangp@husky.neu.edu"
] | chiangp@husky.neu.edu |
cb91712afc299cb9fd572e1c1a3111c4c0834d85 | 1911c2efcab61c3d130a8dccdcac326a35c527ca | /src/edu/usf/ratsim/nsl/modules/qlearning/update/MultiStateProportionalQLReplay.java | 15bd9f4006cfd63c883f9bfa034d19dee420f4de | [] | no_license | mllofriu/rat_simulator | 8e90b2b5a00ae0d8c4039f8d90b4f8bbd4470444 | 8947efdbe22674a5e089bc57129ca63cabb31033 | refs/heads/master | 2021-01-19T17:11:56.724555 | 2015-09-01T22:00:18 | 2015-09-01T22:00:18 | 15,622,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,386 | java | //package edu.usf.ratsim.nsl.modules.qlearning.update;
//
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.FileNotFoundException;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.io.ObjectInputStream;
//import java.io.ObjectOutputStream;
//import java.io.OutputStreamWriter;
//import java.io.PrintWriter;
//import java.util.LinkedList;
//
//import nslj.src.lang.NslDinFloat0;
//import nslj.src.lang.NslDinFloat1;
//import nslj.src.lang.NslDinInt0;
//import nslj.src.lang.NslDoutFloat2;
//import nslj.src.lang.NslModule;
//import edu.usf.experiment.subject.Subject;
//import edu.usf.experiment.universe.Universe;
//import edu.usf.ratsim.support.Configuration;
//
//public class MultiStateProportionalQLReplay extends NslModule implements
// QLAlgorithm {
//
// private static final String DUMP_FILENAME = "policy.txt";
//
// private static final float EPS = 0.2f;
//
// private static PrintWriter writer;
// private NslDinFloat0 reward;
// private NslDinInt0 takenAction;
// private NslDoutFloat2 value;
// private NslDinFloat1 statesBefore;
//
// private float alpha;
// private float discountFactor;
// private NslDinFloat1 statesAfter;
// private int numStates;
//
// private NslDinFloat1 actionVotesAfter;
//
// private NslDinFloat1 actionVotesBefore;
//
// private boolean update;
//
// private Subject subject;
//
// private LinkedList<History> history;
//
// public MultiStateProportionalQLReplay(String nslMain, NslModule nslParent,
// Subject subject, int numStates, int numActions,
// float discountFactor, float alpha, float initialValue) {
// super(nslMain, nslParent);
//
// this.discountFactor = discountFactor;
// this.alpha = alpha;
// this.numStates = numStates;
// this.subject = subject;
//
// takenAction = new NslDinInt0(this, "takenAction");
// reward = new NslDinFloat0(this, "reward");
// statesBefore = new NslDinFloat1(this, "statesBefore", numStates);
// statesAfter = new NslDinFloat1(this, "statesAfter", numStates);
//
// value = new NslDoutFloat2(this, "value", numStates, numActions);
// File f = new File("policy.obj");
// if (f.exists()
// && Configuration.getBoolean("Experiment.loadSavedPolicy")) {
//
// try {
// System.out.println("Reading saved policy...");
// FileInputStream fin;
// fin = new FileInputStream(f);
// ObjectInputStream ois = new ObjectInputStream(fin);
// value.set((float[][]) ois.readObject());
// } catch (FileNotFoundException e) {
// value.set(initialValue);
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (ClassNotFoundException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// } else {
// value.set(initialValue);
// }
//
// actionVotesAfter = new NslDinFloat1(this, "actionVotesAfter",
// numActions);
// actionVotesBefore = new NslDinFloat1(this, "actionVotesBefore",
// numActions);
//
// history = new LinkedList<History>();
//
// update = true;
// }
//
// public void simRun() {
// // Gets the active state as computed at the beginning of the cycle
// int a = takenAction.get();
// float r = reward.get();
// History h = new History(statesBefore.get(), statesAfter.get(),
// actionVotesAfter.get(), a, r);
// history.add(h);
//
// // Updates may be disabled for data log reasons
// if (update) {
// // Update only on rewards
// if (r > 0){
// // Update whole history many times
// for (int i = 0; i < 1; i++)
// for (History hist : history)
// update(hist);
// history.clear();
// }
//
// }
// }
//
// private void update(History h) {
// float maxExpectedR = Float.NEGATIVE_INFINITY;
// for (int action = 0; action < h.getActionsVotes().length; action++)
// if (maxExpectedR < h.getActionsVotes()[action])
// maxExpectedR = h.getActionsVotes()[action];
//
// // Do the update once for each state
// for (int stateBefore = 0; stateBefore < h.getStatesBefore().length; stateBefore++)
// // Dont bother if the activation is to small
// if (h.getStatesBefore()[stateBefore] > EPS)
// updateLastAction(stateBefore, h.getStatesBefore()[stateBefore],
// h.getAction(), h.getReward(), maxExpectedR);
// }
//
// private void updateLastAction(int sBefore, float sBeforeActivation, int a,
// float reward, float maxERNextState) {
// float val = value.get(sBefore, a);
// float delta = alpha
// * (reward + discountFactor * (maxERNextState) - val);
// float newValue = sBeforeActivation * (val + delta)
// + (1 - sBeforeActivation) * val;
//
// if (Float.isInfinite(newValue) || Float.isNaN(newValue))
// System.out.println("Numeric Error");
// value.set(sBefore, a, newValue);
// }
//
// public void setUpdatesEnabled(boolean enabled) {
// update = enabled;
// }
//
// @Override
// public void savePolicy() {
// FileOutputStream fout;
// try {
// fout = new FileOutputStream("policy.obj");
// ObjectOutputStream oos = new ObjectOutputStream(fout);
// oos.writeObject(value._data);
// } catch (FileNotFoundException e) {
// e.printStackTrace();
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// }
//
// @Override
// public void dumpPolicy(String trial, String groupName, String subName,
// String rep, int numIntentions, Universe universe, Subject subject) {
// // TODO Auto-generated method stub
//
// }
//
// } | [
"mllofriu@gmail.com"
] | mllofriu@gmail.com |
514f1e287c136f99f6192a28c706950923689354 | 6acc020474f2799e76befad9e92a16b640a418b6 | /sdk/greengrass/greengrass-client/src/event-stream-rpc-java/model/software/amazon/awssdk/aws/greengrass/model/FailedUpdateConditionCheckError.java | 28ea78d56515167f698d3ea0ec338bcd0fec8762 | [
"Apache-2.0"
] | permissive | QPC-database/aws-iot-device-sdk-java-v2 | d2ccf3fc79fa03704778c8d8882d1e123447b7f4 | c3b4e5ea8c81a3c447e2d1d8016cb5da45e9a022 | refs/heads/main | 2023-06-04T03:16:36.240571 | 2021-07-07T20:37:45 | 2021-07-07T20:37:45 | 384,719,471 | 1 | 0 | Apache-2.0 | 2021-07-10T14:38:45 | 2021-07-10T14:38:45 | null | UTF-8 | Java | false | false | 2,023 | java | package software.amazon.awssdk.aws.greengrass.model;
import com.google.gson.annotations.Expose;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;
public class FailedUpdateConditionCheckError extends GreengrassCoreIPCError implements EventStreamJsonMessage {
public static final String APPLICATION_MODEL_TYPE = "aws.greengrass#FailedUpdateConditionCheckError";
public static final FailedUpdateConditionCheckError VOID;
static {
VOID = new FailedUpdateConditionCheckError() {
@Override
public boolean isVoid() {
return true;
}
};
}
@Expose(
serialize = true,
deserialize = true
)
private Optional<String> message;
public FailedUpdateConditionCheckError(String errorMessage) {
super("FailedUpdateConditionCheckError", errorMessage);
this.message = Optional.ofNullable(errorMessage);
}
public FailedUpdateConditionCheckError() {
super("FailedUpdateConditionCheckError", "");
this.message = Optional.empty();
}
@Override
public String getErrorTypeString() {
return "client";
}
public String getMessage() {
if (message.isPresent()) {
return message.get();
}
return null;
}
public void setMessage(final String message) {
this.message = Optional.ofNullable(message);
}
@Override
public String getApplicationModelType() {
return APPLICATION_MODEL_TYPE;
}
@Override
public boolean equals(Object rhs) {
if (rhs == null) return false;
if (!(rhs instanceof FailedUpdateConditionCheckError)) return false;
if (this == rhs) return true;
final FailedUpdateConditionCheckError other = (FailedUpdateConditionCheckError)rhs;
boolean isEquals = true;
isEquals = isEquals && this.message.equals(other.message);
return isEquals;
}
@Override
public int hashCode() {
return Objects.hash(message);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
dd57b31c0b26c645683afbb485ba1336522ab2d0 | f6c150fcd67a085a2d9c1db865a8f8fb88d6bb6e | /Guper/app/src/main/java/com/davidpopayan/sena/guper/Controllers/splash.java | 6b77517517004babcdbc100391f919d90c0e9632 | [] | no_license | DARWorldSkills/ComplementoGuper | a66c146aaa2372d4f329d0af7dba5d58215b4a5e | 51dc28cf39040852daf8e5e093d0a3c572b32748 | refs/heads/master | 2020-03-20T19:03:59.961674 | 2018-06-17T00:42:57 | 2018-06-17T00:42:57 | 137,619,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package com.davidpopayan.sena.guper.Controllers;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.davidpopayan.sena.guper.R;
import java.util.Timer;
import java.util.TimerTask;
public class splash extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
Intent intent = new Intent(splash.this, Login.class);
startActivity(intent);
finish();
}
};
Timer timer = new Timer();
timer.schedule(timerTask, 1000);
}
}
| [
"popayan159@gmail.com"
] | popayan159@gmail.com |
943653fb02faf2da63302d4c0c9b3fdfb2dcc90a | 84b292a51b12653e8890b8f0585a5118cf366be2 | /ch02-di-xml/src/main/java/com/dlkyy/ba04/School.java | b04b4d98a1f6994ae5e6ae62abe2c9ecb79d40da | [] | no_license | dddllk/spring-course | b8aedc1162d60fa7515027626464ea8704012e20 | 0cc1d1d88749cd2c0fee15f1b5a307b58b8b1ed5 | refs/heads/master | 2023-04-16T14:41:47.568124 | 2021-04-29T11:05:27 | 2021-04-29T11:05:27 | 359,478,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | package com.dlkyy.ba04;
/**
* Created by dlkyy on 2021/4/17 19:50
*/
public class School {
private String address;
private String name;
public School() {
}
public void setAddress(String address) {
this.address = address;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "School{" +
"address='" + address + '\'' +
", name='" + name + '\'' +
'}';
}
}
| [
"474464152@qq.com"
] | 474464152@qq.com |
9ac7be83a542977bb86ab43472b04dd298a1d95b | 289afcaaf18e3dfde8b141294d6f41b933332b30 | /app/src/main/java/com/example/sion10032/hmsystem/EMedBoxPageFragment.java | da36ebdc23c38708356e7825ee260e05e98548ef | [] | no_license | VincentZZZZZ/HMSystem | 14e75746cf994c18d302c1554892df8b475b7a61 | b3fd8cd3376a04740d5756047308ef932ec47eca | refs/heads/master | 2021-08-11T22:17:40.170210 | 2017-11-14T05:42:07 | 2017-11-14T05:42:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,218 | java | package com.example.sion10032.hmsystem;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.os.Bundle;
import android.app.Fragment;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.sion10032.hmsystem.backend.Medicine;
import com.example.sion10032.hmsystem.backend.User;
import java.util.ArrayList;
import java.util.UUID;
public class EMedBoxPageFragment extends Fragment implements View.OnClickListener {
FloatingActionButton mFloatingActionButton;
RecyclerView mRecyclerView;
LinearLayoutManager mLayoutManager;
EMedBoxAdapter mEMedBoxAdapter;
User test;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_emed_box_page, container, false);
initListener(view);
initRecyclerView(view);
return view;
}
public void initListener(View view){
mFloatingActionButton = view.findViewById(R.id.addMedFab);
mFloatingActionButton.setOnClickListener(this);
}
public void initRecyclerView(View view){
// Get the RecyclerView
mRecyclerView = view.findViewById(R.id.EMedBox_Recycler_View);
// Set the LayoutManager of RecyclerView
mLayoutManager = new LinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
// TODO just for test, remember to delete in the future
test = new User(UUID.fromString("550e8400-e29b-41d4-a716-446655440000"), getContext());
Medicine med;
for(int i = 0; i < 30; ++i){
med = new Medicine(UUID.randomUUID(),
"MED #" + i,
"MED #" + i + "'s Description.",
"",
10,
false);
test.addMed(med);
}
// Set the Adapter
mEMedBoxAdapter = new EMedBoxAdapter(test);
mRecyclerView.setAdapter(mEMedBoxAdapter);
}
@Override
public void onClick(View v) {
for(Medicine i : test.getAllMed())
i.setDescription(i.getDescription()+" (Changed) ");
Medicine med = new Medicine(UUID.randomUUID(),
"MED #" + test.getAllMed().size(),
"MED #" + test.getAllMed().size() + "'s Description.",
"",
10,
false);
test.addMed(med);
mEMedBoxAdapter.notifyItemChanged(test.getAllMed().size());
}
}
class EMedBoxAdapter extends RecyclerView.Adapter<EMedBoxAdapter.ViewHolder> {
public User datas = null;
public ArrayList<Medicine> Meds;
public EMedBoxAdapter(User datas) {
this.datas = datas;
Meds = datas.getAllMed();
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater
.from(viewGroup.getContext()), R.layout.med_item_layout, viewGroup, false);
ViewHolder vh = new ViewHolder(binding.getRoot());
vh.setBinding(binding);
return vh;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.getBinding().setVariable(com.example.sion10032.hmsystem.BR.Med,
Meds.get(position));
holder.getBinding().executePendingBindings();
}
@Override
public int getItemCount() {
return Meds.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private ViewDataBinding binding;
public ViewHolder(View view){
super(view);
}
public void setBinding(ViewDataBinding binding) {
this.binding = binding;
}
public ViewDataBinding getBinding() {
return this.binding;
}
}
}
| [
"sion10032@hotmail.com"
] | sion10032@hotmail.com |
f4eb0f4d8a32e60d25cdd31713509fa12480425d | 9389e5a7a92ae296d59c278653dfc080c92fab2c | /app/src/main/java/com/android/mvvm/frameprojmvvm/api/common/CommonApi.java | 28042592a2091674d3e132fe61243247723ccccf | [] | no_license | liuhuiAndroid/FrameProjMVVM | 658e43de74fa7e53b79d0e13be9abb3d4969e019 | 9a84fbad5270850dc56aa2dbacac23dae405ddf9 | refs/heads/master | 2021-01-02T23:00:03.357432 | 2017-08-08T05:56:16 | 2017-08-08T05:56:17 | 99,435,588 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,681 | java | package com.android.mvvm.frameprojmvvm.api.common;
import com.android.frameproj.library.Constants;
import com.android.frameproj.library.bean.HttpResult;
import com.android.mvvm.frameprojmvvm.components.retrofit.RequestHelper;
import com.android.mvvm.frameprojmvvm.components.storage.UserStorage;
import java.io.File;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by WE-WIN-027 on 2016/9/27.
*
* @des ${实现接口的调用}
*/
public class CommonApi {
private CommonService mCommonService;
private RequestHelper mRequestHelper;
private UserStorage mUserStorage;
public CommonApi(OkHttpClient mOkHttpClient, RequestHelper requestHelper, UserStorage userStorage) {
this.mRequestHelper = requestHelper;
mUserStorage = userStorage;
Retrofit retrofit =
new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create())
.client(mOkHttpClient)
.baseUrl(Constants.BASE_URL)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();
mCommonService = retrofit.create(CommonService.class);
}
/**
* 对网络接口返回的Response进行分割操作
*
* @param response
* @param <T>
* @return
*/
public static <T> Observable<T> flatResponse(final HttpResult<T> response) {
return Observable.create(new ObservableOnSubscribe<T>() {
@Override
public void subscribe(@NonNull ObservableEmitter<T> e) throws Exception {
if (!e.isDisposed()) {
if (response.isSuccess()) {
e.onNext(response.getResultValue());
e.onComplete();
} else {
e.onError(new APIException(response.getResultStatus().getCode(),
response.getResultStatus().getMessage()));
}
}
}
});
}
/**
* 自定义异常,当接口返回的code不为Constants.OK时,需要跑出此异常
* eg:登陆时验证码错误;参数为传递等
*/
public static class APIException extends Exception {
public int code;
public String message;
public APIException(int code, String message) {
this.code = code;
this.message = message;
}
@Override
public String getMessage() {
return message;
}
}
public static final String MULTIPART_FORM_DATA = "multipart/form-data";
@android.support.annotation.NonNull
public static RequestBody createPartFromString(String descriptionString) {
return RequestBody.create(
MediaType.parse(MULTIPART_FORM_DATA), descriptionString);
}
@android.support.annotation.NonNull
public static MultipartBody.Part prepareFilePart(String partName, File file) {
// https://github.com/iPaulPro/aFileChooser/blob/master/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java
// use the FileUtils to get the actual file by uri
// create RequestBody instance from file
RequestBody requestFile =
RequestBody.create(MediaType.parse(MULTIPART_FORM_DATA), file);
// MultipartBody.Part is used to send also the actual file name
return MultipartBody.Part.createFormData(partName, file.getName(), requestFile);
}
@android.support.annotation.NonNull
public static MultipartBody.Part createPartString(String name, String value) {
// RequestBody requestFile =
// RequestBody.create(MediaType.parse(MULTIPART_FORM_DATA), value);
return MultipartBody.Part.createFormData(name, value);
}
// ======================================= API
/**
* 日志上传
*/
public Observable<ResponseBody> uploadErrorFiles(String appId, String deviceType,
String osVersion, String deviceModel, String log) {
return mCommonService.uploadErrorFiles(appId, deviceType, osVersion, deviceModel,log).subscribeOn(Schedulers.io());
}
}
| [
"642404044@qq.com"
] | 642404044@qq.com |
e4de280bb8b40f60a6c25483145e57017461bea6 | 94aeacb6f80fdbb7823123671137e5ed774a2785 | /app/src/main/java/com/app/appbook/Book.java | 13663427b81d8f2f9ed121c7134b40152aa69396 | [] | no_license | Oday-Alhamwi/AppBook | 02e026ee9c2a88b6c4255312d0a8692f63cf9539 | f49f57d98c194d5ea2822f24fdaeb0bb512e3988 | refs/heads/main | 2022-12-28T07:18:39.322291 | 2020-10-11T15:58:48 | 2020-10-11T15:58:48 | 303,147,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package com.app.appbook;
class Book {
private String title;
private String cover;
public Book() {
}
public Book(String title, String cover) {
this.title = title;
this.cover = cover;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
}
| [
"odyhamwi@gmail.com"
] | odyhamwi@gmail.com |
fc3f75694ab24e15d24ccadb723ab806a142cfb7 | e21d17cdcd99c5d53300a7295ebb41e0f876bbcb | /22_Chapters_Edition/src/main/resources/ExampleCodes/generics/ComparablePet.java | 7765105ebe854b186da2a520477a8a4e1f82e825 | [] | no_license | lypgod/Thinking_In_Java_4th_Edition | dc42a377de28ae51de2c4000a860cd3bc93d0620 | 5dae477f1a44b15b9aa4944ecae2175bd5d8c10e | refs/heads/master | 2020-04-05T17:39:55.720961 | 2018-11-11T12:07:56 | 2018-11-11T12:08:26 | 157,070,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package ExampleCodes.generics;//: generics/ComparablePet.java
public class ComparablePet
implements Comparable<ComparablePet> {
public int compareTo(ComparablePet arg) { return 0; }
} ///:~
| [
"lypgod@hotmail.com"
] | lypgod@hotmail.com |
995c6dda0906ddc054a005fb6b1c708d3409c2d8 | c758fbe9b429fe3fa1275b52edfc3e7829116502 | /WIP/Sources/Android/TaxiNetMD/src/vn/co/taxinet/mobile/alert/AlertDialogManager.java | 7215479b9ffba5b9f9097f93a93fc8a1823302b6 | [] | no_license | sangnvus/tns-project | 83d0103f3c8ca73b61047e3261cb05609c2d501a | 706923c6f3deacbd929525f34e8c0b671fd0d5f4 | refs/heads/master | 2016-09-06T10:50:27.643835 | 2015-03-13T03:30:59 | 2015-03-13T03:30:59 | 32,120,530 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,801 | java | package vn.co.taxinet.mobile.alert;
import vn.co.taxinet.mobile.R;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
public class AlertDialogManager {
/**
* Function to display simple Alert Dialog
*
* @param context
* - application context
* @param title
* - alert dialog title
* @param message
* - alert message
* @param status
* - success/failure (used to set icon) - pass null if you don't
* want icon
* */
public void showAlertDialog(Context context, String title, String message,
Boolean status) {
AlertDialog alertDialog = new AlertDialog.Builder(context).create();
// Setting Dialog Title
alertDialog.setTitle(title);
// Setting Dialog Message
alertDialog.setMessage(message);
if (status != null)
// Setting alert dialog icon
alertDialog
.setIcon((status) ? R.drawable.success : R.drawable.fail);
// Setting OK Button
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
// Showing Alert Message
alertDialog.show();
}
public void showCancelRequestAlert(Context context, String title,
String message) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
builder.setMessage(message);
builder.setPositiveButton(context.getString(R.string.accept),
new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
}
});
builder.setCancelable(false);
builder.show();
}
}
| [
"hieudtse02895@fpt.edu.vn@88ba3ff6-d7b0-eaa4-419e-cdb00ae9c095"
] | hieudtse02895@fpt.edu.vn@88ba3ff6-d7b0-eaa4-419e-cdb00ae9c095 |
f9fdd7d349c7769453f65af8e8c9a80ef4b57dba | 704f2ec7b037b2c075a237eeaaa6f3a20e1b6097 | /src/main/java/com/league/blockchain/socket/body/BlockHash.java | 9afbc4ff5b2b18d7689656475c6076c25ac431f4 | [] | no_license | WangShouDao/league_blockchain | d56b5f908823d27542c47eded45409cd8c80cb3a | bc28efd27b70dd3dab4cdab55ff5b8765b2b09db | refs/heads/master | 2020-03-24T23:51:40.562442 | 2018-08-04T19:35:36 | 2018-08-04T19:35:36 | 143,157,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package com.league.blockchain.socket.body;
public class BlockHash {
private String hash;
private String prevHash;
private String appId;
public BlockHash(){
}
public BlockHash(String hash, String prevHash, String appId){
this.hash = hash;
this.prevHash = prevHash;
this.appId = appId;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public String getPrevHash() {
return prevHash;
}
public void setPrevHash(String prevHash) {
this.prevHash = prevHash;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
}
| [
"1248773432@qq.com"
] | 1248773432@qq.com |
e68bdf9cad2bc4f41f8625d16cde563753a0d4d0 | 36f36ad9cae6cb6c3b197a3e6b37ad281ee0cb52 | /Java/LearnJava/src/InheritanceTest/Zoo.java | 8caac3a9099d0a82103cc809900c2993d0b93775 | [] | no_license | hongnguyen-nbcuni/Tutorials | c45f1fec37cd3b0cbde35fdc441b86a51d789c4e | 1c9870ac227e7fd8bc64377e412e487e7b31d1f7 | refs/heads/master | 2023-05-06T20:07:45.382494 | 2021-05-24T02:47:19 | 2021-05-24T02:47:19 | 339,528,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 183 | java | package InheritanceTest;
public class Zoo {
public void feedAnimals(Animal[] animals) {
for (Animal animal : animals) {
animal.eat();
animal.age();
}
}
}
| [
"Hong.Nguyen@nbcuni.com"
] | Hong.Nguyen@nbcuni.com |
36465dce2c8fee9c5f19e72bb70edbcfaf32c7a1 | d2085537332926132584f87c92352a4be172c26f | /src/org/omg/CosNaming/NamingContextPackage/NotEmpty.java | 4e1053ee357fba1b918025810c21980ab2868119 | [] | no_license | changyuansky/jdk1.8-source-code-analysis | df3e786f0c78c3f7184f7fa36771540cad04be16 | e5157c73fd724029bd224e9b3e20bd841bed5169 | refs/heads/master | 2022-11-27T18:31:27.043261 | 2020-08-04T13:33:41 | 2020-08-04T13:33:41 | 284,983,365 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | package org.omg.CosNaming.NamingContextPackage;
/**
* org/omg/CosNaming/NamingContextPackage/NotEmpty.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /Users/java_re/workspace/8-2-build-macosx-x86_64/jdk8u181/11358/corba/src/share/classes/org/omg/CosNaming/nameservice.idl
* Saturday, July 7, 2018 1:04:11 AM PDT
*/
public final class NotEmpty extends org.omg.CORBA.UserException
{
public NotEmpty ()
{
super(NotEmptyHelper.id());
} // ctor
public NotEmpty (String $reason)
{
super(NotEmptyHelper.id() + " " + $reason);
} // ctor
} // class NotEmpty
| [
"1725520858@qq.com"
] | 1725520858@qq.com |
a2f578c0c3c3e84b787878a397533cc06f7911e6 | fb0ada33d78e612e74205d9fcb2e618af7869e45 | /src/test/java/com/tcc/helidacosta/basic/FasTipTestiOS.java | f553d6d1820ff9583f13fdf643b0bb193431c23d | [] | no_license | helidacosta/appium-cross-platform-example-master | dd893c35dd7e4a80898c6f84631b1f04eb6f48ed | 09923ceb1a3cfd45acb3d1a18709afe0d4babc36 | refs/heads/master | 2021-01-01T17:40:34.545103 | 2017-07-27T02:17:58 | 2017-07-27T02:17:58 | 98,130,704 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,683 | java | package com.tcc.helidacosta.basic;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.tcc.helidacosta.po.MainScreenPageObject;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
public class FasTipTestiOS {
private AppiumDriver<MobileElement> driver;
@Before
public void setup() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.APP, new File("app/FasTip.app").getAbsolutePath());
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone SE");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.2");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
driver = new IOSDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@After
public void tearDown() {
driver.quit();
}
@Test
public void testCalculateDefaultTip() {
MainScreenPageObject mainScreen = new MainScreenPageObject(driver);
mainScreen.fillBillAmount("100");
mainScreen.clickCalculateTip();
assertEquals("$15.00", mainScreen.getTipAmount());
assertEquals("$115.00", mainScreen.getTotalAmount());
}
}
| [
"helidalu.oliveira@gmail.com"
] | helidalu.oliveira@gmail.com |
bfc9475d361d56a0d1b71129630779bfaa00c3e9 | 14b9ddc3b31f8f652f974558780810375a9382a2 | /pro/src/com/huanglin/pro/service/UserService.java | 1970d4ead5f543d4bcb648a6ee689d96ba02f192 | [] | no_license | huanglinpro/jcwj | afce8b6fed201cc803a93631e97cc1851b2eadec | b80457925a648c56e5fdf9cf5ed6771d11debf54 | refs/heads/master | 2020-03-21T03:24:28.175290 | 2018-06-20T15:38:51 | 2018-06-20T15:38:51 | 138,052,061 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 298 | java | /**
*
*/
package com.huanglin.pro.service;
import java.util.List;
import com.huanglin.pro.domain.User;
/**
* @author lenovo
*
*/
public interface UserService extends BaseService {
void add();
void delete();
void update();
User findByid();
User findByName();
List<User> load();
}
| [
"2498266742@qq.com"
] | 2498266742@qq.com |
ace65441bc7d3832089795f2f9a65f4894957649 | f70cf3ca7af76fb6da7eaa6a1eebd561099d53b9 | /app/src/main/java/com/wenping/android_architecture/view/activity/UserDetailsActivity.java | 385828baecac9b440cb01168290cec1a89cfdc83 | [] | no_license | liuwenping828/android-architecture-moudle | 1d30a8701dc20e10c8a19a184459c42aaaff60e1 | 4e0caa474a671841dd846d4dc51c5e5f017a5912 | refs/heads/master | 2021-01-01T05:22:58.338249 | 2016-05-12T09:52:39 | 2016-05-12T09:52:39 | 58,629,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.wenping.android_architecture.view.activity;
import android.content.Context;
import android.content.Intent;
/**
* Created by Administrator on 2016/4/28.
*/
public class UserDetailsActivity extends BaseActivity {
public static Intent getCallingIntent(Context context, int userId) {
return new Intent(context,UserDetailsActivity.class);
}
}
| [
"851144180@qq.com"
] | 851144180@qq.com |
8efd7c2b56047f789d5e3b169a59764db424198e | d7df6ee544706b6cdab72e4960a4e228435edc18 | /gmall-api/src/main/java/gmall/cms/service/OmsOrderSettingService.java | da3c5e89ef3117363064a222b288ac6c086b6886 | [] | no_license | oscarluo-lang/gmall | bcb5572fd3b537e9a38bf7b90aba2d40f855ba5e | 0f04ed5d1131cc61d7b0dd2ccc2fd3e2ad78268d | refs/heads/master | 2022-06-27T20:05:03.609219 | 2020-01-19T10:38:49 | 2020-01-19T10:38:49 | 234,678,862 | 0 | 0 | null | 2022-06-21T02:39:58 | 2020-01-18T04:02:38 | Java | UTF-8 | Java | false | false | 302 | java | package gmall.cms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import gmall.cms.entity.OmsOrderSetting;
/**
* <p>
* 订单设置表 服务类
* </p>
*
* @author oscar
* @since 2020-01-18
*/
public interface OmsOrderSettingService extends IService<OmsOrderSetting> {
}
| [
"oscar_0921@qq.com"
] | oscar_0921@qq.com |
88620885abc68eb9018d00f41ca99738a5f873b6 | 928a526243c0cced8fe4c5aae131abf221998bfe | /less06/src/ru/geekbrains/lesson06/Dog.java | a7e890ce00030539d6c7a5dc2939521735722824 | [] | no_license | inginginger/java_lvl1 | 92338ce50675e85b447dfa10eae50ee69717e275 | 71b80a0969a18b2da51d0f2c4a46cd8e96f7870d | refs/heads/master | 2021-01-22T10:47:01.009879 | 2017-02-15T08:43:26 | 2017-02-15T08:43:26 | 82,039,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package ru.geekbrains.lesson06;
import ru.geekbrains.lesson06.Animal;
public class Dog extends Animal{
public Dog (String name){
super(name);
maxRunLength = 500;
maxSwimLength = 10;
maxJumpHeight = 0.5f;
}
}
| [
"umka.91@mail.ru"
] | umka.91@mail.ru |
6e9279c8efc86c824bb4e289002eaf5943d79b0b | 4b7f75eee68419263f506b0ae25bc0daa1908473 | /src/test/java/com/taller1/CristianLasso/test/Dao/PreconditionDaoTest.java | 6be810910e591d6d0642c9114c379ff063f95ef7 | [] | no_license | CristianLasso/ComputacionFinal | f4b798cd19892f8a04ef0c09f8f4bdcbf42f4b20 | 7ae25bcd78b3987222ee697abcf0546ecb25af98 | refs/heads/master | 2023-06-03T13:49:00.069753 | 2021-06-18T19:38:03 | 2021-06-18T19:38:03 | 377,979,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,546 | java | package com.taller1.CristianLasso.test.Dao;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import javax.persistence.PersistenceContext;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.taller1.CristianLasso.Taller1Application;
import com.taller1.CristianLasso.back.DAOs.PreconditionDao;
import com.taller1.CristianLasso.back.model.Precondition;
@DirtiesContext
@SpringBootTest
@ContextConfiguration(classes = {PersistenceContext.class, Taller1Application.class})
public class PreconditionDaoTest {
@Autowired
public PreconditionDao preconDao;
protected Precondition precon;
protected void setup() {
precon = new Precondition();
}
@Autowired
public PreconditionDaoTest(PreconditionDao autotransitionDao) {
this.preconDao = autotransitionDao;
}
@Test
protected void test1() {
assertTrue(true);
}
@Test
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
protected void saveTest() {
setup();
preconDao.save(precon);
assertNotNull(preconDao.findById(precon.getPreconId()));
}
@Test
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
protected void deleteTest() {
setup();
preconDao.save(precon);
assertNotNull(preconDao.findById(precon.getPreconId()));
preconDao.delete(precon);
assertNull(preconDao.findById(precon.getPreconId()));
}
@Test
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
protected void editTest() {
setup();
preconDao.save(precon);
precon.setPreconLogicaloperand("OR");
preconDao.edit(precon);
assertEquals("OR", preconDao.findById(precon.getPreconId()).getPreconLogicaloperand());
}
@Test
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
protected void findByIdTest() {
setup();
preconDao.save(precon);
assertEquals(5, preconDao.findById(precon.getPreconId()).getPreconId());
}
}
| [
"47828389+CristianLasso@users.noreply.github.com"
] | 47828389+CristianLasso@users.noreply.github.com |
f3f1d0b90b77cbe7e1cc3d24d8bc58c12e541067 | f1b27686ab324849fa5d5f36070a4b0cf5c1c234 | /app/src/main/java/com/example/sujeet/todo/PageFragment.java | 3377d6d12829ce6615c350d6eac93664c31bee31 | [] | no_license | sujeet14108/ToDo | 9e64ca1cacf51433e851d4eed45c3d2b26f0660d | 482a3d92a6360391f2ae5e66e0077b69c5f5b819 | refs/heads/master | 2021-01-09T23:35:45.087262 | 2016-11-09T16:35:33 | 2016-11-09T16:35:33 | 73,215,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,979 | java | package com.example.sujeet.todo;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
/**
* Created by sujeet on 9/11/16.
*/
public class PageFragment extends Fragment {
public static PageFragment newInstance(Student singleContact) {
PageFragment pageFragment = new PageFragment();
Bundle bundle = new Bundle();
/* bundle.putString("name", singleContact.getName());
bundle.putString("phone", singleContact.getPhone());
pageFragment.setArguments(bundle);*/
bundle.putSerializable("contact", singleContact);
pageFragment.setArguments(bundle);
return pageFragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment, container, false);
final TextView textView1 = (TextView) view.findViewById(R.id.textView1);
final TextView textView2 = (TextView) view.findViewById(R.id.textView2);
final TextView textView3 = (TextView) view.findViewById(R.id.textView7);
Student cont= (Student) getArguments().getSerializable("contact");
textView1.setText(cont.getname());
textView2.setText(cont.getdes());
textView3.setText(cont.getyear());
Button btnClick=(Button) view.findViewById(R.id.btnClick);
btnClick.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getActivity(), "Selected "+textView1.getText().toString(), Toast.LENGTH_SHORT).show();
}
});
return view;
}
}
| [
"sujeet14108@iiitd.ac.in"
] | sujeet14108@iiitd.ac.in |
e3b665164f64578fe2a6b90eec93321ed67fdb1f | 2069e718b8732827ebde70c0f40e48ec6e4e7126 | /app/src/main/java/com/example/androidui/MaterialDesignActivity.java | fa5b8e27f096a448fc13a75de0d9c20cfaacc52c | [] | no_license | jnuwxc/AndroidUI | 263b3d35c738f0704817016392d8d9c7cf97f56a | e0761ef80126d7ff8305a93babf06d7ca3121b4c | refs/heads/master | 2023-04-28T03:09:37.111434 | 2021-05-18T09:42:01 | 2021-05-18T09:42:01 | 362,656,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,250 | java | package com.example.androidui;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import com.google.android.material.snackbar.Snackbar;
public class MaterialDesignActivity extends AppCompatActivity {
private DrawerLayout drawerLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_material_design);
Toolbar toolbar = findViewById(R.id.toolBar);
setSupportActionBar(toolbar);
drawerLayout = findViewById(R.id.drawerLayout);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu);
findViewById(R.id.fab).setOnClickListener(v -> {
Snackbar.make(v, "Data deleted", Snackbar.LENGTH_SHORT).setAction("Undo", v1 -> {
Toast.makeText(this, "Data restored", Toast.LENGTH_SHORT).show();
}).show();
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.toolbar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.backup :
Toast.makeText(this, "you clicked backup", Toast.LENGTH_SHORT).show();
break;
case R.id.delete :
Toast.makeText(this, "you clicked delete", Toast.LENGTH_SHORT).show();
break;
case R.id.setting :
Toast.makeText(this, "you clicked setting", Toast.LENGTH_SHORT).show();
break;
case android.R.id.home:
drawerLayout.openDrawer(GravityCompat.START);
break;
default:
throw new IllegalStateException("Unexpected value: " + item.getItemId());
}
return true;
}
} | [
"1165124074@qq.com"
] | 1165124074@qq.com |
7aad1e3c1a6649a626b837f55fa7257e15461eab | ec4aef0e9b0a26a7f067f5e6d755a903a1e17bd9 | /gmall-pms/src/main/java/com/atguigu/gmall/pms/entity/AttrGroupEntity.java | c7b83344cc74981ac7465309ee6672e9e6d1284f | [
"Apache-2.0"
] | permissive | myxiaofu/gmall | 5205bd323768cdd7097223660b95afc0b3547a94 | a1110b43d2f493436e274165668173b07b847eae | refs/heads/master | 2022-07-30T16:15:03.122514 | 2020-03-06T15:38:01 | 2020-03-06T15:38:01 | 245,444,869 | 1 | 0 | Apache-2.0 | 2022-07-06T20:47:36 | 2020-03-06T14:48:00 | JavaScript | UTF-8 | Java | false | false | 1,212 | java | package com.atguigu.gmall.pms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 属性分组
*
* @author lixianfeng
* @email lxf@atguigu.com
* @date 2020-03-06 18:57:26
*/
@ApiModel
@Data
@TableName("pms_attr_group")
public class AttrGroupEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 分组id
*/
@TableId
@ApiModelProperty(name = "attrGroupId",value = "分组id")
private Long attrGroupId;
/**
* 组名
*/
@ApiModelProperty(name = "attrGroupName",value = "组名")
private String attrGroupName;
/**
* 排序
*/
@ApiModelProperty(name = "sort",value = "排序")
private Integer sort;
/**
* 描述
*/
@ApiModelProperty(name = "descript",value = "描述")
private String descript;
/**
* 组图标
*/
@ApiModelProperty(name = "icon",value = "组图标")
private String icon;
/**
* 所属分类id
*/
@ApiModelProperty(name = "catelogId",value = "所属分类id")
private Long catelogId;
}
| [
"15455206@qq.com"
] | 15455206@qq.com |
83540fa8bdbc1c1947b0065d7650f6153cd6b017 | bc50cbcbe9a79882b64e664caf5e5666ee2cd190 | /app/src/androidTest/java/price/and/me/ExampleInstrumentedTest.java | 6bcdde402f6c30436c4382f9b37fc6598eda030f | [] | no_license | alibabayev/PriceandMe | 141941d1bbe79b90a892bdf7f77b619aa3afc1ac | 1c82381af00e4ce477e006817fa7b97e9b96fd90 | refs/heads/master | 2020-09-06T19:08:54.856380 | 2019-11-08T17:43:50 | 2019-11-08T17:43:50 | 220,518,706 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package price.and.me;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("price.and.me", appContext.getPackageName());
}
}
| [
"ali.babayev@ug.bilkent.edu.tr"
] | ali.babayev@ug.bilkent.edu.tr |
409943796572eb05b2f4d63cc2f07b8aa416ee14 | 87db8a0e5be396b8310cc7772473d9a82529952a | /Baekjoon/src/question1699_sub.java | 15b0660e9b28001e2ace4ecf372400412dfbd0a5 | [] | no_license | Rurril/Beakjoon_practice | 296cd5737aec659d5d2596a5600e0f6f82a8870d | f63324b554f68976c9b4760b9f833428953b1157 | refs/heads/master | 2020-09-15T08:37:48.441643 | 2020-04-15T04:32:08 | 2020-04-15T04:32:08 | 223,397,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package Test;
import java.util.Scanner;
public class question1699_sub {
public static int d[];
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int number = sc.nextInt();
d = new int[number+1];
//d[n] = min(d[n - i^2] + 1)
for (int i = 1; i <= number; i++){
d[i] = i;
for (int j = 1; j*j <= i; j++){
if (d[i] > d[i-j*j]+1){
d[i] = d[i-j*j]+1;
}
}
}
System.out.println(d[number]);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
dea05e72865e4c51671cce07f00002385080ec78 | c12d09eeb8cbaa6a7b96d915be7702ee3b2a4a0b | /src/com/ismail/dao/UserDao.java | 8e0fb131051a0600a27319e66b19c878ee108499 | [] | no_license | kunalandkumar/Hospital-Management-System | e8692ef501e84071b87ee375725e020c4125719a | 21bd6cf4423a61000bc5f3b91c771d42ef581403 | refs/heads/main | 2023-04-05T11:37:50.796217 | 2021-04-17T05:55:42 | 2021-04-17T05:55:42 | 358,796,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,047 | java | package com.ismail.dao;
import java.sql.*;
import java.util.*;
import com.ismail.model.User;
import com.ismail.util.Database;
public class UserDao {
private Connection connection;
public UserDao() {
connection = Database.getConnection();
}
public void checkUser(User user) {
try {
PreparedStatement ps = connection.prepareStatement("select uname from users where uname = ?");
ps.setString(1, user.getUname());
ResultSet rs = ps.executeQuery();
if (rs.next()) // found
{
updateUser(user);
} else {
addUser(user);
}
} catch (Exception ex) {
System.out.println("Error in check() -->" + ex.getMessage());
}
}
public void addUser(User user) {
try {
PreparedStatement preparedStatement = connection.prepareStatement("insert into users(uname, password, email, registeredon) values (?, ?, ?, ? )");
// Parameters start with 1
preparedStatement.setString(1, user.getUname());
preparedStatement.setString(2, user.getPassword());
preparedStatement.setString(3, user.getEmail());
preparedStatement.setDate(4, new java.sql.Date(user.getRegisteredon().getTime()));
preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
public void deleteUser(String userId) {
try {
PreparedStatement preparedStatement = connection.prepareStatement("delete from users where uname=?");
// Parameters start with 1
preparedStatement.setString(1, userId);
preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
public void updateUser(User user) {
try {
PreparedStatement preparedStatement = connection.prepareStatement("update users set password=?, email=?, registeredon=?"
+ "where uname=?");
// Parameters start with 1
System.out.println(new java.sql.Date(user.getRegisteredon().getTime()));
preparedStatement.setString(1, user.getPassword());
preparedStatement.setString(2, user.getEmail());
preparedStatement.setDate(3, new java.sql.Date(user.getRegisteredon().getTime()));
preparedStatement.setString(4, user.getUname());
preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
public List<User> getAllUsers() {
List<User> users = new ArrayList<User>();
try {
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("select * from users");
while (rs.next()) {
User user = new User();
user.setUname(rs.getString("uname"));
user.setPassword(rs.getString("password"));
user.setEmail(rs.getString("email"));
user.setRegisteredon(rs.getDate("registeredon"));
users.add(user);
}
} catch (SQLException e) {
e.printStackTrace();
}
return users;
}
public User getUserById(String userId) {
User user = new User();
try {
PreparedStatement preparedStatement = connection.prepareStatement("select * from users where uname=?");
preparedStatement.setString(1, userId);
ResultSet rs = preparedStatement.executeQuery();
if (rs.next()) {
user.setUname(rs.getString("uname"));
user.setPassword(rs.getString("password"));
user.setEmail(rs.getString("email"));
user.setRegisteredon(rs.getDate("registeredon"));
}
} catch (SQLException e) {
e.printStackTrace();
}
return user;
}
} | [
"kunalandkumar@gmail.com"
] | kunalandkumar@gmail.com |
b782be73b4982a4d70dba8ce7d6a319564bc6895 | 87f068cabb67cbc2b455781c3afc431de352ee50 | /spring-boot-rest-api/src/main/java/com/example/restservice/repository/TutorialRepository.java | 915482ec4d0d8f6da5f7b6072fbf9aa0f16d7ca9 | [] | no_license | BMHasanuzzaman/Pre-Evaluation | d7f991482bfc92f6aca89e356518c0d981fce781 | 01822af4c8f3feee3c8f8853fcd67c47d562585b | refs/heads/master | 2023-06-22T04:31:48.189447 | 2021-07-13T22:23:37 | 2021-07-13T22:23:37 | 382,875,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package com.example.restservice.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.restservice.models.tutorial.Tutorial;
public interface TutorialRepository extends JpaRepository<Tutorial, Long> {
List<Tutorial> findByPublished(boolean published);
List<Tutorial> findByTitleContaining(String title);
} | [
"htraihan@gmail.com"
] | htraihan@gmail.com |
c6bbb90ce6960d4cfa66e5af65b46a44d6706b53 | 4961b5812f9b82978e4ad95963f9865e33586b79 | /MyFirstSeleniumProject/src/test/java/com/automationpractice/search/SearchTestEight.java | ce095a09e4da795387b43f441ed775f10c4effd5 | [] | no_license | asifhkhan123/MyFirstSeleniumProject | 4f8b590a2874d536540777aad156cd2a2c867293 | 03858ee74202403998fef99f3e75bb2e92f4ac8f | refs/heads/master | 2023-05-14T06:57:19.308922 | 2020-05-17T23:46:46 | 2020-05-17T23:46:46 | 262,928,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,251 | java | package com.automationpractice.search;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.Test;
import com.automationpractice.core.TestBase;
public class SearchTestEight extends TestBase {
// SEARCH_008
@Test
public void Search_with_filter() {
//Actions, explicit wait, mouse hover
//Go to http://www.automationpractice.com
driver.get("http://www.automationpractice.com");
//Mouse hover over 'Women' menu
Actions actions = new Actions(driver);
WebElement e = driver.findElement(By.xpath("//a[text()='Women']"));
actions.moveToElement(e).build().perform();
//Click on 'Summer Dresses' Under Dresses section
e = driver.findElement(By.xpath("//a[text()='Summer Dresses']"));
actions.moveToElement(e).build().perform();
e.click();
//Click on 'White' option from left panel under color
driver.findElement(By.xpath("//a[text()='White']")).click();
//Verify text: There is 1 product displayed on right side
//verify enabled filters option also displayed on left side with 'X' button
//Click on 'X' button from enabled filters
//Verify text: There is 3 product displayed on right side
}
}
| [
"asifh@192.168.0.16"
] | asifh@192.168.0.16 |
36cb23550ab092ca8f624b9938504efaf8cbd1d1 | bd7ea06b1db4de4a3d9e9b6459fc0c1ec5e96741 | /mojo/src/main/java/com/cj/qunit/mojo/QunitTestLocator.java | 98ec9b7896f5f77d99501606f68a146828f0cd83 | [] | no_license | ehur/qunit-test-driver | 422a721e4926e01d30af2e720940de33f3b230b9 | 36a8198b1cc61f329c9a33c2904e38efa96c3443 | refs/heads/master | 2021-01-16T22:57:04.099053 | 2013-02-09T17:42:57 | 2013-02-09T17:42:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,981 | java | package com.cj.qunit.mojo;
import static com.cj.qunit.mojo.fs.FilesystemFunctions.scanFiles;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
import com.cj.qunit.mojo.fs.FilesystemFunctions.FileVisitor;
public class QunitTestLocator {
public static class LocatedTest {
public final String name;
public final String relativePath;
private LocatedTest(String name, String relativePath) {
super();
this.name = name;
this.relativePath = relativePath;
}
}
public static List<File> findCodePaths(File basedir) {
List<File> codePaths = new ArrayList<File>();
File sourceDir = new File(basedir, "src");
if(sourceDir.exists()){
for(File next : new File(basedir, "src").listFiles()){
if(next.isDirectory()){
codePaths.addAll(Arrays.asList(next.listFiles()));
}
}
}
return codePaths;
}
public List<LocatedTest> locateTests(final File where){
if(where==null) throw new NullPointerException();
final List<LocatedTest> results = new ArrayList<QunitTestLocator.LocatedTest>();
scanFiles(where, new FileVisitor(){
@Override
public void visit(File path) {
final String name = path.getName();
final String s = path.getAbsolutePath().replaceAll(Pattern.quote(where.getAbsolutePath()), "");
final String relativePath = s.startsWith("/")?s.substring(1):s;
if(name.matches(".*Qunit.*\\.html")){
results.add(new LocatedTest(relativePath, relativePath));
}else if(name.endsWith(".qunit.js")){
results.add(new LocatedTest(relativePath, relativePath + ".Qunit.html"));
}
}
});
return results;
}
}
| [
"stu@penrose.us"
] | stu@penrose.us |
18593319e3758a632659bd759ab5f051f65480aa | c1cca86532b4b3155a80dfbf06002237d8338ebf | /wms/src/test/java/com/hczx/wms/WmsApplicationTests.java | 691940984a0569982e87818e5c701dee2954e093 | [] | no_license | wmsOrg/wms | 76c9025ca0cc6451ce3f62d295c4420978524f20 | 38d6b8d9401e4a2d143b84d087a9502ad9f2c7a1 | refs/heads/master | 2022-12-19T01:58:06.563012 | 2020-09-26T02:54:11 | 2020-09-26T02:54:11 | 296,185,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package com.hczx.wms;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class WmsApplicationTests {
@Test
void contextLoads() {
}
}
| [
"2998694067@qq.com"
] | 2998694067@qq.com |
27bb5ceb4254d97a83f7dbfc0f86f8d88d76ca72 | e5d4d0218a394954389e07f2ef250191e6f375ff | /src/com/cintel/elp/controller/weixin/surface/menu/MenuController.java | 1cefe07452ed66c17454b5d64356c117a279717f | [] | no_license | HUMMERshine/myPreproject | fce3c7f0fb1e31694e6c9189353f81f2525f416e | d92c5f14704ee2e791263c5f23ce864d121b2615 | refs/heads/master | 2020-12-30T17:51:11.253278 | 2017-05-25T06:12:41 | 2017-05-25T06:12:41 | 90,933,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,028 | java | package com.cintel.elp.controller.weixin.surface.menu;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cintel.elp.common.ajax.AjaxRes;
import com.cintel.elp.common.utils.base.Const;
import com.cintel.elp.common.utils.tree.WxMenuTreeUtil;
import com.cintel.elp.controller.base.BaseController;
import com.cintel.elp.entity.weixin.menu.WxMenu;
import com.cintel.elp.service.weixin.menu.WxMenuService;
@Controller
@RequestMapping("/backstage/weixin/menu/")
public class MenuController extends BaseController<WxMenu>{
@Autowired
public WxMenuService service;
private static final String SECURITY_URL="/backstage/weixin/menu/index";
@RequestMapping("index")
public String index(Model model) {
if(doSecurityIntercept(Const.RESOURCES_TYPE_MENU)){
model.addAttribute("permitBtn", getPermitBtn(Const.RESOURCES_TYPE_FUNCTION));
return "/system/weixin/menu/list";
}
return Const.NO_AUTHORIZED_URL;
}
@RequestMapping(value="menuTree", method=RequestMethod.POST)
@ResponseBody
public AjaxRes menuTree(){
AjaxRes ar=getAjaxRes();
if(ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_MENU,SECURITY_URL))){
try {
WxMenu o=new WxMenu();
List<WxMenu> r=service.find(o);
List<WxMenu> tree=WxMenuTreeUtil.buildTree(r);
Map<String, Object> p=new HashMap<String, Object>();
p.put("permitBtn",getPermitBtn(Const.RESOURCES_TYPE_BUTTON));
p.put("list",tree);
ar.setSucceed(p);
} catch (Exception e) {
logger.error(e.toString(),e);
ar.setFailMsg(Const.DATA_FAIL);
}
}
return ar;
}
@RequestMapping(value="findMenu", method=RequestMethod.POST)
@ResponseBody
public AjaxRes findMenu(WxMenu o){
AjaxRes ar=getAjaxRes();
if(ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_MENU,SECURITY_URL))){
try {
List<WxMenu> list=service.find(o);
WxMenu wxMenu=list.get(0);
ar.setSucceed(wxMenu);
} catch (Exception e) {
logger.error(e.toString(),e);
ar.setFailMsg(Const.DATA_FAIL);
}
}
return ar;
}
@RequestMapping(value="addMenu", method=RequestMethod.POST)
@ResponseBody
public AjaxRes addMenu(@RequestBody WxMenu o){
AjaxRes ar=getAjaxRes();
if(ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_MENU,SECURITY_URL))){
try {
int res=service.insertMenu(o);
if(res==1) ar.setSucceedMsg(Const.SAVE_SUCCEED);
else if(res==2) ar.setFailMsg("最多包括3个一级菜单");
else if(res==3) ar.setFailMsg("最多包含5个二级菜单");
else if(res==4) ar.setFailMsg("最多包含10个图文信息");
else ar.setFailMsg(Const.SAVE_FAIL);
} catch (Exception e) {
logger.error(e.toString(),e);
ar.setFailMsg(Const.SAVE_FAIL);
}
}
return ar;
}
@RequestMapping(value="updateMenu", method=RequestMethod.POST)
@ResponseBody
public AjaxRes updateMenu(@RequestBody WxMenu o){
AjaxRes ar=getAjaxRes();
if(ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_MENU,SECURITY_URL))){
try {
o.setUpdateTime(new Date());
int res=service.updateMenu(o);
if(res==1) ar.setSucceedMsg(Const.UPDATE_SUCCEED);
else if(res==4) ar.setFailMsg("最多包含10个图文信息");
else ar.setFailMsg(Const.UPDATE_FAIL);
} catch (Exception e) {
logger.error(e.toString(),e);
ar.setFailMsg(Const.UPDATE_FAIL);
}
}
return ar;
}
@RequestMapping(value="delMenu", method=RequestMethod.POST)
@ResponseBody
public AjaxRes delMenu(WxMenu o){
AjaxRes ar=getAjaxRes();
if(ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_MENU,SECURITY_URL))){
try {
int res=service.deleteMenu(o);
if(res==1) ar.setSucceedMsg(Const.DEL_SUCCEED);
else if(res==2) ar.setFailMsg("请先删除子菜单");
else ar.setFailMsg(Const.DEL_FAIL);
} catch (Exception e) {
logger.error(e.toString(),e);
ar.setFailMsg(Const.DEL_FAIL);
}
}
return ar;
}
@RequestMapping(value="syncMenu", method=RequestMethod.POST)
@ResponseBody
public AjaxRes syncMenu(){
AjaxRes ar=getAjaxRes();
if(ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_MENU,SECURITY_URL))){
try {
int res=service.syncMenu();
if(res==1) ar.setSucceedMsg(Const.UPDATE_SUCCEED);
else if(res==2) ar.setFailMsg("目前没有菜单");
else ar.setFailMsg(Const.UPDATE_FAIL);
} catch (Exception e) {
logger.error(e.toString(),e);
ar.setFailMsg(Const.UPDATE_FAIL);
}
}
return ar;
}
}
| [
"lishutao@localhost"
] | lishutao@localhost |
66df8a3af23e0527e64cfc061e12e2ba8fd9d213 | 363e0dfe0658baacbd770ca674963b3438530752 | /src/interview/airbnb/Calculator.java | fd2773d9ac78d1c9e68ffa120d34dcdafa40f852 | [] | no_license | Ghost141/LeetCode | b7cc2dcd8a1987aec508af90699798371eb9b10f | edb903e7fbdf72424bd83f06dfdaec7f586f6583 | refs/heads/master | 2021-05-23T05:45:13.998824 | 2017-12-31T12:38:10 | 2017-12-31T12:38:10 | 94,890,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,731 | java | package interview.airbnb;
import java.util.ArrayDeque;
import java.util.Deque;
/**
*
* @author zhaokai
* @version 1.0
* @since 1.0 - 11/28/17
*/
public class Calculator {
public int evaluate(String expression) {
char[] tokens = expression.toCharArray();
// Stack for numbers: 'values'
Deque<Integer> values = new ArrayDeque<>();
// Stack for Operators: 'ops'
Deque<Character> ops = new ArrayDeque<>();
for (int i = 0; i < tokens.length; i++) {
char c = tokens[i];
// Current token is a whitespace, skip it
if (c == ' ')
continue;
// Current token is a number, push it to stack for numbers
if (Character.isDigit(c)) {
StringBuffer sbuf = new StringBuffer();
// There may be more than one digits in number
while (i < tokens.length && Character.isDigit(tokens[i])) sbuf.append(tokens[i++]);
values.push(Integer.parseInt(sbuf.toString()));
}
// Current token is an opening brace, push it to 'ops'
else if (c == '(') ops.push(c);
// Closing brace encountered, solve entire brace
else if (c == ')') {
while (ops.peek() != '(')
values.push(applyOp(ops.pop(), values.pop(), values.pop()));
ops.pop();
}
// Current token is an operator.
else if (c == '+' || c == '-' || c == '*' || c == '/') {
// While top of 'ops' has same or greater precedence to current
// token, which is an operator. Apply operator on top of 'ops'
// to top two elements in values stack
while (!ops.isEmpty() && hasPrecedence(c, ops.peek()))
values.push(applyOp(ops.pop(), values.pop(), values.pop()));
// Push current token to 'ops'.
ops.push(c);
}
}
// Entire expression has been parsed at this point, apply remaining
// ops to remaining values
while (!ops.isEmpty())
values.push(applyOp(ops.pop(), values.pop(), values.pop()));
// Top of 'values' contains result, return it
return values.pop();
}
// Returns true if 'op2' has higher or same precedence as 'op1',
// otherwise returns false.
public static boolean hasPrecedence(char op1, char op2) {
if (op2 == '(' || op2 == ')')
return false;
if ((op1 == '*' || op1 == '/') && (op2 == '+' || op2 == '-'))
return false;
else
return true;
}
// A utility method to apply an operator 'op' on operands 'a'
// and 'b'. Return the result.
public static int applyOp(char op, int b, int a) {
switch (op) {
case '+':
return a + b;
case '-':
return a - b;
case '*':
return a * b;
case '/':
if (b == 0)
throw new
UnsupportedOperationException("Cannot divide by zero");
return a / b;
}
return 0;
}
private double compose(int number, int digit) {
int len = 0, tmp = digit;
while (tmp != 0) {
len++;
tmp /= 10;
}
return (double) number + digit * Math.pow(10, -len);
}
public static void main(String[] args) {
Calculator s = new Calculator();
// System.out.println(s.calculate("1.234+0.5"));
// System.out.println(s.calculate("1.234*0.5"));
System.out.println(s.evaluate("3-1"));
}
}
| [
"kidd747@gmail.com"
] | kidd747@gmail.com |
fac8bbff6c71b313cb5fa39925d386bb055e5d0c | 32e3298bcc728740cbec09fce9722654bc48a11f | /app/src/main/java/com/example/bu_iot_mountain/HttpConnection.java | 267e583d02da7236fc8b151770eb393409e9d916 | [] | no_license | pil9/BU_IoT_APP_mountain | 0dc67e04f6469e04ece1589347d5cdb965be7136 | 4c920ac69ce1644119291e04e76ec90d90e4a0b9 | refs/heads/master | 2023-02-03T15:26:25.501453 | 2020-12-22T00:26:36 | 2020-12-22T00:26:36 | 304,087,501 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,229 | java | package com.example.bu_iot_mountain;
import android.util.Log;
import android.widget.Toast;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
public class HttpConnection {
private OkHttpClient client;
private static HttpConnection instance = new HttpConnection();
public static HttpConnection getInstance() {
return instance;
}
private HttpConnection(){ this.client = new OkHttpClient(); }
/** 웹 서버로 요청을 한다. */
public void requestWebServer(Callback callback, String mountain) {
RequestBody body = new FormBody.Builder()
// .add("parameter", parameter)
// .add("parameter2", parameter2)
.build();
if (mountain.equals("설악산")) {
Log.d("pil", "잘 작동함");
Request request = new Request.Builder()
.url("https://api.openweathermap.org/data/2.5/weather?q=Sogcho&appid=370c6108b91660deca1c2d5125c466bc&units=metric")
.post(body)
.build();
client.newCall(request).enqueue(callback);
}
else if (mountain.equals("한라산")) {
Log.d("pil", "잘 작동함");
Request request = new Request.Builder()
.url("https://api.openweathermap.org/data/2.5/weather?q=Jeju&appid=370c6108b91660deca1c2d5125c466bc&units=metric")
.post(body)
.build();
client.newCall(request).enqueue(callback);
}
else if (mountain.equals("덕유산")) {
Log.d("pil", "잘 작동함");
Request request = new Request.Builder()
.url("https://api.openweathermap.org/data/2.5/weather?q=Muju&appid=370c6108b91660deca1c2d5125c466bc&units=metric")
.post(body)
.build();
client.newCall(request).enqueue(callback);
}
else if (mountain.equals("지리산")) {
Log.d("pil", "잘 작동함");
Request request = new Request.Builder()
.url("https://api.openweathermap.org/data/2.5/weather?q=Hamyang&appid=370c6108b91660deca1c2d5125c466bc&units=metric")
.post(body)
.build();
client.newCall(request).enqueue(callback);
}
else if (mountain.equals("북한산")) {
Log.d("pil", "잘 작동함");
Request request = new Request.Builder()
.url("https://api.openweathermap.org/data/2.5/weather?q=Seoul&appid=370c6108b91660deca1c2d5125c466bc&units=metric")
.post(body)
.build();
client.newCall(request).enqueue(callback);
}
else{
Log.d("pil", "아닐때 작동");
Request request = new Request.Builder()
.url("https://api.openweathermap.org/data/2.5/weather?q=Seoul&appid=370c6108b91660deca1c2d5125c466bc&units=metric")
.post(body)
.build();
client.newCall(request).enqueue(callback);
}
}
}
| [
"ljp3326@naver.com"
] | ljp3326@naver.com |
c6f24612686a689416da14cbd83e39f820a26d99 | 2c984a46975b27ccb2043c287235208f3a4be387 | /src/main/java/it/peng/wr/webservice/protocollo/GetRicevutePECResponse.java | ca6fb7188a8d4fdb61a2256defa75cb382b56b23 | [] | no_license | aziendazero/ecm | 12de5e410b344caa8060d5a33f7bc92f52458cdf | 57fd6fba8ead03db016395269e3f2dd1b998d42b | refs/heads/master | 2022-07-24T09:28:05.299546 | 2020-02-27T15:02:04 | 2020-02-27T15:02:04 | 235,811,868 | 0 | 2 | null | 2022-06-30T20:22:49 | 2020-01-23T14:29:41 | Java | UTF-8 | Java | false | false | 1,894 | java |
package it.peng.wr.webservice.protocollo;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for getRicevutePECResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="getRicevutePECResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="return" type="{http://protocollo.webservice.wr.peng.it/}ricevuta" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getRicevutePECResponse", propOrder = {
"_return"
})
public class GetRicevutePECResponse {
@XmlElement(name = "return")
protected List<Ricevuta> _return;
/**
* Gets the value of the return property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the return property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getReturn().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Ricevuta }
*
*
*/
public List<Ricevuta> getReturn() {
if (_return == null) {
_return = new ArrayList<Ricevuta>();
}
return this._return;
}
}
| [
"lpapa@3dial.eu"
] | lpapa@3dial.eu |
dc6510a28a8cb81906cafc4f9a096638e46d085a | b7a293a0d35d3cff3ebc9ed616b9caed0f30721b | /app/src/main/java/com/tyddolphin/apppadres/rest/Movilidad.java | f4b688e603504e4be4f75a8776e1992a1d7644f9 | [] | no_license | mineiko/DolphinMovilidadesPadres | 27a2cb887abf6dcb9c6862e48c3120c6787e5706 | c47862e57dae9a483f4cfafcf71637707891048d | refs/heads/master | 2021-01-22T22:35:03.831776 | 2017-07-15T01:35:28 | 2017-07-15T01:35:28 | 92,780,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package com.tyddolphin.apppadres.rest;
/**
* Created by Gianella Milon on 27/06/2017.
*/
class Movilidad {
public int Id;
public String Nombre;
public Alumno[] Alumnos;
} | [
"gianellmilon@gmail.com"
] | gianellmilon@gmail.com |
fc7610d1cc55dcc1966a2516b1b1d51465bc8d50 | 4ecd7a780ecbb9c3375d95360eaac0e1638185c8 | /Java/StarPattern5.java | 1d9abb36ac5e87df4dbf62426adbde1704a0f691 | [
"MIT"
] | permissive | Sasmita-cloud/Hacktoberfest2021_PatternMaking | dd50c8a81bce9da25650b3b497330a9c150d54da | af48c242c10b08b74cf42c35b8550a45f1d9cbff | refs/heads/main | 2023-08-29T22:56:59.953119 | 2021-10-14T11:49:43 | 2021-10-14T11:49:43 | 415,092,226 | 0 | 0 | MIT | 2021-10-08T18:38:33 | 2021-10-08T18:38:32 | null | UTF-8 | Java | false | false | 542 | java | package LOOPS;
// *
// * *
// * * *
// * * * *
import java.util.Scanner;
public class StarPattern5 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
for(int j = 0; j<=n-i+1;j++){
System.out.print(" ");
}
for(int j=0;j<=i-1;j++){
System.out.print("* ");
}
System.out.println();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
22c8a9b85ee46f41451e2cd7efec32c2091ec1ed | a974fc16ccbfba285abea0351eff1e9df1c60d92 | /src/pyramid/program6.java | 8da3fe0b05ebebc17e23981dc808a16536151032 | [] | no_license | ganI1994/javaprogramming | 7ce1247acd83f5dfb4942ab8aac52ef3b56148ed | b88ca2a2899ba23473c88759e6ffc626bbc3d54d | refs/heads/master | 2023-08-18T08:32:14.351784 | 2021-09-22T15:14:13 | 2021-09-22T15:14:13 | 403,327,175 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package pyramid;
public class program6
{
public static void main(String[] args) {
int n=3;
//int count=1;
for(int row=1;row<=n;row++)
{
int count=1;
for(int space=1; space<=n-row;space++)
{
System.out.print(" ");
}
for(int num=1; num<(2*row); num++)
{
System.out.print(count+++" ");
}
System.out.println();
}
}
}
| [
"ganeshg141994@gmail.com"
] | ganeshg141994@gmail.com |
12eeaf1b8a1baab1c624febd4558ed9189906ee0 | fa9c59b98c8e421e671133c9467d23205075d29d | /SpringDataREST/src/main/java/net/dmaj/test/entities/BaseEntity.java | b6da6fe15ced0abf9494c683adafca93ae450a2f | [
"MIT"
] | permissive | dzmaj/TestProjects | 52006988689c39138b40c202929b9289cd915e52 | 71f7a7ff9ea8d174cebd14b7e12ace8e1afe480f | refs/heads/main | 2023-02-28T09:37:37.603026 | 2021-01-22T04:18:02 | 2021-01-22T04:18:02 | 331,817,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,009 | java | package net.dmaj.test.entities;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
@MappedSuperclass
public abstract class BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name="creation_timestamp")
@CreationTimestamp
private LocalDateTime creationTimestamp;
@Column(name="update_timestamp")
@UpdateTimestamp
private LocalDateTime updateTimestamp;
public BaseEntity() {
super();
}
public BaseEntity(int id) {
super();
this.id = id;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public LocalDateTime getCreationTimestamp() {
return creationTimestamp;
}
public void setCreationTimestamp(LocalDateTime creationTimestamp) {
this.creationTimestamp = creationTimestamp;
}
public LocalDateTime getUpdateTimestamp() {
return updateTimestamp;
}
public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
this.updateTimestamp = updateTimestamp;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("BaseEntity [id=");
builder.append(id);
builder.append(", creationTimestamp=");
builder.append(creationTimestamp);
builder.append(", updateTimestamp=");
builder.append(updateTimestamp);
builder.append("]");
return builder.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BaseEntity other = (BaseEntity) obj;
if (id != other.id)
return false;
return true;
}
}
| [
"d.majewski.3453@gmail.com"
] | d.majewski.3453@gmail.com |
278bee064752866c5f1310115ab700501798ab81 | df94337ca79cbd09797765608750d9a7c5a6a38b | /003-link-interface/src/main/java/com/bjpowernode/dubbo/model/User.java | affe5f9efa05f93001fc147fe469a5fed2adcd33 | [] | no_license | chengshengyao/dubboCode | ac354f3b47cdd5bbefe86b908cd83928c7cca19d | e3a31b81bb0768e4b73b0821cc8edd55096fd93e | refs/heads/master | 2023-03-29T07:43:49.545857 | 2021-03-30T13:56:13 | 2021-03-30T13:56:13 | 353,019,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 689 | java | package com.bjpowernode.dubbo.model;
import java.io.Serializable;
/**
* @ProjectName: dubbo
* @Package: com.bjpowernode.dubbo.model
* @Description: java类作用描述
* @Author: 生尧
* @CreateDate: 2021/1/29 14:57
* @Version: 1.0
* <p>
* Copyright: Copyright (c) 2021
*/
//实现 可序列化接口
public class User implements Serializable {
private Integer id;
private String username;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
| [
"3113547732@QQ.COM"
] | 3113547732@QQ.COM |
1ef805ed05986deeaa268ce611a9f21236d11806 | 87cefc15483d7ed5d177a2aac3f20fe45a7ad1cb | /src/main/java/com/jetbaba/excel/ExcelLog.java | 86c29c73fbe150b3cbb23de2fe0a424d41d849c0 | [] | no_license | jetlv/DataCollector | caa17c3987c50b69b804afbcfaf8b5a1d0bc60c7 | d16eb0e365adc7dd0b77d8a879a7a65f85ddb75e | refs/heads/master | 2021-01-17T13:03:16.572483 | 2016-06-28T09:59:20 | 2016-06-28T09:59:20 | 56,843,791 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,422 | java | package com.jetbaba.excel;
/**
* The <code>ExcelLog</code>
*
* @author sargeras.wang
* @version 1.0, Created at 2013年9月17日
*/
public class ExcelLog {
private Integer rowNum;
private Object object;
private String log;
/**
* @return the rowNum
*/
public Integer getRowNum() {
return rowNum;
}
/**
* @param rowNum
* the rowNum to set
*/
public void setRowNum(Integer rowNum) {
this.rowNum = rowNum;
}
/**
* @return the object
*/
public Object getObject() {
return object;
}
/**
* @param object
* the object to set
*/
public void setObject(Object object) {
this.object = object;
}
/**
* @return the log
*/
public String getLog() {
return log;
}
/**
* @param object
* @param log
*/
public ExcelLog(Object object, String log) {
super();
this.object = object;
this.log = log;
}
/**
* @param rowNum
* @param object
* @param log
*/
public ExcelLog(Object object, String log, Integer rowNum) {
super();
this.rowNum = rowNum;
this.object = object;
this.log = log;
}
/**
* @param log
* the log to set
*/
public void setLog(String log) {
this.log = log;
}
}
| [
"吕超"
] | 吕超 |
d3f1261c3e261d5286b498426620a33061cac3fd | 656e22d276f54b652202858f9fa1978c8993a17c | /src/model/Room.java | d8f38cd45f3e10060659c247b31caf9909b65109 | [] | no_license | Indomie-glitch/Hotel-Reservation | d46ac8ad177f987f7533c9977868137e0fffedcf | 0c6ce1390c65ec2d2717d010b5938aa62d6232f5 | refs/heads/master | 2023-05-10T07:45:26.795371 | 2021-06-10T13:37:46 | 2021-06-10T13:37:46 | 367,333,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package model;
public class Room implements IRoom {
private Double roomPrice;
private String roomNumber;
private RoomType roomType;
private boolean booked;
public Double getRoomPrice() {
return roomPrice;
}
public boolean isBooked() {
return booked;
}
public void setBooked(boolean availability) {
this.booked = availability;
}
public RoomType getRoomType() {
return roomType;
}
public void setType(RoomType type) {
this.roomType = type;
}
@Override
public String getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(String roomNumber) {
this.roomNumber = roomNumber;
}
public void setPrice(Double roomPrice) {
this.roomPrice = roomPrice;
}
public boolean isFree() {
return booked;
}
}
| [
"darthaarnav@gmail.com"
] | darthaarnav@gmail.com |
cd20400b68e7e3afd7e334264bee13ebc8ad53b2 | a767527ec002ec1afff99e081bfe7a7eeb07159e | /app/src/main/java/com/dirk41/androidtvapp/VideoDetailsFragment.java | 2056a83051a599a730cfe7d0c994004ea9969b41 | [] | no_license | lingchong2015/AndroidTVApp | 7b91cd5691d675148b798c2b2c5ae75bad9e9c8e | b494df5bc6c6b31dd776e2788ee29b8c57974f06 | refs/heads/master | 2021-01-10T08:08:40.786149 | 2016-01-24T13:20:34 | 2016-01-24T13:20:34 | 50,288,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,925 | java | package com.dirk41.androidtvapp;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v17.leanback.app.DetailsFragment;
import android.support.v17.leanback.widget.Action;
import android.support.v17.leanback.widget.ArrayObjectAdapter;
import android.support.v17.leanback.widget.ClassPresenterSelector;
import android.support.v17.leanback.widget.DetailsOverviewRow;
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter;
import android.support.v17.leanback.widget.HeaderItem;
import android.support.v17.leanback.widget.ListRow;
import android.support.v17.leanback.widget.ListRowPresenter;
import android.support.v17.leanback.widget.SparseArrayObjectAdapter;
import android.util.Log;
import com.squareup.picasso.Picasso;
import java.io.IOException;
/**
* Created by lingchong on 16-1-23.
*/
//DetailsFragment用于创建Leanback详细内容屏幕,DetailsFragment负责渲染其ObjectAdapter对象中的所有元素,这些元素被视为垂直列表中的行。
//所有ObjectAdapter中的元素都必须是Row类的子类,ObjectAdapter的PresenterSelector类必须存放RowPresenter类型的子类。
public class VideoDetailsFragment extends DetailsFragment {
private CustomFullWidthDetailsOverviewRowPresenter mCustomFullWidthDetailsOverviewRowPresenter;
private PicassoBackgroundManager mPicassoBackgroundManager;
private Movie mSelectedMovie;
private DetailsRowBuilderTask mDetailsRowBuilderTask;
private static final int DETAIL_THUMB_WIDTH = 274;
private static final int DETAIL_THUMB_HEIGHT = 274;
public static final String MOVIE = "com.dirk41.Movie";
private static final String TAG = VideoDetailsFragment.class.getSimpleName();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//初始化FullWidthDetailsOverviewRowPresenter类,将其customizable detailed description view的Presenter设置为DetailDescriptionPresenter类;
mCustomFullWidthDetailsOverviewRowPresenter = new CustomFullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
mPicassoBackgroundManager = new PicassoBackgroundManager(this.getActivity());
mSelectedMovie = this.getActivity().getIntent().getParcelableExtra(MOVIE);
mDetailsRowBuilderTask = (DetailsRowBuilderTask) new DetailsRowBuilderTask().execute(mSelectedMovie);
mPicassoBackgroundManager.updateBackgroundWithDelay(mSelectedMovie.getCardImageUrl());
}
@Override
public void onStop() {
super.onStop();
mDetailsRowBuilderTask.cancel(true);
}
private class DetailsRowBuilderTask extends AsyncTask<Movie, Integer, DetailsOverviewRow> {
@Override
protected DetailsOverviewRow doInBackground(Movie... params) {
DetailsOverviewRow detailsOverviewRow = new DetailsOverviewRow(params[0]);
try {
Bitmap poster = Picasso.with(VideoDetailsFragment.this.getActivity())
.load(mSelectedMovie.getCardImageUrl())
.resize(Utils.convertDpToPixel(VideoDetailsFragment.this.getActivity().getApplicationContext(), DETAIL_THUMB_WIDTH),
Utils.convertDpToPixel(VideoDetailsFragment.this.getActivity().getApplicationContext(), DETAIL_THUMB_HEIGHT))
.centerCrop()
.get();
//设置DetailsOverview的Logo;
detailsOverviewRow.setImageBitmap(VideoDetailsFragment.this.getActivity(), poster);
} catch (IOException e) {
Log.e(TAG, e.toString());
}
return detailsOverviewRow;
}
@Override
protected void onPostExecute(DetailsOverviewRow detailsOverviewRow) {
SparseArrayObjectAdapter sparseArrayObjectAdapter = new SparseArrayObjectAdapter();
for (int i = 0; i < 10; ++i) {
Action action = new Action(i, "lable1", "lable2");
sparseArrayObjectAdapter.set(i, new Action(i, "lable1", "lable2"));
}
detailsOverviewRow.setActionsAdapter(sparseArrayObjectAdapter);
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
for (int i = 0; i < 10; ++i) {
Movie movie = new Movie();
if (i % 3 == 0) {
movie.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02580.jpg");
} else if (i % 3 == 1) {
movie.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02630.jpg");
} else {
movie.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02529.jpg");
}
movie.setTitle("title" + i);
movie.setStudio("studio" + i);
listRowAdapter.add(movie);
}
HeaderItem headerItem = new HeaderItem(0, "相关视频");
ListRow listRow = new ListRow(headerItem, listRowAdapter);
ClassPresenterSelector classPresenterSelector = new ClassPresenterSelector();
mCustomFullWidthDetailsOverviewRowPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_SMALL);
classPresenterSelector.addClassPresenter(DetailsOverviewRow.class, mCustomFullWidthDetailsOverviewRowPresenter);
classPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
ArrayObjectAdapter arrayObjectAdapter = new ArrayObjectAdapter(classPresenterSelector);
arrayObjectAdapter.add(detailsOverviewRow);
arrayObjectAdapter.add(listRow);
VideoDetailsFragment.this.setAdapter(arrayObjectAdapter);
}
}
}
| [
"lingdirk2009@163.com"
] | lingdirk2009@163.com |
1e391a6f5eff9bc239b152fba8d83952b21516f5 | 3318216b1010b9fa2b487d0c237434dea3630ff2 | /src/main/java/com/hepolite/coreutility/hunger/FoodRegistry.java | 324f1ee1307a7ec01780f09b3a24a9518b837bd1 | [] | no_license | PonyvilleSquare/CoreUtility | 0a1f9986372c2113c28919ea1ca7ca151aad8d1b | d4dde850cc60fc7cead28501d9ad2ddd6fb9442c | refs/heads/master | 2021-09-04T15:33:16.153308 | 2018-01-19T22:48:48 | 2018-01-19T22:48:48 | 97,345,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,498 | java | package com.hepolite.coreutility.hunger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import com.hepolite.coreutility.plugin.CorePlugin;
import com.hepolite.coreutility.settings.Settings;
import com.hepolite.coreutility.settings.Settings.PotionEffectSetting;
import com.hepolite.coreutility.settings.SettingsSimple;
public class FoodRegistry
{
private final HungerHandler hungerHandler;
private final Settings settings;
public FoodRegistry(CorePlugin plugin, HungerHandler hungerHandler)
{
this.hungerHandler = hungerHandler;
this.settings = new SettingsSimple(plugin, "Hunger", "FoodRegistry");
}
/** Wipes the registry completely */
public final void wipe()
{
settings.wipe();
}
/** Loads up all food settings from the given config file, reading from the given property */
public final void parseGroupSettings(String group, Settings settings, String property)
{
for (String key : settings.getKeys(property))
{
String path = property + "." + key;
String field = group + "." + key;
if (settings.has(path + ".alwaysEdible"))
this.settings.set(field + ".alwaysEdible", settings.getBool(path + ".alwaysEdible"));
if (settings.has(path + ".contains"))
this.settings.set(field + ".contains", settings.getString(path + ".contains"));
if (settings.has(path + ".categories"))
this.settings.set(field + ".categories", settings.getString(path + ".categories"));
if (settings.has(path + ".food"))
this.settings.set(field + ".food", settings.getFloat(path + ".food"));
if (settings.has(path + ".ratio"))
this.settings.set(field + ".ratio", settings.getFloat(path + ".ratio"));
if (settings.has(path + ".chance"))
this.settings.set(field + ".chance", settings.getFloat(path + ".chance"));
if (settings.has(path + ".effects"))
this.settings.set(field + ".effects", settings.getPotionEffects(path + ".effects").toArray(new PotionEffectSetting[0]));
if (settings.has(path + ".items"))
this.settings.set(field + ".items", settings.getItems(path + ".items").toArray(new ItemStack[0]));
}
this.settings.save();
}
// //////////////////////////////////////////////////////////////////////
/** Returns true if the given group is allowed to consume the given item; if the given collection is not null, the reasons will be added to it */
public final boolean isAllowedToConsume(Food food, Group group, Collection<String> reasons)
{
if (food == null || group == null)
return false;
Group defaultGroup = hungerHandler.getGroup("Default");
Collection<String> forbidden = new HashSet<String>();
forbidden.addAll(defaultGroup.getForbiddenFoods());
forbidden.addAll(group.getForbiddenFoods());
boolean result = true;
for (String category : food.getCategories())
{
if (forbidden.contains(category))
{
result = false;
if (reasons == null)
break;
else
reasons.add(category);
}
}
return result;
}
/** Returns the food settings for the given group and item; returns null if the food does not exist */
public final Food getFood(ItemStack item, Group group)
{
if (item == null || group == null)
return null;
ItemStack copy = item.clone();
copy.setAmount(1);
String food = settings.writeSimpleItem(copy);
String groupName = group.getName();
if (!settings.has("Default." + food) && !settings.has(groupName + "." + food))
return null;
boolean alwaysEdibleDef = settings.getBool("Default." + food + ".alwaysEdible");
boolean alwaysEdible = settings.getBool(groupName + "." + food + ".alwaysEdible", alwaysEdibleDef);
float hungerDef = settings.getFloat("Default." + food + ".food");
float hunger = settings.getFloat(groupName + "." + food + ".food", hungerDef);
float ratioDef = settings.getFloat("Default." + food + ".ratio");
float ratio = settings.getFloat(groupName + "." + food + ".ratio", ratioDef);
float chanceDef = settings.getFloat("Default." + food + ".chance", 1.0f);
float chance = settings.getFloat(groupName + "." + food + ".chance", chanceDef);
Collection<PotionEffectSetting> effectsSettings = null;
if (settings.has(groupName + "." + food + ".effects"))
effectsSettings = settings.getPotionEffects(groupName + "." + food + ".effects");
else
effectsSettings = settings.getPotionEffects("Default." + food + ".effects");
Collection<PotionEffect> effects = new ArrayList<PotionEffect>();
for (PotionEffectSetting setting : effectsSettings)
effects.add(setting.create());
Collection<ItemStack> items = null;
if (settings.has(groupName + "." + food + ".items"))
items = settings.getItems(groupName + "." + food + ".items");
else
items = settings.getItems("Default." + food + ".items");
Food processedFood = new Food(copy);
processedFood.setAlwaysEdible(alwaysEdible);
processedFood.setHunger(hunger);
processedFood.setSaturation(hunger * ratio);
processedFood.setChance(chance);
processedFood.addCategories(getFoodCategories(groupName, food));
processedFood.addEffects(effects);
processedFood.addItems(items);
return processedFood;
}
/** Returns the categories of the given food, for the given group */
private final Collection<String> getFoodCategories(String group, String food)
{
Collection<String> categories = new HashSet<String>();
categories.addAll(getFieldCategories(group, food));
for (String string : getFieldContents(group, food))
categories.addAll(getFieldCategories(group, string));
return categories;
}
/** Returns the contents field for the food at the given group */
private final Collection<String> getFieldContents(String group, String item)
{
Collection<String> contents = new HashSet<String>();
contents.add(item);
String def = settings.getString("Default." + item + ".contains");
String data = settings.getString(group + "." + item + ".contains", def);
if (data != null)
{
for (String string : data.split(" "))
contents.addAll(getFieldContents(group, string));
}
return contents;
}
/** Returns the categories field for the food at the given group */
private final Collection<String> getFieldCategories(String group, String item)
{
String def = settings.getString("Default." + item + ".categories");
String data = settings.getString(group + "." + item + ".categories", def);
return data == null ? new HashSet<String>() : Arrays.asList(data.split(" "));
}
}
| [
"CW.Hepolite@hotmail.com"
] | CW.Hepolite@hotmail.com |
7cc5678840cb3e00f9906dc1176ef30c8806f8db | 314f1b82635dfc15c0597cdeea012f9a0cdd1171 | /app/src/main/java/com/nolabs/lifeline11/Utilities/utilities/Model/User.java | 495846e6fb854b00da3a405f77d804c2905595fc | [] | no_license | SunbakedCoast/Lifeline11 | 9a34782900e8f9aa6e6bf106140b8e8b61ab4d44 | 990e50d032b98b992faf6603f151fa78709a9b18 | refs/heads/master | 2023-02-11T05:32:06.911990 | 2021-01-11T06:28:04 | 2021-01-11T06:28:04 | 328,568,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,743 | java | package com.nolabs.lifeline11.Utilities.utilities.Model;
public class User {
String firstname;
String lastname;
String fullname;
String email;
String gender;
boolean postpermission;
boolean verified;
public User(){
}
public User(String firstname, String lastname, String fullname, String email, String gender, boolean postpermission, boolean verified) {
this.firstname = firstname;
this.lastname = lastname;
this.fullname = fullname;
this.email = email;
this.gender = gender;
this.postpermission = postpermission;
this.verified = verified;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getFullname() {
return fullname;
}
public void setFullname(String fullname) {
this.fullname = fullname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public boolean isPostpermission() {
return postpermission;
}
public void setPostpermission(boolean postpermission) {
this.postpermission = postpermission;
}
public boolean isVerified() {
return verified;
}
public void setVerified(boolean verified) {
this.verified = verified;
}
}
| [
"wllmhnry0@gmail.com"
] | wllmhnry0@gmail.com |
17f12d21942f8a56856fb93976ed0854fc07d7ca | 6252c165657baa6aa605337ebc38dd44b3f694e2 | /org.eclipse.epsilon.egl.sync/Scalability-Tests/boiler-To-Generate-400-Files/boiler-To-Generate-400-Files/syncregions-400Files/TemperatureController1682.java | f00b76b0f947beb220073ed965a0614770b2770d | [] | no_license | soha500/EglSync | 00fc49bcc73f7f7f7fb7641d0561ca2b9a8ea638 | 55101bc781349bb14fefc178bf3486e2b778aed6 | refs/heads/master | 2021-06-23T02:55:13.464889 | 2020-12-11T19:10:01 | 2020-12-11T19:10:01 | 139,832,721 | 0 | 1 | null | 2019-05-31T11:34:02 | 2018-07-05T10:20:00 | Java | UTF-8 | Java | false | false | 367 | java | package syncregions;
public class TemperatureController1682 {
public execute(int temperature1682, int targetTemperature1682) {
//sync _bfpnFUbFEeqXnfGWlV1682, behaviour
1-if(temperatureDifference > 0 && boilerStatus == true) { return 1; } else if (temperatureDifference < 0 && boilerStatus == false) { return 2; } else return 0;
//endSync
}
}
| [
"sultanalmutairi@172.20.10.2"
] | sultanalmutairi@172.20.10.2 |
03330c78de9c1f959ff7c71a4dc956c57d912d96 | 140afdf1b586d26d5d46f914937da51a7c4cc87b | /src/main/java/springtutorial/tutorial/exception/ResourceNotFoundException.java | 02f72f5dfcb7e9fb5dbec9fba18a29dad59a63ac | [] | no_license | MrinmoyDebnath/demoCrudAPI | ee3f2dd240b3167c1e2ae30c151a6c3c047b00b1 | e9399e3260ecdbb7539ab77d4d10f203f7f7a85e | refs/heads/main | 2023-05-03T08:00:02.413139 | 2021-05-17T03:40:38 | 2021-05-17T03:40:38 | 368,036,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package springtutorial.tutorial.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus( value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends RuntimeException {
private static final long serialVersionUID = 1l;
public ResourceNotFoundException(String message){
super(message);
}
}
| [
"mrinmoy.debnath@mountblue.tech"
] | mrinmoy.debnath@mountblue.tech |
65390bcd17cb98812e38e1d331f8fdd92de8d650 | f49bc3d40796c49e143346d33ca3bc314a91c35d | /EvidencijaProjekta/app/src/main/java/com/example/evidencijaprojekta/UlogaOsobeInfoList.java | 0a8baa0fbdd47b51748210f7aa385889b82c9476 | [] | no_license | marinsmoljanic/masters_thesis_project_android | 834ff22c3f9aa8cc7bbb88799c92d013c90f5f91 | fab39d9962efe6a4f96261418179e03ad2e51169 | refs/heads/master | 2023-02-21T02:21:10.172511 | 2021-01-19T22:32:19 | 2021-01-19T22:32:19 | 310,952,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 77 | java | package com.example.evidencijaprojekta;
public class UlogaOsobeInfoList {
}
| [
"marin.smoljanic2@gmail.com"
] | marin.smoljanic2@gmail.com |
913cfa66defd4368262d4164b68f9a267f8a6b28 | b3a0c96eebfb9d2feea695dd76c35f5f917241f6 | /src/main/java/com/zza/jpaa/controller/LogController.java | 72b53a56079c9df282a0902eea85f3a9990e0c4b | [] | no_license | unclesamsCream/bankAccountManageWeb | 1b842093fe8d4f597b342828a2bd5e84f56c03ad | 0e3e3b372e8ea90ef9215b0346d4581b8f5eb12e | refs/heads/master | 2022-07-17T18:33:34.150117 | 2020-05-13T10:44:25 | 2020-05-13T10:44:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,125 | java | package com.zza.jpaa.controller;
import com.zza.jpaa.common.ResultData;
import com.zza.jpaa.entity.dto.LogListDto;
import com.zza.jpaa.entity.vo.LogListVo;
import com.zza.jpaa.services.LogService;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping("/log")
public class LogController {
@Resource
LogService logService;
@GetMapping("/list")
public ResultData getLogList(LogListVo logListVo){
if (StringUtils.isEmpty(logListVo.getPageSize())){
logListVo.setPageSize(10);
}
if (StringUtils.isEmpty(logListVo.getPageIndex())){
logListVo.setPageIndex(1);
}
LogListDto logList = logService.getLogList(logListVo);
return ResultData.success("获取成功",logList);
}
@PostMapping("/{id}")
public ResultData delLog(@PathVariable String id){
logService.delLog(id);
return ResultData.success();
}
@GetMapping("/type")
public ResultData getType(){
return logService.getTpe();
}
}
| [
"zza1998@foxmail.com"
] | zza1998@foxmail.com |
5ef3215af177324f323bbff43ed93bffb0c9a0bb | 1991d03306521cdc26ea19afe605de1d7bb5481d | /src/com/company/Group.java | 083cf787aa9297a389cf811409613427c926c7aa | [] | no_license | aghia7/lecture5project | 0b72b0d1592e588458a6737f19352e3fdf70665d | 4835c75376739c7b5c3bbf8e245209cbc51f6bf8 | refs/heads/master | 2023-02-26T22:52:50.554586 | 2021-01-31T17:54:34 | 2021-01-31T17:54:34 | 334,719,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package com.company;
import java.util.ArrayList;
import java.util.List;
public class Group {
private List<User> users = new ArrayList<>();
public void addUser(User user)
throws NullPointerException, UserExistsException {
if (user == null) {
throw new NullPointerException("User is null");
} else if (userExists(user)) {
throw new UserExistsException("User " + user.getName()
+ " already exists");
}
users.add(user);
}
private boolean userExists(User user) {
for (User u : users) {
if (u.equals(user)) {
return true;
}
}
return false;
}
}
| [
"askar.khaimuldin@astanait.edu.kz"
] | askar.khaimuldin@astanait.edu.kz |
7b942b724b3c31ce0afa50ae7f522de5dc692c9a | 573410077140469035545d57ed50edbc416cbee1 | /Exercicio_189/src/entities/Program.java | 48283f0aa962f774676c6875ffc7d46f762148f0 | [] | no_license | LaianeRibeiroo/Curso_Java_repositorio | 2ffe8c329140297fe01c1d5dfc6a7429937fda58 | 4830bb6e378134e2088ec9ef4330c34b19980617 | refs/heads/master | 2023-08-18T10:36:31.215075 | 2021-10-18T11:18:26 | 2021-10-18T11:18:26 | 377,237,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,757 | java | package entities;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Scanner;
import entities.Product;
public class Program {
public static void main(String[] args) throws ParseException {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
List<Product> list = new ArrayList<>();
System.out.println("Enter file path: ");
String sourceFileStr = sc.nextLine();
File sourceFile = new File(sourceFileStr);
String sourceFolderStr = sourceFile.getParent();
boolean success = new File(sourceFolderStr + "\\out").mkdir();
String targetFileStr = sourceFolderStr + "\\out\\summary.csv";
try (BufferedReader br = new BufferedReader(new FileReader(sourceFileStr))) {
String itemCsv = br.readLine();
while (itemCsv != null) {
String[] fields = itemCsv.split(",");
String name = fields[0];
double price = Double.parseDouble(fields[1]);
int quantity = Integer.parseInt(fields[2]);
list.add(new Product(name, price, quantity));
itemCsv = br.readLine();
}
try (BufferedWriter bw = new BufferedWriter(new FileWriter(targetFileStr))) {
for (Product item : list) {
bw.write(item.getName() + "," + String.format("%.2f", item.total()));
bw.newLine();
}
System.out.println(targetFileStr + " CREATED!");
} catch (IOException e) {
System.out.println("Error writing file: " + e.getMessage());
}
} catch (IOException e) {
System.out.println("Error reading file: " + e.getMessage());
}
sc.close();
}
} | [
"laiane.ribeiro@estudante.iftm.edu.br"
] | laiane.ribeiro@estudante.iftm.edu.br |
7db0a41f0aa8616319ba59a25f9a6664cd8b034c | ea15e64534ea92c6ab84ea059ff5a8c879e8f6cd | /src/lab07/actors/ex/PeersMsg.java | 25e0fefcca12ebcacc34604e375a9bf2a2268ea8 | [] | no_license | LucaPascucci/pap_15_16 | bd208fa6fb477f73406d02a889d332aa2a731197 | 2b37d630bc4738bb0d5bffb89e4834e1a9931bdc | refs/heads/master | 2023-09-02T03:47:33.307163 | 2019-03-24T15:06:42 | 2019-03-24T15:06:42 | 430,444,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package lab07.actors.ex;
import java.util.List;
import akka.actor.ActorRef;
public class PeersMsg {
List<ActorRef> peers;
public PeersMsg(List<ActorRef> peers){
this.peers = peers;
}
public List<ActorRef> getPeers(){
return this.peers;
}
}
| [
"luca.pascucci@studio.unibo.it"
] | luca.pascucci@studio.unibo.it |
16a61ee0ba74193da9130991e7819d200b71b3f9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_37721560ebdda0edc4dcaddfb3a830aeb39e6bfa/CorpusRepositoryFileImplTest/2_37721560ebdda0edc4dcaddfb3a830aeb39e6bfa_CorpusRepositoryFileImplTest_t.java | f0d05e8703b0dcf0bfb3b0ee704762d99e1647e3 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 4,297 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.spnt.recognition.service.test;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sound.sampled.AudioInputStream;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.spantus.core.FrameValues;
import org.spantus.externals.recognition.bean.CorpusEntry;
import org.spantus.externals.recognition.bean.CorpusFileEntry;
import org.spantus.externals.recognition.bean.FeatureData;
import org.spantus.externals.recognition.corpus.CorpusRepositoryFileImpl;
import org.spantus.work.wav.AudioManagerFactory;
/**
*
* @author mondhs
*/
public class CorpusRepositoryFileImplTest {
CorpusRepositoryFileImpl corpusRepository;
@Before
public void onSetup(){
corpusRepository = new CorpusRepositoryFileImpl();
corpusRepository.setRepositoryPath("./target/test-classes/corpus");
}
@Test
public void testCRUDCorpusEntry(){
//given
CorpusEntry corpusEntry = new CorpusEntry();
corpusEntry.setName("Name1");
FeatureData fd = new FeatureData();
fd.setName("Feature1");
fd.setValues(new FrameValues(new Float[]{1F, 2F, 3F}));
corpusEntry.getFeatureMap().put(fd.getName(), fd);
int initialSize = corpusRepository.findAllEntries().size();
//when
CorpusEntry savedCorpusEntry =corpusRepository.save(corpusEntry);
Long savedId = savedCorpusEntry.getId();
int savedSize = corpusRepository.findAllEntries().size();
CorpusEntry updatedCorpusEntry =corpusRepository.update(savedCorpusEntry);
Long updatedId = updatedCorpusEntry.getId();
int updatedSize = corpusRepository.findAllEntries().size();
CorpusEntry deltedCorpusEntry =corpusRepository.delete(updatedCorpusEntry);
int deletedSize = corpusRepository.findAllEntries().size();
Long deletedId = deltedCorpusEntry.getId();
//then
Assert.assertNotNull(savedId);
Assert.assertEquals(updatedId, savedId);
Assert.assertEquals(1, savedSize-initialSize);
Assert.assertEquals(deletedId, savedId);
Assert.assertEquals(1, updatedSize-deletedSize);
}
@Test
public void testUpdateDeleteWav(){
//given
File inputWavFile = new File("../../../data/text1.wav");
URL wavUrl = null;
try {
wavUrl = inputWavFile.toURI().toURL();
} catch (MalformedURLException ex) {
Assert.fail("not working: " + ex.getMessage());
}
Assert.assertNotNull("file not found in "
+inputWavFile.getAbsoluteFile()
, wavUrl);
AudioInputStream ais = AudioManagerFactory.createAudioManager().findInputStream(
wavUrl,
null, null);
CorpusEntry corpusEntry = new CorpusEntry();
corpusEntry.setName("Name1");
FeatureData fd = new FeatureData();
fd.setName("Feature1");
fd.setValues(new FrameValues(new Float[]{1F, 2F, 3F}));
corpusEntry.getFeatureMap().put(fd.getName(), fd);
//when
CorpusEntry savedCorpusEntry =corpusRepository.save(corpusEntry);
CorpusFileEntry updated = (CorpusFileEntry)corpusRepository.update(savedCorpusEntry, ais);
boolean updatedWavExist = updated.getWavFile().exists();
String wavFilePath =updated.getWavFile().getAbsolutePath();
CorpusFileEntry deleted = (CorpusFileEntry)corpusRepository.delete(updated);
//then
String fileName = MessageFormat.format("{0}/{1}-{2,number,#}.wav",
corpusRepository.getRepoDir(),
updated.getName(), updated.getId());
Assert.assertTrue(updatedWavExist);
Assert.assertTrue(wavFilePath+" does not ends with " + fileName,
wavFilePath.endsWith(fileName));
Assert.assertFalse("wav file not exist", deleted.getWavFile().exists());
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
fee44cbb0435d321e9d7950687d22928d6dab7a1 | 0f5f35be1946ba339628d9cc72d9b16b06cdb45d | /src/main/java/com/github/vaerys/sailutils/discordutils/wrappers/ClientObject.java | 631a5724ca57a87392322771af80d03ba783222a | [] | no_license | Vaerys-Dawn/SAILUtils | 7c665c50ad3e966d563610b1dcac71709a68f7e3 | 84abb009d3a087aff4c8b0da95b4e0d619236a1f | refs/heads/master | 2020-03-24T07:00:41.233439 | 2018-07-27T08:26:08 | 2018-07-27T08:26:08 | 142,549,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 644 | java | package com.github.vaerys.sailutils.discordutils.wrappers;
import discord4j.core.DiscordClient;
public class ClientObject {
private final DiscordClient client;
// private final UserObject botUser;
public final EventObject event;
public ClientObject(DiscordClient client, EventObject event) {
this.client = client;
// this.botUser = new UserObject(client.getSelf(), event);
this.event = event;
}
public DiscordClient get() {
return client;
}
// public UserObject getBotUser() {
// return botUser;
// }
public EventObject getEvent() {
return event;
}
}
| [
"thelegotechhead@yahoo.com.au"
] | thelegotechhead@yahoo.com.au |
c981fd106ab6f284cbd6ef0f0dd1297042130621 | 9d00acc6dc1451b10622c6a0b1eb5394fe6deed2 | /src/main/java/org/gpfvic/mahout/cf/taste/impl/similarity/file/FileItemItemSimilarityIterator.java | 49619eeeae07ccbf7640cea54e47e52ffc0203af | [] | no_license | gpfvic/mlbox | 08e52f8f868179de714a9be54ffa5f8b1ecd4588 | 19af00640d922a4722c5e2e1040969f311cbd92e | refs/heads/master | 2020-12-24T20:52:22.379797 | 2016-05-03T06:50:59 | 2016-05-03T06:50:59 | 57,947,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,467 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gpfvic.mahout.cf.taste.impl.similarity.file;
import com.google.common.base.Function;
import com.google.common.collect.ForwardingIterator;
import com.google.common.collect.Iterators;
import org.gpfvic.mahout.cf.taste.impl.similarity.GenericItemSimilarity;
import org.apache.mahout.common.iterator.FileLineIterator;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.regex.Pattern;
/**
* a simple iterator using a {@link FileLineIterator} internally, parsing each
* line into an {@link GenericItemSimilarity.ItemItemSimilarity}.
*/
final class FileItemItemSimilarityIterator extends ForwardingIterator<GenericItemSimilarity.ItemItemSimilarity> {
private static final Pattern SEPARATOR = Pattern.compile("[,\t]");
private final Iterator<GenericItemSimilarity.ItemItemSimilarity> delegate;
FileItemItemSimilarityIterator(File similaritiesFile) throws IOException {
delegate = Iterators.transform(
new FileLineIterator(similaritiesFile),
new Function<String, GenericItemSimilarity.ItemItemSimilarity>() {
@Override
public GenericItemSimilarity.ItemItemSimilarity apply(String from) {
String[] tokens = SEPARATOR.split(from);
return new GenericItemSimilarity.ItemItemSimilarity(Long.parseLong(tokens[0]),
Long.parseLong(tokens[1]),
Double.parseDouble(tokens[2]));
}
});
}
@Override
protected Iterator<GenericItemSimilarity.ItemItemSimilarity> delegate() {
return delegate;
}
}
| [
"gaopengfei@jk.cn"
] | gaopengfei@jk.cn |
673572f8e06b3b73683ff181846b531f23946622 | 111eea2b24294973b3b1a866e5b111071d2cb402 | /proyecto_ninos/src/main/java/proyecto_ninos/Main.java | 07d8596480fb24d6b8833b92d09f39da03e03ec8 | [] | no_license | vmanu/PSP | e6b6561e407c012825895f9b9dc87cae46080c59 | 19f764c346c249640affe3c84a98133bb2405680 | refs/heads/master | 2021-01-21T13:03:28.544438 | 2016-05-11T06:29:01 | 2016-05-11T06:29:01 | 44,518,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,571 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package proyecto_ninos;
import java.util.InputMismatchException;
import java.util.Scanner;
/**
*
* @author Victor
*/
public class Main {
public static int getOpcion(){
Scanner keyb=new Scanner(System.in);
int op=0;
do{
System.out.println("Introduce una opcion:\n\t1.Ver estado Carrera\n\t2.Parar Carrera");
try{
op=keyb.nextInt();
if(op<1||op>2){
System.out.print("El valor introducido no se encuentra entre los elegibles. ");
keyb.nextLine();
}
}catch(InputMismatchException e){
keyb.nextLine();
System.out.print("El valor introducido no es de tipo numerico entero (acorde a las opciones). ");
}
}while(op<1||op>2);
return op;
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Pista miPista=new Pista();
int op;
do{
op=getOpcion();
switch(op){
case 1:
System.out.print(miPista.muestraNiños());
break;
case 2:
miPista.interrumpir();
break;
}
}while(op!=2);
}
}
| [
"vmanuoveuh@hotmail.com"
] | vmanuoveuh@hotmail.com |
5d4949fbc2ab18ffa75d96d257b234271b8d14b5 | 5fe7d86b2a4aa2407d605f6c9657c690c6621311 | /src/main/java/Pandatron76_StSMod/cards/custom_blue/Clawter.java | bbc5713b4dd3f0700587ccafbeed164cb8da2c6c | [] | no_license | Pandatron76/StsMod_Clawfect | 0b6e3582b86e8df3bad80f4233d20efdb408b447 | c8de646a1c4ea1db83826c700f9b03c1f5f87cbd | refs/heads/master | 2020-04-09T15:20:42.510070 | 2019-01-27T01:04:04 | 2019-01-27T01:04:04 | 160,423,045 | 0 | 1 | null | 2019-01-09T04:31:50 | 2018-12-04T21:46:57 | Java | UTF-8 | Java | false | false | 2,392 | java | package Pandatron76_StSMod.cards.custom_blue;
import Pandatron76_StSMod.Clawfect;
import Pandatron76_StSMod.actions.defect.ClawTagAction;
import Pandatron76_StSMod.patches.CardTagsEnum;
import basemod.abstracts.CustomCard;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.DamageAction;
import com.megacrit.cardcrawl.actions.common.RemoveAllBlockAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
public class Clawter extends CustomCard {
public static final String ID = "Clawfect:Clawter";
public static final String IMG_NAME = ID.split(":")[1];
public static final CardStrings cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
public static final String NAME = cardStrings.NAME;
public static final String DESCRIPTION = cardStrings.DESCRIPTION;
public static final int COST = 0;
public static final int ATTACK_DMG = -10;
public static final int MAGIC_NUMBER = 1;
public Clawter(){
super(ID, NAME, Clawfect.makeCardImagePath(IMG_NAME), COST, DESCRIPTION,
AbstractCard.CardType.ATTACK, CardColor.BLUE, CardRarity.COMMON, CardTarget.ENEMY);
this.baseDamage = ATTACK_DMG;
this.baseMagicNumber = MAGIC_NUMBER;
this.magicNumber = this.baseMagicNumber;
this.tags.add(CardTagsEnum.CLAW);
}
public void use(AbstractPlayer player, AbstractMonster monster)
{
AbstractDungeon.actionManager.addToBottom(new RemoveAllBlockAction(monster, player));
AbstractDungeon.actionManager.addToBottom(new DamageAction(
monster, new DamageInfo(
player, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.FIRE));
AbstractDungeon.actionManager.addToBottom(new ClawTagAction(this, this.magicNumber));
}
public AbstractCard makeCopy()
{
return new Clawter();
}
public void upgrade()
{
if (!this.upgraded)
{
upgradeName();
upgradeDamage(4);
}
}
}
| [
"pandatron76@gmail.com"
] | pandatron76@gmail.com |
e074e69d3ac57d78a7760530985d3f068a0c96b5 | 1f795e83ab6f2a49d3f241692b43300792102e7b | /src/main/java/com/flexnet/operations/webservices/CreatedMaintenaceDataType.java | 4623cf2f069c80e2f6ae957d5003b4f9c298665c | [] | no_license | ali-j-maqbool/FNOAvangateConnector | 4b9f43626a074b33d7774ce2c5bf60b3312a31e7 | 93878e75bb9747e8b323065153bb280fc7b1f0b3 | refs/heads/master | 2021-01-17T21:11:29.063784 | 2016-06-24T11:29:34 | 2016-06-24T11:29:34 | 61,436,752 | 0 | 0 | null | 2016-06-24T11:29:35 | 2016-06-18T14:19:44 | Java | UTF-8 | Java | false | false | 4,941 | java | /**
* CreatedMaintenaceDataType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.3 Oct 05, 2005 (05:23:37 EDT) WSDL2Java emitter.
*/
package com.flexnet.operations.webservices;
public class CreatedMaintenaceDataType implements java.io.Serializable {
private java.lang.String recordRefNo;
private java.lang.String uniqueId;
public CreatedMaintenaceDataType() {
}
public CreatedMaintenaceDataType(
java.lang.String recordRefNo,
java.lang.String uniqueId) {
this.recordRefNo = recordRefNo;
this.uniqueId = uniqueId;
}
/**
* Gets the recordRefNo value for this CreatedMaintenaceDataType.
*
* @return recordRefNo
*/
public java.lang.String getRecordRefNo() {
return recordRefNo;
}
/**
* Sets the recordRefNo value for this CreatedMaintenaceDataType.
*
* @param recordRefNo
*/
public void setRecordRefNo(java.lang.String recordRefNo) {
this.recordRefNo = recordRefNo;
}
/**
* Gets the uniqueId value for this CreatedMaintenaceDataType.
*
* @return uniqueId
*/
public java.lang.String getUniqueId() {
return uniqueId;
}
/**
* Sets the uniqueId value for this CreatedMaintenaceDataType.
*
* @param uniqueId
*/
public void setUniqueId(java.lang.String uniqueId) {
this.uniqueId = uniqueId;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof CreatedMaintenaceDataType)) return false;
CreatedMaintenaceDataType other = (CreatedMaintenaceDataType) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.recordRefNo==null && other.getRecordRefNo()==null) ||
(this.recordRefNo!=null &&
this.recordRefNo.equals(other.getRecordRefNo()))) &&
((this.uniqueId==null && other.getUniqueId()==null) ||
(this.uniqueId!=null &&
this.uniqueId.equals(other.getUniqueId())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getRecordRefNo() != null) {
_hashCode += getRecordRefNo().hashCode();
}
if (getUniqueId() != null) {
_hashCode += getUniqueId().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(CreatedMaintenaceDataType.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("urn:com.macrovision:flexnet/operations", "createdMaintenaceDataType"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("recordRefNo");
elemField.setXmlName(new javax.xml.namespace.QName("urn:com.macrovision:flexnet/operations", "recordRefNo"));
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("uniqueId");
elemField.setXmlName(new javax.xml.namespace.QName("urn:com.macrovision:flexnet/operations", "uniqueId"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
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);
}
}
| [
"ali.j.maqbool@gmail.com"
] | ali.j.maqbool@gmail.com |
76cdeec0b1c995c168aa852fce8f2e9748eec8e9 | 81d4b9d6eb7d26a6729c340e5bd20edf5179d7cc | /app/src/main/java/com/codepath/apps/restclienttemplate/LoginActivity.java | 0981f74b871ab560f40816d90e6c7616c6e51433 | [
"MIT",
"Apache-2.0"
] | permissive | krishnakhadka200416/SimpleTweet | 4e1b2660ae94cf52bbac928cbea365c3fbbf875c | 9b9d3352663a8fab8377f3fabc9e22e0fe2e83a8 | refs/heads/master | 2023-03-09T16:51:34.286443 | 2021-02-25T23:07:37 | 2021-02-25T23:07:37 | 337,848,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,942 | java | package com.codepath.apps.restclienttemplate;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import com.codepath.apps.restclienttemplate.models.SampleModel;
import com.codepath.apps.restclienttemplate.models.SampleModelDao;
import com.codepath.oauth.OAuthLoginActionBarActivity;
public class LoginActivity extends OAuthLoginActionBarActivity<TwitterClient> {
SampleModelDao sampleModelDao;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
final SampleModel sampleModel = new SampleModel();
sampleModel.setName("CodePath");
sampleModelDao = ((TwitterApp) getApplicationContext()).getMyDatabase().sampleModelDao();
AsyncTask.execute(new Runnable() {
@Override
public void run() {
sampleModelDao.insertModel(sampleModel);
}
});
}
// Inflate the menu; this adds items to the action bar if it is present.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.login, menu);
return true;
}
// OAuth authenticated successfully, launch primary authenticated activity
// i.e Display application "homepage"
@Override
public void onLoginSuccess() {
Log.i("rk","Login successful");
Intent i = new Intent(this, TimelineActivity.class);
startActivity(i);
// Intent i = new Intent(this, PhotosActivity.class);
// startActivity(i);
}
// OAuth authentication flow failed, handle the error
// i.e Display an error dialog or toast
@Override
public void onLoginFailure(Exception e) {
e.printStackTrace();
}
// Click handler method for the button used to start OAuth flow
// Uses the client to initiate OAuth authorization
// This should be tied to a button used to login
public void loginToRest(View view) {
getClient().connect();
}
}
| [
"krishna.khadka@mavs.uta.edu"
] | krishna.khadka@mavs.uta.edu |
da245d92cbe833412f82b52a77c4d614d278c3ab | fc7a99d048d16cec61180aec68bcbd2e8837a714 | /app/src/main/java/com/example/lsc/weather1/activities/MainActivity.java | 789fbeffa2844439fda72b1384a31acb28279cfb | [] | no_license | StevenIIV/PlantNursing_final | ba877914111f66876f14ef983795aa41ece55023 | 9b295eb2ba295689b3f5b2f446b2200e4609d0d4 | refs/heads/master | 2020-04-29T21:59:15.068084 | 2019-03-19T05:53:35 | 2019-03-19T05:53:35 | 176,431,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,563 | java | package com.example.lsc.weather1.activities;
import android.Manifest;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.location.Location;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.format.Time;
import android.util.Log;
import android.view.ContextMenu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.example.lsc.weather1.R;
import com.example.lsc.weather1.fragments.PlantFragment;
import com.example.lsc.weather1.utils.FontUtils;
import com.example.lsc.weather1.utils.PlantUtil;
import com.example.lsc.weather1.utils.StringUtil;
import com.example.lsc.weather1.apps.MyApp;
import com.example.lsc.weather1.utils.HttpRequest;
import com.example.lsc.weather1.utils.LocationUtils;
import java.util.Calendar;
public class MainActivity extends AppCompatActivity {
private TextView wh_text,wh_code,wh_temperature,wh_time, tx_longitude, tx_latitude, tx_city,tx_district,tx_citycode;
private Button button ,displayBtn;
private FloatingActionButton fab;
private static final int PERMISSION_REQUESTCODE = 1;
private HttpRequest weatherConn,locationConn;
private Location location;
private MyApp app;
private double temperature=20.0;
private int nowHour=12;
public Handler myHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
if(app.myWeather!=null) {
wh_text.setText(app.myWeather.getWeathersAt(nowHour).text);
wh_code.setText(String.valueOf(app.myWeather.getWeathersAt(nowHour).code));
wh_temperature.setText("气温 "+String.valueOf(app.myWeather.getWeathersAt(nowHour).temperature)+"℃");
wh_time.setText(app.myWeather.getWeathersAt(nowHour).time);
temperature=Double.valueOf(app.myWeather.getWeathersAt(nowHour).temperature.toString());
}
else Log.i("weather","is null!!!!!");
break;
case 2:
if(app.myAddress!=null) {
tx_city.setText("城市 "+app.myAddress.city);
tx_district.setText(app.myAddress.district);
String districtName = StringUtil.nameTrim(app.myAddress.district);
String cityCode = StringUtil.parseXML(MainActivity.this, districtName);
if (cityCode == null) {
String cityName = StringUtil.nameTrim(app.myAddress.city);
cityCode = StringUtil.parseXML(MainActivity.this, cityName);
}
if (cityCode != null){
Log.i("name!!!", cityCode);
tx_citycode.setText(cityCode);
weatherConn = new HttpRequest(MainActivity.this);
weatherConn.sendWeatherRequest(cityCode);
}else{
tx_citycode.setText("null");
}
}
else {
tx_city.setText("null");
tx_district.setText("null");
}
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.KITKAT){
//实现透明状态栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//实现透明导航栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
ActionBar actionBar=getSupportActionBar();
actionBar.setCustomView(R.layout.actionbar_title);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
bindView();
app=(MyApp) getApplication();
Time time=new Time();
time.setToNow();
nowHour=time.hour;
Log.i("hour",String.valueOf(nowHour));
permission();
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.showContextMenu();
}
});
}
public void bindView(){
button = (Button) findViewById(R.id.button);
wh_text=(TextView) findViewById(R.id.tx_weather_stat);
wh_code=(TextView) findViewById(R.id.wh_code);
wh_temperature=(TextView) findViewById(R.id.tx_temperature);
wh_time=(TextView) findViewById(R.id.wh_time);
tx_longitude =(TextView) findViewById(R.id.longitude);
tx_latitude =(TextView) findViewById(R.id.latitude);
tx_city =(TextView)findViewById(R.id.tx_city);
tx_district =(TextView)findViewById(R.id.tx_district);
tx_citycode=(TextView)findViewById(R.id.citycode);
fab= (FloatingActionButton) findViewById(R.id.fab_add);
registerForContextMenu(fab);
}
@Override
public void registerForContextMenu(View view) {
super.registerForContextMenu(view);
view.setLongClickable(false);
}
//重写上下文菜单的创建方法
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
MenuInflater inflator = new MenuInflater(this);
inflator.inflate(R.menu.menu_plant, menu);
super.onCreateContextMenu(menu, v, menuInfo);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
Log.i("Title:",item.getTitle().toString());
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
PlantFragment plantFragment = new PlantFragment();
plantFragment.setPlant(PlantUtil.findPlant(MainActivity.this,item.getTitle().toString(),temperature));
plantFragment.setTemperature(temperature);
transaction.add(R.id.line_down,plantFragment);
transaction.commit();
return true;
}
private void permission(){
if(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){//没有授权
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSION_REQUESTCODE);
}else{//已经授权
showLocation();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode){
case PERMISSION_REQUESTCODE:
if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){//用户点击了同意授权
showLocation();
}else{//用户拒绝了授权
Toast.makeText(this,"权限被拒绝",Toast.LENGTH_SHORT).show();
}
break;
default: break;
}
}
public void showLocation(){
location= LocationUtils.getBestLocation(this);
if(location==null){
tx_city.setText("null");
}else {
double longit=location.getLongitude();
double latit=location.getLatitude();
String longi=String.valueOf(longit);
String lati=String.valueOf(latit);
locationConn=new HttpRequest(MainActivity.this);
locationConn.sendLocationRequest(longit,latit);
tx_longitude.setText(longi);
tx_latitude.setText(lati);
}
}
}
| [
"291766389@qq.com"
] | 291766389@qq.com |
0647e1bd5a4c1d1bcae9a94aa8189fe088a20032 | 057b435be6cb6a57a0937f8e280267759086ca98 | /src/main/java/cn/cerc/jdb/other/TickCount.java | d7a57fbb92e40034cac3640c0488f09c41ea5f31 | [
"Apache-2.0"
] | permissive | mr-xhz/summer-db | 2ae100c8a2b40a47425fd703211debded65c9f02 | 2a96bfc7cc6b99844831d3582c4f05bde2ed6112 | refs/heads/develop | 2020-03-26T14:26:00.669564 | 2018-09-01T03:43:41 | 2018-09-01T03:43:41 | 144,987,087 | 0 | 0 | Apache-2.0 | 2018-09-01T03:43:41 | 2018-08-16T12:50:13 | Java | UTF-8 | Java | false | false | 801 | java | package cn.cerc.jdb.other;
import org.apache.log4j.Logger;
public class TickCount {
private static final Logger log = Logger.getLogger(TickCount.class);
private long lastTime;
public TickCount() {
this.lastTime = System.currentTimeMillis();
}
public void print(String message) {
log.info(String.format("%s tickCount: %s", message, System.currentTimeMillis() - lastTime));
this.lastTime = System.currentTimeMillis();
}
public static void main(String[] args) {
TickCount tick = new TickCount();
for (int i = 0; i < 3; i++) {
try {
Thread.sleep(100);
tick.print("test");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| [
"sz9214e@qq.com"
] | sz9214e@qq.com |
98f1fc1a8c6a6b43de3967469e37fb1f8802dd73 | da53d71c01e0ac62fcbabea1655b38687cc54fc1 | /src/SWE/Interface/Hotelinterface.java | 31c365cf0e88c401cd2e7785db48e69ae6d43c3f | [] | no_license | marce132/SWEneu | e0b1ab90c9be94e5a45d0fba824f78fc3a172a08 | 7fa15fc1804f14bdef9f8d28e35cd5a665b625d6 | refs/heads/master | 2020-06-30T04:59:08.760782 | 2013-12-04T17:47:25 | 2013-12-04T17:47:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 861 | java | package SWE.Interface;
import java.util.UUID;
import SWE.hotelmanagement.hotels.Hotel;
//import SWE.usermanagement.users.AbstractUser;
import java.util.ArrayList;
public interface Hotelinterface
{
public abstract Hotel getHotelbyID(UUID id); // gets hotel by ID
public abstract Hotel getHotelbyName(String name); //gets hotel by name
//public abstract AbstractUser getHotelier(Hotel hotel); //gets othel by Hotelier input hotel, return Hotelier useing user id
public abstract ArrayList<Hotel> getHotelList(); // gets the hotel list saved
public abstract void saveHotel(Hotel save); // saves a hotel to the file and arraylist
public abstract void deleteHotel(Hotel delete); // Deletes hotel from Arraylist and overrides file
//public abstract void updateHotel(Hotel update) ; // updates a hotel (overrides object)
}
| [
"markusblecha@eduroam-216-101.wlan.univie.ac.at"
] | markusblecha@eduroam-216-101.wlan.univie.ac.at |
96d3c9084bdac522c8765713a1e604c99e936803 | 72faa32e73e4308643df99fd3af57d12f769050c | /src/main/java/bakacraft/WeaponSkills/BowEffects/PushArrowR.java | 436100e84e246200fa77d05fbd42596c20f1cf68 | [
"MIT"
] | permissive | Deliay/BAKACraft | 3956b2cbfe154f52a7b45d0d1b3d583987001cac | 37687fb8c3f0362c12c0223303708d9e1cacdeb3 | refs/heads/master | 2021-01-01T15:38:48.240687 | 2017-07-30T02:00:08 | 2017-07-30T02:00:08 | 97,665,919 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,203 | java | package bakacraft.WeaponSkills.BowEffects;
import bakacraft.WeaponSkills.BaseSkillBow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.inventory.ItemStack;
/**
* Created by admin on 2017/7/14.
*/
public class PushArrowR extends BaseSkillBow {
@Override
public String getName() {
return "推进之失R";
}
@Override
public int getLevel() {
return 1;
}
@Override
public boolean isOnly() {
return false;
}
@Override
public void applyEffect(EntityDamageByEntityEvent event) {
}
@Override
public void applyEffect(EntityDamageEvent event, LivingEntity by) {
PushArrowN.PushArrow(getLevel(), event, by);
}
@Override
public void burnToWeapon(ItemStack weapon) {
BurnDescription(this, weapon, "按距离结算伤害,1个单位增加2.5%的伤害\n" +
"自身增加缓慢3效果4秒\n" +
"与目标距离超过25个单位时,不再计算单位,伤害减少70%");
}
@Override
public int getChance() {
return 20;
}
}
| [
"admin@remiliascarlet.com"
] | admin@remiliascarlet.com |
f4e32a0066eb56f12ee57abc1e91109af0ab8ffb | a7ef0472e3a1706f922b5e3068806c83fcdbf3ad | /数组/二分查找/最接近的二叉搜索树值.java | 43dfe0529d3772fa902ac486c770834ecdac436a | [] | no_license | kolibreath/oj_practrice | b0ccdb9fb2a4d00e3420d1fa1128cc5906615cbc | 84b8daeb9bfe8c8c7e5224e2b41b121a2f9fd810 | refs/heads/master | 2022-02-16T01:09:58.886379 | 2022-01-30T01:39:02 | 2022-01-30T01:39:02 | 126,612,972 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | public class 最接近的二叉搜索树值 {
class Solution {
public int closestValue(TreeNode root, double target) {
int val, closest = root.val;
while (root != null) {
val = root.val;
closest = Math.abs(val - target) < Math.abs(closest - target) ? val : closest;
root = target < root.val ? root.left : root.right;
}
return closest;
}
}
}
| [
"734780178@qq.com"
] | 734780178@qq.com |
5a9df4fa7c21be9b3cc5b3752663709f7b981829 | f7f9d7fa841e856927e02513ecc74dc00c935f8a | /server/src/test/java/org/codelibs/fesen/discovery/PeerFinderMessagesTests.java | d60cea017abfb59806c445c747f1017cc54bca11 | [
"CDDL-1.0",
"MIT",
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LGPL-2.1-only",
"NAIST-2003",
"LicenseRef-scancode-generic-export-compliance",
"ICU",
"SunPro",
"Python-2.0",
"CC-BY-SA-3.0",
"MPL-1.1",
"GPL-2.0-only",
"CPL-1.0",
"LicenseRef-scancode-other-copyleft",
"Apache-2.0",
"LicenseRef... | permissive | codelibs/fesen | 3f949fd3533e8b25afc3d3475010d1b1a0d95c09 | b2440fbda02e32f7abe77d2be95ead6a16c8af06 | refs/heads/main | 2022-07-27T21:14:02.455938 | 2021-12-21T23:54:20 | 2021-12-21T23:54:20 | 330,334,670 | 4 | 0 | Apache-2.0 | 2022-05-17T01:54:31 | 2021-01-17T07:07:56 | Java | UTF-8 | Java | false | false | 5,584 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.codelibs.fesen.discovery;
import org.codelibs.fesen.Version;
import org.codelibs.fesen.cluster.coordination.PeersResponse;
import org.codelibs.fesen.cluster.node.DiscoveryNode;
import org.codelibs.fesen.discovery.PeersRequest;
import org.codelibs.fesen.test.ESTestCase;
import org.codelibs.fesen.test.EqualsHashCodeTestUtils;
import org.codelibs.fesen.test.EqualsHashCodeTestUtils.CopyFunction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
public class PeerFinderMessagesTests extends ESTestCase {
private DiscoveryNode createNode(String id) {
return new DiscoveryNode(id, buildNewFakeTransportAddress(), Version.CURRENT);
}
public void testPeersRequestEqualsHashCodeSerialization() {
final PeersRequest initialPeersRequest = new PeersRequest(createNode(randomAlphaOfLength(10)),
Arrays.stream(generateRandomStringArray(10, 10, false)).map(this::createNode).collect(Collectors.toList()));
// Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type
EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialPeersRequest,
(CopyFunction<PeersRequest>) publishRequest -> copyWriteable(publishRequest, writableRegistry(), PeersRequest::new),
in -> {
final List<DiscoveryNode> discoveryNodes = new ArrayList<>(in.getKnownPeers());
if (randomBoolean()) {
return new PeersRequest(createNode(randomAlphaOfLength(10)), discoveryNodes);
} else {
return new PeersRequest(in.getSourceNode(), modifyDiscoveryNodesList(in.getKnownPeers(), true));
}
});
}
public void testPeersResponseEqualsHashCodeSerialization() {
final long initialTerm = randomNonNegativeLong();
final PeersResponse initialPeersResponse;
if (randomBoolean()) {
initialPeersResponse = new PeersResponse(Optional.of(createNode(randomAlphaOfLength(10))), emptyList(), initialTerm);
} else {
initialPeersResponse = new PeersResponse(Optional.empty(),
Arrays.stream(generateRandomStringArray(10, 10, false, false)).map(this::createNode).collect(Collectors.toList()),
initialTerm);
}
// Note: the explicit cast of the CopyFunction is needed for some IDE (specifically Eclipse 4.8.0) to infer the right type
EqualsHashCodeTestUtils.checkEqualsAndHashCode(initialPeersResponse,
(CopyFunction<PeersResponse>) publishResponse -> copyWriteable(publishResponse, writableRegistry(), PeersResponse::new),
in -> {
final long term = in.getTerm();
if (randomBoolean()) {
return new PeersResponse(in.getMasterNode(), in.getKnownPeers(),
randomValueOtherThan(term, ESTestCase::randomNonNegativeLong));
} else {
if (in.getMasterNode().isPresent()) {
if (randomBoolean()) {
return new PeersResponse(Optional.of(createNode(randomAlphaOfLength(10))), in.getKnownPeers(), term);
} else {
return new PeersResponse(Optional.empty(), singletonList(createNode(randomAlphaOfLength(10))), term);
}
} else {
if (randomBoolean()) {
return new PeersResponse(Optional.of(createNode(randomAlphaOfLength(10))), emptyList(), term);
} else {
return new PeersResponse(in.getMasterNode(), modifyDiscoveryNodesList(in.getKnownPeers(), false), term);
}
}
}
});
}
private List<DiscoveryNode> modifyDiscoveryNodesList(Collection<DiscoveryNode> originalNodes, boolean allowEmpty) {
final List<DiscoveryNode> discoveryNodes = new ArrayList<>(originalNodes);
if (discoveryNodes.isEmpty() == false && randomBoolean() && (allowEmpty || discoveryNodes.size() > 1)) {
discoveryNodes.remove(randomIntBetween(0, discoveryNodes.size() - 1));
} else if (discoveryNodes.isEmpty() == false && randomBoolean()) {
discoveryNodes.set(randomIntBetween(0, discoveryNodes.size() - 1), createNode(randomAlphaOfLength(10)));
} else {
discoveryNodes.add(createNode(randomAlphaOfLength(10)));
}
return discoveryNodes;
}
}
| [
"shinsuke@apache.org"
] | shinsuke@apache.org |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.