blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d5141d871ae19d6564ee1ab74cbd1e04456b87ca | 2738deb948135f34216caeddd4463279f9729d3d | /src/main/java/io/github/andresantini/application/service/AuditEventService.java | cdf9b617534c1af93ff165697ca3c42521f87fbc | [] | no_license | andreLSantini/ESportsAplication | b88f5b6734b34822e7d4fc0a98db2462c517a25e | 5507f342fb7c12d5b1ea0eb029e816769d41c118 | refs/heads/master | 2021-05-08T11:09:50.990607 | 2018-02-01T19:27:08 | 2018-02-01T19:27:08 | 119,882,651 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,830 | java | package io.github.andresantini.application.service;
import io.github.andresantini.application.config.audit.AuditEventConverter;
import io.github.andresantini.application.repository.PersistenceAuditEventRepository;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.util.Optional;
/**
* Service for managing audit events.
* <p>
* This is the default implementation to support SpringBoot Actuator AuditEventRepository
*/
@Service
@Transactional
public class AuditEventService {
private final PersistenceAuditEventRepository persistenceAuditEventRepository;
private final AuditEventConverter auditEventConverter;
public AuditEventService(
PersistenceAuditEventRepository persistenceAuditEventRepository,
AuditEventConverter auditEventConverter) {
this.persistenceAuditEventRepository = persistenceAuditEventRepository;
this.auditEventConverter = auditEventConverter;
}
public Page<AuditEvent> findAll(Pageable pageable) {
return persistenceAuditEventRepository.findAll(pageable)
.map(auditEventConverter::convertToAuditEvent);
}
public Page<AuditEvent> findByDates(Instant fromDate, Instant toDate, Pageable pageable) {
return persistenceAuditEventRepository.findAllByAuditEventDateBetween(fromDate, toDate, pageable)
.map(auditEventConverter::convertToAuditEvent);
}
public Optional<AuditEvent> find(Long id) {
return Optional.ofNullable(persistenceAuditEventRepository.findOne(id)).map
(auditEventConverter::convertToAuditEvent);
}
}
| [
"[email protected]"
] | |
55f3ac27c53863185ec44b1329b49851110aa24e | fc77bc3eb82e18b7a3fb185618420166cf129813 | /Drugs-ERP/src/main/java/com/drug/shw/mapper/OrderDao.java | 60212573934bbd7877ada451a85223df8494a8ad | [] | no_license | luobotie/DrugsERP | 734ee27a57d824370db43161ad770248ad3cd519 | 3f6a38d1a381d018a76a24ae646075199752529d | refs/heads/master | 2022-12-22T02:40:21.902955 | 2019-11-08T08:52:41 | 2019-11-08T08:52:41 | 215,436,745 | 0 | 0 | null | 2022-12-16T04:28:50 | 2019-10-16T02:14:32 | JavaScript | UTF-8 | Java | false | false | 691 | java | package com.drug.shw.mapper;
import java.util.HashMap;
import java.util.List;
import com.drug.shw.entity.DailyPlanDetails;
import com.drug.shw.entity.orderproduct;
public interface OrderDao {
List<orderproduct> selectorderproduct(HashMap<String, Integer> map);
Integer selectrowfromorderproduct();
Integer updateorderproduct(orderproduct orderproduct);
Integer deleteorderproduct(Integer orderid);
Integer insertorderproduct(orderproduct orderproduct);
Integer insertorderproductdetail(DailyPlanDetails dailyPlanDetails);
List<DailyPlanDetails> selectorderproductdetail(Integer id);
Integer updateorderproductauditState(HashMap<String, Object> map);
}
| [
"[email protected]"
] | |
200e1195f789eedabaf371d6dc2d71c4b3bc2c52 | d2b32191f38f2a495de9ac220c4ba4f52e18d4ed | /src/main/java/com/lpdp/bugtracker/web/rest/vm/KeyAndPasswordVM.java | d71ce2294b34f24f6ad6f4df56353df61ad7365a | [] | no_license | LPDPasAI/BugTrackerJHipster | 6188572c324558dfc424b2d5f4e501cbc2de9e98 | be6f1037b345090cfb528bde91a6c65c12b3303a | refs/heads/master | 2022-12-21T00:15:01.418213 | 2019-11-02T16:25:38 | 2019-11-02T16:25:38 | 219,150,885 | 0 | 0 | null | 2022-12-16T04:40:49 | 2019-11-02T12:30:44 | Java | UTF-8 | Java | false | false | 500 | java | package com.lpdp.bugtracker.web.rest.vm;
/**
* View Model object for storing the user's key and password.
*/
public class KeyAndPasswordVM {
private String key;
private String newPassword;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
}
| [
"[email protected]"
] | |
79d2a90b48c8779da5b8e00b709ad8d8eb40db02 | fd9501d0f79d98d1f103316ca5d4a03dedd43db2 | /SistProgram/src/com/sist/dao/CourseDAO.java | b0dd9b846c0e9c39a31df2b555e24cf6927e3295 | [] | no_license | hyunwooDEV/SistProgram | 696c5b0004d02d5080df003d34287e550336f748 | 87bd5f848cc4af5f11468cb44a49044154e51183 | refs/heads/master | 2023-03-21T09:09:32.115349 | 2020-12-20T10:56:00 | 2020-12-20T10:56:00 | 344,535,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package com.sist.dao;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import com.sist.main.DBUtil;
public class CourseDAO {
private Connection conn;
private Statement stat; // 매개변수x
private PreparedStatement pstat; //매개변수o
private ResultSet rs;
private CallableStatement cstat;
public CourseDAO() {
try {
this.conn = DBUtil.open();
this.stat = conn.createStatement();
} catch (Exception e) {
System.out.println(e);
}
}
}
| [
"[email protected]"
] | |
1a3b986f539c67d17d34a1c0f3e8a9fd374fa9da | 9d864f5a053b29d931b4c2b4f773e13291189d27 | /src/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceSampleChainImpl.java | d10812f68cb9414d58f6d556e1025d879a6931e9 | [] | no_license | kyeddlapalli/sakai-cle | b1bd1e4431d8d96b6b650bfe9454eacd3e7042b2 | 1f06c7ac69c7cbe731c8d175d557313d0fb34900 | refs/heads/master | 2021-01-18T10:57:25.449065 | 2014-01-12T21:18:15 | 2014-01-12T21:18:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,560 | java | /**********************************************************************************
* $URL: https://source.sakaiproject.org/svn/edu-services/trunk/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementServiceSampleChainImpl.java $
* $Id: CourseManagementServiceSampleChainImpl.java 105077 2012-02-24 22:54:29Z [email protected] $
***********************************************************************************
*
* Copyright (c) 2006, 2007, 2008 The Sakai Foundation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************************/
package org.sakaiproject.coursemanagement.impl;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.sakaiproject.coursemanagement.api.AcademicSession;
import org.sakaiproject.coursemanagement.api.CanonicalCourse;
import org.sakaiproject.coursemanagement.api.CourseManagementService;
import org.sakaiproject.coursemanagement.api.CourseOffering;
import org.sakaiproject.coursemanagement.api.CourseSet;
import org.sakaiproject.coursemanagement.api.Enrollment;
import org.sakaiproject.coursemanagement.api.EnrollmentSet;
import org.sakaiproject.coursemanagement.api.Section;
import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException;
/**
* A template to use when implementing CourseManagementService to provide
* course and enrollment data in a federated CM configuration. Extending this class
* should be useful for institutions intending to federate external datasources
* (via webservices, SIS APIs, etc) with Sakai's hibernate-based
* CourseManagementService.
*
* @author <a href="mailto:[email protected]">Josh Holtzman</a>
*
*/
public class CourseManagementServiceSampleChainImpl implements CourseManagementService {
public Set findCourseOfferings(String courseSetEid, String academicSessionEid) throws IdNotFoundException {
throw new IdNotFoundException(courseSetEid, CourseSet.class.getName());
}
public List findCourseSets(String category) {
return null;
}
public Set findCurrentlyEnrolledEnrollmentSets(String userId) {
return null;
}
public Set findCurrentlyInstructingEnrollmentSets(String userId) {
return null;
}
public Enrollment findEnrollment(String userId, String eid) {
return null;
}
public Set findInstructingSections(String userId) {
return null;
}
public Set findInstructingSections(String userId, String academicSessionEid) throws IdNotFoundException {
throw new IdNotFoundException(academicSessionEid, AcademicSession.class.getName());
}
public AcademicSession getAcademicSession(String academicSessionEid) throws IdNotFoundException {
throw new IdNotFoundException(academicSessionEid, AcademicSession.class.getName());
}
public List getAcademicSessions() {
return null;
}
public CanonicalCourse getCanonicalCourse(String canonicalCourseEid) throws IdNotFoundException {
throw new IdNotFoundException(canonicalCourseEid, CanonicalCourse.class.getName());
}
public Set getCanonicalCourses(String courseSetEid) throws IdNotFoundException {
throw new IdNotFoundException(courseSetEid, CourseSet.class.getName());
}
public Set getChildCourseSets(String parentCourseSetEid) throws IdNotFoundException {
throw new IdNotFoundException(parentCourseSetEid, CourseSet.class.getName());
}
public Set getChildSections(String parentSectionEid) throws IdNotFoundException {
throw new IdNotFoundException(parentSectionEid, Section.class.getName());
}
public CourseOffering getCourseOffering(String courseOfferingEid) throws IdNotFoundException {
throw new IdNotFoundException(courseOfferingEid, CourseOffering.class.getName());
}
public Set getCourseOfferingMemberships(String courseOfferingEid) throws IdNotFoundException {
throw new IdNotFoundException(courseOfferingEid, CourseOffering.class.getName());
}
public Set getCourseOfferingsInCourseSet(String courseSetEid) throws IdNotFoundException {
throw new IdNotFoundException(courseSetEid, CourseSet.class.getName());
}
public CourseSet getCourseSet(String courseSetEid) throws IdNotFoundException {
throw new IdNotFoundException(courseSetEid, CourseSet.class.getName());
}
public Set getCourseSetMemberships(String courseSetEid) throws IdNotFoundException {
throw new IdNotFoundException(courseSetEid, CourseSet.class.getName());
}
public Set getCourseSets() {
return null;
}
public List getCurrentAcademicSessions() {
return null;
}
public EnrollmentSet getEnrollmentSet(String enrollmentSetEid) throws IdNotFoundException {
throw new IdNotFoundException(enrollmentSetEid, EnrollmentSet.class.getName());
}
public Set getEnrollmentSets(String courseOfferingEid) throws IdNotFoundException {
throw new IdNotFoundException(courseOfferingEid, CourseOffering.class.getName());
}
public Set getEnrollments(String enrollmentSetEid) throws IdNotFoundException {
throw new IdNotFoundException(enrollmentSetEid, EnrollmentSet.class.getName());
}
public Set getEquivalentCanonicalCourses(String canonicalCourseEid) throws IdNotFoundException {
throw new IdNotFoundException(canonicalCourseEid, CanonicalCourse.class.getName());
}
public Set getEquivalentCourseOfferings(String courseOfferingEid) throws IdNotFoundException {
throw new IdNotFoundException(courseOfferingEid, CourseOffering.class.getName());
}
public Set getInstructorsOfRecordIds(String enrollmentSetEid) throws IdNotFoundException {
throw new IdNotFoundException(enrollmentSetEid, EnrollmentSet.class.getName());
}
public Section getSection(String sectionEid) throws IdNotFoundException {
throw new IdNotFoundException(sectionEid, Section.class.getName());
}
public Set getSectionMemberships(String sectionEid) throws IdNotFoundException {
throw new IdNotFoundException(sectionEid, Section.class.getName());
}
public Set getSections(String courseOfferingEid) throws IdNotFoundException {
throw new IdNotFoundException(courseOfferingEid, CourseOffering.class.getName());
}
public boolean isEmpty(String courseSetEid) {
throw new UnsupportedOperationException();
}
public boolean isEnrolled(String userId, Set enrollmentSetEids) {
throw new UnsupportedOperationException();
}
public boolean isEnrolled(String userId, String eid) {
throw new UnsupportedOperationException();
}
public Set findEnrolledSections(String userId) {
return null;
}
public Map findCourseOfferingRoles(String userEid) {
return null;
}
public Map findCourseSetRoles(String userEid) {
return null;
}
public Map findSectionRoles(String userEid) {
return null;
}
public Set getCourseOfferingsInCanonicalCourse(String canonicalCourseEid) throws IdNotFoundException {
throw new IdNotFoundException(canonicalCourseEid, CanonicalCourse.class.getName());
}
public boolean isAcademicSessionDefined(String eid) {
throw new UnsupportedOperationException();
}
public boolean isCanonicalCourseDefined(String eid) {
throw new UnsupportedOperationException();
}
public boolean isCourseOfferingDefined(String eid) {
throw new UnsupportedOperationException();
}
public boolean isCourseSetDefined(String eid) {
throw new UnsupportedOperationException();
}
public boolean isEnrollmentSetDefined(String eid) {
throw new UnsupportedOperationException();
}
public boolean isSectionDefined(String eid) {
throw new UnsupportedOperationException();
}
public List<String> getSectionCategories() {
return null;
}
public String getSectionCategoryDescription(String categoryCode) {
return null;
}
public Map<String, String> getEnrollmentStatusDescriptions(Locale locale) {
return null;
}
public Map<String, String> getGradingSchemeDescriptions(Locale locale) {
return null;
}
public Map<String, String> getMembershipStatusDescriptions(Locale locale) {
return null;
}
public List<CourseOffering> findActiveCourseOfferingsInCanonicalCourse(
String eid) {
return null;
}
}
| [
"[email protected]"
] | |
303eae66989a64d0b804283e52d689964ec1d20a | e5204e3696f2f90553a563e50a40dcff659f2090 | /638. Shopping Offers.java | a2c98c700abb0073268a80b0e275a1a447337f3b | [] | no_license | HaoSungogogo/Leetcode | d563f74c656d07aa90ccbf6198af8933124bd6c5 | 855760793e9dc814e8c65d0b7a37148af1a6a9c5 | refs/heads/master | 2021-01-02T08:35:00.253823 | 2019-01-05T21:49:04 | 2019-01-05T21:49:04 | 98,950,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,971 | java | N-nary tree dfs, each branch is each sales
Similar to 99 cents.
class Solution {
public int shoppingOffers(List<Integer> price, List<List<Integer>> special, List<Integer> needs) {
if (price == null || price.size() == 0 || special == null || special.size() == 0 ||
needs == null || needs.size() == 0) {
return 0;
}
int[] min = new int[]{Integer.MAX_VALUE};
dfs (min, price, special, needs, 0);
return min[0];
}
private void dfs (int[] min, List<Integer> price, List<List<Integer>> special, List<Integer> needs, int cost) {
boolean flag = true;
for (List<Integer> iter : special) {
if (check(iter, needs)) {
flag = false;
int nonsale = 0;
for (int i = 0; i < needs.size(); i++) {
int num = iter.get(i);
nonsale += num * price.get(i);
needs.set(i, needs.get(i) - num);
}
if (nonsale < iter.get(iter.size() - 1)) {
dfs(min, price, special, needs, cost + nonsale);
} else {
dfs(min, price, special, needs, cost + iter.get(iter.size() - 1));
}
for (int i = 0; i < needs.size(); i++) {
needs.set(i, needs.get(i) + iter.get(i));
}
}
}
if (flag) {
for (int i = 0; i < needs.size(); i++) {
Integer num = needs.get(i);
if (num > 0) {
cost += num * price.get(i);
}
}
min[0] = Math.min(min[0], cost);
return;
}
}
private boolean check(List<Integer> iter, List<Integer> needs) {
for (int i = 0; i < needs.size(); i++) {
if (needs.get(i) < iter.get(i)) {
return false;
}
}
return true;
}
}
| [
"[email protected]"
] | |
698d054ca62859a2931c671210d95fef89108f30 | 4d37505edab103fd2271623b85041033d225ebcc | /spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java | 5888b6cac97e2a9bd316007b4dc186cf47e45450 | [
"Apache-2.0"
] | permissive | huifer/spring-framework-read | 1799f1f073b65fed78f06993e58879571cc4548f | 73528bd85adc306a620eedd82c218094daebe0ee | refs/heads/master | 2020-12-08T08:03:17.458500 | 2020-03-02T05:51:55 | 2020-03-02T05:51:55 | 232,931,630 | 6 | 2 | Apache-2.0 | 2020-03-02T05:51:57 | 2020-01-10T00:18:15 | Java | UTF-8 | Java | false | false | 38,901 | java | /*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.function.server;
import java.net.InetSocketAddress;
import java.net.URI;
import java.security.Principal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpCookie;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.codec.HttpMessageReader;
import org.springframework.http.codec.multipart.Part;
import org.springframework.http.server.PathContainer;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;
import org.springframework.web.reactive.function.BodyExtractor;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebSession;
import org.springframework.web.util.UriBuilder;
import org.springframework.web.util.UriUtils;
import org.springframework.web.util.pattern.PathPattern;
import org.springframework.web.util.pattern.PathPatternParser;
/**
* Implementations of {@link RequestPredicate} that implement various useful
* request matching operations, such as matching based on path, HTTP method, etc.
*
* @author Arjen Poutsma
* @since 5.0
*/
public abstract class RequestPredicates {
private static final Log logger = LogFactory.getLog(RequestPredicates.class);
private static final PathPatternParser DEFAULT_PATTERN_PARSER = new PathPatternParser();
/**
* Return a {@code RequestPredicate} that always matches.
*
* @return a predicate that always matches
*/
public static RequestPredicate all() {
return request -> true;
}
/**
* Return a {@code RequestPredicate} that matches if the request's
* HTTP method is equal to the given method.
*
* @param httpMethod the HTTP method to match against
* @return a predicate that tests against the given HTTP method
*/
public static RequestPredicate method(HttpMethod httpMethod) {
return new HttpMethodPredicate(httpMethod);
}
/**
* Return a {@code RequestPredicate} that matches if the request's
* HTTP method is equal to one the of the given methods.
*
* @param httpMethods the HTTP methods to match against
* @return a predicate that tests against the given HTTP methods
* @since 5.1
*/
public static RequestPredicate methods(HttpMethod... httpMethods) {
return new HttpMethodPredicate(httpMethods);
}
/**
* Return a {@code RequestPredicate} that tests the request path
* against the given path pattern.
*
* @param pattern the pattern to match to
* @return a predicate that tests against the given path pattern
*/
public static RequestPredicate path(String pattern) {
Assert.notNull(pattern, "'pattern' must not be null");
return pathPredicates(DEFAULT_PATTERN_PARSER).apply(pattern);
}
/**
* Return a function that creates new path-matching {@code RequestPredicates}
* from pattern Strings using the given {@link PathPatternParser}.
* <p>This method can be used to specify a non-default, customized
* {@code PathPatternParser} when resolving path patterns.
*
* @param patternParser the parser used to parse patterns given to the returned function
* @return a function that resolves a pattern String into a path-matching
* {@code RequestPredicates} instance
*/
public static Function<String, RequestPredicate> pathPredicates(PathPatternParser patternParser) {
Assert.notNull(patternParser, "PathPatternParser must not be null");
return pattern -> new PathPatternPredicate(patternParser.parse(pattern));
}
/**
* Return a {@code RequestPredicate} that tests the request's headers
* against the given headers predicate.
*
* @param headersPredicate a predicate that tests against the request headers
* @return a predicate that tests against the given header predicate
*/
public static RequestPredicate headers(Predicate<ServerRequest.Headers> headersPredicate) {
return new HeadersPredicate(headersPredicate);
}
/**
* Return a {@code RequestPredicate} that tests if the request's
* {@linkplain ServerRequest.Headers#contentType() content type} is
* {@linkplain MediaType#includes(MediaType) included} by any of the given media types.
*
* @param mediaTypes the media types to match the request's content type against
* @return a predicate that tests the request's content type against the given media types
*/
public static RequestPredicate contentType(MediaType... mediaTypes) {
Assert.notEmpty(mediaTypes, "'mediaTypes' must not be empty");
return new ContentTypePredicate(mediaTypes);
}
/**
* Return a {@code RequestPredicate} that tests if the request's
* {@linkplain ServerRequest.Headers#accept() accept} header is
* {@linkplain MediaType#isCompatibleWith(MediaType) compatible} with any of the given media types.
*
* @param mediaTypes the media types to match the request's accept header against
* @return a predicate that tests the request's accept header against the given media types
*/
public static RequestPredicate accept(MediaType... mediaTypes) {
Assert.notEmpty(mediaTypes, "'mediaTypes' must not be empty");
return new AcceptPredicate(mediaTypes);
}
/**
* Return a {@code RequestPredicate} that matches if request's HTTP method is {@code GET}
* and the given {@code pattern} matches against the request path.
*
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is GET and if the given pattern
* matches against the request path
*/
public static RequestPredicate GET(String pattern) {
return method(HttpMethod.GET).and(path(pattern));
}
/**
* Return a {@code RequestPredicate} that matches if request's HTTP method is {@code HEAD}
* and the given {@code pattern} matches against the request path.
*
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is HEAD and if the given pattern
* matches against the request path
*/
public static RequestPredicate HEAD(String pattern) {
return method(HttpMethod.HEAD).and(path(pattern));
}
/**
* Return a {@code RequestPredicate} that matches if request's HTTP method is {@code POST}
* and the given {@code pattern} matches against the request path.
*
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is POST and if the given pattern
* matches against the request path
*/
public static RequestPredicate POST(String pattern) {
return method(HttpMethod.POST).and(path(pattern));
}
/**
* Return a {@code RequestPredicate} that matches if request's HTTP method is {@code PUT}
* and the given {@code pattern} matches against the request path.
*
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is PUT and if the given pattern
* matches against the request path
*/
public static RequestPredicate PUT(String pattern) {
return method(HttpMethod.PUT).and(path(pattern));
}
/**
* Return a {@code RequestPredicate} that matches if request's HTTP method is {@code PATCH}
* and the given {@code pattern} matches against the request path.
*
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is PATCH and if the given pattern
* matches against the request path
*/
public static RequestPredicate PATCH(String pattern) {
return method(HttpMethod.PATCH).and(path(pattern));
}
/**
* Return a {@code RequestPredicate} that matches if request's HTTP method is {@code DELETE}
* and the given {@code pattern} matches against the request path.
*
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is DELETE and if the given pattern
* matches against the request path
*/
public static RequestPredicate DELETE(String pattern) {
return method(HttpMethod.DELETE).and(path(pattern));
}
/**
* Return a {@code RequestPredicate} that matches if request's HTTP method is {@code OPTIONS}
* and the given {@code pattern} matches against the request path.
*
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is OPTIONS and if the given pattern
* matches against the request path
*/
public static RequestPredicate OPTIONS(String pattern) {
return method(HttpMethod.OPTIONS).and(path(pattern));
}
/**
* Return a {@code RequestPredicate} that matches if the request's path has the given extension.
*
* @param extension the path extension to match against, ignoring case
* @return a predicate that matches if the request's path has the given file extension
*/
public static RequestPredicate pathExtension(String extension) {
Assert.notNull(extension, "'extension' must not be null");
return new PathExtensionPredicate(extension);
}
/**
* Return a {@code RequestPredicate} that matches if the request's path matches the given
* predicate.
*
* @param extensionPredicate the predicate to test against the request path extension
* @return a predicate that matches if the given predicate matches against the request's path
* file extension
*/
public static RequestPredicate pathExtension(Predicate<String> extensionPredicate) {
return new PathExtensionPredicate(extensionPredicate);
}
/**
* Return a {@code RequestPredicate} that matches if the request's query parameter of the given name
* has the given value.
*
* @param name the name of the query parameter to test against
* @param value the value of the query parameter to test against
* @return a predicate that matches if the query parameter has the given value
* @see ServerRequest#queryParam(String)
* @since 5.0.7
*/
public static RequestPredicate queryParam(String name, String value) {
return new QueryParamPredicate(name, value);
}
/**
* Return a {@code RequestPredicate} that tests the request's query parameter of the given name
* against the given predicate.
*
* @param name the name of the query parameter to test against
* @param predicate predicate to test against the query parameter value
* @return a predicate that matches the given predicate against the query parameter of the given name
* @see ServerRequest#queryParam(String)
*/
public static RequestPredicate queryParam(String name, Predicate<String> predicate) {
return new QueryParamPredicate(name, predicate);
}
private static void traceMatch(String prefix, Object desired, @Nullable Object actual, boolean match) {
if (logger.isTraceEnabled()) {
logger.trace(String.format("%s \"%s\" %s against value \"%s\"",
prefix, desired, match ? "matches" : "does not match", actual));
}
}
private static void restoreAttributes(ServerRequest request, Map<String, Object> attributes) {
request.attributes().clear();
request.attributes().putAll(attributes);
}
private static Map<String, String> mergePathVariables(Map<String, String> oldVariables,
Map<String, String> newVariables) {
if (!newVariables.isEmpty()) {
Map<String, String> mergedVariables = new LinkedHashMap<>(oldVariables);
mergedVariables.putAll(newVariables);
return mergedVariables;
}
else {
return oldVariables;
}
}
private static PathPattern mergePatterns(@Nullable PathPattern oldPattern, PathPattern newPattern) {
if (oldPattern != null) {
return oldPattern.combine(newPattern);
}
else {
return newPattern;
}
}
/**
* Receives notifications from the logical structure of request predicates.
*/
public interface Visitor {
/**
* Receive notification of an HTTP method predicate.
*
* @param methods the HTTP methods that make up the predicate
* @see RequestPredicates#method(HttpMethod)
*/
void method(Set<HttpMethod> methods);
/**
* Receive notification of an path predicate.
*
* @param pattern the path pattern that makes up the predicate
* @see RequestPredicates#path(String)
*/
void path(String pattern);
/**
* Receive notification of an path extension predicate.
*
* @param extension the path extension that makes up the predicate
* @see RequestPredicates#pathExtension(String)
*/
void pathExtension(String extension);
/**
* Receive notification of a HTTP header predicate.
*
* @param name the name of the HTTP header to check
* @param value the desired value of the HTTP header
* @see RequestPredicates#headers(Predicate)
* @see RequestPredicates#contentType(MediaType...)
* @see RequestPredicates#accept(MediaType...)
*/
void header(String name, String value);
/**
* Receive notification of a query parameter predicate.
*
* @param name the name of the query parameter
* @param value the desired value of the parameter
* @see RequestPredicates#queryParam(String, String)
*/
void queryParam(String name, String value);
/**
* Receive first notification of a logical AND predicate.
* The first subsequent notification will contain the left-hand side of the AND-predicate;
* followed by {@link #and()}, followed by the right-hand side, followed by {@link #endAnd()}.
*
* @see RequestPredicate#and(RequestPredicate)
*/
void startAnd();
/**
* Receive "middle" notification of a logical AND predicate.
* The following notification contains the right-hand side, followed by {@link #endAnd()}.
*
* @see RequestPredicate#and(RequestPredicate)
*/
void and();
/**
* Receive last notification of a logical AND predicate.
*
* @see RequestPredicate#and(RequestPredicate)
*/
void endAnd();
/**
* Receive first notification of a logical OR predicate.
* The first subsequent notification will contain the left-hand side of the OR-predicate;
* the second notification contains the right-hand side, followed by {@link #endOr()}.
*
* @see RequestPredicate#or(RequestPredicate)
*/
void startOr();
/**
* Receive "middle" notification of a logical OR predicate.
* The following notification contains the right-hand side, followed by {@link #endOr()}.
*
* @see RequestPredicate#or(RequestPredicate)
*/
void or();
/**
* Receive last notification of a logical OR predicate.
*
* @see RequestPredicate#or(RequestPredicate)
*/
void endOr();
/**
* Receive first notification of a negated predicate.
* The first subsequent notification will contain the negated predicated, followed
* by {@link #endNegate()}.
*
* @see RequestPredicate#negate()
*/
void startNegate();
/**
* Receive last notification of a negated predicate.
*
* @see RequestPredicate#negate()
*/
void endNegate();
/**
* Receive first notification of an unknown predicate.
*/
void unknown(RequestPredicate predicate);
}
private static class HttpMethodPredicate implements RequestPredicate {
private final Set<HttpMethod> httpMethods;
public HttpMethodPredicate(HttpMethod httpMethod) {
Assert.notNull(httpMethod, "HttpMethod must not be null");
this.httpMethods = EnumSet.of(httpMethod);
}
public HttpMethodPredicate(HttpMethod... httpMethods) {
Assert.notEmpty(httpMethods, "HttpMethods must not be empty");
this.httpMethods = EnumSet.copyOf(Arrays.asList(httpMethods));
}
@Override
public boolean test(ServerRequest request) {
boolean match = this.httpMethods.contains(request.method());
traceMatch("Method", this.httpMethods, request.method(), match);
return match;
}
@Override
public void accept(Visitor visitor) {
visitor.method(Collections.unmodifiableSet(this.httpMethods));
}
@Override
public String toString() {
if (this.httpMethods.size() == 1) {
return this.httpMethods.iterator().next().toString();
}
else {
return this.httpMethods.toString();
}
}
}
private static class PathPatternPredicate implements RequestPredicate {
private final PathPattern pattern;
public PathPatternPredicate(PathPattern pattern) {
Assert.notNull(pattern, "'pattern' must not be null");
this.pattern = pattern;
}
private static void mergeAttributes(ServerRequest request, Map<String, String> variables,
PathPattern pattern) {
Map<String, String> pathVariables = mergePathVariables(request.pathVariables(), variables);
request.attributes().put(RouterFunctions.URI_TEMPLATE_VARIABLES_ATTRIBUTE,
Collections.unmodifiableMap(pathVariables));
pattern = mergePatterns(
(PathPattern) request.attributes().get(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE),
pattern);
request.attributes().put(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE, pattern);
}
@Override
public boolean test(ServerRequest request) {
PathContainer pathContainer = request.pathContainer();
PathPattern.PathMatchInfo info = this.pattern.matchAndExtract(pathContainer);
traceMatch("Pattern", this.pattern.getPatternString(), request.path(), info != null);
if (info != null) {
mergeAttributes(request, info.getUriVariables(), this.pattern);
return true;
}
else {
return false;
}
}
@Override
public Optional<ServerRequest> nest(ServerRequest request) {
return Optional.ofNullable(this.pattern.matchStartOfPath(request.pathContainer()))
.map(info -> new SubPathServerRequestWrapper(request, info, this.pattern));
}
@Override
public void accept(Visitor visitor) {
visitor.path(this.pattern.getPatternString());
}
@Override
public String toString() {
return this.pattern.getPatternString();
}
}
private static class HeadersPredicate implements RequestPredicate {
private final Predicate<ServerRequest.Headers> headersPredicate;
public HeadersPredicate(Predicate<ServerRequest.Headers> headersPredicate) {
Assert.notNull(headersPredicate, "Predicate must not be null");
this.headersPredicate = headersPredicate;
}
@Override
public boolean test(ServerRequest request) {
return this.headersPredicate.test(request.headers());
}
@Override
public String toString() {
return this.headersPredicate.toString();
}
}
private static class ContentTypePredicate extends HeadersPredicate {
private final Set<MediaType> mediaTypes;
public ContentTypePredicate(MediaType... mediaTypes) {
this(new HashSet<>(Arrays.asList(mediaTypes)));
}
private ContentTypePredicate(Set<MediaType> mediaTypes) {
super(headers -> {
MediaType contentType =
headers.contentType().orElse(MediaType.APPLICATION_OCTET_STREAM);
boolean match = mediaTypes.stream()
.anyMatch(mediaType -> mediaType.includes(contentType));
traceMatch("Content-Type", mediaTypes, contentType, match);
return match;
});
this.mediaTypes = mediaTypes;
}
@Override
public void accept(Visitor visitor) {
visitor.header(HttpHeaders.CONTENT_TYPE,
(this.mediaTypes.size() == 1) ?
this.mediaTypes.iterator().next().toString() :
this.mediaTypes.toString());
}
@Override
public String toString() {
return String.format("Content-Type: %s",
(this.mediaTypes.size() == 1) ?
this.mediaTypes.iterator().next().toString() :
this.mediaTypes.toString());
}
}
private static class AcceptPredicate extends HeadersPredicate {
private final Set<MediaType> mediaTypes;
public AcceptPredicate(MediaType... mediaTypes) {
this(new HashSet<>(Arrays.asList(mediaTypes)));
}
private AcceptPredicate(Set<MediaType> mediaTypes) {
super(headers -> {
List<MediaType> acceptedMediaTypes = acceptedMediaTypes(headers);
boolean match = acceptedMediaTypes.stream()
.anyMatch(acceptedMediaType -> mediaTypes.stream()
.anyMatch(acceptedMediaType::isCompatibleWith));
traceMatch("Accept", mediaTypes, acceptedMediaTypes, match);
return match;
});
this.mediaTypes = mediaTypes;
}
@NonNull
private static List<MediaType> acceptedMediaTypes(ServerRequest.Headers headers) {
List<MediaType> acceptedMediaTypes = headers.accept();
if (acceptedMediaTypes.isEmpty()) {
acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
}
else {
MediaType.sortBySpecificityAndQuality(acceptedMediaTypes);
}
return acceptedMediaTypes;
}
@Override
public void accept(Visitor visitor) {
visitor.header(HttpHeaders.ACCEPT,
(this.mediaTypes.size() == 1) ?
this.mediaTypes.iterator().next().toString() :
this.mediaTypes.toString());
}
@Override
public String toString() {
return String.format("Accept: %s",
(this.mediaTypes.size() == 1) ?
this.mediaTypes.iterator().next().toString() :
this.mediaTypes.toString());
}
}
private static class PathExtensionPredicate implements RequestPredicate {
private final Predicate<String> extensionPredicate;
@Nullable
private final String extension;
public PathExtensionPredicate(Predicate<String> extensionPredicate) {
Assert.notNull(extensionPredicate, "Predicate must not be null");
this.extensionPredicate = extensionPredicate;
this.extension = null;
}
public PathExtensionPredicate(String extension) {
Assert.notNull(extension, "Extension must not be null");
this.extensionPredicate = s -> {
boolean match = extension.equalsIgnoreCase(s);
traceMatch("Extension", extension, s, match);
return match;
};
this.extension = extension;
}
@Override
public boolean test(ServerRequest request) {
String pathExtension = UriUtils.extractFileExtension(request.path());
return this.extensionPredicate.test(pathExtension);
}
@Override
public void accept(Visitor visitor) {
visitor.pathExtension(
(this.extension != null) ?
this.extension :
this.extensionPredicate.toString());
}
@Override
public String toString() {
return String.format("*.%s",
(this.extension != null) ?
this.extension :
this.extensionPredicate);
}
}
private static class QueryParamPredicate implements RequestPredicate {
private final String name;
private final Predicate<String> valuePredicate;
@Nullable
private final String value;
public QueryParamPredicate(String name, Predicate<String> valuePredicate) {
Assert.notNull(name, "Name must not be null");
Assert.notNull(valuePredicate, "Predicate must not be null");
this.name = name;
this.valuePredicate = valuePredicate;
this.value = null;
}
public QueryParamPredicate(String name, String value) {
Assert.notNull(name, "Name must not be null");
Assert.notNull(value, "Value must not be null");
this.name = name;
this.valuePredicate = value::equals;
this.value = value;
}
@Override
public boolean test(ServerRequest request) {
Optional<String> s = request.queryParam(this.name);
return s.filter(this.valuePredicate).isPresent();
}
@Override
public void accept(Visitor visitor) {
visitor.queryParam(this.name,
(this.value != null) ?
this.value :
this.valuePredicate.toString());
}
@Override
public String toString() {
return String.format("?%s %s", this.name,
(this.value != null) ?
this.value :
this.valuePredicate);
}
}
/**
* {@link RequestPredicate} for where both {@code left} and {@code right} predicates
* must match.
*/
static class AndRequestPredicate implements RequestPredicate {
private final RequestPredicate left;
private final RequestPredicate right;
public AndRequestPredicate(RequestPredicate left, RequestPredicate right) {
Assert.notNull(left, "Left RequestPredicate must not be null");
Assert.notNull(right, "Right RequestPredicate must not be null");
this.left = left;
this.right = right;
}
@Override
public boolean test(ServerRequest request) {
Map<String, Object> oldAttributes = new HashMap<>(request.attributes());
if (this.left.test(request) && this.right.test(request)) {
return true;
}
restoreAttributes(request, oldAttributes);
return false;
}
@Override
public Optional<ServerRequest> nest(ServerRequest request) {
return this.left.nest(request).flatMap(this.right::nest);
}
@Override
public void accept(Visitor visitor) {
visitor.startAnd();
this.left.accept(visitor);
visitor.and();
this.right.accept(visitor);
visitor.endAnd();
}
@Override
public String toString() {
return String.format("(%s && %s)", this.left, this.right);
}
}
/**
* {@link RequestPredicate} that negates a delegate predicate.
*/
static class NegateRequestPredicate implements RequestPredicate {
private final RequestPredicate delegate;
public NegateRequestPredicate(RequestPredicate delegate) {
Assert.notNull(delegate, "Delegate must not be null");
this.delegate = delegate;
}
@Override
public boolean test(ServerRequest request) {
Map<String, Object> oldAttributes = new HashMap<>(request.attributes());
boolean result = !this.delegate.test(request);
if (!result) {
restoreAttributes(request, oldAttributes);
}
return result;
}
@Override
public void accept(Visitor visitor) {
visitor.startNegate();
this.delegate.accept(visitor);
visitor.endNegate();
}
@Override
public String toString() {
return "!" + this.delegate.toString();
}
}
/**
* {@link RequestPredicate} where either {@code left} or {@code right} predicates
* may match.
*/
static class OrRequestPredicate implements RequestPredicate {
private final RequestPredicate left;
private final RequestPredicate right;
public OrRequestPredicate(RequestPredicate left, RequestPredicate right) {
Assert.notNull(left, "Left RequestPredicate must not be null");
Assert.notNull(right, "Right RequestPredicate must not be null");
this.left = left;
this.right = right;
}
@Override
public boolean test(ServerRequest request) {
Map<String, Object> oldAttributes = new HashMap<>(request.attributes());
if (this.left.test(request)) {
return true;
}
else {
restoreAttributes(request, oldAttributes);
if (this.right.test(request)) {
return true;
}
}
restoreAttributes(request, oldAttributes);
return false;
}
@Override
public Optional<ServerRequest> nest(ServerRequest request) {
Optional<ServerRequest> leftResult = this.left.nest(request);
if (leftResult.isPresent()) {
return leftResult;
}
else {
return this.right.nest(request);
}
}
@Override
public void accept(Visitor visitor) {
visitor.startOr();
this.left.accept(visitor);
visitor.or();
this.right.accept(visitor);
visitor.endOr();
}
@Override
public String toString() {
return String.format("(%s || %s)", this.left, this.right);
}
}
private static class SubPathServerRequestWrapper implements ServerRequest {
private final ServerRequest request;
private final PathContainer pathContainer;
private final Map<String, Object> attributes;
public SubPathServerRequestWrapper(ServerRequest request,
PathPattern.PathRemainingMatchInfo info, PathPattern pattern) {
this.request = request;
this.pathContainer = new SubPathContainer(info.getPathRemaining());
this.attributes = mergeAttributes(request, info.getUriVariables(), pattern);
}
private static Map<String, Object> mergeAttributes(ServerRequest request,
Map<String, String> pathVariables, PathPattern pattern) {
Map<String, Object> result = new ConcurrentHashMap<>(request.attributes());
result.put(RouterFunctions.URI_TEMPLATE_VARIABLES_ATTRIBUTE,
mergePathVariables(request.pathVariables(), pathVariables));
pattern = mergePatterns(
(PathPattern) request.attributes().get(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE),
pattern);
result.put(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE, pattern);
return result;
}
@Override
public HttpMethod method() {
return this.request.method();
}
@Override
public String methodName() {
return this.request.methodName();
}
@Override
public URI uri() {
return this.request.uri();
}
@Override
public UriBuilder uriBuilder() {
return this.request.uriBuilder();
}
@Override
public String path() {
return this.pathContainer.value();
}
@Override
public PathContainer pathContainer() {
return this.pathContainer;
}
@Override
public Headers headers() {
return this.request.headers();
}
@Override
public MultiValueMap<String, HttpCookie> cookies() {
return this.request.cookies();
}
@Override
public Optional<InetSocketAddress> remoteAddress() {
return this.request.remoteAddress();
}
@Override
public List<HttpMessageReader<?>> messageReaders() {
return this.request.messageReaders();
}
@Override
public <T> T body(BodyExtractor<T, ? super ServerHttpRequest> extractor) {
return this.request.body(extractor);
}
@Override
public <T> T body(BodyExtractor<T, ? super ServerHttpRequest> extractor, Map<String, Object> hints) {
return this.request.body(extractor, hints);
}
@Override
public <T> Mono<T> bodyToMono(Class<? extends T> elementClass) {
return this.request.bodyToMono(elementClass);
}
@Override
public <T> Mono<T> bodyToMono(ParameterizedTypeReference<T> typeReference) {
return this.request.bodyToMono(typeReference);
}
@Override
public <T> Flux<T> bodyToFlux(Class<? extends T> elementClass) {
return this.request.bodyToFlux(elementClass);
}
@Override
public <T> Flux<T> bodyToFlux(ParameterizedTypeReference<T> typeReference) {
return this.request.bodyToFlux(typeReference);
}
@Override
public Map<String, Object> attributes() {
return this.attributes;
}
@Override
public Optional<String> queryParam(String name) {
return this.request.queryParam(name);
}
@Override
public MultiValueMap<String, String> queryParams() {
return this.request.queryParams();
}
@Override
@SuppressWarnings("unchecked")
public Map<String, String> pathVariables() {
return (Map<String, String>) this.attributes.getOrDefault(
RouterFunctions.URI_TEMPLATE_VARIABLES_ATTRIBUTE, Collections.emptyMap());
}
@Override
public Mono<WebSession> session() {
return this.request.session();
}
@Override
public Mono<? extends Principal> principal() {
return this.request.principal();
}
@Override
public Mono<MultiValueMap<String, String>> formData() {
return this.request.formData();
}
@Override
public Mono<MultiValueMap<String, Part>> multipartData() {
return this.request.multipartData();
}
@Override
public ServerWebExchange exchange() {
return this.request.exchange();
}
@Override
public String toString() {
return method() + " " + path();
}
private static class SubPathContainer implements PathContainer {
private static final PathContainer.Separator SEPARATOR = () -> "/";
private final String value;
private final List<Element> elements;
public SubPathContainer(PathContainer original) {
this.value = prefixWithSlash(original.value());
this.elements = prependWithSeparator(original.elements());
}
private static String prefixWithSlash(String path) {
if (!path.startsWith("/")) {
path = "/" + path;
}
return path;
}
private static List<Element> prependWithSeparator(List<Element> elements) {
List<Element> result = new ArrayList<>(elements);
if (result.isEmpty() || !(result.get(0) instanceof Separator)) {
result.add(0, SEPARATOR);
}
return Collections.unmodifiableList(result);
}
@Override
public String value() {
return this.value;
}
@Override
public List<Element> elements() {
return this.elements;
}
}
}
}
| [
"[email protected]"
] | |
9dc18b631b389ef63f790cb19f0c86d93c429962 | 4090ff987ddfb5249290a8415ddee6ef1ffbe57a | /basics/src/lab1numbers/SwapWithTemp.java | 479dbbad8934d9dd279f484d4bef92e30df05f61 | [] | no_license | Mhdsuhail5430/javaIntroProgram | 7d2d1d9ec755cb29e1472f1b99df68622ffdd944 | 904a21b1d721516d4c1be5cc8a038f5808683c5d | refs/heads/master | 2023-08-10T22:09:08.231210 | 2021-09-10T16:18:38 | 2021-09-10T16:18:38 | 374,696,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | package lab1numbers;
public class SwapWithTemp {
public static void main(String[] args) {
int first=120,second=220;
System.out.println("--Before Swaping--");
System.out.println("The first value"+ first);
System.out.println("The second value"+ second);
int temporary = first;
first = second;
second = temporary;
System.out.println("--After Swapping--");
System.out.println("The first value"+ first);
System.out.println("The second value"+ second);
}
}
| [
"[email protected]"
] | |
deb140360731fb74e017a6fcb5a9847dbf21383c | 7c4c2011d97d6f2ad81a2a74fc50e34b409b9779 | /JavaAndroid/IsLeapYear/src/com/juhuyoon/LeapYear.java | 9bb7a2c0d39c73a68a2b39eb65ac158587fd1b76 | [
"MIT"
] | permissive | juhuyoon/codeLibrary | f001982baa94bc12bae8f40d2411ae97c1966337 | 4a964a2d326772659715f9fdd807a91f480642f8 | refs/heads/master | 2023-01-11T07:25:24.651877 | 2020-07-23T03:23:38 | 2020-07-23T03:23:38 | 121,058,856 | 14 | 18 | null | 2023-01-03T15:39:12 | 2018-02-10T22:12:00 | Java | UTF-8 | Java | false | false | 413 | java | package com.juhuyoon;
public class LeapYear {
public static boolean isLeapYear(int year) {
if(year < 1 || year >= 9999) {
return false;
} else if(((year % 4) == 0) && ((year % 100) == 0)
&& ((year % 400)) == 0 ) {
return true;
} else if((year%4) == 0 && ((year %100)) != 0){
return true;
}
return false;
}
}
| [
"[email protected]"
] | |
8c4c0bd9499d5ea5432eebc8777d13399ee8d252 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_d89e7702cfea2e1dd70549647b1c458bc707c9b6/MergeResourceTypesConfigsTask/11_d89e7702cfea2e1dd70549647b1c458bc707c9b6_MergeResourceTypesConfigsTask_t.java | 4718dfad64627385c1f74b4baca596b23e03f8b6 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 10,158 | java | /*
* Merge global resource-types config with realm specific resource-types configs
*/
package org.wyona.yanel.ant;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path;
import java.io.File;
import org.wyona.yanel.core.ResourceTypeDefinition;
import org.wyona.yanel.core.map.Realm;
import org.wyona.yanel.core.map.RealmContextConfig;
import org.wyona.yanel.core.map.RealmManagerConfig;
import org.wyona.commons.xml.XMLHelper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.log4j.Logger;
/**
* Merge resource-types.xml config files of the various realms and core
*/
public class MergeResourceTypesConfigsTask extends Task {
private static Logger log = Logger.getLogger(MergeResourceTypesConfigsTask.class);
private Path realmsConfigFile;
private Path globalResourceTypesConfigFile;
private boolean isBinaryRelease;
private String NAMESPACE = "http://www.wyona.org/yanel/1.0";
/**
*
*/
public void execute() throws BuildException {
log("INFO: Realms config file: " + realmsConfigFile);
File realmsConfig = new File(realmsConfigFile.toString());
log("INFO: Global resource-types config directory: " + globalResourceTypesConfigFile);
File globalResourceTypesConfig = new File(globalResourceTypesConfigFile.toString());
if (isBinaryRelease) {
insertPackageAttribute(globalResourceTypesConfig);
}
RealmManagerConfig realmManagerConfig = new RealmManagerConfig();
try {
RealmContextConfig[] realmContextConfigs;
if (realmsConfig.isFile()) {
realmContextConfigs = realmManagerConfig.getRealmContextConfigs(realmsConfig);
log.info("Merge ...");
log("Number of realms: " + realmContextConfigs.length);
for (int i = 0; i < realmContextConfigs.length; i++) {
log("Realm context config: " + realmContextConfigs[i]);
mergeResourceTypesOfRealm(realmContextConfigs[i].getUnresolvedConfigurationFile(), globalResourceTypesConfig);
}
} else {
log("ERROR: No such realms config '" + realmsConfig.getAbsolutePath() + "' exists!");
}
} catch (Exception e) {
log("ERROR: " + e.getMessage());
throw new BuildException(e.getMessage(), e);
}
}
/**
* Ant file task attribute realmsconfigfile
*/
public void setRealmsConfigFile(Path realmsConfigFile) {
this.realmsConfigFile = realmsConfigFile;
}
/**
* Ant file task attribute globalresourcetypesconfigfile
*/
public void setGlobalResourceTypesConfigFile(Path globalResourceTypesConfigFile) {
this.globalResourceTypesConfigFile = globalResourceTypesConfigFile;
}
/**
* Ant file task attribute isbinaryrelease
*/
public void setIsBinaryRelease(boolean isBinaryRelease) {
this.isBinaryRelease = isBinaryRelease;
}
/**
*
*/
private void mergeResourceTypesOfRealm(File unresolvedRealmConfig, File globalResourceTypesConfig) {
File realmDir;
if (unresolvedRealmConfig.isDirectory()) {
realmDir = unresolvedRealmConfig;
} else if (unresolvedRealmConfig.isFile()) {
realmDir = new File(unresolvedRealmConfig.getParent());
} else {
log.error("Neither file nor directory: " + unresolvedRealmConfig);
return;
}
log("INFO: Realm directory: " + realmDir);
File resourceTypesConfigOfRealm = new File(realmDir, "resource-types.xml");
if (resourceTypesConfigOfRealm.isFile()) {
log("INFO: Realm has specific resource-types configured: " + resourceTypesConfigOfRealm);
try {
Document globalDoc = XMLHelper.readDocument(new java.io.FileInputStream(globalResourceTypesConfig));
Document realmDoc = XMLHelper.readDocument(new java.io.FileInputStream(resourceTypesConfigOfRealm));
Element rootElement = globalDoc.getDocumentElement();
rootElement.appendChild(globalDoc.createComment("Realm specific resource-types (" + resourceTypesConfigOfRealm + "):")); // Only formatting
Element[] resourceTypeElements = XMLHelper.getChildElements(realmDoc.getDocumentElement(), "resource-type", NAMESPACE);
for (int i = 0; i < resourceTypeElements.length; i++) {
String srcAttr = resourceTypeElements[i].getAttribute("src");
if (srcAttr != null) {
srcAttr = srcAttr.replace("@REALM_SRC_DIR@", resourceTypesConfigOfRealm.getParent().replace(File.separator, "/")); // NOTE: Enforce forward slashes in the case of Windows!
}
// TODO: Check for duplicated resource-types also based re package attribute!
if (srcAttr == null || srcAttr.equals("") || !resourceTypeExists(srcAttr, rootElement)) {
rootElement.appendChild(globalDoc.createTextNode("\n ")); // Only formatting
Element rtElement = globalDoc.createElementNS(NAMESPACE, "resource-type");
//Element rtElement = globalDoc.createElementNS(namespace, "todo");
if (srcAttr != null && !srcAttr.equals("")) {
rtElement.setAttribute("src", srcAttr);
}
String packageAttr = resourceTypeElements[i].getAttribute("package");
if (packageAttr != null && !packageAttr.equals("")) {
rtElement.setAttribute("package", packageAttr);
}
String compileAttr = resourceTypeElements[i].getAttribute("compile");
if (compileAttr != null && !compileAttr.equals("")) {
rtElement.setAttribute("compile", compileAttr);
}
String copyDirNameAttr = resourceTypeElements[i].getAttribute("copy-dir-name");
if (copyDirNameAttr != null && !copyDirNameAttr.equals("")) {
rtElement.setAttribute("copy-dir-name", copyDirNameAttr);
log("WARN: copy-dir-name attribute is deprecated (Resource '" + srcAttr + "')!");
log.warn("copy-dir-name attribute is deprecated!");
}
if (isBinaryRelease) {
//log("DEBUG: This is a binary release! (Resource: " + srcAttr + ")");
//log.debug("This is a binary release!");
if (copyDirNameAttr.equals("") && packageAttr.equals("")) {
log("INFO: Insert the package name of the resource '" + srcAttr + "' automatically.");
rtElement.setAttribute("package", getJavaPackageOfResourceType(srcAttr));
}
}
rootElement.appendChild(rtElement);
}
}
rootElement.appendChild(globalDoc.createTextNode("\n\n")); // Only formatting
XMLHelper.writeDocument(globalDoc, new java.io.FileOutputStream(globalResourceTypesConfig));
} catch(Exception e) {
log.error(e, e);
}
} else {
log("INFO: Realm has no specific resource-types configured.");
}
}
/**
*
*/
private boolean resourceTypeExists(String src, Element rootElement) throws Exception {
Element[] elements = XMLHelper.getElements(rootElement, "resource-type", "src", src);
if (elements.length > 0) return true;
return false;
}
/**
* @param resourceHomePath Source directory of resource type
*/
private String getJavaPackageOfResourceType(String resourceHomePath) throws Exception {
String classname = new ResourceTypeDefinition(new File(resourceHomePath, "resource.xml")).getResourceTypeClassname();
//return Class.forName(classname).getPackage().getName(); // NOTE: This doesn't work, because java classloader check
return classname.substring(0, classname.lastIndexOf(".")); // NOTE: This doesn't work in the case of ...
}
/**
* Insert package attributes automatically if binary release and no copy-dir-name attribute exists
* @param globalResourceTypesConfig Copied resource types configuration file (see build/classes/resource-types.xml)
*/
private void insertPackageAttribute(File globalResourceTypesConfig) {
log.debug("Patch file: " + globalResourceTypesConfig);
try {
Document doc = XMLHelper.readDocument(new java.io.FileInputStream(globalResourceTypesConfig));
Element[] resourceTypeElements = XMLHelper.getChildElements(doc.getDocumentElement(), "resource-type", NAMESPACE);
for (int i = 0; i < resourceTypeElements.length; i++) {
if (!resourceTypeElements[i].hasAttribute("copy-dir-name")) {
if (!resourceTypeElements[i].hasAttribute("package")) {
String srcAttr = resourceTypeElements[i].getAttribute("src");
log.debug("Set package automatically for resource type: " + srcAttr);
resourceTypeElements[i].setAttribute("package", getJavaPackageOfResourceType(srcAttr));
}
}
}
log.debug("Overwrite file: " + globalResourceTypesConfig);
XMLHelper.writeDocument(doc, new java.io.FileOutputStream(globalResourceTypesConfig));
} catch(Exception e) {
log.error(e, e);
}
}
}
| [
"[email protected]"
] | |
83960a775eb3f52b89f3fe629f75c233906ee2a6 | dd2d41503b2fed0edfd9a435de642d41d766b7b8 | /src/ExpiringMap.java | ec235496beafa03870c4312ae11f68550c6b603a | [] | no_license | hovinhthinh/email-checker-gui | 32a729d4b900efe767a58750249bb44415567b7a | b48c86ea6576d97f69eae1140f645388e6b2a97a | refs/heads/master | 2020-03-26T08:41:27.922200 | 2018-12-09T22:09:52 | 2018-12-09T22:09:52 | 144,715,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,844 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* A map with expiration. This class contains a worker thread that will
* periodically check this class in order to determine if any objects should be
* removed based on the provided time-to-live value.
*
* @author The Apache MINA Project ([email protected])
* @version $Rev: 662890 $, $Date: 2008-06-03 23:14:21 +0200 (Tue, 03 Jun 2008)
* $
*/
public class ExpiringMap<K, V> implements Map<K, V> {
/**
* The default value, 60
*/
public static final int DEFAULT_TIME_TO_LIVE = 60;
/**
* The default value, 1
*/
public static final int DEFAULT_EXPIRATION_INTERVAL = 1;
private static volatile int expirerCount = 1;
private final ConcurrentHashMap<K, ExpiringObject> delegate;
private final CopyOnWriteArrayList<ExpirationListener<V>> expirationListeners;
private final Expirer expirer;
/**
* Creates a new instance of ExpiringMap using the default values
* DEFAULT_TIME_TO_LIVE and DEFAULT_EXPIRATION_INTERVAL
*
*/
public ExpiringMap() {
this(DEFAULT_TIME_TO_LIVE, DEFAULT_EXPIRATION_INTERVAL);
}
/**
* Creates a new instance of ExpiringMap using the supplied time-to-live
* value and the default value for DEFAULT_EXPIRATION_INTERVAL
*
* @param timeToLive The time-to-live value (seconds)
*/
public ExpiringMap(int timeToLive) {
this(timeToLive, DEFAULT_EXPIRATION_INTERVAL);
}
/**
* Creates a new instance of ExpiringMap using the supplied values and a
* {@link ConcurrentHashMap} for the internal data structure.
*
* @param timeToLive The time-to-live value (seconds)
* @param expirationInterval The time between checks to see if a value
* should be removed (seconds)
*/
public ExpiringMap(int timeToLive, int expirationInterval) {
this(new ConcurrentHashMap<K, ExpiringObject>(),
new CopyOnWriteArrayList<ExpirationListener<V>>(), timeToLive,
expirationInterval);
}
private ExpiringMap(ConcurrentHashMap<K, ExpiringObject> delegate,
CopyOnWriteArrayList<ExpirationListener<V>> expirationListeners,
int timeToLive, int expirationInterval) {
this.delegate = delegate;
this.expirationListeners = expirationListeners;
this.expirer = new Expirer();
expirer.setTimeToLive(timeToLive);
expirer.setExpirationInterval(expirationInterval);
}
public V put(K key, V value) {
ExpiringObject answer = delegate.put(key, new ExpiringObject(key,
value, System.currentTimeMillis()));
if (answer == null) {
return null;
}
return answer.getValue();
}
public V get(Object key) {
ExpiringObject object = delegate.get(key);
if (object != null) {
object.setLastAccessTime(System.currentTimeMillis());
return object.getValue();
}
return null;
}
public V remove(Object key) {
ExpiringObject answer = delegate.remove(key);
if (answer == null) {
return null;
}
return answer.getValue();
}
public boolean containsKey(Object key) {
return delegate.containsKey(key);
}
public boolean containsValue(Object value) {
return delegate.containsValue(value);
}
public int size() {
return delegate.size();
}
public boolean isEmpty() {
return delegate.isEmpty();
}
public void clear() {
delegate.clear();
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public Set<K> keySet() {
return delegate.keySet();
}
@Override
public boolean equals(Object obj) {
return delegate.equals(obj);
}
public void putAll(Map<? extends K, ? extends V> inMap) {
for (Entry<? extends K, ? extends V> e : inMap.entrySet()) {
this.put(e.getKey(), e.getValue());
}
}
public Collection<V> values() {
throw new UnsupportedOperationException();
}
public Set<Map.Entry<K, V>> entrySet() {
throw new UnsupportedOperationException();
}
public void addExpirationListener(ExpirationListener<V> listener) {
expirationListeners.add(listener);
}
public void removeExpirationListener(
ExpirationListener<V> listener) {
expirationListeners.remove(listener);
}
public Expirer getExpirer() {
return expirer;
}
public int getExpirationInterval() {
return expirer.getExpirationInterval();
}
public int getTimeToLive() {
return expirer.getTimeToLive();
}
public void setExpirationInterval(int expirationInterval) {
expirer.setExpirationInterval(expirationInterval);
}
public void setTimeToLive(int timeToLive) {
expirer.setTimeToLive(timeToLive);
}
private class ExpiringObject {
private K key;
private V value;
private long lastAccessTime;
private final ReadWriteLock lastAccessTimeLock = new ReentrantReadWriteLock();
ExpiringObject(K key, V value, long lastAccessTime) {
if (value == null) {
throw new IllegalArgumentException(
"An expiring object cannot be null.");
}
this.key = key;
this.value = value;
this.lastAccessTime = lastAccessTime;
}
public long getLastAccessTime() {
lastAccessTimeLock.readLock().lock();
try {
return lastAccessTime;
} finally {
lastAccessTimeLock.readLock().unlock();
}
}
public void setLastAccessTime(long lastAccessTime) {
lastAccessTimeLock.writeLock().lock();
try {
this.lastAccessTime = lastAccessTime;
} finally {
lastAccessTimeLock.writeLock().unlock();
}
}
public K getKey() {
return key;
}
public V getValue() {
return value;
}
@Override
public boolean equals(Object obj) {
return value.equals(obj);
}
@Override
public int hashCode() {
return value.hashCode();
}
}
/**
* A Thread that monitors an {@link ExpiringMap} and will remove elements
* that have passed the threshold.
*
*/
public class Expirer implements Runnable {
private final ReadWriteLock stateLock = new ReentrantReadWriteLock();
private long timeToLiveMillis;
private long expirationIntervalMillis;
private boolean running = false;
private final Thread expirerThread;
/**
* Creates a new instance of Expirer.
*
*/
public Expirer() {
expirerThread = new Thread(this, "ExpiringMapExpirer-"
+ expirerCount++);
expirerThread.setDaemon(true);
}
public void run() {
while (running) {
processExpires();
try {
Thread.sleep(expirationIntervalMillis);
} catch (InterruptedException e) {
}
}
}
private void processExpires() {
long timeNow = System.currentTimeMillis();
for (ExpiringObject o : delegate.values()) {
if (timeToLiveMillis <= 0) {
continue;
}
long timeIdle = timeNow - o.getLastAccessTime();
if (timeIdle >= timeToLiveMillis) {
delegate.remove(o.getKey());
for (ExpirationListener<V> listener : expirationListeners) {
listener.expired(o.getValue());
}
}
}
}
/**
* Kick off this thread which will look for old objects and remove them.
*
*/
public void startExpiring() {
stateLock.writeLock().lock();
try {
if (!running) {
running = true;
expirerThread.start();
}
} finally {
stateLock.writeLock().unlock();
}
}
/**
* If this thread has not started, then start it. Otherwise just return;
*/
public void startExpiringIfNotStarted() {
stateLock.readLock().lock();
try {
if (running) {
return;
}
} finally {
stateLock.readLock().unlock();
}
stateLock.writeLock().lock();
try {
if (!running) {
running = true;
expirerThread.start();
}
} finally {
stateLock.writeLock().unlock();
}
}
/**
* Stop the thread from monitoring the map.
*/
public void stopExpiring() {
stateLock.writeLock().lock();
try {
if (running) {
running = false;
expirerThread.interrupt();
}
} finally {
stateLock.writeLock().unlock();
}
}
/**
* Checks to see if the thread is running
*
* @return If the thread is running, true. Otherwise false.
*/
public boolean isRunning() {
stateLock.readLock().lock();
try {
return running;
} finally {
stateLock.readLock().unlock();
}
}
/**
* Returns the Time-to-live value.
*
* @return The time-to-live (seconds)
*/
public int getTimeToLive() {
stateLock.readLock().lock();
try {
return (int) timeToLiveMillis / 1000;
} finally {
stateLock.readLock().unlock();
}
}
/**
* Update the value for the time-to-live
*
* @param timeToLive The time-to-live (seconds)
*/
public void setTimeToLive(long timeToLive) {
stateLock.writeLock().lock();
try {
this.timeToLiveMillis = timeToLive * 1000;
} finally {
stateLock.writeLock().unlock();
}
}
/**
* Get the interval in which an object will live in the map before it is
* removed.
*
* @return The time in seconds.
*/
public int getExpirationInterval() {
stateLock.readLock().lock();
try {
return (int) expirationIntervalMillis / 1000;
} finally {
stateLock.readLock().unlock();
}
}
/**
* Set the interval in which an object will live in the map before it is
* removed.
*
* @param expirationInterval The time in seconds
*/
public void setExpirationInterval(long expirationInterval) {
stateLock.writeLock().lock();
try {
this.expirationIntervalMillis = expirationInterval * 1000;
} finally {
stateLock.writeLock().unlock();
}
}
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* A listener for expired object events.
*
* @author The Apache MINA Project ([email protected])
* @version $Rev: 589932 $, $Date: 2007-10-30 02:50:39 +0100 (Tue, 30 Oct 2007)
* $ TODO Make this a inner interface of ExpiringMap
*/
interface ExpirationListener<E> {
void expired(E expiredObject);
}
| [
"[email protected]"
] | |
2b30cc6912a07ee89ff1e6352628e9edf22d7a6e | 9efe83c7bca61476e60f1ec9fdfae9909e9a1f43 | /gmall-user/src/main/java/ming/jin/gmall/user/service/MemberAddressService.java | aac4c5f0b4733cdbc42b80a28be46f361e7f603a | [] | no_license | xixixijin/mal01l | 487a3e76ff703c414620041a6d81d20cae7252b9 | e316349dbfc22367d2d015e555054e4946d493e2 | refs/heads/master | 2022-09-11T05:56:09.737329 | 2019-12-09T15:58:46 | 2019-12-09T15:58:46 | 225,814,319 | 2 | 0 | null | 2022-09-01T23:17:01 | 2019-12-04T08:15:04 | HTML | UTF-8 | Java | false | false | 421 | java | package ming.jin.gmall.user.service;
import ming.jin.bean.MemberAddress;
import java.util.List;
/**
* @author Haokun
* @date 2019/12/5 0:34
* <p>
* mall01
*/
public interface MemberAddressService {
List<MemberAddress> selectByMemId(Integer id);
void addMemberAddress(MemberAddress memberAddress);
void updateMemberAddress(MemberAddress memberAddress);
void deleteMemberAddress(Integer id);
}
| [
"[email protected]"
] | |
d36644d017f23d52ce784e65d62ee71fb1c309c9 | 6a29c2d828bb31e5d6e6867405b17a88d5699a40 | /Plugin_Test/src/org/micromanager/serialPortHandling/InputMapper.java | 594387fa469489bce33c2b5f11bcfc3fa4cab0c8 | [] | no_license | mutterer/ibmp | c5829c9030192d2fa3d2afbea05d1b276c48af41 | 6832114defa34a0dc95f0dc26b1ada44caa5f6c9 | refs/heads/master | 2021-01-16T21:45:12.723182 | 2014-11-06T14:51:21 | 2014-11-06T14:51:21 | 26,274,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | java | package src.org.micromanager.serialPortHandling;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import mmcorej.CMMCore;
import org.micromanager.api.ScriptInterface;
public class InputMapper {
private CMMCore core_;
private ScriptInterface gui_;
public InputMapper(){
/*OldCode
* try{
gui_ = app;
core_ = gui_.getMMCore();
}
catch(NullPointerException nPe){
nPe.printStackTrace();
}*/
/*Making an Array of String Arrays which look like this:
0:DeviceName ; 1:deviceProperty0; 2:deviceProperty1; ...
*/
/*Code for doing things without Static Core
try {
//String[] devices = core_.getDeviceAdapterNames().toArray();
//String[][] deviceProps = new String[devices.length][];
ArrayList<String> devices =new ArrayList<String>(Arrays.asList(core_.getDeviceAdapterNames().toArray()));
ArrayList<ArrayList<String>> deviceProps = new ArrayList<ArrayList<String>>();
for(int i = 0; i < devices.size(); i++){
deviceProps.add(new ArrayList<String>(Arrays.asList(core_.getDevicePropertyNames(devices.get(i)).toArray())));
deviceProps.get(i).add(0, devices.get(i));
}
propertyWindow = new InputMappingPropertyWindow(deviceProps);
} catch (Exception e) {
e.printStackTrace();
}*/
}
public HashMap<Integer, String[]> returnMappings(){
//TODO this method
return null;
}
}
| [
"[email protected]"
] | |
886c0cdf073af07f61bccf8b038c0c6e97d5210a | e37161fe796a83f6093084980ec14121ffe66aab | /src/main/java/com/soumitra/mockserver/model/Employee.java | 2d34369d5016604cc36b76ef210ebc90fa57f172 | [] | no_license | soumitra1998/mock-server | 212663d18daca6ca991d044f140f844deed789dd | c82793e0b84ff900a4d447f72905d6aa493366fd | refs/heads/main | 2023-05-31T06:53:12.277447 | 2021-07-04T05:12:32 | 2021-07-04T05:12:32 | 382,765,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,116 | java | package com.soumitra.mockserver.model;
public class Employee {
private String empId;
private String empName;
private String empDept;
private String designation;
private Integer salary;
// public Employee() {
// super();
// }
public Employee(String empId, String empName, String empDept, String designation, Integer salary) {
super();
this.empId = empId;
this.empName = empName;
this.empDept = empDept;
this.designation = designation;
this.salary = salary;
}
public String getEmpId() {
return empId;
}
public void setEmpId(String empId) {
this.empId = empId;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public String getEmpDept() {
return empDept;
}
public void setEmpDept(String empDept) {
this.empDept = empDept;
}
public String getDesignation() {
return designation;
}
public void setDesignation(String designation) {
this.designation = designation;
}
public Integer getSalary() {
return salary;
}
public void setSalary(Integer salary) {
this.salary = salary;
}
}
| [
"[email protected]"
] | |
8c4019612622405e722ad1fa717beaf246e60b6b | 5feeadba01b6c17a87edcd412621ff95e75b6e27 | /kkb/第二十二章RabbitMQ/09-rabbitmq/02-rabbitmq/RabbitMQ 2019-7-6/RabbitMQ_DEMO/src/main/java/com/kkb/rabbitmq_message/Message_Consumer.java | 1edd3f17a26593501e9d6ff31b9756831166061f | [] | no_license | lxn348567248/KKB-Java_study | 7588f431df401b2e69afadc5f2108d96aabe66b5 | dfae46582132e0358317c3701f6a6fd5ade27676 | refs/heads/master | 2022-11-26T07:53:17.413640 | 2020-08-01T12:45:55 | 2020-08-01T12:45:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,148 | java | package com.kkb.rabbitmq_message;
import com.rabbitmq.client.*;
import java.io.IOException;
public class Message_Consumer {
public static void main(String[] args) throws Exception {
// 1. 创建 ConnetionFactory 连接工厂
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("192.168.86.53");
factory.setPort(5672);
factory.setVirtualHost("/");
// 2. 获取 Connection 连接对象
Connection connection = factory.newConnection();
// 3. 创建 Channel 信道
Channel channel = connection.createChannel();
// 4. 声明交换机
String exchangeName = "direct_exchange";
String exchangeType = "direct";
channel.exchangeDeclare(exchangeName, exchangeType, true);
// 5. 声明&绑定队列
String queueName = channel.queueDeclare().getQueue();
String routingKey = "msg_direct";
channel.queueBind(queueName, exchangeName, routingKey);
// 5. 消费消息
while (true){
boolean autoAck = false;
String consumerTag = "";
channel.basicConsume(queueName, autoAck, consumerTag, new DefaultConsumer(channel){
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
// 获取 routingKey & contentType
String routingKey = envelope.getRoutingKey();
String contentType = properties.getContentType();
System.out.println("消费的 Routing Key:" + routingKey + " \n消费的 Content Type:" + contentType);
// 获取传送标签
long deliveryTag = envelope.getDeliveryTag();
// 确认消息
channel.basicAck(deliveryTag, false);
System.out.println("消费的 Body:");
String bodyMsg = new String(body, "UTF-8");
System.out.println(bodyMsg);
}
});
}
}
}
| [
"[email protected]"
] | |
d1cc79681fdd56e3789a6de69090622f72689c00 | 8e0110a725a8bb069a17defb332472fe8cfbee43 | /app/src/main/java/com/zxn/event/ToastUtil.java | 3cd35cfe23bbea14733f736fb30f41a05e3a77aa | [] | no_license | AsaLynn/MyEventDemo | 2a5331681d602f6cc47f93bdc801730a1244f9f1 | 55047400be561340235d1752cd23d645ff035ea6 | refs/heads/master | 2021-09-17T05:04:26.519124 | 2018-06-28T07:54:29 | 2018-06-28T07:54:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 456 | java | package com.zxn.event;
import android.content.Context;
import android.widget.Toast;
public class ToastUtil {
private static Context mContext;
public static void showToast(String text) {
if (null == mContext){
throw new RuntimeException("null == mContext");
}
Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
}
public static void init(Context context) {
mContext = context;
}
}
| [
"[email protected]"
] | |
7978d52b35826584b9da2a7225ab7d607bab26db | 96602275a8a9fdd18552df60d3b4ae4fa21034e9 | /arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/BookCollection.java | ac8dfbaf969bc9c1e1fd3eceb865263ff4966571 | [
"Apache-2.0"
] | permissive | tedwon/Resteasy | 03bb419dc9f74ea406dc1ea29d8a6b948b2228a8 | 38badcb8c2daae2a77cea9e7d70a550449550c49 | refs/heads/master | 2023-01-18T22:03:43.256889 | 2016-06-29T15:37:45 | 2016-06-29T15:37:45 | 62,353,131 | 0 | 0 | NOASSERTION | 2023-01-02T22:02:20 | 2016-07-01T01:29:16 | Java | UTF-8 | Java | false | false | 1,020 | java | package org.jboss.resteasy.cdi.injection;
import java.util.Collection;
import java.util.logging.Logger;
import javax.ejb.Singleton;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author <a href="[email protected]">Ron Sigal</a>
* @version $Revision: 1.1 $
*
* Copyright May 8, 2012
*/
@Singleton
@ApplicationScoped
public class BookCollection
{
@ResourceBinding
@PersistenceContext(unitName="test")
EntityManager em;
@Inject Logger log;
public void addBook(Book book)
{
em.persist(book);
log.info("persisted: " + book);
}
public Book getBook(int id)
{
return em.find(Book.class, id);
}
public Collection<Book> getBooks()
{
return em.createQuery("SELECT b FROM Book AS b", Book.class).getResultList();
}
public void empty()
{
em.createQuery("delete from Book").executeUpdate();
}
}
| [
"[email protected]"
] | |
876fb56fc0050328e1fbd7adea1663758ce8681e | 29c7f9b01310649b349276c44f7d68604f1ca9db | /source/game/npc/impl/zulrah/ZulrahTransformationState.java | 7574fccf03db5ee17f978adeb0ec86bc9a5b2ca4 | [
"MIT"
] | permissive | FavyTeam/Elderscape_server | 9d4bebcb69a356ad75319c619cf50e07db80d1c1 | 38bf75396e4e13222be67d5f15eb0b9862dca6bb | refs/heads/master | 2021-11-11T21:06:58.328305 | 2021-10-29T02:31:36 | 2021-10-29T02:31:36 | 177,174,976 | 5 | 7 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package game.npc.impl.zulrah;
/**
* Created by Jason MacKeigan on 2018-04-11 at 2:29 PM
*/
public enum ZulrahTransformationState {
NONE,
TRANSFORMING
}
| [
"[email protected]"
] | |
8dcd33fc6fa9219db9ad287dd3c625926aae3192 | 7032766853158a5e85e3ad041ff24df78d1408ee | /herenciaEmpleado/EmpleadoPorHora.java | 04a050b6a8ec5f9af13930ef89d3585025fcc754 | [] | no_license | naludena1/poo2020 | eb260dd0108d0feca34e587648aec602270e124c | ffa4ecc47645da5373c8a4d7d807a80933a2acf4 | refs/heads/master | 2020-12-31T08:18:38.118819 | 2020-05-13T02:54:20 | 2020-05-13T02:54:20 | 238,948,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,132 | java | package herenciaEmpleado;
public class EmpleadoPorHora extends Empleado {
public EmpleadoPorHora(String nombre, String cargo, String dependencia, int hora, double valorHora){
this.nombre = nombre;
this.cargo = cargo;
this.dependencia = dependencia;
this.hora= hora;
this.valorHora = valorHora;
}
// variables
private int hora;
private double valorHora;
private double sueldo;
// Métodos get y set
public int getHora() {
return hora;
}
public void setHora(int hora) {
this.hora = hora;
}
public double getValorHora() {
return valorHora;
}
public void setValorHora(double valorHora) {
this.valorHora = valorHora;
}
public double getSueldo() {
return sueldo;
}
public void setSueldo(double sueldo) {
this.sueldo = sueldo;
}
/**
* Metodo para calcular el sueldo
* @return sueldo
*/
public double CalcularSueldoHoras(){
sueldo = (hora * valorHora);
return sueldo;
}
}
| [
"[email protected]"
] | |
5d3c37c188c3b5c51b6972a691035012aaa8d84e | a5de267598e136b663472231136c89392eb24f69 | /app/src/main/java/hr/foi/air/storknest/app/hygiene/model/HygieneModel.java | a130ef4fb55f3c42b93c7fd86128abc77265f294 | [] | no_license | toslunjski/StorkNest | c80144b98e9bb497692a8391018e997caf01867d | ba82935988b623f9bbe398f50dbcee2abce7d115 | refs/heads/master | 2020-03-26T08:53:26.078695 | 2018-08-27T02:35:23 | 2018-08-27T02:35:23 | 72,231,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 786 | java | package hr.foi.air.storknest.app.hygiene.model;
import com.google.firebase.database.DataSnapshot;
public class HygieneModel {
public String id;
public String user;
public String hygieneBody;
public String hygieneHair;
public String hygieneBelly;
public String createdAt;
public HygieneModel() {
}
public HygieneModel deserialize(DataSnapshot snapshot) {
id = snapshot.child("id").getValue().toString();
hygieneBody = snapshot.child("hygieneBody").getValue().toString();
hygieneHair = snapshot.child("hygieneHair").getValue().toString();
hygieneBelly = snapshot.child("hygieneBelly").getValue().toString();
createdAt = snapshot.child("createdAt").getValue().toString();
return this;
}
}
| [
"[email protected]"
] | |
87146d523a61e62af951ed907d7e3048c338ce72 | 6f5c9de301db73a4ac669c7c98459d4c698b70e8 | /src/main/java/com/amideljuyi/thesisportal/config/AsyncConfiguration.java | 3fbfcb2b8637939b80d46d212bc3c028f8444edc | [] | no_license | amirdeljouyi/thesis-portal | 09415584b08f926e3ae17ca8f35f23f14c7091ba | 85bee66b6996bdb3119ac41a73c984b51c5932c0 | refs/heads/master | 2020-04-22T00:14:49.700395 | 2017-07-29T22:32:17 | 2017-07-29T22:32:17 | 169,972,440 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,792 | java | package com.amideljuyi.thesisportal.config;
import io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor;
import io.github.jhipster.config.JHipsterProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.*;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
@Configuration
@EnableAsync
@EnableScheduling
public class AsyncConfiguration implements AsyncConfigurer {
private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class);
private final JHipsterProperties jHipsterProperties;
public AsyncConfiguration(JHipsterProperties jHipsterProperties) {
this.jHipsterProperties = jHipsterProperties;
}
@Override
@Bean(name = "taskExecutor")
public Executor getAsyncExecutor() {
log.debug("Creating Async Task Executor");
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize());
executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize());
executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity());
executor.setThreadNamePrefix("thesis-portal-Executor-");
return new ExceptionHandlingAsyncTaskExecutor(executor);
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return new SimpleAsyncUncaughtExceptionHandler();
}
}
| [
"[email protected]"
] | |
d70fd43ed72c21a7f1e87340c5ee50d2a61f4630 | 73a38236df5a17a599b0329bd583accf13cab642 | /app/src/main/java/wangyi/bwie/com/wangyinews/fragment/JunshiFragment.java | 2227adad0932a2f19e7ed229106dfac7aa508f6e | [] | no_license | danney7348/WangyiNews | d36a2322d65133bb27f019e62ec36770f8a3b5be | df76af56d373356d421b46b0b43aa34a2400c7ff | refs/heads/master | 2021-07-03T12:31:21.190785 | 2017-09-20T07:10:16 | 2017-09-20T07:10:16 | 104,174,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,213 | java | package wangyi.bwie.com.wangyinews.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.Moyuchen.networjudement.NetWorkjudeUtils;
import com.google.gson.Gson;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import okhttp3.Call;
import view.xlistview.XListView;
import wangyi.bwie.com.wangyinews.R;
import wangyi.bwie.com.wangyinews.XiangqingActivity;
import wangyi.bwie.com.wangyinews.adapter.MyAdapter;
import wangyi.bwie.com.wangyinews.adapter.MyViewPagerAdapter;
import wangyi.bwie.com.wangyinews.bean.LixianNews;
import wangyi.bwie.com.wangyinews.bean.News;
import wangyi.bwie.com.wangyinews.bean.NewsListInterface;
import wangyi.bwie.com.wangyinews.bean.Url;
import wangyi.bwie.com.wangyinews.dao.NewsDao;
import wangyi.bwie.com.wangyinews.okhttpUtils.NewsDaoutils;
/**
* 作者: 张少丹
* 时间: 2017/9/13.
* 邮箱:[email protected]
* 类的用途:
*/
public class JunshiFragment extends Fragment implements NewsListInterface, XListView.IXListViewListener {
private View view;
private XListView lv;
private NewsDaoutils dao;
private MyAdapter adapter;
private List<News.ResultBean.DataBean> newlist = new ArrayList<>();
private ViewPager vp;
private TextView tv;
private LinearLayout ll;
private List<ImageView> imgList = new ArrayList<>();
private List<String> vpList;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = View.inflate(getContext(), R.layout.news_item,null);
dao = new NewsDaoutils();
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
lv = view.findViewById(R.id.lv);
lv.setXListViewListener(this);
lv.setPullRefreshEnable(true);
lv.setPullLoadEnable(true);
View inflate = View.inflate(getContext(), R.layout.viewpager, null);
lv.addHeaderView(inflate);
vp = inflate.findViewById(R.id.vp);
tv = inflate.findViewById(R.id.vp_tv);
ll = inflate.findViewById(R.id.ll_xiaoyuandian);
NetWorkjudeUtils netWorkjudeUtils = new NetWorkjudeUtils();
netWorkjudeUtils.judement(getContext(), new NetWorkjudeUtils.networkjude() {
@Override
public void Mobilenetwork() {
Toast.makeText(getContext(), "Mobilenetwork", Toast.LENGTH_SHORT).show();
dao.getList(Url.NEWS_JUNSHI);
}
@Override
public void Wifinetwork() {
Toast.makeText(getContext(), "Wifinetwork", Toast.LENGTH_SHORT).show();
dao.getList(Url.NEWS_JUNSHI);
}
@Override
public void UNnetwork() {
Toast.makeText(getContext(), "UNnetwork", Toast.LENGTH_SHORT).show();
NewsDao dao = new NewsDao(getContext());
LixianNews query = dao.query("junshi");
String content = query.getContent();
parseData(content);
}
});
dao.setNewsListInterface(this);
vpList = new ArrayList<>();
vpList.add("https://cbu01.alicdn.com/img/ibank/2016/031/397/3058793130_1828124284.310x310.jpg");
vpList.add("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3950662657,515060759&fm=27&gp=0.jpg");
vpList.add("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4098194244,60717967&fm=27&gp=0.jpg");
vpList.add("https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1272234542,2063002059&fm=27&gp=0.jpg");
MyViewPagerAdapter vpAdapter = new MyViewPagerAdapter(getActivity(), vpList);
vp.setAdapter(vpAdapter);
initDot();
vp.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
for (int i = 0; i < imgList.size(); i++) {
if(position%vpList.size() == i){
imgList.get(i).setImageResource(R.drawable.dot1);
}else {
imgList.get(i).setImageResource(R.drawable.dot2);
}
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
private void initDot() {
for (int i = 0; i < vpList.size(); i++) {
ImageView iv = new ImageView(getContext());
if(i == 0){
iv.setImageResource(R.drawable.dot1);
}else{
iv.setImageResource(R.drawable.dot2);
}
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(10,10);
params.setMargins(5,0,5,0);
ll.addView(iv,params);
imgList.add(iv);
}
}
private void parseData(String content) {
Gson gson = new Gson();
System.out.println("content = " + content);
News news = gson.fromJson(content, News.class);
News.ResultBean result = news.getResult();
final List<News.ResultBean.DataBean> data = result.getData();
System.out.println("data = " + data);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if(adapter == null){
adapter = new MyAdapter(getActivity(),newlist);
lv.setAdapter(adapter);
}else {
adapter.notifyDataSetChanged();
}
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(getContext(), XiangqingActivity.class);
intent.putExtra("url",data.get(i-2).getUrl());
intent.putExtra("title",data.get(i-2).getTitle());
startActivity(intent);
}
});
}
});
}
@Override
public void onNewsListFailure(Call call, IOException e) {
}
@Override
public void onNewsListResponse(Call call, final List<News.ResultBean.DataBean> list) {
newlist = list;
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if(adapter == null){
adapter = new MyAdapter(getActivity(),newlist);
lv.setAdapter(adapter);
}else {
adapter.notifyDataSetChanged();
}
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(getContext(), XiangqingActivity.class);
intent.putExtra("url",list.get(i-2).getUrl());
intent.putExtra("title",list.get(i-2).getTitle());
startActivity(intent);
}
});
}
});
}
@Override
public void onRefresh() {
if(adapter != null){
adapter = null;
}
dao.getList(Url.NEWS_JUNSHI);
lv.stopRefresh();
}
@Override
public void onLoadMore() {
adapter.add(newlist);
lv.stopLoadMore();
}
}
| [
"[email protected]"
] | |
5bdb834499e989a64ae0bec4beb8b35a436aa9b0 | afd7ebabda451990715066b7d045489b19ccccd5 | /components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestPortletApplicationManager.java | a9a48dd911cf0a487876a88d6113a6fca1f9fe7e | [
"CC-BY-SA-2.5",
"AFL-2.1",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-proprietary-license"
] | permissive | malakeel/jetspeed-portal | 6996ab54816ebf7073aec1a6cbd86f59e3ee9d17 | 149dd8eba01eb86cc946d473d65ecc387464ca13 | refs/heads/master | 2022-12-29T07:50:12.413375 | 2020-04-18T04:55:45 | 2020-04-18T04:55:45 | 247,505,166 | 0 | 0 | Apache-2.0 | 2022-12-16T02:47:04 | 2020-03-15T16:27:17 | Java | UTF-8 | Java | false | false | 11,443 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jetspeed.tools.pamanager;
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jetspeed.components.jndi.JetspeedTestJNDIComponent;
import org.apache.jetspeed.components.portletregistry.RegistryException;
import org.apache.jetspeed.components.test.AbstractJexlSpringTestCase;
import org.apache.jetspeed.security.RoleManager;
import org.apache.jetspeed.security.SecurityDomain;
import org.apache.jetspeed.security.impl.SecurityDomainImpl;
import org.apache.jetspeed.security.spi.SecurityDomainAccessManager;
import org.apache.jetspeed.security.spi.SecurityDomainStorageManager;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
public class TestPortletApplicationManager extends AbstractJexlSpringTestCase
{
private static final Log log = LogFactory.getLog(TestPortletApplicationManager.class);
public static final boolean TEST_CONCURRENT_PAM_ACCESS = true;
public static final boolean TEST_USE_VERSIONED_PAM = false;
public static final int TEST_PORTLET_APPLICATION_RESTARTS = 5;
public static final String CONTEXT_NAME = "test-pa";
public static final String CONTEXT_PATH = "/"+CONTEXT_NAME;
private static final long TEST_PROCESS_SHUTDOWN_WAIT = 5000;
protected JetspeedTestJNDIComponent jndiDS;
private PortletApplicationManagement portletApplicationManager;
/**
* Configure test methods.
*
* @return test suite.
*/
public static Test suite() {
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestPortletApplicationManager.class);
}
@Override
protected void setUp() throws Exception {
// setup jetspeed test datasource
jndiDS = new JetspeedTestJNDIComponent();
jndiDS.setup();
// setup scripting and Spring test case
super.setUp();
// setup test
portletApplicationManager = scm.lookupComponent("PAM");
assertTrue(portletApplicationManager.isStarted());
Class<?> portletApplicationManagerClass = scm.lookupComponent("org.apache.jetspeed.tools.pamanager.PortletApplicationManager").getClass();
log.info("PortletApplicationManager class: " + portletApplicationManagerClass.getSimpleName());
// unregister portlet application
try {
portletApplicationManager.unregisterPortletApplication(CONTEXT_NAME);
} catch (RegistryException re) {
}
// create standard default security domain and user role as necessary
// for portlet application permissions
SecurityDomainAccessManager domainAccessManager = scm.lookupComponent("org.apache.jetspeed.security.spi.SecurityDomainAccessManager");
if (domainAccessManager.getDomainByName(SecurityDomain.DEFAULT_NAME) == null) {
SecurityDomainStorageManager domainStorageManager = scm.lookupComponent("org.apache.jetspeed.security.spi.SecurityDomainStorageManager");
SecurityDomainImpl defaultSecurityDomain = new SecurityDomainImpl();
defaultSecurityDomain.setName(SecurityDomain.DEFAULT_NAME);
domainStorageManager.addDomain(defaultSecurityDomain);
}
RoleManager roleManager = scm.lookupComponent("org.apache.jetspeed.security.RoleManager");
if (!roleManager.roleExists("user")) {
roleManager.addRole("user");
}
}
@Override
protected String[] getConfigurations() {
List<String> confList = new ArrayList<String>();
confList.add("transaction.xml");
confList.add("cache.xml");
confList.add("jetspeed-base.xml");
confList.add("jetspeed-properties.xml");
confList.add("page-manager.xml");
confList.add("registry.xml");
confList.add("search.xml");
confList.add("JETSPEED-INF/spring/RequestDispatcherService.xml");
confList.add("rc2.xml");
confList.add("static-bean-references.xml");
confList.add("security-managers.xml");
confList.add("security-providers.xml");
confList.add("security-spi.xml");
confList.add("security-atn.xml");
confList.add("security-spi-atn.xml");
confList.add("security-atz.xml");
confList.add("JETSPEED-INF/spring/JetspeedPrincipalManagerProviderOverride.xml");
confList.add("deployment.xml");
if (TEST_USE_VERSIONED_PAM)
{
confList.add("alternate/versioned-deployment/deployment.xml");
}
confList.add("search.xml");
confList.add("cluster-node.xml");
return confList.toArray(new String[1]);
}
@Override
protected String[] getBootConfigurations() {
return new String[]{"boot/datasource.xml"};
}
@Override
protected String getBeanDefinitionFilterCategories() {
return "default,jdbcDS,xmlPageManager,security,dbSecurity";
}
@Override
protected Properties getInitProperties() {
Properties properties = super.getInitProperties();
properties.setProperty("autodeployment.catalina.base", getBaseDir()+"/target");
properties.setProperty("autodeployment.catalina.engine", "Catalina");
properties.setProperty("autodeployment.delay", "10000");
properties.setProperty("autodeployment.password", "test");
properties.setProperty("autodeployment.port", "8080");
properties.setProperty("autodeployment.server", "localhost");
properties.setProperty("autodeployment.staging.dir", getBaseDir()+"/target");
properties.setProperty("autodeployment.target.dir", getBaseDir()+"/target");
properties.setProperty("autodeployment.user", "test");
return properties;
}
@Override
protected void tearDown() throws Exception {
// unregister portlet application
try {
portletApplicationManager.unregisterPortletApplication(CONTEXT_NAME);
} catch (RegistryException re) {
}
portletApplicationManager = null;
// tear down test
super.tearDown();
// tear down jetspeed test datasource
jndiDS.tearDown();
}
/**
* Test basic PortletApplicationManager operation.
*/
public void testPortletApplicationManager() {
// check for distributed database support
String databaseName = System.getProperty("org.apache.jetspeed.database.default.name");
if ((databaseName != null) && databaseName.equals("derby")) {
System.out.println("Database support not distributed: system limitation... test skipped");
log.warn("Database support not distributed: system limitation... test skipped");
return;
}
// start portlet application manager test servers
final TestProgram server0 = new TestProgram("server-0", PortletApplicationManagerServer.class, 0);
final TestProgram server1 = new TestProgram("server-1", PortletApplicationManagerServer.class, 1);
try {
// start servers
server0.start();
server1.start();
// wait until servers have started
server0.execute("");
server1.execute("");
// test starting and stopping portlet application
String result;
for (int i = 0; (i < TEST_PORTLET_APPLICATION_RESTARTS); i++) {
// start portlet application
if (TEST_CONCURRENT_PAM_ACCESS) {
// start portlet application asynchronously in background threads per server
log.info("test concurrent register/start/stop portlet application, iteration "+i+"...");
TestExecuteThread startPortletApplication0 = new TestExecuteThread(server0, "portletApplicationManagerServer.startPortletApplication();");
TestExecuteThread startPortletApplication1 = new TestExecuteThread(server1, "portletApplicationManagerServer.startPortletApplication();");
startPortletApplication0.start();
startPortletApplication1.start();
result = startPortletApplication0.getResult();
assertTrue(!result.contains("Exception"));
result = startPortletApplication1.getResult();
assertTrue(!result.contains("Exception"));
} else {
// stop portlet application synchronously
log.info("test serial register/start/stop portlet application, iteration "+i+"...");
result = server0.execute("portletApplicationManagerServer.startPortletApplication();");
assertTrue(!result.contains("Exception"));
result = server1.execute("portletApplicationManagerServer.startPortletApplication();");
assertTrue(!result.contains("Exception"));
}
// stop portlet application synchronously
result = server1.execute("portletApplicationManagerServer.stopPortletApplication();");
assertTrue(!result.contains("Exception"));
result = server0.execute("portletApplicationManagerServer.stopPortletApplication();");
assertTrue(!result.contains("Exception"));
// unregister portlet application
log.info("test unregister portlet application, iteration "+i+"...");
try {
portletApplicationManager.unregisterPortletApplication(CONTEXT_NAME);
} catch (RegistryException re) {
}
}
} catch (final Exception e) {
log.error("Server test exception: "+e, e);
fail("Server test exception: "+e);
} finally {
// silently shutdown servers
try {
server0.shutdown(TEST_PROCESS_SHUTDOWN_WAIT);
} catch (final Exception e) {
log.error( "Server shutdown exception: "+e, e);
}
try {
server1.shutdown(TEST_PROCESS_SHUTDOWN_WAIT);
} catch (final Exception e) {
log.error( "Server shutdown exception: "+e, e);
}
}
}
/**
* Start the tests.
*
* @param args the arguments. Not used
*/
public static void main(String args[]) {
TestRunner.main(new String[] {TestPortletApplicationManager.class.getName()});
}
}
| [
"[email protected]"
] | |
7699c754f369824ae8ce2ec3a9ded538e7d8ddbe | b5f57690fb2dd5860afbe1defd1ae25fae688a1f | /MyTest/src/com/mytest/test/Test12_trywithresource.java | d94fd2ec24a493d92142eb1c5bfa55abb368dfbe | [] | no_license | zhangxinzhou/demos | a117f94e737308029dea9e4947d36b99af37c10f | a9de4fbf5b79c2d356009d8da00a1d4199b7eeb8 | refs/heads/master | 2022-01-31T12:48:55.485187 | 2019-05-17T13:04:01 | 2019-05-17T13:04:01 | 87,510,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,299 | java | package com.mytest.test;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* try-catch-finally与try-with-resource比较
* @author Administrator
*
*/
public class Test12_trywithresource {
public static void main(String[] args) {
String path="C:\\windows-version.txt";
oldMethod(path);
newMethod(path);
}
public static void oldMethod(String path){
InputStreamReader isr=null;
BufferedReader br=null;
try {
isr = new InputStreamReader(new FileInputStream(path), "gbk");
br=new BufferedReader(isr);
System.out.println(br.readLine());
} catch (Exception e) {
e.printStackTrace();
} finally {
if(br!=null){
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(isr!=null){
try {
isr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public static void newMethod(String path){
try(
InputStreamReader isr = new InputStreamReader(new FileInputStream(path), "gbk");
BufferedReader br = new BufferedReader(isr);
)
{
System.out.println(br.readLine());
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
0a1c5149c8eb7efa6eff351100aca054d6e074ff | a80083e9ffea65d982af6c40fa0bf2aacb251134 | /tools/ged_rangequery/src/comparison/distance/IdentityDistance.java | 0d55ff464e3ee076658cc2f3cecbab1207705f4c | [
"MIT"
] | permissive | BiancaStoecker/complex-similarity-evaluation | d3e0792f84b66e58515e6944926b258e57ff642c | 58ac04b943122660b1973656a620077392a5df16 | refs/heads/master | 2021-03-19T12:35:40.424015 | 2021-01-27T16:02:24 | 2021-01-27T16:02:24 | 122,058,593 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package comparison.distance;
public class IdentityDistance implements Distance<Object> {
double maxDist;
public IdentityDistance() {
maxDist = 1d;
}
public IdentityDistance(double maxDist) {
this.maxDist = maxDist;
}
@Override
public double compute(Object g1, Object g2) {
return (g1.equals(g2)) ? 0d : maxDist;
}
public double getMaxDist() {
return maxDist;
}
}
| [
"[email protected]"
] | |
1d18024a3f773aea8c759a17544f978e23537253 | 397d05f17cfb4e6f0d05ee807e47d988cd4f3df1 | /src/com/base/engine/render/ShaderLoader.java | c025fec303d341cc8061775c5d3b5edf05912bd6 | [] | no_license | Dekunutter/Just-Physics | 9f42c39f9e18eb02b5b02c3b7b3a403dc1e8fb6b | 1beb42542b2b33450f61be009f020c70aeee9d38 | refs/heads/master | 2020-03-22T08:33:23.547511 | 2019-06-02T20:04:00 | 2019-06-02T20:04:00 | 139,773,688 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | package com.base.engine.render;
import java.io.InputStream;
import java.util.Scanner;
public class ShaderLoader {
public static String load(String fileName) throws Exception {
fileName = "com/base/engine/render/shaders/" + fileName;
String result;
ClassLoader classloader = new ShaderLoader().getClass().getClassLoader();
try(InputStream in = classloader.getResourceAsStream(fileName);
Scanner scanner = new Scanner(in, "UTF-8")) {
result = scanner.useDelimiter("\\A").next();
} catch(Exception ex) {
throw new ShaderException("Failed to load shader at " + fileName);
}
return result;
}
}
| [
"[email protected]"
] | |
ab5ec3d96a0ab1bd1fbbe7d02babf933cb7aa475 | fea2407937574fc87d4248fc2e39be2c8f85e6e3 | /haiya-uaa/src/main/java/com/haiya/oauth/service/impl/RedisTokensServiceImpl.java | 3172bcbac0b53098ec5f6e9965f8b14ce9c5d5c5 | [] | no_license | shanluhaiya/haiya-mircroservices-cloud | fdc547a58c26e96b9d7b66890353f6fd918d6c5f | e4f97b2d0696bc311e198e6e11ecaa3ff2190df4 | refs/heads/master | 2023-06-11T02:46:23.284904 | 2021-07-06T12:39:31 | 2021-07-06T12:39:31 | 379,939,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,444 | java | package com.haiya.oauth.service.impl;
import cn.hutool.core.util.PageUtil;
import cn.hutool.core.util.StrUtil;
import com.haiya.oauth.model.TokenVo;
import com.haiya.oauth.service.ITokensService;
import com.haiya.common.constant.SecurityConstants;
import com.haiya.common.model.PageResult;
import com.haiya.redis.template.RedisRepository;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.OAuth2Request;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* token管理服务(redis token)
*
* @author qiaoguoqiang
*/
@Slf4j
@Service
public class RedisTokensServiceImpl implements ITokensService {
@Autowired
private RedisRepository redisRepository;
@Override
public PageResult<TokenVo> listTokens(Map<String, Object> params, String clientId) {
Integer page = MapUtils.getInteger(params, "page");
Integer limit = MapUtils.getInteger(params, "limit");
int[] startEnds = PageUtil.transToStartEnd(page, limit);
//根据请求参数生成redis的key
String redisKey = getRedisKey(params, clientId);
long size = redisRepository.length(redisKey);
List<TokenVo> result = new ArrayList<>(limit);
RedisSerializer<Object> valueSerializer = RedisSerializer.java();
//查询token集合
List<Object> tokenObjs = redisRepository.getList(redisKey, startEnds[0], startEnds[1]-1, valueSerializer);
if (tokenObjs != null) {
for (Object obj : tokenObjs) {
DefaultOAuth2AccessToken accessToken = (DefaultOAuth2AccessToken)obj;
//构造token对象
TokenVo tokenVo = new TokenVo();
tokenVo.setTokenValue(accessToken.getValue());
tokenVo.setExpiration(accessToken.getExpiration());
//获取用户信息
Object authObj = redisRepository.get(SecurityConstants.REDIS_TOKEN_AUTH + accessToken.getValue(), valueSerializer);
OAuth2Authentication authentication = (OAuth2Authentication)authObj;
if (authentication != null) {
OAuth2Request request = authentication.getOAuth2Request();
tokenVo.setUsername(authentication.getName());
tokenVo.setClientId(request.getClientId());
tokenVo.setGrantType(request.getGrantType());
}
result.add(tokenVo);
}
}
return PageResult.<TokenVo>builder().data(result).code(0).count(size).build();
}
/**
* 根据请求参数生成redis的key
*/
private String getRedisKey(Map<String, Object> params, String clientId) {
String result;
String username = MapUtils.getString(params, "username");
if (StrUtil.isNotEmpty(username)) {
result = SecurityConstants.REDIS_UNAME_TO_ACCESS + clientId + ":" + username;
} else {
result = SecurityConstants.REDIS_CLIENT_ID_TO_ACCESS + clientId;
}
return result;
}
}
| [
"[email protected]"
] | |
fa01a76144b5385b3a25b3cc6f3e8267449abd54 | 4b5f1f19258b210d573b01a109d51164666e32f7 | /src/main/java/com/example/demo/demo/security/ApplicationSecurityConfig.java | 6fdbb1488fe22c14c8e2617dfe87e22f64612dce | [] | no_license | KirrVer/demo_security- | 41110dd63ad5f84b33c0f26975234db368d2bf03 | feba54ed8f3567ce29771b2c06110aaae1e67eb5 | refs/heads/master | 2023-08-27T19:49:51.723114 | 2021-10-14T15:49:38 | 2021-10-14T15:49:38 | 415,078,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,304 | java | package com.example.demo.demo.security;
import com.example.demo.demo.auth.ApplicationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
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;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import java.util.concurrent.TimeUnit;
import static com.example.demo.demo.security.ApplicationUsersRole.*;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class ApplicationSecurityConfig extends WebSecurityConfigurerAdapter {
private final PasswordEncoder passwordEncoder;
private final ApplicationUserService applicationUserService;
@Autowired
public ApplicationSecurityConfig(PasswordEncoder passwordEncoder, ApplicationUserService applicationUserService) {
this.passwordEncoder = passwordEncoder;
this.applicationUserService = applicationUserService;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
// .csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
// .and()
.csrf().disable()
.authorizeRequests()
.antMatchers("/", "index", "/css/*", "/js/*").permitAll()
.antMatchers("/api/**").hasRole(STUDENT.name())
.anyRequest()
.authenticated()
.and()
.formLogin()
.loginPage("/login").permitAll()
.defaultSuccessUrl("/courses", true)
.and()
.rememberMe()
.tokenValiditySeconds((int) TimeUnit.DAYS.toSeconds(21))
.key("sometimes")
.and()
.logout()
.logoutUrl("/logout")
.logoutRequestMatcher(new AntPathRequestMatcher("/logout", "GET"))
.clearAuthentication(true)
.invalidateHttpSession(true)
.deleteCookies("JSESSIONID", "remember-me")
.logoutSuccessUrl("/login");
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(daoAuthenticationProvider());
}
@Bean
public DaoAuthenticationProvider daoAuthenticationProvider(){
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
provider.setPasswordEncoder(passwordEncoder);
provider.setUserDetailsService(applicationUserService);
return provider;
}
}
| [
"[email protected]"
] | |
16c15ada63290ca36ee2b5728aab8b70f2bab13d | 7562001407534edaa6824e596ae87d5333a0a967 | /src/main/java/com/codementor/ideapool/auth/LoginAuthenticationProvider.java | 48ed8951cdadf2e34f6ae5b319a8050ebaa6a6cd | [] | no_license | hochichuang/ideapool-jwt | cea7b12d6d482287d2384abaabfa1545d149a649 | 0b6273fe7c2415584d42f4adcc31a140e11a9a05 | refs/heads/master | 2021-07-21T10:45:47.102091 | 2017-09-24T06:41:36 | 2017-10-27T16:35:21 | 108,567,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,244 | java | package com.codementor.ideapool.auth;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import com.codementor.ideapool.entity.User;
import com.codementor.ideapool.user.UserService;
@Component
public class LoginAuthenticationProvider implements AuthenticationProvider {
public static final List<GrantedAuthority> DEFAULT_AUTHORITIES = Arrays
.asList(new SimpleGrantedAuthority("NORMAL_USER"));
@Autowired
private BCryptPasswordEncoder encoder;
@Autowired
private UserService userService;
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
Assert.notNull(authentication, "No authentication data provided");
String email = (String) authentication.getPrincipal();
String password = (String) authentication.getCredentials();
User user = userService.getByEmail(email)
.orElseThrow(() -> new UsernameNotFoundException("User not found: " + email));
if (!encoder.matches(password, user.getPassword())) {
throw new BadCredentialsException("Authentication Failed. Username or Password not valid.");
}
return new UsernamePasswordAuthenticationToken(email, null, DEFAULT_AUTHORITIES);
}
@Override
public boolean supports(Class<?> authentication) {
return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
}
}
| [
"[email protected]"
] | |
46fc63b70e35e95ba3c60d5e9095247ca6a1b9a4 | a7c39c0dabe61b60dc001eb1a3969dfd0084a7d2 | /SmartHomeRepo/src/com/smarthome/presenter/view/DevManageView.java | 1ae24ce1ab5001178f750e7713158e1cbcfdd5ef | [] | no_license | JasonQiusip/SmartHome | e3ab9270177e56a6ec8ba82fc1d4d75f22e1af95 | f5e984a22ce114851de94091f4b68ec310fc2d0f | refs/heads/master | 2020-05-17T11:23:50.537204 | 2015-08-08T06:43:28 | 2015-08-08T06:43:28 | 39,500,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.smarthome.presenter.view;
public interface DevManageView extends CustomView{
void showLoading();
void hideLoading();
void onCheckDevArgs();
void onCheckError();
void onChangeDevArgs();
void onChangError();
void onDispatchConf();
void onDispatchConfError();
void onDevControl();
void onDevControlError();
}
| [
"qiusp@pc"
] | qiusp@pc |
52eee61f2da71bea799804ac38a693786b5fcea8 | 74e60c8a372fa72c3c41300907d032b97a84ee6f | /src/test/java/com/shopdirect/forecasting/authorization/AuthorizationServiceApplicationTests.java | c78c490d544cb9578b3b245fb7f7d04d584cfd90 | [] | no_license | gyowannyqueiroz/springboot-oauth-service | 5bde1a387fa14364ab6fdd536dde5de43094068c | aeb068aa246686a3a08c3c76cdeee100dbd0e5fa | refs/heads/master | 2020-05-20T13:16:14.979519 | 2019-05-08T16:36:10 | 2019-05-08T16:36:10 | 185,593,874 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.shopdirect.forecasting.authorization;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class AuthorizationServiceApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
fa93350ac0906a80faea6e3ff8fd0e19e75f1a3c | eef09f3c0cf7d5eac681d2b79f7744e55ac6c0bd | /src/main/java/com/spk/web/myfirstws/ui/model/request/PasswordResetModel.java | 674cf205c68fd357ec100a9ba406a4fecd5e55a1 | [] | no_license | saharpk1988/WebserviceApplication | 5a18b431de5b236c01b0129a73af64ff5303c03c | 3787300f499a407bfd8df154e06b52c55c23f0d8 | refs/heads/master | 2023-01-30T15:18:01.095937 | 2020-12-05T11:31:41 | 2020-12-05T11:31:41 | 298,240,572 | 1 | 1 | null | 2020-10-15T18:31:05 | 2020-09-24T10:09:32 | Java | UTF-8 | Java | false | false | 431 | java |
package com.spk.web.myfirstws.ui.model.request;
public class PasswordResetModel {
private String token;
private String password;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"[email protected]"
] | |
cc04d3ef5891460e939ef8095c13025dca029de8 | 485f012cba3beea94905eeab93c65e8a1742c264 | /src/com/xiaba2/task/controller/CompanyController.java | fad772fbde9564c2d3abada9959303eb0a0ac027 | [] | no_license | goddie/crmtwww | 1ad96a58682b7d2df67cb5cd83832250a19c2ed1 | b02f9a7072651952411b20c377bfdbbef3a348f9 | refs/heads/master | 2021-01-17T14:45:56.677693 | 2016-06-22T12:27:11 | 2016-06-22T12:27:11 | 48,489,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,475 | java | package com.xiaba2.task.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.util.WebUtils;
import com.xiaba2.core.Page;
import com.xiaba2.task.domain.Company;
import com.xiaba2.task.domain.Task;
import com.xiaba2.task.domain.User;
import com.xiaba2.task.gen.EnumSet.CheckStatus;
import com.xiaba2.task.service.CompanyService;
import com.xiaba2.task.service.UserService;
import com.xiaba2.util.SessionUtil;
@Controller
@RequestMapping("/company")
public class CompanyController {
@Resource
private CompanyService companyService;
@Resource
private UserService userService;
/**
* 企业认证
*
* @param request
* @return
*/
@RequestMapping(value = "/v/checkcompany")
public ModelAndView checkCompany(HttpServletRequest request) {
ModelAndView mv = new ModelAndView("ucenter_checkcompany");
User user = (User) SessionUtil.getInstance().getSessionUser();
if (user != null) {
user = userService.get(user.getId());
}
mv.addObject("user", user);
if(user.getIsCheckCompany()==CheckStatus.SUCCESS || user.getIsCheckCompany()==CheckStatus.WAIT)
{
ModelAndView mv2 = new ModelAndView("ucenter_checkcompany_done");
mv2.addObject("status", user.getIsCheckCompany());
return mv2;
}
return mv;
}
/**
* 企业认证
*
* @param request
* @return
*/
@RequestMapping(value = "/v/companydetail")
public ModelAndView companyDetail(HttpServletRequest request) {
ModelAndView mv = new ModelAndView("ucenter_checkcompany_detail");
User user = (User) SessionUtil.getInstance().getSessionUser();
if (user != null) {
user = userService.get(user.getId());
}
mv.addObject("user", user);
if(user.getIsCheckCompany()==CheckStatus.SUCCESS || user.getIsCheckCompany()==CheckStatus.WAIT)
{
ModelAndView mv2 = new ModelAndView("ucenter_checkcompany_done");
mv2.addObject("status", user.getIsCheckCompany());
return mv2;
}
mv.addObject("ref", request.getHeader("Referer"));
return mv;
}
/**
* 企业认证
*
* @param request
* @return
*/
@RequestMapping(value = "/admin/companydetail")
public ModelAndView adminCompanyDetail(@RequestParam("id") UUID id, HttpServletRequest request) {
ModelAndView mv = new ModelAndView("admin_review_companydetail");
Company company = companyService.get(id);
if(company==null)
{
return mv;
}
mv.addObject("user",company.getUser());
mv.addObject("company",company);
mv.addObject("ref", request.getHeader("Referer"));
return mv;
}
@RequestMapping(value = "/action/add")
public ModelAndView actionAdd(Company entity, RedirectAttributes attr, HttpServletRequest request) {
ModelAndView mv = new ModelAndView("redirect:/company/v/checkcompany");
String thumb = request.getParameter("licenceImage");
if (StringUtils.isEmpty(thumb)) {
attr.addFlashAttribute("msg", "请上传证明图片");
return mv;
}
User user = (User) SessionUtil.getInstance().getSessionUser();
if (user == null) {
return mv;
}
user = userService.get(user.getId());
entity.setUser(user);
entity.setCreatedDate(new Date());
companyService.save(entity);
user.setIsCheckCompany(CheckStatus.WAIT);
userService.saveOrUpdate(user);
attr.addFlashAttribute("js", "<script>alert('提交成功,等待审核!')</script>");
return mv;
}
/**
* 任务块
*
* @param type
* @param count
* @return
*/
@RequestMapping(value = "/companyblock")
public ModelAndView getTaskCompanyBlock(@RequestParam("count") int count) {
ModelAndView mv = new ModelAndView("task_block_company");
DetachedCriteria criteria = userService.createDetachedCriteria();
criteria.add(Restrictions.eq("isDelete", 0));
criteria.add(Restrictions.eq("isCheckCompany", CheckStatus.SUCCESS));
criteria.add(Restrictions.isNotNull("head"));
Page<User> p = new Page<User>();
p.setPageSize(count);
p.setPageNo(1);
p.addOrder("createdDate", "desc");
p = userService.findPageByCriteria(criteria, p);
List<CompanyUser> list2 = new ArrayList<CompanyUser>();
List<User> list = p.getResult();
for (User user : list) {
String img = user.getHead();
if (!StringUtils.isEmpty(img)) {
img = img.replace("_200x200", "_240x180");
user.setHead(img);
}
CompanyUser cu = new CompanyUser(companyService.getByUser(user), user);
list2.add(cu);
}
// List<Product> list = productService.findByCriteria(criteria);
mv.addObject("list", list2);
return mv;
}
public class CompanyUser {
public CompanyUser(Company c, User u) {
this.company = c;
this.user = u;
}
private Company company;
private User user;
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
} | [
"[email protected]"
] | |
c4a318b5cb282ddd3802e4704d8d830ca773c307 | 8c127b78fd34baa0e15dd6f8e6894d70bc05a3e0 | /pruebaMongoDB/src/java/util/listeners/SessionListener.java | 0f72b5369de1c7e759109b8f6d69c547b7f1535b | [] | no_license | Matfork/Java-MongoDB | db9cefb23341b58aee94974a4d70cf4fb58a40f8 | 278c0fa013ec1b9b9f7044dea252a0829f7cf87d | refs/heads/master | 2021-01-13T01:37:22.557139 | 2012-12-25T17:28:51 | 2012-12-25T17:28:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package util.listeners;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
@WebListener()
public class SessionListener implements HttpSessionListener {
@Override
public void sessionCreated(HttpSessionEvent se) {
se.getSession().setMaxInactiveInterval(15*60);
}
@Override
public void sessionDestroyed(HttpSessionEvent se) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
| [
"[email protected]"
] | |
527d2e3df16496274001fcfc2654e7d496010d81 | c9dbe935791435c5ebfcaf482407ca9c2a6ee102 | /app/src/main/java/com/example/viewpager2withanimations/Utils.java | 1a191202a422e890af08e7e5e1c48cd0f1756f29 | [] | no_license | Narayan-Dhingra/ViewPager2Animations | cfe22993f04b9f64f941fb35a6067760126d92ff | 183707c141dbea0352047c0a27ee09a03fbf1d4b | refs/heads/master | 2023-08-27T15:12:09.722479 | 2021-10-12T10:36:20 | 2021-10-12T10:36:20 | 415,550,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,048 | java | package com.example.viewpager2withanimations;
import android.annotation.SuppressLint;
import androidx.viewpager2.widget.ViewPager2;
import com.example.viewpager2withanimations.transformers.AntiClockSpinTransformation;
import com.example.viewpager2withanimations.transformers.ClockSpinTransformation;
import com.example.viewpager2withanimations.transformers.CubeInDepthTransformation;
import com.example.viewpager2withanimations.transformers.CubeInRotationTransformation;
import com.example.viewpager2withanimations.transformers.CubeOutDepthTransformation;
import com.example.viewpager2withanimations.transformers.CubeOutRotationTransformation;
import com.example.viewpager2withanimations.transformers.CubeOutScalingTransformation;
import com.example.viewpager2withanimations.transformers.DepthPageTransformer;
import com.example.viewpager2withanimations.transformers.DepthTransformation;
import com.example.viewpager2withanimations.transformers.FadeOutTransformation;
import com.example.viewpager2withanimations.transformers.FanTransformation;
import com.example.viewpager2withanimations.transformers.GateTransformation;
import com.example.viewpager2withanimations.transformers.HingeTransformation;
import com.example.viewpager2withanimations.transformers.HorizontalFlipTransformation;
import com.example.viewpager2withanimations.transformers.PopTransformation;
import com.example.viewpager2withanimations.transformers.SimpleTransformation;
import com.example.viewpager2withanimations.transformers.SpinnerTransformation;
import com.example.viewpager2withanimations.transformers.TossTransformation;
import com.example.viewpager2withanimations.transformers.VerticalFlipTransformation;
import com.example.viewpager2withanimations.transformers.VerticalShutTransformation;
import com.example.viewpager2withanimations.transformers.ZoomOutPageTransformer;
public class Utils {
@SuppressLint("NonConstantResourceId")
public static ViewPager2.PageTransformer getTransformer(int id) {
switch (id) {
case R.id.action_anti_clock_spin:
return new AntiClockSpinTransformation();
case R.id.action_clock_spin:
return new ClockSpinTransformation();
case R.id.action_cube_in_depth:
return new CubeInDepthTransformation();
case R.id.action_cube_in_rotate:
return new CubeInRotationTransformation();
case R.id.action_cube_out_depth:
return new CubeOutDepthTransformation();
case R.id.action_cube_out_rotate:
return new CubeOutRotationTransformation();
case R.id.action_cube_out_scaling:
return new CubeOutScalingTransformation();
case R.id.action_depth_page:
return new DepthPageTransformer();
case R.id.action_depth:
return new DepthTransformation();
case R.id.action_fade_out:
return new FadeOutTransformation();
case R.id.action_fan:
return new FanTransformation();
case R.id.action_gate:
return new GateTransformation();
case R.id.action_hinge:
return new HingeTransformation();
case R.id.action_horizontal_flip:
return new VerticalFlipTransformation();
case R.id.action_pop:
return new PopTransformation();
case R.id.action_simple_transformation:
return new SimpleTransformation();
case R.id.action_spinner:
return new SpinnerTransformation();
case R.id.action_toss:
return new TossTransformation();
case R.id.action_vertical_flip:
return new HorizontalFlipTransformation();
case R.id.action_vertical_shut:
return new VerticalShutTransformation();
case R.id.action_zoom_out:
return new ZoomOutPageTransformer();
}
return null;
}
}
| [
"[email protected]"
] | |
af5bd2ccfe2d050b3458ae962706a5a1b93e5e69 | 19b493f5ba3ea3de89b0c55c20d01874919425cd | /src/main/java/com/nexio/exercices/dto/ShoppingCartDto.java | 008700949849330cda7fc73e495a3dd90fbce252 | [] | no_license | EliuX/nexio-exercice-1-java | d604fabd36760ddfceb54621d34bf00e8391d272 | 56e61c619d59106bcc4f1eef8f7cfe1d6120bcb7 | refs/heads/master | 2022-02-18T09:54:29.524407 | 2019-09-23T03:05:48 | 2019-09-23T03:44:16 | 208,974,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 576 | java | package com.nexio.exercices.dto;
import java.math.BigDecimal;
import java.util.List;
public class ShoppingCartDto {
private List<ShoppingCartItemDto> items;
public ShoppingCartDto() {
}
public List<ShoppingCartItemDto> getItems() {
return items;
}
public void setItems(List<ShoppingCartItemDto> items) {
this.items = items;
}
public BigDecimal getTotalPrice() {
return getItems().stream()
.map(ShoppingCartItemDto::getTotalPrice)
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
}
| [
"[email protected]"
] | |
5ea9217acaf97c59f713e2b2af75d11ec9005c81 | 903ba529f7e1d6a88c171613e943b29316b39706 | /EvenLargest.java | 3eb2445c6e095b85adeee004d2f98a005bf294aa | [] | no_license | A-a1i/TheCoreJavaBasics | 7e78bb7bab229b1c93bb5053021f34aace175200 | d4f03223612e32311b974114179b7d6d71efd3d8 | refs/heads/master | 2020-04-13T08:44:43.914112 | 2018-12-26T10:42:49 | 2018-12-26T10:42:49 | 163,090,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package arrayprograms;
public class EvenLargest {
public static void main(String args[])
{
int a[]={10,20,30,40,50};
int k=a[0];
System.out.println(a.length);
for(int i=0;i<a.length;i++)
{
if(a[i]>k)
{
k=a[i];
}
}
System.out.println(k);
if(k%2==0)
{
System.out.println("even");
}
else
{
System.out.println("not even");
}
}
}
| [
"[email protected]"
] | |
eb2e310c5e2b8451bb9083d3a88b0eab2953bd58 | dbe07c2f69d6b564bf0edad478e11ed484f4142a | /college-business-new/src/main/java/com/shenghesun/college/news/controller/SpecialViewController.java | d177432d86b603addb454478d542a839f13c472c | [] | no_license | KevinDingFeng/college | 882bf37ea5a7367ba8804fd620f386fa36226de0 | 7a898d046108b76598279a7e1fc72efc8bb64bb6 | refs/heads/master | 2020-04-01T17:21:00.994910 | 2019-01-11T09:13:59 | 2019-01-11T09:13:59 | 153,424,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,808 | java | package com.shenghesun.college.news.controller;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.shenghesun.college.news.entity.SysSpecial;
import com.shenghesun.college.news.service.SysSpecialService;
@Controller
@RequestMapping(value = "/special_view")
public class SpecialViewController {
@Autowired
private SysSpecialService specialService;
/**
* 专题首页,即新闻列表页,也作为当前系统的首页使用
*
* @param pageNum
* @param model
* @return
*/
@RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
public String index(@RequestParam(value = "pageNum", required = false) Integer pageNum, Model model) {
// 构建分页信息
pageNum = pageNum == null ? 0 : pageNum;
Pageable pageable = this.getListPageable(pageNum);
Page<SysSpecial> page = specialService.findBySpecification(this.getSpecification(), pageable);
model.addAttribute("page", page);
model.addAttribute("pageNum", pageNum);
return "special_show/list";
}
private Pageable getListPageable(Integer pageNum) {
Sort sort = new Sort(Direction.DESC, "creation");
Pageable pageable = new PageRequest(pageNum, 50, sort);
return pageable;
}
private Specification<SysSpecial> getSpecification() {
return new Specification<SysSpecial>() {
@Override
public Predicate toPredicate(Root<SysSpecial> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> list = new ArrayList<Predicate>();
list.add(cb.equal(root.get("removed"), false));
Predicate[] p = new Predicate[list.size()];
return cb.and(list.toArray(p));
}
};
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String form(@PathVariable("id") Long id, Model model) {
// 判断该操作是新增还是修改
SysSpecial news = specialService.findById(id);
model.addAttribute("entity", news);
return "special_show/detail";
}
}
| [
"kevin@kevin-TM1701"
] | kevin@kevin-TM1701 |
b0555d6aa2e50ec1a0cb4f3c2e3c90fb4962dea4 | 639fc7348a3011418f72de2578514b9eb521cca7 | /SSM框架论坛上线版/src/main/java/kybmig/ssm/service/UserService.java | 7925e856d37d5e3ca3f9cb1e985513833c03f1cf | [] | no_license | remi1993/weibo | 1481de0207cbd31f39d937e7db84ae7b64cd4763 | 9013af27146a5d15b2938fd92a557c6f102cd839 | refs/heads/master | 2022-12-16T00:55:11.366666 | 2020-09-14T08:52:08 | 2020-09-14T08:52:08 | 294,701,814 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,738 | java | package kybmig.ssm.service;
import kybmig.ssm.Utility;
import kybmig.ssm.mapper.UserMapper;
import kybmig.ssm.model.UserModel;
import kybmig.ssm.model.UserRole;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.List;
@Service
public class UserService {
private UserMapper mapper;
public UserService(UserMapper userMapper) {
this.mapper = userMapper;
}
public Long createdTime (){
Long time = System.currentTimeMillis() ;
// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String time = sdf.format(new Date(Long.parseLong(String.valueOf(createdTime))));
Utility.log("createdtime1 %s" ,time);
return time;
}
public UserModel add(String username, String password) {
UserModel m = new UserModel();
m.setUsername(username);
m.setPassword(password);
m.setRole(UserRole.normal);
m.setCreatedTime(this.createdTime());
m.setAvatar("/doge.gif");
Utility.log("注册的m %s",m);
mapper.insertUser(m);
return m;
}
public void update(Integer id, String username, String password) {
UserModel m = new UserModel();
m.setId(id);
m.setUsername(username);
m.setPassword(password);
mapper.updateUser(m);
}
public void deleteById(Integer id) {
mapper.deleteUser(id);
}
public UserModel findById(Integer id) {
return mapper.selectUser(id);
}
public UserModel findByUsername(String username) {
return mapper.selectOnerByUsername(username);
}
public boolean validateLogin(String username, String password) {
UserModel user = mapper.selectOnerByUsername(username);
if (user != null && user.getPassword().equals(password)) {
return true;
} else {
return false;
}
}
public UserModel guest() {
UserModel user = new UserModel();
user.setRole(UserRole.guest);
user.setId(-1);
user.setUsername("游客");
user.setPassword("游客");
return user;
}
public UserModel currentUser(HttpServletRequest request) {
HttpSession session = request.getSession();
Integer id = (Integer) session.getAttribute("user_id");
if (id == null) {
return this.guest();
}
UserModel user = mapper.selectUser(id);
if (user == null) {
user = this.guest();
}
return user;
}
public List<UserModel> all() {
return mapper.selectAllUser();
}
}
| [
"[email protected]"
] | |
888d2b10f6364619bca790cc62d1adedb27e92d9 | c07b67cd9db8532ac4b09169446202e2a9cd40bc | /Codelabs/OneHop/Linux/app/src/main/java/com/example/demoforonehop/MainActivity.java | 734e8030f87d0d4fa5874b275e5502beb4eef0fc | [
"Apache-2.0"
] | permissive | AtaerCaner/Consumer | 692c30045eb655be2f28c8108d524f1d8a240c3f | e218db3b10a1cbecdcc837b0275060ba00a8e232 | refs/heads/master | 2022-11-09T21:04:48.026545 | 2020-06-23T02:58:14 | 2020-06-23T03:40:24 | 274,390,186 | 1 | 0 | null | 2020-06-23T11:40:29 | 2020-06-23T11:40:28 | null | UTF-8 | Java | false | false | 6,117 | java | /*
* Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
*/
package com.example.demoforonehop;
import android.emcom.IOneHopAppCallback;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
import com.huawei.onehop.appsdk.HwOneHopSdk;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private static final String MSG_DATA = "data_received";
private static final String PKG_NAME = "com.example.demoforonehop";
private static final String DATA_STR = "Test";
private static final int MSG_RECEIVE = 0;
private static int count = 0;
private MyHandler mHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initHandlder();
register();
}
@Override
protected void onDestroy() {
unregister();
super.onDestroy();
}
private void unregister() {
int retCode = HwOneHopSdk.getInstance().unregisterOneHop(getPackageName(),
HwOneHopSdk.ONEHOP_DATA_TYPE_BUSINESS_CONTINUITY);
if (retCode == HwOneHopSdk.ONEHOP_ERR) {
Log.d(TAG, "unregister failed");
}
}
private void initHandlder() {
mHandler = new MyHandler(this);
}
private void register() {
new RegisterThread().start();
}
private void makeToast(Message message) {
if (message == null) {
Log.e(TAG, "the message is null");
return;
}
Bundle data = message.getData();
if (data == null) {
Log.e(TAG, "data is null");
return;
}
String text = data.getString(MSG_DATA, "default");
Log.d(TAG, "get para: " + text);
Toast.makeText(MainActivity.this, text, Toast.LENGTH_LONG).show();
TextView para = findViewById(R.id.text);
para.setText(text);
para.setHighlightColor(Color.BLUE);
}
/**
* Thread to register onehop
*
* @since 2019-11-11
*/
private class RegisterThread extends Thread {
@Override
public void run() {
int retCode = HwOneHopSdk.getInstance().registerOneHop(PKG_NAME,
HwOneHopSdk.ONEHOP_DATA_TYPE_BUSINESS_CONTINUITY, new IOneHopAppCallback.Stub() {
@Override
public void onOneHopReceived(String s) throws RemoteException {
// 调用OneHop同步接口OneHopData,通知当前触碰事件。
if (TextUtils.isEmpty(s)) {
Log.e(TAG, "onOneHopReceived got wrong para");
return;
}
Log.d(TAG, "param is " + s);
try {
JSONObject jsonObject = new JSONObject(s);
boolean isEvent;
if (jsonObject.has(HwOneHopSdk.ONEHOP_RECEIVE_TYPE)) {
int type = jsonObject.getInt(HwOneHopSdk.ONEHOP_RECEIVE_TYPE);
isEvent = type == HwOneHopSdk.ONEHOP_RECEIVE_TYPE_EVENT ? true : false;
} else {
Log.e(TAG, "the para is false " + s);
return;
}
if (!isEvent) {
// pad: receive parameters
handleReceive(s);
} else {
// phone: send parameters
handleSend();
}
} catch (JSONException e) {
Log.e(TAG, "JSON parsed failed " + e.getMessage());
}
}
});
if (retCode == HwOneHopSdk.ONEHOP_ERR) {
Log.e(TAG, "register OneHop error");
}
}
}
private void handleSend() {
Map<String, Object> map = new HashMap<>();
map.put(DATA_STR, "Hello World! " + (count++));
int retCode = HwOneHopSdk.getInstance().oneHopSend(getPackageName(),
new JSONObject(map));
if (retCode == HwOneHopSdk.ONEHOP_ERR) {
Log.e(TAG, "send failed");
}
}
private void handleReceive(String param) {
Message message = new Message();
message.what = MSG_RECEIVE;
Bundle bundle = new Bundle();
bundle.putString(MSG_DATA, param);
message.setData(bundle);
mHandler.sendMessage(message);
}
static class MyHandler extends Handler {
private final WeakReference<MainActivity> mActivity;
MyHandler(MainActivity activity) {
mActivity = new WeakReference<>(activity);
}
@Override
public void handleMessage(@NonNull Message msg) {
if (mActivity.get() == null) {
Log.e(TAG, "current activity is null");
return;
}
MainActivity activity = mActivity.get();
switch (msg.what) {
case MSG_RECEIVE:
Log.d(TAG, "receive");
activity.makeToast(msg);
break;
default:
Log.e(TAG, "get unknown message " + msg.what);
break;
}
}
}
} | [
"[email protected]"
] | |
1076c4a1848a89f91a83e212f82bc4a73511432a | 258de8e8d556901959831bbdc3878af2d8933997 | /utopia-service/utopia-parenthomework/utopia-parenthomework-impl/src/main/java/com/voxlearning/utopia/service/parent/homework/provider/intelligentTeaching/impl/entity/BookCatalog.java | 31aa242f8435f31bf984eac0035f1f2c79faae42 | [] | no_license | Explorer1092/vox | d40168b44ccd523748647742ec376fdc2b22160f | 701160b0417e5a3f1b942269b0e7e2fd768f4b8e | refs/heads/master | 2020-05-14T20:13:02.531549 | 2019-04-17T06:54:06 | 2019-04-17T06:54:06 | 181,923,482 | 0 | 4 | null | 2019-04-17T15:53:25 | 2019-04-17T15:53:25 | null | UTF-8 | Java | false | false | 596 | java | package com.voxlearning.utopia.service.parent.homework.provider.intelligentTeaching.impl.entity;
import com.voxlearning.alps.annotation.dao.DocumentField;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* 教材节点
*
* @author Wenlong Meng
* @since Feb 13, 2019
*/
@Getter
@Setter
public class BookCatalog implements Serializable {
private static final long serialVersionUID = -2022210401815265192L;
private String id;
@DocumentField("node_level")
private String nodeLevel;
@DocumentField("node_type")
private String nodeType;
}
| [
"[email protected]"
] | |
a22bf20471b9247c1013d5177d362306d7844455 | 8bc8e94e7d9d2a6c6aaae2a03b1280a1baa5dd23 | /src/apple/applicationservices/struct/CMDeviceInfo.java | d4d3951acad34abcbe0d58c34fe994f8b194788f | [] | no_license | VadimZharkov/natj-mac-example | fd5eb814371bde26d7b77c54edbeebb3fa667851 | 94af6b2c1d01fb3f9ebd28550d5996fe49fe3ddc | refs/heads/master | 2020-06-22T00:09:07.333774 | 2019-07-18T12:44:25 | 2019-07-18T12:44:25 | 197,585,255 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,208 | java | /*
Copyright 2014-2016 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package apple.applicationservices.struct;
import org.moe.natj.c.StructObject;
import org.moe.natj.c.ann.Structure;
import org.moe.natj.c.ann.StructureField;
import org.moe.natj.general.NatJ;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.ByValue;
import org.moe.natj.general.ann.Generated;
import org.moe.natj.general.ann.ReferenceInfo;
import org.moe.natj.general.ptr.Ptr;
import apple.corefoundation.opaque.CFDictionaryRef;
@Generated
@Structure()
public final class CMDeviceInfo extends StructObject {
static {
NatJ.register();
}
private static long __natjCache;
@Generated
public CMDeviceInfo() {
super(CMDeviceInfo.class);
}
@Generated
protected CMDeviceInfo(Pointer peer) {
super(peer);
}
@Generated
@StructureField(order = 0, isGetter = true)
public native int dataVersion();
@Generated
@StructureField(order = 0, isGetter = false)
public native void setDataVersion(int value);
@Generated
@StructureField(order = 1, isGetter = true)
public native int deviceClass();
@Generated
@StructureField(order = 1, isGetter = false)
public native void setDeviceClass(int value);
@Generated
@StructureField(order = 2, isGetter = true)
public native int deviceID();
@Generated
@StructureField(order = 2, isGetter = false)
public native void setDeviceID(int value);
@Generated
@StructureField(order = 3, isGetter = true)
@ByValue
public native CMDeviceScope deviceScope();
@Generated
@StructureField(order = 3, isGetter = false)
public native void setDeviceScope(@ByValue CMDeviceScope value);
@Generated
@StructureField(order = 4, isGetter = true)
public native int deviceState();
@Generated
@StructureField(order = 4, isGetter = false)
public native void setDeviceState(int value);
@Generated
@StructureField(order = 5, isGetter = true)
public native int defaultProfileID();
@Generated
@StructureField(order = 5, isGetter = false)
public native void setDefaultProfileID(int value);
@Generated
@StructureField(order = 6, isGetter = true)
@ReferenceInfo(type = CFDictionaryRef.class)
public native Ptr<CFDictionaryRef> deviceName();
@Generated
@StructureField(order = 6, isGetter = false)
public native void setDeviceName(Ptr<CFDictionaryRef> value);
@Generated
@StructureField(order = 7, isGetter = true)
public native int profileCount();
@Generated
@StructureField(order = 7, isGetter = false)
public native void setProfileCount(int value);
@Generated
@StructureField(order = 8, isGetter = true)
public native int reserved();
@Generated
@StructureField(order = 8, isGetter = false)
public native void setReserved(int value);
}
| [
"[email protected]"
] | |
fa0d87b9c593cdfc6ec63e3811eb95adf5ec9e5f | 23a8cfdac21f40b7d5b37142ca1a012499cc61f6 | /src/man/ac/uk/Test.java | f2d5ba28daa0af5a6db7bbfe4506d816cba658bc | [] | no_license | mslee-manchester/justification-isomorphism-framework | 0589ea616565c5525d1a68c631a66e60e1c22f0f | 524b7565937343d1b9fa36a0d169e501326923d1 | refs/heads/master | 2020-06-11T06:17:32.586521 | 2016-12-06T15:30:42 | 2016-12-06T15:30:42 | 75,748,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,397 | java | package man.ac.uk;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.semanticweb.HermiT.Reasoner.ReasonerFactory;
import org.semanticweb.owl.explanation.api.Explanation;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.AxiomType;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLAnnotationProperty;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import iso.checker.PutativeStrictIso;
public class Test {
public Test() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) throws OWLOntologyCreationException, IOException {
// TODO Auto-generated method stub
/**
File dir = new File("/home/michael/experiments/ore/ax_swallow_result2/dis");
File dir2= new File("/home/michael/experiments/ore/ax_swallow_result2/just");
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
OWLDataFactory df = ontoman.getOWLDataFactory();
//OWLAnnotationProperty name = df.getOWLAnnotationProperty(IRI.create("http://owl.cs.manchester.ac.uk/reasoner_verification/vocabulary#generating_ontology"));
Set<OWLAxiom> disset = new HashSet<OWLAxiom>();
for(File o:dir.listFiles())
{
OWLOntology ont = ontoman.loadOntologyFromOntologyDocument(o);
for(OWLAxiom ax:ont.getAxioms())
{
disset.add(ax.getAxiomWithoutAnnotations());
}
ontoman.removeOntology(ont);
}
File csv = new File("/home/michael/experiments/ore/ax_swallow_result2/axiom_swallow.csv");
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
pw.println("just,axiom_swallow");
for(File j:dir2.listFiles())
{
Boolean cond = false;
OWLOntology just = ontoman.loadOntologyFromOntologyDocument(j);
for(OWLAxiom ax:just.getAxioms())
{
if(disset.contains(ax))
{
cond = true;
}
}
pw.println(j.getAbsolutePath()+","+cond);
ontoman.removeOntology(just);
}
pw.close();
**/
//Code to find if MORe ever disagrees with hermit.
/**
File dir = new File("/home/michael/experiments/ore/dis/sj_out/");
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
ArrayList<String> found = new ArrayList<>();
for(File fl:dir.listFiles())
{
OWLOntology disagreement = ontoman.loadOntologyFromOntologyDocument(fl);
ArrayList<String> f = new ArrayList<>();
for(OWLAxiom ax:disagreement.getAxioms())
{
//Does hermit1, hermit 2 or more occured in axiom?
Boolean cond1 = false;
Boolean cond2 = false;
Boolean cond3 = false;
//Has at least one occured in axiom?
Boolean cond4 = false;
for(OWLAnnotation anno:ax.getAnnotations())
{
if(anno.toString().contains("owl_hermit-linux"))
{
cond1 = true;
cond4 = true;
}
else if(anno.toString().contains("owl_hermit-owlapiv4"))
{
cond2 = true;
cond4 = true;
}
else if(anno.toString().contains("MOReHermiT-linux"))
{
cond3 = true;
cond4 = true;
}
}
if((!(cond1 && cond3) || !(cond2 && cond3)) && cond4)
{
found.add(fl.getName() + "," + ax.getAxiomWithoutAnnotations().toString());
}
}
ontoman.removeOntology(disagreement);
}
File csv = new File("/home/michael/experiments/ore/hermit_vs_more_diff_axsw.csv");
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
pw.println("ontology,entailment");
for(String line:found)
{
pw.println(line);
}
pw.close();
**/
//Code to find if versions of the same reasoner (hermit) ever disagree or fail.
File dir = new File("/home/michael/experiments/ore/dis/sj_out/");
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
ArrayList<String> found = new ArrayList<>();
Set<String> ont = new HashSet<>();
for(File fl:dir.listFiles())
{
OWLOntology disagreement = ontoman.loadOntologyFromOntologyDocument(fl);
for(OWLAxiom ax:disagreement.getAxioms())
{
//Does hermit1 or hermit 2 occur in axiom?
Boolean cond1 = false;
Boolean cond2 = false;
//Has at least one occured in axiom?
Boolean cond3 = false;
for(OWLAnnotation anno:ax.getAnnotations())
{
if(anno.toString().contains("owl_fact++"))
{
cond1 = true;
cond3 = true;
}
else if(anno.toString().contains("chainsaw-linux"))
{
cond2 = true;
cond3 = true;
}
}
if(!(cond1 && cond2) && cond3)
{
found.add(fl.getName() + "," + ax.getAxiomWithoutAnnotations().toString());
ont.add(fl.getName());
}
}
ontoman.removeOntology(disagreement);
}
for(String s:ont)
{
System.out.println(s);
}
File csv = new File("/home/michael/experiments/ore/chainsaw_vs_fact_diff_axsw.csv");
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
pw.println("ontology,entailment");
for(String line:found)
{
pw.println(line);
}
pw.close();
/**
File dir = new File("/home/michael/experiments/ore/ax_swallow_result2/non-axswallow_cases");
File dir2 = new File("/home/michael/experiments/ore/ax_swallow_result2/non-axswallow_corpus");
Isomatch ism = new Isomatch();
ism.sortJusts(dir, dir2);
/**
File dir = new File("/home/michael/ore_inferred_ch/reorganized-results/ore2015-classification-dl-linux/disagreement/");
Isomatch ism = new Isomatch();
ArrayList<String> dir1List = ism.makeList(dir);
OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
File csv = new File("/home/michael/experiments/ore/problem_files.csv");
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
pw.println("inf_ch,status");
OWLReasonerFactory hermitfac = new ReasonerFactory();
for(String s:dir1List)
{
File ch = new File(s);
if(ch.length() != 0)
{
OWLOntology ont = ontologyManager.loadOntologyFromOntologyDocument(ch);
if(!ont.isEmpty())
{
OWLReasoner r = hermitfac.createNonBufferingReasoner(ont);
if(r.isConsistent())
{
pw.println(s + ",normal");
}
else
{
pw.println(s + ",inconsistent");
}
r.dispose();
}
else
{
pw.println(s + ",empty");
}
ontologyManager.removeOntology(ont);
}
else
{
pw.println(s + ",blank");
}
}
pw.close();
/**
File dir = new File("/home/michael/experiments/iso_rerun/overall/");
File dir2 = new File("/home/michael/corpus/overall/");
File csv = new File("/home/michael/experiments/iso_rerun/data/equivalence_classes.csv");
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
pw.println("equiv_class,members,size");
Isomatch ism = new Isomatch();
Isosearch iso = new Isosearch();
CorpusSorter cs = new CorpusSorter();
ArrayList<String> dir1List = ism.makeList(dir);
for(String s:dir1List)
{
File ont = new File(s);
OWLOntology onto = ontoman.loadOntologyFromOntologyDocument(ont);
Set<OWLAxiom> set = new HashSet<OWLAxiom>();
for(OWLAxiom ax:onto.getAxioms())
{
if(ax.isLogicalAxiom() && !ax.isOfType(AxiomType.DECLARATION))
{
set.add(ax);
}
}
Explanation<OWLAxiom> exp = new Explanation<OWLAxiom>(cs.entailSearch(onto),set);
ontoman.removeOntology(onto);
ArrayList<String> found = iso.dirSearch(exp, dir2);
String line = s + ",";
for(String f:found)
{
line = line + f + ";";
}
line = line + "," + found.size();
pw.println(line);
}
pw.close();
/**
Isomatch ism = new Isomatch();
Isosearch iso = new Isosearch();
CorpusSorter cs = new CorpusSorter();
File dir = new File("/home/michael/corpus/overall/");
File dir2 = new File("/home/michael/experiments/iso_rerun/overall/");
File csv = new File("/home/michael/experiments/iso_rerun/data/timing_overall.csv");
String ont = "overall";
long start = System.nanoTime();
ism.sortJusts(dir, dir2);
long end = System.nanoTime();
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
//pw.println("ontology,time_to_sort");
pw.println(ont + "," + (end - start));
pw.close();
/**
ArrayList<String> dir1List = ism.makeList(dir);
ArrayList<String> dir2List = ism.makeList(dir2);
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
Map<String,ArrayList<String>> equ = new HashMap<String,ArrayList<String>>();
for(String s:dir1List)
{
File ont = new File(s);
OWLOntology onto = ontoman.loadOntologyFromOntologyDocument(ont);
Set<OWLAxiom> set = new HashSet<OWLAxiom>();
for(OWLAxiom ax:onto.getAxioms())
{
if(ax.isLogicalAxiom() && !ax.isOfType(AxiomType.DECLARATION))
{
set.add(ax);
}
}
Explanation<OWLAxiom> exp = new Explanation<OWLAxiom>(cs.entailSearch(onto),set);
ArrayList<String> found = iso.dirSearch(exp, dir2);
equ.put(s, found);
ontoman.removeOntology(onto);
}
File csv = new File("/home/michael/experiments/iswc_repeat/iwsc_repeat_sept/corpus/matches.csv");
File csv2 = new File("/home/michael/experiments/iswc_repeat/iwsc_repeat_sept/corpus/nomatches.csv");
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
PrintWriter pw2 = new PrintWriter(new BufferedWriter(new FileWriter(csv2)));
pw.println("eq_in_orig,eq_in_rerun");
pw2.println("no_match");
for(String s:equ.keySet())
{
String line = s + ",";
for(String f:equ.get(s))
{
line = line + f + ";";
}
if(equ.get(s).isEmpty())
{
pw2.println(s);
}
pw.println(line);
}
pw.close();
pw2.close();
/**
File dir = new File("/home/michael/ore_dis_onto/");
Map<String,ArrayList<String>> repeats = new HashMap<String,ArrayList<String>>();
ArrayList<String> arraylist = new ArrayList<String>();
for(File fl:dir.listFiles())
{
if(fl.toString().contains(".owl"))
{
arraylist.add(fl.toString());
}
}
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
OWLOntologyManager ontoman2 = OWLManager.createOWLOntologyManager();
while(!arraylist.isEmpty())
{
File fl = new File(arraylist.get(0));
String repeat = arraylist.get(0);
ArrayList<String> found = new ArrayList<String>();
arraylist.remove(0);
OWLOntology check = ontoman.loadOntologyFromOntologyDocument(fl);
for(String s:arraylist)
{
File fl2 = new File(s);
OWLOntology ont = ontoman2.loadOntologyFromOntologyDocument(fl2);
if(check.equals(ont))
{
found.add(s);
}
ontoman2.removeOntology(ont);
}
arraylist.removeAll(found);
repeats.put(repeat, found);
ontoman.removeOntology(check);
}
File csv = new File("/home/michael/experiments/ore/repeats/repeat_ontology.csv");
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
pw.println("name,repeats");
for(String name:repeats.keySet())
{
String found = "";
for(String s:repeats.get(name))
{
found = found + s + ";";
}
pw.println(name + "," + found);
}
**/
/**
File fl1 = new File("/home/michael/experiments/iswc_repeat/iwsc_repeat_sept/justs/dikb/just_dikb.drug-interaction-knowledge-base-ontology.3.orig.owl.xml_jfact_463929380.owl");
File fl2 = new File("/home/michael/experiments/iswc_repeat/iwsc_repeat_sept/justs/dikb/just_dikb.drug-interaction-knowledge-base-ontology.3.orig.owl.xml_jfact_767875311.owl");
OWLReasonerFactory hermitfac = new ReasonerFactory();
PutativeStrictIso e2si = new PutativeStrictIso(hermitfac);
CorpusSorter cs = new CorpusSorter();
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
OWLOntology ont1 = ontoman.loadOntologyFromOntologyDocument(fl1);
Set<OWLAxiom> set1 = new HashSet<OWLAxiom>();
for(OWLAxiom ax:ont1.getAxioms())
{
if(ax.isLogicalAxiom())
{
if(!ax.isOfType(AxiomType.DECLARATION))
{
set1.add(ax);
}
}
}
Explanation<OWLAxiom> exp1 = new Explanation<OWLAxiom>(cs.entailSearch(ont1),set1);
ontoman.removeOntology(ont1);
OWLOntology ont2 = ontoman.loadOntologyFromOntologyDocument(fl1);
Set<OWLAxiom> set2 = new HashSet<OWLAxiom>();
for(OWLAxiom ax:ont2.getAxioms())
{
if(ax.isLogicalAxiom())
{
if(!ax.isOfType(AxiomType.DECLARATION))
{
set2.add(ax);
}
}
}
Explanation<OWLAxiom> exp2 = new Explanation<OWLAxiom>(cs.entailSearch(ont2),set2);
System.out.println(e2si.equivalent(exp1, exp2));
**/
/**
*
*
*
File dir = new File(args[0]);
File dir2 = new File(args[1]);
File csv = new File(args[2]);
OWLReasonerFactory hermitfac = new ReasonerFactory();
ExplanationGeneratorFactory<OWLAxiom> genFac = ExplanationManager
.createLaconicExplanationGeneratorFactory(hermitfac);
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
CorpusSorter cs = new CorpusSorter();
for(File fl:dir.listFiles())
{
OWLOntology o1 = ontoman.loadOntologyFromOntologyDocument(fl);
ExplanationGenerator<OWLAxiom> leg = genFac.createExplanationGenerator(o1);
Set<Explanation<OWLAxiom>> found = leg.getExplanations(cs.entailSearch(o1));
System.out.println(found);
}
**/
/**
File dir = new File(args[0]);
File dir2 = new File(args[1]);
File csv = new File(args[2]);
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
Set<OWLAxiom> checkSet = new HashSet<OWLAxiom>();
for(File fl:dir.listFiles())
{
System.out.println(fl.getName());
OWLOntology o1 = ontoman.loadOntologyFromOntologyDocument(fl);
for(OWLAxiom ax:o1.getLogicalAxioms())
{
checkSet.add(ax.getAxiomWithoutAnnotations());
}
ontoman.removeOntology(o1);
}
ArrayList<String> list = new ArrayList<String>();
for(File fl:dir2.listFiles())
{
OWLOntology o2 = ontoman.loadOntologyFromOntologyDocument(fl);
Boolean cond = false;
for(OWLAxiom ax:o2.getAxioms())
{
if(checkSet.contains(ax.getAxiomWithoutAnnotations()))
{
cond = true;
}
}
if(!cond)
{
list.add(fl.getName());
}
ontoman.removeOntology(o2);
}
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
pw.println("just_without_axiom_swallowing");
for(String s:list)
{
pw.println(s);
}
**/
/**
CorpusSorter cs = new CorpusSorter();
File dir = new File("/home/michael/experiments/iswc_repeat/iwsc_repeat_sept/justs/");
File dir2 = new File("/home/michael/experiments/iswc_repeat/iwsc_repeat_sept/corpus/overall2/");
Isomatch ism = new Isomatch();
ism.sortJusts(dir, dir2);
/**
OWLReasonerFactory hermitfac = new ReasonerFactory();
Ext2StrIso e2si = new Ext2StrIso(hermitfac);
CorpusSorter cs = new CorpusSorter();
File dir = new File(args[0]);
File dir2 = new File(args[1]);
File csv = new File(args[2]);
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
OWLOntology just = ontoman.loadOntologyFromOntologyDocument(file);
Set<OWLAxiom> set1 = new HashSet<OWLAxiom>();
for(OWLAxiom ax:just.getAxioms())
{
if(ax.isLogicalAxiom())
{
set1.add(ax);
}
}
OWLAxiom ent1 = cs.entailSearch(just);
ontoman.removeOntology(just);
OWLOntology just2 = ontoman.loadOntologyFromOntologyDocument(file2);
Set<OWLAxiom> set2 = new HashSet<OWLAxiom>();
for(OWLAxiom ax:just2.getAxioms())
{
if(ax.isLogicalAxiom())
{
set2.add(ax);
}
}
OWLAxiom ent2 = cs.entailSearch(just2);
ontoman.removeOntology(just2);
Explanation<OWLAxiom> exp1 = new Explanation<OWLAxiom>(ent1,set1);
Explanation<OWLAxiom> exp2 = new Explanation<OWLAxiom>(ent2,set2);
/**
OWLReasonerFactory hermitfac = new ReasonerFactory();
Ext2StrIso e2si = new Ext2StrIso(hermitfac);
CorpusSorter cs = new CorpusSorter();
File dir = new File(args[0]);
File dir2 = new File(args[1]);
File csv = new File(args[2]);
File missing_equv_csv = new File(args[3]);
File no_equv_csv = new File(args[4]);
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(csv)));
pw.println("equivalence_class,members_in_corpus");
OWLOntologyManager ontoman = OWLManager.createOWLOntologyManager();
ArrayList<String> matchedDir2Files = new ArrayList<String>();
ArrayList<String> noMatchDir = new ArrayList<String>();
ArrayList<String> noMatchDir2 = new ArrayList<String>();
for(File fl:dir.listFiles())
{
String list = fl.getName() + ",";
OWLOntology o1 = ontoman.loadOntologyFromOntologyDocument(fl);
Set<OWLAxiom> set1 = new HashSet<OWLAxiom>();
for(OWLAxiom ax:o1.getLogicalAxioms())
{
set1.add(ax);
}
System.out.println("ENTAIL S: " + fl.getName());
Explanation<OWLAxiom> e1 = new Explanation<OWLAxiom>(cs.entailSearch(o1),set1);
ontoman.removeOntology(o1);
for(File fl2:dir2.listFiles())
{
OWLOntology o2 = ontoman.loadOntologyFromOntologyDocument(fl2);
Set<OWLAxiom> set2 = new HashSet<OWLAxiom>();
for(OWLAxiom ax:o2.getLogicalAxioms())
{
set2.add(ax);
}
System.out.println("ENTAIL S: " + fl2.getName());
Explanation<OWLAxiom> e2 = new Explanation<OWLAxiom>(cs.entailSearch(o2),set2);
ontoman.removeOntology(o2);
if(e2si.equivalent(e1, e2))
{
list = list + fl2.getName() + ";";
matchedDir2Files.add(fl2.getName());
}
}
pw.println(list);
if(list.equals(fl.getName() + ","))
{
noMatchDir.add(fl.getName());
}
}
pw.flush();
for(File fl2:dir2.listFiles())
{
if(!matchedDir2Files.contains(fl2.getName()))
{
noMatchDir2.add(fl2.getName());
}
}
PrintWriter pw2 = new PrintWriter(new BufferedWriter(new FileWriter(missing_equv_csv)));
for(String s:noMatchDir)
{
pw2.println(s);
}
pw2.flush();
PrintWriter pw3 = new PrintWriter(new BufferedWriter(new FileWriter(no_equv_csv)));
for(String s:noMatchDir)
{
pw3.println(s);
}
pw3.flush();
**/
}
}
| [
"[email protected]"
] | |
af33e5f845b50168eceb7ec5e119ca84b9bd65c2 | ad41adc78d66f220b710793c2f4d192063e22b9f | /server/src/main/java/com/restapi/server/controller/MemberController.java | 2cfd56b7c4446e0595badc70d58444527b7ba63c | [] | no_license | ZoologicalFooding/ZoologicalFooding-main | 5dc975d7c88f5e0bdd82e45a166fbb075c1198f8 | f7bd681e1bfdae09f15db24b59f1fbe36e3931ed | refs/heads/master | 2020-12-14T13:51:22.533215 | 2020-04-23T15:21:07 | 2020-04-23T15:21:07 | 234,763,618 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,110 | java | package com.restapi.server.controller;
import com.restapi.server.model.Member;
import com.restapi.server.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.*;
import java.util.Random;
@RestController
@CrossOrigin(origins = "*")
public class MemberController {
private final MemberService memberService;
@Autowired
private JavaMailSender javaMailSender;
@Autowired
public MemberController(MemberService memberService) {
this.memberService = memberService;
}
@RequestMapping(value = "/members",method = RequestMethod.GET)
public ResponseEntity<Iterable<Member>> getMembers() {
Iterable<Member> memberList = memberService.getAllMembers();
return ResponseEntity.ok(memberList);
}
@RequestMapping(value = "/member/{id}",method = RequestMethod.GET)
public ResponseEntity<Member> getMember(@PathVariable int id) {
Member memb = memberService.getMemberById(id);
return ResponseEntity.ok(memb);
}
@RequestMapping(value = "/addMember",method = RequestMethod.POST)
public ResponseEntity<Member> addMember(@RequestBody Member member) {
Random rand = new Random();
int rand_int = rand.nextInt(1000);
member.setPointCode(rand_int+"");
member.setPointStr("0");
memberService.addMember(member);
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(member.getEmail());
message.setSubject(member.getFirst_name()+" Code");
message.setText("Hi! "+member.getFirst_name()+", you can use this code to earn points ->" +member.getMemberID());
javaMailSender.send(message);
return ResponseEntity.ok(member);
}
@RequestMapping(value = "/deleteMember/{id}", method = RequestMethod.DELETE)
public ResponseEntity<Member> deleteMember(@PathVariable int id) {
Member mem = memberService.getMemberById(id);
memberService.deleteMemberById(id);
return ResponseEntity.ok(mem);
}
@RequestMapping(value = "/editMember/{id}", method = RequestMethod.PUT)
public ResponseEntity<Member> updateMember(@RequestBody(required = false) Member mem, @PathVariable int id) {
memberService.updateMemberById(mem,id);
return ResponseEntity.ok(mem);
}
@RequestMapping(value = "/editPoint/{id}", method = RequestMethod.PUT)
public ResponseEntity<Member> updatePoint(@RequestBody(required = false) Member mem, @PathVariable int id) {
Member member = memberService.getMemberById(id);
int point = Integer.parseInt(member.getPointStr());
point = point + 50;
member.setPointStr(point+"");
memberService.addMember(member);
return ResponseEntity.ok(member);
}
@RequestMapping(value = "/deleteAllMembers", method = RequestMethod.DELETE)
public ResponseEntity<String> deleteAllMembers(){
memberService.deleteAllMembers();
return ResponseEntity.ok("Delete All Members!");
}
// this method is set to be deleted later, please ignore this method!!!!!!!!!!!!!!!!!
/* @RequestMapping(value = "/denemeKrediKarti", method = RequestMethod.POST)
public ResponseEntity<String> krediKarti(@RequestBody Member member){
CreditCard cr1 = new CreditCard();
CreditCard cr2 = new CreditCard();
cr1.setCardNumber(1212131);
cr1.setCvvNumber(2323232);
cr1.setExpiration_date(232323);
cr1.setFullName("denemeilk");
cr2.setCvvNumber(2222222);
cr2.setFullName("denemeIKi");
cr2.setExpiration_date(2324242);
cr2.setCardNumber(13445677);
List<CreditCard> tempList = new ArrayList<>();
tempList.add(cr1);
tempList.add(cr2);
member.setCreditCardList(tempList);
memberService.addMember(member);
return ResponseEntity.ok("Delete All Members!");
}*/
}
| [
"[email protected]"
] | |
45833160b4aa5ca8da1ee27b26de820197e4382b | 51e07ea7f692d6a2c54850b73e2775517f36c2ce | /build/generated/src/org/apache/jsp/registrarTv_jsp.java | 4459ca06e2d4e768e5ac36093fb627d6c74ed841 | [] | no_license | yohan1152/programacion-avanzada-taller-vehiculos | d85b8b1f1cf5e8e14c8a65768f75252406ef27b7 | 7a86de24cac8fbb7dc05f07bd56603ed9fb06c50 | refs/heads/master | 2021-01-26T09:04:43.809571 | 2020-03-16T02:50:42 | 2020-03-16T02:50:42 | 243,396,986 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 65,169 | java | package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class registrarTv_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List<String> _jspx_dependants;
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public java.util.List<String> getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html lang=\"es\">\n");
out.write("\t<head>\n");
out.write("\t\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\" />\n");
out.write("\t\t<meta charset=\"utf-8\" />\n");
out.write("\t\t<title>Sowil Company</title>\n");
out.write("\n");
out.write("\t\t<meta name=\"description\" content=\"Wilson Castro Gil\" />\n");
out.write("\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0\" />\n");
out.write("\n");
out.write("\t\t<!-- bootstrap & fontawesome -->\n");
out.write("\t\t<link rel=\"stylesheet\" href=\"assets/css/bootstrap.min.css\" />\n");
out.write("\t\t<link rel=\"stylesheet\" href=\"assets/font-awesome/4.5.0/css/font-awesome.min.css\" />\n");
out.write("\n");
out.write("\t\t<!-- page specific plugin styles -->\n");
out.write("\n");
out.write("\t\t<!-- text fonts -->\n");
out.write("\t\t<link rel=\"stylesheet\" href=\"assets/css/fonts.googleapis.com.css\" />\n");
out.write("\n");
out.write("\t\t<!-- ace styles -->\n");
out.write("\t\t<link rel=\"stylesheet\" href=\"assets/css/ace.min.css\" class=\"ace-main-stylesheet\" id=\"main-ace-style\" />\n");
out.write("\n");
out.write("\t\t<!--[if lte IE 9]>\n");
out.write("\t\t\t<link rel=\"stylesheet\" href=\"assets/css/ace-part2.min.css\" class=\"ace-main-stylesheet\" />\n");
out.write("\t\t<![endif]-->\n");
out.write("\t\t<link rel=\"stylesheet\" href=\"assets/css/ace-skins.min.css\" />\n");
out.write("\t\t<link rel=\"stylesheet\" href=\"assets/css/ace-rtl.min.css\" />\n");
out.write("\n");
out.write("\t\t<!--[if lte IE 9]>\n");
out.write("\t\t <link rel=\"stylesheet\" href=\"assets/css/ace-ie.min.css\" />\n");
out.write("\t\t<![endif]-->\n");
out.write("\n");
out.write("\t\t<!-- inline styles related to this page -->\n");
out.write("\n");
out.write("\t\t<!-- ace settings handler -->\n");
out.write("\t\t<script src=\"assets/js/ace-extra.min.js\"></script>\n");
out.write("\n");
out.write("\t\t<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->\n");
out.write("\n");
out.write("\t\t<!--[if lte IE 8]>\n");
out.write("\t\t<script src=\"assets/js/html5shiv.min.js\"></script>\n");
out.write("\t\t<script src=\"assets/js/respond.min.js\"></script>\n");
out.write("\t\t<![endif]-->\n");
out.write("\t</head>\n");
out.write("\n");
out.write("\t<body class=\"no-skin\">\n");
out.write("\t\t<div id=\"navbar\" class=\"navbar navbar-default ace-save-state\">\n");
out.write("\t\t\t<div class=\"navbar-container ace-save-state\" id=\"navbar-container\">\n");
out.write("\t\t\t\t<button type=\"button\" class=\"navbar-toggle menu-toggler pull-left\" id=\"menu-toggler\" data-target=\"#sidebar\">\n");
out.write("\t\t\t\t\t<span class=\"sr-only\">Toggle sidebar</span>\n");
out.write("\n");
out.write("\t\t\t\t\t<span class=\"icon-bar\"></span>\n");
out.write("\n");
out.write("\t\t\t\t\t<span class=\"icon-bar\"></span>\n");
out.write("\n");
out.write("\t\t\t\t\t<span class=\"icon-bar\"></span>\n");
out.write("\t\t\t\t</button>\n");
out.write("\n");
out.write("\t\t\t\t<div class=\"navbar-header pull-left\">\n");
out.write("\t\t\t\t\t<a href=\"index.jsp\" class=\"navbar-brand\">\n");
out.write("\t\t\t\t\t\t<small>\n");
out.write("\t\t\t\t\t\t\t<i class=\"fa fa-book\"></i>\n");
out.write("\t\t\t\t\t\t\tGestión de Vehículos\n");
out.write("\t\t\t\t\t\t</small>\n");
out.write("\t\t\t\t\t</a>\n");
out.write("\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t<div class=\"navbar-buttons navbar-header pull-right\" role=\"navigation\">\n");
out.write("\t\t\t\t\t<ul class=\"nav ace-nav\">\n");
out.write("\t\t\t\t\t\t<li class=\"grey dropdown-modal\">\n");
out.write("\t\t\t\t\t\t\t<a data-toggle=\"dropdown\" class=\"dropdown-toggle\" href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-tasks\"></i>\n");
out.write("\t\t\t\t\t\t\t\t<span class=\"badge badge-grey\">4</span>\n");
out.write("\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t<ul class=\"dropdown-menu-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close\">\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"dropdown-header\">\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-check\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t4 Tasks to complete\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"dropdown-content\">\n");
out.write("\t\t\t\t\t\t\t\t\t<ul class=\"dropdown-menu dropdown-navbar\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-left\">Software Update</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-right\">65%</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"progress progress-mini\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<div style=\"width:65%\" class=\"progress-bar\"></div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-left\">Hardware Upgrade</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-right\">35%</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"progress progress-mini\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<div style=\"width:35%\" class=\"progress-bar progress-bar-danger\"></div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-left\">Unit Testing</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-right\">15%</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"progress progress-mini\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<div style=\"width:15%\" class=\"progress-bar progress-bar-warning\"></div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-left\">Bug Fixes</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-right\">90%</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"progress progress-mini progress-striped active\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<div style=\"width:90%\" class=\"progress-bar progress-bar-success\"></div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"dropdown-footer\">\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\tSee tasks with details\n");
out.write("\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-arrow-right\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<li class=\"purple dropdown-modal\">\n");
out.write("\t\t\t\t\t\t\t<a data-toggle=\"dropdown\" class=\"dropdown-toggle\" href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-bell icon-animated-bell\"></i>\n");
out.write("\t\t\t\t\t\t\t\t<span class=\"badge badge-important\">8</span>\n");
out.write("\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t<ul class=\"dropdown-menu-right dropdown-navbar navbar-pink dropdown-menu dropdown-caret dropdown-close\">\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"dropdown-header\">\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-exclamation-triangle\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t8 Notifications\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"dropdown-content\">\n");
out.write("\t\t\t\t\t\t\t\t\t<ul class=\"dropdown-menu dropdown-navbar navbar-pink\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-left\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"btn btn-xs no-hover btn-pink fa fa-comment\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\tNew Comments\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-right badge badge-info\">+12</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"btn btn-xs btn-primary fa fa-user\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\tBob just signed up as an editor ...\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-left\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"btn btn-xs no-hover btn-success fa fa-shopping-cart\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\tNew Orders\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-right badge badge-success\">+8</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-left\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"btn btn-xs no-hover btn-info fa fa-twitter\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\tFollowers\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"pull-right badge badge-info\">+11</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"dropdown-footer\">\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\tSee all notifications\n");
out.write("\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-arrow-right\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<li class=\"green dropdown-modal\">\n");
out.write("\t\t\t\t\t\t\t<a data-toggle=\"dropdown\" class=\"dropdown-toggle\" href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-envelope icon-animated-vertical\"></i>\n");
out.write("\t\t\t\t\t\t\t\t<span class=\"badge badge-success\">5</span>\n");
out.write("\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t<ul class=\"dropdown-menu-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close\">\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"dropdown-header\">\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-envelope-o\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t5 Messages\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"dropdown-content\">\n");
out.write("\t\t\t\t\t\t\t\t\t<ul class=\"dropdown-menu dropdown-navbar\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"assets/images/avatars/avatar.png\" class=\"msg-photo\" alt=\"Alex's Avatar\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-body\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-title\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"blue\">Alex:</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\tCiao sociis natoque penatibus et auctor ...\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-time\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-clock-o\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span>a moment ago</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"assets/images/avatars/avatar3.png\" class=\"msg-photo\" alt=\"Susan's Avatar\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-body\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-title\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"blue\">Susan:</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\tVestibulum id ligula porta felis euismod ...\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-time\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-clock-o\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span>20 minutes ago</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"assets/images/avatars/avatar4.png\" class=\"msg-photo\" alt=\"Bob's Avatar\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-body\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-title\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"blue\">Bob:</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\tNullam quis risus eget urna mollis ornare ...\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-time\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-clock-o\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span>3:15 pm</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"assets/images/avatars/avatar2.png\" class=\"msg-photo\" alt=\"Kate's Avatar\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-body\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-title\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"blue\">Kate:</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\tCiao sociis natoque eget urna mollis ornare ...\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-time\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-clock-o\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span>1:33 pm</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"clearfix\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"assets/images/avatars/avatar5.png\" class=\"msg-photo\" alt=\"Fred's Avatar\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-body\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-title\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"blue\">Fred:</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\tVestibulum id penatibus et auctor ...\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"msg-time\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-clock-o\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span>10:09 am</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"dropdown-footer\">\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"inbox.html\">\n");
out.write("\t\t\t\t\t\t\t\t\t\tSee all messages\n");
out.write("\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-arrow-right\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<li class=\"light-blue dropdown-modal\">\n");
out.write("\t\t\t\t\t\t\t<a data-toggle=\"dropdown\" href=\"#\" class=\"dropdown-toggle\">\n");
out.write("\t\t\t\t\t\t\t\t<img class=\"nav-user-photo\" src=\"assets/images/avatars/user.jpg\" alt=\"Wilcas Photo\" />\n");
out.write("\t\t\t\t\t\t\t\t<span class=\"user-info\">\n");
out.write("\t\t\t\t\t\t\t\t\t<small>Welcome,</small>\n");
out.write("\t\t\t\t\t\t\t\t\tWilcas\n");
out.write("\t\t\t\t\t\t\t\t</span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-caret-down\"></i>\n");
out.write("\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t<ul class=\"user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close\">\n");
out.write("\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-cog\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\tSettings\n");
out.write("\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"profile.html\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-user\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\tProfile\n");
out.write("\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<li class=\"divider\"></li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-power-off\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\tLogout\n");
out.write("\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t</div>\n");
out.write("\t\t\t</div><!-- /.navbar-container -->\n");
out.write("\t\t</div>\n");
out.write("\n");
out.write("\t\t<div class=\"main-container ace-save-state\" id=\"main-container\">\n");
out.write("\t\t\t<script type=\"text/javascript\">\n");
out.write("\t\t\t\ttry{ace.settings.loadState('main-container')}catch(e){}\n");
out.write("\t\t\t</script>\n");
out.write("\n");
out.write("\t\t\t<div id=\"sidebar\" class=\"sidebar responsive ace-save-state\">\n");
out.write("\t\t\t\t<script type=\"text/javascript\">\n");
out.write("\t\t\t\t\ttry{ace.settings.loadState('sidebar')}catch(e){}\n");
out.write("\t\t\t\t</script>\n");
out.write("\n");
out.write("\t\t\t\t<div class=\"sidebar-shortcuts\" id=\"sidebar-shortcuts\">\n");
out.write("\t\t\t\t\t<div class=\"sidebar-shortcuts-large\" id=\"sidebar-shortcuts-large\">\n");
out.write("\t\t\t\t\t\t<button class=\"btn btn-success\">\n");
out.write("\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-signal\"></i>\n");
out.write("\t\t\t\t\t\t</button>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<button class=\"btn btn-info\">\n");
out.write("\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-pencil\"></i>\n");
out.write("\t\t\t\t\t\t</button>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<button class=\"btn btn-warning\">\n");
out.write("\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-users\"></i>\n");
out.write("\t\t\t\t\t\t</button>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<button class=\"btn btn-danger\">\n");
out.write("\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-cogs\"></i>\n");
out.write("\t\t\t\t\t\t</button>\n");
out.write("\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t<div class=\"sidebar-shortcuts-mini\" id=\"sidebar-shortcuts-mini\">\n");
out.write("\t\t\t\t\t\t<span class=\"btn btn-success\"></span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<span class=\"btn btn-info\"></span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<span class=\"btn btn-warning\"></span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<span class=\"btn btn-danger\"></span>\n");
out.write("\t\t\t\t\t</div>\n");
out.write("\t\t\t\t</div><!-- /.sidebar-shortcuts -->\n");
out.write("\n");
out.write("\t\t\t\t<ul class=\"nav nav-list\">\n");
out.write("\t\t\t\t\t<li class=\"\">\n");
out.write("\t\t\t\t\t\t<a href=\"index.jsp\">\n");
out.write("\t\t\t\t\t\t\t<i class=\"menu-icon fa fa-tachometer\"></i>\n");
out.write("\t\t\t\t\t\t\t<span class=\"menu-text\"> Inicio </span>\n");
out.write("\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<b class=\"arrow\"></b>\n");
out.write("\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t<li class=\"active open\">\n");
out.write("\t\t\t\t\t\t<a href=\"#\" class=\"dropdown-toggle\">\n");
out.write("\t\t\t\t\t\t\t<i class=\"menu-icon fa fa-book\"></i>\n");
out.write("\t\t\t\t\t\t\t<span class=\"menu-text\"> Gestionar Vehículos </span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t<b class=\"arrow fa fa-angle-down\"></b>\n");
out.write("\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<b class=\"arrow\"></b>\n");
out.write("\n");
out.write("\t\t\t\t\t\t<ul class=\"submenu\">\n");
out.write("\t\t\t\t\t\t\t<li class=\"active\">\n");
out.write("\t\t\t\t\t\t\t\t<a href=\"index.jsp\">\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"menu-icon fa fa-caret-right\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\tLista de Vehículos\n");
out.write("\t\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<b class=\"arrow\"></b>\n");
out.write("\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t<li class=\"\">\n");
out.write("\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"menu-icon fa fa-caret-right\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\tRegistrar Vehículo\n");
out.write("\t\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<b class=\"arrow\"></b>\n");
out.write("\t\t\t\t\t\t\t</li>\n");
out.write(" <li class=\"\">\n");
out.write("\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"menu-icon fa fa-caret-right\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\tRegistrar Tipo Vehículo\n");
out.write("\t\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<b class=\"arrow\"></b>\n");
out.write("\t\t\t\t\t\t\t</li>\n");
out.write(" <!-- <li class=\"\">\n");
out.write("\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"menu-icon fa fa-caret-right\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\tRegistrar Rutas\n");
out.write("\t\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<b class=\"arrow\"></b>\n");
out.write("\t\t\t\t\t\t\t</li> -->\n");
out.write("\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t</ul><!-- /.nav-list -->\n");
out.write("\n");
out.write("\t\t\t\t<div class=\"sidebar-toggle sidebar-collapse\" id=\"sidebar-collapse\">\n");
out.write("\t\t\t\t\t<i id=\"sidebar-toggle-icon\" class=\"ace-icon fa fa-angle-double-left ace-save-state\" data-icon1=\"ace-icon fa fa-angle-double-left\" data-icon2=\"ace-icon fa fa-angle-double-right\"></i>\n");
out.write("\t\t\t\t</div>\n");
out.write("\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t<div class=\"main-content\">\n");
out.write("\t\t\t\t<div class=\"main-content-inner\">\n");
out.write("\t\t\t\t\t<div class=\"breadcrumbs ace-save-state\" id=\"breadcrumbs\">\n");
out.write("\t\t\t\t\t\t<ul class=\"breadcrumb\">\n");
out.write("\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-home home-icon\"></i>\n");
out.write("\t\t\t\t\t\t\t\t<a href=\"#\">Inicio</a>\n");
out.write("\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\n");
out.write("\t\t\t\t\t\t</ul><!-- /.breadcrumb -->\n");
out.write("\n");
out.write("\t\t\t\t\t\t<div class=\"nav-search\" id=\"nav-search\">\n");
out.write("\t\t\t\t\t\t\t<form class=\"form-search\">\n");
out.write("\t\t\t\t\t\t\t\t<span class=\"input-icon\">\n");
out.write("\t\t\t\t\t\t\t\t\t<input type=\"text\" placeholder=\"Search ...\" class=\"nav-search-input\" id=\"nav-search-input\" autocomplete=\"off\" />\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-search nav-search-icon\"></i>\n");
out.write("\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t</form>\n");
out.write("\t\t\t\t\t\t</div><!-- /.nav-search -->\n");
out.write("\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t<div class=\"page-content\">\n");
out.write("\t\t\t\t\t\t<div class=\"ace-settings-container\" id=\"ace-settings-container\">\n");
out.write("\t\t\t\t\t\t\t<div class=\"btn btn-app btn-xs btn-warning ace-settings-btn\" id=\"ace-settings-btn\">\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-cog bigger-130\"></i>\n");
out.write("\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t<div class=\"ace-settings-box clearfix\" id=\"ace-settings-box\">\n");
out.write("\t\t\t\t\t\t\t\t<div class=\"pull-left width-50\">\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"ace-settings-item\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<div class=\"pull-left\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<select id=\"skin-colorpicker\" class=\"hide\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<option data-skin=\"no-skin\" value=\"#438EB9\">#438EB9</option>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<option data-skin=\"skin-1\" value=\"#222A2D\">#222A2D</option>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<option data-skin=\"skin-2\" value=\"#C6487E\">#C6487E</option>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<option data-skin=\"skin-3\" value=\"#D0D0D0\">#D0D0D0</option>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</select>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t<span> Choose Skin</span>\n");
out.write("\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"ace-settings-item\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" class=\"ace ace-checkbox-2 ace-save-state\" id=\"ace-settings-navbar\" autocomplete=\"off\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t<label class=\"lbl\" for=\"ace-settings-navbar\"> Fixed Navbar</label>\n");
out.write("\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"ace-settings-item\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" class=\"ace ace-checkbox-2 ace-save-state\" id=\"ace-settings-sidebar\" autocomplete=\"off\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t<label class=\"lbl\" for=\"ace-settings-sidebar\"> Fixed Sidebar</label>\n");
out.write("\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"ace-settings-item\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" class=\"ace ace-checkbox-2 ace-save-state\" id=\"ace-settings-breadcrumbs\" autocomplete=\"off\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t<label class=\"lbl\" for=\"ace-settings-breadcrumbs\"> Fixed Breadcrumbs</label>\n");
out.write("\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"ace-settings-item\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" class=\"ace ace-checkbox-2\" id=\"ace-settings-rtl\" autocomplete=\"off\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t<label class=\"lbl\" for=\"ace-settings-rtl\"> Right To Left (rtl)</label>\n");
out.write("\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"ace-settings-item\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" class=\"ace ace-checkbox-2 ace-save-state\" id=\"ace-settings-add-container\" autocomplete=\"off\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t<label class=\"lbl\" for=\"ace-settings-add-container\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\tInside\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<b>.container</b>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</label>\n");
out.write("\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t</div><!-- /.pull-left -->\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<div class=\"pull-left width-50\">\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"ace-settings-item\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" class=\"ace ace-checkbox-2\" id=\"ace-settings-hover\" autocomplete=\"off\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t<label class=\"lbl\" for=\"ace-settings-hover\"> Submenu on Hover</label>\n");
out.write("\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"ace-settings-item\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" class=\"ace ace-checkbox-2\" id=\"ace-settings-compact\" autocomplete=\"off\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t<label class=\"lbl\" for=\"ace-settings-compact\"> Compact Sidebar</label>\n");
out.write("\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"ace-settings-item\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" class=\"ace ace-checkbox-2\" id=\"ace-settings-highlight\" autocomplete=\"off\" />\n");
out.write("\t\t\t\t\t\t\t\t\t\t<label class=\"lbl\" for=\"ace-settings-highlight\"> Alt. Active Item</label>\n");
out.write("\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t</div><!-- /.pull-left -->\n");
out.write("\t\t\t\t\t\t\t</div><!-- /.ace-settings-box -->\n");
out.write("\t\t\t\t\t\t</div><!-- /.ace-settings-container -->\n");
out.write("\n");
out.write("\t\t\t\t\t\t<div class=\"page-header\">\n");
out.write("\t\t\t\t\t\t\t<h1>\n");
out.write("\t\t\t\t\t\t\t\tGestionar los Vehículos\n");
out.write("\t\t\t\t\t\t\t\t<small>\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-angle-double-right\"></i>\n");
out.write(" Lista de Vehículos\n");
out.write("\t\t\t\t\t\t\t\t</small>\n");
out.write("\t\t\t\t\t\t\t</h1>\n");
out.write("\t\t\t\t\t\t</div><!-- /.page-header -->\n");
out.write("\n");
out.write("\t\t\t\t\t\t<div class=\"row\">\n");
out.write("\t\t\t\t\t\t\t<div class=\"col-xs-12\">\n");
out.write("\t\t\t\t\t\t\t\t<!-- PAGE CONTENT BEGINS -->\n");
out.write("\t\t\t\t\t\t\t\t<!-- /.row -->\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<div class=\"row\">\n");
out.write("\t\t\t\t\t\t\t\t\t<div class=\"col-xs-12\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t<div class=\"table-header\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\tResultados de vehículos registrados\n");
out.write("\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<!-- div.table-responsive -->\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t<!-- div.dataTables_borderWrap -->\n");
out.write("\t\t\t\t\t\t\t\t\t\t<div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<table id=\"dynamic-table\" class=\"table table-striped table-bordered table-hover\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<thead>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<th>Id Vehículo</th>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<th>Marca</th>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<th>Modelo</th>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<th class=\"hidden-480\">Matricula</th>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<th>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-clock-o bigger-110 hidden-480\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAño\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t</th>\n");
out.write(" <th>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTipo Vehículo\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t</th>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<!-- <th class=\"hidden-480\">Categoría</th> -->\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<th></th>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</thead>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<tbody>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">101</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td class=\"hidden-480\">Chevrolet</td>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>Sail</td>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>2017-2012-1331</td>\n");
out.write(" <td><span class=\"label label-sm label-success\">2017</span></td>\n");
out.write(" <td>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"label label-sm label-success\">Automovil</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"hidden-sm hidden-xs action-buttons\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"blue\" href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-search-plus bigger-130\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"green\" href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-pencil bigger-130\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"red\" href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-trash-o bigger-130\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"hidden-md hidden-lg\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"inline pos-rel\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-minier btn-yellow dropdown-toggle\" data-toggle=\"dropdown\" data-position=\"auto\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-caret-down icon-only bigger-120\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</button>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ul class=\"dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"tooltip-info\" data-rel=\"tooltip\" title=\"View\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"blue\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-search-plus bigger-120\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"tooltip-success\" data-rel=\"tooltip\" title=\"Edit\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"green\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-pencil-square-o bigger-120\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"tooltip-error\" data-rel=\"tooltip\" title=\"Delete\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"red\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-trash-o bigger-120\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</tbody>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</table>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t<div class=\"modal-footer no-margin-top\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-danger pull-left\" data-dismiss=\"modal\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-times\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\tClose\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</button>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t<ul class=\"pagination pull-right no-margin\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<li class=\"prev disabled\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-angle-double-left\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<li class=\"active\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">1</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">2</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">3</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t<li class=\"next\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-angle-double-right\"></i>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t\t</ul>\n");
out.write("\t\t\t\t\t\t\t\t\t\t\t</div>\n");
out.write("\t\t\t\t\t\t\t\t\t\t</div><!-- /.modal-content -->\n");
out.write("\t\t\t\t\t\t\t\t\t</div><!-- /.modal-dialog -->\n");
out.write("\t\t\t\t\t\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t\t<!-- PAGE CONTENT ENDS -->\n");
out.write("\t\t\t\t\t\t\t</div><!-- /.col -->\n");
out.write("\t\t\t\t\t\t</div><!-- /.row -->\n");
out.write("\t\t\t\t\t</div><!-- /.page-content -->\n");
out.write("\t\t\t\t</div>\n");
out.write("\t\t\t</div><!-- /.main-content -->\n");
out.write("\n");
out.write("\t\t\t<div class=\"footer\">\n");
out.write("\t\t\t\t<div class=\"footer-inner\">\n");
out.write("\t\t\t\t\t<div class=\"footer-content\">\n");
out.write("\t\t\t\t\t\t<span class=\"bigger-120\">\n");
out.write("\t\t\t\t\t\t\tWilson Castro Gil © SoWil-2019\n");
out.write("\t\t\t\t\t\t</span>\n");
out.write("\n");
out.write("\t\t\t\t\t\t \n");
out.write("\t\t\t\t\t\t<span class=\"action-buttons\">\n");
out.write("\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-twitter-square light-blue bigger-150\"></i>\n");
out.write("\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-facebook-square text-primary bigger-150\"></i>\n");
out.write("\t\t\t\t\t\t\t</a>\n");
out.write("\n");
out.write("\t\t\t\t\t\t\t<a href=\"#\">\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"ace-icon fa fa-rss-square orange bigger-150\"></i>\n");
out.write("\t\t\t\t\t\t\t</a>\n");
out.write("\t\t\t\t\t\t</span>\n");
out.write("\t\t\t\t\t</div>\n");
out.write("\t\t\t\t</div>\n");
out.write("\t\t\t</div>\n");
out.write("\n");
out.write("\t\t\t<a href=\"#\" id=\"btn-scroll-up\" class=\"btn-scroll-up btn btn-sm btn-inverse\">\n");
out.write("\t\t\t\t<i class=\"ace-icon fa fa-angle-double-up icon-only bigger-110\"></i>\n");
out.write("\t\t\t</a>\n");
out.write("\t\t\n");
out.write("\n");
out.write("\t\t<!-- basic scripts -->\n");
out.write("\n");
out.write("\t\t<!--[if !IE]> -->\n");
out.write("\t\t<script src=\"assets/js/jquery-2.1.4.min.js\"></script>\n");
out.write("\n");
out.write("\t\t<!-- <![endif]-->\n");
out.write("\n");
out.write("\t\t<!--[if IE]>\n");
out.write("<script src=\"assets/js/jquery-1.11.3.min.js\"></script>\n");
out.write("<![endif]-->\n");
out.write("\t\t<script type=\"text/javascript\">\n");
out.write("\t\t\tif('ontouchstart' in document.documentElement) document.write(\"<script src='assets/js/jquery.mobile.custom.min.js'>\"+\"<\"+\"/script>\");\n");
out.write("\t\t</script>\n");
out.write("\t\t<script src=\"assets/js/bootstrap.min.js\"></script>\n");
out.write("\n");
out.write("\t\t<!-- page specific plugin scripts -->\n");
out.write("\t\t<script src=\"assets/js/jquery.dataTables.min.js\"></script>\n");
out.write("\t\t<script src=\"assets/js/jquery.dataTables.bootstrap.min.js\"></script>\n");
out.write("\t\t<script src=\"assets/js/dataTables.buttons.min.js\"></script>\n");
out.write("\t\t<script src=\"assets/js/buttons.flash.min.js\"></script>\n");
out.write("\t\t<script src=\"assets/js/buttons.html5.min.js\"></script>\n");
out.write("\t\t<script src=\"assets/js/buttons.print.min.js\"></script>\n");
out.write("\t\t<script src=\"assets/js/buttons.colVis.min.js\"></script>\n");
out.write("\t\t<script src=\"assets/js/dataTables.select.min.js\"></script>\n");
out.write("\n");
out.write("\t\t<!-- ace scripts -->\n");
out.write("\t\t<script src=\"assets/js/ace-elements.min.js\"></script>\n");
out.write("\t\t<script src=\"assets/js/ace.min.js\"></script>\n");
out.write("\n");
out.write("\t\t<!-- inline scripts related to this page -->\n");
out.write("\t\t<script type=\"text/javascript\">\n");
out.write("\t\t\tjQuery(function($) {\n");
out.write("\t\t\t\t//initiate dataTables plugin\n");
out.write("\t\t\t\tvar myTable = \n");
out.write("\t\t\t\t$('#dynamic-table')\n");
out.write("\t\t\t\t//.wrap(\"<div class='dataTables_borderWrap' />\") //if you are applying horizontal scrolling (sScrollX)\n");
out.write("\t\t\t\t.DataTable( {\n");
out.write("\t\t\t\t\tbAutoWidth: false,\n");
out.write("\t\t\t\t\t\"aoColumns\": [\n");
out.write("\t\t\t\t\t { \"bSortable\": false },\n");
out.write("\t\t\t\t\t null, null,null, null, null,\n");
out.write("\t\t\t\t\t { \"bSortable\": false }\n");
out.write("\t\t\t\t\t],\n");
out.write("\t\t\t\t\t\"aaSorting\": [],\n");
out.write("\t\t\t\t\t\n");
out.write("\t\t\t\t\t\n");
out.write("\t\t\t\t\t//\"bProcessing\": true,\n");
out.write("\t\t\t //\"bServerSide\": true,\n");
out.write("\t\t\t //\"sAjaxSource\": \"http://127.0.0.1/table.php\"\t,\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t\t//,\n");
out.write("\t\t\t\t\t//\"sScrollY\": \"200px\",\n");
out.write("\t\t\t\t\t//\"bPaginate\": false,\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t\t//\"sScrollX\": \"100%\",\n");
out.write("\t\t\t\t\t//\"sScrollXInner\": \"120%\",\n");
out.write("\t\t\t\t\t//\"bScrollCollapse\": true,\n");
out.write("\t\t\t\t\t//Note: if you are applying horizontal scrolling (sScrollX) on a \".table-bordered\"\n");
out.write("\t\t\t\t\t//you may want to wrap the table inside a \"div.dataTables_borderWrap\" element\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t\t//\"iDisplayLength\": 50\n");
out.write("\t\t\t\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t\tselect: {\n");
out.write("\t\t\t\t\t\tstyle: 'multi'\n");
out.write("\t\t\t\t\t}\n");
out.write("\t\t\t } );\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t$.fn.dataTable.Buttons.defaults.dom.container.className = 'dt-buttons btn-overlap btn-group btn-overlap';\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\tnew $.fn.dataTable.Buttons( myTable, {\n");
out.write("\t\t\t\t\tbuttons: [\n");
out.write("\t\t\t\t\t {\n");
out.write("\t\t\t\t\t\t\"extend\": \"colvis\",\n");
out.write("\t\t\t\t\t\t\"text\": \"<i class='fa fa-search bigger-110 blue'></i> <span class='hidden'>Show/hide columns</span>\",\n");
out.write("\t\t\t\t\t\t\"className\": \"btn btn-white btn-primary btn-bold\",\n");
out.write("\t\t\t\t\t\tcolumns: ':not(:first):not(:last)'\n");
out.write("\t\t\t\t\t },\n");
out.write("\t\t\t\t\t {\n");
out.write("\t\t\t\t\t\t\"extend\": \"copy\",\n");
out.write("\t\t\t\t\t\t\"text\": \"<i class='fa fa-copy bigger-110 pink'></i> <span class='hidden'>Copy to clipboard</span>\",\n");
out.write("\t\t\t\t\t\t\"className\": \"btn btn-white btn-primary btn-bold\"\n");
out.write("\t\t\t\t\t },\n");
out.write("\t\t\t\t\t {\n");
out.write("\t\t\t\t\t\t\"extend\": \"csv\",\n");
out.write("\t\t\t\t\t\t\"text\": \"<i class='fa fa-database bigger-110 orange'></i> <span class='hidden'>Export to CSV</span>\",\n");
out.write("\t\t\t\t\t\t\"className\": \"btn btn-white btn-primary btn-bold\"\n");
out.write("\t\t\t\t\t },\n");
out.write("\t\t\t\t\t {\n");
out.write("\t\t\t\t\t\t\"extend\": \"excel\",\n");
out.write("\t\t\t\t\t\t\"text\": \"<i class='fa fa-file-excel-o bigger-110 green'></i> <span class='hidden'>Export to Excel</span>\",\n");
out.write("\t\t\t\t\t\t\"className\": \"btn btn-white btn-primary btn-bold\"\n");
out.write("\t\t\t\t\t },\n");
out.write("\t\t\t\t\t {\n");
out.write("\t\t\t\t\t\t\"extend\": \"pdf\",\n");
out.write("\t\t\t\t\t\t\"text\": \"<i class='fa fa-file-pdf-o bigger-110 red'></i> <span class='hidden'>Export to PDF</span>\",\n");
out.write("\t\t\t\t\t\t\"className\": \"btn btn-white btn-primary btn-bold\"\n");
out.write("\t\t\t\t\t },\n");
out.write("\t\t\t\t\t {\n");
out.write("\t\t\t\t\t\t\"extend\": \"print\",\n");
out.write("\t\t\t\t\t\t\"text\": \"<i class='fa fa-print bigger-110 grey'></i> <span class='hidden'>Print</span>\",\n");
out.write("\t\t\t\t\t\t\"className\": \"btn btn-white btn-primary btn-bold\",\n");
out.write("\t\t\t\t\t\tautoPrint: false,\n");
out.write("\t\t\t\t\t\tmessage: 'This print was produced using the Print button for DataTables'\n");
out.write("\t\t\t\t\t }\t\t \n");
out.write("\t\t\t\t\t]\n");
out.write("\t\t\t\t} );\n");
out.write("\t\t\t\tmyTable.buttons().container().appendTo( $('.tableTools-container') );\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t//style the message box\n");
out.write("\t\t\t\tvar defaultCopyAction = myTable.button(1).action();\n");
out.write("\t\t\t\tmyTable.button(1).action(function (e, dt, button, config) {\n");
out.write("\t\t\t\t\tdefaultCopyAction(e, dt, button, config);\n");
out.write("\t\t\t\t\t$('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white');\n");
out.write("\t\t\t\t});\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\tvar defaultColvisAction = myTable.button(0).action();\n");
out.write("\t\t\t\tmyTable.button(0).action(function (e, dt, button, config) {\n");
out.write("\t\t\t\t\t\n");
out.write("\t\t\t\t\tdefaultColvisAction(e, dt, button, config);\n");
out.write("\t\t\t\t\t\n");
out.write("\t\t\t\t\t\n");
out.write("\t\t\t\t\tif($('.dt-button-collection > .dropdown-menu').length == 0) {\n");
out.write("\t\t\t\t\t\t$('.dt-button-collection')\n");
out.write("\t\t\t\t\t\t.wrapInner('<ul class=\"dropdown-menu dropdown-light dropdown-caret dropdown-caret\" />')\n");
out.write("\t\t\t\t\t\t.find('a').attr('href', '#').wrap(\"<li />\")\n");
out.write("\t\t\t\t\t}\n");
out.write("\t\t\t\t\t$('.dt-button-collection').appendTo('.tableTools-container .dt-buttons')\n");
out.write("\t\t\t\t});\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t////\n");
out.write("\t\t\t\n");
out.write("\t\t\t\tsetTimeout(function() {\n");
out.write("\t\t\t\t\t$($('.tableTools-container')).find('a.dt-button').each(function() {\n");
out.write("\t\t\t\t\t\tvar div = $(this).find(' > div').first();\n");
out.write("\t\t\t\t\t\tif(div.length == 1) div.tooltip({container: 'body', title: div.parent().text()});\n");
out.write("\t\t\t\t\t\telse $(this).tooltip({container: 'body', title: $(this).text()});\n");
out.write("\t\t\t\t\t});\n");
out.write("\t\t\t\t}, 500);\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\tmyTable.on( 'select', function ( e, dt, type, index ) {\n");
out.write("\t\t\t\t\tif ( type === 'row' ) {\n");
out.write("\t\t\t\t\t\t$( myTable.row( index ).node() ).find('input:checkbox').prop('checked', true);\n");
out.write("\t\t\t\t\t}\n");
out.write("\t\t\t\t} );\n");
out.write("\t\t\t\tmyTable.on( 'deselect', function ( e, dt, type, index ) {\n");
out.write("\t\t\t\t\tif ( type === 'row' ) {\n");
out.write("\t\t\t\t\t\t$( myTable.row( index ).node() ).find('input:checkbox').prop('checked', false);\n");
out.write("\t\t\t\t\t}\n");
out.write("\t\t\t\t} );\n");
out.write("\t\t\t\n");
out.write("\t\t\t\n");
out.write("\t\t\t\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t/////////////////////////////////\n");
out.write("\t\t\t\t//table checkboxes\n");
out.write("\t\t\t\t$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t//select/deselect all rows according to table header checkbox\n");
out.write("\t\t\t\t$('#dynamic-table > thead > tr > th input[type=checkbox], #dynamic-table_wrapper input[type=checkbox]').eq(0).on('click', function(){\n");
out.write("\t\t\t\t\tvar th_checked = this.checked;//checkbox inside \"TH\" table header\n");
out.write("\t\t\t\t\t\n");
out.write("\t\t\t\t\t$('#dynamic-table').find('tbody > tr').each(function(){\n");
out.write("\t\t\t\t\t\tvar row = this;\n");
out.write("\t\t\t\t\t\tif(th_checked) myTable.row(row).select();\n");
out.write("\t\t\t\t\t\telse myTable.row(row).deselect();\n");
out.write("\t\t\t\t\t});\n");
out.write("\t\t\t\t});\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t//select/deselect a row when the checkbox is checked/unchecked\n");
out.write("\t\t\t\t$('#dynamic-table').on('click', 'td input[type=checkbox]' , function(){\n");
out.write("\t\t\t\t\tvar row = $(this).closest('tr').get(0);\n");
out.write("\t\t\t\t\tif(this.checked) myTable.row(row).deselect();\n");
out.write("\t\t\t\t\telse myTable.row(row).select();\n");
out.write("\t\t\t\t});\n");
out.write("\t\t\t\n");
out.write("\t\t\t\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t$(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {\n");
out.write("\t\t\t\t\te.stopImmediatePropagation();\n");
out.write("\t\t\t\t\te.stopPropagation();\n");
out.write("\t\t\t\t\te.preventDefault();\n");
out.write("\t\t\t\t});\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t//And for the first simple table, which doesn't have TableTools or dataTables\n");
out.write("\t\t\t\t//select/deselect all rows according to table header checkbox\n");
out.write("\t\t\t\tvar active_class = 'active';\n");
out.write("\t\t\t\t$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){\n");
out.write("\t\t\t\t\tvar th_checked = this.checked;//checkbox inside \"TH\" table header\n");
out.write("\t\t\t\t\t\n");
out.write("\t\t\t\t\t$(this).closest('table').find('tbody > tr').each(function(){\n");
out.write("\t\t\t\t\t\tvar row = this;\n");
out.write("\t\t\t\t\t\tif(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);\n");
out.write("\t\t\t\t\t\telse $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);\n");
out.write("\t\t\t\t\t});\n");
out.write("\t\t\t\t});\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t//select/deselect a row when the checkbox is checked/unchecked\n");
out.write("\t\t\t\t$('#simple-table').on('click', 'td input[type=checkbox]' , function(){\n");
out.write("\t\t\t\t\tvar $row = $(this).closest('tr');\n");
out.write("\t\t\t\t\tif($row.is('.detail-row ')) return;\n");
out.write("\t\t\t\t\tif(this.checked) $row.addClass(active_class);\n");
out.write("\t\t\t\t\telse $row.removeClass(active_class);\n");
out.write("\t\t\t\t});\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t/********************************/\n");
out.write("\t\t\t\t//add tooltip for small view action buttons in dropdown menu\n");
out.write("\t\t\t\t$('[data-rel=\"tooltip\"]').tooltip({placement: tooltip_placement});\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t//tooltip placement on right or left\n");
out.write("\t\t\t\tfunction tooltip_placement(context, source) {\n");
out.write("\t\t\t\t\tvar $source = $(source);\n");
out.write("\t\t\t\t\tvar $parent = $source.closest('table')\n");
out.write("\t\t\t\t\tvar off1 = $parent.offset();\n");
out.write("\t\t\t\t\tvar w1 = $parent.width();\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t\tvar off2 = $source.offset();\n");
out.write("\t\t\t\t\t//var w2 = $source.width();\n");
out.write("\t\t\t\n");
out.write("\t\t\t\t\tif( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';\n");
out.write("\t\t\t\t\treturn 'left';\n");
out.write("\t\t\t\t}\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t/***************/\n");
out.write("\t\t\t\t$('.show-details-btn').on('click', function(e) {\n");
out.write("\t\t\t\t\te.preventDefault();\n");
out.write("\t\t\t\t\t$(this).closest('tr').next().toggleClass('open');\n");
out.write("\t\t\t\t\t$(this).find(ace.vars['.icon']).toggleClass('fa-angle-double-down').toggleClass('fa-angle-double-up');\n");
out.write("\t\t\t\t});\n");
out.write("\t\t\t\t/***************/\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t\n");
out.write("\t\t\t\t/**\n");
out.write("\t\t\t\t//add horizontal scrollbars to a simple table\n");
out.write("\t\t\t\t$('#simple-table').css({'width':'2000px', 'max-width': 'none'}).wrap('<div style=\"width: 1000px;\" />').parent().ace_scroll(\n");
out.write("\t\t\t\t {\n");
out.write("\t\t\t\t\thorizontal: true,\n");
out.write("\t\t\t\t\tstyleClass: 'scroll-top scroll-dark scroll-visible',//show the scrollbars on top(default is bottom)\n");
out.write("\t\t\t\t\tsize: 2000,\n");
out.write("\t\t\t\t\tmouseWheelLock: true\n");
out.write("\t\t\t\t }\n");
out.write("\t\t\t\t).css('padding-top', '12px');\n");
out.write("\t\t\t\t*/\n");
out.write("\t\t\t\n");
out.write("\t\t\t\n");
out.write("\t\t\t})\n");
out.write("\t\t</script>\n");
out.write("\t</body>\n");
out.write("</html>\n");
out.write("\n");
out.write("\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"[email protected]"
] | |
9d6d6f07b9b346d3063d5973f6f30ecf678dcb49 | 24d8bec27056b530e3c369037e89f80ad517586a | /servlets/Pets/src/com/codingdojo/controllers/Home.java | 0906696aae762b15041c4634da2b2a009049fb32 | [] | no_license | ohis/JAVAOnTheWeb | 70ce4b30af8d1996569bb24d65995979b4517261 | 44d19e8911956fcd54e3786093b8567018dbe9ac | refs/heads/master | 2021-08-28T16:42:45.282214 | 2017-12-12T19:59:10 | 2017-12-12T19:59:10 | 114,032,870 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,293 | java | package com.codingdojo.controllers;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class Home
*/
@WebServlet("/Home")
public class Home extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Home() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
RequestDispatcher view = request.getRequestDispatcher("/WEB-INF/views/Home.jsp");
view.forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"[email protected]"
] | |
54afa18f2bedd5fc018ae3de7f509b9170a12191 | 40eb233b4982285c941ecc70f0ada60f625f039c | /src/main/java/com/mimecast/robin/annotation/plugin/package-info.java | b4351e0940c0d0b5b194409d95f2ab65f02d42fe | [
"Apache-2.0"
] | permissive | mimecast/robin | 02d31965168132705b0f3e4fd8c73e4cfbfb83a8 | 42c856a976dd5aa5ae19aacf4df48380433eeef4 | refs/heads/master | 2023-08-31T08:11:45.061066 | 2023-08-25T13:09:35 | 2023-08-25T13:09:35 | 204,729,772 | 16 | 5 | Apache-2.0 | 2023-09-05T11:02:55 | 2019-08-27T15:11:02 | Java | UTF-8 | Java | false | false | 153 | java | /**
* Plugin interface and container package.
*
* <p>Plugins are only loaded from this package.</p>
*/
package com.mimecast.robin.annotation.plugin;
| [
"[email protected]"
] | |
821f49fc42e7d9d7576f342004c499f03b26536f | 1e4855f1b2fb47806f4bbc769f89674bc45d8a8a | /src/Exercicio02/Professor.java | 927a1378917c2f1756ab3cbd9b9d94a2c7764672 | [] | no_license | s4mz1nh0/exercicio07 | 0abef21427797ccb97ba7577dd7e561039c9eba2 | fad1c9b2521c2803331b531524796705c8830758 | refs/heads/master | 2020-05-28T09:27:13.163202 | 2019-05-28T04:44:45 | 2019-05-28T04:44:45 | 188,955,434 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 646 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Exercicio02;
/**
*
* @author P4N
*/
public class Professor {
private String nome,matricula;
private int idade;
void setNome(String n){ this.nome=n;}
String getNome(){ return this.nome;}
void setMatricula(String m){ this.matricula=m;}
String getMatricula(){ return this.matricula;}
void setIdade(int i){ this.idade=i;}
int getIdade(){ return this.idade;}
}
| [
"[email protected]"
] | |
9c7fb8fc0c6f5a4314cc5e1d8a02fa002434bddd | 13b8d9a378f8416e546a415907968d9cc5efc063 | /src/epos/model/sequence/io/AbstractAlignmentWriter.java | e9d12f2fee857e898c94c5c0f849933a8bcf3976 | [] | no_license | pgdurand/EPOS-LE | f319a0a0a064ca63f6d0528e0c3c736fa0486766 | 7383d969223a842e49ead8bc213ed29a463d51bf | refs/heads/master | 2021-05-01T02:18:17.975975 | 2017-01-24T12:50:47 | 2017-01-24T12:50:47 | 79,911,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package epos.model.sequence.io;
import java.io.File;
import org.jdesktop.application.AbstractBean;
import epos.model.sequence.SequenceQNode.Type;
public abstract class AbstractAlignmentWriter extends AbstractBean implements AlignmentWriter{
protected String[] names;
protected String[] sequences;
protected Type type;
protected File file;
public void setNames(String[] names) {
this.names = names;
}
public void setSequences(String[] seqs) {
this.sequences = seqs;
}
public void setType(Type type) {
this.type = type;
}
public void setFile(File file) {
this.file = file;
}
public abstract void write() throws Exception;
}
| [
"[email protected]"
] | |
6b4964f043c537536a6ab4c170e09a9099b8b45d | aa70bf20cbc459a9175c34ab584cc44f40369988 | /app/src/main/java/com/mz/sticker/crop/Crop.java | 3fe1457f34f50491e2bce157e125d00a06250bcd | [] | no_license | MichalZwierzyk/Sticker | 4f80a733f2dcf7533072d73de49e984edfb162b8 | 6d86185d55aecb22999dca67d48c432eea6ec2bb | refs/heads/master | 2021-01-01T18:22:45.629286 | 2015-04-14T21:21:48 | 2015-04-14T21:21:48 | 33,957,684 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,269 | java | package com.mz.sticker.crop;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import com.mz.sticker.screen.CropImageActivity;
/**
* Builder for crop Intents and utils for handling result
*/
public class Crop {
public static final int REQUEST_CROP = 6709;
public static final int RESULT_ERROR = 404;
public interface Extra {
String ASPECT_X = "aspect_x";
String ASPECT_Y = "aspect_y";
String MAX_X = "max_x";
String MAX_Y = "max_y";
String ENTER_FROM_GALLERY = "enter_from_gallery";
String ERROR = "error";
}
private Intent cropIntent;
/**
* Create a crop Intent builder with source image
*
* @param source Source image URI
*/
public Crop(Uri source) {
cropIntent = new Intent();
cropIntent.setData(source);
}
/**
* Set output URI where the cropped image will be saved
*
* @param output Output image URI
*/
public Crop output(Uri output) {
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, output);
return this;
}
/**
* Set fixed aspect ratio for crop area
*
* @param x Aspect X
* @param y Aspect Y
*/
public Crop withAspect(int x, int y) {
cropIntent.putExtra(Extra.ASPECT_X, x);
cropIntent.putExtra(Extra.ASPECT_Y, y);
return this;
}
/**
* Crop area with fixed 1:1 aspect ratio
*/
public Crop asSquare() {
cropIntent.putExtra(Extra.ASPECT_X, 1);
cropIntent.putExtra(Extra.ASPECT_Y, 1);
return this;
}
/**
* Set maximum crop size
*
* @param width Max width
* @param height Max height
*/
public Crop withMaxSize(int width, int height) {
cropIntent.putExtra(Extra.MAX_X, width);
cropIntent.putExtra(Extra.MAX_Y, height);
return this;
}
/**
* Send the crop Intent!
*
* @param activity Activity to receive result
* @param enterFromGallery Was previous activity a gallery?
*/
public void start(Activity activity, boolean enterFromGallery) {
cropIntent.putExtra(Extra.ENTER_FROM_GALLERY, enterFromGallery);
start(activity, REQUEST_CROP);
}
/**
* Send the crop Intent with a custom requestCode
*
* @param activity Activity to receive result
* @param requestCode requestCode for result
*/
public void start(Activity activity, int requestCode) {
activity.startActivityForResult(getIntent(activity), requestCode);
}
/**
* Send the crop Intent!
*
* @param context Context
* @param fragment Fragment to receive result
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void start(Context context, Fragment fragment) {
start(context, fragment, REQUEST_CROP);
}
/**
* Send the crop Intent with a custom requestCode
*
* @param context Context
* @param fragment Fragment to receive result
* @param requestCode requestCode for result
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void start(Context context, Fragment fragment, int requestCode) {
fragment.startActivityForResult(getIntent(context), requestCode);
}
/**
* Get Intent to start crop Activity
*
* @param context Context
* @return Intent for CropImageActivity
*/
public Intent getIntent(Context context) {
cropIntent.setClass(context, CropImageActivity.class);
return cropIntent;
}
/**
* Retrieve URI for cropped image, as set in the Intent builder
*
* @param result Output Image URI
*/
public static Uri getOutput(Intent result) {
return result.getParcelableExtra(MediaStore.EXTRA_OUTPUT);
}
/**
* Retrieve error that caused crop to fail
*
* @param result Result Intent
* @return Throwable handled in CropImageActivity
*/
public static Throwable getError(Intent result) {
return (Throwable) result.getSerializableExtra(Extra.ERROR);
}
}
| [
"[email protected]"
] | |
0d09eaf458e00a94f6e6a309085bcfee8d81261f | 9419249ee66fc06f7fa389fe28ea5debc6362c6d | /src/main/java/com/wsk/cards/skill/PhysicalFitnessCard.java | 1da551be191dac2a243db2bf47f95fe0c9502a39 | [
"MIT"
] | permissive | wsk1103/LagranYue | 0ee45ee3745ab444cff84e822f005056d91ff188 | 5da15ed6cce5a182585226b1c26fb159b5b4dc0d | refs/heads/master | 2022-09-17T00:13:41.248505 | 2022-08-14T12:28:30 | 2022-08-14T12:28:30 | 172,636,794 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,052 | java | package com.wsk.cards.skill;
import basemod.abstracts.CustomCard;
import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.actions.common.MakeTempCardInHandAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.wsk.cards.AbstractArmsCard;
import com.wsk.patches.AbstractCardEnum;
import com.wsk.utils.CommonUtil;
/**
* @author wsk1103
* @date 2019/2/26
* @desc 一句话说明
*/
public class PhysicalFitnessCard extends CustomCard {
public static final String ID = "LagranYue:PhysicalFitnessCard";
private static final String NAME;
private static final String DESCRIPTION;
private static final String UPGRADED_DESCRIPTION;
private static final CardStrings cardStrings;
private static final String IMG = "cards/PhysicalFitnessCard.png";
//例:img/cards/claw/attack/BloodSuckingClaw_Orange.png 详细情况请根据自己项目的路径布置进行填写。
private static final int COST = 2;
public PhysicalFitnessCard() {
super(ID, NAME, CommonUtil.getResourcePath(IMG), COST, DESCRIPTION,
CardType.SKILL,
AbstractCardEnum.LagranYue,
CardRarity.UNCOMMON, CardTarget.SELF);
this.baseBlock = 14;
this.exhaust = false;
this.magicNumber = this.baseMagicNumber = 1;
}
//用于显示在卡牌一览里。同时也是诸多卡牌复制效果所需要调用的基本方法,用来获得一张该卡的原始模板修改后加入手牌/抽牌堆/弃牌堆/牌组。
public AbstractCard makeCopy() {
return new PhysicalFitnessCard();
}
@Override
public void upgrade() {
if (!this.upgraded) {
this.upgradeName();
this.upgradeBlock(4);
this.rawDescription = UPGRADED_DESCRIPTION;
this.initializeDescription();
}
}
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
AbstractDungeon.actionManager.addToTop(new GainBlockAction(p, p, this.block));
AbstractCard c;
for (AbstractCard card : p.drawPile.group) {
if (card instanceof AbstractArmsCard) {
c = card.makeCopy();
//设置保留
c.retain = true;
if (upgraded) {
c.modifyCostForCombat(-c.cost);
}
AbstractDungeon.actionManager.addToTop(new MakeTempCardInHandAction(c, true));
break;
}
}
}
static {
cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
NAME = cardStrings.NAME;
DESCRIPTION = cardStrings.DESCRIPTION;
UPGRADED_DESCRIPTION = cardStrings.UPGRADE_DESCRIPTION;
}
}
| [
"[email protected]"
] | |
038a38ce511e3629aeb2371941a7015770d95ab1 | 0863109ea48bc70dcde4830c3503440841be0b6c | /src/BaseDatos/Problemas/TestExclusivebet.java | 226cacf978aa9e1aae74249a0df232cd410605bb | [] | no_license | adrife94/DondeApuesto1 | 8b7883431a4a0d5f8a433b7ea0a07fed35bc933e | 7360ca1c50ca538c8d12879b511d58438ceb720c | refs/heads/master | 2022-10-11T14:20:06.145981 | 2020-06-15T10:53:39 | 2020-06-15T10:53:39 | 264,186,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | package BaseDatos.Problemas;
import BaseDatos.Problemas.Exclusivebet;
public class TestExclusivebet {
public static void main(String[] args) {
Exclusivebet exclusivebet = new Exclusivebet();
exclusivebet.parseador ("Exclusivebet","Bundesliga", "https://www.exclusivebeteu.com/Sport/torneo-ubicaci%C3%B3n/f%C3%BAtbol/1/alemania/54/bundesliga/9369994488582144/pr%C3%B3ximamente");
}
}
| [
"[email protected]"
] | |
4602f3fe74e5deec65db08a38f8947c442edea3c | 88c72985b953684fd758d39c3bff227813ed30eb | /app/src/main/java/com/fclarke/androidsearch/MovieAdapter.java | 5380b001f18f4a90085a4cefca968f91e35c5894 | [] | no_license | frankjmclarke/AndroidSearch | ebee91bd50b560e2bea10580a87a9669eda61c48 | 503baaa17a8366c7bba4c4b6cd15b2b763afc422 | refs/heads/master | 2021-07-25T01:56:18.882619 | 2017-11-05T22:02:26 | 2017-11-05T22:02:26 | 104,521,881 | 0 | 1 | null | 2017-11-05T22:08:27 | 2017-09-22T21:53:40 | Java | UTF-8 | Java | false | false | 1,693 | java | package com.fclarke.androidsearch;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
public class MovieAdapter extends
RecyclerView.Adapter<MovieAdapter.ViewHolder> {
private List<String> mtList ;
public Context mcontext;
ViewHolder viewHolder;
public MovieAdapter(List<String> list, Context context) {
mtList = list;
mcontext = context;
}
// Called when RecyclerView needs a new RecyclerView.ViewHolder of the given type to represent an item.
@Override
public MovieAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
// create a layout
View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.list, null);
viewHolder = new ViewHolder(itemLayoutView);
return viewHolder;
}
// Called by RecyclerView to display the data at the specified position.
@Override
public void onBindViewHolder(final ViewHolder viewHolder, int position ) {
viewHolder.name.setText(mtList.get(position));
}
//Returns the total number of items in the data set hold by the adapter.
@Override
public int getItemCount() {
return mtList.size();
}
// initializes some private fields to be used by RecyclerView.
public static class ViewHolder extends RecyclerView.ViewHolder {
public TextView name;
public ViewHolder(View itemLayoutView) {
super(itemLayoutView);
name = (TextView) itemLayoutView.findViewById(R.id.name);
}
}
} | [
"[email protected]"
] | |
de9a0b49fb639f0754451b3b7347dfb110c13e5d | cda6fe62537ccb85fd6891e7a52a7c788a3bae86 | /MybatisDemo2/src/main/java/com/chen/entity/Product.java | 3876e0517f8dd8376eb509df96e1f5459e4e5fd0 | [] | no_license | ChEnFeNg111/MyBatis | 682d2cce9c49e8cc541bde95027bfaea93a81a83 | e547713552f2cb6f354ccd5b7cfbada7178187f5 | refs/heads/master | 2020-04-02T04:16:34.116039 | 2018-12-12T12:16:34 | 2018-12-12T12:16:34 | 154,009,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,270 | java | package com.chen.entity;
import java.io.Serializable;
public class Product implements Serializable {
// 普通属性
private int id;
private String name;
private int price;
//关系属性,保存着另一张表
private Category category;
public Product() {
}
public Product(int id, String name, int price, Category category) {
this.id = id;
this.name = name;
this.price = price;
this.category = category;
}
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 int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
@Override
public String toString() {
return "Product{" +
"id=" + id +
", name='" + name + '\'' +
", price=" + price +
", category=" + category +
'}';
}
}
| [
"[email protected]"
] | |
ecd458c30ae761b32added9d411077df7985d64b | 02ad3f63aca8eaec2e3d309ed22ad6714c8fadab | /src/main/java/br/com/robson/github/RepositoriesApplication.java | 3a6bfc5416ccb192e49c74d1b916617b8833d697 | [] | no_license | robynhosp/list-github | 751b77fac432dd828319b948f2b3a36491eeb1ea | 54935a77393993b7109beb5de43fdde5e3a65016 | refs/heads/master | 2023-03-23T22:16:10.962333 | 2021-03-06T15:43:28 | 2021-03-06T15:43:28 | 345,127,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | package br.com.robson.github;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
public class RepositoriesApplication {
public static void main(String[] args) {
SpringApplication.run(RepositoriesApplication.class, args);
}
}
| [
"[email protected]"
] | |
96dfebe97fc39cc815a1d4773fe574d43ee6b948 | 063c81924b044e0c6c74c451ec991bba4afc59ab | /src/main/java/com/bazalyskyi/school/controller/RevenueReportController.java | 288ef8c7228b94bc624db1417bc7e83100351787 | [] | no_license | BazaUA/bd | e79953fbcba69a4819ecc1dc2b4f136c538912ed | 341f0ba6a6589b7637a4146842e080254d1c7e09 | refs/heads/master | 2020-03-12T08:45:11.106935 | 2018-04-22T04:33:44 | 2018-04-22T04:33:44 | 130,535,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,598 | java | package com.bazalyskyi.school.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
public class RevenueReportController extends AbstractController{
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String output =
ServletRequestUtils.getStringParameter(request, "output");
//dummy data
Map<String,String> revenueData = new HashMap<String,String>();
revenueData.put("Jan-2010", "$100,000,000");
revenueData.put("Feb-2010", "$110,000,000");
revenueData.put("Mar-2010", "$130,000,000");
revenueData.put("Apr-2010", "$140,000,000");
revenueData.put("May-2010", "$200,000,000");
if(output ==null || "".equals(output)){
//return normal view
return new ModelAndView("RevenueSummary","revenueData",revenueData);
}else if("EXCEL".equals(output.toUpperCase())){
//return excel view
return new ModelAndView("ExcelRevenueSummary","revenueData",revenueData);
}else{
//return normal view
return new ModelAndView("RevenueSummary","revenueData",revenueData);
}
}
} | [
"[email protected]"
] | |
83e4029a63abefb52ffa4dc4d15fee790899d966 | 1ac6c830c0457a5600bee318302f5dda5367c71d | /flexible-adapter-app/src/main/java/eu/davidea/samples/flexibleadapter/fragments/OnFragmentInteractionListener.java | 628deb3b854881088dcdbcbbdba5634e30b1d4c8 | [
"Apache-2.0"
] | permissive | aftabsikander/FlexibleAdapter | 04fd7ce006e3b4db416a20a3f4c04148248f31de | 128cae7b85676c4d83fc807a4a0484818a78a91d | refs/heads/master | 2022-05-01T08:01:20.672681 | 2022-03-17T23:38:24 | 2022-03-17T23:38:24 | 267,617,761 | 0 | 0 | Apache-2.0 | 2022-03-17T23:38:25 | 2020-05-28T14:51:35 | Java | UTF-8 | Java | false | false | 924 | java | package eu.davidea.samples.flexibleadapter.fragments;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.RecyclerView;
import android.view.Menu;
import eu.davidea.flexibleadapter.SelectableAdapter;
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
void onFragmentChange(SwipeRefreshLayout swipeRefreshLayout, RecyclerView recyclerView,
@SelectableAdapter.Mode int mode);
void initSearchView(final Menu menu);
} | [
"[email protected]"
] | |
084ff441a895e0883931b4095ac231b62b831a47 | 02ff5be8811780b12054beff156b74cfe7237e16 | /affect/affect/affect2/affect/src/main/java/com/captain/service/GetDistanceService.java | 2bbf0045bfaa0176a038f71d4c4f33339c5f958b | [] | no_license | AmineSisaber/Tests- | ffdeef3d32024d79e75eac30a0b89cea9a789f66 | 75833e0798dad7112a7d70245b766d6dac6a83fe | refs/heads/master | 2020-04-09T22:26:38.993511 | 2018-03-14T17:04:06 | 2018-03-14T17:04:06 | 124,246,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package com.captain.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.captain.metier.DistanceMaxMetier;
@RestController
public class GetDistanceService {
@Autowired
DistanceMaxMetier dis;
@Autowired CandidateRestService candservice;
@RequestMapping(value="/distance",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_VALUE)
@Transactional
public String getDistance() {
try {
return dis.getMaxDistance()+""+candservice.getCandidate();
} catch (Exception e) {
return null;
}
}
} | [
"[email protected]"
] | |
47d2d0442e6da498be946627467c75752277326c | d1bc4331a659bdaba1cb8d9f19951f06f228222e | /user_manage/src/main/java/com/smart/respository/Dao/WriteLogginInfoRepository.java | 07b3fa9d2cd8de7fcb00a54614c10878e0ddcb8f | [] | no_license | ShnningStarts/tb | 6f8f2d4b5adf1ea7c097bc5d9be8c55a4b7d6faa | 7ae2ba5f171811e679799e864d28b110642058db | refs/heads/master | 2022-12-24T12:57:47.008265 | 2019-07-09T15:04:53 | 2019-07-09T15:04:53 | 195,218,124 | 0 | 0 | null | 2022-12-15T23:30:48 | 2019-07-04T10:08:06 | Java | UTF-8 | Java | false | false | 1,337 | java | package com.smart.respository.Dao;
import com.querydsl.core.types.Path;
import com.querydsl.jpa.impl.JPAQueryFactory;
import com.smart.entity.QUserLogginInfoEntity;
import com.smart.entity.UserLogginInfoEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import java.sql.Timestamp;
import java.util.List;
@Repository
public class WriteLogginInfoRepository {
@Autowired
QUserLogginInfoEntity qUserLogginInfoEntity=QUserLogginInfoEntity.userLogginInfoEntity;
@Autowired
EntityManager entityManager;
JPAQueryFactory queryFactory=new JPAQueryFactory(entityManager);
UserLogginInfoEntity getLogginInfoByUserId(String id){
return queryFactory.selectFrom(qUserLogginInfoEntity).where(qUserLogginInfoEntity.userId.eq(id)).fetchOne();
}
public Long writeLogginInfo(String id, String userId, String ip, Timestamp logginInTime){
return queryFactory.update(qUserLogginInfoEntity)
.set(qUserLogginInfoEntity.id, id)
.set(qUserLogginInfoEntity.userId, userId)
.set(qUserLogginInfoEntity.logginInTime, logginInTime).set(qUserLogginInfoEntity.logginInTime, logginInTime)
.set(qUserLogginInfoEntity.logginIp, ip).execute();
}
}
| [
"[email protected]"
] | |
66f2c2e3a8308d6f43e3bed78ca10471147f0d89 | d2ac83d3fd8c8a08bb34f53d8f6b2b0e42a5b5ca | /src/main/java/se/rimevel/FeudalFunctions/modules/survival/interfaces/IFireTool.java | 788fb29dde9af4b5ef5e3ff92cf7b89e14c78fbd | [] | no_license | Rimevel/FeudalFunctions | 07c51258add5c02f2a0fe4625d7c9299d78255c4 | cf6dd56ae7800401621523465bebdad00e1f96a5 | refs/heads/master | 2020-04-25T19:51:10.297677 | 2015-07-24T04:17:13 | 2015-07-24T04:17:13 | 31,514,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | package se.rimevel.FeudalFunctions.modules.survival.interfaces;
public interface IFireTool
{
public int getFireProbability();
}
| [
"[email protected]"
] | |
85bbc9bd8a1af0b7c8c6e365878f2101020fd8d6 | ac1768b715e9fe56be8b340bc1e4bc7f917c094a | /openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/dataset/IPhysicalDataFileFormatTypeTranslator.java | e78e52202c442f27810c5c65bfd219901a3a088b | [
"Apache-2.0"
] | permissive | kykrueger/openbis | 2c4d72cb4b150a2854df4edfef325f79ca429c94 | 1b589a9656d95e343a3747c86014fa6c9d299b8d | refs/heads/master | 2023-05-11T23:03:57.567608 | 2021-05-21T11:54:58 | 2021-05-21T11:54:58 | 364,558,858 | 0 | 0 | Apache-2.0 | 2021-06-04T10:08:32 | 2021-05-05T11:48:20 | Java | UTF-8 | Java | false | false | 1,118 | java | /*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.asapi.v3.translator.dataset;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.FileFormatType;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions.FileFormatTypeFetchOptions;
import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.common.IObjectToOneRelationTranslator;
/**
* @author pkupczyk
*/
public interface IPhysicalDataFileFormatTypeTranslator extends IObjectToOneRelationTranslator<FileFormatType, FileFormatTypeFetchOptions>
{
}
| [
"pkupczyk"
] | pkupczyk |
42f5c61a3500650faa09c03e61c029ccea3955da | 2e9a86693b665b879c59b14dfd63c2c92acbf08a | /webconverter/decomiledJars/rt/com/sun/org/apache/xml/internal/security/encryption/EncryptedKey.java | c83c2b12242f151e28d04d322bbec981a698f33a | [] | no_license | shaikgsb/webproject-migration-code-java | 9e2271255077025111e7ea3f887af7d9368c6933 | 3b17211e497658c61435f6c0e118b699e7aa3ded | refs/heads/master | 2021-01-19T18:36:42.835783 | 2017-07-13T09:11:05 | 2017-07-13T09:11:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | package com.sun.org.apache.xml.internal.security.encryption;
public abstract interface EncryptedKey
extends EncryptedType
{
public abstract String getRecipient();
public abstract void setRecipient(String paramString);
public abstract ReferenceList getReferenceList();
public abstract void setReferenceList(ReferenceList paramReferenceList);
public abstract String getCarriedName();
public abstract void setCarriedName(String paramString);
}
| [
"[email protected]"
] | |
cc3e101cbcc32d559ead7b1d53babdcdf271530d | 1a4913e6f9c2a4f8d30b5cb78ec749dbe49a4ac1 | /src/main/java/com/example/restaurantmenus/service/RestaurantServiceImpl.java | 79c844020b9ab02ad5f905a647caa21daeea3776 | [] | no_license | martin113/aukro-example | 9206925ee6c3929eb6f63dff07b66a046f6747fd | 7a5d24caa64b9c06c48716066c7d3c8d39f7dc34 | refs/heads/master | 2021-04-03T02:55:46.217094 | 2018-03-12T07:25:45 | 2018-03-12T07:25:45 | 124,743,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,870 | java | package com.example.restaurantmenus.service;
import com.example.restaurantmenus.entity.Restaurant;
import com.example.restaurantmenus.model.MenuDTO;
import com.example.restaurantmenus.model.RestaurantDTO;
import com.example.restaurantmenus.model.RestaurantDetailDTO;
import com.example.restaurantmenus.repository.MenuDao;
import com.example.restaurantmenus.repository.RestaurantDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.temporal.IsoFields;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.TemporalField;
import java.time.temporal.WeekFields;
import java.util.List;
import java.util.Locale;
@Transactional
@Service
public class RestaurantServiceImpl implements RestaurantService {
@Autowired
private RestaurantDao restaurantDao;
@Autowired
private MenuDao menuDao;
@Override
public Restaurant findById(Long id) {
return restaurantDao.findOne(id);
}
@Override
public List<Restaurant> findAll() {
return restaurantDao.findAll();
}
@Transactional
@Override
public void save(Restaurant restaurant) {
restaurantDao.create(restaurant);
}
@Transactional
@Override
public void update(Long id, Restaurant restaurant) {
restaurantDao.update(id, restaurant);
}
@Transactional
@Override
public void delete(Long id) {
Restaurant restaurant = restaurantDao.findOne(id);
restaurantDao.delete(restaurant);
}
@Override
public List<RestaurantDTO> findAllByDate(LocalDate date) {
if(date == null) date = LocalDate.now();
return restaurantDao.restaurantByDateView(date);
}
@Override
public RestaurantDetailDTO findDetail(Long id, LocalDate weekDate) {
if(weekDate == null) weekDate = LocalDate.now();
TemporalField weekFields = WeekFields.of(Locale.getDefault()).weekOfWeekBasedYear();
int weekNumber = weekDate.get(weekFields);
LocalDate startDate = LocalDate.now().with(IsoFields.WEEK_OF_WEEK_BASED_YEAR, weekNumber).with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
LocalDate endDate = LocalDate.now().with(IsoFields.WEEK_OF_WEEK_BASED_YEAR, weekNumber).with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
Restaurant restaurant = restaurantDao.findOne(id);
List<MenuDTO> menuList = menuDao.findWeekMenuByRestaurant(id, startDate, endDate);
RestaurantDetailDTO detailView = new RestaurantDetailDTO();
detailView.setName(restaurant.getName());
detailView.setDescription(restaurant.getDescription());
detailView.setWeekMenu(menuList);
return detailView;
}
}
| [
"[email protected]"
] | |
648f33a9ef2746dfc8a77f802b6704730f16fd05 | 1df1e297275507b6d8aaecc531d811c968c8e4fc | /app/src/main/java/com/tingyu/venus/netty/util/MessageIdGenerator.java | 8403729eeb46f82cee646b1ca4433ea7d3c46828 | [] | no_license | Essionshy/venus-android | d9e792f018a237d1acb1ce2c1850b06cf494ff95 | dc2fde6af6ccf0cc1e26b369229455adac8b355a | refs/heads/master | 2023-01-15T08:41:20.652658 | 2020-11-26T13:30:41 | 2020-11-26T13:30:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package com.tingyu.venus.netty.util;
import java.util.Random;
/**
* @Author essionshy
* @Create 2020/11/21 13:45
* @Version venus-server
*/
public class MessageIdGenerator {
private static Long id=null;
private MessageIdGenerator(){}
public static Long getId(){
if(id==null){
id=Math.abs(new Random().nextLong());
}else{
id++;
}
return id;
}
}
| [
"[email protected]"
] | |
4c89ee70d2f470b4b6a0cb8021e0e42288814ceb | 5660749133265ed4c2847851893f7d411fa7ef0f | /02. Simple Calculations/src/B_InchesToCentimeters.java | 6ad3f0c2832f950869fc358f8afcd5d59fec7b0a | [] | no_license | Kristiyan93/Programming-Basics-with-Java | 359df12137e3883ea57726e0f33f4a31ba713d72 | 240f9c50d8a1393f6fa865066ae8e3881ab8c4b9 | refs/heads/master | 2021-08-07T18:21:16.165834 | 2017-11-08T17:56:22 | 2017-11-08T17:56:22 | 109,957,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | import java.util.Scanner;
public class B_InchesToCentimeters {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Inches:");
Double inches = Double.parseDouble(scanner.nextLine());
Double centimeters = inches * 2.54;
System.out.println("Centimeters=" + centimeters);
}
}
| [
"[email protected]"
] | |
6d3d1879c1663cac24a9d114434b39f82d0478d2 | fd119fe450a86a10493a530b36ccbf61b6602ac9 | /src/View/FormMustahiq.java | 5949178d5adb06fe92fdbf74d976bd92a4655a6a | [] | no_license | hafizha19/Zakat-Yuk | dc2348b51e530301b1c0b877f7eb38982110c03c | 0ee99c4bfd6484fce0678935e90ff3a7732c01af | refs/heads/master | 2022-08-26T02:15:25.380394 | 2020-05-28T05:26:48 | 2020-05-28T05:26:48 | 267,500,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,379 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package View;
import Controller.MustahiqController;
import java.util.ArrayList;
import java.util.List;
import Model.MustahiqModel;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
/**
*
* @author mz-hafizha
*/
public class FormMustahiq extends javax.swing.JFrame {
/**
* Creates new form Konfirmasi
*/
String FormMustahiq;
private MustahiqController MustahiqController2;
// private List<MustahiqModel> lm = new ArrayList<>();
public FormMustahiq() {
initComponents();
MustahiqController2 = new MustahiqController(this);
setLocationRelativeTo(null);
}
public JButton getB_daftarM() {
return b_daftarM;
}
public JButton getjButton1() {
return jButton1;
}
public JTextField getNamaText() {
return namaText;
}
public JTextField getNikText() {
return nikText;
}
public JTextField getNo_hpText() {
return no_hpText;
}
public JTextField getRwText() {
return rwText;
}
public JTextField getTanggunganText() {
return tanggunganText;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
namaText = new javax.swing.JTextField();
nikText = new javax.swing.JTextField();
no_hpText = new javax.swing.JTextField();
tanggunganText = new javax.swing.JTextField();
rwText = new javax.swing.JTextField();
b_daftarM = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
b_update = new javax.swing.JButton();
b_reset = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
jLabel1.setText("Pendaftaran Mustahiq Baru");
jLabel3.setText("Nama");
jLabel4.setText("NIK");
jLabel5.setText("No HP");
jLabel6.setText("Tanggungan");
jLabel7.setText("RW");
namaText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
namaTextActionPerformed(evt);
}
});
b_daftarM.setText("Daftar");
b_daftarM.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
b_daftarMActionPerformed(evt);
}
});
jButton1.setText("Back to Menu");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
b_update.setText("Update ");
b_update.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
b_updateActionPerformed(evt);
}
});
b_reset.setText("Reset");
b_reset.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
b_resetActionPerformed(evt);
}
});
jButton2.setText("Lihat Daftar Mustahiq");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(b_daftarM)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(b_update)
.addGap(40, 40, 40)
.addComponent(b_reset))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7))
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(namaText, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
.addComponent(nikText)
.addComponent(no_hpText)
.addComponent(rwText, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
.addComponent(tanggunganText))))
.addGap(29, 29, 29))
.addGroup(layout.createSequentialGroup()
.addGap(35, 35, 35)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 293, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(38, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(30, 30, 30)
.addComponent(jLabel1)
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(namaText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(nikText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(no_hpText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(tanggunganText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(rwText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(b_daftarM)
.addComponent(b_update)
.addComponent(b_reset))
.addContainerGap(48, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void namaTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_namaTextActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_namaTextActionPerformed
private void b_daftarMActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_daftarMActionPerformed
MustahiqController2.add();
// ListMustahiq2.isiTabel();
}//GEN-LAST:event_b_daftarMActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
MustahiqController2.welcome();
}//GEN-LAST:event_jButton1ActionPerformed
private void b_updateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_updateActionPerformed
MustahiqController2.update();
// ListMustahiqController2.isiTabel();
}//GEN-LAST:event_b_updateActionPerformed
private void b_resetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_resetActionPerformed
MustahiqController2.reset();
}//GEN-LAST:event_b_resetActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
dispose();
new ListMustahiq().setVisible(true);
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FormMustahiq.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FormMustahiq.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FormMustahiq.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FormMustahiq.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FormMustahiq().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton b_daftarM;
private javax.swing.JButton b_reset;
private javax.swing.JButton b_update;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JTextField namaText;
private javax.swing.JTextField nikText;
private javax.swing.JTextField no_hpText;
private javax.swing.JTextField rwText;
private javax.swing.JTextField tanggunganText;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
bfd3f4484f9094726af095eefaa130f4ee2bc5f6 | 8c0affdfdf54c6fe28757b0d3a6fcb8a493b7f5c | /Project/br/Empresa/Models/Login.java | 7fdd1a1daf2bbccedf39caff0ce61645ffd00b13 | [] | no_license | marcelosouzaufpb/Sistema-de-Gerenciamento-de-Funcionario-Para | bf22e402a73eb95f4165bdff887bdfa6c28f242c | daac38c240fee257baa1c6a6b56deb2446a28943 | refs/heads/master | 2020-03-07T01:41:05.511133 | 2018-05-17T16:09:00 | 2018-05-17T16:09:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,618 | java | package br.Empresa.Models;
public class Login {
private int id;
private String user;
private String password;
public Login() {
this.id = 0;
this.user = "";
this.password = "";
}
public Login(int id, String usuario, String senha) {
super();
this.id = id;
this.user = usuario;
this.password = senha;
}
public String toString() {
return "Login [id=" + id + ", usuario=" + user + ", senha=" + password + "]";
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsuario() {
return user;
}
public void setUsuario(String usuario) {
this.user = usuario;
}
public String getSenha() {
return password;
}
public void setSenha(String senha) {
this.password = senha;
}
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((password == null) ? 0 : password.hashCode());
result = prime * result + ((user == null) ? 0 : user.hashCode());
return result;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Login other = (Login) obj;
if (id != other.id)
return false;
if (password == null) {
if (other.password != null)
return false;
} else if (!password.equals(other.password))
return false;
if (user == null) {
if (other.user != null)
return false;
} else if (!user.equals(other.user))
return false;
return true;
}
}
| [
"Marcelo@DESKTOP-3RQN849"
] | Marcelo@DESKTOP-3RQN849 |
3d45a524cb7cc08dcfe668436db57eb080f37391 | 9ef1b7b449164df370cdc521e4f3fbd68fd0b0d7 | /src/com/portfolio/RecommendPortfolioResponse.java | 5fa0ece68fd6061ce1a63ad7ff080511d8280d96 | [] | no_license | BurneyBill/PortfolioAdvisor | 57040b587afddea128a14e20963f01f870575d64 | 3894a9530e448eaefb1d81c3b54dd994db7dd132 | refs/heads/master | 2021-04-16T10:05:43.357083 | 2020-03-23T06:21:20 | 2020-03-23T06:21:20 | 249,348,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package com.portfolio;
/*
* RecommendPortfolioResponse
*
* JSON value returned from recommendPortfolio request.
*
*/
public class RecommendPortfolioResponse {
private String description;
private Portfolio portfolio;
public RecommendPortfolioResponse(String desc, Portfolio portfolio) {
this.description = desc;
this.portfolio = portfolio;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Portfolio getPortfolio() {
return portfolio;
}
public void setPortfolio(Portfolio portfolio) {
this.portfolio = portfolio;
}
}
| [
"[email protected]"
] | |
f65855abde23ee64fe01a7daa56c7fe333b8c4a4 | 04480db3c0e643184e84b0ffe01995d5b47939be | /Java Core/TestingSystem11/src/com/vti/backend/datalayer/AccountRepository.java | d5c7c2f5a04601c9cdaa9ab9dd9e75fee4be37aa | [] | no_license | conglinhrocket13/Rocket13 | 7e3d08b103241548cb161f9fdb6f4034e321c205 | 7710667a66d53116c38ea18315ca9bbc098ba90f | refs/heads/master | 2023-06-03T11:03:33.913884 | 2021-06-21T20:55:14 | 2021-06-21T20:55:14 | 364,826,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,686 | java | package com.vti.backend.datalayer;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DateFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import com.vti.entity.Account;
import com.vti.entity.Department;
import com.vti.entity.Position;
import com.vti.ultis.ScannerUltis;
import com.vti.ultis.jdbcUltis;
public class AccountRepository implements IAccountRepository{
private jdbcUltis jdbc;
public AccountRepository() throws FileNotFoundException, IOException {
jdbc = new jdbcUltis();
}
@Override
public ArrayList<Account> getListAccounts() throws ClassNotFoundException, SQLException, FileNotFoundException, IOException {
String sql = "SELECT * FROM Account ORDER BY AccountID";
ResultSet resultSet = jdbc.executeQuery(sql);
ArrayList<Account> listAcc = new ArrayList<Account>();
while (resultSet.next()) {
Account acc = new Account();
acc.setId(resultSet.getInt(1));
acc.setEmail(resultSet.getString(2));
acc.setUsername(resultSet.getString(3));
acc.setFullname(resultSet.getString(4));
DepartmentRepository depDao = new DepartmentRepository();
Department dep = depDao.getDepByID(resultSet.getInt(5));
acc.setDepartment(dep);
PositionRepository posDao = new PositionRepository();
Position pos = posDao.getPosByID(resultSet.getInt(6));
acc.setPosition(pos);
LocalDate lcd = resultSet.getDate(7).toLocalDate();
acc.setCreateDate(lcd);
listAcc.add(acc);
}
return listAcc;
}
@Override
public Account getAccByID(int id) throws SQLException, ClassNotFoundException, FileNotFoundException, IOException {
String sql = "SELECT * FROM Account WHERE AccountID = ?";
PreparedStatement preStatement = jdbc.createPrepareStatement(sql);
preStatement.setInt(1, id);
ResultSet resultSet = preStatement.executeQuery();
if (resultSet.next()) {
Account acc = new Account();
acc.setId(resultSet.getInt(1));
acc.setEmail(resultSet.getString(2));
acc.setUsername(resultSet.getString(3));
acc.setFullname(resultSet.getString(4));
DepartmentRepository depDao = new DepartmentRepository();
Department dep = depDao.getDepByID(resultSet.getInt(5));
acc.setDepartment(dep);
PositionRepository posDao = new PositionRepository();
acc.setPosition(posDao.getPosByID(resultSet.getInt(6)));
LocalDate lcd = Date.valueOf(resultSet.getDate(7).toString()).toLocalDate();
acc.setCreateDate(lcd);
return acc;
} else {
jdbc.disConnection();
return null;
}
}
@Override
public Boolean isAccNameExists(String name) throws SQLException, ClassNotFoundException {
String sql = "SELECT * FROM Account WHERE UserName = ?";
PreparedStatement preStatement = jdbc.createPrepareStatement(sql);
preStatement.setNString(1, name);
ResultSet result = preStatement.executeQuery();
if (result.next()) {
jdbc.disConnection();
return true;
} else {
jdbc.disConnection();
return false;
}
}
@Override
public boolean createAccount(Account acc, int depId, int posId) throws SQLException, ClassNotFoundException {
String sql = "INSERT INTO account (Email, UserName, FullName, DepartmentID, PositionID, CreateDate) VALUES (?, ?, ?,?,?,now());";
PreparedStatement preStatement = jdbc.createPrepareStatement(sql);
preStatement.setNString(1, acc.getEmail());
preStatement.setNString(2, acc.getUsername());
preStatement.setNString(3, acc.getFullname());
preStatement.setInt(4, depId);
preStatement.setInt(5, posId);
int result = preStatement.executeUpdate();
if (result == 1) {
jdbc.disConnection();
return true;
} else {
jdbc.disConnection();
return false;
}
}
@Override
public boolean delAccByID(int ID) throws ClassNotFoundException, SQLException {
String sql = "DELETE FROM Account WHERE (AccountID = ?);";
PreparedStatement preStatement = jdbc.createPrepareStatement(sql);
preStatement.setInt(1, ID);
int result = preStatement.executeUpdate();
if (result == 1) {
jdbc.disConnection();
return true;
} else {
jdbc.disConnection();
return false;
}
}
@Override
public boolean updateFullName(int id, String newFullName) throws ClassNotFoundException, SQLException {
String sql = "UPDATE account SET FullName = ? WHERE AccountID = ?;";
PreparedStatement preStatement = jdbc.createPrepareStatement(sql);
preStatement.setString(1, newFullName);
preStatement.setInt(2, id);
int result = preStatement.executeUpdate();
if (result == 1) {
jdbc.disConnection();
return true;
} else {
jdbc.disConnection();
return false;
}
}
}
| [
"[email protected]"
] | |
04e723d34a4aef3dc1f1c94b50ced5c5100e03ac | 3f85ea0e3892d147a240925b6a688285ddde3c68 | /src/main/java/be/vdab/web/IndexController.java | 8904acd43e08418d466e842c378a3646b17f6b1f | [] | no_license | thiersnicolas/groenetenen | 87dfd224bfd850f0b3d0c7b04732fc6b16b21ec2 | b70b3aab09b32339a07d68432b7d1b5f568aa2c7 | refs/heads/master | 2020-03-23T14:54:58.638274 | 2018-08-10T13:56:50 | 2018-08-10T13:56:50 | 141,707,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | package be.vdab.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/")
public class IndexController {
private static final String VIEW = "index";
private final Voorkeur voorkeur;
IndexController(Voorkeur voorkeur) {
this.voorkeur = voorkeur;
}
@GetMapping
ModelAndView index() {
return new ModelAndView(VIEW, "foto", voorkeur.getFoto());
}
@GetMapping(params="foto")
String kleurKeuze(String foto) {
voorkeur.setFoto(foto);
return "redirect:/";
}
}
| [
"[email protected]"
] | |
1336c934d63bc4f3e0a1252ffd52c4dc2da842eb | e5243a7b44eac6aec20ebd2d7f124141b5bfeef7 | /NerdLauncher/app/src/main/java/com/bignerdranch/android/nerdlauncher/SingleFragmentActivity.java | 0d85b7913a1fbbb2c179a835517a2e3d2a2119cc | [] | no_license | groz/android-course | 1e6ed35902dc504d3f492807fee3a0f6c0ee3d36 | 5bd5a39ff183ad5d47299434df9a45114f5e37e8 | refs/heads/master | 2021-01-21T04:47:54.537414 | 2016-07-11T02:25:00 | 2016-07-11T02:25:00 | 52,340,908 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,871 | java | package com.bignerdranch.android.nerdlauncher;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
public abstract class SingleFragmentActivity extends AppCompatActivity {
protected abstract String getLogTag();
protected abstract Fragment createFragment();
protected Fragment mFragment;
@LayoutRes
protected int getLayoutResId() {
return R.layout.activity_fragment;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(getLogTag(), "onCreate");
setContentView(getLayoutResId());
FragmentManager fm = getSupportFragmentManager();
mFragment = fm.findFragmentById(R.id.fragment_container);
if (mFragment == null) {
mFragment = createFragment();
fm.beginTransaction()
.add(R.id.fragment_container, mFragment)
.commit();
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Log.d(getLogTag(), "onSaveInstanceState");
}
@Override
public void onResume() {
super.onResume();
Log.d(getLogTag(), "onResume");
}
@Override
public void onStart() {
super.onStart();
Log.d(getLogTag(), "onStart");
}
@Override
public void onPause() {
super.onPause();
Log.d(getLogTag(), "onPause");
}
@Override
public void onStop() {
super.onStop();
Log.d(getLogTag(), "onStop");
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d(getLogTag(), "onDestroy");
}
}
| [
"[email protected]"
] | |
5ee703481130d40cae514a1cc00eec18c4e5897c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/34/34_56936139ae5f676213942f251052e25d4b2c7a53/kelondroRecords/34_56936139ae5f676213942f251052e25d4b2c7a53_kelondroRecords_s.java | 435c0248ea3421076918476911880cf01ee1b3fb | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 62,680 | java | // kelondroRecords.java
// -----------------------
// part of The Kelondro Database
// (C) by Michael Peter Christen; [email protected]
// first published on http://www.anomic.de
// Frankfurt, Germany, 2003, 2004
// last major change: 11.01.2004
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Using this software in any meaning (reading, learning, copying, compiling,
// running) means that you agree that the Author(s) is (are) not responsible
// for cost, loss of data or any harm that may be caused directly or indirectly
// by usage of this softare or this documentation. The usage of this software
// is on your own risk. The installation and usage (starting/running) of this
// software may allow other people or application to access your computer and
// any attached devices and is highly dependent on the configuration of the
// software which must be done by the user of the software; the author(s) is
// (are) also not responsible for proper configuration and usage of the
// software, even if provoked by documentation provided together with
// the software.
//
// Any changes to this file according to the GPL as documented in the file
// gpl.txt aside this file in the shipment you received can be done to the
// lines that follows this copyright notice here, but changes must not be
// done inside the copyright notive above. A re-distribution must contain
// the intact and unchanged copyright notice.
// Contributions and changes to the program code must be marked as such.
/*
The Kelondro Database
Kelondro Records are the basis for the tree structures of the needed database
Therefore, the name is inspired by the creek words 'fakelo'=file and 'dentro'=tree.
We omitted the 'fa' and 'de' in 'fakelodentro',
making it sounding better by replacing the 't' by 'd'.
The Kelondro Records are also used for non-tree structures like the KelondroStack.
The purpose of these structures are file-based storage of lists/stacks and
indexeable information.
We use the following structure:
Handle : handles are simply the abstraction of integer indexe's.
We don't want to mix up integer values as node pointers
with handles. This makes node indexes more robust against
manipulation that is too far away of thinking about records
Simply think that handles are like cardinals that are used
like pointers.
Node : The emelentary storage piece for one information fragment.
All Records, which are essentially files with a definitive
structure, are constructed of a list of Node elements, but
the Node Handles that are carried within the Node overhead
prefix construct a specific structure, like trees or stacks.
*/
package de.anomic.kelondro;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Iterator;
import java.util.logging.Logger;
public class kelondroRecords {
// constants
private static final int NUL = Integer.MIN_VALUE; // the meta value for the kelondroRecords' NUL abstraction
private static final long memBlock = 500000; // do not fill cache further if the amount of available memory is less that this
// memory calculation
private static final int element_in_cache = 52;
private static final int cache_control_entry = 96;
// caching flags
public static final int CP_NONE = -1; // cache priority none; entry shall not be cached
public static final int CP_LOW = 0; // cache priority low; entry may be cached
public static final int CP_MEDIUM = 1; // cache priority medium; entry shall be cached
public static final int CP_HIGH = 2; // cache priority high; entry must be cached
// static seek pointers
public static int LEN_DESCR = 60;
private static long POS_MAGIC = 0; // 1 byte, byte: file type magic
private static long POS_BUSY = POS_MAGIC + 1; // 1 byte, byte: marker for synchronization
private static long POS_PORT = POS_BUSY + 1; // 2 bytes, short: hint for remote db access
private static long POS_DESCR = POS_PORT + 2; // 60 bytes, string: any description string
private static long POS_COLUMNS = POS_DESCR + LEN_DESCR; // 2 bytes, short: number of columns in one entry
private static long POS_OHBYTEC = POS_COLUMNS + 2; // 2 bytes, number of extra bytes on each Node
private static long POS_OHHANDLEC = POS_OHBYTEC + 2; // 2 bytes, number of Handles on each Node
private static long POS_USEDC = POS_OHHANDLEC + 2; // 4 bytes, int: used counter
private static long POS_FREEC = POS_USEDC + 4; // 4 bytes, int: free counter
private static long POS_FREEH = POS_FREEC + 4; // 4 bytes, int: free pointer (to free chain start)
private static long POS_MD5PW = POS_FREEH + 4; // 16 bytes, string (encrypted password to this file)
private static long POS_ENCRYPTION = POS_MD5PW + 16; // 16 bytes, string (method description)
private static long POS_OFFSET = POS_ENCRYPTION + 16; // 8 bytes, long (seek position of first record)
private static long POS_INTPROPC = POS_OFFSET + 8; // 4 bytes, int: number of INTPROP elements
private static long POS_TXTPROPC = POS_INTPROPC + 4; // 4 bytes, int: number of TXTPROP elements
private static long POS_TXTPROPW = POS_TXTPROPC + 4; // 4 bytes, int: width of TXTPROP elements
private static long POS_COLWIDTHS = POS_TXTPROPW + 4; // array of 4 bytes, int[]: sizes of columns
// after this configuration field comes:
// POS_HANDLES: INTPROPC * 4 bytes : INTPROPC Integer properties, randomly accessible
// POS_TXTPROPS: TXTPROPC * TXTPROPW : an array of TXTPROPC byte arrays of width TXTPROPW that can hold any string
// POS_NODES : (USEDC + FREEC) * (overhead + sum(all: COLWIDTHS)) : Node Objects
// values that are only present at run-time
protected String filename; // the database's file name
protected kelondroIOChunks entryFile; // the database file
private int overhead; // OHBYTEC + 4 * OHHANDLEC = size of additional control bytes
private int headchunksize;// overheadsize + key element column size
private int tailchunksize;// sum(all: COLWIDTHS) minus the size of the key element colum
private int recordsize; // (overhead + sum(all: COLWIDTHS)) = the overall size of a record
// dynamic run-time seek pointers
private long POS_HANDLES = 0; // starts after end of POS_COLWIDHS which is POS_COLWIDTHS + COLWIDTHS.length * 4
private long POS_TXTPROPS = 0; // starts after end of POS_HANDLES which is POS_HANDLES + HANDLES.length * 4
private long POS_NODES = 0; // starts after end of POS_TXTPROPS which is POS_TXTPROPS + TXTPROPS.length * TXTPROPW
// dynamic variables that are back-ups of stored values in file; read/defined on instantiation
/*
private int USEDC; // counter of used elements
private int FREEC; // counter of free elements in list of free Nodes
private Handle FREEH; // pointer to first element in list of free Nodes, empty = NUL
*/
private usageControl USAGE; // counter for used and re-use records and pointer to free-list
private short OHBYTEC; // number of extra bytes in each node
private short OHHANDLEC; // number of handles in each node
protected int COLWIDTHS[]; // array with widths of columns
private Handle HANDLES[]; // array with handles
private byte[] TXTPROPS[]; // array with text properties
private int TXTPROPW; // size of a single TXTPROPS element
// caching buffer
protected HashMap[] XcacheHeaders; // the cache; holds overhead values and key element
protected int XcacheSize; // number of cache records
protected long XcacheStartup; // startup time; for cache aging
protected kelondroMScoreCluster cacheScore; // controls cache aging
// optional logger
protected Logger theLogger = null;
// Random. This is used to shift flush-times of write-buffers to differrent time
private static Random random = new Random(System.currentTimeMillis());
private class usageControl {
private int USEDC; // counter of used elements
private int FREEC; // counter of free elements in list of free Nodes
private Handle FREEH; // pointer to first element in list of free Nodes, empty = NUL
public usageControl() throws IOException {
read();
}
public usageControl(int usedc, int freec, Handle freeh) {
this.USEDC = usedc;
this.FREEC = freec;
this.FREEH = freeh;
}
public void write() throws IOException {
synchronized (entryFile) {
entryFile.writeInt(POS_USEDC, USEDC);
entryFile.writeInt(POS_FREEC, FREEC);
entryFile.writeInt(POS_FREEH, FREEH.index);
}
}
public void read() throws IOException {
synchronized (entryFile) {
this.USEDC = entryFile.readInt(POS_USEDC);
this.FREEC = entryFile.readInt(POS_FREEC);
this.FREEH = new Handle(entryFile.readInt(POS_FREEH));
}
}
public int allCount() {
return this.USEDC + this.FREEC;
}
}
public kelondroRecords(File file, long buffersize /* bytes */,
short ohbytec, short ohhandlec,
int[] columns, int FHandles, int txtProps, int txtPropWidth,
boolean exitOnFail) {
// creates a new file
// file: the file that shall be created
// oha : overhead size array of four bytes: oha[0]=# of bytes, oha[1]=# of shorts, oha[2]=# of ints, oha[3]=# of longs,
// columns: array with size of column width; columns.length is number of columns
// FHandles: number of integer properties
// txtProps: number of text properties
assert (!file.exists()) : "file " + file + " already exist";
try {
this.filename = file.getCanonicalPath();
kelondroRA raf = new kelondroFileRA(this.filename);
// kelondroRA raf = new kelondroBufferedRA(new kelondroFileRA(this.filename), 1024, 100);
// kelondroRA raf = new kelondroNIOFileRA(this.filename, false, 10000);
init(raf, ohbytec, ohhandlec, columns, FHandles, txtProps, txtPropWidth, buffersize / 10);
} catch (IOException e) {
logFailure("cannot create / " + e.getMessage());
if (exitOnFail)
System.exit(-1);
}
initCache(buffersize / 10 * 9);
}
public kelondroRecords(kelondroRA ra, long buffersize /* bytes */,
short ohbytec, short ohhandlec,
int[] columns, int FHandles, int txtProps, int txtPropWidth,
boolean exitOnFail) {
this.filename = null;
try {
init(ra, ohbytec, ohhandlec, columns, FHandles, txtProps, txtPropWidth, buffersize / 10);
} catch (IOException e) {
logFailure("cannot create / " + e.getMessage());
if (exitOnFail) System.exit(-1);
}
initCache(buffersize / 10 * 9);
}
private void init(kelondroRA ra, short ohbytec, short ohhandlec,
int[] columns, int FHandles, int txtProps, int txtPropWidth, long writeBufferSize) throws IOException {
// create new Chunked IO
this.entryFile = new kelondroBufferedIOChunks(ra, ra.name(), writeBufferSize, 30000 + random.nextLong() % 30000);
//this.entryFile = new kelondroRAIOChunks(ra, ra.name());
// store dynamic run-time data
this.overhead = ohbytec + 4 * ohhandlec;
this.recordsize = this.overhead;
for (int i = 0; i < columns.length; i++) this.recordsize += columns[i];
this.headchunksize = overhead + columns[0];
this.tailchunksize = this.recordsize - this.headchunksize;
// store dynamic run-time seek pointers
POS_HANDLES = POS_COLWIDTHS + columns.length * 4;
POS_TXTPROPS = POS_HANDLES + FHandles * 4;
POS_NODES = POS_TXTPROPS + txtProps * txtPropWidth;
// store dynamic back-up variables
USAGE = new usageControl(0, 0, new Handle(NUL));
OHBYTEC = ohbytec;
OHHANDLEC = ohhandlec;
COLWIDTHS = columns;
HANDLES = new Handle[FHandles];
for (int i = 0; i < FHandles; i++) HANDLES[i] = new Handle(NUL);
TXTPROPS = new byte[txtProps][];
for (int i = 0; i < txtProps; i++) TXTPROPS[i] = new byte[0];
TXTPROPW = txtPropWidth;
// write data to file
entryFile.writeByte(POS_MAGIC, 4); // magic marker for this file type
entryFile.writeByte(POS_BUSY, 0); // unlock: default
entryFile.writeShort(POS_PORT, 4444); // default port (not used yet)
entryFile.write(POS_DESCR, "--AnomicRecords file structure--".getBytes());
entryFile.writeShort(POS_COLUMNS, this.COLWIDTHS.length);
entryFile.writeShort(POS_OHBYTEC, OHBYTEC);
entryFile.writeShort(POS_OHHANDLEC, OHHANDLEC);
entryFile.writeInt(POS_USEDC, this.USAGE.USEDC);
entryFile.writeInt(POS_FREEC, this.USAGE.FREEC);
entryFile.writeInt(POS_FREEH, this.USAGE.FREEH.index);
entryFile.write(POS_MD5PW, "PASSWORDPASSWORD".getBytes());
entryFile.write(POS_ENCRYPTION, "ENCRYPTION!#$%&?".getBytes());
entryFile.writeLong(POS_OFFSET, POS_NODES);
entryFile.writeInt(POS_INTPROPC, FHandles);
entryFile.writeInt(POS_TXTPROPC, txtProps);
entryFile.writeInt(POS_TXTPROPW, txtPropWidth);
// write configuration arrays
for (int i = 0; i < this.COLWIDTHS.length; i++) {
entryFile.writeInt(POS_COLWIDTHS + 4 * i, COLWIDTHS[i]);
}
for (int i = 0; i < this.HANDLES.length; i++) {
entryFile.writeInt(POS_HANDLES + 4 * i, NUL);
HANDLES[i] = new Handle(NUL);
}
byte[] ea = new byte[TXTPROPW];
for (int j = 0; j < TXTPROPW; j++) ea[j] = 0;
for (int i = 0; i < this.TXTPROPS.length; i++) {
entryFile.write(POS_TXTPROPS + TXTPROPW * i, ea);
}
this.entryFile.commit();
}
public void setDescription(byte[] description) throws IOException {
if (description.length > LEN_DESCR)
entryFile.write(POS_DESCR, description, 0, LEN_DESCR);
else
entryFile.write(POS_DESCR, description);
}
public byte[] getDescription() throws IOException {
byte[] b = new byte[LEN_DESCR];
entryFile.readFully(POS_DESCR, b, 0, LEN_DESCR);
return b;
}
public void setLogger(Logger newLogger) {
this.theLogger = newLogger;
}
public void logWarning(String message) {
if (this.theLogger == null)
System.err.println("KELONDRO WARNING for file " + this.filename + ": " + message);
else
this.theLogger.warning("KELONDRO WARNING for file " + this.filename + ": " + message);
}
public void logFailure(String message) {
if (this.theLogger == null)
System.err.println("KELONDRO FAILURE for file " + this.filename + ": " + message);
else
this.theLogger.severe("KELONDRO FAILURE for file " + this.filename + ": " + message);
}
public void clear() throws IOException {
// Removes all mappings from this map
// throw new UnsupportedOperationException("clear not supported");
synchronized (USAGE) {
this.USAGE.USEDC = 0;
this.USAGE.FREEC = 0;
this.USAGE.FREEH = new Handle(NUL);
}
this.USAGE.write();
}
public kelondroRecords(File file, long buffersize) throws IOException{
// opens an existing tree
assert (file.exists()): "file " + file.getAbsoluteFile().toString() + " does not exist";
this.filename = file.getCanonicalPath();
kelondroRA raf = new kelondroFileRA(this.filename);
//kelondroRA raf = new kelondroBufferedRA(new kelondroFileRA(this.filename), 1024, 100);
//kelondroRA raf = new kelondroCachedRA(new kelondroFileRA(this.filename), 5000000, 1000);
//kelondroRA raf = new kelondroNIOFileRA(this.filename, (file.length() < 4000000), 10000);
init(raf, buffersize / 10);
initCache(buffersize / 10 * 9);
}
public kelondroRecords(kelondroRA ra, long buffersize) throws IOException{
this.filename = null;
init(ra, buffersize / 10);
initCache(buffersize / 10 * 9);
}
private void init(kelondroRA ra, long writeBufferSize) throws IOException {
// read from Chunked IO
this.entryFile = new kelondroBufferedIOChunks(ra, ra.name(), writeBufferSize, 30000 + random.nextLong() % 30000);
//this.entryFile = new kelondroRAIOChunks(ra, ra.name());
// read dynamic variables that are back-ups of stored values in file;
// read/defined on instantiation
this.USAGE = new usageControl();
this.OHBYTEC = entryFile.readShort(POS_OHBYTEC);
this.OHHANDLEC = entryFile.readShort(POS_OHHANDLEC);
this.COLWIDTHS = new int[entryFile.readShort(POS_COLUMNS)];
this.HANDLES = new Handle[entryFile.readInt(POS_INTPROPC)];
this.TXTPROPS = new byte[entryFile.readInt(POS_TXTPROPC)][];
this.TXTPROPW = entryFile.readInt(POS_TXTPROPW);
if (COLWIDTHS.length == 0) throw new kelondroException(filename, "init: zero columns; strong failure");
// calculate dynamic run-time seek pointers
POS_HANDLES = POS_COLWIDTHS + COLWIDTHS.length * 4;
POS_TXTPROPS = POS_HANDLES + HANDLES.length * 4;
POS_NODES = POS_TXTPROPS + TXTPROPS.length * TXTPROPW;
// read configuration arrays
for (int i = 0; i < COLWIDTHS.length; i++) {
COLWIDTHS[i] = entryFile.readInt(POS_COLWIDTHS + 4 * i);
}
for (int i = 0; i < HANDLES.length; i++) {
HANDLES[i] = new Handle(entryFile.readInt(POS_HANDLES + 4 * i));
}
for (int i = 0; i < TXTPROPS.length; i++) {
TXTPROPS[i] = new byte[TXTPROPW];
entryFile.readFully(POS_TXTPROPS + TXTPROPW * i, TXTPROPS[i], 0, TXTPROPS[i].length);
}
// assign remaining values that are only present at run-time
this.overhead = OHBYTEC + 4 * OHHANDLEC;
this.recordsize = this.overhead;
for (int i = 0; i < COLWIDTHS.length; i++) this.recordsize += COLWIDTHS[i];
this.headchunksize = this.overhead + COLWIDTHS[0];
this.tailchunksize = this.recordsize - this.headchunksize;
}
private void initCache(long buffersize) {
if (buffersize <= 0) {
this.XcacheSize = 0;
this.XcacheHeaders = null;
this.cacheScore = null;
} else {
if ((buffersize / cacheChunkSize(false)) > size()) {
this.XcacheSize = (int) (buffersize / cacheChunkSize(false));
this.cacheScore = null; // no cache control because we have more cache slots than database entries
} else {
this.XcacheSize = (int) (buffersize / cacheChunkSize(true));
this.cacheScore = new kelondroMScoreCluster(); // cache control of CP_HIGH caches
}
this.XcacheHeaders = new HashMap[]{new HashMap(), new HashMap(), new HashMap()};
}
this.XcacheStartup = System.currentTimeMillis();
}
private static final long max = Runtime.getRuntime().maxMemory();
private static final Runtime runtime = Runtime.getRuntime();
private static long availableMemory() {
// memory that is available including increasing total memory up to maximum
return max - runtime.totalMemory() + runtime.freeMemory();
}
public File file() {
if (filename == null) return null;
return new File(filename);
}
protected final int cacheChunkSize(boolean cacheControl) {
return this.headchunksize + element_in_cache + ((cacheControl) ? cache_control_entry : 0);
}
public int[] cacheChunkSize() {
// returns three integers:
// #0: chunk size of CP_LOW - priority entries
// #1: chunk size of CP_MEDIUM - priority entries
// #2: chunk size of CP_HIGH - priority entries
int[] i = new int[3];
i[CP_LOW] = cacheChunkSize(false);
i[CP_MEDIUM] = cacheChunkSize(false);
i[CP_HIGH] = cacheChunkSize(this.cacheScore != null);
return i;
}
public int[] cacheFillStatus() {
if (XcacheHeaders == null) return new int[]{0,0,0,0};
return new int[]{XcacheSize - (XcacheHeaders[CP_HIGH].size() + XcacheHeaders[CP_MEDIUM].size() + XcacheHeaders[CP_LOW].size()), XcacheHeaders[CP_HIGH].size(), XcacheHeaders[CP_MEDIUM].size(), XcacheHeaders[CP_LOW].size()};
}
protected Node newNode() throws IOException {
return new Node();
}
protected Node getNode(Handle handle) throws IOException {
return getNode(handle, null, 0);
}
protected Node getNode(Handle handle, Node parentNode, int referenceInParent) throws IOException {
return new Node(handle, parentNode, referenceInParent);
}
protected void deleteNode(Handle handle) throws IOException {
if (XcacheSize != 0) {
synchronized (XcacheHeaders) {
if (cacheScore == null) {
XcacheHeaders[CP_LOW].remove(handle);
XcacheHeaders[CP_MEDIUM].remove(handle);
XcacheHeaders[CP_HIGH].remove(handle);
} else if (XcacheHeaders[CP_HIGH].get(handle) != null) {
// remove handle from cache-control
cacheScore.deleteScore(handle);
XcacheHeaders[CP_HIGH].remove(handle);
} else if (XcacheHeaders[CP_MEDIUM].get(handle) != null) {
// no cache control for medium-priority entries
XcacheHeaders[CP_MEDIUM].remove(handle);
} else if (XcacheHeaders[CP_LOW].get(handle) != null) {
// no cache control for low-priority entries
XcacheHeaders[CP_LOW].remove(handle);
}
}
}
dispose(handle);
}
public final class Node {
// an Node holds all information of one row of data. This includes the key to the entry
// which is stored as entry element at position 0
// an Node object can be created in two ways:
// 1. instantiation with an index number. After creation the Object does not hold any
// value information until such is retrieved using the getValue() method
// 2. instantiation with a value array. the values are not directly written into the
// file. Expanding the tree structure is then done using the save() method. at any
// time it is possible to verify the save state using the saved() predicate.
// Therefore an entry object has three modes:
// a: holding an index information only (saved() = true)
// b: holding value information only (saved() = false)
// c: holding index and value information at the same time (saved() = true)
// which can be the result of one of the two processes as follow:
// (i) created with index and after using the getValue() method, or
// (ii) created with values and after calling the save() method
// the method will therefore throw an IllegalStateException when the following
// process step is performed:
// - create the Node with index and call then the save() method
// this case can be decided with
// ((index != NUL) && (values == null))
// The save() method represents the insert function for the tree. Balancing functions
// are applied automatically. While balancing, the Node does never change its index key,
// but its parent/child keys.
//private byte[] ohBytes = null; // the overhead bytes, OHBYTEC values
//private Handle[] ohHandle= null; // the overhead handles, OHHANDLEC values
//private byte[][] values = null; // an array of byte[] nodes is the value vector
private Handle handle = null; // index of the entry, by default NUL means undefined
private byte[] headChunk = null; // contains ohBytes, ohHandles and the key value
private byte[] tailChunk = null; // contains all values except the key value
private boolean headChanged = false;
private boolean tailChanged = false;
private Node() throws IOException {
// create a new empty node and reserve empty space in file for it
// use this method only if you want to extend the file with new entries
// without the need to have content in it.
this.handle = new Handle();
// create empty chunks
this.headChunk = new byte[headchunksize];
this.tailChunk = new byte[tailchunksize];
for (int i = 0; i < headchunksize; i++) this.headChunk[i] = 0;
for (int i = 0; i < tailchunksize; i++) this.tailChunk[i] = 0;
this.headChanged = true;
this.tailChanged = true;
}
private Node(Handle handle) throws IOException {
// this creates an entry with an pre-reserved entry position
// values can be written using the setValues() method
// but we expect that values are already there in the file ready to
// be read which we do not here
if (handle == null) throw new kelondroException(filename, "INTERNAL ERROR: node handle is null.");
if (handle.index >= USAGE.allCount()) throw new kelondroException(filename, "INTERNAL ERROR: node handle index exceeds size.");
// use given handle
this.handle = new Handle(handle.index);
// init the content
initContent();
}
private Node(Handle handle, Node parentNode, int referenceInParent) throws IOException {
// this creates an entry with an pre-reserved entry position values can be written
// using the setValues() method but we expect that values are already there in the file
// ready to be read which we do not here
assert (handle != null): "node handle is null";
assert (handle.index >= 0): "node handle too low: " + handle.index;
//assert (handle.index < USAGE.allCount()) : "node handle too high: " + handle.index + ", USEDC=" + USAGE.USEDC + ", FREEC=" + USAGE.FREEC;
// the parentNode can be given if an auto-fix in the following case is wanted
if (handle == null) throw new kelondroException(filename, "INTERNAL ERROR: node handle is null.");
if (handle.index >= USAGE.allCount()) {
if (parentNode == null) {
throw new kelondroException(filename, "INTERNAL ERROR, Node/init: node handle index exceeds size. No auto-fix node was submitted. This is a serious failure.");
} else {
try {
parentNode.setOHHandle(referenceInParent, null);
parentNode.commit(CP_NONE);
logWarning("INTERNAL ERROR, Node/init in " + filename + ": node handle index " + handle.index + " exceeds size. The bad node has been auto-fixed");
} catch (IOException ee) {
throw new kelondroException(filename, "INTERNAL ERROR, Node/init: node handle index " + handle.index + " exceeds size. It was tried to fix the bad node, but failed with an IOException: " + ee.getMessage());
}
}
}
// use given handle
this.handle = new Handle(handle.index);
// init the content
initContent();
}
private void initContent() throws IOException {
// create chunks; read them from file or cache
this.tailChunk = null;
if (XcacheSize == 0) {
// read overhead and key
//System.out.println("**NO CACHE for " + this.handle.index + "**");
this.headChunk = new byte[headchunksize];
entryFile.readFully(seekpos(this.handle), this.headChunk, 0, this.headChunk.length);
this.headChanged = false;
} else synchronized(XcacheHeaders) {
byte[] cacheEntry = null;
int cp = CP_HIGH;
cacheEntry = (byte[]) XcacheHeaders[CP_HIGH].get(this.handle); // first try
if (cacheEntry == null) {
cacheEntry = (byte[]) XcacheHeaders[CP_MEDIUM].get(this.handle); // second try
cp = CP_MEDIUM;
}
if (cacheEntry == null) {
cacheEntry = (byte[]) XcacheHeaders[CP_LOW].get(this.handle); // third try
cp = CP_LOW;
}
if (cacheEntry == null) {
// cache miss, we read overhead and key from file
//System.out.println("**CACHE miss for " + this.handle.index + "**");
this.headChunk = new byte[headchunksize];
//this.tailChunk = new byte[tailchunksize];
entryFile.readFully(seekpos(this.handle), this.headChunk, 0, this.headChunk.length);
this.headChanged = true; // provoke a cache store
cp = CP_HIGH;
if (OHHANDLEC == 3) {
Handle l = getOHHandle(1);
Handle r = getOHHandle(2);
if ((l == null) && (r == null)) cp = CP_LOW;
else if ((l == null) || (r == null)) cp = CP_MEDIUM;
}
// if space left in cache, copy these value to the cache
update2Cache(cp);
} else {
// cache hit, copy overhead and key from cache
//System.out.println("**CACHE HIT for " + this.handle.index + "**");
this.headChunk = new byte[headchunksize];
System.arraycopy(cacheEntry, 0, this.headChunk, 0, headchunksize);
// update cache scores to announce this cache hit
if ((cacheScore != null) && (cp == CP_HIGH)) {
cacheScore.setScore(this.handle, (int) ((System.currentTimeMillis() - XcacheStartup) / 1000));
}
this.headChanged = false;
}
}
}
private void setValue(byte[] value, int valuewidth, byte[] targetarray, int targetoffset) {
if (value == null) {
while (valuewidth-- > 0) targetarray[targetoffset + valuewidth] = 0;
} else {
System.arraycopy(value, 0, targetarray, targetoffset, Math.min(value.length, valuewidth)); // error?
if (value.length < valuewidth) {
while (valuewidth-- > value.length) targetarray[targetoffset + valuewidth] = 0;
}
}
}
protected Handle handle() {
// if this entry has an index, return it
if (this.handle.index == NUL) throw new kelondroException(filename, "the entry has no index assigned");
return new Handle(this.handle.index);
}
protected void setOHByte(int i, byte b) {
if (i >= OHBYTEC) throw new IllegalArgumentException("setOHByte: wrong index " + i);
if (this.handle.index == NUL) throw new kelondroException(filename, "setOHByte: no handle assigned");
this.headChunk[i] = b;
this.headChanged = true;
}
protected void setOHHandle(int i, Handle otherhandle) {
assert (i < OHHANDLEC): "setOHHandle: wrong array size " + i;
assert (this.handle.index != NUL): "setOHHandle: no handle assigned ind file" + filename;
if (otherhandle == null) {
NUL2bytes(this.headChunk, OHBYTEC + 4 * i);
} else {
if (otherhandle.index >= USAGE.allCount()) throw new kelondroException(filename, "INTERNAL ERROR, setOHHandles: handle " + i + " exceeds file size (" + handle.index + " >= " + USAGE.allCount() + ")");
int2bytes(otherhandle.index, this.headChunk, OHBYTEC + 4 * i);
}
this.headChanged = true;
}
protected byte getOHByte(int i) {
if (i >= OHBYTEC) throw new IllegalArgumentException("getOHByte: wrong index " + i);
if (this.handle.index == NUL) throw new kelondroException(filename, "Cannot load OH values");
return this.headChunk[i];
}
protected Handle getOHHandle(int i) {
if (this.handle.index == NUL) throw new kelondroException(filename, "Cannot load OH values");
assert (i < OHHANDLEC): "handle index out of bounds: " + i + " in file " + filename;
int h = bytes2int(this.headChunk, OHBYTEC + 4 * i);
return (h == NUL) ? null : new Handle(h);
}
public byte[][] setValues(byte[][] row) throws IOException {
// if the index is defined, then write values directly to the file, else only to the object
byte[][] result = getValues(); // previous value (this loads the values if not already happened)
// set values
if (this.handle.index != NUL) {
setValue(row[0], COLWIDTHS[0], headChunk, overhead);
int offset = 0;
for (int i = 1; i < row.length; i++) {
setValue(row[i], COLWIDTHS[i], tailChunk, offset);
offset +=COLWIDTHS[i];
}
}
this.headChanged = true;
this.tailChanged = true;
return result; // return previous value
}
public byte[] getKey() {
// read key
return trimCopy(headChunk, overhead, COLWIDTHS[0]);
}
public byte[][] getValues() throws IOException {
if (this.tailChunk == null) {
// load all values from the database file
this.tailChunk = new byte[tailchunksize];
// read values
entryFile.readFully(seekpos(this.handle) + headchunksize, this.tailChunk, 0, this.tailChunk.length);
}
// create return value
byte[][] values = new byte[COLWIDTHS.length][];
// read key
values[0] = trimCopy(headChunk, overhead, COLWIDTHS[0]);
// read remaining values
int offset = 0;
for (int i = 1; i < COLWIDTHS.length; i++) {
values[i] = trimCopy(tailChunk, offset, COLWIDTHS[i]);
offset += COLWIDTHS[i];
}
return values;
}
public synchronized void commit(int cachePriority) throws IOException {
// this must be called after all write operations to the node are
// finished
// place the data to the file
if (this.headChunk == null) {
// there is nothing to save
throw new kelondroException(filename, "no values to save (header missing)");
}
// save head
if (this.headChanged) {
//System.out.println("WRITEH(" + filename + ", " + seekpos(this.handle) + ", " + this.headChunk.length + ")");
entryFile.write(seekpos(this.handle), this.headChunk);
update2Cache(cachePriority);
}
// save tail
if ((this.tailChunk != null) && (this.tailChanged)) {
//System.out.println("WRITET(" + filename + ", " + (seekpos(this.handle) + headchunksize) + ", " + this.tailChunk.length + ")");
entryFile.write(seekpos(this.handle) + headchunksize, this.tailChunk);
}
}
public synchronized void collapse() {
// this must be called after all write and read operations to the
// node are finished
this.headChunk = null;
this.tailChunk = null;
this.handle = null;
}
private byte[] trimCopy(byte[] a, int offset, int length) {
if (length > a.length - offset)
length = a.length - offset;
while ((length > 0) && (a[offset + length - 1] == 0))
length--;
if (length == 0)
return null;
byte[] b = new byte[length];
System.arraycopy(a, offset, b, 0, length);
return b;
}
public String toString() {
if (this.handle.index == NUL) return "NULL";
String s = Integer.toHexString(this.handle.index);
Handle h;
while (s.length() < 4) s = "0" + s;
try {
for (int i = 0; i < OHBYTEC; i++) s = s + ":b" + getOHByte(i);
for (int i = 0; i < OHHANDLEC; i++) {
h = getOHHandle(i);
if (h == null) s = s + ":hNULL"; else s = s + ":h" + h.toString();
}
byte[][] content = getValues();
for (int i = 0; i < content.length; i++) s = s + ":" + ((content[i] == null) ? "NULL" : (new String(content[i], "UTF-8")).trim());
} catch (IOException e) {
s = s + ":***LOAD ERROR***:" + e.getMessage();
}
return s;
}
private void update2Cache(int forPriority) {
if (XcacheSize > 0) {
XcacheHeaders[CP_LOW].remove(this.handle);
XcacheHeaders[CP_MEDIUM].remove(this.handle);
XcacheHeaders[CP_HIGH].remove(this.handle);
}
if (cacheSpace(forPriority)) updateNodeCache(forPriority);
}
private boolean cacheSpace(int forPriority) {
// check for space in cache
// should be only called within a synchronized(XcacheHeaders) environment
// returns true if it is allowed to add another entry to the cache
// returns false if the cache is considered to be full
if (forPriority == CP_NONE) return false;
if (XcacheSize == 0) return false; // no caching
long cs = XcacheHeaders[CP_LOW].size() + XcacheHeaders[CP_MEDIUM].size() + XcacheHeaders[CP_HIGH].size();
if (cs == 0) return true; // nothing there to flush
if ((cs < XcacheSize) && (availableMemory() >= memBlock)) return true; // no need to flush cache space
Handle delkey;
// delete one entry. distinguish between different priority cases:
if (forPriority == CP_LOW) {
// remove only from low-priority cache
if (XcacheHeaders[CP_LOW].size() != 0) {
// just delete any of the low-priority entries
delkey = (Handle) XcacheHeaders[CP_LOW].keySet().iterator().next();
XcacheHeaders[CP_LOW].remove(delkey);
return true;
} else {
// we cannot delete any entry, therefore there is no space for another entry
return false;
}
} else if (forPriority == CP_MEDIUM) {
if (XcacheHeaders[CP_LOW].size() != 0) {
// just delete any of the low-priority entries
delkey = (Handle) XcacheHeaders[CP_LOW].keySet().iterator().next();
XcacheHeaders[CP_LOW].remove(delkey);
return true;
} else if (XcacheHeaders[CP_MEDIUM].size() != 0) {
// just delete any of the medium-priority entries
delkey = (Handle) XcacheHeaders[CP_MEDIUM].keySet().iterator().next();
XcacheHeaders[CP_MEDIUM].remove(delkey);
return true;
} else {
// we cannot delete any entry, therefore there is no space for another entry
return false;
}
} else {
// request for a high-priority entry
if (XcacheHeaders[CP_LOW].size() != 0) {
// just delete any of the low-priority entries
delkey = (Handle) XcacheHeaders[CP_LOW].keySet().iterator().next();
XcacheHeaders[CP_LOW].remove(delkey);
return true;
} else if (XcacheHeaders[CP_MEDIUM].size() != 0) {
// just delete any of the medium-priority entries
delkey = (Handle) XcacheHeaders[CP_MEDIUM].keySet().iterator().next();
XcacheHeaders[CP_MEDIUM].remove(delkey);
return true;
} else if (cacheScore == null) {
// no cache-control of high-priority cache
// the cache is considered as full
return false;
} else try {
// delete one from the high-priority entries
// use the cache-control to find the right object
delkey = (Handle) cacheScore.getMinObject();
cacheScore.deleteScore(delkey);
XcacheHeaders[CP_HIGH].remove(delkey);
return true;
} catch (NoSuchElementException e) {
// this is a strange error and could be caused by internal java problems
// we simply clear the cache
String error = "cachScore error: " + e.getMessage() + "; cachesize=" + XcacheSize + ", cache.size()=[" + XcacheHeaders[0].size() + "," + XcacheHeaders[1].size() + "," + XcacheHeaders[2].size() + "], cacheScore.size()=" + cacheScore.size();
cacheScore = new kelondroMScoreCluster();
XcacheHeaders[CP_LOW] = new HashMap();
XcacheHeaders[CP_MEDIUM] = new HashMap();
XcacheHeaders[CP_HIGH] = new HashMap();
throw new kelondroException(filename, error);
}
}
}
private void updateNodeCache(int priority) {
if (this.handle == null) return; // wrong access
if (this.headChunk == null) return; // nothing there to cache
if (priority == CP_NONE) return; // it is not wanted that this shall be cached
if (XcacheSize == 0) return; // we do not use the cache
int cs = XcacheHeaders[CP_LOW].size() + XcacheHeaders[CP_MEDIUM].size() + XcacheHeaders[CP_HIGH].size();
if (cs >= XcacheSize) return; // no cache update if cache is full
synchronized (XcacheHeaders) {
// generate cache entry
byte[] cacheEntry = new byte[headchunksize];
System.arraycopy(headChunk, 0, cacheEntry, 0, headchunksize);
Handle cacheHandle = new Handle(this.handle.index);
// store the cache entry
//XcacheHeaders.remove(cacheHandle);
if (priority != CP_LOW) XcacheHeaders[CP_LOW].remove(cacheHandle);
if (priority != CP_MEDIUM) XcacheHeaders[CP_MEDIUM].remove(cacheHandle);
if (priority != CP_HIGH) XcacheHeaders[CP_HIGH].remove(cacheHandle);
XcacheHeaders[priority].put(cacheHandle, cacheEntry);
if ((cacheScore != null) && (priority == CP_HIGH)) {
cacheScore.setScore(cacheHandle, (int) ((System.currentTimeMillis() - XcacheStartup) / 1000));
}
// delete the cache entry buffer
cacheEntry = null;
cacheHandle = null;
//System.out.println("kelondroRecords cache4" + filename + ": cache record size = " + (memBefore - Runtime.getRuntime().freeMemory()) + " bytes" + ((newentry) ? " new" : ""));
//printCache();
}
}
}
protected void printCache() {
if (XcacheSize == 0) {
System.out.println("### file report: " + size() + " entries");
for (int i = 0; i < size() + 3; i++) {
// print from file to compare
System.out.print("#F " + i + ": ");
try {
for (int j = 0; j < headchunksize; j++)
System.out.print(entryFile.readByte(j + seekpos(new Handle(i))) + ",");
} catch (IOException e) {}
System.out.println();
}
} else {
System.out.println("### cache report: [" + XcacheHeaders[0].size() + "," + XcacheHeaders[0].size() + "," + XcacheHeaders[0].size() + "] entries");
for (int cp = 0; cp < 3; cp++) {
Iterator i = XcacheHeaders[cp].entrySet().iterator();
Map.Entry entry;
while (i.hasNext()) {
entry = (Map.Entry) i.next();
// print from cache
System.out.print("#C " + cp + " ");
printChunk((Handle) entry.getKey(), (byte[]) entry.getValue());
System.out.println();
// print from file to compare
System.out.print("#F " + cp + " " + ((Handle) entry.getKey()).index + ": ");
try {
for (int j = 0; j < headchunksize; j++)
System.out.print(entryFile.readByte(j + seekpos((Handle) entry.getKey())) + ",");
} catch (IOException e) {}
System.out.println();
}
}
}
System.out.println("### end report");
}
private void printChunk(Handle handle, byte[] chunk) {
System.out.print(handle.index + ": ");
for (int j = 0; j < chunk.length; j++) System.out.print(chunk[j] + ",");
}
public synchronized int columns() {
return this.COLWIDTHS.length;
}
public synchronized int columnSize(int column) {
if ((column < 0) || (column >= this.COLWIDTHS.length)) return -1;
return this.COLWIDTHS[column];
}
private final long seekpos(Handle handle) {
assert (handle.index >= 0): "handle index too low: " + handle.index;
assert (handle.index < USAGE.allCount()): "handle index too high:" + handle.index;
return POS_NODES + ((long) recordsize * handle.index);
}
// additional properties
public synchronized int handles() {
return this.HANDLES.length;
}
protected void setHandle(int pos, Handle handle) throws IOException {
if (pos >= HANDLES.length) throw new IllegalArgumentException("setHandle: handle array exceeded");
if (handle == null) handle = new Handle(NUL);
HANDLES[pos] = handle;
entryFile.writeInt(POS_HANDLES + 4 * pos, handle.index);
}
protected Handle getHandle(int pos) {
if (pos >= HANDLES.length) throw new IllegalArgumentException("getHandle: handle array exceeded");
return (HANDLES[pos].index == NUL) ? null : HANDLES[pos];
}
// custom texts
public void setText(int pos, byte[] text) throws IOException {
if (pos >= TXTPROPS.length) throw new IllegalArgumentException("setText: text array exceeded");
if (text.length > TXTPROPW) throw new IllegalArgumentException("setText: text lemgth exceeded");
if (text == null) text = new byte[0];
TXTPROPS[pos] = text;
entryFile.write(POS_TXTPROPS + TXTPROPW * pos, text);
}
public byte[] getText(int pos) {
if (pos >= TXTPROPS.length) throw new IllegalArgumentException("getText: text array exceeded");
return TXTPROPS[pos];
}
// Returns true if this map contains no key-value mappings.
public boolean isEmpty() {
return (USAGE.USEDC == 0);
}
// Returns the number of key-value mappings in this map.
public int size() {
return USAGE.USEDC;
}
protected int free() {
return USAGE.FREEC;
}
private void dispose(Handle h) throws IOException {
// delete element with handle h
// this element is then connected to the deleted-chain and can be
// re-used change counter
synchronized (USAGE) {
USAGE.USEDC--;
USAGE.FREEC++;
// change pointer
entryFile.writeInt(seekpos(h), USAGE.FREEH.index); // extend free-list
// write new FREEH Handle link
USAGE.FREEH = h;
USAGE.write();
}
}
public Iterator content() {
try {
return new contentIterator();
} catch (IOException e) {
return new HashSet().iterator();
}
}
public class contentIterator implements Iterator {
// iterator that iterates all byte[][]-objects in the file
// all records that are marked as deleted are ommitted
// this is probably also the fastest way to iterate all objects
private HashSet markedDeleted;
private Handle pos;
public contentIterator() throws IOException {
pos = new Handle(0);
markedDeleted = new HashSet();
synchronized (USAGE) {
if (USAGE.FREEC != 0) {
Handle h = USAGE.FREEH;
while (h.index != NUL) {
markedDeleted.add(h);
h = new Handle(entryFile.readInt(seekpos(h)));
}
}
}
while ((markedDeleted.contains(pos)) && (pos.index < USAGE.allCount())) pos.index++;
}
public boolean hasNext() {
return pos.index < USAGE.allCount();
}
public Object next() {
try {
Node n = new Node(pos);
pos.index++;
while ((markedDeleted.contains(pos)) && (pos.index < USAGE.allCount())) pos.index++;
return n.getValues();
} catch (IOException e) {
throw new kelondroException(filename, e.getMessage());
}
}
public void remove() {
throw new UnsupportedOperationException();
}
}
public void close() throws IOException {
if (this.entryFile != null) this.entryFile.close();
this.entryFile = null;
}
public void finalize() {
try {
close();
} catch (IOException e) { }
}
protected static String[] line2args(String line) {
// parse the command line
if ((line == null) || (line.length() == 0)) return null;
String args[];
StringTokenizer st = new StringTokenizer(line);
args = new String[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++) {
args[i] = st.nextToken();
}
st = null;
return args;
}
protected static boolean equals(byte[] a, byte[] b) {
if (a == b) return true;
if ((a == null) || (b == null)) return false;
if (a.length != b.length) return false;
for (int n = 0; n < a.length; n++) if (a[n] != b[n]) return false;
return true;
}
public static byte[] long2bytes(long x, int length) {
byte[] b = new byte[length];
for (int i = length - 1; i >= 0; i--) {
b[i] = (byte) (x & 0XFF);
x >>= 8;
}
return b;
}
public static long bytes2long(byte[] b) {
if (b == null) return 0;
long x = 0;
for (int i = 0; i < b.length; i++) x = (x << 8) | (0xff & b[i]);
return x;
}
public final static void NUL2bytes(byte[] b, int offset) {
b[offset ] = (byte) (0XFF & (NUL >> 24));
b[offset + 1] = (byte) (0XFF & (NUL >> 16));
b[offset + 2] = (byte) (0XFF & (NUL >> 8));
b[offset + 3] = (byte) (0XFF & NUL);
}
public final static void int2bytes(long i, byte[] b, int offset) {
b[offset ] = (byte) (0XFF & (i >> 24));
b[offset + 1] = (byte) (0XFF & (i >> 16));
b[offset + 2] = (byte) (0XFF & (i >> 8));
b[offset + 3] = (byte) (0XFF & i);
}
public final static int bytes2int(byte[] b, int offset) {
return (
((b[offset ] & 0xff) << 24) |
((b[offset + 1] & 0xff) << 16) |
((b[offset + 2] & 0xff) << 8) |
(b[offset + 3] & 0xff));
}
public void print(boolean records) throws IOException {
System.out.println("REPORT FOR FILE '" + this.filename + "':");
System.out.println("--");
System.out.println("CONTROL DATA");
System.out.print(" HANDLES : " + HANDLES.length + " int-values");
if (HANDLES.length == 0)
System.out.println();
else {
System.out.print(" {" + HANDLES[0].toString());
for (int i = 1; i < HANDLES.length; i++)
System.out.print(", " + HANDLES[i].toString());
System.out.println("}");
}
System.out.print(" TXTPROPS : " + TXTPROPS.length + " strings, max length " + TXTPROPW + " bytes");
if (TXTPROPS.length == 0)
System.out.println();
else {
System.out.print(" {'" + (new String(TXTPROPS[0])).trim());
System.out.print("'");
for (int i = 1; i < TXTPROPS.length; i++)
System.out.print(", '" + (new String(TXTPROPS[i])).trim() + "'");
System.out.println("}");
}
System.out.println(" USEDC : " + USAGE.USEDC);
System.out.println(" FREEC : " + USAGE.FREEC);
System.out.println(" FREEH : " + USAGE.FREEH.toString());
System.out.println(" Data Offset: 0x" + Long.toHexString(POS_NODES));
System.out.println("--");
System.out.println("RECORDS");
System.out.print(" Columns : " + columns() + " columns {" + COLWIDTHS[0]);
for (int i = 1; i < columns(); i++) System.out.print(", " + COLWIDTHS[i]);
System.out.println("}");
System.out.println(" Overhead : " + this.overhead + " bytes (" + OHBYTEC + " OH bytes, " + OHHANDLEC + " OH Handles)");
System.out.println(" Recordsize : " + this.recordsize + " bytes");
System.out.println("--");
printCache();
System.out.println("--");
if (!(records)) return;
// print also all records
for (int i = 0; i < USAGE.allCount(); i++)
System.out.println("NODE: " + new Node(new Handle(i), null, 0).toString());
}
public String toString() {
return size() + " RECORDS IN FILE " + filename;
}
protected class Handle implements Comparable {
private int index;
private Handle() throws IOException {
// reserves a new record and returns index of record
// the return value is not a seek position
// the seek position can be retrieved using the seekpos() function
synchronized (USAGE) {
if (USAGE.FREEC == 0) {
// generate new entry
index = USAGE.allCount();
USAGE.USEDC++;
entryFile.writeInt(POS_USEDC, USAGE.USEDC);
} else {
// re-use record from free-list
USAGE.USEDC++;
USAGE.FREEC--;
// take link
if (USAGE.FREEH.index == NUL) {
System.out.println("INTERNAL ERROR (DATA INCONSISTENCY): re-use of records failed, lost " + (USAGE.FREEC + 1) + " records. Affected file: " + filename);
// try to heal..
USAGE.USEDC = USAGE.allCount() + 1;
USAGE.FREEC = 0;
index = USAGE.USEDC - 1;
} else {
index = USAGE.FREEH.index;
// read link to next element to FREEH chain
USAGE.FREEH.index = entryFile.readInt(seekpos(USAGE.FREEH));
}
USAGE.write();
}
}
}
protected Handle(int i) {
assert (i == NUL) || (i >= 0) : "node handle index too low: " + i;
//assert (i == NUL) || (i < USAGE.allCount()) : "node handle index too high: " + i + ", USEDC=" + USAGE.USEDC + ", FREEC=" + USAGE.FREEC;
this.index = i;
}
public boolean isNUL() {
return index == NUL;
}
public String toString() {
if (index == NUL) return "NULL";
String s = Integer.toHexString(index);
while (s.length() < 4) s = "0" + s;
return s;
}
public boolean equals(Handle h) {
assert (index != NUL);
assert (h.index != NUL);
return (this.index == h.index);
}
public boolean equals(Object h) {
assert (index != NUL);
assert (((Handle) h).index != NUL);
return (this.index == ((Handle) h).index);
}
public int compare(Object h0, Object h1) {
assert (((Handle) h0).index != NUL);
assert (((Handle) h1).index != NUL);
if (((Handle) h0).index < ((Handle) h1).index) return -1;
if (((Handle) h0).index > ((Handle) h1).index) return 1;
return 0;
}
public int compareTo(Object h) {
// this is needed for a treeMap
assert (index != NUL);
assert (((Handle) h).index != NUL);
if (index < ((Handle) h).index) return -1;
if (index > ((Handle) h).index) return 1;
return 0;
}
public int hashCode() {
assert (index != NUL);
return this.index;
}
}
}
| [
"[email protected]"
] | |
72c9cd428fe323fcf0fbaf726ad5a9a882e158e2 | 69fb84d40ba0194131abc6642fe0a1bc8aba64b9 | /TestNGDemo/src/demo/Annotations.java | 015134961fde2ec250a5558f2de5a7ee19939e32 | [] | no_license | deebhatti/SeleniumJune14 | 04b4d47ccfaae67e538252c4296a0831688d3dd0 | 5a32fd8088dd5bbc76c70a3d3cdb9385d34a7e0b | refs/heads/master | 2020-12-25T09:08:53.213075 | 2016-06-15T14:22:12 | 2016-06-15T14:22:12 | 61,132,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,798 | java | package demo;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class Annotations {
@BeforeSuite
public void beforeSuite(){
System.out.println("Before Suite will always execute prior to all"
+ "annotations in the suite");
}
@AfterSuite
public void afterSuite(){
System.out.println("After Suite will always execute at last afte"
+ "r all the annotations");
}
@BeforeClass
public void beforeClass(){
System.out.println("Before Class will always execute prior to "
+ "@BeforeMethod and @Test");
}
@AfterClass
public void afterClass(){
System.out.println("After Class will always execute later to @After"
+ "Method and @Test");
}
@BeforeMethod
public void beforeMEthod(){
System.out.println("Before Method will execute before every "
+ "@Test");
}
@AfterMethod
public void afterMethod(){
System.out.println("After Method is executed after every @Test");
}
@BeforeTest
public void beforeTest(){
System.out.println("Before Test will always execute prior to @Before"
+ "Class, @BeforeMEthod and @Test");
}
@AfterTest
public void afterTest(){
System.out.println("AfterTest will always execute later to @After"
+ "Method, @AfterClass");
}
@Test
public void testCase1(){
System.out.println("Inside first Test case");
}
@Test
public void testCase2(){
System.out.println("Inside second Test case");
}
}
| [
"[email protected]"
] | |
bf4ca56201770d29210014536b4b81c027ff9b6f | 548d3c3458924c56215e46f265ed4713c55df744 | /core/src/main/java/ninja/bytecode/shuriken/collections/hunk/storage/AtomicDoubleHunk.java | 62c0bd524a39ac1800e2d1ebbaa975e6525d8c2e | [] | no_license | cyberpwnn/Shuriken | 4964fe04d6a86e362651834f983fd40beca08f6c | af3ec709c822db0e5f3cb3380a7e580e006b00d3 | refs/heads/master | 2023-02-09T13:45:04.983659 | 2021-01-04T21:02:48 | 2021-01-04T21:02:48 | 197,869,024 | 0 | 0 | null | 2020-12-02T18:40:56 | 2019-07-20T02:27:54 | Java | UTF-8 | Java | false | false | 887 | java | package ninja.bytecode.shuriken.collections.hunk.storage;
import lombok.Data;
import lombok.EqualsAndHashCode;
import ninja.bytecode.shuriken.collections.atomics.AtomicDoubleArray;
import ninja.bytecode.shuriken.collections.hunk.Hunk;
@Data
@EqualsAndHashCode(callSuper = false)
public class AtomicDoubleHunk extends StorageHunk<Double> implements Hunk<Double>
{
private final AtomicDoubleArray data;
public AtomicDoubleHunk(int w, int h, int d)
{
super(w, h, d);
data = new AtomicDoubleArray(w * h * d);
}
@Override
public boolean isAtomic()
{
return true;
}
@Override
public void setRaw(int x, int y, int z, Double t)
{
data.set(index(x, y, z), t);
}
@Override
public Double getRaw(int x, int y, int z)
{
return data.get(index(x, y, z));
}
private int index(int x, int y, int z)
{
return (z * getWidth() * getHeight()) + (y * getWidth()) + x;
}
}
| [
"[email protected]"
] | |
2c3df6cc802893de10048df253583318f4c2058c | 12f1d0ab0807937b1b8c1e7a5d0cff03b20d118c | /Exp/NetBeans/Chapter5/src/meal/Bread.java | 60d8725c7712653b6317808eccb50bc73b99601a | [] | no_license | DSapphire/JavaNotes | 61b7396842c59fc5d724a3f7161bc89a657d7b88 | 2e31eae39629f25295ad701a9cf5ef12f9c30007 | refs/heads/master | 2020-04-01T13:09:55.325433 | 2015-06-19T00:34:02 | 2015-06-19T00:34:02 | 37,692,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 76 | java | package meal;
class Bread {
Bread() { System.out.println("Bread()"); }
}
| [
"[email protected]"
] | |
7e9f95a384016b2cb608c178f39af1240d36bf3b | 42976852438d61998f740dce9d36b4fea3c25dff | /src/main/java/com/designpattern/decorator/starbuzzWithSizes/Whip.java | 452d0ae858880ab52fd68fb2672f807598ec2d30 | [] | no_license | xueshuiyy/designpatterns | e2f125ed549e660d2e86bb15d0303ce5873ddbc8 | 13d703c569fa25c6b61b28c8071e6473aaed62a7 | refs/heads/master | 2020-05-03T20:21:05.559728 | 2019-04-01T07:01:43 | 2019-04-01T07:01:43 | 178,801,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package com.designpattern.decorator.starbuzzWithSizes;
public class Whip extends CondimentDecorator {
public Whip(Beverage beverage) {
this.beverage = beverage;
}
public String getDescription() {
return beverage.getDescription() + ", Whip";
}
public double cost() {
return beverage.cost() + .10;
}
}
| [
"[email protected]"
] | |
76c3e95ab828e8669ae84d4231556df318bf6a5c | eea91e66a1427ef313b60b851f7f292f3312ab24 | /src/main/java/com/dem/yjy/web/security/package-info.java | d6b00c17ca1788bc3fa72f24aac91c8b31cde718 | [] | no_license | PanzerkleinVv/yjy | 30ec8fb6ca98d5072b13a105f6b9626929d7ed34 | 6292d975b3e34dc953cfe0c0ac6a469305378e46 | refs/heads/master | 2020-03-13T23:32:46.467828 | 2018-11-11T14:46:50 | 2018-11-11T14:46:50 | 131,337,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 54 | java | /**
* 安全层
*/
package com.dem.yjy.web.security; | [
"Administrator@SKY-20120731QAN"
] | Administrator@SKY-20120731QAN |
243c1b8598e96d26adb3129755c2ce00471b2c16 | fe82f8eb21ab3b71b840aabcad741dcf746c309a | /src/extra_class_bookingsystem/Controllers/dashboard.java | a276e55d7e89f67c740fab4229953dcb2315b74b | [] | no_license | kanchitbajaj8070/extra_class_booking | 793db7ad16e705a6a75058d81842de23e77d6570 | 612a39e5b7dfb4abcdb23b2749336a3ff356e143 | refs/heads/master | 2020-05-07T11:44:22.321105 | 2019-04-10T01:05:20 | 2019-04-10T01:05:20 | 180,473,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,318 | java | package extra_class_bookingsystem.Controllers;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import java.net.URL;
import java.sql.*;
import java.util.HashMap;
import java.util.ResourceBundle;
public class dashboard implements Initializable{
@FXML
private AnchorPane pane;
@FXML
private VBox sidepane;
@FXML
private Label welcome_label;
@FXML
private Button user_name;
@FXML
private Button home_button;
@FXML
private Button info_button;
@FXML
private Button password_button;
@FXML
private Button contact_button;
@FXML
private Pane title_pane;
@FXML
public Button add_button;
@FXML
private Button delete_button;
@FXML
private Button modify_button;
@FXML
void add_func1(MouseEvent event) throws Exception {
Stage primaryStage=new Stage();
Parent root = FXMLLoader.load(getClass().getResource("/extra_class_bookingsystem/fxmls/ADD_BUTTON_WINDOW.fxml"));
primaryStage.setTitle(" ");
primaryStage.initModality(Modality.APPLICATION_MODAL);
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
}
public void clear_selection()
{
tableData.getSelectionModel().clearSelection();
}
@FXML
public Label USER_LABEL;
@FXML
private TableView< extra_class_bookingsystem.Controllers.ModelTable> tableData;
@FXML
private TableColumn< extra_class_bookingsystem.Controllers.ModelTable, String> roomname;
@FXML
private TableColumn< extra_class_bookingsystem.Controllers.ModelTable,Date> book_date;
@FXML
private TableColumn< extra_class_bookingsystem.Controllers.ModelTable, String> timeslot;
@FXML
private Button sign_out;
@FXML
private TableColumn< extra_class_bookingsystem.Controllers.ModelTable, String> name;
static ObservableList< extra_class_bookingsystem.Controllers.ModelTable> obList= FXCollections.observableArrayList();
public static HashMap<Integer, String> time_slot_map_inverse = new HashMap<>();
@Override
public void initialize(URL location, ResourceBundle resources) {
obList.clear();
tableData.setColumnResizePolicy(TableView.UNCONSTRAINED_RESIZE_POLICY);
int c = 8;
for (int i = 0; i < DATE_TIME_SELECT.list.size(); i++) {
time_slot_map_inverse.put(c, DATE_TIME_SELECT.list.get(i));
c = c + 1;
}
System.out.println(time_slot_map_inverse);
USER_LABEL.setText(LoginController.fname);
roomname.setCellValueFactory(new PropertyValueFactory<extra_class_bookingsystem.Controllers.ModelTable, String>("roomname"));
book_date.setCellValueFactory(new PropertyValueFactory<extra_class_bookingsystem.Controllers.ModelTable, Date>("book_date"));
timeslot.setCellValueFactory(new PropertyValueFactory<extra_class_bookingsystem.Controllers.ModelTable, String>("timeslot"));
name.setCellValueFactory(new PropertyValueFactory<extra_class_bookingsystem.Controllers.ModelTable, String>("name"));
System.out.println("start");
try {
System.out.println("222222");
Class.forName("com.mysql.jdbc.Driver");
System.out.println("1");
Connection con = DriverManager.getConnection(
"jdbc:mysql://remotemysql.com:3306/0htZliliVa", "0htZliliVa", "VoFrbMvpC9");
System.out.println("2");
ResultSet rs = con.createStatement().executeQuery("select * from booked where lower(name)='" + LoginController.uname + "';");
System.out.println(rs.toString());
System.out.println("3");
while (rs.next()) {
System.out.println("4");
obList.add(new extra_class_bookingsystem.Controllers.ModelTable(rs.getString("Roomname"), rs.getDate("book_date"), rs.getString("timeslot"), rs.getString("description")));
}
System.out.println("5");
tableData.setItems(obList);
con.close();
} catch (Exception e) {
System.out.println(e.getMessage() + "err");
}
}
public void home_window_open() throws Exception
{
Stage primaryStage=new Stage();
Parent root = FXMLLoader.load(getClass().getResource("/extra_class_bookingsystem/fxmls/home_window.fxml"));
primaryStage.setTitle(" home");
primaryStage.initModality(Modality.APPLICATION_MODAL);
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
}
public void refresh_userLabel()
{
USER_LABEL.setText(LoginController.fname);
}
public void handle_edit_info_button()
{
Stage primaryStage = new Stage();
primaryStage.setOnCloseRequest(e->
{
e.consume();
System.out.println("closiunfjf");
refresh_userLabel();
primaryStage.close();
});
try {
Parent root = FXMLLoader.load(getClass().getResource("/extra_class_bookingsystem/fxmls/edit_info_window.fxml"));
primaryStage.setTitle("bookIT-extra class booking system");
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
primaryStage.initModality(Modality.APPLICATION_MODAL);
} catch (Exception e) {
System.out.println(e.getCause());
}
USER_LABEL.setText(LoginController.fname);
}
public void contactus_window_open() throws Exception
{
Stage primaryStage= new Stage();
try {
Parent root = FXMLLoader.load(getClass().getResource("/extra_class_bookingsystem/fxmls/contact_window.fxml"));
primaryStage.setTitle("contact us");
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
primaryStage.initModality(Modality.APPLICATION_MODAL);
} catch (Exception e) {
System.out.println(e.getCause());
}
}
public void sign_out_function() throws Exception {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("SIGN OUT ");
alert.setContentText("YOU ARE ABOUT TO SIGN OUT");
alert.setHeaderText("ARE YOU SURE U WANT TO PROCEED");
alert.showAndWait().ifPresent(rs -> {
if (rs == ButtonType.OK) {
System.out.println("Pressed OK.");
Stage current = (Stage) USER_LABEL.getScene().getWindow();
LoginController.uname = null;
LoginController.password = null;
current.close();
System.out.println("done");
Stage primaryStage = new Stage();
try {
Parent root = FXMLLoader.load(getClass().getResource("/extra_class_bookingsystem/fxmls/login.fxml"));
primaryStage.setTitle("bookIT-extra class booking system");
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
} catch (Exception e) {
System.out.println(e.getCause());
}
}
});
}
public void delete_row_from_table() {
extra_class_bookingsystem.Controllers.ModelTable row_to_delete = tableData.getSelectionModel().getSelectedItem();
if (row_to_delete != null) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("DELETE SELECTED BOOKING");
alert.setHeaderText("DELETE SELECTED BOOKING ");
alert.setContentText("ARE YOU SURE YOU WANT TO DELETE THE SELECTED BOOKED ROOM?");
alert.showAndWait().ifPresent(rs -> {
if (rs == ButtonType.OK) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:mysql://remotemysql.com:3306/0htZliliVa", "0htZliliVa", "VoFrbMvpC9");
Statement stmt = con.createStatement();
PreparedStatement preparedStmt = con.prepareStatement("delete from booked where book_date=? and roomname=? and timeslot=? and name =?");
preparedStmt.setDate(1, row_to_delete.getBook_date());
preparedStmt.setString(2, row_to_delete.Roomname);
preparedStmt.setString(3, row_to_delete.getTimeslot());
preparedStmt.setString(4, LoginController.uname);
preparedStmt.execute();
con.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
tableData.getItems().removeAll(row_to_delete);
}
});
}
}
public void change_password_window_open() throws Exception
{
Stage primaryStage= new Stage();
try {
Parent root = FXMLLoader.load(getClass().getResource("/extra_class_bookingsystem/fxmls/change_password_window.fxml"));
primaryStage.setTitle("change password");
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
primaryStage.initModality(Modality.APPLICATION_MODAL);
} catch (Exception e) {
System.out.println(e.getCause());
}
}
}
| [
"[email protected]"
] | |
400db8b35baa71258a541b4c577af30d6c51ffbc | 5318021c405eb22c285b3c3a762538d618937d39 | /app/src/main/java/com/huier/custom_recyclerview/SimpleActivity.java | 9a1cf0dba4b479f3629141a6165e54a7138c47e2 | [] | no_license | ecit010223/recyclerview | 21c19270bc008893e9dc4f064cced7d69ce7d6e6 | 8a3a854008071df9dce957416ec1daa46b3551ae | refs/heads/master | 2021-01-02T08:53:57.479341 | 2017-08-02T08:15:30 | 2017-08-02T08:15:30 | 99,089,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,286 | java | package com.huier.custom_recyclerview;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.huier.custom_recyclerview.adapter.CustomRecyclerAdapter;
import com.huier.custom_recyclerview.decoration.AdvanceItemDecoration;
import com.huier.custom_recyclerview.listener.OnRecyclerItemClickListener;
public class SimpleActivity extends AppCompatActivity implements View.OnClickListener {
private Context mContext;
private LinearLayout linearTopbarBack;
/** 添加数据按钮 **/
private Button btnAddData;
private RecyclerView recyclerViewSimple;
private CustomRecyclerAdapter mAdapter;
/** 线性布局 **/
private LinearLayoutManager mLinearLayoutManager;
/** 网络布局 **/
private GridLayoutManager mGridLayoutManager;
/** 瀑布布局 **/
private StaggeredGridLayoutManager mStaggeredGridLayoutManager;
public static void entry(Context from){
Intent intent = new Intent(from,SimpleActivity.class);
from.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_simple);
mContext = this;
initTopbar();
initRecyclerView();
}
/** 头部控件 **/
private void initTopbar(){
linearTopbarBack = (LinearLayout)findViewById(R.id.linear_top_bar_back);
linearTopbarBack.setOnClickListener(this);
//添加数据按钮
btnAddData = (Button)findViewById(R.id.btn_add_data);
btnAddData.setOnClickListener(this);
}
/** RecyclerView处理 **/
private void initRecyclerView(){
//开始设置RecyclerView
recyclerViewSimple =(RecyclerView)this.findViewById(R.id.recyclerview_simple);
//设置固定大小
recyclerViewSimple.setHasFixedSize(true);
//创建线性布局
mLinearLayoutManager = new LinearLayoutManager(this);
//垂直方向
mLinearLayoutManager.setOrientation(OrientationHelper.VERTICAL);
//创建网格布局
mGridLayoutManager = new GridLayoutManager(mContext,4);
//创建瀑布布局
mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(2,OrientationHelper.VERTICAL);
//给RecyclerView设置布局管理器
// recyclerViewSimple.setLayoutManager(mLinearLayoutManager);
recyclerViewSimple.setLayoutManager(mGridLayoutManager);
// recyclerViewSimple.setLayoutManager(mStaggeredGridLayoutManager);
//设置分割线
// recyclerViewSimple.addItemDecoration(new SimpleItemDecoration(mContext));
recyclerViewSimple.addItemDecoration(new AdvanceItemDecoration(mContext,OrientationHelper.VERTICAL));
//创建适配器
// mAdapter = new CustomRecyclerAdapter(mContext);
//创建带有各选项的点击回调的适配器
mAdapter = new CustomRecyclerAdapter(mContext, new OnRecyclerItemClickListener() {
@Override
public void onItemClick(View view, int position) {
Toast.makeText(mContext,((TextView)view).getText().toString()+":"+position,Toast.LENGTH_SHORT).show();
mAdapter.removeItem(position);
}
});
//添加默认的动画效果
recyclerViewSimple.setItemAnimator(new DefaultItemAnimator());
recyclerViewSimple.setAdapter(mAdapter);
}
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.btn_add_data:
mAdapter.additem("新数据",0);
break;
case R.id.linear_top_bar_back:
finish();
break;
}
}
}
| [
"[email protected]"
] | |
32b10ce9bb165260e1896c6012c6cd7b7ce4cdfd | fa025b2b86365a35d8326bfd5e9c132c0f509f33 | /api/src/main/java/org/gwtproject/i18n/client/impl/plurals/DefaultRule_bn.java | 6948b1b7570e3c9a6a1093e7f9b36f1d5dda2d44 | [
"Apache-2.0"
] | permissive | treblereel/gwt-i18n | 7fe4d2ff93ba25a400cb323195dcaea94a65572c | 4020290a299febfece327e57985f5563516a60b2 | refs/heads/master | 2020-06-12T21:17:45.679124 | 2020-01-13T18:39:56 | 2020-01-13T18:39:56 | 194,425,422 | 0 | 0 | Apache-2.0 | 2020-01-13T18:39:57 | 2019-06-29T16:17:49 | Java | UTF-8 | Java | false | false | 955 | java | /*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.gwtproject.i18n.client.impl.plurals;
/**
* Plural forms for Bengali are 1 and n, with 0 treated as plural.
*/
public class DefaultRule_bn extends DefaultRule {
@Override
public PluralForm[] pluralForms() {
return DefaultRule_1_0n.pluralForms();
}
@Override
public int select(int n) {
return DefaultRule_1_0n.select(n);
}
}
| [
"[email protected]"
] | |
dc207293c44aac2c3c8563bc39312f331fefa972 | 0830ebea21e9a496c3319f04771ab5d211d105f0 | /1345. Jump Game IV.java | 73fa5af9d49b496d5a933ee244f6131919a60f99 | [] | no_license | SeraphyYuan/Java | 79dbbe2b268830585690ec20494be019615d69a9 | 0bf4ddb97cba0eb9965a9525628fbca3679e2d60 | refs/heads/master | 2023-03-28T13:31:45.919603 | 2021-03-29T02:43:42 | 2021-03-29T02:43:42 | 305,879,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,334 | java | class Solution {
public int minJumps(int[] arr) {
Map<Integer, ArrayList<Integer>> map = new HashMap<>();
int m = arr.length;
for(int i = 0; i < m; i++){
if(i > 0 && i < m-1 && arr[i] == arr[i-1] && arr[i] == arr[i+1]){
continue;
}
map.putIfAbsent(arr[i], new ArrayList<>());
map.get(arr[i]).add(i);
}
Queue<Integer> q = new LinkedList<>();
int step = 0;
Set<Integer> visited = new HashSet<>();
q.add(0);
visited.add(0);
while(!q.isEmpty()){
for (int size = q.size(); size > 0; size--) {
int curr = q.poll();
if(curr == m-1){
return step;
}
ArrayList<Integer> dirs = map.getOrDefault(arr[curr], new ArrayList<>());
dirs.add(curr+1);
dirs.add(curr-1);
for(int pos: dirs){
if(visited.contains(pos)){
continue;
}
if(pos >=0 && pos < m && !visited.contains(pos)){
q.add(pos);
visited.add(pos);
}
}
}
step++;
}
return 0;
}
} | [
"[email protected]"
] | |
2094907d5c5f9770d89d39e57d3c82f248365547 | 84e13dcb95136a5890fc3002ffa6626628732d08 | /DS- TimeTracker/src/main/java/com/example/joans/timetracker/LlistaActivitatsActivity.java | d581ea0e8b8afc9e005f7dc4b9b95d4ff47db62f | [] | no_license | RogerRey14/Time-Tracker-Android-App | 71a78d0facdea3eb2dd3d8ac8e3b342b851bae60 | 878d626054d3e285ba9ac458d560b8c9c483576c | refs/heads/master | 2022-12-14T01:57:44.156040 | 2020-09-10T12:10:37 | 2020-09-10T12:10:37 | 294,398,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,519 | java | package com.example.joans.timetracker;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.getbase.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
import nucli.Activitat;
/**
* Mostra la llista de projectes i tasques filles del projecte pare actual.
* Inicialment, en engegar la aplicació per primer cop (o quan s'ha engegat el
* telèfon) mostra doncs les activitats del primer "nivell", considerant que hi
* ha un projecte arrel invisible de cara als usuaris que és el seu projecte
* pare.
* <p>
* Juntament amb el nom de projecte o tasca se'n mostra el temps total
* cronometrat. I mentre que s'està cronometrant alguna tasca d'aquestes, o bé
* descendent d'un dels projectes mostrats, el seu temps es veu que es va
* actualitzant. Per tal de mostrar nom i durada mitjançant les
* <code>ListView</code> d'Android, hem hagut de dotar la classe
* <code>DadesActivitat</code> d'un mètode <code>toString</code> que és invocat
* per un objecte de classe <code>Adapter</code>, que fa la connexió entre la
* interfase i les dades que mostra.
* <p>
* També gestiona els events que permeten navegar per l'arbre de projectes i
* tasques :
* <ul>
* <li>un click sobre un element de la llista baixa de nivell: passa a mostrar
* els seus "fills", la siguin subprojectes i tasques (si era un projecte) o
* intervals (si era tasca)</li>
* <li>tecla o botó "back" puja de nivell: anem al projecte para del les
* activitats de les quals mostrem les dades, o si ja són del primer nivell i no
* podem pujar més, anem a la pantalla "Home"</li>
* </ul>
* I també events per tal de cronometrar una tasca p parar-ne el cronòmetre,
* mitjançant un click llarg.
* <p>
* Totes dues funcions no són dutes a terme efectivament aquí sinó a
* <code>GestorArbreActivitat</code>, que manté l'arbre de tasques, projectes i
* intervals en memòria. Cal fer-ho així per que Android pot eliminar (
* <code>destroy</code>) la instància d'aquesta classe quan no és visible per
* que estem interactuant amb alguna altra aplicació, si necessita memòria. En
* canvi, un servei com és <code>GestorArbreActivitats</code> només serà
* destruït en circumstàncies extremes. La comunicació amb el servei es fa
* mitjançant "intents", "broadcast" i una classe privada "receiver".
*
* @author joans
* @version 6 febrer 2012
*/
public class LlistaActivitatsActivity extends AppCompatActivity {
/**
* Nom de la classe per fer aparèixer als missatges de logging del LogCat.
*
* @see Log
*/
private final String tag = this.getClass().getSimpleName();
/**
* Grup de vistes (controls de la interfase gràfica) que consisteix en un
* <code>TextView</code> per a cada activitat a mostrar.
*/
private ListView arrelListView;
/**
* Adaptador necessari per connectar les dades de la llista de projectes i
* tasques filles del projecte pare actual, amb la interfase, segons el
* mecanisme estàndard d'Android.
* <p>
* Per tal de fer-lo servir, cal que la classe <code>DadesActivitat</code>
* tingui un mètode <code>toString</code> que retornarà l'string a mostrar
* en els TextView (controls de text) de la llista ListView.
*/
private ArrayAdapter<DadesActivitat> aaAct;
/**
* Llista de dades de les activitats (projectes i tasques) mostrades
* actualment, filles del (sub)projecte on estem posicionats actualment.
*/
private List<DadesActivitat> llistaDadesActivitats;
/**
* Identificador del View les propietats del qual (establertes amb l'editor
* XML de la interfase gràfica) estableixen com es mostra cada un els items
* o elements de la llista d'activitats (tasques i projectes) referenciada
* per l'adaptador {@link #aaAct}. Si per comptes haguéssim posat
* <code>android.R.layout.simple_list_item_1</code> llavors fora la
* visualització per defecte d'un text. Ara la diferència es la mida de la
* tipografia.
*/
private int layoutID = R.layout.textview_llista_activitats;
/**
* Flag que ens servirà per decidir fer que si premem el botó/tecla "back"
* quan estem a l'arrel de l'arbre de projectes, tasques i intervals : si és
* que si, desem l'arbre i tornem a la pantalla "Home", sinó hem d'anar al
* projecte pare del pare actual (pujar de nivell).
*/
private boolean activitatPareActualEsArrel;
//Creem una variable local per fer-la servir quan sigui necessària
private String nomActivitatPare;
/**
* Rep els "intents" que envia <code>GestorArbreActivitats</code> amb les
* dades de les activitats a mostrar. El receptor els rep tots (no hi ha cap
* filtre) per que només se'n n'hi envia un, el "TE_FILLS".
*
* @author joans
* @version 6 febrer 2012
*/
private class Receptor extends BroadcastReceiver {
/**
* Nom de la classe per fer aparèixer als missatges de logging del
* LogCat.
*
* @see Log
*/
private final String tag = this.getClass().getCanonicalName();
/**
* Gestiona tots els intents enviats, de moment només el de la
* acció TE_FILLS. La gestió consisteix en actualitzar la llista
* de dades que s'està mostrant mitjançant el seu adaptador.
*
* @param context
* @param intent
* objecte Intent que arriba per "broadcast" i del qual en fem
* servir l'atribut "action" per saber quina mena de intent és
* i els extres per obtenir les dades a mostrar i si el projecte
* actual és l'arrel de tot l'arbre o no
*
*/
@Override
public void onReceive(final Context context, final Intent intent) {
Log.i(tag, "onReceive");
if (intent.getAction().equals(GestorArbreActivitats.TE_FILLS)) {
activitatPareActualEsArrel = intent.getBooleanExtra(
"activitat_pare_actual_es_arrel", false);
nomActivitatPare = intent.getStringExtra("nom_actual");
TextView nomActual = (TextView) findViewById(R.id.projecteActual);
if(nomActivitatPare!=""){
nomActual.setText(nomActivitatPare);
}
// obtenim la nova llista de dades d'activitat que ve amb
// l'intent
@SuppressWarnings("unchecked")
ArrayList<DadesActivitat> llistaDadesAct =
(ArrayList<DadesActivitat>) intent
.getSerializableExtra("llista_dades_activitats");
aaAct.clear();
for (DadesActivitat dadesAct : llistaDadesAct) {
aaAct.add(dadesAct);
}
// això farà redibuixar el ListView
aaAct.notifyDataSetChanged();
Log.d(tag, "mostro els fills actualitzats");
} else {
// no pot ser
assert false : "intent d'acció no prevista";
}
}
}
/**
* Objecte únic de la classe {@link Receptor}.
*/
private Receptor receptor;
// Aquests són els "serveis", identificats per un string, que demana
// aquesta classe a la classe Service GestorArbreActivitats, en funció
// de la interacció de l'usuari:
/**
* String que defineix l'acció de demanar a <code>GestorActivitats</code> la
* llista de les dades dels fills de l'activitat actual, que és un projecte.
* Aquesta llista arribarà com a dades extres d'un Intent amb la "acció"
* TE_FILLS.
*
* @see GestorArbreActivitats.Receptor
*/
public static final String DONAM_FILLS = "Donam_fills";
/**
* String que defineix l'acció de demanar a <code>GestorActivitats</code>
* que engegui el cronòmetre de la tasca clicada.
*/
public static final String ENGEGA_CRONOMETRE = "Engega_cronometre";
/**
* String que defineix l'acció de demanar a <code>GestorActivitats</code>
* que pari el cronòmetre de la tasca clicada.
*/
public static final String PARA_CRONOMETRE = "Para_cronometre";
/**
* String que defineix l'acció de demanar a <code>GestorActivitats</code>
* que escrigui al disc l'arbre actual.
*/
public static final String DESA_ARBRE = "Desa_arbre";
/**
* String que defineix l'acció de demanar a <code>GestorActivitats</code>
* que el projecte pare de les activitats actuals sigui el projecte que
* l'usuari ha clicat.
*/
public static final String BAIXA_NIVELL = "Baixa_nivell";
/**
* String que defineix l'acció de demanar a <code>GestorActivitats</code>
* que el projecte pare passi a ser el seu pare, o sigui, pujar de nivell.
*/
public static final String PUJA_NIVELL = "Puja_nivell";
/**
* En voler pujar de nivell quan ja som a dalt de tot vol dir que l'usuari
* desitja "deixar de treballar del tot" amb la aplicació, així que "parem"
* el servei <code>GestorActivitats</code>, que vol dir parar el cronòmetre
* de les tasques engegades, si n'hi ha alguna, desar l'arbre i parar
* (invocant <code>stopSelf</code>) el servei. Tot això es fa a
* {@link GestorArbreActivitats#paraServei}.
*/
public static final String PARA_SERVEI = "Para_servei";
/**
* Quan aquesta Activity es mostra després d'haver estat ocultada per alguna
* altra Activity cal tornar a fer receptor i el seu filtre per que atengui
* als intents que es redifonen (broadcast). I també engegar el servei
* <code>GestorArbreActivitats</code>, si és la primera vegada que es mostra
* aquesta Activity. En fer-ho, el servei enviarà la llista de dades de les
* activitats filles del projecte arrel actual.
*/
@Override
public final void onResume() {
Log.i(tag, "onResume");
IntentFilter filter;
filter = new IntentFilter();
filter.addAction(GestorArbreActivitats.TE_FILLS);
receptor = new Receptor();
registerReceiver(receptor, filter);
// Crea el servei GestorArbreActivitats, si no existia ja. A més,
// executa el mètode onStartCommand del servei, de manera que
// *un cop creat el servei* = havent llegit ja l'arbre si es el
// primer cop, ens enviarà un Intent amb acció TE_FILLS amb les
// dades de les activitats de primer nivell per que les mostrem.
// El que no funcionava era crear el servei (aquí mateix o
// a onCreate) i després demanar la llista d'activiats a mostrar
// per que startService s'executa asíncronament = retorna de seguida,
// i la petició no trobava el servei creat encara.
startService(new Intent(this, GestorArbreActivitats.class));
super.onResume();
Log.i(tag, "final de onResume");
}
/**
* Just abans de quedar "oculta" aquesta Activity per una altra, anul·lem el
* receptor de intents.
*/
@Override
public final void onPause() {
Log.i(tag, "onPause");
unregisterReceiver(receptor);
super.onPause();
}
/**
* Estableix com a activitats a visualitzar les filles del projecte
* arrel, així com els dos listeners que gestionen els
* events de un click normal i un click llarg. El primer serveix per navegar
* "cap avall" per l'arbre, o sigui, veure els fills d'un projecte o els
* intervals d'una tasca. El segon per cronometrar, en cas que haguem clicat
* sobre una tasca.
*
* @param savedInstanceState
* de tipus Bundle, però no el fem servir ja que el pas de
* paràmetres es fa via l'objecte aplicació
* <code>TimeTrackerApplication</code>.
*/
@Override
public final void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(tag, "onCreate");
setContentView(R.layout.activity_llista_activitats);
arrelListView = (ListView) this.findViewById(R.id.listViewActivitats);
ImageView enrere = (ImageView) findViewById(R.id.enrere);
ImageView info = (ImageView) findViewById(R.id.info);
//Li donem la mateixa funcionalitat que el botó de tirar enrere
enrere.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
}
});
llistaDadesActivitats = new ArrayList<DadesActivitat>();
//aaAct = new ArrayAdapter<DadesActivitat>(this, layoutID,
// llistaDadesActivitats);
aaAct = new ArrayAdapter<DadesActivitat>(this, layoutID,
llistaDadesActivitats){
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
LayoutInflater layoutInflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//Cada fila representa un element de la llista, és a dir, una activitat
View fila = layoutInflater.inflate(R.layout.fila_activitat, parent, false);
//Creem objectes de tots els elements del layoutInflater
ImageView icona = fila.findViewById(R.id.image);
TextView titol = fila.findViewById(R.id.titol);
TextView durada = fila.findViewById(R.id.durada);
final ImageView inicia_atura = fila.findViewById(R.id.inicia_atura);
//Controlem si es fa click sobre el botó inicia_atura
inicia_atura.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v){
if (llistaDadesActivitats.get(position).isTasca()) {
Intent inte;
//Si estava aturada, canviem la icona a 'stop' i iniciem la tasca
if (!llistaDadesActivitats.get(position).isCronometreEngegat()) {
inte = new Intent(
LlistaActivitatsActivity.ENGEGA_CRONOMETRE);
Log.d(tag, "enviat intent ENGEGA_CRONOMETRE de "
+ llistaDadesActivitats.get(position).getNom());
inicia_atura.setImageResource(R.drawable.stop);
}
//Si estava iniciada, canviem la icona a 'start' i aturem la tasca
else {
inte = new Intent(
LlistaActivitatsActivity.PARA_CRONOMETRE);
Log.d(tag, "enviat intent PARA_CRONOMETRE de "
+ llistaDadesActivitats.get(position).getNom());
inicia_atura.setImageResource(R.drawable.start);
}
inte.putExtra("posicio", position);
sendBroadcast(inte);
}
}
});
//Associem a cada activitat el seu nom i la seva durada
titol.setText(llistaDadesActivitats.get(position).getNom());
durada.setText(llistaDadesActivitats.get(position).toString());
//Si l'activitat és una tasca
if(llistaDadesActivitats.get(position).isTasca()){
icona.setImageResource(R.drawable.tasques);
//Associem la icona corresponent al botó per iniciar i aturar
if(llistaDadesActivitats.get(position).isCronometreEngegat()){
inicia_atura.setImageResource(R.drawable.stop);
//Si està iniciada es posa de color vermell
titol.setTextColor(Color.rgb(250, 0, 0));
}
else{
inicia_atura.setImageResource(R.drawable.start);
}
}
//Si l'activitat és un projecte
else{
icona.setImageResource(R.drawable.projectes);
//No té botó per iniciar ni aturar
inicia_atura.setImageResource(0);
if(llistaDadesActivitats.get(position).isCronometreEngegat()){
//Si té alguna tasca iniciada es posa de color vermell
titol.setTextColor(Color.rgb(250, 0, 0));
}
}
return fila;
}
};
//Botons per crear tasques i projectes
FloatingActionButton fabT = findViewById(R.id.fab_afegirTasca);
FloatingActionButton fabP = findViewById(R.id.fab_afegirProjecte);
//Quan es fa click al botó "afegirTasca" ens porta a l'activitat CrearTascaActivity
fabT.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(LlistaActivitatsActivity.this,
CrearTascaActivity.class));
}
});
//Quan es fa click al botó "afegirProjecte" ens porta a l'activitat CrearProjecteActivity
fabP.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(LlistaActivitatsActivity.this,
CrearProjecteActivity.class));
}
});
//Quan es fa click al botó "info" ens porta a l'activitat InfoActivitatsActivity
info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(LlistaActivitatsActivity.this, InfoActivitatsActivity.class));
}
});
arrelListView.setAdapter(aaAct);
// Un click serveix per navegar per l'arbre de projectes, tasques
// i intervals. Un click en el botó play/stop es per cronometrar una tasca, si és que
// l'item clicat es una tasca (sinó, no es fa res).
arrelListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(final AdapterView<?> arg0, final View arg1,
final int pos, final long id) {
Log.i(tag, "onItemClick");
Log.d(tag, "pos = " + pos + ", id = " + id);
Intent inte = new Intent(LlistaActivitatsActivity.BAIXA_NIVELL);
inte.putExtra("posicio", pos);
sendBroadcast(inte);
if (llistaDadesActivitats.get(pos).isProjecte()) {
sendBroadcast(new Intent(
LlistaActivitatsActivity.DONAM_FILLS));
Log.d(tag, "enviat intent DONAM_FILLS");
} else if (llistaDadesActivitats.get(pos).isTasca()) {
startActivity(new Intent(LlistaActivitatsActivity.this,
LlistaIntervalsActivity.class));
// en aquesta classe ja es demanara la llista de fills
} else {
// no pot ser!
assert false : "activitat que no es projecte ni tasca";
}
}
});
arrelListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(final AdapterView<?> arg0,
final View arg1, final int pos, final long id) {
// Important :
// "Programming Android", Z. Mednieks, L. Dornin,
// G. Meike, M. Nakamura, O'Reilly 2011, pag. 187:
//
// If the listener returns false, the event is dispatched
// to the View methods as though the handler did not exist.
// If, on the other hand, a listener returns true, the event
// is said to have been consumed. The View aborts any further
// processing for it.
//
// Si retornem false, l'event long click es tornat a processar
// pel listener de click "normal", fent que seguidament a
// ordenar el cronometrat passem a veure la llista d'intervals.
return true;
}
});
}
/**
* Gestor de l'event de prémer la tecla 'enrera' del D-pad. El que fem es
* anar "cap amunt" en l'arbre de tasques i projectes. Si el projecte pare
* de les activitats que es mostren ara no és nul (n'hi ha), 'pugem' per
* mostrar-lo a ell i les seves activitats germanes. Si no n'hi ha, paro el
* servei, deso l'arbre (equivalent a parar totes les tasques que s'estiguin
* cronometrant) i pleguem de la aplicació.
*/
@Override
public final void onBackPressed() {
Log.i(tag, "onBackPressed");
if (activitatPareActualEsArrel) {
Log.d(tag, "parem servei");
sendBroadcast(new Intent(LlistaActivitatsActivity.PARA_SERVEI));
super.onBackPressed();
} else {
sendBroadcast(new Intent(LlistaActivitatsActivity.PUJA_NIVELL));
Log.d(tag, "enviat intent PUJA_NIVELL");
sendBroadcast(new Intent(LlistaActivitatsActivity.DONAM_FILLS));
Log.d(tag, "enviat intent DONAM_FILLS");
}
}
// D'aqui en avall els mètodes que apareixen són simplement sobrecàrregues
// de mètodes de Activity per tal que es mostri un missatge de logging i
// d'aquesta manera puguem entendre el cicle de vida d'un objecte d'aquesta
// classe i depurar errors de funcionament de la interfase (on posar què).
/**
* Mostra un missatge de log per entendre millor el cicle de vida d'una
* Activity.
*
* @param savedInstanceState
* objecte de classe Bundle, que no fem servir.
*/
@Override
public final void onSaveInstanceState(final Bundle savedInstanceState) {
Log.i(tag, "onSaveInstanceState");
super.onSaveInstanceState(savedInstanceState);
}
/**
* Aquesta funció es crida després de <code>onCreate</code> quan hi ha un
* canvi de configuració = rotar el mòbil 90 graus, passant de "portrait" a
* apaisat o al revés.
*
* @param savedInstanceState
* Bundle que de fet no es fa servir.
*
* @see onConfigurationChanged
*/
@Override
public final void onRestoreInstanceState(final Bundle savedInstanceState) {
Log.i(tag, "onRestoreInstanceState");
super.onRestoreInstanceState(savedInstanceState);
}
/**
* Mostra un missatge de log per entendre millor el cicle de vida d'una
* Activity.
*/
@Override
public final void onStop() {
Log.i(tag, "onStop");
super.onStop();
}
/**
* Mostra un missatge de log per entendre millor el cicle de vida d'una
* Activity.
*/
@Override
public final void onDestroy() {
Log.i(tag, "onDestroy");
super.onDestroy();
}
/**
* Mostra un missatge de log per entendre millor el cicle de vida d'una
* Activity.
*/
@Override
public final void onStart() {
Log.i(tag, "onStart");
super.onStart();
}
/**
* Mostra un missatge de log per entendre millor el cicle de vida d'una
* Activity.
*/
@Override
public final void onRestart() {
Log.i(tag, "onRestart");
super.onRestart();
}
/**
* Mostra un missatge de logging en rotar 90 graus el dispositiu (o
* simular-ho en l'emulador). L'event <code>configChanged</code> passa quan
* girem el dispositiu 90 graus i passem de portrait a landscape (apaisat) o
* al revés. Això fa que les activitats siguin destruïdes (
* <code>onDestroy</code>) i tornades a crear (<code>onCreate</code>). En
* l'emulador del dispositiu, això es simula fent Ctrl-F11.
*
* @param newConfig
* nova configuració {@link Configuration}
*/
@Override
public final void onConfigurationChanged(final Configuration newConfig) {
Log.i(tag, "onConfigurationChanged");
if (Log.isLoggable(tag, Log.VERBOSE)) {
Log.v(tag, newConfig.toString());
}
}
}
| [
"[email protected]"
] | |
f1cd7c022b7714f509a0b00bdc666a7cd524c64d | fe5d1e3cbc8324c1e1a9d8748e8949fb661c8bcc | /JSP/한빛/src/appB/MySessionListener.java | a04c1472b78006142fec47d670a452c46da6307a | [] | no_license | zhaojc/web | 6aafbc8a72856443c1ee1161c707f044a9ce974a | fe5f8b1feb97b4a6ce95427af7c7c3be7f88f1b8 | refs/heads/master | 2021-01-18T20:23:03.773660 | 2013-09-09T12:03:26 | 2013-09-09T12:03:26 | null | 0 | 0 | null | null | null | null | UHC | Java | false | false | 678 | java | package mylistener;
import javax.servlet.http.*;
import java.util.*;
public class MySessionListener implements HttpSessionListener {
public void sessionCreated(HttpSessionEvent event) {
HttpSession session = event.getSession();
System.out.printf("[%TT] 세션이 시작되었습니다. (%s) %n",
new GregorianCalendar(), session.getId());
}
public void sessionDestroyed(HttpSessionEvent event) {
HttpSession session = event.getSession();
System.out.printf("[%TT] 세션이 끝났습니다. (%s) %n",
new GregorianCalendar(), session.getId());
}
}
| [
"[email protected]"
] | |
66965920363bd6f11bcd3da8808943e0a404b3ae | c66e8a8572344d624c4a8ac3aea7f2617033b981 | /src/kaishun/zks/test/设计模式/责任链模式/DEBUGLogger.java | 43e6ff6b17528b665222ba33ee39be2a549c5c08 | [] | no_license | zhangkaishun/myutil | 8dc989d65cfbbdbce3c3acc9f2211ccc81b185c3 | afb1cb84ce343340425a1e83b131fedb67eb6e9d | refs/heads/master | 2021-05-01T12:41:59.182346 | 2017-09-17T12:14:51 | 2017-09-17T12:14:51 | 79,529,791 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 296 | java | package kaishun.zks.test.设计模式.责任链模式;
public class DEBUGLogger extends AbstractLogger{
public DEBUGLogger(int level, String message) {
super(level, message);
}
@Override
public void write(String message) {
System.out.println("debug log:"+message);
}
}
| [
"[email protected]"
] | |
45b0550ce0ea323f9e7de011187d513993da711e | 340244f649995da96ea7b079c78a31b6302c4504 | /trunk/org.openebiz.core/src/org/openebiz/core/common/cbc/DocumentQualifierType.java | 76dafc6c691f7c37df5367b63b393953bd7e0a29 | [] | no_license | BackupTheBerlios/openebiz-svn | 6be3506ba0f5068a69459e6f093917699af50708 | f83946dab9371d17ffbc0ec43fe157e4544d97fe | refs/heads/master | 2020-04-18T01:46:26.607391 | 2009-03-08T17:23:20 | 2009-03-08T17:23:20 | 40,749,474 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | java | /*******************************************************************************
* Open E-Biz - Darrell Kundel
*
* Contributors:
* Darrell Kundel - initial API and implementation
*******************************************************************************/
package org.openebiz.core.common.cbc;
import org.openebiz.core.common.udt.TextType;
import java.io.Serializable;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Document Qualifier Type</b></em>'.
* <!-- end-user-doc -->
*
*
* @generated
*/
public class DocumentQualifierType extends TextType implements Serializable {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = "Open E-Biz - Darrell Kundel"; //$NON-NLS-1$
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static final long serialVersionUID = 1L;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DocumentQualifierType() {
super();
}
} // DocumentQualifierType | [
"wukunlun@3b9d58ea-9e0c-0410-94fd-f833e57fda8f"
] | wukunlun@3b9d58ea-9e0c-0410-94fd-f833e57fda8f |
e94d86c5e49c294b7d15605da9823d17ec3983ae | 666296b5d069d775227c6fcef9752f8a7e19e1a6 | /src/test/java/tr/com/yigithanbalci/shoppingcartservice/unit/dto/DrinkInputTests.java | 2e04bca199e84bae6f1f22776cee350bcd2e6a6b | [] | no_license | yigithanbalci/shopping-cart | e37a0f2aeceee8059029849b803baa50eb54aaff | 2e1772a9a2fb8955681a4fc6526ffdb8cc15e28d | refs/heads/master | 2022-12-03T19:59:53.983297 | 2020-08-24T13:10:49 | 2020-08-24T13:10:49 | 286,541,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 676 | java | package tr.com.yigithanbalci.shoppingcartservice.unit.dto;
import static pl.pojo.tester.api.assertion.Assertions.assertPojoMethodsFor;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import pl.pojo.tester.api.assertion.Method;
import tr.com.yigithanbalci.shoppingcartservice.dto.DrinkInput;
@ExtendWith(SpringExtension.class)
public class DrinkInputTests {
@Test
public void testDataMethods() {
assertPojoMethodsFor(DrinkInput.class).testing(Method.TO_STRING, Method.GETTER, Method.EQUALS, Method.HASH_CODE, Method.CONSTRUCTOR).areWellImplemented();
}
} | [
"[email protected]"
] | |
91f6ced6272d9626300a4f4d829d3d0b28e2a901 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/jdk_management_jfr_RecordingInfo_getState.java | d8af69a0a85ad278eb02673e79e808396801de96 | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | class jdk_management_jfr_RecordingInfo_getState{ public static void function() {jdk.management.jfr.RecordingInfo obj = new jdk.management.jfr.RecordingInfo();obj.getState();}} | [
"[email protected]"
] | |
179e80651420c5dcdae72ad50d29dc6c8c78e17e | 88e7b60681701b87af6e72ec732193ef6853d006 | /src/lab05/ArrayListStack.java | 22625aafc57a866cb9387398fbf25d915e600fdb | [] | no_license | GurraB/datastrukturer | 34bf08c49f13c6338cc23adf0c136c08042277e2 | 1d8c9a0b73daaeac24d46ec347a80fe6cf858f5e | refs/heads/master | 2021-01-10T17:46:43.966252 | 2016-03-11T18:26:48 | 2016-03-11T18:26:48 | 53,688,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 811 | java | package lab05;
import java.util.ArrayList;
import java.util.EmptyStackException;
/**
* Created by Gustaf on 27/01/2016.
*/
public class ArrayListStack<T> implements Stack<T> {
private ArrayList<T> elements = new ArrayList<T>();
@Override
public void push(T element) {
elements.add(element);
}
@Override
public T pop() {
if(isEmpty())
throw new EmptyStackException();
return elements.remove(elements.size() - 1);
}
@Override
public T peek() {
if(isEmpty())
throw new EmptyStackException();
return elements.get(elements.size() - 1);
}
@Override
public boolean isEmpty() {
return elements.isEmpty();
}
@Override
public int size() {
return elements.size();
}
}
| [
"[email protected]"
] | |
33769e99c77062558f38b7e61b0dacda626ad3d2 | a9967cdcda7e7da3d7aa59a405f7560931dfd1d1 | /app/src/main/java/com/example/memorydemo/IndexActivity.java | 7e5b55c88649084f395518c8e1125008675bd49f | [] | no_license | tomyZhou/MemoryDemo | 3f94bc52935102e9cffa7fe1994e428e501684bd | 7bc12d81b747c429284d97a0a19c088225f0295f | refs/heads/master | 2020-09-18T13:59:05.470562 | 2019-11-28T09:21:53 | 2019-11-28T09:21:53 | 224,149,751 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,829 | java | package com.example.memorydemo;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
public class IndexActivity extends AppCompatActivity {
private TextView tv_next, tv_next_2, tv_next_3, tv_next_4;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_index);
tv_next = findViewById(R.id.tv_next);
tv_next_2 = findViewById(R.id.tv_next_2);
tv_next_3 = findViewById(R.id.tv_next_3);
tv_next_4 = findViewById(R.id.tv_next_4);
tv_next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(IndexActivity.this, MainActivity.class);
startActivity(intent);
}
});
tv_next_2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(IndexActivity.this, InnerClassLeakDemoActivity.class);
startActivity(intent);
}
});
tv_next_3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(IndexActivity.this, ThreadLeakActivity.class);
startActivity(intent);
}
});
tv_next_4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(IndexActivity.this, HandlerLeakActivity.class);
startActivity(intent);
}
});
}
}
| [
"[email protected]"
] | |
8ff9df01fed7f0eb63bc52e97cef48b9af0aabad | f4251413f7012e27bd5776d1730c3c259b82740c | /server/account-server/src/main/java/com/github/xuchengen/server/account/facade/AccountServiceImpl.java | 10b1d516fc3ec1659c8a5ba57438ffc69fc24e4d | [
"Apache-2.0",
"MIT"
] | permissive | Xuchengen/seata-spring-dubbo | 6e1ec808238f3acafbfb19b36433eb87ea7b0334 | 4d2160fe0263f942d552c872b7f3b5863279f2b0 | refs/heads/master | 2022-07-18T13:29:30.736401 | 2019-12-20T07:19:17 | 2019-12-20T07:19:17 | 229,203,570 | 3 | 1 | MIT | 2022-06-21T02:29:13 | 2019-12-20T06:25:07 | Java | UTF-8 | Java | false | false | 635 | java | package com.github.xuchengen.server.account.facade;
import com.github.xuchengen.facade.account.AccountService;
import com.github.xuchengen.server.account.dao.mapper.AccountDOMapper;
import org.apache.dubbo.config.annotation.Service;
import javax.annotation.Resource;
/**
* 账户服务实现
* 作者:徐承恩
* 邮箱:[email protected]
* 日期:2019/12/19
*/
@Service
public class AccountServiceImpl implements AccountService {
@Resource
private AccountDOMapper accountDOMapper;
@Override
public void debit(String userId, int money) {
accountDOMapper.decreaseAccount(userId, money);
}
}
| [
"[email protected]"
] | |
95d17b98ab2173b20f58d72bcbbe6a665f9dc046 | da7116234ca3c82d4e07b594b1b9b626643d0be1 | /RecyclerView/app/src/main/java/com/example/recyclerview/Person.java | 8d38b162f0399f8e79df874d6f913ad2f600bbc8 | [] | no_license | JulesMoorhouse/AndroidTutorials | ae5838dcc377b591a0fd1138ef7adc8804f1dec2 | 19da0ceede0476c5b1fa067e14b7a94c75cef3d0 | refs/heads/master | 2023-03-01T12:28:13.872914 | 2021-02-08T08:29:36 | 2021-02-08T08:29:36 | 294,370,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package com.example.recyclerview;
public class Person
{
private String name;
private String surname;
private String preference; //this takes the bus or the plane
public Person(String name, String surname, String preference)
{
this.name = name;
this.surname = surname;
this.preference = preference;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getPreference() {
return preference;
}
public void setPreference(String preference) {
this.preference = preference;
}
}
| [
"[email protected]"
] | |
c99294a2291944ea09e3ecde95e5feebbf065884 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-13/u-13-f4869.java | ae8d15290def5b207f1a2d39968eb7a65ed36738 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
2757932449314 | [
"[email protected]"
] | |
7582308d92cd4d0cc44c46044c99568a641dbfba | 50e5cfb0620e77bb8e3508e157ab9053e742a577 | /app/src/main/java/com/picture/xyz/comica/p240d/jl.java | b719eaa602a93447c35d1a69f393e73ee9205ced | [] | no_license | waxxl/Comica | 007885a704b553969678fd1c6e40fdb7fd64709a | ba069cc1d2da4002579f2de3606135cdd59f14bf | refs/heads/master | 2023-01-19T08:32:03.918721 | 2020-12-01T10:26:10 | 2020-12-01T10:26:10 | 317,189,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,627 | java | package com.picture.xyz.comica.p240d;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import java.util.ArrayList;
import com.picture.xyz.comica.p240d.p455l.bl;
import com.picture.xyz.comica.p240d.p455l.en;
import com.picture.xyz.comica.p240d.p455l.wd;
import com.picture.xyz.comica.p241e.p242c.hn;
import com.picture.xyz.comica.p246gr.gamebrain.comica.R;
import com.picture.xyz.comica.comica.Face2;
import com.picture.xyz.comica.imageprocessing.FastImageProcessingPipeline;
import com.picture.xyz.comica.imageprocessing.FastImageProcessingView;
import com.picture.xyz.comica.imageprocessing.p253c.BasicFilter;
import com.picture.xyz.comica.imageprocessing.p254e.ImageResourceInput;
import com.picture.xyz.comica.imageprocessing.p255f.BitmapOutput;
/* renamed from: d.w */
public class jl implements BitmapOutput.C11653a {
/* renamed from: a */
ImageView f39420a = null;
/* renamed from: b */
int f39421b = 0;
/* renamed from: c */
ArrayList<en> f39422c = new ArrayList<>();
/* renamed from: d */
C11182e f39423d;
/* renamed from: e */
private LayoutInflater f39424e;
/* renamed from: f */
private FastImageProcessingView f39425f;
/* renamed from: g */
LinearLayout f39426g;
/* renamed from: h */
private FastImageProcessingPipeline f39427h;
/* renamed from: i */
private BitmapOutput f39428i;
/* renamed from: j */
Context f39429j;
/* renamed from: k */
en f39430k;
/* renamed from: l */
ImageResourceInput f39431l;
/* renamed from: m */
BasicFilter f39432m;
/* renamed from: d.w$a */
/* compiled from: jl */
class C11183a implements Runnable {
/* renamed from: a */
final /* synthetic */ Bitmap f39433a;
C11183a(Bitmap bitmap) {
this.f39433a = bitmap;
}
public void run() {
jl wVar = jl.this;
wVar.mo51900c(wVar.f39426g, wVar.f39430k, this.f39433a);
jl.this.m48438e();
}
}
/* renamed from: d.w$b */
/* compiled from: jl */
class C11184b implements View.OnClickListener {
/* renamed from: a */
final /* synthetic */ en f39435a;
C11184b(en bVar) {
this.f39435a = bVar;
}
public void onClick(View view) {
ImageView imageView = jl.this.f39420a;
if (imageView != null) {
imageView.setBackgroundColor(0);
}
jl wVar = jl.this;
if (wVar.f39420a == view) {
wVar.f39423d.mo51896b(new bl());
jl.this.f39420a = null;
return;
}
try {
wVar.f39423d.mo51896b(this.f39435a);
} catch (Throwable th) {
th.printStackTrace();
}
jl.this.f39420a = (ImageView) view;
//view.setBackgroundResource(R.drawable.selected);
}
}
public jl(Context context, boolean z, Bitmap bitmap, FastImageProcessingView fastImageProcessingView, Face2[] hVarArr) {
new PorterDuffColorFilter(-256, PorterDuff.Mode.DST_ATOP);
this.f39429j = context;
FastImageProcessingPipeline aVar = new FastImageProcessingPipeline();
this.f39427h = aVar;
this.f39425f = fastImageProcessingView;
fastImageProcessingView.setPipeline(aVar);
this.f39431l = new ImageResourceInput(this.f39425f, bitmap);
this.f39428i = new BitmapOutput(this);
this.f39427h.mo53634b(this.f39431l);
this.f39422c.add(new wd(context, hVarArr, 7));
this.f39422c.add(new wd(context, hVarArr, 6));
this.f39422c.add(new wd(context, hVarArr, 8));
this.f39422c.add(new wd(context, hVarArr, 5));
this.f39422c.add(new wd(context, hVarArr, 4));
this.f39422c.add(new wd(context, hVarArr, 0));
this.f39422c.add(new wd(context, hVarArr, 1));
this.f39422c.add(new wd(context, hVarArr, 9));
this.f39422c.add(new wd(context, hVarArr, 3));
this.f39422c.add(new wd(context, hVarArr, 2));
this.f39423d = (C11182e) context;
this.f39424e = (LayoutInflater) context.getSystemService(hn.m21100b("HZ]TQO{RJ]HZP^V"));
}
/* access modifiers changed from: private */
/* renamed from: e */
public /* synthetic */ void m48438e() {
int i = this.f39421b + 1;
this.f39421b = i;
if (i < this.f39422c.size()) {
this.f39430k = this.f39422c.get(this.f39421b);
this.f39427h.mo53635d();
this.f39431l.mo24185B(this.f39432m);
this.f39432m.mo24185B(this.f39428i);
this.f39427h.mo53633a(this.f39432m);
BasicFilter f = this.f39430k.mo51865f(this.f39429j);
this.f39432m = f;
f.mo24187w(this.f39428i);
this.f39431l.mo24187w(this.f39432m);
this.f39427h.mo53636e();
this.f39425f.requestRender();
return;
}
this.f39427h.mo53635d();
this.f39431l.mo24185B(this.f39432m);
this.f39432m.mo24185B(this.f39428i);
this.f39427h.mo53633a(this.f39432m);
this.f39425f.setVisibility(View.GONE);
}
/* renamed from: a */
public void mo51898a(Bitmap bitmap) {
this.f39427h.mo53635d();
((Activity) this.f39429j).runOnUiThread(new C11183a(bitmap));
}
/* renamed from: b */
public void mo51899b(LinearLayout linearLayout) {
this.f39421b = 0;
this.f39426g = linearLayout;
en bVar = this.f39422c.get(0);
this.f39430k = bVar;
BasicFilter f = bVar.mo51865f(this.f39429j);
this.f39432m = f;
f.mo24187w(this.f39428i);
this.f39431l.mo24187w(this.f39432m);
this.f39427h.mo53636e();
this.f39425f.requestRender();
}
/* renamed from: c */
public void mo51900c(LinearLayout linearLayout, en bVar, Bitmap bitmap) {
View inflate = this.f39424e.inflate(R.layout.action_caricature_layout, linearLayout, false);
((ImageView) inflate.findViewById(R.id.menuImage)).setImageBitmap(bitmap);
ImageView imageView = (ImageView) inflate.findViewById(R.id.selected);
imageView.setClickable(true);
imageView.setOnClickListener(new C11184b(bVar));
linearLayout.addView(inflate, linearLayout.getChildCount());
}
}
| [
"[email protected]"
] | |
b31f08c9ec2e6b9f423456f9e5aa92238f3ceeb5 | b28c4ef4ed059d4ad20d15e1b63acd12453d26c1 | /app/src/main/java/com/example/whatsappandroid/Messages.java | 0a2f6493bd446c2101423a267e89954ea9bfda0a | [] | no_license | breezyaloo123/whatsappAndroid | 8f75ba422bc1695c34381cd7911e7c653efc7e15 | 8e659db404794f76c440386856e7cc4f2c41b912 | refs/heads/master | 2021-05-24T14:18:14.310075 | 2020-05-22T01:34:41 | 2020-05-22T01:34:41 | 253,602,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 701 | java | package com.example.whatsappandroid;
public class Messages
{
private String from,message,type;
public Messages()
{
}
public Messages(String from, String message, String type) {
this.from = from;
this.message = message;
this.type = type;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"[email protected]"
] | |
09f1333d24aac62eb775f0f070814ff9a9896695 | c0787f622d790d927fe4a35951a615629a8c92fd | /Source/GortGUIv2/Gort/crowdanalysis/src/org/cmuchimps/gort/modules/crowdanalysis/samples/helloworld/MTurkHelloWorld.java | 152c28bdc26cf394f16410e595cd6ffe313a3621 | [
"Apache-2.0"
] | permissive | samini/gort-public | aa497913924306578416aa8c526f6cbd6dbf38cc | fed7d1d884753f3e3b412a9afb476ae1e1f563c4 | refs/heads/master | 2021-07-08T00:28:58.374280 | 2021-05-20T21:25:22 | 2021-05-20T21:25:22 | 22,022,704 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,150 | java | /*
* Copyright 2007-2012 Amazon Technologies, Inc.
*
* 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://aws.amazon.com/apache2.0
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and
* limitations under the License.
*/
package org.cmuchimps.gort.modules.crowdanalysis.samples.helloworld;
import com.amazonaws.mturk.service.axis.RequesterService;
import com.amazonaws.mturk.service.exception.ServiceException;
import com.amazonaws.mturk.util.PropertiesClientConfig;
import com.amazonaws.mturk.requester.HIT;
/**
* The MTurk Hello World sample application creates a simple HIT via the Mechanical Turk
* Java SDK. mturk.properties must be found in the current file path.
*/
public class MTurkHelloWorld {
private RequesterService service;
// Defining the attributes of the HIT to be created
private String title = "Answer a question";
private String description =
"This is a HIT created by the Mechanical Turk SDK. Please answer the provided question.";
private int numAssignments = 1;
private double reward = 0.05;
/**
* Constructor
*
*/
public MTurkHelloWorld() {
service = new RequesterService(new PropertiesClientConfig("../mturk.properties"));
}
/**
* Check if there are enough funds in your account in order to create the HIT
* on Mechanical Turk
*
* @return true if there are sufficient funds. False if not.
*/
public boolean hasEnoughFund() {
double balance = service.getAccountBalance();
System.out.println("Got account balance: " + RequesterService.formatCurrency(balance));
return balance > reward;
}
/**
* Creates the simple HIT.
*
*/
public void createHelloWorld() {
try {
// The createHIT method is called using a convenience static method of
// RequesterService.getBasicFreeTextQuestion that generates the QAP for
// the HIT.
HIT hit = service.createHIT(
title,
description,
reward,
RequesterService.getBasicFreeTextQuestion(
"What is the weather like right now in Seattle, WA?"),
numAssignments);
System.out.println("Created HIT: " + hit.getHITId());
System.out.println("You may see your HIT with HITTypeId '"
+ hit.getHITTypeId() + "' here: ");
System.out.println(service.getWebsiteURL()
+ "/mturk/preview?groupId=" + hit.getHITTypeId());
} catch (ServiceException e) {
System.err.println(e.getLocalizedMessage());
}
}
/**
* Main method
*
* @param args
*/
public static void main(String[] args) {
MTurkHelloWorld app = new MTurkHelloWorld();
if (app.hasEnoughFund()) {
app.createHelloWorld();
System.out.println("Success.");
} else {
System.out.println("You do not have enough funds to create the HIT.");
}
}
}
| [
"[email protected]"
] | |
0f150ead8c1462a8f9587ed90cff65bc09fbb3ea | eb8a97f5a919e45fb17441a079f80cb3dd4b751b | /app/src/main/java/com/cvnavi/logistics/i51eyun/app/utils/ContextUtil.java | 2a37ce7dc5bf16fd0cddb2ddf58f619798743e1c | [] | no_license | ChenJun1/I51EY | 46b3e5417fce5df3b945cd65731e6908d392157c | cf10d8f93665cddda4a111cae34dbb1b05a33414 | refs/heads/master | 2020-12-01T06:07:32.464735 | 2016-08-31T02:15:16 | 2016-08-31T02:15:16 | 66,893,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,449 | java | package com.cvnavi.logistics.i51eyun.app.utils;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.text.TextUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by JohnnyYuan on 2016/7/6.
*/
public class ContextUtil {
public static String replaceBlank(String str) {
String dest = "";
if (TextUtils.isEmpty(str) == false) {
Pattern pattern = Pattern.compile("\\s*|\t|\r|\n");
Matcher matcher = pattern.matcher(str);
dest = matcher.replaceAll("");
}
return dest;
}
/**
* 取小数点后两位
*
* @param number
* @return
*/
public static String getDouble(String number) {
if (TextUtils.isEmpty(number)) {
return "";
}
Double numbers = Double.valueOf(number);
numbers = (double) Math.round(numbers * 100) / 100;
String strNumber = String.valueOf(numbers);
return strNumber;
}
/**
* 拨号
* @param callNumber
* @param context
*/
public static void callAlertDialog(final String callNumber, final Context context) {
AlertDialog.Builder dBuilder = new AlertDialog.Builder(context);
dBuilder.setTitle("提示");
dBuilder.setMessage("拨号:" + callNumber);
dBuilder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent in = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + callNumber));
context.startActivity(in);
}
}).setNegativeButton("取消", null);
dBuilder.create();
dBuilder.show();
}
/**
* 得到软件显示版本信息
*
* @param context 上下文
* @return 当前版本信息
*/
public static String getVerName(Context context) {
String verName = "";
try {
String packageName = context.getPackageName();
verName = context.getPackageManager()
.getPackageInfo(packageName, 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return verName;
}
}
| [
"[email protected]"
] | |
c66c3d80b0207bce331bb4d4f7b8ff833cffc996 | 00e1e0709c471385b807b25ae5da0715f069136d | /center/src/com/chuangyou/xianni/avatar/cmd/AvartarCampaignRewardCmd.java | 028a514f42efcedd868ac91d6705dd534fe17cfe | [] | no_license | hw233/app2-java | 44504896d13a5b63e3d95343c62424495386b7f1 | f4b5217a4980b0ff81f81577c348a6e71593a185 | refs/heads/master | 2020-04-27T11:23:44.089556 | 2016-11-18T01:33:52 | 2016-11-18T01:33:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | java | package com.chuangyou.xianni.avatar.cmd;
import com.chuangyou.common.protobuf.pb.avatar.PassAvatarCampaignProto.PassAvatarCampaignMsg;
import com.chuangyou.xianni.player.GamePlayer;
import com.chuangyou.xianni.proto.PBMessage;
import com.chuangyou.xianni.protocol.Protocol;
import com.chuangyou.xianni.socket.Cmd;
import com.chuangyou.xianni.socket.Command;
import com.chuangyou.xianni.word.WorldMgr;
import io.netty.channel.Channel;
@Cmd(code = Protocol.C_PASS_CAMPAIGN_N2CENTER, desc = "通关分身副本,发放分身奖励")
public class AvartarCampaignRewardCmd implements Command {
@Override
public void execute(Channel channel, PBMessage packet) throws Exception {
PassAvatarCampaignMsg msg = PassAvatarCampaignMsg.parseFrom(packet.getBytes());
GamePlayer player = WorldMgr.getPlayer(msg.getPlayerId());
if (player != null && player.getAvatarInventory() != null) {
player.getAvatarInventory().challageReward(msg.getTempId(), msg.getRewardCount());
}
}
}
| [
"[email protected]"
] | |
7cb1b2c4cc9c28e2c1affdfd9fdb52f06ad89986 | 7dfd0163b045e03d83c65b7e271ff66bd570f079 | /CIDER_Herramienta/src/CIDER_GUI_actionZones/CIDER_GUI_twoVariablePlotZone.java | 4388c144bc73126e39fdadc43c25aec96abf793d | [] | no_license | camilorey/CIDER_Herramienta | 09a2189dd4d401b8f6134f5930015496e7ceda80 | 6d23ce11eb2dd0310482ccc8b10b68776c93f044 | refs/heads/master | 2018-01-08T16:46:51.118912 | 2015-11-23T22:14:43 | 2015-11-23T22:14:43 | 46,748,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,713 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package CIDER_GUI_actionZones;
import CIDER_DB.CIDER_DB;
import CIDER_GUI_CIDER_entityMarkers.CIDER_GUI_Object;
import CIDER_GUI_surfaces2.CIDER_GUI_StatPlotDisplaySurface;
import CIDER_GUI_surfaces2.CIDER_GUI_twoVariableStatPlotDisplaySurface;
import CIDER_GUI_textComponents.CIDER_GUI_variableFilter;
import java.util.ArrayList;
import processing.core.PApplet;
import processing.core.PImage;
import processing.core.PVector;
/**
*
* @author laptop
*/
public class CIDER_GUI_twoVariablePlotZone extends CIDER_GUI_statPlotZone{
CIDER_GUI_variableFilter[] variables;
ArrayList<CIDER_GUI_variableFilter> vars;
public CIDER_GUI_twoVariablePlotZone(CIDER_DB parentDB, PApplet parent) {
super(parentDB, parent);
variables = new CIDER_GUI_variableFilter[]{null,null};
vars = new ArrayList<CIDER_GUI_variableFilter>();
}
public CIDER_GUI_twoVariablePlotZone(CIDER_DB parentDB, PApplet parent, PVector position, float objectWidth, PImage backgroundImage) {
super(parentDB, parent, position, objectWidth, backgroundImage);
variables = new CIDER_GUI_variableFilter[]{null,null};
vars = new ArrayList<CIDER_GUI_variableFilter>();
}
int actionZoneState(){
if(variables[0] == null && variables[1]==null){
return -2;
}else if(variables[0] != null && variables[1] == null){
return -1;
}else if(variables[0] == null && variables[1] != null){
return 0;
}else{
return 1;
}
}
void clearVariables(){
variables[0] = null;
variables[1] = null;
}
public boolean readyToCreatePlot(){
return variables[0]!=null && variables[1]!=null;
}
public void createStatPlot(){
resultingPlot = new CIDER_GUI_twoVariableStatPlotDisplaySurface(parentDB, parent, new PVector(position.x,position.y), parent.width*0.25f, parent.height*0.25f, parent.width, parent.height);
resultingPlot.setBackgroundColor(new int[]{255,255,255});
vars.get(0).intensifyColor();
vars.get(1).intensifyColor();
resultingPlot.addFilter(vars.get(0));
resultingPlot.addFilter(vars.get(1));
resultingPlot.applyFilter();
}
@Override
public void onCollision(CIDER_GUI_Object object) {
if(object instanceof CIDER_GUI_variableFilter){
vars.add((CIDER_GUI_variableFilter) object);
((CIDER_GUI_variableFilter) object).fadeColor();
if(vars.size() ==2){
System.out.println("num variables:"+vars.size());
System.out.println("creando stat plot: ");
vars.get(0).intensifyColor();
vars.get(1).intensifyColor();
createStatPlot();
vars.clear();
}else if(vars.size()>2){
vars.clear();
}
}
}
}
| [
"laptop@laptop-camilo"
] | laptop@laptop-camilo |
8ab9511232665ab93784bd6e8972ada422c2587c | 376266811b1322bd142fd566b88d87afc2f3c1a8 | /decompil/autolugstor/general/Errors.java | ff81f4d093332816ee82028dc3c875b3c78f6783 | [] | no_license | devsandk/operator | b5ee406c90fe6ec4214ddfadc45dff579a3276cc | b20908a7230f7f6982eb0138581619983ea899d1 | refs/heads/master | 2016-09-09T17:11:00.248556 | 2015-07-15T05:32:29 | 2015-07-15T05:32:29 | 35,717,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package autolugstor.general;
public class Errors {
public static final String NoData20 = "Нет данных.Код ошибки 20.";
public static final String NoData21 = "Нет данных.Код ошибки 21.";
public static final String NoData22 = "Нет данных.Код ошибки 22.";
}
| [
"[email protected]"
] | |
3751f13ce3d19c6183e1027cd6276b6913f7e9b6 | 47798511441d7b091a394986afd1f72e8f9ff7ab | /src/main/java/com/alipay/api/response/AlipayMarketingCampaignRuleTagQueryResponse.java | f7eb863d7de4b5b0be33ba0f959597ff65e31a93 | [
"Apache-2.0"
] | permissive | yihukurama/alipay-sdk-java-all | c53d898371032ed5f296b679fd62335511e4a310 | 0bf19c486251505b559863998b41636d53c13d41 | refs/heads/master | 2022-07-01T09:33:14.557065 | 2020-05-07T11:20:51 | 2020-05-07T11:20:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,030 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.marketing.campaign.rule.tag.query response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class AlipayMarketingCampaignRuleTagQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 4548446775736228724L;
/**
* {
"categories": [
{
"tags": [
{
"control": "text",
"op": "IN",
"sources": [
"23905"
],
"status": "EXECUTING",
"tagCode": "pubsrv_custom_batch",
"title": "标签描述AAAAB"
}
],
"title": "自定义标签"
}
]
}
tagCode:自定义标签固定为‘pubsrv_custom_batch’
sources:取值为创建自定义标签时获取的‘selftag’自定义标签id
status: 自定义标签创建任务状态:COMPLETE:执行完成, FAIL:执行失败, EXECUTING:处理中,只有处于‘COMPLETE’状态的标签才能用于创建圈人规则
*/
@ApiField("customtagjson")
private String customtagjson;
/**
* {"categories": [{"tags": [{"tagCode": "pubsrv_have_auto","control": "radio-normal","title": "是否有车","op": "EQ","sources": [{"value": "0","label": "否"},{"value": "1","label": "是"}]}]}
标签含义参见 alipay.marketing.campaign.rule.crowd.create (圈人规则创建)
*/
@ApiField("scenetagjson")
private String scenetagjson;
public void setCustomtagjson(String customtagjson) {
this.customtagjson = customtagjson;
}
public String getCustomtagjson( ) {
return this.customtagjson;
}
public void setScenetagjson(String scenetagjson) {
this.scenetagjson = scenetagjson;
}
public String getScenetagjson( ) {
return this.scenetagjson;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.