blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
sequence | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
unknown | revision_date
unknown | committer_date
unknown | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
unknown | gha_created_at
unknown | gha_updated_at
unknown | gha_pushed_at
unknown | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
sequence | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0fd1df4d65470a3171f581c393ac56ac38b9beda | 4,148,938,469,484 | c97015b777cbd02b4b7faa0e025bcfab913d22c0 | /src/main/java/com/netcracker/solutions/kpi/controller/student/StudentApplicationFormController.java | a963b2330a155ed454742aa30de03f91385b557e | [] | no_license | chalienko13/recruitingSystem | https://github.com/chalienko13/recruitingSystem | 9c4ed43e12d676dbd0dc96a30ada1f47d6c2a4fa | 1178aa6add221e0a7511e9f072e5346096efa163 | refs/heads/master | "2021-01-16T23:16:33.535000" | "2016-08-11T16:52:52" | "2016-08-11T16:52:52" | 65,560,910 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.netcracker.solutions.kpi.controller.student;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.VisibilityChecker;
import com.google.gson.*;
import com.itextpdf.text.DocumentException;
import com.netcracker.solutions.kpi.config.PropertiesReader;
import com.netcracker.solutions.kpi.persistence.dto.*;
import com.netcracker.solutions.kpi.persistence.model.*;
import com.netcracker.solutions.kpi.persistence.model.adapter.*;
import com.netcracker.solutions.kpi.persistence.model.enums.*;
import com.netcracker.solutions.kpi.service.*;
import com.netcracker.solutions.kpi.util.export.*;
import org.apache.commons.io.FilenameUtils;
import org.slf4j.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import util.form.FormAnswerProcessor;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.sql.Timestamp;
import java.util.*;
@RestController
@RequestMapping("/student")
public class StudentApplicationFormController {
private static final String[] AVAILABLE_PHOTO_EXTENSIONS = {"jpg", "jpeg", "png"};
private static Logger log = LoggerFactory.getLogger(StudentApplicationFormController.class);
private static Gson gson = new Gson();
private static final String WRONG_INPUT_MESSAGE = gson.toJson(new MessageDto("Wrong input.", MessageDtoType.ERROR));
private static final String MUST_UPLOAD_PHOTO_MESSAGE = gson
.toJson(new MessageDto("You must upload photo.", MessageDtoType.ERROR));
private static final String WAS_UPDATED_MESSAGE = gson
.toJson(new MessageDto("Your application form was updated.", MessageDtoType.SUCCESS));
private static final String WAS_CREATED_MESSAGE = gson
.toJson(new MessageDto("Your application form was created.", MessageDtoType.SUCCESS));
private static final String CANNOT_UPLOAD_MESSAGE = gson
.toJson(new MessageDto("Cannot upload photo", MessageDtoType.ERROR));
private static final String PHOTO_HAS_WRONG_FORMAT_MESSAGE = gson
.toJson(new MessageDto("Photo has wrong format", MessageDtoType.ERROR));
private static final String MUST_FILL_IN_MANDATORY_MESSAGE = gson
.toJson(new MessageDto("You must fill in all mandatory fields.", MessageDtoType.ERROR));
private static final String REGISTRATION_DEADLINE = gson.toJson(new MessageDto(
"You cannot update your application form after registration deadline.", MessageDtoType.ERROR));
@Autowired
private FormAnswerService formAnswerService;
@Autowired
private ApplicationFormService applicationFormService;
@Autowired
private UserService userService;
@Autowired
private FormQuestionService formQuestionService;
@Autowired
private RoleService roleService;
@Autowired
private RecruitmentService recruitmentService;
@Autowired
private StatusService statusService;
@Autowired
private PropertiesReader propertiesReader;
@Transactional
@RequestMapping(value = "appform", method = RequestMethod.POST)
public ApplicationForm getApplicationForm() {
User student = userService.getAuthorizedUser();
ApplicationForm applicationForm = applicationFormService.getApplicationFormByUserId(student.getId());
Long roleId = RoleEnum.ROLE_STUDENT.getId();
applicationForm.setQuestions(formQuestionService.getEnableByRole(roleId));
return applicationForm;
}
@Transactional
@RequestMapping(value = "saveApplicationForm", method = RequestMethod.POST)
public String saveApplicationForm(@RequestParam("applicationForm") String applicationFormJson,
@RequestParam("file") MultipartFile file) {
ObjectMapper mapper = new ObjectMapper();
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
mapper.setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(JsonAutoDetect.Visibility.ANY));
ApplicationForm applicationForm = null;
System.out.println("JSON: " + applicationFormJson);
try {
applicationForm = mapper.readValue(applicationFormJson, ApplicationForm.class);
} catch (IOException e) {
log.error("Cannot parse json to object",e);
return WRONG_INPUT_MESSAGE;
}
User user = userService.getAuthorizedUser();
log.info("Save application form {} for user: {} ", applicationForm, user.getEmail());
// updateUser(user, applicationForm.getUser());
// Recruitment currentRecruitment = recruitmentService.getCurrentRecruitmnet();
// boolean newForm = false;
// Set<FormQuestion> remainedQuestions;
// ApplicationForm applicationForm = getApplicationFormForSave(user);
// log.info("Saving application form of user {}", user.getId());
// if (applicationForm == null || !applicationForm.isActive()) {
// newForm = true;
// if (file.isEmpty()) {
// return MUST_UPLOAD_PHOTO_MESSAGE;
// }
// applicationForm = createApplicationForm(user);
// remainedQuestions = formQuestionService
// .getByEnableRoleAsSet(roleService.getRoleByTitle(RoleEnum.valueOf(RoleEnum.ROLE_STUDENT)));
// } else {
// Recruitment recruitment = applicationForm.getRecruitment();
// if (recruitment != null) {
// if (currentRecruitment != null && recruitment.getId().equals(currentRecruitment.getId()) && isRegistrationDeadlineEnded(recruitment)) {
// return REGISTRATION_DEADLINE;
// }
// remainedQuestions = formQuestionService.getByApplicationFormAsSet(applicationForm);
// } else {
// if (currentRecruitment != null && !isRegistrationDeadlineEnded(currentRecruitment)) {
// applicationForm.setRecruitment(currentRecruitment);
// }
// remainedQuestions = formQuestionService
// .getByEnableRoleAsSet(roleService.getRoleByTitle(RoleEnum.valueOf(RoleEnum.ROLE_STUDENT)));
// }
// }
// String errorMessage = processAnswers(applicationForm, applicationForm.getQuestions(), remainedQuestions,
// newForm);
// if (errorMessage != null) {
// return errorMessage;
// }
// if (newForm) {
//
// applicationFormService.insertApplicationForm(applicationForm);
// } else {
// applicationFormService.updateApplicationFormWithAnswers(applicationForm);
// }
// if (!file.isEmpty()) {
String fileExtension = FilenameUtils.getExtension(file.getOriginalFilename());
// if (!hasPhotoValidFormat(fileExtension)) {
// return PHOTO_HAS_WRONG_FORMAT_MESSAGE;
// }
// if (!savePhoto(applicationForm, file, fileExtension)) {
// return CANNOT_UPLOAD_MESSAGE;
// }
// }
// if (newForm) {
// return WAS_CREATED_MESSAGE;
// } else {
// return WAS_UPDATED_MESSAGE;
// }
return WAS_CREATED_MESSAGE;
}
private void updateUser(User user, UserDto userDto) {
user.setLastName(userDto.getLastName());
user.setFirstName(userDto.getFirstName());
user.setSecondName(userDto.getSecondName());
userService.updateUser(user);
}
private String processAnswers(ApplicationForm applicationForm, List<FormQuestion> questions,
Set<FormQuestion> remainedQuestions, boolean newForm) {
// FormAnswerProcessor formAnswerProcessor = new FormAnswerProcessor(applicationForm);
// List<FormAnswer> finalAnswers = new ArrayList<>();
// for (FormQuestion questionDto : questions) {
// FormQuestion formQuestion = formQuestionService.getById(questionDto.getId());
// formAnswerProcessor.setFormQuestion(formQuestion);
// if (!isFormQuestionValid(formQuestion)) {
// return WRONG_INPUT_MESSAGE;
// }
// if (formQuestion.isMandatory() && !isFilled(questionDto)) {
// return MUST_FILL_IN_MANDATORY_MESSAGE;
// }
// if (!remainedQuestions.remove(formQuestion)) {
// return WRONG_INPUT_MESSAGE;
// }
// System.out.println("APLICATION FORM QUESTION " + applicationForm.getQuestions());
//// if (!newForm && containsQuestionWithId(applicationForm.getQuestions(), formQuestion.getId())) {
//// List<FormAnswer> answers = formAnswerService.getByApplicationFormAndQuestion(applicationForm,
//// formQuestion);
//// formAnswerProcessor.updateAnswers(questionDto.g(), answers);
//// } else {
//// formAnswerProcessor.insertNewAnswers(questionDto.getAnswers());
//// }
// }
// if (!remainedQuestions.isEmpty()) {
// return WRONG_INPUT_MESSAGE;
// }
// finalAnswers.addAll(formAnswerProcessor.getAnswers());
// applicationForm.setAnswers(finalAnswers);
return null;
}
private boolean savePhoto(ApplicationForm applicationForm, MultipartFile file, String fileExtension) {
try {
String photoScope = applicationForm.getId() + "." + fileExtension;
String photoDirPath = propertiesReader.propertiesReader("photodir.path");
File photoFile = new File(photoDirPath, photoScope);
log.info("Saving photo to {}", photoFile.getAbsolutePath());
file.transferTo(photoFile);
applicationForm.setPhotoScope(photoScope);
applicationFormService.updateApplicationForm(applicationForm);
return true;
} catch (IOException e) {
log.error("Cannot save photo", e);
return false;
}
}
@RequestMapping(value = "appform/{applicationFormId}", method = RequestMethod.GET)
public void exportAppform(@PathVariable Long applicationFormId, HttpServletResponse response)
throws IOException, DocumentException {
ApplicationForm applicationForm = applicationFormService.getApplicationFormById(applicationFormId);
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=ApplicationForm.pdf");
ExportApplicationForm pdfAppForm = new ExportApplicationFormImp();
pdfAppForm.export(applicationForm, response);
}
private ApplicationForm createApplicationForm(User user) {
log.info("Create Application Form for User {}",user);
ApplicationForm applicationForm = new ApplicationForm();
applicationForm.setUser(user);
Recruitment recruitment = recruitmentService.getCurrentRecruitmnet();
applicationForm.setStatus(statusService.getStatusById(StatusEnum.REGISTERED.getId()));
applicationForm.setActive(true);
applicationForm.setDateCreate(new Timestamp(System.currentTimeMillis()));
applicationForm.setRecruitment(recruitment);
return applicationForm;
}
private boolean isFormQuestionValid(FormQuestion formQuestion) {
return !(formQuestion == null || !formQuestion.isEnable());
}
private boolean isFilled(StudentAppFormQuestionDto questionDto) {
List<StudentAnswerDto> answersDto = questionDto.getAnswers();
if (answersDto == null) {
return false;
}
for (StudentAnswerDto answer : answersDto) {
if (answer != null && answer.getAnswer() != null && !answer.getAnswer().isEmpty()) {
return true;
}
}
return false;
}
private boolean hasPhotoValidFormat(String fileExtension) {
for (String photoExtension : AVAILABLE_PHOTO_EXTENSIONS) {
if (photoExtension.equals(fileExtension)) {
return true;
}
}
return false;
}
private boolean containsQuestionWithId(List<FormQuestion> questions, Long id) {
if (questions == null){
return false;
}
for (FormQuestion formQuestion : questions) {
if (formQuestion.getId().equals(id)) {
return true;
}
}
return false;
}
private boolean isRegistrationDeadlineEnded(Recruitment recruitment) {
Timestamp deadline = recruitment.getRegistrationDeadline();
return deadline != null && deadline.before(new Date());
}
private ApplicationForm getApplicationFormForSave(User student) {
ApplicationForm applicationForm = applicationFormService.getCurrentApplicationFormByUserId(student.getId());
if (applicationForm == null) {
applicationForm = applicationFormService.getLastApplicationFormByUserId(student.getId());
}
return applicationForm;
}
} | UTF-8 | Java | 13,416 | java | StudentApplicationFormController.java | Java | [] | null | [] | package com.netcracker.solutions.kpi.controller.student;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.VisibilityChecker;
import com.google.gson.*;
import com.itextpdf.text.DocumentException;
import com.netcracker.solutions.kpi.config.PropertiesReader;
import com.netcracker.solutions.kpi.persistence.dto.*;
import com.netcracker.solutions.kpi.persistence.model.*;
import com.netcracker.solutions.kpi.persistence.model.adapter.*;
import com.netcracker.solutions.kpi.persistence.model.enums.*;
import com.netcracker.solutions.kpi.service.*;
import com.netcracker.solutions.kpi.util.export.*;
import org.apache.commons.io.FilenameUtils;
import org.slf4j.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import util.form.FormAnswerProcessor;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.sql.Timestamp;
import java.util.*;
@RestController
@RequestMapping("/student")
public class StudentApplicationFormController {
private static final String[] AVAILABLE_PHOTO_EXTENSIONS = {"jpg", "jpeg", "png"};
private static Logger log = LoggerFactory.getLogger(StudentApplicationFormController.class);
private static Gson gson = new Gson();
private static final String WRONG_INPUT_MESSAGE = gson.toJson(new MessageDto("Wrong input.", MessageDtoType.ERROR));
private static final String MUST_UPLOAD_PHOTO_MESSAGE = gson
.toJson(new MessageDto("You must upload photo.", MessageDtoType.ERROR));
private static final String WAS_UPDATED_MESSAGE = gson
.toJson(new MessageDto("Your application form was updated.", MessageDtoType.SUCCESS));
private static final String WAS_CREATED_MESSAGE = gson
.toJson(new MessageDto("Your application form was created.", MessageDtoType.SUCCESS));
private static final String CANNOT_UPLOAD_MESSAGE = gson
.toJson(new MessageDto("Cannot upload photo", MessageDtoType.ERROR));
private static final String PHOTO_HAS_WRONG_FORMAT_MESSAGE = gson
.toJson(new MessageDto("Photo has wrong format", MessageDtoType.ERROR));
private static final String MUST_FILL_IN_MANDATORY_MESSAGE = gson
.toJson(new MessageDto("You must fill in all mandatory fields.", MessageDtoType.ERROR));
private static final String REGISTRATION_DEADLINE = gson.toJson(new MessageDto(
"You cannot update your application form after registration deadline.", MessageDtoType.ERROR));
@Autowired
private FormAnswerService formAnswerService;
@Autowired
private ApplicationFormService applicationFormService;
@Autowired
private UserService userService;
@Autowired
private FormQuestionService formQuestionService;
@Autowired
private RoleService roleService;
@Autowired
private RecruitmentService recruitmentService;
@Autowired
private StatusService statusService;
@Autowired
private PropertiesReader propertiesReader;
@Transactional
@RequestMapping(value = "appform", method = RequestMethod.POST)
public ApplicationForm getApplicationForm() {
User student = userService.getAuthorizedUser();
ApplicationForm applicationForm = applicationFormService.getApplicationFormByUserId(student.getId());
Long roleId = RoleEnum.ROLE_STUDENT.getId();
applicationForm.setQuestions(formQuestionService.getEnableByRole(roleId));
return applicationForm;
}
@Transactional
@RequestMapping(value = "saveApplicationForm", method = RequestMethod.POST)
public String saveApplicationForm(@RequestParam("applicationForm") String applicationFormJson,
@RequestParam("file") MultipartFile file) {
ObjectMapper mapper = new ObjectMapper();
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
mapper.setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(JsonAutoDetect.Visibility.ANY));
ApplicationForm applicationForm = null;
System.out.println("JSON: " + applicationFormJson);
try {
applicationForm = mapper.readValue(applicationFormJson, ApplicationForm.class);
} catch (IOException e) {
log.error("Cannot parse json to object",e);
return WRONG_INPUT_MESSAGE;
}
User user = userService.getAuthorizedUser();
log.info("Save application form {} for user: {} ", applicationForm, user.getEmail());
// updateUser(user, applicationForm.getUser());
// Recruitment currentRecruitment = recruitmentService.getCurrentRecruitmnet();
// boolean newForm = false;
// Set<FormQuestion> remainedQuestions;
// ApplicationForm applicationForm = getApplicationFormForSave(user);
// log.info("Saving application form of user {}", user.getId());
// if (applicationForm == null || !applicationForm.isActive()) {
// newForm = true;
// if (file.isEmpty()) {
// return MUST_UPLOAD_PHOTO_MESSAGE;
// }
// applicationForm = createApplicationForm(user);
// remainedQuestions = formQuestionService
// .getByEnableRoleAsSet(roleService.getRoleByTitle(RoleEnum.valueOf(RoleEnum.ROLE_STUDENT)));
// } else {
// Recruitment recruitment = applicationForm.getRecruitment();
// if (recruitment != null) {
// if (currentRecruitment != null && recruitment.getId().equals(currentRecruitment.getId()) && isRegistrationDeadlineEnded(recruitment)) {
// return REGISTRATION_DEADLINE;
// }
// remainedQuestions = formQuestionService.getByApplicationFormAsSet(applicationForm);
// } else {
// if (currentRecruitment != null && !isRegistrationDeadlineEnded(currentRecruitment)) {
// applicationForm.setRecruitment(currentRecruitment);
// }
// remainedQuestions = formQuestionService
// .getByEnableRoleAsSet(roleService.getRoleByTitle(RoleEnum.valueOf(RoleEnum.ROLE_STUDENT)));
// }
// }
// String errorMessage = processAnswers(applicationForm, applicationForm.getQuestions(), remainedQuestions,
// newForm);
// if (errorMessage != null) {
// return errorMessage;
// }
// if (newForm) {
//
// applicationFormService.insertApplicationForm(applicationForm);
// } else {
// applicationFormService.updateApplicationFormWithAnswers(applicationForm);
// }
// if (!file.isEmpty()) {
String fileExtension = FilenameUtils.getExtension(file.getOriginalFilename());
// if (!hasPhotoValidFormat(fileExtension)) {
// return PHOTO_HAS_WRONG_FORMAT_MESSAGE;
// }
// if (!savePhoto(applicationForm, file, fileExtension)) {
// return CANNOT_UPLOAD_MESSAGE;
// }
// }
// if (newForm) {
// return WAS_CREATED_MESSAGE;
// } else {
// return WAS_UPDATED_MESSAGE;
// }
return WAS_CREATED_MESSAGE;
}
private void updateUser(User user, UserDto userDto) {
user.setLastName(userDto.getLastName());
user.setFirstName(userDto.getFirstName());
user.setSecondName(userDto.getSecondName());
userService.updateUser(user);
}
private String processAnswers(ApplicationForm applicationForm, List<FormQuestion> questions,
Set<FormQuestion> remainedQuestions, boolean newForm) {
// FormAnswerProcessor formAnswerProcessor = new FormAnswerProcessor(applicationForm);
// List<FormAnswer> finalAnswers = new ArrayList<>();
// for (FormQuestion questionDto : questions) {
// FormQuestion formQuestion = formQuestionService.getById(questionDto.getId());
// formAnswerProcessor.setFormQuestion(formQuestion);
// if (!isFormQuestionValid(formQuestion)) {
// return WRONG_INPUT_MESSAGE;
// }
// if (formQuestion.isMandatory() && !isFilled(questionDto)) {
// return MUST_FILL_IN_MANDATORY_MESSAGE;
// }
// if (!remainedQuestions.remove(formQuestion)) {
// return WRONG_INPUT_MESSAGE;
// }
// System.out.println("APLICATION FORM QUESTION " + applicationForm.getQuestions());
//// if (!newForm && containsQuestionWithId(applicationForm.getQuestions(), formQuestion.getId())) {
//// List<FormAnswer> answers = formAnswerService.getByApplicationFormAndQuestion(applicationForm,
//// formQuestion);
//// formAnswerProcessor.updateAnswers(questionDto.g(), answers);
//// } else {
//// formAnswerProcessor.insertNewAnswers(questionDto.getAnswers());
//// }
// }
// if (!remainedQuestions.isEmpty()) {
// return WRONG_INPUT_MESSAGE;
// }
// finalAnswers.addAll(formAnswerProcessor.getAnswers());
// applicationForm.setAnswers(finalAnswers);
return null;
}
private boolean savePhoto(ApplicationForm applicationForm, MultipartFile file, String fileExtension) {
try {
String photoScope = applicationForm.getId() + "." + fileExtension;
String photoDirPath = propertiesReader.propertiesReader("photodir.path");
File photoFile = new File(photoDirPath, photoScope);
log.info("Saving photo to {}", photoFile.getAbsolutePath());
file.transferTo(photoFile);
applicationForm.setPhotoScope(photoScope);
applicationFormService.updateApplicationForm(applicationForm);
return true;
} catch (IOException e) {
log.error("Cannot save photo", e);
return false;
}
}
@RequestMapping(value = "appform/{applicationFormId}", method = RequestMethod.GET)
public void exportAppform(@PathVariable Long applicationFormId, HttpServletResponse response)
throws IOException, DocumentException {
ApplicationForm applicationForm = applicationFormService.getApplicationFormById(applicationFormId);
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=ApplicationForm.pdf");
ExportApplicationForm pdfAppForm = new ExportApplicationFormImp();
pdfAppForm.export(applicationForm, response);
}
private ApplicationForm createApplicationForm(User user) {
log.info("Create Application Form for User {}",user);
ApplicationForm applicationForm = new ApplicationForm();
applicationForm.setUser(user);
Recruitment recruitment = recruitmentService.getCurrentRecruitmnet();
applicationForm.setStatus(statusService.getStatusById(StatusEnum.REGISTERED.getId()));
applicationForm.setActive(true);
applicationForm.setDateCreate(new Timestamp(System.currentTimeMillis()));
applicationForm.setRecruitment(recruitment);
return applicationForm;
}
private boolean isFormQuestionValid(FormQuestion formQuestion) {
return !(formQuestion == null || !formQuestion.isEnable());
}
private boolean isFilled(StudentAppFormQuestionDto questionDto) {
List<StudentAnswerDto> answersDto = questionDto.getAnswers();
if (answersDto == null) {
return false;
}
for (StudentAnswerDto answer : answersDto) {
if (answer != null && answer.getAnswer() != null && !answer.getAnswer().isEmpty()) {
return true;
}
}
return false;
}
private boolean hasPhotoValidFormat(String fileExtension) {
for (String photoExtension : AVAILABLE_PHOTO_EXTENSIONS) {
if (photoExtension.equals(fileExtension)) {
return true;
}
}
return false;
}
private boolean containsQuestionWithId(List<FormQuestion> questions, Long id) {
if (questions == null){
return false;
}
for (FormQuestion formQuestion : questions) {
if (formQuestion.getId().equals(id)) {
return true;
}
}
return false;
}
private boolean isRegistrationDeadlineEnded(Recruitment recruitment) {
Timestamp deadline = recruitment.getRegistrationDeadline();
return deadline != null && deadline.before(new Date());
}
private ApplicationForm getApplicationFormForSave(User student) {
ApplicationForm applicationForm = applicationFormService.getCurrentApplicationFormByUserId(student.getId());
if (applicationForm == null) {
applicationForm = applicationFormService.getLastApplicationFormByUserId(student.getId());
}
return applicationForm;
}
} | 13,416 | 0.672779 | 0.672704 | 288 | 45.586807 | 32.200748 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 5 |
a8afa578308d92bd2f33857f3dc156fb1b69a1b8 | 1,151,051,290,476 | 66df2a4f4cab8cf18836d5c07e683470d9ec11c5 | /candy_shop/backend/src/main/java/slabodchikov/tritpo/candy_shop/backend/controller/CartController.java | 5367b9dfc0ac174b48053cfcdb212c9ea9022586 | [] | no_license | RSlabodchikov/CandyShop | https://github.com/RSlabodchikov/CandyShop | f98c1e2fb6e320f793c558658165afb5d530c6ad | d288384368dcd91f93ead5f792f26a7024bbe9f7 | refs/heads/master | "2020-08-03T23:17:32.822000" | "2019-12-10T09:00:43" | "2019-12-10T09:00:43" | 211,917,396 | 0 | 3 | null | false | "2019-12-04T02:01:03" | "2019-09-30T17:36:01" | "2019-12-03T22:11:45" | "2019-12-04T02:01:01" | 1,707 | 0 | 0 | 1 | Java | false | false | package slabodchikov.tritpo.candy_shop.backend.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import slabodchikov.tritpo.candy_shop.backend.entity.Cart;
import slabodchikov.tritpo.candy_shop.backend.service.CartService;
@RestController
@RequestMapping(value = "/api/carts")
public class CartController {
private CartService cartService;
@Autowired
public CartController(CartService cartService) {
this.cartService = cartService;
}
@GetMapping
public Iterable<Cart> findAll() {
return cartService.findAll();
}
@GetMapping(value = "/{cartId}")
public Cart findById(@PathVariable(name = "cartId") Long id) {
return cartService.findById(id).orElse(null);
}
@DeleteMapping(value = "/{cartId}")
public void deleteById(@PathVariable(name = "cartId") Long id) {
cartService.deleteById(id);
}
@PostMapping
public Cart save(@RequestBody Cart cart) {
return cartService.save(cart);
}
@GetMapping(value = "/user/{userId}")
public Cart findByUserId(@PathVariable(name = "userId") Long id) {
return cartService.findByUserId(id);
}
}
| UTF-8 | Java | 1,231 | java | CartController.java | Java | [] | null | [] | package slabodchikov.tritpo.candy_shop.backend.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import slabodchikov.tritpo.candy_shop.backend.entity.Cart;
import slabodchikov.tritpo.candy_shop.backend.service.CartService;
@RestController
@RequestMapping(value = "/api/carts")
public class CartController {
private CartService cartService;
@Autowired
public CartController(CartService cartService) {
this.cartService = cartService;
}
@GetMapping
public Iterable<Cart> findAll() {
return cartService.findAll();
}
@GetMapping(value = "/{cartId}")
public Cart findById(@PathVariable(name = "cartId") Long id) {
return cartService.findById(id).orElse(null);
}
@DeleteMapping(value = "/{cartId}")
public void deleteById(@PathVariable(name = "cartId") Long id) {
cartService.deleteById(id);
}
@PostMapping
public Cart save(@RequestBody Cart cart) {
return cartService.save(cart);
}
@GetMapping(value = "/user/{userId}")
public Cart findByUserId(@PathVariable(name = "userId") Long id) {
return cartService.findByUserId(id);
}
}
| 1,231 | 0.698619 | 0.698619 | 44 | 26.977272 | 23.710842 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false | 5 |
c2ce6e202c6458bb3a2c6e30add637e72d32f19d | 18,674,517,863,560 | 784018619972bc15635a3cd7cbac0a71571e21f7 | /spboot/src/main/java/com/spboot/test/controller/CustomerInfoController.java | 9292ea179fca1ded9f6e18d7e23f3291ca8c8607 | [] | no_license | csh4612/spboot123 | https://github.com/csh4612/spboot123 | c255afd64bff90f21b1836b486c5a14549319759 | 529d8f5ef949ce903eceb1210ea1ac05df133749 | refs/heads/master | "2023-03-29T15:06:37.064000" | "2021-04-04T10:16:20" | "2021-04-04T10:16:20" | 352,319,553 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.spboot.test.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import com.spboot.test.entity.CustomerInfo;
import com.spboot.test.service.CustomerInfoService;
import lombok.extern.slf4j.Slf4j;
@Controller
@Slf4j
public class CustomerInfoController {
@Autowired
private CustomerInfoService customerInfoService;
@PostMapping("/login")
public @ResponseBody CustomerInfo login(@RequestBody CustomerInfo customerInfo, HttpServletRequest req) {
CustomerInfo cui = customerInfoService.login(customerInfo);
if(cui!=null) {
HttpSession session = req.getSession();
session.setAttribute("customerInfo", cui);
}
return cui;
}
@PostMapping("/logout")
public @ResponseBody boolean logout(HttpServletRequest req) {
HttpSession session = req.getSession();
session.invalidate();
return true;
}
}
// get맵핑엔 모델어트리뷰트 post맵핑엔 리퀘스트 바디
| UTF-8 | Java | 1,285 | java | CustomerInfoController.java | Java | [] | null | [] | package com.spboot.test.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import com.spboot.test.entity.CustomerInfo;
import com.spboot.test.service.CustomerInfoService;
import lombok.extern.slf4j.Slf4j;
@Controller
@Slf4j
public class CustomerInfoController {
@Autowired
private CustomerInfoService customerInfoService;
@PostMapping("/login")
public @ResponseBody CustomerInfo login(@RequestBody CustomerInfo customerInfo, HttpServletRequest req) {
CustomerInfo cui = customerInfoService.login(customerInfo);
if(cui!=null) {
HttpSession session = req.getSession();
session.setAttribute("customerInfo", cui);
}
return cui;
}
@PostMapping("/logout")
public @ResponseBody boolean logout(HttpServletRequest req) {
HttpSession session = req.getSession();
session.invalidate();
return true;
}
}
// get맵핑엔 모델어트리뷰트 post맵핑엔 리퀘스트 바디
| 1,285 | 0.773857 | 0.771451 | 42 | 27.690475 | 25.150488 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.238095 | false | false | 5 |
7ab55c78e1122e740e387759640ca715ae585017 | 21,895,743,306,678 | 3ff4870a690af2c5a9154b15e0a7fed0abfb4b37 | /src/day16_string_manipulations/Replace.java | 25b0876d9ad745cfde2d8e1fdffac464be147139 | [] | no_license | dmitrybalduev/java-practice | https://github.com/dmitrybalduev/java-practice | 4d42cd4cd284b11c375c6723767241963d4eeaa3 | 6ec607811ff34a1b263ad38eabffeb8465e6fce3 | refs/heads/master | "2020-05-18T08:12:48.054000" | "2019-05-29T22:22:34" | "2019-05-29T22:22:34" | 184,287,490 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package day16_string_manipulations;
import java.util.*;
public class Replace {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter the words:");
String word = scan.nextLine();
//System.out.println(word.toLowerCase().replace("a", "y"));
System.out.println(word.replaceFirst(" ", "||"));
}
}
| UTF-8 | Java | 361 | java | Replace.java | Java | [] | null | [] | package day16_string_manipulations;
import java.util.*;
public class Replace {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter the words:");
String word = scan.nextLine();
//System.out.println(word.toLowerCase().replace("a", "y"));
System.out.println(word.replaceFirst(" ", "||"));
}
}
| 361 | 0.67867 | 0.67313 | 14 | 24.785715 | 20.330057 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.785714 | false | false | 5 |
568fe336f3567bd0a3d4ec2cf18e0d56aee6eeae | 22,393,959,512,413 | 696f8617042acfbd339c924fb879b566f9fb6a4b | /sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java | 99262e9e820587eaed66bc8163d3fbb8878d940b | [
"MIT"
] | permissive | anuchandy/azure-sdk-for-java | https://github.com/anuchandy/azure-sdk-for-java | cb5587a47c661f8a4510bef6cee1d3d33ffe1c65 | 6e1630458c4c6e3bbbd45fae02de357d4f49d6fe | refs/heads/master | "2023-08-31T20:57:47.002000" | "2019-07-01T18:02:29" | "2019-07-01T18:02:29" | 194,730,010 | 7 | 1 | MIT | true | "2023-08-17T22:59:17" | "2019-07-01T19:13:58" | "2022-12-06T22:36:24" | "2023-08-17T22:59:16" | 3,000,167 | 1 | 0 | 1 | Java | false | false | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation;
import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedDatabaseBlobAuditingPolicy;
import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl;
import rx.Observable;
import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState;
import java.util.List;
import java.util.UUID;
class ExtendedDatabaseBlobAuditingPolicyImpl extends CreatableUpdatableImpl<ExtendedDatabaseBlobAuditingPolicy, ExtendedDatabaseBlobAuditingPolicyInner, ExtendedDatabaseBlobAuditingPolicyImpl> implements ExtendedDatabaseBlobAuditingPolicy, ExtendedDatabaseBlobAuditingPolicy.Definition, ExtendedDatabaseBlobAuditingPolicy.Update {
private final SqlManager manager;
private String resourceGroupName;
private String serverName;
private String databaseName;
ExtendedDatabaseBlobAuditingPolicyImpl(String name, SqlManager manager) {
super(name, new ExtendedDatabaseBlobAuditingPolicyInner());
this.manager = manager;
// Set resource name
this.databaseName = name;
//
}
ExtendedDatabaseBlobAuditingPolicyImpl(ExtendedDatabaseBlobAuditingPolicyInner inner, SqlManager manager) {
super(inner.name(), inner);
this.manager = manager;
// Set resource name
this.databaseName = inner.name();
// set resource ancestor and positional variables
this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups");
this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers");
this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases");
//
}
@Override
public SqlManager manager() {
return this.manager;
}
@Override
public Observable<ExtendedDatabaseBlobAuditingPolicy> createResourceAsync() {
ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies();
return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner())
.map(innerToFluentMap(this));
}
@Override
public Observable<ExtendedDatabaseBlobAuditingPolicy> updateResourceAsync() {
ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies();
return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner())
.map(innerToFluentMap(this));
}
@Override
protected Observable<ExtendedDatabaseBlobAuditingPolicyInner> getInnerAsync() {
ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies();
return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName);
}
@Override
public boolean isInCreateMode() {
return this.inner().id() == null;
}
@Override
public List<String> auditActionsAndGroups() {
return this.inner().auditActionsAndGroups();
}
@Override
public String id() {
return this.inner().id();
}
@Override
public Boolean isAzureMonitorTargetEnabled() {
return this.inner().isAzureMonitorTargetEnabled();
}
@Override
public Boolean isStorageSecondaryKeyInUse() {
return this.inner().isStorageSecondaryKeyInUse();
}
@Override
public String name() {
return this.inner().name();
}
@Override
public String predicateExpression() {
return this.inner().predicateExpression();
}
@Override
public Integer retentionDays() {
return this.inner().retentionDays();
}
@Override
public BlobAuditingPolicyState state() {
return this.inner().state();
}
@Override
public String storageAccountAccessKey() {
return this.inner().storageAccountAccessKey();
}
@Override
public UUID storageAccountSubscriptionId() {
return this.inner().storageAccountSubscriptionId();
}
@Override
public String storageEndpoint() {
return this.inner().storageEndpoint();
}
@Override
public String type() {
return this.inner().type();
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) {
this.resourceGroupName = resourceGroupName;
this.serverName = serverName;
this.databaseName = databaseName;
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) {
this.inner().withState(state);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List<String> auditActionsAndGroups) {
this.inner().withAuditActionsAndGroups(auditActionsAndGroups);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) {
this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) {
this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) {
this.inner().withPredicateExpression(predicateExpression);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) {
this.inner().withRetentionDays(retentionDays);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) {
this.inner().withStorageAccountAccessKey(storageAccountAccessKey);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) {
this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) {
this.inner().withStorageEndpoint(storageEndpoint);
return this;
}
}
| UTF-8 | Java | 6,838 | java | ExtendedDatabaseBlobAuditingPolicyImpl.java | Java | [] | null | [] | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation;
import com.microsoft.azure.management.sql.v2017_03_01_preview.ExtendedDatabaseBlobAuditingPolicy;
import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl;
import rx.Observable;
import com.microsoft.azure.management.sql.v2017_03_01_preview.BlobAuditingPolicyState;
import java.util.List;
import java.util.UUID;
class ExtendedDatabaseBlobAuditingPolicyImpl extends CreatableUpdatableImpl<ExtendedDatabaseBlobAuditingPolicy, ExtendedDatabaseBlobAuditingPolicyInner, ExtendedDatabaseBlobAuditingPolicyImpl> implements ExtendedDatabaseBlobAuditingPolicy, ExtendedDatabaseBlobAuditingPolicy.Definition, ExtendedDatabaseBlobAuditingPolicy.Update {
private final SqlManager manager;
private String resourceGroupName;
private String serverName;
private String databaseName;
ExtendedDatabaseBlobAuditingPolicyImpl(String name, SqlManager manager) {
super(name, new ExtendedDatabaseBlobAuditingPolicyInner());
this.manager = manager;
// Set resource name
this.databaseName = name;
//
}
ExtendedDatabaseBlobAuditingPolicyImpl(ExtendedDatabaseBlobAuditingPolicyInner inner, SqlManager manager) {
super(inner.name(), inner);
this.manager = manager;
// Set resource name
this.databaseName = inner.name();
// set resource ancestor and positional variables
this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups");
this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers");
this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases");
//
}
@Override
public SqlManager manager() {
return this.manager;
}
@Override
public Observable<ExtendedDatabaseBlobAuditingPolicy> createResourceAsync() {
ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies();
return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner())
.map(innerToFluentMap(this));
}
@Override
public Observable<ExtendedDatabaseBlobAuditingPolicy> updateResourceAsync() {
ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies();
return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner())
.map(innerToFluentMap(this));
}
@Override
protected Observable<ExtendedDatabaseBlobAuditingPolicyInner> getInnerAsync() {
ExtendedDatabaseBlobAuditingPoliciesInner client = this.manager().inner().extendedDatabaseBlobAuditingPolicies();
return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName);
}
@Override
public boolean isInCreateMode() {
return this.inner().id() == null;
}
@Override
public List<String> auditActionsAndGroups() {
return this.inner().auditActionsAndGroups();
}
@Override
public String id() {
return this.inner().id();
}
@Override
public Boolean isAzureMonitorTargetEnabled() {
return this.inner().isAzureMonitorTargetEnabled();
}
@Override
public Boolean isStorageSecondaryKeyInUse() {
return this.inner().isStorageSecondaryKeyInUse();
}
@Override
public String name() {
return this.inner().name();
}
@Override
public String predicateExpression() {
return this.inner().predicateExpression();
}
@Override
public Integer retentionDays() {
return this.inner().retentionDays();
}
@Override
public BlobAuditingPolicyState state() {
return this.inner().state();
}
@Override
public String storageAccountAccessKey() {
return this.inner().storageAccountAccessKey();
}
@Override
public UUID storageAccountSubscriptionId() {
return this.inner().storageAccountSubscriptionId();
}
@Override
public String storageEndpoint() {
return this.inner().storageEndpoint();
}
@Override
public String type() {
return this.inner().type();
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) {
this.resourceGroupName = resourceGroupName;
this.serverName = serverName;
this.databaseName = databaseName;
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) {
this.inner().withState(state);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List<String> auditActionsAndGroups) {
this.inner().withAuditActionsAndGroups(auditActionsAndGroups);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) {
this.inner().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) {
this.inner().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) {
this.inner().withPredicateExpression(predicateExpression);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) {
this.inner().withRetentionDays(retentionDays);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) {
this.inner().withStorageAccountAccessKey(storageAccountAccessKey);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) {
this.inner().withStorageAccountSubscriptionId(storageAccountSubscriptionId);
return this;
}
@Override
public ExtendedDatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) {
this.inner().withStorageEndpoint(storageEndpoint);
return this;
}
}
| 6,838 | 0.731208 | 0.727698 | 197 | 33.710659 | 40.696133 | 330 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.42132 | false | false | 5 |
87c0dd91c7a5ffb3c51f5c38054a88df016b892d | 22,393,959,513,335 | efcdca74b2a3b47c9aa85ef5ea7b829e486e580e | /src/main/java/bo/edu/ucb/sis/piratebay/dao/OrderDao.java | 811b3baf703b5cde6a86c09029892c43c362eda2 | [] | no_license | vilcs/ing_soft_final | https://github.com/vilcs/ing_soft_final | 2c3bbaa8e64e32d8b0599d42e7f31b7a05464cd9 | 664c868f20ff243528f350666d7aaaf8cbd01c16 | refs/heads/master | "2022-11-12T11:44:37.688000" | "2020-07-10T00:37:13" | "2020-07-10T00:37:13" | 278,489,755 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package bo.edu.ucb.sis.piratebay.dao;
import bo.edu.ucb.sis.piratebay.model.OrderModel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@Service
public class OrderDao {
private JdbcTemplate jdbcTemplate;
@Autowired
public OrderDao(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
public List<PayedModel> findAllPayed() {
// Implmentamos SQL varible binding para evitar SQL INJECTION
String query =
"SELECT o.order_id, DATE(o.date), CONCAT(p.first_name,' ',p.first_surname) as customer, p.address " +
"FROM \"order\" as o, \"user\" as u, customer as c, person as p " +
"WHERE o.user_id = u.user_id " +
"AND u.user_id = c.user_id " +
"AND c.person_id = p.person_id " +
"AND o.status = 1";
List<PayedModel> result = null;
try {
result = jdbcTemplate.query(query, new RowMapper<PayedModel>() {
@Override
public PayedModel mapRow(ResultSet resultSet, int i) throws SQLException {
return new PayedModel(
resultSet.getInt(1),
resultSet.getString(2),
resultSet.getString(3),
resultSet.getString(4));
}
});
} catch (Exception ex) {
throw new RuntimeException();
}
return result;
}
public List<ReadyModel> findAllReady() {
// Implmentamos SQL varible binding para evitar SQL INJECTION
String query =
"SELECT o.order_id, DATE(o.date), CONCAT(p.first_name,' ',p.first_surname) as customer, o.date_courier_req " +
"FROM \"order\" as o, \"user\" as u, customer as c, person as p " +
"WHERE o.user_id = u.user_id " +
"AND u.user_id = c.user_id " +
"AND c.person_id = p.person_id " +
"AND o.status = 2";
List<ReadyModel> result = null;
try {
result = jdbcTemplate.query(query, new RowMapper<ReadyModel>() {
@Override
public ReadyModel mapRow(ResultSet resultSet, int i) throws SQLException {
return new ReadyModel(
resultSet.getInt(1),
resultSet.getString(2),
resultSet.getString(3),
resultSet.getString(4));
}
});
} catch (Exception ex) {
throw new RuntimeException();
}
return result;
}
public List<DispatchedModel> findAllDispatched() {
// Implmentamos SQL varible binding para evitar SQL INJECTION
String query =
"SELECT o.order_id, DATE(o.date), CONCAT(p.first_name,' ',p.first_surname) as customer, o.date_courier_rec " +
"FROM \"order\" as o, \"user\" as u, customer as c, person as p " +
"WHERE o.user_id = u.user_id " +
"AND u.user_id = c.user_id " +
"AND c.person_id = p.person_id " +
"AND o.status = 3";
List<DispatchedModel> result = null;
try {
result = jdbcTemplate.query(query, new RowMapper<DispatchedModel>() {
@Override
public DispatchedModel mapRow(ResultSet resultSet, int i) throws SQLException {
return new DispatchedModel(
resultSet.getInt(1),
resultSet.getString(2),
resultSet.getString(3),
resultSet.getString(4));
}
});
} catch (Exception ex) {
throw new RuntimeException();
}
return result;
}
public List<DeliveredModel> findAllDelivered() {
// Implmentamos SQL varible binding para evitar SQL INJECTION
String query =
"SELECT o.order_id, DATE(o.date), CONCAT(p.first_name,' ',p.first_surname) as customer, o.date_courier_rec, o.date_cust_rec " +
"FROM \"order\" as o, \"user\" as u, customer as c, person as p " +
"WHERE o.user_id = u.user_id " +
"AND u.user_id = c.user_id " +
"AND c.person_id = p.person_id " +
"AND o.status = 4";
List<DeliveredModel> result = null;
try {
result = jdbcTemplate.query(query, new RowMapper<DeliveredModel>() {
@Override
public DeliveredModel mapRow(ResultSet resultSet, int i) throws SQLException {
return new DeliveredModel(
resultSet.getInt(1),
resultSet.getString(2),
resultSet.getString(3),
resultSet.getString(4),
resultSet.getString(5));
}
});
} catch (Exception ex) {
throw new RuntimeException();
}
return result;
}
}
| UTF-8 | Java | 5,517 | java | OrderDao.java | Java | [] | null | [] | package bo.edu.ucb.sis.piratebay.dao;
import bo.edu.ucb.sis.piratebay.model.OrderModel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@Service
public class OrderDao {
private JdbcTemplate jdbcTemplate;
@Autowired
public OrderDao(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
public List<PayedModel> findAllPayed() {
// Implmentamos SQL varible binding para evitar SQL INJECTION
String query =
"SELECT o.order_id, DATE(o.date), CONCAT(p.first_name,' ',p.first_surname) as customer, p.address " +
"FROM \"order\" as o, \"user\" as u, customer as c, person as p " +
"WHERE o.user_id = u.user_id " +
"AND u.user_id = c.user_id " +
"AND c.person_id = p.person_id " +
"AND o.status = 1";
List<PayedModel> result = null;
try {
result = jdbcTemplate.query(query, new RowMapper<PayedModel>() {
@Override
public PayedModel mapRow(ResultSet resultSet, int i) throws SQLException {
return new PayedModel(
resultSet.getInt(1),
resultSet.getString(2),
resultSet.getString(3),
resultSet.getString(4));
}
});
} catch (Exception ex) {
throw new RuntimeException();
}
return result;
}
public List<ReadyModel> findAllReady() {
// Implmentamos SQL varible binding para evitar SQL INJECTION
String query =
"SELECT o.order_id, DATE(o.date), CONCAT(p.first_name,' ',p.first_surname) as customer, o.date_courier_req " +
"FROM \"order\" as o, \"user\" as u, customer as c, person as p " +
"WHERE o.user_id = u.user_id " +
"AND u.user_id = c.user_id " +
"AND c.person_id = p.person_id " +
"AND o.status = 2";
List<ReadyModel> result = null;
try {
result = jdbcTemplate.query(query, new RowMapper<ReadyModel>() {
@Override
public ReadyModel mapRow(ResultSet resultSet, int i) throws SQLException {
return new ReadyModel(
resultSet.getInt(1),
resultSet.getString(2),
resultSet.getString(3),
resultSet.getString(4));
}
});
} catch (Exception ex) {
throw new RuntimeException();
}
return result;
}
public List<DispatchedModel> findAllDispatched() {
// Implmentamos SQL varible binding para evitar SQL INJECTION
String query =
"SELECT o.order_id, DATE(o.date), CONCAT(p.first_name,' ',p.first_surname) as customer, o.date_courier_rec " +
"FROM \"order\" as o, \"user\" as u, customer as c, person as p " +
"WHERE o.user_id = u.user_id " +
"AND u.user_id = c.user_id " +
"AND c.person_id = p.person_id " +
"AND o.status = 3";
List<DispatchedModel> result = null;
try {
result = jdbcTemplate.query(query, new RowMapper<DispatchedModel>() {
@Override
public DispatchedModel mapRow(ResultSet resultSet, int i) throws SQLException {
return new DispatchedModel(
resultSet.getInt(1),
resultSet.getString(2),
resultSet.getString(3),
resultSet.getString(4));
}
});
} catch (Exception ex) {
throw new RuntimeException();
}
return result;
}
public List<DeliveredModel> findAllDelivered() {
// Implmentamos SQL varible binding para evitar SQL INJECTION
String query =
"SELECT o.order_id, DATE(o.date), CONCAT(p.first_name,' ',p.first_surname) as customer, o.date_courier_rec, o.date_cust_rec " +
"FROM \"order\" as o, \"user\" as u, customer as c, person as p " +
"WHERE o.user_id = u.user_id " +
"AND u.user_id = c.user_id " +
"AND c.person_id = p.person_id " +
"AND o.status = 4";
List<DeliveredModel> result = null;
try {
result = jdbcTemplate.query(query, new RowMapper<DeliveredModel>() {
@Override
public DeliveredModel mapRow(ResultSet resultSet, int i) throws SQLException {
return new DeliveredModel(
resultSet.getInt(1),
resultSet.getString(2),
resultSet.getString(3),
resultSet.getString(4),
resultSet.getString(5));
}
});
} catch (Exception ex) {
throw new RuntimeException();
}
return result;
}
}
| 5,517 | 0.508066 | 0.50426 | 132 | 40.795456 | 28.649063 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.674242 | false | false | 5 |
4ef61482ecb8f67c84f36caa8192215588b42cdf | 17,841,294,173,276 | 3cc5589ed03a28430d0256f0f052c0cfa376df04 | /src/main/java/tardis/common/tileents/components/ComponentPeripheral.java | 2f36a53424d30610c4344de1f9e54c21a7cf0695 | [] | no_license | Schuljakov/TardisMod | https://github.com/Schuljakov/TardisMod | 3b5d0f28e1b9d6a73360345d22ad38368782e7ee | 484100a27be2a550d3d0a26776fcdbbec5ccccaf | refs/heads/master | "2020-06-15T18:46:31.162000" | "2016-11-29T15:02:37" | "2016-11-29T15:02:37" | 75,270,843 | 1 | 0 | null | true | "2016-12-01T08:18:32" | "2016-12-01T08:18:32" | "2016-10-24T07:00:01" | "2016-11-29T15:03:55" | 35,301 | 0 | 0 | 0 | null | null | null | package tardis.common.tileents.components;
import tardis.common.tileents.ComponentTileEntity;
public class ComponentPeripheral extends AbstractComponent
{
protected ComponentPeripheral()
{
}
public ComponentPeripheral(ComponentTileEntity parent)
{
parentObj = parent;
}
@Override
public ITardisComponent create(ComponentTileEntity parent)
{
return new ComponentPeripheral();
}
}
| UTF-8 | Java | 404 | java | ComponentPeripheral.java | Java | [] | null | [] | package tardis.common.tileents.components;
import tardis.common.tileents.ComponentTileEntity;
public class ComponentPeripheral extends AbstractComponent
{
protected ComponentPeripheral()
{
}
public ComponentPeripheral(ComponentTileEntity parent)
{
parentObj = parent;
}
@Override
public ITardisComponent create(ComponentTileEntity parent)
{
return new ComponentPeripheral();
}
}
| 404 | 0.787129 | 0.787129 | 24 | 15.833333 | 21.349604 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.916667 | false | false | 5 |
4185518eb672c2432585c8059043c0e622fa698a | 12,000,138,663,264 | 33e91f72654cfe39d8e5ef52ad06104ffbc739fa | /src/ex04controlstatement/E03While.java | fe0b18d35c7fedb62c71280bf1d6e6452c7dd555 | [] | no_license | daeunk06/K01java | https://github.com/daeunk06/K01java | 8602d5fb32e8ebed66ff5f2d33ef426fec40e870 | efa96a3d7e8f4a6eb7e24b15563d42710a5b296f | refs/heads/master | "2023-01-08T17:02:02.653000" | "2020-11-04T09:11:11" | "2020-11-04T09:11:11" | 309,946,546 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ex04controlstatement;
/*
while문
: 반복의 횟수가 정해져있지 않을 떄 주로 사용하는 반복문.
횟수가 명확할때는 for문을 주로 사용
형식]
반복을 위한 변수의 초기값 선언;
while(반복의 조건){
실행문;
반복을 위한 변수의 증감식; <= 반복문 탈출을 위한 ++, --와 같은 연산필요
}
반복의 조건이 false 일때 while 문을 탈출한다.
*/
public class E03While {
public static void main(String[] args) {
/*
시나리오]1~10까지의 합을 구하는 프로그램을 while문으로 작성하시오
*/
// 누적합을 저장하기 위한 변수선언, 증가하는 i를 누적해서 더함.
int sum = 0;
//반복문을 위한 변수 선언 및 초기화
int i = 1;
while(i<=10) { // 반복의 조건 설정. i가 11이상이면 탈출.
//증가되는 i를 sum에 누적해서 더함 (1+2+3+...)
sum += i;
//while문을 탈출하기 위한 조건을 위한 증가연산
i++;
}
System.out.println("1~10가지의 합은:" + sum);//55
/*
*시나리오] 1부터 100가지의 정수중 3의 배수이거나 5의 배수인 수의 합을
*구하는 프로그램을 while문을 이용해 작성하시오.
*/
int total = 0;
int j = 1;
while(j<=100) {
if (j%3==0 || j%5==0) {
total += j;
}
j++;
}
System.out.println("1~100사이의 3or5의 합:" + total);
/*
시나리오] 구구단을 출력하는 프로그램을 작성하시오
단, while문을 이용하세요
*/
int dan = 2;
while (dan<=9) {
int su = 1;//수는 증가했다가 단이 바뀌면 다시 1로 초기화됨
while(su<=9) {
//서식에 맞춰 출력할때는 printf()문이 유리함.
//System.out.printf("%-2d* %-2d= %2d", dan , su , (dan*su));
System.out.print(dan + "*" + su + "="+ (dan*su));
System.out.println("");
su++;
}
//하나의 단을 모두 출력한 후 다음 단을 출력하기위해 줄바꿈 처리
System.out.println();
dan++;//단 증가
}
System.out.println("\n===========================\n");
/*
* 시나리오] 아래와 같은 모양을 출력하는 while 문을 작성하시오
* 출력결과
* 1 0 0 0
* 0 1 0 0
* 0 0 1 0
* 0 0 0 1
*/
int m = 1;
while(m<=4) {
int n = 1;
while(n<=4) {
if(m==n) {
System.out.print("1 ");}
else {
System.out.print("0 ");
}
n++;
}
System.out.println();
m++;
}
}
}
| UTF-8 | Java | 2,621 | java | E03While.java | Java | [] | null | [] | package ex04controlstatement;
/*
while문
: 반복의 횟수가 정해져있지 않을 떄 주로 사용하는 반복문.
횟수가 명확할때는 for문을 주로 사용
형식]
반복을 위한 변수의 초기값 선언;
while(반복의 조건){
실행문;
반복을 위한 변수의 증감식; <= 반복문 탈출을 위한 ++, --와 같은 연산필요
}
반복의 조건이 false 일때 while 문을 탈출한다.
*/
public class E03While {
public static void main(String[] args) {
/*
시나리오]1~10까지의 합을 구하는 프로그램을 while문으로 작성하시오
*/
// 누적합을 저장하기 위한 변수선언, 증가하는 i를 누적해서 더함.
int sum = 0;
//반복문을 위한 변수 선언 및 초기화
int i = 1;
while(i<=10) { // 반복의 조건 설정. i가 11이상이면 탈출.
//증가되는 i를 sum에 누적해서 더함 (1+2+3+...)
sum += i;
//while문을 탈출하기 위한 조건을 위한 증가연산
i++;
}
System.out.println("1~10가지의 합은:" + sum);//55
/*
*시나리오] 1부터 100가지의 정수중 3의 배수이거나 5의 배수인 수의 합을
*구하는 프로그램을 while문을 이용해 작성하시오.
*/
int total = 0;
int j = 1;
while(j<=100) {
if (j%3==0 || j%5==0) {
total += j;
}
j++;
}
System.out.println("1~100사이의 3or5의 합:" + total);
/*
시나리오] 구구단을 출력하는 프로그램을 작성하시오
단, while문을 이용하세요
*/
int dan = 2;
while (dan<=9) {
int su = 1;//수는 증가했다가 단이 바뀌면 다시 1로 초기화됨
while(su<=9) {
//서식에 맞춰 출력할때는 printf()문이 유리함.
//System.out.printf("%-2d* %-2d= %2d", dan , su , (dan*su));
System.out.print(dan + "*" + su + "="+ (dan*su));
System.out.println("");
su++;
}
//하나의 단을 모두 출력한 후 다음 단을 출력하기위해 줄바꿈 처리
System.out.println();
dan++;//단 증가
}
System.out.println("\n===========================\n");
/*
* 시나리오] 아래와 같은 모양을 출력하는 while 문을 작성하시오
* 출력결과
* 1 0 0 0
* 0 1 0 0
* 0 0 1 0
* 0 0 0 1
*/
int m = 1;
while(m<=4) {
int n = 1;
while(n<=4) {
if(m==n) {
System.out.print("1 ");}
else {
System.out.print("0 ");
}
n++;
}
System.out.println();
m++;
}
}
}
| 2,621 | 0.476575 | 0.437803 | 129 | 13.395349 | 14.997374 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.534884 | false | false | 5 |
6862daceb8f260a7e4b42d11a7adcb422d682bf1 | 24,867,860,651,571 | 0a85956a970ac605245cf789154170eddad4b429 | /src/com/fengchengpeng/syntax/TestScanner.java | 240587ef5da9ffe9a9fc3421fca77ce4f97dca42 | [] | no_license | renxue/java-basic | https://github.com/renxue/java-basic | 2aa13ac5143a40d85e8d60cf96f3685fa10b0c6b | 5a73bf2f64b3499137db459b3beb240ea545c5f6 | refs/heads/master | "2020-02-28T14:38:51.575000" | "2017-07-30T08:52:25" | "2017-07-30T08:52:25" | 87,635,371 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fengchengpeng.syntax;
import java.util.Scanner;
/**
* Created by fengchengpeng on 2017/6/16.
*/
public class TestScanner {
public static void main(String[] args) {
// char
System.out.println("基本类型:char 二进制位数:" + Character.SIZE);
System.out.println("基本类型:byte 二进制位数:" + Byte.SIZE);
System.out.println("基本类型:short 二进制位数:" + Short.SIZE);
/* while (true) {
Scanner scanner = new Scanner(System.in);
System.out.println("please input your age: ");
int age = scanner.nextInt();
System.out.println("please input your sex: ");
String sex = scanner.next();
if (age >= 7) {
System.out.println("move");
} else if (age >= 5 && sex.equals("男")) {
System.out.println(" 5 move");
} else {
System.out.println(String.format("输入不合法:age = %s, sex = %s", age, sex));
}
}*/
}
}
| UTF-8 | Java | 1,063 | java | TestScanner.java | Java | [
{
"context": "tax;\n\nimport java.util.Scanner;\n\n/**\n * Created by fengchengpeng on 2017/6/16.\n */\npublic class TestScanner {\n ",
"end": 93,
"score": 0.8224504590034485,
"start": 80,
"tag": "USERNAME",
"value": "fengchengpeng"
}
] | null | [] | package com.fengchengpeng.syntax;
import java.util.Scanner;
/**
* Created by fengchengpeng on 2017/6/16.
*/
public class TestScanner {
public static void main(String[] args) {
// char
System.out.println("基本类型:char 二进制位数:" + Character.SIZE);
System.out.println("基本类型:byte 二进制位数:" + Byte.SIZE);
System.out.println("基本类型:short 二进制位数:" + Short.SIZE);
/* while (true) {
Scanner scanner = new Scanner(System.in);
System.out.println("please input your age: ");
int age = scanner.nextInt();
System.out.println("please input your sex: ");
String sex = scanner.next();
if (age >= 7) {
System.out.println("move");
} else if (age >= 5 && sex.equals("男")) {
System.out.println(" 5 move");
} else {
System.out.println(String.format("输入不合法:age = %s, sex = %s", age, sex));
}
}*/
}
}
| 1,063 | 0.531027 | 0.520855 | 29 | 32.896553 | 23.07461 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.551724 | false | false | 5 |
cbf67e3a45182c9067864172c119467ca0d0bb5b | 26,319,559,632,559 | f0405c9b003dc4379d4983bc808a917783b5db4f | /semester_1/lab2/src/test/java/lab/GeneratorForTests.java | 88fc26974e66a7cc8c12623540c5b97f2e4991a4 | [] | no_license | SymphonyOfTranquility/OOP-3-course | https://github.com/SymphonyOfTranquility/OOP-3-course | 67b5bcf0db95e05a146434854219c87f9e38a7d1 | ef05ed01f3c30b66abb957e8436147433781bf63 | refs/heads/master | "2021-07-12T16:39:18.058000" | "2020-06-20T18:58:04" | "2020-06-20T18:58:04" | 207,505,215 | 0 | 0 | null | false | "2020-10-13T22:48:33" | "2019-09-10T08:29:15" | "2020-06-20T18:59:52" | "2020-10-13T22:48:32" | 3,949 | 0 | 0 | 1 | JavaScript | false | false | package lab;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
final class GeneratorForTests {
private GeneratorForTests(){}
static InputStream generateXml(boolean bySchema) {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<Papers xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
"xsi:noNamespaceSchemaLocation=\"publication.xsd\">" +
"<Paper id=\"ID-1\">" +
"<Title>Mriya</Title>";
if (bySchema)
xml += "<Type>newspaper</Type>";
xml += "<Monthly>true</Monthly>" +
"<Chars>"+
"<Colored>true</Colored>" +
"<Size>30</Size>" +
"<Glossy>false</Glossy>" +
"<SubscriptionIndex>true</SubscriptionIndex>" +
"</Chars>" +
"</Paper>" +
"</Papers>";
return new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8));
}
static Paper generatePaper() {
Paper paper = new Paper();
paper.id = "ID-1";
paper.title = "Mriya";
paper.monthly = true;
paper.type = "newspaper";
HashMap<String, Integer> chars = new HashMap<>();
chars.put("Colored", 1);
chars.put("Size", 30);
chars.put("Glossy", 0);
chars.put("SubscriptionIndex", 1);
paper.chars = chars;
return paper;
}
}
| UTF-8 | Java | 1,567 | java | GeneratorForTests.java | Java | [] | null | [] | package lab;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
final class GeneratorForTests {
private GeneratorForTests(){}
static InputStream generateXml(boolean bySchema) {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<Papers xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
"xsi:noNamespaceSchemaLocation=\"publication.xsd\">" +
"<Paper id=\"ID-1\">" +
"<Title>Mriya</Title>";
if (bySchema)
xml += "<Type>newspaper</Type>";
xml += "<Monthly>true</Monthly>" +
"<Chars>"+
"<Colored>true</Colored>" +
"<Size>30</Size>" +
"<Glossy>false</Glossy>" +
"<SubscriptionIndex>true</SubscriptionIndex>" +
"</Chars>" +
"</Paper>" +
"</Papers>";
return new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8));
}
static Paper generatePaper() {
Paper paper = new Paper();
paper.id = "ID-1";
paper.title = "Mriya";
paper.monthly = true;
paper.type = "newspaper";
HashMap<String, Integer> chars = new HashMap<>();
chars.put("Colored", 1);
chars.put("Size", 30);
chars.put("Glossy", 0);
chars.put("SubscriptionIndex", 1);
paper.chars = chars;
return paper;
}
}
| 1,567 | 0.518188 | 0.506701 | 46 | 32.065216 | 20.244595 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false | 5 |
337d2123d22e3a276444d88aa0b80b927df5142c | 28,355,374,151,357 | d34f8390e30e484df1db824c1cf8facc76afb308 | /poi-example/src/main/java/net/aicoder/exsys/module/submodule/controller/EntityImpController.java | 72f3708ae551e8d94c3455a20608926bcfd2365c | [] | no_license | ai-coders/tcom-poi | https://github.com/ai-coders/tcom-poi | cc44548645e96603f227b6e29982b9998288719d | 4a08b98a80db489dc3edb5ac632efea3b2ab0136 | refs/heads/master | "2021-04-12T08:21:12.644000" | "2018-06-25T07:13:02" | "2018-06-25T07:13:02" | 125,809,337 | 4 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.aicoder.exsys.module.submodule.controller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import net.aicoder.tcom.poi.excel.importer.IBookImporter;
@Component
public class EntityImpController {
private static final String KEY_SYS_CODE = "sysCode";
private static final Log log = LogFactory.getLog(EntityImpController.class);
@Autowired
IBookImporter entityBookImporter;
public void impEntityList() {
String sysCode = "devp";
log.debug("expEntityList>> key=" + KEY_SYS_CODE + "; value=" + sysCode);
entityBookImporter.putOneOutData(KEY_SYS_CODE, sysCode);
entityBookImporter.doImport();
}
}
| UTF-8 | Java | 772 | java | EntityImpController.java | Java | [
{
"context": "er {\n\tprivate static final String KEY_SYS_CODE = \"sysCode\";\n\n\tprivate static final Log log = LogFactory.get",
"end": 411,
"score": 0.8114951252937317,
"start": 404,
"tag": "KEY",
"value": "sysCode"
}
] | null | [] | package net.aicoder.exsys.module.submodule.controller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import net.aicoder.tcom.poi.excel.importer.IBookImporter;
@Component
public class EntityImpController {
private static final String KEY_SYS_CODE = "sysCode";
private static final Log log = LogFactory.getLog(EntityImpController.class);
@Autowired
IBookImporter entityBookImporter;
public void impEntityList() {
String sysCode = "devp";
log.debug("expEntityList>> key=" + KEY_SYS_CODE + "; value=" + sysCode);
entityBookImporter.putOneOutData(KEY_SYS_CODE, sysCode);
entityBookImporter.doImport();
}
}
| 772 | 0.78886 | 0.78886 | 25 | 29.879999 | 25.522257 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.16 | false | false | 5 |
4150b6a535eaeaab545c0ec15a7715865c20d6b5 | 11,536,282,191,715 | 2e62fd17d91fc0e1ff5fb6cd1df83e5f3fc1ed22 | /src/DbManagerTest.java | 13097b41f1093d181b5924f7762a822d11bfe72d | [] | no_license | nbena/jdbc-example | https://github.com/nbena/jdbc-example | ab9a574533d706bc3d8e7ed97e473f7a8862761c | a792f9b93bae61402625efa0d709e0fd62d8a696 | refs/heads/master | "2020-09-27T14:40:37.117000" | "2019-12-07T16:03:29" | "2019-12-07T16:03:29" | 226,539,348 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import static org.junit.jupiter.api.Assertions.*;
import java.sql.SQLException;
import org.junit.jupiter.api.Test;
class DbManagerTest {
// in-memory database just for testing
private static final String DB_PATH = "jdbc:sqlite::memory:";
private static Book commedia = new Book("La Divina Commedia", "Dante Alighieri", "123-456",
"Alighieri Publicantions");
private static Book sposi = new Book("I Promessi Sposi", "Alessandro Manzoni", "678-910", "Manzoni & co");
@Test
void testDB() {
try {
// first we have to create the database
DbManager manager = new DbManager(DB_PATH);
manager.createTable();
// at first, the db is empty
assertTrue(manager.getBooks().size() == 0);
// first we insert the two books
Book commediaInserted = manager.createBook(commedia);
Book sposiInserted = manager.createBook(sposi);
// making sure they have been inserted
assertTrue(manager.getBooks().size() == 2);
// now we search the two books with their id
// making sure it is not null
assertNotNull(manager.getBook(commediaInserted.getID()));
assertNotNull(manager.getBook(sposiInserted.getID()));
// we make an update
commediaInserted.setTitle("La Divinissima Commedia");
manager.updateBook(commediaInserted);
// we retrieve the book making sure it has been modified
assertTrue(manager.getBook(commediaInserted.getID()).getTitle().equals("La Divinissima Commedia"));
// we delete it...
manager.deleteBook(commediaInserted);
// we try to retrieve it, and we will see that it is null
assertNull(manager.getBook(commediaInserted.getID()));
// also, we make sure our list now it is 1 item long
assertTrue(manager.getBooks().size() == 1);
} catch (SQLException e) {
e.printStackTrace();
fail("exceptions!");
}
}
}
| UTF-8 | Java | 1,805 | java | DbManagerTest.java | Java | [
{
"context": "c Book commedia = new Book(\"La Divina Commedia\", \"Dante Alighieri\", \"123-456\",\n\t\t\t\"Alighieri Publicantions\");\n\tpriv",
"end": 323,
"score": 0.999793529510498,
"start": 308,
"tag": "NAME",
"value": "Dante Alighieri"
},
{
"context": "static Book sposi = new Book(\"I Promessi Sposi\", \"Alessandro Manzoni\", \"678-910\", \"Manzoni & co\");\n\n\t@Test\n\tvoid testD",
"end": 445,
"score": 0.9998762011528015,
"start": 427,
"tag": "NAME",
"value": "Alessandro Manzoni"
}
] | null | [] | import static org.junit.jupiter.api.Assertions.*;
import java.sql.SQLException;
import org.junit.jupiter.api.Test;
class DbManagerTest {
// in-memory database just for testing
private static final String DB_PATH = "jdbc:sqlite::memory:";
private static Book commedia = new Book("La Divina Commedia", "<NAME>", "123-456",
"Alighieri Publicantions");
private static Book sposi = new Book("I Promessi Sposi", "<NAME>", "678-910", "Manzoni & co");
@Test
void testDB() {
try {
// first we have to create the database
DbManager manager = new DbManager(DB_PATH);
manager.createTable();
// at first, the db is empty
assertTrue(manager.getBooks().size() == 0);
// first we insert the two books
Book commediaInserted = manager.createBook(commedia);
Book sposiInserted = manager.createBook(sposi);
// making sure they have been inserted
assertTrue(manager.getBooks().size() == 2);
// now we search the two books with their id
// making sure it is not null
assertNotNull(manager.getBook(commediaInserted.getID()));
assertNotNull(manager.getBook(sposiInserted.getID()));
// we make an update
commediaInserted.setTitle("La Divinissima Commedia");
manager.updateBook(commediaInserted);
// we retrieve the book making sure it has been modified
assertTrue(manager.getBook(commediaInserted.getID()).getTitle().equals("La Divinissima Commedia"));
// we delete it...
manager.deleteBook(commediaInserted);
// we try to retrieve it, and we will see that it is null
assertNull(manager.getBook(commediaInserted.getID()));
// also, we make sure our list now it is 1 item long
assertTrue(manager.getBooks().size() == 1);
} catch (SQLException e) {
e.printStackTrace();
fail("exceptions!");
}
}
}
| 1,784 | 0.706371 | 0.697507 | 60 | 29.083334 | 27.069843 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.133333 | false | false | 5 |
74c92891d423b4621740643625b55a41797f5da4 | 13,812,614,846,284 | 92ddf92711f48e5b64c6bbbc83e3cef72d8f78f1 | /app/src/main/java/com/eugenebaturov/rickandmorty/models/domain/Character.java | db527ae6052f347d3abfaaf4e74e7c1469d5d95f | [] | no_license | VectorMath/Sber_AndroidSchool2021_Rick_and_Morty | https://github.com/VectorMath/Sber_AndroidSchool2021_Rick_and_Morty | b58b51ad234d037ce3070676621a8373f07875d3 | a12e4b22984aa6ab43f3c0894ce63bf6ac0abff5 | refs/heads/master | "2023-08-06T12:25:24.093000" | "2021-10-04T09:23:28" | "2021-10-04T09:23:28" | 398,068,790 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.eugenebaturov.rickandmorty.models.domain;
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Embedded;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.room.TypeConverters;
import com.eugenebaturov.rickandmorty.data.converter.StringConverter;
import com.eugenebaturov.rickandmorty.models.data.CurrentLocation;
import com.eugenebaturov.rickandmorty.models.data.Origin;
import java.util.List;
import java.util.Objects;
/**
* Класс-сущность персонажа в domain/ui - слое.
*/
@Entity(tableName = "character_table")
public final class Character {
@ColumnInfo(name = "id")
@PrimaryKey
private final int mId;
@ColumnInfo(name = "name")
@NonNull
private final String mName;
@ColumnInfo(name = "status")
@NonNull
private final String mStatus;
@ColumnInfo(name = "image_status_res")
private final int mImageStatusResource;
@ColumnInfo(name = "species")
@NonNull
private final String mSpecies;
@ColumnInfo(name = "type")
@NonNull
private final String mType;
@ColumnInfo(name = "gender")
@NonNull
private final String mGender;
@ColumnInfo(name = "image_url")
@NonNull
private final String mImageUrl;
@Embedded
@NonNull
private final Origin mOrigin;
@ColumnInfo(name = "origin_id")
private final int mOriginId;
@Embedded
@NonNull
private final CurrentLocation mCurrentLocation;
@ColumnInfo(name = "current_location_id")
private final int mCurrentLocationId;
@TypeConverters(StringConverter.class)
@NonNull
private final List<String> mEpisodesUrl;
/**
* Конструктор класса в который мы вручную передаём все параметры персонажа.
*
* @param id id персонажа.
* @param name имя персонажа.
* @param status статус персонажа.
* @param species раса персонажа
* @param type отличительная черта персонажа.
* @param gender пол персонажа.
* @param imageUrl url аватарки персонажа
* @param origin место рождения персонажа.
* @param originId id локации места рождения.
* @param currentLocation текущая локация в которой находится персонаж.
* @param currentLocationId id текущей локации.
* @param episodesUrl список URL эпизодов в которых персонаж появился.
*/
public Character(
final int id,
@NonNull final String name,
@NonNull final String status,
final int imageStatusResource,
@NonNull final String species,
@NonNull final String type,
@NonNull final String gender,
@NonNull final String imageUrl,
@NonNull final Origin origin,
final int originId,
@NonNull final CurrentLocation currentLocation,
final int currentLocationId,
@NonNull final List<String> episodesUrl) {
mId = id;
mName = name;
mStatus = status;
mImageStatusResource = imageStatusResource;
mSpecies = species;
mType = type;
mGender = gender;
mImageUrl = imageUrl;
mOrigin = origin;
mOriginId = originId;
mCurrentLocation = currentLocation;
mCurrentLocationId = currentLocationId;
mEpisodesUrl = episodesUrl;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Character character = (Character) o;
return mId == character.mId &&
mImageStatusResource == character.mImageStatusResource &&
mOriginId == character.mOriginId &&
mCurrentLocationId == character.mCurrentLocationId &&
mName.equals(character.mName) &&
mStatus.equals(character.mStatus) &&
mSpecies.equals(character.mSpecies) &&
mType.equals(character.mType) &&
mGender.equals(character.mGender) &&
mImageUrl.equals(character.mImageUrl) &&
mOrigin.equals(character.mOrigin) &&
mCurrentLocation.equals(character.mCurrentLocation) &&
mEpisodesUrl.equals(character.mEpisodesUrl);
}
@Override
public int hashCode() {
return Objects.hash(mId, mName, mStatus, mImageStatusResource, mSpecies, mType, mGender, mImageUrl, mOrigin, mOriginId, mCurrentLocation, mCurrentLocationId, mEpisodesUrl);
}
@Override
public String toString() {
return "Character{" +
"mId=" + mId +
", mName='" + mName + '\'' +
", mStatus='" + mStatus + '\'' +
", mImageStatusResource=" + mImageStatusResource +
", mSpecies='" + mSpecies + '\'' +
", mType='" + mType + '\'' +
", mGender='" + mGender + '\'' +
", mImageUrl='" + mImageUrl + '\'' +
", mOrigin=" + mOrigin +
", mOriginId=" + mOriginId +
", mCurrentLocation=" + mCurrentLocation +
", mCurrentLocationId=" + mCurrentLocationId +
", mEpisodesUrl=" + mEpisodesUrl +
'}';
}
/**
* Получить id персонажа.
*
* @return id персонажа.
*/
public int getId() {
return mId;
}
/**
* Получить имя персонажа.
*
* @return имя персонажа.
*/
@NonNull
public String getName() {
return mName;
}
/**
* Получить статус персонажа.
*
* @return статус персонажа.
*/
@NonNull
public String getStatus() {
return mStatus;
}
/**
* Получить ресурс изображения статуса персонажа.
*
* @return ресурс изображения статуса персонажа.
*/
public int getImageStatusResource() {
return mImageStatusResource;
}
/**
* Получить расу персонажа.
*
* @return раса персонажа.
*/
@NonNull
public String getSpecies() {
return mSpecies;
}
/**
* Получить отличительную черту персонажа.
*
* @return отличительная черта персонажа.
*/
@NonNull
public String getType() {
return mType;
}
/**
* Получить пол персонажа.
*
* @return пол персонажа.
*/
@NonNull
public String getGender() {
return mGender;
}
/**
* Получить url-изображение персонажа.
*
* @return url-изображение персонажа.
*/
@NonNull
public String getImageUrl() {
return mImageUrl;
}
/**
* Получить id персонажа.
*
* @return id персонажа.
*/
@NonNull
public Origin getOrigin() {
return mOrigin;
}
/**
* Получить место рождения персонажа.
*
* @return место рождения персонажа.
*/
@NonNull
public CurrentLocation getCurrentLocation() {
return mCurrentLocation;
}
/**
* Получить url список эпизодов в которых учавствовал персонаж.
*
* @return список url-эпизодов.
*/
@NonNull
public List<String> getEpisodesUrl() {
return mEpisodesUrl;
}
/**
* Получить id места рождения.
*
* @return id места рождения.
*/
public int getOriginId() {
return mOriginId;
}
/**
* Получить id текущей локации.
*
* @return id текущей локации.
*/
public int getCurrentLocationId() {
return mCurrentLocationId;
}
}
| UTF-8 | Java | 8,552 | java | Character.java | Java | [
{
"context": "> episodesUrl) {\n mId = id;\n mName = name;\n mStatus = status;\n mImageStatusRe",
"end": 3073,
"score": 0.8395907878875732,
"start": 3069,
"tag": "NAME",
"value": "name"
},
{
"context": " \"mId=\" + mId +\n \", mName='\" + mName + '\\'' +\n \", mStatus='\" + mSta",
"end": 4760,
"score": 0.9414269924163818,
"start": 4759,
"tag": "NAME",
"value": "m"
},
{
"context": " \"mId=\" + mId +\n \", mName='\" + mName + '\\'' +\n \", mStatus='\" + mStatus ",
"end": 4764,
"score": 0.8022915720939636,
"start": 4760,
"tag": "NAME",
"value": "Name"
}
] | null | [] | package com.eugenebaturov.rickandmorty.models.domain;
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Embedded;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.room.TypeConverters;
import com.eugenebaturov.rickandmorty.data.converter.StringConverter;
import com.eugenebaturov.rickandmorty.models.data.CurrentLocation;
import com.eugenebaturov.rickandmorty.models.data.Origin;
import java.util.List;
import java.util.Objects;
/**
* Класс-сущность персонажа в domain/ui - слое.
*/
@Entity(tableName = "character_table")
public final class Character {
@ColumnInfo(name = "id")
@PrimaryKey
private final int mId;
@ColumnInfo(name = "name")
@NonNull
private final String mName;
@ColumnInfo(name = "status")
@NonNull
private final String mStatus;
@ColumnInfo(name = "image_status_res")
private final int mImageStatusResource;
@ColumnInfo(name = "species")
@NonNull
private final String mSpecies;
@ColumnInfo(name = "type")
@NonNull
private final String mType;
@ColumnInfo(name = "gender")
@NonNull
private final String mGender;
@ColumnInfo(name = "image_url")
@NonNull
private final String mImageUrl;
@Embedded
@NonNull
private final Origin mOrigin;
@ColumnInfo(name = "origin_id")
private final int mOriginId;
@Embedded
@NonNull
private final CurrentLocation mCurrentLocation;
@ColumnInfo(name = "current_location_id")
private final int mCurrentLocationId;
@TypeConverters(StringConverter.class)
@NonNull
private final List<String> mEpisodesUrl;
/**
* Конструктор класса в который мы вручную передаём все параметры персонажа.
*
* @param id id персонажа.
* @param name имя персонажа.
* @param status статус персонажа.
* @param species раса персонажа
* @param type отличительная черта персонажа.
* @param gender пол персонажа.
* @param imageUrl url аватарки персонажа
* @param origin место рождения персонажа.
* @param originId id локации места рождения.
* @param currentLocation текущая локация в которой находится персонаж.
* @param currentLocationId id текущей локации.
* @param episodesUrl список URL эпизодов в которых персонаж появился.
*/
public Character(
final int id,
@NonNull final String name,
@NonNull final String status,
final int imageStatusResource,
@NonNull final String species,
@NonNull final String type,
@NonNull final String gender,
@NonNull final String imageUrl,
@NonNull final Origin origin,
final int originId,
@NonNull final CurrentLocation currentLocation,
final int currentLocationId,
@NonNull final List<String> episodesUrl) {
mId = id;
mName = name;
mStatus = status;
mImageStatusResource = imageStatusResource;
mSpecies = species;
mType = type;
mGender = gender;
mImageUrl = imageUrl;
mOrigin = origin;
mOriginId = originId;
mCurrentLocation = currentLocation;
mCurrentLocationId = currentLocationId;
mEpisodesUrl = episodesUrl;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Character character = (Character) o;
return mId == character.mId &&
mImageStatusResource == character.mImageStatusResource &&
mOriginId == character.mOriginId &&
mCurrentLocationId == character.mCurrentLocationId &&
mName.equals(character.mName) &&
mStatus.equals(character.mStatus) &&
mSpecies.equals(character.mSpecies) &&
mType.equals(character.mType) &&
mGender.equals(character.mGender) &&
mImageUrl.equals(character.mImageUrl) &&
mOrigin.equals(character.mOrigin) &&
mCurrentLocation.equals(character.mCurrentLocation) &&
mEpisodesUrl.equals(character.mEpisodesUrl);
}
@Override
public int hashCode() {
return Objects.hash(mId, mName, mStatus, mImageStatusResource, mSpecies, mType, mGender, mImageUrl, mOrigin, mOriginId, mCurrentLocation, mCurrentLocationId, mEpisodesUrl);
}
@Override
public String toString() {
return "Character{" +
"mId=" + mId +
", mName='" + mName + '\'' +
", mStatus='" + mStatus + '\'' +
", mImageStatusResource=" + mImageStatusResource +
", mSpecies='" + mSpecies + '\'' +
", mType='" + mType + '\'' +
", mGender='" + mGender + '\'' +
", mImageUrl='" + mImageUrl + '\'' +
", mOrigin=" + mOrigin +
", mOriginId=" + mOriginId +
", mCurrentLocation=" + mCurrentLocation +
", mCurrentLocationId=" + mCurrentLocationId +
", mEpisodesUrl=" + mEpisodesUrl +
'}';
}
/**
* Получить id персонажа.
*
* @return id персонажа.
*/
public int getId() {
return mId;
}
/**
* Получить имя персонажа.
*
* @return имя персонажа.
*/
@NonNull
public String getName() {
return mName;
}
/**
* Получить статус персонажа.
*
* @return статус персонажа.
*/
@NonNull
public String getStatus() {
return mStatus;
}
/**
* Получить ресурс изображения статуса персонажа.
*
* @return ресурс изображения статуса персонажа.
*/
public int getImageStatusResource() {
return mImageStatusResource;
}
/**
* Получить расу персонажа.
*
* @return раса персонажа.
*/
@NonNull
public String getSpecies() {
return mSpecies;
}
/**
* Получить отличительную черту персонажа.
*
* @return отличительная черта персонажа.
*/
@NonNull
public String getType() {
return mType;
}
/**
* Получить пол персонажа.
*
* @return пол персонажа.
*/
@NonNull
public String getGender() {
return mGender;
}
/**
* Получить url-изображение персонажа.
*
* @return url-изображение персонажа.
*/
@NonNull
public String getImageUrl() {
return mImageUrl;
}
/**
* Получить id персонажа.
*
* @return id персонажа.
*/
@NonNull
public Origin getOrigin() {
return mOrigin;
}
/**
* Получить место рождения персонажа.
*
* @return место рождения персонажа.
*/
@NonNull
public CurrentLocation getCurrentLocation() {
return mCurrentLocation;
}
/**
* Получить url список эпизодов в которых учавствовал персонаж.
*
* @return список url-эпизодов.
*/
@NonNull
public List<String> getEpisodesUrl() {
return mEpisodesUrl;
}
/**
* Получить id места рождения.
*
* @return id места рождения.
*/
public int getOriginId() {
return mOriginId;
}
/**
* Получить id текущей локации.
*
* @return id текущей локации.
*/
public int getCurrentLocationId() {
return mCurrentLocationId;
}
}
| 8,552 | 0.587061 | 0.587061 | 286 | 25.807692 | 21.771254 | 180 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.332168 | false | false | 5 |
da8b6582ad9a33917815c5853c0942eb00686119 | 24,970,939,902,444 | ceb82e59fe8a8ca6e14c0df08a4d6234b4812090 | /src/main/java/com/flansmod/common/data/player/IPlayerData.java | 2cc2e70523925444213e78e847346fce27e9f0d3 | [] | no_license | Fexcraft/FlansMod | https://github.com/Fexcraft/FlansMod | 49355520ee9c91705a9913157850f2e440b28fc4 | a06206e2ce23300f868f1333e41aec5d597e7c85 | refs/heads/minus-1.12.2 | "2021-05-23T22:32:02.412000" | "2020-01-25T19:08:46" | "2020-01-25T19:08:46" | 67,859,938 | 16 | 15 | null | true | "2020-07-19T07:49:08" | "2016-09-10T08:27:55" | "2020-07-19T07:42:45" | "2020-07-19T07:49:07" | 70,453 | 13 | 6 | 0 | Java | false | false | package com.flansmod.common.data.player;
import net.minecraft.nbt.NBTTagCompound;
public interface IPlayerData {
public void read(NBTTagCompound nbt);
public NBTTagCompound write();
public void copy(IPlayerData data);
public String getTextureURL();
public void setTextureURL(String s);
} | UTF-8 | Java | 306 | java | IPlayerData.java | Java | [] | null | [] | package com.flansmod.common.data.player;
import net.minecraft.nbt.NBTTagCompound;
public interface IPlayerData {
public void read(NBTTagCompound nbt);
public NBTTagCompound write();
public void copy(IPlayerData data);
public String getTextureURL();
public void setTextureURL(String s);
} | 306 | 0.767974 | 0.767974 | 17 | 17.058823 | 17.474253 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.058824 | false | false | 5 |
c85840577bf18a69fde74b7b12685780f01b2ecc | 10,307,921,537,147 | df73bd05d3817e90af283341827c599691fd86ce | /app/src/main/java/org/marceloleite/projetoanna/mixer/media/codec/callback/MediaDecoderCallback.java | 3d03c6ce331039db5d6ddb59e40bb92d467f15db | [] | no_license | MarceloLeite2604/anna-application | https://github.com/MarceloLeite2604/anna-application | bd0250f2f27a39c903bfb6ca3da5bce43fb5c57f | 1690f3ba7e5596dbdd0dd8283abbb80241b88dfa | refs/heads/master | "2021-06-20T04:37:19.053000" | "2017-07-31T22:10:33" | "2017-07-31T22:10:33" | 85,348,326 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.marceloleite.projetoanna.mixer.media.codec.callback;
import android.media.MediaCodec;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.support.annotation.NonNull;
import org.marceloleite.projetoanna.mixer.media.codec.callback.bytebufferwriter.AudioData;
import org.marceloleite.projetoanna.mixer.media.codec.callback.bytebufferwriter.ByteBufferWriteOutputStream;
import org.marceloleite.projetoanna.utils.Log;
import org.marceloleite.projetoanna.utils.MediaUtils;
import org.marceloleite.projetoanna.utils.audio.AudioUtils;
import org.marceloleite.projetoanna.utils.progressmonitor.ProgressReport;
import org.marceloleite.projetoanna.utils.progressmonitor.ProgressReporter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.nio.ByteBuffer;
/**
* The {@link MediaCodecCallback} used to decode audio files to its raw format.
*/
public class MediaDecoderCallback extends MediaCodecCallback {
private static final String DEFAULT_PROGRESS_REPORT_MESSAGE = "Decoding";
/**
* A tag to identify this class' messages on log.
*/
private static final String LOG_TAG = MediaDecoderCallback.class.getSimpleName();
/*
* Enables messages of this class to be shown on log.
*/
static {
Log.addClassToLog(LOG_TAG);
}
/**
* The {@link ByteBufferWriteOutputStream} to write the audio data pieces on the output stream.
*/
private ByteBufferWriteOutputStream byteBufferWriteOutputStream;
/**
* The {@link MediaExtractor} object which contains the encoded audio.
*/
private MediaExtractor mediaExtractor;
/**
* Indicates if the decoding is concluded.
*/
private volatile boolean finishedDecoding;
private ProgressReporter progressReporter;
private long audioDuration;
/**
* Constructor.
*
* @param mediaExtractor The {@link MediaExtractor} object which contains the encoded audio.
* @param outputFile The file which will store the raw audio content.
* @param audioTimeIgnored The amount of audio time which will be ignored before writing the raw audio on output file.
* @param audioDuration The duration of the audio file.
*/
public MediaDecoderCallback(MediaExtractor mediaExtractor, File outputFile, long audioTimeIgnored, long audioDuration, ProgressReporter progressReporter) {
this.mediaExtractor = mediaExtractor;
this.finishedDecoding = false;
Log.d(LOG_TAG, "MediaDecoderCallback (47): Audio duration: " + audioDuration + ", audio delay: " + audioTimeIgnored);
long bytesToIgnore = AudioUtils.calculateSizeOfAudioSample(audioTimeIgnored);
long bytesToRead = AudioUtils.calculateSizeOfAudioSample(audioDuration);
FileOutputStream fileOutputStream;
try {
fileOutputStream = new FileOutputStream(outputFile);
} catch (FileNotFoundException fileNotFoundException) {
throw new RuntimeException("Exception thrown while creating the file to store the decoded audio.", fileNotFoundException);
}
this.progressReporter = progressReporter;
this.audioDuration = audioDuration;
this.byteBufferWriteOutputStream = new ByteBufferWriteOutputStream(fileOutputStream, bytesToIgnore, bytesToRead);
}
@Override
public void onInputBufferAvailable(@NonNull MediaCodec mediaCodec, int inputBufferId) {
ByteBuffer inputBuffer = mediaCodec.getInputBuffer(inputBufferId);
MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo();
int percentageConcluded;
if (inputBuffer != null) {
bufferInfo.size = mediaExtractor.readSampleData(inputBuffer, AudioUtils.BUFFER_OFFSET);
if (bufferInfo.size > 0) {
bufferInfo.presentationTimeUs = mediaExtractor.getSampleTime();
percentageConcluded = (int) (((double) bufferInfo.presentationTimeUs / (double) audioDuration) * 100);
//noinspection WrongConstant
bufferInfo.flags = mediaExtractor.getSampleFlags();
mediaExtractor.advance();
} else {
Log.d(LOG_TAG, "onInputBufferAvailable (66): End of mp3 file.");
percentageConcluded = 100;
inputBuffer.clear();
bufferInfo.size = 0;
bufferInfo.presentationTimeUs = -1;
bufferInfo.flags = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
}
ProgressReport progressReport = new ProgressReport(DEFAULT_PROGRESS_REPORT_MESSAGE, percentageConcluded);
progressReporter.reportProgress(progressReport);
mediaCodec.queueInputBuffer(inputBufferId, AudioUtils.BUFFER_OFFSET, bufferInfo.size, bufferInfo.presentationTimeUs, bufferInfo.flags);
}
}
@Override
public void onOutputBufferAvailable(@NonNull MediaCodec mediaCodec, int outputBufferId, @NonNull MediaCodec.BufferInfo bufferInfo) {
ByteBuffer outputBuffer = mediaCodec.getOutputBuffer(outputBufferId);
ByteBuffer byteBuffer = MediaCodecCallback.copyByteBuffer(outputBuffer);
AudioData audioData = new AudioData(byteBuffer, bufferInfo);
if ((bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
Log.d(LOG_TAG, "onOutputBufferAvailable (84): End of output stream.");
byteBufferWriteOutputStream.finishWriting();
this.finishedDecoding = true;
} else {
byteBufferWriteOutputStream.add(audioData);
}
mediaCodec.releaseOutputBuffer(outputBufferId, false);
}
@Override
public void onError(@NonNull MediaCodec mediaCodec, @NonNull MediaCodec.CodecException e) {
Log.e(LOG_TAG, "onError (97): An error occurred on media codec" + mediaCodec);
e.printStackTrace();
}
@Override
public void onOutputFormatChanged(@NonNull MediaCodec mediaCodec, @NonNull MediaFormat mediaFormat) {
Log.d(LOG_TAG, "onOutputFormatChanged (104): Output format changed to " + mediaFormat);
}
@Override
public boolean finished() {
return this.finishedDecoding;
}
}
| UTF-8 | Java | 6,247 | java | MediaDecoderCallback.java | Java | [] | null | [] | package org.marceloleite.projetoanna.mixer.media.codec.callback;
import android.media.MediaCodec;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.support.annotation.NonNull;
import org.marceloleite.projetoanna.mixer.media.codec.callback.bytebufferwriter.AudioData;
import org.marceloleite.projetoanna.mixer.media.codec.callback.bytebufferwriter.ByteBufferWriteOutputStream;
import org.marceloleite.projetoanna.utils.Log;
import org.marceloleite.projetoanna.utils.MediaUtils;
import org.marceloleite.projetoanna.utils.audio.AudioUtils;
import org.marceloleite.projetoanna.utils.progressmonitor.ProgressReport;
import org.marceloleite.projetoanna.utils.progressmonitor.ProgressReporter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.nio.ByteBuffer;
/**
* The {@link MediaCodecCallback} used to decode audio files to its raw format.
*/
public class MediaDecoderCallback extends MediaCodecCallback {
private static final String DEFAULT_PROGRESS_REPORT_MESSAGE = "Decoding";
/**
* A tag to identify this class' messages on log.
*/
private static final String LOG_TAG = MediaDecoderCallback.class.getSimpleName();
/*
* Enables messages of this class to be shown on log.
*/
static {
Log.addClassToLog(LOG_TAG);
}
/**
* The {@link ByteBufferWriteOutputStream} to write the audio data pieces on the output stream.
*/
private ByteBufferWriteOutputStream byteBufferWriteOutputStream;
/**
* The {@link MediaExtractor} object which contains the encoded audio.
*/
private MediaExtractor mediaExtractor;
/**
* Indicates if the decoding is concluded.
*/
private volatile boolean finishedDecoding;
private ProgressReporter progressReporter;
private long audioDuration;
/**
* Constructor.
*
* @param mediaExtractor The {@link MediaExtractor} object which contains the encoded audio.
* @param outputFile The file which will store the raw audio content.
* @param audioTimeIgnored The amount of audio time which will be ignored before writing the raw audio on output file.
* @param audioDuration The duration of the audio file.
*/
public MediaDecoderCallback(MediaExtractor mediaExtractor, File outputFile, long audioTimeIgnored, long audioDuration, ProgressReporter progressReporter) {
this.mediaExtractor = mediaExtractor;
this.finishedDecoding = false;
Log.d(LOG_TAG, "MediaDecoderCallback (47): Audio duration: " + audioDuration + ", audio delay: " + audioTimeIgnored);
long bytesToIgnore = AudioUtils.calculateSizeOfAudioSample(audioTimeIgnored);
long bytesToRead = AudioUtils.calculateSizeOfAudioSample(audioDuration);
FileOutputStream fileOutputStream;
try {
fileOutputStream = new FileOutputStream(outputFile);
} catch (FileNotFoundException fileNotFoundException) {
throw new RuntimeException("Exception thrown while creating the file to store the decoded audio.", fileNotFoundException);
}
this.progressReporter = progressReporter;
this.audioDuration = audioDuration;
this.byteBufferWriteOutputStream = new ByteBufferWriteOutputStream(fileOutputStream, bytesToIgnore, bytesToRead);
}
@Override
public void onInputBufferAvailable(@NonNull MediaCodec mediaCodec, int inputBufferId) {
ByteBuffer inputBuffer = mediaCodec.getInputBuffer(inputBufferId);
MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo();
int percentageConcluded;
if (inputBuffer != null) {
bufferInfo.size = mediaExtractor.readSampleData(inputBuffer, AudioUtils.BUFFER_OFFSET);
if (bufferInfo.size > 0) {
bufferInfo.presentationTimeUs = mediaExtractor.getSampleTime();
percentageConcluded = (int) (((double) bufferInfo.presentationTimeUs / (double) audioDuration) * 100);
//noinspection WrongConstant
bufferInfo.flags = mediaExtractor.getSampleFlags();
mediaExtractor.advance();
} else {
Log.d(LOG_TAG, "onInputBufferAvailable (66): End of mp3 file.");
percentageConcluded = 100;
inputBuffer.clear();
bufferInfo.size = 0;
bufferInfo.presentationTimeUs = -1;
bufferInfo.flags = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
}
ProgressReport progressReport = new ProgressReport(DEFAULT_PROGRESS_REPORT_MESSAGE, percentageConcluded);
progressReporter.reportProgress(progressReport);
mediaCodec.queueInputBuffer(inputBufferId, AudioUtils.BUFFER_OFFSET, bufferInfo.size, bufferInfo.presentationTimeUs, bufferInfo.flags);
}
}
@Override
public void onOutputBufferAvailable(@NonNull MediaCodec mediaCodec, int outputBufferId, @NonNull MediaCodec.BufferInfo bufferInfo) {
ByteBuffer outputBuffer = mediaCodec.getOutputBuffer(outputBufferId);
ByteBuffer byteBuffer = MediaCodecCallback.copyByteBuffer(outputBuffer);
AudioData audioData = new AudioData(byteBuffer, bufferInfo);
if ((bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
Log.d(LOG_TAG, "onOutputBufferAvailable (84): End of output stream.");
byteBufferWriteOutputStream.finishWriting();
this.finishedDecoding = true;
} else {
byteBufferWriteOutputStream.add(audioData);
}
mediaCodec.releaseOutputBuffer(outputBufferId, false);
}
@Override
public void onError(@NonNull MediaCodec mediaCodec, @NonNull MediaCodec.CodecException e) {
Log.e(LOG_TAG, "onError (97): An error occurred on media codec" + mediaCodec);
e.printStackTrace();
}
@Override
public void onOutputFormatChanged(@NonNull MediaCodec mediaCodec, @NonNull MediaFormat mediaFormat) {
Log.d(LOG_TAG, "onOutputFormatChanged (104): Output format changed to " + mediaFormat);
}
@Override
public boolean finished() {
return this.finishedDecoding;
}
}
| 6,247 | 0.7093 | 0.705779 | 155 | 39.303226 | 38.681725 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.580645 | false | false | 5 |
a72fe486a809fa7ada6f091dd98cd6485475f821 | 10,307,921,536,551 | 6f41d822745d0af9b3bf4e1c49f231728b233e0d | /Bilibili settle project/src/com/akashi/settle/bilibili/BiliBiliApplication.java | 5400bf49216df84a6ed383257ea9bf54c73aeb49 | [] | no_license | AkashiWen/BiliBili-Settle-Project | https://github.com/AkashiWen/BiliBili-Settle-Project | 8f2d074eee95f805039292b41acbf48b33996c6d | af36ed76e9387eff482c0c441312869b74957f3d | refs/heads/master | "2015-08-23T02:44:13.962000" | "2015-07-03T01:46:15" | "2015-07-03T01:46:15" | 33,543,728 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.akashi.settle.bilibili;
import com.support.akashi.BaseApplication;
public class BiliBiliApplication extends BaseApplication {
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
}
}
| UTF-8 | Java | 243 | java | BiliBiliApplication.java | Java | [] | null | [] | package com.akashi.settle.bilibili;
import com.support.akashi.BaseApplication;
public class BiliBiliApplication extends BaseApplication {
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
}
}
| 243 | 0.761317 | 0.761317 | 14 | 16.357143 | 18.889177 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.785714 | false | false | 5 |
aae516813e1f18f42269033b59d775496f82d2ef | 3,315,714,768,476 | 01d8af978d1b0a17fc8754dde9b429e5adb14e8d | /question144_Binary_Tree_Preorder_Traversal/BinaryTreePreorderTraversal.java | 0ca8ecf4e749bc8b67f35bf5e68531db63253c6a | [] | no_license | zhangCabbage/leetcode | https://github.com/zhangCabbage/leetcode | a0e9944c08a8776f387f0eea8edf464174df8a91 | 46c7c6e3e12e51632d9f934dade854232c62d801 | refs/heads/master | "2020-04-04T04:12:53.696000" | "2017-08-16T14:06:44" | "2017-08-16T14:06:44" | 55,337,533 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package zhang.algorithm.leetcode.question144_Binary_Tree_Preorder_Traversal;
import zhang.algorithm.modelUtil.Tree.TreeNode;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
/**
* Created by IntelliJ IDEA.
* User: zhang_MacPro
* Date: 16/7/10
* Time: 下午7:50
* To change this template use File | Settings | File Templates.
*/
public class BinaryTreePreorderTraversal {
/**
*
* <strong>result of test:</strong><br/>
* 67 / 67 test cases passed
* Status: Accepted
* Runtime: 2 ms, bit 1.86%
*
* @param root
* @return
*/
public List<Integer> preorderTraversal(TreeNode root) {
List<Integer> result = new ArrayList<Integer>();
Stack<TreeNode> stack = new Stack<TreeNode>();
while(root != null || !stack.isEmpty()){
while(root != null){
result.add(root.val);
stack.add(root);
root = root.left;
}
if(!stack.isEmpty()){
TreeNode cur = stack.pop();
root = cur.right;
}
}
return result;
}
}
| UTF-8 | Java | 1,145 | java | BinaryTreePreorderTraversal.java | Java | [
{
"context": ".Stack;\n\n/**\n * Created by IntelliJ IDEA.\n * User: zhang_MacPro\n * Date: 16/7/10\n * Time: 下午7:50\n * To change thi",
"end": 257,
"score": 0.9995272755622864,
"start": 245,
"tag": "USERNAME",
"value": "zhang_MacPro"
}
] | null | [] | package zhang.algorithm.leetcode.question144_Binary_Tree_Preorder_Traversal;
import zhang.algorithm.modelUtil.Tree.TreeNode;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
/**
* Created by IntelliJ IDEA.
* User: zhang_MacPro
* Date: 16/7/10
* Time: 下午7:50
* To change this template use File | Settings | File Templates.
*/
public class BinaryTreePreorderTraversal {
/**
*
* <strong>result of test:</strong><br/>
* 67 / 67 test cases passed
* Status: Accepted
* Runtime: 2 ms, bit 1.86%
*
* @param root
* @return
*/
public List<Integer> preorderTraversal(TreeNode root) {
List<Integer> result = new ArrayList<Integer>();
Stack<TreeNode> stack = new Stack<TreeNode>();
while(root != null || !stack.isEmpty()){
while(root != null){
result.add(root.val);
stack.add(root);
root = root.left;
}
if(!stack.isEmpty()){
TreeNode cur = stack.pop();
root = cur.right;
}
}
return result;
}
}
| 1,145 | 0.568799 | 0.552147 | 43 | 25.534883 | 19.115742 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.418605 | false | false | 5 |
558f516013549402455dc8583e6d883a06618b7d | 27,779,848,499,758 | e54efb7fae73cce3015dc8fee9d3276d1c82b799 | /modules/cloudsim/src/test/java/org/cloudbus/cloudsim/preemption/util/DecimalUtilTest.java | f96959e39ce580c3597caa0731fdfb85e3a8da78 | [] | no_license | giovannifs/cloudsim | https://github.com/giovannifs/cloudsim | a9af8394532fd74d5fc26b89a62dd8ea9f5052dc | 8987eff034da8d2e1b3ab563a5bc6f90e150165e | refs/heads/master | "2021-01-12T19:00:16.520000" | "2017-04-03T18:22:00" | "2017-04-03T18:22:00" | 65,411,029 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.cloudbus.cloudsim.preemption.util;
import org.cloudbus.cloudsim.preemption.util.DecimalUtil;
import org.junit.Assert;
import org.junit.Test;
import java.text.DecimalFormat;
/**
* Created by João Victor Mafra and Alessandro Lia Fook on 23/09/16.
*/
public class DecimalUtilTest {
private static final double ACCEPTABLE_DIFERENCE = 0.0000000001;
@Test
public void testFormat1(){
double NUMBER = 0.53999999710999999999999999999;
Assert.assertEquals(0.539999997, DecimalUtil.format(NUMBER), ACCEPTABLE_DIFERENCE);
//Asserting limit of round
NUMBER = 0.539999999701010;
Assert.assertEquals(0.54, DecimalUtil.format(NUMBER), ACCEPTABLE_DIFERENCE);
//Asserting round half up
NUMBER = 0.5399999995701010;
Assert.assertEquals(0.54, DecimalUtil.format(NUMBER), ACCEPTABLE_DIFERENCE);
//Asserting round hald down
NUMBER = 0.5399999994701010;
Assert.assertEquals(0.539999999, DecimalUtil.format(NUMBER), ACCEPTABLE_DIFERENCE);
}
}
| UTF-8 | Java | 1,051 | java | DecimalUtilTest.java | Java | [
{
"context": "import java.text.DecimalFormat;\n\n/**\n * Created by João Victor Mafra and Alessandro Lia Fook on 23/09/16.\n */\npublic c",
"end": 223,
"score": 0.9998471140861511,
"start": 206,
"tag": "NAME",
"value": "João Victor Mafra"
},
{
"context": "alFormat;\n\n/**\n * Created by João Victor Mafra and Alessandro Lia Fook on 23/09/16.\n */\npublic class DecimalUtilTest {\n\n",
"end": 247,
"score": 0.9998689889907837,
"start": 228,
"tag": "NAME",
"value": "Alessandro Lia Fook"
}
] | null | [] | package org.cloudbus.cloudsim.preemption.util;
import org.cloudbus.cloudsim.preemption.util.DecimalUtil;
import org.junit.Assert;
import org.junit.Test;
import java.text.DecimalFormat;
/**
* Created by <NAME> and <NAME> on 23/09/16.
*/
public class DecimalUtilTest {
private static final double ACCEPTABLE_DIFERENCE = 0.0000000001;
@Test
public void testFormat1(){
double NUMBER = 0.53999999710999999999999999999;
Assert.assertEquals(0.539999997, DecimalUtil.format(NUMBER), ACCEPTABLE_DIFERENCE);
//Asserting limit of round
NUMBER = 0.539999999701010;
Assert.assertEquals(0.54, DecimalUtil.format(NUMBER), ACCEPTABLE_DIFERENCE);
//Asserting round half up
NUMBER = 0.5399999995701010;
Assert.assertEquals(0.54, DecimalUtil.format(NUMBER), ACCEPTABLE_DIFERENCE);
//Asserting round hald down
NUMBER = 0.5399999994701010;
Assert.assertEquals(0.539999999, DecimalUtil.format(NUMBER), ACCEPTABLE_DIFERENCE);
}
}
| 1,026 | 0.715238 | 0.597143 | 38 | 26.631578 | 29.336901 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.578947 | false | false | 5 |
d559261df6c89757d6d56bcc3e179052a253826a | 32,487,132,691,214 | 288eced5630c3f3b65685cdce9c340e1665a7942 | /CentiliStepExecutor/src/main/java/com/centili/stepexe/entities/Step.java | 206761a72036a4c878e797bc61b1e5f83846af8a | [] | no_license | NenadPaunov/StepExecutor | https://github.com/NenadPaunov/StepExecutor | 3ef88c8520ff786b7cff0d6ec63ed42bd207eead | cab09d2bb48085f5c1e96828136ced92084c318e | refs/heads/main | "2023-08-10T20:48:41.773000" | "2021-09-29T09:04:00" | "2021-09-29T09:04:00" | 411,600,848 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.centili.stepexe.entities;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@Entity
@Table
public class Step {
@Id
@GeneratedValue
private int id;
@Column(unique = true)
@NotNull
@NotEmpty(message = "Please provide a step name.")
private String name;
@NotNull
@NotEmpty(message = "Please provide URL.")
private String url;
@OneToMany(mappedBy = "step")
private List<Transaction> transactions;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public List<Transaction> getTransactions() {
return transactions;
}
public void setTransactions(List<Transaction> transactions) {
this.transactions = transactions;
}
}
| UTF-8 | Java | 1,225 | java | Step.java | Java | [] | null | [] | package com.centili.stepexe.entities;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@Entity
@Table
public class Step {
@Id
@GeneratedValue
private int id;
@Column(unique = true)
@NotNull
@NotEmpty(message = "Please provide a step name.")
private String name;
@NotNull
@NotEmpty(message = "Please provide URL.")
private String url;
@OneToMany(mappedBy = "step")
private List<Transaction> transactions;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public List<Transaction> getTransactions() {
return transactions;
}
public void setTransactions(List<Transaction> transactions) {
this.transactions = transactions;
}
}
| 1,225 | 0.699592 | 0.699592 | 63 | 17.444445 | 16.208735 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.047619 | false | false | 5 |
4efb2c16ee2ad72bb7abb49a2ab9bad05d971e7c | 21,904,333,254,090 | 5bd7c3688814d5b630ef9c8c544459c2d44fe1ba | /code/LeetCode12.java | 2bbd0b30a207a7ad1810d2bbacdaab5837799751 | [] | no_license | LLJQ/wu-leetcode | https://github.com/LLJQ/wu-leetcode | 014f20f89978d10ff9c7f6bb399b7c3ff236935f | 4013976fa9e718b625708759f1f416e16a9ee0ac | refs/heads/master | "2020-03-23T12:10:36.220000" | "2018-07-26T04:03:09" | "2018-07-26T04:03:09" | 141,541,739 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wjq.code.alg;
import java.util.*;
public class LeetCode12 {
/**
* 罗马数字和整数映射
*/
private static final Map<Integer, String> map = new HashMap<>(32);
/**
* 将[1, 3999]范围的整数转换为罗马数字表示
*/
public static String intToRoman(int num) {
int i = 1, curr = num, temp;
List<String> list = new ArrayList<>();
while (curr > 0) { // 计算每一位数字的罗马数字表示
temp = curr % 10;
if (temp != 0)
list.add(map.get(i * temp));
i *= 10;
curr /= 10;
}
// 将所有的罗马数字拼接起来
Collections.reverse(list);
StringBuffer result = new StringBuffer();
for (String str : list)
result.append(str);
return result.toString();
}
static {
map.put(1, "I");
map.put(2, "II");
map.put(3, "III");
map.put(4, "IV");
map.put(5, "V");
map.put(6, "VI");
map.put(7, "VII");
map.put(8, "VIII");
map.put(9, "IX");
map.put(10, "X");
map.put(20, "XX");
map.put(30, "XXX");
map.put(40, "XL");
map.put(50, "L");
map.put(60, "LX");
map.put(70, "LXX");
map.put(80, "LXXX");
map.put(90, "XC");
map.put(100, "C");
map.put(200, "CC");
map.put(300, "CCC");
map.put(400, "CD");
map.put(500, "D");
map.put(600, "DC");
map.put(700, "DCC");
map.put(800, "DCCC");
map.put(900, "CM");
map.put(1000, "M");
map.put(2000, "MM");
map.put(3000, "MMM");
}
}
| UTF-8 | Java | 1,721 | java | LeetCode12.java | Java | [] | null | [] | package com.wjq.code.alg;
import java.util.*;
public class LeetCode12 {
/**
* 罗马数字和整数映射
*/
private static final Map<Integer, String> map = new HashMap<>(32);
/**
* 将[1, 3999]范围的整数转换为罗马数字表示
*/
public static String intToRoman(int num) {
int i = 1, curr = num, temp;
List<String> list = new ArrayList<>();
while (curr > 0) { // 计算每一位数字的罗马数字表示
temp = curr % 10;
if (temp != 0)
list.add(map.get(i * temp));
i *= 10;
curr /= 10;
}
// 将所有的罗马数字拼接起来
Collections.reverse(list);
StringBuffer result = new StringBuffer();
for (String str : list)
result.append(str);
return result.toString();
}
static {
map.put(1, "I");
map.put(2, "II");
map.put(3, "III");
map.put(4, "IV");
map.put(5, "V");
map.put(6, "VI");
map.put(7, "VII");
map.put(8, "VIII");
map.put(9, "IX");
map.put(10, "X");
map.put(20, "XX");
map.put(30, "XXX");
map.put(40, "XL");
map.put(50, "L");
map.put(60, "LX");
map.put(70, "LXX");
map.put(80, "LXXX");
map.put(90, "XC");
map.put(100, "C");
map.put(200, "CC");
map.put(300, "CCC");
map.put(400, "CD");
map.put(500, "D");
map.put(600, "DC");
map.put(700, "DCC");
map.put(800, "DCCC");
map.put(900, "CM");
map.put(1000, "M");
map.put(2000, "MM");
map.put(3000, "MMM");
}
}
| 1,721 | 0.439852 | 0.388032 | 67 | 23.194031 | 13.465532 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.149254 | false | false | 5 |
ce4331760684cfcf08a1ea6cc52e8e22e4b06598 | 2,224,793,111,098 | dc4281be0ccdc0df31f8d779ca4466344d40651d | /03Sort/src/MergeSort.java | fb1d9cb5f396139e0fbc2bb50787bb39d038684c | [] | no_license | nnaku/algoritmit | https://github.com/nnaku/algoritmit | b95d4dc9cd9e84c4a76018077d64fdc8eb1c9ae8 | 8fac07f66e1ca7d61c72d6acb19d09ebc7319571 | refs/heads/master | "2021-07-10T14:57:39.300000" | "2017-10-07T22:36:49" | "2017-10-07T22:36:49" | 105,740,403 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Random;
public class MergeSort {
final private int MAX;
private int[] tau;
private long lkm = 0;
public MergeSort(int mAX) {
MAX = mAX;
tau= new int[mAX];
}
public long mergeSort() {
int[] a= new int[MAX];
int i;
Random r = new Random(); //luodaan satunnaislukugeneraattori
System.out.println("\nGeneroidaan syöttöaineisto: ");
for (i=0;i<MAX;i++) {
a[i] = r.nextInt(1000); //generoidaan luvut
System.out.print(a[i]+" ");
if (i>0 && i%40==0) // rivinvaihto
System.out.println();
}
System.out.println("\nSuoritetaan lomituslajittelu, paina Enter ");
//Lue.merkki();
mergeSort(a, 0, MAX-1);
for (i=0;i<MAX;i++) {
System.out.print(a[i]+" ");
if (i>0 && i%40==0) // rivinvaihto
System.out.println();
}
return lkm;
}
//oletus: osataulukot t[p..q] ja t[q+1...r] ovat järjestyksess„
private void merge(int t[], int p, int q, int r) {
//i osoittaa 1. osataulukkoa, j osoittaa 2. osataulukkoa
// k osoittaa aputaulukkoa, johon yhdiste kirjoitetaan.
int i=p, j=q+1, k=0;
lkm++;
lkm++;
while(i<q+1 && j<r+1) {
lkm++;
if (t[i]<t[j]) {
tau[k++]=t[i++];
} else {
tau[k++]=t[j++];
}
lkm++;
lkm++;
}
//toinen osataulukko käsitelty, siirretään toisen käsittelemättömät
lkm++;
while (i<q+1){
tau[k++]=t[i++];
lkm++;
}
lkm++;
while (j<r+1){
tau[k++]=t[j++];
lkm++;
}
lkm++;
//siirretään yhdiste alkuperäiseen taulukkoon
for (i=0;i<k;i++) {
t[p+i]=tau[i];
lkm++;
}
}
private void mergeSort(int t[], int alku, int loppu) {
int ositus;
long la, ll, lt;
lkm++;
if (alku<loppu) { //onko väh. 2 alkiota, että voidaan suorittaa ositus
la=alku; ll=loppu;
lt=(la+ll)/2;
ositus=(int)lt;
mergeSort(t, alku, ositus);//lajitellaan taulukon alkupää
mergeSort(t, ositus+1, loppu);//lajitellaan taulukon loppupää
merge(t, alku, ositus, loppu);//yhdistetään lajitellut osataulukot
}
}
}
| UTF-8 | Java | 2,472 | java | MergeSort.java | Java | [] | null | [] | import java.util.Random;
public class MergeSort {
final private int MAX;
private int[] tau;
private long lkm = 0;
public MergeSort(int mAX) {
MAX = mAX;
tau= new int[mAX];
}
public long mergeSort() {
int[] a= new int[MAX];
int i;
Random r = new Random(); //luodaan satunnaislukugeneraattori
System.out.println("\nGeneroidaan syöttöaineisto: ");
for (i=0;i<MAX;i++) {
a[i] = r.nextInt(1000); //generoidaan luvut
System.out.print(a[i]+" ");
if (i>0 && i%40==0) // rivinvaihto
System.out.println();
}
System.out.println("\nSuoritetaan lomituslajittelu, paina Enter ");
//Lue.merkki();
mergeSort(a, 0, MAX-1);
for (i=0;i<MAX;i++) {
System.out.print(a[i]+" ");
if (i>0 && i%40==0) // rivinvaihto
System.out.println();
}
return lkm;
}
//oletus: osataulukot t[p..q] ja t[q+1...r] ovat järjestyksess„
private void merge(int t[], int p, int q, int r) {
//i osoittaa 1. osataulukkoa, j osoittaa 2. osataulukkoa
// k osoittaa aputaulukkoa, johon yhdiste kirjoitetaan.
int i=p, j=q+1, k=0;
lkm++;
lkm++;
while(i<q+1 && j<r+1) {
lkm++;
if (t[i]<t[j]) {
tau[k++]=t[i++];
} else {
tau[k++]=t[j++];
}
lkm++;
lkm++;
}
//toinen osataulukko käsitelty, siirretään toisen käsittelemättömät
lkm++;
while (i<q+1){
tau[k++]=t[i++];
lkm++;
}
lkm++;
while (j<r+1){
tau[k++]=t[j++];
lkm++;
}
lkm++;
//siirretään yhdiste alkuperäiseen taulukkoon
for (i=0;i<k;i++) {
t[p+i]=tau[i];
lkm++;
}
}
private void mergeSort(int t[], int alku, int loppu) {
int ositus;
long la, ll, lt;
lkm++;
if (alku<loppu) { //onko väh. 2 alkiota, että voidaan suorittaa ositus
la=alku; ll=loppu;
lt=(la+ll)/2;
ositus=(int)lt;
mergeSort(t, alku, ositus);//lajitellaan taulukon alkupää
mergeSort(t, ositus+1, loppu);//lajitellaan taulukon loppupää
merge(t, alku, ositus, loppu);//yhdistetään lajitellut osataulukot
}
}
}
| 2,472 | 0.475296 | 0.463046 | 93 | 25.333334 | 21.481342 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.11828 | false | false | 5 |
b1ff33d17e8de2a87fcc3c02da94ca2c9974713a | 5,944,234,797,983 | bb51494f40c87efb8f04a6219f6ac4bd8ae34955 | /src/main/java/com/epam/rd/model/ModelUser.java | 986acdbda122461b0584dfb8acc6c9f181b0b515 | [] | no_license | andreyykovalev/project | https://github.com/andreyykovalev/project | 39b22b82f5e16659fe5eb8dc89ffc25a7a184abf | dbc8eea8833a072f4b5fbc46f2b5b8d83d587fad | refs/heads/master | "2021-04-26T15:12:52.045000" | "2018-02-19T10:45:38" | "2018-02-19T10:45:38" | 121,222,749 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.epam.rd.model;
import com.epam.rd.model.entity.EntityUser;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ModelUser extends Model {
private static final String CREATE_ADMIN = "INSERT INTO `USER` (`LOGIN`, `PASSWORD`, `LEVEL`) VALUES ('%s','%s',%d);";
private static final String UPDATE_ADMIN = "UPDATE USER SET LOGIN = '%s', PASSWORD = '%s', LEVEL = %d WHERE ID_USER = %d";
private static final String DELETE_ADMIN = "DELETE FROM USER WHERE ID_USER = %d";
private static final String LOAD_BY_ID = "SELECT * FROM USER WHERE ID_USER = %d";
private static final String LOAD_ALL = "SELECT ID_USER FROM USER";
private static final String GET_USER_BY_MAIL = "SELECT * FROM USER WHERE LOGIN = '%s'";
public void create(EntityUser user) {
update(String.format(CREATE_ADMIN, user.getLogin(), user.getPassword(), user.getLevel()));
}
public void update(EntityUser user) {
update(String.format(UPDATE_ADMIN, user.getLogin(), user.getPassword(), user.getLevel(), user.getId()));
}
public void delete(EntityUser user) {
update(String.format(DELETE_ADMIN, user.getId()));
}
public EntityUser load(Long id) {
List<Map> collection = query(String.format(LOAD_BY_ID, id));
final EntityUser[] packages = new EntityUser[1];
if (collection != null) {
collection.forEach((Map e) -> packages[0] = EntityUser.builder()
.id(id)
.login(((String) e.get("login")))
.password((String) e.get("password"))
.level((Integer) e.get("level"))
.build());
}
return packages[0];
}
public EntityUser loadByLogin(String login) {
List<Map> collection = query(String.format(GET_USER_BY_MAIL, login));
final EntityUser[] packages = new EntityUser[1];
if (collection != null) {
collection.forEach((Map e) -> packages[0] = EntityUser.builder()
.id(Long.valueOf((Integer) e.get("id_user")))
.login(((String) e.get("login")))
.password((String) e.get("password"))
.level((Integer) e.get("level"))
.build());
}
return packages[0];
}
public List<EntityUser> load() {
List<Map> collection = query(LOAD_ALL);
List<EntityUser> list = new ArrayList<>();
collection.forEach((Map e) -> list.add(load(Long.valueOf((Integer) e.get("id_user")))));
return list;
}
}
| UTF-8 | Java | 2,601 | java | ModelUser.java | Java | [
{
"context": "MIN = \"UPDATE USER SET LOGIN = '%s', PASSWORD = '%s', LEVEL = %d WHERE ID_USER = %d\";\n private sta",
"end": 401,
"score": 0.863105297088623,
"start": 400,
"tag": "PASSWORD",
"value": "s"
}
] | null | [] | package com.epam.rd.model;
import com.epam.rd.model.entity.EntityUser;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ModelUser extends Model {
private static final String CREATE_ADMIN = "INSERT INTO `USER` (`LOGIN`, `PASSWORD`, `LEVEL`) VALUES ('%s','%s',%d);";
private static final String UPDATE_ADMIN = "UPDATE USER SET LOGIN = '%s', PASSWORD = '%s', LEVEL = %d WHERE ID_USER = %d";
private static final String DELETE_ADMIN = "DELETE FROM USER WHERE ID_USER = %d";
private static final String LOAD_BY_ID = "SELECT * FROM USER WHERE ID_USER = %d";
private static final String LOAD_ALL = "SELECT ID_USER FROM USER";
private static final String GET_USER_BY_MAIL = "SELECT * FROM USER WHERE LOGIN = '%s'";
public void create(EntityUser user) {
update(String.format(CREATE_ADMIN, user.getLogin(), user.getPassword(), user.getLevel()));
}
public void update(EntityUser user) {
update(String.format(UPDATE_ADMIN, user.getLogin(), user.getPassword(), user.getLevel(), user.getId()));
}
public void delete(EntityUser user) {
update(String.format(DELETE_ADMIN, user.getId()));
}
public EntityUser load(Long id) {
List<Map> collection = query(String.format(LOAD_BY_ID, id));
final EntityUser[] packages = new EntityUser[1];
if (collection != null) {
collection.forEach((Map e) -> packages[0] = EntityUser.builder()
.id(id)
.login(((String) e.get("login")))
.password((String) e.get("password"))
.level((Integer) e.get("level"))
.build());
}
return packages[0];
}
public EntityUser loadByLogin(String login) {
List<Map> collection = query(String.format(GET_USER_BY_MAIL, login));
final EntityUser[] packages = new EntityUser[1];
if (collection != null) {
collection.forEach((Map e) -> packages[0] = EntityUser.builder()
.id(Long.valueOf((Integer) e.get("id_user")))
.login(((String) e.get("login")))
.password((String) e.get("password"))
.level((Integer) e.get("level"))
.build());
}
return packages[0];
}
public List<EntityUser> load() {
List<Map> collection = query(LOAD_ALL);
List<EntityUser> list = new ArrayList<>();
collection.forEach((Map e) -> list.add(load(Long.valueOf((Integer) e.get("id_user")))));
return list;
}
}
| 2,601 | 0.588235 | 0.585928 | 65 | 39.015385 | 33.194298 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.661538 | false | false | 5 |
a5371c71e57ba40ae7611453174b8f4b2110575f | 14,516,989,498,737 | 436a28a7529e46de0a3486cb0a33c1e009b2b4b4 | /Jena_/src/main/java/jena/adni/main/LoadCsv.java | b2c6798faaed6c5d42a84de9f535d2848dae7ddb | [] | no_license | federicoperazzoni/adnimanger | https://github.com/federicoperazzoni/adnimanger | d54b61a49f0716b2a75591d82241361c688050b8 | 297104ef6329d2446bd7bb01531c1626294fa7c4 | refs/heads/master | "2020-05-17T07:30:58.443000" | "2019-10-01T13:46:25" | "2019-10-01T13:46:25" | 183,582,252 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jena.adni.main;
import java.util.ArrayList;
import jena.adni.bean.CDRBean;
import jena.adni.bean.FAQBean;
import jena.adni.constants.ADNIExternalResource;
import jena.adni.loader.LoaderCDRCsvToBeanArray;
import jena.adni.loader.LoaderFAQCsvToBeanArray;
import jena.adni.manager.CDRManager;
import jena.adni.manager.FAQManager;
import jena.adni.manager.ontology.ADNIOntologyLoader;
public class LoadCsv {
public static int loadPercent;
public static String loadMex;
public static int status;
public static void loadCsvWithReset() {
status = 0;
loadMex = "Caricamento ontologia ADNI";
//Carica l'ontologia
ADNIOntologyLoader adniOntologyLoader = new ADNIOntologyLoader();
adniOntologyLoader.resetADNIOntologyTDB();
adniOntologyLoader.loadADNIOntology();
loadMex = "Fine caricamento ontologia ADNI";
loadPercent = 10;
status = 2;
loadMex = "Caricamento CSV";
//Carica i CSV in un Array list
LoaderCDRCsvToBeanArray cdrCsvToBeanArray = new LoaderCDRCsvToBeanArray();
ArrayList<CDRBean> cdrTestList = cdrCsvToBeanArray.load(ADNIExternalResource.getInstance().getADNI_HOME() + "\\ADNICSV\\CDR.csv");
LoaderFAQCsvToBeanArray faqCsvToBeanArray = new LoaderFAQCsvToBeanArray();
ArrayList<FAQBean> faqTestList = faqCsvToBeanArray.load(ADNIExternalResource.getInstance().getADNI_HOME() + "\\ADNICSV\\FAQ.csv");
loadMex = "Fine caricamento CSV";
loadPercent = 10;
status = 3;
loadMex = "Caricamento CSV nell'ontologia";
//Carica i dati (individui) nel TDB
CDRManager cdrManager = new CDRManager();
cdrManager.insertInADNIOntology(cdrTestList);
FAQManager faqManager = new FAQManager();
faqManager.insertInADNIOntology(faqTestList);
loadMex = "Fine caricamento CSV nell'ontologia";
}
public static void loadCsvNoReset() {
status = 2;
loadMex = "Caricamento CSV";
//Carica i CSV in un Array list
LoaderCDRCsvToBeanArray cdrCsvToBeanArray = new LoaderCDRCsvToBeanArray();
ArrayList<CDRBean> cdrTestList = cdrCsvToBeanArray.load(ADNIExternalResource.getInstance().getADNI_HOME() + "\\ADNICSV\\CDR.csv");
LoaderFAQCsvToBeanArray faqCsvToBeanArray = new LoaderFAQCsvToBeanArray();
ArrayList<FAQBean> faqTestList = faqCsvToBeanArray.load(ADNIExternalResource.getInstance().getADNI_HOME() + "\\ADNICSV\\FAQ.csv");
loadMex = "Fine caricamento CSV";
loadPercent = 20;
status = 3;
loadMex = "Caricamento CSV nell'ontologia";
//Carica i dati (individui) nel TDB
CDRManager cdrManager = new CDRManager();
cdrManager.insertInADNIOntology(cdrTestList);
FAQManager faqManager = new FAQManager();
faqManager.insertInADNIOntology(faqTestList);
loadMex = "Fine caricamento CSV nell'ontologia";
}
}
| UTF-8 | Java | 2,709 | java | LoadCsv.java | Java | [] | null | [] | package jena.adni.main;
import java.util.ArrayList;
import jena.adni.bean.CDRBean;
import jena.adni.bean.FAQBean;
import jena.adni.constants.ADNIExternalResource;
import jena.adni.loader.LoaderCDRCsvToBeanArray;
import jena.adni.loader.LoaderFAQCsvToBeanArray;
import jena.adni.manager.CDRManager;
import jena.adni.manager.FAQManager;
import jena.adni.manager.ontology.ADNIOntologyLoader;
public class LoadCsv {
public static int loadPercent;
public static String loadMex;
public static int status;
public static void loadCsvWithReset() {
status = 0;
loadMex = "Caricamento ontologia ADNI";
//Carica l'ontologia
ADNIOntologyLoader adniOntologyLoader = new ADNIOntologyLoader();
adniOntologyLoader.resetADNIOntologyTDB();
adniOntologyLoader.loadADNIOntology();
loadMex = "Fine caricamento ontologia ADNI";
loadPercent = 10;
status = 2;
loadMex = "Caricamento CSV";
//Carica i CSV in un Array list
LoaderCDRCsvToBeanArray cdrCsvToBeanArray = new LoaderCDRCsvToBeanArray();
ArrayList<CDRBean> cdrTestList = cdrCsvToBeanArray.load(ADNIExternalResource.getInstance().getADNI_HOME() + "\\ADNICSV\\CDR.csv");
LoaderFAQCsvToBeanArray faqCsvToBeanArray = new LoaderFAQCsvToBeanArray();
ArrayList<FAQBean> faqTestList = faqCsvToBeanArray.load(ADNIExternalResource.getInstance().getADNI_HOME() + "\\ADNICSV\\FAQ.csv");
loadMex = "Fine caricamento CSV";
loadPercent = 10;
status = 3;
loadMex = "Caricamento CSV nell'ontologia";
//Carica i dati (individui) nel TDB
CDRManager cdrManager = new CDRManager();
cdrManager.insertInADNIOntology(cdrTestList);
FAQManager faqManager = new FAQManager();
faqManager.insertInADNIOntology(faqTestList);
loadMex = "Fine caricamento CSV nell'ontologia";
}
public static void loadCsvNoReset() {
status = 2;
loadMex = "Caricamento CSV";
//Carica i CSV in un Array list
LoaderCDRCsvToBeanArray cdrCsvToBeanArray = new LoaderCDRCsvToBeanArray();
ArrayList<CDRBean> cdrTestList = cdrCsvToBeanArray.load(ADNIExternalResource.getInstance().getADNI_HOME() + "\\ADNICSV\\CDR.csv");
LoaderFAQCsvToBeanArray faqCsvToBeanArray = new LoaderFAQCsvToBeanArray();
ArrayList<FAQBean> faqTestList = faqCsvToBeanArray.load(ADNIExternalResource.getInstance().getADNI_HOME() + "\\ADNICSV\\FAQ.csv");
loadMex = "Fine caricamento CSV";
loadPercent = 20;
status = 3;
loadMex = "Caricamento CSV nell'ontologia";
//Carica i dati (individui) nel TDB
CDRManager cdrManager = new CDRManager();
cdrManager.insertInADNIOntology(cdrTestList);
FAQManager faqManager = new FAQManager();
faqManager.insertInADNIOntology(faqTestList);
loadMex = "Fine caricamento CSV nell'ontologia";
}
}
| 2,709 | 0.765227 | 0.761166 | 79 | 33.291138 | 30.898016 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.101266 | false | false | 5 |
8ccf8284a8452f6743a9cb4b27988ff26a73dab8 | 15,857,019,293,811 | 166a99193149ffb70ed0f3c0a3aa7ecb607ba8d7 | /src/lia/app/monc/AppMonC.java | 36eaec5bee8718cf6a8487782147405186c42e11 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | costing/Monalisa | https://github.com/costing/Monalisa | 735c99ab77a92f908564098a6474d6bb085b2e4f | 2e4ab0fa3e198313397edb5bd1d48549ce138a25 | refs/heads/master | "2021-05-02T12:05:18.501000" | "2020-10-09T20:10:32" | "2020-10-09T20:10:32" | 120,735,433 | 0 | 0 | null | true | "2018-02-08T08:50:04" | "2018-02-08T08:50:04" | "2018-02-07T10:54:48" | "2018-02-07T10:54:24" | 232,464 | 0 | 0 | 0 | null | false | null | package lia.app.monc;
import java.util.Enumeration;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import lia.app.AppUtils;
import lia.util.Utils;
import lia.web.utils.Formatare;
/**
* @author costing
* @since forever
*/
public class AppMonC implements lia.app.AppInt {
/** Logger used by this class */
private static final Logger logger = Logger.getLogger(AppMonC.class.getName());
/**
* Configuration file
*/
String sFile = null;
/**
* Configuration options
*/
Properties prop = new Properties();
/**
* Configuration options description
*/
public static final String sConfigOptions = "########### Required parameters : ########\n"
+ "#bash=/path/to/bash (default is /bin/bash)\n" + "##########################################\n\n";
/**
* Path to bash
*/
String sBash = "/bin/bash";
@Override
public boolean start() {
return true;
}
@Override
public boolean stop() {
return true;
}
@Override
public boolean restart() {
return true;
}
@Override
public int status() {
String s = exec(sBash + " --version");
if ((s == null) || (s.length() <= 0)) {
return AppUtils.APP_STATUS_STOPPED;
}
s = s.replace('\n', ' ');
s = s.replace('\r', ' ');
if (s.matches("^GNU bash, version.*$")) {
return AppUtils.APP_STATUS_RUNNING;
}
return AppUtils.APP_STATUS_UNKNOWN;
}
@Override
public String info() {
// xml with the version & stuff
StringBuilder sb = new StringBuilder();
sb.append("<config app=\"Bash\">\n");
sb.append("<file name=\"info\">\n");
try {
String s = exec(sBash + " --version");
if (s.indexOf("version") > 0) {
s = s.substring(s.indexOf("version") + "version".length()).trim();
s = s.substring(0, s.indexOf(" ")).trim();
sb.append("<key name=\"version\" value=\"" + AppUtils.enc(s)
+ "\" line=\"1\" read=\"true\" write=\"false\"/>\n");
}
} catch (Exception e) {
// ignore
}
sb.append("</file>");
sb.append("</config>");
return sb.toString();
}
@Override
public String exec(final String sCmd) {
Throwable exc = null;
try {
final String s = Formatare.replace(sCmd, "\"", "\\\"");
return AppUtils.getOutput(new String[] { sBash, "-c", s });
} catch (Throwable t) {
exc = t;
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, " Got exception in AppMonC", t);
}
}
return "Got exception. Cause:\n" + Utils.getStackTrace(exc);
}
/**
* @param sUpdate
*/
@Override
public boolean update(String sUpdate) {
return true;
}
/**
* @param sUpdate
*/
@Override
public boolean update(String sUpdate[]) {
return true;
}
@Override
public String getConfiguration() {
StringBuilder sb = new StringBuilder();
sb.append(sConfigOptions);
Enumeration<?> e = prop.propertyNames();
while (e.hasMoreElements()) {
String s = (String) e.nextElement();
sb.append(s + "=" + prop.getProperty(s) + "\n");
}
return sb.toString();
}
@Override
public boolean updateConfiguration(String s) {
return AppUtils.updateConfig(sFile, s) && init(sFile);
}
@Override
public boolean init(String sPropFile) {
sFile = sPropFile;
AppUtils.getConfig(prop, sFile);
if ((prop.getProperty("bash") != null) && (prop.getProperty("bash").length() > 0)) {
sBash = prop.getProperty("bash");
}
return true;
}
@Override
public String getName() {
return "lia.app.monc.AppMonC";
}
@Override
public String getConfigFile() {
return sFile;
}
}
| UTF-8 | Java | 4,147 | java | AppMonC.java | Java | [
{
"context": "s;\nimport lia.web.utils.Formatare;\n\n/**\n * @author costing\n * @since forever\n */\npublic class AppMonC implem",
"end": 251,
"score": 0.7829785943031311,
"start": 244,
"tag": "USERNAME",
"value": "costing"
}
] | null | [] | package lia.app.monc;
import java.util.Enumeration;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import lia.app.AppUtils;
import lia.util.Utils;
import lia.web.utils.Formatare;
/**
* @author costing
* @since forever
*/
public class AppMonC implements lia.app.AppInt {
/** Logger used by this class */
private static final Logger logger = Logger.getLogger(AppMonC.class.getName());
/**
* Configuration file
*/
String sFile = null;
/**
* Configuration options
*/
Properties prop = new Properties();
/**
* Configuration options description
*/
public static final String sConfigOptions = "########### Required parameters : ########\n"
+ "#bash=/path/to/bash (default is /bin/bash)\n" + "##########################################\n\n";
/**
* Path to bash
*/
String sBash = "/bin/bash";
@Override
public boolean start() {
return true;
}
@Override
public boolean stop() {
return true;
}
@Override
public boolean restart() {
return true;
}
@Override
public int status() {
String s = exec(sBash + " --version");
if ((s == null) || (s.length() <= 0)) {
return AppUtils.APP_STATUS_STOPPED;
}
s = s.replace('\n', ' ');
s = s.replace('\r', ' ');
if (s.matches("^GNU bash, version.*$")) {
return AppUtils.APP_STATUS_RUNNING;
}
return AppUtils.APP_STATUS_UNKNOWN;
}
@Override
public String info() {
// xml with the version & stuff
StringBuilder sb = new StringBuilder();
sb.append("<config app=\"Bash\">\n");
sb.append("<file name=\"info\">\n");
try {
String s = exec(sBash + " --version");
if (s.indexOf("version") > 0) {
s = s.substring(s.indexOf("version") + "version".length()).trim();
s = s.substring(0, s.indexOf(" ")).trim();
sb.append("<key name=\"version\" value=\"" + AppUtils.enc(s)
+ "\" line=\"1\" read=\"true\" write=\"false\"/>\n");
}
} catch (Exception e) {
// ignore
}
sb.append("</file>");
sb.append("</config>");
return sb.toString();
}
@Override
public String exec(final String sCmd) {
Throwable exc = null;
try {
final String s = Formatare.replace(sCmd, "\"", "\\\"");
return AppUtils.getOutput(new String[] { sBash, "-c", s });
} catch (Throwable t) {
exc = t;
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, " Got exception in AppMonC", t);
}
}
return "Got exception. Cause:\n" + Utils.getStackTrace(exc);
}
/**
* @param sUpdate
*/
@Override
public boolean update(String sUpdate) {
return true;
}
/**
* @param sUpdate
*/
@Override
public boolean update(String sUpdate[]) {
return true;
}
@Override
public String getConfiguration() {
StringBuilder sb = new StringBuilder();
sb.append(sConfigOptions);
Enumeration<?> e = prop.propertyNames();
while (e.hasMoreElements()) {
String s = (String) e.nextElement();
sb.append(s + "=" + prop.getProperty(s) + "\n");
}
return sb.toString();
}
@Override
public boolean updateConfiguration(String s) {
return AppUtils.updateConfig(sFile, s) && init(sFile);
}
@Override
public boolean init(String sPropFile) {
sFile = sPropFile;
AppUtils.getConfig(prop, sFile);
if ((prop.getProperty("bash") != null) && (prop.getProperty("bash").length() > 0)) {
sBash = prop.getProperty("bash");
}
return true;
}
@Override
public String getName() {
return "lia.app.monc.AppMonC";
}
@Override
public String getConfigFile() {
return sFile;
}
}
| 4,147 | 0.521341 | 0.520135 | 177 | 22.429379 | 22.589104 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.378531 | false | false | 5 |
b8ea11ae4bf1e0296a03e59ada9482ee326bb68e | 31,610,959,354,211 | bbbe958ed1c23347d05b8bc2daad1239f6166406 | /ParserAdivinadorQuinielas/src/gui/Opciones.java | 14f14c40b78e737fa1abdc26a071295426c6e120 | [] | no_license | ahmedeissa1/globulosrojos | https://github.com/ahmedeissa1/globulosrojos | d3f916d04e6a307704e47b55edadcd65b5fc49bb | efa597d4aad31939da058f6f1e21d4f11e1b3681 | refs/heads/master | "2021-01-18T08:32:02.349000" | "2011-05-19T20:04:05" | "2011-05-19T20:04:05" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gui;
public class Opciones {
public enum votacion {BASICA, PONDERADA};
public static votacion opcionVotacion = votacion.PONDERADA;
public static int opcionKNN = 3;
public static int ultimaJornada = 12;
}
| UTF-8 | Java | 232 | java | Opciones.java | Java | [] | null | [] | package gui;
public class Opciones {
public enum votacion {BASICA, PONDERADA};
public static votacion opcionVotacion = votacion.PONDERADA;
public static int opcionKNN = 3;
public static int ultimaJornada = 12;
}
| 232 | 0.724138 | 0.711207 | 10 | 21.200001 | 20.404902 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | false | false | 5 |
98a4c894a73cc80af678533d30cf445e6cd225f6 | 30,047,591,236,599 | a70ce53ea233a3576884eba238f54c5b572653dd | /src/main/java/myProject/practest/test/testScripts/LoginTest.java | f5bece357ee9bcef689385759d38d487706ae79d | [] | no_license | SrikanthSelenium/MyFrameworkPOMProject | https://github.com/SrikanthSelenium/MyFrameworkPOMProject | 66a0bdb4d4c7d5fdc5f02899fad72976f25e508e | 48518bf0d4e411c14eaf45a82eadef6cb9940b26 | refs/heads/master | "2023-01-10T01:15:07.053000" | "2020-11-09T15:40:06" | "2020-11-09T15:40:06" | 311,375,244 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package myProject.practest.test.testScripts;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.testng.SkipException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import myProject.practest.test.helper.assertion.AssertionHelper;
import myProject.practest.test.helper.assertion.VerificationHelper;
import myProject.practest.test.helper.browserConfig.config.ObjectReader;
import myProject.practest.test.helper.excel.ExcelHelper;
import myProject.practest.test.helper.logger.LoggerHelper;
import myProject.practest.test.helper.resource.ResourceHelper;
import myProject.practest.test.pageObject.LoginPage;
import myProject.practest.test.testbase.TestBase;
public class LoginTest extends TestBase {
private Logger log = LoggerHelper.getLogger(LoginTest.class);
VerificationHelper verifyHelper;
static String path = ResourceHelper.getResourcePath("src/main/resources/configfile/testData.xlsx");
@Test(dataProvider = "testData")
public void testLoginToApplication(String testCase, String runMode, String userName, String Password)
throws Exception {
if (testCase.equalsIgnoreCase("Login") && runMode.equalsIgnoreCase("N")) {
throw new SkipException("Test not set for Run");
}
// getApplicationUrl(ObjectReader.reader.getUrl());
LoginPage loginpage = new LoginPage(driver);
verifyHelper = new VerificationHelper(driver);
loginpage.loginToApplication(userName, Password);
boolean status = loginpage.verifySuccessLoginMsg();
//AssertionHelper.updateTestStatus(status);
if (status) {
TestBase.logStatus("Pass", "Login Succesful..." + loginpage.LoginSuccessMsg());
loginpage.logout();
}
}
@DataProvider(name = "testData")
public Object[][] testData() throws IOException {
Object[][] data = ExcelHelper.getExcelData(path, "loginData");
return data;
}
}
| UTF-8 | Java | 1,847 | java | LoginTest.java | Java | [] | null | [] | package myProject.practest.test.testScripts;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.testng.SkipException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import myProject.practest.test.helper.assertion.AssertionHelper;
import myProject.practest.test.helper.assertion.VerificationHelper;
import myProject.practest.test.helper.browserConfig.config.ObjectReader;
import myProject.practest.test.helper.excel.ExcelHelper;
import myProject.practest.test.helper.logger.LoggerHelper;
import myProject.practest.test.helper.resource.ResourceHelper;
import myProject.practest.test.pageObject.LoginPage;
import myProject.practest.test.testbase.TestBase;
public class LoginTest extends TestBase {
private Logger log = LoggerHelper.getLogger(LoginTest.class);
VerificationHelper verifyHelper;
static String path = ResourceHelper.getResourcePath("src/main/resources/configfile/testData.xlsx");
@Test(dataProvider = "testData")
public void testLoginToApplication(String testCase, String runMode, String userName, String Password)
throws Exception {
if (testCase.equalsIgnoreCase("Login") && runMode.equalsIgnoreCase("N")) {
throw new SkipException("Test not set for Run");
}
// getApplicationUrl(ObjectReader.reader.getUrl());
LoginPage loginpage = new LoginPage(driver);
verifyHelper = new VerificationHelper(driver);
loginpage.loginToApplication(userName, Password);
boolean status = loginpage.verifySuccessLoginMsg();
//AssertionHelper.updateTestStatus(status);
if (status) {
TestBase.logStatus("Pass", "Login Succesful..." + loginpage.LoginSuccessMsg());
loginpage.logout();
}
}
@DataProvider(name = "testData")
public Object[][] testData() throws IOException {
Object[][] data = ExcelHelper.getExcelData(path, "loginData");
return data;
}
}
| 1,847 | 0.792637 | 0.792095 | 49 | 36.693878 | 27.809999 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.612245 | false | false | 5 |
c06b9d90fbc590015d9f6f81186497c48307249b | 30,047,591,237,346 | d77ce2a702691a840e6a40e988fa4c8700dfb219 | /src/main/java/org/jevis/jecommons/dataprocessing/DataCalc.java | 7b750834ae84c366c6bab09fdda304239273bd1a | [] | no_license | Ulrich5120/DataProcessing | https://github.com/Ulrich5120/DataProcessing | da85237cada4b6a267a716689d5f80f903e92ced | 89aad87bb1634dec4d1c87030bf004fdb89e7e92 | refs/heads/master | "2016-03-30T23:19:30.817000" | "2015-01-23T16:08:07" | "2015-01-23T16:08:07" | 29,485,372 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.jevis.jecommons.dataprocessing;
import java.text.ParseException;
import java.util.List;
import org.jevis.api.JEVisAttribute;
import org.jevis.api.JEVisException;
import org.jevis.api.JEVisSample;
import org.joda.time.DateTime;
/**
*
* @author gf
*/
public interface DataCalc {
/*
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param value one value of typ double to be added
* @return
*/
List<JEVisSample> addition(JEVisAttribute attribute, double value) throws JEVisException;
/*
* @param attributes the infinite many sampled data rows of typ JEVisAttribute to be calculated
* @return
*/
public List<JEVisSample> addition(List<JEVisAttribute> attributes)throws JEVisException;
/*
* @param attribute1 one sampled data row of typ JEVisAttribute to be calculated
* @param attribute2 one sampled data row of typ JEVisAttribute to be calculated
* @return
*/
public List<JEVisSample> addition(JEVisAttribute attribute1, JEVisAttribute attribute2) throws JEVisException;
/*
the combination of high pass filter und low pass filter
The input parameter „delete“ decides, whether the improper values
will be deleted or replaced by the upper limit and the lower limit.
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param boundary_up the upper limit
* @param boundary_low the lower limit
* @param delete decides, whether the improper values will be deleted or replaced by the upper limit and the lower limit.(delete=true, delete; delete=false, replace)
* @return
*/
public List<JEVisSample> boundaryFilter(JEVisAttribute attribute, double boundary_up, double boundary_low, boolean delete) throws JEVisException;
/*
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @return
*/
public List<JEVisSample> cumulativeDifferentialConverter(JEVisAttribute sample) throws JEVisException;
/*
* 1. the over boundary value will not be stored, and become a gap. no
* 2. the over boundary value will replaced by boundary.
* 3. the over boundary value will replaced by 0 or any other value.
* here choose 2
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param boundary the upper limit
* @return
*/
public List<JEVisSample> highPassFilter(JEVisAttribute attribute, double boundary) throws JEVisException;
/*
* 1. the over boundary value will not be stored, and become a gap. no
* 2. the over boundary value will replaced by boundary.
* 3. the over boundary value will replaced by 0 or any other value.
* here choose 3
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param boundary the upper limit
* @param fill_value the value,that replaces the inproper values
* @return
*/
public List<JEVisSample> highPassFilter(JEVisAttribute attribute, double boundary, double fill_value) throws JEVisException;
/*
* calculate the area between every two time points,and here the period
* between every two time points must not be same.
* And there could be sevrial methods to calculate the integration:vorwaerts,nachwaerts,trapezoid,
* here trapezoid is used.
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @return
*/
public double integration(JEVisAttribute attribute) throws JEVisException;
/*
* calculate the area between every two time points,and here the period
* between every two time points must not be same.
* And there could be sevrial methods to calculate the integration:vorwaerts,nachwaerts,trapezoid,
* here trapezoid is used.
* calculate in a range
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param from the begintime
* @param to the endtime.
* @return
*/
public double integration(JEVisAttribute attribute, DateTime from, DateTime to) throws JEVisException;
/*
* eliminate the deviation of the timestamp(delay).
* the smallest unit of time,period_s and deviation_s is second
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param period_s period of the sampling and it's units is second.
* @param deviation_s allowable deviation time and it's units second.
* @return
*/
public List<JEVisSample> intervalAlignment(JEVisAttribute attribute, DateTime begin_time, int period_s, int deviation_s) throws JEVisException;
/*
* interpolation the whole data row, from begin to end
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param insert_num decides,how many points will be added into every two time points in original data row.
* @return
*/
public List<JEVisSample> linearInterpolation(JEVisAttribute attribute, int insert_num) throws JEVisException;
/*
* interpolation in a range
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param from the begintime
* @param to the endtime
* @param insert_num decides,how many points will be added into every two time points in original data row.
* @return
*/
public List<JEVisSample> linearInterpolation(JEVisAttribute attribute, DateTime from, DateTime to, int insert_num) throws JEVisException;
/*
* calculate every value according to y=a*x+b
* the gap is not taken into considered until now
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param proportion
* @param b
* @return
*/
public List<JEVisSample> linearScaling(JEVisAttribute attribute, double proportion, double b) throws JEVisException;
/*
look for the median of one data row(JEVis variable).
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @return
*/
public double median(JEVisAttribute attribute) throws JEVisException;
/*
* merge the values at some timestamps to one timestamp, the values will be added.
* The input parameter „begin_time“ is the theoretic begin time(the first sampled time) of the data row.
* The input parameter „period_s“ should be time(period) and it's unit is second.
* The last input parameter „meg_num“ means, how many sampled value will be merged.
* (millinsecond for year is too lang,already beyound the int,so the smallest unit of time is here second.)
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param begin_time the begintime
* @param period_s period of the sampling and it's units is second.
* @param meg_num means, how many sampled value will be merged.
* @return
*/
public List<JEVisSample> mergeValues(JEVisAttribute attribute, DateTime begin_time, int period_s, int meg_num) throws JEVisException;
/*
delete the value,that is not bigger or smaller than it's previous value in one percentage value.
The inputparameter „percent“ is the percentage value, which is decided by enduser.
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param percent the percentage value
* @return
*/
public List<JEVisSample> precisionFilter(JEVisAttribute attribute, double percent) throws JEVisException;
/*
sort the data row according to Time. The import parameter "order" decides form begin/end to end/begin.
order= 1,begin to end
order=-1,end to begin
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param order decides,whether is from begen to end(1) or from end to begin(-1). The value of „order“ should be 1 or -1.
* @return
*/
public List<JEVisSample> sortByTime(JEVisAttribute attribute,int order);
/*
sort the data row according to value. The import parameter "order" decides form big/small to small/big.
order= 1,small to big
order=-1,big to small
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param order decides,whether is from big to small(1) or from samll to big(-1).
* @return
*/
public List<JEVisSample> sortByValue(JEVisAttribute attribute,int order);
/*
* only split the value as average, it's not komplete
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param period_s period of the sampling and it's units is second.
* @param seg_num means, how many time points will one sampled time point will be splitted into.(seg_num=1,one point becomes two points; seg_num=2,one point becomes three points; ......)
* @return
*/
public List<JEVisSample> splitValues(JEVisAttribute attribute, int period_s, int seg_num) throws JEVisException;
/*
every value of the data row minus one value
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param value one value of typ double to be subtracted
* @return
*/
public List<JEVisSample> subtraction(JEVisAttribute attribute, double value) throws JEVisException;
/*
the value in first data row minus the value in second data row with same time.
the time punkts,that only the first data row has, it's value will be directly putted into the result.
the time punkts,that only the second data row has, it's value will become negative and be putted into the result.
* @param attribute1 one sampled data row of typ JEVisAttribute to subtract
* @param attribute2 one sampled data row of typ JEVisAttribute to be subtracted
* @return
*/
public List<JEVisSample> subtraction(JEVisAttribute attribute1, JEVisAttribute attribute2) throws JEVisException;
/*
* output all minimum values with their time in the data row
* @param attribute one sampled data row of typ JEVisAttribute to be processed
* @return
*/
public List<JEVisSample> valueAllMinimum(JEVisAttribute attribute) throws JEVisException;
/*
* output only the minimum value in one data row
* @param attribute one sampled data row of typ JEVisAttribute to be processed
* @return
*/
public double valueMinimum(JEVisAttribute attribute) throws JEVisException;
/*
find the minimum value of multiple data rows and a value.
the multiple data rows must first be putted into a List, so that this
function can compare endless more data rows.
* @param attributes infinite many sampled data rows of typ JEVisAttribute to be processed
* @return
*/
public double valueMinimum(List<JEVisAttribute> attributes) throws JEVisException;
/*
find the minimum value of multiple data rows and a value.
It firstly use the function:valueMinimum(List<JEVisAttribute> attributes) to find
the minimum value of multiple data rows, then compare it to the value.
* @param attributes infinite many sampled data rows of typ JEVisAttribute to be processed
* @param value one value of typ double to be compared
* @return
*/
public double valueMinimum(List<JEVisAttribute> attributes,double value) throws JEVisException;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public List<JEVisSample> multiplication(JEVisAttribute f1, JEVisAttribute f2) throws ParseException, JEVisException;
public List<JEVisSample> division(JEVisAttribute myAtt1, JEVisAttribute myAtt2) throws ParseException, JEVisException;
public double getAverageValue(JEVisAttribute myAtt1) throws JEVisException;
public double getMaxValue(JEVisAttribute myAtt1) throws JEVisException;
//calculate the Mean Deviation
public double meanDeviation(JEVisAttribute myAtt1) throws JEVisException;
//add shifttime to original timeaxis
public List<JEVisSample> addShiftTime(JEVisAttribute myAtt1, int shiftTime) throws ParseException, JEVisException;
//only the value which smaller than setNumber can be stored
public List<JEVisSample> lowPassFilter(JEVisAttribute myAtt1, double setNumber) throws ParseException, JEVisException;
//this function will considers the period as no matter how long you give
public List<JEVisSample> derivation(JEVisAttribute myAtt1, int period) throws ParseException, JEVisException;
public List<JEVisSample> differentialCumulativeConverter(JEVisAttribute myAtt1) throws JEVisException;
}
| UTF-8 | Java | 12,876 | java | DataCalc.java | Java | [
{
"context": "\nimport org.joda.time.DateTime;\n\n/**\n *\n * @author gf\n */\npublic interface DataCalc {\n \n /*\n ",
"end": 361,
"score": 0.9991753697395325,
"start": 359,
"tag": "USERNAME",
"value": "gf"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.jevis.jecommons.dataprocessing;
import java.text.ParseException;
import java.util.List;
import org.jevis.api.JEVisAttribute;
import org.jevis.api.JEVisException;
import org.jevis.api.JEVisSample;
import org.joda.time.DateTime;
/**
*
* @author gf
*/
public interface DataCalc {
/*
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param value one value of typ double to be added
* @return
*/
List<JEVisSample> addition(JEVisAttribute attribute, double value) throws JEVisException;
/*
* @param attributes the infinite many sampled data rows of typ JEVisAttribute to be calculated
* @return
*/
public List<JEVisSample> addition(List<JEVisAttribute> attributes)throws JEVisException;
/*
* @param attribute1 one sampled data row of typ JEVisAttribute to be calculated
* @param attribute2 one sampled data row of typ JEVisAttribute to be calculated
* @return
*/
public List<JEVisSample> addition(JEVisAttribute attribute1, JEVisAttribute attribute2) throws JEVisException;
/*
the combination of high pass filter und low pass filter
The input parameter „delete“ decides, whether the improper values
will be deleted or replaced by the upper limit and the lower limit.
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param boundary_up the upper limit
* @param boundary_low the lower limit
* @param delete decides, whether the improper values will be deleted or replaced by the upper limit and the lower limit.(delete=true, delete; delete=false, replace)
* @return
*/
public List<JEVisSample> boundaryFilter(JEVisAttribute attribute, double boundary_up, double boundary_low, boolean delete) throws JEVisException;
/*
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @return
*/
public List<JEVisSample> cumulativeDifferentialConverter(JEVisAttribute sample) throws JEVisException;
/*
* 1. the over boundary value will not be stored, and become a gap. no
* 2. the over boundary value will replaced by boundary.
* 3. the over boundary value will replaced by 0 or any other value.
* here choose 2
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param boundary the upper limit
* @return
*/
public List<JEVisSample> highPassFilter(JEVisAttribute attribute, double boundary) throws JEVisException;
/*
* 1. the over boundary value will not be stored, and become a gap. no
* 2. the over boundary value will replaced by boundary.
* 3. the over boundary value will replaced by 0 or any other value.
* here choose 3
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param boundary the upper limit
* @param fill_value the value,that replaces the inproper values
* @return
*/
public List<JEVisSample> highPassFilter(JEVisAttribute attribute, double boundary, double fill_value) throws JEVisException;
/*
* calculate the area between every two time points,and here the period
* between every two time points must not be same.
* And there could be sevrial methods to calculate the integration:vorwaerts,nachwaerts,trapezoid,
* here trapezoid is used.
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @return
*/
public double integration(JEVisAttribute attribute) throws JEVisException;
/*
* calculate the area between every two time points,and here the period
* between every two time points must not be same.
* And there could be sevrial methods to calculate the integration:vorwaerts,nachwaerts,trapezoid,
* here trapezoid is used.
* calculate in a range
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param from the begintime
* @param to the endtime.
* @return
*/
public double integration(JEVisAttribute attribute, DateTime from, DateTime to) throws JEVisException;
/*
* eliminate the deviation of the timestamp(delay).
* the smallest unit of time,period_s and deviation_s is second
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param period_s period of the sampling and it's units is second.
* @param deviation_s allowable deviation time and it's units second.
* @return
*/
public List<JEVisSample> intervalAlignment(JEVisAttribute attribute, DateTime begin_time, int period_s, int deviation_s) throws JEVisException;
/*
* interpolation the whole data row, from begin to end
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param insert_num decides,how many points will be added into every two time points in original data row.
* @return
*/
public List<JEVisSample> linearInterpolation(JEVisAttribute attribute, int insert_num) throws JEVisException;
/*
* interpolation in a range
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param from the begintime
* @param to the endtime
* @param insert_num decides,how many points will be added into every two time points in original data row.
* @return
*/
public List<JEVisSample> linearInterpolation(JEVisAttribute attribute, DateTime from, DateTime to, int insert_num) throws JEVisException;
/*
* calculate every value according to y=a*x+b
* the gap is not taken into considered until now
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param proportion
* @param b
* @return
*/
public List<JEVisSample> linearScaling(JEVisAttribute attribute, double proportion, double b) throws JEVisException;
/*
look for the median of one data row(JEVis variable).
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @return
*/
public double median(JEVisAttribute attribute) throws JEVisException;
/*
* merge the values at some timestamps to one timestamp, the values will be added.
* The input parameter „begin_time“ is the theoretic begin time(the first sampled time) of the data row.
* The input parameter „period_s“ should be time(period) and it's unit is second.
* The last input parameter „meg_num“ means, how many sampled value will be merged.
* (millinsecond for year is too lang,already beyound the int,so the smallest unit of time is here second.)
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param begin_time the begintime
* @param period_s period of the sampling and it's units is second.
* @param meg_num means, how many sampled value will be merged.
* @return
*/
public List<JEVisSample> mergeValues(JEVisAttribute attribute, DateTime begin_time, int period_s, int meg_num) throws JEVisException;
/*
delete the value,that is not bigger or smaller than it's previous value in one percentage value.
The inputparameter „percent“ is the percentage value, which is decided by enduser.
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param percent the percentage value
* @return
*/
public List<JEVisSample> precisionFilter(JEVisAttribute attribute, double percent) throws JEVisException;
/*
sort the data row according to Time. The import parameter "order" decides form begin/end to end/begin.
order= 1,begin to end
order=-1,end to begin
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param order decides,whether is from begen to end(1) or from end to begin(-1). The value of „order“ should be 1 or -1.
* @return
*/
public List<JEVisSample> sortByTime(JEVisAttribute attribute,int order);
/*
sort the data row according to value. The import parameter "order" decides form big/small to small/big.
order= 1,small to big
order=-1,big to small
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param order decides,whether is from big to small(1) or from samll to big(-1).
* @return
*/
public List<JEVisSample> sortByValue(JEVisAttribute attribute,int order);
/*
* only split the value as average, it's not komplete
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param period_s period of the sampling and it's units is second.
* @param seg_num means, how many time points will one sampled time point will be splitted into.(seg_num=1,one point becomes two points; seg_num=2,one point becomes three points; ......)
* @return
*/
public List<JEVisSample> splitValues(JEVisAttribute attribute, int period_s, int seg_num) throws JEVisException;
/*
every value of the data row minus one value
* @param attribute one sampled data row of typ JEVisAttribute to be calculated
* @param value one value of typ double to be subtracted
* @return
*/
public List<JEVisSample> subtraction(JEVisAttribute attribute, double value) throws JEVisException;
/*
the value in first data row minus the value in second data row with same time.
the time punkts,that only the first data row has, it's value will be directly putted into the result.
the time punkts,that only the second data row has, it's value will become negative and be putted into the result.
* @param attribute1 one sampled data row of typ JEVisAttribute to subtract
* @param attribute2 one sampled data row of typ JEVisAttribute to be subtracted
* @return
*/
public List<JEVisSample> subtraction(JEVisAttribute attribute1, JEVisAttribute attribute2) throws JEVisException;
/*
* output all minimum values with their time in the data row
* @param attribute one sampled data row of typ JEVisAttribute to be processed
* @return
*/
public List<JEVisSample> valueAllMinimum(JEVisAttribute attribute) throws JEVisException;
/*
* output only the minimum value in one data row
* @param attribute one sampled data row of typ JEVisAttribute to be processed
* @return
*/
public double valueMinimum(JEVisAttribute attribute) throws JEVisException;
/*
find the minimum value of multiple data rows and a value.
the multiple data rows must first be putted into a List, so that this
function can compare endless more data rows.
* @param attributes infinite many sampled data rows of typ JEVisAttribute to be processed
* @return
*/
public double valueMinimum(List<JEVisAttribute> attributes) throws JEVisException;
/*
find the minimum value of multiple data rows and a value.
It firstly use the function:valueMinimum(List<JEVisAttribute> attributes) to find
the minimum value of multiple data rows, then compare it to the value.
* @param attributes infinite many sampled data rows of typ JEVisAttribute to be processed
* @param value one value of typ double to be compared
* @return
*/
public double valueMinimum(List<JEVisAttribute> attributes,double value) throws JEVisException;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public List<JEVisSample> multiplication(JEVisAttribute f1, JEVisAttribute f2) throws ParseException, JEVisException;
public List<JEVisSample> division(JEVisAttribute myAtt1, JEVisAttribute myAtt2) throws ParseException, JEVisException;
public double getAverageValue(JEVisAttribute myAtt1) throws JEVisException;
public double getMaxValue(JEVisAttribute myAtt1) throws JEVisException;
//calculate the Mean Deviation
public double meanDeviation(JEVisAttribute myAtt1) throws JEVisException;
//add shifttime to original timeaxis
public List<JEVisSample> addShiftTime(JEVisAttribute myAtt1, int shiftTime) throws ParseException, JEVisException;
//only the value which smaller than setNumber can be stored
public List<JEVisSample> lowPassFilter(JEVisAttribute myAtt1, double setNumber) throws ParseException, JEVisException;
//this function will considers the period as no matter how long you give
public List<JEVisSample> derivation(JEVisAttribute myAtt1, int period) throws ParseException, JEVisException;
public List<JEVisSample> differentialCumulativeConverter(JEVisAttribute myAtt1) throws JEVisException;
}
| 12,876 | 0.716387 | 0.713196 | 278 | 45.230217 | 42.256977 | 190 | false | false | 0 | 0 | 0 | 0 | 125 | 0.009726 | 0.460432 | false | false | 5 |
a93f9cc2326481363efb16b504936ee1003d5e6f | 1,202,590,888,908 | bbd7b1700b68b18e756e2cd0b035441e400851b3 | /components/alarm/src/main/java/agh/edu/pl/smarthome/ReceiverControl.java | 7b4ced7f5d64dc264cd07bfa65876e485d993f1f | [] | no_license | Fudalinm/SmartHome | https://github.com/Fudalinm/SmartHome | 729e2dfc94bf85f7796090c08058473a72f79b23 | 802a29eb01fe03cdafedecc410709406e61795ce | refs/heads/master | "2022-09-01T16:45:20.097000" | "2020-05-28T22:58:25" | "2020-05-28T22:58:25" | 261,501,541 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package agh.edu.pl.smarthome;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Delivery;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
public class ReceiverControl implements Runnable{
private Connection connection;
private Channel channel;
private String exchange;
private String listenTopicControl;
private String queueName;
private Alarm alarm;
public void deliverCallback(String consumerTag, Delivery delivery) throws UnsupportedEncodingException {
JsonObject receivedJson = new Gson().fromJson(new String(delivery.getBody(), "UTF-8"),JsonObject.class);
System.out.println(" Alarm received: " +
delivery.getEnvelope().getRoutingKey() + "':'" + receivedJson.toString() + "'");
int set = receivedJson.get("Set").getAsInt();
if (set == 1) {
this.alarm.setIsOn(true);
} else {
this.alarm.setIsOn(false);
this.alarm.setIsUp(false);
}
}
public ReceiverControl(
Connection connection,
String exchange,
String listenTopicControl,
Alarm alarm
) throws IOException {
this.alarm = alarm;
this.exchange = exchange;
this.listenTopicControl = listenTopicControl;
this.connection = connection;
this.channel = connection.createChannel();
}
@Override
public void run() {
try {
this.channel.exchangeDeclare(exchange, "topic");
this.queueName = channel.queueDeclare().getQueue();
this.channel.queueBind(queueName, exchange, this.listenTopicControl);
this.channel.basicConsume(queueName, true, this::deliverCallback, consumerTag -> { });
} catch (IOException e) {
e.printStackTrace();
}
}
} | UTF-8 | Java | 1,961 | java | ReceiverControl.java | Java | [] | null | [] | package agh.edu.pl.smarthome;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Delivery;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
public class ReceiverControl implements Runnable{
private Connection connection;
private Channel channel;
private String exchange;
private String listenTopicControl;
private String queueName;
private Alarm alarm;
public void deliverCallback(String consumerTag, Delivery delivery) throws UnsupportedEncodingException {
JsonObject receivedJson = new Gson().fromJson(new String(delivery.getBody(), "UTF-8"),JsonObject.class);
System.out.println(" Alarm received: " +
delivery.getEnvelope().getRoutingKey() + "':'" + receivedJson.toString() + "'");
int set = receivedJson.get("Set").getAsInt();
if (set == 1) {
this.alarm.setIsOn(true);
} else {
this.alarm.setIsOn(false);
this.alarm.setIsUp(false);
}
}
public ReceiverControl(
Connection connection,
String exchange,
String listenTopicControl,
Alarm alarm
) throws IOException {
this.alarm = alarm;
this.exchange = exchange;
this.listenTopicControl = listenTopicControl;
this.connection = connection;
this.channel = connection.createChannel();
}
@Override
public void run() {
try {
this.channel.exchangeDeclare(exchange, "topic");
this.queueName = channel.queueDeclare().getQueue();
this.channel.queueBind(queueName, exchange, this.listenTopicControl);
this.channel.basicConsume(queueName, true, this::deliverCallback, consumerTag -> { });
} catch (IOException e) {
e.printStackTrace();
}
}
} | 1,961 | 0.648649 | 0.647629 | 66 | 28.727272 | 26.76358 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 5 |
01927b9fcdc842507f69779b7903aa2db73a5c5c | 9,191,230,064,326 | 1cedad6242833c207c6997264903d47c83c4e5dc | /src/main/java/model/ItemOrder.java | d7c42660aa353c4e83c41f1282d70159b9af4049 | [] | no_license | LucasKr/petshop | https://github.com/LucasKr/petshop | 89261d49fbf1d8db14395fa59f3f8cf791e93608 | 9813add29f262a94d42fa79c68561a470eb252d7 | refs/heads/master | "2021-04-27T00:14:01.120000" | "2017-05-16T20:53:21" | "2017-05-16T20:53:21" | 69,765,328 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model;
public class ItemOrder {
private int id;
private Item item;
private double amount;
private double unitPrice;
public ItemOrder() {
}
public ItemOrder(int id, Item item, double amount, double unitPrice) {
this.id = id;
this.item = item;
this.amount = amount;
this.unitPrice = unitPrice;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(double unitPrice) {
this.unitPrice = unitPrice;
}
}
| UTF-8 | Java | 916 | java | ItemOrder.java | Java | [] | null | [] | package model;
public class ItemOrder {
private int id;
private Item item;
private double amount;
private double unitPrice;
public ItemOrder() {
}
public ItemOrder(int id, Item item, double amount, double unitPrice) {
this.id = id;
this.item = item;
this.amount = amount;
this.unitPrice = unitPrice;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(double unitPrice) {
this.unitPrice = unitPrice;
}
}
| 916 | 0.567686 | 0.567686 | 51 | 16.960785 | 15.734264 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.392157 | false | false | 5 |
c29cb7087df3017c46a808da532bfb40e9168a75 | 7,086,696,045,284 | dddacbfb422e1bb5baf2287e4d42bcdc73f5a643 | /app/src/main/java/com/zslide/data/remote/converter/LocalDateTimeConverter.java | 0b36b98d53fe8ac4ee62c0ce2e3aa19af1b0c6bd | [] | no_license | netstep21/apartslide | https://github.com/netstep21/apartslide | aafa4583497001d86fcd53fbbd38dd326a4f355e | e2510c245b8575d2995508c48ddb5e5bdc0733fe | refs/heads/master | "2021-03-17T04:33:04.370000" | "2020-03-13T00:59:49" | "2020-03-13T00:59:49" | 246,960,010 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zslide.data.remote.converter;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import org.threeten.bp.Instant;
import org.threeten.bp.LocalDate;
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.ZoneId;
import org.threeten.bp.format.DateTimeFormatter;
import java.lang.reflect.Type;
/**
* Created by chulwoo on 2018. 1. 10..
*/
public class LocalDateTimeConverter implements JsonDeserializer<LocalDateTime>, JsonSerializer<LocalDateTime> {
@Override
public LocalDateTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
String localDateTimeString = json.getAsJsonPrimitive().getAsString();
try {
return LocalDateTime.ofInstant(Instant.from(DateTimeFormatter.ISO_INSTANT.parse(localDateTimeString)), ZoneId.systemDefault());
} catch (Exception e1) {
try {
return LocalDateTime.parse(localDateTimeString, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
} catch (Exception e2) {
try {
return LocalDate.parse(localDateTimeString, DateTimeFormatter.ISO_LOCAL_DATE).atStartOfDay();
} catch (Exception e3) {
// pass
}
}
}
return null;
}
@Override
public JsonElement serialize(LocalDateTime src, Type typeOfSrc, JsonSerializationContext
context) {
return new JsonPrimitive(src.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); // "yyyy-mm-dd"
}
}
| UTF-8 | Java | 1,805 | java | LocalDateTimeConverter.java | Java | [
{
"context": "\nimport java.lang.reflect.Type;\n\n/**\n * Created by chulwoo on 2018. 1. 10..\n */\n\npublic class LocalDateTimeC",
"end": 583,
"score": 0.9996461272239685,
"start": 576,
"tag": "USERNAME",
"value": "chulwoo"
}
] | null | [] | package com.zslide.data.remote.converter;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import org.threeten.bp.Instant;
import org.threeten.bp.LocalDate;
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.ZoneId;
import org.threeten.bp.format.DateTimeFormatter;
import java.lang.reflect.Type;
/**
* Created by chulwoo on 2018. 1. 10..
*/
public class LocalDateTimeConverter implements JsonDeserializer<LocalDateTime>, JsonSerializer<LocalDateTime> {
@Override
public LocalDateTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
String localDateTimeString = json.getAsJsonPrimitive().getAsString();
try {
return LocalDateTime.ofInstant(Instant.from(DateTimeFormatter.ISO_INSTANT.parse(localDateTimeString)), ZoneId.systemDefault());
} catch (Exception e1) {
try {
return LocalDateTime.parse(localDateTimeString, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
} catch (Exception e2) {
try {
return LocalDate.parse(localDateTimeString, DateTimeFormatter.ISO_LOCAL_DATE).atStartOfDay();
} catch (Exception e3) {
// pass
}
}
}
return null;
}
@Override
public JsonElement serialize(LocalDateTime src, Type typeOfSrc, JsonSerializationContext
context) {
return new JsonPrimitive(src.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); // "yyyy-mm-dd"
}
}
| 1,805 | 0.705263 | 0.699723 | 50 | 35.099998 | 36.185219 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.56 | false | false | 5 |
00e6fca92c7ee4ac10a44d83a5cabc1989e9e26e | 7,086,696,041,694 | 9bc3c3c74138b064c4da81ac26f82cec7fe58ce7 | /src/java/model/service/AdminService.java | a235266e70bbe27086d610dc48a4dc3fdeb80ed0 | [] | no_license | zaharij/Periodicals | https://github.com/zaharij/Periodicals | 49c8705fdb8b3cb8cd00fe5699297ddb1de85b33 | 2895cd876b6342e2945e3b4062d91184840db66b | refs/heads/master | "2020-12-24T12:20:07.067000" | "2016-09-27T15:08:20" | "2016-09-27T15:08:20" | 65,726,390 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 model.service;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import model.dao.impl.AdminDao;
import model.dao.impl.ArticlesDao;
import static model.service.constants.ConstantsLogic.*;
/**
* AdminService
* @author Zakhar
*/
public class AdminService {
private AdminDao adminDao = new AdminDao();
private ArticlesDao articleDao = new ArticlesDao();
private UserService userService = new UserService();
/**
* payForArticles
* salaries for authors
*/
public void payForArticles(){
try{
Timestamp dateCurrent = new Timestamp(System.currentTimeMillis());
List<String> authorsForPayList = null;
HashMap<String, Double> freezedMap = adminDao.getFreezedListByDate(dateCurrent);
Set mapKeysPeriodicals = freezedMap.keySet();
for (Object periodicalObject: mapKeysPeriodicals){
String periodical = periodicalObject.toString();
articleDao.getAuthorsForPayList(periodical, dateCurrent);
double moneyPart = freezedMap.get(periodical)/authorsForPayList.size();
for(String email: authorsForPayList){
userService.replenishAccount(email, moneyPart);
}
}
adminDao.deleteFreezed (dateCurrent);
adminDao.updateFreezed(dateCurrent);
}catch(RuntimeException ex){
}
}
/**
* checkLoginFields
* check if login fields is correct
* @param login
* @param password
* @return result (boolean)
*/
public boolean checkLoginFields(String login, String password){
if (userService.checkField(login, CHECK_ADMIN_LOGIN_REG) && userService.checkField(password, CHECK_PASSWORD_REG)){
return true;
}
return false;
}
/**
* checkLogin
* check if password for user is true
* @return result (boolean)
*/
public boolean checkLogin(String login, int passwordInput){
try{
int passwordTrue = adminDao.getSuperAdminPassword(login);
if (passwordTrue.equals(passwordInput)){
return true;
} else{
return false;
}
}catch (RuntimeException ex){
return false;
}
}
/**
* setAdminRightsTrue
* @param email
*/
public void setAdminRightsTrue (String email){
try{
adminDao.setAdminRights(email, IS_ADMIN);
}catch (RuntimeException ex){
}
}
/**
* setAdminRightsFalse
* @param email
*/
public void setAdminRightsFalse (String email){
try{
adminDao.setAdminRights(email, IS_ADMIN_DEFAULT);
}catch (RuntimeException ex){
}
}
}
| UTF-8 | Java | 3,171 | java | AdminService.java | Java | [
{
"context": "stantsLogic.*;\r\n\r\n/**\r\n * AdminService\r\n * @author Zakhar\r\n */\r\npublic class AdminService {\r\n priva",
"end": 480,
"score": 0.6136218309402466,
"start": 479,
"tag": "NAME",
"value": "Z"
},
{
"context": "antsLogic.*;\r\n\r\n/**\r\n * AdminService\r\n * @author Zakhar\r\n */\r\npublic class AdminService {\r\n private Ad",
"end": 485,
"score": 0.7239279747009277,
"start": 480,
"tag": "USERNAME",
"value": "akhar"
}
] | null | [] | /*
* 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 model.service;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import model.dao.impl.AdminDao;
import model.dao.impl.ArticlesDao;
import static model.service.constants.ConstantsLogic.*;
/**
* AdminService
* @author Zakhar
*/
public class AdminService {
private AdminDao adminDao = new AdminDao();
private ArticlesDao articleDao = new ArticlesDao();
private UserService userService = new UserService();
/**
* payForArticles
* salaries for authors
*/
public void payForArticles(){
try{
Timestamp dateCurrent = new Timestamp(System.currentTimeMillis());
List<String> authorsForPayList = null;
HashMap<String, Double> freezedMap = adminDao.getFreezedListByDate(dateCurrent);
Set mapKeysPeriodicals = freezedMap.keySet();
for (Object periodicalObject: mapKeysPeriodicals){
String periodical = periodicalObject.toString();
articleDao.getAuthorsForPayList(periodical, dateCurrent);
double moneyPart = freezedMap.get(periodical)/authorsForPayList.size();
for(String email: authorsForPayList){
userService.replenishAccount(email, moneyPart);
}
}
adminDao.deleteFreezed (dateCurrent);
adminDao.updateFreezed(dateCurrent);
}catch(RuntimeException ex){
}
}
/**
* checkLoginFields
* check if login fields is correct
* @param login
* @param password
* @return result (boolean)
*/
public boolean checkLoginFields(String login, String password){
if (userService.checkField(login, CHECK_ADMIN_LOGIN_REG) && userService.checkField(password, CHECK_PASSWORD_REG)){
return true;
}
return false;
}
/**
* checkLogin
* check if password for user is true
* @return result (boolean)
*/
public boolean checkLogin(String login, int passwordInput){
try{
int passwordTrue = adminDao.getSuperAdminPassword(login);
if (passwordTrue.equals(passwordInput)){
return true;
} else{
return false;
}
}catch (RuntimeException ex){
return false;
}
}
/**
* setAdminRightsTrue
* @param email
*/
public void setAdminRightsTrue (String email){
try{
adminDao.setAdminRights(email, IS_ADMIN);
}catch (RuntimeException ex){
}
}
/**
* setAdminRightsFalse
* @param email
*/
public void setAdminRightsFalse (String email){
try{
adminDao.setAdminRights(email, IS_ADMIN_DEFAULT);
}catch (RuntimeException ex){
}
}
}
| 3,171 | 0.589404 | 0.589404 | 102 | 29.088236 | 24.597984 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.401961 | false | false | 5 |
a49185fdde99bee7239f9f0db3d78de3495d6ae3 | 20,109,036,939,911 | 9c0924aa07e4cb6d8ae8f4c31a0749eac8c3a4db | /engagement_int/src/com/netease/common/http/multidown/DownloadService.java | 8bb9077e229695be67358d66d8e1b294c63e0ff5 | [] | no_license | treejames/Yuehui | https://github.com/treejames/Yuehui | be76d7f1e244b5f46269ed40fa9d683ff811c197 | cb06eebd95a7dc105627837a87535efc77ee4b55 | refs/heads/master | "2016-09-06T06:02:43.756000" | "2014-11-26T15:36:54" | "2014-11-26T15:36:54" | 31,499,439 | 2 | 0 | null | true | "2015-03-01T14:51:05" | "2015-03-01T14:51:05" | "2015-03-01T14:51:04" | "2014-11-26T15:36:55" | 21,308 | 0 | 0 | 0 | null | null | null | package com.netease.common.http.multidown;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;
import com.netease.common.config.IConfig;
public class DownloadService extends Service implements IConfig, DownloadListener {
private static final String TAG = "DownloadService";
/************************以下 IConfig可配置项******************************/
// 下载线程个数
public static int DownloadThreadCount = 3;
// 最小多线程下载文件大小
public static int MinMultiDownloadSize = 4 * 1024; // 100KB
/************************以上 IConfig可配置项******************************/
public static final String ACTION_START_DOWNLOAD = "start";
public static final String ACTION_STOP_DOWNLOAD = "stop";
public static final String DOWNLOAD_TASK = "task";
private HashMap<String, DownloadState> mDownloadingMap
= new HashMap<String, DownloadState>();
private LinkedList<DownloadState> mWaitingTasks
= new LinkedList<DownloadState>();
ThreadPoolExecutor mPoolExecutor;
LinkedBlockingQueue<Runnable> mBlockingQueue;
private static HashSet<DownloadListener> mListeners = new HashSet<DownloadListener>();
public static void registerDownloatListener(DownloadListener listener) {
if (listener != null) {
mListeners.add(listener);
}
}
public static void unRegisterDownloatListener(DownloadListener listener) {
mListeners.remove(listener);
}
@Override
public void onCreate() {
super.onCreate();
Log.e(TAG, "onCreate ");
mBlockingQueue = new LinkedBlockingQueue<Runnable>();
mPoolExecutor = new ThreadPoolExecutor(DownloadThreadCount,
DownloadThreadCount, 1000, TimeUnit.MICROSECONDS, mBlockingQueue);
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
Log.e(TAG, "onStart " + intent);
if (intent != null && intent.getAction() != null) {
String action = intent.getAction().intern();
DownloadTask task = intent.getParcelableExtra(DOWNLOAD_TASK);
if (action == ACTION_START_DOWNLOAD) {
startDownload(task);
} else if (action == ACTION_STOP_DOWNLOAD) {
stopDownload(task);
}
}
}
@Override
public void onDestroy() {
super.onDestroy();
Log.e(TAG, "onDestroy");
if (mPoolExecutor != null) {
mPoolExecutor.shutdown();
mPoolExecutor = null;
}
}
@Override
public IBinder onBind(Intent intent) {
Log.e(TAG, "obBind " + intent);
if (intent != null && intent.getAction() != null) {
String action = intent.getAction().intern();
DownloadTask task = intent.getParcelableExtra(DOWNLOAD_TASK);
if (action == ACTION_START_DOWNLOAD) {
startDownload(task);
} else if (action == ACTION_STOP_DOWNLOAD) {
stopDownload(task);
}
}
return null;
}
private void startDownload(DownloadTask task) {
Log.e(TAG, "startDownload url: " + task.getUrl());
if (mDownloadingMap.containsKey(task.getUrl())) {
return ;
}
DownloadState state = DownloadPreference.getDownloadState(getApplicationContext(), task.getUrl());
if (state != null && new File(state.mTargetPath + "_tmp").length() == state.mTotalSize) {
notifyDownloadState(state);
} else {
state = new DownloadState();
state.mUrl = task.getUrl();
state.mTargetPath = task.getTargetPath();
}
state.mTitle = task.getTitle();
mDownloadingMap.put(state.mUrl, state);
DownloadRunnable runnable = new DownloadRunnable(getApplicationContext(),
mPoolExecutor, state, -1, this);
mPoolExecutor.execute(runnable);
}
private void stopDownload(DownloadTask task) {
Log.e(TAG, "stopDownload url: " + task.getUrl());
DownloadState state = mDownloadingMap.remove(task.getUrl());
if (state != null) {
state.doCancel();
notifyDownloadState(state);
}
}
@Override
public void notifyDownloadState(DownloadState state) {
Log.e(TAG, "DownJson: " + state.toJSONString());
mHandler.sendMessage(mHandler.obtainMessage(0, state));
}
Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
DownloadState state = (DownloadState) msg.obj;
List<DownloadListener> list = new LinkedList<DownloadListener>();
list.addAll(mListeners);
if (list.size() > 0) {
for (DownloadListener listener : list) {
listener.notifyDownloadState(state);
}
}
}
};
}
| UTF-8 | Java | 4,895 | java | DownloadService.java | Java | [] | null | [] | package com.netease.common.http.multidown;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;
import com.netease.common.config.IConfig;
public class DownloadService extends Service implements IConfig, DownloadListener {
private static final String TAG = "DownloadService";
/************************以下 IConfig可配置项******************************/
// 下载线程个数
public static int DownloadThreadCount = 3;
// 最小多线程下载文件大小
public static int MinMultiDownloadSize = 4 * 1024; // 100KB
/************************以上 IConfig可配置项******************************/
public static final String ACTION_START_DOWNLOAD = "start";
public static final String ACTION_STOP_DOWNLOAD = "stop";
public static final String DOWNLOAD_TASK = "task";
private HashMap<String, DownloadState> mDownloadingMap
= new HashMap<String, DownloadState>();
private LinkedList<DownloadState> mWaitingTasks
= new LinkedList<DownloadState>();
ThreadPoolExecutor mPoolExecutor;
LinkedBlockingQueue<Runnable> mBlockingQueue;
private static HashSet<DownloadListener> mListeners = new HashSet<DownloadListener>();
public static void registerDownloatListener(DownloadListener listener) {
if (listener != null) {
mListeners.add(listener);
}
}
public static void unRegisterDownloatListener(DownloadListener listener) {
mListeners.remove(listener);
}
@Override
public void onCreate() {
super.onCreate();
Log.e(TAG, "onCreate ");
mBlockingQueue = new LinkedBlockingQueue<Runnable>();
mPoolExecutor = new ThreadPoolExecutor(DownloadThreadCount,
DownloadThreadCount, 1000, TimeUnit.MICROSECONDS, mBlockingQueue);
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
Log.e(TAG, "onStart " + intent);
if (intent != null && intent.getAction() != null) {
String action = intent.getAction().intern();
DownloadTask task = intent.getParcelableExtra(DOWNLOAD_TASK);
if (action == ACTION_START_DOWNLOAD) {
startDownload(task);
} else if (action == ACTION_STOP_DOWNLOAD) {
stopDownload(task);
}
}
}
@Override
public void onDestroy() {
super.onDestroy();
Log.e(TAG, "onDestroy");
if (mPoolExecutor != null) {
mPoolExecutor.shutdown();
mPoolExecutor = null;
}
}
@Override
public IBinder onBind(Intent intent) {
Log.e(TAG, "obBind " + intent);
if (intent != null && intent.getAction() != null) {
String action = intent.getAction().intern();
DownloadTask task = intent.getParcelableExtra(DOWNLOAD_TASK);
if (action == ACTION_START_DOWNLOAD) {
startDownload(task);
} else if (action == ACTION_STOP_DOWNLOAD) {
stopDownload(task);
}
}
return null;
}
private void startDownload(DownloadTask task) {
Log.e(TAG, "startDownload url: " + task.getUrl());
if (mDownloadingMap.containsKey(task.getUrl())) {
return ;
}
DownloadState state = DownloadPreference.getDownloadState(getApplicationContext(), task.getUrl());
if (state != null && new File(state.mTargetPath + "_tmp").length() == state.mTotalSize) {
notifyDownloadState(state);
} else {
state = new DownloadState();
state.mUrl = task.getUrl();
state.mTargetPath = task.getTargetPath();
}
state.mTitle = task.getTitle();
mDownloadingMap.put(state.mUrl, state);
DownloadRunnable runnable = new DownloadRunnable(getApplicationContext(),
mPoolExecutor, state, -1, this);
mPoolExecutor.execute(runnable);
}
private void stopDownload(DownloadTask task) {
Log.e(TAG, "stopDownload url: " + task.getUrl());
DownloadState state = mDownloadingMap.remove(task.getUrl());
if (state != null) {
state.doCancel();
notifyDownloadState(state);
}
}
@Override
public void notifyDownloadState(DownloadState state) {
Log.e(TAG, "DownJson: " + state.toJSONString());
mHandler.sendMessage(mHandler.obtainMessage(0, state));
}
Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
DownloadState state = (DownloadState) msg.obj;
List<DownloadListener> list = new LinkedList<DownloadListener>();
list.addAll(mListeners);
if (list.size() > 0) {
for (DownloadListener listener : list) {
listener.notifyDownloadState(state);
}
}
}
};
}
| 4,895 | 0.675212 | 0.671904 | 169 | 26.621302 | 23.788486 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.177515 | false | false | 5 |
4224784666daeee97ab0a8440ab4b98c56a801cb | 19,481,971,655,835 | 1dc252dbc1f2999452228dfd07b6a344ded0e1be | /src/main/java/com/github/phf/jb/Flags.java | c74553ea41cebabf98f1bf56913cd84429d6eef3 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | permissive | phf/jb | https://github.com/phf/jb | 9f9b907289b80795522bb98ed6651b5616e11b6c | 1a43076e71afa4a3850b136f0c23a3c6bddb0196 | refs/heads/master | "2020-12-25T16:57:05.539000" | "2018-06-17T03:16:38" | "2018-06-17T03:16:38" | 57,876,468 | 6 | 3 | null | false | "2016-09-20T20:14:02" | "2016-05-02T08:58:35" | "2016-05-02T16:02:14" | "2016-09-20T20:14:01" | 111 | 1 | 1 | 0 | Java | null | null | package com.github.phf.jb;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Flags is a simplistic parser for command-line flags. You know, things like
* "cat -n -v oh no" and friends. Flags can be strings (yay!) but they always
* require a value after them (boo!) for consistency. (Yes, even booleans.)
*
* Use string, bool, integer to register handlers for flags. Note that Java 8
* lambdas often result in one-liners here. Neat?
*
* TODO don't write to stderr directly, let main do it
* TODO write a real flags package that could stand on its own
*/
final class Flags {
/**
* Flagger and friends interpret flags. Yes, we hardcode the different
* kinds of flags we can handle, sorry. Extensibility would be nice but it
* comes at too steep a price.
*/
interface Flagger {
}
interface Stringer extends Flagger {
void set(String s);
}
interface Booler extends Flagger {
void set(Boolean b);
}
interface Inter extends Flagger {
void set(Integer i);
}
private HashMap<String, Flagger> flags = new HashMap<String, Flagger>();
void string(String flag, Stringer s) {
this.flags.put(flag, s);
}
void bool(String flag, Booler b) {
this.flags.put(flag, b);
}
void integer(String flag, Inter i) {
this.flags.put(flag, i);
}
/**
* Parse the given arguments for flags. Each actual flag found is checked
* as far as possible and then the corresponding handler is invoked. The
* remaining arguments are collected and returned as "leftovers" for the
* main program to deal with.
*/
String[] parse(String[] args) {
ArrayList<String> out = new ArrayList<String>();
for (int i = 0; i < args.length; i++) {
if (!args[i].startsWith("-")) {
out.add(args[i]);
continue;
}
String f = args[i].substring(1);
if (!this.flags.containsKey(f)) {
System.err.printf("unknown flag -%s%n", f);
continue;
}
if (i + 1 >= args.length) {
System.err.printf("flag -%s requires argument%n", f);
continue;
}
String d = args[i + 1];
i++;
Flagger q = this.flags.get(f);
if (q instanceof Stringer) {
Stringer r = (Stringer) q;
r.set(d);
} else if (q instanceof Booler) {
Booler r = (Booler) q;
if ("true".equals(d)) {
r.set(true);
} else if ("false".equals(d)) {
r.set(false);
} else {
System.err.printf(
"invalid boolean %s, should be true or false%n",
d
);
}
} else if (q instanceof Inter) {
Inter r = (Inter) q;
r.set(Integer.valueOf(d));
} else {
System.err.printf("unknown flagger %s%n", q);
}
}
String[] x = new String[out.size()];
return out.toArray(x);
}
}
| UTF-8 | Java | 3,229 | java | Flags.java | Java | [] | null | [] | package com.github.phf.jb;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Flags is a simplistic parser for command-line flags. You know, things like
* "cat -n -v oh no" and friends. Flags can be strings (yay!) but they always
* require a value after them (boo!) for consistency. (Yes, even booleans.)
*
* Use string, bool, integer to register handlers for flags. Note that Java 8
* lambdas often result in one-liners here. Neat?
*
* TODO don't write to stderr directly, let main do it
* TODO write a real flags package that could stand on its own
*/
final class Flags {
/**
* Flagger and friends interpret flags. Yes, we hardcode the different
* kinds of flags we can handle, sorry. Extensibility would be nice but it
* comes at too steep a price.
*/
interface Flagger {
}
interface Stringer extends Flagger {
void set(String s);
}
interface Booler extends Flagger {
void set(Boolean b);
}
interface Inter extends Flagger {
void set(Integer i);
}
private HashMap<String, Flagger> flags = new HashMap<String, Flagger>();
void string(String flag, Stringer s) {
this.flags.put(flag, s);
}
void bool(String flag, Booler b) {
this.flags.put(flag, b);
}
void integer(String flag, Inter i) {
this.flags.put(flag, i);
}
/**
* Parse the given arguments for flags. Each actual flag found is checked
* as far as possible and then the corresponding handler is invoked. The
* remaining arguments are collected and returned as "leftovers" for the
* main program to deal with.
*/
String[] parse(String[] args) {
ArrayList<String> out = new ArrayList<String>();
for (int i = 0; i < args.length; i++) {
if (!args[i].startsWith("-")) {
out.add(args[i]);
continue;
}
String f = args[i].substring(1);
if (!this.flags.containsKey(f)) {
System.err.printf("unknown flag -%s%n", f);
continue;
}
if (i + 1 >= args.length) {
System.err.printf("flag -%s requires argument%n", f);
continue;
}
String d = args[i + 1];
i++;
Flagger q = this.flags.get(f);
if (q instanceof Stringer) {
Stringer r = (Stringer) q;
r.set(d);
} else if (q instanceof Booler) {
Booler r = (Booler) q;
if ("true".equals(d)) {
r.set(true);
} else if ("false".equals(d)) {
r.set(false);
} else {
System.err.printf(
"invalid boolean %s, should be true or false%n",
d
);
}
} else if (q instanceof Inter) {
Inter r = (Inter) q;
r.set(Integer.valueOf(d));
} else {
System.err.printf("unknown flagger %s%n", q);
}
}
String[] x = new String[out.size()];
return out.toArray(x);
}
}
| 3,229 | 0.52524 | 0.523692 | 106 | 29.462265 | 23.496758 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.509434 | false | false | 5 |
68fb449801116839c2878d556d6ef4c78b9b7a39 | 30,820,685,346,664 | 2808e509c2177879241f29e61c6f4e5653237f1d | /src/com/evaluation/URLify.java | 8a62a3b754af33bd8a433653702f82d073a5ceb7 | [] | no_license | rfnunes/docker | https://github.com/rfnunes/docker | bd8fbb55ef44b68f86b3b5ec281ed82e34c1f29c | d24cf91a6f8af8299686793a606db63c50c296b2 | refs/heads/master | "2021-05-04T23:10:58.833000" | "2018-01-24T22:26:36" | "2018-01-24T22:26:36" | 120,085,824 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.evaluation;
import com.util.Util;
public class URLify {
public static void main(String[] args) {
new URLify().go("http://www.sapo.pt/My Web Page.html ");
}
private void go(String s) {
char[] chars = s.toCharArray();
for(int i = 0; i < chars.length-3; i++) {
char c = chars[i];
if(c == ' ') {
for(int j = chars.length - 4; j >= i; j--) {
chars[j+3] = chars[j+2];
chars[j+2] = chars[j+1];
chars[j+1] = chars[j];
}
chars[i] = '%';
chars[i+1] = '2';
chars[i+2] = '0';
}
}
System.out.println(Util.getArrayAsString(chars, false));
}
}
| UTF-8 | Java | 814 | java | URLify.java | Java | [] | null | [] | package com.evaluation;
import com.util.Util;
public class URLify {
public static void main(String[] args) {
new URLify().go("http://www.sapo.pt/My Web Page.html ");
}
private void go(String s) {
char[] chars = s.toCharArray();
for(int i = 0; i < chars.length-3; i++) {
char c = chars[i];
if(c == ' ') {
for(int j = chars.length - 4; j >= i; j--) {
chars[j+3] = chars[j+2];
chars[j+2] = chars[j+1];
chars[j+1] = chars[j];
}
chars[i] = '%';
chars[i+1] = '2';
chars[i+2] = '0';
}
}
System.out.println(Util.getArrayAsString(chars, false));
}
}
| 814 | 0.404177 | 0.389435 | 30 | 25.133333 | 20.556805 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.566667 | false | false | 5 |
c1fc335e415b429aeb1056b5748ee127a4e29048 | 30,176,440,237,235 | 891e41e920db969538ace5a33bcff19676487170 | /src/main/java/com/skidata/uiPages/chbackoffice/EditArticlePage.java | b4529fee7b64c5ec26c96316b68dbc82978fba59 | [] | no_license | shahidbit84/download | https://github.com/shahidbit84/download | b748f5701aef30b39d533c68a3ec4b731ba5c341 | 9310269da26e43542a83791b38000c3c73a5e04f | refs/heads/master | "2020-05-19T16:16:19.971000" | "2019-05-06T01:55:37" | "2019-05-06T01:55:37" | 185,103,786 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package com.skidata.uiPages.chbackoffice;
import java.awt.AWTException;
import java.io.IOException;
import java.util.List;
import org.apache.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.relevantcodes.extentreports.ExtentTest;
import com.skidata.helperclasses.MouseKeyboardHelper;
import com.skidata.helperclasses.WaitHelper;
import com.skidata.testBase.TestBase;
import com.skidata.util.ConstantValues;
/**
* @author shmo
*
*/
public class EditArticlePage extends TestBase {
WaitHelper wh = new WaitHelper(driver,test);
MouseKeyboardHelper mkh = new MouseKeyboardHelper(driver,test);
String status=null;
public static final Logger log = Logger.getLogger(EditArticlePage.class.getName());
//Class constructor
public EditArticlePage(WebDriver driver,ExtentTest test) {
this.driver = driver;
this.test=test;
PageFactory.initElements(driver, this);
}
/**
******************************************************************************************************
* Web Elements of the page
******************************************************************************************************
*/
@FindBy(xpath = "//span[@class='v-label' and text()='LOADING...']")
public WebElement loadingprogress;
@FindBy(xpath = "//span[@class='v-label' and text()='SAVING...']")
public WebElement savingprogress;
@FindBy(xpath = "//input[@v-model='model.article.name']")
public WebElement ArticleName_inputfield;
@FindBy(xpath = "//textarea[@v-model='model.article.description']")
public WebElement LocalizedDescription_inputfield;
@FindBy(xpath = "//div[@v-model='model.article.localizedNames']//div[@class='v-button-icon v-25-multilingual-error']")
public WebElement AddLocalizedNameIcon;
@FindBy(xpath = "//div[@v-model='model.article.localizedDescriptions']//div[@class='v-button-icon v-25-multilingual-error']")
public WebElement AddLocalizedDescriptionsIcon;
@FindBy(xpath = "//div[contains(@v-label,'CHPortal.LocaleLabel')]//span[@class='k-dropdown-wrap k-state-default']")
public WebElement LocaleDropdownSelect;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//div[contains(@v-label,'CHPortal.LocaleLabel')]//div//span/span[@class='k-input ng-scope']")
public WebElement LocaleDropdownSelectforLocalizedDescriptionPopup;
@FindBy(xpath = "//input[@v-locale='ui.locale.locale']")
public WebElement LocalizedName_inputfield;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//textarea")
public WebElement LocalizedDescriptiontextinpopup_inputfield;
@FindBy(xpath = "//button[@translate='VSMKendoMessages.DONE']")
public WebElement AddLocalizedName_DoneButton;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//button[@translate='VSMKendoMessages.DONE']")
public WebElement AddLocalizedDescription_DoneButton;
@FindBy(xpath = "//div[contains(@v-label,'SSPArticle.ArticleForm-selectProduct')]//div//span[@class='k-dropdown-wrap k-state-default']")
public WebElement SelectProductDD;
@FindBy(xpath = "//div[@class='task-close ng-scope']")
public WebElement taskcloseicon;
@FindBy(xpath = "//p[@class='ng-scope' and @translate='SSPArticle.EditArticleHeader']")
public WebElement pageHeader;
@FindBy(xpath = "//div[@v-model='model.article.localizedNames']//div[@id='button-icon']")
public WebElement ProductNameLocalizedEarthIcon;
@FindBy(xpath = "//div[@v-model='model.article.localizedDescriptions']//div[@id='button-icon']")
public WebElement ProductDescriptionLocalizedEarthIcon;
@FindBy(xpath = "//div[contains(@k-title,'Add localized names')]//div[contains(@v-label,'CHPortal.LocaleLabel')]//span[@class='k-input ng-scope']")
public WebElement AddlocalizedNamesPopUP_localeDropdown;
@FindBy(xpath = "//div[contains(@ k-title,'Add localized descriptions')]//div[contains(@v-label,'CHPortal.LocaleLabel')]//span[@class='k-input ng-scope']")
public WebElement AddlocalizedDescriptionPopUP_localeDropdown;
@FindBy(xpath = "//input[@v-locale='ui.locale.locale']")
public WebElement AddlocalizedNamesPopUP_LocalizedNamesInputfield;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//textarea")
public WebElement AddlocalizedNamesPopUP_LocalizedDescriptionInputfield;
@FindBy(xpath = "//div[contains(@k-title,'Add localized names')]//button[@translate='VSMKendoMessages.SAVE']")
public WebElement SaveLocalizedNames;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//button[@translate='VSMKendoMessages.SAVE']")
public WebElement SaveLocalizeddescriptions;
@FindBy(xpath = "//li[@id='ssp_article_edit_save']")
public WebElement Save;
@FindBy(xpath = "//li[@id='ssp_article_edit_cancel']")
public WebElement Cancel;
@FindBy(xpath = "//li[@id='ssp_article_edit_upload_image']")
public WebElement UploadImage;
@FindBy(xpath = "//li[@id='ssp_article_edit_add_properties']")
public WebElement AddProperties;
@FindBy(xpath = "//li[@id='ssp_article_edit_update_properties']")
public WebElement EditProperties;
@FindBy(xpath = "//li[@id='ssp_article_edit_additional_articles']")
public WebElement ManageAdditionalProperties;
@FindBy(xpath = "//li[@id='ssp_article_edit_pricing']")
public WebElement Pricing;
@FindBy(xpath = "//li[@id='ssp_article_edit_subscription_plans']")
public WebElement SubscriptionPlans;
@FindBy(xpath = "//li[@id='ssp_saleschannel_theme_logo']")
public WebElement CloneConfirmationMessage;
@FindBy(xpath = "//button[@translate='VSMCommon.ButtonOk']")
public WebElement OKButton;
@FindBy(xpath = "//input[@ v-model='model.newProperty.localizedAttributes']")
public WebElement textField_PropertyName;
@FindBy(xpath = "//textarea[@ v-model='model.newProperty.localizedDescriptions']")
public WebElement textArea_PropertyDescription;
@FindBy(xpath = "//div[@kendo-window='ui.addPropertyWindow']//div[contains(@v-label,'SSPArticle.LocaleSelector-LabelName')]//span[@class='k-input ng-scope']")
public WebElement dropDownList_PropertyLocale;
@FindBy(xpath = "//input[@v-model='model.newProperty.localizedMeasurementUnit']")
public WebElement textField_PropertyMeasurementUnit;
@FindBy(xpath = "//input[@v-model='model.newProperty.localizedValue']")
public WebElement textField_PropertyValue;
@FindBy(xpath = "//html/body/div[20]/div[2]/div/form/div[11]/div[1]/div/div/div/button")
public WebElement button_SaveProperties;
@FindBy(xpath = "//span[@translate='SSPArticle.propertiesHeader-properties']")
public WebElement labelDropDown_GeneralProperties;
@FindBy(xpath = "//div[@kendo-grid='model.propertiesGrid']//tr//th[1]")
public WebElement column_GeneralPropertiesName;
@FindBy(xpath = "//div[@kendo-grid='model.propertiesGrid']//tr//th[2]")
public WebElement column_GeneralPropertiesValue;
@FindBy(xpath = "//div[@kendo-grid='model.propertiesGrid']//tr//th[3]")
public WebElement column_GeneralPropertiesType;
/**
* Method to click on X task header Control icon
*/
public void clickonXtaskHeaderControlicon() {
taskcloseicon.click();
log("clicked on the X icon in the Task Header label");
takeScreenShot();
}
//****************************************************************************************************************
public void selectLocale(String _LocaleValue) {
driver.findElement(By.xpath("//div[contains(@v-label,'SSPArticle.LocaleSelector-LabelName')]//span[@class='k-widget k-dropdown k-header ng-scope']")).click();
WebElement locale = driver.findElement(By.xpath("//li[text()='"+_LocaleValue+"']"));
clickElementUsingJavaScript(locale);
}
/**
*
* @throws InterruptedException
* @throws AWTException
*/
public void addArticledetails(String _ArticleName,String _LocaleinputforallLocales,String _LocalizedNameforallLocales,String _Description,
String LocalizedDescriptiontextinpopup,String _SelectProduct) throws InterruptedException, AWTException {
ArticleName_inputfield.sendKeys(_ArticleName);
log("Entered the Article name as "+_ArticleName);
AddLocalizedNameIcon.click();
Thread.sleep(3000);
LocaleDropdownSelect.click();
Thread.sleep(3000);
WebElement locale = driver.findElement(By.xpath("//li[@class='k-item ng-scope k-state-selected k-state-focused' and text()='"+_LocaleinputforallLocales+"']"));
Thread.sleep(3000);
clickElementUsingJavaScript(locale);
Thread.sleep(3000);
LocalizedName_inputfield.sendKeys(_LocalizedNameforallLocales);
Thread.sleep(3000);
AddLocalizedName_DoneButton.click();
clickElementUsingJavaScript(AddLocalizedDescriptionsIcon);
Thread.sleep(3000);
//LocaleDropdownSelectforLocalizedDescriptionPopup.click();
Thread.sleep(3000);
// WebElement s = driver.findElement(By.xpath("//div[@class='k-animation-container']//ul[@class='k-list k-reset']//li[text()='English - Australia']"));
// Thread.sleep(4000);
// clickElementUsingJavaScript(s);
LocalizedDescriptiontextinpopup_inputfield.sendKeys(LocalizedDescriptiontextinpopup);
AddLocalizedDescription_DoneButton.click();
LocalizedDescription_inputfield.sendKeys(_Description);
wh.waitForElementToBeClickable(SelectProductDD, driver, 30);
clickElementUsingJavaScript(SelectProductDD);
WebElement productToSelect = driver.findElement(By.xpath("//li[@class='k-item ng-scope' and text()='"+_SelectProduct+"']"));
Thread.sleep(5000);
clickElementUsingJavaScript(productToSelect);
}
public void clickonSave() throws InterruptedException {
wh.waitForElementToBeVisible(Save, driver, 10);
Thread.sleep(3000);
clickElementUsingJavaScript(Save);
}
/**
* Method to verify Icon Labels and Header in Edit Article page
* @param _SaveLabel
* @param _CancelLabel
* @param _PageHeaderAddArticle
* @param _ArticleName
* @param _PageHeaderAfterEnteringName
* @return
* @throws InterruptedException
*/
public String verifyIconLabelsAndHeader(String _SaveLabel,String _CancelLabel,String _UploadImage,String _AddProperties
,String _EditProperties,String _ManageAdditionalProperties,String _Pricing,String _PageHeader,String _Name,String _UpdatedHeader) throws InterruptedException {
status="FAIL";
if(Save.getText().equals(_SaveLabel)) {
log("Save button is displayed ");
if(Cancel.getText().equals(_CancelLabel)) {
log("Cancel button is displayed");
if(UploadImage.getText().equals(_UploadImage)) {
log(UploadImage.getText()+" is displayed in UI");
if(AddProperties.getText().equals(_AddProperties)) {
log(AddProperties.getText()+" is displayed in UI");
if(EditProperties.getText().equals(_EditProperties)) {
log(EditProperties.getText()+" is displayed in UI");
if(ManageAdditionalProperties.getText().equals(_ManageAdditionalProperties)) {
log(ManageAdditionalProperties.getText()+" is displayed in UI");
if(Pricing.getText().equals(_Pricing)) {
log(Pricing.getText()+" is displayed in UI");
log(pageHeader.getText());
if(pageHeader.getText().equals(_PageHeader)) {
log(pageHeader.getText()+" is displayed as header in UI");
ArticleName_inputfield.clear();
ArticleName_inputfield.sendKeys(_Name);
if(pageHeader.getText().equals(_UpdatedHeader))
log(pageHeader.getText()+" is displayed after edit of the Name");
takeScreenShot();
status="PASS";
}
}
}
}
}
}
}
}
return status;
}
public void editArticleDetails(String _Name,String _Description) throws InterruptedException, AWTException {
wh.waitForElementToBeClickable(ArticleName_inputfield, driver, 10);
ArticleName_inputfield.clear();
ArticleName_inputfield.sendKeys(_Name);
log("Entered the Name as "+_Name);
LocalizedDescription_inputfield.clear();
LocalizedDescription_inputfield.sendKeys(_Description);
log("Entered the Description");
takeScreenShot();
}
public void clickonAddLocalizedName() {
ProductNameLocalizedEarthIcon.click();
log("Clicked on the Add localized names icon");
takeScreenShot();
}
public void addlocalizednamesDetails(String _localeForAddlocalizedNames,String _LocalizedName) throws InterruptedException {
AddlocalizedNamesPopUP_localeDropdown.click();
// WebElement localevalue = driver.findElement(By.xpath("//div[8]/div/div[3]/ul/li[text()='"+_localeForAddlocalizedNames+"']"));
// wh.waitForElementToBeVisible(localevalue, driver, 10);
// Thread.sleep(4000);
// localevalue.click();
// log("Selected the locale of Add localized names as "+_localeForAddlocalizedNames);
AddlocalizedNamesPopUP_LocalizedNamesInputfield.clear();
AddlocalizedNamesPopUP_LocalizedNamesInputfield.sendKeys(_LocalizedName);
takeScreenShot();
SaveLocalizedNames.click();
log("Clicked on Save");
}
public void clickonAddLocalizedDescription() {
wh.waitForElementToBeVisible(ProductDescriptionLocalizedEarthIcon, driver, 10);
clickElementUsingJavaScript(ProductDescriptionLocalizedEarthIcon);
log("Clicked on the Add localized Description icon");
takeScreenShot();
}
public void addlocalizedDescriptionDetails(String _localeForAddlocalizedDescription,String _LocalizedNameDescription) throws InterruptedException {
// AddlocalizedDescriptionPopUP_localeDropdown.click();
//
// WebElement localevalue = driver.findElement(By.xpath("//div[10]/div/div[3]/ul/li[text()='"+_localeForAddlocalizedDescription+"']"));
// Thread.sleep(4000);
// localevalue.click();
// log("Selected the locale of Add localized names as "+_localeForAddlocalizedDescription);
AddlocalizedNamesPopUP_LocalizedDescriptionInputfield.clear();
AddlocalizedNamesPopUP_LocalizedDescriptionInputfield.sendKeys(_LocalizedNameDescription);
takeScreenShot();
SaveLocalizeddescriptions.click();
log("Clicked on Save");
}
public void SelectProductFromDropDown(String _SelectProductForArticle) {
wh.waitForElementToBeClickable(SelectProductDD, driver, 20);
clickElementUsingJavaScript(SelectProductDD);
log("Clicked on the Select Product Drop Down ");
WebElement dropdownProductValue = driver.findElement(By.xpath("//li[@class='k-item ng-scope' and text()='"+_SelectProductForArticle+"']"));
wh.waitForElementToBeClickable(dropdownProductValue, driver, 10);
clickElementUsingJavaScript(dropdownProductValue);
log("Selected the product "+_SelectProductForArticle);
takeScreenShot();
}
public String searchAndSelectArticleCreated(String _ArticleName,String _ProductNameOfArticle,String _Type,String _ArticleStatus) throws InterruptedException {
String status = "FAIL";
Thread.sleep(10000);
List<WebElement> tenantRows = driver.findElements(By.xpath("//table[@class='k-selectable']//tbody//tr"));
log("No of rows ="+tenantRows.size());
for(int i=0;i<tenantRows.size();i++) {
int j=i+1;
WebElement NameColumnValue = driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]/td[1]"));
WebElement ProductColumnValue = driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]/td[2]"));
WebElement TypeColumnValue = driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]/td[3]"));
WebElement StatusColumnValue = driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]/td[4]"));
if(NameColumnValue.getText().equals(_ArticleName)) {
log(NameColumnValue.getText()+" is displayed in UI");
if(ProductColumnValue.getText().equals(_ProductNameOfArticle)) {
log(ProductColumnValue.getText()+" is displayed in UI");
if(TypeColumnValue.getText().equals(_Type)) {
log(TypeColumnValue.getText()+" is displayed in UI");
if(StatusColumnValue.getText().equals(_ArticleStatus)) {
log(StatusColumnValue.getText()+" is displayed in UI");
driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]")).click();
log("Product -> "+_ArticleName+" Searched and Selected ");
status ="PASS";
}
}
}
}
}
return status;
}
public String verifyCloneConfirmationMessage(String _CloneInformationMessage) {
status="FAIL";
List<WebElement> window = driver.findElements(By.xpath("//span[@class='k-window-title' and text()='Information']"));
if(window.size()==1) {
log(CloneConfirmationMessage.getText());
if(CloneConfirmationMessage.getText().equals(_CloneInformationMessage)) {
log("Information message displayed as "+CloneConfirmationMessage.getText());
takeScreenShot();
OKButton.click();
status="PASS";
}
}
return status;
}
public void clickonAddProperties() {
wh.waitForElementToBeVisible(AddProperties, driver, 10);
clickElementUsingJavaScript(AddProperties);
log("Clicked on the Add properties icon");
takeScreenShot();
}
public void AddPropertiesToArticleAndSave(String _PropertyName,String _PropertyDescription,String _PropertyLocaleValue,String _PropertyMeasurementUnit,
String _PropertyUnitValue,String _UploadImageForPropertyYesOrNo,String _Browser) throws IOException, AWTException, InterruptedException{
wh.waitForElementToBeClickable(textField_PropertyName, driver, 30);
textField_PropertyName.clear();
textField_PropertyName.sendKeys(_PropertyName);
log("Entered the Property Name as "+_PropertyName);
textArea_PropertyDescription.clear();
textArea_PropertyDescription.sendKeys(_PropertyDescription);
log("Entered the Description as "+_PropertyDescription);
//dropDownList_PropertyLocale.click();
//WebElement localeValue = driver.findElement(By.xpath("html/body/div[15]/div/div[3]/ul/li[text()='"+_PropertyLocaleValue+"']"));
//wh.waitForElementToBeClickable(localeValue, driver, 30);
//clickElementUsingJavaScript(localeValue);
//log("Property locale value selected as "+_PropertyLocaleValue);
textField_PropertyMeasurementUnit.clear();
textField_PropertyMeasurementUnit.sendKeys(_PropertyMeasurementUnit);
log("Measurement unit is entered as "+_PropertyMeasurementUnit);
textField_PropertyValue.clear();
textField_PropertyValue.sendKeys(_PropertyUnitValue);
log("Value is entered as "+_PropertyUnitValue);
if(_UploadImageForPropertyYesOrNo.equalsIgnoreCase("YES")) {
//button_Selectimage.click();
// uploadFile(_Browser, ConstantValues.LEFTLOGO_IMG);
mkh.pressTabKeyAndRelease();
mkh.pressEnterKeyAndRelease();
uploadFile(_Browser, ConstantValues.LEFTLOGO_IMG);
log("Image is uploaded");
takeScreenShot();
button_SaveProperties.click();
log("Clicked on the Save button in the dialog pop up");
Thread.sleep(5000);
}
}
public String searchAndSelectPropertiesAdded(String _GeneralPropertiesLabel_EditArticle,String _NameColHeader_EditArticle_Properties,
String _ValueColHeader_EditArticle_Properties,String _TypeColHeader_EditArticle_Properties,String _NamePropertyValue_EditArticlePage,
String _ValuePropertyValue_EditArticlePage, String _TypePropertyValue_EditArticlePage) {
status="FAIL";
wh.waitForElementToBeClickable(labelDropDown_GeneralProperties, driver, 30);
if(labelDropDown_GeneralProperties.getText().equals(_GeneralPropertiesLabel_EditArticle)) {
log(labelDropDown_GeneralProperties.getText()+" is displayed in UI");
wh.waitForElementToBeClickable(labelDropDown_GeneralProperties, driver, 30);
labelDropDown_GeneralProperties.click();
if(column_GeneralPropertiesName.getText().equals(_NameColHeader_EditArticle_Properties)) {
log(column_GeneralPropertiesName.getText()+" is displayed in UI");
if(column_GeneralPropertiesValue.getText().equals(_ValueColHeader_EditArticle_Properties)) {
log(column_GeneralPropertiesValue.getText()+" is displayed in UI");
if(column_GeneralPropertiesType.getText().equals(_TypeColHeader_EditArticle_Properties)) {
log(column_GeneralPropertiesType.getText()+" is displayed in UI");
List<WebElement> noOfRows = driver.findElements(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr"));
for(int i=0;i<noOfRows.size();i++) {
int j=i+1;
WebElement nameColumnValue = driver.findElement(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr["+j+"]//td[1]//span[1]"));
WebElement valueColumnValue = driver.findElement(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr["+j+"]//td[2]//span[1]"));
WebElement typeColumnValue = driver.findElement(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr["+j+"]//td[3]//span[1]"));
if(nameColumnValue.getText().equals(_NamePropertyValue_EditArticlePage)) {
if(valueColumnValue.getText().equals(_ValuePropertyValue_EditArticlePage)) {
if(typeColumnValue.getText().equals(_TypePropertyValue_EditArticlePage)) {
status="PASS";
takeScreenShot();
log("Name column value displayed under General properties "+nameColumnValue.getText());
log("Value column value displayed under General properties "+valueColumnValue.getText());
log("Type column value displayed under General properties "+typeColumnValue.getText());
driver.findElement(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr["+j+"]")).click();
}
}
}
}
}
}
}
}
return status;
}
public void clickonPricing() {
wh.waitForElementToBeClickable(Pricing, driver, 20);
Pricing.click();
log("clicked on Pricing icon");
takeScreenShot();
}
public void clickonCancel() {
wh.waitForElementToBeClickable(Cancel, driver, 20);
Cancel.click();
log("clicked on Cancel icon");
takeScreenShot();
}
public void clickOnSubscriptionPlans() throws InterruptedException {
Thread.sleep(5000);
clickElementUsingJavaScript(SubscriptionPlans);
log("Clicked on the Subscription plans icon");
takeScreenShot();
}
} | UTF-8 | Java | 22,096 | java | EditArticlePage.java | Java | [
{
"context": "t com.skidata.util.ConstantValues;\n\n/**\n * @author shmo\n * \n */\npublic class EditArticlePage extends Test",
"end": 616,
"score": 0.9996814131736755,
"start": 612,
"tag": "USERNAME",
"value": "shmo"
},
{
"context": "ment savingprogress;\n\n\t@FindBy(xpath = \"//input[@v-model='model.article.name']\")\n\tpublic WebElement A",
"end": 1555,
"score": 0.5536118745803833,
"start": 1555,
"tag": "EMAIL",
"value": ""
},
{
"context": "ingprogress;\n\n\t@FindBy(xpath = \"//input[@v-model='model.article.name']\")\n\tpublic WebElement ArticleName_inputfield;\n\n\t",
"end": 1581,
"score": 0.8545206785202026,
"start": 1563,
"tag": "EMAIL",
"value": "model.article.name"
},
{
"context": "eld;\n\n\t@FindBy(xpath = \"//textarea[@v-model='model.article.description']\")\n\tpublic WebElement LocalizedDescription_input",
"end": 1694,
"score": 0.6766074299812317,
"start": 1675,
"tag": "EMAIL",
"value": "article.description"
},
{
"context": "on_inputfield;\n\n\t@FindBy(xpath = \"//div[@v-model='model.article.localizedNames']//div[@class='v-button-icon v-25-multilingual-er",
"end": 1814,
"score": 0.7518602013587952,
"start": 1786,
"tag": "EMAIL",
"value": "model.article.localizedNames"
},
{
"context": "ropdown;\n\n\t@FindBy(xpath = \"//input[@v-locale='ui.locale.locale']\")\n\tpublic WebElement AddlocalizedNamesPo",
"end": 4189,
"score": 0.5069826245307922,
"start": 4183,
"tag": "EMAIL",
"value": "locale"
},
{
"context": ";\n\n\t@FindBy(xpath = \"//input[@v-locale='ui.locale.locale']\")\n\tpublic WebElement AddlocalizedNamesPopUP_Loc",
"end": 4196,
"score": 0.5916825532913208,
"start": 4190,
"tag": "EMAIL",
"value": "locale"
},
{
"context": "ties;\n\t\n\t@FindBy(xpath = \"//div[@kendo-grid='model.propertiesGrid']//tr//th[1]\")\n\tpublic WebElement column_GeneralP",
"end": 6773,
"score": 0.5764281153678894,
"start": 6759,
"tag": "EMAIL",
"value": "propertiesGrid"
}
] | null | [] | /**
*
*/
package com.skidata.uiPages.chbackoffice;
import java.awt.AWTException;
import java.io.IOException;
import java.util.List;
import org.apache.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.relevantcodes.extentreports.ExtentTest;
import com.skidata.helperclasses.MouseKeyboardHelper;
import com.skidata.helperclasses.WaitHelper;
import com.skidata.testBase.TestBase;
import com.skidata.util.ConstantValues;
/**
* @author shmo
*
*/
public class EditArticlePage extends TestBase {
WaitHelper wh = new WaitHelper(driver,test);
MouseKeyboardHelper mkh = new MouseKeyboardHelper(driver,test);
String status=null;
public static final Logger log = Logger.getLogger(EditArticlePage.class.getName());
//Class constructor
public EditArticlePage(WebDriver driver,ExtentTest test) {
this.driver = driver;
this.test=test;
PageFactory.initElements(driver, this);
}
/**
******************************************************************************************************
* Web Elements of the page
******************************************************************************************************
*/
@FindBy(xpath = "//span[@class='v-label' and text()='LOADING...']")
public WebElement loadingprogress;
@FindBy(xpath = "//span[@class='v-label' and text()='SAVING...']")
public WebElement savingprogress;
@FindBy(xpath = "//input[@v-model='<EMAIL>']")
public WebElement ArticleName_inputfield;
@FindBy(xpath = "//textarea[@v-model='model.<EMAIL>']")
public WebElement LocalizedDescription_inputfield;
@FindBy(xpath = "//div[@v-model='<EMAIL>']//div[@class='v-button-icon v-25-multilingual-error']")
public WebElement AddLocalizedNameIcon;
@FindBy(xpath = "//div[@v-model='model.article.localizedDescriptions']//div[@class='v-button-icon v-25-multilingual-error']")
public WebElement AddLocalizedDescriptionsIcon;
@FindBy(xpath = "//div[contains(@v-label,'CHPortal.LocaleLabel')]//span[@class='k-dropdown-wrap k-state-default']")
public WebElement LocaleDropdownSelect;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//div[contains(@v-label,'CHPortal.LocaleLabel')]//div//span/span[@class='k-input ng-scope']")
public WebElement LocaleDropdownSelectforLocalizedDescriptionPopup;
@FindBy(xpath = "//input[@v-locale='ui.locale.locale']")
public WebElement LocalizedName_inputfield;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//textarea")
public WebElement LocalizedDescriptiontextinpopup_inputfield;
@FindBy(xpath = "//button[@translate='VSMKendoMessages.DONE']")
public WebElement AddLocalizedName_DoneButton;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//button[@translate='VSMKendoMessages.DONE']")
public WebElement AddLocalizedDescription_DoneButton;
@FindBy(xpath = "//div[contains(@v-label,'SSPArticle.ArticleForm-selectProduct')]//div//span[@class='k-dropdown-wrap k-state-default']")
public WebElement SelectProductDD;
@FindBy(xpath = "//div[@class='task-close ng-scope']")
public WebElement taskcloseicon;
@FindBy(xpath = "//p[@class='ng-scope' and @translate='SSPArticle.EditArticleHeader']")
public WebElement pageHeader;
@FindBy(xpath = "//div[@v-model='model.article.localizedNames']//div[@id='button-icon']")
public WebElement ProductNameLocalizedEarthIcon;
@FindBy(xpath = "//div[@v-model='model.article.localizedDescriptions']//div[@id='button-icon']")
public WebElement ProductDescriptionLocalizedEarthIcon;
@FindBy(xpath = "//div[contains(@k-title,'Add localized names')]//div[contains(@v-label,'CHPortal.LocaleLabel')]//span[@class='k-input ng-scope']")
public WebElement AddlocalizedNamesPopUP_localeDropdown;
@FindBy(xpath = "//div[contains(@ k-title,'Add localized descriptions')]//div[contains(@v-label,'CHPortal.LocaleLabel')]//span[@class='k-input ng-scope']")
public WebElement AddlocalizedDescriptionPopUP_localeDropdown;
@FindBy(xpath = "//input[@v-locale='ui.<EMAIL>.<EMAIL>']")
public WebElement AddlocalizedNamesPopUP_LocalizedNamesInputfield;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//textarea")
public WebElement AddlocalizedNamesPopUP_LocalizedDescriptionInputfield;
@FindBy(xpath = "//div[contains(@k-title,'Add localized names')]//button[@translate='VSMKendoMessages.SAVE']")
public WebElement SaveLocalizedNames;
@FindBy(xpath = "//div[contains(@k-title,'Add localized descriptions')]//button[@translate='VSMKendoMessages.SAVE']")
public WebElement SaveLocalizeddescriptions;
@FindBy(xpath = "//li[@id='ssp_article_edit_save']")
public WebElement Save;
@FindBy(xpath = "//li[@id='ssp_article_edit_cancel']")
public WebElement Cancel;
@FindBy(xpath = "//li[@id='ssp_article_edit_upload_image']")
public WebElement UploadImage;
@FindBy(xpath = "//li[@id='ssp_article_edit_add_properties']")
public WebElement AddProperties;
@FindBy(xpath = "//li[@id='ssp_article_edit_update_properties']")
public WebElement EditProperties;
@FindBy(xpath = "//li[@id='ssp_article_edit_additional_articles']")
public WebElement ManageAdditionalProperties;
@FindBy(xpath = "//li[@id='ssp_article_edit_pricing']")
public WebElement Pricing;
@FindBy(xpath = "//li[@id='ssp_article_edit_subscription_plans']")
public WebElement SubscriptionPlans;
@FindBy(xpath = "//li[@id='ssp_saleschannel_theme_logo']")
public WebElement CloneConfirmationMessage;
@FindBy(xpath = "//button[@translate='VSMCommon.ButtonOk']")
public WebElement OKButton;
@FindBy(xpath = "//input[@ v-model='model.newProperty.localizedAttributes']")
public WebElement textField_PropertyName;
@FindBy(xpath = "//textarea[@ v-model='model.newProperty.localizedDescriptions']")
public WebElement textArea_PropertyDescription;
@FindBy(xpath = "//div[@kendo-window='ui.addPropertyWindow']//div[contains(@v-label,'SSPArticle.LocaleSelector-LabelName')]//span[@class='k-input ng-scope']")
public WebElement dropDownList_PropertyLocale;
@FindBy(xpath = "//input[@v-model='model.newProperty.localizedMeasurementUnit']")
public WebElement textField_PropertyMeasurementUnit;
@FindBy(xpath = "//input[@v-model='model.newProperty.localizedValue']")
public WebElement textField_PropertyValue;
@FindBy(xpath = "//html/body/div[20]/div[2]/div/form/div[11]/div[1]/div/div/div/button")
public WebElement button_SaveProperties;
@FindBy(xpath = "//span[@translate='SSPArticle.propertiesHeader-properties']")
public WebElement labelDropDown_GeneralProperties;
@FindBy(xpath = "//div[@kendo-grid='model.<EMAIL>']//tr//th[1]")
public WebElement column_GeneralPropertiesName;
@FindBy(xpath = "//div[@kendo-grid='model.propertiesGrid']//tr//th[2]")
public WebElement column_GeneralPropertiesValue;
@FindBy(xpath = "//div[@kendo-grid='model.propertiesGrid']//tr//th[3]")
public WebElement column_GeneralPropertiesType;
/**
* Method to click on X task header Control icon
*/
public void clickonXtaskHeaderControlicon() {
taskcloseicon.click();
log("clicked on the X icon in the Task Header label");
takeScreenShot();
}
//****************************************************************************************************************
public void selectLocale(String _LocaleValue) {
driver.findElement(By.xpath("//div[contains(@v-label,'SSPArticle.LocaleSelector-LabelName')]//span[@class='k-widget k-dropdown k-header ng-scope']")).click();
WebElement locale = driver.findElement(By.xpath("//li[text()='"+_LocaleValue+"']"));
clickElementUsingJavaScript(locale);
}
/**
*
* @throws InterruptedException
* @throws AWTException
*/
public void addArticledetails(String _ArticleName,String _LocaleinputforallLocales,String _LocalizedNameforallLocales,String _Description,
String LocalizedDescriptiontextinpopup,String _SelectProduct) throws InterruptedException, AWTException {
ArticleName_inputfield.sendKeys(_ArticleName);
log("Entered the Article name as "+_ArticleName);
AddLocalizedNameIcon.click();
Thread.sleep(3000);
LocaleDropdownSelect.click();
Thread.sleep(3000);
WebElement locale = driver.findElement(By.xpath("//li[@class='k-item ng-scope k-state-selected k-state-focused' and text()='"+_LocaleinputforallLocales+"']"));
Thread.sleep(3000);
clickElementUsingJavaScript(locale);
Thread.sleep(3000);
LocalizedName_inputfield.sendKeys(_LocalizedNameforallLocales);
Thread.sleep(3000);
AddLocalizedName_DoneButton.click();
clickElementUsingJavaScript(AddLocalizedDescriptionsIcon);
Thread.sleep(3000);
//LocaleDropdownSelectforLocalizedDescriptionPopup.click();
Thread.sleep(3000);
// WebElement s = driver.findElement(By.xpath("//div[@class='k-animation-container']//ul[@class='k-list k-reset']//li[text()='English - Australia']"));
// Thread.sleep(4000);
// clickElementUsingJavaScript(s);
LocalizedDescriptiontextinpopup_inputfield.sendKeys(LocalizedDescriptiontextinpopup);
AddLocalizedDescription_DoneButton.click();
LocalizedDescription_inputfield.sendKeys(_Description);
wh.waitForElementToBeClickable(SelectProductDD, driver, 30);
clickElementUsingJavaScript(SelectProductDD);
WebElement productToSelect = driver.findElement(By.xpath("//li[@class='k-item ng-scope' and text()='"+_SelectProduct+"']"));
Thread.sleep(5000);
clickElementUsingJavaScript(productToSelect);
}
public void clickonSave() throws InterruptedException {
wh.waitForElementToBeVisible(Save, driver, 10);
Thread.sleep(3000);
clickElementUsingJavaScript(Save);
}
/**
* Method to verify Icon Labels and Header in Edit Article page
* @param _SaveLabel
* @param _CancelLabel
* @param _PageHeaderAddArticle
* @param _ArticleName
* @param _PageHeaderAfterEnteringName
* @return
* @throws InterruptedException
*/
public String verifyIconLabelsAndHeader(String _SaveLabel,String _CancelLabel,String _UploadImage,String _AddProperties
,String _EditProperties,String _ManageAdditionalProperties,String _Pricing,String _PageHeader,String _Name,String _UpdatedHeader) throws InterruptedException {
status="FAIL";
if(Save.getText().equals(_SaveLabel)) {
log("Save button is displayed ");
if(Cancel.getText().equals(_CancelLabel)) {
log("Cancel button is displayed");
if(UploadImage.getText().equals(_UploadImage)) {
log(UploadImage.getText()+" is displayed in UI");
if(AddProperties.getText().equals(_AddProperties)) {
log(AddProperties.getText()+" is displayed in UI");
if(EditProperties.getText().equals(_EditProperties)) {
log(EditProperties.getText()+" is displayed in UI");
if(ManageAdditionalProperties.getText().equals(_ManageAdditionalProperties)) {
log(ManageAdditionalProperties.getText()+" is displayed in UI");
if(Pricing.getText().equals(_Pricing)) {
log(Pricing.getText()+" is displayed in UI");
log(pageHeader.getText());
if(pageHeader.getText().equals(_PageHeader)) {
log(pageHeader.getText()+" is displayed as header in UI");
ArticleName_inputfield.clear();
ArticleName_inputfield.sendKeys(_Name);
if(pageHeader.getText().equals(_UpdatedHeader))
log(pageHeader.getText()+" is displayed after edit of the Name");
takeScreenShot();
status="PASS";
}
}
}
}
}
}
}
}
return status;
}
public void editArticleDetails(String _Name,String _Description) throws InterruptedException, AWTException {
wh.waitForElementToBeClickable(ArticleName_inputfield, driver, 10);
ArticleName_inputfield.clear();
ArticleName_inputfield.sendKeys(_Name);
log("Entered the Name as "+_Name);
LocalizedDescription_inputfield.clear();
LocalizedDescription_inputfield.sendKeys(_Description);
log("Entered the Description");
takeScreenShot();
}
public void clickonAddLocalizedName() {
ProductNameLocalizedEarthIcon.click();
log("Clicked on the Add localized names icon");
takeScreenShot();
}
public void addlocalizednamesDetails(String _localeForAddlocalizedNames,String _LocalizedName) throws InterruptedException {
AddlocalizedNamesPopUP_localeDropdown.click();
// WebElement localevalue = driver.findElement(By.xpath("//div[8]/div/div[3]/ul/li[text()='"+_localeForAddlocalizedNames+"']"));
// wh.waitForElementToBeVisible(localevalue, driver, 10);
// Thread.sleep(4000);
// localevalue.click();
// log("Selected the locale of Add localized names as "+_localeForAddlocalizedNames);
AddlocalizedNamesPopUP_LocalizedNamesInputfield.clear();
AddlocalizedNamesPopUP_LocalizedNamesInputfield.sendKeys(_LocalizedName);
takeScreenShot();
SaveLocalizedNames.click();
log("Clicked on Save");
}
public void clickonAddLocalizedDescription() {
wh.waitForElementToBeVisible(ProductDescriptionLocalizedEarthIcon, driver, 10);
clickElementUsingJavaScript(ProductDescriptionLocalizedEarthIcon);
log("Clicked on the Add localized Description icon");
takeScreenShot();
}
public void addlocalizedDescriptionDetails(String _localeForAddlocalizedDescription,String _LocalizedNameDescription) throws InterruptedException {
// AddlocalizedDescriptionPopUP_localeDropdown.click();
//
// WebElement localevalue = driver.findElement(By.xpath("//div[10]/div/div[3]/ul/li[text()='"+_localeForAddlocalizedDescription+"']"));
// Thread.sleep(4000);
// localevalue.click();
// log("Selected the locale of Add localized names as "+_localeForAddlocalizedDescription);
AddlocalizedNamesPopUP_LocalizedDescriptionInputfield.clear();
AddlocalizedNamesPopUP_LocalizedDescriptionInputfield.sendKeys(_LocalizedNameDescription);
takeScreenShot();
SaveLocalizeddescriptions.click();
log("Clicked on Save");
}
public void SelectProductFromDropDown(String _SelectProductForArticle) {
wh.waitForElementToBeClickable(SelectProductDD, driver, 20);
clickElementUsingJavaScript(SelectProductDD);
log("Clicked on the Select Product Drop Down ");
WebElement dropdownProductValue = driver.findElement(By.xpath("//li[@class='k-item ng-scope' and text()='"+_SelectProductForArticle+"']"));
wh.waitForElementToBeClickable(dropdownProductValue, driver, 10);
clickElementUsingJavaScript(dropdownProductValue);
log("Selected the product "+_SelectProductForArticle);
takeScreenShot();
}
public String searchAndSelectArticleCreated(String _ArticleName,String _ProductNameOfArticle,String _Type,String _ArticleStatus) throws InterruptedException {
String status = "FAIL";
Thread.sleep(10000);
List<WebElement> tenantRows = driver.findElements(By.xpath("//table[@class='k-selectable']//tbody//tr"));
log("No of rows ="+tenantRows.size());
for(int i=0;i<tenantRows.size();i++) {
int j=i+1;
WebElement NameColumnValue = driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]/td[1]"));
WebElement ProductColumnValue = driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]/td[2]"));
WebElement TypeColumnValue = driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]/td[3]"));
WebElement StatusColumnValue = driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]/td[4]"));
if(NameColumnValue.getText().equals(_ArticleName)) {
log(NameColumnValue.getText()+" is displayed in UI");
if(ProductColumnValue.getText().equals(_ProductNameOfArticle)) {
log(ProductColumnValue.getText()+" is displayed in UI");
if(TypeColumnValue.getText().equals(_Type)) {
log(TypeColumnValue.getText()+" is displayed in UI");
if(StatusColumnValue.getText().equals(_ArticleStatus)) {
log(StatusColumnValue.getText()+" is displayed in UI");
driver.findElement(By.xpath("//table[@class='k-selectable']/tbody/tr["+j+"]")).click();
log("Product -> "+_ArticleName+" Searched and Selected ");
status ="PASS";
}
}
}
}
}
return status;
}
public String verifyCloneConfirmationMessage(String _CloneInformationMessage) {
status="FAIL";
List<WebElement> window = driver.findElements(By.xpath("//span[@class='k-window-title' and text()='Information']"));
if(window.size()==1) {
log(CloneConfirmationMessage.getText());
if(CloneConfirmationMessage.getText().equals(_CloneInformationMessage)) {
log("Information message displayed as "+CloneConfirmationMessage.getText());
takeScreenShot();
OKButton.click();
status="PASS";
}
}
return status;
}
public void clickonAddProperties() {
wh.waitForElementToBeVisible(AddProperties, driver, 10);
clickElementUsingJavaScript(AddProperties);
log("Clicked on the Add properties icon");
takeScreenShot();
}
public void AddPropertiesToArticleAndSave(String _PropertyName,String _PropertyDescription,String _PropertyLocaleValue,String _PropertyMeasurementUnit,
String _PropertyUnitValue,String _UploadImageForPropertyYesOrNo,String _Browser) throws IOException, AWTException, InterruptedException{
wh.waitForElementToBeClickable(textField_PropertyName, driver, 30);
textField_PropertyName.clear();
textField_PropertyName.sendKeys(_PropertyName);
log("Entered the Property Name as "+_PropertyName);
textArea_PropertyDescription.clear();
textArea_PropertyDescription.sendKeys(_PropertyDescription);
log("Entered the Description as "+_PropertyDescription);
//dropDownList_PropertyLocale.click();
//WebElement localeValue = driver.findElement(By.xpath("html/body/div[15]/div/div[3]/ul/li[text()='"+_PropertyLocaleValue+"']"));
//wh.waitForElementToBeClickable(localeValue, driver, 30);
//clickElementUsingJavaScript(localeValue);
//log("Property locale value selected as "+_PropertyLocaleValue);
textField_PropertyMeasurementUnit.clear();
textField_PropertyMeasurementUnit.sendKeys(_PropertyMeasurementUnit);
log("Measurement unit is entered as "+_PropertyMeasurementUnit);
textField_PropertyValue.clear();
textField_PropertyValue.sendKeys(_PropertyUnitValue);
log("Value is entered as "+_PropertyUnitValue);
if(_UploadImageForPropertyYesOrNo.equalsIgnoreCase("YES")) {
//button_Selectimage.click();
// uploadFile(_Browser, ConstantValues.LEFTLOGO_IMG);
mkh.pressTabKeyAndRelease();
mkh.pressEnterKeyAndRelease();
uploadFile(_Browser, ConstantValues.LEFTLOGO_IMG);
log("Image is uploaded");
takeScreenShot();
button_SaveProperties.click();
log("Clicked on the Save button in the dialog pop up");
Thread.sleep(5000);
}
}
public String searchAndSelectPropertiesAdded(String _GeneralPropertiesLabel_EditArticle,String _NameColHeader_EditArticle_Properties,
String _ValueColHeader_EditArticle_Properties,String _TypeColHeader_EditArticle_Properties,String _NamePropertyValue_EditArticlePage,
String _ValuePropertyValue_EditArticlePage, String _TypePropertyValue_EditArticlePage) {
status="FAIL";
wh.waitForElementToBeClickable(labelDropDown_GeneralProperties, driver, 30);
if(labelDropDown_GeneralProperties.getText().equals(_GeneralPropertiesLabel_EditArticle)) {
log(labelDropDown_GeneralProperties.getText()+" is displayed in UI");
wh.waitForElementToBeClickable(labelDropDown_GeneralProperties, driver, 30);
labelDropDown_GeneralProperties.click();
if(column_GeneralPropertiesName.getText().equals(_NameColHeader_EditArticle_Properties)) {
log(column_GeneralPropertiesName.getText()+" is displayed in UI");
if(column_GeneralPropertiesValue.getText().equals(_ValueColHeader_EditArticle_Properties)) {
log(column_GeneralPropertiesValue.getText()+" is displayed in UI");
if(column_GeneralPropertiesType.getText().equals(_TypeColHeader_EditArticle_Properties)) {
log(column_GeneralPropertiesType.getText()+" is displayed in UI");
List<WebElement> noOfRows = driver.findElements(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr"));
for(int i=0;i<noOfRows.size();i++) {
int j=i+1;
WebElement nameColumnValue = driver.findElement(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr["+j+"]//td[1]//span[1]"));
WebElement valueColumnValue = driver.findElement(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr["+j+"]//td[2]//span[1]"));
WebElement typeColumnValue = driver.findElement(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr["+j+"]//td[3]//span[1]"));
if(nameColumnValue.getText().equals(_NamePropertyValue_EditArticlePage)) {
if(valueColumnValue.getText().equals(_ValuePropertyValue_EditArticlePage)) {
if(typeColumnValue.getText().equals(_TypePropertyValue_EditArticlePage)) {
status="PASS";
takeScreenShot();
log("Name column value displayed under General properties "+nameColumnValue.getText());
log("Value column value displayed under General properties "+valueColumnValue.getText());
log("Type column value displayed under General properties "+typeColumnValue.getText());
driver.findElement(By.xpath("//div[@kendo-grid='model.propertiesGrid']//tbody//tr["+j+"]")).click();
}
}
}
}
}
}
}
}
return status;
}
public void clickonPricing() {
wh.waitForElementToBeClickable(Pricing, driver, 20);
Pricing.click();
log("clicked on Pricing icon");
takeScreenShot();
}
public void clickonCancel() {
wh.waitForElementToBeClickable(Cancel, driver, 20);
Cancel.click();
log("clicked on Cancel icon");
takeScreenShot();
}
public void clickOnSubscriptionPlans() throws InterruptedException {
Thread.sleep(5000);
clickElementUsingJavaScript(SubscriptionPlans);
log("Clicked on the Subscription plans icon");
takeScreenShot();
}
} | 22,047 | 0.723479 | 0.717777 | 561 | 38.388592 | 38.838421 | 165 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.786096 | false | false | 5 |
c78e1786512b3e14e3c343a8dc53a07dbe02cca6 | 24,945,170,074,918 | 41d6f75e26d58fc095f51add43e5f98fcfc4374c | /src/TreeNode.java | eced185b926f05bd229c561b8c388ab6f77c18d3 | [] | no_license | ggordonutech/cards-binary-search-tree-sample | https://github.com/ggordonutech/cards-binary-search-tree-sample | 9c73c3b8257ce615bbe236f9159171765a03c785 | 90932cec2281eb7ec513d599835ab79d2f12a786 | refs/heads/master | "2021-04-15T14:39:02.195000" | "2018-03-23T00:05:06" | "2018-03-23T00:05:06" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class TreeNode {
private Card data;
private TreeNode left; //left subtree
private TreeNode right; //right subtree
public TreeNode() {
this(null);
}
public TreeNode(Card data) {
this(data,null,null);
}
public TreeNode(Card data, TreeNode left, TreeNode right) {
super();
this.data = data;
this.left = left;
this.right = right;
}
@Override
public String toString() {
return "TreeNode [data=" + data + ", left=" + left + ", right=" + right + "]";
}
public Card getData() {
return data;
}
public void setData(Card data) {
this.data = data;
}
public TreeNode getLeft() {
return left;
}
public void setLeft(TreeNode left) {
this.left = left;
}
public TreeNode getRight() {
return right;
}
public void setRight(TreeNode right) {
this.right = right;
}
}
| UTF-8 | Java | 869 | java | TreeNode.java | Java | [] | null | [] |
public class TreeNode {
private Card data;
private TreeNode left; //left subtree
private TreeNode right; //right subtree
public TreeNode() {
this(null);
}
public TreeNode(Card data) {
this(data,null,null);
}
public TreeNode(Card data, TreeNode left, TreeNode right) {
super();
this.data = data;
this.left = left;
this.right = right;
}
@Override
public String toString() {
return "TreeNode [data=" + data + ", left=" + left + ", right=" + right + "]";
}
public Card getData() {
return data;
}
public void setData(Card data) {
this.data = data;
}
public TreeNode getLeft() {
return left;
}
public void setLeft(TreeNode left) {
this.left = left;
}
public TreeNode getRight() {
return right;
}
public void setRight(TreeNode right) {
this.right = right;
}
}
| 869 | 0.607595 | 0.607595 | 48 | 16.0625 | 16.825584 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.645833 | false | false | 5 |
af906043695189926da53778e096f7db303ff2a8 | 4,784,593,589,997 | 9ddb3dfdaeedfa33363e8b88530b563c12f0c70c | /AirlinesReservationSystem/airlines-reservations-system/src/test/java/ars/cs/miu/edu/AirlineTest.java | e2d0416c407c30f7e7b7ed52df16b860891615ce | [] | no_license | mesganad/EA_Project | https://github.com/mesganad/EA_Project | d5ecc0b60d73181741864c01f771c413d260b111 | 4d8363c2dcfde60ec98a88d416c6af7c572ff537 | refs/heads/main | "2023-07-21T22:49:51.184000" | "2021-09-01T23:01:08" | "2021-09-01T23:01:08" | 398,383,330 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ars.cs.miu.edu;
import ars.cs.miu.edu.models.Airline;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.junit.BeforeClass;
import org.junit.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.equalTo;
public class AirlineTest {
@BeforeClass
public static void setup() {
RestAssured.port = Integer.valueOf(8090);
RestAssured.baseURI = "http://localhost";
RestAssured.basePath = "";
}
@Test
public void testAirline() {
Airline airline = new Airline(12,"UT", "United", "The biggest airline in eritrea");
given()
.header("Content-Type", "application/json").contentType(ContentType.JSON).accept(ContentType.JSON)
.body(airline)
.when().post("/airlines").then()
.statusCode(201);
given()
.when()
.get("/airlines/code/UT")
.then()
.contentType(ContentType.JSON)
.and()
.body("code",equalTo("UT"))
.body("name", equalTo("United"));
// cleanup
given()
.when()
.delete("/airlines/code/UT");
}
}
| UTF-8 | Java | 1,274 | java | AirlineTest.java | Java | [] | null | [] | package ars.cs.miu.edu;
import ars.cs.miu.edu.models.Airline;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.junit.BeforeClass;
import org.junit.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.equalTo;
public class AirlineTest {
@BeforeClass
public static void setup() {
RestAssured.port = Integer.valueOf(8090);
RestAssured.baseURI = "http://localhost";
RestAssured.basePath = "";
}
@Test
public void testAirline() {
Airline airline = new Airline(12,"UT", "United", "The biggest airline in eritrea");
given()
.header("Content-Type", "application/json").contentType(ContentType.JSON).accept(ContentType.JSON)
.body(airline)
.when().post("/airlines").then()
.statusCode(201);
given()
.when()
.get("/airlines/code/UT")
.then()
.contentType(ContentType.JSON)
.and()
.body("code",equalTo("UT"))
.body("name", equalTo("United"));
// cleanup
given()
.when()
.delete("/airlines/code/UT");
}
}
| 1,274 | 0.565934 | 0.55887 | 45 | 27.311111 | 23.348396 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false | 5 |
0bab17a7bb702a64f41d8f6ed27fea49f7931f7f | 21,354,577,423,873 | e12f36eb8dd21809c7fbfed8f7cbee5e51838c90 | /Java/CCValidate.java | 2498fa051b2668224dbb6e82cec965a0cbfe54a4 | [] | no_license | varanasisrikar/Programs | https://github.com/varanasisrikar/Programs | 809e54f5043c21936a7475862b0fc5aee73e329b | 7d2950c4721d3182a742cb35142cdffd6fb5f40d | refs/heads/master | "2022-01-14T03:09:15.583000" | "2022-01-03T06:30:24" | "2022-01-03T06:30:24" | 207,335,379 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class CCValidate {
public static boolean validate(String n) {
int sum = 0;
int digit = 0;
String[] ps = n.split("");
for (int i = ps.length - 2; i >= 0; i--) {
digit = Integer.parseInt(ps[i]);
if (i % 2 == ps.length % 2) {
digit *= 2;
if (digit > 9) {
digit -= 9;
}
}
sum += digit;
}
sum += Integer.parseInt(ps[ps.length - 1]);
if (sum % 10 == 0) {
return true;
} else {
return false;
}
}
public static void main(String[] args) {
System.out.println(CCValidate.validate("1230"));
}
}
| UTF-8 | Java | 720 | java | CCValidate.java | Java | [] | null | [] | class CCValidate {
public static boolean validate(String n) {
int sum = 0;
int digit = 0;
String[] ps = n.split("");
for (int i = ps.length - 2; i >= 0; i--) {
digit = Integer.parseInt(ps[i]);
if (i % 2 == ps.length % 2) {
digit *= 2;
if (digit > 9) {
digit -= 9;
}
}
sum += digit;
}
sum += Integer.parseInt(ps[ps.length - 1]);
if (sum % 10 == 0) {
return true;
} else {
return false;
}
}
public static void main(String[] args) {
System.out.println(CCValidate.validate("1230"));
}
}
| 720 | 0.405556 | 0.381944 | 27 | 25.666666 | 15.792638 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481481 | false | false | 5 |
64d745a06f1d2d5f643f0ff1f1b5cf1075dbf14b | 7,576,322,360,914 | aa205bc0bb918b93b9bc494c48a8316cb5cabc27 | /spring-parent/mybatis/src/main/java/com/alibaba/mybatis/core/dao/UserMapper.java | fe0ed769c3f8675737cfb0c930832d9edb0cafff | [] | no_license | sierpys/aries | https://github.com/sierpys/aries | 8b05e28fd0d2b8a4690f51f0efa161f24f2b95bd | 6e42ae7e144adcc1f035b5f9abb2b1705c4f08a7 | refs/heads/master | "2022-12-21T11:33:13.955000" | "2019-12-19T12:48:39" | "2019-12-19T12:48:39" | 144,351,994 | 0 | 0 | null | false | "2022-12-16T04:31:51" | "2018-08-11T03:22:28" | "2019-12-19T12:48:48" | "2022-12-16T04:31:49" | 204 | 0 | 0 | 13 | Java | false | false | package com.alibaba.mybatis.core.dao;
import com.alibaba.mybatis.core.model.User;
/**
* @author sier.pys 10/21/18
*/
public interface UserMapper {
User findById();
}
| UTF-8 | Java | 174 | java | UserMapper.java | Java | [
{
"context": "m.alibaba.mybatis.core.model.User;\n\n/**\n * @author sier.pys 10/21/18\n */\npublic interface UserMapper {\n Us",
"end": 107,
"score": 0.9983585476875305,
"start": 99,
"tag": "USERNAME",
"value": "sier.pys"
}
] | null | [] | package com.alibaba.mybatis.core.dao;
import com.alibaba.mybatis.core.model.User;
/**
* @author sier.pys 10/21/18
*/
public interface UserMapper {
User findById();
}
| 174 | 0.706897 | 0.672414 | 10 | 16.4 | 16.038704 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false | 5 |
10e86a634a2b8b865bab337bb8afed7532203b96 | 23,021,024,735,799 | 0198d9973a96d18f8dd9702f29e27c2ea4503dbb | /POO/Ejercicio29.8/src/app/App.java | 511c79e61e157048665f5a19780cd9cc3f5f5c86 | [] | no_license | sabriguantay/ADAITW | https://github.com/sabriguantay/ADAITW | 3be2844fdffebc0f703d662a68f69fe42d76d5df | 614ff7a36a2aee685cbf77d472fe151cd7a0acb5 | refs/heads/master | "2022-07-07T03:15:29.794000" | "2020-08-06T21:06:10" | "2020-08-06T21:06:10" | 201,466,486 | 0 | 0 | null | false | "2022-06-21T02:06:14" | "2019-08-09T12:49:32" | "2021-06-30T19:27:00" | "2022-06-21T02:06:13" | 923 | 0 | 0 | 3 | Java | false | false | package app;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class App {
public static Scanner Teclado = new Scanner(System.in);
public static void main(String[] args) throws Exception {
System.out.println("Ingrese persona");
String nombre;
long dni;
int edad;
System.out.println("Ingrese la nombre de persona");
nombre = Teclado.nextInt();
System.out.println("Ingrese la dni de persona");
dni = Teclado.nextInt();
System.out.println("Ingrese la edad de persona");
edad = Teclado.nextInt();
//public static List<Persona> personas(){
//List<Persona> personas;
//personas = new ArrayList<Persona>();
//Persona p1 = new Persona("Ariel", 40000000, 21);
//personas.add((Persona) personas);
}
}
} | UTF-8 | Java | 937 | java | App.java | Java | [
{
"context": "<Persona>();\n\n //Persona p1 = new Persona(\"Ariel\", 40000000, 21);\n //personas.add((Persona)",
"end": 815,
"score": 0.9994639158248901,
"start": 810,
"tag": "NAME",
"value": "Ariel"
}
] | null | [] | package app;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class App {
public static Scanner Teclado = new Scanner(System.in);
public static void main(String[] args) throws Exception {
System.out.println("Ingrese persona");
String nombre;
long dni;
int edad;
System.out.println("Ingrese la nombre de persona");
nombre = Teclado.nextInt();
System.out.println("Ingrese la dni de persona");
dni = Teclado.nextInt();
System.out.println("Ingrese la edad de persona");
edad = Teclado.nextInt();
//public static List<Persona> personas(){
//List<Persona> personas;
//personas = new ArrayList<Persona>();
//Persona p1 = new Persona("Ariel", 40000000, 21);
//personas.add((Persona) personas);
}
}
} | 937 | 0.574173 | 0.562433 | 54 | 16.370371 | 20.54561 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.388889 | false | false | 5 |
d7a08cc5c92dca6dd2f85af9cb2b44d73e903358 | 18,820,546,709,691 | debf105a453f71087dd4786e9de658103462996e | /Javeled/src/kayttoliittyma/Tietoalue.java | 36361baae195de295daeeec89034214e0d406055 | [] | no_license | jsopakar/ohtu-viikko1 | https://github.com/jsopakar/ohtu-viikko1 | 39bb93177c1d599d16feed14d9a8ca9e9407b716 | 7d226b44a4058970259aaa03e5a187f1b58b3c75 | refs/heads/master | "2021-01-22T04:41:15.923000" | "2014-04-04T13:16:29" | "2014-04-04T13:16:29" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package kayttoliittyma;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import sovelluslogiikka.*;
/**
* Pelin tietoalue, joka näyttää jäljellä olevat siirrot, pistemäärän
* ja tarvittavat toimintopainikkeet.
* @author 012616660
*/
public class Tietoalue extends JPanel implements ActionListener {
/**
* Viittaus Pelitaso-olioon, josta saa tiedon pelin vaiheista.
*/
private Pelitaso peli;
protected JLabel siirtojaLabel;
protected JLabel pisteitaLabel;
protected JButton lopetaButton;
/**
* Konstruktori, joka alustaa ja kutsuu komponenttien luontia.
* @param peli
*/
public Tietoalue(Pelitaso peli) {
super(new GridLayout(2, 4));
this.peli = peli;
luoKomponentit();
}
/**
* Metodi joka luo varsinaiset näytettävä komponentit
*/
private void luoKomponentit() {
this.add(new JLabel("Siirtoja: "));
siirtojaLabel = new JLabel();
siirtojaLabel.setName("siirtoLabel");
siirtojaLabel.setText(Integer.toString(peli.siirtojaJaljella()));
this.add(siirtojaLabel);
this.add(new JLabel("Pisteitä: "));
pisteitaLabel = new JLabel();
pisteitaLabel.setName("pisteLabel");
pisteitaLabel.setText(Integer.toString(peli.kerroPistemaara()));
this.add(pisteitaLabel);
// Toinen rivi:
this.add(new JLabel("Toimintoja: "));
lopetaButton = new JButton();
lopetaButton.setText("Lopeta");
lopetaButton.addActionListener(this);
lopetaButton.setActionCommand("Lopeta");
this.add(lopetaButton);
this.add(new JLabel(""));
this.add(new JLabel(""));
}
/**
* Käsittely nappuloiden painamiselle.
* <p>
* Julkaisuversiossa vain lopeta-nappula.
* @param e ActionEvent
*/
@Override
public void actionPerformed(ActionEvent e) {
// Lopeta-nappulan käsittely:
if ("Lopeta".equals(e.getActionCommand())) {
Container frame = lopetaButton.getParent();
do
frame = frame.getParent();
while (!(frame instanceof JFrame));
((JFrame) frame).dispose();
// Tuki muille komennoille jatkossa:
} else if ("Uusi".equals(e.getActionCommand())) {
// Runko uuden pelin luomiselle, tai uuden tason valitsemisen laukaisemiselle
}
}
}
| UTF-8 | Java | 2,674 | java | Tietoalue.java | Java | [
{
"context": "\n * ja tarvittavat toimintopainikkeet.\n * @author 012616660\n */\npublic class Tietoalue extends JPanel impleme",
"end": 422,
"score": 0.9825583696365356,
"start": 413,
"tag": "USERNAME",
"value": "012616660"
}
] | null | [] | package kayttoliittyma;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import sovelluslogiikka.*;
/**
* Pelin tietoalue, joka näyttää jäljellä olevat siirrot, pistemäärän
* ja tarvittavat toimintopainikkeet.
* @author 012616660
*/
public class Tietoalue extends JPanel implements ActionListener {
/**
* Viittaus Pelitaso-olioon, josta saa tiedon pelin vaiheista.
*/
private Pelitaso peli;
protected JLabel siirtojaLabel;
protected JLabel pisteitaLabel;
protected JButton lopetaButton;
/**
* Konstruktori, joka alustaa ja kutsuu komponenttien luontia.
* @param peli
*/
public Tietoalue(Pelitaso peli) {
super(new GridLayout(2, 4));
this.peli = peli;
luoKomponentit();
}
/**
* Metodi joka luo varsinaiset näytettävä komponentit
*/
private void luoKomponentit() {
this.add(new JLabel("Siirtoja: "));
siirtojaLabel = new JLabel();
siirtojaLabel.setName("siirtoLabel");
siirtojaLabel.setText(Integer.toString(peli.siirtojaJaljella()));
this.add(siirtojaLabel);
this.add(new JLabel("Pisteitä: "));
pisteitaLabel = new JLabel();
pisteitaLabel.setName("pisteLabel");
pisteitaLabel.setText(Integer.toString(peli.kerroPistemaara()));
this.add(pisteitaLabel);
// Toinen rivi:
this.add(new JLabel("Toimintoja: "));
lopetaButton = new JButton();
lopetaButton.setText("Lopeta");
lopetaButton.addActionListener(this);
lopetaButton.setActionCommand("Lopeta");
this.add(lopetaButton);
this.add(new JLabel(""));
this.add(new JLabel(""));
}
/**
* Käsittely nappuloiden painamiselle.
* <p>
* Julkaisuversiossa vain lopeta-nappula.
* @param e ActionEvent
*/
@Override
public void actionPerformed(ActionEvent e) {
// Lopeta-nappulan käsittely:
if ("Lopeta".equals(e.getActionCommand())) {
Container frame = lopetaButton.getParent();
do
frame = frame.getParent();
while (!(frame instanceof JFrame));
((JFrame) frame).dispose();
// Tuki muille komennoille jatkossa:
} else if ("Uusi".equals(e.getActionCommand())) {
// Runko uuden pelin luomiselle, tai uuden tason valitsemisen laukaisemiselle
}
}
}
| 2,674 | 0.626692 | 0.622556 | 94 | 27.297873 | 20.705549 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.478723 | false | false | 5 |
856c616ee33c7522cbc386da27463b334324009b | 8,486,855,426,207 | 21716eddb05b5596b85919b445b5911d3a798eff | /oauth2-common/common-core/src/main/java/com/jasonless/oauth2/common/core/exception/IErrorType.java | 602aa087fc304880280e6354bc7db131aecdfab1 | [
"Apache-2.0"
] | permissive | caesarlewis/oauth2-server | https://github.com/caesarlewis/oauth2-server | 61c18e205cf1526750f5852a2eeb3d411ae9aa6d | 6a8a00b698030720b5898e804610251cc711e3b0 | refs/heads/master | "2022-11-24T02:38:37.986000" | "2020-07-24T09:25:21" | "2020-07-24T09:25:21" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jasonless.oauth2.common.core.exception;
/**
* @author LiuShiZeng
*/
public interface IErrorType {
/**
* 返回code
*
* @return
*/
String getCode();
/**
* 返回msg
*
* @return
*/
String getMsg();
}
| UTF-8 | Java | 272 | java | IErrorType.java | Java | [
{
"context": "less.oauth2.common.core.exception;\n\n/**\n * @author LiuShiZeng\n */\npublic interface IErrorType {\n\n /**\n *",
"end": 78,
"score": 0.9997730851173401,
"start": 68,
"tag": "NAME",
"value": "LiuShiZeng"
}
] | null | [] | package com.jasonless.oauth2.common.core.exception;
/**
* @author LiuShiZeng
*/
public interface IErrorType {
/**
* 返回code
*
* @return
*/
String getCode();
/**
* 返回msg
*
* @return
*/
String getMsg();
}
| 272 | 0.503788 | 0.5 | 22 | 11 | 11.782113 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | false | false | 5 |
878f86e81edc752c2fe1905ea278074c447f9781 | 25,237,227,862,320 | ef2b47467e8713a0fed6c8f5c0533c73c79949fb | /src/Course.java | 42679ca814f58713d97b1d2fb60c9ce0246eebfc | [] | no_license | Nguyenj93/SE300Spring2018T4 | https://github.com/Nguyenj93/SE300Spring2018T4 | b3fcd96cd0a907ac8944c52358d7838b63094676 | f78c866298253c199e678b3613e47623672e4cdf | refs/heads/master | "2021-05-02T16:14:26.158000" | "2018-04-20T14:14:29" | "2018-04-20T14:14:29" | 120,670,343 | 3 | 0 | null | false | "2018-04-20T14:14:30" | "2018-02-07T20:53:09" | "2018-04-19T20:53:33" | "2018-04-20T14:14:29" | 246 | 1 | 0 | 0 | Java | false | null | import java.io.Serializable;
public class Course implements Serializable {
static final long serialVersionUID = 1L;
private BaseCourse baseCourse;
private Grade grade;
// Disable default constructor
private Course() {
}
public Course(BaseCourse course) {
if (course == null) {
throw new NullPointerException();
}
baseCourse = course;
grade = Grade.NONE;
}
public BaseCourse getBaseCourse() {
return this.baseCourse;
}
public Grade getGrade() {
return this.grade;
}
public int getNumCredits() {
return baseCourse.getNumCredits();
}
public void setGrade(Grade newGrade) {
grade = newGrade;
}
}
| UTF-8 | Java | 741 | java | Course.java | Java | [] | null | [] | import java.io.Serializable;
public class Course implements Serializable {
static final long serialVersionUID = 1L;
private BaseCourse baseCourse;
private Grade grade;
// Disable default constructor
private Course() {
}
public Course(BaseCourse course) {
if (course == null) {
throw new NullPointerException();
}
baseCourse = course;
grade = Grade.NONE;
}
public BaseCourse getBaseCourse() {
return this.baseCourse;
}
public Grade getGrade() {
return this.grade;
}
public int getNumCredits() {
return baseCourse.getNumCredits();
}
public void setGrade(Grade newGrade) {
grade = newGrade;
}
}
| 741 | 0.612686 | 0.611336 | 37 | 19.027027 | 16.401197 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.297297 | false | false | 5 |
88ebdacddf82a081dbdeb45b6128756ff8f7953e | 15,607,911,220,158 | df19d6fb6e80cac2a14ac9c42952e30db3a59922 | /src/main/java/Others/base/covariantReturnType/Flowers/Person.java | 32a3ed500ddf6c125885e59d2fa17299823113b0 | [] | no_license | iwinder/DesignPatternsDom | https://github.com/iwinder/DesignPatternsDom | 003a4bf92a72ed0e201bf6de0e203376703ded8d | fb2799815e680473c0afb004c0de765a2f73b158 | refs/heads/master | "2021-01-21T21:15:41.310000" | "2019-08-16T10:05:50" | "2019-08-16T10:05:50" | 94,800,833 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Others.base.covariantReturnType.Flowers;
public class Person {
public Flower buy(){
System.out.println("人们买花");
return new Flower();
}
}
| UTF-8 | Java | 178 | java | Person.java | Java | [] | null | [] | package Others.base.covariantReturnType.Flowers;
public class Person {
public Flower buy(){
System.out.println("人们买花");
return new Flower();
}
}
| 178 | 0.647059 | 0.647059 | 8 | 20.25 | 16.107063 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 5 |
b99a4182638160fe5405085e8c2084362ee6b50f | 21,809,843,951,123 | ea1a4879dddb53ca16fb926f1833812760a3727b | /JavaBackEnd/39-HW_ArrayInterface/src/telran/util/Array.java | 4d5224cbec1736b71de9dfacabf3a7335611ed4c | [] | no_license | Braslik/Telran | https://github.com/Braslik/Telran | 8f15ec79b47bbea6b4219c2ac7b229702da4316f | f2ba585e23ca9d3a80504d0c98b980de62df41c6 | refs/heads/master | "2021-03-30T05:57:39.482000" | "2021-03-29T04:00:46" | "2021-03-29T04:00:46" | 248,022,888 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package telran.util;
import java.util.Arrays;
public class Array<T> implements IndexedList<T> {
private T[] array;
private int size;// blue = 0
private static int defaultCapacity = 16;
@SuppressWarnings("unchecked")
public Array(int capacity) {
array = (T[]) new Object[capacity];
}
public Array() {
this(defaultCapacity);
}
public void add(T obj) {
if (size == array.length) {
reallocate();
}
array[size++] = obj;
}
private void reallocate() {
array = Arrays.copyOf(array, array.length * 2);
}
public T get(int index) {
if (index < 0 || index >= size) {
return null;
}
return array[index];
}
public int size() {
return size;
}
public boolean add(int index, T obj) {
if (index < 0 || index >= size) {
return false;
}
if (size == array.length) {
reallocate();
}
System.arraycopy(array, index, array, index + 1, size - index);
array[index] = obj;
size++;
return true;
}
public T remove(int index) {
if (index < 0 || index >= size) {
return null;
}
size--;
T res = array[index];
System.arraycopy(array, index + 1, array, index, size - index);
array[size] = null;
return res;
}
public int indexOf(Object pattern) {
for (int i = 0; i < size; i++) {
if (array[i].equals(pattern)) {
return i;
}
}
return -1;
}
public int lastIndexOf(Object pattern) {
for (int i = size - 1; i >= 0; i--) {
if (array[i].equals(pattern)) {
return i;
}
}
return -1;
}
public void reverse() { // >=!!
for (int left = 0, right = size - 1; left < right; left++, right--) {
T tmp = array[left];
array[left] = array[right];
array[right] = tmp;
}
}
@Override
public T remove(Object pattern) {
int index = indexOf(pattern);
T res = remove(index);
return res;
}
@Override
public boolean removeAll(IndexedList<T> patterns) {
int tempSize = size;
for(int i = size - 1; i >= 0; i--) {
if (patterns.contains(get(i))) {
remove(i);
}}
return tempSize != size;
}
@Override
public boolean contains(T pattern) {
for (int i = 0; i < size; i++) {
if (array[i] == pattern) {
return true;
}
}
return false;
}
@Override
public boolean retainAll(IndexedList<T> patterns) {
int tempSize = size;
for(int i = size - 1; i >= 0; i--) {
if (!patterns.contains(get(i))) {
remove(i);
}}
return tempSize != size;
}
}
| UTF-8 | Java | 2,387 | java | Array.java | Java | [] | null | [] | package telran.util;
import java.util.Arrays;
public class Array<T> implements IndexedList<T> {
private T[] array;
private int size;// blue = 0
private static int defaultCapacity = 16;
@SuppressWarnings("unchecked")
public Array(int capacity) {
array = (T[]) new Object[capacity];
}
public Array() {
this(defaultCapacity);
}
public void add(T obj) {
if (size == array.length) {
reallocate();
}
array[size++] = obj;
}
private void reallocate() {
array = Arrays.copyOf(array, array.length * 2);
}
public T get(int index) {
if (index < 0 || index >= size) {
return null;
}
return array[index];
}
public int size() {
return size;
}
public boolean add(int index, T obj) {
if (index < 0 || index >= size) {
return false;
}
if (size == array.length) {
reallocate();
}
System.arraycopy(array, index, array, index + 1, size - index);
array[index] = obj;
size++;
return true;
}
public T remove(int index) {
if (index < 0 || index >= size) {
return null;
}
size--;
T res = array[index];
System.arraycopy(array, index + 1, array, index, size - index);
array[size] = null;
return res;
}
public int indexOf(Object pattern) {
for (int i = 0; i < size; i++) {
if (array[i].equals(pattern)) {
return i;
}
}
return -1;
}
public int lastIndexOf(Object pattern) {
for (int i = size - 1; i >= 0; i--) {
if (array[i].equals(pattern)) {
return i;
}
}
return -1;
}
public void reverse() { // >=!!
for (int left = 0, right = size - 1; left < right; left++, right--) {
T tmp = array[left];
array[left] = array[right];
array[right] = tmp;
}
}
@Override
public T remove(Object pattern) {
int index = indexOf(pattern);
T res = remove(index);
return res;
}
@Override
public boolean removeAll(IndexedList<T> patterns) {
int tempSize = size;
for(int i = size - 1; i >= 0; i--) {
if (patterns.contains(get(i))) {
remove(i);
}}
return tempSize != size;
}
@Override
public boolean contains(T pattern) {
for (int i = 0; i < size; i++) {
if (array[i] == pattern) {
return true;
}
}
return false;
}
@Override
public boolean retainAll(IndexedList<T> patterns) {
int tempSize = size;
for(int i = size - 1; i >= 0; i--) {
if (!patterns.contains(get(i))) {
remove(i);
}}
return tempSize != size;
}
}
| 2,387 | 0.589443 | 0.580645 | 138 | 16.297102 | 16.256285 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.978261 | false | false | 5 |
601e9f69bc423a288c7d820bdb90126747509000 | 8,461,085,602,891 | 7f1d71618cc3fb7b7f867da9be3697d989ed9dc2 | /src/Amazon/WeightedJobScheduling.java | 29237f1df5bc1305cb085591f3c5fbe0da17a861 | [] | no_license | PramitDutta/Coding-Practice | https://github.com/PramitDutta/Coding-Practice | 497d8b4f72ccab3cacd034c0bd033d3a7976cc2f | f90b83d65524df11a009f570ab8b1f89a15e6891 | refs/heads/master | "2020-04-10T21:00:04.453000" | "2018-12-11T06:05:18" | "2018-12-11T06:05:18" | 161,285,091 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Amazon;
import java.util.Arrays;
import java.util.Comparator;
public class WeightedJobScheduling {
public static class Job {
int start, finish, profit;
Job(int start, int finish, int profit) {
this.start = start;
this.finish = finish;
this.profit = profit;
}
}
public static class JobComparator implements Comparator<Job> {
@Override
public int compare(Job a, Job b) {
return a.finish < b.finish ? -1 : a.finish == b.finish ? 0 : 1;
}
}
static public int binarySearch(Job jobs[], int index) {
// index is the index of the current job
int low = 0, high = index - 1;
while (low <= high) {
int mid = (high + low) / 2;
if (jobs[mid].finish <= jobs[index].start) {
if (jobs[mid + 1].finish <= jobs[index].start)
low = mid + 1;
else
return mid;
} else
high = mid - 1;
}
return -1;
}
public static int schedule(Job jobs[]) {
Arrays.sort(jobs, new JobComparator());
int n = jobs.length;
int[] table = new int[n];
table[0] = jobs[0].profit;
for (int i = 1; i < n; i++) {
int inclProf = jobs[i].profit;
int latest = binarySearch(jobs, i);
if (latest != -1)
inclProf += table[latest];
table[i] = Math.max(inclProf, table[i - 1]);
}
return table[n - 1];
}
public static void main(String[] args) {
Job jobs[] = { new Job(1, 2, 50), new Job(3, 5, 20), new Job(6, 19, 100), new Job(2, 100, 200) };
System.out.println("Optimal profit is " + schedule(jobs));
}
}
| UTF-8 | Java | 1,474 | java | WeightedJobScheduling.java | Java | [] | null | [] | package Amazon;
import java.util.Arrays;
import java.util.Comparator;
public class WeightedJobScheduling {
public static class Job {
int start, finish, profit;
Job(int start, int finish, int profit) {
this.start = start;
this.finish = finish;
this.profit = profit;
}
}
public static class JobComparator implements Comparator<Job> {
@Override
public int compare(Job a, Job b) {
return a.finish < b.finish ? -1 : a.finish == b.finish ? 0 : 1;
}
}
static public int binarySearch(Job jobs[], int index) {
// index is the index of the current job
int low = 0, high = index - 1;
while (low <= high) {
int mid = (high + low) / 2;
if (jobs[mid].finish <= jobs[index].start) {
if (jobs[mid + 1].finish <= jobs[index].start)
low = mid + 1;
else
return mid;
} else
high = mid - 1;
}
return -1;
}
public static int schedule(Job jobs[]) {
Arrays.sort(jobs, new JobComparator());
int n = jobs.length;
int[] table = new int[n];
table[0] = jobs[0].profit;
for (int i = 1; i < n; i++) {
int inclProf = jobs[i].profit;
int latest = binarySearch(jobs, i);
if (latest != -1)
inclProf += table[latest];
table[i] = Math.max(inclProf, table[i - 1]);
}
return table[n - 1];
}
public static void main(String[] args) {
Job jobs[] = { new Job(1, 2, 50), new Job(3, 5, 20), new Job(6, 19, 100), new Job(2, 100, 200) };
System.out.println("Optimal profit is " + schedule(jobs));
}
}
| 1,474 | 0.609227 | 0.584125 | 63 | 22.396826 | 20.776619 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.492064 | false | false | 5 |
dfb854d8b8b9d9655b08e48f175a764ce8a49604 | 8,624,294,372,416 | bb78ece00d39d66ba1d95020e6d56d00d0a19f19 | /src/SecondClass.java | e21bb5368831b2e4eb3dc7c8363486bdfbe679ee | [] | no_license | madinochkab/HelloYou | https://github.com/madinochkab/HelloYou | 9c77900827c38c478b92a2c6d21941d681e9ee88 | 343a28d14c5eaa8c3c003dd8e0918c464a786546 | refs/heads/master | "2021-01-10T07:45:07.104000" | "2016-03-24T04:59:16" | "2016-03-24T04:59:16" | 54,610,626 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //import library to use Scanner object
import java.util.Scanner;
//class to get to know user
public class SecondClass {
//create a class variable of a Scanner object to allow user to input to console
static Scanner scanner = new Scanner (System.in);
//static class variable to hold string array for user info
static String[] userVars;
static String[] details;
//method to say farewell to user
//5
public static void exitApplication(){
System.out.println("\nThanks you for using the SQA Greeting Application!");
//exit the system
System.exit(0);
}
// this is the method of function (components that make up the method form a method signature)
//2
public static String[] requestUserInfo(String name, String... details){
//create an array of strings type, object to hold values for user, size is based on supplied arguments
userVars = new String[details.length];
//greeting of user
System.out.println("I am excited to learn more about you "+ name + "!");
//perform loop for the amount of iteration equal to the length of supplied items
for (int i=0; i<details.length; i++){
//for each iteration ask the user for details
System.out.println("Can I get your " + details[i]+",please?");
//capture user input in relative variable within array
userVars[i]=scanner.nextLine();
}
//return the string array of supllied details
return details;
}
//start 1 and 3
public static void main(String[] args){
//declare local variables
String name;
System.out.println("Hello, and welcome to SQA Selenium bootcamp");
System.out.println("Could I please get your name?");
//set the captured name to a local string variable, name
name = scanner.nextLine();
//call method to get user input and set it to variable which holds an array of strings
details = requestUserInfo(name, " age", " city of residence", " favorite color", " current mood");
//output the info to the user
outputUserDetails(name);
//call method which gives a farewell to user and exits the system
exitApplication();
}
//4
public static void outputUserDetails(String name){
//begin outputing user gathered details such as theirs name
System.out.println("\nWell " + name + ", it seems I have learned enough about you");
//iterate through user details backwards, each iteration echos a detail
for (int i = userVars.length - 1; i>0; i--){
//echo details gathered of user info and requested details to console
System.out.println("your" + details[i] + " is "+ userVars[i]+ ".");
}
}
} | UTF-8 | Java | 2,481 | java | SecondClass.java | Java | [] | null | [] | //import library to use Scanner object
import java.util.Scanner;
//class to get to know user
public class SecondClass {
//create a class variable of a Scanner object to allow user to input to console
static Scanner scanner = new Scanner (System.in);
//static class variable to hold string array for user info
static String[] userVars;
static String[] details;
//method to say farewell to user
//5
public static void exitApplication(){
System.out.println("\nThanks you for using the SQA Greeting Application!");
//exit the system
System.exit(0);
}
// this is the method of function (components that make up the method form a method signature)
//2
public static String[] requestUserInfo(String name, String... details){
//create an array of strings type, object to hold values for user, size is based on supplied arguments
userVars = new String[details.length];
//greeting of user
System.out.println("I am excited to learn more about you "+ name + "!");
//perform loop for the amount of iteration equal to the length of supplied items
for (int i=0; i<details.length; i++){
//for each iteration ask the user for details
System.out.println("Can I get your " + details[i]+",please?");
//capture user input in relative variable within array
userVars[i]=scanner.nextLine();
}
//return the string array of supllied details
return details;
}
//start 1 and 3
public static void main(String[] args){
//declare local variables
String name;
System.out.println("Hello, and welcome to SQA Selenium bootcamp");
System.out.println("Could I please get your name?");
//set the captured name to a local string variable, name
name = scanner.nextLine();
//call method to get user input and set it to variable which holds an array of strings
details = requestUserInfo(name, " age", " city of residence", " favorite color", " current mood");
//output the info to the user
outputUserDetails(name);
//call method which gives a farewell to user and exits the system
exitApplication();
}
//4
public static void outputUserDetails(String name){
//begin outputing user gathered details such as theirs name
System.out.println("\nWell " + name + ", it seems I have learned enough about you");
//iterate through user details backwards, each iteration echos a detail
for (int i = userVars.length - 1; i>0; i--){
//echo details gathered of user info and requested details to console
System.out.println("your" + details[i] + " is "+ userVars[i]+ ".");
}
}
} | 2,481 | 0.730351 | 0.726723 | 65 | 37.184616 | 29.597761 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.384615 | false | false | 5 |
b3f382ebfbb2c8cdbb306451af7a9cfdad904c14 | 10,737,418,243,246 | 9c801ee87ed622d794270d1a4bffb09a193ed005 | /src/main/java/org/mbaum/common/model/ModelValidator.java | 4efe35f1ef93f7a06d487abeb06b8e247acd6fd0 | [] | no_license | mikebaum/hockeystreams | https://github.com/mikebaum/hockeystreams | 81a9d668e097772d00fa940ad8fe521c7e6b8360 | 0b6099d786f7ba2ff4ebd4261c50c1e12a2dcc21 | refs/heads/master | "2021-01-10T01:03:21.010000" | "2014-11-29T12:32:00" | "2014-11-29T12:32:00" | 13,710,433 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.mbaum.common.model;
public interface ModelValidator<M extends ModelSpec>
{
boolean isValid( Model<M> model );
}
| UTF-8 | Java | 129 | java | ModelValidator.java | Java | [] | null | [] | package org.mbaum.common.model;
public interface ModelValidator<M extends ModelSpec>
{
boolean isValid( Model<M> model );
}
| 129 | 0.751938 | 0.751938 | 6 | 20.5 | 20.774584 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 5 |
fac8465785fba50e067fec8852f24a074ce5a7da | 25,417,616,480,488 | 0fb2e474bf41472510550edb01f3bdfabdda3af6 | /ErrorHandling/TimeException.java | 44f70d8a9bde5c1b9d9bf5119440ae55c4053a03 | [] | no_license | akashchouhan16/Java | https://github.com/akashchouhan16/Java | d1575665025f34a61455e076826bded8f347b2e4 | 9bb41570cd7d354bf954e30c8a124af1cfd0a1b6 | refs/heads/main | "2023-04-27T23:14:16.686000" | "2021-05-04T17:12:11" | "2021-05-04T17:12:11" | 350,270,136 | 2 | 0 | null | false | "2021-05-04T17:12:12" | "2021-03-22T08:47:58" | "2021-05-03T15:50:31" | "2021-05-04T17:12:11" | 77 | 1 | 0 | 0 | Java | false | false | import java.io.*;
import java.util.*;
class HourException extends Exception {
public HourException(String s) {
super(s);
}
}
public class TimeException {
static Scanner sc = new Scanner(System.in);
int hour;
void Input() {
System.out.println("Enter Time in Hr : ");
hour = sc.nextInt();
try {
if (hour > 24 || hour < 0) {
throw new HourException("Invalid Time!");
} else {
System.out.println("Valid Time Input!");
}
} catch (HourException err) {
System.out.println(err.getMessage());
}
}
public static void main(String[] args) {
new TimeException().Input();
}
}
| UTF-8 | Java | 735 | java | TimeException.java | Java | [] | null | [] | import java.io.*;
import java.util.*;
class HourException extends Exception {
public HourException(String s) {
super(s);
}
}
public class TimeException {
static Scanner sc = new Scanner(System.in);
int hour;
void Input() {
System.out.println("Enter Time in Hr : ");
hour = sc.nextInt();
try {
if (hour > 24 || hour < 0) {
throw new HourException("Invalid Time!");
} else {
System.out.println("Valid Time Input!");
}
} catch (HourException err) {
System.out.println(err.getMessage());
}
}
public static void main(String[] args) {
new TimeException().Input();
}
}
| 735 | 0.530612 | 0.526531 | 32 | 21.96875 | 18.51095 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.40625 | false | false | 5 |
c53e56ae2e6b51907ec7d0b6619930827824f41c | 17,729,625,020,032 | 404eece5d04bf95d3c7e477551f85a4bfcc0308d | /app/src/main/java/co/original/codigo/ems_tracker/eventBusEvents/LocationUpdateEvent.java | 471b76ace62d089efc4262178257767d1b1924ce | [] | no_license | FelipeGarcia911/ems_tracker_android_vehicle | https://github.com/FelipeGarcia911/ems_tracker_android_vehicle | fb84f32b79ba0395e4aab1d2d5e9f4626769057f | f902617381a90c1f8ab0b2b022580c891b35d949 | refs/heads/master | "2021-01-22T21:16:56.319000" | "2017-03-25T21:46:28" | "2017-03-25T21:46:28" | 85,408,006 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package co.original.codigo.ems_tracker.eventBusEvents;
/**
* Created by Felipe Garcia on 25/03/2017 - 3:06 PM.
*/
public class LocationUpdateEvent{
private int eventType;
private String errorMessage;
private String latitude;
private String longitude;
public static final int ON_LOCATION_UPDATE = 0;
public int getEventType() {
return eventType;
}
public void setEventType(int eventType) {
this.eventType = eventType;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
}
| UTF-8 | Java | 974 | java | LocationUpdateEvent.java | Java | [
{
"context": "igo.ems_tracker.eventBusEvents;\n\n/**\n * Created by Felipe Garcia on 25/03/2017 - 3:06 PM.\n */\n\npublic class Locati",
"end": 87,
"score": 0.9997157454490662,
"start": 74,
"tag": "NAME",
"value": "Felipe Garcia"
}
] | null | [] | package co.original.codigo.ems_tracker.eventBusEvents;
/**
* Created by <NAME> on 25/03/2017 - 3:06 PM.
*/
public class LocationUpdateEvent{
private int eventType;
private String errorMessage;
private String latitude;
private String longitude;
public static final int ON_LOCATION_UPDATE = 0;
public int getEventType() {
return eventType;
}
public void setEventType(int eventType) {
this.eventType = eventType;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
}
| 967 | 0.651951 | 0.63963 | 47 | 19.723404 | 18.702261 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.297872 | false | false | 5 |
d6b16aaa91501f31fc9fc276b41667c661603566 | 22,247,930,647,338 | 1e993b2d43036b7e15d1cc74507535d252c84e65 | /src/test/java/com/el/test/TestDataForBench.java | bf592a58b0155e7fcbf0a7b36a95cd59ba897d0b | [] | no_license | juedaishusheng/stp-svr | https://github.com/juedaishusheng/stp-svr | 9157624172607c5a060bcbef11d5d903f6ccf6d3 | c1448c3c5b087d4742d81f2fe071d400164af3c5 | refs/heads/master | "2020-12-25T14:23:42.363000" | "2016-08-29T08:07:11" | "2016-08-29T08:07:11" | 66,818,112 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.el.test;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* Created on 16/6/30.
*
* @author panlw
*/
public class TestDataForBench {
private static final String T_NEW_USER =
" UNION ALL SELECT 'test_u%d', '9bbb66bda489d8286ff18f8832bbbe399c761237c9d6d0e4029bac1f33e972be'" +
", 1, 'DEV', 1, 'DBA', 'admin' FROM DUAL";
public static String createNewUserSqls(int userIndexFrom, int userCount) {
return IntStream.range(userIndexFrom, userIndexFrom + userCount)
.mapToObj(i -> String.format(T_NEW_USER, i))
.collect(Collectors.joining("\n"));
}
}
| UTF-8 | Java | 653 | java | TestDataForBench.java | Java | [
{
"context": "tStream;\n\n/**\n * Created on 16/6/30.\n *\n * @author panlw\n */\npublic class TestDataForBench {\n\n private ",
"end": 140,
"score": 0.9996665716171265,
"start": 135,
"tag": "USERNAME",
"value": "panlw"
}
] | null | [] | package com.el.test;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* Created on 16/6/30.
*
* @author panlw
*/
public class TestDataForBench {
private static final String T_NEW_USER =
" UNION ALL SELECT 'test_u%d', '9bbb66bda489d8286ff18f8832bbbe399c761237c9d6d0e4029bac1f33e972be'" +
", 1, 'DEV', 1, 'DBA', 'admin' FROM DUAL";
public static String createNewUserSqls(int userIndexFrom, int userCount) {
return IntStream.range(userIndexFrom, userIndexFrom + userCount)
.mapToObj(i -> String.format(T_NEW_USER, i))
.collect(Collectors.joining("\n"));
}
}
| 653 | 0.669219 | 0.600306 | 22 | 28.681818 | 29.818216 | 108 | false | false | 0 | 0 | 0 | 0 | 64 | 0.098009 | 0.636364 | false | false | 5 |
188cd70b7f19051d7b124f000f16f35e544fa21e | 33,182,917,365,585 | 953c2ceda3275c2e5dd551fbb02f93df0eda2983 | /src/evaluationSystemPG1/abstracts/EntitiesDAO.java | cfdba7b73566df2fae4dac87e35c99645b494ff4 | [] | no_license | anleon/EvaluationSystemPG1 | https://github.com/anleon/EvaluationSystemPG1 | 8627849cc6644e1d1aae955ff4f0ccd12a04dc77 | 02be7f26a4b3e76545caf069cb37de7a1fd2c7e8 | refs/heads/master | "2021-01-10T00:53:12.946000" | "2010-12-14T15:55:22" | "2010-12-14T15:55:22" | 1,132,036 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package evaluationSystemPG1.abstracts;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import evaluationSystemPG1.db.HibernateUtil;
import evaluationSystemPG1.entities.Evaluation;
import evaluationSystemPG1.entities.Question;
public abstract class EntitiesDAO<T extends IEntity > {
private Class<T> entityClass;
protected EntitiesDAO(Class<T> entityClass) {
this.entityClass = entityClass;
}
public List<T> getAll(){
Session herbSession = HibernateUtil.getSession();
herbSession.beginTransaction();;
Query query = herbSession.createQuery("from "+ this.entityClass.getName());
herbSession.getTransaction().commit();
List<T> objects = query.list();
return objects;
}
public void saveAll(List<T> object){
Session herbSession = HibernateUtil.getSession();
herbSession.beginTransaction();
herbSession.save(object);
herbSession.getTransaction().commit();
}
public T get(int id){
Session herbSession = HibernateUtil.getSession();
herbSession.beginTransaction();
Criteria criteria = herbSession.createCriteria(this.entityClass);
criteria.add(Restrictions.idEq(id));
herbSession.getTransaction().commit();
T object = (T)criteria.uniqueResult();
return object;
}
public void save(T object){
Session herbSession = HibernateUtil.getSession();
herbSession.beginTransaction();
herbSession.save(object);
herbSession.getTransaction().commit();
}
//Variation
// protected abstract Class<T> myEntityClass();
/*
* tvingad överlagring
* public static IEntity getInstance() throws Exception {
return null;
}*/
}
| UTF-8 | Java | 1,707 | java | EntitiesDAO.java | Java | [] | null | [] | package evaluationSystemPG1.abstracts;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import evaluationSystemPG1.db.HibernateUtil;
import evaluationSystemPG1.entities.Evaluation;
import evaluationSystemPG1.entities.Question;
public abstract class EntitiesDAO<T extends IEntity > {
private Class<T> entityClass;
protected EntitiesDAO(Class<T> entityClass) {
this.entityClass = entityClass;
}
public List<T> getAll(){
Session herbSession = HibernateUtil.getSession();
herbSession.beginTransaction();;
Query query = herbSession.createQuery("from "+ this.entityClass.getName());
herbSession.getTransaction().commit();
List<T> objects = query.list();
return objects;
}
public void saveAll(List<T> object){
Session herbSession = HibernateUtil.getSession();
herbSession.beginTransaction();
herbSession.save(object);
herbSession.getTransaction().commit();
}
public T get(int id){
Session herbSession = HibernateUtil.getSession();
herbSession.beginTransaction();
Criteria criteria = herbSession.createCriteria(this.entityClass);
criteria.add(Restrictions.idEq(id));
herbSession.getTransaction().commit();
T object = (T)criteria.uniqueResult();
return object;
}
public void save(T object){
Session herbSession = HibernateUtil.getSession();
herbSession.beginTransaction();
herbSession.save(object);
herbSession.getTransaction().commit();
}
//Variation
// protected abstract Class<T> myEntityClass();
/*
* tvingad överlagring
* public static IEntity getInstance() throws Exception {
return null;
}*/
}
| 1,707 | 0.747948 | 0.745604 | 72 | 22.694445 | 20.476028 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.611111 | false | false | 5 |
f91bf562d80622b845b87de4ba220f3e711613aa | 11,063,835,809,151 | a7bbf15de6a623a4ffb20b96e31e2237fb884f2c | /src/main/java/com/tiy/ssa/weekone/assignmentone/Power.java | 43989592ff07161bd04e1d630625f861c6d22227 | [] | no_license | mpatrick8303/SSA12Week | https://github.com/mpatrick8303/SSA12Week | 9c94dfb04f5018f839f37f2b6b966e0316ae5dad | 6696dd991625e4ba8b248a56b143c90fd87ad452 | refs/heads/master | "2021-01-09T20:14:28.054000" | "2016-08-19T20:27:04" | "2016-08-19T20:27:04" | 64,668,579 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tiy.ssa.weekone.assignmentone;
public class Power
{
private double result = 1;
private int num;
private int powerO;
public Power(int num, int powerO)
{
this.num = num;
this.powerO = powerO;
}
// public int pOf1()
// {
// result = num;
//
// return result;
// }
//
// public int pOf2()
// {
// result = num*num;
// return result;
// }
//
// public int pOf3()
// {
// result = num*num*num;
// return result;
// }
//
public int pOf()
{
if(powerO < 2)
{
result = num;
}
else
{
result = Math.pow((double)num, (double)powerO);
}
return (int) result;
}
// public int pOf()
// {
//
// int num1 = 1;
//
// if(powerO == 1)
// {
// result = num;
// }
// else
// {
// for(int i = 1; i<=powerO;i++)
// {
// num1 = (int) result;
// result = num1*num;
// }
//
// }
// return (int)result;
// }
}
| UTF-8 | Java | 883 | java | Power.java | Java | [] | null | [] | package com.tiy.ssa.weekone.assignmentone;
public class Power
{
private double result = 1;
private int num;
private int powerO;
public Power(int num, int powerO)
{
this.num = num;
this.powerO = powerO;
}
// public int pOf1()
// {
// result = num;
//
// return result;
// }
//
// public int pOf2()
// {
// result = num*num;
// return result;
// }
//
// public int pOf3()
// {
// result = num*num*num;
// return result;
// }
//
public int pOf()
{
if(powerO < 2)
{
result = num;
}
else
{
result = Math.pow((double)num, (double)powerO);
}
return (int) result;
}
// public int pOf()
// {
//
// int num1 = 1;
//
// if(powerO == 1)
// {
// result = num;
// }
// else
// {
// for(int i = 1; i<=powerO;i++)
// {
// num1 = (int) result;
// result = num1*num;
// }
//
// }
// return (int)result;
// }
}
| 883 | 0.505096 | 0.492639 | 71 | 11.43662 | 10.844266 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.957747 | false | false | 5 |
51a1c113c3c78aeab93c0063c442e18d9e4598e5 | 10,161,892,684,790 | 43b640a1c667f5aecda8e038b1850c58e048febf | /springboot-mybatis-learning/src/test/java/com/learning/springboot/SpringbootMybatisLearningApplicationTests.java | 3daf8f37fa6cef07f345d4e3d7ed2b65e12f8ef5 | [] | no_license | smilekaka/spring-boot-learning | https://github.com/smilekaka/spring-boot-learning | 41a0e550aa64de4c99c5215dcd22d1aa3b650165 | fa792dcb3fc8b93543f9cf771dcae421f62b3602 | refs/heads/master | "2022-11-08T07:58:50.887000" | "2020-06-25T13:49:28" | "2020-06-25T13:49:28" | 274,927,921 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.learning.springboot;
import com.learning.springboot.dao.CategoryDao;
import com.learning.springboot.entity.Category;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@SpringBootTest
@ContextConfiguration(classes = SpringbootMybatisLearningApplication.class)
class SpringbootMybatisLearningApplicationTests {
@Resource
private CategoryDao categoryDao;
@Test
public void selectAllTest() {
List<Category> categories = categoryDao.selectAll();
assertEquals(true, categories.size() > 0);
}
@Test
public void insertTest() {
Category newCategory = new Category();
newCategory.setCategoryID(1000);
newCategory.setCategoryName("test");
newCategory.setDescription("for test");
int result = categoryDao.insert(newCategory);
assertEquals(1, result);
}
@Test
public void deleteByExampleTest() {
Example example = new Example(Category.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("categoryID", 1000);
int result = categoryDao.deleteByExample(example);
assertEquals(1, result);
}
@Test
public void selectByExampleTest() {
Example example = new Example(Category.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("categoryID", 1);
criteria.orEqualTo("categoryID", 2);
categoryDao.selectByExample(example);
}
}
| UTF-8 | Java | 1,752 | java | SpringbootMybatisLearningApplicationTests.java | Java | [] | null | [] | package com.learning.springboot;
import com.learning.springboot.dao.CategoryDao;
import com.learning.springboot.entity.Category;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@SpringBootTest
@ContextConfiguration(classes = SpringbootMybatisLearningApplication.class)
class SpringbootMybatisLearningApplicationTests {
@Resource
private CategoryDao categoryDao;
@Test
public void selectAllTest() {
List<Category> categories = categoryDao.selectAll();
assertEquals(true, categories.size() > 0);
}
@Test
public void insertTest() {
Category newCategory = new Category();
newCategory.setCategoryID(1000);
newCategory.setCategoryName("test");
newCategory.setDescription("for test");
int result = categoryDao.insert(newCategory);
assertEquals(1, result);
}
@Test
public void deleteByExampleTest() {
Example example = new Example(Category.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("categoryID", 1000);
int result = categoryDao.deleteByExample(example);
assertEquals(1, result);
}
@Test
public void selectByExampleTest() {
Example example = new Example(Category.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("categoryID", 1);
criteria.orEqualTo("categoryID", 2);
categoryDao.selectByExample(example);
}
}
| 1,752 | 0.716324 | 0.708904 | 56 | 30.285715 | 22.458466 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 5 |
40ac369c9bbd31c25f3f08caa2a933a57a7815c8 | 36,953,898,624,800 | aef8cebc650d31a169b4acfc2c65258c0ba5cc98 | /app/src/main/java/csc207/gamecentre/memorypuzzle/MPBoardManager.java | 34c51bbd2133311e3cadd4394bfd969e6c1404ba | [] | no_license | MingdiXie/Minesweeper | https://github.com/MingdiXie/Minesweeper | 6026e7fc05a7980416e1f5c1c06f01f9c7a02cb7 | 52b5bdd75f5fca2f2b31780dd0186f05b83c52e1 | refs/heads/master | "2020-06-19T14:41:48.808000" | "2020-04-17T20:23:27" | "2020-04-17T20:23:27" | 196,747,863 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package csc207.gamecentre.memorypuzzle;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import csc207.gamecentre.general.BoardManager;
import csc207.gamecentre.general.Tile;
/**
* A Board Manager refined for Memory Puzzle that extends BoardManager
*/
public class MPBoardManager extends BoardManager implements Serializable {
/**
* The current move in progress
*/
Integer[][] currMove = new Integer[2][2];
/**
* The previous move made
*/
private Integer[][] prevMove = new Integer[2][2];
/**
* The number of moves made
*/
private int numMoves;
/**
* The number of undo moves allowed left
*/
private int numUndo;
/**
* Creates a newly shuffled Memory Puzzle Board Manager for a 6 by 6 board
*/
MPBoardManager() {
super();
List<MPTile> tiles = new ArrayList<>();
int numUniqueTiles = 18;
for (int tileNum = 0; tileNum < numUniqueTiles; tileNum++) {
tiles.add(new MPTile(tileNum + 1));
tiles.add(new MPTile(tileNum + 1));
}
Collections.shuffle(tiles);
this.currBoard = new MPBoard(tiles);
numMoves = 0;
numUndo = 1;
}
/**
* Creates a Memory Puzzle Board Manager for board
*
* @param board the Memory Puzzle board to be managed
*/
public MPBoardManager(MPBoard board) {
super();
this.currBoard = board;
numMoves = 0;
numUndo = 1;
}
/**
* A getter for the board
*
* @return the current board
*/
@Override
public MPBoard getBoard() {
return (MPBoard) this.currBoard;
}
/**
* Returns if the current tile tapped is unflipped
*
* @param position the position of the tile tapped
* @return if the tile is unflipped
*/
@Override
public boolean isValidTap(int position) {
int row = position / currBoard.getNumCols();
int col = position % currBoard.getNumCols();
MPTile curr = (MPTile) currBoard.getTile(row, col);
return !curr.isFlippedUp();
}
/**
* Flips the tile at position
*
* @param position the position of the Tile
*/
@Override
public void touchMove(int position) {
int row = position / currBoard.getNumCols();
int col = position % currBoard.getNumCols();
((MPBoard) currBoard).flipTile(row, col);
Integer[] thisMove = {row, col};
// Add to current move
if (currMove[0][0] == null) {
currMove[0] = thisMove;
} else {
currMove[1] = thisMove;
}
numMoves++;
}
/**
* Resets the move if curr move is full and the two tiles didn't match
* <p>
* Important: must be called after every touchMove
*/
void resetMove() {
// If curr move now full then decide if keep or reflip
if (currMove[1][0] != null) {
// clear current move
prevMove = currMove;
currMove = new Integer[2][2];
int firstTile = currBoard.getTile(prevMove[0][0], prevMove[0][1]).getId();
int secondTile = currBoard.getTile(prevMove[1][0], prevMove[1][1]).getId();
// if they don't match then reflip
if (firstTile != secondTile) {
((MPBoard) currBoard).flipTile(prevMove[0][0], prevMove[0][1]);
((MPBoard) currBoard).flipTile(prevMove[1][0], prevMove[1][1]);
}
}
}
/**
* Returns if all tiles in the puzzle are unflipped
*
* @return if all tiles are unflipped
*/
@Override
public boolean puzzleSolved() {
boolean solved = true;
Iterator<Tile> iter = this.getBoard().iterator();
MPTile curr = (MPTile) iter.next();
while (iter.hasNext() && solved) {
if (!curr.isFlippedUp()) {
solved = false;
}
curr = (MPTile) iter.next();
}
return solved;
}
/**
* Returns the number of moves made in the game
*
* @return the number of moves made
*/
@Override
public int getNumMoves() {
return numMoves;
}
/**
* Returns the score based on moves and time taken.
*
* @return the score
*/
@Override
public int getScore() {
return currBoard.getNumRows() * 10000 - (int) getTileElapsed() / 1000 - 2 * this.getNumMoves();
}
/**
* Undoes the current board by one state
*/
public void undo() {
if (numUndo > 0 && numMoves > 0) {
// undo last flip
if (currMove[1][0] == null) {
// currently in the middle of a move
((MPBoard) currBoard).flipTile(currMove[0][0], currMove[0][1]);
currMove = new Integer[2][2];
} else {
// completed a move
int firstTile = currBoard.getTile(currMove[0][0], currMove[0][1]).getId();
int secondTile = currBoard.getTile(currMove[1][0], currMove[1][1]).getId();
// if they don't match reflip first tile
if (firstTile != secondTile) {
((MPBoard) currBoard).flipTile(currMove[0][0], currMove[0][1]);
} else {
// if they do match reflip second tile
((MPBoard) currBoard).flipTile(currMove[1][0], currMove[1][1]);
}
currMove = prevMove;
currMove[1] = new Integer[2];
}
numUndo = numUndo - 1;
numMoves = numMoves - 1;
}
}
} | UTF-8 | Java | 5,748 | java | MPBoardManager.java | Java | [] | null | [] | package csc207.gamecentre.memorypuzzle;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import csc207.gamecentre.general.BoardManager;
import csc207.gamecentre.general.Tile;
/**
* A Board Manager refined for Memory Puzzle that extends BoardManager
*/
public class MPBoardManager extends BoardManager implements Serializable {
/**
* The current move in progress
*/
Integer[][] currMove = new Integer[2][2];
/**
* The previous move made
*/
private Integer[][] prevMove = new Integer[2][2];
/**
* The number of moves made
*/
private int numMoves;
/**
* The number of undo moves allowed left
*/
private int numUndo;
/**
* Creates a newly shuffled Memory Puzzle Board Manager for a 6 by 6 board
*/
MPBoardManager() {
super();
List<MPTile> tiles = new ArrayList<>();
int numUniqueTiles = 18;
for (int tileNum = 0; tileNum < numUniqueTiles; tileNum++) {
tiles.add(new MPTile(tileNum + 1));
tiles.add(new MPTile(tileNum + 1));
}
Collections.shuffle(tiles);
this.currBoard = new MPBoard(tiles);
numMoves = 0;
numUndo = 1;
}
/**
* Creates a Memory Puzzle Board Manager for board
*
* @param board the Memory Puzzle board to be managed
*/
public MPBoardManager(MPBoard board) {
super();
this.currBoard = board;
numMoves = 0;
numUndo = 1;
}
/**
* A getter for the board
*
* @return the current board
*/
@Override
public MPBoard getBoard() {
return (MPBoard) this.currBoard;
}
/**
* Returns if the current tile tapped is unflipped
*
* @param position the position of the tile tapped
* @return if the tile is unflipped
*/
@Override
public boolean isValidTap(int position) {
int row = position / currBoard.getNumCols();
int col = position % currBoard.getNumCols();
MPTile curr = (MPTile) currBoard.getTile(row, col);
return !curr.isFlippedUp();
}
/**
* Flips the tile at position
*
* @param position the position of the Tile
*/
@Override
public void touchMove(int position) {
int row = position / currBoard.getNumCols();
int col = position % currBoard.getNumCols();
((MPBoard) currBoard).flipTile(row, col);
Integer[] thisMove = {row, col};
// Add to current move
if (currMove[0][0] == null) {
currMove[0] = thisMove;
} else {
currMove[1] = thisMove;
}
numMoves++;
}
/**
* Resets the move if curr move is full and the two tiles didn't match
* <p>
* Important: must be called after every touchMove
*/
void resetMove() {
// If curr move now full then decide if keep or reflip
if (currMove[1][0] != null) {
// clear current move
prevMove = currMove;
currMove = new Integer[2][2];
int firstTile = currBoard.getTile(prevMove[0][0], prevMove[0][1]).getId();
int secondTile = currBoard.getTile(prevMove[1][0], prevMove[1][1]).getId();
// if they don't match then reflip
if (firstTile != secondTile) {
((MPBoard) currBoard).flipTile(prevMove[0][0], prevMove[0][1]);
((MPBoard) currBoard).flipTile(prevMove[1][0], prevMove[1][1]);
}
}
}
/**
* Returns if all tiles in the puzzle are unflipped
*
* @return if all tiles are unflipped
*/
@Override
public boolean puzzleSolved() {
boolean solved = true;
Iterator<Tile> iter = this.getBoard().iterator();
MPTile curr = (MPTile) iter.next();
while (iter.hasNext() && solved) {
if (!curr.isFlippedUp()) {
solved = false;
}
curr = (MPTile) iter.next();
}
return solved;
}
/**
* Returns the number of moves made in the game
*
* @return the number of moves made
*/
@Override
public int getNumMoves() {
return numMoves;
}
/**
* Returns the score based on moves and time taken.
*
* @return the score
*/
@Override
public int getScore() {
return currBoard.getNumRows() * 10000 - (int) getTileElapsed() / 1000 - 2 * this.getNumMoves();
}
/**
* Undoes the current board by one state
*/
public void undo() {
if (numUndo > 0 && numMoves > 0) {
// undo last flip
if (currMove[1][0] == null) {
// currently in the middle of a move
((MPBoard) currBoard).flipTile(currMove[0][0], currMove[0][1]);
currMove = new Integer[2][2];
} else {
// completed a move
int firstTile = currBoard.getTile(currMove[0][0], currMove[0][1]).getId();
int secondTile = currBoard.getTile(currMove[1][0], currMove[1][1]).getId();
// if they don't match reflip first tile
if (firstTile != secondTile) {
((MPBoard) currBoard).flipTile(currMove[0][0], currMove[0][1]);
} else {
// if they do match reflip second tile
((MPBoard) currBoard).flipTile(currMove[1][0], currMove[1][1]);
}
currMove = prevMove;
currMove[1] = new Integer[2];
}
numUndo = numUndo - 1;
numMoves = numMoves - 1;
}
}
} | 5,748 | 0.545755 | 0.530445 | 200 | 27.745001 | 23.387604 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 5 |
0172129d7528d10a8028293d0f4001b73163cfd2 | 34,522,947,159,901 | f04e9757d5479875555d799ba16e03462a124cc8 | /edu.jspiders.oops.interfaces/src/edu/jspiders/oops/interfaces/MySQL.java | 4c9c7e148fcc938f6d5ee02318f43bfb3f4ad38a | [] | no_license | nidhinkjames7/JSPIDERS-CORE_JAVA | https://github.com/nidhinkjames7/JSPIDERS-CORE_JAVA | 207fe5d75bc00628099abab340c006ffae3e2fec | 7825f23721498eeabf754a4214d8c4101d8a1e77 | refs/heads/master | "2022-11-08T22:56:47.856000" | "2020-06-23T20:17:27" | "2020-06-23T20:17:27" | 273,581,201 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.jspiders.oops.interfaces;
public class MySQL implements Connection
{
public void connect()
{
System.out.println("Connect to MySQL");
}
public void disconnect()
{
System.out.println("Disconnect from MySQL");
}
}
| UTF-8 | Java | 248 | java | MySQL.java | Java | [] | null | [] | package edu.jspiders.oops.interfaces;
public class MySQL implements Connection
{
public void connect()
{
System.out.println("Connect to MySQL");
}
public void disconnect()
{
System.out.println("Disconnect from MySQL");
}
}
| 248 | 0.685484 | 0.685484 | 13 | 17.076923 | 17.860405 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 5 |
a20b07ad014daa0579b188d009ae98f704410c72 | 16,080,357,620,844 | 15a04ddc490a2273f9516fb2f730b208c672a7bd | /officefloor/jee/officeservlet_war/src/main/java/net/officefloor/webapp/WebAppOfficeFloorCompilerConfigurationServiceFactory.java | f516ee52c86e6556d6fac3d5468ec7edfe076624 | [
"Apache-2.0"
] | permissive | officefloor/OfficeFloor | https://github.com/officefloor/OfficeFloor | d50c4441e96773e3f33b6a154dcaf049088480a2 | 4bad837e3d71dbc49b161f9814d6b188937ca69d | refs/heads/master | "2023-09-01T12:06:04.230000" | "2023-08-27T16:36:04" | "2023-08-27T16:36:04" | 76,112,580 | 60 | 7 | Apache-2.0 | false | "2023-09-14T20:12:48" | "2016-12-10T12:56:50" | "2023-09-01T21:27:02" | "2023-09-14T20:12:47" | 71,559 | 53 | 5 | 17 | Java | false | false | /*-
* #%L
* OfficeFloor integration of WAR
* %%
* Copyright (C) 2005 - 2020 Daniel Sagenschneider
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package net.officefloor.webapp;
import java.io.File;
import java.net.URL;
import net.officefloor.compile.OfficeFloorCompilerConfigurer;
import net.officefloor.compile.OfficeFloorCompilerConfigurerContext;
import net.officefloor.compile.OfficeFloorCompilerConfigurerServiceFactory;
import net.officefloor.frame.api.source.ServiceContext;
import net.officefloor.servlet.archive.ArchiveAwareClassLoaderFactory;
/**
* Loads the {@link ClassLoader} for WAR.
*
* @author Daniel Sagenschneider
*/
public class WebAppOfficeFloorCompilerConfigurationServiceFactory
implements OfficeFloorCompilerConfigurerServiceFactory {
/*
* ========== OfficeFloorCompilerConfigurationServiceFactory ==========
*/
@Override
public OfficeFloorCompilerConfigurer createService(ServiceContext context) throws Throwable {
// Obtain the location of the web app (WAR)
String webAppPath = context.getProperty(OfficeFloorWar.PROPERTY_WAR_PATH);
// Create and return the configuration
ClassLoader classLoader = context.getClassLoader();
return new WebAppOfficeFlooorConfigurationService(webAppPath, classLoader);
}
/**
* {@link OfficeFloorCompilerConfigurer} for the web app (WAR).
*/
private static class WebAppOfficeFlooorConfigurationService implements OfficeFloorCompilerConfigurer {
/**
* Path to the web app (WAR).
*/
private final String webAppPath;
/**
* {@link ClassLoader}.
*/
private final ClassLoader classLoader;
/**
* Instantiate.
*
* @param webAppPath Path to the web app (WAR).
* @param classLoader {@link ClassLoader}.
*/
private WebAppOfficeFlooorConfigurationService(String webAppPath, ClassLoader classLoader) {
this.webAppPath = webAppPath;
this.classLoader = classLoader;
}
/*
* ============== OfficeFloorCompilerConfigurationService =============
*/
@Override
public void configureOfficeFloorCompiler(OfficeFloorCompilerConfigurerContext context) throws Exception {
// Create class loader for the web application (WAR)
URL webAppUrl = new File(this.webAppPath).toURI().toURL();
ClassLoader compileClassLoader = new ArchiveAwareClassLoaderFactory(this.classLoader)
.createClassLoader(webAppUrl, "WEB-INF/classes/", "WEB-INF/lib/");
// Configure the class loader
context.setClassLoader(compileClassLoader);
}
}
}
| UTF-8 | Java | 3,010 | java | WebAppOfficeFloorCompilerConfigurationServiceFactory.java | Java | [
{
"context": "egration of WAR\n * %%\n * Copyright (C) 2005 - 2020 Daniel Sagenschneider\n * %%\n * Licensed under the Apache License, Versi",
"end": 101,
"score": 0.9998421669006348,
"start": 80,
"tag": "NAME",
"value": "Daniel Sagenschneider"
},
{
"context": "ds the {@link ClassLoader} for WAR.\n * \n * @author Daniel Sagenschneider\n */\npublic class WebAppOfficeFloorCompilerConfigu",
"end": 1171,
"score": 0.9998303055763245,
"start": 1150,
"tag": "NAME",
"value": "Daniel Sagenschneider"
}
] | null | [] | /*-
* #%L
* OfficeFloor integration of WAR
* %%
* Copyright (C) 2005 - 2020 <NAME>
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package net.officefloor.webapp;
import java.io.File;
import java.net.URL;
import net.officefloor.compile.OfficeFloorCompilerConfigurer;
import net.officefloor.compile.OfficeFloorCompilerConfigurerContext;
import net.officefloor.compile.OfficeFloorCompilerConfigurerServiceFactory;
import net.officefloor.frame.api.source.ServiceContext;
import net.officefloor.servlet.archive.ArchiveAwareClassLoaderFactory;
/**
* Loads the {@link ClassLoader} for WAR.
*
* @author <NAME>
*/
public class WebAppOfficeFloorCompilerConfigurationServiceFactory
implements OfficeFloorCompilerConfigurerServiceFactory {
/*
* ========== OfficeFloorCompilerConfigurationServiceFactory ==========
*/
@Override
public OfficeFloorCompilerConfigurer createService(ServiceContext context) throws Throwable {
// Obtain the location of the web app (WAR)
String webAppPath = context.getProperty(OfficeFloorWar.PROPERTY_WAR_PATH);
// Create and return the configuration
ClassLoader classLoader = context.getClassLoader();
return new WebAppOfficeFlooorConfigurationService(webAppPath, classLoader);
}
/**
* {@link OfficeFloorCompilerConfigurer} for the web app (WAR).
*/
private static class WebAppOfficeFlooorConfigurationService implements OfficeFloorCompilerConfigurer {
/**
* Path to the web app (WAR).
*/
private final String webAppPath;
/**
* {@link ClassLoader}.
*/
private final ClassLoader classLoader;
/**
* Instantiate.
*
* @param webAppPath Path to the web app (WAR).
* @param classLoader {@link ClassLoader}.
*/
private WebAppOfficeFlooorConfigurationService(String webAppPath, ClassLoader classLoader) {
this.webAppPath = webAppPath;
this.classLoader = classLoader;
}
/*
* ============== OfficeFloorCompilerConfigurationService =============
*/
@Override
public void configureOfficeFloorCompiler(OfficeFloorCompilerConfigurerContext context) throws Exception {
// Create class loader for the web application (WAR)
URL webAppUrl = new File(this.webAppPath).toURI().toURL();
ClassLoader compileClassLoader = new ArchiveAwareClassLoaderFactory(this.classLoader)
.createClassLoader(webAppUrl, "WEB-INF/classes/", "WEB-INF/lib/");
// Configure the class loader
context.setClassLoader(compileClassLoader);
}
}
}
| 2,980 | 0.746512 | 0.742525 | 98 | 29.714285 | 30.699331 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.22449 | false | false | 5 |
d297d59c1fe20fcbdf1afce6e3b78299482e65be | 30,056,181,195,029 | 2d44a9ef44a1148d0c2f5c31ae6c62e606e82ab9 | /src/main/java/ar/com/draimo/jitws/dao/IQuincenaDAO.java | de37d69d1ba0b2f7be2af20015e5ef3b531f2086 | [] | no_license | mangelino997/app2Full-backend | https://github.com/mangelino997/app2Full-backend | a363ce61347f5aafee170bf993233e79f59883f5 | 3734d962582434d205e21673092453ebbd84535a | refs/heads/master | "2022-11-29T15:03:04.915000" | "2020-08-09T05:09:21" | "2020-08-09T05:09:21" | 286,170,793 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //Paquete al que pertenece la interfaz
package ar.com.draimo.jitws.dao;
import ar.com.draimo.jitws.model.Quincena;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* Interfaz DAO Quincena
* Define los metodos particulares contra la base de datos
* @author blas
*/
public interface IQuincenaDAO extends JpaRepository<Quincena, Integer> {
//Obtiene el ultimo registro
public Quincena findTopByOrderByIdDesc();
//Obtiene una lista por nombre
public List<Quincena> findByNombreContaining(String nombre);
} | UTF-8 | Java | 579 | java | IQuincenaDAO.java | Java | [
{
"context": "os particulares contra la base de datos\n * @author blas\n */\n\npublic interface IQuincenaDAO extends JpaRep",
"end": 305,
"score": 0.9987667798995972,
"start": 301,
"tag": "USERNAME",
"value": "blas"
}
] | null | [] | //Paquete al que pertenece la interfaz
package ar.com.draimo.jitws.dao;
import ar.com.draimo.jitws.model.Quincena;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* Interfaz DAO Quincena
* Define los metodos particulares contra la base de datos
* @author blas
*/
public interface IQuincenaDAO extends JpaRepository<Quincena, Integer> {
//Obtiene el ultimo registro
public Quincena findTopByOrderByIdDesc();
//Obtiene una lista por nombre
public List<Quincena> findByNombreContaining(String nombre);
} | 579 | 0.75475 | 0.75475 | 22 | 25.363636 | 23.35603 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.318182 | false | false | 5 |
da2ea69337ae88d1f03939da1ae531960cf93f65 | 23,862,838,356,430 | 6eff86c360f6bf64c236983f1ac086829452abeb | /app/src/main/java/com/cc/callcenter/callcenter/retrofit/KullaniciDto.java | d85bc8ef3714ba20bcd56f7e1f6ca7580381a4f0 | [
"MIT"
] | permissive | temelt/CallCenter | https://github.com/temelt/CallCenter | 27805b6438389e234a1634bf2039fd95a5cd4120 | 30f4156ddf565bb7ebb419d596b52d6c8d916dee | refs/heads/master | "2020-03-22T13:59:56.444000" | "2019-03-12T17:25:27" | "2019-03-12T17:25:27" | 140,146,670 | 0 | 0 | null | false | "2019-03-12T17:25:28" | "2018-07-08T07:25:43" | "2018-07-22T09:30:11" | "2019-03-12T17:25:28" | 165 | 0 | 0 | 0 | Java | false | null | package com.cc.callcenter.callcenter.retrofit;
/**
* Created by vektorel on 01.07.2018.
*/
public class KullaniciDto {
private Long id;
private String ad;
private String soyad;
private String username;
private String password;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAd() {
return ad;
}
public void setAd(String ad) {
this.ad = ad;
}
public String getSoyad() {
return soyad;
}
public void setSoyad(String soyad) {
this.soyad = soyad;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "KullaniciDto{" +
"id=" + id +
", ad='" + ad + '\'' +
", soyad='" + soyad + '\'' +
", username='" + username + '\'' +
", password='" + password + '\'' +
'}';
}
}
| UTF-8 | Java | 1,251 | java | KullaniciDto.java | Java | [
{
"context": "callcenter.callcenter.retrofit;\n\n/**\n * Created by vektorel on 01.07.2018.\n */\n\npublic class KullaniciDto {\n\n",
"end": 74,
"score": 0.9997279644012451,
"start": 66,
"tag": "USERNAME",
"value": "vektorel"
},
{
"context": "sername(String username) {\n this.username = username;\n }\n\n public String getPassword() {\n ",
"end": 766,
"score": 0.9416645765304565,
"start": 758,
"tag": "USERNAME",
"value": "username"
},
{
"context": "\n\n public String getPassword() {\n return password;\n }\n\n public void setPassword(String passwo",
"end": 832,
"score": 0.528889000415802,
"start": 824,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "assword(String password) {\n this.password = password;\n }\n\n @Override\n public String toString(",
"end": 920,
"score": 0.9088267087936401,
"start": 912,
"tag": "PASSWORD",
"value": "password"
},
{
"context": " + soyad + '\\'' +\n \", username='\" + username + '\\'' +\n \", password='\" + passwor",
"end": 1161,
"score": 0.9557210803031921,
"start": 1153,
"tag": "USERNAME",
"value": "username"
},
{
"context": "username + '\\'' +\n \", password='\" + password + '\\'' +\n '}';\n }\n}\n",
"end": 1212,
"score": 0.9931847453117371,
"start": 1204,
"tag": "PASSWORD",
"value": "password"
}
] | null | [] | package com.cc.callcenter.callcenter.retrofit;
/**
* Created by vektorel on 01.07.2018.
*/
public class KullaniciDto {
private Long id;
private String ad;
private String soyad;
private String username;
private String password;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAd() {
return ad;
}
public void setAd(String ad) {
this.ad = ad;
}
public String getSoyad() {
return soyad;
}
public void setSoyad(String soyad) {
this.soyad = soyad;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return <PASSWORD>;
}
public void setPassword(String password) {
this.password = <PASSWORD>;
}
@Override
public String toString() {
return "KullaniciDto{" +
"id=" + id +
", ad='" + ad + '\'' +
", soyad='" + soyad + '\'' +
", username='" + username + '\'' +
", password='" + <PASSWORD> + '\'' +
'}';
}
}
| 1,257 | 0.511591 | 0.505196 | 65 | 18.246155 | 15.726539 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.323077 | false | false | 5 |
137ff91d105addc83f5d98616763ea0565b906ae | 33,818,572,525,830 | 8fc788c1e250f3e7f6e2ef3ca670c5ebfdf97991 | /src/main/java/org/rcsb/mmtf/collectors/CountAtoms.java | e4b6f862446b4b206a0749413583c0ec16b39ead | [] | no_license | rcsb/mmtf-spark-utils | https://github.com/rcsb/mmtf-spark-utils | a16bbdf166e5606883c880a75ea125b21b5481e2 | 6017ae1c32664afe44536f69bfd1606639daba6f | refs/heads/master | "2021-01-10T05:04:01.560000" | "2018-11-29T18:11:24" | "2018-11-29T18:11:24" | 51,963,305 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.rcsb.mmtf.collectors;
import org.apache.spark.api.java.function.PairFunction;
import org.biojava.nbio.structure.Chain;
import org.biojava.nbio.structure.Group;
import org.biojava.nbio.structure.Structure;
import scala.Tuple2;
/**
*
* @author Anthony Bradley
* Class to count the number of Atoms in the PDB
*/
public class CountAtoms implements PairFunction<Tuple2<String, Structure>, String, Integer> {
private static final long serialVersionUID = 2788962017828944159L;
private Integer getAtoms(Structure input){
// Get the number of atoms in the structure
int outAns = 0;
try{
for (Chain c: input.getChains()){
for(Group g: c.getAtomGroups()){
outAns+=g.getAtoms().size();
}
}
return outAns;
}
catch(IndexOutOfBoundsException e){
return 0;
}
}
@Override
public Tuple2<String, Integer> call(Tuple2<String, Structure> t) throws Exception {
Tuple2<String, Integer> outAns = new Tuple2<String, Integer>(t._1, getAtoms(t._2));
return outAns;
}
}
| UTF-8 | Java | 1,017 | java | CountAtoms.java | Java | [
{
"context": "ructure;\n\nimport scala.Tuple2;\n\n/**\n * \n * @author Anthony Bradley\n * Class to count the number of Atoms in the PDB\n",
"end": 276,
"score": 0.9998863339424133,
"start": 261,
"tag": "NAME",
"value": "Anthony Bradley"
}
] | null | [] | package org.rcsb.mmtf.collectors;
import org.apache.spark.api.java.function.PairFunction;
import org.biojava.nbio.structure.Chain;
import org.biojava.nbio.structure.Group;
import org.biojava.nbio.structure.Structure;
import scala.Tuple2;
/**
*
* @author <NAME>
* Class to count the number of Atoms in the PDB
*/
public class CountAtoms implements PairFunction<Tuple2<String, Structure>, String, Integer> {
private static final long serialVersionUID = 2788962017828944159L;
private Integer getAtoms(Structure input){
// Get the number of atoms in the structure
int outAns = 0;
try{
for (Chain c: input.getChains()){
for(Group g: c.getAtomGroups()){
outAns+=g.getAtoms().size();
}
}
return outAns;
}
catch(IndexOutOfBoundsException e){
return 0;
}
}
@Override
public Tuple2<String, Integer> call(Tuple2<String, Structure> t) throws Exception {
Tuple2<String, Integer> outAns = new Tuple2<String, Integer>(t._1, getAtoms(t._2));
return outAns;
}
}
| 1,008 | 0.718781 | 0.690265 | 44 | 22.113636 | 25.607365 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.545455 | false | false | 5 |
4d422fb5b7358de358b20bd07f5256df9df14f5d | 11,888,469,539,585 | 4c71a0da0e7ecb3d130da17517e589febfe59091 | /Java-XML-Processing/src/main/java/com/jverstry/stax/StAX.java | 1bcb57bb601a504d18f605f1152164ef7e82ef8d | [] | no_license | JVerstry/Java-Mavenized-Examples | https://github.com/JVerstry/Java-Mavenized-Examples | 31b25e2136652ecf1a55eb92a0c921ffd8616612 | c08dd4edfbfb917402ef36ddd416672be1ca280d | refs/heads/master | "2022-12-03T13:41:39.982000" | "2013-08-30T16:19:18" | "2013-08-30T16:19:18" | 5,264,258 | 8 | 11 | null | false | "2022-11-24T03:02:35" | "2012-08-01T20:18:43" | "2018-02-02T10:01:08" | "2022-11-24T03:02:32" | 269 | 12 | 18 | 8 | Java | false | false |
package com.jverstry.stax;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Iterator;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
public class StAX {
public static void main(String[] args) throws XMLStreamException, FileNotFoundException {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
InputStream IS = StAX.class.getResourceAsStream("/rates.xml");
XMLEventReader eventReader = inputFactory.createXMLEventReader(IS);
// Pulling XML elements
while (eventReader.hasNext()) {
XMLEvent event = eventReader.nextEvent();
if (event.isStartElement()) {
StartElement se = event.asStartElement();
// Filtering on Cube elements
if (se.getName().getLocalPart().equals("Cube")) {
Iterator it = se.getAttributes();
while (it.hasNext()) {
Attribute a = (Attribute) it.next();
System.out.print(a.getValue() + " ");
}
eventReader.nextEvent();
System.out.println("");
continue;
}
}
}
}
}
| UTF-8 | Java | 1,299 | java | StAX.java | Java | [] | null | [] |
package com.jverstry.stax;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Iterator;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
public class StAX {
public static void main(String[] args) throws XMLStreamException, FileNotFoundException {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
InputStream IS = StAX.class.getResourceAsStream("/rates.xml");
XMLEventReader eventReader = inputFactory.createXMLEventReader(IS);
// Pulling XML elements
while (eventReader.hasNext()) {
XMLEvent event = eventReader.nextEvent();
if (event.isStartElement()) {
StartElement se = event.asStartElement();
// Filtering on Cube elements
if (se.getName().getLocalPart().equals("Cube")) {
Iterator it = se.getAttributes();
while (it.hasNext()) {
Attribute a = (Attribute) it.next();
System.out.print(a.getValue() + " ");
}
eventReader.nextEvent();
System.out.println("");
continue;
}
}
}
}
}
| 1,299 | 0.677444 | 0.677444 | 55 | 22.6 | 21.686695 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.109091 | false | false | 5 |
912c7be59c62d0ae45c2737b1e92aa6b936fb218 | 38,972,533,271,997 | a7cf1de9a3f85dae9c348a7b81ae400b3ae7a7d5 | /src/co/mm/bank/services/BankService.java | 155cd718c43ae8d74f5951857c76e92536c0cf4e | [] | no_license | natdanaimon/OTPServer | https://github.com/natdanaimon/OTPServer | ad565d9bf32f6f3bcf1fdc2a101dc5f56fb9acfb | 7f2eb16fe13eea29cedf65ef6b9cd4018f12ae73 | refs/heads/master | "2020-05-03T09:14:13.001000" | "2019-10-23T15:44:57" | "2019-10-23T15:44:57" | 178,548,733 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 co.mm.bank.services;
import co.mm.sms.CallNotification;
import co.mm.sms.GatewayStatusNotification;
import co.mm.sms.InboundNotification;
import co.mm.sms.OrphanedMessageNotification;
import co.mm.util.FormatUtil;
import co.mm.util.LogUtil;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.FilenameUtils;
import org.smslib.AGateway;
import org.smslib.GatewayException;
import org.smslib.InboundMessage;
import org.smslib.Message;
import org.smslib.SMSLibException;
import org.smslib.Service;
import org.smslib.modem.SerialModemGateway;
/**
*
* @author
*/
public final class BankService {
public int portStart = 0;
public int portEnd = 0;
public String fixPort = "";
public BankService(int _portStart, int _portEnd, String _fixPort) {
RemoveHistoryLogs(System.getProperty("app.path.log"));
this.portStart = _portStart;
this.portEnd = _portEnd;
this.fixPort = (_fixPort != null ? _fixPort : "");
}
public void InsertOTP() {
List<InboundMessage> msgList;
InboundNotification inboundNotification = new InboundNotification();
CallNotification callNotification = new CallNotification();
GatewayStatusNotification statusNotification = new GatewayStatusNotification();
OrphanedMessageNotification orphanedMessageNotification = new OrphanedMessageNotification();
try {
Service.getInstance().setInboundMessageNotification(inboundNotification);
Service.getInstance().setCallNotification(callNotification);
Service.getInstance().setGatewayStatusNotification(statusNotification);
Service.getInstance().setOrphanedMessageNotification(orphanedMessageNotification);
for (SerialModemGateway g : listGateWayPortActive()) {
Service.getInstance().removeGateway(g);
Service.getInstance().addGateway(g);
}
Service.getInstance().startService();
msgList = new ArrayList<InboundMessage>();
Service.getInstance().readMessages(msgList, InboundMessage.MessageClasses.ALL);
for (InboundMessage msg : msgList) {
AGateway agw = Service.getInstance().getGateway(msg.getGatewayId());
inboundNotification.process(agw, Message.MessageTypes.INBOUND, msg);
}
System.out.println("Now Sleeping - Hit <enter> to stop service.");
System.in.read();
System.in.read();
} catch (Exception e) {
System.out.println("InsertOTP Exception : " + e.getMessage());
LogUtil.getLogService().error("InsertOTP Exception : " + e.getMessage());
} finally {
try {
Service.getInstance().stopService();
} catch (SMSLibException | IOException | InterruptedException ex1) {
Logger.getLogger(BankService.class.getName()).log(Level.SEVERE, null, ex1);
}
}
}
public List<SerialModemGateway> listGateWayPortActive() {
List<SerialModemGateway> ls = new ArrayList<SerialModemGateway>();
if (!fixPort.equals("")) {
String[] port = fixPort.split(",");
for (String p : port) {
SerialModemGateway gateway = new SerialModemGateway("", "COM" + p, 115200, "", "");
gateway.setProtocol(AGateway.Protocols.PDU);
gateway.setInbound(true);
gateway.setOutbound(true);
// gateway.setSimPin("000" + p);
ls.add(gateway);
System.out.println("COM" + p + " : Add to List");
}
} else {
for (int i = portStart; i <= portEnd; i++) {
SerialModemGateway gateway = new SerialModemGateway("", "COM" + i, 115200, "", "");
try {
gateway.setProtocol(AGateway.Protocols.PDU);
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("000" + i);
Service.getInstance().addGateway(gateway);
Service.getInstance().S.SERIAL_TIMEOUT = 1000;
Service.getInstance().startService();
ls.add(gateway);
System.out.println("COM" + i + " : Success");
LogUtil.getLogService().info("COM" + i + " : Success");
} catch (IOException | InterruptedException | SMSLibException e) {
System.out.println("COM" + i + " : " + e.getMessage());
LogUtil.getLogService().error("COM" + i + " : " + e.getMessage());
} finally {
try {
Service.getInstance().stopService();
} catch (SMSLibException | IOException | InterruptedException ex1) {
LogUtil.getLogService().error("SMSLibException | IOException | InterruptedException ex1 : " + ex1.getMessage());
}
try {
Service.getInstance().removeGateway(gateway);
} catch (GatewayException gex) {
LogUtil.getLogService().error("GatewayException : " + gex.getMessage());
}
}
}
}
return ls;
}
public void RemoveHistoryLogs(String logPath) {
File folder = new File(logPath);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
String fType = FilenameUtils.getExtension(listOfFiles[i].getName()).toLowerCase();
String fName = listOfFiles[i].getName();
try {
if (!fType.equals("log")
&& !fType.equals(FormatUtil.DateDelFileTH(1)) && !fType.equals(FormatUtil.DateDelFileTH(2))
&& !fType.equals(FormatUtil.DateDelFileEN(1)) && !fType.equals(FormatUtil.DateDelFileEN(2))) {
File fDel = new File(logPath + "/" + fName);
LogUtil.getLogService().info(fType + " / " + fName);
LogUtil.getLogService().info(FormatUtil.DateDelFileTH(1) + " | " + FormatUtil.DateDelFileTH(2));
LogUtil.getLogService().info(FormatUtil.DateDelFileEN(1) + " | " + FormatUtil.DateDelFileEN(2));
if (fDel.delete()) {
LogUtil.getLogService().info(fDel.getName() + " is del!");
System.out.println(fDel.getName() + " is del!");
} else {
LogUtil.getLogService().info("Del (" + fDel.getName() + ") oper is failed.");
System.out.println("Del (" + fDel.getName() + ") oper is failed.");
}
}
} catch (Exception e) {
}
} else if (listOfFiles[i].isDirectory()) {
}
}
}
}
| UTF-8 | Java | 7,536 | java | BankService.java | Java | [] | null | [] | /*
* 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 co.mm.bank.services;
import co.mm.sms.CallNotification;
import co.mm.sms.GatewayStatusNotification;
import co.mm.sms.InboundNotification;
import co.mm.sms.OrphanedMessageNotification;
import co.mm.util.FormatUtil;
import co.mm.util.LogUtil;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.FilenameUtils;
import org.smslib.AGateway;
import org.smslib.GatewayException;
import org.smslib.InboundMessage;
import org.smslib.Message;
import org.smslib.SMSLibException;
import org.smslib.Service;
import org.smslib.modem.SerialModemGateway;
/**
*
* @author
*/
public final class BankService {
public int portStart = 0;
public int portEnd = 0;
public String fixPort = "";
public BankService(int _portStart, int _portEnd, String _fixPort) {
RemoveHistoryLogs(System.getProperty("app.path.log"));
this.portStart = _portStart;
this.portEnd = _portEnd;
this.fixPort = (_fixPort != null ? _fixPort : "");
}
public void InsertOTP() {
List<InboundMessage> msgList;
InboundNotification inboundNotification = new InboundNotification();
CallNotification callNotification = new CallNotification();
GatewayStatusNotification statusNotification = new GatewayStatusNotification();
OrphanedMessageNotification orphanedMessageNotification = new OrphanedMessageNotification();
try {
Service.getInstance().setInboundMessageNotification(inboundNotification);
Service.getInstance().setCallNotification(callNotification);
Service.getInstance().setGatewayStatusNotification(statusNotification);
Service.getInstance().setOrphanedMessageNotification(orphanedMessageNotification);
for (SerialModemGateway g : listGateWayPortActive()) {
Service.getInstance().removeGateway(g);
Service.getInstance().addGateway(g);
}
Service.getInstance().startService();
msgList = new ArrayList<InboundMessage>();
Service.getInstance().readMessages(msgList, InboundMessage.MessageClasses.ALL);
for (InboundMessage msg : msgList) {
AGateway agw = Service.getInstance().getGateway(msg.getGatewayId());
inboundNotification.process(agw, Message.MessageTypes.INBOUND, msg);
}
System.out.println("Now Sleeping - Hit <enter> to stop service.");
System.in.read();
System.in.read();
} catch (Exception e) {
System.out.println("InsertOTP Exception : " + e.getMessage());
LogUtil.getLogService().error("InsertOTP Exception : " + e.getMessage());
} finally {
try {
Service.getInstance().stopService();
} catch (SMSLibException | IOException | InterruptedException ex1) {
Logger.getLogger(BankService.class.getName()).log(Level.SEVERE, null, ex1);
}
}
}
public List<SerialModemGateway> listGateWayPortActive() {
List<SerialModemGateway> ls = new ArrayList<SerialModemGateway>();
if (!fixPort.equals("")) {
String[] port = fixPort.split(",");
for (String p : port) {
SerialModemGateway gateway = new SerialModemGateway("", "COM" + p, 115200, "", "");
gateway.setProtocol(AGateway.Protocols.PDU);
gateway.setInbound(true);
gateway.setOutbound(true);
// gateway.setSimPin("000" + p);
ls.add(gateway);
System.out.println("COM" + p + " : Add to List");
}
} else {
for (int i = portStart; i <= portEnd; i++) {
SerialModemGateway gateway = new SerialModemGateway("", "COM" + i, 115200, "", "");
try {
gateway.setProtocol(AGateway.Protocols.PDU);
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("000" + i);
Service.getInstance().addGateway(gateway);
Service.getInstance().S.SERIAL_TIMEOUT = 1000;
Service.getInstance().startService();
ls.add(gateway);
System.out.println("COM" + i + " : Success");
LogUtil.getLogService().info("COM" + i + " : Success");
} catch (IOException | InterruptedException | SMSLibException e) {
System.out.println("COM" + i + " : " + e.getMessage());
LogUtil.getLogService().error("COM" + i + " : " + e.getMessage());
} finally {
try {
Service.getInstance().stopService();
} catch (SMSLibException | IOException | InterruptedException ex1) {
LogUtil.getLogService().error("SMSLibException | IOException | InterruptedException ex1 : " + ex1.getMessage());
}
try {
Service.getInstance().removeGateway(gateway);
} catch (GatewayException gex) {
LogUtil.getLogService().error("GatewayException : " + gex.getMessage());
}
}
}
}
return ls;
}
public void RemoveHistoryLogs(String logPath) {
File folder = new File(logPath);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
String fType = FilenameUtils.getExtension(listOfFiles[i].getName()).toLowerCase();
String fName = listOfFiles[i].getName();
try {
if (!fType.equals("log")
&& !fType.equals(FormatUtil.DateDelFileTH(1)) && !fType.equals(FormatUtil.DateDelFileTH(2))
&& !fType.equals(FormatUtil.DateDelFileEN(1)) && !fType.equals(FormatUtil.DateDelFileEN(2))) {
File fDel = new File(logPath + "/" + fName);
LogUtil.getLogService().info(fType + " / " + fName);
LogUtil.getLogService().info(FormatUtil.DateDelFileTH(1) + " | " + FormatUtil.DateDelFileTH(2));
LogUtil.getLogService().info(FormatUtil.DateDelFileEN(1) + " | " + FormatUtil.DateDelFileEN(2));
if (fDel.delete()) {
LogUtil.getLogService().info(fDel.getName() + " is del!");
System.out.println(fDel.getName() + " is del!");
} else {
LogUtil.getLogService().info("Del (" + fDel.getName() + ") oper is failed.");
System.out.println("Del (" + fDel.getName() + ") oper is failed.");
}
}
} catch (Exception e) {
}
} else if (listOfFiles[i].isDirectory()) {
}
}
}
}
| 7,536 | 0.559448 | 0.554406 | 192 | 38.25 | 32.51474 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.640625 | false | false | 5 |
45e04d276139fc771372daeffa325373b01d8d4d | 29,205,777,619,588 | 287eb89274497cf3ec6bc44c4fe8bab1d81ddc9d | /src/main/java/com/wg8/gof23/proxy/dynamicproxy/Client.java | daa6c45a78cbb7ca804496c168199af3a01f7cb4 | [] | no_license | wg8/JavaStudy | https://github.com/wg8/JavaStudy | bfc4dd481d34b29730b9b7070671b18192f5cd09 | 3bf81c3dea181517c07f730cd3fa59cd4f29ccaa | refs/heads/master | "2020-05-02T17:51:28.343000" | "2019-05-22T11:32:17" | "2019-05-22T11:32:17" | 178,111,361 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wg8.gof23.proxy.dynamicproxy;
import java.lang.reflect.Proxy;
/**
* @author Harry
* @date 2019/4/2 10:23 PM
*/
public class Client {
public static void main(String[] args) {
Star realStar = new RealStar();
StarHandler starHandler = new StarHandler(realStar);
Star proxyStar = (Star) Proxy.newProxyInstance(ClassLoader.getSystemClassLoader(), new Class[]{Star.class}, starHandler);
proxyStar.bookTicket();
proxyStar.sing();
}
}
| UTF-8 | Java | 494 | java | Client.java | Java | [
{
"context": ";\n\nimport java.lang.reflect.Proxy;\n\n/**\n * @author Harry\n * @date 2019/4/2 10:23 PM\n */\npublic class Clien",
"end": 96,
"score": 0.9996853470802307,
"start": 91,
"tag": "NAME",
"value": "Harry"
}
] | null | [] | package com.wg8.gof23.proxy.dynamicproxy;
import java.lang.reflect.Proxy;
/**
* @author Harry
* @date 2019/4/2 10:23 PM
*/
public class Client {
public static void main(String[] args) {
Star realStar = new RealStar();
StarHandler starHandler = new StarHandler(realStar);
Star proxyStar = (Star) Proxy.newProxyInstance(ClassLoader.getSystemClassLoader(), new Class[]{Star.class}, starHandler);
proxyStar.bookTicket();
proxyStar.sing();
}
}
| 494 | 0.67004 | 0.643725 | 19 | 25 | 30.321089 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473684 | false | false | 5 |
f4b13932465c99b4d32ea270250e8bc85e3275a6 | 4,398,046,526,220 | d1edc361eb38549cc40895bfa8ac33e7bed67882 | /DataAccess/src/daos/StateDAO.java | 765894274a8aaa9144ae1fc484a264d4d247342f | [] | no_license | dlmn592/AplicaionesWeb-DHM | https://github.com/dlmn592/AplicaionesWeb-DHM | b451a837a512fe46f1f9186b621720c6a666ef9d | 8700be2e908cb4875cdd9ffadd2925b92496c5b0 | refs/heads/main | "2023-08-01T03:27:46.181000" | "2021-09-08T17:03:42" | "2021-09-08T17:03:42" | 404,401,895 | 0 | 0 | null | true | "2021-09-08T15:34:27" | "2021-09-08T15:34:26" | "2021-09-08T15:32:50" | "2021-09-08T15:32:47" | 2,067 | 0 | 0 | 0 | null | false | false | package daos;
import businessObjects.State;
import com.mongodb.client.MongoCollection;
import static com.mongodb.client.model.Filters.eq;
import java.util.List;
import org.bson.types.ObjectId;
import org.bson.Document;
public class StateDAO implements DAO<State> {
MongoCollection<State> collection = instance.getConnection().getCollection("States", State.class);
@Override
public boolean insert(State item) {
try{
collection.insertOne(item);
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return true;
}
@Override
public boolean delete(ObjectId idItem) {
try{
collection.deleteOne(eq("_id", idItem));
}catch(Exception ex){
System.out.println(ex.getMessage());
}
return true;
}
@Override
public boolean deleteItem(ObjectId idItem, ObjectId idDelete) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean update(State item) {
try {
collection.updateOne(eq("_id", item.getId()), new Document("$set",
new Document().append("name", item.getName()).append("municipalities", item.getMunicipalities())));
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return true;
}
@Override
public State find(ObjectId id) {
State state = null;
try {
state = collection.find(eq("_id", id)).first();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return state;
}
@Override
public List<State> findAll() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<State> findLike(String pattern) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<State> findMany(int many) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| UTF-8 | Java | 2,380 | java | StateDAO.java | Java | [] | null | [] | package daos;
import businessObjects.State;
import com.mongodb.client.MongoCollection;
import static com.mongodb.client.model.Filters.eq;
import java.util.List;
import org.bson.types.ObjectId;
import org.bson.Document;
public class StateDAO implements DAO<State> {
MongoCollection<State> collection = instance.getConnection().getCollection("States", State.class);
@Override
public boolean insert(State item) {
try{
collection.insertOne(item);
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return true;
}
@Override
public boolean delete(ObjectId idItem) {
try{
collection.deleteOne(eq("_id", idItem));
}catch(Exception ex){
System.out.println(ex.getMessage());
}
return true;
}
@Override
public boolean deleteItem(ObjectId idItem, ObjectId idDelete) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean update(State item) {
try {
collection.updateOne(eq("_id", item.getId()), new Document("$set",
new Document().append("name", item.getName()).append("municipalities", item.getMunicipalities())));
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return true;
}
@Override
public State find(ObjectId id) {
State state = null;
try {
state = collection.find(eq("_id", id)).first();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return state;
}
@Override
public List<State> findAll() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<State> findLike(String pattern) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<State> findMany(int many) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| 2,380 | 0.617227 | 0.617227 | 83 | 27.674698 | 33.233788 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.506024 | false | false | 5 |
ec27e1f3b558431489c866b84ce54852f39fcc0f | 8,847,632,643,662 | 23e84ab899c247d9e339573e3512b7c1d8bd9d85 | /proyectos-v1/SuperTourist/src/supertourist/data/OrdenServicioData.java | 9a653a77a88bf672c8fc10f4a7992c04fca17df9 | [] | no_license | adineri/spring-master | https://github.com/adineri/spring-master | f7b3f4e862358ed31a05f91ae64ebf472917bcf4 | 619e72de5dbd6d6795d4cc15053ceedfb8a2f164 | refs/heads/master | "2021-09-13T01:51:56.194000" | "2018-04-23T15:41:27" | "2018-04-23T15:41:27" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 supertourist.data;
import java.util.ArrayList;
/**
*
* @author diego
*/
public class OrdenServicioData {
private int id;
private int suscription;
private int user;
private int almacen;
private int celular;
private int encargado;
private int ordenPrestadores;
private int asesor;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getSuscription() {
return suscription;
}
public void setSuscription(int suscription) {
this.suscription = suscription;
}
public int getUser() {
return user;
}
public void setUser(int user) {
this.user = user;
}
public int getAlmacen() {
return almacen;
}
public void setAlmacen(int almacen) {
this.almacen = almacen;
}
public int getCelular() {
return celular;
}
public void setCelular(int celular) {
this.celular = celular;
}
public int getEncargado() {
return encargado;
}
public void setEncargado(int encargado) {
this.encargado = encargado;
}
public int getPrestadores() {
return ordenPrestadores;
}
public void setPrestadores(int prestadores) {
this.ordenPrestadores = prestadores;
}
public int getAsesor() {
return asesor;
}
public void setAsesor(int asesor) {
this.asesor = asesor;
}
}
| UTF-8 | Java | 1,669 | java | OrdenServicioData.java | Java | [
{
"context": "a;\n\nimport java.util.ArrayList;\n\n/**\n *\n * @author diego\n */\npublic class OrdenServicioData {\n private ",
"end": 265,
"score": 0.9945015907287598,
"start": 260,
"tag": "USERNAME",
"value": "diego"
}
] | null | [] | /*
* 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 supertourist.data;
import java.util.ArrayList;
/**
*
* @author diego
*/
public class OrdenServicioData {
private int id;
private int suscription;
private int user;
private int almacen;
private int celular;
private int encargado;
private int ordenPrestadores;
private int asesor;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getSuscription() {
return suscription;
}
public void setSuscription(int suscription) {
this.suscription = suscription;
}
public int getUser() {
return user;
}
public void setUser(int user) {
this.user = user;
}
public int getAlmacen() {
return almacen;
}
public void setAlmacen(int almacen) {
this.almacen = almacen;
}
public int getCelular() {
return celular;
}
public void setCelular(int celular) {
this.celular = celular;
}
public int getEncargado() {
return encargado;
}
public void setEncargado(int encargado) {
this.encargado = encargado;
}
public int getPrestadores() {
return ordenPrestadores;
}
public void setPrestadores(int prestadores) {
this.ordenPrestadores = prestadores;
}
public int getAsesor() {
return asesor;
}
public void setAsesor(int asesor) {
this.asesor = asesor;
}
}
| 1,669 | 0.611144 | 0.611144 | 89 | 17.75281 | 16.772959 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.325843 | false | false | 5 |
3ef603d8ac6391cfd29b35cc66f7ba031c062d5b | 6,880,537,614,084 | bd972190a073214bd282c8589ab44296bd0b76be | /src/main/java/sk/durco/promanagement/configuration/WebSecurityConfig.java | d4343c8fca11a4a339d852062c9a889a2bf4d962 | [] | no_license | durixx/pro_management | https://github.com/durixx/pro_management | 99a937c192a84fd8d63574cf40f593bd7868108e | bb95e2a1e84e6aa94e954dd776c1a239157cf1a9 | refs/heads/master | "2021-05-08T22:50:51.374000" | "2018-01-31T13:15:06" | "2018-01-31T13:15:06" | 119,687,451 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sk.durco.promanagement.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
// .antMatchers("/login").permitAll()
// .antMatchers("/resource/**").permitAll()
// .antMatchers("/home").hasAnyRole("PM", "VEDUCI", "BOSS")
.anyRequest().permitAll()
/*
.and()
.formLogin()
.loginPage("/login")
.failureUrl("/login?error")
.successForwardUrl("/login_success")
.passwordParameter("password")
.usernameParameter("username")
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/login?logout")
.invalidateHttpSession(true)
.deleteCookies("JSESSIONID")
*/
;
}
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
//hierarchia
//BOSS->PM->VEDUCI
auth
.inMemoryAuthentication()
.withUser("tomasm").password("tomasm").roles("PM", "VEDUCI", "BOSS");
auth
.inMemoryAuthentication()
.withUser("jurajbo").password("jurajbo").roles("VEDUCI");
auth
.inMemoryAuthentication()
.withUser("bucek").password("bucek").roles("VEDUCI", "PM");
}
}
| UTF-8 | Java | 2,141 | java | WebSecurityConfig.java | Java | [
{
"context": "in_success\")\r\n .passwordParameter(\"password\")\r\n .usernameParameter(\"username\")",
"end": 1233,
"score": 0.9994021654129028,
"start": 1225,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "(\"password\")\r\n .usernameParameter(\"username\")\r\n .and()\r\n\r\n .log",
"end": 1281,
"score": 0.9981801509857178,
"start": 1273,
"tag": "USERNAME",
"value": "username"
},
{
"context": "emoryAuthentication()\r\n .withUser(\"tomasm\").password(\"tomasm\").roles(\"PM\", \"VEDUCI\", \"BOSS\"",
"end": 1809,
"score": 0.9993366599082947,
"start": 1803,
"tag": "USERNAME",
"value": "tomasm"
},
{
"context": "()\r\n .withUser(\"tomasm\").password(\"tomasm\").roles(\"PM\", \"VEDUCI\", \"BOSS\");\r\n auth\r\n ",
"end": 1828,
"score": 0.9994555711746216,
"start": 1822,
"tag": "PASSWORD",
"value": "tomasm"
},
{
"context": "emoryAuthentication()\r\n .withUser(\"jurajbo\").password(\"jurajbo\").roles(\"VEDUCI\");\r\n a",
"end": 1954,
"score": 0.9994136095046997,
"start": 1947,
"tag": "USERNAME",
"value": "jurajbo"
},
{
"context": ")\r\n .withUser(\"jurajbo\").password(\"jurajbo\").roles(\"VEDUCI\");\r\n auth\r\n ",
"end": 1974,
"score": 0.9994281530380249,
"start": 1967,
"tag": "PASSWORD",
"value": "jurajbo"
},
{
"context": "emoryAuthentication()\r\n .withUser(\"bucek\").password(\"bucek\").roles(\"VEDUCI\", \"PM\");\r\n\r\n ",
"end": 2084,
"score": 0.9993331432342529,
"start": 2079,
"tag": "USERNAME",
"value": "bucek"
},
{
"context": "n()\r\n .withUser(\"bucek\").password(\"bucek\").roles(\"VEDUCI\", \"PM\");\r\n\r\n }\r\n}\r\n",
"end": 2102,
"score": 0.999468207359314,
"start": 2097,
"tag": "PASSWORD",
"value": "bucek"
}
] | null | [] | package sk.durco.promanagement.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
// .antMatchers("/login").permitAll()
// .antMatchers("/resource/**").permitAll()
// .antMatchers("/home").hasAnyRole("PM", "VEDUCI", "BOSS")
.anyRequest().permitAll()
/*
.and()
.formLogin()
.loginPage("/login")
.failureUrl("/login?error")
.successForwardUrl("/login_success")
.passwordParameter("<PASSWORD>")
.usernameParameter("username")
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/login?logout")
.invalidateHttpSession(true)
.deleteCookies("JSESSIONID")
*/
;
}
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
//hierarchia
//BOSS->PM->VEDUCI
auth
.inMemoryAuthentication()
.withUser("tomasm").password("<PASSWORD>").roles("PM", "VEDUCI", "BOSS");
auth
.inMemoryAuthentication()
.withUser("jurajbo").password("<PASSWORD>").roles("VEDUCI");
auth
.inMemoryAuthentication()
.withUser("bucek").password("<PASSWORD>").roles("VEDUCI", "PM");
}
}
| 2,155 | 0.58057 | 0.58057 | 58 | 34.913792 | 28.729586 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.258621 | false | false | 5 |
62047a3824f3f39299b3d58d8868705cf7638b12 | 18,786,186,963,935 | bb450bef04f1fab24a03858343f3e8fd9c5061ee | /tests/sources/local/java/0_api_calls/src/main/java/api/calls/Main.java | 921a3494cfdf2f00b06000b4690463815373be86 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bsc-wdc/compss | https://github.com/bsc-wdc/compss | c02b1c6a611ed50d5f75716d35bd8201889ae9d8 | 5f7a31436d0e6f5acbeb66fa36ab8aad18dc4092 | refs/heads/stable | "2023-08-16T02:51:46.073000" | "2023-08-04T21:43:31" | "2023-08-04T21:43:31" | 123,949,037 | 39 | 21 | Apache-2.0 | false | "2022-07-05T04:08:53" | "2018-03-05T16:44:51" | "2022-06-16T04:31:46" | "2022-07-05T04:08:53" | 294,836 | 31 | 14 | 7 | Java | false | false | package api.calls;
import es.bsc.compss.api.COMPSs;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Three tasks without dependencies that are scheduled one after the other because of the barrier call.
*/
public class Main {
/*
* HELPER METHODS
*/
private static void initCounter(String counterName, int value) throws IOException {
// Write value
try (FileOutputStream fos = new FileOutputStream(counterName)) {
fos.write(value);
System.out.println("Initial " + counterName + " value is " + value);
}
}
private static void printCounter(String counterName) throws IOException {
System.out.println("After Sending task");
try (FileInputStream fis = new FileInputStream(counterName)) {
System.out.println("Final " + counterName + " value is " + fis.read());
}
}
private static void testBarrier(int initialValue) throws IOException {
// Initialize independent counters
String counterName1 = "counter1";
String counterName2 = "counter2";
String counterName3 = "counter3";
initCounter(counterName1, initialValue);
initCounter(counterName2, initialValue);
initCounter(counterName3, initialValue);
// Execute task
MainImpl.increment(counterName1);
// Regular barrier
COMPSs.barrier();
// Execute task
MainImpl.increment(counterName2);
// Barrier with noMoreTasks false
COMPSs.barrier(false);
MainImpl.increment(counterName3);
// Barrier with noMoreTasks true
COMPSs.barrier(true);
// Retrieve counter results
printCounter(counterName1);
printCounter(counterName2);
printCounter(counterName3);
}
/**
* Test main method.
*
* @param args System arguments
* @throws IOException When processing test files.
*/
public static void main(String[] args) throws IOException {
// Check and get parameters
if (args.length != 1) {
System.out.println("[ERROR] Bad number of parameters");
System.out.println(" Usage: java_api_calls.Main <counterValue>");
System.exit(-1);
}
int initialValue = Integer.parseInt(args[0]);
// ------------------------------------------------------------------------
// Barrier test
testBarrier(initialValue);
}
}
| UTF-8 | Java | 2,516 | java | Main.java | Java | [] | null | [] | package api.calls;
import es.bsc.compss.api.COMPSs;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Three tasks without dependencies that are scheduled one after the other because of the barrier call.
*/
public class Main {
/*
* HELPER METHODS
*/
private static void initCounter(String counterName, int value) throws IOException {
// Write value
try (FileOutputStream fos = new FileOutputStream(counterName)) {
fos.write(value);
System.out.println("Initial " + counterName + " value is " + value);
}
}
private static void printCounter(String counterName) throws IOException {
System.out.println("After Sending task");
try (FileInputStream fis = new FileInputStream(counterName)) {
System.out.println("Final " + counterName + " value is " + fis.read());
}
}
private static void testBarrier(int initialValue) throws IOException {
// Initialize independent counters
String counterName1 = "counter1";
String counterName2 = "counter2";
String counterName3 = "counter3";
initCounter(counterName1, initialValue);
initCounter(counterName2, initialValue);
initCounter(counterName3, initialValue);
// Execute task
MainImpl.increment(counterName1);
// Regular barrier
COMPSs.barrier();
// Execute task
MainImpl.increment(counterName2);
// Barrier with noMoreTasks false
COMPSs.barrier(false);
MainImpl.increment(counterName3);
// Barrier with noMoreTasks true
COMPSs.barrier(true);
// Retrieve counter results
printCounter(counterName1);
printCounter(counterName2);
printCounter(counterName3);
}
/**
* Test main method.
*
* @param args System arguments
* @throws IOException When processing test files.
*/
public static void main(String[] args) throws IOException {
// Check and get parameters
if (args.length != 1) {
System.out.println("[ERROR] Bad number of parameters");
System.out.println(" Usage: java_api_calls.Main <counterValue>");
System.exit(-1);
}
int initialValue = Integer.parseInt(args[0]);
// ------------------------------------------------------------------------
// Barrier test
testBarrier(initialValue);
}
}
| 2,516 | 0.6093 | 0.602146 | 83 | 29.313253 | 25.926647 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.39759 | false | false | 5 |
a65ec9c4ca8c145ce65c23aa6d1061799b5983e7 | 8,624,294,338,211 | 0242fded20f1a0661250582d30f27fd8b44dbb43 | /src/test/java/org/project/locators/CreateLocators.java | 8e5cf33fd0c242efe6bd8a4933bc42dcd0606dac | [] | no_license | christopherac90/Automation | https://github.com/christopherac90/Automation | 5d439c04c8589517e40b625beac547eb3dc3154b | 28692e27c30838c70a48dc8efd9ead9f3db677e5 | refs/heads/master | "2020-06-16T14:07:19.614000" | "2019-07-07T03:50:48" | "2019-07-07T03:50:48" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.project.locators;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.project.configurations.selenium.PageObjectBase;
public class CreateLocators extends PageObjectBase {
public CreateLocators(WebDriver driver) {
super(driver);
}
@FindBy(id="id_username")
protected WebElement userNameElement;
@FindBy(id="id_password1")
protected WebElement passwordElement;
@FindBy(id="id_password2")
protected WebElement passwordElement2;
@FindBy(id="id_is_staff")
protected WebElement checkBox;
// @FindBy(name="_save")
// protected WebElement submitElement;
@FindBy(css="[type='submit']")
protected WebElement submitElement;
@FindBy(name="_continue")
protected WebElement submitElementContinue;
@FindBy(css="div.field-password div div.help a")
protected WebElement changePassElement;
@FindBy(id="id_new_password2")
protected WebElement newPassword2Element;
}
| UTF-8 | Java | 1,035 | java | CreateLocators.java | Java | [
{
"context": ") {\n super(driver);\n }\n\n @FindBy(id=\"id_username\")\n protected WebElement userNameElement;\n\n ",
"end": 367,
"score": 0.7747971415519714,
"start": 356,
"tag": "USERNAME",
"value": "id_username"
}
] | null | [] | package org.project.locators;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.project.configurations.selenium.PageObjectBase;
public class CreateLocators extends PageObjectBase {
public CreateLocators(WebDriver driver) {
super(driver);
}
@FindBy(id="id_username")
protected WebElement userNameElement;
@FindBy(id="id_password1")
protected WebElement passwordElement;
@FindBy(id="id_password2")
protected WebElement passwordElement2;
@FindBy(id="id_is_staff")
protected WebElement checkBox;
// @FindBy(name="_save")
// protected WebElement submitElement;
@FindBy(css="[type='submit']")
protected WebElement submitElement;
@FindBy(name="_continue")
protected WebElement submitElementContinue;
@FindBy(css="div.field-password div div.help a")
protected WebElement changePassElement;
@FindBy(id="id_new_password2")
protected WebElement newPassword2Element;
}
| 1,035 | 0.7343 | 0.729469 | 39 | 25.538462 | 19.094698 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 5 |
ee28131e25ede8ce2bad0ef1a5c83f10e8ea8bc0 | 19,112,604,471,941 | d2df3fd866b0c6014a90ea1e3618c4d999ce5762 | /core/src/works/maatwerk/generals/NetworkTestsRunnable.java | e0c53e7efe3741494e70610f581ccbdd547dd085 | [] | no_license | Ixbitz/Generals | https://github.com/Ixbitz/Generals | 3c227e12e6f6c218537b0ed6ce8c2be33285b9bc | f168b8832d90a0366ea9632427c6672e9baa4cc4 | refs/heads/master | "2020-01-16T10:48:00.161000" | "2018-02-27T14:47:05" | "2018-02-27T14:47:05" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package works.maatwerk.generals;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Net;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.JsonWriter;
import com.github.czyzby.websocket.WebSocket;
import com.github.czyzby.websocket.WebSockets;
import works.maatwerk.generals.models.Person;
import works.maatwerk.generals.responselisteners.AllGamesResponseListener;
import works.maatwerk.generals.responselisteners.TestSocketListener;
import java.io.StringWriter;
class NetworkTestsRunnable implements Runnable {
private void testWebSockets() {
Gdx.app.debug("Network", "Beginning websocket test");
WebSocket socket = WebSockets.newSocket("ws://52.28.233.213:9000/game");
socket.setSerializeAsString(true);
socket.addListener(new TestSocketListener());
socket.connect();
Gdx.app.debug("JSON", "Serializing object to json");
Json json = new Json(JsonWriter.OutputType.json);
Person teun = new Person();
teun.setTeLaat(true);
teun.setTeun("ja");
teun.setTriggerLevel(9001);
String packet = json.toJson(teun);
Gdx.app.debug("Network", "Sending packet to websocket: " + packet);
socket.send(packet);
}
/**
* Testing the http functions of libgdx
*/
private void testRestAPI() {
Gdx.app.debug("Network", "Testing REST API");
//request to use for future networking
Net.HttpRequest request = new Net.HttpRequest();
testRESTGet(request);
//post request
testRESTPost(request);
}
private void testRESTGet(Net.HttpRequest request) {
Gdx.app.debug("Network", "Testing REST GET");
//get request
request.setMethod(Net.HttpMethods.GET);
request.setUrl("http://52.28.233.213:9000/games");
Gdx.net.sendHttpRequest(request, new AllGamesResponseListener());
}
private void testRESTPost(Net.HttpRequest request) {
Gdx.app.debug("Network", "Testing REST POST");
request.setMethod(Net.HttpMethods.POST);
request.setUrl("http://52.28.233.213:9000/games");
request.setHeader("Content-Type", "application/json"); //needed so the server knows what to expect ;)
Json json = getTestingJson();
//put the object as a string in the request body
//ok so this is ugly. First getWriter gets a JSonwriter -- we dont want that. Second gets the native java stringwriter.
request.setContent(json.getWriter().getWriter().toString());
//send!
Gdx.net.sendHttpRequest(request, null);
}
private Json getTestingJson() {
Gdx.app.debug("JSON", "Writing JSON objects from scratch");
//creating a json body to post
Json json = new Json(JsonWriter.OutputType.json);
//write to a string
json.setWriter(new StringWriter());
//start creating the object
json.writeObjectStart();
json.writeValue("name", "Game 3");
json.writeValue("host", "Job's Server (May or May Not be running)");
json.writeObjectEnd();
return json;
}
@Override
public void run() {
testRestAPI();
testWebSockets();
}
} | UTF-8 | Java | 3,223 | java | NetworkTestsRunnable.java | Java | [
{
"context": "badlogic.gdx.utils.JsonWriter;\nimport com.github.czyzby.websocket.WebSocket;\nimport com.github.czyzby.web",
"end": 194,
"score": 0.9015511870384216,
"start": 189,
"tag": "USERNAME",
"value": "zyzby"
},
{
"context": "ub.czyzby.websocket.WebSocket;\nimport com.github.czyzby.websocket.WebSockets;\nimport works.maatwerk.gener",
"end": 240,
"score": 0.8578936457633972,
"start": 235,
"tag": "USERNAME",
"value": "zyzby"
},
{
"context": " WebSocket socket = WebSockets.newSocket(\"ws://52.28.233.213:9000/game\");\n socket.setSerializeAsString(",
"end": 699,
"score": 0.9996597766876221,
"start": 686,
"tag": "IP_ADDRESS",
"value": "52.28.233.213"
},
{
"context": ".HttpMethods.GET);\n request.setUrl(\"http://52.28.233.213:9000/games\");\n Gdx.net.sendHttpRequest(req",
"end": 1815,
"score": 0.9996670484542847,
"start": 1802,
"tag": "IP_ADDRESS",
"value": "52.28.233.213"
},
{
"context": "HttpMethods.POST);\n request.setUrl(\"http://52.28.233.213:9000/games\");\n request.setHeader(\"Content-",
"end": 2117,
"score": 0.9984639286994934,
"start": 2104,
"tag": "IP_ADDRESS",
"value": "52.28.233.213"
}
] | null | [] | package works.maatwerk.generals;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Net;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.JsonWriter;
import com.github.czyzby.websocket.WebSocket;
import com.github.czyzby.websocket.WebSockets;
import works.maatwerk.generals.models.Person;
import works.maatwerk.generals.responselisteners.AllGamesResponseListener;
import works.maatwerk.generals.responselisteners.TestSocketListener;
import java.io.StringWriter;
class NetworkTestsRunnable implements Runnable {
private void testWebSockets() {
Gdx.app.debug("Network", "Beginning websocket test");
WebSocket socket = WebSockets.newSocket("ws://172.16.17.32:9000/game");
socket.setSerializeAsString(true);
socket.addListener(new TestSocketListener());
socket.connect();
Gdx.app.debug("JSON", "Serializing object to json");
Json json = new Json(JsonWriter.OutputType.json);
Person teun = new Person();
teun.setTeLaat(true);
teun.setTeun("ja");
teun.setTriggerLevel(9001);
String packet = json.toJson(teun);
Gdx.app.debug("Network", "Sending packet to websocket: " + packet);
socket.send(packet);
}
/**
* Testing the http functions of libgdx
*/
private void testRestAPI() {
Gdx.app.debug("Network", "Testing REST API");
//request to use for future networking
Net.HttpRequest request = new Net.HttpRequest();
testRESTGet(request);
//post request
testRESTPost(request);
}
private void testRESTGet(Net.HttpRequest request) {
Gdx.app.debug("Network", "Testing REST GET");
//get request
request.setMethod(Net.HttpMethods.GET);
request.setUrl("http://172.16.17.32:9000/games");
Gdx.net.sendHttpRequest(request, new AllGamesResponseListener());
}
private void testRESTPost(Net.HttpRequest request) {
Gdx.app.debug("Network", "Testing REST POST");
request.setMethod(Net.HttpMethods.POST);
request.setUrl("http://172.16.17.32:9000/games");
request.setHeader("Content-Type", "application/json"); //needed so the server knows what to expect ;)
Json json = getTestingJson();
//put the object as a string in the request body
//ok so this is ugly. First getWriter gets a JSonwriter -- we dont want that. Second gets the native java stringwriter.
request.setContent(json.getWriter().getWriter().toString());
//send!
Gdx.net.sendHttpRequest(request, null);
}
private Json getTestingJson() {
Gdx.app.debug("JSON", "Writing JSON objects from scratch");
//creating a json body to post
Json json = new Json(JsonWriter.OutputType.json);
//write to a string
json.setWriter(new StringWriter());
//start creating the object
json.writeObjectStart();
json.writeValue("name", "Game 3");
json.writeValue("host", "Job's Server (May or May Not be running)");
json.writeObjectEnd();
return json;
}
@Override
public void run() {
testRestAPI();
testWebSockets();
}
} | 3,220 | 0.657772 | 0.64319 | 99 | 31.565657 | 26.506016 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 5 |
bbc33831bd65c1d4877085ffe7809ea83985c2b3 | 31,963,146,639,749 | bd35d1ef836016a05d39f0b5171313202db362ab | /src/com/omis/item/FigthWeapon.java | 94b9527c99242e79301f623330f214bbbd845066 | [] | no_license | demcy/OmisGame | https://github.com/demcy/OmisGame | 1170f1b8397afc7dd4acf70984f3bed6a67d3c4d | a1bdfe53d8f21c263a70643e37c56190d137fcc7 | refs/heads/main | "2023-04-17T20:44:51.853000" | "2021-05-04T16:57:12" | "2021-05-04T16:57:12" | 359,868,021 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.omis.item;
public interface FigthWeapon {
double hit();
}
| UTF-8 | Java | 75 | java | FigthWeapon.java | Java | [] | null | [] | package com.omis.item;
public interface FigthWeapon {
double hit();
}
| 75 | 0.706667 | 0.706667 | 5 | 14 | 11.781342 | 30 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 5 |
20e5d715aa7f513054f919408dc67c2c13a182d1 | 23,880,018,194,224 | aad09895b047161a58f907b5f846541d21df0d5f | /core/src/main/java/br/com/tiagodeliberali/ecommerce/core/application/port/in/GetCartQuery.java | f131aa6c239983fe2521d226d3f5701631111f3c | [] | no_license | tiagodeliberali/ecommerce | https://github.com/tiagodeliberali/ecommerce | fac0f7ac377650f5c29bf797053159c17455db0f | 6ae164181f10fa401e1f71d156905a49934fe599 | refs/heads/main | "2023-05-01T14:27:24.704000" | "2021-05-18T03:19:28" | "2021-05-18T03:19:28" | 365,095,770 | 1 | 0 | null | false | "2021-05-18T03:19:29" | "2021-05-07T02:47:20" | "2021-05-18T03:07:20" | "2021-05-18T03:19:28" | 201 | 1 | 0 | 0 | Java | false | false | package br.com.tiagodeliberali.ecommerce.core.application.port.in;
import br.com.tiagodeliberali.ecommerce.core.domain.Cart;
import br.com.tiagodeliberali.ecommerce.core.domain.UserId;
public interface GetCartQuery {
Cart getActiveCart(UserId userId);
}
| UTF-8 | Java | 260 | java | GetCartQuery.java | Java | [] | null | [] | package br.com.tiagodeliberali.ecommerce.core.application.port.in;
import br.com.tiagodeliberali.ecommerce.core.domain.Cart;
import br.com.tiagodeliberali.ecommerce.core.domain.UserId;
public interface GetCartQuery {
Cart getActiveCart(UserId userId);
}
| 260 | 0.819231 | 0.819231 | 8 | 31.5 | 26.348625 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 5 |
2c6dc8229b67c97623c0f8273f204ab9769f9aaa | 29,918,742,199,308 | 91a34e2f46f6c50c0379f3fd861180184e0f3a06 | /src/main/java/com/aflabs/hubot/core/event/deep/IntellectualSubjectEvent.java | 4516f0b9bdfbcc812d154bc2c17853b1e044ff2b | [] | no_license | shastrijs/Hubo | https://github.com/shastrijs/Hubo | e254d95070ab67ab2c8ad474a410a642efe8eaef | b12c675b6b7b8383db17795ffb43b423a6b2b36a | refs/heads/master | "2020-03-08T06:03:02.476000" | "2018-06-11T16:26:08" | "2018-06-11T16:26:08" | 127,962,108 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.aflabs.hubot.core.event.deep;
import com.aflabs.hubot.core.event.SubjectEvent;
import com.aflabs.hubot.core.event.deep.behavior.IIntellectualSubjectEvent;
public class IntellectualSubjectEvent extends SubjectEvent implements IIntellectualSubjectEvent{
public IntellectualSubjectEvent() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 453 | java | IntellectualSubjectEvent.java | Java | [] | null | [] | package com.aflabs.hubot.core.event.deep;
import com.aflabs.hubot.core.event.SubjectEvent;
import com.aflabs.hubot.core.event.deep.behavior.IIntellectualSubjectEvent;
public class IntellectualSubjectEvent extends SubjectEvent implements IIntellectualSubjectEvent{
public IntellectualSubjectEvent() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| 453 | 0.770419 | 0.770419 | 17 | 24.647058 | 29.166744 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.647059 | false | false | 5 |
cadf53142b71555da2ccf6548d174c60788bfe19 | 24,060,406,795,957 | 18bec7e5eab91bf9003d5dcaf536737253c74e95 | /leetcode/src/main/java/collection/MinaClient.java | 0dd24704280825618fe00c5f484690be682cc622 | [] | no_license | xuxin930/leetcode | https://github.com/xuxin930/leetcode | ef0332afd6efebd2db8d2d8c536d0b3c8315639a | 2e3c0764868e49826daf37e80054f952e57bbb7e | refs/heads/master | "2023-08-06T01:37:30.895000" | "2023-08-04T12:58:05" | "2023-08-04T12:58:05" | 182,922,926 | 1 | 0 | null | false | "2023-08-04T12:57:58" | "2019-04-23T03:32:17" | "2023-07-27T11:31:58" | "2023-08-04T12:57:57" | 105 | 1 | 0 | 2 | Java | false | false | package collection;
import org.apache.mina.core.future.ConnectFuture;
import org.apache.mina.core.service.IoConnector;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.LineDelimiter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.transport.socket.nio.NioSocketConnector;
import java.net.InetSocketAddress;
import java.nio.charset.Charset;
public class MinaClient {
static String HOST = "127.0.0.1";
static int PORT = 18081;
public static void main(String[] args) {
IoSession session = null;
IoConnector connector = new NioSocketConnector();
connector.setConnectTimeoutMillis(3000);
connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8"), LineDelimiter.WINDOWS.getValue(),LineDelimiter.WINDOWS.getValue())));
// connector.setHandler(new MyHandler());
ConnectFuture future = connector.connect(new InetSocketAddress(HOST, PORT));
future.awaitUninterruptibly(); //等待链接
session = future.getSession();
session.write("wolaila");
session.getCloseFuture().awaitUninterruptibly(); //等待关闭链接
connector.dispose();
}
}
| UTF-8 | Java | 1,337 | java | MinaClient.java | Java | [
{
"context": "blic class MinaClient {\n static String HOST = \"127.0.0.1\";\n static int PORT = 18081;\n public static ",
"end": 546,
"score": 0.9993917942047119,
"start": 537,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
}
] | null | [] | package collection;
import org.apache.mina.core.future.ConnectFuture;
import org.apache.mina.core.service.IoConnector;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.LineDelimiter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.transport.socket.nio.NioSocketConnector;
import java.net.InetSocketAddress;
import java.nio.charset.Charset;
public class MinaClient {
static String HOST = "127.0.0.1";
static int PORT = 18081;
public static void main(String[] args) {
IoSession session = null;
IoConnector connector = new NioSocketConnector();
connector.setConnectTimeoutMillis(3000);
connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8"), LineDelimiter.WINDOWS.getValue(),LineDelimiter.WINDOWS.getValue())));
// connector.setHandler(new MyHandler());
ConnectFuture future = connector.connect(new InetSocketAddress(HOST, PORT));
future.awaitUninterruptibly(); //等待链接
session = future.getSession();
session.write("wolaila");
session.getCloseFuture().awaitUninterruptibly(); //等待关闭链接
connector.dispose();
}
}
| 1,337 | 0.744115 | 0.731967 | 30 | 42.900002 | 35.504318 | 196 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.9 | false | false | 5 |
806dfdd48ca82a5a3ed8e55bdd9a8abe2e1c2a0e | 15,418,932,648,430 | 6b3cfaaf9049abec162a6118a599320b53453817 | /Project1/src/org/bridgelabz/datastructure1/PrimeNumbersInA2DArray.java | 2f99f6eb0861f499b1a3b3cca643b11dccbd17eb | [] | no_license | 1301mohit/basic-datastructure-oops-programs | https://github.com/1301mohit/basic-datastructure-oops-programs | 9d833ef3fab17d01f65513d9eecb8c58dbc1417c | 7cfca8505bada8ed972cc3f952ab8a812e9a70f1 | refs/heads/master | "2021-10-10T21:12:40.665000" | "2019-01-17T14:09:53" | "2019-01-17T14:09:53" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.bridgelabz.datastructure1;
import org.bridgelabz.utility.Utility;
/**
* Purpose: To represent the prime numbers in the range of 0 - 1000 in 2D array.
*
* @author Mohit Kumar
* @version 1.0
* @since 03.01.2019
*/
public class PrimeNumbersInA2DArray {
public static void main(String[] args) {
System.out.println("Enter range");
int range = Utility.getInt();
String prime[][] = Utility.primeNumbersInA2DArray(range);
for(int i=0; i<prime.length; i++) {
for(int j=0; j<prime[0].length; j++) {
if(prime[i][j] != null)
System.out.print(prime[i][j]+" ");
}
System.out.println();
System.out.println();
}
}
}
| UTF-8 | Java | 660 | java | PrimeNumbersInA2DArray.java | Java | [
{
"context": "the range of 0 - 1000 in 2D array.\n * \n * @author Mohit Kumar\n * @version 1.0\n * @since 03.01.2019\n */\npublic",
"end": 192,
"score": 0.9998792409896851,
"start": 181,
"tag": "NAME",
"value": "Mohit Kumar"
}
] | null | [] | package org.bridgelabz.datastructure1;
import org.bridgelabz.utility.Utility;
/**
* Purpose: To represent the prime numbers in the range of 0 - 1000 in 2D array.
*
* @author <NAME>
* @version 1.0
* @since 03.01.2019
*/
public class PrimeNumbersInA2DArray {
public static void main(String[] args) {
System.out.println("Enter range");
int range = Utility.getInt();
String prime[][] = Utility.primeNumbersInA2DArray(range);
for(int i=0; i<prime.length; i++) {
for(int j=0; j<prime[0].length; j++) {
if(prime[i][j] != null)
System.out.print(prime[i][j]+" ");
}
System.out.println();
System.out.println();
}
}
}
| 655 | 0.648485 | 0.615152 | 28 | 22.571428 | 20.38632 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.607143 | false | false | 5 |
f4bce00f1ee356b791076432e0f57b61193f78cd | 37,589,553,793,798 | c126a85db19b5920b911d262282cd51a7f2bc2dd | /LibreriaEnCasa/src/main/java/eu/victor/lopez/romero/storage/Library.java | 6cf99e2386b402444b973e1b64478b47b3a1f811 | [] | no_license | viticlick/exercises-libreria-en-casa | https://github.com/viticlick/exercises-libreria-en-casa | 1e063c26787b21d6be8b1f3d3208bd92d2fe218b | 90c69733b386dfdc5093ddfbd5c1d23dc9d431f9 | refs/heads/master | "2021-01-11T15:30:45.043000" | "2017-01-29T18:47:29" | "2017-01-29T18:47:29" | 80,363,056 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package eu.victor.lopez.romero.storage;
import java.util.Collection;
import eu.victor.lopez.romero.beans.Book;
import eu.victor.lopez.romero.beans.Genre;
public interface Library {
Book getBook(long id);
void addBook(Book book);
Collection<Book> getBooks();
Collection<Book> getBooksByGenre(Genre genre);
}
| UTF-8 | Java | 320 | java | Library.java | Java | [] | null | [] | package eu.victor.lopez.romero.storage;
import java.util.Collection;
import eu.victor.lopez.romero.beans.Book;
import eu.victor.lopez.romero.beans.Genre;
public interface Library {
Book getBook(long id);
void addBook(Book book);
Collection<Book> getBooks();
Collection<Book> getBooksByGenre(Genre genre);
}
| 320 | 0.765625 | 0.765625 | 17 | 17.82353 | 17.544012 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.823529 | false | false | 5 |
3c814316d61161041156b7958878199350a6c872 | 33,938,831,602,623 | ab8df62fb39d86b8e9aa5264453bd6dbb2232001 | /app/src/main/java/com/example/saveus/Fragments/PersonalInformation.java | c08062473663c43781f0f2645f4fdf7d25167d16 | [] | no_license | israelelchdad/saveusvp | https://github.com/israelelchdad/saveusvp | 2f84caa11dd19537b5651ec73f3c04fe0b460353 | 3a1f33184f1e0dbceb8784199eadb31ec9c4d093 | refs/heads/master | "2022-10-22T12:19:32.955000" | "2020-06-11T12:21:36" | "2020-06-11T12:21:36" | 258,171,481 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.saveus.Fragments;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.saveus.Activitys.LoginActivity;
import com.example.saveus.Objects.Place;
import com.example.saveus.Objects.Profil;
import com.example.saveus.R;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
public class PersonalInformation extends Fragment implements View.OnClickListener {
private ImageView editProfile;
private Profil myProfile;
private TextView name;
private TextView email;
private TextView phone;
private OnFragmentInteractionListener mListener;
public PersonalInformation() {
}
public static PersonalInformation newInstance() {
PersonalInformation fragment = new PersonalInformation();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view= inflater.inflate(R.layout.fragment_personal_information, container, false);
name = view.findViewById(R.id.profile_name);
email = view.findViewById(R.id.profile_email);
phone = view.findViewById(R.id.profile_phone);
getMyProfile();
editProfile = view.findViewById(R.id.profile_edit);
editProfile.setOnClickListener(this);
return view;
}
private void getMyProfile() {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
Gson gson = new Gson();
String json = sharedPrefs.getString(LoginActivity.KEYOPROFILE, null);
Type type = new TypeToken<Profil>() {}.getType();
myProfile = gson.fromJson(json,type);
if(myProfile!=null){
setMyprofil();
}
}
private void setMyprofil() {
name.setText(myProfile.getName());
email.setText(myProfile.getName());
phone.setText(myProfile.getPhone());
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
@Override
public void onClick(View v) {
mListener.moveToEditProfile();
}
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
void moveToEditProfile();
}
}
| UTF-8 | Java | 3,632 | java | PersonalInformation.java | Java | [] | null | [] | package com.example.saveus.Fragments;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.saveus.Activitys.LoginActivity;
import com.example.saveus.Objects.Place;
import com.example.saveus.Objects.Profil;
import com.example.saveus.R;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
public class PersonalInformation extends Fragment implements View.OnClickListener {
private ImageView editProfile;
private Profil myProfile;
private TextView name;
private TextView email;
private TextView phone;
private OnFragmentInteractionListener mListener;
public PersonalInformation() {
}
public static PersonalInformation newInstance() {
PersonalInformation fragment = new PersonalInformation();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view= inflater.inflate(R.layout.fragment_personal_information, container, false);
name = view.findViewById(R.id.profile_name);
email = view.findViewById(R.id.profile_email);
phone = view.findViewById(R.id.profile_phone);
getMyProfile();
editProfile = view.findViewById(R.id.profile_edit);
editProfile.setOnClickListener(this);
return view;
}
private void getMyProfile() {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
Gson gson = new Gson();
String json = sharedPrefs.getString(LoginActivity.KEYOPROFILE, null);
Type type = new TypeToken<Profil>() {}.getType();
myProfile = gson.fromJson(json,type);
if(myProfile!=null){
setMyprofil();
}
}
private void setMyprofil() {
name.setText(myProfile.getName());
email.setText(myProfile.getName());
phone.setText(myProfile.getPhone());
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
@Override
public void onClick(View v) {
mListener.moveToEditProfile();
}
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
void moveToEditProfile();
}
}
| 3,632 | 0.676762 | 0.676762 | 128 | 27.375 | 23.37734 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 5 |
ea038727da4731cade593dc82a053c9554ccf185 | 35,304,631,216,075 | 60c4056900b741a6b68b9bbaae3458a9e12b2441 | /src/main/java/com/dhruba/classExample/Passenger.java | 8d59ee3f849dce60046b15d14f3a752519c41542 | [] | no_license | dhrub123/JavaFundamentals | https://github.com/dhrub123/JavaFundamentals | c82b27822d294894f1b35ce853db206c505e38b1 | cd626a3cca500fa3afb9c092aa68692e9a4ae880 | refs/heads/master | "2023-05-12T11:39:04.280000" | "2023-05-05T07:32:44" | "2023-05-05T07:32:44" | 289,631,254 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dhruba.classExample;
public class Passenger {
public Passenger(int checkedBags, int carryOns) {
super();
this.checkedBags = checkedBags;
this.carryOns = carryOns;
}
int checkedBags;
int carryOns;
public int getCarryOns() {
return carryOns;
}
public void setCarryOns(int carryOns) {
this.carryOns = carryOns;
}
public int getCheckedBags() {
return checkedBags;
}
public void setCheckedBags(int checkedBags) {
this.checkedBags = checkedBags;
}
}
| UTF-8 | Java | 496 | java | Passenger.java | Java | [] | null | [] | package com.dhruba.classExample;
public class Passenger {
public Passenger(int checkedBags, int carryOns) {
super();
this.checkedBags = checkedBags;
this.carryOns = carryOns;
}
int checkedBags;
int carryOns;
public int getCarryOns() {
return carryOns;
}
public void setCarryOns(int carryOns) {
this.carryOns = carryOns;
}
public int getCheckedBags() {
return checkedBags;
}
public void setCheckedBags(int checkedBags) {
this.checkedBags = checkedBags;
}
}
| 496 | 0.71371 | 0.71371 | 32 | 14.5 | 15.54027 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.28125 | false | false | 5 |
93c01abd885ca50ac2954bc7ffbd27192d63b3e2 | 36,524,401,916,560 | d69851f59d31012da02c3f0f39a72e8503bb2005 | /src/main/java/domain/Endorsement.java | 3882b0773cd988b5f05cd644d7b83274412a312d | [] | no_license | Domin-97/Cambios-DP03-DP04 | https://github.com/Domin-97/Cambios-DP03-DP04 | 227cdf891b20d68639084152486168e0dbdc2265 | e1309dafcd22c455855661f4010e307db520582d | refs/heads/master | "2020-04-08T12:34:14.457000" | "2018-11-29T15:07:41" | "2018-11-29T15:07:41" | 159,352,676 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package domain;
import java.util.Date;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import org.hibernate.validator.constraints.NotBlank;
@Entity
@Access(AccessType.PROPERTY)
public class Endorsement extends DomainEntity implements Cloneable {
private Date moment;
private String comment;
private double score;
@Override
public Object clone() {
Object o = null;
try {
o = super.clone();
} catch (CloneNotSupportedException ex) {
}
return o;
}
@NotNull
@Past
@Temporal(TemporalType.TIMESTAMP)
public Date getMoment() {
return this.moment;
}
public void setMoment(final Date moment) {
this.moment = moment;
}
@NotBlank
public String getComment() {
return this.comment;
}
public void setComment(final String comment) {
this.comment = comment;
}
// We need an insctance of Configuration
public double getScore() {
// double score = 0.0;
// double pBuenas = 0;
// double pMalas = 0;
// for (final String s : Configuration.getPositiveWords())
// if (this.comment.toLowerCase().contains(s))
// pBuenas++;
// for (final String s : Configuration.getNegativeWords())
// if (this.comment.toLowerCase().contains(s))
// pMalas++;
// if (pBuenas + pMalas != 0)
// score = (pBuenas - pMalas) / (pBuenas + pMalas);
return this.score;
}
public void setScore(final double score) {
this.score = score;
}
}
| UTF-8 | Java | 1,608 | java | Endorsement.java | Java | [] | null | [] |
package domain;
import java.util.Date;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import org.hibernate.validator.constraints.NotBlank;
@Entity
@Access(AccessType.PROPERTY)
public class Endorsement extends DomainEntity implements Cloneable {
private Date moment;
private String comment;
private double score;
@Override
public Object clone() {
Object o = null;
try {
o = super.clone();
} catch (CloneNotSupportedException ex) {
}
return o;
}
@NotNull
@Past
@Temporal(TemporalType.TIMESTAMP)
public Date getMoment() {
return this.moment;
}
public void setMoment(final Date moment) {
this.moment = moment;
}
@NotBlank
public String getComment() {
return this.comment;
}
public void setComment(final String comment) {
this.comment = comment;
}
// We need an insctance of Configuration
public double getScore() {
// double score = 0.0;
// double pBuenas = 0;
// double pMalas = 0;
// for (final String s : Configuration.getPositiveWords())
// if (this.comment.toLowerCase().contains(s))
// pBuenas++;
// for (final String s : Configuration.getNegativeWords())
// if (this.comment.toLowerCase().contains(s))
// pMalas++;
// if (pBuenas + pMalas != 0)
// score = (pBuenas - pMalas) / (pBuenas + pMalas);
return this.score;
}
public void setScore(final double score) {
this.score = score;
}
}
| 1,608 | 0.706468 | 0.703358 | 74 | 20.716217 | 18.280487 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.756757 | false | false | 5 |
347259d67ae3c0d5ce258005efc54d0d130a4a0f | 36,524,401,914,756 | 4c1278618d996060cbce59251774bd2d1909cf3b | /src/org/fh/orRule.java | 7901695d8779daa3946ccae45c6fe8649566211e | [] | no_license | elmiond/FileHawk | https://github.com/elmiond/FileHawk | df24552710e06fb5754b3d73c81481d6fc01e0dc | 2ea5ecf9bcb2dc432e568d9e20896212b6c91a2a | refs/heads/master | "2021-01-25T07:34:12.387000" | "2014-11-11T10:34:14" | "2014-11-11T10:34:14" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.fh;
import java.nio.file.Path;
public class orRule implements matchRuleCollection
{
public boolean isMatch(Path filePath)
{
for (matchRule r : rules)
{
if (r.isMatch(filePath))
{
return true;
}
}
return false;
}
public void add(matchRule rule)
{
rules.add(rule);
}
public void remove(int index)
{
rules.remove(index);
}
}
| UTF-8 | Java | 374 | java | orRule.java | Java | [] | null | [] | package org.fh;
import java.nio.file.Path;
public class orRule implements matchRuleCollection
{
public boolean isMatch(Path filePath)
{
for (matchRule r : rules)
{
if (r.isMatch(filePath))
{
return true;
}
}
return false;
}
public void add(matchRule rule)
{
rules.add(rule);
}
public void remove(int index)
{
rules.remove(index);
}
}
| 374 | 0.657754 | 0.657754 | 29 | 11.896552 | 13.757367 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.413793 | false | false | 5 |
77d97ca75c9bbd5aaf0232ccfaf6e631b10fc7f7 | 35,381,940,610,550 | f910ff2e90132e0737e4ff04319968e03df4e4f8 | /Assignment 7/6/ExtendedButton.java | 9381c810ea056505ccd17b19e30a999aba5537f9 | [] | no_license | craig-amendt/Java12Skeleton | https://github.com/craig-amendt/Java12Skeleton | 8f9d7c8d2d4cca208aaf18f1a906164ef26e9c33 | bb9c0d1fb3ffaa57978c29375138e7cf119185ae | refs/heads/master | "2020-03-29T20:17:20.006000" | "2018-09-19T18:57:47" | "2018-09-19T18:57:47" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import javafx.scene.control.Button;
public class ExtendedButton {
}
public class MyButton extends Button {
} | UTF-8 | Java | 121 | java | ExtendedButton.java | Java | [] | null | [] | import javafx.scene.control.Button;
public class ExtendedButton {
}
public class MyButton extends Button {
} | 121 | 0.719008 | 0.719008 | 10 | 11.2 | 15.131424 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | false | false | 5 |
6691fb61f653dbb94a4b6f7778eb6b32a8b44b94 | 36,249,524,012,492 | 2e5ee62c069969f16a79f511470db45d3a631ed6 | /hbkdassistant2/src/main/java/com/tofirst/study/hbkdassistant/acitvity/login/PickUpPSDActivity.java | dd96b46c5d7475ab83a3b0b983d3bdaa033d353b | [] | no_license | CFLOVEYR/HBKDAssistant | https://github.com/CFLOVEYR/HBKDAssistant | f3a2487e1609e18fa17e92430434e2f2999738e6 | 31ae4598d9137061ac33e1c4e52cc585ffe93340 | refs/heads/master | "2021-01-19T04:06:33.182000" | "2016-02-01T16:19:19" | "2016-02-01T16:19:19" | 50,093,230 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tofirst.study.hbkdassistant.acitvity.login;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.tofirst.study.hbkdassistant.R;
import com.tofirst.study.hbkdassistant.utils.common.SharePreUtils;
import com.tofirst.study.hbkdassistant.utils.common.ToastUtils;
import com.tofirst.study.hbkdassistant.utils.common.UIUtils;
import com.umeng.analytics.MobclickAgent;
import java.util.Timer;
import java.util.TimerTask;
import cn.bmob.v3.BmobSMS;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.RequestSMSCodeListener;
import cn.bmob.v3.listener.ResetPasswordByCodeListener;
public class PickUpPSDActivity extends AppCompatActivity {
private EditText et_pickup_code;//手机验证码
private EditText et_pickup_pnumber;//手机号
private EditText et_pickup_newpsd;//新密码
private EditText et_pickup_newpsd_confirm;//新密码确认
private boolean isLight;
private Toolbar toolbar;
private TextView tv_getSmsCode;
private int Count = 60;
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0:
tv_getSmsCode.setText(Count + "后重新发送");
tv_getSmsCode.setClickable(false);
break;
case 1:
tv_getSmsCode.setText("重新获取验证码");
tv_getSmsCode.setClickable(true);
break;
default:
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pick_up_psd);
setTitle("找回密码");
initView();
}
private void initView() {
initToolBar();
et_pickup_code = (EditText) findViewById(R.id.et_pickup_code);
et_pickup_pnumber = (EditText) findViewById(R.id.et_pickup_pnumber);
et_pickup_newpsd = (EditText) findViewById(R.id.et_pickup_newpsd);
et_pickup_newpsd_confirm = (EditText) findViewById(R.id.et_pickup_newpsd_confirm);
tv_getSmsCode = (TextView) findViewById(R.id.tv_getSmsCode);
}
private void initToolBar() {
isLight = SharePreUtils.getsPreBoolean(this, "isLight", true);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setBackgroundColor(getResources().getColor(isLight ? R.color.light_toolbar : R.color.dark_toolbar));
setSupportActionBar(toolbar);
//设置返回键可用
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
/**
* 获取验证码
*
* @param view
*/
public void getCode(View view) {
String number = et_pickup_pnumber.getText().toString();
BmobSMS.requestSMSCode(PickUpPSDActivity.this, number, "修改密码", new RequestSMSCodeListener() {
@Override
public void done(Integer integer, BmobException e) {
if (e == null) {//验证码发送成功
Log.i("smile", "短信id:" + integer);//用于查询本次短信发送详情
UIUtils.showToastSafe("短信已发送,请注意查收");
tv_getSmsCode.setText("短信已发送");
final Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
handler.sendEmptyMessage(0);
Count--;
if (Count < 0) {
timer.cancel();
Count = 60;
handler.sendEmptyMessage(1);
}
}
}, 0, 1000);
} else {
UIUtils.showToastSafe("短信发送失败");
}
}
});
}
/**
* 保存信息的方法
*
* @param view
*/
public void save_phone_pickup(View view) {
String number = et_pickup_pnumber.getText().toString();
String code = et_pickup_code.getText().toString();
final String newpsd = et_pickup_newpsd.getText().toString();
String newpsd_confirm = et_pickup_newpsd_confirm.getText().toString();
if (TextUtils.isEmpty(number) || TextUtils.isEmpty(newpsd) ||
TextUtils.isEmpty(code) || TextUtils.isEmpty(newpsd_confirm)) {
Toast.makeText(PickUpPSDActivity.this, "输入内容不能为空", Toast.LENGTH_SHORT).show();
} else {
if (!newpsd_confirm.equals(newpsd)) {
Toast.makeText(PickUpPSDActivity.this, "密码输入不一致,请再次输入", Toast.LENGTH_SHORT).show();
}
BmobUser.resetPasswordBySMSCode(this, code, newpsd, new ResetPasswordByCodeListener() {
@Override
public void done(BmobException ex) {
if (ex == null) {
Log.i("smile", "密码重置成功");
ToastUtils.showToast(PickUpPSDActivity.this, "密码重置成功" + newpsd);
//跳转到登录界面
startActivity(new Intent(PickUpPSDActivity.this, LoginActivity.class));
finish();
} else {
Log.i("smile", "重置失败:code =" + ex.getErrorCode() + ",msg = " + ex.getLocalizedMessage());
}
}
});
}
}
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
MobclickAgent.onPause(this);
}
}
| UTF-8 | Java | 6,570 | java | PickUpPSDActivity.java | Java | [] | null | [] | package com.tofirst.study.hbkdassistant.acitvity.login;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.tofirst.study.hbkdassistant.R;
import com.tofirst.study.hbkdassistant.utils.common.SharePreUtils;
import com.tofirst.study.hbkdassistant.utils.common.ToastUtils;
import com.tofirst.study.hbkdassistant.utils.common.UIUtils;
import com.umeng.analytics.MobclickAgent;
import java.util.Timer;
import java.util.TimerTask;
import cn.bmob.v3.BmobSMS;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.RequestSMSCodeListener;
import cn.bmob.v3.listener.ResetPasswordByCodeListener;
public class PickUpPSDActivity extends AppCompatActivity {
private EditText et_pickup_code;//手机验证码
private EditText et_pickup_pnumber;//手机号
private EditText et_pickup_newpsd;//新密码
private EditText et_pickup_newpsd_confirm;//新密码确认
private boolean isLight;
private Toolbar toolbar;
private TextView tv_getSmsCode;
private int Count = 60;
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0:
tv_getSmsCode.setText(Count + "后重新发送");
tv_getSmsCode.setClickable(false);
break;
case 1:
tv_getSmsCode.setText("重新获取验证码");
tv_getSmsCode.setClickable(true);
break;
default:
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pick_up_psd);
setTitle("找回密码");
initView();
}
private void initView() {
initToolBar();
et_pickup_code = (EditText) findViewById(R.id.et_pickup_code);
et_pickup_pnumber = (EditText) findViewById(R.id.et_pickup_pnumber);
et_pickup_newpsd = (EditText) findViewById(R.id.et_pickup_newpsd);
et_pickup_newpsd_confirm = (EditText) findViewById(R.id.et_pickup_newpsd_confirm);
tv_getSmsCode = (TextView) findViewById(R.id.tv_getSmsCode);
}
private void initToolBar() {
isLight = SharePreUtils.getsPreBoolean(this, "isLight", true);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setBackgroundColor(getResources().getColor(isLight ? R.color.light_toolbar : R.color.dark_toolbar));
setSupportActionBar(toolbar);
//设置返回键可用
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
/**
* 获取验证码
*
* @param view
*/
public void getCode(View view) {
String number = et_pickup_pnumber.getText().toString();
BmobSMS.requestSMSCode(PickUpPSDActivity.this, number, "修改密码", new RequestSMSCodeListener() {
@Override
public void done(Integer integer, BmobException e) {
if (e == null) {//验证码发送成功
Log.i("smile", "短信id:" + integer);//用于查询本次短信发送详情
UIUtils.showToastSafe("短信已发送,请注意查收");
tv_getSmsCode.setText("短信已发送");
final Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
handler.sendEmptyMessage(0);
Count--;
if (Count < 0) {
timer.cancel();
Count = 60;
handler.sendEmptyMessage(1);
}
}
}, 0, 1000);
} else {
UIUtils.showToastSafe("短信发送失败");
}
}
});
}
/**
* 保存信息的方法
*
* @param view
*/
public void save_phone_pickup(View view) {
String number = et_pickup_pnumber.getText().toString();
String code = et_pickup_code.getText().toString();
final String newpsd = et_pickup_newpsd.getText().toString();
String newpsd_confirm = et_pickup_newpsd_confirm.getText().toString();
if (TextUtils.isEmpty(number) || TextUtils.isEmpty(newpsd) ||
TextUtils.isEmpty(code) || TextUtils.isEmpty(newpsd_confirm)) {
Toast.makeText(PickUpPSDActivity.this, "输入内容不能为空", Toast.LENGTH_SHORT).show();
} else {
if (!newpsd_confirm.equals(newpsd)) {
Toast.makeText(PickUpPSDActivity.this, "密码输入不一致,请再次输入", Toast.LENGTH_SHORT).show();
}
BmobUser.resetPasswordBySMSCode(this, code, newpsd, new ResetPasswordByCodeListener() {
@Override
public void done(BmobException ex) {
if (ex == null) {
Log.i("smile", "密码重置成功");
ToastUtils.showToast(PickUpPSDActivity.this, "密码重置成功" + newpsd);
//跳转到登录界面
startActivity(new Intent(PickUpPSDActivity.this, LoginActivity.class));
finish();
} else {
Log.i("smile", "重置失败:code =" + ex.getErrorCode() + ",msg = " + ex.getLocalizedMessage());
}
}
});
}
}
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
MobclickAgent.onPause(this);
}
}
| 6,570 | 0.574928 | 0.571588 | 177 | 34.514126 | 25.732458 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 5 |
eb736cf73b79e445d906cc10c4994dbb64d0af89 | 35,502,199,706,409 | 9740ba3adf8a9a4535ff6679e1f1eee8a6c5f614 | /GREEN_LEAVES/src/main/java/com/mac/green_leaves/v1/green_leaves/tea_issue/TeaIssueController.java | 1b0c026cbcfaadd97386b6378813ffa9ef4a1324 | [] | no_license | kavishperera/green_leaves | https://github.com/kavishperera/green_leaves | 2493297302f74c0b0eeab30cbe1b65bd13bd237f | 1ad4ac746087059d1d2f3a8b55c31a30d7334933 | refs/heads/master | "2020-03-09T04:50:40.949000" | "2017-06-18T20:42:55" | "2017-06-18T20:42:55" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mac.green_leaves.v1.green_leaves.tea_issue;
import com.mac.green_leaves.v1.green_leaves.tea_issue.model.TTeaIssue;
import com.mac.green_leaves.v1.zutil.SecurityUtil;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
/**
*
* @author Don
*/
@CrossOrigin
@RestController
@RequestMapping("/api/v1/green-leaves/tea-issue")
public class TeaIssueController {
@Autowired
private TeaIssueService teaIssueService;
@RequestMapping(value = "/{number}/{type}", method = RequestMethod.GET)
public TTeaIssue findByNumberAndType(@PathVariable("number") Integer number, @PathVariable("type") String type) {
return teaIssueService.findTeaIssueByNumberAndType(number, type, SecurityUtil.getCurrentUser().getBranch());
}
@RequestMapping(value = "/save-tea-issue", method = RequestMethod.POST)
public Integer saveTeaIssue(@RequestBody TTeaIssue teaIssue) {
return teaIssueService.saveTeaIssue(teaIssue, SecurityUtil.getCurrentUser().getBranch());
}
@RequestMapping(value = "/delete-tea-issue/{indexNo}", method = RequestMethod.DELETE)
public Integer deleteTeaIssue(@PathVariable Integer indexNo) {
teaIssueService.deleteTeaIssue(indexNo);
return indexNo;
}
@RequestMapping(value = "/delete-tea-issue-detail/{indexNo}", method = RequestMethod.DELETE)
public Integer deleteTeaIssueDetail(@PathVariable Integer indexNo) {
teaIssueService.deleteTeaIssueDetail(indexNo);
return indexNo;
}
@RequestMapping(value = "/officer-tea-ledger-summary/{officer}/{date}", method = RequestMethod.GET)
public List<Object[]> findOfficerTeaLedgerSummary(@PathVariable("officer") Integer officer, @PathVariable("date") @DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
return teaIssueService.findTeaLedgerSummary(SecurityUtil.getCurrentUser().getBranch(), officer, date);
}
}
| UTF-8 | Java | 2,559 | java | TeaIssueController.java | Java | [
{
"context": "bind.annotation.RestController;\n\n/**\n *\n * @author Don\n */\n@CrossOrigin\n@RestController\n@RequestMapping(",
"end": 925,
"score": 0.9951393008232117,
"start": 922,
"tag": "NAME",
"value": "Don"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mac.green_leaves.v1.green_leaves.tea_issue;
import com.mac.green_leaves.v1.green_leaves.tea_issue.model.TTeaIssue;
import com.mac.green_leaves.v1.zutil.SecurityUtil;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
/**
*
* @author Don
*/
@CrossOrigin
@RestController
@RequestMapping("/api/v1/green-leaves/tea-issue")
public class TeaIssueController {
@Autowired
private TeaIssueService teaIssueService;
@RequestMapping(value = "/{number}/{type}", method = RequestMethod.GET)
public TTeaIssue findByNumberAndType(@PathVariable("number") Integer number, @PathVariable("type") String type) {
return teaIssueService.findTeaIssueByNumberAndType(number, type, SecurityUtil.getCurrentUser().getBranch());
}
@RequestMapping(value = "/save-tea-issue", method = RequestMethod.POST)
public Integer saveTeaIssue(@RequestBody TTeaIssue teaIssue) {
return teaIssueService.saveTeaIssue(teaIssue, SecurityUtil.getCurrentUser().getBranch());
}
@RequestMapping(value = "/delete-tea-issue/{indexNo}", method = RequestMethod.DELETE)
public Integer deleteTeaIssue(@PathVariable Integer indexNo) {
teaIssueService.deleteTeaIssue(indexNo);
return indexNo;
}
@RequestMapping(value = "/delete-tea-issue-detail/{indexNo}", method = RequestMethod.DELETE)
public Integer deleteTeaIssueDetail(@PathVariable Integer indexNo) {
teaIssueService.deleteTeaIssueDetail(indexNo);
return indexNo;
}
@RequestMapping(value = "/officer-tea-ledger-summary/{officer}/{date}", method = RequestMethod.GET)
public List<Object[]> findOfficerTeaLedgerSummary(@PathVariable("officer") Integer officer, @PathVariable("date") @DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
return teaIssueService.findTeaLedgerSummary(SecurityUtil.getCurrentUser().getBranch(), officer, date);
}
}
| 2,559 | 0.764361 | 0.762798 | 60 | 41.650002 | 38.903225 | 170 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 5 |
77d39828bfea4306f68110612cbff6ccd4a8b72c | 38,895,223,841,267 | c818fae3b6bede57e25344acf229adb33fc0b0d1 | /DMS Server - Community Edition 2022/src/com/primeleaf/krystal/model/vo/SearchFilter.java | bc3a1bcf73ad9a839ee83042d09d744938087a36 | [] | no_license | primeleaf/krystaldms-community-edition | https://github.com/primeleaf/krystaldms-community-edition | 1438bd512ead3e3b7d9d6d8d9ca6235bb69cdfd0 | 48483d3256e6801b6525c8d49e5118ec063aa489 | refs/heads/master | "2022-08-14T03:46:14.257000" | "2022-07-28T12:40:54" | "2022-07-28T12:40:54" | 131,812,861 | 19 | 11 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Created On Feb 19, 2014
* Copyright 2010 by Primeleaf Consulting (P) Ltd.,
* #29,784/785 Hendre Castle,
* D.S.Babrekar Marg,
* Gokhale Road(North),
* Dadar,Mumbai 400 028
* India
*
* All rights reserved.
*
* This software is the confidential and proprietary information
* of Primeleaf Consulting (P) Ltd. ("Confidential Information").
* You shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Primeleaf Consulting (P) Ltd.
*/
package com.primeleaf.krystal.model.vo;
/**
* Author Rahul Kubadia
*/
public class SearchFilter {
private String columnName;
private String columnType;
private boolean metaColumn;
private String value1;
private String value2;
private byte operator;
public SearchFilter(String columnName,String columnType,boolean metaColumn,String value1, String value2, byte operator){
this.columnName = columnName;
this.columnType = columnType;
this.metaColumn = metaColumn;
this.value1 = value1;
this.value2 = value2;
this.operator = operator;
}
/**
* @return the columnName
*/
public String getColumnName() {
return columnName;
}
/**
* @param columnName the columnName to set
*/
public void setColumnName(String columnName) {
this.columnName = columnName;
}
/**
* @return the columnType
*/
public String getColumnType() {
return columnType;
}
/**
* @param columnType the columnType to set
*/
public void setColumnType(String columnType) {
this.columnType = columnType;
}
/**
* @return the metaColumn
*/
public boolean isMetaColumn() {
return metaColumn;
}
/**
* @param metaColumn the metaColumn to set
*/
public void setMetaColumn(boolean metaColumn) {
this.metaColumn = metaColumn;
}
/**
* @return the value1
*/
public String getValue1() {
return value1;
}
/**
* @param value1 the value1 to set
*/
public void setValue1(String value1) {
this.value1 = value1;
}
/**
* @return the value2
*/
public String getValue2() {
return value2;
}
/**
* @param value2 the value2 to set
*/
public void setValue2(String value2) {
this.value2 = value2;
}
/**
* @return the operator
*/
public byte getOperator() {
return operator;
}
/**
* @param operator the operator to set
*/
public void setOperator(byte operator) {
this.operator = operator;
}
public final static byte OPERATOR_IS=1;
public final static byte OPERATOR_ISNOT = 2;
public final static byte OPERATOR_LIKE=3;
public final static byte OPERATOR_NOTLIKE=4;
public final static byte OPERATOR_ISGREATERTHAN=5;
public final static byte OPERATOR_ISLESSERTHAN=6;
public final static byte OPERATOR_BETWEEN=7;
public final static byte OPERATOR_ISEMPTY=8;
public final static byte OPERATOR_ISNOTEMPTY=9;
}
| UTF-8 | Java | 2,954 | java | SearchFilter.java | Java | [
{
"context": " by Primeleaf Consulting (P) Ltd.,\r\n * #29,784/785 Hendre Castle,\r\n * D.S.Babrekar Marg,\r\n * Gokhale Road(North),\r",
"end": 114,
"score": 0.9977303743362427,
"start": 101,
"tag": "NAME",
"value": "Hendre Castle"
},
{
"context": "lting (P) Ltd.,\r\n * #29,784/785 Hendre Castle,\r\n * D.S.Babrekar Marg,\r\n * Gokhale Road(North),\r\n * Dadar",
"end": 123,
"score": 0.7833519577980042,
"start": 120,
"tag": "NAME",
"value": "D.S"
},
{
"context": " (P) Ltd.,\r\n * #29,784/785 Hendre Castle,\r\n * D.S.Babrekar Marg,\r\n * Gokhale Road(North),\r\n * Dadar,Mumbai 400 02",
"end": 137,
"score": 0.9524075388908386,
"start": 124,
"tag": "NAME",
"value": "Babrekar Marg"
},
{
"context": " com.primeleaf.krystal.model.vo;\r\n\r\n/**\r\n * Author Rahul Kubadia\r\n */\r\n\r\npublic class SearchFilter {\r\n\tprivate Str",
"end": 640,
"score": 0.999872088432312,
"start": 627,
"tag": "NAME",
"value": "Rahul Kubadia"
}
] | null | [] | /**
* Created On Feb 19, 2014
* Copyright 2010 by Primeleaf Consulting (P) Ltd.,
* #29,784/785 <NAME>,
* D.S.<NAME>,
* Gokhale Road(North),
* Dadar,Mumbai 400 028
* India
*
* All rights reserved.
*
* This software is the confidential and proprietary information
* of Primeleaf Consulting (P) Ltd. ("Confidential Information").
* You shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Primeleaf Consulting (P) Ltd.
*/
package com.primeleaf.krystal.model.vo;
/**
* Author <NAME>
*/
public class SearchFilter {
private String columnName;
private String columnType;
private boolean metaColumn;
private String value1;
private String value2;
private byte operator;
public SearchFilter(String columnName,String columnType,boolean metaColumn,String value1, String value2, byte operator){
this.columnName = columnName;
this.columnType = columnType;
this.metaColumn = metaColumn;
this.value1 = value1;
this.value2 = value2;
this.operator = operator;
}
/**
* @return the columnName
*/
public String getColumnName() {
return columnName;
}
/**
* @param columnName the columnName to set
*/
public void setColumnName(String columnName) {
this.columnName = columnName;
}
/**
* @return the columnType
*/
public String getColumnType() {
return columnType;
}
/**
* @param columnType the columnType to set
*/
public void setColumnType(String columnType) {
this.columnType = columnType;
}
/**
* @return the metaColumn
*/
public boolean isMetaColumn() {
return metaColumn;
}
/**
* @param metaColumn the metaColumn to set
*/
public void setMetaColumn(boolean metaColumn) {
this.metaColumn = metaColumn;
}
/**
* @return the value1
*/
public String getValue1() {
return value1;
}
/**
* @param value1 the value1 to set
*/
public void setValue1(String value1) {
this.value1 = value1;
}
/**
* @return the value2
*/
public String getValue2() {
return value2;
}
/**
* @param value2 the value2 to set
*/
public void setValue2(String value2) {
this.value2 = value2;
}
/**
* @return the operator
*/
public byte getOperator() {
return operator;
}
/**
* @param operator the operator to set
*/
public void setOperator(byte operator) {
this.operator = operator;
}
public final static byte OPERATOR_IS=1;
public final static byte OPERATOR_ISNOT = 2;
public final static byte OPERATOR_LIKE=3;
public final static byte OPERATOR_NOTLIKE=4;
public final static byte OPERATOR_ISGREATERTHAN=5;
public final static byte OPERATOR_ISLESSERTHAN=6;
public final static byte OPERATOR_BETWEEN=7;
public final static byte OPERATOR_ISEMPTY=8;
public final static byte OPERATOR_ISNOTEMPTY=9;
}
| 2,933 | 0.678402 | 0.658429 | 125 | 21.615999 | 20.020304 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.28 | false | false | 5 |
131692dbbf8bdaf9daafd97be7a50b016c4bd97c | 10,015,863,783,358 | 55a64ac219060922d65c6880aa173b4cf84f7505 | /src/main/java/za/ac/PremierSoccerLeague/domain/Tournament.java | da3228403d5492de515581e79fd8b7f5140d4b79 | [] | no_license | smkumatela/PremierSoccerLeague | https://github.com/smkumatela/PremierSoccerLeague | 9e295da0e5ed7a8dd34f204115a3928145e4565d | c1eaf00e98f01bfc635e686438ca1737debe99a3 | refs/heads/master | "2021-01-10T21:52:59.403000" | "2016-09-01T17:14:16" | "2016-09-01T17:14:16" | 34,167,198 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package za.ac.PremierSoccerLeague.domain;
import javax.persistence.*;
import java.io.Serializable;
/**
* Created by student on 2015/04/18.
*/
@Entity
public class Tournament implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
private int numOfTeams;
private double prize;
@Embedded
@JoinColumn(name = "channel")
private Broadcaster channel;
private Tournament() {
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public int getNumOfTeams() {
return numOfTeams;
}
public Broadcaster getChannel(){
return channel;
}
public double getPrize() {
return prize;
}
public Tournament(Builder builder) {
id = builder.id;
this.channel = builder.channel;
name = builder.name;
numOfTeams = builder.numOfTeams;
prize = builder.prize;
}
public static class Builder {
private Long id;
private String name;
private int numOfTeams;
private double prize;
private Broadcaster channel;
public Builder(String name) {
this.name = name;
}
public Builder id(Long value) {
this.id = value;
return this;
}
public Builder channel(Broadcaster value){
this.channel = value;
return this;
}
public Builder numOfTeams(int value) {
this.numOfTeams = value;
return this;
}
public Builder prize(double value) {
this.prize = value;
return this;
}
public Builder copy(Tournament value){
this.id = value.id;
this.name = value.name;
this.channel = value.channel;
this.numOfTeams = value.numOfTeams;
this.prize = value.prize;
return this;
}
public Tournament build(){
return new Tournament(this);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tournament that = (Tournament) o;
return !(id != null ? !id.equals(that.id) : that.id != null);
}
@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
} | UTF-8 | Java | 2,474 | java | Tournament.java | Java | [
{
"context": "*;\nimport java.io.Serializable;\n\n/**\n * Created by student on 2015/04/18.\n */\n@Entity\npublic class Tournamen",
"end": 127,
"score": 0.9574288129806519,
"start": 120,
"tag": "USERNAME",
"value": "student"
}
] | null | [] | package za.ac.PremierSoccerLeague.domain;
import javax.persistence.*;
import java.io.Serializable;
/**
* Created by student on 2015/04/18.
*/
@Entity
public class Tournament implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
private int numOfTeams;
private double prize;
@Embedded
@JoinColumn(name = "channel")
private Broadcaster channel;
private Tournament() {
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public int getNumOfTeams() {
return numOfTeams;
}
public Broadcaster getChannel(){
return channel;
}
public double getPrize() {
return prize;
}
public Tournament(Builder builder) {
id = builder.id;
this.channel = builder.channel;
name = builder.name;
numOfTeams = builder.numOfTeams;
prize = builder.prize;
}
public static class Builder {
private Long id;
private String name;
private int numOfTeams;
private double prize;
private Broadcaster channel;
public Builder(String name) {
this.name = name;
}
public Builder id(Long value) {
this.id = value;
return this;
}
public Builder channel(Broadcaster value){
this.channel = value;
return this;
}
public Builder numOfTeams(int value) {
this.numOfTeams = value;
return this;
}
public Builder prize(double value) {
this.prize = value;
return this;
}
public Builder copy(Tournament value){
this.id = value.id;
this.name = value.name;
this.channel = value.channel;
this.numOfTeams = value.numOfTeams;
this.prize = value.prize;
return this;
}
public Tournament build(){
return new Tournament(this);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tournament that = (Tournament) o;
return !(id != null ? !id.equals(that.id) : that.id != null);
}
@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
} | 2,474 | 0.556993 | 0.553355 | 116 | 20.336206 | 16.996422 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.396552 | false | false | 5 |
5751556dbcd47c744802898cc2a8ff7b0236efbe | 11,527,692,228,734 | 3d76e456196f68fba44f4233a6e77ac2fbac211e | /src/main/java/nikita488/zycraft/menu/FabricatorContainer.java | 5a3c1bdb757d2fbdb42b941bf5cdc08bd6a8f87c | [
"MIT"
] | permissive | nikita488/ZYCraft | https://github.com/nikita488/ZYCraft | 256bc38ad5e5746e9698d42e4d534829da8fb06d | b66375a9b7cececc1bff7b2b9601dabe7a6d4172 | refs/heads/1.16.x | "2022-07-06T18:28:13.131000" | "2021-12-18T10:31:29" | "2021-12-18T10:31:29" | 278,884,938 | 1 | 3 | MIT | false | "2021-01-30T10:26:36" | "2020-07-11T15:06:32" | "2020-12-01T17:40:43" | "2021-01-30T10:26:36" | 785 | 1 | 1 | 2 | Java | false | false | package nikita488.zycraft.menu;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ICraftingRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.network.play.server.SSetSlotPacket;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import nikita488.zycraft.block.state.properties.FabricatorMode;
import nikita488.zycraft.init.ZYContainers;
import nikita488.zycraft.menu.data.IntMenuData;
import nikita488.zycraft.menu.slot.RecipePatternSlot;
import nikita488.zycraft.menu.slot.ZYSlot;
import nikita488.zycraft.tile.FabricatorTile;
import nikita488.zycraft.util.ItemStackUtils;
import javax.annotation.Nullable;
import java.util.Optional;
public class FabricatorContainer extends ZYTileContainer<FabricatorTile>
{
private final World level;
private final PlayerEntity player;
private final IntMenuData modeData;
public FabricatorContainer(@Nullable ContainerType<?> type, int id, PlayerInventory playerInventory)
{
this(type, id, playerInventory, null, new Inventory(9), new ItemStackHandler(), new ItemStackHandler(9), new IntMenuData());
}
public FabricatorContainer(int id, PlayerInventory playerInventory, FabricatorTile fabricator)
{
this(ZYContainers.FABRICATOR.get(), id, playerInventory, fabricator, fabricator.recipePattern(), fabricator.craftingResult(), fabricator.inventory(), new IntMenuData(() -> fabricator.mode().ordinal()));
}
public FabricatorContainer(@Nullable ContainerType<?> type, int id, PlayerInventory playerInventory, @Nullable FabricatorTile fabricator, IInventory recipePattern, IItemHandler craftingResult, IItemHandler inventory, IntMenuData modeData)
{
super(type, id, fabricator);
this.player = playerInventory.player;
this.level = player.level;
this.modeData = modeData;
addVariable(modeData);
checkContainerSize(recipePattern, 9);
assertInventorySize(craftingResult, 1);
assertInventorySize(inventory, 9);
assertDataSize(data, 1);
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
addSlot(new RecipePatternSlot(this, recipePattern, j + i * 3, 16 + j * 18, 25 + i * 18));
addSlot(new ZYSlot(craftingResult, 0, 88, 43)
{
@Override
public boolean mayPickup(PlayerEntity player)
{
return false;
}
@Override
public boolean mayPlace(ItemStack stack)
{
return false;
}
});
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
addSlot(new ZYSlot(inventory, j + i * 3, 124 + j * 18, 25 + i * 18));
addPlayerInventorySlots(playerInventory);
}
@Override
protected ItemStack doClick(int slotIndex, int button, ClickType type, PlayerEntity player)
{
if (slotIndex >= 0 && slotIndex < 9)
{
if (type == ClickType.PICKUP || type == ClickType.QUICK_CRAFT)
getSlot(slotIndex).set(ItemStackUtils.copy(player.inventory.getCarried(), 1));
return ItemStack.EMPTY;
}
else if (slotIndex == 9)
{
if (blockEntity == null || type != ClickType.PICKUP)
return ItemStack.EMPTY;
if (button == 0)
{
blockEntity.logic().recheckSides();
blockEntity.logic().tryCraft();
}
else if (button == 1)
{
blockEntity.recipePattern().clearContent();
blockEntity.setCraftingRecipeAndResult(null, ItemStack.EMPTY);
}
broadcastChanges();
return ItemStack.EMPTY;
}
return super.doClick(slotIndex, button, type, player);
}
@Override
public void slotsChanged(IInventory inventory)
{
if (blockEntity == null)
return;
CraftingInventory recipePattern = blockEntity.recipePattern();
ICraftingRecipe lastRecipe = blockEntity.craftingRecipe();
if (lastRecipe != null && lastRecipe.matches(recipePattern, level))
return;
ServerPlayerEntity player = (ServerPlayerEntity)this.player;
Optional<ICraftingRecipe> craftingRecipe = level.getRecipeManager().getRecipeFor(IRecipeType.CRAFTING, recipePattern, level)
.filter(FabricatorTile::isRecipeCompatible);
ItemStack craftingResult = craftingRecipe.map(recipe -> recipe.assemble(recipePattern)).orElse(ItemStack.EMPTY);
blockEntity.setCraftingRecipeAndResult(craftingRecipe.orElse(null), craftingResult);
player.connection.send(new SSetSlotPacket(containerId, 9, craftingResult));
}
@Override
public boolean tryTransferStackToSlot(ItemStack stack, int slotIndex)
{
return slotIndex >= 10 && slotIndex < 19 ? moveItemStackTo(stack, 19, 55, false) : moveItemStackTo(stack, 10, 19, false);
}
@Override
public boolean clickMenuButton(PlayerEntity player, int index)
{
if (blockEntity != null)
blockEntity.setMode(FabricatorMode.VALUES[index]);
return modeData.getAsInt() != index;
}
public IntMenuData modeData()
{
return modeData;
}
}
| UTF-8 | Java | 5,794 | java | FabricatorContainer.java | Java | [] | null | [] | package nikita488.zycraft.menu;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ICraftingRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.network.play.server.SSetSlotPacket;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import nikita488.zycraft.block.state.properties.FabricatorMode;
import nikita488.zycraft.init.ZYContainers;
import nikita488.zycraft.menu.data.IntMenuData;
import nikita488.zycraft.menu.slot.RecipePatternSlot;
import nikita488.zycraft.menu.slot.ZYSlot;
import nikita488.zycraft.tile.FabricatorTile;
import nikita488.zycraft.util.ItemStackUtils;
import javax.annotation.Nullable;
import java.util.Optional;
public class FabricatorContainer extends ZYTileContainer<FabricatorTile>
{
private final World level;
private final PlayerEntity player;
private final IntMenuData modeData;
public FabricatorContainer(@Nullable ContainerType<?> type, int id, PlayerInventory playerInventory)
{
this(type, id, playerInventory, null, new Inventory(9), new ItemStackHandler(), new ItemStackHandler(9), new IntMenuData());
}
public FabricatorContainer(int id, PlayerInventory playerInventory, FabricatorTile fabricator)
{
this(ZYContainers.FABRICATOR.get(), id, playerInventory, fabricator, fabricator.recipePattern(), fabricator.craftingResult(), fabricator.inventory(), new IntMenuData(() -> fabricator.mode().ordinal()));
}
public FabricatorContainer(@Nullable ContainerType<?> type, int id, PlayerInventory playerInventory, @Nullable FabricatorTile fabricator, IInventory recipePattern, IItemHandler craftingResult, IItemHandler inventory, IntMenuData modeData)
{
super(type, id, fabricator);
this.player = playerInventory.player;
this.level = player.level;
this.modeData = modeData;
addVariable(modeData);
checkContainerSize(recipePattern, 9);
assertInventorySize(craftingResult, 1);
assertInventorySize(inventory, 9);
assertDataSize(data, 1);
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
addSlot(new RecipePatternSlot(this, recipePattern, j + i * 3, 16 + j * 18, 25 + i * 18));
addSlot(new ZYSlot(craftingResult, 0, 88, 43)
{
@Override
public boolean mayPickup(PlayerEntity player)
{
return false;
}
@Override
public boolean mayPlace(ItemStack stack)
{
return false;
}
});
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
addSlot(new ZYSlot(inventory, j + i * 3, 124 + j * 18, 25 + i * 18));
addPlayerInventorySlots(playerInventory);
}
@Override
protected ItemStack doClick(int slotIndex, int button, ClickType type, PlayerEntity player)
{
if (slotIndex >= 0 && slotIndex < 9)
{
if (type == ClickType.PICKUP || type == ClickType.QUICK_CRAFT)
getSlot(slotIndex).set(ItemStackUtils.copy(player.inventory.getCarried(), 1));
return ItemStack.EMPTY;
}
else if (slotIndex == 9)
{
if (blockEntity == null || type != ClickType.PICKUP)
return ItemStack.EMPTY;
if (button == 0)
{
blockEntity.logic().recheckSides();
blockEntity.logic().tryCraft();
}
else if (button == 1)
{
blockEntity.recipePattern().clearContent();
blockEntity.setCraftingRecipeAndResult(null, ItemStack.EMPTY);
}
broadcastChanges();
return ItemStack.EMPTY;
}
return super.doClick(slotIndex, button, type, player);
}
@Override
public void slotsChanged(IInventory inventory)
{
if (blockEntity == null)
return;
CraftingInventory recipePattern = blockEntity.recipePattern();
ICraftingRecipe lastRecipe = blockEntity.craftingRecipe();
if (lastRecipe != null && lastRecipe.matches(recipePattern, level))
return;
ServerPlayerEntity player = (ServerPlayerEntity)this.player;
Optional<ICraftingRecipe> craftingRecipe = level.getRecipeManager().getRecipeFor(IRecipeType.CRAFTING, recipePattern, level)
.filter(FabricatorTile::isRecipeCompatible);
ItemStack craftingResult = craftingRecipe.map(recipe -> recipe.assemble(recipePattern)).orElse(ItemStack.EMPTY);
blockEntity.setCraftingRecipeAndResult(craftingRecipe.orElse(null), craftingResult);
player.connection.send(new SSetSlotPacket(containerId, 9, craftingResult));
}
@Override
public boolean tryTransferStackToSlot(ItemStack stack, int slotIndex)
{
return slotIndex >= 10 && slotIndex < 19 ? moveItemStackTo(stack, 19, 55, false) : moveItemStackTo(stack, 10, 19, false);
}
@Override
public boolean clickMenuButton(PlayerEntity player, int index)
{
if (blockEntity != null)
blockEntity.setMode(FabricatorMode.VALUES[index]);
return modeData.getAsInt() != index;
}
public IntMenuData modeData()
{
return modeData;
}
}
| 5,794 | 0.669831 | 0.655851 | 156 | 36.141026 | 37.371395 | 242 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.916667 | false | false | 5 |
ac7ec4df62a5740327243fdbca500eb9e26a28e9 | 10,746,008,177,800 | 21b4300783f74c8242c2b9a78f6f998a800a482b | /leetcode/Odd_Even_Linked_List.java | ca801cbcca65b879ead1734743f1b60e35c3ea81 | [
"MIT"
] | permissive | dray92/Programming-Questions | https://github.com/dray92/Programming-Questions | ff64e30aa6e9c4ade136ed78e52c460c39d440ac | d04def011f9a1221e9438eafd754cec243397b18 | refs/heads/master | "2021-01-17T12:29:32.632000" | "2016-10-11T02:38:10" | "2016-10-11T02:38:10" | 49,532,020 | 8 | 5 | null | null | null | null | null | null | null | null | null | null | null | null | null | package leetcode;
// https://leetcode.com/problems/odd-even-linked-list/
public class Odd_Even_Linked_List {
static class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
next = null;
}
public String toString() {
return String.valueOf(this.val);
}
}
public static void main(String[] args) {
ListNode head = new ListNode(1);
head.next = new ListNode(2);
head.next.next = new ListNode(3);
head.next.next.next = new ListNode(4);
head.next.next.next.next = new ListNode(5);
System.out.println(getString(head));
head = oddEvenList(head);
System.out.println(getString(head));
}
public static String getString(ListNode head) {
StringBuilder st = new StringBuilder();
ListNode cur = head;
while(cur != null) {
st.append(cur.val);
if(cur.next != null)
st.append(" -> ");
cur = cur.next;
}
return st.toString();
}
public static ListNode oddEvenList(ListNode head) {
if(head == null)
return null;
if(head.next == null)
return head;
ListNode oddTail = head, evenTail = head.next;
boolean isNextOdd = true;
while(evenTail != null && evenTail.next != null) {
ListNode temp = evenTail.next;
ListNode tempNext = temp.next;
if(isNextOdd) {
temp.next = oddTail.next;
oddTail.next = temp;
oddTail = temp;
} else {
temp.next = evenTail.next;
evenTail.next = temp;
evenTail = temp;
}
isNextOdd = !isNextOdd;
evenTail.next = tempNext;
}
return head;
}
}
| UTF-8 | Java | 1,720 | java | Odd_Even_Linked_List.java | Java | [] | null | [] | package leetcode;
// https://leetcode.com/problems/odd-even-linked-list/
public class Odd_Even_Linked_List {
static class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
next = null;
}
public String toString() {
return String.valueOf(this.val);
}
}
public static void main(String[] args) {
ListNode head = new ListNode(1);
head.next = new ListNode(2);
head.next.next = new ListNode(3);
head.next.next.next = new ListNode(4);
head.next.next.next.next = new ListNode(5);
System.out.println(getString(head));
head = oddEvenList(head);
System.out.println(getString(head));
}
public static String getString(ListNode head) {
StringBuilder st = new StringBuilder();
ListNode cur = head;
while(cur != null) {
st.append(cur.val);
if(cur.next != null)
st.append(" -> ");
cur = cur.next;
}
return st.toString();
}
public static ListNode oddEvenList(ListNode head) {
if(head == null)
return null;
if(head.next == null)
return head;
ListNode oddTail = head, evenTail = head.next;
boolean isNextOdd = true;
while(evenTail != null && evenTail.next != null) {
ListNode temp = evenTail.next;
ListNode tempNext = temp.next;
if(isNextOdd) {
temp.next = oddTail.next;
oddTail.next = temp;
oddTail = temp;
} else {
temp.next = evenTail.next;
evenTail.next = temp;
evenTail = temp;
}
isNextOdd = !isNextOdd;
evenTail.next = tempNext;
}
return head;
}
}
| 1,720 | 0.559884 | 0.556977 | 75 | 21.933332 | 15.276416 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.84 | false | false | 5 |
c688cb4a90fe0f275f7f183b727ee5e8b272c09b | 25,460,566,139,084 | 6fc5476d97dc9d9dbd3fdbf8768950656fc37454 | /src/main/com/sample/calculator/CalculatorController.java | 22138d3ae3bbf87b03c3b332f4deb8c948da0ffe | [] | no_license | s0lus/JavaFX-Calculator | https://github.com/s0lus/JavaFX-Calculator | f524fa8e80c4aac8f14c640b4f19bd179fd29074 | ad1e708ce7fa532f6e929b958b37e49193c57ecf | refs/heads/master | "2016-09-12T01:31:03.857000" | "2016-06-15T14:30:57" | "2016-06-15T14:30:57" | 61,043,025 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sample.calculator;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.event.ActionEvent;
import javafx.scene.control.TextField;
public class CalculatorController
{
@FXML
TextField display;
private boolean buttonDigitWasPressed;
private String displayNumber = "0";
private Button button;
public void digitButtons(ActionEvent actionEvent)
{
button = (Button) actionEvent.getSource();
String digit = button.getText();
if (buttonDigitWasPressed)
{
displayNumber += digit;
}
else
{
displayNumber = digit;
}
buttonDigitWasPressed = true;
display.setText(displayNumber);
System.out.println("Display Number: " + displayNumber);
}
public void backSpaceButton(ActionEvent actionEvent)
{
System.out.println("BackSpaces was clicked");
}
public void divideButton(ActionEvent actionEvent)
{
}
public void plusButton(ActionEvent actionEvent)
{
}
public void commaButton(ActionEvent actionEvent)
{
}
public void equalButton(ActionEvent actionEvent)
{
}
public void minusButton(ActionEvent actionEvent)
{
}
public void multiplyButton(ActionEvent actionEvent)
{
}
public void buttonClear(ActionEvent actionEvent)
{
display.setText("0");
buttonDigitWasPressed = false;
}
public void buttonSqrt(ActionEvent actionEvent)
{
double sqrt = Math.sqrt(Double.parseDouble(displayNumber));
display.setText(String.valueOf(sqrt));
buttonDigitWasPressed = false;
}
} | UTF-8 | Java | 1,615 | java | CalculatorController.java | Java | [] | null | [] | package com.sample.calculator;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.event.ActionEvent;
import javafx.scene.control.TextField;
public class CalculatorController
{
@FXML
TextField display;
private boolean buttonDigitWasPressed;
private String displayNumber = "0";
private Button button;
public void digitButtons(ActionEvent actionEvent)
{
button = (Button) actionEvent.getSource();
String digit = button.getText();
if (buttonDigitWasPressed)
{
displayNumber += digit;
}
else
{
displayNumber = digit;
}
buttonDigitWasPressed = true;
display.setText(displayNumber);
System.out.println("Display Number: " + displayNumber);
}
public void backSpaceButton(ActionEvent actionEvent)
{
System.out.println("BackSpaces was clicked");
}
public void divideButton(ActionEvent actionEvent)
{
}
public void plusButton(ActionEvent actionEvent)
{
}
public void commaButton(ActionEvent actionEvent)
{
}
public void equalButton(ActionEvent actionEvent)
{
}
public void minusButton(ActionEvent actionEvent)
{
}
public void multiplyButton(ActionEvent actionEvent)
{
}
public void buttonClear(ActionEvent actionEvent)
{
display.setText("0");
buttonDigitWasPressed = false;
}
public void buttonSqrt(ActionEvent actionEvent)
{
double sqrt = Math.sqrt(Double.parseDouble(displayNumber));
display.setText(String.valueOf(sqrt));
buttonDigitWasPressed = false;
}
} | 1,615 | 0.681734 | 0.680495 | 81 | 18.950617 | 20.472748 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.271605 | false | false | 5 |
c4612f89b6d91680111709abe71bb8c91d4fdec8 | 7,593,502,192,400 | 9f1f5d38a86b76b3f73523956a6e5125bd8954e0 | /QuickSort/QuickSort.java | dff772412f8c02cc43d92fe39cc806ca19d9d8f0 | [] | no_license | nwulqx/Algorithm | https://github.com/nwulqx/Algorithm | 61f102b47042d03fa433046296f1646c1a840a4b | 752146a451346ac7f4eead81e74630022eb67b9a | refs/heads/master | "2023-03-01T15:10:47.016000" | "2021-01-28T14:15:28" | "2021-01-28T14:15:28" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
public class QuickSort{
public static void main(String[] args){
/*int a[] = {1,2,3};
System.out.print(Arrays.toString(a));
exch(a,0,1);
System.out.print(Arrays.toString(a));*/
int j ;
int a[] = {4,3,2,4,1};
/*j= combination(a,0,3);
j = combination(a,0,j-1);
j = combination(a,j+1,2);
System.out.print(Arrays.toString(a)+"\n\rj="+j);*/
sort(a);
}
/*
小于判断,a<b。返回true;
a>b,返回false。
*/
public static boolean less(int a,int b){
return a-b<0?true:false;
}
public static void exch(int[] a,int i,int j){
System.out.println("beforeexch:"+Arrays.toString(a));
/*^异或运算下的交换元素,不能针对同一个元素自身更换,所以数组想要自身更换,还是不要用
例如:a=a^a;此时a=0;自身怎么运算就都是0了
*/
a[i] = a[i]^a[j];
a[j] = a[i]^a[j];
a[i] = a[i]^a[j];
System.out.println("afterexch:"+Arrays.toString(a));
}
public static int combination(int []a,int lo,int hi){
int i = lo;
int j = hi+1;
while(true){
//从左边逐个寻找大于a[lo]的数
while(less(a[++i],a[lo]))
if(i==hi) break;
//从右边逐个寻找小于a[lo]的数
while(less(a[lo],a[--j]))
if(j==lo) break;
if(i>=j) break;
exch(a,i,j);
}
if(j==lo) return j;
exch(a,lo,j);
return j;
}
public static void sort(int []a,int lo,int hi){
if(hi<=lo) return;
int j = combination(a,lo,hi);
sort(a,lo,j-1);
sort(a,j+1,hi);
}
public static void sort(int []a){
sort(a,0,a.length-1);
}
} | UTF-8 | Java | 1,528 | java | QuickSort.java | Java | [] | null | [] | import java.util.*;
public class QuickSort{
public static void main(String[] args){
/*int a[] = {1,2,3};
System.out.print(Arrays.toString(a));
exch(a,0,1);
System.out.print(Arrays.toString(a));*/
int j ;
int a[] = {4,3,2,4,1};
/*j= combination(a,0,3);
j = combination(a,0,j-1);
j = combination(a,j+1,2);
System.out.print(Arrays.toString(a)+"\n\rj="+j);*/
sort(a);
}
/*
小于判断,a<b。返回true;
a>b,返回false。
*/
public static boolean less(int a,int b){
return a-b<0?true:false;
}
public static void exch(int[] a,int i,int j){
System.out.println("beforeexch:"+Arrays.toString(a));
/*^异或运算下的交换元素,不能针对同一个元素自身更换,所以数组想要自身更换,还是不要用
例如:a=a^a;此时a=0;自身怎么运算就都是0了
*/
a[i] = a[i]^a[j];
a[j] = a[i]^a[j];
a[i] = a[i]^a[j];
System.out.println("afterexch:"+Arrays.toString(a));
}
public static int combination(int []a,int lo,int hi){
int i = lo;
int j = hi+1;
while(true){
//从左边逐个寻找大于a[lo]的数
while(less(a[++i],a[lo]))
if(i==hi) break;
//从右边逐个寻找小于a[lo]的数
while(less(a[lo],a[--j]))
if(j==lo) break;
if(i>=j) break;
exch(a,i,j);
}
if(j==lo) return j;
exch(a,lo,j);
return j;
}
public static void sort(int []a,int lo,int hi){
if(hi<=lo) return;
int j = combination(a,lo,hi);
sort(a,lo,j-1);
sort(a,j+1,hi);
}
public static void sort(int []a){
sort(a,0,a.length-1);
}
} | 1,528 | 0.591382 | 0.573551 | 59 | 21.830509 | 14.760406 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3 | false | false | 5 |
7ea7a8698ee9d7e700040497f450d11f68bce098 | 22,617,297,792,355 | bb12064949a2834844d76e2c54b0f64a32109b12 | /src/test/java/com/eliana/betancur/recipe/RecipeDAOTests.java | 86c22b8f7654ed67c5b2dced61d7ad78c5d5d6c5 | [] | no_license | gneliana/RecipeCaseStudy | https://github.com/gneliana/RecipeCaseStudy | 011eef8b77a34d232311efa108eef5b5954cf313 | edc64a2be9070d7baaae05df7399c2431222b5c2 | refs/heads/main | "2023-09-04T11:15:03.947000" | "2021-10-21T14:38:12" | "2021-10-21T14:38:12" | 417,305,161 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.eliana.betancur.recipe;
import java.util.List;
import java.util.Optional;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.annotation.Rollback;
import com.eliana.betancur.dao.RecipeDAO;
import com.eliana.betancur.enitity.Difficulty;
import com.eliana.betancur.enitity.Recipe;
@DataJpaTest
@TestMethodOrder(OrderAnnotation.class)
public class RecipeDAOTests {
@Autowired
private RecipeDAO recipeDAO;
@Test
@Order(1)
@Rollback(value = false)
public void saveRecipeTest() {
Recipe recipe = Recipe.builder().recipeDescription("Fajitas").prepTime("1").cookTime("10").servings("2")
.directions("Cook It").Image("IMAGE URL").categories(null).difficulty(Difficulty.EASY).ingredient(null)
.build();
recipeDAO.save(recipe);
Assertions.assertThat(recipe.getId()).isGreaterThan(0);
}
@Test
@Order(2)
public void getRecipeTest() {
Recipe recipe = recipeDAO.findById(1);
Assertions.assertThat(recipe.getId()).isEqualTo(1);
}
@Test
@Order(3)
public void getListOfRecipes() {
List<Recipe> recipes = recipeDAO.findAll();
Assertions.assertThat(recipes.size()).isGreaterThan(0);
}
@Test
@Order(4)
@Rollback(value = false)
public void updateRecipeTest() {
Recipe recipe = recipeDAO.findById(1);
recipe.setCookTime("UT_Updated CookTime");
Assertions.assertThat(recipeDAO.findById(1).getCookTime()).isEqualTo(recipe.getCookTime());
}
@Test
@Order(5)
@Rollback(value = false)
public void deleteRecipeTest() {
Recipe recipe = recipeDAO.findById(1);
recipeDAO.delete(recipe);
Optional<Recipe> optionalRecipe = Optional.ofNullable(recipeDAO.findById(recipe.getId()));
Recipe tempRecipe = null;
if (optionalRecipe.isPresent()) {
tempRecipe = optionalRecipe.get();
}
Assertions.assertThat(tempRecipe).isNull();
}
}
| UTF-8 | Java | 2,197 | java | RecipeDAOTests.java | Java | [] | null | [] | package com.eliana.betancur.recipe;
import java.util.List;
import java.util.Optional;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.annotation.Rollback;
import com.eliana.betancur.dao.RecipeDAO;
import com.eliana.betancur.enitity.Difficulty;
import com.eliana.betancur.enitity.Recipe;
@DataJpaTest
@TestMethodOrder(OrderAnnotation.class)
public class RecipeDAOTests {
@Autowired
private RecipeDAO recipeDAO;
@Test
@Order(1)
@Rollback(value = false)
public void saveRecipeTest() {
Recipe recipe = Recipe.builder().recipeDescription("Fajitas").prepTime("1").cookTime("10").servings("2")
.directions("Cook It").Image("IMAGE URL").categories(null).difficulty(Difficulty.EASY).ingredient(null)
.build();
recipeDAO.save(recipe);
Assertions.assertThat(recipe.getId()).isGreaterThan(0);
}
@Test
@Order(2)
public void getRecipeTest() {
Recipe recipe = recipeDAO.findById(1);
Assertions.assertThat(recipe.getId()).isEqualTo(1);
}
@Test
@Order(3)
public void getListOfRecipes() {
List<Recipe> recipes = recipeDAO.findAll();
Assertions.assertThat(recipes.size()).isGreaterThan(0);
}
@Test
@Order(4)
@Rollback(value = false)
public void updateRecipeTest() {
Recipe recipe = recipeDAO.findById(1);
recipe.setCookTime("UT_Updated CookTime");
Assertions.assertThat(recipeDAO.findById(1).getCookTime()).isEqualTo(recipe.getCookTime());
}
@Test
@Order(5)
@Rollback(value = false)
public void deleteRecipeTest() {
Recipe recipe = recipeDAO.findById(1);
recipeDAO.delete(recipe);
Optional<Recipe> optionalRecipe = Optional.ofNullable(recipeDAO.findById(recipe.getId()));
Recipe tempRecipe = null;
if (optionalRecipe.isPresent()) {
tempRecipe = optionalRecipe.get();
}
Assertions.assertThat(tempRecipe).isNull();
}
}
| 2,197 | 0.731452 | 0.724169 | 78 | 26.166666 | 25.684185 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.294872 | false | false | 5 |
a3f005ab3413f5d0640d346efafd847fe4bffdf6 | 38,766,374,849,323 | ca0e03251b3f6058ec2eae0d8ae232f002f474eb | /src/main/java/com/bonc/medicine/entity/thumb/IntegralRule.java | 9b2f139efe60b344d4ae49aff6ba2f4fc866a1b1 | [] | no_license | tang6922718/medicine-1026 | https://github.com/tang6922718/medicine-1026 | 71dbbba0a14a86d87a316c06bf6be352c9f01398 | b62f1652f3b4f3d80abb7986c0fd061a9c20e174 | refs/heads/master | "2020-04-02T20:13:44.587000" | "2018-10-25T09:41:07" | "2018-10-25T09:41:07" | 154,761,849 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bonc.medicine.entity.thumb;
/**
* @program: medicine-hn
* @description: 积分规则实体类
* @author: hejiajun
* @create: 2018-09-06 21:37
**/
public class IntegralRule {
//id
private int id;
//行为编号/类型
private String actionCode;
//积分数当前行为的积分数
private int point;
//有效标志1:有效 0:无效
private char isEffect;
private String chineseName;
//每日上限
private int upperBound;
private int upperTimes;
public IntegralRule() {
}
public int getUpperTimes() {
return upperTimes;
}
public void setUpperTimes(int upperTimes) {
this.upperTimes = upperTimes;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getActionCode() {
return actionCode;
}
public void setActionCode(String actionCode) {
this.actionCode = actionCode;
}
public int getPoint() {
return point;
}
public void setPoint(int point) {
this.point = point;
}
public char getIsEffect() {
return isEffect;
}
public void setIsEffect(char isEffect) {
this.isEffect = isEffect;
}
public String getChineseName() {
return chineseName;
}
public void setChineseName(String chineseName) {
this.chineseName = chineseName;
}
public int getUpperBound() {
return upperBound;
}
public void setUpperBound(int upperBound) {
this.upperBound = upperBound;
}
@Override
public String toString() {
return "IntegralRule{" +
"id=" + id +
", actionCode='" + actionCode + '\'' +
", point=" + point +
", isEffect=" + isEffect +
", chineseName='" + chineseName + '\'' +
", upperBound=" + upperBound +
", upperTimes=" + upperTimes +
'}';
}
}
| UTF-8 | Java | 2,031 | java | IntegralRule.java | Java | [
{
"context": ": medicine-hn\n * @description: 积分规则实体类\n * @author: hejiajun\n * @create: 2018-09-06 21:37\n **/\npublic class In",
"end": 115,
"score": 0.9976526498794556,
"start": 107,
"tag": "USERNAME",
"value": "hejiajun"
}
] | null | [] | package com.bonc.medicine.entity.thumb;
/**
* @program: medicine-hn
* @description: 积分规则实体类
* @author: hejiajun
* @create: 2018-09-06 21:37
**/
public class IntegralRule {
//id
private int id;
//行为编号/类型
private String actionCode;
//积分数当前行为的积分数
private int point;
//有效标志1:有效 0:无效
private char isEffect;
private String chineseName;
//每日上限
private int upperBound;
private int upperTimes;
public IntegralRule() {
}
public int getUpperTimes() {
return upperTimes;
}
public void setUpperTimes(int upperTimes) {
this.upperTimes = upperTimes;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getActionCode() {
return actionCode;
}
public void setActionCode(String actionCode) {
this.actionCode = actionCode;
}
public int getPoint() {
return point;
}
public void setPoint(int point) {
this.point = point;
}
public char getIsEffect() {
return isEffect;
}
public void setIsEffect(char isEffect) {
this.isEffect = isEffect;
}
public String getChineseName() {
return chineseName;
}
public void setChineseName(String chineseName) {
this.chineseName = chineseName;
}
public int getUpperBound() {
return upperBound;
}
public void setUpperBound(int upperBound) {
this.upperBound = upperBound;
}
@Override
public String toString() {
return "IntegralRule{" +
"id=" + id +
", actionCode='" + actionCode + '\'' +
", point=" + point +
", isEffect=" + isEffect +
", chineseName='" + chineseName + '\'' +
", upperBound=" + upperBound +
", upperTimes=" + upperTimes +
'}';
}
}
| 2,031 | 0.552941 | 0.54578 | 102 | 18.166666 | 16.338985 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.284314 | false | false | 5 |
6a31cc47ab8e802e5cef037683879ee19d5dbd5b | 28,303,834,536,653 | 2a94aeb721b3137eb5960bde8325c018f622e2c0 | /Battleships-master/BlueDestroyer.java | c4edb677beeadec810d119f32fbdc0d583d660e4 | [] | no_license | JamesLWang/Battleship | https://github.com/JamesLWang/Battleship | d0420ee8411f6291670a7c3e2974b5e081910931 | 81c844fee50643370920a1dc13e98e3db4afbd78 | refs/heads/master | "2018-03-31T05:19:33.724000" | "2017-04-20T16:05:40" | "2017-04-20T16:05:40" | 88,080,429 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | import greenfoot.*;
import java.util.*;
/**
* Write a description of class BlueDestroyer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class BlueDestroyer extends BlueShip
{
public void crossBoundaries(){
Actor actor = getOneIntersectingObject(Boom.class);
if(actor != null){
setLocation(getX(), getY() - 10);
}
}
public void act()
{
move();
crossBoundaries();
}
}
| UTF-8 | Java | 492 | java | BlueDestroyer.java | Java | [] | null | [] | import greenfoot.*;
import java.util.*;
/**
* Write a description of class BlueDestroyer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class BlueDestroyer extends BlueShip
{
public void crossBoundaries(){
Actor actor = getOneIntersectingObject(Boom.class);
if(actor != null){
setLocation(getX(), getY() - 10);
}
}
public void act()
{
move();
crossBoundaries();
}
}
| 492 | 0.575203 | 0.571138 | 27 | 17.222221 | 17.121208 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.259259 | false | false | 5 |
ff2a2ecce90deff4a596a2fe372528ddbda64b7b | 35,854,387,005,925 | e73757b85389274316523a0b53f2df901e693cdd | /jisuan/src/main/java/com/anxin/jisuan/dao/MyStudentDao.java | 1715d3db7bd7fa02b918705762dc7f006cfd8cfa | [] | no_license | loowyoung/ZXJS | https://github.com/loowyoung/ZXJS | 976762bc41f10ff487fd12546a3cb2b1f4a94f8e | 9bb58126a81bac72f34568c3521b5e616d799205 | refs/heads/master | "2023-05-25T19:21:15.857000" | "2023-05-22T06:38:41" | "2023-05-22T06:38:41" | 161,727,221 | 1 | 0 | null | false | "2022-06-17T03:22:48" | "2018-12-14T03:33:11" | "2021-06-13T03:09:48" | "2022-06-17T03:22:48" | 1,193 | 1 | 0 | 5 | JavaScript | false | false | package com.anxin.jisuan.dao;
import com.anxin.jisuan.model.MyStudentModel;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author: ly
* @date: 2020/2/13 14:11
*/
@Mapper
public interface MyStudentDao {
List<MyStudentModel> findAll();
Object findMapBySql(String s, List<Object> objects);
Object findTotalCountBySql(String s, Object any);
}
| UTF-8 | Java | 387 | java | MyStudentDao.java | Java | [
{
"context": "s.Mapper;\n\nimport java.util.List;\n\n/**\n * @author: ly\n * @date: 2020/2/13 14:11\n */\n@Mapper\npublic inte",
"end": 165,
"score": 0.9806928038597107,
"start": 163,
"tag": "USERNAME",
"value": "ly"
}
] | null | [] | package com.anxin.jisuan.dao;
import com.anxin.jisuan.model.MyStudentModel;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author: ly
* @date: 2020/2/13 14:11
*/
@Mapper
public interface MyStudentDao {
List<MyStudentModel> findAll();
Object findMapBySql(String s, List<Object> objects);
Object findTotalCountBySql(String s, Object any);
}
| 387 | 0.731266 | 0.702842 | 19 | 19.368422 | 19.437378 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473684 | false | false | 5 |
888b61c44b7ce71cde6fa2615ef27bddc41923d7 | 34,437,047,816,534 | 27db46260490191e4e5e535cb68184f5875a8071 | /Akipav2/src/main/java/com/akipav2/rest/PlatosREST.java | 79f727133c72b0b9e2f18bb5d8550a8af3eaa970 | [] | no_license | glizarzaburu/Akipav2 | https://github.com/glizarzaburu/Akipav2 | aaf4235437d3be24d8cfd2ad84a8008793a3c932 | dc18581f2b91cff3e0b057c95988bbe8d9d17fed | refs/heads/main | "2023-03-07T23:44:47.939000" | "2021-01-31T23:52:36" | "2021-01-31T23:52:36" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.akipav2.rest;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.akipav2.dao.PlatosDAO;
import com.akipav2.entitys.Platos;
@RestController
@RequestMapping("/platos")
public class PlatosREST {
//@GetMapping
@RequestMapping(value="hello", method=RequestMethod.GET)
public String hello() {
return "Estas en la seccion platos";
}
@Autowired
private PlatosDAO platoDAO;
@RequestMapping(value = "listar", method = RequestMethod.GET)
public ResponseEntity<List<Platos>> getPlatos(){
List<Platos> platos = platoDAO.findAll();
return ResponseEntity.ok(platos);
}
@RequestMapping(value = "listar/{platoId}", method = RequestMethod.GET)
public ResponseEntity<Platos> getPlatosById(@PathVariable("platoId") Long platoId){
Optional<Platos> optionalPlatos =platoDAO.findById(platoId);
if (optionalPlatos.isPresent()) {
return ResponseEntity.ok(optionalPlatos.get());
}else {
return ResponseEntity.noContent().build();
}
}
@PostMapping(value = "/registrar")
public ResponseEntity<Platos> createPlato(@RequestBody Platos plato){
Platos newPlato = platoDAO.save(plato);
return ResponseEntity.ok(newPlato);
}
@DeleteMapping(value = "/eliminar/{platoId}")
public ResponseEntity<Void> deletePlato(@PathVariable("platoId") Long platoId){
platoDAO.deleteById(platoId);
return ResponseEntity.ok(null);
}
@PutMapping(value = "/actualizar")
public ResponseEntity<Platos> updatePlato(@RequestBody Platos plato){
Optional<Platos> optionalPlato = platoDAO.findById(plato.getId());
if (optionalPlato.isPresent()) {
Platos updatePlato = optionalPlato.get();
updatePlato.setNombre(plato.getNombre());
updatePlato.setPrecio(plato.getPrecio());
updatePlato.setEstado(plato.getEstado());
updatePlato.setImagen(plato.getImagen());
updatePlato.setDescripcionPlato(plato.getDescripcionPlato());
platoDAO.save(updatePlato);
return ResponseEntity.ok(updatePlato);
}else {
return ResponseEntity.notFound().build();
}
}
}
| UTF-8 | Java | 2,782 | java | PlatosREST.java | Java | [] | null | [] | package com.akipav2.rest;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.akipav2.dao.PlatosDAO;
import com.akipav2.entitys.Platos;
@RestController
@RequestMapping("/platos")
public class PlatosREST {
//@GetMapping
@RequestMapping(value="hello", method=RequestMethod.GET)
public String hello() {
return "Estas en la seccion platos";
}
@Autowired
private PlatosDAO platoDAO;
@RequestMapping(value = "listar", method = RequestMethod.GET)
public ResponseEntity<List<Platos>> getPlatos(){
List<Platos> platos = platoDAO.findAll();
return ResponseEntity.ok(platos);
}
@RequestMapping(value = "listar/{platoId}", method = RequestMethod.GET)
public ResponseEntity<Platos> getPlatosById(@PathVariable("platoId") Long platoId){
Optional<Platos> optionalPlatos =platoDAO.findById(platoId);
if (optionalPlatos.isPresent()) {
return ResponseEntity.ok(optionalPlatos.get());
}else {
return ResponseEntity.noContent().build();
}
}
@PostMapping(value = "/registrar")
public ResponseEntity<Platos> createPlato(@RequestBody Platos plato){
Platos newPlato = platoDAO.save(plato);
return ResponseEntity.ok(newPlato);
}
@DeleteMapping(value = "/eliminar/{platoId}")
public ResponseEntity<Void> deletePlato(@PathVariable("platoId") Long platoId){
platoDAO.deleteById(platoId);
return ResponseEntity.ok(null);
}
@PutMapping(value = "/actualizar")
public ResponseEntity<Platos> updatePlato(@RequestBody Platos plato){
Optional<Platos> optionalPlato = platoDAO.findById(plato.getId());
if (optionalPlato.isPresent()) {
Platos updatePlato = optionalPlato.get();
updatePlato.setNombre(plato.getNombre());
updatePlato.setPrecio(plato.getPrecio());
updatePlato.setEstado(plato.getEstado());
updatePlato.setImagen(plato.getImagen());
updatePlato.setDescripcionPlato(plato.getDescripcionPlato());
platoDAO.save(updatePlato);
return ResponseEntity.ok(updatePlato);
}else {
return ResponseEntity.notFound().build();
}
}
}
| 2,782 | 0.745147 | 0.744069 | 87 | 29.977011 | 24.838779 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.747126 | false | false | 5 |
f0045ae095d703c66e03fbaed7b8ea7407693d10 | 36,386,962,960,702 | 89d969a9d0e83d3852566dbf1fe14dfefc94a2da | /guli-commonservice-eureka/src/main/java/com/guli/eureka/EurekaServerApplication.java | 3011b335ee596f3e688b8d5d10eef83f6ec0f3ac | [] | no_license | bellmit/guli-mei | https://github.com/bellmit/guli-mei | 1579dea9c73a022fe40b9e98fb6e2f5860cc04ca | 6ecb5895f7aca0866edd4b88857f373d74fa1a09 | refs/heads/master | "2023-05-11T19:38:33.019000" | "2020-09-11T02:40:05" | "2020-09-11T02:40:05" | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.guli.eureka;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* @author :mei
* @date :Created in 2019/3/12 0012 上午 11:17
* @description:注册中心启动类
* @modified By:
* @version: $
*/
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class);
}
}
| UTF-8 | Java | 590 | java | EurekaServerApplication.java | Java | [
{
"context": "ka.server.EnableEurekaServer;\r\n\r\n/**\r\n * @author :mei\r\n * @date :Created in 2019/3/12 0012 上午 11:17\r\n *",
"end": 248,
"score": 0.998816728591919,
"start": 245,
"tag": "USERNAME",
"value": "mei"
}
] | null | [] | package com.guli.eureka;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* @author :mei
* @date :Created in 2019/3/12 0012 上午 11:17
* @description:注册中心启动类
* @modified By:
* @version: $
*/
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class);
}
}
| 590 | 0.741135 | 0.714539 | 20 | 26.200001 | 22.99913 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 5 |
f0d52ec05c4d6748ed9bcf7d28fa28fa1769745d | 35,450,660,097,317 | fa54289d5ef44be1aae44dac85963161c87168c0 | /src/everyT/everyone.java | a6d9541eb8ea91b41e2ad24c409087a579ed07b4 | [] | no_license | xiaomage6/test001 | https://github.com/xiaomage6/test001 | 6b0f2bd02b559e357d7f9a3147b289d964aac4a0 | b2067573ceccf7772cc10e8b62f4793347c3a900 | refs/heads/master | "2020-03-17T09:07:23.779000" | "2018-05-14T02:20:33" | "2018-05-14T02:20:33" | 133,461,929 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package everyT;
import java.util.Random;
public class everyone {
public static void main(String[] args) {
int i=1;
Random random=new Random();
int count=random.nextInt(5000)*100;
System.out.println(count);
}
}
| UTF-8 | Java | 213 | java | everyone.java | Java | [] | null | [] | package everyT;
import java.util.Random;
public class everyone {
public static void main(String[] args) {
int i=1;
Random random=new Random();
int count=random.nextInt(5000)*100;
System.out.println(count);
}
}
| 213 | 0.737089 | 0.699531 | 12 | 16.75 | 13.772709 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false | 5 |
39da4059e94a7b15d6709cfa5ad4032cf706db58 | 8,572,754,780,824 | 581dae83063e97b3b6587e287c63744b02b130ba | /flashtext/src/storyteller/ColorTranslator.java | f8419ca0377c50c788e0221ff4e2073287629d1f | [] | no_license | alejandrolujan/multimedia-storyteller | https://github.com/alejandrolujan/multimedia-storyteller | 11e18bbf1b10715e2977d63506840929953175f7 | 72dd3ba0670dd9a7f1ee715478fad0e12e3c55d8 | refs/heads/master | "2021-01-19T09:06:08.568000" | "2007-12-12T22:30:19" | "2007-12-12T22:30:19" | 32,114,334 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package storyteller;
import java.lang.reflect.Method;
import com.flagstone.transform.FSColor;
import com.flagstone.transform.FSColorTable;
/**
* @author Alex
*
*/
public class ColorTranslator
{
public enum Suit { }
/**
* Translates a string name to a FSColor object. Uses FSColorTable, which
* supports all the colors defined in the Netscape color table (over 130) Uses
* reflection to call the corresponding method's name.
* @param colorName English name of the color (white, black, grey, etc)
* @return a FSColor object that is named as the colorName parameter. If the name is
* not found in FSColorTable, default is returned. If default is invalid, white is returned.
*/
public static FSColor getColor(String colorName, String defaultColor)
{
try
{
// Load the class and look for the method
Class<?> clazz = FSColorTable.class;
Method m = clazz.getMethod(colorName.toLowerCase(), new Class[0]);
// Invoque the method that corresponds to the color name
FSColor co = (FSColor) m.invoke(null, new Object[0]);
return co;
} catch (Exception e)
{
// Most likely method name not found (colour not defined). Return default.
//System.err.println("Ignoring color parameter '" + colorName + "'");
return getColor(defaultColor, "white");
}
}
}
| UTF-8 | Java | 1,437 | java | ColorTranslator.java | Java | [
{
"context": "stone.transform.FSColorTable;\r\n\r\n\r\n/**\r\n * @author Alex\r\n *\r\n */\r\npublic class ColorTranslator\r\n{\r\n publ",
"end": 184,
"score": 0.9992926716804504,
"start": 180,
"tag": "NAME",
"value": "Alex"
}
] | null | [] | /**
*
*/
package storyteller;
import java.lang.reflect.Method;
import com.flagstone.transform.FSColor;
import com.flagstone.transform.FSColorTable;
/**
* @author Alex
*
*/
public class ColorTranslator
{
public enum Suit { }
/**
* Translates a string name to a FSColor object. Uses FSColorTable, which
* supports all the colors defined in the Netscape color table (over 130) Uses
* reflection to call the corresponding method's name.
* @param colorName English name of the color (white, black, grey, etc)
* @return a FSColor object that is named as the colorName parameter. If the name is
* not found in FSColorTable, default is returned. If default is invalid, white is returned.
*/
public static FSColor getColor(String colorName, String defaultColor)
{
try
{
// Load the class and look for the method
Class<?> clazz = FSColorTable.class;
Method m = clazz.getMethod(colorName.toLowerCase(), new Class[0]);
// Invoque the method that corresponds to the color name
FSColor co = (FSColor) m.invoke(null, new Object[0]);
return co;
} catch (Exception e)
{
// Most likely method name not found (colour not defined). Return default.
//System.err.println("Ignoring color parameter '" + colorName + "'");
return getColor(defaultColor, "white");
}
}
}
| 1,437 | 0.647182 | 0.643702 | 47 | 28.574469 | 29.908901 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.425532 | false | false | 5 |
f4dae4352fa9441c0f6806990f9d9d3d05e37306 | 39,101,382,264,254 | 352ad22ecbdb5f569ba797004a9e634bf1c76d69 | /lib_datamanager/src/main/java/com/wowly/lib/datamanager/cryptographic/ICryptographicString.java | 7a04df02cf3fec93fc75e7076aae92661a36825b | [] | no_license | LionsZhang/lib_datamanager | https://github.com/LionsZhang/lib_datamanager | 75ecc367fce33d9adb47f472a4ad7bf603f3bcff | a0ea27739cee18276639fda1a1e3751e22624a4b | refs/heads/master | "2023-04-09T11:48:19.941000" | "2021-04-06T10:10:31" | "2021-04-06T10:10:31" | 355,035,580 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wowly.lib.datamanager.cryptographic;
/**
* @author: lionszhang
* @Filename: 加解密(字符串)
* @Description:
* @Copyright: Copyright (c) 2017 Tuandai Inc. All rights reserved.
* @date: 2017/5/10 9:18
*/
public interface ICryptographicString extends ICryptographic {
/**
* 加密字符串
*
* @param context 待加密字符串
* @return 加密后的字符串
*/
String encryptString(String context);
/**
* 解密字符串
*
* @param context 待解密字符串
* @return 解密后的字符串
*/
String decodeString(String context);
}
| UTF-8 | Java | 628 | java | ICryptographicString.java | Java | [
{
"context": "ly.lib.datamanager.cryptographic;\n\n/**\n * @author: lionszhang\n * @Filename: 加解密(字符串)\n * @Description:\n * @Copyr",
"end": 76,
"score": 0.9995008111000061,
"start": 66,
"tag": "USERNAME",
"value": "lionszhang"
}
] | null | [] | package com.wowly.lib.datamanager.cryptographic;
/**
* @author: lionszhang
* @Filename: 加解密(字符串)
* @Description:
* @Copyright: Copyright (c) 2017 Tuandai Inc. All rights reserved.
* @date: 2017/5/10 9:18
*/
public interface ICryptographicString extends ICryptographic {
/**
* 加密字符串
*
* @param context 待加密字符串
* @return 加密后的字符串
*/
String encryptString(String context);
/**
* 解密字符串
*
* @param context 待解密字符串
* @return 解密后的字符串
*/
String decodeString(String context);
}
| 628 | 0.625926 | 0.6 | 27 | 19 | 18.340403 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false | 5 |
d9089152d11a51872df1e1c806b476a34f37ed8c | 36,945,308,704,519 | d9acbd5d8241a4938ceffbf0bde799233a5deff0 | /src/main/java/com/ensi/smartlocker/repositories/LigneFicheDemandeRepository.java | cc362b549d11fb086613c258ef125c1e905f8cc4 | [] | no_license | RaniaBOLTANE/ENSI_SmartLockerApp | https://github.com/RaniaBOLTANE/ENSI_SmartLockerApp | f941024f2f6ec0e94b7e27a701e303eae7486a2e | 9e311b897df170d1f8e18657900acdbac3097063 | refs/heads/master | "2022-11-29T00:26:18.319000" | "2020-08-02T11:36:19" | "2020-08-02T11:36:19" | 284,448,244 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ensi.smartlocker.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import com.ensi.smartlocker.domain.LigneFicheDemande;
public interface LigneFicheDemandeRepository extends JpaRepository<LigneFicheDemande, Integer> {
}
| UTF-8 | Java | 262 | java | LigneFicheDemandeRepository.java | Java | [] | null | [] | package com.ensi.smartlocker.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import com.ensi.smartlocker.domain.LigneFicheDemande;
public interface LigneFicheDemandeRepository extends JpaRepository<LigneFicheDemande, Integer> {
}
| 262 | 0.854962 | 0.854962 | 9 | 28.111111 | 33.991646 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 5 |
4f8f2b2607959d6a40c7a66ba75284fcc18d14da | 36,567,351,589,304 | 3b8d7b329f269474d388ec32aaee0aeb6ec29068 | /blogs-service/src/main/java/blogs/service/pojo/SysLog.java | 528e42986797452184d6a00ecbfe6e7641038e0f | [] | no_license | yxh312154247/blogs | https://github.com/yxh312154247/blogs | 93ff2aa71dd6be3983ade253d66acb732b8501ce | 9df77f8a5486eee2f239d69d170585b2a548b153 | refs/heads/master | "2022-06-26T22:11:10.521000" | "2020-01-17T08:58:34" | "2020-01-17T08:58:34" | 234,209,057 | 0 | 0 | null | false | "2022-06-21T02:39:27" | "2020-01-16T01:34:33" | "2020-01-17T08:59:38" | "2022-06-21T02:39:24" | 21 | 0 | 0 | 2 | Java | false | false | package blogs.service.pojo;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotations.Version;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author yangxianghua
* @since 2020-01-17
*/
@Data
@Accessors(chain = true)
@TableName("sys_log")
public class SysLog implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Date time;
@TableField("user_id")
private Integer userId;
@TableField("user_name")
private String userName;
@TableField("article_id")
private Integer articleId;
private String action;
}
| UTF-8 | Java | 1,072 | java | SysLog.java | Java | [
{
"context": "l.Accessors;\n\n/**\n * <p>\n * \n * </p>\n *\n * @author yangxianghua\n * @since 2020-01-17\n */\n@Data\n@Accessors(chain =",
"end": 588,
"score": 0.9880574345588684,
"start": 576,
"tag": "USERNAME",
"value": "yangxianghua"
}
] | null | [] | package blogs.service.pojo;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotations.Version;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author yangxianghua
* @since 2020-01-17
*/
@Data
@Accessors(chain = true)
@TableName("sys_log")
public class SysLog implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Date time;
@TableField("user_id")
private Integer userId;
@TableField("user_name")
private String userName;
@TableField("article_id")
private Integer articleId;
private String action;
}
| 1,072 | 0.746269 | 0.737873 | 52 | 19.615385 | 18.699192 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.403846 | false | false | 5 |
fc5116447094a315de03af30d511de14635038b7 | 38,431,367,376,326 | 7125527d94ff2c3b8738186c915619a41c6773a7 | /app/src/main/java/com/example/android/upcomingmovies/Rest/ApiInterface.java | bed7f18ff94d8d810f3a0c0a01f051aa037eca38 | [] | no_license | sourabhjinde/UpCommingMovies | https://github.com/sourabhjinde/UpCommingMovies | e3b9db41cfe5fa97d2fc22d47d4761661f588050 | 0bcd2d3cae9bb09b28f6f6d53ba1bba2be53498f | refs/heads/master | "2021-01-19T12:09:34.215000" | "2017-04-12T08:01:25" | "2017-04-12T08:01:25" | 88,024,741 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.android.upcomingmovies.Rest;
/**
* Created by S on 07/04/2017.
*/
import retrofit2.Call;
import retrofit2.http.GET;
import com.example.android.upcomingmovies.Model.MovieImagesResponse;
import com.example.android.upcomingmovies.Model.MoviesResponse;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface ApiInterface {
@GET("movie/upcoming")
Call<MoviesResponse> getUpComingMovies(@Query("api_key") String apiKey);
@GET("movie/{id}/images")
Call<MovieImagesResponse> getMovieDetails(@Path("id") int id, @Query("api_key") String apiKey);
} | UTF-8 | Java | 602 | java | ApiInterface.java | Java | [
{
"context": "le.android.upcomingmovies.Rest;\n\n/**\n * Created by S on 07/04/2017.\n */\n\nimport retrofit2.Call;\nimport",
"end": 69,
"score": 0.7287923097610474,
"start": 68,
"tag": "USERNAME",
"value": "S"
}
] | null | [] | package com.example.android.upcomingmovies.Rest;
/**
* Created by S on 07/04/2017.
*/
import retrofit2.Call;
import retrofit2.http.GET;
import com.example.android.upcomingmovies.Model.MovieImagesResponse;
import com.example.android.upcomingmovies.Model.MoviesResponse;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface ApiInterface {
@GET("movie/upcoming")
Call<MoviesResponse> getUpComingMovies(@Query("api_key") String apiKey);
@GET("movie/{id}/images")
Call<MovieImagesResponse> getMovieDetails(@Path("id") int id, @Query("api_key") String apiKey);
} | 602 | 0.757475 | 0.737542 | 23 | 25.217392 | 27.911283 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false | 5 |