blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
3282f5a1d1c8f5ccdb4819072cb417528d51e238
c949698f8b415999c594b7d0bb7b84d07f8acf2b
/src/main/java/com/interceptingFilter/FilterChain.java
b183c35fd1345ec82c81a28e90a9aee32528af46
[]
no_license
luqijia/DesignModel
3243dc2d7cc43f6538aa939dff15e93e544db4f3
7ae8df8820b3b4f5527272299040ac06815acbf6
refs/heads/master
2020-05-17T09:13:41.225130
2019-04-26T12:54:18
2019-04-26T12:54:18
183,626,903
1
0
null
null
null
null
UTF-8
Java
false
false
488
java
package com.interceptingFilter; import java.util.ArrayList; import java.util.List; public class FilterChain { private List<Filter> filters = new ArrayList<Filter>(); private Target target; public void addFilter(Filter filter) { filters.add(filter); } public void execute(String request) { for (Filter filter : filters) { filter.execute(request); } target.execute(request); } public void setTarget(Target target) { this.target = target; } }
[ "luxun@qq.com" ]
luxun@qq.com
ef17292c7fe636f0b46ef574a6983e985f79a00b
6cda18aa2d6fafaf1667f20a3322c9de33c8c19e
/src/main/java/com/learn/searchApi/domain/Owner.java
18d7c57d3ddc2bff5751cb48ddc6a05558e956ba
[]
no_license
Sumohit/gitprojectsearchapi
c3b8281110d955036454949928b9bbcdf83d4290
f75d7dd99625c2316db52a854c6846160474d5ce
refs/heads/master
2023-06-09T20:46:08.268207
2021-06-27T19:10:50
2021-06-27T19:10:50
380,477,020
0
0
null
null
null
null
UTF-8
Java
false
false
2,180
java
package com.learn.searchApi.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.Setter; @Getter @Setter @JsonIgnoreProperties(ignoreUnknown = true) public class Owner { @JsonProperty("login") private String login ; @JsonProperty("id") private int id ; @JsonProperty("node_id") private String node_id ; @JsonProperty("avatar_url") private String avatar_url ; @JsonProperty("gravatar_id") private String gravatar_id ; @JsonProperty("url") private String url ; @JsonProperty("html_url") private String html_url ; @JsonProperty("followers_url") private String followers_url ; @JsonProperty("following_url") private String following_url ; @JsonProperty("gists_url") private String gists_url ; @JsonProperty("starred_url") private String starred_url ; @JsonProperty("namsubscriptions_urle") private String subscriptions_url ; @JsonProperty("organizations_url") private String organizations_url ; @JsonProperty("repos_url") private String repos_url ; @JsonProperty("events_url") private String events_url ; @JsonProperty("received_events_url") private String received_events_url ; @JsonProperty("type") private String type ; @JsonProperty("site_admin") private String site_admin ; @Override public String toString() { return "{\"login\":\"" + login + "\", \"id\":\"" + id + ", \"node_id\":\"" + node_id + "\", \"avatar_url\":\"" + avatar_url + "\", \"gravatar_id\":\"" + gravatar_id + "\", \"url\":\"" + url + "\", \"html_url\":\"" + html_url + "\", \"followers_url\":\"" + followers_url + "\", \"following_url\":\"" + following_url + "\", \"gists_url\":\"" + gists_url + "\", \"starred_url\":\"" + starred_url + "\", \"subscriptions_url\":\"" + subscriptions_url + "\", \"organizations_url\":\"" + organizations_url + "\", \"repos_url\":\"" + repos_url + "\", \"events_url\":\"" + events_url + "\", \"received_events_url\":\"" + received_events_url + "\", \"type\":\"" + type + "\", \"site_admin\":\"" + site_admin + "\"}"; } }
[ "mohitkumaryadav@Mohits-MacBook-Air.local" ]
mohitkumaryadav@Mohits-MacBook-Air.local
d340607e3763e63b1eda86f21f48cae9804d235d
84abcef44ea13976d8748e33f5c67c5e74ebb4c9
/src/main/java/net/elegantsoft/demo/api/PersonController.java
b80a8aca6e92b32cf8a427e94e33b7bfe3ea8231
[]
no_license
ElegantSoft/spring-demo
e8e95a9100ad3b4c9d5a6f450b8b245254ce5703
fb0251e96981afc818db808fc06cdd9b15002911
refs/heads/master
2022-09-08T22:24:40.785414
2020-06-02T07:09:43
2020-06-02T07:09:43
268,728,657
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package net.elegantsoft.demo.api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import net.elegantsoft.demo.model.Person; import net.elegantsoft.demo.service.PersonService; @RequestMapping("api/v1/person") @RestController public class PersonController { private final PersonService personService; @Autowired public PersonController(PersonService personService) { this.personService = personService; } @PostMapping public void addPerson(@RequestBody Person person) { personService.addPerson(person); } }
[ "react.laravel.dev@gmail.com" ]
react.laravel.dev@gmail.com
d90f2eabbde8f3f0139ff892151df923d752066b
9908360fda4072eda22e99a465bda54a0d1b960b
/AndroidProjects/Esame11112016/app/src/test/java/com/its/pretto/samuele/esame11112016/ExampleUnitTest.java
fbe69315ab9f2dca6a80af9fd14d582b7674e3c0
[]
no_license
RobotFox/corso-android
bb1a214343390895d6f6396b20986db93c882c02
3bfa6e565ae0996fdd3a81a564ae34a36d80ff6e
refs/heads/master
2021-01-11T09:39:51.296932
2017-05-16T07:47:59
2017-05-16T07:47:59
77,682,137
0
0
null
null
null
null
UTF-8
Java
false
false
414
java
package com.its.pretto.samuele.esame11112016; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "samuele.pretto@gmail.com" ]
samuele.pretto@gmail.com
3ada996dcaa607b72dd07444de4ecc6a8aef45b6
a1d4aab2fc8cf2a031150c588615cadd9150a0e8
/Taller Universidad del SOL/src/aux_classes/jose/Read.java
0132ab481eefd1af5be0162f822e62ff6d9b80b1
[ "Apache-2.0" ]
permissive
Nestyko/Taller_Universidad_del_SOL
c7f2d8e92307513fb17b71586659f9f68748d15e
20066a5ed8c669492c498011f0e6e136d27bed6b
refs/heads/master
2016-09-02T04:33:20.412028
2015-08-16T15:20:57
2015-08-16T15:20:57
31,996,430
1
0
null
2015-03-14T02:49:14
2015-03-11T03:33:20
Java
UTF-8
Java
false
false
3,049
java
//Jose Delgado package aux_classes.jose; public class Read { //METODO PARA LEER NUMEROS TIPO BYTE public static byte Nbyte(String mensaje) { boolean sal; byte n = 0; do { System.out.print(mensaje); try { n = Byte.parseByte(KbInput.read()); sal = true; }//try catch(NumberFormatException exc) { error(); sal = false; }//catch }while(sal == false ); return n; }//Nbyte //METODO PARA LEER NUMEROS TIPO SHORT public static short Nshort(String mensaje) { boolean sal; short n = 0; do { System.out.print(mensaje); try { n = Short.parseShort(KbInput.read()); sal = true; }//try catch(NumberFormatException exc) { error(); sal = false; }//catch }while(sal == false ); return n; }//Nshort //METODO PARA LEER NUMEROS TIPO INTEGER public static int Nint(String mensaje) { boolean sal; int n = 0; do { System.out.print(mensaje); try { n = Integer.parseInt(KbInput.read()); sal = true; }//try catch(NumberFormatException exc) { error(); sal = false; }//catch }while(sal == false ); return n; }//Nint //METODO PARA LEER NUMEROS TIPO LONG public static long Nlong(String mensaje) { boolean sal; long n = 0; do { System.out.print(mensaje); try { n = Long.parseLong(KbInput.read()); sal = true; }//try catch(NumberFormatException exc) { error(); sal = false; }//catch }while(sal == false ); return n; }//Nlong //METODO PARA LEER NUMEROS TIPO FLOAT public static float Nfloat(String mensaje) { boolean sal; float n = 0; do { System.out.print(mensaje); try { n = Float.parseFloat(KbInput.read()); sal = true; }//try catch(NumberFormatException exc) { error(); sal = false; }//catch }while(sal == false ); return n; }//Nfloat //METODO PARA LEER NUMEROS TIPO DOUBLE public static double Ndouble(String mensaje) { boolean sal; double n = 0; do { System.out.print(mensaje); try { n = Double.parseDouble(KbInput.read()); sal = true; }//try catch(NumberFormatException exc) { error(); sal = false; }//catch }while(sal == false ); return n; }//Ndouble //METODO PARA LEER UN CHAR public static char Cchar (String mensaje) { System.out.print(mensaje); return KbInputChar.read(); }//Cchar //METODO PARA LEER UNA CADENA STRING public static String Cstring(String texto) { String t; do{ System.out.print(texto); t = KbInput.read(); if((t.startsWith(" ") == true) || (t.length()<=0)) { System.out.println("\t\t\t\t\t\t\t(ERROR) NO INGRESO TEXTO O COMIENZA CON ESPACIO"); } }while((t.startsWith(" ") == true) || (t.length()<=0)); return t; }//Cstring //METODO PARA MOSTRAR MENSAJE DE ERROR public static void error() { MCursor.BLinea(5); MCursor.TCen(32,"E R R O R"); MCursor.TCen(30,"VALOR FUERA DE RANGO"); MCursor.BLinea(5); }//error }//class
[ "nltobon@gmail.com" ]
nltobon@gmail.com
b2cf7a97d1bee93ae62565697fa384e745a83007
b016e43cbd057f3911ed5215c23a686592d98ff0
/google-ads/src/main/java/com/google/ads/googleads/v7/resources/TopicViewProto.java
87f9763721cc8f7d847a5dd4246e871c263cd3fe
[ "Apache-2.0" ]
permissive
devchas/google-ads-java
d53a36cd89f496afedefcb6f057a727ecad4085f
51474d7f29be641542d68ea406d3268f7fea76ac
refs/heads/master
2021-12-28T18:39:43.503491
2021-08-12T14:56:07
2021-08-12T14:56:07
169,633,392
0
1
Apache-2.0
2021-08-12T14:46:32
2019-02-07T19:56:58
Java
UTF-8
Java
false
true
3,419
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/ads/googleads/v7/resources/topic_view.proto package com.google.ads.googleads.v7.resources; public final class TopicViewProto { private TopicViewProto() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } static final com.google.protobuf.Descriptors.Descriptor internal_static_google_ads_googleads_v7_resources_TopicView_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_ads_googleads_v7_resources_TopicView_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n2google/ads/googleads/v7/resources/topi" + "c_view.proto\022!google.ads.googleads.v7.re" + "sources\032\037google/api/field_behavior.proto" + "\032\031google/api/resource.proto\032\034google/api/" + "annotations.proto\"\270\001\n\tTopicView\022A\n\rresou" + "rce_name\030\001 \001(\tB*\340A\003\372A$\n\"googleads.google" + "apis.com/TopicView:h\352Ae\n\"googleads.googl" + "eapis.com/TopicView\022?customers/{customer" + "_id}/topicViews/{ad_group_id}~{criterion" + "_id}B\373\001\n%com.google.ads.googleads.v7.res" + "ourcesB\016TopicViewProtoP\001ZJgoogle.golang." + "org/genproto/googleapis/ads/googleads/v7" + "/resources;resources\242\002\003GAA\252\002!Google.Ads." + "GoogleAds.V7.Resources\312\002!Google\\Ads\\Goog" + "leAds\\V7\\Resources\352\002%Google::Ads::Google" + "Ads::V7::Resourcesb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.api.FieldBehaviorProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_ads_googleads_v7_resources_TopicView_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_google_ads_googleads_v7_resources_TopicView_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_ads_googleads_v7_resources_TopicView_descriptor, new java.lang.String[] { "ResourceName", }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); registry.add(com.google.api.ResourceProto.resource); registry.add(com.google.api.ResourceProto.resourceReference); com.google.protobuf.Descriptors.FileDescriptor .internalUpdateFileDescriptor(descriptor, registry); com.google.api.FieldBehaviorProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) }
[ "noreply@github.com" ]
noreply@github.com
dc822da0091b4715056b693da5953ec79d124de3
ce03d0f121ba06767f27bfd179869764d5bc71f2
/week-05/day-03/GardenApplication/src/Garden.java
776c46dcc3c773985e79db9b5d4645a7bc9e5156
[]
no_license
green-fox-academy/respublika
402749b4b2b7b0caa7ef63b6ff3cf7133e6d6312
c6f460d43c4d2094dbb546d19f646b0579e30f49
refs/heads/master
2020-03-08T22:39:43.763658
2018-08-22T18:24:09
2018-08-22T18:24:09
128,437,397
0
0
null
null
null
null
UTF-8
Java
false
false
1,650
java
import java.util.ArrayList; public class Garden { public ArrayList<Flower> flowers; public ArrayList<Tree> trees; public Garden() { this.flowers = new ArrayList<>(); this.trees = new ArrayList<>(); } public void addFlower(Flower flower) { this.flowers.add(flower); } public void addTree(Tree tree) { this.trees.add(tree); } public void showGarden() { for (Flower flower: flowers) { if (flower.waterLevel<5) { System.out.println("The " + flower.color + " Flower needs water"); } else { System.out.println("The " + flower.color + " Flower doesn't need water"); } } for (Tree tree: trees) { if (tree.waterLevel<10) { System.out.println("The " + tree.color + " Tree needs water"); } else { System.out.println("The " + tree.color + " Tree doesn't need water"); } } } public void wateringGarden(int waterAmount) { int countToWater=0; for (Flower flower: flowers) { if (flower.waterLevel<5) {countToWater++;} } for (Tree tree: trees) { if (tree.waterLevel<10) {countToWater++;} } if (countToWater>0) { for (Flower flower : flowers) { flower.watering(waterAmount / countToWater); } for (Tree tree : trees) { tree.watering(waterAmount / countToWater); } } System.out.println("Watering with: " + waterAmount); showGarden(); } }
[ "teglas.szilvia@gmail.com" ]
teglas.szilvia@gmail.com
abad7dbbb9712626ff36321f3ea084037b8a6d17
584493f84cbe8989ac2169e0b6f90edb84d9588c
/Algoritmer/src/indledendeØvelser/PlatEllerKrone.java
e8d0c5992b22f8c9b0bd076b92150949ee2a2fd3
[]
no_license
RManse/Gruppearbejde
271d3ca6a4eb8a530d8c2cb1d398715cea14ca7a
428b9fc19bfbbac770238abb4d0b51a52c4d57e0
refs/heads/master
2021-01-10T16:10:43.642855
2016-02-11T09:23:52
2016-02-11T09:23:52
50,725,995
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
package indledendeØvelser; public class PlatEllerKrone { public static void main(String[] args) { } }
[ "sebastian@vestrup.net" ]
sebastian@vestrup.net
0a08b3105c6a5e9bc3d83063a68436819c202de1
312d0b30e30dd565b871e00ab80f8389b6c42da6
/src/com/riawolf/patterns/model/animals/Constants.java
917ae7105d5a63341097a2bcd42ea7286d72eef4
[]
no_license
RIAwolf/DesignPatterns
d2060a28c48c33907383e68c1993c3013d23de33
87133b2983ffca2d12d6bf218e2f3b310009d2d7
refs/heads/master
2021-08-16T22:47:20.501497
2017-11-20T12:49:45
2017-11-20T12:49:45
111,410,057
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package com.riawolf.patterns.model.animals; public class Constants { public static String ANIMAL_CATEGORY="category"; public static String ANIMAL_FAMILY="family"; public static String ANIMAL_NAME="name"; public static String ANIMAL_WEIGHT="weight"; public static String ANIMAL_HEIGHT="height"; public static String ANIMAL_MOVEMENT="movement"; }
[ "packmaster@riawolf.com" ]
packmaster@riawolf.com
e703c2f6f29e187437ea7de505cad62dac194892
b57853f58a571ba077115e1c08e0590077e889db
/src/main/java/com/elearningportal/apps/service/MailService.java
da8f8faa60aeefd464123a9270c70eb8b4a9f531
[]
no_license
BulkSecurityGeneratorProject/E-learning
ffd0b904ddff0f2207a4ae46dc5857d465d6cc70
c3d75dbcd268e2cac1bc02718311a3128c71f9ed
refs/heads/master
2022-12-11T22:57:26.101173
2018-03-16T13:33:16
2018-03-16T13:33:16
296,685,384
0
0
null
2020-09-18T17:18:05
2020-09-18T17:18:05
null
UTF-8
Java
false
false
4,707
java
package com.elearningportal.apps.service; import com.elearningportal.apps.domain.User; import io.github.jhipster.config.JHipsterProperties; import org.apache.commons.lang3.CharEncoding; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.thymeleaf.context.Context; import org.thymeleaf.spring4.SpringTemplateEngine; import org.apache.commons.lang3.StringUtils; import javax.mail.internet.MimeMessage; import java.util.Locale; /** * Service for sending emails. * <p> * We use the @Async annotation to send emails asynchronously. */ @Service public class MailService { private final Logger log = LoggerFactory.getLogger(MailService.class); private static final String USER = "user"; private static final String BASE_URL = "baseUrl"; private final JHipsterProperties jHipsterProperties; private final JavaMailSender javaMailSender; private final MessageSource messageSource; private final SpringTemplateEngine templateEngine; public MailService(JHipsterProperties jHipsterProperties, JavaMailSender javaMailSender, MessageSource messageSource, SpringTemplateEngine templateEngine) { this.jHipsterProperties = jHipsterProperties; this.javaMailSender = javaMailSender; this.messageSource = messageSource; this.templateEngine = templateEngine; } @Async public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) { log.debug("Send email[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}", isMultipart, isHtml, to, subject, content); // Prepare message using a Spring helper MimeMessage mimeMessage = javaMailSender.createMimeMessage(); try { MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8); message.setTo(to); message.setFrom(jHipsterProperties.getMail().getFrom()); message.setSubject(subject); message.setText(content, isHtml); javaMailSender.send(mimeMessage); log.debug("Sent email to User '{}'", to); } catch (Exception e) { if (log.isDebugEnabled()) { log.warn("Email could not be sent to user '{}'", to, e); } else { log.warn("Email could not be sent to user '{}': {}", to, e.getMessage()); } } } @Async public void sendEmailFromTemplate(User user, String templateName, String titleKey) { Locale locale = Locale.forLanguageTag(user.getLangKey()); Context context = new Context(locale); context.setVariable(USER, user); context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl()); String content = templateEngine.process(templateName, context); String subject = messageSource.getMessage(titleKey, null, locale); sendEmail(user.getEmail(), subject, content, false, true); } @Async public void sendActivationEmail(User user) { log.debug("Sending activation email to '{}'", user.getEmail()); sendEmailFromTemplate(user, "activationEmail", "email.activation.title"); } @Async public void sendCreationEmail(User user) { log.debug("Sending creation email to '{}'", user.getEmail()); sendEmailFromTemplate(user, "creationEmail", "email.activation.title"); } @Async public void sendPasswordResetMail(User user) { log.debug("Sending password reset email to '{}'", user.getEmail()); sendEmailFromTemplate(user, "passwordResetEmail", "email.reset.title"); } @Async public void sendSocialRegistrationValidationEmail(User user, String provider) { log.debug("Sending social registration validation email to '{}'", user.getEmail()); Locale locale = Locale.forLanguageTag(user.getLangKey()); Context context = new Context(locale); context.setVariable(USER, user); context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl()); context.setVariable("provider", StringUtils.capitalize(provider)); String content = templateEngine.process("socialRegistrationValidationEmail", context); String subject = messageSource.getMessage("email.social.registration.title", null, locale); sendEmail(user.getEmail(), subject, content, false, true); } }
[ "vireshkumar@corenet.in.aquevix.com" ]
vireshkumar@corenet.in.aquevix.com
d0455cc3f5d6cdb961ea9f1e10e6922fdf1151ba
32915df3adacf272dd8871f2b1eacb45d6111216
/app/src/main/java/com/example/pokemonapp2/db/DatabaseDao.java
ea64ca01121aa2149b8574ef5578b2e839228bae
[]
no_license
devAhmed94/PokemonApp2
6cf20c5460a8cad70402456672019a61b9c4abc8
2edfda3744d13ef407becb96cc026c5c6bbfbcda
refs/heads/master
2023-02-11T18:52:23.565727
2021-01-04T21:42:58
2021-01-04T21:42:58
326,814,624
1
0
null
null
null
null
UTF-8
Java
false
false
536
java
package com.example.pokemonapp2.db; import androidx.lifecycle.LiveData; import androidx.room.Dao; import androidx.room.Insert; import androidx.room.Query; import com.example.pokemonapp2.network.Pokemon; import java.util.List; @Dao public interface DatabaseDao { @Insert public void insertPokemon(Pokemon pokemon); @Query("delete from pokemon_table where name =:pokemonName") public void deletePokemon(String pokemonName); @Query("select * from pokemon_table") LiveData<List<Pokemon>> getListPokemon(); }
[ "ahmedali26002844@gmail.com" ]
ahmedali26002844@gmail.com
00b8d48739bf1ff5341876c09942c0ba9457c35a
f63a392ea5489e81a05af16688636d49906e5113
/src/main/java/com/pj/jaxbbug/JaxbExample.java
abf3f305f081ab05a80c0a22316ee182c7bdcef1
[]
no_license
pavankjadda/JaxbBug
2a60312632fc0e67c5e07d080c18c6a806177065
0828c38af061253f927612ac672df5c6448bf988
refs/heads/main
2023-06-10T05:28:46.179850
2021-06-30T06:33:06
2021-06-30T06:33:06
381,598,909
0
0
null
null
null
null
UTF-8
Java
false
false
1,061
java
package com.pj.jaxbbug; import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Marshaller; import java.util.Arrays; public class JaxbExample { public static void main(String[] args) { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(Company.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); // output pretty printed jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(createCompanyObject(), System.out); } catch (JAXBException e) { e.printStackTrace(); } } private static Company createCompanyObject() { Company comp = new Company(); comp.setName("ABCDEFG Enterprise"); Staff o1 = new Staff(); o1.setId(1); o1.setName("mkyong"); o1.setSalary("8000 & Bonus"); o1.setBio("<h1>support</h1>"); Staff o2 = new Staff(); o2.setId(2); o2.setName("yflow"); o2.setSalary("9000"); o2.setBio("<h1>developer & database</h1>"); comp.setList(Arrays.asList(o1, o2)); return comp; } }
[ "jaddap2@nih.gov" ]
jaddap2@nih.gov
9920555b0eacc2e60ffa5e15b11ad82bfd1f5502
ab81a6221d622a70abbbe2d4664573c8f6068288
/app/src/main/java/com/lex/servise/CashbackIntentService.java
eb32e500ce89acfb780ff158c556727a3d23f806
[]
no_license
lexeyfan/Servise
16c2c38aae2a4d064d3131890fea2439011f9065
89d7d436b52027ac4a4bac563e148266df095000
refs/heads/master
2020-12-21T18:31:53.269343
2020-01-27T15:30:13
2020-01-27T15:30:13
236,522,529
0
0
null
null
null
null
UTF-8
Java
false
false
2,791
java
package com.lex.servise; import android.app.IntentService; import android.content.Context; import android.content.Intent; import android.os.Looper; import android.widget.Toast; import android.os.Handler; import java.util.Date; public class CashbackIntentService extends IntentService{ final static String CASHBACK_INFO = "info"; int i; public static Context ctx; public CashbackIntentService() { super("IntentService"); ctx = this; } @Override protected void onHandleIntent(Intent intent) { String cb_category = intent.getStringExtra("service"); String cbinfo = getCashbackInfo(cb_category); sendCashbackInfoToClient(cbinfo); } private String getCashbackInfo(String cbcat){ String cashback; String tt = cbcat; i=1; while("1".equals(tt)){ try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } i++; if( i==10) { i=1; Handler mainHandler = new Handler(getMainLooper()); mainHandler.post(new Runnable() { @Override public void run() { // Do your stuff here related to UI, e.g. show toast String txt =String.valueOf(i); Date date = new Date(); String txt2 =String.valueOf(date); Toast.makeText(getApplicationContext(), txt + ' ' + txt2 , Toast.LENGTH_LONG).show(); } }); } } Handler mainHandler = new Handler(getMainLooper()); mainHandler.post(new Runnable() { @Override public void run() { // Do your stuff here related to UI, e.g. show toast String txt =String.valueOf(i); Date date = new Date(); String txt2 =String.valueOf(date); Toast.makeText(getApplicationContext(), "STOP" , Toast.LENGTH_LONG).show(); } }); cashback = "Exit"; return cashback; //if("electronics".equals(cbcat)){ // cashback = "Upto 20% cashback on electronics"; // }else if("fashion".equals(cbcat)){ // cashback = "Upto 60% cashbak on all fashion items"; // }else{ // cashback = "All other categories except fashion and electronics, flat 30% cashback"; // } // return cashback; } private void sendCashbackInfoToClient(String msg){ Intent intent = new Intent(); intent.setAction(CASHBACK_INFO); intent.putExtra("service",msg); sendBroadcast(intent); } }
[ "Богдан@DESKTOP-OMACC7Q" ]
Богдан@DESKTOP-OMACC7Q
764788ceca3b655a9cf66b5ffb29823bbc6f7458
8e5288001f21fc9c25f57bf46254ee8e98fa0c85
/specimen/src/org/labkey/specimen/importer/AbstractSpecimenTask.java
4c1b780c6e6b2a2c1a674dc9cf0d7a5c3a09f4ac
[]
no_license
bbimber/platform
a0015a46a188acfcc77eb2689d34fee37982589f
74c3dfee4ac2de2469717e8da02d2c8f59ead1db
refs/heads/develop
2023-04-17T00:02:58.916940
2023-04-05T15:23:32
2023-04-05T15:23:32
254,413,705
1
0
null
2020-04-09T15:46:43
2020-04-09T15:46:42
null
UTF-8
Java
false
false
10,543
java
/* * Copyright (c) 2009-2017 LabKey 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 org.labkey.specimen.importer; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.labkey.api.admin.ImportException; import org.labkey.api.pipeline.CancelledException; import org.labkey.api.pipeline.PipelineJob; import org.labkey.api.pipeline.PipelineJobException; import org.labkey.api.pipeline.RecordedActionSet; import org.labkey.api.pipeline.TaskFactory; import org.labkey.api.specimen.importer.SpecimenImporter; import org.labkey.api.study.SpecimenService; import org.labkey.api.study.SpecimenTransform; import org.labkey.api.study.Study; import org.labkey.api.study.StudyService; import org.labkey.api.study.importer.SimpleStudyImportContext; import org.labkey.api.study.model.VisitService; import org.labkey.api.util.DateUtil; import org.labkey.api.util.FileType; import org.labkey.api.util.FileUtil; import org.labkey.api.writer.FileSystemFile; import org.labkey.api.writer.VirtualFile; import org.labkey.api.writer.ZipUtil; import org.labkey.specimen.pipeline.SpecimenJobSupport; import org.labkey.specimen.writer.SpecimenArchiveDataTypes; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.sql.BatchUpdateException; import java.util.Date; /* * User: adam * Date: Aug 31, 2009 * Time: 9:12:22 AM */ public abstract class AbstractSpecimenTask<FactoryType extends AbstractSpecimenTaskFactory<FactoryType>> extends PipelineJob.Task<TaskFactory> { public static final FileType ARCHIVE_FILE_TYPE = new FileType(".specimens"); protected AbstractSpecimenTask(FactoryType factory, PipelineJob job) { super(factory, job); } @Override @NotNull public RecordedActionSet run() throws PipelineJobException { try { PipelineJob job = getJob(); Path specimenArchive = getSpecimenFile(job); SimpleStudyImportContext ctx = getImportContext(job); doImport(specimenArchive, job, ctx, isMerge(), true, getImportHelper()); } catch (CancelledException | PipelineJobException e) { throw e; } catch (Exception e) { throw new PipelineJobException("Error attempting to load specimen archive", e); } return new RecordedActionSet(); } protected Path getSpecimenFile(PipelineJob job) throws Exception { SpecimenJobSupport support = job.getJobSupport(SpecimenJobSupport.class); return support.getSpecimenArchivePath(); } protected SimpleStudyImportContext getImportContext(PipelineJob job) { return job.getJobSupport(SpecimenJobSupport.class).getImportContext(); } public static void doImport(@Nullable Path inputFile, PipelineJob job, SimpleStudyImportContext ctx, boolean merge, boolean syncParticipantVisit) throws PipelineJobException { doImport(inputFile, job, ctx, merge, syncParticipantVisit, new DefaultImportHelper()); } private static void doPostTransform(SpecimenTransform transformer, Path inputFile, PipelineJob job) throws PipelineJobException { if (transformer.getFileType().isType(inputFile)) { if (job != null) job.setStatus("OPTIONAL POST TRANSFORMING STEP " + transformer.getName() + " DATA"); File specimenArchive = ARCHIVE_FILE_TYPE.getFile(inputFile.getParent().toFile(), transformer.getFileType().getBaseName(inputFile)); transformer.postTransform(job, inputFile.toFile(), specimenArchive); } } public static void doImport(@Nullable Path inputFile, PipelineJob job, SimpleStudyImportContext ctx, boolean merge, boolean syncParticipantVisit, ImportHelper importHelper) throws PipelineJobException { // do nothing if we've specified data types and specimen is not one of them if (!ctx.isDataTypeSelected(SpecimenArchiveDataTypes.SPECIMENS)) return; try { VirtualFile specimenDir; specimenDir = importHelper.getSpecimenDir(job, ctx, inputFile); if (specimenDir == null) return; if (job != null) job.setStatus("PROCESSING SPECIMENS"); ctx.getLogger().info("Starting specimen import..."); SpecimenImporter importer = new SpecimenImporter(ctx.getContainer(), ctx.getUser()); importer.process(specimenDir, merge, ctx, job, syncParticipantVisit); // perform any tasks after the transform and import has been completed String activeImporter = SpecimenService.get().getActiveSpecimenImporter(ctx.getContainer()); if (null != activeImporter) { SpecimenTransform activeTransformer = SpecimenService.get().getSpecimenTransform(activeImporter); if (activeTransformer != null && activeTransformer.getFileType().isType(inputFile)) doPostTransform(activeTransformer, inputFile, job); } else { for (SpecimenTransform transformer : SpecimenService.get().getSpecimenTransforms(ctx.getContainer())) { if (transformer.getFileType().isType(inputFile)) { doPostTransform(transformer, inputFile, job); break; } } } } catch (CancelledException e) { throw e; // rethrow so pipeline marks it canceled } catch (Exception e) { if (e instanceof BatchUpdateException && null != ((BatchUpdateException)e).getNextException()) e = ((BatchUpdateException)e).getNextException(); throw new PipelineJobException(e); } finally { // do any temp file cleanup importHelper.afterImport(ctx); // Since changing specimens in this study will impact specimens in ancillary studies dependent on this study, // we need to force a participant/visit refresh in those study containers (if any): for (Study dependentStudy : StudyService.get().getAncillaryStudies(ctx.getContainer())) VisitService.get().updateParticipantVisits(dependentStudy, ctx.getUser()); } } protected boolean isMerge() { return getJob().getJobSupport(SpecimenJobSupport.class).isMerge(); } public ImportHelper getImportHelper() { return new DefaultImportHelper(); } public interface ImportHelper { VirtualFile getSpecimenDir(PipelineJob job, SimpleStudyImportContext ctx, @Nullable Path inputFile) throws IOException, ImportException, PipelineJobException; void afterImport(SimpleStudyImportContext ctx); } protected static class DefaultImportHelper implements ImportHelper { private Path _unzipDir; @Override public VirtualFile getSpecimenDir(PipelineJob job, SimpleStudyImportContext ctx, @Nullable Path inputFile) throws IOException, ImportException, PipelineJobException { // backwards compatibility, if we are given a specimen archive as a zip file, we need to extract it if (inputFile != null) { // Might need to transform to a file type that we know how to import Path specimenArchive = inputFile; for (SpecimenTransform transformer : SpecimenService.get().getSpecimenTransforms(ctx.getContainer())) { if (transformer.getFileType().isType(inputFile.getFileName().toString())) { if (job != null) job.setStatus("TRANSFORMING " + transformer.getName() + " DATA"); specimenArchive = ARCHIVE_FILE_TYPE.getPath(inputFile.getParent(), transformer.getFileType().getBaseName(inputFile)); transformer.transform(job, inputFile, specimenArchive); break; } } if (null == specimenArchive) { ctx.getLogger().info("No specimen archive"); return null; } else { if (job != null) job.setStatus("UNZIPPING SPECIMEN ARCHIVE"); ctx.getLogger().info("Unzipping specimen archive " + specimenArchive); String tempDirName = DateUtil.formatDateTime(new Date(), "yyMMddHHmmssSSS"); _unzipDir = specimenArchive.getParent().resolve(tempDirName); ZipUtil.unzipToDirectory(specimenArchive, _unzipDir, ctx.getLogger()); ctx.getLogger().info("Archive unzipped to " + _unzipDir); return new FileSystemFile(_unzipDir); } } else { // the specimen files must already be "extracted" in the specimens directory return ctx.getDir("specimens"); } } @Override public void afterImport(SimpleStudyImportContext ctx) { if (_unzipDir != null) delete(_unzipDir, ctx); } protected void delete(Path path, SimpleStudyImportContext ctx) { Logger log = ctx.getLogger(); if (Files.isDirectory(path)) { try { FileUtil.deleteDir(path); } catch (IOException e) { log.error("Error deleting files from " + path, e); } } } } }
[ "noreply@github.com" ]
noreply@github.com
93055b1e47c32a0f42f5013b0e21407c0bdccc98
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-13544-87-14-PESA_II-WeightedSum:TestLen:CallDiversity/org/xwiki/resource/servlet/RoutingFilter_ESTest.java
74731aa07fce472a6881565d92c8c69be41d9ab4
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
/* * This file was automatically generated by EvoSuite * Sun Jan 19 20:50:09 UTC 2020 */ package org.xwiki.resource.servlet; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class RoutingFilter_ESTest extends RoutingFilter_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
6f571b219ff8285d65a5849a35a6875126b07d32
8cc37b1d49538da0fffc227cff8dd3dad1bb3cd0
/src/com/zjx/HashCode测试/HashCodeTest.java
e6ec403466e235a2d0bf32db53a5681e1b5bd2c8
[]
no_license
zjx1015288314/AlgorithmAnalysis
05aaef585069f59dddf624fe8b2f34bbaf5c6482
10b36df7e812d947589f02e494377cd878f10f86
refs/heads/master
2022-06-02T05:07:26.063317
2022-03-06T11:58:20
2022-03-06T11:58:20
213,101,748
1
0
null
null
null
null
UTF-8
Java
false
false
1,981
java
package com.zjx.HashCode测试; import java.util.*; /** * 文章链接:https://blog.csdn.net/bachbrahms/article/details/106983428 * 不同对象的hashCode何时会相等? * 1)重写hashCode方法时 * 一个类,如果你用某个属性去重写了hashCode方法,那么当不同对象的该属性相等时, * 它们的hashCode也一样。包括String类,也重写了hashCode方法(以及equals方法), * 当字符串内容相同时,hashCode相同。即使equals方法不相等,hashcode也可能相等 * 因为int溢出的原因,hashcode会变成负数或者出现重复值 * HashMap中hashcode采用了高低16位异或来防止hashcode为负导致无法放入数组(其实hash&(len - 1)也可以防止) * 2)未重写hashCode方法时 * 首先,hashCode方法返回的并不是对象在jvm上的内存地址值本身, * 而是通过一定算法,转化而来的一个int值。 * 这里就存在一个问题,内存上可能的地址值有多少个? * 经询问高手,得到的答案是,以64位系统为例,就是2的64次方个, * 而int的最大值是2的32次方,因此,理论上,int值不够分配给所有地址值, * 这就决定了会出现不同对象hashCode相等的情况.为了验证它,写了个小测试: * 结论:!!!!不重写hashCode方法,不同对象的hashCode也可能相同!!!! */ public class HashCodeTest { static Set<Integer> hashCodeSet = new HashSet<>(); public static void main(String[] args) { for (int i = 0; i < Integer.MAX_VALUE; i++) { Integer hashCode = new Object().hashCode(); if(hashCode < 0) System.out.println("hashcode " + hashCode + "< 0"); if (hashCodeSet.contains(hashCode)){ System.out.println("出现重复hashCode值:" + hashCode + ",此时size为:" + hashCodeSet.size()); break; } hashCodeSet.add(hashCode); } } }
[ "1015288314@qq.com" ]
1015288314@qq.com
a0fecc7496d599a6f26cc76dcae4b80b216354af
acfe45331e55d7cc54e0f18aba796ac2b33c4120
/src/com/controller/admin/goodsType/AdminGoodsTypeController.java
473f7a2f18168ddd58431b0c08f68aee4d59ac6a
[]
no_license
Xukaiqiang123/myStore
1c9aaac15a99264d30da491d144362a34224c483
352b2dbc3ac6fbe26d79f86f223702880db2ae4a
refs/heads/master
2023-01-08T06:30:09.525909
2020-11-03T13:26:37
2020-11-03T13:26:37
309,691,475
0
0
null
null
null
null
UTF-8
Java
false
false
3,114
java
package com.controller.admin.goodsType; import com.controller.BaseController; import com.entity.GoodsType; import com.fasterxml.jackson.databind.ObjectMapper; import com.service.GoodsTypeService; import com.service.impl.GoodsTypeServiceImpl; import com.utils.Constants; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @WebServlet("/admin/goodsType") public class AdminGoodsTypeController extends BaseController { private static GoodsTypeService typeService = new GoodsTypeServiceImpl(); //查看商品分类 public String showGoodsType(HttpServletRequest request, HttpServletResponse response) throws IOException { List<GoodsType> goodsTypeList = typeService.getAllGoodsType(); request.setAttribute("goodsTypeList",goodsTypeList); return Constants.FORWARD+"/admin/showGoodsType.jsp"; } //删除商品类别 public String deleteType(HttpServletRequest request, HttpServletResponse response) throws IOException { String id = request.getParameter("id"); typeService.deleteType(Integer.valueOf(id)); return null; } //修改商品类别 public String updateType(HttpServletRequest request, HttpServletResponse response) throws IOException { Integer id = Integer.valueOf(request.getParameter("id")); String name = request.getParameter("name"); Integer level = Integer.valueOf(request.getParameter("level")); Integer parent = Integer.valueOf(request.getParameter("parent")); GoodsType goodsType = new GoodsType(id,name,level,parent); typeService.updateType(goodsType); return Constants.REDIRECT+"/admin/goodsType?method=showGoodsType"; } //条件查询 public String searchType(HttpServletRequest request, HttpServletResponse response){ String name = request.getParameter("name"); String level = request.getParameter("level"); List<GoodsType> goodsTypeList = typeService.searchType(name,level); request.setAttribute("goodsTypeList",goodsTypeList); return Constants.FORWARD+"/admin/showGoodsType.jsp"; } //获取类别列表 public String getTypes(HttpServletRequest request, HttpServletResponse response) throws IOException { List<GoodsType> goodsTypeList = typeService.getAllGoodsType(); request.setAttribute("goodsTypes",goodsTypeList); return Constants.FORWARD+"/admin/addGoodsType.jsp"; } //添加分类 public String addType(HttpServletRequest request, HttpServletResponse response){ String name = request.getParameter("name"); Integer parent = Integer.valueOf(request.getParameter("parent")); GoodsType goodsType = null; if (parent == 0) { goodsType = new GoodsType(name,1,parent); }else{ goodsType = new GoodsType(name,2,parent); } typeService.addGoodsType(goodsType); return Constants.REDIRECT+"/admin/goodsType?method=showGoodsType"; } }
[ "1065917052@qq.com" ]
1065917052@qq.com
2ad553928d30844a2c35c9658af31335a92a3b04
5adf528b1885853200a99a528a592c8b63b922cc
/app/src/main/java/com/example/azharuddin/creditreceipt/listeners/UserListener.java
586f866e75f8f8fa1a8a4544d4a3208f36838fa9
[]
no_license
azharmarmu/CreditReceipt
4c1aa03fee5648d1c636d6667253002fda927af2
6dc3219eb93154cc2fb8068620a96431e0831794
refs/heads/master
2021-04-12T12:17:30.828244
2018-03-22T07:03:38
2018-03-22T07:03:38
126,293,565
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package com.example.azharuddin.creditreceipt.listeners; import java.util.HashMap; /** * Created by azharuddin on 18/9/17. */ public interface UserListener { public void getUser(HashMap<String, Object> user); }
[ "azharuddin@above-inc.com" ]
azharuddin@above-inc.com
e558507ee353e39762c53e8482d7e23fe2d2a075
2c6df93528fa7b8317fbc04922487d576d3f6f20
/src/poad/algorithms/ea/ISelectionAlgorithm.java
d2e8ace2b459988afe26ce4d7865dbdb073aa19c
[]
no_license
hgdxubenben/VRP
18cd294c400cadffd292e0b30f2559e59bc7cbf0
8d4180f7ffe2885203055924737fab84c1612bcc
refs/heads/master
2016-09-06T10:27:21.560916
2015-01-03T13:54:41
2015-01-03T13:54:41
27,962,628
0
0
null
null
null
null
UTF-8
Java
false
false
597
java
package poad.algorithms.ea; import java.util.Random; import poad.Individual; /** the interface for selection algorithms */ public interface ISelectionAlgorithm { /** * Fill the mating pool with selected individuals from the population * * @param pop * the population of the current individuals * @param mate * the mating pool to be filled with individuals * @param r * the random number generator */ public abstract void select(final Individual<?, ?>[] pop, final Individual<?, ?>[] mate, final Random r); }
[ "junxu1991@gmail.com" ]
junxu1991@gmail.com
f939084b586708c0fc6aacd1f88ffc51d54c41d8
9822f65ac9ae369fe416bde3ba16ac1ef4b99671
/ScopeChallenge/src/com/company/X.java
642c04970012cf32e0a3b6eaf66ef60f6d8b6ab6
[]
no_license
SergiOn/complete-java-masterclass
821772c5972eadbc2c1823b4db64929150db16a9
79bab75f0271c38627052c3b78119d8c60b3b457
refs/heads/master
2020-03-22T06:12:07.349362
2018-09-19T21:38:40
2018-09-19T21:38:40
139,617,497
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package com.company; import java.util.Scanner; /** * Created by dev on 13/11/2015. */ public class X { private int x; public X(Scanner x) { System.out.println("Please enter a number: "); this.x = x.nextInt(); } public void x() { for(int x = 1; x < 13; x++) { System.out.println(x + " times " + this.x + " equals " + x * this.x); } } }
[ "onishhenko@gmail.com" ]
onishhenko@gmail.com
884736476452039f9cc391ee8a8120a13bb02181
3b26a0d39305e54c859c80f040170f928f23a644
/Car/Settings/tests/robotests/src/com/android/car/settings/security/SecurityEntryPreferenceControllerTest.java
e7509d7727c500a0e9b493bcde78930865d0e6c6
[]
no_license
MyMagma/apps
cfd74d98c7b81d4bc2f4b4946484a7be1b3bb4ef
128d43ae1aa967328b32225f5eb162fb3b6569d3
refs/heads/master
2020-12-27T06:49:24.811808
2020-02-02T17:32:35
2020-02-02T17:32:35
237,800,995
1
1
null
null
null
null
UTF-8
Java
false
false
2,708
java
/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.car.settings.security; import static com.android.car.settings.common.PreferenceController.AVAILABLE; import static com.android.car.settings.common.PreferenceController.DISABLED_FOR_USER; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.when; import android.car.userlib.CarUserManagerHelper; import com.android.car.settings.CarSettingsRobolectricTestRunner; import com.android.car.settings.common.PreferenceControllerTestHelper; import com.android.car.settings.testutils.ShadowCarUserManagerHelper; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; /** Unit test for {@link SecurityEntryPreferenceController}. */ @RunWith(CarSettingsRobolectricTestRunner.class) @Config(shadows = {ShadowCarUserManagerHelper.class}) public class SecurityEntryPreferenceControllerTest { @Mock private CarUserManagerHelper mCarUserManagerHelper; private SecurityEntryPreferenceController mController; @Before public void setUp() { MockitoAnnotations.initMocks(this); ShadowCarUserManagerHelper.setMockInstance(mCarUserManagerHelper); mController = new PreferenceControllerTestHelper<>(RuntimeEnvironment.application, SecurityEntryPreferenceController.class).getController(); } @After public void tearDown() { ShadowCarUserManagerHelper.reset(); } @Test public void getAvailabilityStatus_guestUser_disabledForUser() { when(mCarUserManagerHelper.isCurrentProcessGuestUser()).thenReturn(true); assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_FOR_USER); } @Test public void getAvailabilityStatus_nonGuestUser_available() { when(mCarUserManagerHelper.isCurrentProcessGuestUser()).thenReturn(false); assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE); } }
[ "user@email.edu" ]
user@email.edu
29ecd3bee4446be9d08f20c3afac37eccc50871a
be0adf2bb2d41e6d7d4b0e54b1a2142089da95ee
/highlight_spring4/src/main/java/com/wisely/highlight_spring4/ch3/fortest/TestApplication.java
8bd884c790564df63b404df4b8afd32c7f423db6
[]
no_license
shengchenglong/highlight_springmvc4
612a7d2334a3619fc179c5a1c43d3b8907dc081b
b3c7f310b041e1519639a206bf5c2eb0ccd1a6be
refs/heads/master
2020-12-25T08:49:40.858856
2016-07-12T07:38:43
2016-07-12T07:38:43
63,136,290
1
1
null
null
null
null
GB18030
Java
false
false
859
java
package com.wisely.highlight_spring4.ch3.fortest; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class)//在junit环境中提供Spring TestContext Framework 的功能 @ContextConfiguration(classes = {TestConfig.class})//该注解用来加载配置ApplicationContext,其中的classes属性用来加载配置类 @ActiveProfiles("dev")//声明活动的profile public class TestApplication { @Autowired private TestBean testBean; @Test public void test1() { String content = testBean.getContent(); System.out.println(content); } }
[ "shengchenglong@scl" ]
shengchenglong@scl
4aa6edc7a45a364716757f21fe737e64fe7097da
63f99fc8e030f64a22eed1eba0f94d5eb318ecba
/task04/model/parser/TextParcer.java
1d6358c2e061c1af93e684fd1aba38fda8175db0
[]
no_license
MaksimK87/JavaWeb
ba76f7d2379b1cb839d4813cdd4680cfe9c0b224
bf68a86a286723cc1fb8df3116572b1cbd3aaacb
refs/heads/master
2020-04-23T12:29:41.620433
2019-04-12T08:27:51
2019-04-12T08:27:51
171,170,661
0
0
null
null
null
null
UTF-8
Java
false
false
1,520
java
/** * @author - Maksim Kosmachev */ package by.epam.javawebtraining.maksimkosmachev.task04.model.parser; import by.epam.javawebtraining.maksimkosmachev.task04.model.entity.IUnit; import by.epam.javawebtraining.maksimkosmachev.task04.model.entity.Paragraf; import by.epam.javawebtraining.maksimkosmachev.task04.model.reader.TextReader; import org.apache.log4j.Logger; import java.util.List; public class TextParcer extends AbstractParser { private static Logger logger = Logger.getLogger(TextParcer.class); private String text; private static final String PARAGRAF_SPLITTER = "[\t]"; public String getText() { return text; } public void setText(String text) { this.text = text; } TextParcer(String text) { this.text = text; } TextParcer() { this.text = TextReader.readFile(); } public List<IUnit> parse() { String[] paragrafs = text.split(PARAGRAF_SPLITTER); for (String paragraf : paragrafs) { logger.info("\n"+"next paragraf will add to container: " + "\n" + paragraf); composites.add(new Paragraf(paragraf)); } if (this.getNextParser() != null) { logger.info("moving to the paragraf parser from text parser"); return getNextParser().parse(composites); } return composites; } @Override List<IUnit> parse(List<IUnit> composites) { return null; } }
[ "noreply@github.com" ]
noreply@github.com
e5101776d1e34824dc285e034f0391e154cfcc34
fe7d27bdebd033f7954d301a0b4801da73c2153c
/src/main/java/uniandes/isis2304/EPSAndes/negocio/Control.java
08301484d9c8c5130385859ce618f1837107f2d3
[]
no_license
dfperezc/Py-It1
e2fd8b17cf9db39692c12caca395f004635fb424
c177b48e73b470c8a5a43bda822147ffd5b46ccb
refs/heads/master
2020-07-23T15:35:52.933398
2019-10-24T23:37:59
2019-10-24T23:37:59
207,613,811
0
0
null
2019-10-22T20:19:52
2019-09-10T16:50:19
Java
UTF-8
Java
false
false
295
java
package uniandes.isis2304.EPSAndes.negocio; public class Control extends Servicio implements VOControl{ /** * @param id * @param capacidad * @param horariosAtencion */ public Control(long id, int capacidad, String horariosAtencion) { super(id, capacidad, horariosAtencion); } }
[ "df.perezc@uniandes.edu.co" ]
df.perezc@uniandes.edu.co
6a713112d34c71c5432e8c97a5ff55a3718c782a
0d4edfbd462ed72da9d1e2ac4bfef63d40db2990
/app/src/main/java/com/bilibili/commons/time/FastDatePrinter.java
c0766b7960ff7958fa59056900f17cb1ea2c5ffe
[]
no_license
dvc890/MyBilibili
1fc7e0a0d5917fb12a7efed8aebfd9030db7ff9f
0483e90e6fbf42905b8aff4cbccbaeb95c733712
refs/heads/master
2020-05-24T22:49:02.383357
2019-11-23T01:14:14
2019-11-23T01:14:14
187,502,297
31
3
null
null
null
null
UTF-8
Java
false
false
33,699
java
package com.bilibili.commons.time; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; /* compiled from: BL */ public class FastDatePrinter implements Serializable { public static final int FULL = 0; public static final int LONG = 1; private static final int MAX_DIGITS = 10; public static final int MEDIUM = 2; public static final int SHORT = 3; private static final ConcurrentMap<C12631i, String> cTimeZoneDisplayCache = new ConcurrentHashMap(7); private static final long serialVersionUID = 1; private final Locale mLocale; private transient int mMaxLengthEstimate; private final String mPattern; private transient C12630f[] mRules; private final TimeZone mTimeZone; /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$f */ private interface C12630f { /* renamed from: a */ int mo43647a(); /* renamed from: a */ void mo43648a(Appendable appendable, Calendar calendar) throws IOException; } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$i */ private static class C12631i { /* renamed from: a */ private final TimeZone f34383a; /* renamed from: b */ private final int f34384b; /* renamed from: c */ private final Locale f34385c; C12631i(TimeZone timeZone, boolean z, int i, Locale locale) { this.f34383a = timeZone; if (z) { this.f34384b = Integer.MIN_VALUE | i; } else { this.f34384b = i; } this.f34385c = locale; } public int hashCode() { return (((this.f34384b * 31) + this.f34385c.hashCode()) * 31) + this.f34383a.hashCode(); } public boolean equals(Object obj) { boolean z = true; if (this == obj) { return true; } if (!(obj instanceof C12631i)) { return false; } C12631i c12631i = (C12631i) obj; if (!(this.f34383a.equals(c12631i.f34383a) && this.f34384b == c12631i.f34384b && this.f34385c.equals(c12631i.f34385c))) { z = false; } return z; } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$a */ private static class C12632a implements C12630f { /* renamed from: a */ private final char f34386a; /* renamed from: a */ public int mo43647a() { return 1; } C12632a(char c) { this.f34386a = c; } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { appendable.append(this.f34386a); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$c */ private static class C12633c implements C12630f { /* renamed from: a */ static final C12633c f34387a = new C12633c(3); /* renamed from: b */ static final C12633c f34388b = new C12633c(5); /* renamed from: c */ static final C12633c f34389c = new C12633c(6); /* renamed from: d */ final int f34390d; /* renamed from: a */ static C12633c m47024a(int i) { switch (i) { case 1: return f34387a; case 2: return f34388b; case 3: return f34389c; default: throw new IllegalArgumentException("invalid number of X"); } } C12633c(int i) { this.f34390d = i; } /* renamed from: a */ public int mo43647a() { return this.f34390d; } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { int i = calendar.get(15) + calendar.get(16); if (i == 0) { appendable.append("Z"); return; } if (i < 0) { appendable.append('-'); i = -i; } else { appendable.append('+'); } int i2 = i / 3600000; FastDatePrinter.appendDigits(appendable, i2); if (this.f34390d >= 5) { if (this.f34390d == 6) { appendable.append(':'); } FastDatePrinter.appendDigits(appendable, (i / 60000) - (i2 * 60)); } } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$d */ private interface C12634d extends C12630f { /* renamed from: a */ void mo43668a(Appendable appendable, int i) throws IOException; } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$g */ private static class C12635g implements C12630f { /* renamed from: a */ private final String f34391a; C12635g(String str) { this.f34391a = str; } /* renamed from: a */ public int mo43647a() { return this.f34391a.length(); } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { appendable.append(this.f34391a); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$h */ private static class C12636h implements C12630f { /* renamed from: a */ private final int f34392a; /* renamed from: b */ private final String[] f34393b; C12636h(int i, String[] strArr) { this.f34392a = i; this.f34393b = strArr; } /* renamed from: a */ public int mo43647a() { int length = this.f34393b.length; int i = 0; while (true) { length--; if (length < 0) { return i; } int length2 = this.f34393b[length].length(); if (length2 > i) { i = length2; } } } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { appendable.append(this.f34393b[calendar.get(this.f34392a)]); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$j */ private static class C12637j implements C12630f { /* renamed from: a */ private final Locale f34394a; /* renamed from: b */ private final int f34395b; /* renamed from: c */ private final String f34396c; /* renamed from: d */ private final String f34397d; C12637j(TimeZone timeZone, Locale locale, int i) { this.f34394a = locale; this.f34395b = i; this.f34396c = FastDatePrinter.getTimeZoneDisplay(timeZone, false, i, locale); this.f34397d = FastDatePrinter.getTimeZoneDisplay(timeZone, true, i, locale); } /* renamed from: a */ public int mo43647a() { return Math.max(this.f34396c.length(), this.f34397d.length()); } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { TimeZone timeZone = calendar.getTimeZone(); if (calendar.get(16) != 0) { appendable.append(FastDatePrinter.getTimeZoneDisplay(timeZone, true, this.f34395b, this.f34394a)); } else { appendable.append(FastDatePrinter.getTimeZoneDisplay(timeZone, false, this.f34395b, this.f34394a)); } } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$k */ private static class C12638k implements C12630f { /* renamed from: a */ static final C12638k f34398a = new C12638k(true); /* renamed from: b */ static final C12638k f34399b = new C12638k(false); /* renamed from: c */ final boolean f34400c; /* renamed from: a */ public int mo43647a() { return 5; } C12638k(boolean z) { this.f34400c = z; } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { int i = calendar.get(15) + calendar.get(16); if (i < 0) { appendable.append('-'); i = -i; } else { appendable.append('+'); } int i2 = i / 3600000; FastDatePrinter.appendDigits(appendable, i2); if (this.f34400c) { appendable.append(':'); } FastDatePrinter.appendDigits(appendable, (i / 60000) - (i2 * 60)); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$b */ private static class C12639b implements C12634d { /* renamed from: a */ private final C12634d f34401a; C12639b(C12634d c12634d) { this.f34401a = c12634d; } /* renamed from: a */ public int mo43647a() { return this.f34401a.mo43647a(); } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { int i = 7; int i2 = calendar.get(7); C12634d c12634d = this.f34401a; if (i2 != 1) { i = i2 - 1; } c12634d.mo43668a(appendable, i); } /* renamed from: a */ public void mo43668a(Appendable appendable, int i) throws IOException { this.f34401a.mo43668a(appendable, i); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$e */ private static class C12640e implements C12634d { /* renamed from: a */ private final int f34402a; /* renamed from: b */ private final int f34403b; C12640e(int i, int i2) { if (i2 < 3) { throw new IllegalArgumentException(); } this.f34402a = i; this.f34403b = i2; } /* renamed from: a */ public int mo43647a() { return this.f34403b; } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { mo43668a(appendable, calendar.get(this.f34402a)); } /* renamed from: a */ public final void mo43668a(Appendable appendable, int i) throws IOException { FastDatePrinter.appendFullDigits(appendable, i, this.f34403b); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$l */ private static class C12641l implements C12634d { /* renamed from: a */ private final C12634d f34404a; C12641l(C12634d c12634d) { this.f34404a = c12634d; } /* renamed from: a */ public int mo43647a() { return this.f34404a.mo43647a(); } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { int i = calendar.get(10); if (i == 0) { i = calendar.getLeastMaximum(10) + 1; } this.f34404a.mo43668a(appendable, i); } /* renamed from: a */ public void mo43668a(Appendable appendable, int i) throws IOException { this.f34404a.mo43668a(appendable, i); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$m */ private static class C12642m implements C12634d { /* renamed from: a */ private final C12634d f34405a; C12642m(C12634d c12634d) { this.f34405a = c12634d; } /* renamed from: a */ public int mo43647a() { return this.f34405a.mo43647a(); } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { int i = calendar.get(11); if (i == 0) { i = calendar.getMaximum(11) + 1; } this.f34405a.mo43668a(appendable, i); } /* renamed from: a */ public void mo43668a(Appendable appendable, int i) throws IOException { this.f34405a.mo43668a(appendable, i); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$n */ private static class C12643n implements C12634d { /* renamed from: a */ static final C12643n f34406a = new C12643n(); /* renamed from: a */ public int mo43647a() { return 2; } C12643n() { } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { mo43668a(appendable, calendar.get(2) + 1); } /* renamed from: a */ public final void mo43668a(Appendable appendable, int i) throws IOException { FastDatePrinter.appendDigits(appendable, i); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$o */ private static class C12644o implements C12634d { /* renamed from: a */ private final int f34407a; /* renamed from: a */ public int mo43647a() { return 2; } C12644o(int i) { this.f34407a = i; } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { mo43668a(appendable, calendar.get(this.f34407a)); } /* renamed from: a */ public final void mo43668a(Appendable appendable, int i) throws IOException { if (i < 100) { FastDatePrinter.appendDigits(appendable, i); } else { FastDatePrinter.appendFullDigits(appendable, i, 2); } } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$p */ private static class C12645p implements C12634d { /* renamed from: a */ static final C12645p f34408a = new C12645p(); /* renamed from: a */ public int mo43647a() { return 2; } C12645p() { } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { mo43668a(appendable, calendar.get(1) % 100); } /* renamed from: a */ public final void mo43668a(Appendable appendable, int i) throws IOException { FastDatePrinter.appendDigits(appendable, i); } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$q */ private static class C12646q implements C12634d { /* renamed from: a */ static final C12646q f34409a = new C12646q(); /* renamed from: a */ public int mo43647a() { return 2; } C12646q() { } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { mo43668a(appendable, calendar.get(2) + 1); } /* renamed from: a */ public final void mo43668a(Appendable appendable, int i) throws IOException { if (i < 10) { appendable.append((char) (i + 48)); } else { FastDatePrinter.appendDigits(appendable, i); } } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$r */ private static class C12647r implements C12634d { /* renamed from: a */ private final int f34410a; /* renamed from: a */ public int mo43647a() { return 4; } C12647r(int i) { this.f34410a = i; } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { mo43668a(appendable, calendar.get(this.f34410a)); } /* renamed from: a */ public final void mo43668a(Appendable appendable, int i) throws IOException { if (i < 10) { appendable.append((char) (i + 48)); } else if (i < 100) { FastDatePrinter.appendDigits(appendable, i); } else { FastDatePrinter.appendFullDigits(appendable, i, 1); } } } /* compiled from: BL */ /* renamed from: com.bilibili.commons.time.FastDatePrinter$s */ private static class C12648s implements C12634d { /* renamed from: a */ private final C12634d f34411a; C12648s(C12634d c12634d) { this.f34411a = c12634d; } /* renamed from: a */ public int mo43647a() { return this.f34411a.mo43647a(); } /* renamed from: a */ public void mo43648a(Appendable appendable, Calendar calendar) throws IOException { this.f34411a.mo43668a(appendable, C12649a.m47068b(calendar)); } /* renamed from: a */ public void mo43668a(Appendable appendable, int i) throws IOException { this.f34411a.mo43668a(appendable, i); } } protected FastDatePrinter(String str, TimeZone timeZone, Locale locale) { this.mPattern = str; this.mTimeZone = timeZone; this.mLocale = locale; init(); } private void init() { List parsePattern = parsePattern(); this.mRules = (C12630f[]) parsePattern.toArray(new C12630f[parsePattern.size()]); int length = this.mRules.length; int i = 0; while (true) { length--; if (length >= 0) { i += this.mRules[length].mo43647a(); } else { this.mMaxLengthEstimate = i; return; } } } /* Access modifiers changed, original: protected */ public java.util.List<FastDatePrinter.C12630f> parsePattern() { /* r17 = this; r0 = r17; r1 = new java.text.DateFormatSymbols; r2 = r0.mLocale; r1.<init>(r2); r2 = new java.util.ArrayList; r2.<init>(); r3 = r1.getEras(); r4 = r1.getMonths(); r5 = r1.getShortMonths(); r6 = r1.getWeekdays(); r7 = r1.getShortWeekdays(); r1 = r1.getAmPmStrings(); r8 = r0.mPattern; r8 = r8.length(); r9 = 1; r10 = new int[r9]; r11 = 0; r12 = 0; L_0x0031: if (r12 >= r8) goto L_0x018f; L_0x0033: r10[r11] = r12; r12 = r0.mPattern; r12 = r0.parseToken(r12, r10); r13 = r10[r11]; r14 = r12.length(); if (r14 != 0) goto L_0x0045; L_0x0043: goto L_0x018f; L_0x0045: r15 = r12.charAt(r11); r9 = 7; switch(r15) { case 68: goto L_0x017f; case 69: goto L_0x0171; case 70: goto L_0x0169; case 71: goto L_0x0162; case 72: goto L_0x015a; default: goto L_0x004d; }; L_0x004d: switch(r15) { case 87: goto L_0x0154; case 88: goto L_0x014f; case 89: goto L_0x0120; case 90: goto L_0x0122; default: goto L_0x0050; }; L_0x0050: switch(r15) { case 121: goto L_0x0120; case 122: goto L_0x0106; default: goto L_0x0053; }; L_0x0053: r11 = 3; switch(r15) { case 39: goto L_0x00e9; case 75: goto L_0x00e1; case 77: goto L_0x00c2; case 83: goto L_0x00ba; case 97: goto L_0x00b1; case 100: goto L_0x00aa; case 104: goto L_0x009d; case 107: goto L_0x0090; case 109: goto L_0x0088; case 115: goto L_0x0080; case 117: goto L_0x0074; case 119: goto L_0x006e; default: goto L_0x0057; }; L_0x0057: r1 = new java.lang.IllegalArgumentException; r2 = new java.lang.StringBuilder; r2.<init>(); r3 = "Illegal pattern component: "; r2.append(r3); r2.append(r12); r2 = r2.toString(); r1.<init>(r2); throw r1; L_0x006e: r9 = r0.selectNumberRule(r11, r14); goto L_0x0160; L_0x0074: r11 = new com.bilibili.commons.time.FastDatePrinter$b; r9 = r0.selectNumberRule(r9, r14); r11.<init>(r9); L_0x007d: r9 = r11; goto L_0x0160; L_0x0080: r9 = 13; r9 = r0.selectNumberRule(r9, r14); goto L_0x0160; L_0x0088: r9 = 12; r9 = r0.selectNumberRule(r9, r14); goto L_0x0160; L_0x0090: r9 = new com.bilibili.commons.time.FastDatePrinter$m; r11 = 11; r11 = r0.selectNumberRule(r11, r14); r9.<init>(r11); goto L_0x0160; L_0x009d: r9 = new com.bilibili.commons.time.FastDatePrinter$l; r11 = 10; r11 = r0.selectNumberRule(r11, r14); r9.<init>(r11); goto L_0x0160; L_0x00aa: r9 = 5; r9 = r0.selectNumberRule(r9, r14); goto L_0x0160; L_0x00b1: r9 = new com.bilibili.commons.time.FastDatePrinter$h; r11 = 9; r9.<init>(r11, r1); goto L_0x0160; L_0x00ba: r9 = 14; r9 = r0.selectNumberRule(r9, r14); goto L_0x0160; L_0x00c2: r9 = 4; if (r14 < r9) goto L_0x00cd; L_0x00c5: r9 = new com.bilibili.commons.time.FastDatePrinter$h; r12 = 2; r9.<init>(r12, r4); goto L_0x0160; L_0x00cd: r12 = 2; if (r14 != r11) goto L_0x00d7; L_0x00d0: r9 = new com.bilibili.commons.time.FastDatePrinter$h; r9.<init>(r12, r5); goto L_0x0160; L_0x00d7: if (r14 != r12) goto L_0x00dd; L_0x00d9: r9 = com.bilibili.commons.time.FastDatePrinter.C12643n.f34406a; goto L_0x0160; L_0x00dd: r9 = com.bilibili.commons.time.FastDatePrinter.C12646q.f34409a; goto L_0x0160; L_0x00e1: r9 = 10; r9 = r0.selectNumberRule(r9, r14); goto L_0x0160; L_0x00e9: r9 = 1; r11 = r12.substring(r9); r12 = r11.length(); if (r12 != r9) goto L_0x0100; L_0x00f4: r9 = new com.bilibili.commons.time.FastDatePrinter$a; r12 = 0; r11 = r11.charAt(r12); r9.<init>(r11); goto L_0x0160; L_0x0100: r9 = new com.bilibili.commons.time.FastDatePrinter$g; r9.<init>(r11); goto L_0x0160; L_0x0106: r9 = 4; if (r14 < r9) goto L_0x0114; L_0x0109: r9 = new com.bilibili.commons.time.FastDatePrinter$j; r11 = r0.mTimeZone; r12 = r0.mLocale; r14 = 1; r9.<init>(r11, r12, r14); goto L_0x0160; L_0x0114: r14 = 1; r9 = new com.bilibili.commons.time.FastDatePrinter$j; r11 = r0.mTimeZone; r12 = r0.mLocale; r15 = 0; r9.<init>(r11, r12, r15); goto L_0x0160; L_0x0120: r9 = 2; goto L_0x0131; L_0x0122: r9 = 1; if (r14 != r9) goto L_0x0128; L_0x0125: r9 = com.bilibili.commons.time.FastDatePrinter.C12638k.f34399b; goto L_0x0160; L_0x0128: r9 = 2; if (r14 != r9) goto L_0x012e; L_0x012b: r9 = com.bilibili.commons.time.FastDatePrinter.C12633c.f34389c; goto L_0x0160; L_0x012e: r9 = com.bilibili.commons.time.FastDatePrinter.C12638k.f34398a; goto L_0x0160; L_0x0131: if (r14 != r9) goto L_0x0136; L_0x0133: r9 = com.bilibili.commons.time.FastDatePrinter.C12645p.f34408a; goto L_0x0142; L_0x0136: r9 = 4; if (r14 >= r9) goto L_0x013c; L_0x0139: r9 = 1; r14 = 4; goto L_0x013d; L_0x013c: r9 = 1; L_0x013d: r11 = r0.selectNumberRule(r9, r14); r9 = r11; L_0x0142: r11 = 89; if (r15 != r11) goto L_0x0160; L_0x0146: r11 = new com.bilibili.commons.time.FastDatePrinter$s; r9 = (com.bilibili.commons.time.FastDatePrinter.C12634d) r9; r11.<init>(r9); goto L_0x007d; L_0x014f: r9 = com.bilibili.commons.time.FastDatePrinter.C12633c.m47024a(r14); goto L_0x0160; L_0x0154: r11 = 4; r9 = r0.selectNumberRule(r11, r14); goto L_0x0160; L_0x015a: r9 = 11; r9 = r0.selectNumberRule(r9, r14); L_0x0160: r12 = 0; goto L_0x0185; L_0x0162: r9 = new com.bilibili.commons.time.FastDatePrinter$h; r12 = 0; r9.<init>(r12, r3); goto L_0x0185; L_0x0169: r12 = 0; r9 = 8; r9 = r0.selectNumberRule(r9, r14); goto L_0x0185; L_0x0171: r11 = 4; r12 = 0; r15 = new com.bilibili.commons.time.FastDatePrinter$h; if (r14 >= r11) goto L_0x0179; L_0x0177: r11 = r7; goto L_0x017a; L_0x0179: r11 = r6; L_0x017a: r15.<init>(r9, r11); r9 = r15; goto L_0x0185; L_0x017f: r12 = 0; r9 = 6; r9 = r0.selectNumberRule(r9, r14); L_0x0185: r2.add(r9); r9 = 1; r11 = r13 + 1; r12 = r11; r11 = 0; goto L_0x0031; L_0x018f: return r2; */ throw new UnsupportedOperationException("Method not decompiled: com.bilibili.commons.time.FastDatePrinter.parsePattern():java.util.List"); } /* Access modifiers changed, original: protected */ public String parseToken(String str, int[] iArr) { StringBuilder stringBuilder = new StringBuilder(); int i = iArr[0]; int length = str.length(); char charAt = str.charAt(i); if ((charAt >= 'A' && charAt <= 'Z') || (charAt >= 'a' && charAt <= 'z')) { stringBuilder.append(charAt); while (true) { int i2 = i + 1; if (i2 >= length || str.charAt(i2) != charAt) { break; } stringBuilder.append(charAt); i = i2; } } else { stringBuilder.append('\''); int i3 = 0; while (i < length) { char charAt2 = str.charAt(i); if (charAt2 != '\'') { if (i3 == 0 && ((charAt2 >= 'A' && charAt2 <= 'Z') || (charAt2 >= 'a' && charAt2 <= 'z'))) { i--; break; } stringBuilder.append(charAt2); } else { int i4 = i + 1; if (i4 >= length || str.charAt(i4) != '\'') { i3 ^= 1; } else { stringBuilder.append(charAt2); i = i4; } } i++; } } iArr[0] = i; return stringBuilder.toString(); } /* Access modifiers changed, original: protected */ public C12634d selectNumberRule(int i, int i2) { switch (i2) { case 1: return new C12647r(i); case 2: return new C12644o(i); default: return new C12640e(i, i2); } } /* Access modifiers changed, original: 0000 */ public String format(Object obj) { if (obj instanceof Date) { return format((Date) obj); } if (obj instanceof Calendar) { return format((Calendar) obj); } if (obj instanceof Long) { return format(((Long) obj).longValue()); } String str; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Unknown class: "); if (obj == null) { str = "<null>"; } else { str = obj.getClass().getName(); } stringBuilder.append(str); throw new IllegalArgumentException(stringBuilder.toString()); } public String format(long j) { Calendar newCalendar = newCalendar(); newCalendar.setTimeInMillis(j); return applyRulesToString(newCalendar); } private String applyRulesToString(Calendar calendar) { return ((StringBuilder) applyRules(calendar, new StringBuilder(this.mMaxLengthEstimate))).toString(); } private Calendar newCalendar() { return Calendar.getInstance(this.mTimeZone, this.mLocale); } public String format(Date date) { Calendar newCalendar = newCalendar(); newCalendar.setTime(date); return applyRulesToString(newCalendar); } public String format(Calendar calendar) { return ((StringBuilder) format(calendar, new StringBuilder(this.mMaxLengthEstimate))).toString(); } public <B extends Appendable> B format(long j, B b) { return (B) format(new Date(j), (Appendable) b); } public <B extends Appendable> B format(Date date, B b) { Calendar newCalendar = newCalendar(); newCalendar.setTime(date); return applyRules(newCalendar, b); } public <B extends Appendable> B format(Calendar calendar, B b) { if (!calendar.getTimeZone().equals(this.mTimeZone)) { calendar = (Calendar) calendar.clone(); calendar.setTimeZone(this.mTimeZone); } return applyRules(calendar, b); } private <B extends Appendable> B applyRules(Calendar calendar, B b) { try { for (C12630f a : this.mRules) { a.mo43648a(b, calendar); } } catch (IOException e) { e.printStackTrace(); } return b; } public String getPattern() { return this.mPattern; } public TimeZone getTimeZone() { return this.mTimeZone; } public Locale getLocale() { return this.mLocale; } public int getMaxLengthEstimate() { return this.mMaxLengthEstimate; } public boolean equals(Object obj) { boolean z = false; if (!(obj instanceof FastDatePrinter)) { return false; } FastDatePrinter fastDatePrinter = (FastDatePrinter) obj; if (this.mPattern.equals(fastDatePrinter.mPattern) && this.mTimeZone.equals(fastDatePrinter.mTimeZone) && this.mLocale.equals(fastDatePrinter.mLocale)) { z = true; } return z; } public int hashCode() { return this.mPattern.hashCode() + ((this.mTimeZone.hashCode() + (this.mLocale.hashCode() * 13)) * 13); } public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("FastDatePrinter["); stringBuilder.append(this.mPattern); stringBuilder.append(","); stringBuilder.append(this.mLocale); stringBuilder.append(","); stringBuilder.append(this.mTimeZone.getID()); stringBuilder.append("]"); return stringBuilder.toString(); } private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { objectInputStream.defaultReadObject(); init(); } private static void appendDigits(Appendable appendable, int i) throws IOException { appendable.append((char) ((i / 10) + 48)); appendable.append((char) ((i % 10) + 48)); } private static void appendFullDigits(Appendable appendable, int i, int i2) throws IOException { char[] cArr = new char[10]; int i3 = 0; while (i != 0) { int i4 = i3 + 1; cArr[i3] = (char) ((i % 10) + 48); i /= 10; i3 = i4; } while (i3 < i2) { appendable.append('0'); i2--; } while (true) { i3--; if (i3 >= 0) { appendable.append(cArr[i3]); } else { return; } } } static String getTimeZoneDisplay(TimeZone timeZone, boolean z, int i, Locale locale) { C12631i c12631i = new C12631i(timeZone, z, i, locale); String str = (String) cTimeZoneDisplayCache.get(c12631i); if (str != null) { return str; } str = timeZone.getDisplayName(z, i, locale); String str2 = (String) cTimeZoneDisplayCache.putIfAbsent(c12631i, str); return str2 != null ? str2 : str; } }
[ "dvc890@139.com" ]
dvc890@139.com
9a017d4766f123ff7ef237e522e66301df243e5e
987d3a6f4e225b83291df961d3d18bc958f88e9a
/src/GOF23/P268_中介者模式/Development.java
3ece03bf7e527f478c6fb57cc5f0591b72de5b12
[]
no_license
pippichi/IntelliJ_JAVA
2d83d6052651c3eadb4af44c86e9f0ecc5d3caac
90a5e342516529ce1c9cc44128147ca62aa24f76
refs/heads/master
2023-04-12T13:56:36.898397
2021-05-18T07:02:11
2021-05-18T07:02:11
159,301,322
2
0
null
2018-11-27T09:17:02
2018-11-27T08:28:21
null
UTF-8
Java
false
false
514
java
package GOF23.P268_中介者模式; public class Development implements Department{ private Mediator m; //持有中介者(总经理)的引用 public Development(Mediator m) { this.m = m; m.register("development",this); } @Override public void selfAction() { System.out.println("专心科研,开发项目!"); } @Override public void outAction() { System.out.println("汇报工作!没钱了!!请求资金支持!!"); } }
[ "874496049@qq.com" ]
874496049@qq.com
4062054713217993eca3615d6b8a3a8e2215ec87
dd80a584130ef1a0333429ba76c1cee0eb40df73
/developers/samples/android/background/alarms/Scheduler/src/com/example/android/scheduler/SampleAlarmReceiver.java
3a8cce1ca023062d72aad303199e42d5de6a0484
[ "MIT" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
Java
false
false
5,982
java
package com.example.android.scheduler; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.support.v4.content.WakefulBroadcastReceiver; import java.util.Calendar; /** * When the alarm fires, this WakefulBroadcastReceiver receives the broadcast Intent * and then starts the IntentService {@code SampleSchedulingService} to do some work. */ public class SampleAlarmReceiver extends WakefulBroadcastReceiver { // The app's AlarmManager, which provides access to the system alarm services. private AlarmManager alarmMgr; // The pending intent that is triggered when the alarm fires. private PendingIntent alarmIntent; @Override public void onReceive(Context context, Intent intent) { // BEGIN_INCLUDE(alarm_onreceive) /* * If your receiver intent includes extras that need to be passed along to the * service, use setComponent() to indicate that the service should handle the * receiver's intent. For example: * * ComponentName comp = new ComponentName(context.getPackageName(), * MyService.class.getName()); * * // This intent passed in this call will include the wake lock extra as well as * // the receiver intent contents. * startWakefulService(context, (intent.setComponent(comp))); * * In this example, we simply create a new intent to deliver to the service. * This intent holds an extra identifying the wake lock. */ Intent service = new Intent(context, SampleSchedulingService.class); // Start the service, keeping the device awake while it is launching. startWakefulService(context, service); // END_INCLUDE(alarm_onreceive) } // BEGIN_INCLUDE(set_alarm) /** * Sets a repeating alarm that runs once a day at approximately 8:30 a.m. When the * alarm fires, the app broadcasts an Intent to this WakefulBroadcastReceiver. * @param context */ public void setAlarm(Context context) { alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, SampleAlarmReceiver.class); alarmIntent = PendingIntent.getBroadcast(context, 0, intent, 0); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); // Set the alarm's trigger time to 8:30 a.m. calendar.set(Calendar.HOUR_OF_DAY, 8); calendar.set(Calendar.MINUTE, 30); /* * If you don't have precise time requirements, use an inexact repeating alarm * to minimize the drain on the device battery. * * The call below specifies the alarm type, the trigger time, the interval at * which the alarm is fired, and the alarm's associated PendingIntent. * It uses the alarm type RTC_WAKEUP ("Real Time Clock" wake up), which wakes up * the device and triggers the alarm according to the time of the device's clock. * * Alternatively, you can use the alarm type ELAPSED_REALTIME_WAKEUP to trigger * an alarm based on how much time has elapsed since the device was booted. This * is the preferred choice if your alarm is based on elapsed time--for example, if * you simply want your alarm to fire every 60 minutes. You only need to use * RTC_WAKEUP if you want your alarm to fire at a particular date/time. Remember * that clock-based time may not translate well to other locales, and that your * app's behavior could be affected by the user changing the device's time setting. * * Here are some examples of ELAPSED_REALTIME_WAKEUP: * * // Wake up the device to fire a one-time alarm in one minute. * alarmMgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, * SystemClock.elapsedRealtime() + * 60*1000, alarmIntent); * * // Wake up the device to fire the alarm in 30 minutes, and every 30 minutes * // after that. * alarmMgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, * AlarmManager.INTERVAL_HALF_HOUR, * AlarmManager.INTERVAL_HALF_HOUR, alarmIntent); */ // Set the alarm to fire at approximately 8:30 a.m., according to the device's // clock, and to repeat once a day. alarmMgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, alarmIntent); // Enable {@code SampleBootReceiver} to automatically restart the alarm when the // device is rebooted. ComponentName receiver = new ComponentName(context, SampleBootReceiver.class); PackageManager pm = context.getPackageManager(); pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); } // END_INCLUDE(set_alarm) /** * Cancels the alarm. * @param context */ // BEGIN_INCLUDE(cancel_alarm) public void cancelAlarm(Context context) { // If the alarm has been set, cancel it. if (alarmMgr!= null) { alarmMgr.cancel(alarmIntent); } // Disable {@code SampleBootReceiver} so that it doesn't automatically restart the // alarm when the device is rebooted. ComponentName receiver = new ComponentName(context, SampleBootReceiver.class); PackageManager pm = context.getPackageManager(); pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } // END_INCLUDE(cancel_alarm) }
[ "karun.matharu@gmail.com" ]
karun.matharu@gmail.com
e1264b4c7d0ffb002807a9d470e8d9780d7ebe92
8fdc572a9db92148c421552b6feef2a887ec9d4f
/modules/ui/src/com/alee/managers/popup/ShadeLayer.java
e2aec93b88ca819c10d9b43d15601f884d7c2605
[]
no_license
RoshanGerard/weblaf
cde828d647fdd95c3aab979881020ece08a050ca
2b8f47d5927253ae583ef6a9b3778fcafbd660c7
refs/heads/master
2020-12-24T23:39:28.707037
2016-04-18T18:24:01
2016-04-18T18:24:01
51,216,001
0
0
null
2016-02-06T18:42:37
2016-02-06T18:42:37
null
UTF-8
Java
false
false
6,979
java
/* * This file is part of WebLookAndFeel library. * * WebLookAndFeel library is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * WebLookAndFeel library 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 WebLookAndFeel library. If not, see <http://www.gnu.org/licenses/>. */ package com.alee.managers.popup; import com.alee.extended.layout.AlignLayout; import com.alee.global.StyleConstants; import com.alee.utils.GraphicsUtils; import com.alee.utils.swing.WebTimer; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * This special popup layer is used to place modal-like popups atop of it. * It basically provides a semi-transparent layer that covers the whole window and leaves only modal popup in focus. * * @author Mikle Garin * @see PopupManager */ public class ShadeLayer extends PopupLayer { /** * Whether modal shade should be animated or not. * It might cause serious lags in case it is used in a large window with lots of UI elements. */ protected boolean animate = ShadeLayerStyle.animate; /** * Layer current opacity. */ protected int opacity = 0; /** * Layer opacity animator. */ protected WebTimer animator; /** * Whether popup close attemps should be blocked or not. */ protected boolean blockClose = false; /** * Constructs new shade layer. */ public ShadeLayer () { super ( new AlignLayout () ); final MouseAdapter mouseAdapter = new MouseAdapter () { @Override public void mousePressed ( final MouseEvent e ) { if ( !blockClose ) { hideAllPopups (); } } }; addMouseListener ( mouseAdapter ); addMouseMotionListener ( mouseAdapter ); } @Override public void showPopup ( final WebPopup popup ) { showPopup ( popup, false, false ); } /** * Displays the specified popup on this popup layer. * * @param popup popup to display * @param hfill whether popup should fill the whole available window width or not * @param vfill whether popup should fill the whole available window height or not */ public void showPopup ( final WebPopup popup, final boolean hfill, final boolean vfill ) { // Informing that popup will now become visible popup.firePopupWillBeOpened (); // Updating layout settings final LayoutManager layoutManager = getLayout (); if ( layoutManager instanceof AlignLayout ) { final AlignLayout layout = ( AlignLayout ) layoutManager; layout.setHfill ( hfill ); layout.setVfill ( vfill ); } // Updating popup layer setBounds ( new Rectangle ( 0, 0, getParent ().getWidth (), getParent ().getHeight () ) ); // Adding popup removeAll (); add ( popup, SwingConstants.CENTER + AlignLayout.SEPARATOR + SwingConstants.CENTER, 0 ); setVisible ( true ); revalidate (); repaint (); } /** * Returns whether modal shade should be animated or not. * * @return true if modal shade should be animated, false otherwise */ public boolean isAnimate () { return animate; } /** * Sets whether modal shade should be animated or not. * * @param animate whether modal shade should be animated or not */ public void setAnimate ( final boolean animate ) { this.animate = animate; } /** * Returns whether popup close attemps should be blocked or not. * * @return true if popup close attemps should be blocked, false otherwise */ public boolean isBlockClose () { return blockClose; } /** * Sets whether popup close attemps should be blocked or not. * * @param blockClose whether popup close attemps should be blocked or not */ public void setBlockClose ( final boolean blockClose ) { this.blockClose = blockClose; } @Override public void paint ( final Graphics g ) { // todo Really bad workaround GraphicsUtils.setupAlphaComposite ( ( Graphics2D ) g, ( float ) opacity / 100, opacity < 100 ); super.paint ( g ); } @Override protected void paintComponent ( final Graphics g ) { super.paintComponent ( g ); final Graphics2D g2d = ( Graphics2D ) g; final Object old = GraphicsUtils.setupAntialias ( g2d ); final Composite comp = GraphicsUtils.setupAlphaComposite ( g2d, 0.8f ); g2d.setPaint ( Color.LIGHT_GRAY ); g2d.fillRect ( 0, 0, getWidth (), getHeight () ); GraphicsUtils.restoreComposite ( g2d, comp ); GraphicsUtils.restoreAntialias ( g2d, old ); } @Override public void setVisible ( final boolean visible ) { super.setVisible ( visible ); if ( visible ) { if ( animator != null ) { animator.stop (); } if ( animate ) { opacity = 0; animator = new WebTimer ( "ShadeLayer.fadeIn", StyleConstants.animationDelay, new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { if ( opacity < 100 ) { opacity += 25; ShadeLayer.this.repaint (); } else { animator.stop (); } } } ); animator.start (); } else { opacity = 100; ShadeLayer.this.repaint (); } } } /** * Returns whether the specified point is within bounds of this popup layer or not. * * @param x X coordinate * @param y Y coordinate * @return true if the specified point is within bounds of this popup layer, false otherwise */ @Override public boolean contains ( final int x, final int y ) { return normalContains ( x, y ); } }
[ "mgarin@alee.com" ]
mgarin@alee.com
261c7937bb1d344c4225b75982ad3819a79c713d
d0342efaecf0e8f41ff70f499c0d5ced3519b010
/Java OOP Exams/Java OOP Exam - 11 August 2019/src/viceCity/models/guns/BaseGun.java
78b5dcdbd3bd8edfa563850bbd8acc9bd3782605
[]
no_license
Whi7eW0lf/Exams-SoftUni
137f2bf7e48512e0034a85278b8d4b4590d23699
209fbc404993bf56f2b33b0ce7e01d708f3544b3
refs/heads/master
2020-06-25T13:38:14.658126
2019-12-15T22:10:59
2019-12-15T22:10:59
199,324,057
1
1
null
null
null
null
UTF-8
Java
false
false
1,982
java
package viceCity.models.guns; public abstract class BaseGun implements Gun { private static final String NULL_OR_EMPTY_EXCEPTION_MESSAGE = "Name cannot be null or whitespace!"; private static final String BULLETS_PER_BARREL_BELOW_ZERO_EXCEPTION_MESSAGE = "Bullets cannot be below zero!"; private static final String TOTAL_BULLETS_BELOW_ZERO_EXCEPTION_MESSAGE = "Total bullets cannot be below zero!"; private String name; private int bulletsPerBarrel; private int totalBullets; BaseGun(String name, int bulletsPerBarrel, int totalBullets) { setName(name); setBulletsPerBarrel(bulletsPerBarrel); setTotalBullets(totalBullets); } @Override public String getName() { return this.name; } @Override public int getBulletsPerBarrel() { return this.bulletsPerBarrel; } @Override public boolean canFire() { if (this.totalBullets == 0) { return bulletsPerBarrel != 0; } return true; } @Override public int getTotalBullets() { return this.totalBullets; } @Override public abstract int fire(); protected abstract void rechargeGun(); void setBulletsPerBarrel(int bulletsPerBarrel) { if (bulletsPerBarrel < 0) { throw new IllegalArgumentException(BULLETS_PER_BARREL_BELOW_ZERO_EXCEPTION_MESSAGE); } this.bulletsPerBarrel = bulletsPerBarrel; } void setTotalBullets(int totalBullets) { if (totalBullets < 0) { throw new IllegalArgumentException(TOTAL_BULLETS_BELOW_ZERO_EXCEPTION_MESSAGE); } this.totalBullets = totalBullets; } boolean barrelIsEmpty() { return this.bulletsPerBarrel == 0; } private void setName(String name) { if (name == null || name.trim().isEmpty()) { throw new NullPointerException(NULL_OR_EMPTY_EXCEPTION_MESSAGE); } this.name = name; } }
[ "slaveizlatarev@gmail.com" ]
slaveizlatarev@gmail.com
cf91d5020645c8757ea4f2b63d0a12d866ef5cea
80b9d2bac4320fc33bd6332150de1aacf65e9bc0
/app/src/main/java/com/example/yzwy/lprmag/view/TabIconView.java
c84cd421dd2f686960da8e6c73e3ab7309371a28
[]
no_license
sengeiou/YZWY-HikMag
377a7256eac4b7133a77ea537af78d3f6dc35432
2aa50bcc7174ae9cd6c07bb959ec042c49ca0566
refs/heads/master
2020-06-07T18:16:08.158390
2019-06-19T02:08:30
2019-06-19T02:08:30
193,070,106
0
1
null
2019-06-21T09:26:23
2019-06-21T09:26:22
null
UTF-8
Java
false
false
2,593
java
package com.example.yzwy.lprmag.view; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; import android.widget.ImageView; /** * <p>底部bar图标</p> * Created by Jarek(王健) 2016/3/10. */ public class TabIconView extends ImageView { /** 改变透明度 */ private Paint mPaint; /** focus下bitmap*/ private Bitmap mSelectedIcon; /** normal下bitmap*/ private Bitmap mNormalIcon; /** focus bitmap矩阵*/ private Rect mSelectedRect; /** normal bitmap矩阵*/ private Rect mNormalRect; /** 当前选择项(mSelectedIcon)透明度 * <p><b> mNormalIcon</b> 透明度即为 255 - mSelectedAlpha</p> */ private int mSelectedAlpha = 0; public TabIconView(Context context) { super(context); } public TabIconView(Context context, AttributeSet attrs) { super(context, attrs); } public TabIconView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } /** * 初始化资源图片bitmap及相关绘制对象 * @param normal normals * @param selected focus */ public final void init(int normal, int selected, int width, int height) { this.mNormalIcon = createBitmap(normal); this.mSelectedIcon = createBitmap(selected); this.mNormalRect = new Rect(0, 0, width, height); this.mSelectedRect = new Rect(0, 0, width, height); this.mPaint = new Paint(1); } private Bitmap createBitmap(int resId) { return BitmapFactory.decodeResource(getResources(), resId); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (this.mPaint == null) { return; } this.mPaint.setAlpha(255 - this.mSelectedAlpha); canvas.drawBitmap(this.mNormalIcon, null, this.mNormalRect, this.mPaint); this.mPaint.setAlpha(this.mSelectedAlpha); canvas.drawBitmap(this.mSelectedIcon, null, this.mSelectedRect, this.mPaint); } /** * 改变透明度值 * @param alpha 透明度 */ public final void changeSelectedAlpha(int alpha) { this.mSelectedAlpha = alpha; invalidate(); } /** * 改变透明度百分比 * @param offset 百分比 */ public final void offsetChanged(float offset) { changeSelectedAlpha((int) (255 * (1 - offset))); } }
[ "zhongchao6725@163.com" ]
zhongchao6725@163.com
51a6ecfb871a864838d734e303e8f0c444237d35
721c01fcd26048e046df7d83b58550511237b6ae
/src/boardgame/BoardException.java
e59840a08aba383cda38870040912a335cbe3b8e
[]
no_license
gabholanda/chess-game-java
55ef1d9c5dabec6cea1e78b7f975e9759c7b5ff6
affb1b2f7fcd9b5942b06c64a16cf469eb49f92b
refs/heads/master
2020-05-20T23:44:10.603346
2019-05-14T21:12:56
2019-05-14T21:12:56
185,809,613
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package boardgame; /** * * @author HOLANDAS */ public class BoardException extends RuntimeException { private static final long serialVersionUID = 1L; public BoardException(String msg){ super(msg); } }
[ "gabriel_ebot@hotmail.com" ]
gabriel_ebot@hotmail.com
6265809a16df8d80d591308a5d7e7157af4dbfc9
a1621e690167e6adf461cbfceb8e1c9b2f269e02
/src/main/java/org/una/tramites/repositories/ITipoTramiteRepository.java
8701afbd9912224ac4040d295b83f9c8f548b009
[]
no_license
RoberthFallas/tramitesWS
91c0ca2b5dbbdbc0bcab07b7dddf78636212f78b
2dd653decb793d23d52aa6be87953d0d77b6c2d8
refs/heads/master
2022-12-26T12:28:03.375737
2020-10-09T22:43:12
2020-10-09T22:43:12
291,831,066
0
0
null
2020-09-14T05:42:08
2020-08-31T21:43:43
Java
UTF-8
Java
false
false
625
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 org.una.tramites.repositories; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.una.tramites.entities.TramiteTipo; /** * * @author Roberth :) */ public interface ITipoTramiteRepository extends JpaRepository<TramiteTipo, Long> { public List<TramiteTipo> findByEstado(boolean estado); public List<TramiteTipo> findByDescripcion(String descripcion); }
[ "roberth123pz@gmail.com" ]
roberth123pz@gmail.com
8a8650e6e7e81beea533010f2ec4978a769b3644
90207ac52870dfa498a2d280a4adb3ea349825d5
/src/com/facebook/buck/java/JarDirectoryStep.java
1bc01ef64645b28d6e99c97ce3b1da54300435d4
[ "Apache-2.0" ]
permissive
KhalidElSayed/buck
cd31a5736cb04eb2395ee52e36dc88aebbd2db55
d1019cdd20ec6a4cd0f1351632cd662a57a26418
refs/heads/master
2021-01-18T06:00:02.516097
2013-08-22T17:44:35
2013-08-23T17:06:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,219
java
/* * Copyright 2012-present Facebook, 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 com.facebook.buck.java; import com.facebook.buck.event.BuckEventBus; import com.facebook.buck.event.LogEvent; import com.facebook.buck.step.ExecutionContext; import com.facebook.buck.step.Step; import com.facebook.buck.util.DirectoryTraversal; import com.facebook.buck.util.ProjectFilesystem; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.google.common.io.ByteStreams; import com.google.common.io.Closeables; import com.google.common.io.Closer; import com.google.common.io.Files; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.Map; import java.util.Set; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; import java.util.logging.Level; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import javax.annotation.Nullable; /** * Creates a JAR file from a collection of directories/ZIP/JAR files. */ public class JarDirectoryStep implements Step { /** Where to write the new JAR file. */ private final String pathToOutputFile; /** A collection of directories/ZIP/JAR files to include in the generated JAR file. */ private final ImmutableSet<String> entriesToJar; /** If specified, the Main-Class to list in the manifest of the generated JAR file. */ @Nullable private final String mainClass; /** If specified, the Manifest file to use for the generated JAR file. */ @Nullable private final String manifestFile; /** * Creates a JAR from the specified entries (most often, classpath entries). * <p> * If an entry is a directory, then its files are traversed and added to the generated JAR. * <p> * If an entry is a file, then it is assumed to be a ZIP/JAR file, and its entries will be read * and copied to the generated JAR. * @param pathToOutputFile The directory that contains this path must exist before this command is * executed. * @param entriesToJar Paths to directories/ZIP/JAR files. * @param mainClass If specified, the value for the Main-Class attribute in the manifest of the * generated JAR. * @param manifestFile If specified, the path to the manifest file to use with this JAR. */ public JarDirectoryStep(String pathToOutputFile, Set<String> entriesToJar, @Nullable String mainClass, @Nullable String manifestFile) { this.pathToOutputFile = Preconditions.checkNotNull(pathToOutputFile); this.entriesToJar = ImmutableSet.copyOf(entriesToJar); this.mainClass = mainClass; this.manifestFile = manifestFile; } private String getJarArgs() { String result = "cf"; if (manifestFile != null) { result += "m"; } return result; } @Override public String getShortName() { return "jar"; } @Override public String getDescription(ExecutionContext context) { return String.format("jar %s %s %s %s", getJarArgs(), pathToOutputFile, manifestFile != null ? manifestFile : "", Joiner.on(' ').join(entriesToJar)); } @Override public int execute(ExecutionContext context) { try { createJarFile(context); } catch (IOException e) { e.printStackTrace(context.getStdErr()); return 1; } return 0; } private void createJarFile(ExecutionContext context) throws IOException { Manifest manifest = new Manifest(); // Write the manifest, as appropriate. ProjectFilesystem filesystem = context.getProjectFilesystem(); if (manifestFile != null) { FileInputStream manifestStream = new FileInputStream( filesystem.getFileForRelativePath(manifestFile)); boolean readSuccessfully = false; try { manifest.read(manifestStream); readSuccessfully = true; } finally { Closeables.close(manifestStream, !readSuccessfully); } } else { manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); } try (JarOutputStream outputFile = new JarOutputStream( new BufferedOutputStream(new FileOutputStream( filesystem.getFileForRelativePath(pathToOutputFile))))) { Set<String> alreadyAddedEntries = Sets.newHashSet(); ProjectFilesystem projectFilesystem = context.getProjectFilesystem(); for (String entry : entriesToJar) { File file = projectFilesystem.getFileForRelativePath(entry); if (file.isFile()) { // Assume the file is a ZIP/JAR file. copyZipEntriesToJar(file, outputFile, manifest, alreadyAddedEntries, context.getBuckEventBus()); } else if (file.isDirectory()) { addFilesInDirectoryToJar(file, outputFile, alreadyAddedEntries, context.getBuckEventBus()); } else { throw new IllegalStateException("Must be a file or directory: " + file); } } // The process of merging the manifests means that existing entries are // overwritten. To ensure that our main_class is set as expected, we // write it here. if (mainClass != null) { manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, mainClass); } JarEntry manifestEntry = new JarEntry(JarFile.MANIFEST_NAME); outputFile.putNextEntry(manifestEntry); manifest.write(outputFile); } } /** * @param file is assumed to be a zip file. * @param jar is the file being written. * @param manifest that should get a copy of (@code jar}'s manifest entries. * @param alreadyAddedEntries is used to avoid duplicate entries. */ private void copyZipEntriesToJar(File file, final JarOutputStream jar, Manifest manifest, Set<String> alreadyAddedEntries, BuckEventBus eventBus) throws IOException { ZipFile zip = new ZipFile(file); for (Enumeration<? extends ZipEntry> entries = zip.entries(); entries.hasMoreElements(); ) { ZipEntry entry = entries.nextElement(); String entryName = entry.getName(); if (entryName.equals(JarFile.MANIFEST_NAME)) { Manifest readManifest = readManifest(zip, entry); merge(manifest, readManifest); continue; } // The same directory entry cannot be added more than once. if (!alreadyAddedEntries.add(entryName)) { // Duplicate entries. Skip. eventBus.post(LogEvent.create( Level.FINE, "Duplicate found when adding file to jar: %s", entryName)); continue; } jar.putNextEntry(entry); InputStream inputStream = zip.getInputStream(entry); ByteStreams.copy(inputStream, jar); jar.closeEntry(); } } private Manifest readManifest(ZipFile zip, ZipEntry manifestMfEntry) throws IOException { Closer closer = Closer.create(); ByteArrayOutputStream output = closer.register( new ByteArrayOutputStream((int) manifestMfEntry.getSize())); InputStream stream = closer.register(zip.getInputStream(manifestMfEntry)); try { ByteStreams.copy(stream, output); ByteArrayInputStream rawManifest = new ByteArrayInputStream(output.toByteArray()); return new Manifest(rawManifest); } finally { closer.close(); } } /** * @param directory that must not contain symlinks with loops. * @param jar is the file being written. */ private void addFilesInDirectoryToJar(File directory, final JarOutputStream jar, final Set<String> alreadyAddedEntries, final BuckEventBus eventBus) { new DirectoryTraversal(directory) { @Override public void visit(File file, String relativePath) { JarEntry entry = new JarEntry(relativePath); String entryName = entry.getName(); entry.setTime(file.lastModified()); try { if (alreadyAddedEntries.contains(entryName)) { eventBus.post(LogEvent.create( Level.FINE, "Duplicate found when adding directory to jar: %s", relativePath)); return; } jar.putNextEntry(entry); Files.copy(file, jar); jar.closeEntry(); if (entryName.endsWith("/")) { alreadyAddedEntries.add(entryName); } } catch (IOException e) { Throwables.propagate(e); } } }.traverse(); } /** * Merge entries from two Manifests together, with existing attributes being * overwritten. * * @param into The Manifest to modify. * @param from The Manifest to copy from. */ private void merge(Manifest into, Manifest from) { Preconditions.checkNotNull(into); Preconditions.checkNotNull(from); Attributes attributes = from.getMainAttributes(); if (attributes != null) { for (Map.Entry<Object, Object> attribute : attributes.entrySet()) { into.getMainAttributes().put(attribute.getKey(), attribute.getValue()); } } Map<String, Attributes> entries = from.getEntries(); if (entries != null) { for (Map.Entry<String, Attributes> entry : entries.entrySet()) { into.getEntries().put(entry.getKey(), entry.getValue()); } } } }
[ "mbolin@fb.com" ]
mbolin@fb.com
c81e154354e80eee4bd8cf19d27e77ce965450e5
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-wellarchitected/src/main/java/com/amazonaws/services/wellarchitected/model/QuestionMetric.java
a8ecf543e86e2bf46ba61a37f9114b4ee85fd43a
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
7,975
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. 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 com.amazonaws.services.wellarchitected.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * A metric for a particular question in the pillar. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/wellarchitected-2020-03-31/QuestionMetric" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class QuestionMetric implements Serializable, Cloneable, StructuredPojo { private String questionId; private String risk; /** * <p> * The best practices, or choices, that have been identified as contributing to risk in a question. * </p> */ private java.util.List<BestPractice> bestPractices; /** * @param questionId */ public void setQuestionId(String questionId) { this.questionId = questionId; } /** * @return */ public String getQuestionId() { return this.questionId; } /** * @param questionId * @return Returns a reference to this object so that method calls can be chained together. */ public QuestionMetric withQuestionId(String questionId) { setQuestionId(questionId); return this; } /** * @param risk * @see Risk */ public void setRisk(String risk) { this.risk = risk; } /** * @return * @see Risk */ public String getRisk() { return this.risk; } /** * @param risk * @return Returns a reference to this object so that method calls can be chained together. * @see Risk */ public QuestionMetric withRisk(String risk) { setRisk(risk); return this; } /** * @param risk * @return Returns a reference to this object so that method calls can be chained together. * @see Risk */ public QuestionMetric withRisk(Risk risk) { this.risk = risk.toString(); return this; } /** * <p> * The best practices, or choices, that have been identified as contributing to risk in a question. * </p> * * @return The best practices, or choices, that have been identified as contributing to risk in a question. */ public java.util.List<BestPractice> getBestPractices() { return bestPractices; } /** * <p> * The best practices, or choices, that have been identified as contributing to risk in a question. * </p> * * @param bestPractices * The best practices, or choices, that have been identified as contributing to risk in a question. */ public void setBestPractices(java.util.Collection<BestPractice> bestPractices) { if (bestPractices == null) { this.bestPractices = null; return; } this.bestPractices = new java.util.ArrayList<BestPractice>(bestPractices); } /** * <p> * The best practices, or choices, that have been identified as contributing to risk in a question. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setBestPractices(java.util.Collection)} or {@link #withBestPractices(java.util.Collection)} if you want * to override the existing values. * </p> * * @param bestPractices * The best practices, or choices, that have been identified as contributing to risk in a question. * @return Returns a reference to this object so that method calls can be chained together. */ public QuestionMetric withBestPractices(BestPractice... bestPractices) { if (this.bestPractices == null) { setBestPractices(new java.util.ArrayList<BestPractice>(bestPractices.length)); } for (BestPractice ele : bestPractices) { this.bestPractices.add(ele); } return this; } /** * <p> * The best practices, or choices, that have been identified as contributing to risk in a question. * </p> * * @param bestPractices * The best practices, or choices, that have been identified as contributing to risk in a question. * @return Returns a reference to this object so that method calls can be chained together. */ public QuestionMetric withBestPractices(java.util.Collection<BestPractice> bestPractices) { setBestPractices(bestPractices); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getQuestionId() != null) sb.append("QuestionId: ").append(getQuestionId()).append(","); if (getRisk() != null) sb.append("Risk: ").append(getRisk()).append(","); if (getBestPractices() != null) sb.append("BestPractices: ").append(getBestPractices()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof QuestionMetric == false) return false; QuestionMetric other = (QuestionMetric) obj; if (other.getQuestionId() == null ^ this.getQuestionId() == null) return false; if (other.getQuestionId() != null && other.getQuestionId().equals(this.getQuestionId()) == false) return false; if (other.getRisk() == null ^ this.getRisk() == null) return false; if (other.getRisk() != null && other.getRisk().equals(this.getRisk()) == false) return false; if (other.getBestPractices() == null ^ this.getBestPractices() == null) return false; if (other.getBestPractices() != null && other.getBestPractices().equals(this.getBestPractices()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getQuestionId() == null) ? 0 : getQuestionId().hashCode()); hashCode = prime * hashCode + ((getRisk() == null) ? 0 : getRisk().hashCode()); hashCode = prime * hashCode + ((getBestPractices() == null) ? 0 : getBestPractices().hashCode()); return hashCode; } @Override public QuestionMetric clone() { try { return (QuestionMetric) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.wellarchitected.model.transform.QuestionMetricMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
847f5771b0669c412062034ba8ba5218303853a8
3557d59cbc6808a7d651bba238c8931e274575aa
/src/amata1219/parkour/hat/Hats.java
1f4d38063204d706d1c02e8c0f080b4b463eda08
[]
no_license
csu-anzai/Parkour
d48197b720c33a7f2a31352a6a815f35bc9fe23e
b69cfab384202b94d27432e01a618b64fd1f07f6
refs/heads/master
2020-07-18T21:45:06.833004
2019-09-03T11:52:48
2019-09-03T11:52:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,353
java
package amata1219.parkour.hat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import amata1219.parkour.item.SkullCreator; public class Hats { public final static List<Hat> HATS = new ArrayList<>(37); static{ initialize( "0,1000000,ledlaggazi,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzI3MjMsInByb2ZpbGVJZCI6IjU4YmVjYzQ0YzViNzQyMGY4ODAwMTViYTg4ODIwOTczIiwicHJvZmlsZU5hbWUiOiJsZWRsYWdnYXppIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzFhMDBlYjBjOWQ2MTAwZjcwNDlkMDA3OWJiYzI5ZmJkMWM2M2IwMTlkYmViNGRjOGMxMTcyZmE5NDk4OTY2ODQiLCJtZXRhZGF0YSI6eyJtb2RlbCI6InNsaW0ifX19fQ==", "1,500000,YukiLeafX,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzMyMDYsInByb2ZpbGVJZCI6IjgyNjY5ZjExZjFlNTQwMmM5NjQyNzVhZmY4YTQ3NjEzIiwicHJvZmlsZU5hbWUiOiJZdWtpTGVhZlgiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjY0N2M2ZDM5OWRhOGIyYzhjOWY1OTQyZWY5MWIxMGNkY2I2ZWJmYzk3MTYxYzQzNGM2MGYxZWQwMTEzOGViOSJ9fX0=", "2,500000,siloneco,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzM0MzAsInByb2ZpbGVJZCI6IjdkYWYyMWU3YjI3NTQzZGRiYzBkNDc2MmM3M2Q2MTk5IiwicHJvZmlsZU5hbWUiOiJzaWxvbmVjbyIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iZDRhZGRjYzIzMDg2MjRjMjUyZWM2ZTE2NWFjNGI5NzE3ODRmOTc2YTcxNTM1ZjU0NmQyNDczMTJlOTljMDUwIn19fQ==", "3,500000,Mori01231,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzM5NjYsInByb2ZpbGVJZCI6IjRlZGViYTZiMGYzMjQzODM5ZTc0NWU3OTg4YTdjZjdlIiwicHJvZmlsZU5hbWUiOiJNb3JpMDEyMzEiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjYxMWJiMDY4OTdlMmRhYTI5ODBmMjA3ZmRlMTU2N2E5ZGJhNTBmNzUyNTA3NTg5NmQzNmE3Y2IwNDI1MjAwZiJ9fX0=", "4,500000,amata1219,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzQxODMsInByb2ZpbGVJZCI6IjU0ZTRkZDU1ZmQzZjQ2ZDQ4ZWY5ZmYzYjY5NTdlM2IwIiwicHJvZmlsZU5hbWUiOiJhbWF0YTEyMTkiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTYxZTdlODg2YWQwYjc4OWU2ZjRmODMwMDM0YWI5YzdmMGE5NmUzMmVmMmM1YTIzMWZhMGFjYzk3NjM0NTczNyJ9fX0=", "5,500000,Mizinkobusters,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzQ0MDIsInByb2ZpbGVJZCI6ImFhODFiM2E2ZGNlODRiMWM5OWQ1MTY0NjMyZGQ0ZGEzIiwicHJvZmlsZU5hbWUiOiJNaXppbmtvYnVzdGVycyIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS85MjViNmZjYzY5MmI0NDcyZTM5NGYwMjE2ZjQ1OTIyMTRhZTg4MjllNjIxOTk5OWM1MmQzMmQ4Njc2ZTViNTcifX19", "6,500000,Bounen057,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzQ2MTQsInByb2ZpbGVJZCI6Ijg0YTA4OTgwMWY5YjRjZjc5OGExODM5NTkyODM0ZDRkIiwicHJvZmlsZU5hbWUiOiJCb3VuZW4wNTciLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGZlOTM1MGYyZWNjMTM2ZmQ5MDYwMjY1NzcwODBlOGQwM2E2NmE0MjRhZWM5YTc5MmQ5ZDk4ZjFlODM1NjhiYSIsIm1ldGFkYXRhIjp7Im1vZGVsIjoic2xpbSJ9fX19", "7,300000,Ad_mira,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzQ4MjYsInByb2ZpbGVJZCI6IjE5OTc5OGFkMjk2NjQ3YmE5MzJkYzBhNzM1MTQ0Y2YxIiwicHJvZmlsZU5hbWUiOiJBZF9taXJhIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzZlNzc3NTdjNDM5Y2VkMjY4OGE3OTczYjVlNjZhZTk2NDJmNzEwOWQ4ZWZlNzY4MTUwZmI1Mzc1MmQ3ZjJhMmUiLCJtZXRhZGF0YSI6eyJtb2RlbCI6InNsaW0ifX19fQ==", "8,300000,SC_Yazuki,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzUwNDIsInByb2ZpbGVJZCI6IjgzNmRhMTY1MjUzYTQ4YzE4Yzk0MTVlYzQyY2EzYTFhIiwicHJvZmlsZU5hbWUiOiJTQ19ZYXp1a2kiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2NlYTEwMzk2Njk0NDkxMjJjZjM2NWY5MDA3YTVkZWVhYjZlNDhhZGVhNmFiZmNkYTdkZGYyY2EwYmJmN2ZlOSJ9fX0=", "9,300000,Akiakibird_japan,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzUyNjIsInByb2ZpbGVJZCI6ImI1MjFlOTlkZTIyOTQzOTA4YzIxYWU4ODNhODNjMTYzIiwicHJvZmlsZU5hbWUiOiJBa2lha2liaXJkX2phcGFuIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QyZDliYjFjNzdjNGU1NjU4MWU0YzQ5MDU3NWJhNDYzMTQ1MTUxMWNhZTdmMGY4ZWE5ZmU2NmZhNzNlNzQyYTIifX19", "10,150000,p_maikura,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzU0OTksInByb2ZpbGVJZCI6ImRlYWU1OThjZDNmODQ0MjE5NTI4MWQwYmNiNzJkNTk5IiwicHJvZmlsZU5hbWUiOiJwX21haWt1cmEiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjNlMGI4YWEwNjY1MGY1MjEyNGVkYmViOTE0Y2U2MDNhNzViZmY5ZGZlZDQ1NTBiMTdkZjlkNWNhNGIzOGQ4MyIsIm1ldGFkYXRhIjp7Im1vZGVsIjoic2xpbSJ9fX19", "11,150000,_Z_soda__,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzU3MjEsInByb2ZpbGVJZCI6ImRlNjg3MTdhN2FhMTRhNGFiMTUwY2M1NWI2ODZhYzQ0IiwicHJvZmlsZU5hbWUiOiJfWl9zb2RhX18iLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTk4NTcyZmVkMTE0MGU0ZjQ3MWMwYzdiYzU0YjViZDlmNTVlMTdiMDJhOTY0OTJiNWVhNzc4ZmVmOThkOThiZiJ9fX0=", "12,100000,NR_3,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzU5NDcsInByb2ZpbGVJZCI6ImJmYjQ5ODJlMDJiODQyZWRiN2Y5NTlmMTUzMWQ5ODNjIiwicHJvZmlsZU5hbWUiOiJOUl8zIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2ZkMWU2NzhhYTRmNDU3ZWMyYzU1NzYyNTY3ZjI2M2FhMDM4ZWY1NGVmYWFlZWJmOTYwOWI0NThiYTZkM2I5N2QifX19", "13,100000,papiyonnn,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzYxNjYsInByb2ZpbGVJZCI6IjU5NTM1MWFjNzYxODQ2NzE5MjFkYTBjM2MzM2JiZjkwIiwicHJvZmlsZU5hbWUiOiJwYXBpeW9ubm4iLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWFkYzNhMzlmNmYxYTk0ZTlkMTlkYTgxNWY5NWNiMjRlNjVlMjUwNWQyYzcxM2RhMjFlMTFmYzliNmRmOTA5MSIsIm1ldGFkYXRhIjp7Im1vZGVsIjoic2xpbSJ9fX19", "14,100000,Dall0125,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzYzOTQsInByb2ZpbGVJZCI6IjQ5ZmZhYmQ0MGI5ZDQ1NWNiY2MxNjIxYzg4MGVmZmY5IiwicHJvZmlsZU5hbWUiOiJEYWxsMDEyNSIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS83M2MxMWYxNDhiYTg2YTdlMzZjNzZhZjAwNzU2Zjk1MGYyOGIzNjYxOTMyZDg2ZjMxZGU3ZTA2Y2QwMDM5ZmRiIn19fQ==", "15,100000,BlackAlice1694,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzY2MjYsInByb2ZpbGVJZCI6ImQxNWU0ZTgyMmEwNzQ0NzI5MmRhYWEwMTAwMjBkMjA5IiwicHJvZmlsZU5hbWUiOiJCbGFja0FsaWNlMTY5NCIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zNzMyYjhhMTQyZDFkODY3YjRmNTYxM2M3ZTkxNjFiNmM4YTM5MDc0OWFlOWQxYTBmOTNmNDAzNjNhZDRkZDMxIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "16,100000,P0_KI,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzY4NDgsInByb2ZpbGVJZCI6IjY0YzBkNzFlNTMwNzRmZGM4ODZiNmM3NjNlYTBjNzc1IiwicHJvZmlsZU5hbWUiOiJQMF9LSSIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81YjZiMmIyOTU5Njk5ZTVmNzQzNTUyZTIzYmRhMWE5NDNkMGNiYTMyNGEyMGYyM2NkYTFjZjRjMDUyNjgxYTlkIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "17,100000,Sasterisk24,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzcwNjgsInByb2ZpbGVJZCI6ImE2MWY3MDE3Zjc4MDRhNmM4YjBjNDYxYmQxMjYwMmZjIiwicHJvZmlsZU5hbWUiOiJTYXN0ZXJpc2syNCIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8yNTQyYWQ3YzkxM2Q1ZGE0YTFkZjcwZjI3MmViZThkM2IzNGNlOWVlZTliYTNhMzQ3NjY5NjY3YmE1OTA1ZDUwIn19fQ==", "18,100000,taiki7,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzcyOTYsInByb2ZpbGVJZCI6ImRiZTFhYzFlZTI1OTRiYmRhZTFlZWViY2M5YzE5Y2MwIiwicHJvZmlsZU5hbWUiOiJ0YWlraTciLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDQ5MjU5ZTNlOTVlMjlhZjg1YjliZWZhMTU2NmVhYTU5NzQzM2FmNjJiMzk2OWY2OTMzNWFkZWIyMzU3N2I1ZSJ9fX0=", "19,100000,iThank,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3Mzc1MTksInByb2ZpbGVJZCI6IjBjN2Y0MmZiNGE4YTQ2NmQ5ZjFlM2FjZjFhNDU1OGIzIiwicHJvZmlsZU5hbWUiOiJBamlfZmlzaCIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hMDc2NmI2Njg1MzQ3OWQ0MmNlMDNiZTA3NGVjZGMzNjc0MmIzOTM2ZTc3ZGQyOWU4MDI4OTk3YjZlMjNjZDAzIn19fQ==", "20,100000,Suppp4,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzgyODYsInByb2ZpbGVJZCI6IjM4YzVkMzVjOGJiMTQ2YTFhOWU3M2UzZTYxNTgyZTIxIiwicHJvZmlsZU5hbWUiOiJTdXBwcDQiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODBiYWYyMjA3YWUxODcyMTVkMDE5YzI4MWQ0MDgyMzgxYzQ4Yjg5NzIxMTRmZTIxODI2NTI2MzJkYWYyMGQ1ZiJ9fX0=", "21,100000,ard_Riri,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3Mzg1MDksInByb2ZpbGVJZCI6IjUxNmFkMWQzNmNkNDQ3ZjA4ZmM3YTg5YzA5ZjI2ZjVhIiwicHJvZmlsZU5hbWUiOiJhcmRfUmlyaSIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS85YTg2YjgyMWZiY2YxYmYwMjBhY2M4MzliYmFiOTU4ZmI4YzUzMWMwMTI3OWQ2MDk3NDM3OGI2MWQ5ZjRhZmMxIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "22,100000,kyoujyu88,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3Mzg3MzIsInByb2ZpbGVJZCI6IjRjMTcxZGNlZTZkZDRiMTFhNDZjOTczOWEyMThhMjdmIiwicHJvZmlsZU5hbWUiOiJreW91anl1ODgiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWZjMmMxZDhlNGZhY2RmODY1MmU1ZGEwMDg0ZjRiZGExNTQwOTA0YWM1ZjUxYWI0NTE5MzMyNmY0ODk5MjgwZCIsIm1ldGFkYXRhIjp7Im1vZGVsIjoic2xpbSJ9fX19", "23,100000,red_akairo,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3Mzg5NzUsInByb2ZpbGVJZCI6ImYzNzU1NTBlZWI0NDQ2NzM5ZTljYTViYjM2ODEwYTk1IiwicHJvZmlsZU5hbWUiOiJyZWRfYWthaXJvIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzNiNTU5NDk2ZjljY2NiYmYyZTQwZWRmYTkyMDFhMWFiOGNkZTEzZWQ4ZGYzZjU4ZjYxOTBlMzY5YWE5YTc2OTkiLCJtZXRhZGF0YSI6eyJtb2RlbCI6InNsaW0ifX19fQ==", "24,100000,yugomegane,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3MzkxOTksInByb2ZpbGVJZCI6Ijk0ZmNhYWQyYjY4YTQ3NzlhM2M4YjIyMTkzZDVmM2E3IiwicHJvZmlsZU5hbWUiOiJ5dWdvbWVnYW5lIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2U2Mjc3NjE2NzAxYjQzMjA4ZDViMmI2NjkxYzk2OWZiYTlhNGMwYzNlMzEwMWZiZjQwN2Y1YmIyNDA2Y2RkZGUifX19", "25,100000,FlowSounds,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3Mzk0MTcsInByb2ZpbGVJZCI6ImMwOGQ3ZTk5NDkxMjQ3ZWE5YzY2MzI2ZjhkYWNmMmE1IiwicHJvZmlsZU5hbWUiOiJGbG93U291bmRzIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzdjYTQ4ZmZlN2M5NzllZWYzMjNhMzEyM2M0NmZlNDE0MTFkZTdiNWQyOWVlNzY1YWU4MmRhYmU0NzMzOTBkMTIiLCJtZXRhZGF0YSI6eyJtb2RlbCI6InNsaW0ifX19fQ==", "26,100000,Ayaka_1031,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3Mzk2NDcsInByb2ZpbGVJZCI6IjU2M2NjZmM1NmJhYzQ4ZTE5MTdiZGFjYWM3MDliMDkzIiwicHJvZmlsZU5hbWUiOiJBeWFrYV8xMDMxIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2UzZjk4YWZlNjg4ZTZmZDRiYzE3NTBmYmEzNzlhZmNiZGFkZGZlODQ0NzEwN2ZiZDEwMzUzNTEyZjhhZTViZGUifX19", "27,100000,_regretDees_,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3Mzk4NTgsInByb2ZpbGVJZCI6ImIzOGVkYTk5MzNlMDRiZWViZDY1MDBlNGIxZGM1YTFkIiwicHJvZmlsZU5hbWUiOiJyZWdyZXRfRGVlc18iLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTgwOGFhZTJhMmM0NGMzOTczODUyMTE1N2RiNWQxNmZiMTc4ZGJkMTlhYzZiOWVhYzY0YjhjOTAwNGJjYzFkNyIsIm1ldGFkYXRhIjp7Im1vZGVsIjoic2xpbSJ9fX19", "28,100000,toufu_toufu,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3NDAwNzMsInByb2ZpbGVJZCI6IjZlNzczZTVlYjkxNDQxZDdiNmI5MmJlYWI3YjA2NDZlIiwicHJvZmlsZU5hbWUiOiJ0b3VmdV90b3VmdSIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81N2RlMzc2MTYwNWNkYWQ5ZDQ2NjY0MDNkNjA4YmQ2ZjcwYmEyNjIwODEyZDRiMmNjMjE1ZDJmOTFkZDQ1Zjc0IiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "39,100000,SAPONIN9000,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3NDAyODYsInByb2ZpbGVJZCI6ImI5NjdiOWRlOGFjODRmMTdhYWRmOGNlMzllOGI5OWZiIiwicHJvZmlsZU5hbWUiOiJTQVBPTklOOTAwMCIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9mY2FhZjA1ZjVmMmVmY2JjYTkwMTA5NzUwYTI3ODdhOGMwZDYzMzVkMWE0YWMzNGYzMmFlOTk2NjEzMjI0MzBjIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "40,100000,mi_0711,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3NDA1MDMsInByb2ZpbGVJZCI6IjA1ZTlmYjA4OGUwYjRkYWRiNjExYWUxMzYyNWIwNTFmIiwicHJvZmlsZU5hbWUiOiJtaV8wNzExIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzdhNTJhMTk2YzkxYzUyNjA5OThkZDU2NWM2ZmY3Mjc5MGQ4YTZmODA4MjM0ZGRlZGI3Y2ViMDQ2YjkzZDk2MDkiLCJtZXRhZGF0YSI6eyJtb2RlbCI6InNsaW0ifX19fQ==", "41,100000,Uekibachi,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3NDA3MTksInByb2ZpbGVJZCI6IjA2ZTliMzRkNmZiMzRkMzRiYTA1ZjJiMjU4Zjc1YjUwIiwicHJvZmlsZU5hbWUiOiJVZWtpYmFjaGkiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzBmODYwMWJhYTAwYjA1YTJiOWYzZWQ1M2EwNDdkNjRhNWQxMzg5OTcyY2IzMWIyM2E1YWY0M2VlZmQ0NDhiMiJ9fX0=", "42,100000,KUCHITSU,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3NDA5MzUsInByb2ZpbGVJZCI6IjViMjIxMTQyZTc5NTRmZTU4NDMyOTEzNDUwYzQyMmE2IiwicHJvZmlsZU5hbWUiOiJLVUNISVRTVSIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9kZTc5YjY4N2I5ZDBlOWE3YWMxMzBjYjhkZmJkNmE1NWI3N2E4ZWE0Yzk4YWY0ZDBlYWRjMDg3NGRjNTg4NDViIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "43,100000,Tomoya,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3NDExNDcsInByb2ZpbGVJZCI6IjgxNjI0YjI0OGZkMTQ0NTNhMzg2ZjliZTM1MTY1YjUxIiwicHJvZmlsZU5hbWUiOiJUb21veWEiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmU3ZGUyNDllMzM0OTQ3NDZlZjk1OTczODI3OWE2ZTYyZmRkM2Y5NWU3YzM2NzIzMzU2ZGI4ZWUxYzZhYTdlIn19fQ==", "44,100000,JapanALL,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3NDEzNjksInByb2ZpbGVJZCI6IjE1Y2EzMTBkNzUwYjQ2NmJiYTJhZTM4YWQ5NmEyNjZmIiwicHJvZmlsZU5hbWUiOiJKYXBhbkFsbCIsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iNTQ4OWIzNTE0ZDZlZDVkMjE1MzRmNWM5YmE4ZGEzZDZmMTEzN2MwNjU3OGMxZjBkN2FhNTVlYjRmYzc3YTczIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "45,100000,mikage255,eyJ0aW1lc3RhbXAiOjE1NjU4MzM3NDE1OTUsInByb2ZpbGVJZCI6ImRiMmU5YTU1YzJmNjRmZjY4NzhiYWFmYWYwMzExYWM5IiwicHJvZmlsZU5hbWUiOiJtaWthZ2UyNTUiLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjhkYjYzYjc5YjYxMThmNjc4MGRmY2QwNGI4MzMzM2E2NjM3MjYyYWE3ZTM2ZjFmODZiZjY0MzlkNDU0Y2RiZCJ9fX0=" ); } private static void initialize(String... texts){ Arrays.stream(texts) .map(text -> text.split(",")) .map(data -> new Hat(Integer.parseInt(data[0]), Integer.parseInt(data[1]), data[2], SkullCreator.fromBase64(data[3]))) .forEach(HATS::add); } }
[ "suzukiamata@gmail.com" ]
suzukiamata@gmail.com
cd63b50be592e83a60a94ab71f8455c835ef51fb
8d5d93f82b7c9c3b0bac298ea6445a4121e447cb
/Documents/NetBeansProjects/Liam/src/Areas/RectangleArea.java
9c50012a9c832bc3d6e26c8f4f251c15b69f7c4b
[]
no_license
liamh17/Liam
6e9f6e13f56c9ad92cb6e7cddc9855b810223c25
3cae0e9caaa55fa6293b804c60300b489d7961f8
refs/heads/master
2020-04-06T06:47:39.805601
2014-11-03T20:08:58
2014-11-03T20:08:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
665
java
package Areas; import java.util.Scanner; public class RectangleArea { static Scanner sc = new Scanner(System.in); public static void main(String args[]) { double w; double l; System.out.println("Enter the width: "); w = sc.nextDouble(); System.out.println("Enter the height: "); l = sc.nextDouble(); double Area = w * l; System.out.println("The area of your rectangle is: " + Area); System.out.println("What is your name?: "); System.out.println("Hello " + sc.next()); } }
[ "liamheisler@gmail.com" ]
liamheisler@gmail.com
d5a1eb6576f91a67a60d024f245b212446c1b374
99b1c8f4afc63718201a3ede8fe13bcd514ea72c
/src/test/java/app/page/StockPage.java
251b9ff79b713db58706bfd3df9a840ed609b319
[]
no_license
believeyinuo/JavaAutoTest
0f170c4c59cd339250267dc80ba82e00996118da
a7dd2c856dfc351961b654adfaf5e43fcd33ec3c
refs/heads/master
2021-01-27T10:47:57.130472
2020-03-20T10:15:11
2020-03-20T10:15:11
243,222,175
0
0
null
null
null
null
UTF-8
Java
false
false
1,262
java
package app.page; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.ArrayList; import java.util.List; public class StockPage extends BasePage { public StockPage deleteAll(){ // click(By.id("com.xueqiu.android:id/edit_group")); // click(By.id("com.xueqiu.android:id/check_all")); // click(By.id("com.xueqiu.android:id/cancel_follow")); // click(By.id("com.xueqiu.android:id/md_buttonDefaultPositive")); // click(By.id("com.xueqiu.android:id/action_close")); parseSteps("deleteAll"); return this; } public List<String> getAllStocks(){ handleAlert(); List<String> stocks = new ArrayList<>(); findElements(By.id("com.xueqiu.android:id/portfolio_stockName")).forEach(element-> { stocks.add(element.getText()); }); System.out.println(stocks); return stocks; } public StockPage addDefaultSelectedStocks() { click(By.id("com.xueqiu.android:id/add_to_portfolio_stock")); return this; } public SearchPage toSearch(){ click(By.id("com.xueqiu.android:id/action_search")); return new SearchPage(); } }
[ "lqc@xsdsport.com" ]
lqc@xsdsport.com
2413a5cb8c5721e23830fa4667a96cb0f295d6e7
0b98c79363750ba65c3b7b3b660e53964a04f6ef
/src/test/java/recap/AmazonMenu.java
095e1707ebd59799b08e8060b8cc68ed9ef646ff
[]
no_license
ErmekZ/Practice
33af4d3da6e2675f5bbe1711d63209421e29aa27
03568989a7e46a7527770567481877317a516584
refs/heads/master
2020-05-15T09:13:30.439829
2019-04-19T00:46:52
2019-04-19T00:46:52
182,173,186
0
0
null
2019-04-19T00:46:53
2019-04-19T00:03:06
Java
UTF-8
Java
false
false
1,927
java
package recap; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.testng.annotations.Ignore; import org.testng.annotations.Test; import utilities.TestBase; public class AmazonMenu extends TestBase { @Ignore @Test public void amazonTitle() throws InterruptedException { driver.get("http://amazon.com"); Actions action = new Actions(driver); WebElement nav = driver.findElement(By.id("icp-nav-flyout")); action.moveToElement(nav).perform(); Thread.sleep(10000); } @Ignore @Test public void doubleClick() throws InterruptedException { driver.get("https://www.primefaces.org/showcase/ui/misc/effect.xhtml"); Actions action = new Actions(driver); WebElement dc = driver.findElement(By.id("fold_header")); action.moveToElement(dc).perform(); Thread.sleep(3000); WebElement footer = driver.findElement(By.className("footer-info-left")); action.moveToElement(footer).perform(); } @Ignore @Test public void dragAndDrop() throws InterruptedException { driver.get("https://demos.telerik.com/kendo-ui/dragdrop/index"); Actions action = new Actions(driver); WebElement drag = driver.findElement(By.id("draggable")); WebElement drop = driver.findElement(By .id("droptarget")); // action.dragAndDrop(drag,drop).perform(); action.clickAndHold(drag).moveToElement((drop)).perform(); Thread.sleep(3000); } @Test public void upload() throws InterruptedException { driver.get("http://the-internet.herokuapp.com/upload"); WebElement upload = driver.findElement(By.id("file-upload")); upload.sendKeys("C:\\Users\\eliza\\Desktop\\download.jpg"); Thread.sleep(5000); driver.findElement(By.id("file-submit")).click(); Thread.sleep(10000); } }
[ "aminzamirov@gmail.com" ]
aminzamirov@gmail.com
42c9246b6aadd19412d7c7bba3afb8e3608709c5
429bee7bf9801cb82daddb8f99a7572582f85706
/src/main/java/firstUniqueCharacterinAString/Test.java
069f1616091a28c4d59af1e059a66e2458c13c3c
[]
no_license
Ral-Zhao/leetcode
113b0a0a344c6efbff3288ec506281f3c9276ce3
5d0a060b64888645f4e765ec89cb9031b71697ee
refs/heads/master
2022-06-26T04:50:55.596499
2020-09-03T08:14:40
2020-09-03T08:14:40
96,397,654
0
1
null
2022-06-17T02:50:56
2017-07-06T06:45:56
Java
UTF-8
Java
false
false
190
java
package firstUniqueCharacterinAString; public class Test { public static void main(String[] args) { Solution s = new Solution(); System.out.println(s.firstUniqChar("helloheo")); } }
[ "zhaozhezijian@jd.com" ]
zhaozhezijian@jd.com
498430b7f47afdc033d6c5fa5f827a861350d10a
2e91430dfcbaf4010716153ec3b0e4f1a7d0a71d
/core/src/main/java/com/springapp/mvc/repository/RoutesRepository.java
18c173a2d97b49933b038915c2b290f895899fb6
[]
no_license
adelzam/web-app
5554f5b08d1f02e38fb0a8d102b20d0e5dcad4ae
fff3f1a314004f4dfb6c65b9bf1d0f37982a1aeb
refs/heads/master
2020-12-24T20:33:13.810679
2016-06-07T12:01:17
2016-06-07T12:01:17
57,953,528
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package com.springapp.mvc.repository; import com.springapp.mvc.common.RouteInfo; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; public interface RoutesRepository extends JpaRepository<RouteInfo, Long> { RouteInfo findRouteInfoByArrivalIdAndDepartureId(Long arrival_id, Long departure_id); }
[ "adelzam1997@gmail.com" ]
adelzam1997@gmail.com
c8479f76978515a21b52d0fbe02b82ec14037322
b859e89389a428799cafebd9b59aa3e13f4ab14a
/src/main/java/com/pucrs/xtree/algorithm/Xtree.java
dbb746251a7c89317336f1ffa9f0fe0974f09f14
[]
no_license
idsouza/xtree
a37f9d0cf15dd9ec5b4a0ae125ec406911617d51
bbbee6686d987c4485e1f2e290f42d338a298534
refs/heads/master
2020-07-24T15:11:59.633571
2019-09-12T04:49:05
2019-09-12T04:49:05
207,964,593
0
0
null
null
null
null
UTF-8
Java
false
false
2,651
java
package com.pucrs.xtree.algorithm; import com.pucrs.xtree.models.Node; import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class Xtree { /** * Algorithm responsible for compute a xtree and convert * the expression in a tree structure. * * Exemple; * xtree: 2 1 0 2 50 10 1 1 0 3 39 51 87 79 32 * tree: * - (32) * - (50, 10) * - (79) * - (39, 51, 87) * * @param expressionParam xtree * @return tree structure * @author Igor Duarte - igorduarte.s@gmail.com */ public Node execute(String expressionParam) { var expression = Arrays.stream(expressionParam.split(" ")) .map(Integer::valueOf) .collect(Collectors.toList()); var n1 = Instant.now().getNano(); var m1 = Instant.now().toEpochMilli(); var node = compute(expression, 0); var nanoTime = Instant.now().getNano() - n1; var milliTime = Instant.now().toEpochMilli() - m1; System.out.println(String.format("Tempo de execução: %dus", nanoTime)); System.out.println(String.format("Tempo de execução: %dms", milliTime)); return node; } private Node compute(List<Integer> expression, int beginIndex) { var childrenSize = expression.get(beginIndex); var node = new Node(); node.setBeginIndex(beginIndex); if (childrenSize > 0) { computeChildren(node, expression, beginIndex + 2, childrenSize); computeElements(node, expression, node.getLastChild().getEndIndex() + 1); } else { computeElements(node, expression, beginIndex + 2); } return node; } private void computeChildren(Node node, List<Integer> expression, int beginIndex, int childrenSize) { for (int i = 0; i < childrenSize; i++) { var child = compute(expression, beginIndex); beginIndex = child.getEndIndex() + 1; node.getChildren().add(child); } } private void computeElements(Node node, List<Integer> expression, int beginIndex) { var elementsSize = expression.get(node.getBeginIndex() + 1); var elements = new ArrayList<Integer>(); var elementPosition = beginIndex; for (int i = 0; i < elementsSize; i++, elementPosition++) { elements.add(expression.get(elementPosition)); } node.setElements(elements); node.setEndIndex(elementPosition - 1); } }
[ "igorduarte.s@live.com" ]
igorduarte.s@live.com
174e5b3263537cff20dfc0b97020495fef687527
c0d9a4cd9be21141a10cf947007c2bef8876581d
/Labs/RequestSummary.java
511e5282ea161cef19e700a350a116d67a41d54e
[]
no_license
sguttula/Web-and-Internet-Programming
7cad35eb100a0ee369ed41a50f6779eb75b83ed7
f99e7f2fc0363a21b96ff914bb7a2fdab6f4ca91
refs/heads/master
2020-09-13T12:19:50.018079
2019-11-20T00:23:17
2019-11-20T00:23:17
222,776,223
0
0
null
null
null
null
UTF-8
Java
false
false
6,115
java
package Labs; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Date; import java.util.Enumeration; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import models.RequestParameterEntry; @WebServlet("/Labs/RequestSummary") public class RequestSummary extends HttpServlet { private static final long serialVersionUID = 1L; public RequestSummary() { super(); } public void init(ServletConfig config) throws ServletException { super.init(config); ArrayList<RequestParameterEntry> entriesParameters = new ArrayList<RequestParameterEntry>(); //entriesParameters.add(new RequestParameterEntry("John Doe", "Hello World!")); // entries.add(new RequestParameterEntry("Joe Boxer", "Howdy")); // entries.add(new RequestParameterEntry("MAry Jane", "Hi!")); // entries.add(new RequestParameterEntry("MAry Jane", "Yo!")); // getServletContext().setAttribute("entries", entriesParameters); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); // Get a Print Writer PrintWriter out = response.getWriter(); Date date = new Date(); ServletContext contextParameters = getServletContext(); ArrayList<RequestParameterEntry> parameterInfo = (ArrayList<RequestParameterEntry>) contextParameters.getAttribute("entries"); // Generate the template HTML out.println("<!DOCTYPE html>"); out.println("<html lang=\"en\">"); out.println("<head>"); out.println(" <meta charset=\"UTF-8\">"); out.println(" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"); out.println(" <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">"); out.println(" <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css\" integrity=\"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm\" crossorigin=\"anonymous\">"); //out.println(" <link rel=\"stylesheet\" href=\"../WebContent/request.css\">"); out.println(" <title>Request Parameters</title>"); out.println("</head>"); out.println("<body>"); out.println("<div class=\"container\">"); out.println("<div class=\"header\">"); out.println("<h1>Request Parameters <small>Lab 2</small></h1>"); out.println("<p>The following <code>" + request.getMethod() + "</code> request was submitted on <code>" + date.toString()); out.println("</div>"); out.println("<h1><small>Request Parameters</small></h1>"); out.println("<table class =\"table table-bordered table-striped table-hovered\">"); out.println("<th> Parameter Name </th>"); out.println("<th> Parameter Value </th>"); for(RequestParameterEntry entry1 : parameterInfo) { out.println("<thead>"); //out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); //out.println("<tr>"); out.println("<tr>"); out.println("<td>" + request.getParameterNames() + "</td>"); out.println("<td>" + entry1.getMessage() + "</td>"); // // // out.println(" <td>" + entry.getCreated() + "</td>"); // // out.println(" <td>"); // // out.println(" <a class=\"btn btn-primary\" href=\"EditEntry?id=" + entry.getId() + "\">Edit</a>"); // // out.println(" <a class=\"btn btn-primary\" href=\"DeleteEntry?id=" + entry.getId() + "\">Delete</a>"); // // out.println(" </td>"); // out.println("</tr>"); // out.println("</tbody>"); } Enumeration pNames = request.getParameterNames(); while(pNames.hasMoreElements()) { String pName = (String)pNames.nextElement(); out.print("<tr><td>" + pName + "</td>\n"); // String pValue = request.getParameter(pName); // out.println("<td> " + pValue + "</td></tr>\n"); out.println("<td> "); String[] para = request.getParameterValues(pName); for(int i = 0 ; i < para.length ; i++) { out.println(para[i] + "\n\n "); } out.println("</td></tr>\n"); } out.println("</table>"); //out.println("<a href=\"AddEntry\">Add Entry</a>"); ArrayList<RequestParameterEntry> entriesHeaders = new ArrayList<RequestParameterEntry>(); getServletContext().setAttribute("entries", entriesHeaders); ServletContext contextHeaders = getServletContext(); ArrayList<RequestParameterEntry> headerInfo = (ArrayList<RequestParameterEntry>) contextHeaders.getAttribute("entries"); out.println("<h1><small>Header Information</small></h1>"); out.println("<table class =\"table table-bordered table-striped table-hovered\">"); out.println("<th> Header Field </th>"); out.println("<th> Header Value </th>"); for(RequestParameterEntry entry2 : headerInfo) { // // out.println("<tr>"); out.println("<td>host</td>"); //out.println("<td>" + request.getRemoteHost().toString() + "</td>"); out.println("</tr>"); //out.println("<tr>"); out.println("<td>" + entry2.getName() + "</td>"); out.println("<td>" + entry2.getMessage() + "</td>"); // // } Enumeration headerNames = request.getHeaderNames(); while(headerNames.hasMoreElements()) { String paramName = (String)headerNames.nextElement(); out.print("<tr><td>" + paramName + "</td>\n"); // String paramValue = request.getHeader(paramName); // out.println("<td> " + paramValue + "</td></tr>\n"); out.println("<td> "); String paraHead = request.getHeader(paramName); //for(int i = 0 ; i < paraHead.length ; i++) { out.println(paraHead + "\n\n "); //} out.println("</td></tr>\n"); } out.println("</table>"); out.println("</div>"); out.println("</body>"); out.println("</html>"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "sidguttula@yahoo.com" ]
sidguttula@yahoo.com
f6e69547ba63a8a335d64610bec8dadab5636340
9b2e2ec3f57da270278b9c879d703d64d4d998da
/app/src/main/java/com/oropeza/utilidades/Preferencias.java
dfb17cf2d1ba54fd741a63f6fb5e8ad093e4157f
[]
no_license
yiyocas/ChatSafe
fd04d5ae74aafe4e4ab1ef5e8a00c5eed1de420e
c3cb4c0b0cb3ef61aaa0e2ab8b6fcb5baa56e538
refs/heads/master
2021-01-10T01:05:57.353180
2015-09-30T19:34:31
2015-09-30T19:34:31
43,453,989
0
0
null
null
null
null
UTF-8
Java
false
false
995
java
package com.oropeza.utilidades; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; /** * Created by yiyo on 09/09/15. */ public class Preferencias { private SharedPreferences prefs; private SharedPreferences.Editor editor; private Context contex; public Preferencias(Context context){ this.contex = context; prefs = PreferenceManager.getDefaultSharedPreferences(context); editor = prefs.edit(); } public String getID_DIVICE() { return prefs.getString("ID_DIVICE",""); } public void setID_DIVICE(String ID_DIVICE) { editor.putString("ID_DIVICE",ID_DIVICE); editor.commit(); } public boolean getID_DIVICE_Google() { return prefs.getBoolean("ID_DIVICE_GOOGLE",false); } public void setID_DIVICE_Google(boolean ID_DIVICE) { editor.putBoolean("ID_DIVICE_GOOGLE", ID_DIVICE); editor.commit(); } }
[ "yiyocas31@gmail.com" ]
yiyocas31@gmail.com
b65afd88b550dc17fd78501339ab0ebc14e37d55
2332f8d00375ea97f16be15aa8ec5a6043b091e6
/app/src/main/java/com/example/raghav/datauploader/AsyncHttpPost.java
bd0e2c6fe1d3a1155a5fb3255308df0ba77e76e7
[]
no_license
raghavs1108/datauploader
36ec31266e39fb9d47c5a42b6599c31f495f10bb
19e03c28b9756b5d4e0b8459e424004e46f1e7f5
refs/heads/master
2021-01-15T13:44:33.796147
2015-11-12T15:34:05
2015-11-12T15:34:05
41,755,430
0
0
null
null
null
null
UTF-8
Java
false
false
4,914
java
package com.example.raghav.datauploader; import android.app.ProgressDialog; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Environment; import android.util.Log; import android.widget.TextView; import com.example.raghav.datauploader.MainActivity; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; class AsyncHttpPost extends AsyncTask<String, Void, Void> { NetworkInfo net; File file = null; MainActivity uActivity; HttpURLConnection connection = null; DataOutputStream outputStream = null; DataInputStream inputStream = null; String folderPath; String arrayOfFiles[]; File root; File allFiles; String urlServer = "https://pothole-detector-server.herokuapp.com/"; //"http://192.168.0.104:8080/"; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 100*1024*1024; // 100 MB URL url; String filename = null; public AsyncHttpPost(String filename) { this.filename = filename; this.file = new File(filename); } @Override protected void onPreExecute() { Log.d(" UploadGpsData", "onPreRequest"); } @Override protected Void doInBackground(String... params) { Log.d(" UploadGpsData","doInBackground"); Log.d("File Name", filename); //File filename = new File(arrayOfFiles[i].toString()); try { url = new URL(urlServer); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { connection = (HttpURLConnection) url.openConnection(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); // Enable POST method try { connection.setRequestMethod("POST"); } catch (ProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } connection.setRequestProperty("Connection", "Keep-Alive"); connection.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary); try{ FileInputStream fileInputStream = new FileInputStream(filename); try { outputStream = new DataOutputStream( connection.getOutputStream() ); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } outputStream.writeBytes(twoHyphens + boundary + lineEnd); outputStream.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + filename +"\"" + lineEnd); outputStream.writeBytes(lineEnd); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; // Read file bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead > 0){ outputStream.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } outputStream.writeBytes(lineEnd); outputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); //int serverResponseCode = connection.getResponseCode(); //String serverResponseMessage = connection.getResponseMessage(); // Responses from the server (code and message) //serverResponseCode = connection.getResponseCode(); //serverResponseMessage = connection.getResponseMessage(); fileInputStream.close(); outputStream.flush(); outputStream.close(); Log.d("File Name", "closed the output stream."); } catch(Exception e){ e.printStackTrace(); } return null; } protected void onPostExecute(Void result) { Log.d(" UploadGpsData","onPost"); Log.d(" UploadGpsData", "upload acheived."); } }
[ "raghavs1108@gmail.com" ]
raghavs1108@gmail.com
150f6d71af983acd63318e372b13cd35f14994e7
866a45cedf197583aa4b174b583991f6b59ceaf5
/app/src/main/java/com/htmessage/yichatopen/activity/register/RegisterContract.java
6a7583606c4ea490ef5518dcbb6c7eb1c34976ad
[]
no_license
13802410684/IM_AMICO_ANDROIND
f3bb4d5364a3dff1cd9d9a48b9dda00b6865e987
a853a9a0b1c487534ea2d24b9ce27a50a7eecbdd
refs/heads/master
2020-04-14T17:06:02.180156
2019-01-03T13:17:56
2019-01-03T13:17:56
163,970,173
0
0
null
null
null
null
UTF-8
Java
false
false
1,099
java
package com.htmessage.yichatopen.activity.register; import android.app.Activity; import android.content.Intent; import com.htmessage.yichatopen.activity.BasePresenter; import com.htmessage.yichatopen.activity.BaseView; /** * Created by huangfangyi on 2017/6/23. * qq 84543217 */ public interface RegisterContract { public int PHOTO_REQUEST_TAKEPHOTO = 1;// 拍照 public int PHOTO_REQUEST_GALLERY = 2;// 从相册中选择 public int PHOTO_REQUEST_CUT = 3;// 结果 public interface View extends BaseView<Presenter>{ void showAvatar(String imagePath); void showDialog(); void cancelDialog(); void showPassword(); void hidePassword(); void enableButton(); void disableButton(); void showToast(int msgRes); String getOriginImagePath(); Activity getBaseActivity(); } public interface Presenter extends BasePresenter{ void registerInServer(String nickName,String mobile,String password); void result(int requsetCode, int resultCode, Intent intent); } }
[ "542569819@qq.com" ]
542569819@qq.com
4e7eb137a38eef3b9d384297d0db29a442d68bc7
b32efdcb7e54d8450b9d0c8e41e69c599d6883f3
/transaction-service/src/main/java/com/digitalbank/shan/transactionserver/constant/TransactionStatus.java
f11491d8d1b6affb294aadb7682df45fb389831b
[]
no_license
ShanmugamRaman/digital-banking
91fe2c22b0408dceab8cb416b445eb59af265793
b6532e2cdb5da6486641e499b5c3a397ecee69c0
refs/heads/master
2020-03-25T13:25:39.796464
2018-08-07T06:38:24
2018-08-07T06:38:24
143,824,182
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
package com.digitalbank.shan.transactionserver.constant; public enum TransactionStatus { CREATED, PROCESSING, COMPLETED }
[ "r.shanmugam4@gmail.com" ]
r.shanmugam4@gmail.com
a225243209b19c7c58bb046924f3925833356ec9
f95b2c0343990472cab4f4ae576dfa840b46106a
/PartTwo/StringHandling/src/com/courtney/MailList.java
d89fbb3982ad9dd273b0fd68924c1b7774c2f88e
[]
no_license
CourtneyBritney/JavaCompleteReference11
c5bb53260c7405d01ff269841fa55bc00991a8b8
19e21544e3cbb8b3b2e865955b85848111f99074
refs/heads/master
2023-02-16T00:36:51.094237
2021-01-02T17:07:29
2021-01-02T17:07:29
316,416,000
0
0
null
null
null
null
UTF-8
Java
false
false
682
java
package com.courtney; import java.util.LinkedList; class MailList { public static void main(String args[]) { LinkedList<Address> ml = new LinkedList<Address>(); // Add elements to the linked list. ml.add(new Address("J.W. West", "11 Oak Ave", "Urbana", "IL", "61801")); ml.add(new Address("Ralph Baker", "1142 Maple Lane", "Mahome", "IL", "61853")); ml.add(new Address("Tom Carlton", "867 Elm St", "Champaign", "IL", "61820")); // Display the mailing list. for(Address element : ml) System.out.println(element + "\n"); System.out.println(); } }
[ "courtney02alexander@gmail.com" ]
courtney02alexander@gmail.com
80251cbbb2ab18e7ee947f68021d6a656c2a2709
726090720f4cec56a6f75afb85ba1d7c7ee48e5c
/src/cn/ems/servlet/AdminUpdate.java
d52432615199f382f69ebbd9b06a91b694ec5331
[]
no_license
FangYunLong/ems
2ff4131f03f7a0265a957fc86cc7e4e36113822e
884c7f956dec31444678500754d1f5675b403432
refs/heads/master
2021-08-24T10:49:36.250567
2017-12-09T09:03:48
2017-12-09T09:03:48
113,655,771
1
0
null
null
null
null
UTF-8
Java
false
false
1,582
java
package cn.ems.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cn.ems.dao.impl.AdminDaoIpml; import cn.ems.domain.Admin; public class AdminUpdate extends HttpServlet { /** * */ private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); String username = request.getParameter("user"); String old_pass = request.getParameter("old_pass"); String new_pass = request.getParameter("new_pass"); List<Admin> oldpass = AdminDaoIpml.getAdminByUsername(username); if(old_pass.equals(oldpass.get(0).getPassword())){ Admin admin = new Admin(); admin.setUsername(username); admin.setPassword(new_pass); int result = AdminDaoIpml.UpdatePassword(admin); if(result == 1){ out.print("<script>"); out.print("alert('密码修改成功!');"); out.print("window.history.back(-1);"); out.print("</script>"); } }else { out.print("<script>"); out.print("alert('旧密码不正确?!');"); out.print("window.history.back(-1);"); out.print("</script>"); } } }
[ "724319952@qq.com" ]
724319952@qq.com
ce98b3ab325364463d7d289f93fd2c27593ca348
2302cb5a6a8c59e55848d62d772982c16748e16f
/students/soft1714080902431/app/src/main/java/edu/hzuapps/androidlabs/soft1714080902431/Soft1714080902431Activity.java
a1d22f5f0720fa9516224a866c02a7bcea22b4e4
[]
no_license
anceker/android-labs-2019
7ad34f8b6792ad509ada625beeadbfc220074679
ff5ab315cfe4198c2ac57b2218074ff37c5cb0f2
refs/heads/master
2020-05-04T08:13:58.060047
2019-04-21T06:39:34
2019-04-21T06:39:34
179,042,578
1
0
null
2019-04-02T09:20:58
2019-04-02T09:20:57
null
UTF-8
Java
false
false
2,247
java
package edu.hzuapps.androidlabs.soft1714080902431; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class Soft1714080902431Activity extends AppCompatActivity { private Button button1; private Button button2; //private ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_soft1714080902431); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Soft1714080902431Activity.this, MainActivity.class); startActivity(intent); } }); button2 = (Button) findViewById(R.id.button2); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Soft1714080902431Activity.this, Main2Activity.class); startActivity(intent); } }); /*imageView = (ImageView) findViewById(R.id.imageView); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Soft1714080902431Activity.this, MainActivity.class); startActivity(intent); } });*/ } }
[ "3132857267@qq.com" ]
3132857267@qq.com
c4f626f63dd5a4bfab6ee4542fb6159635c7cded
ec8bafdb5208444b9d3699667a3f6ef60d3ae649
/app/src/androidTest/java/com/atguigu/mytext/ExampleInstrumentedTest.java
dc6f82fe6fbfefa3972356ff10294528586de257
[]
no_license
huxuecheng/MyText
807de7ac96fdfee99681761b5b5776d59328d693
01ca59f0425fabf15a98477c75fdd23238e68667
refs/heads/master
2021-01-19T01:45:23.588914
2017-03-09T07:28:36
2017-03-09T07:28:36
84,395,242
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package com.atguigu.mytext; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.atguigu.mytext", appContext.getPackageName()); } }
[ "247249879@qq.com" ]
247249879@qq.com
935590c0e5e09bbb890b193ade28077c6e70121e
ab2f0881c5c03bfd164f720c6cf7b26a8b158410
/producer/src/main/java/com/wuym/rabbitmq/producer/ProducerApplication.java
be14d22989a14fb6aec540c9c722776871f38ebc
[]
no_license
wuym000/PracticeDemo
584f3640695a377e79ae2ee0efd114386c1985dc
f9801d5842a69560ca5f543eb713cc752a54bac4
refs/heads/master
2020-03-19T03:04:41.523442
2018-06-02T08:44:07
2018-06-02T08:44:07
135,692,570
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package com.wuym.rabbitmq.producer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ProducerApplication { public static void main(String[] args) { SpringApplication.run(ProducerApplication.class, args); } }
[ "wuyumeng@iairportcloud.com" ]
wuyumeng@iairportcloud.com
088c170f9a3fee75c9506b089923da0cb0c3a8fe
814bcdb7b0cc57c0ae52867f41443e6ed47027cb
/hibernate_1100_one2one_component/src/com/by/hibernate/Wife.java
8f5cd721aa1dd4ee9c2de978e0709d4c35659edf
[]
no_license
byOriental/MyProject
94ef63942faf277eb0b0d278f17e7b48a5a8fa10
1d4682b7847e3282e3ecea03a75b9485604b3d6f
refs/heads/master
2021-09-14T19:46:39.620710
2018-05-18T08:24:01
2018-05-18T08:24:01
115,535,252
0
0
null
null
null
null
GB18030
Java
false
false
448
java
package com.by.hibernate; /** * * @Title:Wife * @Description:组件component嵌入 * @author:Administrator * @date:2018年1月16日 下午3:17:38 */ public class Wife { private String wifeName; private int age; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getwifeName() { return wifeName; } public void setwifeName(String wifeName) { this.wifeName = wifeName; } }
[ "baichangling@126.com" ]
baichangling@126.com
29ba4749a8872b970ab7fd33f7fa3f8866d241ce
f203d2bb06ec3e2af9008fbe4bc938802b3b23c9
/hw02/src/main/java/ru/sberbank/homework/drozdov/Operations.java
8024c8fc99a27c44ce0fa6070530c1b7b72d0ad0
[]
no_license
DrozdikGleb/Homework
65e0e2e682c8eb37aa9c85329a5a642fea4258b7
7f1a238485ef43403cc6c6b094eb7cfe7e42d197
refs/heads/master
2021-05-03T13:53:32.910965
2018-05-28T20:01:22
2018-05-28T20:01:22
120,517,010
0
0
null
2018-05-28T20:01:23
2018-02-06T20:07:30
Java
UTF-8
Java
false
false
501
java
package ru.sberbank.homework.drozdov; /** * Created by Gleb on 14.02.2018 */ public abstract class Operations implements Expression { private Expression first; private Expression second; Operations(Expression first, Expression second){ this.first = first; this.second = second; } protected abstract double calculate(double first, double second); @Override public double evaluate() { return calculate(first.evaluate(),second.evaluate()); } }
[ "224989@niuitmo.ru" ]
224989@niuitmo.ru
523e779cd4d16d360cde56fe4aebfcc029f02173
f81b774e5306ac01d2c6c1289d9e01b5264aae70
/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchBarControl.java
3f505b5db5c77b4e792302266dddf1e04556f44a
[ "BSD-3-Clause" ]
permissive
waaberi/chromium
a4015160d8460233b33fe1304e8fd9960a3650a9
6549065bd785179608f7b8828da403f3ca5f7aab
refs/heads/master
2022-12-13T03:09:16.887475
2020-09-05T20:29:36
2020-09-05T20:29:36
293,153,821
1
1
BSD-3-Clause
2020-09-05T21:02:50
2020-09-05T21:02:49
null
UTF-8
Java
false
false
26,617
java
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.compositor.bottombar.contextualsearch; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.view.ViewGroup; import androidx.annotation.VisibleForTesting; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.R; import org.chromium.chrome.browser.compositor.animation.CompositorAnimator; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelAnimation; import org.chromium.chrome.browser.contextualsearch.QuickActionCategory; import org.chromium.chrome.browser.contextualsearch.ResolvedSearchTerm.CardTag; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.ui.base.LocalizationUtils; import org.chromium.ui.resources.dynamics.DynamicResourceLoader; /** * Controls the Search Bar in the Contextual Search Panel. */ public class ContextualSearchBarControl { /** Full opacity -- fully visible. */ private static final float FULL_OPACITY = 1.0f; /** Transparent opacity -- completely transparent (not visible). */ private static final float TRANSPARENT_OPACITY = 0.0f; /** * The panel used to get information about the panel layout. */ protected ContextualSearchPanel mContextualSearchPanel; /** * The {@link ContextualSearchContextControl} used to control the Search Context View. */ private final ContextualSearchContextControl mContextControl; /** * The {@link ContextualSearchTermControl} used to control the Search Term View. */ private final ContextualSearchTermControl mSearchTermControl; /** * The {@link ContextualSearchCaptionControl} used to control the Caption View. */ private final ContextualSearchCaptionControl mCaptionControl; /** * The {@link ContextualSearchQuickActionControl} used to control quick action behavior. */ private final ContextualSearchQuickActionControl mQuickActionControl; /** * The {@link ContextualSearchCardIconControl} used to control icons for non-action Cards * returned by the server. */ private final ContextualSearchCardIconControl mCardIconControl; /** The width of our icon, including padding, in pixels. */ private final float mPaddedIconWidthPx; /** * The {@link ContextualSearchImageControl} for the panel. */ private ContextualSearchImageControl mImageControl; /** * The opacity of the Bar's Search Context. * This text control may not be initialized until the opacity is set beyond 0. */ private float mSearchBarContextOpacity; /** * The opacity of the Bar's Search Term. * This text control may not be initialized until the opacity is set beyond 0. */ private float mSearchBarTermOpacity; // Dimensions used for laying out the search bar. private final float mTextLayerMinHeight; private final float mTermCaptionSpacing; /** * The visibility percentage for the divider line ranging from 0.f to 1.f. */ private float mDividerLineVisibilityPercentage; /** * The width of the divider line in px. */ private final float mDividerLineWidth; /** * The height of the divider line in px. */ private final float mDividerLineHeight; /** * The divider line color. */ private final int mDividerLineColor; /** * The width of the end button in px. */ private final float mEndButtonWidth; /** * The percentage the panel is expanded. 1.f is fully expanded and 0.f is peeked. */ private float mExpandedPercent; /** * Converts dp dimensions to pixels. */ private final float mDpToPx; /** * Whether the panel contents can be promoted to a new tab. */ private final boolean mCanPromoteToNewTab; /** The animator that controls the text opacity. */ private CompositorAnimator mTextOpacityAnimation; /** The animator that controls the divider line visibility. */ private CompositorAnimator mDividerLineVisibilityAnimation; /** The animator that controls touch highlighting. */ private CompositorAnimator mTouchHighlightAnimation; /** * Constructs a new bottom bar control container by inflating views from XML. * * @param panel The panel. * @param container The parent view for the bottom bar views. * @param loader The resource loader that will handle the snapshot capturing. */ public ContextualSearchBarControl(ContextualSearchPanel panel, Context context, ViewGroup container, DynamicResourceLoader loader) { mContextualSearchPanel = panel; mCanPromoteToNewTab = panel.canPromoteToNewTab(); mImageControl = new ContextualSearchImageControl(panel); mContextControl = new ContextualSearchContextControl(panel, context, container, loader); mSearchTermControl = new ContextualSearchTermControl(panel, context, container, loader); mCaptionControl = new ContextualSearchCaptionControl( panel, context, container, loader, mCanPromoteToNewTab); mQuickActionControl = new ContextualSearchQuickActionControl(context, loader); mCardIconControl = new ContextualSearchCardIconControl(context, loader); mTextLayerMinHeight = context.getResources().getDimension( R.dimen.contextual_search_text_layer_min_height); mTermCaptionSpacing = context.getResources().getDimension( R.dimen.contextual_search_term_caption_spacing); // Divider line values. mDividerLineWidth = context.getResources().getDimension( R.dimen.contextual_search_divider_line_width); mDividerLineHeight = context.getResources().getDimension( R.dimen.contextual_search_divider_line_height); mDividerLineColor = ApiCompatibilityUtils.getColor( context.getResources(), R.color.contextual_search_divider_line_color); // Icon attributes. mPaddedIconWidthPx = context.getResources().getDimension(R.dimen.contextual_search_padded_button_width); mEndButtonWidth = mPaddedIconWidthPx + context.getResources().getDimension(R.dimen.overlay_panel_button_padding); mDpToPx = context.getResources().getDisplayMetrics().density; } /** * @return The {@link ContextualSearchImageControl} for the panel. */ public ContextualSearchImageControl getImageControl() { return mImageControl; } /** * Returns the minimum height that the text layer (containing the Search Context, Term and * Caption) should be. */ public float getTextLayerMinHeight() { return mTextLayerMinHeight; } /** * Returns the spacing that should be placed between the Search Term and Caption. */ public float getSearchTermCaptionSpacing() { return mTermCaptionSpacing; } /** * Removes the bottom bar views from the parent container. */ public void destroy() { mContextControl.destroy(); mSearchTermControl.destroy(); mCaptionControl.destroy(); mQuickActionControl.destroy(); mCardIconControl.destroy(); } /** * Updates this bar when in transition between closed to peeked states. * @param percentage The percentage to the more opened state. */ public void onUpdateFromCloseToPeek(float percentage) { // #onUpdateFromPeekToExpanded() never reaches the 0.f value because this method is called // instead. If the panel is fully peeked, call #onUpdateFromPeekToExpanded(). if (percentage == FULL_OPACITY) onUpdateFromPeekToExpand(TRANSPARENT_OPACITY); // When the panel is completely closed the caption and custom image should be hidden. if (percentage == TRANSPARENT_OPACITY) { mQuickActionControl.reset(); mCaptionControl.hide(); getImageControl().hideCustomImage(false); } } /** * Updates this bar when in transition between peeked to expanded states. * @param percentage The percentage to the more opened state. */ public void onUpdateFromPeekToExpand(float percentage) { mExpandedPercent = percentage; // If there is a quick action, the divider line's appearance was animated when the quick // action was set. if (!getQuickActionControl().hasQuickAction() && !ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) { mDividerLineVisibilityPercentage = percentage; } getImageControl().onUpdateFromPeekToExpand(percentage); mCaptionControl.onUpdateFromPeekToExpand(percentage); mSearchTermControl.onUpdateFromPeekToExpand(percentage); mContextControl.onUpdateFromPeekToExpand(percentage); } /** * Sets the details of the context to display in the control. * @param selection The portion of the context that represents the user's selection. * @param end The portion of the context after the selection. */ public void setContextDetails(String selection, String end) { cancelSearchTermResolutionAnimation(); hideCaption(); mQuickActionControl.reset(); mContextControl.setContextDetails(selection, end); resetSearchBarContextOpacity(); animateDividerLine(false); } /** * Updates the Bar to display a dictionary definition card. * @param searchTerm The string that represents the search term to display. * @param cardTagEnum Which kind of card is being shown in this update. */ void updateForDictionaryDefinition(String searchTerm, @CardTag int cardTagEnum) { if (!mCardIconControl.didUpdateControlsForDefinition( mContextControl, mImageControl, searchTerm, cardTagEnum)) { // Can't style, just update with the text to display. setSearchTerm(searchTerm); animateSearchTermResolution(); } } /** * Sets the search term to display in the control. * @param searchTerm The string that represents the search term. */ public void setSearchTerm(String searchTerm) { cancelSearchTermResolutionAnimation(); hideCaption(); mQuickActionControl.reset(); mSearchTermControl.setSearchTerm(searchTerm); resetSearchBarTermOpacity(); // If the panel is expanded, the divider line should not be hidden. This may happen if the // panel is opened before the search term is resolved. if (mExpandedPercent == TRANSPARENT_OPACITY) animateDividerLine(false); } /** * Sets the caption to display in the control and sets the caption visible. * @param caption The caption to display. */ public void setCaption(String caption) { mCaptionControl.setCaption(caption); } /** * Gets the current animation percentage for the Caption control, which guides the vertical * position and opacity of the caption. * @return The animation percentage ranging from 0.0 to 1.0. * */ public float getCaptionAnimationPercentage() { return mCaptionControl.getAnimationPercentage(); } /** * @return Whether the caption control is visible. */ public boolean getCaptionVisible() { return mCaptionControl.getIsVisible(); } /** * @return The Id of the Search Context View. */ public int getSearchContextViewId() { return mContextControl.getViewId(); } /** * @return The Id of the Search Term View. */ public int getSearchTermViewId() { return mSearchTermControl.getViewId(); } /** * @return The Id of the Search Caption View. */ public int getCaptionViewId() { return mCaptionControl.getViewId(); } /** * @return The text currently showing in the caption view. */ @VisibleForTesting public CharSequence getCaptionText() { return mCaptionControl.getCaptionText(); } /** * @return The opacity of the SearchBar's search context. */ public float getSearchBarContextOpacity() { return mSearchBarContextOpacity; } /** * @return The opacity of the SearchBar's search term. */ public float getSearchBarTermOpacity() { return mSearchBarTermOpacity; } /** * Sets the quick action if one is available. * @param quickActionUri The URI for the intent associated with the quick action. * @param quickActionCategory The {@link QuickActionCategory} for the quick action. * @param toolbarBackgroundColor The current toolbar background color. This may be used for * icon tinting. */ public void setQuickAction(String quickActionUri, @QuickActionCategory int quickActionCategory, int toolbarBackgroundColor) { mQuickActionControl.setQuickAction( quickActionUri, quickActionCategory, toolbarBackgroundColor); if (mQuickActionControl.hasQuickAction()) { // TODO(twellington): should the quick action caption be stored separately from the // regular caption? mCaptionControl.setCaption(mQuickActionControl.getCaption()); mImageControl.setCardIconResourceId(mQuickActionControl.getIconResId()); animateDividerLine(true); } } /** * @return The {@link ContextualSearchQuickActionControl} for the panel. */ public ContextualSearchQuickActionControl getQuickActionControl() { return mQuickActionControl; } /** * Resets the SearchBar text opacity when a new search context is set. The search * context is made visible and the search term invisible. */ private void resetSearchBarContextOpacity() { mSearchBarContextOpacity = FULL_OPACITY; mSearchBarTermOpacity = TRANSPARENT_OPACITY; } /** * Resets the SearchBar text opacity when a new search term is set. The search * term is made visible and the search context invisible. */ private void resetSearchBarTermOpacity() { mSearchBarContextOpacity = TRANSPARENT_OPACITY; mSearchBarTermOpacity = FULL_OPACITY; } /** * Hides the caption so it will not be displayed in the control. */ private void hideCaption() { mCaptionControl.hide(); } // ============================================================================================ // Divider Line // ============================================================================================ /** * @return The visibility percentage for the divider line ranging from 0.f to 1.f. */ public float getDividerLineVisibilityPercentage() { return mDividerLineVisibilityPercentage; } /** * @return The width of the divider line in px. */ public float getDividerLineWidth() { return mDividerLineWidth; } /** * @return The height of the divider line in px. */ public float getDividerLineHeight() { return mDividerLineHeight; } /** * @return The divider line color. */ public int getDividerLineColor() { return mDividerLineColor; } /** * @return The x-offset for the divider line relative to the x-position of the Bar in px. */ public float getDividerLineXOffset() { if (LocalizationUtils.isLayoutRtl()) { return mEndButtonWidth; } else { return mContextualSearchPanel.getContentViewWidthPx() - mEndButtonWidth - getDividerLineWidth(); } } /** * Animates the appearance or disappearance of the divider line. * @param visible Whether the divider line should be made visible. */ private void animateDividerLine(boolean visible) { if (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) return; float endValue = visible ? FULL_OPACITY : TRANSPARENT_OPACITY; if (mDividerLineVisibilityPercentage == endValue) return; if (mDividerLineVisibilityAnimation != null) mDividerLineVisibilityAnimation.cancel(); mDividerLineVisibilityAnimation = CompositorAnimator.ofFloat( mContextualSearchPanel.getAnimationHandler(), mDividerLineVisibilityPercentage, endValue, OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, null); mDividerLineVisibilityAnimation.addUpdateListener( animator -> mDividerLineVisibilityPercentage = animator.getAnimatedValue()); mDividerLineVisibilityAnimation.start(); } // ============================================================================================ // Touch Highlight // ============================================================================================ /** * Whether the touch highlight is visible. */ private boolean mTouchHighlightVisible; /** * Whether the touch that triggered showing the touch highlight was on the end Bar button. */ private boolean mWasTouchOnEndButton; /** * Whether the divider line was visible when the touch highlight started showing. */ private boolean mWasDividerVisibleOnTouch; /** Where the touch highlight should start, in pixels. */ private float mTouchHighlightXOffsetPx; /** The width of the touch highlight, in pixels. */ private float mTouchHighlightWidthPx; /** * @return Whether the touch highlight is visible. */ public boolean getTouchHighlightVisible() { return mTouchHighlightVisible; } /** * @return The x-offset of the touch highlight in pixels. */ public float getTouchHighlightXOffsetPx() { if (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) { return mTouchHighlightXOffsetPx; } if (mWasDividerVisibleOnTouch && ((mWasTouchOnEndButton && !LocalizationUtils.isLayoutRtl()) || (!mWasTouchOnEndButton && LocalizationUtils.isLayoutRtl()))) { // If the touch was on the end button in LTR, offset the touch highlight so that it // starts at the beginning of the end button. // If the touch was not on the end button in RTL, offset the touch highlight so that it // starts after the end button. return getDividerLineXOffset() + getDividerLineWidth(); } return 0; } /** * @return The width of the touch highlight in pixels. */ public float getTouchHighlightWidthPx() { if (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) { return mTouchHighlightWidthPx; } if (mWasDividerVisibleOnTouch) { // The touch was on the end button so the touch highlight should cover the end button. if (mWasTouchOnEndButton) return mEndButtonWidth; // The touch was not on the end button so the touch highlight should cover everything // except the end button. return mContextualSearchPanel.getContentViewWidthPx() - mEndButtonWidth - getDividerLineWidth(); } // If the divider line wasn't visible when the Bar was touched, the touch highlight covers // the entire Bar. return mContextualSearchPanel.getContentViewWidthPx(); } /** * Should be called when the Bar is clicked. * @param xDps The x-position of the click in DPs. */ public void onSearchBarClick(float xDps) { showTouchHighlight(xDps * mDpToPx); } /** * Should be called when an onShowPress() event occurs on the Bar. * See {@code GestureDetector.SimpleOnGestureListener#onShowPress()}. * @param xDps The x-position of the touch in DPs. */ public void onShowPress(float xDps) { showTouchHighlight(xDps * mDpToPx); } /** * Classifies the give x position in pixels and computes the highlight offset and width. * @param xPx The x-coordinate of a touch location, in pixels. */ private void classifyTouchLocation(float xPx) { assert ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT); // There are 3 cases: // 1) The whole Bar (without any icons) // 2) The Bar minus icon (when the icon is present) // 3) The icon int panelWidth = mContextualSearchPanel.getContentViewWidthPx(); if (mContextualSearchPanel.isPeeking()) { // Case 1 - whole Bar. mTouchHighlightXOffsetPx = 0; mTouchHighlightWidthPx = panelWidth; } else { // The open-tab-icon is on the right (on the left in RTL). boolean isRtl = LocalizationUtils.isLayoutRtl(); float paddedIconWithMarginWidth = (mContextualSearchPanel.getBarMarginSide() + mContextualSearchPanel.getOpenTabIconDimension() + mContextualSearchPanel.getButtonPaddingDps()) * mDpToPx; float contentWidth = panelWidth - paddedIconWithMarginWidth; // Adjust the touch point to panel coordinates. xPx -= mContextualSearchPanel.getOffsetX() * mDpToPx; if (isRtl && xPx > paddedIconWithMarginWidth || !isRtl && xPx < contentWidth) { // Case 2 - Bar minus icon. mTouchHighlightXOffsetPx = isRtl ? paddedIconWithMarginWidth : 0; mTouchHighlightWidthPx = contentWidth; } else { // Case 3 - the icon. mTouchHighlightXOffsetPx = isRtl ? 0 : contentWidth; mTouchHighlightWidthPx = paddedIconWithMarginWidth; } } } /** * Shows the touch highlight if it is not already visible. * @param x The x-position of the touch in px. */ private void showTouchHighlight(float x) { if (mTouchHighlightVisible) return; mWasTouchOnEndButton = isTouchOnEndButton(x); // If the panel is expanded or maximized and the panel content cannot be promoted to a new // tab, then tapping anywhere besides the end buttons does nothing. In this case, the touch // highlight should not be shown. if (!mContextualSearchPanel.isPeeking() && !mCanPromoteToNewTab) return; if (ChromeFeatureList.isEnabled(ChromeFeatureList.OVERLAY_NEW_LAYOUT)) { classifyTouchLocation(x); } else { mWasDividerVisibleOnTouch = getDividerLineVisibilityPercentage() > TRANSPARENT_OPACITY; } mTouchHighlightVisible = true; // The touch highlight animation is used to ensure the touch highlight is visible for at // least OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS. // TODO(donnd): Add a material ripple to this animation. if (mTouchHighlightAnimation == null) { mTouchHighlightAnimation = new CompositorAnimator(mContextualSearchPanel.getAnimationHandler()); mTouchHighlightAnimation.setDuration(OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS); mTouchHighlightAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mTouchHighlightVisible = false; } }); } mTouchHighlightAnimation.cancel(); mTouchHighlightAnimation.start(); } /** * @param xPx The x-position of the touch in px. * @return Whether the touch occurred on the search Bar's end button. */ private boolean isTouchOnEndButton(float xPx) { if (getDividerLineVisibilityPercentage() == TRANSPARENT_OPACITY) return false; // Adjust the touch position to compensate for the narrow panel. xPx -= mContextualSearchPanel.getOffsetX() * mDpToPx; if (LocalizationUtils.isLayoutRtl()) return xPx <= getDividerLineXOffset(); return xPx > getDividerLineXOffset(); } // ============================================================================================ // Search Bar Animation // ============================================================================================ /** * Animates the search term resolution. */ public void animateSearchTermResolution() { if (mTextOpacityAnimation == null) { mTextOpacityAnimation = CompositorAnimator.ofFloat( mContextualSearchPanel.getAnimationHandler(), TRANSPARENT_OPACITY, FULL_OPACITY, OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, null); mTextOpacityAnimation.addUpdateListener( animator -> updateSearchBarTextOpacity(animator.getAnimatedValue())); } mTextOpacityAnimation.cancel(); mTextOpacityAnimation.start(); } /** * Cancels the search term resolution animation if it is in progress. */ public void cancelSearchTermResolutionAnimation() { if (mTextOpacityAnimation != null) mTextOpacityAnimation.cancel(); } /** * Updates the UI state for the SearchBar text. The search context view will fade out * while the search term fades in. * * @param percentage The visibility percentage of the search term view. */ private void updateSearchBarTextOpacity(float percentage) { // The search context will start fading out before the search term starts fading in. // They will both be partially visible for overlapPercentage of the animation duration. float overlapPercentage = .75f; float fadingOutPercentage = Math.max(1 - (percentage / overlapPercentage), TRANSPARENT_OPACITY); float fadingInPercentage = Math.max(percentage - (1 - overlapPercentage), TRANSPARENT_OPACITY) / overlapPercentage; mSearchBarContextOpacity = fadingOutPercentage; mSearchBarTermOpacity = fadingInPercentage; } }
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
edc154e107043dc2437521e19d3e5dda395a3e00
71975999c9d702a0883ec9038ce3e76325928549
/src2.4.0/src/main/java/defpackage/fb.java
435692154f64557c6914a7f3d7e3fb0613305de6
[]
no_license
XposedRunner/PhysicalFitnessRunner
dc64179551ccd219979a6f8b9fe0614c29cd61de
cb037e59416d6c290debbed5ed84c956e705e738
refs/heads/master
2020-07-15T18:18:23.001280
2019-09-02T04:21:34
2019-09-02T04:21:34
205,620,387
3
2
null
null
null
null
UTF-8
Java
false
false
2,136
java
package defpackage; import android.support.v7.widget.RecyclerView.Adapter; import android.support.v7.widget.RecyclerView.ViewHolder; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.zjwh.android_wh_physicalfitness.entity.TopicBean; import java.util.List; /* compiled from: FindTopicAdapter */ /* renamed from: fb */ public class fb extends Adapter { private List<TopicBean> O000000o; private boolean O00000Oo; private in<TopicBean> O00000o0; /* compiled from: FindTopicAdapter */ /* renamed from: fb$1 */ class 1 implements OnClickListener { final /* synthetic */ ViewHolder O000000o; final /* synthetic */ TopicBean O00000Oo; final /* synthetic */ fb O00000o0; 1(fb fbVar, ViewHolder viewHolder, TopicBean topicBean) { } public void onClick(View view) { } } /* compiled from: FindTopicAdapter */ /* renamed from: fb$O000000o */ private static abstract class O000000o extends ViewHolder { public O000000o(View view) { } public abstract void O000000o(TopicBean topicBean); } /* compiled from: FindTopicAdapter */ /* renamed from: fb$O00000Oo */ private static class O00000Oo extends O000000o { private ImageView O000000o; private TextView O00000Oo; private ImageView O00000o; private TextView O00000o0; public O00000Oo(View view) { } /* Access modifiers changed, original: protected */ public void O000000o(TopicBean topicBean) { } } public void O000000o() { } public void O000000o(in<TopicBean> inVar) { } public void O000000o(List<TopicBean> list) { } public int getItemCount() { return 0; } public void onBindViewHolder(ViewHolder viewHolder, int i) { } public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { return null; } }
[ "xr_master@mail.com" ]
xr_master@mail.com
7e87c5c498b1e4f9d3fecf224cb7e870fec945e5
012abf1f94594082dc91711ae8228b5cf656de20
/src/main/java/com/camrin/productservice/fileupload/FileUploadUtil.java
1144a7a7934298ef94f3fbb2600d709eb0cc8da4
[]
no_license
corrine3297/camrin_integrated_promotionType
7cd4d119768c8a0e3b6ea28dee432f17d15fab2d
9acd4e8cfb69f7c1e5eaf80bac438610fc9ea8d2
refs/heads/master
2023-03-02T09:30:25.387705
2021-02-09T16:33:05
2021-02-09T16:33:05
337,466,218
0
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.camrin.productservice.fileupload; import java.io.*; import java.nio.file.*; import org.springframework.web.multipart.MultipartFile; /** * * @author ANISH */ public class FileUploadUtil { public static void saveFile(String uploadDir, String fileName, MultipartFile multipartFile) throws IOException { Path uploadPath = Paths.get(uploadDir); if (!Files.exists(uploadPath)) { Files.createDirectories(uploadPath); } try (InputStream inputStream = multipartFile.getInputStream()) { Path filePath = uploadPath.resolve(fileName); Files.copy(inputStream, filePath, StandardCopyOption.REPLACE_EXISTING); } catch (IOException ioe) { throw new IOException("Could not save image file: " + fileName, ioe); } } }
[ "corrine.elizabeth.rodrigues04gmail.com" ]
corrine.elizabeth.rodrigues04gmail.com
1180f5e7ecd2049e6667fbeab6dea7e29bd70b3e
fc0f86a9528ab592e434f939a97f7eacf63c1f3d
/WEXAPIService/wex-analyzer/src/main/java/org/wolffr/wex/analyzer/TickerAnalyzer.java
b653e64cc73954d9fa590e2b646575ad9a200c61
[]
no_license
robertwolff1986/WEXAPIService
b0c6a654511d1758e7ea1e9367849a2c03a9a37f
feba876bfbf9942e3940e0d8dafab573ab292200
refs/heads/master
2021-08-24T12:33:11.708153
2017-12-09T22:09:45
2017-12-09T22:09:45
113,070,588
0
0
null
null
null
null
UTF-8
Java
false
false
3,148
java
package org.wolffr.wex.analyzer; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import javax.ejb.EJB; import javax.ejb.Singleton; import org.wolffr.wex.common.mongo.ticker.SpecificTicker; @Singleton public class TickerAnalyzer { @EJB private MailService mailService; private static final Double oneMinuteSwingPercentToNotify = 3.0; private static final Double tenMinuteSwingPercentToNotify = 10.0; private static final Integer MAILREPEATRATE=5; private Map<String, List<SpecificTicker>> tenMinuteTickerMap = new ConcurrentHashMap<>(); private Map<String, List<SpecificTicker>> oneMinuteTickerMap = new ConcurrentHashMap<>(); private Map<String,LocalDateTime> lastMailMap=new HashMap<>(); public void analyzeTicker(SpecificTicker ticker) { addTickerToTickerMap(tenMinuteTickerMap, ticker); addTickerToTickerMap(oneMinuteTickerMap, ticker); checkPriceSwing(oneMinuteTickerMap.get(ticker.getSymbol()), oneMinuteSwingPercentToNotify); checkPriceSwing(tenMinuteTickerMap.get(ticker.getSymbol()), tenMinuteSwingPercentToNotify); } private void checkPriceSwing(List<SpecificTicker> tickerList, Double swingToNotify) { SpecificTicker currentTicker = tickerList.get(tickerList.size() - 1); SpecificTicker oldestTicker = tickerList.get(0); Double percentSwing = (Double.valueOf(currentTicker.getLast()) - Double.valueOf(oldestTicker.getLast())) / (Double.valueOf(oldestTicker.getLast()) / 100.0); if(Math.abs(percentSwing)>swingToNotify && canSendMail(currentTicker.getSymbol())) { sendNotificationMail(currentTicker.getSymbol(), percentSwing, oldestTicker.getLast(),currentTicker.getLast()); } } private boolean canSendMail(String symbol) { if(lastMailMap.get(symbol)==null) return true; return LocalDateTime.now().isAfter(lastMailMap.get(symbol).plusMinutes(MAILREPEATRATE)); } private void sendNotificationMail(String symbol, Double percentSwing, String old, String current) { mailService.sendPercentSwingMail(symbol,percentSwing,old,current); lastMailMap.put(symbol, LocalDateTime.now()); } private void addTickerToTickerMap(Map<String, List<SpecificTicker>> tickerMap, SpecificTicker ticker) { if (tickerMap.get(ticker.getSymbol()) == null) { List<SpecificTicker> tickerList = new ArrayList<>(); tickerList.add(ticker); tickerMap.put(ticker.getSymbol(), tickerList); } else { tickerMap.get(ticker.getSymbol()).add(ticker); } clearTickerMap(tickerMap); } private void clearTickerMap(Map<String, List<SpecificTicker>> tickerMap) { tickerMap.entrySet().stream().forEach(entry -> entry.setValue( entry.getValue().stream().filter(this::checkUpdateTimeInInteral).collect(Collectors.toList()))); } private boolean checkUpdateTimeInInteral(SpecificTicker ticker) { LocalDateTime time = LocalDateTime.parse(ticker.getUpdated(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); return time.isAfter(LocalDateTime.now().minusMinutes(10)); } }
[ "robert.wolff1986@gmail.com" ]
robert.wolff1986@gmail.com
324832f8b804a6314c099de0e46a4bfb175eca36
2051aeb0d367a5aacd37539aa5c4582f63d9d988
/Pronostics/src/main/java/gui/ChampionatUI.java
75c626316509790b0cba5a37786a463efeecf3c6
[]
no_license
Fraouf/pronos
d0a865d0204f1d68a84067b5dd51dd5598a744a0
d5f1399e8ecbd0abef56e1bff9829639eb93e3a4
refs/heads/master
2021-07-07T14:01:23.521856
2017-10-04T20:39:51
2017-10-04T20:39:51
105,816,251
0
0
null
null
null
null
UTF-8
Java
false
false
17,826
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 gui; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import pronostics.Equipe; import pronostics.Match; import pronostics.NeuralNetwork; import sql.SQLConnection; /** * * @author k1fryouf */ public class ChampionatUI extends javax.swing.JFrame { private SQLConnection myConnection; private final String championat; private NeuralNetwork nn; /** * Creates new form PronostiqueUI * @param championat * @param nn */ public ChampionatUI(String championat,NeuralNetwork nn) { myConnection = new SQLConnection(); myConnection.createConnection(); this.championat = championat; this.nn = nn; initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jButtonSupprimerEquipe = new javax.swing.JButton(); jButtonAjouterEquipe = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); listeEquipes = new javax.swing.JList(); jButtonQuitter = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); listeMatchs = new javax.swing.JList(); jLabel2 = new javax.swing.JLabel(); jButtonSupprimerMatche = new javax.swing.JButton(); jButtonAjouterMatche = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jLabel1.setText("Équipes"); jButtonSupprimerEquipe.setText("Supprimer"); jButtonSupprimerEquipe.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSupprimerEquipeActionPerformed(evt); } }); jButtonAjouterEquipe.setText("Ajouter"); jButtonAjouterEquipe.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAjouterEquipeActionPerformed(evt); } }); myConnection.setTableName("APP.EQUIPES"); listeEquipes.setModel(new javax.swing.AbstractListModel() { ArrayList<Equipe> equipes = myConnection.selectTeamsByComp(championat); public int getSize() { return equipes.size(); } public String getElementAt(int i) { return equipes.get(i).getNom(); } }); listeEquipes.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { listeEquipesMouseClicked(evt); } }); jScrollPane1.setViewportView(listeEquipes); jButtonQuitter.setText("Quitter"); jButtonQuitter.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonQuitterActionPerformed(evt); } }); myConnection.setTableName("APP.MATCHES"); listeMatchs.setModel(new javax.swing.AbstractListModel() { ArrayList<Match> matchs = myConnection.selectMatchsByComp(championat); public int getSize() { return matchs.size(); } public String getElementAt(int i) { return matchs.get(i).toString(); } }); listeMatchs.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { listeMatchsMouseClicked(evt); } }); jScrollPane2.setViewportView(listeMatchs); jLabel2.setText("Matchs"); jButtonSupprimerMatche.setText("Supprimer"); jButtonSupprimerMatche.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSupprimerMatcheActionPerformed(evt); } }); jButtonAjouterMatche.setText("Ajouter"); jButtonAjouterMatche.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAjouterMatcheActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2) .addGap(233, 233, 233) .addComponent(jLabel1) .addGap(89, 89, 89)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(155, 155, 155) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(jButtonAjouterMatche, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButtonSupprimerMatche)) .addComponent(jScrollPane2, 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.LEADING) .addGroup(layout.createSequentialGroup() .addGap(122, 122, 122) .addComponent(jButtonQuitter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 9, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(jButtonAjouterEquipe, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButtonSupprimerEquipe)) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 308, Short.MAX_VALUE) .addComponent(jScrollPane1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButtonSupprimerEquipe) .addComponent(jButtonAjouterEquipe) .addComponent(jButtonSupprimerMatche) .addComponent(jButtonAjouterMatche)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE) .addComponent(jButtonQuitter) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButtonAjouterEquipeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAjouterEquipeActionPerformed myConnection.setTableName("APP.EQUIPES"); AddTeam aAddTeam = new AddTeam(myConnection, this); aAddTeam.getjTextChampionat().setText(championat); if(!championat.equals("")){ aAddTeam.getjTextChampionat().setEnabled(false); } aAddTeam.setVisible(true); }//GEN-LAST:event_jButtonAjouterEquipeActionPerformed private void jButtonSupprimerEquipeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSupprimerEquipeActionPerformed myConnection.setTableName("APP.EQUIPES"); List<String> list = listeEquipes.getSelectedValuesList(); list.stream().forEach((String list1) -> { if(myConnection.deleteTeam(list1)){ }else{ JOptionPane.showMessageDialog(this, list1 +" n'a pas été supprimé."); } }); }//GEN-LAST:event_jButtonSupprimerEquipeActionPerformed private void listeEquipesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listeEquipesMouseClicked JList list = (JList)evt.getSource(); if (evt.getClickCount() == 2) { // Double-click detected editTeam(list.getSelectedValue().toString()); }; }//GEN-LAST:event_listeEquipesMouseClicked private void jButtonQuitterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonQuitterActionPerformed this.dispose(); }//GEN-LAST:event_jButtonQuitterActionPerformed private void jButtonAjouterMatcheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAjouterMatcheActionPerformed myConnection.setTableName("APP.MATCHES"); AddMatch aAddMatch = new AddMatch(myConnection, this); aAddMatch.getjTextComp().setText(championat); if(!championat.equals("")){ aAddMatch.getjTextComp().setEnabled(false); } aAddMatch.setVisible(true); }//GEN-LAST:event_jButtonAjouterMatcheActionPerformed private void jButtonSupprimerMatcheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSupprimerMatcheActionPerformed myConnection.setTableName("APP.MATCHES"); List<String> list = listeMatchs.getSelectedValuesList(); list.stream().forEach((String list1) -> { if(myConnection.deleteMatch(list1)){ refreshListMatchs(championat); }else{ JOptionPane.showMessageDialog(this, list1 +" n'a pas été supprimé."); } }); }//GEN-LAST:event_jButtonSupprimerMatcheActionPerformed private void listeMatchsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listeMatchsMouseClicked JList list = (JList)evt.getSource(); if (evt.getClickCount() == 2) { // Double-click detected editMatch(list.getSelectedValue().toString()); }; }//GEN-LAST:event_listeMatchsMouseClicked public void editTeam(String teamName){ myConnection.setTableName("APP.EQUIPES"); AddTeam editTeam = new AddTeam(myConnection, this); editTeam.getjButtonAjouter().setText("Modifier"); ArrayList<Equipe> team = myConnection.selectTeams(teamName); editTeam.getjTextNom().setText(team.get(0).getNom()); editTeam.getjTextPresident().setText(team.get(0).getPresident()); editTeam.getjTextEntraineur().setText(team.get(0).getEntraineur()); editTeam.getjTextPays().setText(team.get(0).getPays()); editTeam.getjTextChampionat().setText(team.get(0).getChampionat()); editTeam.getjTextStade().setText(team.get(0).getStade()); editTeam.getjTextIcon().setText(team.get(0).getIcon()); editTeam.setVisible(true); } public void editMatch(String matchId){ myConnection.setTableName("APP.MATCHES"); AddMatch editMatch = new AddMatch(myConnection, this); editMatch.getjButtonAjouter().setText("Modifier"); ArrayList<Match> match = myConnection.selectMatchs(matchId); editMatch.getjLabelId().setText(matchId); editMatch.getjTextEquipeDom().setSelectedItem(match.get(0).getEquipeDom()); editMatch.getjTextEquipeExt().setSelectedItem(match.get(0).getEquipeExt()); editMatch.getjTextStade().setText(match.get(0).getStade()); editMatch.getjTextDate().setText(match.get(0).getDate().toString()); editMatch.getjTextComp().setText(match.get(0).getCompetition()); editMatch.setVisible(true); } public JLabel getjLabel1() { return jLabel1; } public void setjLabel1(JLabel jLabel1) { this.jLabel1 = jLabel1; } public JScrollPane getjScrollPane1() { return jScrollPane1; } public void setjScrollPane1(JScrollPane jScrollPane1) { this.jScrollPane1 = jScrollPane1; } public JList getListeEquipes() { return listeEquipes; } public void setListeEquipes(JList listeEquipes) { this.listeEquipes = listeEquipes; } public JButton getjButtonAjouterEquipe() { return jButtonAjouterEquipe; } public void setjButtonAjouterEquipe(JButton jButtonAjouterEquipe) { this.jButtonAjouterEquipe = jButtonAjouterEquipe; } public JButton getjButtonAjouterMatche() { return jButtonAjouterMatche; } public void setjButtonAjouterMatche(JButton jButtonAjouterMatche) { this.jButtonAjouterMatche = jButtonAjouterMatche; } public JButton getjButtonQuitter() { return jButtonQuitter; } public void setjButtonQuitter(JButton jButtonQuitter) { this.jButtonQuitter = jButtonQuitter; } public JButton getjButtonSupprimerEquipe() { return jButtonSupprimerEquipe; } public void setjButtonSupprimerEquipe(JButton jButtonSupprimerEquipe) { this.jButtonSupprimerEquipe = jButtonSupprimerEquipe; } public JButton getjButtonSupprimerMatche() { return jButtonSupprimerMatche; } public void setjButtonSupprimerMatche(JButton jButtonSupprimerMatche) { this.jButtonSupprimerMatche = jButtonSupprimerMatche; } public JLabel getjLabel2() { return jLabel2; } public void setjLabel2(JLabel jLabel2) { this.jLabel2 = jLabel2; } public JScrollPane getjScrollPane2() { return jScrollPane2; } public void setjScrollPane2(JScrollPane jScrollPane2) { this.jScrollPane2 = jScrollPane2; } public JList getListeMatchs() { return listeMatchs; } public void setListeMatchs(JList listeMatchs) { this.listeMatchs = listeMatchs; } public void refreshListMatchs(String s){ listeMatchs.setModel(new javax.swing.AbstractListModel() { ArrayList<Match> matchs = myConnection.selectMatchsByComp(s); public int getSize() { return matchs.size(); } public String getElementAt(int i) { return matchs.get(i).toString(); } }); jScrollPane2.setViewportView(listeMatchs); } public void refreshListEquipes(String s){ listeEquipes.setModel(new javax.swing.AbstractListModel() { ArrayList<Equipe> equipes = myConnection.selectTeamsByComp(s); @Override public int getSize() { return equipes.size(); } @Override public String getElementAt(int i) { return equipes.get(i).getNom(); } }); jScrollPane1.setViewportView(listeEquipes); } public String makeId(Match m){ return m.getEquipeDom().substring(0, 3)+m.getEquipeExt().substring(0, 3)+m.getDate(); } public String getChampionat(){ return championat; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButtonAjouterEquipe; private javax.swing.JButton jButtonAjouterMatche; private javax.swing.JButton jButtonQuitter; private javax.swing.JButton jButtonSupprimerEquipe; private javax.swing.JButton jButtonSupprimerMatche; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JList listeEquipes; private javax.swing.JList listeMatchs; // End of variables declaration//GEN-END:variables }
[ "k1fryouf@192.168.0.101" ]
k1fryouf@192.168.0.101
245dd720085e6439a9463facee86977f56cf30dd
bf96f7e4001aa54b72443771d6d47a866ad1b435
/legalaidsystem/src/business/Organization/AdminOrganization.java
7421c6a58eb0ae621c0b5b70b2bf20cd797f836c
[]
no_license
keerthana-ravi-thoddoon/legalaidsystem
48832ccab397c90849a0e88193d258d657921f29
1e34e303642856e35474d4ab47d34af22e888eb1
refs/heads/master
2022-11-17T20:04:45.156271
2020-07-23T06:11:32
2020-07-23T06:11:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
663
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 Business.Organization; import Business.Role.AdminRole; import Business.Role.Role; import java.util.ArrayList; /** * * @author kranthikumar */ public class AdminOrganization extends Organization { public AdminOrganization() { super(Organization.Type.Admin.getValue()); } @Override public ArrayList<Role> getSupportedRole() { ArrayList<Role> roles = new ArrayList(); roles.add(new AdminRole()); return roles; } }
[ "thoddoonravi.k@northeastern.edu" ]
thoddoonravi.k@northeastern.edu
ae95cf48f1706e0a602842607dd9dc4032b42461
a93f1de3f73a025d5667b4068cd1893205e501c5
/Lecheros/src/sistema/SistemaUsuarios.java
a8185c3b120435569cdc0bf0dceaa1acfe7db1bd
[]
no_license
eduardito15/Lecheros
74c8ec8ca4be277942b605e6ad8ee619e2b06474
765c8dc03f0f6d0bbfd937b98d6e9d63212ab154
refs/heads/master
2021-05-23T05:32:11.278614
2018-04-21T22:05:37
2018-04-21T22:05:37
95,057,943
1
1
null
null
null
null
UTF-8
Java
false
false
12,614
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 sistema; import dao.GenericDAO; import dominio.usuarios.Actividad; import dominio.usuarios.LogDeOperacion; import dominio.usuarios.Rol; import dominio.usuarios.Usuario; import excepciones.LogDeExcepciones; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Date; import java.util.List; import java.util.Properties; import lecheros.Lecheros; import org.hibernate.Query; import org.hibernate.Session; import ui.usuarios.Constantes; /** * * @author Edu */ public class SistemaUsuarios { private static SistemaUsuarios instance; private static Usuario usuario; /** * @return the instance */ public static SistemaUsuarios getInstance() { if(instance == null){ return new SistemaUsuarios(); } return instance; } private SistemaUsuarios(){ try { cargarNombreEmpresa(); } catch (Exception ex) { //Logger.getLogger(SistemaUsuarios.class.getName()).log(Level.SEVERE, null, ex); } } private static MessageDigest md; public static String cryptWithMD5(String pass) { try { md = MessageDigest.getInstance("MD5"); byte[] passBytes = pass.getBytes(); md.reset(); byte[] digested = md.digest(passBytes); StringBuffer sb = new StringBuffer(); for (int i = 0; i < digested.length; i++) { sb.append(Integer.toHexString(0xff & digested[i])); } return sb.toString(); } catch (NoSuchAlgorithmException ex) { } return null; } public String devolverNombrePorDefecto() throws IOException, Exception { String retorno = ""; String directorioDeInstalacion = SistemaMantenimiento.getInstance().devolverConfiguracionGeneral().getDirectorioInstalacion(); try (BufferedReader br = new BufferedReader(new FileReader(directorioDeInstalacion + "/usu.txt"))) { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); line = br.readLine(); } retorno = sb.toString(); return retorno; } } public final void cargarNombreEmpresa() throws IOException, Exception { Properties prop = new Properties(); InputStream input = null; try { String sSistemaOperativo = System.getProperty("os.name"); //System.out.println(sSistemaOperativo); if(sSistemaOperativo.equals("Mac OS X")) { input = new FileInputStream("src/config.properties"); } else { String dir = System.getProperty("user.dir"); input = new FileInputStream(dir + "\\config.properties"); } // load a properties file prop.load(input); // get the property value and print it out Lecheros.nombreEmpresa = prop.getProperty("empresa"); //System.out.println(prop.getProperty("dbuser")); //System.out.println(prop.getProperty("dbpassword")); } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } } public List<Actividad> devolverActividades() throws Exception { List<Actividad> retorno; Session session = GenericDAO.getGenericDAO().getSessionFactory().openSession(); session.beginTransaction(); Query consulta = session.createQuery("FROM Actividad"); retorno = consulta.list(); session.getTransaction().commit(); session.close(); return retorno; } public Actividad devolverActividadPorNombre(String nombre) throws Exception { Actividad retorno; Session session = GenericDAO.getGenericDAO().getSessionFactory().openSession(); session.beginTransaction(); Query consulta = session.createQuery("SELECT a FROM Actividad a WHERE a.nombre = :nom"); consulta.setString("nom", nombre); retorno = (Actividad)consulta.uniqueResult(); session.getTransaction().commit(); session.close(); return retorno; } //Metodos Choferes public boolean agregarRol(String nombre, List<Actividad> actividades) throws Exception { Rol rol = new Rol(); rol.setNombre(nombre); rol.setActividades(actividades); SistemaUsuarios.getInstance().registrarOperacion(Constantes.ActividadMantenimientoRoles, "Creo el rol : " + nombre); return GenericDAO.getGenericDAO().guardar(rol); } public List<Rol> devolverRoles() { List<Rol> retorno; Session session = GenericDAO.getGenericDAO().getSessionFactory().openSession(); session.beginTransaction(); Query consulta = session.createQuery("FROM Rol"); retorno = consulta.list(); session.getTransaction().commit(); session.close(); return retorno; } public boolean actualizarRol(Rol rol) throws Exception { SistemaUsuarios.getInstance().registrarOperacion(Constantes.ActividadMantenimientoRoles, "Actualizo el rol : " + rol.getNombre() ); return GenericDAO.getGenericDAO().actualizar(rol); } public boolean eliminarRol(Rol rol) throws Exception { SistemaUsuarios.getInstance().registrarOperacion(Constantes.ActividadMantenimientoRoles, "Elimino el rol : " + rol.getNombre() ); return GenericDAO.getGenericDAO().borrar(rol); } public boolean nombreDeRolValido(String nombre) throws Exception { boolean retorno = true; Session session = GenericDAO.getGenericDAO().getSessionFactory().openSession(); session.beginTransaction(); Query consulta = session.createQuery("FROM Rol r where r.nombre = :nom"); consulta.setString("nom", nombre); Rol r = (Rol)consulta.uniqueResult(); if(r != null){ retorno = false; } session.getTransaction().commit(); session.close(); return retorno; } public boolean nombreDeUsuarioValido(String nombre) throws Exception { boolean retorno = true; Session session = GenericDAO.getGenericDAO().getSessionFactory().openSession(); session.beginTransaction(); Query consulta = session.createQuery("FROM Usuario u where u.nombreDeUsuario = :nom and u.activo = :act"); consulta.setString("nom", nombre); consulta.setBoolean("act", true); Rol r = (Rol)consulta.uniqueResult(); if(r != null){ retorno = false; } session.getTransaction().commit(); session.close(); return retorno; } public boolean agregarUsuario(String nombre, String contrasena, Rol rol) throws Exception { Usuario u = new Usuario(); u.setActivo(true); u.setNombreDeUsuario(nombre); String contrasenaEncriptada = SistemaUsuarios.cryptWithMD5(contrasena); u.setContrasena(contrasenaEncriptada); u.setRol(rol); SistemaUsuarios.getInstance().registrarOperacion(Constantes.ActividadMantenimientoUsuarios, "Ingreso el usuario : " + nombre ); return GenericDAO.getGenericDAO().guardar(u); } public boolean eliminarUsuario(Usuario u) throws Exception { u.setActivo(false); SistemaUsuarios.getInstance().registrarOperacion(Constantes.ActividadMantenimientoUsuarios, "Elimino el usuario : " + u.getNombreDeUsuario() ); return GenericDAO.getGenericDAO().actualizar(u); } public boolean actualizarUsuario(Usuario u) throws Exception { String contrasenaEncriptada = SistemaUsuarios.cryptWithMD5(u.getContrasena()); u.setContrasena(contrasenaEncriptada); SistemaUsuarios.getInstance().registrarOperacion(Constantes.ActividadMantenimientoUsuarios, "Actualizo el usuario : " + u.getNombreDeUsuario() ); return GenericDAO.getGenericDAO().actualizar(u); } public List<Usuario> devolverUsuarios() { List<Usuario> retorno; Session session = GenericDAO.getGenericDAO().getSessionFactory().openSession(); session.beginTransaction(); Query consulta = session.createQuery("FROM Usuario u where u.activo = :act"); consulta.setBoolean("act", true); retorno = consulta.list(); session.getTransaction().commit(); session.close(); return retorno; } public boolean existeUsuario(String nombre, String contrasena) throws Exception { boolean retorno = false; String conEncriptada = SistemaUsuarios.cryptWithMD5(contrasena); Session session = GenericDAO.getGenericDAO().getSessionFactory().openSession(); session.beginTransaction(); Query consulta = session.createQuery("FROM Usuario u where u.nombreDeUsuario = :nom and u.activo = :act and u.contrasena = :conEncriptada"); consulta.setString("nom", nombre); consulta.setString("conEncriptada", conEncriptada); consulta.setBoolean("act", true); this.usuario = (Usuario)consulta.uniqueResult(); if(this.usuario != null) { registrarOperacion(Constantes.Login, "Inicio aplicacion. Usuario: " + usuario.getNombreDeUsuario()); retorno = true; } session.getTransaction().commit(); session.close(); return retorno; } public boolean tienePermisos(String nombreActividad) throws Exception{ boolean retorno = false; Actividad a = devolverActividadPorNombre(nombreActividad); if(a != null) { if(this.usuario.getRol().getActividades().contains(a)){ retorno = true; } } return retorno; } public void registrarOperacion(String nombreActividad, String descripcionActividad) throws Exception{ LogDeOperacion log = new LogDeOperacion(); Actividad a = this.devolverActividadPorNombre(nombreActividad); log.setAactividad(a); log.setDescripcion(descripcionActividad); log.setUsuario(usuario); Date fecha = new Date(); log.setFecha(fecha); GenericDAO.getGenericDAO().guardar(log); } public void registrarExcepcion(String mensajeDeError, String stackTrace){ LogDeExcepciones log = new LogDeExcepciones(); log.setUsuario(usuario); Date fecha = new Date(); log.setFecha(fecha); log.setMensajeDeError(mensajeDeError); //log.setStackTrace(stackTrace); GenericDAO.getGenericDAO().guardar(log); } public boolean verificarContrasenia(String contrasenia){ boolean retorno = false; String conEncriptada = cryptWithMD5(contrasenia); if(usuario.getContrasena().equals(conEncriptada)){ retorno = true; } return retorno; } public void cambiarContrasenia(String contraseniaNueva) throws Exception{ String nuevaConEncriptada = SistemaUsuarios.cryptWithMD5(contraseniaNueva); usuario.setContrasena(nuevaConEncriptada); try { actualizarUsuario(usuario); SistemaUsuarios.getInstance().registrarOperacion(Constantes.ActividadMantenimientoUsuarios, "Cambio la contraseña : " ); } catch (Exception ex) { throw ex; } } public List<LogDeOperacion> devolverLogDeOperacionesEntreFechas(Date desdeFecha, Date hastaFecha) { List<LogDeOperacion> retorno = null; Session session = GenericDAO.getGenericDAO().getSessionFactory().openSession(); session.beginTransaction(); Query consulta = session.createQuery("FROM LogDeOperacion WHERE (fecha BETWEEN :stDate AND :edDate )" ); consulta.setDate("stDate", desdeFecha); consulta.setDate("edDate", hastaFecha); retorno = consulta.list(); session.getTransaction().commit(); session.close(); return retorno; } }
[ "eduardovecino15@gmail.com" ]
eduardovecino15@gmail.com
6332e89f8c0b01a2f79821263478694f8f91a534
83cabb12926e407a6cc93197a1aa72798df00127
/src/model/excecao/DominioException.java
02027a630cc7dbd1253353679476414b8ea26a16
[]
no_license
Sandro0330/ExcepitionPersonalizada
cb8e5d700721431b30d8ed8228e91478f8732403
354b6cbb83d60c1db6f6e45f7728152cf5e66b0d
refs/heads/master
2022-07-01T18:50:38.181248
2020-05-08T05:55:07
2020-05-08T05:55:07
262,232,860
0
0
null
null
null
null
UTF-8
Java
false
false
194
java
package model.excecao; public class DominioException extends RuntimeException { private static final long serialVersionUID = 1L; public DominioException(String msg) { super(msg); } }
[ "60124712+Sandro0330@users.noreply.github.com" ]
60124712+Sandro0330@users.noreply.github.com
88a90fd134f7a8228ec1122e47c1a2f7b6278c40
2f3d06915689f6b62344d7b29fccae4603489280
/CaTsApp/app/src/main/java/com/example/catsapp/Models/UserStatus.java
626f0b62bfb9212bb4cee77ceba242544d746598
[]
no_license
Anton1636/CHATTRAP
41f5acce011a67f43c8f7d72a536d64d1ed6b449
e48a16f2a3f472585c967532499ccb16ea148005
refs/heads/main
2023-08-14T10:23:18.618170
2021-09-18T09:41:50
2021-09-18T09:41:50
383,201,675
0
0
null
null
null
null
UTF-8
Java
false
false
1,296
java
package com.example.catsapp.Models; import java.util.ArrayList; public class UserStatus { private String id, name, profileImage; private long lastUpdated; private ArrayList<Status> statuses; public UserStatus() { } public UserStatus(String id, String name, String profileImage, long lastUpdated, ArrayList<Status> statuses) { this.id = id; this.name = name; this.profileImage = profileImage; this.lastUpdated = lastUpdated; this.statuses = statuses; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getProfileImage() { return profileImage; } public void setProfileImage(String profileImage) { this.profileImage = profileImage; } public long getLastUpdated() { return lastUpdated; } public void setLastUpdated(long lastUpdated) { this.lastUpdated = lastUpdated; } public ArrayList<Status> getStatuses() { return statuses; } public void setStatuses(ArrayList<Status> statuses) { this.statuses = statuses; } }
[ "hobermac228@gmil.com" ]
hobermac228@gmil.com
57ba0afda318cea668e5d49552071c5413eb8918
e97db282c449faeb11c67d97191ee460d9a2d7dd
/demoThirtyOneProvider/src/main/java/com/example/demoThirtyOneProvider/demoThirtyOneApplication.java
363a762dd6f648171028cf720eec190b3ae9cc16
[]
no_license
gejun123456/dubboSpringbootDemo
1a95e2f025c76a639e4b41b3c497fd5ac9500b01
7ff6dfc6da1d210112ddc7c026d764a889f0e465
refs/heads/master
2020-03-23T15:43:48.087330
2018-07-21T14:21:41
2018-07-21T14:21:41
141,770,334
2
0
null
null
null
null
UTF-8
Java
false
false
488
java
package com.example.demoThirtyOneProvider; import org.springframework.boot.SpringApplication; import java.util.concurrent.CountDownLatch; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class demoThirtyOneApplication { public static void main(String[] args) throws InterruptedException{ SpringApplication.run(demoThirtyOneApplication.class, args); new CountDownLatch(1).await(); //hold住应用,防止provider退出 } }
[ "gejun123456@gmail.com" ]
gejun123456@gmail.com
dc9626e895e2d3dc5ee3f67f8799655b6328f66f
d86bbcb1bc4428aac4d4e05194e16d1d599cb6ca
/src/controller/events/PaintCanvasMouseAdapter.java
5a1fbaf78431fd8baa784a1add60ca4a160675ce
[]
no_license
moyarich/JPaint
4d22139a3322e24bc4dbb9d5470784103dd3b786
eb4e7d322ad575310ab7ae53ecf1d4764ebed293
refs/heads/main
2021-02-14T03:31:03.978400
2020-03-03T23:33:55
2020-03-03T23:33:55
244,762,982
0
1
null
null
null
null
UTF-8
Java
false
false
3,791
java
package controller.events; import model.interfaces.IApplicationState; import model.interfaces.IMode; import model.mode.DrawMode; import model.mode.MoveMode; import model.mode.SelectMode; import view.interfaces.PaintCanvasBase; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * Controls the mouse effects * <p> * calls reprint() on: * mouseReleased * mouseDragged * mouseClicked * mouseMoved * * @author Moya Richards */ public class PaintCanvasMouseAdapter extends MouseAdapter { /** * For testing: draw a demo shape on the paint canvas */ Shape drawDemoShape; private PaintCanvasBase paintCanvas; private Point startPoint, endPoint; private IApplicationState appState; private int dragStartX = 0; private int dragStartY = 0; private MoveMode moveMode = null; private boolean mouseDragged = false; public PaintCanvasMouseAdapter(PaintCanvasBase paintCanvas, IApplicationState appState) { this.paintCanvas = paintCanvas; this.appState = appState; } @Override public void mousePressed(MouseEvent e) { startPoint = e.getPoint(); endPoint = e.getPoint(); dragStartX = e.getX(); dragStartY = e.getY(); mouseDragged = false; //------------------------ System.out.println("===mousePressed " + e.getPoint() + " mode " + appState.getActiveStartAndEndPointMode()); //------------------------ } /** * Move the shape on mouse release * * @param e */ public void mouseDragged(MouseEvent e) { mouseDragged = true; //------------------------ System.out.println("===mouseDragged " + e.getPoint() + " mode " + appState.getActiveStartAndEndPointMode()); //------------------------ int currentX = e.getX(); int currentY = e.getY(); switch (appState.getActiveStartAndEndPointMode()) { case MOVE: int translateXX = currentX - dragStartX; int translateYY = currentY - dragStartY; Point transformPos = new Point(translateXX, translateYY); System.out.println("+++ =------ -dragStartX " + dragStartX + " -dragStartY " + dragStartY + " transformPos " + transformPos); /* * dragStartX, dragStartY originally contained the mouse position when it was pressed * now it must be reset to match the current movement of the mouse */ dragStartX = currentX; dragStartY = currentY; moveMode = new MoveMode(startPoint, transformPos, paintCanvas, appState); moveMode.operate(); break; } } /** * Draw the shape on mouse release * Select multiple shapes on mouse release */ @Override public void mouseReleased(MouseEvent e) { //------------------------ System.out.println("===mouseReleased " + e.getPoint() + " mode: " + appState.getActiveStartAndEndPointMode()); //------------------------ endPoint = e.getPoint(); IMode mode = null; switch (appState.getActiveStartAndEndPointMode()) { case DRAW: mode = new DrawMode(startPoint, endPoint, paintCanvas, appState); break; case SELECT: mode = new SelectMode(startPoint, endPoint, paintCanvas, appState); break; case MOVE: if (mouseDragged && moveMode != null) { moveMode.lockMovement(endPoint); } break; } if (mode != null) { mode.operate(); } } }
[ "moyarich@hotmail.com" ]
moyarich@hotmail.com
07b92539564c5891d635652a76dba45b93a200cc
21659d9a413b246622f3951ab4e250c4def430aa
/src/main/java/com/mao/util/SU.java
6c576f6e063099bb56ce482d195bd3d8d0ef483d
[]
no_license
KeepYoungerMao/keep-younger-api
cb1d1c9dea4bf353ea1f4f61143f7b90bf0da63e
248ce0b73ba414a076d77745f3ac21efb7e428e9
refs/heads/master
2022-02-18T11:59:02.426304
2019-09-12T07:03:34
2019-09-12T07:03:34
205,352,829
0
0
null
null
null
null
UTF-8
Java
false
false
26,642
java
package com.mao.util; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author mao by 18:27 2019/8/19 */ public class SU { /** * 随机字符串的默认长度 */ private static final int RANDOM_STRING_LENGTH = 32; /** * a empty string */ private static final String EMPTY = ""; /** * 身份证权重因子 */ private static final int[] POWER = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 }; /** * 手机号 正则表达式 */ private static final String PHONE_REGEX = "^((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(166)|(17[0135678])|(18[0-9])|(19[89]))\\d{8}$"; /** * Email 正则表达式 */ private static final String EMAIL_REGEX = "(?:(?:[A-Za-z0-9\\-_@!#$%&'*+/=?" + "^`{|}~]|(?:\\\\[\\x00-\\xFF]?)|(?:\"[\\x00-\\xFF]*\"))+(?:\\.(?:(?:[A-Za-z0-9\\-" + "_@!#$%&'*+/=?^`{|}~])|(?:\\\\[\\x00-\\xFF]?)|(?:\"[\\x00-\\xFF]*\"))+)*)" + "@(?:(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\\.)+" + "(?:(?:[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*)(?:[A-Za-z0-9-]*[A-Za-z0-9])?))"; /** * 判断字符串是否为空 * 仿写commons-lang3 * @param str str * @return true/false */ public static boolean isEmpty(String str){ // " " is false return null == str || str.length() == 0; } /** * 判断字符串是否不为空 * 仿写commons-lang3 * @param str str * @return true/false */ public static boolean isNotEmpty(String str){ // " " is true return null != str && str.length() > 0; } /** * 字符串转成数字,处理异常,有异常时返回-1 * @param str str * @return long */ public static long parseLong(String str){ if (isEmpty(str)) return -1; try{ return Long.parseLong(str); }catch (NumberFormatException e){ return -1; } } /** * [0-9a-z] */ private static final char[] chars = { '0','1','2','3','4','5','6','7','8','9', 'a','b','c','d','e','f','g','h','i','j', 'k','l','m','n','o','p','q','r','s','t', 'u','v','w','x','y','z'}; /** * 混淆一下code,采用交叉混淆 * @param code code * @return code */ public static String enCode(String code){ String result = ""; Random random = new Random(); for (int i = 0; i < code.length(); i++){ result += code.charAt(i); result += chars[random.nextInt(chars.length)]; } return result; } /** * 清楚混淆,取出code * @param result result * @return code */ public static String deCode(String result){ String code = ""; for (int i = 0; i < result.length(); i++){ if (i%2 == 0) code += result.charAt(i); } return code; } /** * Min-Replace:最小匹配替换 * map为替换数据,替换文本text中相同的字符串。 * 最小匹配:替换过的文本区域不能再次替换(相同区域替换次数<=1) * introduction: * 替换成功后,为该替换的字符串记录一个在文本text中的坐标(indexOf), * 当下一个替换词进来匹配替换时,判断本次替换的字符串的坐标是否在已经匹配成功的字符串的坐标的范围内, * 如果在范围内则不进行匹配。直到替换结束。 * 其中,后者匹配成功的字符串可能会对前面匹配成功的字符串的坐标有影响,因此每次匹配替换成功后, * 需要判断,该次替换的字符串的坐标的后面是否有替换成功的字符串,如果有,需要修订其坐标: * 5 6 <== 已替换的字符串区间“5-6” * 你 好 , 我 是 张 三 。 * ----------------------------- 本次替换:我 ==> 我的名字 * * 3 6 8 9 <== 上一次的区间“5-6”需要修订为“8-9” * 你 好 , 我 的 名 字 是 张 三 。 * 本次替换:名字 ==> 姓名 ==> “名字”在区间“3-6”中,不替换 * @param text text * @param map to trans * @return text which had translated */ public static String minReplace(String text, Map<String, String> map){ List<int[]> has = new ArrayList<>(); for (Map.Entry<String,String> entry : map.entrySet()){ String phase = entry.getKey(); if (text.contains(phase)){ int begin = text.indexOf(phase); int end = begin+phase.length(); boolean flag = true; if (has.size() > 0){ for (int[] i : has){ int t_begin = i[0]; int t_end = i[1]; if ( (begin > t_begin && begin < t_end) || (end > t_begin && end < t_end) ){ flag = false; break; } } } if (flag){ String trans = entry.getValue(); text = text.replaceAll(phase,trans); int step = trans.length() - phase.length(); end += step; if (has.size() > 0){ for (int[] i : has){ if (i[0] > begin){ i[0] += step; i[1] += step; } } } has.add(new int[]{begin,end}); } } } return text; } /** * Max-Replace:最大匹配替换 * 循环遍历替换的值,匹配成功后,对文本text进行替换, * 替换成功后,进行下一循环,对替换成功后的文本text再次匹配替换 * 这样可能会出现: * 1.替换后文本中有新的词汇会对后者的匹配结果产生很大的影响 * 2.匹配的顺序的不同也会对结果有很大的影响:因此建议使用LinkedHashMap作为参数 * @param text text * @param map to trans,LinkedHashMap is better * @return text which had translated */ public static String maxReplace(String text, Map<String, String> map){ for (Map.Entry<String, String> entry : map.entrySet()){ if (text.contains(entry.getKey())){ text = text.replaceAll(entry.getKey(),entry.getValue()); } } return text; } /** * get a random string * the length of the return string is the specified length. * if the specified length lass than 1: * it will throw NullPointerException * if the specified length equals the total length which length of * prefix and length of suffix length: * direct return "prefix + suffix" * if the total length greater than the specified length: * it will throw StringIndexOutOfBoundsException * the final string returned: * prefix + the random string(length:specified length - total length) + suffix * @see UUID * @param prefix prefix * @param suffix suffix * @param length length * @return random string */ public static String randomString(String prefix, String suffix, int length){ if (length <= 0) throw new NullPointerException("length must greater than 0."); int init_len = 0; if (isNotEmpty(prefix)) init_len += prefix.length(); else prefix = ""; if (isNotEmpty(suffix)) init_len += suffix.length(); else suffix = ""; if (init_len == length) return prefix + suffix; if (init_len > length) throw new StringIndexOutOfBoundsException ("Additional strings must not exceed the specified length."); return prefix + UUIDString(length - init_len) + suffix; } /** * get a random string with prefix and suffix * the length of the return string is the total length which * default length(32),length of prefix and length of suffix * @param prefix prefix * @param suffix suffix * @return random string */ public static String randomString(String prefix, String suffix){ //default length int len = RANDOM_STRING_LENGTH; if (isNotEmpty(prefix)) len += prefix.length(); if (isNotEmpty(suffix)) len += suffix.length(); return randomString(prefix, suffix,len); } /** * get a random string with a prefix. * the length of the return string is the specified length. * if the length of the prefix greater than specified length: * it will throw StringIndexOutOfBoundsException * @param prefix prefix * @param length the specified length * @return random string */ public static String randomString(String prefix, int length){ //default suffix return randomString(prefix,null,length); } /** * get a random string with a prefix * the length of the returned string is total length * which the default length(32) and the length of prefix. * @param prefix prefix * @return random string */ public static String randomString(String prefix){ //default suffix,length int len = RANDOM_STRING_LENGTH; if (isNotEmpty(prefix)) len += prefix.length(); return randomString(prefix,null,len); } /** * get a random string which specified length * the length need greater than 0. if not * it will throw NullPointerException. * @param length specified length * @return random string */ public static String randomString(int length){ //default prefix,suffix return randomString(null,null,length); } /** * get a random string * the default length is 32 * @return random string */ public static String randomString(){ //default prefix,suffix,length return randomString(null,null,RANDOM_STRING_LENGTH); } /** * get a timestamp string * @return string */ public static String timestamp(){ //system time return String.valueOf(System.currentTimeMillis()); } /** * get the UUID String which specified length. * Random String are generated by UUID Class. * the default initial length is 32, * if specified length less than it: * interception from the initial string; * if specified length greater than it: * generate a 32-initial-length string which same as the first time. * and stitching with the previous string. * until the length of the string is greater than the specified length. * @param length the specified length * @return random string */ private static String UUIDString(int length){ StringBuilder builder = new StringBuilder(); builder.append(UUIDString()); int len = RANDOM_STRING_LENGTH; while (len < length){ builder.append(UUIDString()); len += RANDOM_STRING_LENGTH; } if (len > length) return builder.substring(0,length); return builder.toString(); } /** * get the UUID String which removed "-". * @return random string */ private static String UUIDString(){ // UUID return UUID.randomUUID().toString().replaceAll("-",""); } /** * 将一个字符串进行反转 * @param str string * @throws NullPointerException if it is empty * @return string */ public static String reverse(String str){ if (isEmpty(str) || str.length() == 1) return str; int len = str.length(); char[] reverse = new char[len]; for (int i = len - 1 , j = 0 ; i >= 0 ; i -- , j ++) reverse[j] = str.charAt(i); return new String(reverse); } /** * 判断字符串是否是对称的 * 使用反转方法 * @param str str * @throws NullPointerException if it is empty * @return string */ public static boolean isSymmetric(String str){ // method reverse decide empty exception return reverse(str).equals(str); } /** * splicing an object array into a string * use the char-type separator as a chain * @param array a object-type array * @param separator a char * @return string */ public static String join(Object[] array, char separator){ int len; if (array == null || (len = array.length) < 1) return null; StringBuilder buf = new StringBuilder(len * 16); for (int i = 0 ; i < len ; i ++){ if (array[i] != null && !EMPTY.equals(array[i])){ buf.append(array[i]); if (i != len - 1){ buf.append(separator); } } } return buf.toString(); } /** * 判断字符串是否全是数字 * @param str string * @return true/false */ public static boolean isNumber(String str){ if (isEmpty(str)) return false; for (int i = 0 , len = str.length() ; i < len ; i ++) if (!Character.isDigit(str.charAt(i))) return false; return true; } public static Integer getNumber(String str){ try { return Integer.parseInt(str); } catch (NumberFormatException e) { return null; } } /** * 中国 身份证识别 * 可识别15位及18位身份证 * @param idcard IdCard * @return true/false */ public static boolean isIdCard(String idcard){ if (isEmpty(idcard)) return false; if (idcard.length() == 15){ if (!isNumber(idcard)) return false; idcard = translate15IdcardTo18Idcard(idcard); if (null == idcard) return false; } return isNumber(idcard.substring(0,idcard.length() - 1)) && validate18IdCard(idcard); } /** * translate IDCard-15 into IDCard-18 * @param idcard IDCard-15 * @return 18-IDCard or null */ private static String translate15IdcardTo18Idcard(String idcard){ //get birth String birth = idcard.substring(6,12); Date birthDate = null; try{ birthDate = new SimpleDateFormat("yyMMdd").parse(birth); }catch (ParseException e){ e.printStackTrace(); } if (null == birthDate) return null; Calendar calendar = Calendar.getInstance(); calendar.setTime(birthDate); String year = String.valueOf(calendar.get(Calendar.YEAR)); String idcard17 = idcard.substring(0,6) + year + idcard.substring(8); int[] ints =convertCharToInt(idcard17.toCharArray()); int sum17 = getPowerSum(ints); String checkCode = getCheckCodeBySum(sum17); if (null == checkCode) return null; return idcard17 + checkCode; } /** * Judging the Legitimacy of IDCard-18 * According to the stipulation of citizenship number in the national * standard GB11643-1999 of the People's Republic of China, * Citizenship number is a feature combination code, * which consists of 17-digit digital ontology code and one-digit digital check code. * The order from left to right is: six digit address code, * eight digit date of birth code, three digit sequence code and one digit check code. * sequence code: * Indicates the person born in the same year, month and day within the * area marked by the same address code. * In sequence code, odd numbers for men and even numbers for women。 * 1.前1、2位数字表示:所在省份的代码; * 1. The first 1 and 2 digits represent the code of the province in which it is located. * 2.第3、4位数字表示:所在城市的代码; * 2. The 3rd and 4th digits indicate: the code of the city in which it is located; * 3.第5、6位数字表示:所在区县的代码; * 3. Numbers 5 and 6 denote the code of the district or county in which it is located. * 4.第7~14位数字表示:出生年、月、日; * 4. Numbers 7-14 denote the year, month and day of birth; * 5.第15、16位数字表示:所在地的派出所的代码; * The fifteenth and sixteenth digits indicate the code of the police station * where it is located. * 6.第17位数字表示性别:奇数表示男性,偶数表示女性; * 6. Seventeenth digit denotes gender: odd number denotes male, even number denotes female; * 7.第18位数字是校检码:也有的说是个人信息码, * 7. The eighteenth digit is the proofreading code. * Others say it is the personal information code. * 一般是随计算机的随机产生,用来检验身份证的正确性。 * Generally, it is generated randomly with the computer to * verify the correctness of the ID card. * 校检码可以是0~9的数字,和罗马数字x表示。 * The check code can be a number of 0-9 and a Roman number X. * 第十八位数字(校验码)的计算方法为: * 1.将前面的身份证号码17位数分别乘以不同的系数。 * 从第一位到第十七位的系数分别为: * 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2 * 2.将这17位数字和系数相乘的结果相加。 * 3.用加出来和除以11,看余数是多少? * 4.余数只可能有0 1 2 3 4 5 6 7 8 9 10这11个数字。 * 其分别对应的最后一位身份证的号码为1 0 X 9 8 7 6 5 4 3 2。 * 5.通过上面得知如果余数是2,就会在身份证的第18位数字上出现罗马数字的Ⅹ。 * 如果余数是10,身份证的最后一位号码就是2。 * @param idcard ID Card * @return true/false */ private static boolean validate18IdCard(String idcard){ if (idcard.length() == 18){ String checkCode =idcard.substring(17,18); char[] chars = idcard.substring(0,17).toCharArray(); int sum17 =getPowerSum(convertCharToInt(chars)); String _checkCode =getCheckCodeBySum(sum17); return null != _checkCode && _checkCode.equals(checkCode); } return false; } /** * converting char arrays to int arrays * Used for authentication of identity cards * @param chars char arrays * @return int arrays * @throws NumberFormatException not a number */ private static int[] convertCharToInt(char[] chars) throws NumberFormatException{ int len = chars.length; int[] ints = new int[len]; for (int i = 0 ; i < len ; i ++){ ints[i] = Integer.parseInt(String.valueOf(chars[i])); } return ints; } /** * get the 18th Bit Check Code in the Id Card Number * Used for authentication of identity cards * @param sum the sum of Weighting factors * @return Bit Check Code */ private static String getCheckCodeBySum(int sum){ switch (sum%11){ case 10: return "2"; case 9: return "3"; case 8: return "4"; case 7: return "5"; case 6: return "6"; case 5: return "7"; case 4: return "8"; case 3: return "9"; case 2: return "x"; case 1: return "0"; case 0: return "1"; default: return null; } } /** * the sum of Weighting factors * Used for authentication of identity cards * @param ints Weighting factors * @return int */ private static int getPowerSum(int[] ints){ int sum = 0; int len = ints.length; if (POWER.length != len) return sum; for (int i = 0 ; i < len ; i ++ ) sum += ints[i] * POWER[i]; return sum; } /** * Determine whether a string is a cell phone number * China Telecom:133,149,153,173,177,180,181,189,199 * China Unicom:130,131,132,145,155,156,166,175,176,185,186 * China Mobile:134(0-8),13(5-9),147,15(0-2),15(7-9),178,18(2-4),187,188,198 * @param phone phone number * @return true/false * @since 2019/03 */ public static boolean isPhone(String phone){ if (phone.length() == 11){ Pattern pattern = Pattern.compile(PHONE_REGEX); Matcher matcher = pattern.matcher(phone); return matcher.matches(); } return false; } /** * Verify the correctness of Email * validation rule:RFC 5322 * user name * 1.ALLOW:A-Z,a-z,0-9,.-_@!#$%&'*+/=?^{}|~ * 2.ALLOW:ASCII char(including Control-char). * 3.[.] can not appear at the beginning or end,Can't be next to each other more than two. * domain name * 1. ONLY ALLOW:A-Z,a-z,0-9,-(this one can not appear at the beginning or end). * 2. Top-level domain name cannot be all digital. * 3. at least have a secondary domain name. * @param email email * @return true/false */ public static boolean isEmail(String email){ Pattern pattern = Pattern.compile(EMAIL_REGEX); Matcher matcher = pattern.matcher(email); return matcher.matches(); } /** * get message from idcard * 0-5 : home address * 6-13 : birth * 16-17: sex * attention: home_address need search from MySQL * only return address_code to User's home_address field * //@param idcard Identity card * //@return User */ /*public static User getMsgFromIdcard(String idcard){ if (isIdCard(idcard)){ try{ String address_code = idcard.substring(0,6); User user = new User(); user.setHome_address(address_code); Date birth = stringToDate(idcard.substring(6,14)); user.setBirth(birth); user.setAge(getAgeFromBirth(birth)); user.setSex(parserSex(idcard.substring(16,17))); return user; }catch (Exception e){ e.printStackTrace(); return null; } } return null; }*/ /** * String to Date * 错误解析:起初使用 * LocalDateTime time = LocalDateTime.parse(reg,df); * 报错 * @param reg String * @return Date */ private static Date stringToDate(String reg){ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMdd"); LocalDate time = LocalDate.parse(reg,df); return localDateTimeToDate(time); } /** * Date 转 String * @param date Date * @return String */ public static String dateToString(Date date){ Instant instant = date.toInstant(); ZoneId zoneId = ZoneId.systemDefault(); LocalDateTime localDateTime = LocalDateTime.ofInstant(instant,zoneId); DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd"); return df.format(localDateTime); } /** * LocalDateTime to Date * @param time LocalDateTime time * @see LocalDateTime * @return Date time */ private static Date localDateTimeToDate(LocalDate time){ ZoneId zoneId = ZoneId.systemDefault(); Instant instant = time.atStartOfDay().atZone(zoneId).toInstant(); return Date.from(instant); } /** * parser sex from the 17th number of Identity card * @param reg the 17th number * @return sex */ private static String parserSex(String reg){ return ((Integer.parseInt(reg)) % 2 != 0) ? "男" : "女"; } /** * get age from birth * @param birth birth Date * @return age */ private static int getAgeFromBirth(Date birth){ Calendar cal = Calendar.getInstance(); if (cal.before(birth)) { throw new IllegalArgumentException( "The birthDay is before Now.It's unbelievable!"); } int yearNow = cal.get(Calendar.YEAR); int monthNow = cal.get(Calendar.MONTH); int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH); cal.setTime(birth); int yearBirth = cal.get(Calendar.YEAR); int monthBirth = cal.get(Calendar.MONTH); int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH); int age = yearNow - yearBirth; if (monthNow <= monthBirth) { if (monthNow == monthBirth) { if (dayOfMonthNow < dayOfMonthBirth) age--; }else{ age--; } } return age; } /** * 给文本增加 p 标签 * 变成 H5可读文本 * @param str 文本数据 * @return str */ public static String addP(String str){ if (isEmpty(str)) return null; StringBuilder sb = new StringBuilder(); if (str.contains("\r\n")){ String[] split = str.split("\r\n"); for (String s : split) { if (isNotEmpty(s)){ sb.append("<p>"); sb.append(s); sb.append("</p>"); } } } return sb.toString(); } /** * 根据字符串获取enum的Enum类型 * @param t Enum类 * @param type 字符串 * @param <T> Enum类 * @return Enum类 */ public static <T extends Enum<T>> T getType(Class<T> t, String type){ try { return Enum.valueOf(t,type); } catch (Exception e) { return null; } } public static void main(String[] args) { //String a = "-abs-c"; //a = a.replaceFirst("-",""); System.out.println(Integer.parseInt("-20")); } }
[ "maozx@dayiai.com" ]
maozx@dayiai.com
867fdd8a584c3bf76cfcb0550eac23f60f6cafdb
dd3ad0f28bb8bd5641e41fa75cf93e5a3bc51015
/asset-tests/app/src/androidTest/java/com/samsungxr/tester/AssetLightTests.java
492a4bcee5c20415a086049f21d365bfc34165e5
[]
no_license
ragner/sxrsdk-tests
56d0e787cc53912aed440e59275ab0f58ab24402
9c735f2d98cac5cf56ac8168c1953113bfb3c5f4
refs/heads/master
2020-04-07T18:04:09.192656
2018-11-16T15:27:26
2018-11-16T15:27:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,412
java
package com.samsungxr.tester; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import net.jodah.concurrentunit.Waiter; import com.samsungxr.SXRContext; import com.samsungxr.SXRDirectLight; import com.samsungxr.SXRLight; import com.samsungxr.SXRMaterial; import com.samsungxr.SXRScene; import com.samsungxr.SXRNode; import com.samsungxr.nodes.SXRCubeNode; import com.samsungxr.unittestutils.SXRTestUtils; import com.samsungxr.unittestutils.SXRTestableActivity; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.util.List; import java.util.concurrent.TimeoutException; @RunWith(AndroidJUnit4.class) public class AssetLightTests { private static final String TAG = AssetLightTests.class.getSimpleName(); private SXRTestUtils mTestUtils; private Waiter mWaiter; private SXRNode mRoot; private SXRNode mBackground; private boolean mDoCompare = true; private AssetEventHandler mHandler; @Rule public ActivityTestRule<SXRTestableActivity> ActivityRule = new ActivityTestRule<SXRTestableActivity>(SXRTestableActivity.class); @After public void tearDown() { SXRScene scene = mTestUtils.getMainScene(); if (scene != null) { scene.clear(); } } @Before public void setUp() throws TimeoutException { SXRTestableActivity activity = ActivityRule.getActivity(); mTestUtils = new SXRTestUtils(activity); mTestUtils.waitForOnInit(); mWaiter = new Waiter(); SXRContext ctx = mTestUtils.getSxrContext(); SXRScene scene = mTestUtils.getMainScene(); mWaiter.assertNotNull(scene); mBackground = new SXRCubeNode(ctx, false, new SXRMaterial(ctx, SXRMaterial.SXRShaderType.Phong.ID)); mBackground.getTransform().setScale(10, 10, 10); mBackground.setName("background"); mRoot = scene.getRoot(); mWaiter.assertNotNull(mRoot); mHandler = new AssetEventHandler(scene, mWaiter, mTestUtils, getClass().getSimpleName()); } @Test public void jassimpCubeDiffuseDirectional() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_diffuse_directionallight.fbx", 1, 0, "jassimpCubeDiffuseDirectional"); } @Test public void jassimpCubeDiffusePoint() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_diffuse_pointlight.fbx", 1, 0, "jassimpCubeDiffusePoint"); } @Test public void jassimpCubeDiffuseSpot() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_diffuse_spotlight.fbx", 1, 0, "jassimpCubeDiffuseSpot"); } @Test public void jassimpCubeDiffuseSpotLinearDecay() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_diffuse_spotlight_linear.fbx", 1, 0, "jassimpCubeDiffuseSpotLinearDecay"); } @Test public void jassimpCubeDiffuseSpotLinearDecay9() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_diffuse_spotlight_linear9.fbx", 1, 0, "jassimpCubeDiffuseSpotLinearDecay9"); } @Test public void jassimpCubeNormalDiffuseAmbient() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_normal_diffuse_ambientlight.fbx", 2, 0, "jassimpCubeNormalDiffuseAmbient"); } @Test public void jassimpCubeNormalDiffuseDirect() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_normal_diffuse_directionallight.fbx", 2, 0, "jassimpCubeNormalDiffuseDirect"); } @Test public void jassimpCubeNormalDiffusePoint() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_normal_diffuse_pointlights.fbx", 2, 0, "jassimpCubeNormalDiffusePoint"); } @Test public void jassimpCubeNormalDiffuseSpot() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_normal_diffuse_spotlight.fbx", 2, 0, "jassimpCubeNormalDiffuseSpot"); } @Test public void jassimpCubeNormalDiffuseSpotLinearDecay() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_normal_diffuse_spotlight_linear_decay.fbx", 2, 0, "jassimpCubeNormalDiffuseSpotLinearDecay"); } @Test public void jassimpCubeNormalDiffuseSpotQuadraticDecay() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_normal_diffuse_spotlight_quadratic_decay.fbx", 2, 0, "jassimpCubeNormalDiffuseSpotQuadraticDecay"); } @Test public void jassimpCubeAmbientTexture() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_ambient_texture.fbx", 1, 0, "jassimpCubeAmbientTexture"); } @Test public void jassimpCubeAmbientSpecularTexture() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/cube/cube_ambient_specular_texture.fbx", 2, 0, "jassimpCubeAmbientSpecularTexture"); } @Test public void x3dPointLight1() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/lighting/pointlightsimple.x3d", 1, 0, "x3dPoint1"); } @Test public void x3dPointLight2() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/lighting/pointlighttest.x3d", 2, 0, "x3dPoint2"); } @Test public void x3dPointLightAttenuation() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/lighting/pointlightattenuationtest.x3d", 3, 0, "x3dPointLightAttenuation"); } @Test public void x3dMultiplePoints() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/lighting/pointlightmultilights.x3d", 4, 0, "x3dMultiplePoints"); } @Test public void x3dDirectLight() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/lighting/directionallight1.x3d", 4, 0, "x3dDirectLight"); } @Test public void x3dSpotLight1() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/lighting/spotlighttest1.x3d", 4, 0, "x3dSpotLight1"); } @Test public void x3dSpotLight2() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/lighting/spotlighttest2.x3d", 4, 0, "x3dSpotLight2"); } @Test public void x3dSpotLight3() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/lighting/spotlighttest3.x3d", 4, 0, "x3dSpotLight3"); } @Test public void x3dSpotLight4() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/lighting/spotlighttest4.x3d", 4, 0, "x3dSpotLight4"); } @Test public void x3dGenerateNormalsPoint() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "x3d/generate_normals/nonormalswithptlights.x3d", 2, 0, "x3dGenerateNormalsPoint"); } @Test public void x3dShininess() throws TimeoutException { mHandler.loadTestModel("x3d/teapotandtorus_AddPtLt.x3d", 2, 0, "x3dShininess"); } @Test public void testAddLight() throws TimeoutException { mHandler.loadTestModel(SXRTestUtils.GITHUB_URL + "jassimp/animals/wolf-obj.obj", 3, 0, null); mTestUtils.waitForXFrames(2); SXRContext ctx = mTestUtils.getSxrContext(); SXRScene scene = mTestUtils.getMainScene(); SXRDirectLight light1 = new SXRDirectLight(ctx); SXRDirectLight light2 = new SXRDirectLight(ctx); SXRNode topLight = new SXRNode(ctx); light1.setDiffuseIntensity(1, 1, 0.5f, 1); topLight.attachComponent(light2); topLight.getTransform().rotateByAxis(-90.0f, 1, 0, 0); topLight.getTransform().setPositionY(1.0f); scene.addNode(topLight); scene.getMainCameraRig().getHeadTransformObject().attachComponent(light1); mTestUtils.waitForXFrames(4); mTestUtils.screenShot(getClass().getSimpleName(), "testAddLight", mWaiter, mDoCompare); } @Test public void testRemoveLight() throws TimeoutException { SXRNode model = mHandler.loadTestModel("jassimp/astro_boy.dae", 4, 0, null); mTestUtils.waitForXFrames(2); List<SXRLight> lights = model.getAllComponents(SXRLight.getComponentType()); for (SXRLight l : lights) { l.getOwnerObject().detachComponent(SXRLight.getComponentType()); } mTestUtils.waitForXFrames(4); mTestUtils.screenShot(getClass().getSimpleName(), "testRemoveLight", mWaiter, mDoCompare); } /* @Test public void VRBenchmark() throws TimeoutException { SXRNode model = loadTestModel("sd:GearVRF/benchmark_assets/TestShadowNew.FBX", 2, 0, null); model.getTransform().rotateByAxis(90, 0, 1, 0); model.getTransform().setPosition(0, -0.5f, 0); mTestUtils.waitForXFrames(2000); } */ }
[ "m.marinov@samsung.com" ]
m.marinov@samsung.com
f6957f9a4a12dfecc376158271ce8c130730182b
ff71e9f1c8eb3b128f9e0ce605b34b06a834b448
/app/build/generated/source/r/androidTest/debug/settings/androidhive/info/purplefoody/test/R.java
805dd390e8c2ddd257df0b96ae2d13251dc85258
[]
no_license
Oboob/Purple-Foody
f8732c89d8ec2e6f7e5b3015a116235309579cd3
d8e030c31118a933ea0910d86b1c838aec5978d2
refs/heads/master
2021-05-14T23:36:04.979577
2017-09-22T10:30:13
2017-09-22T10:30:13
104,458,521
0
0
null
null
null
null
UTF-8
Java
false
false
401
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package settings.androidhive.info.purplefoody.test; public final class R { public static final class attr { } public static final class string { public static final int app_name=0x7f020000; } }
[ "thuantran9645@gmail.com" ]
thuantran9645@gmail.com
b6e1be1faee80707f25eae809dc0e228bb1a125f
61937f46b98a5c4281479331b2366fce5833efd1
/src/main/java/lk/mongo_with_spring/asset/dish_restaurant_branch/enums/DishRestaurantBranchStatus.java
93b66545c7175dbf3f64793f4f57d780cd897b31
[]
no_license
Developers-In/mongo_with_spring
56584ba0ac706b56366eea2f5b4f4e45e0d5e3c2
dabc29979e5b368c1027cd178b31525b8b4f5fa0
refs/heads/master
2023-03-12T09:12:59.116795
2021-03-01T14:00:16
2021-03-01T14:00:16
342,462,449
0
0
null
null
null
null
UTF-8
Java
false
false
204
java
package lk.mongo_with_spring.asset.dish_restaurant_branch.enums; import lombok.Getter; @Getter public enum DishRestaurantBranchStatus { //todo => take more status to here AVAILABLE, SUSPEND,BLOCK }
[ "asakahatapitiya@gmail.com" ]
asakahatapitiya@gmail.com
a7c54137219e7d1812f23718ed9d98d8c8afde9d
a8f4be578a63a9756804629445ab41f070265c66
/src/main/java/com/zheng/socket/netty/echo/fixlength/FixedEchoServerHandler.java
f5f1114d940fa267ccdf4fef5064e12099997452
[]
no_license
zl736732419/socket-study
a4f2816e5403635c38ca479678499c422e984764
40c69b043a0e0f39da26a18653df1d84d6ed4ea9
refs/heads/master
2021-08-11T06:23:10.446237
2017-11-13T08:02:58
2017-11-13T08:02:58
107,235,561
0
0
null
null
null
null
UTF-8
Java
false
false
978
java
package com.zheng.socket.netty.echo.fixlength; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerAdapter; import io.netty.channel.ChannelHandlerContext; import java.nio.charset.StandardCharsets; /** * @Author zhenglian * @Date 2017/11/13 13:53 */ public class FixedEchoServerHandler extends ChannelHandlerAdapter { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { String body = (String) msg; System.out.println("server recieve command: " + body); ByteBuf response = Unpooled.copiedBuffer(body.getBytes(StandardCharsets.UTF_8)); ctx.writeAndFlush(response); } @Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { ctx.flush(); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { ctx.close(); } }
[ "736732419@qq.com" ]
736732419@qq.com
d4959b3fecef3ba6b64699760bff3232d6e9a676
8e862068f333039252c5ab5178ea295da0f127cc
/Hello world.java
f6f62306cab5cbacec194aad102796051ffc491b
[]
no_license
vishal-webdvlp/hello-world
d5b3bbb4dd3cfa42ee184c81fa77db54af8b2e4e
dcd2a6236ecc132689011c6b3946d96034e8868e
refs/heads/master
2020-07-09T02:22:48.433507
2019-08-22T18:12:43
2019-08-22T18:12:43
203,848,266
0
0
null
null
null
null
UTF-8
Java
false
false
98
java
Class Hello{ public void static main(String [] args) { System.out.println("hello world"): } }
[ "noreply@github.com" ]
noreply@github.com
a17b0a6473ed135c9e251bb982834af170e53497
54064ae92211e13707ccb995253f8623c7db1dcc
/javacode/javaweb-maven-01/javaweb-filter-listener/src/main/java/org/yyds/servlet/ServletDemo01.java
5398c34dc70b22f02d2a55230b4f605c988f6173
[]
no_license
yyds2333/practiceCode
7b2d1a87694f5f6e8fe4b3f1e0368c14bf52eae4
967030e26cd31e282121f215c2d5e3292ba657b2
refs/heads/master
2023-07-26T17:12:55.469592
2021-09-03T12:54:54
2021-09-03T12:54:54
402,771,135
1
0
null
null
null
null
UTF-8
Java
false
false
628
java
package org.yyds.servlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class ServletDemo01 extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setAttribute("name", "永远都是你"); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } }
[ "1379685425@qq.com" ]
1379685425@qq.com
6b2d21e3e79d9db5d733114dc1d8f0b1e91ac930
33e66b744a7ffd608ab8c16b6b036de943d6582f
/app/src/main/java/com/example/chen/myanimator/PermissionService.java
ceec71cac2116d0ded3fbd85a38943fbe6dca76f
[]
no_license
JoinChen/MyAnimator
0704453beb5ecd70b267fd89b5bb3ccc8682443b
cfa4a5671ee2aa9ea39b245794854b248b040c98
refs/heads/master
2020-03-17T05:45:01.767661
2018-05-14T08:15:21
2018-05-14T08:15:21
133,327,422
0
0
null
null
null
null
UTF-8
Java
false
false
2,089
java
package com.example.chen.myanimator; import android.Manifest; import android.app.Service; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.support.annotation.Nullable; import android.widget.Toast; import com.ninetripods.aopermission.permissionlib.annotation.NeedPermission; import com.ninetripods.aopermission.permissionlib.annotation.PermissionCanceled; import com.ninetripods.aopermission.permissionlib.annotation.PermissionDenied; import com.ninetripods.aopermission.permissionlib.bean.CancelBean; import com.ninetripods.aopermission.permissionlib.bean.DenyBean; import com.ninetripods.aopermission.permissionlib.util.PermissionUtil; import com.ninetripods.aopermission.permissionlib.util.SettingUtil; /** * Created by chen on 2018/4/18. */ public class PermissionService extends Service { public PermissionService() { } @Nullable @Override public IBinder onBind(Intent intent) { return (IBinder) new UnsupportedOperationException("Not yet implemented"); } @Override public void onCreate() { super.onCreate(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { new Handler().postDelayed(new Runnable() { @Override public void run() { requestCamera(); } },500); return super.onStartCommand(intent, flags, startId); } @NeedPermission(value = Manifest.permission.CAMERA,requestCode = 1) public void requestCamera(){ Toast.makeText(PermissionService.this,"相机权限请求成功",Toast.LENGTH_SHORT).show(); } @PermissionDenied public void refusedCallBack(DenyBean denyBean){ Toast.makeText(PermissionService.this,"相机权限已被禁止",Toast.LENGTH_SHORT).show(); SettingUtil.go2Setting(PermissionService.this); } @PermissionCanceled public void cancleCallBack(CancelBean cancelBean){ Toast.makeText(PermissionService.this,"相机权限已被取消",Toast.LENGTH_SHORT).show(); } }
[ "1432560150@qq.com" ]
1432560150@qq.com
0c8554330bb7c7d27d450c0d97633b6bba31d052
3cf7d5b2b9f62432aacf9ed59dccfae170543c09
/TaobaoShopDemo/app/src/main/java/com/example/taobaoshopdemo/adapter/decoration/DividerGridItemDecoration.java
720e0d3c1c27db5f3584a1e40b7061ad09d57a29
[]
no_license
WWWWilson/TaobaoShopDemo
692004b20181b127b4c939b1fce17dcab4b57fe9
45cbe570199a09414b5cf7a2ce14928c353f78be
refs/heads/master
2023-03-10T22:30:54.916711
2021-02-19T08:34:39
2021-02-19T08:34:39
340,305,300
0
0
null
null
null
null
UTF-8
Java
false
false
6,485
java
package com.example.taobaoshopdemo.adapter.decoration; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.view.View; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.StaggeredGridLayoutManager; public class DividerGridItemDecoration extends RecyclerView.ItemDecoration { private static final int[] ATTRS = new int[] { android.R.attr.listDivider }; private Drawable mDivider; public DividerGridItemDecoration(Context context) { final TypedArray a = context.obtainStyledAttributes(ATTRS); mDivider = a.getDrawable(0); a.recycle(); } @Override public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { drawHorizontal(c, parent); drawVertical(c, parent); } private int getSpanCount(RecyclerView parent) { // 列数 int spanCount = -1; RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); if (layoutManager instanceof GridLayoutManager) { spanCount = ((GridLayoutManager) layoutManager).getSpanCount(); } else if (layoutManager instanceof StaggeredGridLayoutManager) { spanCount = ((StaggeredGridLayoutManager) layoutManager) .getSpanCount(); } return spanCount; } public void drawHorizontal(Canvas c, RecyclerView parent) { int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child .getLayoutParams(); final int left = child.getLeft() - params.leftMargin; final int right = child.getRight() + params.rightMargin + mDivider.getIntrinsicWidth(); final int top = child.getBottom() + params.bottomMargin; final int bottom = top + mDivider.getIntrinsicHeight(); mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } } public void drawVertical(Canvas c, RecyclerView parent) { final int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child .getLayoutParams(); final int top = child.getTop() - params.topMargin; final int bottom = child.getBottom() + params.bottomMargin; final int left = child.getRight() + params.rightMargin; final int right = left + mDivider.getIntrinsicWidth(); mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } } private boolean isLastColum(RecyclerView parent, int pos, int spanCount, int childCount) { RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); if (layoutManager instanceof GridLayoutManager) { if ((pos + 1) % spanCount == 0)// 如果是最后一列,则不需要绘制右边 { return true; } } else if (layoutManager instanceof StaggeredGridLayoutManager) { int orientation = ((StaggeredGridLayoutManager) layoutManager) .getOrientation(); if (orientation == StaggeredGridLayoutManager.VERTICAL) { if ((pos + 1) % spanCount == 0)// 如果是最后一列,则不需要绘制右边 { return true; } } else { childCount = childCount - childCount % spanCount; if (pos >= childCount)// 如果是最后一列,则不需要绘制右边 return true; } } return false; } private boolean isLastRaw(RecyclerView parent, int pos, int spanCount, int childCount) { RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); if (layoutManager instanceof GridLayoutManager) { childCount = childCount - childCount % spanCount; if (pos >= childCount)// 如果是最后一行,则不需要绘制底部 return true; } else if (layoutManager instanceof StaggeredGridLayoutManager) { int orientation = ((StaggeredGridLayoutManager) layoutManager) .getOrientation(); // StaggeredGridLayoutManager 且纵向滚动 if (orientation == StaggeredGridLayoutManager.VERTICAL) { childCount = childCount - childCount % spanCount; // 如果是最后一行,则不需要绘制底部 if (pos >= childCount) return true; } else // StaggeredGridLayoutManager 且横向滚动 { // 如果是最后一行,则不需要绘制底部 if ((pos + 1) % spanCount == 0) { return true; } } } return false; } @Override public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) { int spanCount = getSpanCount(parent); int childCount = parent.getAdapter().getItemCount(); if (isLastRaw(parent, itemPosition, spanCount, childCount))// 如果是最后一行,则不需要绘制底部 { outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); } else if (isLastColum(parent, itemPosition, spanCount, childCount))// 如果是最后一列,则不需要绘制右边 { outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); } else { outRect.set(0, 0, mDivider.getIntrinsicWidth(), mDivider.getIntrinsicHeight()); } } }
[ "shen13299032593@163.com" ]
shen13299032593@163.com
b853f6afc9a1717cacd6865813f0063bce862428
2be1d80591c9758226c4b57f86d78023c68725ab
/OneWireLights.java
2043c2c921cc9868750824b20b2604ddb6dff52c
[ "MIT" ]
permissive
adinardi/csh-drink-tini
4a7cd03cc10d9ea631a89037fe4ed163c8a14103
44c9d7d0094e13965c1a9e7c069e83b1129bd7e9
refs/heads/master
2020-05-17T15:55:29.847854
2009-04-18T06:52:47
2009-04-18T06:52:47
179,127
2
1
null
null
null
null
UTF-8
Java
false
false
2,088
java
import com.dalsemi.onewire.*; import com.dalsemi.onewire.adapter.*; import com.dalsemi.onewire.container.*; class OneWireLights { /** * 1-Wire bus adapter */ private DSPortAdapter adapter = null; /** * 1-Wire IDs of the switches */ protected String[] lights = ConfigMgr.getInstance().getLights(); private static OneWireLights instance = null; public synchronized static OneWireLights getInstance() { if( instance == null ) { instance = new OneWireLights(); } return instance; } private OneWireLights() { try { this.adapter = OneWireAccessProvider.getDefaultAdapter(); }catch( Exception e ) { System.out.println( "Oh Snap. Can't get adapter." ); } } /** * Get the OneWireContainer associated with the given 1-Wire id * * @param id 1-Wire Device ID to fetch * * @return OneWireContainer corresponding to the 1-wire id */ protected OneWireContainer05 getSwitch( String id ) { System.out.println( "Getting Light: " + id ); OneWireContainer owc = this.adapter.getDeviceContainer( id ); if( owc instanceof OneWireContainer05 ) { return (OneWireContainer05) owc; } else { return null; } } /** * Set the status light of a slot * * @param slot Slot number to change light for * @param empty Empty status to set light to (true = on) */ public void slotStatus( int slot, boolean empty) { //if we don't have any lights loaded in, don't do anything. if( lights == null ) { return; } OneWireContainer05 owc = getSwitch( lights[slot] ); try { byte[] state = owc.readDevice(); owc.setLatchState( 0, empty, false, state ); owc.writeDevice( state ); } catch ( Exception e ) { System.out.println( "Error Setting Slot Status Light" ); e.printStackTrace(); } } }
[ "adinardi@e1c6a677-3c05-0410-8139-d630aaec0cf4" ]
adinardi@e1c6a677-3c05-0410-8139-d630aaec0cf4
4d9729fc6ee0f9dba9f1ff1146e648cb21f3f992
f8909d391dd52654f4459faf9e5783f15a77c8e5
/Homework/Lab 7/src/MyDoubleNode.java
1f1ffffb22b85901eebcb4fef6b5fbd2e7d796c1
[]
no_license
rajatkuthiala/CSC-172
b77c00304cb497d8d6a9b0b6b0ab4b1365fe0a0b
24c6fb2201128bdba2498aa7b63910e191c9e902
refs/heads/master
2021-03-19T16:32:52.995991
2017-03-20T19:58:57
2017-03-20T19:58:57
80,461,360
0
0
null
null
null
null
UTF-8
Java
false
false
368
java
/* * Rajat Kuthiala * LAB-7 * CSC-172 * TA: Shuyang Liu * Partner: Jordy * * I affirm that I have not given * or received any unauthorized help * on this assignment, and that this * work is my own. */ public class MyDoubleNode<AnyType> { public AnyType data; public MyDoubleNode<AnyType> next; public MyDoubleNode<AnyType> prev; }
[ "rajatkuthiala@gmail.com" ]
rajatkuthiala@gmail.com
24c41dae63787f80fec320f084f7329df189c3a0
368621f5f93b942fcd20039c83c74fb32954fc24
/Selenium_basic/src/test_suites/package-info.java
6701db6a0838eab0556a8be90ea9640b7c4992de
[]
no_license
praveendvd/SeleniumJava-Draw_canvas
bef2d21b1af4978a89a9306bc3292b37d6f4ac72
d5f49002447db250987c4d464cf5db48f7818af3
refs/heads/master
2023-03-28T08:07:29.764723
2020-06-16T13:55:35
2020-06-16T13:55:35
268,536,562
3
2
null
2021-03-31T22:00:15
2020-06-01T13:54:37
Java
UTF-8
Java
false
false
20
java
package test_suites;
[ "praveendvd@live.com" ]
praveendvd@live.com
955edaf7b08c5dafc9f50af0f9e405d3bef73b37
f648260f1cb7b4195a251917d887fc9d31fd30d2
/app/src/main/java/ua/kh/tremtyachiy/mylist/DrawerMenu.java
265e60b7af68551cca4324344b361b9e2b32b8b8
[]
no_license
mrsnoopy86/MyList
f1de8f47d667d29b1a366d3b6cd389d89233f58d
ee1a076059d81e3fca18b0ab596c1a0914db8087
refs/heads/master
2021-01-01T20:17:22.104897
2015-06-23T11:33:11
2015-06-23T11:33:11
37,662,976
1
0
null
null
null
null
UTF-8
Java
false
false
2,868
java
package ua.kh.tremtyachiy.mylist; import android.app.Activity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.AdapterView; import com.mikepenz.materialdrawer.Drawer; import com.mikepenz.materialdrawer.DrawerBuilder; import com.mikepenz.materialdrawer.model.DividerDrawerItem; import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; /** * Created by User on 19.06.2015. */ public class DrawerMenu { private Drawer drawerMenu; public Drawer getDrawerMenu() { return drawerMenu; } public void initDrawerMenu(final Activity activity, Toolbar toolbar){ drawerMenu = new DrawerBuilder() .withToolbar(toolbar) .withDisplayBelowToolbar(true) .withActionBarDrawerToggleAnimated(true) .withActivity(activity) .addDrawerItems( new SecondaryDrawerItem() .withIcon(R.drawable.ic_settings_white_24dp) .withName(R.string.nav_menu_item1) .withIdentifier(1), new DividerDrawerItem(), new SecondaryDrawerItem() .withName(R.string.nav_menu_item2) .withIcon(R.drawable.ic_announcement_white_24dp) .withIdentifier(2), new SecondaryDrawerItem() .withName(R.string.nav_menu_item3) .withIcon(R.drawable.ic_supervisor_account_white_24dp) .withIdentifier(3), new SecondaryDrawerItem() .withName(R.string.nav_menu_item4) .withIcon(R.drawable.ic_live_help_white_24dp) .withIdentifier(4), new DividerDrawerItem(), new SecondaryDrawerItem() .withName(R.string.nav_menu_item5) .withIcon(R.drawable.ic_exit_to_app_white_24dp) .withIdentifier(5)) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(AdapterView<?> adapterView, View view, int i, long l, IDrawerItem iDrawerItem) { switch (iDrawerItem.getIdentifier()) { case 5: activity.finish(); break; } return true; } }) .build(); } }
[ "tremtyachiy@gmail.com" ]
tremtyachiy@gmail.com
1cbd13f3c116395531e44204350a94db3b9b4b09
c7f3102cf33b875414c512c2a6e7334d2ab6683d
/Project/Project/src/com/montran/action/BookDetailsAction.java
9622dc34332c51ce2d8f1d984d36b3160a9d02cc
[]
no_license
Poournima/Assignments
e00bbdb0a3fcfb8ef58a64a8fcdcb40d088b2667
661c750093b38c84b72ae48566ffbd482852391d
refs/heads/master
2022-12-11T08:06:18.784900
2020-08-19T19:01:47
2020-08-19T19:01:47
282,427,109
0
0
null
null
null
null
UTF-8
Java
false
false
1,018
java
package com.montran.action; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.montran.dao.BookDAO; import com.montran.pojo.Book_issue_return; import com.montran.pojo.Member_master; import com.montran.pojo.*; public class BookDetailsAction extends Action{ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println("in execute"); BookDAO dao = new BookDAO(); Member_master member=new Member_master(); Book_master book=new Book_master(); List<Book_issue_return> bookList = dao.getAllDetails(); request.setAttribute("books", bookList); return mapping.findForward("success"); } }
[ "noreply@github.com" ]
noreply@github.com
af96b9588c8d661a28fcd29b0e216433676cc097
733252a5f8b7dde1fd59c8980c5cd4de2491453a
/src/day13_newSubject/Assigment.java
d1d59fd35ffa7ff3308e645b79a74d3f4aac32b3
[]
no_license
shnayla71/Spring2020B18_Java1
b53dbab3f56fc931d10bca77c96d9b84b6f8c6a5
89d9056c2bfad00b80cb733b869e1f639832d879
refs/heads/master
2022-12-02T19:24:27.358444
2020-08-20T23:28:57
2020-08-20T23:28:57
258,926,796
0
0
null
null
null
null
UTF-8
Java
false
false
829
java
package day13_newSubject; import java.util.Scanner; public class Assigment { /* input :cybertek prints only itials school output :CS */ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter your full name"); String fullName = input.nextLine(); // cybertek school String firstName = fullName.substring(0, fullName.indexOf(" ") ); String lastName = fullName.substring(fullName.indexOf(" ")+1 ); // School //cYbeRTEK System.out.println(firstName); System.out.println(lastName); firstName = firstName.substring(0,1).toUpperCase(); lastName = lastName.substring(0,1).toUpperCase(); System.out.println(firstName+lastName); } }
[ "shnayla71" ]
shnayla71
89d4364fc18d95550ddd9e6ae5e5641b2d79d55b
e88215712898c8faad7aa4b7b7278cbb3a47e162
/src/com/eoulu/dao/FumigationDao.java
c53a5caf1fb9aba378374210d7e898af1fc25598
[]
no_license
LGDHuaOPER/HuaFEEng_Goose
f482fff96aaf8d1910b3ee11a181d8423c276b9b
318ca4377a0d37c9dcebb925456591ddf264e23d
refs/heads/master
2020-03-27T23:12:46.256068
2018-09-29T10:13:27
2018-09-29T10:13:27
147,301,655
2
1
null
null
null
null
UTF-8
Java
false
false
3,527
java
package com.eoulu.dao; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; import com.eoulu.commonality.Page; import com.eoulu.entity.Fumigation; import com.eoulu.util.DBUtil; public class FumigationDao { /** * 分页查询 * @param page * @return */ public List<Map<String,Object>> getFumigation(Page page){ List<Map<String, Object>> ls = null; DBUtil db = new DBUtil(); String sql= "select t_order.Customer,t_order.ContractTitle,t_fumigation_certificate.ContractNO,t_fumigation_certificate.Date," + "t_fumigation_certificate.DCNO,t_fumigation_certificate.ID,t_fumigation_certificate.PONO " + "from t_fumigation_certificate left join t_order on t_fumigation_certificate.ContractNO=t_order.ContractNo " + "order by t_fumigation_certificate.OperatingTime desc limit ?,?"; Object[] parameter = new Object[]{(page.getCurrentPage()-1)*page.getRows(),page.getRows()}; ls = db.QueryToList(sql, parameter); return ls; } /** * 总数量 * @return */ public int getAllCounts(){ int counts = 0; DBUtil db = new DBUtil(); String sql = "select count(ID) ? from t_fumigation_certificate order by OperatingTime desc"; Object[] parameter = new Object[]{"AllCounts"}; List<Map<String, Object>> ls = db.QueryToList(sql, parameter); if(ls.size()>1) counts = Integer.parseInt(ls.get(1).get(ls.get(0).get("col1")).toString()); return counts; } /** * 添加 * @param invoice * @param db * @return */ public boolean insert(Fumigation fumigation ){ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DBUtil db = new DBUtil(); boolean flag = false; Object[] parameter = new Object[5]; String sql = "insert into t_fumigation_certificate (ContractNO,Date,DCNO,PONO,OperatingTime) values (?,?,?,?,?)"; parameter[0] = fumigation.getContractNO(); parameter[1] = fumigation.getDate(); parameter[2] = fumigation.getDCNO(); parameter[3] = fumigation.getPONO(); parameter[4] = df.format(new Date()); int i = 0; i = db.executeUpdate(sql, parameter); if(i>=1){ flag = true; } return flag; } /** * 修改 * @param packing * @return */ public boolean updateFumigation(Fumigation fumigation){ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DBUtil db = new DBUtil(); boolean flag = false; Object[] parameter = new Object[6]; String sql = "update t_fumigation_certificate set ContractNO=?,Date=?,DCNO=?,PONO=?,OperatingTime=? where ID=?"; parameter[0]= fumigation.getContractNO(); parameter[1]= fumigation.getDate(); parameter[2]= fumigation.getDCNO(); parameter[3]= fumigation.getPONO(); parameter[4]= df.format(new Date()); parameter[5]= fumigation.getID(); int i = 0; i = db.executeUpdate(sql, parameter); if(i>=1){ flag = true; } return flag; } /** * 删除 * @param id * @return */ public boolean delete(int id){ boolean flag = false; DBUtil db = new DBUtil(); String sql = "delete from t_fumigation_certificate where ID=?"; Object[] parameter = new Object[]{id}; int i = 0; i = db.executeUpdate(sql, parameter); if(i>=1){ flag = true; } return flag; } /** * 搜索 * @param sql * @param parameter * @return */ public List<Map<String, Object>> getFumigation(String sql,Object[] parameter){ DBUtil db = new DBUtil(); List<Map<String, Object>> ls = db.QueryToList(sql, parameter); return ls; } }
[ "LGD_HuaOPER@gmail.com" ]
LGD_HuaOPER@gmail.com
4e5e229ae60afd5851ceb034a70c98fccb99ea45
2b24bd7ca999bdf2a69249b14e2a3ed3d14f7e80
/SmartLocator/app/src/main/java/com/example/hi/smartlocator/TheftReceiver.java
c68f6587efced3906cc459b50898b85c63683c3c
[ "MIT" ]
permissive
texplumber/smart_locator
3cda6bd662d89d1d684397b2872e8d37f97056ab
dca6cc0e1d9499ad5cbbc39461c4f360db47ed6f
refs/heads/master
2023-03-15T21:38:23.988760
2017-08-23T18:20:49
2017-08-23T18:20:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,913
java
package com.example.hi.smartlocator; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.telephony.SmsManager; import android.telephony.TelephonyManager; import android.widget.Toast; /** * Created by HI on 02-Mar-17. */ public class TheftReceiver extends BroadcastReceiver { Context c; String id; TelephonyManager tm; @Override public void onReceive(Context context, Intent intent) { c = context; tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); SharedPreferences app_preferences = PreferenceManager.getDefaultSharedPreferences(context); id = app_preferences.getString("simno", tm.getSimSerialNumber()); String phone = app_preferences.getString("loc_phone",""); Toast.makeText(context, "SIM card ID: " + id, Toast.LENGTH_LONG).show(); String simID = tm.getSimSerialNumber(); Toast.makeText(context, "current SIM card ID: " + simID, Toast.LENGTH_LONG).show(); if (simID.equals(id)) { Toast.makeText(c, "same sim is inserted", Toast.LENGTH_LONG).show(); } else { Toast.makeText(c, "diff. sim is inserted", Toast.LENGTH_LONG).show(); GPSTracker gps = new GPSTracker(context); if (gps.gpsoff) { Double latitude = gps.getlatitude(); Double longitude = gps.getlongitude(); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phone, null, "check: " + latitude + ", " + longitude, null, null); } } } }
[ "me.avik191@gmail.com" ]
me.avik191@gmail.com
9e2c4491f0dbed9a9c8ca1fdb22592e5d3f34725
76a8f8a7c1395c0c3b6081ffc452b671503b8738
/src/main/java/com/ipph/migratecore/deal/format/JsonMethodFormater.java
6d7b33952939702d34d61d2fef5e701dc40d97c7
[]
no_license
yutian1012/migrate-core
ce911230ac937a09a8296362b0cd4e29fddd0edd
3a9c66e07e9ea79b5aff44a02be965844ffea996
refs/heads/master
2020-03-15T11:14:04.314765
2018-07-17T02:13:15
2018-07-17T02:13:15
132,116,556
0
0
null
null
null
null
UTF-8
Java
false
false
600
java
package com.ipph.migratecore.deal.format; import java.util.Map; import com.alibaba.fastjson.JSON; /** * 参数提供一个类似于Map的集合,map中只接受字符串类型的数据Map<String,String> * 如:{'1':'值1','2':'值2'} */ public class JsonMethodFormater implements Formater{ public Object format(String args,Object value){ if(null==value) return null; String val= value.toString(); if(null!=args&&!"".equals(args)){ Map<String,Object> jsonMap = JSON.parseObject(args, Map.class); if(null!=jsonMap){ return jsonMap.get(val); } } return null; } }
[ "yutian1012@126.com" ]
yutian1012@126.com
2e884b8822de5050d4cff04c841b19c81c4c898c
0e50ea7485d6e1453d0a0a07755ed9da83a1ab60
/src/main/java/com/epam/tasktracker/repositories/TaskRepository.java
c306970be028b54117982f0a9106e1749c7a5bf2
[ "MIT" ]
permissive
phenomiks/task_tracker
0cf7219e4707cd0b057a1b160346a3ac5639fa2e
c3a0ef8ce0cd714a408b79542fbf453260d1b422
refs/heads/main
2023-06-17T06:02:27.078980
2021-07-14T15:12:05
2021-07-14T15:12:05
385,982,491
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package com.epam.tasktracker.repositories; import com.epam.tasktracker.entities.Task; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.Collection; @Repository public interface TaskRepository extends JpaRepository<Task, Long> { Collection<Task> findAllByUserId(Long userId); }
[ "phenomikspc@gmail.com" ]
phenomikspc@gmail.com
e53b80eb9e0f2b1db3ef02f2890358ee7f3f9b6c
24e293b5822684406d117e063cfcb28c8d044fd9
/twin-management-client/twin-management-client-api/src/main/java/com/microsoft/twins/model/ODataQueryOptionsExtendedType.java
f371aceb054408e2f0256e69a607752f767c90fe
[ "MIT" ]
permissive
microsoft/azure-digital-twins-java
3841cb316510b6d48d03eebe013091b4578d3783
bee66f392bbc9d68b51f37d13ebf7f23b18fa24d
refs/heads/master
2023-06-29T21:57:15.240829
2020-11-19T11:54:45
2020-11-19T11:54:45
187,796,903
12
17
MIT
2019-10-18T07:40:30
2019-05-21T08:40:18
Java
UTF-8
Java
false
false
22,761
java
/** * Copyright (c) Microsoft Corporation. Licensed under the MIT License. */ /* * Digital Twins Service Management APIs The Digital Twins Service allows for managing IoT devices * within spaces on Microsoft Azure. This guide describes the REST APIs to manage these devices. For * more documentation, please follow [this link](https://docs.microsoft.com/azure/digital-twins/). * ## How to use the APIs ### Authentication All API calls must be authenticated using OAuth. ### * HTTP request headers 1. Most APIs expect the `Content-Type` header to be set to * `application/json`. 2. Optional: Provide Correlation ID (GUID) by using the following header - * `X-Ms-Client-Request-Id`. ### HTTP response headers 1. Create APIs set the `Location` header. 2. * APIs set the `X-Ms-Request-Id` header. ### Calling conventions The APIs follow * [these](https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md) conventions. ### * HTTP response status codes The standard * [codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) are used. In particular, - `2xx` * codes are returned on success. In particular: - `200` for requests querying data (GET). - `201` * for requests creating objects (POST). - `204` for requests performing data modification (PATCH, * PUT, DELETE). - `4xx` codes are returned on failure for issues owned by the caller. In * particular: - `400` for input validation issues; the response body typically provides details * regarding the issue. - `401` for authentication failures. - `403` for authorization failures when * trying to use a specific object without permission. For example: - directly accessing an object * by id, e.g. `api/v1.0/spaces/id-of-a-space-that-current-user-cannot-view` **Note**: this does not * apply to collections; for these filtering is used instead of erroring out. e.g. * `api/v1.0/spaces?type=Tenant` will return all spaces of type `Tenant` that the current user has * access to, possibly an empty collection. - in a body payload when performing a change. For * example creating or modifying an object under a space without permission. - `404` when: - using * an incorrect route (e.g. `api/v1.0/incorrect`) or - specifying a query string that's [too * long](https://docs.microsoft.com/en-us/iis/configuration/system.webserver/security/ * requestfiltering/requestlimits) (thousands of chars) - specifying an object that does not exist * in a route (e.g. `api/v1.0/devices/invalid-device-id`) or - using an object that does not exist * in a body payload. For example: an invalid spaceId when creating a device, an invalid property * key name when assigning a property value to an object, etc. - `5xx` codes are returned on failure * for issues that are probably owned by the service. ## Object Model ### Spaces [Spaces](#!/Spaces) * correspond to physical locations. Each space has a type (for example: `Region`) and a name (for * example: `Puget Sound`). A given space may belong to another space, e.g. a neighborhood may * belong to a floor, that in turn belongs to a venue, region, customer, etc. ### Resources * [Resources](#!/Resources) are attached to a [space](#!/Spaces). Such as an IoTHub used by objects * in the space's hierarchy. ### Devices [Devices](#!/Devices) are attached to a [space](#!/Spaces). * They are entities (physical or virtual) that manage a number of [sensors](#!/Sensors). For * example, a device could be a user's phone, a Raspberry Pi sensor pod, Lora gateway, etc. ### * Sensors [Sensors](#!/Sensors) are attached to a [device](#!/Device) and a [space](#!/Spaces). * They record values. For example: battery level, temperature, noise, motion, etc. ### Blobs Blobs * are attached to objects (such as spaces, devices, sensors and users). They are the equivalent of * files (for example: pictures) with a mime type (ex: `image/jpeg`) and metadata (name, * description, type, etc.). Multipart requests are used to upload blobs. ### Extended Types Most * entities have one or more associated [Types](#!/Types) (see list below). Extended types are * extensible enumerations that augment entities with specific characteristics, which can be used to * filter or group entities by their type's name within the UI or within the data processor. An * example of extended type is the Space's type, which can have names such as Region, Customer, * Floor, Room, etc. Extended types have the following characteristics: - When creating an entity * that exposes the type, their name can be optionally specified and default to * \"None\" otherwise. - Their names only allow for alpha-numeric characters. - Their \"friendlyName\" allow for any character. - They can be disabled. A disabled extended type cannot be referenced. - They have a logical order that can be used (instead of e.g. alphabetical ordering) to populate dropdowns in UI. The system provides default seed names for extended types with ontologies (see next section), but users can extend the set of available names to suit their needs. Extended types offer the capability to model any type of vertical solution, including connected office, connected building, smart city, smart farming, etc. Here are the supported types and their definitions: - Devices: - `DeviceType` : defined as manufacturer of the device, i.e. \"Contoso Device Manufacturer\" - `DeviceSubtype` : defined as underlying hardware function, i.e. \"Gateway\", \"Controller\", \"Battery\", \"Switch\", \"AirHandlerUnit\", \"VariableAirVolume\", etc. - DeviceBlobs: - `DeviceBlobType` : defined as category of blobs that could be attached to a device, i.e. \"Model\", \"Specification\", etc. - `DeviceBlobSubtype` : defined as subcategory of blobs that gives more granularity on the DeviceBlobType, i.e. \"PhysicalModel\", \"LogicalModel\", \"KitSpecification\", \"FunctionalSpecification\", etc. - Sensors: - `SensorType` : defined as the manufacturer of the sensor, i.e. \"Contoso Sensor Manufacturer\" - `SensorDataType` : defined as category of data the sensor collects, i.e. \"Motion\", \"Temperature\", \"Humidity\", \"Sound\", \"Light\", etc. - `SensorDataSubtype` : defined as subcategory of data the sensor collects to give more granularity to SensorDataType, i.e. \"OutsideAirTemperature\", \"ReturnAirTemperature\", \"InsideTemperature\", \"MicrophoneSound\", \"SoundImpact\", \"VoiceSound\", etc. - `SensorDataUnitType` : defined as unit of measurement for data the sensor collects, i.e. \"Celsius\", \"Fahrenheit\", \"Decibels\", \"Pascal\", \"CubicFeetPerMinute\", \"Seconds\", etc. - `SensorPortType` : defined as type of communication for the sensor, i.e. \"AnalogInput\", \"AnalogOutput\", \"BinaryInput\", \"BinaryOutput\", etc. - Spaces: - `SpaceType` : defined as category of spaces specific to vertical solution. Space category might be physical locations or logical, i.e. \"Tenant\", \"Region\", \"Customer\", \"Venue\", \"Floor\", \"Area\", \"Workstation\", \"Desk\", \"Chair\", etc. - `SpaceSubtype` : defined as subcategory of spaces that gives more granularity on the SpaceType, i.e. \"StoreVenue\", \"SalesVenue\", \"MarketingVenue\", \"NeighborhoodArea\", \"ConfRoomArea\", \"PhoneRoomArea\", \"TeamRoomArea\", \"FocusRoomArea\", etc. - `SpaceStatus` : allows for defining current state of a space. e.g. \"Active\", \"Disabled\" - SpaceBlobs - `SpaceBlobType` : defined as category of blobs that could be attached to a space, i.e. \"Map\", \"Image\", etc. - `SpaceBlobSubtype` : defined as subtype that gives more granularity on the SpaceBlobType, i.e. \"GenericMap\", \"ElectricalMap\", \"SatelliteMap\", \"WayfindingMap\", etc. - SpaceResources - `SpaceResourceType` : defined as Azure resource type that could be associated to a space to be provisioned by this system, i.e. \"IoTHub\". - UserBlobs: - `UserBlobType` : defined as category of blobs that could be attached to a user, i.e. \"Image\", \"Video\", etc. - `UserBlobSubtype` : defined as subcategory of spaces that gives more granularity on the UserBlobType, i.e. \"ProfessionalImage\", \"VacationImage\", \"CommercialVideo\", etc. ### Ontologies [Ontologies](#!/Ontologies) represent a set of extended types. For example: - The Default ontology provides generic names for most types (ex: Temperature for SensorDataType, Map for SpaceBlobType, Active for SpaceStatus, etc.) and space types (ex: Space Type Room and Space Subtypes FocusRoom, ConferenceRoom, BathRoom, etc.). - The BACnet ontology provides names for sensor types/datatypes/datasubtypes/dataunittypes. Ontologies are managed by the system and new ontologies or new type names are regularly added. Users can load or unload ontologies. When an ontology is loaded, all of its associated type names have their `Disabled` state reset to false, unless they were already associated with a different loaded ontology. When an ontology is unloaded, all of its associated type names are switched to `Disabled` unless they are associated with another loaded ontology. Types associated with ontologies are available system wide (all spaces). By default, the following ontologies are loaded: Default, Required. All the existing ontologies are still a work in progress, and they will be improved over time. ### Property keys and values Some objects such as [spaces](#!/Spaces), [devices](#!/Device), [Users](#!/Users) and [sensors](#!/Sensors) can have custom properties defined in addition to the built-in ones. Associating a custom property to an object is a two steps process: 1. Creating the [property key](#!/PropertyKeys): a key exists for a given space tree/hierarchy (the space and it's children) and scope (eg. spaces, devices, users or sensors). An example of property key could be `BasicTemperatureDeltaProcessingRefreshTime` of type `uint` for scope Sensors and Space \"Contoso customer\". 2. Assigning a value for the given key to an object of the space hierarchy: using the previous example, [assigning the value](#!/Sensors/Sensors_AddProperty) `10` to the `BasicTemperatureDeltaProcessingRefreshTime` property for a sensor attached to `/Contoso customer/Building 1/Floor 10/Room 13`. Property keys' authors can optionally specify constraints on the associated property value, for example: - `PrimitiveDataType`: when setting `PrimitiveDataType`=`bool` for the HasWindows property key, only the `true` and `false` values are allowed. - `Min` and `Max`: when setting `PrimitiveDataType`=int, `Min`=0, `Max`=120 for the age property key, only numbers between 0 and 120 are allowed. - `ValidationData`: when setting `PrimitiveDataType`=enum, `ValidationData`=purple;blue;green for the haircolor property key, only purple, blue or green are allowed. Note: constraints are enforced on new values and not on existing ones. | `PrimitiveDataType` | `Min` & `Max` | `ValidationData` | Notes | | --------------------|------------------------|-------------------|----------------------------------| | None | N/A | N/A | | | bool | N/A | N/A | Value is converted to lower case | | string | string length range | Optional [regex](https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference) | Regex is single line case insensitive | | long,int,uint | allowed value range | N/A | White spaces are trimmed | | datetime | ISO8601 datetime range | optional [format specifier](https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings), for example \"yyyy-MM-dd\". Defaults to \"o\" * if not specified| | set | nb elements range | val1;val2;... | Values are converted to the case * specified in the key | | enum | N/A | val1;val2;... | Values is converted to the case specified * in the key | | json | string length range | optional [schema](http://json-schema.org/) | | ### * Users [Users](#!/Users) are attached to [spaces](#!/Spaces). They are used to locate individuals, * and not for permissioning. ### Roles [Roles](#!/System/System_RetrieveRoles) correspond to user * roles. Each role has a set of permissions (for example: `Read, Write, Update`) that defines the * privileges granted to a user. ### Role Assignments [Role Assignments](#!/RoleAssignments) * correspond to the association between identifiers and roles. Each role assignment includes an * identifier (such as user id, domain name, etc.), an identifier type, a role id, a tenant id and a * path that associates the corresponding identifier with a role. The path defines the upper limit * of the resource that the identifier can access with the permissions granted. The tenant id is not * allowed for gateway devices. ### Keys A [space](#!/Spaces) can have a number of [security key * stores](#!/KeyStores). These stores holds a collection of security keys and allow for easily * retrieving the [latest valid](#!/KeyStores/KeyStores_RetrieveKeysLast) one. ### System The * [system](#!/System) APIs allow for managing system wide settings, such as the various available * types of [spaces](#!/Spaces) and [sensors](#!/Sensors). ## Tree navigation The main routes (ex: * `/spaces`, `/devices`, `/users`, `/sensors`,...) support tree filtering/navigation with the * following optional parameters: - `spaceId`: if specified, this space node is used for the * filtering. - `/spaces` route only: the `useParentSpace` boolean flag indicates if `spaceId` * refers to the parent space or the current space. - `traverse`: - If `None` (the default) then * only the specified `spaceId` is returned. - If `Down`, the specified `spaceId` and its * descendants are returned. - If `Up`, the specified `spaceId` and its ancestors are returned. - If * `Span`, `spaceId` is used to select a horizontal portion of the tree relative to the specified * space node. In this case at least one of `minRelative` or `maxRelative` must be set to true. - * `minLevel`, `maxLevel`, `minRelative` and `maxRelative` - `minLevel` and `maxLevel` both default * to not set. - `minLevel` and `maxLevel` are both inclusive when set. - `minRelative` and * `maxRelative` both default to false, meaning by default levels are absolute. - Root spaces * (spaces with no parent) are of level 1, and spaces with a parent space of level n are of level n * + 1. - Devices, sensors, etc. are of the same level than their closest space. - To get all * objects of a given level, set both `minLevel` and `maxLevel` to the same value. - When * `minRelative` or `maxRelative` is set, the corresponding level is relative to the level of the * specified `spaceId`. - Relative level 0 represents spaces at the same level than the specified * space. - Relative level 1 represents spaces of the same level as the children of the specified * space. Relative level n represents spaces lower than the specified space by n levels. - Relative * level -1 represents spaces of the same level as the parent space of the specified spaceId, etc. * Examples with the `devices` route: - `devices?maxLevel=1`: returns all devices attached to root * spaces. - `devices?minLevel=2&maxLevel=4`: returns all devices attached to spaces of levels 2, 3 * or 4. - `devices?spaceId=mySpaceId`: returns all devices directly attached to `mySpaceId`. - * `devices?spaceId=mySpaceId&traverse=Down`: returns all devices attached to `mySpaceId` or one of * its descendants. - `devices?spaceId=mySpaceId&traverse=Down&minLevel=1&minRelative=true`: returns * all devices attached to descendants of `mySpaceId`, `mySpaceId` excluded. - * `devices?spaceId=mySpaceId&traverse=Down&minLevel=1&minRelative=true&maxLevel=1&maxRelative=true` * : returns all devices attached to direct children of `mySpaceId`. - * `devices?spaceId=mySpaceId&traverse=Up&maxLevel=-1&maxRelative=true`: returns all devices * attached to one of the ancestors of `mySpaceId`. - * `devices?spaceId=mySpaceId&traverse=Down&maxLevel=5`: returns all devices attached to descendants * of `mySpaceId` that are of level smaller than or equal to 5. - * `devices?spaceId=mySpaceId&traverse=Span&minLevel=0&minRelative=true&maxLevel=0&maxRelative=true` * : returns all devices attached to spaces that are of the same level than `mySpaceId` ## OData * support Most of the APIs that return collections (for example a GET on `/api/v1.0/spaces`, * `/api/v1.0/spaces/{id}/parents`, `/api/v1.0/spaces/{id}`, etc.) support a subset of the generic * [OData](http://www.odata.org/getting-started/basic-tutorial/#queryData) system query options: - * `$filter`. - `$orderby`. **Note:** unless it's being used in combination with `$top` the * recommendation is to order on the client instead. - `$top` - `$skip`. **Note:** the server cost * of requesting n times a 1/n subset of a collection with `$skip` is quadratic (instead of linear). * Therefore a client that intends on displaying the entire collection should request it whole (in a * single call) and perform paging client-side. - Other options (`$count`, `$expand`, `$search`, * etc.) are not supported. Below some examples of queries using OData's system query options: - * /api/v1.0/devices?$top=3&$orderby=Name desc - * /api/v1.0/keystores?$filter=endswith(Description,'space') - /api/v1.0/propertykeys?$filter=Scope * ne 'Spaces' - /api/v1.0/resources?$filter=Size gt 'M' - * /api/v1.0/users?$top=4&$filter=endswith(LastName,'k')&$orderby=LastName - * /api/v1.0/spaces?$orderby=Name desc&$top=3&$filter=substringof('Floor',Name) ## Last Updated * 2018-12-12T18:06:34.0000000Z ## API List * * OpenAPI spec version: V1 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git Do not edit the class manually. */ package com.microsoft.twins.model; import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.EqualsAndHashCode; import lombok.ToString; /** * ODataQueryOptionsExtendedType */ @ToString @EqualsAndHashCode public class ODataQueryOptionsExtendedType { @JsonProperty("ifMatch") private Object ifMatch; @JsonProperty("ifNoneMatch") private Object ifNoneMatch; @JsonProperty("context") private ODataQueryContext context; @JsonProperty("request") private Object request; @JsonProperty("rawValues") private ODataRawQueryOptions rawValues; @JsonProperty("selectExpand") private SelectExpandQueryOption selectExpand; @JsonProperty("filter") private FilterQueryOption filter; @JsonProperty("orderBy") private OrderByQueryOption orderBy; @JsonProperty("skip") private SkipQueryOption skip; @JsonProperty("top") private TopQueryOption top; @JsonProperty("inlineCount") private InlineCountQueryOption inlineCount; @JsonProperty("validator") private ODataQueryValidator validator; /** * Get ifMatch * * @return ifMatch **/ public Object getIfMatch() { return ifMatch; } /** * Get ifNoneMatch * * @return ifNoneMatch **/ public Object getIfNoneMatch() { return ifNoneMatch; } public ODataQueryOptionsExtendedType context(final ODataQueryContext context) { this.context = context; return this; } /** * Get context * * @return context **/ @Valid public ODataQueryContext getContext() { return context; } public void setContext(final ODataQueryContext context) { this.context = context; } /** * Get request * * @return request **/ public Object getRequest() { return request; } public ODataQueryOptionsExtendedType rawValues(final ODataRawQueryOptions rawValues) { this.rawValues = rawValues; return this; } /** * Get rawValues * * @return rawValues **/ @Valid public ODataRawQueryOptions getRawValues() { return rawValues; } public void setRawValues(final ODataRawQueryOptions rawValues) { this.rawValues = rawValues; } public ODataQueryOptionsExtendedType selectExpand(final SelectExpandQueryOption selectExpand) { this.selectExpand = selectExpand; return this; } /** * Get selectExpand * * @return selectExpand **/ @Valid public SelectExpandQueryOption getSelectExpand() { return selectExpand; } public void setSelectExpand(final SelectExpandQueryOption selectExpand) { this.selectExpand = selectExpand; } public ODataQueryOptionsExtendedType filter(final FilterQueryOption filter) { this.filter = filter; return this; } /** * Get filter * * @return filter **/ @Valid public FilterQueryOption getFilter() { return filter; } public void setFilter(final FilterQueryOption filter) { this.filter = filter; } public ODataQueryOptionsExtendedType orderBy(final OrderByQueryOption orderBy) { this.orderBy = orderBy; return this; } /** * Get orderBy * * @return orderBy **/ @Valid public OrderByQueryOption getOrderBy() { return orderBy; } public void setOrderBy(final OrderByQueryOption orderBy) { this.orderBy = orderBy; } public ODataQueryOptionsExtendedType skip(final SkipQueryOption skip) { this.skip = skip; return this; } /** * Get skip * * @return skip **/ @Valid public SkipQueryOption getSkip() { return skip; } public void setSkip(final SkipQueryOption skip) { this.skip = skip; } public ODataQueryOptionsExtendedType top(final TopQueryOption top) { this.top = top; return this; } /** * Get top * * @return top **/ @Valid public TopQueryOption getTop() { return top; } public void setTop(final TopQueryOption top) { this.top = top; } public ODataQueryOptionsExtendedType inlineCount(final InlineCountQueryOption inlineCount) { this.inlineCount = inlineCount; return this; } /** * Get inlineCount * * @return inlineCount **/ @Valid public InlineCountQueryOption getInlineCount() { return inlineCount; } public void setInlineCount(final InlineCountQueryOption inlineCount) { this.inlineCount = inlineCount; } public ODataQueryOptionsExtendedType validator(final ODataQueryValidator validator) { this.validator = validator; return this; } /** * Get validator * * @return validator **/ @Valid public ODataQueryValidator getValidator() { return validator; } public void setValidator(final ODataQueryValidator validator) { this.validator = validator; } }
[ "kai.zimmermann@microsoft.com" ]
kai.zimmermann@microsoft.com
0e5734261933ecf9e5019be25d42632010efae2e
59a28030b9bbfce8b6c7ad51a9e5cbb7aadc36b9
/QdmKnimeTranslator/src/main/java/edu/phema/jaxb/ihe/svs/OilDrugForm.java
367ab2853ddf37d5cb9752fcd61d219ae412b931
[]
no_license
PheMA/qdm-knime
c3970566c7fe529eefe94a9311d7beeed6d39dc8
fb3e2925a6cd15ebba83ba5fc95bb604a54ff564
refs/heads/master
2020-12-24T14:27:42.708153
2016-05-25T21:42:57
2016-05-25T21:42:57
29,319,651
1
0
null
null
null
null
UTF-8
Java
false
false
1,008
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.12.15 at 03:09:44 PM CST // package edu.phema.jaxb.ihe.svs; import javax.xml.bind.annotation.XmlEnum; /** * <p>Java class for OilDrugForm. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="OilDrugForm"> * &lt;restriction base="{urn:ihe:iti:svs:2008}cs"> * &lt;enumeration value="OIL"/> * &lt;enumeration value="TOPOIL"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlEnum public enum OilDrugForm { OIL, TOPOIL; public String value() { return name(); } public static OilDrugForm fromValue(String v) { return valueOf(v); } }
[ "thompsow@r1001-lt-100-f.enhnet.org" ]
thompsow@r1001-lt-100-f.enhnet.org
fea3c899f8be6da0e07cc3ff75f8d345851abd2f
d80f2894b57801dab44669db6531dba9d465507a
/src/main/java/com/platzi/market/domain/service/ProductService.java
6fca674652b37005935ceac0e1c8301e5a920330
[]
no_license
Ysparky/spring-market
a351d27e1901403674697579bce95d04e385f650
f085f69fa071ed5fd6795de6dfdf2b4cd1fcb91f
refs/heads/master
2022-12-13T02:17:19.957055
2020-09-09T04:57:49
2020-09-09T04:57:49
293,953,244
0
0
null
null
null
null
UTF-8
Java
false
false
1,194
java
package com.platzi.market.domain.service; import com.platzi.market.domain.Product; import com.platzi.market.domain.repository.ProductRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; @Service public class ProductService { @Autowired private ProductRepository productRepository; public List<Product> getAll() { return productRepository.getAll(); } public Optional<Product> getProduct(int productId) { return productRepository.getProduct(productId); } public Optional<List<Product>> getByCategory(int categoryId) { return productRepository.getByCategory(categoryId); } public Optional<List<Product>> getScarseProducts(int quantity) { return productRepository.getScarseProducts(quantity); } public Product save(Product product) { return productRepository.save(product); } public boolean delete(int productId) { return getProduct(productId).map(product -> { productRepository.delete(productId); return true; }).orElse(false); } }
[ "jscr272000.jscr@gmail.com" ]
jscr272000.jscr@gmail.com
f15b70c75acc9772736710af27d131d64a80f8d0
5d96d1fc3f201a5bb3f25a3f6fc4ebc545719f5b
/shop-picture-service/src/main/java/ru/geekbrains/service/PictureServiceFileImpl.java
ccdd553c24705219aacdc6222c24014ffd259d3a
[]
no_license
arcanrun/spring-geek-2
df69939ef972172b8979679f066c15b584b83566
ee9f67c3de4740c7f40a1ff46fcea66c2f26e7d4
refs/heads/master
2023-02-23T12:44:06.068522
2021-01-30T20:11:55
2021-01-30T20:11:55
307,186,988
0
0
null
2021-01-30T20:11:56
2020-10-25T20:32:42
CSS
UTF-8
Java
false
false
2,190
java
package ru.geekbrains.service; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import ru.geekbrains.model.Picture; import ru.geekbrains.model.PictureData; import ru.geekbrains.repository.PictureRepository; import java.io.IOException; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Optional; import java.util.UUID; public class PictureServiceFileImpl implements PictureService { private static final Logger logger = LoggerFactory.getLogger(PictureServiceFileImpl.class); @Value("${picture.storage.path}") private String storagePath; private final PictureRepository pictureRepository; public PictureServiceFileImpl(PictureRepository pictureRepository) { this.pictureRepository = pictureRepository; } @Override public Optional<String> getPictureContentTypeById(int id) { return pictureRepository.findById(id) .map(Picture::getContentType); } @Override public Optional<byte[]> getPictureDataById(int id) { return pictureRepository.findById(id) .filter(pic -> pic.getPictureData().getFileName() != null) .map(pic -> Paths.get(storagePath, pic.getPictureData().getFileName())) .filter(Files::exists) .map(path -> { try { return Files.readAllBytes(path); } catch (IOException ex) { logger.error("Can't read picture file ", ex); throw new RuntimeException(ex); } }); } @Override public PictureData createPictureData(byte[] picture) { String fileName = UUID.randomUUID().toString(); try (OutputStream outputStream = Files.newOutputStream(Path.of(storagePath, fileName))) { outputStream.write(picture); } catch (IOException ex) { logger.error("Can't create picture file ", ex); throw new RuntimeException(ex); } return new PictureData(fileName); } }
[ "arcan.run@gmail.com" ]
arcan.run@gmail.com
3d22718b9030172405d38d63dcc9ab34b6c8512a
caa5940e446fcaa3aea3b8d5eec46d457674a5c1
/jxc/src/main/java/com/mrguo/vo/goods/GoodSkuAllInfoVo.java
5fc75e16caa04f6f6ce5d35de37e8bf5cab7ce83
[]
no_license
zhangweijie1/jxcapi
b6d9a8358e8834fa3be5c78b3c27f4df7ef7bf22
33eb180fe0215aef8003e914eb863bc33792914a
refs/heads/master
2023-04-05T12:58:10.305874
2021-04-12T07:48:16
2021-04-12T07:48:16
357,077,305
0
1
null
null
null
null
UTF-8
Java
false
false
1,119
java
package com.mrguo.vo.goods; import com.mrguo.dto.goods.SkuInfoDto; import com.mrguo.entity.goods.*; import lombok.Data; import javax.validation.constraints.NotNull; import java.util.List; /** * @author 郭成兴 * @ClassName GoodsDto * @Description 商品新增VO * @date 2019/8/1710:28 PM * @updater 郭成兴 * @updatedate 2019/8/1710:28 PM */ @Data public class GoodSkuAllInfoVo { /** * sku */ @NotNull(message = "SKU信息没有为空") private GoodsSku goodsSku; /** * 商品价格数据 */ @NotNull(message = "商品价格不能为空") private List<GoodsPrice> goodsPriceList; /** * 商品等级价 */ private List<GoodsLevel> goodsLevelList; /** * 商品单位 */ private List<GoodsUnit> goodsUnitList; /** * 商品条形码 */ private List<GoodsBarcode> goodsBarcodeList; /** * 期初库存 */ @NotNull(message = "期初库存不能为空") private List<SkuInfoDto> goodsStockList; /** * 库存预警 */ private List<GoodsStockWarn> goodsStockWarnList; }
[ "812154214@qq.com" ]
812154214@qq.com
d1010992b6ad11b38c7e97485419d560667b05d2
cd73733881f28e2cd5f1741fbe2d32dafc00f147
/libs/common-ui/src/main/java/com/hjhq/teamface/common/weight/filter/ItemFilterView.java
1fa05d7c0a94410cdccf683451c43b7b7d1f89ed
[]
no_license
XiaoJon/20180914
45cfac9f7068ad85dee26e570acd2900796cbcb1
6c0759d8abd898f1f5dba77eee45cbc3d218b2e0
refs/heads/master
2020-03-28T16:48:36.275700
2018-09-14T04:10:27
2018-09-14T04:10:27
148,730,363
0
1
null
null
null
null
UTF-8
Java
false
false
4,042
java
package com.hjhq.teamface.common.weight.filter; import android.app.Activity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.alibaba.fastjson.JSONObject; import com.chad.library.adapter.base.BaseQuickAdapter; import com.hjhq.teamface.basis.R; import com.hjhq.teamface.basis.bean.FilterFieldResultBean; import com.hjhq.teamface.basis.util.TextUtil; import com.hjhq.teamface.basis.util.device.SoftKeyboardUtils; import com.hjhq.teamface.basis.view.recycler.SimpleItemClickListener; import com.hjhq.teamface.common.weight.BaseFilterView; import com.hjhq.teamface.common.weight.adapter.ItemFilterAdapter; import java.util.ArrayList; import java.util.List; import rx.Observable; /** * 筛选条件中单选或多选 */ public class ItemFilterView extends BaseFilterView { private RelativeLayout rlAction; private RelativeLayout rlContent; private RecyclerView mRecyclerView; private TextView tvTitle; private ItemFilterAdapter mAdapter; private List<FilterFieldResultBean.DataBean.EntrysBean> mDataList = new ArrayList<>(); private boolean mFlag = false; private View ivArraw; public ItemFilterView(FilterFieldResultBean.DataBean bean) { super(bean); } @Override public void addView(LinearLayout parent, Activity activity, int index) { mView = View.inflate(activity, R.layout.crm_item_goods_filter_by_creator, null); tvTitle = (TextView) mView.findViewById(R.id.tv_title); rlAction = (RelativeLayout) mView.findViewById(R.id.rl_title_creator); rlContent = (RelativeLayout) mView.findViewById(R.id.rl_action_creator); if (!mFlag) { rlContent.setVisibility(View.GONE); } mRecyclerView = (RecyclerView) mView.findViewById(R.id.recyclerview); ivArraw = mView.findViewById(R.id.iv); mRecyclerView.setLayoutManager(new LinearLayoutManager(mView.getContext()) { @Override public boolean canScrollVertically() { return false; } }); initView(); setClickListener(); parent.addView(mView, index); } private void initView() { TextUtil.setText(tvTitle, title); mDataList = bean.getEntrys(); mAdapter = new ItemFilterAdapter(mDataList); mRecyclerView.setAdapter(mAdapter); } private void setClickListener() { rlAction.setOnClickListener(v -> { SoftKeyboardUtils.hide(v); if (!mFlag) { rlContent.setVisibility(View.VISIBLE); mFlag = !mFlag; rotateCButton(mActivity, ivArraw, 0f, 180f, 500, R.drawable.icon_sort_down); } else { rlContent.setVisibility(View.GONE); mFlag = !mFlag; rotateCButton(mActivity, ivArraw, 0f, -180f, 500, R.drawable.icon_sort_down); } }); mRecyclerView.addOnItemTouchListener(new SimpleItemClickListener() { @Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { super.onItemChildClick(adapter, view, position); if (view.getId() == R.id.check_null) { } } }); } public boolean formatCheck() { return true; } @Override public boolean put(JSONObject json) throws Exception { if (mDataList == null) { return false; } StringBuilder sb = new StringBuilder(); Observable.from(mDataList).filter(data -> data.isChecked()).subscribe(data -> sb.append(data.getValue() + ",")); if (sb.length() > 0) { sb.deleteCharAt(sb.length() - 1); json.put(keyName, sb.toString()); } return true; } }
[ "xiaojun6909@gmail.com" ]
xiaojun6909@gmail.com
f0a361eab7d2c9c42b37cb6e023cc24730dc77d9
b87664a388c0f3235d99bb187ebe1747e231a35a
/232_InLab_4/src/pkg232_inlab_4/Main.java
b2c41e226362f62d6658fdb27f4942d2a665ab31
[]
no_license
tylerbourgeois/Misc-Java-Projects
0962dffbb60098a715e66539867e7098e57a01be
0e4d274ecad3261d40b7cf227e6715e925c4483c
refs/heads/master
2020-12-06T06:34:42.264678
2020-01-07T17:12:23
2020-01-07T17:12:23
232,374,837
0
0
null
null
null
null
UTF-8
Java
false
false
1,632
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 pkg232_inlab_4; import java.io.FileNotFoundException; /** * * @author tybik */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) throws FileNotFoundException { // TODO code application logic here Graph g = new Graph(5); //new graph of length 5 g.loadFromFileWeighted("directional.dat"); System.out.println("Directional Graph"); g.printGraph(); g.loadFromFileWeighted("weighted.dat"); System.out.println("Weighted Graph"); g.printGraph(); g.loadFromFileDirectional("directional.dat"); //loads graph from directional file int i = 4; //int to search for System.out.print("Breadth First Search for " + i + ": "); g.breadthfirstSearch(i); //BFS System.out.println(); System.out.print("\nDepth First Search for " + i + ": "); g.depthfirstSearch(i); //DFS System.out.println(); g.loadFromFileWeighted("weighted.dat"); //loads weighted graph g.dijkstra(0); //dijkstra System.out.println(); g.primsALG(); //prim's g.loadFromFileWeighted("directional.dat"); g.floydALG(); //floyd's g.loadFromFileWeighted("weighted.dat"); //loads weighted graph g.floydwarshallALG(); //floyd-warshall } }
[ "noreply@github.com" ]
noreply@github.com
0785fd62028f192381b3d9b4858ece318534fbb9
f92898b1c043b4b031456f4c8db01a08209fe9ae
/app/src/main/java/mx/tec/proyectofinal/retrofit/IGoogleApi.java
dc63e8f6dc006aa8f5f07e1ec9148dcb0ea830b0
[]
no_license
Salvasgdo/PistaCuernavaca
c25e1ba0e99c92c34bea636d2c397596bed3293f
5be1b5e756c3da63af9623d296a5047718f9eb26
refs/heads/master
2023-01-21T09:49:40.274866
2020-11-30T23:22:22
2020-11-30T23:22:22
314,421,296
0
0
null
null
null
null
UTF-8
Java
false
false
213
java
package mx.tec.pistacuernavaca.retrofit; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Url; public interface IGoogleApi { @GET Call<String> getDirections(@Url String url); }
[ "A01421806@itesm.mx" ]
A01421806@itesm.mx
49faf9c4090fc52366d0ff0e2989865894908031
9f1d42ff2a4e0f20abeba2866abe2083b378ea9e
/services/rds/src/main/java/org/finra/gatekeeper/services/db/connections/DocumentDBConnection.java
745b6308bd3717cf06a2468ca04c3a4ad3f69d59
[ "Apache-2.0" ]
permissive
mhatrep/Gatekeeper
f17021b47816f9e32aa5e9272a3ce0a4bb3fe99e
5613278d3e1de267f52d2f7e8ae158bd4e3ded4f
refs/heads/master
2022-11-20T00:19:40.930622
2022-10-17T21:31:42
2022-10-17T21:31:42
203,690,019
1
0
null
2019-08-22T01:20:02
2019-08-22T01:20:02
null
UTF-8
Java
false
false
15,551
java
/* * Copyright 2022. Gatekeeper Contributors * * 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.finra.gatekeeper.services.db.connections; import com.mongodb.BasicDBObject; import com.mongodb.MongoException; import com.mongodb.client.MongoClient; import com.mongodb.client.MongoClients; import com.mongodb.client.MongoDatabase; import org.bson.Document; import org.finra.gatekeeper.configuration.GatekeeperProperties; import org.finra.gatekeeper.rds.exception.GKUnsupportedDBException; import org.finra.gatekeeper.rds.interfaces.DBConnection; import org.finra.gatekeeper.rds.interfaces.GKUserCredentialsProvider; import org.finra.gatekeeper.rds.model.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import java.sql.SQLException; import java.util.*; /** * Interface for dealing with Postgres RDS Connections */ @Component public class DocumentDBConnection implements DBConnection { private final Logger logger = LoggerFactory.getLogger(DocumentDBConnection.class); private final GKUserCredentialsProvider gkUserCredentialsProvider; private final String gkUserName; private final Boolean ssl; private final String replicaSet; private final String readPreference; private final Boolean retryWrites; @Autowired public DocumentDBConnection(GatekeeperProperties gatekeeperProperties, @Qualifier("credentialsProvider") GKUserCredentialsProvider gkUserCredentialsProvider){ this.gkUserCredentialsProvider = gkUserCredentialsProvider; GatekeeperProperties.GatekeeperDbProperties db = gatekeeperProperties.getDb(); GatekeeperProperties.GatekeeperDbProperties.DocumentDbProperties documentdb = db.getDocumentdb(); this.gkUserName = db.getGkUser(); this.ssl = documentdb.getSsl(); this.replicaSet = documentdb.getReplicaSet(); this.readPreference = documentdb.getReadPreference(); this.retryWrites = documentdb.getRetryWrites(); } public boolean grantAccess(RdsGrantAccessQuery rdsGrantAccessQuery) throws MongoException { String address = rdsGrantAccessQuery.getAddress(); String user = rdsGrantAccessQuery.getUser(); RoleType role = rdsGrantAccessQuery.getRole(); String password = rdsGrantAccessQuery.getPassword(); MongoClient client = null; try{ client = connect(address, gkUserCredentialsProvider.getGatekeeperSecret(rdsGrantAccessQuery)); String userWithSuffix = user + "_" + role.getShortSuffix(); //Try to revoke the user boolean revoked = true; if(userExists(client, userWithSuffix)) { logger.info("User " + userWithSuffix + " already exists, try to remove the user."); try { // try to delete the user if they already are present revoked = revokeUser(client, userWithSuffix); } catch (Exception ex) { logger.error("Could not remove the existing user from the database. Falling back by trying to rotate the existing user's password", ex); revoked = false; } } if(revoked) { // Update the gk roles on the DB createUser(client, address, userWithSuffix, password, role); }else{ // Rotate the password and expiration time for te existing user. updateUser(client, address, userWithSuffix, password, role); } return true; }catch(Exception ex){ logger.error("An exception was thrown while trying to grant access to user " + user + "_" + role.getShortSuffix() + " on address " + address , ex); return false; }finally{ if(client != null) { client.close(); } } } public boolean revokeAccess(RdsRevokeAccessQuery rdsRevokeAccessQuery) throws MongoException{ String address = rdsRevokeAccessQuery.getAddress(); String user = rdsRevokeAccessQuery.getUser(); RoleType role = rdsRevokeAccessQuery.getRole(); MongoClient client = null; try { client = connect(address, gkUserCredentialsProvider.getGatekeeperSecret(rdsRevokeAccessQuery)); logger.info("Removing " + user + " from " + address + " if they exist."); if(role != null) { //if roles is provided revoke the user with the suffix (from activiti) revokeUser(client, user + "_" + role.getShortSuffix()); }else{ //if roles is not provided just revoke the user (forced removal) revokeUser(client, user); } return true; }catch(Exception ex){ String username = role == null ? user : user + "_" + role.getShortSuffix(); logger.error("An exception was thrown while trying to revoke user " + username + " from address " + address, ex); return false; } finally { if(client != null) { client.close(); } } } public Map<RoleType, List<String>> getAvailableTables(RdsQuery rdsQuery) throws MongoException { String address = rdsQuery.getAddress(); Map<RoleType, List<String>> results = new HashMap<>(); MongoClient client = null; logger.info("Getting available schema information for " + address); try { client = connect(address, gkUserCredentialsProvider.getGatekeeperSecret(rdsQuery)); ArrayList<Document> jsonRoles = (ArrayList<Document>) client.getDatabase("admin").runCommand(new Document("rolesInfo", 1)).get("roles"); Map<String, List<Document>> roles = new HashMap<>(); for (Document role : jsonRoles){ roles.put(role.get("role").toString(),(List) role.get("roles")); } for (RoleType roleType : RoleType.values()) { List<String> schemas = new ArrayList<>(); for(Document role : roles.get(roleType.getDbRole())){ schemas.add(role.get("db").toString()); } results.put(roleType, !schemas.isEmpty() ? schemas : Collections.singletonList("No Schemas are available for role " + roleType.getDbRole() + " at this time.")); } logger.info("Retrieved available schema information for database " + address); }catch (Exception ex) { logger.error("Could not retrieve available role information for database " + address, ex); }finally{ if(client != null) { client.close(); } } return results; } public List<String> checkDb(RdsQuery rdsQuery) throws GKUnsupportedDBException { String address = rdsQuery.getAddress(); List<String> issues = new ArrayList<>(); List<String> gkRoles = new ArrayList<>(); gkRoles.addAll(Arrays.asList("gk_datafix", "gk_readonly", "gk_dba")); MongoClient client = null; try{ logger.info("Checking the gatekeeper setup for " + address); client = connect(address, gkUserCredentialsProvider.getGatekeeperSecret(rdsQuery)); MongoDatabase adminDB = client.getDatabase("admin"); Document getRolesCommand = adminDB.runCommand(new Document("rolesInfo", 1)); ArrayList<Document> roles = (ArrayList<Document>) getRolesCommand.get("roles"); List<String> roleCheckResult = new ArrayList<>(); for (Document role : roles){ roleCheckResult.add(role.get("role").toString()); } gkRoles.removeAll(roleCheckResult); if(!gkRoles.isEmpty()) { issues.add("missing the following roles: " + gkRoles); } Document getGatekeeperUserCommand = adminDB.runCommand(new Document("usersInfo", 1)); ArrayList<Document> users = (ArrayList<Document>) getGatekeeperUserCommand.get("users"); Boolean createRolePermCheckResult = false; for(Document user: users){ if(user.get("_id").equals(gkUserName)){ ArrayList<Document> userRoles = (ArrayList<Document>) user.get("roles"); for (Document role: userRoles){ if(role.get("db").equals("admin") && role.get("role").equals("root")){ createRolePermCheckResult = true; } } } } if(!createRolePermCheckResult){ issues.add("gatekeeper user missing root role in admin db"); } client.close(); } catch(MongoException ex){ logger.error("Failed to connect to DB", ex); logger.error(ex.getMessage()); logger.error(String.valueOf(ex.getMessage().contains("authenticating"))); if(ex.getMessage().contains("authenticating")) { issues.add("Password authentication failed for gatekeeper user"); }else{ issues.add("Unable to connect to DB (" + ex.getCause().getMessage() + ")"); } } return issues; } /** * Check to see if this user is the owner of any tables on the DB * * @param rdsCheckUsersTableQuery - the query details for the db * @return List of String - List of users that still own tables * * @throws SQLException - if there's an issue executing the query on the database */ public List<String> checkIfUsersHasTables(RdsCheckUsersTableQuery rdsCheckUsersTableQuery) throws MongoException{ return Collections.EMPTY_LIST; } public List<DbUser> getUsers(RdsQuery rdsQuery) throws MongoException{ String address = rdsQuery.getAddress(); MongoClient client = null; List<DbUser> results = new ArrayList<>(); logger.info("Getting available schema information for " + address); try { client = connect(address, gkUserCredentialsProvider.getGatekeeperSecret(rdsQuery)); Document getUsersCommand = client.getDatabase("admin").runCommand(new Document("usersInfo", 1)); ArrayList<Document> users = (ArrayList<Document>) getUsersCommand.get("users"); for(Document user: users){ ArrayList<Document> jsonRoles = (ArrayList<Document>) user.get("roles"); List<String> roles = new ArrayList<>(); for (Document role: jsonRoles){ roles.add(role.get("role").toString()); } results.add(new DbUser(user.get("_id").toString(), roles)); } logger.info("Retrieved users for database " + address); } catch (Exception ex) { logger.error("Could not retrieve list of users for database " + address, ex); results = Collections.emptyList(); }finally{ if(client != null) { client.close(); } } return results; } public List<String> getAvailableRoles(RdsQuery rdsQuery) throws MongoException{ String address = rdsQuery.getAddress(); MongoClient client = null; List<String> results = new ArrayList<>(); logger.info("Getting available roles for " + address); try { client = connect(address, gkUserCredentialsProvider.getGatekeeperSecret(rdsQuery)); Document getRolesCommand = client.getDatabase("admin").runCommand(new Document("rolesInfo", 1)); ArrayList<Document> roles = (ArrayList<Document>) getRolesCommand.get("roles"); for (Document role : roles){ if(role.get("role").toString().startsWith("gk_")) results.add(role.get("role").toString()); } } catch (Exception ex) { logger.error("Could not retrieve list of roles for database " + address, ex); throw ex; }finally{ if(client != null) { client.close(); } } return results; } private MongoClient connect(String url, String gkUserPassword){ String connectionTemplate = "mongodb://%s:%s@%s?ssl=%s&replicaSet=%s&readPreference=%s&retryWrites=%s"; String connectionString = String.format(connectionTemplate, gkUserName, gkUserPassword, url, ssl, replicaSet, readPreference, retryWrites.toString()); MongoClient mongoClient = MongoClients.create(connectionString); return mongoClient; } private void updateUser(MongoClient client, String address, String user, String password, RoleType role) throws MongoException{ logger.info("Updating the password for " + user + " on " + address + " with role " + role.getDbRole()); final BasicDBObject updateUserCommand = new BasicDBObject("updateUser", user) .append("pwd", password) .append("roles", Collections.singletonList(new BasicDBObject("role", role.getDbRole()).append("db", "admin")) ); client.getDatabase("admin").runCommand(updateUserCommand); logger.info("Done Updating user " + user + " on " + address + " with role " + role.getDbRole()); } private void createUser(MongoClient client, String address, String user, String password, RoleType role) throws MongoException{ logger.info("Creating user " + user + " on " + address + " with role " + role.getDbRole()); final BasicDBObject createUserCommand = new BasicDBObject("createUser", user) .append("pwd", password) .append("roles", Collections.singletonList(new BasicDBObject("role", role.getDbRole()).append("db", "admin")) ); client.getDatabase("admin").runCommand(createUserCommand); logger.info("Done Creating user " + user + " on " + address + " with role " + role.getDbRole()); } private boolean userExists(MongoClient client, String user){ logger.info("Checking to see if user " + user + " exists"); Document getUsersCommand = client.getDatabase("admin").runCommand(new Document("usersInfo", 1)); ArrayList<Document> users = (ArrayList<Document>) getUsersCommand.get("users"); for(Document userJSON: users){ if(userJSON.get("_id").equals(user)){ return true; } } return false; } private boolean revokeUser(MongoClient client, String user){ final BasicDBObject dropUserCommand = new BasicDBObject("dropUser", user); client.getDatabase("admin").runCommand(dropUserCommand); return !userExists(client, user); } }
[ "noreply@github.com" ]
noreply@github.com
85d3c1a06c311b6e867e0ca8cfd6e01f4c6a5fd8
45668e9dc59a44de010ea6f32a4610cee34b59e7
/OntoQA/src/cn/edu/hit/scir/dependency/TargetCompletion.java
7b7807e97a267b750e8568a66275f667fdd7e7a0
[]
no_license
spkang/OntoQA
b7def4337c55a23b5c9b4b2ebdf7f5eee68c7086
47e03889d66c3827229df3092152f2388cd409ec
refs/heads/master
2021-01-22T04:41:32.202649
2014-06-16T07:55:35
2014-06-16T07:55:35
18,555,035
1
2
null
null
null
null
UTF-8
Java
false
false
4,321
java
package cn.edu.hit.scir.dependency; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.List; import org.apache.log4j.Logger; import cn.edu.hit.ir.nlp.OpenNLP; import edu.stanford.nlp.ling.TaggedWord; /** * * @author spkang (kangshupeng@163.com) * @version 0.1.0 * @date 2014年3月14日 */ public class TargetCompletion { private static Logger logger = Logger.getLogger(TargetCompletion.class); //private static NlpTool nlptool = EnglishNlpTool.getInstance(); public static OpenNLP openNLP = OpenNLP.getInstance(); private static TargetCompletion instance = null; private static QuestionTargetRecognizer qtRecognizer = QuestionTargetRecognizer.getInstance(); private static StanfordTagger tagger = StanfordTagger.getInstance(); private static Question questionInstance = Question.getInstance(); public static TargetCompletion getInstance () { if (instance == null ) return new TargetCompletion () ; return instance; } private TargetCompletion () { if (false == openNLP.createChunker()) logger.info("create chuncker error!"); } public String completeTarget (String question) { if (question == null ) return null; questionInstance.initialize(question); List<TaggedWord> taggedWords = tagger.taggerSentence(questionInstance.getProcessedQuestion()); String [] words = new String[taggedWords.size()]; String [] tags = new String[taggedWords.size()]; int idx = 0; for (TaggedWord tw : taggedWords ) { words[idx] = tw.word() + "-" + (idx + 1); tags[idx++] = tw.tag(); } String [] chunkers = openNLP.chunkAsWords(words, tags); String orgTarget = qtRecognizer.recognizeQuestionTarget(question); return locateTarget (chunkers, orgTarget); } /** * locate the target in the chunker * * @param chunkers, orgTarget : single word * @return String , the complete target */ public String locateTarget (String [] chunkers, String orgTarget) { if (chunkers == null || orgTarget == null ) return null; String [] tmp = orgTarget.trim().split("-"); logger.info("chunker num : " + chunkers.length); String target = null; Integer targetPos = -1; if (tmp.length == 2) { target = tmp[0].trim(); targetPos = Integer.parseInt(tmp[1].trim ()); for (String ck : chunkers ) { logger.info("ck : " + ck); String [] subBlock = ck.split("\\s+"); boolean isIn = false; for (String wd : subBlock ) { Integer wdPos = Integer.parseInt(wd.substring(wd.indexOf("-") + 1, wd.length()).trim()); if (wdPos.equals(targetPos) ) { isIn = true; break; } } if (isIn) { target = ck.replaceAll("-|\\d+", "").replaceAll("\\s+"," "); break; } } } logger.info("Completion Target : " + target); return target == null ? orgTarget.replaceAll("-|\\d+", "").replaceAll("\\s+"," ") : target; } public void completeTargetFiles ( String inFileName, String outFileName ) { if (inFileName == null || outFileName == null ) { logger.error("parameter is null!"); return ; } try { BufferedReader input = new BufferedReader (new FileReader (new File (inFileName))); BufferedWriter output = new BufferedWriter (new FileWriter (new File(outFileName ))); try { String line = null; while ((line = input.readLine()) != null ) { String target = completeTarget (line.trim()); output.write(line + "\t" + target + "\n"); } } finally { if (input != null ) input.close(); if (output != null ) output.close(); } }catch (FileNotFoundException ex) { ex.printStackTrace(); }catch (IOException ex ) { ex.printStackTrace(); } } public static void main (String [] args ) { //String qt = "how high is the highest point in montana ?"; TargetCompletion tc = TargetCompletion.getInstance(); final String IN_FILE_NAME = "./data/geo880.txt"; final String OUT_FILE_NAME = "./data/output/geo880.completeTarget"; tc.completeTargetFiles(IN_FILE_NAME, OUT_FILE_NAME); //logger.info("Complete Target : " + tc.completeTarget(qt)); logger.info("Finished!"); } }
[ "spkangirhit@gmail.com" ]
spkangirhit@gmail.com
746c7fc59f2662dc24ed1715cfc1465cc71380c1
d9a4e810ea20e6116e282de68bbc524ade7c45d3
/ada-vcs/src/main/java/ada/domain/dvc/values/repository/watcher/WatcherSink.java
353f0ca2f03fdb9da562944fed08bd8b4735fbb1
[ "Apache-2.0" ]
permissive
cokeSchlumpf/ada
483283b64a50f9a7ffda9e5ab064a5639fd873d7
a4f091cc00eab66211ee0830e4c2ae50574facca
refs/heads/master
2020-04-05T16:16:17.274351
2019-06-01T13:19:04
2019-06-01T13:19:04
157,004,774
1
0
null
null
null
null
UTF-8
Java
false
false
721
java
package ada.domain.dvc.values.repository.watcher; import ada.domain.dvc.protocol.api.RepositoryMessage; import ada.domain.dvc.values.repository.RepositorySink; import ada.domain.dvc.values.repository.version.VersionDetails; import akka.actor.typed.ActorRef; import akka.stream.javadsl.Sink; import akka.util.ByteString; import lombok.AllArgsConstructor; import java.util.concurrent.CompletionStage; @AllArgsConstructor(staticName = "apply") public final class WatcherSink implements RepositorySink { private final RepositorySink actual; private final ActorRef<RepositoryMessage> actor; @Override public Sink<ByteString, CompletionStage<VersionDetails>> get() { return actual.get(); } }
[ "michael.wellner@de.ibm.com" ]
michael.wellner@de.ibm.com
18057aff673fe3a51a2d8c7070ea6fa63940ed35
a94c5dccdd6b25d40fde78abe2d6c95ad13f7cc2
/varios/Programación java/prueba_ciclos/src/prueba_ciclos/EjemploArreglos.java
a53101f579cafec1c8195e315032f1ee98418b02
[]
no_license
ngaitan55/Personal
5b3e500f9fd39d6e8e2430f1ce2c7cfca606f4bb
64a7ee7a4ebcecf7cc718211e7cfc51029a437e0
refs/heads/master
2022-12-17T04:50:09.088591
2020-09-19T02:23:50
2020-09-19T02:23:50
268,140,797
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
1,681
java
package prueba_ciclos; import java.util.Scanner; public class EjemploArreglos { public static void main(String[] args) { // TODO Auto-generated method stub double[] notas; notas = new double[5]; notas[0] = 5; notas[1] = 4.5; notas[2] = 2.5; notas[3] = 4.3; notas[4] = 3.8; double suma = notas[1] + notas[4]; System.out.println(suma); notas[2]+=1; System.out.println("Nota modificada a: " + notas[2]); int cantidadNotas = notas.length; System.out.println("Las notas son: " + cantidadNotas); double [] grades; Scanner scanner = new Scanner(System.in); System.out.println("Escriba la cantidad de notas"); String linea = scanner.nextLine(); int cantidadDeNotas = Integer.parseInt(linea); System.out.println(cantidadDeNotas); grades = new double[cantidadDeNotas]; int n = grades.length; for(int i = 0; i<n; i+=1){ System.out.println("Escriba la siguiente nota: "); linea = scanner.nextLine(); System.out.println("Siguiente línea: "+ linea + " contador: " + i + " cantidad notas: " + n); grades[i] = Double.parseDouble(linea); } System.out.println("Finalizada la captura de notas"); double numerador = 0; double denominador = grades.length;; double promedio = 0; for(int i = 0; i<grades.length; i +=1){ numerador += grades[i]; } if(denominador == 0 || numerador == 0){ promedio = 0; }else{ promedio = numerador/denominador; } if(promedio != 0){ System.out.println("El promedio es: " + promedio); }else if(denominador != 0){ System.out.println("Todos sacaron 0"); }else{ System.out.println("No hay notas"); } } }
[ "ngaitan55@gmail.com" ]
ngaitan55@gmail.com
6ba270f6f0364f58c103f21e5f56428fefc410d3
b7735f5cf5eede09c8dd1281a27378bb910f1330
/src/tests/unit/tyrex/tm/xid/GlobalXid_BaseXidImpl.java
93c3eadf84f6051a75b59b942d03af2da0f79ee1
[]
no_license
mkurz/tyrex
d350a218fcee667939e3a5a605f98b3dd1cbbe19
eecee10bca2f0f036a5c27cedb97ba98d7404282
refs/heads/master
2021-01-02T08:18:38.936544
2005-12-01T14:23:06
2005-12-01T14:23:06
98,991,906
0
0
null
null
null
null
UTF-8
Java
false
false
3,132
java
/** * Redistribution and use of this software and associated documentation * ("Software"), with or without modification, are permitted provided * that the following conditions are met: * * 1. Redistributions of source code must retain copyright * statements and notices. Redistributions must also contain a * copy of this document. * * 2. Redistributions in binary form must reproduce the * above copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. The name "Exolab" must not be used to endorse or promote * products derived from this Software without prior written * permission of Intalio. For written permission, * please contact info@exolab.org. * * 4. Products derived from this Software may not be called "Exolab" * nor may "Exolab" appear in their names without prior written * permission of Intalio. Exolab is a registered * trademark of Intalio. * * 5. Due credit should be given to the Exolab Project * (http://www.exolab.org/). * * THIS SOFTWARE IS PROVIDED BY INTALIO AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * INTALIO OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * Copyright 1999-2001 (C) Intalio Inc. All Rights Reserved. * * $Id: GlobalXid_BaseXidImpl.java,v 1.3 2001/09/12 13:36:25 mills Exp $ */ package tyrex.tm.xid; import junit.framework.TestCase; import junit.framework.TestSuite; import java.io.PrintWriter; /** * * @author <a href="mailto:mills@intalio.com">David Mills</a> * @version $Revision: 1.3 $ */ public class GlobalXid_BaseXidImpl extends BaseXidTest { public GlobalXid_BaseXidImpl(String name) { super(name); } /** * The method for creating an instance of BaseXid. */ public BaseXid newBaseXid() throws Exception { return (BaseXid) new GlobalXid(); } /** * <p>The method for returning a String representation of * BaseXid.</p> */ public String getStringXid(BaseXid xid) throws Exception { char[] pref = xid.createPrefix(BaseXid.FORMAT_ID); return new String(pref) + tyrex.Unit.byteArrayToString(xid.getGlobalTransactionId()); } /** * <p>Whether the class (the test's newBaseXid() method) is * expected to produce unique ids.</p> */ public boolean uniqueIds() throws Exception { return true; } }
[ "mills@users.sourceforge.net" ]
mills@users.sourceforge.net
976d3f9cd9dfab7ff804acff10aad7c636b4e9f3
26c064780b4260c5877817876a7ed8f3b107f054
/src/BusquedaAnchuraBall.java
67531d2bb218b8c75618437ae3f2d13d95252a04
[]
no_license
Dantevils/InteligenciaArtificial
5e140c2c03a7d087b13ac9ab2966b37fe613442a
8acb81f60159c7d9f84d751ca06821736fa255cb
refs/heads/master
2021-01-01T19:44:23.959113
2017-07-28T15:50:45
2017-07-28T15:50:45
98,664,542
0
1
null
null
null
null
UTF-8
Java
false
false
14,393
java
import java.util.ArrayList; import java.util.TimerTask; public class BusquedaAnchuraBall extends TimerTask implements Constantes { public Laberinto laberinto; public ArrayList<Estado> colaEstados; public ArrayList<Estado> historial; public ArrayList<Character> pasos; public int index_pasos; public ArrayList<Estado> destinos;/*Multiples destinos*/ public ArrayList<Estado> destinos2;/*Multiples destinos*/ public ArrayList<Estado> destinos3;/*Multiples destinos*/ public Estado inicial; public Estado objetivo; public Estado temp; public boolean exito; public boolean parar; public Item Ball; public BusquedaAnchuraBall(Laberinto laberinto, Item Ball) { this.laberinto=laberinto; this.Ball = Ball; colaEstados=new ArrayList<>(); historial=new ArrayList<>(); pasos=new ArrayList<>(); index_pasos=0; exito=false; /*Inicializacion*/ destinos = new ArrayList<>(); destinos2 = new ArrayList<>(); destinos3 = new ArrayList<>(); parar = false; } public boolean buscar2(Estado inicial, Estado objetivo){ index_pasos = 0; colaEstados.add(inicial); historial.add(inicial); this.objetivo = objetivo; exito=false; //si el inicial es final, salimos if ( inicial.equals(objetivo)) exito=true; // si no mientras que la cola no este vacia y no hayamos // alcanzado el meta hacemos lo siguiente while ( !colaEstados.isEmpty() && !exito ){ //tomamos el primero y lo quitamos de cola de estad temp=colaEstados.get(0); colaEstados.remove(0); //lo exploramos, es decir, generamos sus sucesores, // es decir, los estados a los que podemos ir desde el // estado actual moverArriba(temp); moverAbajo(temp); moverIzquierda(temp); moverDerecha(temp); } if (exito) { System.out.println("Ruta Calculada"); this.calcularRuta2(); return true; } else{ System.out.println("La ruta no pudo carcular"); return false; } } /* public void buscar(int x1,int y1,int x2,int y2) { //creamos el estado inicial y el objetivo inicial=new Estado(x1,y1,'N',null); objetivo=new Estado(x2,y2,'P',null); //los añadimos a la cola de estados y al historial colaEstados.add(inicial); historial.add(inicial); //si el inicial es final, salimos if ( inicial.equals(objetivo)) exito=true; // si no mientras que la cola no este vacia y no hayamos // alcanzado el meta hacemos lo siguiente while ( !colaEstados.isEmpty() && !exito ){ //tomamos el primero y lo quitamos de cola de estad temp=colaEstados.get(0); colaEstados.remove(0); //lo exploramos, es decir, generamos sus sucesores, // es decir, los estados a los que podemos ir desde el // estado actual moverArriba(temp); moverAbajo(temp); moverIzquierda(temp); moverDerecha(temp); } if ( exito ) System.out.println("Ruta calculada"); else System.out.println("La ruta no pudo calcularse"); }*/ /*Movimientos*/ private void moverArriba(Estado e) { if ( e.y > 0 ) { if ( laberinto.celdas[e.x][e.y-1].tipo != 'O'&& laberinto.celdas[e.x][e.y-1].tipo != 'P'&& laberinto.celdas[e.x][e.y-1].tipo != 'A'&& laberinto.celdas[e.x][e.y-1].tipo != 'J' ) { Estado arriba=new Estado(e.x,e.y-1,'U',e); if ( !historial.contains(arriba)) { colaEstados.add(arriba); historial.add(arriba); if ( arriba.equals(objetivo)) { objetivo=arriba; exito=true; } } } } }//fin del metodo moverArriba private void moverAbajo(Estado e) { if ( e.y+1 < alturaMundoVirtual ) { if ( laberinto.celdas[e.x][e.y+1].tipo != 'O'&& laberinto.celdas[e.x][e.y+1].tipo != 'P' && laberinto.celdas[e.x][e.y+1].tipo != 'A'&& laberinto.celdas[e.x][e.y+1].tipo != 'J' ) { Estado abajo=new Estado(e.x,e.y+1,'D',e); if ( !historial.contains(abajo)) { colaEstados.add(abajo); historial.add(abajo); if ( abajo.equals(objetivo)) { objetivo=abajo; exito=true; } } } } } private void moverIzquierda(Estado e) { if ( e.x > 0 ) { if ( laberinto.celdas[e.x-1][e.y].tipo != 'O' && laberinto.celdas[e.x-1][e.y].tipo != 'P' && laberinto.celdas[e.x-1][e.y].tipo != 'A' && laberinto.celdas[e.x-1][e.y].tipo != 'J') { Estado izquierda=new Estado(e.x-1,e.y,'L',e); if ( !historial.contains(izquierda)) { colaEstados.add(izquierda); historial.add(izquierda); if ( izquierda.equals(objetivo)) { objetivo=izquierda; exito=true; } } } } }// fin del metodo izquierda private void moverDerecha(Estado e) { if ( e.x < anchuraMundoVirtual-1 ) { if ( laberinto.celdas[e.x+1][e.y].tipo != 'O' && laberinto.celdas[e.x+1][e.y].tipo != 'P' && laberinto.celdas[e.x+1][e.y].tipo != 'A' && laberinto.celdas[e.x+1][e.y].tipo != 'J' ) { Estado derecha=new Estado(e.x+1,e.y,'R',e); if ( !historial.contains(derecha)){ colaEstados.add(derecha); historial.add(derecha); if ( derecha.equals(objetivo)) { objetivo=derecha; exito=true; } } } } } public void calcularRuta() { Estado predecesor=objetivo; do{ pasos.add(predecesor.oper); predecesor=predecesor.predecesor; }while ( predecesor != null); index_pasos=pasos.size()-1; } public void calcularRuta2() { Estado predecesor=objetivo; do{ pasos.add(0,predecesor.oper); predecesor=predecesor.predecesor; }while ( predecesor != null); index_pasos=pasos.size()-1; } /*Para Orientar el Hilo*/ public boolean Contacofail(int x,int y){ Estado ActualPelota; ActualPelota = new Estado(Ball.item.x,Ball.item.y,'N',null); if (ActualPelota.equals(new Estado(x-1,y,'N',null))) { System.out.println("Izquierda"); // laberinto.LienzoPadre.adversario.moverCeldaArriba(); // laberinto.LienzoPadre.adversario.moverCeldaIzquierda(); //laberinto.LienzoPadre.repaint(); return true; } return false; } public boolean Contacofail2(int x,int y){ Estado ActualPelota; ActualPelota = new Estado(Ball.item.x,Ball.item.y,'N',null); if (ActualPelota.equals(new Estado(x,y-1,'N',null))) { System.out.println("contactofail2"); // laberinto.LienzoPadre.adversario.moverCeldaArriba(); // laberinto.LienzoPadre.adversario.moverCeldaIzquierda(); //laberinto.LienzoPadre.repaint(); return true; } return false; } public boolean ContactoPelotajugador(int x,int y,int j,int k){ Estado ActualPelota; ActualPelota = new Estado(Ball.item.x,Ball.item.y,'N',null); if (ActualPelota.equals(new Estado(x+1,y,'N',null))==true && ActualPelota.equals(new Estado(j-1,k,'N',null))==true) { System.out.println("Con los 2 maricones al lado"); return true; } return false; } public boolean ContactoPelota(int x,int y){ Estado ActualPelota; ActualPelota = new Estado(Ball.item.x,Ball.item.y,'N',null); if (ActualPelota.equals(new Estado(x,y-1,'N',null))) { System.out.println("Arriba"); return true; } if (ActualPelota.equals(new Estado(x,y+1,'N',null))) { System.out.println("Abajo"); return true; } if (ActualPelota.equals(new Estado(x-1,y,'N',null))) { System.out.println("Izquierda"); // laberinto.LienzoPadre.adversario.moverCeldaArriba(); // laberinto.LienzoPadre.adversario.moverCeldaIzquierda(); //laberinto.LienzoPadre.repaint(); return true; } if (ActualPelota.equals(new Estado(x+1,y,'N',null))) { System.out.println("Derecha"); //laberinto.LienzoPadre.adversario.moverCeldaAbajo(); //laberinto.LienzoPadre.adversario.moverCeldaDerecha(); // laberinto.LienzoPadre.adversario.moverCeldaIzquierdaArriba(); // laberinto.LienzoPadre.repaint(); return true; } return false; } @Override public synchronized void run() { if (!parar && ContactoPelotajugador(laberinto.LienzoPadre.adversario.adversario.x,laberinto.LienzoPadre.adversario.adversario.y,laberinto.LienzoPadre.Hero.jugador.x ,laberinto.LienzoPadre.Hero.jugador.y)==true) { this.laberinto.LienzoPadre.Pelota.REBOTECTM(); laberinto.LienzoPadre.repaint(); } /*modificacion*/ /*if (!parar && ContactoPelota(laberinto.LienzoPadre.adversario.adversario.x,laberinto.LienzoPadre.adversario.adversario.y) ==true ) { } if (!parar && Contacofail2(laberinto.LienzoPadre.Hero.jugador.x ,laberinto.LienzoPadre.Hero.jugador.y ) == true) { this.laberinto.LienzoPadre.Pelota.REBOTEfail2(); laberinto.LienzoPadre.repaint(); }*/ if (!parar && Contacofail(laberinto.LienzoPadre.adversario.adversario.x,laberinto.LienzoPadre.adversario.adversario.y) == true) { this.laberinto.LienzoPadre.Pelota.REBOTE2(); laberinto.LienzoPadre.repaint(); } if (!parar && ContactoPelota(laberinto.LienzoPadre.adversario.adversario.x,laberinto.LienzoPadre.adversario.adversario.y) == true && ContactoPelota(laberinto.LienzoPadre.Hero.jugador.x,laberinto.LienzoPadre.Hero.jugador.y) == true ) { System.out.println("Rebote"); //subinicial = new Estado(laberinto.LienzoPadre.Hero.jugador.x,laberinto.LienzoPadre.Hero.jugador.y,'N',null); this.laberinto.LienzoPadre.Pelota.REBOTE(); /* this.Ball.laberinto.celdas[Ball.item.x][Ball.item.y].tipo='V'; int y = numeroAleatorio(Ball.item.y+2,Ball.item.y+4); int x = numeroAleatorio(Ball.item.x+2,Ball.item.x+4); this.Ball.laberinto.celdas[x][y].tipo='I'; */ laberinto.LienzoPadre.repaint(); } if (!parar && ContactoPelota(laberinto.LienzoPadre.adversario.adversario.x,laberinto.LienzoPadre.adversario.adversario.y) == true ) { System.out.println("El loco esta serca"); // this.laberinto.LienzoPadre.Pelota.BAB.destinos.add(new Estado(laberinto.LienzoPadre.Hero.jugador.x,laberinto.LienzoPadre.Hero.jugador.y,'N',null)); Estado subinicial,subobjetivo; boolean resultado; colaEstados.clear(); historial.clear(); pasos.clear(); do { //subinicial = new Estado(laberinto.LienzoPadre.Hero.jugador.x,laberinto.LienzoPadre.Hero.jugador.y,'N',null); subinicial = new Estado(Ball.item.x,Ball.item.y,'N',null); subobjetivo = destinos.get(0); resultado = this.buscar2(subinicial, subobjetivo); if (resultado == false ) { destinos.remove(subobjetivo); colaEstados.clear(); historial.clear(); pasos.clear(); } if (subinicial.equals(subobjetivo)) { destinos.remove(subobjetivo); } if (destinos.isEmpty()) { System.out.println("se acabo a donde ir"); parar = true; this.cancel(); } } while (!resultado && !destinos.isEmpty()); if (pasos.size()> 1) { switch(pasos.get(1)) { case 'D': laberinto.LienzoPadre.Pelota.moverCeldaAbajo();break; case 'U': laberinto.LienzoPadre.Pelota.moverCeldaArriba();break; case 'R': laberinto.LienzoPadre.Pelota.moverCeldaDerecha();break; case 'L': laberinto.LienzoPadre.Pelota.moverCeldaIzquierda();break; } laberinto.LienzoPadre.repaint(); } /* if ( index_pasos >= 0 ) { switch(pasos.get(index_pasos)) { case 'D': laberinto.LienzoPadre.Hero.moverCeldaAbajo();break; case 'U': laberinto.LienzoPadre.Hero.moverCeldaArriba();break; case 'R': laberinto.LienzoPadre.Hero.moverCeldaDerecha();break; case 'L': laberinto.LienzoPadre.Hero.moverCeldaIzquierda();break; } laberinto.LienzoPadre.repaint(); index_pasos--; }else { this.cancel();*/ } /* if (!parar && ContactoPelota(laberinto.LienzoPadre.Hero.jugador.x,laberinto.LienzoPadre.Hero.jugador.y) == true ) { System.out.println("El HERO esta serca"); // this.laberinto.LienzoPadre.Pelota.BAB.destinos.add(new Estado(laberinto.LienzoPadre.Hero.jugador.x,laberinto.LienzoPadre.Hero.jugador.y,'N',null)); Estado subinicial,subobjetivo; boolean resultado; colaEstados.clear(); historial.clear(); pasos.clear(); do { //subinicial = new Estado(laberinto.LienzoPadre.Hero.jugador.x,laberinto.LienzoPadre.Hero.jugador.y,'N',null); subinicial = new Estado(Ball.item.x,Ball.item.y,'N',null); subobjetivo = destinos2.get(0); resultado = this.buscar2(subinicial, subobjetivo); if (resultado == false ) { destinos2.remove(subobjetivo); colaEstados.clear(); historial.clear(); pasos.clear(); } if (subinicial.equals(subobjetivo)) { destinos2.remove(subobjetivo); } if (destinos2.isEmpty()) { System.out.println("se acabo a donde ir"); parar = true; this.cancel(); } } while (!resultado && !destinos2.isEmpty()); if (pasos.size()> 1) { switch(pasos.get(1)) { case 'D': laberinto.LienzoPadre.Pelota.moverCeldaAbajo();break; case 'U': laberinto.LienzoPadre.Pelota.moverCeldaArriba();break; case 'R': laberinto.LienzoPadre.Pelota.moverCeldaDerecha();break; case 'L': laberinto.LienzoPadre.Pelota.moverCeldaIzquierda();break; } laberinto.LienzoPadre.repaint(); } } */ } }
[ "dantes.alfredo@gmail.com" ]
dantes.alfredo@gmail.com
306c597fe5726eb89605a2a720ed5322a8f59ead
1bb11aafdbd10cf1014a1d77cb245e0a08aa369e
/src/main/java/net/msj0319/api/quiz/service/GeneratorServiceImpl.java
0659e73225a72282514a28246d002ab03133c6ec
[]
no_license
msj0319/bithumb-tech-6-spring-boot-webflux
f4744a63592915a7940c9b53b65d829fafa9a58b
b77e70af329017133e4d14a3f608f46a905377c4
refs/heads/main
2023-07-21T09:23:31.650810
2021-09-05T17:28:01
2021-09-05T17:28:01
402,145,647
0
0
null
null
null
null
UTF-8
Java
false
false
586
java
package net.msj0319.api.quiz.service; import net.msj0319.api.quiz.domain.Factor; import org.springframework.stereotype.Service; import java.util.Random; import java.util.function.Function; @Service public class GeneratorServiceImpl implements GeneratorService { @Override public int randomFactor() { Function<String, Integer> function = Integer::parseInt; return new Random().nextInt(function.apply(Factor.MAXIMUM.toString()) - function.apply(Factor.MINIMUM.toString()) + 1) + function.apply(Factor.MINIMUM.toString()); } }
[ "gaeddongie13@gmail.com" ]
gaeddongie13@gmail.com
1389830cc9adc5850163e8ef880c246d827dc4f7
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/1/1_b90464659e3e4343114f7fb532531a0c8e378f16/CardStack/1_b90464659e3e4343114f7fb532531a0c8e378f16_CardStack_s.java
6cfbd3f86c4f12d946cfe6a4adcd6effe4076254
[]
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
547
java
package de.htwg.se.dog.models; import java.util.Stack; public class CardStack { private Stack<Card> cardstack; public CardStack(){ cardstack = new Stack<>(); } public static Card[] generateCardArray(){ Card[] cardArray = new Card[55]; for(int i = 0; i <= 3 ; i++){ for(int j = 0; j <= 12; j++){ cardArray[(i*13) + j] = new Card(j+1); } } cardArray[52] = new Card(14); cardArray[53] = new Card(14); cardArray[54] = new Card(14); return cardArray; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
7e38d83211a1c5272ccbbbe3eca4375dee859830
e1d12733b7929b70adaa40784e8e0119b28b43ea
/src/main/java/com/mobiq/test/utils/dataGeneration/collection/SetGenerator.java
e72e8f0909ae62147f637aa30e32c240dd764f54
[]
no_license
dmitry-malinovsky/mobiq-atf-api
8ed305694788cee7fe8e05b741d31baf7b5f80a2
7acb20d51db4b517250d2bcefb9e2f2fb973b00b
refs/heads/master
2023-05-31T11:36:47.997694
2021-06-09T14:08:05
2021-06-09T14:08:05
336,237,618
0
0
null
2021-02-08T18:35:05
2021-02-05T10:24:50
Java
UTF-8
Java
false
false
422
java
package com.mobiq.test.utils.dataGeneration.collection; import com.mobiq.test.utils.dataGeneration.metadata.Metadata; import java.util.*; import java.util.function.Supplier; public class SetGenerator extends CollectionGenerator<Set<?>> { public SetGenerator(Metadata metadata) { super(metadata); } protected Supplier<Collection<Set<?>>> collectionSupplier() { return HashSet::new; } }
[ "dmitrii.malinovschii@gmail.com" ]
dmitrii.malinovschii@gmail.com