blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11c7cec7aa220184835314f71cf18203ec425328 | 1c8c61bef26ee827d6e9568c24996c1d81c08c17 | /src/main/java/com/looseboxes/webform/web/WebRequest.java | 15684015ffac7d7eb21b76126e89c0280be400df | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | missaouib/webform | 5b425a81deb246d691969bd5e88549e0d83a456c | 960832908239adc7a4c8e278d19040895c2a1a6e | refs/heads/master | 2023-08-02T07:39:50.566834 | 2021-09-15T21:13:05 | 2021-09-15T21:13:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package com.looseboxes.webform.web;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.springframework.web.multipart.MultipartFile;
/**
* @author hp
*/
public interface WebRequest<T> {
String getSessionId();
String getParameter(String name);
String [] getParameterValues(String name);
boolean hasFiles();
Map<String, MultipartFile> getFiles();
Locale getLocale();
Map<String, List<MultipartFile>> getMultiValueFiles();
}
| [
"[email protected]"
] | |
ba0a3ceb54955f1283eacaee745f432447144951 | d8ffdeb3d864dc86f1b8f25a48cf50a4a6f5f67f | /app/src/test/java/com/example/usuario/gerenciadorlicitatorio/ExampleUnitTest.java | 5de14453d9ccbf048dcb93aa3f3c5834ce5d0f1c | [] | no_license | gerenciadorlicitatorio/GerenciadorLicitatorio | 15b52426932060bbef28d07a7760a32e4db20394 | 063d0e3d8531e259f894c50f318bbba7e63bd97c | refs/heads/master | 2020-03-31T13:39:40.341212 | 2018-10-15T13:40:16 | 2018-10-15T13:40:16 | 152,263,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.example.usuario.gerenciadorlicitatorio;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
ec60206ef33312e51a6f68f4d8e75ef61d29affc | 3fca45801c96147e3bda238cf81580c3c5c7e970 | /javaPlusDay1/src/com/ibeifeng/com/MyVector.java | c90e614fa1c08b23f6ea50a92549312900693498 | [] | no_license | Diana212926/hadoop | 5feb1a7c95f288074ce86dcef5ea1a6d97a11c8a | 541a0221b81b6c9cb94df5efadff293fbded3d6d | refs/heads/master | 2020-02-26T16:48:59.966145 | 2016-10-21T09:38:09 | 2016-10-21T09:38:09 | 71,544,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.ibeifeng.com;
import java.util.Iterator;
import java.util.Vector;
public class MyVector {
public static void main(String[] args) {
Vector<Integer> vector = new Vector<Integer>();
vector.add(1);
vector.add(2);
vector.add(3);
vector.add(10);
Iterator<Integer> iterator = vector.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
}
}
| [
"Administrator@USER-20160929WC"
] | Administrator@USER-20160929WC |
f9ef11d691136babec001689c72e41e3604538a8 | ad0bb3c68c2f901c02db59bbd024a8862db6c946 | /src/main/java/com/example/util/GetSqlSession.java | fff9ef2ff0d0b522e3aa747d64d2619a549958f7 | [] | no_license | techskywalker/loginproject | e65e1ee3d8784aca1da3af0313a43a15e3143ba7 | 5030d6cf5cb41a45b9f2735389be1d9291f5d37c | refs/heads/main | 2023-06-14T15:27:12.564837 | 2021-07-09T04:02:27 | 2021-07-09T04:02:27 | 384,327,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 976 | java | package com.example.util;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.IOException;
import java.io.InputStream;
public class GetSqlSession {
public static SqlSession createSqlSession() {
SqlSessionFactory sqlSessionFactory = null;
InputStream input = null;
SqlSession session = null;
try {
String resource = "mybatis-config.xml";
input = Resources.getResourceAsStream(resource);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(input);
session = sqlSessionFactory.openSession();
return session;
}catch (IOException e){
e.printStackTrace();
return null;
}
}
public static void main(String[] args) {
System.out.println(createSqlSession());
}
}
| [
"[email protected]"
] | |
b2ef83a78032ebda38c924d566d25ef0c25117e9 | f8e16f002a901f63241c0969c25b61a5e920f380 | /src/main/java/com/example/demo/pojo/Blog.java | bdd5afaaf67a08f2a044a0f581e9d1836422d928 | [] | no_license | PottermoreIron/Debate-demo-B-E | e3aebfc24cc4b6ddd03e6205e414d0ef4c607cf6 | 00999e792db5cc552a62c03132ec86f6c806df79 | refs/heads/master | 2023-02-18T12:47:28.779712 | 2021-01-19T14:41:22 | 2021-01-19T14:41:22 | 331,008,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package com.example.demo.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Blog {
private Integer blog_id;
private Integer blog_authorId;
private Date blog_time;
private String blog_content;
private String blog_title;
}
| [
"[email protected]"
] | |
80eaaac06323576bd497b0a2c3ff072fec472ddd | 500a9e06d3f938f00fd6e6c66e3e6d037a51311d | /store-front-micro/store-front-gateway-service/src/main/java/com/storefront/StoreFrontGatewayServiceApplication.java | 4e7a496052ab6043ab7a0a8274c981b0f6fa51ba | [] | no_license | praneethdodedu/storefront | 5ccbfc804b57cbba1a8457d3050002ef9342d85b | 87655b6c60d1bf007f8ac453add81ec899020495 | refs/heads/master | 2021-01-24T21:03:30.548761 | 2018-02-28T09:59:53 | 2018-02-28T09:59:53 | 123,264,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,262 | java | package com.storefront;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.oauth2.client.OAuth2ClientContext;
import org.springframework.session.data.redis.RedisFlushMode;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@SpringBootApplication
@EnableZuulProxy
@EnableOAuth2Sso
@EnableRedisHttpSession(redisFlushMode = RedisFlushMode.IMMEDIATE)
public class StoreFrontGatewayServiceApplication extends WebSecurityConfigurerAdapter {
public static void main(String[] args) {
SpringApplication.run(StoreFrontGatewayServiceApplication.class, args);
}
@Bean
public AlwaysSampler defaultSampler() {
return new AlwaysSampler();
}
@Autowired
OAuth2ClientContext oauth2ClientContext;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.antMatcher("/**").authorizeRequests()
.antMatchers("/", "/login**", "/webjars/**", "/users/signUpNewUser", "/courses/getPreviewCourses",
"/accounts")
.permitAll().anyRequest().authenticated().and().exceptionHandling().and().logout().logoutSuccessUrl("/")
.permitAll().and().csrf().disable();
// .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
}
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
};
}
}
| [
"[email protected]"
] | |
f4c7c808139186887e1d1b0cc3cd4b1239aac2c3 | a336c8ce418abd236fcba788b195daf897e29b9a | /src/main/java/com/viiyue/plugins/mybatis/utils/StringAppender.java | 86bd5002f03878be191c2e04fd340287f72f6c70 | [
"Apache-2.0"
] | permissive | tangxbai/mybatis-mapper | c0fa9c31970d6e476b3ef5d64035cf8111777e3a | 23b93c49776e1459b982554cf0515b91490ee9d5 | refs/heads/master | 2023-04-07T01:30:34.455314 | 2023-03-24T07:12:43 | 2023-03-24T07:12:43 | 213,864,262 | 8 | 0 | Apache-2.0 | 2023-03-24T07:12:44 | 2019-10-09T08:33:46 | Java | UTF-8 | Java | false | false | 3,011 | java | /**
* Copyright (C) 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.viiyue.plugins.mybatis.utils;
/**
* Some auxiliary method extensions for {@code StringBuilder}
*
* @author tangxbai
* @since 1.1.0
*/
public class StringAppender {
/**
* Starting with 1.2.0, changed from {@link StringBuffer} to {@link StringBuilder}.
*/
private final StringBuilder builder;
public StringAppender() {
this( new StringBuilder() );
}
public StringAppender( int capacity ) {
this( new StringBuilder( capacity ) );
}
public StringAppender( StringBuilder buffer ) {
this.builder = buffer;
}
public boolean isEmpty() {
return builder.length() == 0;
}
public boolean hasContent() {
return builder.length() > 0;
}
public boolean startsWith( String content ) {
if ( content != null ) {
return builder.indexOf( content ) == 0;
}
return false;
}
// fixed in 1.2.0
public boolean endsWith( String content ) {
if ( content != null ) {
return builder.lastIndexOf( content ) == builder.length() - content.length();
}
return false;
}
public StringAppender addDelimiter( String delimiter ) {
if ( delimiter != null && hasContent() ) {
this.builder.append( delimiter );
}
return this;
}
public final <T> StringAppender insert( int offset, T content ) {
if ( content != null ) {
this.builder.insert( offset, content );
}
return this;
}
public <T> StringAppender prepend( T content ) {
if ( content != null ) {
this.builder.insert( 0, content );
}
return this;
}
public StringAppender append( String content ) {
if ( content != null ) {
this.builder.append( content );
}
return this;
}
public StringAppender append( Object content ) {
if ( content != null ) {
this.builder.append( content );
}
return this;
}
public <T> StringAppender append( StringAppender appender ) {
if ( appender != null && appender.hasContent() ) {
this.builder.append( appender.getAppender() );
}
return this;
}
public StringAppender delete( int start, int end ) {
this.builder.delete( start, end );
return this;
}
public StringAppender reset() {
this.builder.setLength( 0 );
return this;
}
public StringBuilder getAppender() {
return builder;
}
@Override
public String toString() {
return builder.toString();
}
}
| [
"[email protected]"
] | |
2028300c70666494f484a331befb033f41a29c14 | 042342f9dc0e8662a1a7da671ab5dc9d82ccd835 | /esb/org.wso2.developerstudio.eclipse.gmf.esb/src/org/wso2/developerstudio/eclipse/gmf/esb/HTTPEndPointOutputConnector.java | 5f8e3c505b1b47985493f385a87357614539ecd1 | [
"Apache-2.0"
] | permissive | ksdperera/developer-studio | 6fe6d50a66e4fb73de3a4dbeef8d68b461da1ab6 | 9c0f601b91cc34dda036c660598a93c232260e08 | refs/heads/developer-studio-3.8.0 | 2021-01-15T08:50:21.571267 | 2018-10-26T12:59:17 | 2018-10-26T12:59:17 | 39,486,894 | 0 | 1 | Apache-2.0 | 2018-10-26T12:59:18 | 2015-07-22T05:13:13 | Java | UTF-8 | Java | false | false | 1,047 | java | /**
* Copyright 2009-2012 WSO2, Inc. (http://wso2.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.developerstudio.eclipse.gmf.esb;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>HTTP End Point Output Connector</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getHTTPEndPointOutputConnector()
* @model
* @generated
*/
public interface HTTPEndPointOutputConnector extends OutputConnector {
} // HTTPEndPointOutputConnector
| [
"[email protected]"
] | |
3b90a880345061f5c5e3caf3dc8940bfc26d14e1 | 1b73e8efd1ec9fbdd2c32162eaf0f8ce30666d08 | /Mosima/Projet_Calibration_M2/src/Model_Calibration/GDE/TeacherGDE.java | 8ca6fac653402c8b697998a0cd7d948c7286e731 | [] | no_license | dtbinh/M2_Androide | 060db9575aa10b8ab0a9707db3e34cc64f5d0e03 | a828b7ff477470c8e00c012dd36d61df2ef7d910 | refs/heads/master | 2020-06-16T05:02:29.653270 | 2016-11-29T11:54:24 | 2016-11-29T11:54:24 | 75,243,702 | 1 | 0 | null | 2016-12-01T01:38:37 | 2016-12-01T01:38:36 | null | UTF-8 | Java | false | false | 10,411 | java | package Model_Calibration.GDE;
import java.util.ArrayList;
import java.util.LinkedList;
import AlgoGDE.GroupedDifferentialEvolution;
import AlgoGDE.Pair;
import AlgoGDE.Teacher.Result;
import Model_Calibration.OptionResults;
import Model_Calibration.Parameters;
import Model_PredatorPrey.ParallelSimuLauncher;
import Model_PredatorPrey.Simulation;
import uchicago.src.sim.util.SimUtilities;
public class TeacherGDE {
/*
* horizonCalib : horizon de calibration du modèle
* NbRunSimu : Nb de simu lancées pour le calcul de la fitness moyenne
* rangeAverageFitness : Plage de temps sur laquelle sont moyennées les sorties du modèle
* F : mutation parameter pour GDE (See Piotrowski, A.P., Napiórkowski, J.J., 2010. The grouping differential evolution algorithm for multi-dimensional optimization problems)
* Cr : crossover parameter pour GDE (See Piotrowski, A.P., Napiórkowski, J.J., 2010.)
* PNI_ : nombre d'iteration pendant lequel un groupe est autorisé à recevoir à échanger des informations avec les autres groupes quand il est bloqué dans un optimum local (See Piotrowski, A.P., Napiórkowski, J.J., 2010.)
* fitnessTarget : objectif de fitness
* maxIter : maxIter : nombre d'iterations max autorisées
*/
public double teachGDE(int horizonCalib, int NbRunSimu, int rangeAverageFitness, double F, double Cr, int PNI_, double fitnessTarget , int maxIter) {
int weightNb = 8;
double bestFitness = 999999;
int PNI = (int) PNI_;
double[] GFBEST_PNI = new double[4];
int counter_frozen_individual = 0;
LinkedList<Integer> frozList = new LinkedList<Integer>();
double[][] fitness;
double[][] fitness_nextgeneration;
GroupedDifferentialEvolution GDE = new GroupedDifferentialEvolution();
GDE.setDimension(weightNb);
GDE.setF(F);
GDE.setCr(Cr);
int pop_size = weightNb * 8;
int group_pop_size = weightNb * 2;
GDE.setPop_size(pop_size);
GDE.setGroupPop_size(group_pop_size);
double[][][] group_pop = GDE.init();
fitness = new double[4][group_pop_size];
fitness_nextgeneration = new double[4][group_pop_size];
int itr = 0;
Parameters parameters = new Parameters();
for (int n = 0; n < 4; ++n) {
for (int i = 0; i < group_pop_size; ++i) {
double penalty = parameters.BoundaryPenaltyParameters(group_pop[n][i]);
if( penalty > 0){
fitness[n][i] = 100 + penalty *10;
} else {
itr++;
ParallelSimuLauncher parallelSimuLauncher = new ParallelSimuLauncher();
double[] results = parallelSimuLauncher.getFitnessSimulation(NbRunSimu, horizonCalib, rangeAverageFitness, group_pop[n][i]);
double fit = results[0];
fitness[n][i] = fit;
if(fit < bestFitness){
bestFitness = fit;
if(OptionResults.showFitness){
System.out.println("bestFitness " + fit );
}
}
if(fit < fitnessTarget){
if(OptionResults.showCalibratedResults){
System.out.println("energyPredatorUseEachTick " + group_pop[n][i][0]);
System.out.println("energyPredatorUseForMate " + group_pop[n][i][1]);
System.out.println("energyPreyUseEachTick " + group_pop[n][i][2]);
System.out.println("energyPreyUseForMate " + group_pop[n][i][3]);
System.out.println("energyTakenFromGrass " + group_pop[n][i][4]);
System.out.println("energyTakenFromPrey " + group_pop[n][i][5]);
System.out.println("probabilityForPredatorMate " + group_pop[n][i][6]);
System.out.println("probabilityForPreyMate " + group_pop[n][i][7]);
System.out.println(" ");
System.out.println("meanRatePreysOverPredators " + results[1]);
System.out.println("meanRatePreyEaten " + results[2]);
}
return itr;
}
if(itr == maxIter){
return -1;
}
}
}
}
for (int counter = 0; counter < 50000; counter++) {
// --- core iteration step ---
double[][][] pop_nextgeneration = GDE.samplePopulation();
double[] GFBEST_current = new double[4];
int[] MinPop = new int[4];
double GF = 0;
for (int n = 0; n < 4; ++n) {
GFBEST_current[n] = 1;
}
for (int n = 0; n < 4; ++n) {
for (int i = 0; i < group_pop_size; ++i) {
if (pop_nextgeneration[n][i] != group_pop[n][i]) {
double fit = 0;
double penalty = parameters.BoundaryPenaltyParameters(group_pop[n][i]);
if( penalty > 0){
fit = 100 + penalty *10;
} else {
itr++;
if(itr == maxIter){
return -1;
}
ParallelSimuLauncher parallelSimuLauncher = new ParallelSimuLauncher();
double[] results = parallelSimuLauncher.getFitnessSimulation(NbRunSimu, horizonCalib, rangeAverageFitness, group_pop[n][i]);
fit = results[0];
if(fit < bestFitness){
bestFitness = fit;
if(OptionResults.showFitness){
System.out.println("bestFitness " + fit );
}
}
if (fit < fitnessTarget ){
if(OptionResults.showCalibratedResults){
System.out.println("energyPredatorUseEachTick " + group_pop[n][i][0]);
System.out.println("energyPredatorUseForMate " + group_pop[n][i][1]);
System.out.println("energyPreyUseEachTick " + group_pop[n][i][2]);
System.out.println("energyPreyUseForMate " + group_pop[n][i][3]);
System.out.println("energyTakenFromGrass " + group_pop[n][i][4]);
System.out.println("energyTakenFromPrey " + group_pop[n][i][5]);
System.out.println("probabilityForPredatorMate " + group_pop[n][i][6]);
System.out.println("probabilityForPreyMate " + group_pop[n][i][7]);
System.out.println(" ");
System.out.println("meanRatePreysOverPredators " + results[1]);
System.out.println("meanRatePreyEaten " + results[2]);
}
return itr;
}
}
fitness_nextgeneration[n][i] = fit;
if (fitness_nextgeneration[n][i] < fitness[n][i]) {
group_pop[n][i] = pop_nextgeneration[n][i];
fitness[n][i] = fitness_nextgeneration[n][i];
}
if (fitness[n][i] < GFBEST_current[n]) {
GFBEST_current[n] = fitness[n][i];
MinPop[n] = i;
}
}
}
}
if (counter % PNI == 0) {
if (counter == 0) {
GFBEST_PNI = GFBEST_current;
} else {
GF = 0;
for (int n = 0; n < 4; ++n) {
GF = GF + GFBEST_PNI[n] - GFBEST_current[n];
}
GF = GF / 100;
int[] LG = GDE.getLG();
int[] Lx = GDE.getLx();
int counter_group_trapped = 0;
for (int n = 0; n < 3; ++n) {
if (GFBEST_PNI[n] - GFBEST_current[n] < GF && LG[n] == 0 && counter_group_trapped == 0) {
LG[n] = 1;
counter_group_trapped = 1;
Lx[n * group_pop_size + MinPop[n]] = 1;
frozList.addLast(n * group_pop_size + MinPop[n]);
if (counter_frozen_individual < pop_size / 10) {
counter_frozen_individual = counter_frozen_individual + 1;
} else {
Lx[frozList.getFirst()] = 0;
frozList.removeFirst();
}
} else {
LG[n] = 0;
}
}
GDE.setLG(LG);
GDE.setLx(Lx);
GFBEST_PNI = GFBEST_current;
}
}
GDE.setPop(group_pop);
}
return itr;
}
public static double getMinFitness(double[][] fitness) {
double min = 1;
for (int n = 0; n < 4; ++n) {
for (int i = 0; i < fitness[n].length; ++i) {
if (fitness[n][i] < min) {
min = fitness[n][i];
}
}
}
return min;
}
public static int getMinPopFitness(double[][] fitness) {
double min = 1;
int minPop = 0;
for (int n = 0; n < 4; ++n) {
for (int i = 0; i < fitness[n].length; ++i) {
if (fitness[n][i] < min) {
min = fitness[n][i];
minPop = n * fitness[n].length + 1;
}
}
}
return minPop;
}
}
| [
"[email protected]"
] | |
db7ba1e6ecdb56200867cbf26a5c218249f0b588 | 6d441d79c9a159c00c4ab7d1961811631ef2e93c | /SpringMVCAnnotationShoppingCart/src/main/java/org/o7planning/springmvcshoppingcart/dao/ProductDAO.java | e56c9b1786f9f235d9ab219ad4d6001d1655b7c2 | [] | no_license | PraneethPathireddy/ShoppingCart | 008fddaa20fafef0a2c6a6acad91d78188826a27 | 779e572d13d96d20cd053b9fbaee272d0d786384 | refs/heads/master | 2022-12-22T14:53:26.082098 | 2019-07-21T04:19:00 | 2019-07-21T04:19:00 | 162,675,274 | 0 | 0 | null | 2022-12-16T07:25:42 | 2018-12-21T06:29:33 | Java | UTF-8 | Java | false | false | 754 | java | package org.o7planning.springmvcshoppingcart.dao;
import org.o7planning.springmvcshoppingcart.entity.Product;
import org.o7planning.springmvcshoppingcart.model.PaginationResult;
import org.o7planning.springmvcshoppingcart.model.ProductInfo;
public interface ProductDAO {
public Product findProduct(String code);
public ProductInfo findProductInfo(String code) ;
public PaginationResult<ProductInfo> queryProducts(int page,
int maxResult, int maxNavigationPage );
public PaginationResult<ProductInfo> queryProducts(int page, int maxResult,
int maxNavigationPage, String likeName);
public void save(ProductInfo productInfo);
} | [
"[email protected]"
] | |
6514a5491c71bf85c8b3f4ae0eceb4460cf5cd91 | 85751594e8f316b1d3e1c8e685f02f970021edd4 | /dfalex/src/main/java/com/nobigsoftware/dfalex/DfaStateImpl.java | 6e363d581e538ff4c5d8c838c75569a8c85301f8 | [
"Apache-2.0"
] | permissive | asmith26/ApexNLP | 29f0ae1b735795a21294d6c50e347a5b19cfd9f8 | 29bdc7fa0ea4aea396807e3c07cd73376726ee95 | refs/heads/master | 2021-01-19T10:14:37.795950 | 2017-03-14T09:16:18 | 2017-03-14T09:16:56 | 87,841,022 | 1 | 0 | null | 2017-04-10T17:56:56 | 2017-04-10T17:56:56 | null | UTF-8 | Java | false | false | 1,429 | java | /*
* Copyright 2015 Matthew Timmermans
*
* 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.nobigsoftware.dfalex;
/**
* Implementation of a Dfa State.
* <P>
* This can either be a "placeholder" state that delegates to another DFA state, or
* a DFA state in final form. As the last step in DFA construction,
*/
abstract class DfaStateImpl<MATCH> extends DfaState<MATCH>
{
/**
* Replace any internal placeholder references with references to
* their delegates.
* <P>
* Every reference to a state X is replaces with x.resolvePlaceholder();
*/
abstract void fixPlaceholderReferences();
/**
* If this is a placeholder that delegates to another state,
* return that other state. Otherwise return this.
* <P>
* This method will follow a chain of placeholders to the end
*
* @return the final delegate of this state
*/
abstract DfaStateImpl<MATCH> resolvePlaceholder();
}
| [
"[email protected]"
] | |
68fc330b804b54de9d136f0e78292fcbea93ba31 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/57179/tar_0.java | 2051011a93d8f9bd671c39d4c5ac6012c3e20ff1 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,791 | java | /*******************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.tests.junit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Event;
import org.junit.Before;
import org.junit.Test;
/**
* Automated Test Suite for class org.eclipse.swt.widgets.Button
*
* @see org.eclipse.swt.widgets.Button
*/
public class Test_org_eclipse_swt_widgets_Button extends Test_org_eclipse_swt_widgets_Control {
Button button;
@Override
@Before
public void setUp() {
super.setUp();
button = new Button(shell, SWT.PUSH);
setWidget(button);
}
@Override
@Test
public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
// Test Button(Composite parent, int style)
new Button(shell, SWT.NULL);
new Button(shell, SWT.PUSH);
new Button(shell, SWT.CHECK);
new Button(shell, SWT.TOGGLE);
new Button(shell, SWT.ARROW);
new Button(shell, SWT.PUSH | SWT.CHECK);
try {
new Button(null, 0);
fail("No exception thrown for parent == null");
}
catch (IllegalArgumentException e) {
}
}
@Test
public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
listenerCalled = false;
SelectionListener listener = new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
listenerCalled = true;
}
public void widgetDefaultSelected(SelectionEvent e) {
}
};
try {
button.addSelectionListener(null);
fail("No exception thrown for addSelectionListener with null argument");
} catch (IllegalArgumentException e) {
}
button.addSelectionListener(listener);
button.notifyListeners(SWT.Selection, new Event());
assertTrue(listenerCalled);
try {
button.removeSelectionListener(null);
fail("No exception thrown for removeSelectionListener with null argument");
} catch (IllegalArgumentException e) {
}
listenerCalled = false;
button.removeSelectionListener(listener);
button.notifyListeners(SWT.Selection, new Event());
assertFalse(listenerCalled);
}
@Override
@Test
public void test_computeSizeIIZ() {
button.computeSize(0, 0);
button.computeSize(0, 0, false);
button.computeSize(-10, -10);
button.computeSize(-10, -10, false);
button.computeSize(10, 10);
button.computeSize(10, 10, false);
button.computeSize(10000, 10000);
button.computeSize(10000, 10000, false);
}
@Test
public void test_setAlignmentI() {
button.setAlignment(SWT.LEFT);
assertEquals(SWT.LEFT, button.getAlignment());
button.setAlignment(SWT.RIGHT);
assertEquals(SWT.RIGHT, button.getAlignment());
button.setAlignment(SWT.CENTER);
assertEquals(SWT.CENTER, button.getAlignment());
button.setAlignment(SWT.UP); // bad value for push button
assertTrue(SWT.UP != button.getAlignment());
Button arrowButton = new Button(shell, SWT.ARROW);
arrowButton.setAlignment(SWT.LEFT);
assertEquals(SWT.LEFT, arrowButton.getAlignment());
arrowButton.setAlignment(SWT.RIGHT);
assertEquals(SWT.RIGHT, arrowButton.getAlignment());
arrowButton.setAlignment(SWT.UP);
assertEquals(SWT.UP, arrowButton.getAlignment());
arrowButton.setAlignment(SWT.DOWN);
assertEquals(SWT.DOWN, arrowButton.getAlignment());
arrowButton.setAlignment(SWT.CENTER); // bad value for arrow button
assertTrue(SWT.CENTER != arrowButton.getAlignment());
arrowButton.dispose();
int alignment = 55; // some bogus number
button.setAlignment(alignment);
assertTrue(alignment != button.getAlignment());
}
@Override
@Test
public void test_setFocus() {
Button btn = new Button(shell, SWT.ARROW);
btn.setFocus();
}
@Test
public void test_setImageLorg_eclipse_swt_graphics_Image() {
Image image = button.getImage();
button.setImage(image);
assertEquals(image, button.getImage());
button.setImage(null);
assertNull(button.getImage());
image = new Image(shell.getDisplay(), 10, 10);
button.setImage(image);
assertEquals(image, button.getImage());
button.setImage(null);
image.dispose();
try {
button.setImage(image);
button.setImage(null);
fail("No exception thrown for disposed image");
} catch (IllegalArgumentException e) {
}
}
@Test
public void test_setSelectionZ() {
// test setSelection for check box
button = new Button(shell, SWT.CHECK);
button.setSelection(true);
assertTrue(button.getSelection());
button.setSelection(false);
assertTrue(!button.getSelection());
// test setSelection for arrow button
Button newButton = new Button(shell, SWT.ARROW);
newButton.setSelection(true);
assertTrue(!newButton.getSelection());
newButton.setSelection(false);
assertTrue(!newButton.getSelection());
newButton.dispose();
// test setSelection for push button
newButton = new Button(shell, SWT.PUSH);
newButton.setSelection(true);
assertTrue(!newButton.getSelection());
newButton.setSelection(false);
assertTrue(!newButton.getSelection());
newButton.dispose();
// test setSelection for radio button
newButton = new Button(shell, SWT.RADIO);
newButton.setSelection(true);
assertTrue(newButton.getSelection());
newButton.setSelection(false);
assertTrue(!newButton.getSelection());
newButton.dispose();
// test setSelection for toggle button
newButton = new Button(shell, SWT.TOGGLE);
newButton.setSelection(true);
assertTrue(newButton.getSelection());
newButton.setSelection(false);
assertTrue(!newButton.getSelection());
newButton.dispose();
}
@Test
public void test_setTextLjava_lang_String() {
String[] cases = {"", "some text", "ldkashdoehufweovcnhslvhregojebckreavbkuhxbiufvcyhbifuyewvbiureyd.,cmnesljliewjfchvbwoifivbeworixuieurvbiuvbohflksjeahfcliureafgyciabelitvyrwtlicuyrtliureybcliuyreuceyvbliureybct", "\n \n \b \t ", "\0"};
int goodCases = 4;
for (int i=0; i<goodCases; i++){
button.setText(cases[i]);
assertTrue("good case: " + String.valueOf(i), button.getText().equals(cases[i]));
}
try {
button.setText(null);
fail("No exception thrown for text == null");
}
catch (IllegalArgumentException e) {
}
button.setText("");
}
//custom
protected void setUp(int style) {
super.setUp();
button = new Button(shell, style);
setWidget(button);
}
@Test
public void test_consistency_MenuDetect () {
consistencyEvent(10, 10, 3, 0, ConsistencyUtility.MOUSE_CLICK);
tearDown();
setUp(SWT.CHECK);
consistencyEvent(5, 5, 3, 0, ConsistencyUtility.MOUSE_CLICK);
tearDown();
setUp(SWT.RADIO);
consistencyEvent(5, 5, 3, 0, ConsistencyUtility.MOUSE_CLICK);
tearDown();
setUp(SWT.TOGGLE);
consistencyEvent(5, 5, 3, 0, ConsistencyUtility.MOUSE_CLICK);
tearDown();
setUp(SWT.ARROW);
consistencyEvent(5, 5, 3, 0, ConsistencyUtility.MOUSE_CLICK);
}
@Test
public void test_consistency_MouseSelection () {
consistencyEvent(10, 10, 1, 0, ConsistencyUtility.MOUSE_CLICK);
tearDown();
setUp(SWT.CHECK);
consistencyEvent(5, 5, 1, 0, ConsistencyUtility.MOUSE_CLICK);
tearDown();
setUp(SWT.RADIO);
button.setSelection(true);
consistencyEvent(5, 5, 1, 0, ConsistencyUtility.MOUSE_CLICK);
tearDown();
setUp(SWT.TOGGLE);
consistencyEvent(5, 5, 1, 0, ConsistencyUtility.MOUSE_CLICK);
tearDown();
setUp(SWT.ARROW);
consistencyEvent(5, 5, 1, 0, ConsistencyUtility.MOUSE_CLICK);
}
@Test
public void test_consistency_EnterSelection () {
// differences between push and the rest of the buttons
// different across platforms
// consistencyEvent(10, 13, 0, 0, ConsistencyUtility.KEY_PRESS);
tearDown();
setUp(SWT.CHECK);
consistencyEvent(10, 13, 0, 0, ConsistencyUtility.KEY_PRESS);
tearDown();
setUp(SWT.RADIO);
consistencyEvent(10, 13, 0, 0, ConsistencyUtility.KEY_PRESS);
tearDown();
setUp(SWT.TOGGLE);
consistencyEvent(10, 13, 0, 0, ConsistencyUtility.KEY_PRESS);
tearDown();
setUp(SWT.ARROW);
consistencyEvent(10, 13, 0, 0, ConsistencyUtility.KEY_PRESS);
}
@Test
public void test_consistency_SpaceSelection () {
consistencyEvent(' ', 32, 0, 0, ConsistencyUtility.KEY_PRESS);
tearDown();
setUp(SWT.CHECK);
consistencyEvent(' ', 32, 0, 0, ConsistencyUtility.KEY_PRESS);
tearDown();
setUp(SWT.RADIO);
button.setSelection(true);
consistencyEvent(' ', 32, 0, 0, ConsistencyUtility.KEY_PRESS);
tearDown();
setUp(SWT.TOGGLE);
consistencyEvent(' ', 32, 0, 0, ConsistencyUtility.KEY_PRESS);
tearDown();
//arrow does not produce a traverse mnemonic on xp
setUp(SWT.ARROW);
consistencyEvent(' ', 32, 0, 0, ConsistencyUtility.KEY_PRESS);
}
@Test
public void test_consistency_DragDetect () {
consistencyEvent(10, 10, 20, 20, ConsistencyUtility.MOUSE_DRAG);
tearDown();
setUp(SWT.CHECK);
consistencyEvent(5, 5, 15, 15, ConsistencyUtility.MOUSE_DRAG);
tearDown();
setUp(SWT.RADIO);
consistencyEvent(5, 5, 15, 15, ConsistencyUtility.MOUSE_DRAG);
tearDown();
setUp(SWT.TOGGLE);
consistencyEvent(5, 5, 15, 15, ConsistencyUtility.MOUSE_DRAG);
tearDown();
setUp(SWT.ARROW);
consistencyEvent(5, 5, 15, 15, ConsistencyUtility.MOUSE_DRAG);
}
}
| [
"[email protected]"
] | |
48684573d656ead9c6e41459735655601ea37403 | f76c467deed8763ca47ff37fa25be249bd53ded3 | /Java/src/qin/Odd.java | f0d906ae1820a0b75b36fb9b0819823e71e9c33f | [] | no_license | FiveLemon/Code | 3e0aa9944d81dec5951b6166e9e62122815e8994 | 27b1ca436cbd230a5a15c80cabd3451dd69f6c37 | refs/heads/master | 2021-10-09T01:41:37.304186 | 2018-12-20T03:15:23 | 2018-12-20T03:15:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | package qin;
/**
* Question 11、(1)定义一个方法,传入一个整数参数,判断奇是否为奇数?
* 是返回true,不是,返回false。
*
* (2)定义一个方法,传入一个整数参数n,
* 计算0~n的所有奇数的和。并打印和。
*
* (3)定义一个方法,传入一个整数的数组参数,
* 求数组中最大值和最小值的差,并返回差值。
* */
import java.util.Scanner;
public class Odd {
public boolean isOdd(int number){
if (0 != number % 2){
return true;
}else{
return false;
}
}
public int sumOfOdd(int number){
int sum = 0;
for (int i = 0; i <= number; i++){
if (isOdd(i)){
sum += i;
}
}
return sum;
}
public int differenceOfTwoNumber(int[] data){
int max = data[0];
int min = data[0];
for (int i = 1; i < data.length; i++){
max = Math.max(max, data[i]);
min = Math.min(min, data[i]);
}
return max - min;
}
public static void main(String[] args){
Scanner in = new Scanner(System.in);
Odd test = new Odd();
int temp;
while (in.hasNext()){
temp = in.nextInt();
if (test.isOdd(temp)){
System.out.println("true");
}else{
System.out.println("false");
}
System.out.println(test.sumOfOdd(temp));
}
int[] data = new int[]{1,2,34,4,5};
System.out.println(test.differenceOfTwoNumber(data));
in.close();
}
}
| [
"[email protected]"
] | |
5c5f7ff35a73b48c80479ef3d4b824dc48afb965 | 251b1941d768801f63a018e66ca95411694a3e6a | /src/http/Http.java | bb8c3456f795c59dcd31922d94033d4ff4040764 | [] | no_license | jiaxinyang1/HTTPAPI | 761ed3a79c693ee2bc1cd9c1b176877867317474 | c99159431adf457ae60c4bdf16bbcc0f0923510d | refs/heads/master | 2020-05-19T06:22:48.891500 | 2019-05-05T07:43:24 | 2019-05-05T07:43:24 | 184,873,386 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package http;
/**
* Http
* 抽象接口,作为连接Socket 和HTTP 上下层的接口
* @author hakurei
* @date 2019/5/4
*/
public interface Http {
/**
* 返回响应数据
* @author hakurei
* @date 16:50 2019/5/4
* @param data
* @return 响应数据
**/
String getData(String data);
}
| [
"[email protected]"
] | |
6dfe8ddb6db890574b77b5b766bb851dd0849f26 | 8d4c41adb54839081d689fc0eb9261dc88609acb | /com/asherah/internal/Narration.java | 09f4552f43c32687c8e9ef1be59f1e95c50037f0 | [] | no_license | trainman419/aucuba | 12dd72edf79e8ec8d2bb38475dbc28997b3b245a | 05e43af3b2664ac727981c1a8258551d33fe9b6e | refs/heads/master | 2020-05-28T07:42:10.294633 | 2012-12-29T00:33:53 | 2012-12-29T00:33:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 138 | java |
package com.asherah.internal;
public class Narration extends Text {
public Narration(Block n, int res) {
super(n, res);
}
}
| [
"[email protected]"
] | |
0bc2e239a5a8f5e4af04fdc1f46e4936d55eb28c | 8600efee9579cfe6e164e77eec0604fba16d455a | /data/src/main/java/com/kadirkertis/data/fav/FavoriteRepositoryImpl.java | 256e597dc1354903f88f37c1c7228607cd822008 | [] | no_license | katharmoi/Buyrun | 92d07efffc6e824e3d76ccd4b6aa97598084343a | d77255fd0e332da93e50470af15e5c1af37d0c96 | refs/heads/master | 2022-04-09T09:37:09.078923 | 2020-02-16T18:12:11 | 2020-02-16T18:12:11 | 148,145,718 | 8 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,046 | java | package com.kadirkertis.data.fav;
import com.kadirkertis.data.mappers.PlaceToDataPlaceMapperImpl;
import com.kadirkertis.domain.interactor.place.model.Place;
import com.kadirkertis.domain.interactor.place.repository.FavoriteRepository;
import io.reactivex.Completable;
import io.reactivex.Single;
/**
* Created by Kadir Kertis on 11/9/2017.
*/
public class FavoriteRepositoryImpl implements FavoriteRepository {
@Override
public Completable addPlaceToFavorites(Place place) {
return Completable.fromAction(() -> FavoritePlaceServiceImpl.addToFavPlace(new PlaceToDataPlaceMapperImpl().map(place)));
}
@Override
public Completable deleteFromFavorites(Place place) {
return Completable.fromCallable(() -> FavoritePlaceServiceImpl.deleteFromFavPlaces(new PlaceToDataPlaceMapperImpl().map(place)));
}
@Override
public Single<Boolean> isPlaceInFav(Place place) {
return Single.fromCallable(() -> FavoritePlaceServiceImpl.isPlaceInDb(new PlaceToDataPlaceMapperImpl().map(place)));
}
}
| [
"[email protected]"
] | |
fefb98ac209abce9623651e7cb78e57ee49e9773 | 73db6a00ece51c541e00ce7c657d9bcf11510af8 | /src/cn/gcs/rest/entity/Rest.java | d551a1da10251eceecea5a08976b0e5cc918987b | [] | no_license | Wentworth1108/EducationSystem | bd23dae0f22a6f04056c3e7c635dd8b2d21c4592 | 75cfedbebc7a50e4170ca63cf8ff6a8427f86379 | refs/heads/master | 2021-01-25T09:25:49.446868 | 2017-06-09T06:59:28 | 2017-06-09T06:59:28 | 93,828,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,711 | java | package cn.gcs.rest.entity;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.GenericGenerator;
import cn.gcs.student.entity.Student;
import cn.gcs.user.entity.User;
@Entity
public class Rest {
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "native")
private Integer restId;
//学生学号
@ManyToOne
@JoinColumn(name="student_id")
private Student student;
private Date start_time;
private Date end_time;
private String reason;
//批准人ID
@ManyToOne
private User user;
//批准状态
@Column(name="state",length=1)
private String state;
public Integer getRestId() {
return restId;
}
public void setRestId(Integer restId) {
this.restId = restId;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
public Date getStart_time() {
return start_time;
}
public void setStart_time(Date start_time) {
this.start_time = start_time;
}
public Date getEnd_time() {
return end_time;
}
public void setEnd_time(Date end_time) {
this.end_time = end_time;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
| [
"[email protected]"
] | |
23cf3149ac3d59ad8b840298332121d3caea9b8c | 6e0bb540665229b22a696205557bae62b8aec24d | /src/main/java/com/lc/topic/Rev1.java | 6a4ecd64376c6958f4956481c0281d3496d2c432 | [] | no_license | hongnikai/spring-cloud-customer | 8cf3f3b63389309801ab6d78d151beda3104f6c8 | dccf038182c6f5db586073afb7eaf8e7e3b5f575 | refs/heads/master | 2022-07-06T19:33:15.320978 | 2019-05-23T02:50:39 | 2019-05-23T02:50:39 | 182,532,681 | 0 | 0 | null | 2022-06-21T01:09:18 | 2019-04-21T12:51:43 | Java | UTF-8 | Java | false | false | 1,770 | java | package com.lc.topic;
import com.lc.util.ConnectionUtil;
import com.rabbitmq.client.*;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
@SuppressWarnings("all")
public class Rev1 {
private static final String EXCHANGE_NAME="test_exchange_topic";
private static final String queue_NAME="test_queue_topic_1";
public static void main(String[] args) throws IOException, TimeoutException {
Connection connection = ConnectionUtil.getConnection();
Channel channel = connection.createChannel();
channel.queueDeclare(queue_NAME,false,false,false,null);
channel.queueBind(queue_NAME,EXCHANGE_NAME,"goods.add");
//同一时刻服务器只会发一条消息给消费者(能者多劳模式),空闲多的消费者,消费更多的消息
channel.basicQos(1);
//定义一个消费者
Consumer consumer = new DefaultConsumer(channel){
//消息出发方法
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
String msg=new String(body,"utf-8");
System.out.println("[1] Recv msg:"+msg);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}finally {
System.out.println("[1] done");
//手动回执一个消息
channel.basicAck(envelope.getDeliveryTag(),false);
}
}
};
boolean autoAck=false;//自动应答 改成false
channel.basicConsume(queue_NAME,autoAck,consumer);
}
}
| [
"[email protected]"
] | |
d32ca0165109a611185998716274ba9cc2db5ca8 | b006cb000598636be8f36543f6ac6a41154f6898 | /src/com/placa/controller/PlacaDAO.java | 552c5edfb381267015f5be8ffddf9578affa3cb2 | [
"Apache-2.0"
] | permissive | eptene/picoyplaca | d7cb2ecd3a9470edb13d2de0813e98af31ce7b62 | 99295bf964bb512b156139bc7f64d191cf5aab04 | refs/heads/master | 2021-04-29T05:33:53.126044 | 2017-01-05T18:24:50 | 2017-01-05T18:24:50 | 77,979,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,379 | java | package com.placa.controller;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.placa.model.Placa;
import com.placa.util.LoadFile;
/**
* <h1>Controlador PlacaDAO</h1>
* Implementa la interfaz PlacaDAOLocal
* Este controlador administra los objetos obtenidos
* del archivo de placas ingresadas
* @author Edwin Tene
* @version 1.0
* @since 2017-01-03
*/
public class PlacaDAO implements PlacaDAOLocal {
/**
* Servicio que permite obtener los datos del fichero
*/
private LoadFile servicio;
/**
* Este metodo obtiene todas las cadenas del archivo de placas
* @param ruta String con la ruta del archivo
* @return Lista de Placas obtenidas del archivo
*/
@Override
public List<Placa> getAllPlacas(String ruta) {
// TODO Auto-generated method stub
servicio = new LoadFile(ruta);
if (servicio != null)
return servicio.getPlacas();
return null;
}
/**
* Este metodo verifica si la cadena ingresada corresponde
* a una placa en el formato ABC-1234
* @param placa String que contiene la cadena
* @return Retorn la condicion de la cadena
*/
@Override
public Boolean isPlaca(String placa) {
// TODO Auto-generated method stub
Pattern pattern = Pattern.compile("[A-Z]{3}-[0-9]{4}");
Matcher matcher = pattern.matcher(placa);
return matcher.matches();
}
}
| [
"[email protected]"
] | |
2f0ee07c7ca32d6d39c683c78b764a9a932ed76c | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/MATH-31b-6-29-NSGA_II-WeightedSum:TestLen:CallDiversity/org/apache/commons/math3/distribution/AbstractIntegerDistribution_ESTest_scaffolding.java | 0c31992014246db6963e532aaa38aca5be96f203 | [] | 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 | 469 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sat Jan 18 21:23:38 UTC 2020
*/
package org.apache.commons.math3.distribution;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class AbstractIntegerDistribution_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
] | |
648dc2559ff24ec285d9399f7c45a5f4e8508be7 | 344b8d732f00435a4bf2c9a98783c87319129188 | /poj/p2601/Main.java | 4da64f6a1e5de9577607718e8debba14fdc2558e | [] | no_license | idiotsxp/acm | bf796f16100118090004c6b38a8da519e02ba1b7 | 5c171c10a6d42f5a6dfe163f71ccec88e6c60008 | refs/heads/master | 2021-01-02T22:17:36.814625 | 2014-09-05T02:58:27 | 2014-09-05T02:58:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int n = in.nextInt();
double a0 = in.nextDouble();
double a_n1 = in.nextDouble();
double c[] = new double[n];
for(int i=0; i<n;i++)
c[i] = in.nextDouble();
double a1 = a_n1+n*a0;
for(int i=0; i<n; i++)
a1 -= 2*(n-i)*c[i];
System.out.printf("%.2f",a1/(n+1));
}
}
| [
"[email protected]"
] | |
31dbd8c19706887e3aaf762d3b3a724996aca17a | 677bbedf671e85c7c6c50ffb17839cae01067565 | /network_lib/src/main/java/com/ejulive/network_lib/Interface/IRequest.java | 7a7c81320532a9fa63e5fc46f6c631773ad422c2 | [] | no_license | congcongxu/OkHttpUtil | 9733ab9af55f4834e0f43b4823335d4ff0b2ad2b | 3939b3efef0a7a646f3905bc189c738830d76080 | refs/heads/master | 2021-01-19T22:05:55.475591 | 2017-03-03T08:04:16 | 2017-03-03T08:04:16 | 83,772,440 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,000 | java | package com.ejulive.network_lib.Interface;
import org.json.JSONObject;
import java.io.File;
import java.util.Map;
/**
* 该接口规定所有请求所需的常量和方法
*/
public interface IRequest {
/**
* 发送get请求
* @param url URL
* @param i responseInterface
*/
<T>void GET(String url, HttpResultCallback<T> i, Class<T> mClass);
/**
* 发送get请求
* @param url URL
* @param map map
* @param i responseInterface
*/
<T>void GET(String url, Map<String,Object> map, HttpResultCallback<T> i, Class<T> mClass);
/**
* 发送get请求
* @param url
* @param params String
* @param i
* @param mClass
* @param <T>
*/
<T>void GET(String url,String params,HttpResultCallback<T> i,Class<T> mClass);
/**
* 发送get请求
* @param url URL
* @param map map
* @param time time_out
* @param i responseInterface
*/
<T>void GET(String url, Map<String,Object> map, String time, HttpResultCallback<T> i, Class<T> mClass);
/**
* 发送post请求
* @param url
* @param json
* @param i
*/
<T>void POST(String url, JSONObject json, HttpResultCallback<T> i, Class<T> mClass);
<T>void POST(String url,String params,HttpResultCallback<T> i,Class<T> mClass);
/**
* 发送post请求
* @param url URL
* @param map map
* @param i responseInterface
*/
<T>void POST(String url, Map<String,Object> map, HttpResultCallback<T> i, Class<T> mClass);
/**
* 发送post请求
* @param url URL
* @param map map
* @param time time_out
* @param i responseInterface
*/
<T>void POST(String url, Map<String,Object> map, String time, HttpResultCallback<T> i, Class<T> mClass);
/**
* 下载文件
*/
void downloadFile(String url);
/**
* 上传文件,图片
*/
void upLoadFile(String url, File file,HttpResultCallback<String> i);
} | [
"[email protected]"
] | |
272bc262a9a074be1e7a5420748fc26f03684e78 | 5a5fede1c808971fec5d271982ea4edd224081a9 | /src/main/java/ph/SitetaskmanagerApplication.java | d257b622e58932c6d03478907e3b525e508304ab | [] | no_license | leonCordero/TaskManager | 45ff975a3fff25f973b2d845121bbd35ae69f794 | 2a476ef88b52fbabdf301e1d7ddf7ada62e6496f | refs/heads/master | 2021-01-17T15:20:31.381996 | 2017-03-06T18:45:59 | 2017-03-06T18:45:59 | 84,107,276 | 0 | 0 | null | 2017-03-06T18:45:59 | 2017-03-06T18:34:13 | CSS | UTF-8 | Java | false | false | 312 | java | package ph;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SitetaskmanagerApplication {
public static void main(String[] args) {
SpringApplication.run(SitetaskmanagerApplication.class, args);
}
}
| [
"[email protected]"
] | |
23cb7864af7a684b203eb0e5f70159b92f591206 | 29e712184f566c3dba0e637f6ed81fac3f2280f8 | /PaintJarakaki/src/app/Clipping.java | 500123841fee85d9b5de9299b3943c660c2d466e | [] | no_license | dpcbranco/PaintCGPI | 34e55bfb069d74ab3b8bd8c84a2a853b6eecde66 | db1c1b4afabc7348f79df69c9e88737dc122d47b | refs/heads/master | 2020-03-27T04:12:47.852862 | 2018-11-05T21:26:22 | 2018-11-05T21:26:22 | 145,921,225 | 0 | 0 | null | 2018-11-05T19:16:30 | 2018-08-24T00:21:23 | Java | UTF-8 | Java | false | false | 2,298 | java | package app;
import java.util.ArrayList;
import formas.Ponto;
import grafico.RetanguloGr;
import javafx.geometry.Rectangle2D;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Ellipse;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class Clipping {
RetanguloGr retSelecao;
Desenho desenhoSelecao;
Ponto pInicial;
WritableImage clip;
public Clipping(Pane pc) {
desenhoSelecao = new Desenho(pc);
}
public Ponto getPInicial() {
return pInicial;
}
public void setPInicial(Ponto pInicial) {
this.pInicial = pInicial;
}
public void iniciarCorte(Ponto novoPonto) {
pInicial = novoPonto;
desenhoSelecao.desenharCorte(novoPonto);
}
public void encerrarCorte(Ponto novoPonto) {
Stage janelaCorte = new Stage();
Rectangle2D areaClip = new Rectangle2D(pInicial.getX(), pInicial.getY(), larguraCorte(novoPonto), alturaCorte(novoPonto));
ArrayList<Ellipse> listaRecorte = new ArrayList<>();
Pane clip = new Pane();
desenhoSelecao.desenharCorte(novoPonto);
for (Node n : desenhoSelecao.getPaneCanvas().getChildren()) {
if (n.getClass().getSimpleName().equals("Ellipse")) {
Ellipse e = (Ellipse) n;
if (areaClip.contains(e.getCenterX(), e.getCenterY())) {
listaRecorte.add(copiarEllipse(e));
}
}
}
clip.getChildren().addAll(listaRecorte);
janelaCorte.initModality(Modality.APPLICATION_MODAL);
janelaCorte.setScene(new Scene(clip));
janelaCorte.show();
pInicial = null;
}
//Copia propriedades de um Ellipse
private Ellipse copiarEllipse(Ellipse e) {
Ellipse copia = new Ellipse();
copia.setCenterX(e.getCenterX());
copia.setCenterY(e.getCenterY());
copia.setRadiusX(e.getRadiusX());
copia.setRadiusY(e.getRadiusY());
copia.setFill(e.getFill());
return copia;
}
public void elasticoCorte (Ponto pontoElastico) {
desenhoSelecao.elasticoCorte(pontoElastico);
}
private double larguraCorte (Ponto novoPonto) {
return Math.abs(novoPonto.getX() - pInicial.getX());
}
private double alturaCorte (Ponto novoPonto) {
return Math.abs(novoPonto.getY() - pInicial.getY());
}
}
| [
"[email protected]"
] | |
120da6597569ae2ac04eba6251da72c609c3be36 | adfeeb8efc088bed44485c4a64464d74ccb6b4bb | /app/src/main/java/com/example/administrator/meetingapp/GetHartListUserInfoActivity.java | 20b0148136f2f22ed95c00d1b845e76e100b7d34 | [] | no_license | hoo9496/MeetingGo | c026e7a007a6b6bb6d8c0eb0f18188f953209e5f | e30bbcf3d76f1236eb2d4cbaeb9ce7be0687a058 | refs/heads/master | 2020-07-07T08:29:28.989032 | 2019-08-20T05:35:17 | 2019-08-20T05:35:17 | 203,304,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,362 | java | package com.example.administrator.meetingapp;
import android.content.Intent;
import android.graphics.Bitmap;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.ImageRequest;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
import de.hdodenhof.circleimageview.CircleImageView;
// 하트리스트의 나에게 호감을 표시한 이성의 정보 화면
public class GetHartListUserInfoActivity extends AppCompatActivity {
private TextView nickname, age, blood, height, bodyType, area, job, hobby, personality, smoking, religion, alcohol;
private String imageURL;
private Button btn_x, btn_hart;
CircleImageView profileImage;
private String userNickname, userAge, userBlood, userHeight, userBodyType, userArea, userJob, userPersonality, userHobby, userReligion, userSmoking, userAlcohol;
private static String URL_USER_INFO = "http://leejunho9496.cafe24.com/MeetingApp/hartList_userInfo.php"; // 하트리스트의 이성 클릭 시 상세 정보 제공
private static String URL_USER_SAVE_MATCHING_LIST = "http://leejunho9496.cafe24.com/MeetingApp/matchingHartList.php"; // 하트리스트의 이성 정보에서 하트 버튼 누를 시 처리
private static String URL_USER_REFUSAL_HART_LIST = "http://leejunho9496.cafe24.com/MeetingApp/refusalHartList.php"; // 하트리스트의 이성 정보에서 x 버튼 누를 시 처리
private String myNickname, mySex;
Session session;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_get_hart_list_user_info);
nickname = (TextView) findViewById(R.id.nickname);
age = (TextView) findViewById(R.id.age);
blood = (TextView) findViewById(R.id.blood);
area = (TextView) findViewById(R.id.area);
height = (TextView) findViewById(R.id.height);
bodyType = (TextView) findViewById(R.id.bodyType);
job = (TextView) findViewById(R.id.job);
personality = (TextView) findViewById(R.id.personality);
hobby = (TextView) findViewById(R.id.hobby);
religion = (TextView) findViewById(R.id.religion);
smoking = (TextView) findViewById(R.id.smoking);
alcohol = (TextView) findViewById(R.id.alcohol);
profileImage = (CircleImageView) findViewById(R.id.profileImage);
btn_x = (Button) findViewById(R.id.btn_x);
btn_hart = (Button) findViewById(R.id.btn_hart);
userNickname = getIntent().getStringExtra("userNickname");
session = new Session(this);
HashMap<String, String> user = session.getMyInfo();
myNickname = user.get(session.NICKNAME);
mySex = user.get(session.SEX);
getUserInfo();
// x버튼 누를 시
btn_x.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
UserRefusalHartList();
startActivity(new Intent(GetHartListUserInfoActivity.this, HartListActivity.class));
finish();
}
});
// 하트 버튼 누를 시
btn_hart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
UserSaveMatchingList();
startActivity(new Intent(GetHartListUserInfoActivity.this, HartListActivity.class));
finish();
}
});
}
// 클릭한 이성 정보 제공
private void getUserInfo() {
StringRequest stringRequest = new StringRequest(Request.Method.POST, URL_USER_INFO,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject(response);
String success = jsonObject.getString("success");
JSONArray jsonArray = jsonObject.getJSONArray("userInfo");
if (success.equals("1")) {
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
userNickname = object.getString("nickname").trim();
userAge = object.getString("age").trim();
userBlood = object.getString("blood").trim();
userHeight = object.getString("height").trim();
userBodyType = object.getString("bodyType").trim();
userArea = object.getString("area").trim();
userJob = object.getString("job").trim();
userPersonality = object.getString("personality").trim();
userHobby = object.getString("hobby").trim();
userReligion = object.getString("religion").trim();
userSmoking = object.getString("smoking").trim();
userAlcohol = object.getString("alcohol").trim();
nickname.setText(userNickname);
age.setText(userAge);
blood.setText(userBlood);
height.setText(userHeight);
bodyType.setText(userBodyType);
area.setText(userArea);
job.setText(userJob);
personality.setText(userPersonality);
hobby.setText(userHobby);
religion.setText(userReligion);
smoking.setText(userSmoking);
alcohol.setText(userAlcohol);
}
// 서버에서 이미지 가져오기
final String imageNickname = nickname.getText().toString().trim();
imageURL = "http://leejunho9496.cafe24.com/MeetingApp/profile_image/" + imageNickname + ".jpeg";
ImageRequest imageRequest = new ImageRequest(imageURL,
new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
profileImage.setImageBitmap(response);
}
}, 0, 0, ImageView.ScaleType.CENTER_CROP, null, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(GetHartListUserInfoActivity.this, "사진을 가져오지 못했습니다.", Toast.LENGTH_SHORT).show();
error.printStackTrace();
}
});
MySingleton.getInstance(GetHartListUserInfoActivity.this).addToRequestQue(imageRequest);
}
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(GetHartListUserInfoActivity.this, "Error1 : 이성 정보를 불러오지 못했습니다.", Toast.LENGTH_LONG).show();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(GetHartListUserInfoActivity.this, "Error2 : 이성 정보를 불러오지 못했습니다." + error.toString(), Toast.LENGTH_SHORT).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("user_nickname", userNickname);
params.put("my_sex", mySex);
return params;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 하트 리스트에서 이성 정보를 클릭 후 하트 누를 시 매칭 성공
private void UserSaveMatchingList() {
StringRequest stringRequest = new StringRequest(Request.Method.POST, URL_USER_SAVE_MATCHING_LIST,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject(response); // JSONObject => JSON형태의 데이터를 관리
String success = jsonObject.getString("success");
if (success.equals("1")) {
Toast.makeText(GetHartListUserInfoActivity.this, userNickname + "님과 매칭에 성공했습니다.\n카카오톡ID가 공개됩니다. 친구추가해 대화를 나눠보세요.", Toast.LENGTH_LONG).show();
/*
Intent intent = new Intent(GetHartListUserInfo.this, MessageActivity.class);
intent.putExtra("my_nickname", myNickname);
intent.putExtra("user_nickname", userNickname);
startActivity(intent);
*/
}
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(GetHartListUserInfoActivity.this, "매칭 에러1 : " + e.toString(), Toast.LENGTH_SHORT).show();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(GetHartListUserInfoActivity.this, "매칭 에러2 " + error.toString(), Toast.LENGTH_SHORT).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("my_nickname", myNickname);
params.put("user_nickname", userNickname);
params.put("my_sex", mySex);
return params;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(this); // Request를 보낼 queue를 생성
requestQueue.add(stringRequest); // // RequestQueue에 현재 Task를 추가
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 하트 리스트에서 이성 정보를 클릭 후 x버튼 누를 시 리스트 삭제
private void UserRefusalHartList() {
StringRequest stringRequest = new StringRequest(Request.Method.POST, URL_USER_REFUSAL_HART_LIST,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject(response); // JSONObject => JSON형태의 데이터를 관리
String success = jsonObject.getString("success");
if (success.equals("1")) {
Toast.makeText(GetHartListUserInfoActivity.this, userNickname + "님이 리스트에서 삭제되었습니다.", Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(GetHartListUserInfoActivity.this, "거절 에러1 : " + e.toString(), Toast.LENGTH_SHORT).show();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(GetHartListUserInfoActivity.this, "거절 에러2 " + error.toString(), Toast.LENGTH_SHORT).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("my_nickname", myNickname);
params.put("user_nickname", userNickname);
params.put("my_sex", mySex);
return params;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(this); // Request를 보낼 queue를 생성
requestQueue.add(stringRequest); // // RequestQueue에 현재 Task를 추가
}
// back 버튼을 누른 경우
@Override
public void onBackPressed() {
startActivity(new Intent(GetHartListUserInfoActivity.this, HartListActivity.class));
finish();
super.onBackPressed();
}
}
| [
"[email protected]"
] | |
c0734df228143c8eae96df346fb15a3155ff8608 | b4dfcc20cd09cb18477c00ebb1ba2187d9c63283 | /backend/src/main/java/com/devsuperior/dsdelivery/controller/OrderController.java | 2f056d219feb90ebbd863ef2a7b15505e3358251 | [] | no_license | juancarllos88/dsdeliver | e54f457651cdb9364c526a113a20e94e073779f7 | c803ed9f9ab7a2ffc8a2594a59bb27d7ea856b2e | refs/heads/master | 2023-02-14T20:51:15.583118 | 2021-01-16T14:50:45 | 2021-01-16T14:50:45 | 328,187,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,904 | java | package com.devsuperior.dsdelivery.controller;
import java.net.URI;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
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 org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import com.devsuperior.dsdelivery.dto.OrderDTO;
import com.devsuperior.dsdelivery.model.Order;
import com.devsuperior.dsdelivery.service.ConverterServiceImpl;
import com.devsuperior.dsdelivery.service.OrderService;
@RestController
@RequestMapping("/orders")
public class OrderController {
@Autowired
private OrderService service;
@Autowired
private ConverterServiceImpl converter;
@GetMapping
public ResponseEntity<List<OrderDTO>> findAll() {
List<Order> orders = service.findOrdersWithProducts();
return ResponseEntity.ok(converter.converterToOrderDTO(orders));
}
@PostMapping
public ResponseEntity<OrderDTO> save(@RequestBody OrderDTO orderDTO) {
Order order = converter.converterToOrder(orderDTO);
Order orderBD = service.insert(order);
URI uri = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(orderBD.getId())
.toUri();
return ResponseEntity.created(uri).body(converter.converterToOrderDTO(orderBD));
}
@PatchMapping("/{id}/delivered")
public ResponseEntity<OrderDTO> delivered(@PathVariable Long id) {
Order order = service.setDelivered(id);
return ResponseEntity.ok(converter.converterToOrderDTO(order));
}
}
| [
"[email protected]"
] | |
0b55be82de8fc29876a216b858069619b0db4fa9 | 038ee6b20cae51169a2ed4ed64a7b8e99b5cbaad | /schemaOrgGson/src/org/kyojo/schemaOrg/m3n3/gson/core/mapCategoryType/SeatingMapDeserializer.java | e32feb3e23f5cd9b3501903d2fdd4fc73f21cde1 | [
"Apache-2.0"
] | permissive | nagaikenshin/schemaOrg | 3dec1626781913930da5585884e3484e0b525aea | 4c9d6d098a2741c2dc2a814f1c708ee55c36e9a8 | refs/heads/master | 2021-06-25T04:52:49.995840 | 2019-05-12T06:22:37 | 2019-05-12T06:22:37 | 134,319,974 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,084 | java | package org.kyojo.schemaorg.m3n3.gson.core.mapCategoryType;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import org.kyojo.gson.JsonDeserializationContext;
import org.kyojo.gson.JsonDeserializer;
import org.kyojo.gson.JsonElement;
import org.kyojo.gson.JsonObject;
import org.kyojo.gson.JsonParseException;
import org.kyojo.gson.reflect.TypeToken;
import org.kyojo.schemaorg.m3n3.core.mapCategoryType.SEATING_MAP;
import org.kyojo.schemaorg.m3n3.core.MapCategoryType.SeatingMap;
public class SeatingMapDeserializer implements JsonDeserializer<SeatingMap> {
@Override
public SeatingMap deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
throws JsonParseException {
if(jsonElement.isJsonPrimitive()) {
return new SEATING_MAP(jsonElement.getAsString());
}
JsonObject jsonObject = jsonElement.getAsJsonObject();
SeatingMap obj = new SEATING_MAP();
HashMap<String, Field> fldMap = new HashMap<>();
Field[] flds = SEATING_MAP.class.getFields();
for(Field fld : flds) {
fldMap.put(fld.getName(), fld);
}
for(Entry<String, JsonElement> ent : jsonObject.entrySet()) {
if(fldMap.containsKey(ent.getKey())) {
Field fld = fldMap.get(ent.getKey());
JsonElement elm = ent.getValue();
try {
if(fld.getType().equals(List.class)) {
ParameterizedType gType = (ParameterizedType)fld.getGenericType();
Type[] aTypes = gType.getActualTypeArguments();
Type listType = TypeToken.getParameterized(ArrayList.class, (Class<?>)aTypes[0]).getType();
List<?> list = context.deserialize(elm, listType);
fld.set(obj, list);
} else {
Object val = context.deserialize(elm, fld.getType());
fld.set(obj, val);
}
} catch(IllegalArgumentException iae) {
throw new JsonParseException(iae);
} catch(IllegalAccessException iae) {
throw new JsonParseException(iae);
}
}
}
return obj;
}
}
| [
"[email protected]"
] | |
3fbe7be81dc69b55a01425dc74569d0de9d6cf6d | a591f065a73375b88546ad0c40f5ff35eaaad9af | /src/main/java/com/lwb/system/domain/UserRoleDO.java | 4db80a30a977328dc2d2459883a03a551780ca8d | [] | no_license | lwbldy/spring-boot-blog | 886506b806c3f9a80e16032a9f4d24d4f7141129 | 2ee405abd78f28f2cc5a0eca087c9ad72a898299 | refs/heads/master | 2020-03-23T05:12:00.157650 | 2018-07-28T07:53:35 | 2018-07-28T07:53:35 | 141,130,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 882 | java | package com.lwb.system.domain;
import java.io.Serializable;
import java.util.Date;
/**
* 用户与角色对应关系
*
* @author lwb
* @email [email protected]
* @date 2018-07-21 16:47:05
*/
public class UserRoleDO implements Serializable {
private static final long serialVersionUID = 1L;
//
private Long id;
//用户ID
private Long userId;
//角色ID
private Long roleId;
/**
* 设置:
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取:
*/
public Long getId() {
return id;
}
/**
* 设置:用户ID
*/
public void setUserId(Long userId) {
this.userId = userId;
}
/**
* 获取:用户ID
*/
public Long getUserId() {
return userId;
}
/**
* 设置:角色ID
*/
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
/**
* 获取:角色ID
*/
public Long getRoleId() {
return roleId;
}
}
| [
"[email protected]"
] | |
4ffcad16384bc745b8ea3fca914ee18d02fd74bb | c7302140636d2fd97bac8baa4d9f7fcc8b07c350 | /src/db/DbException.java | 997241edf9bc16c47b4d0395c205b122692ed401 | [] | no_license | rhuann/demo-dao-jdbc | 8e23fc1578b6a7dcdbb9733490446bb652904da2 | 6c1cf1644d553f8a3bf48f6ab6ed1b940fadd434 | refs/heads/master | 2022-11-29T09:54:18.079032 | 2020-08-05T15:37:33 | 2020-08-05T15:37:33 | 285,285,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 172 | java | package db;
public class DbException extends RuntimeException {
private static final long serialVersionUID = 1L;
public DbException(String msg) {
super(msg);
}
}
| [
"[email protected]"
] | |
436b3fc336e67bef4ec96e62b60a7f1195f0ca11 | ae16abcc52f3b08c7ee7dd84b83effd2bfb6fe8e | /medium/SkynetRevolutionEpisode1/java/Player.java | 18b8d7739d4595097a93cba0a37e8baab8e32a1e | [
"MIT"
] | permissive | joand/codingame | eaf5c6ad296511d4d9831c5ac1e828cc10bd8f78 | d4337d641cc9a931823b9c0d3a9270b6102fa041 | refs/heads/master | 2021-01-11T03:12:47.290261 | 2017-11-01T10:34:36 | 2017-11-01T10:34:36 | 71,292,532 | 6 | 21 | null | 2017-11-01T10:34:37 | 2016-10-18T21:22:45 | Java | UTF-8 | Java | false | false | 2,715 | java | import java.util.*;
class Player {
private static class Graph {
LinkedList<Integer>[] graph;
public Graph(int n) {
graph = new LinkedList[n];
for (int i = 0; i < n; ++i) {
graph[i] = new LinkedList<Integer>();
}
}
public void link(int index1, int index2) { //creates links bwtween 2 nodes
graph[index1].add(index2);
graph[index2].add(index1);
}
public void cut(int index1, int index2) { // cuts links bbtween 2 nodes
graph[index1].remove(Integer.valueOf(index2));
graph[index2].remove(Integer.valueOf(index1));
}
public LinkedList<Integer> neighbors(int index) { // returns list of nodes adjacent to index
return graph[index];
}
}
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int N = in.nextInt(); // the total number of nodes in the level, including the gateways
int L = in.nextInt(); // the number of links
int E = in.nextInt(); // the number of exit gateways
Graph graph = new Graph(N);
Set<Integer> exits = new HashSet<Integer>(); // stores indices of exit points
for (int i = 0; i < L; i++) {
int N1 = in.nextInt(); // N1 and N2 defines a link between these nodes
int N2 = in.nextInt();
graph.link(N1,N2);
}
for (int i = 0; i < E; i++) {
int EI = in.nextInt(); // the index of a gateway node
exits.add(EI);
}
Queue<Integer> q; // queue needed to perfrom breadth-first search
boolean foundExit; // check if exit is found during traversal
// game loop
while (true) {
int SI = in.nextInt(); // The index of the node on which the Skynet agent is positioned this turn
foundExit = false;
q = new LinkedList<Integer>();
q.offer(SI);
while (!q.isEmpty() && !foundExit) {
int curr = q.poll();
for (int i: graph.neighbors(curr)) {
if (exits.contains(i)) { // an exit point has been found
System.out.println(curr + " " + i);
graph.cut(curr,i); // / Cut link between exit and last node on path from Skynet agent
foundExit = true;
break;
} else {
q.offer(i);
}
}
}
}
}
} | [
"[email protected]"
] | |
fe5f69be8313ce0f4c1a4201b182e9eae7472e91 | 54c9f7f2f7afadcdddba1d5ffe1b97e1694e4c29 | /bootx-music - 副本/src/main/java/com/bootx/util/DateUtils.java | 640447baaf2733f029da0e8c0d19a7eb23d19968 | [] | no_license | blackboy1987/min-program | 37cf2630a91a166b7b409178273f176f0fc10ab8 | 0babf400000c890d1dcc3fadc58c2fae34c005d6 | refs/heads/master | 2023-04-23T12:52:07.208957 | 2021-05-11T15:02:59 | 2021-05-11T15:02:59 | 351,773,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,988 | java | package com.bootx.util;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 采用jdk8的日期类进行操作时间
*/
public class DateUtils {
private enum Type {
day,
month,
year,
}
/**
* 获取到当天的0点0分0秒
*
* @return
*/
public static Date getBeginToday() {
LocalDate localDate = LocalDate.now();
return convertLocalDateToDate(localDate);
}
/**
* 当天的24点
* @return
*/
public static Date getEndToday() {
LocalDate localDate = LocalDate.now();
LocalDateTime localDateTime= convertLocalDateToLocalDateTime(localDate);
return convertLocalDateTimeToDate(localDateTime.plusDays(1));
}
/**
* 获取指定时间的0点0分0秒
*
* @param date
* 指定时间
* @return
* 指定时间的0点0分0秒
*/
public static Date getBeginDay(Date date){
LocalDate localDate = convertDateToLocalDate(date);
return convertLocalDateToDate(localDate);
}
/**
* 获取指定时间的24点
*
* @param date
* 指定时间
* @return
* 指定时间的0点0分0秒
*/
public static Date getEndDay(Date date){
LocalDate localDate = convertDateToLocalDate(date);
return convertLocalDateTimeToDate(convertLocalDateToLocalDateTime(localDate).plusDays(1));
}
/**
* 距离当前时间index天之后的时间
* @param index
* 相隔的天数。index=0:当天,index>0 之后的index天。index<0:之前的index天
* @return
* 距离当前时间index天之后的时间
*/
public static Date getNextDay(Integer index) {
LocalDateTime localDateTime = LocalDateTime.now();
return convertLocalDateTimeToDate(localDateTime.plusDays(index));
}
/**
* 距离当前时间index天之后的时间
* @param index
* 相隔的天数。index=0:当天,index>0 之后的index天。index<0:之前的index天
* @return
* 距离当前时间index天之后的时间
*/
public static Date getNextHhour(Integer index) {
LocalDateTime localDateTime = LocalDateTime.now();
return convertLocalDateTimeToDate(localDateTime.plusHours(index));
}
/**
* 距离当前时间index天之后的时间
* @param index
* 相隔的天数。index=0:当天,index>0 之后的index天。index<0:之前的index天
* @return
* 距离当前时间index天之后的时间
*/
public static Date getNextMinute(Integer index) {
LocalDateTime localDateTime = LocalDateTime.now();
return convertLocalDateTimeToDate(localDateTime.plusMinutes(index));
}
/**
* 距离当前时间index天之后的时间
* @param index
* 相隔的天数。index=0:当天,index>0 之后的index天。index<0:之前的index天
* @return
* 距离当前时间index天之后的时间
*/
public static Date getNextSecond(long index) {
LocalDateTime localDateTime = LocalDateTime.now();
return convertLocalDateTimeToDate(localDateTime.plusSeconds(index));
}
/**
* 距离指定时间index天之后的时间
* @param index
* 相隔的天数。index=0:当天,index>0 之后的index天。index<0:之前的index天
* @return
* 距离指定时间index天之后的时间
*/
public static Date getNextDay(Date date,Integer index) {
LocalDateTime localDateTime = convertDateToLocalDateTime(date);
return convertLocalDateTimeToDate(localDateTime.plusDays(index));
}
/**
* 距离当前时间index天之后的0点0分0秒
* @param index
* 相隔的天数。index=0:当天,index>0 之后的index天。index<0:之前的index天
* @return
* 距离当前时间index天之后的0点0分0秒
*/
public static Date getBeginNextDay(Integer index) {
LocalDate localDate = LocalDate.now();
return convertLocalDateToDate(localDate.plusDays(index));
}
/**
* 距离当前时间index天之后的24点
* @param index
* 相隔的天数。index=0:当天,index>0 之后的index天。index<0:之前的index天
* @return
* 距离当前时间index天之后的24点
*/
public static Date getEndNextDay(Integer index) {
LocalDate localDate = LocalDate.now();
localDate = localDate.plusDays(index+1);
return convertLocalDateTimeToDate(convertLocalDateToLocalDateTime(localDate));
}
//计算2个时间的插值(秒)
public static Long getIntervalSecond(Date startDate, Date endDate) {
Duration duration = Duration.between(convertDateToLocalDateTime(endDate),convertDateToLocalDateTime(startDate));
return duration.getSeconds();
}
//计算2个时间的插值(分)
public static Long getIntervalMin(Date startDate, Date endDate) {
Duration duration = Duration.between(convertDateToLocalDateTime(endDate),convertDateToLocalDateTime(startDate));
return duration.toMinutes();
}
//计算2个时间的插值(时)
public static Long getIntervalHour(Date startDate, Date endDate) {
Duration duration = Duration.between(convertDateToLocalDateTime(endDate),convertDateToLocalDateTime(startDate));
return duration.toHours();
}
//计算2个时间的插值(天)
public static Long getIntervalDay(Date startDate, Date endDate) {
Duration duration = Duration.between(convertDateToLocalDateTime(endDate),convertDateToLocalDateTime(startDate));
return duration.toDays();
}
//根据时间段获取所有天数(以0时0分0秒开始)
public static List<Date> findDates(Date beginDate, Date endDate,Integer hours,Integer minutes,Integer seconds) {
List<Date> list = new ArrayList<>();
LocalDateTime localDateTime = convertDateToLocalDateTime(beginDate);
if(hours==null||hours<0){
hours = localDateTime.getHour();
}
if(minutes==null||minutes<0){
minutes = localDateTime.getMinute();
}
if(seconds==null||seconds<0){
seconds = localDateTime.getSecond();
}
LocalDateTime localDateTime1 = convertDateToLocalDateTime(endDate);
while (localDateTime1.isAfter(localDateTime)){
LocalDate localDate = convertLocalDateTimeToLocalDate(localDateTime1);
LocalDateTime localDateTime2 = convertLocalDateToLocalDateTime(localDate).plusHours(hours).plusMinutes(minutes).plusSeconds(seconds);
list.add(convertLocalDateTimeToDate(localDateTime2));
localDateTime1 = localDateTime1.plusDays(-1);
}
return list;
}
/**
* 将时间按照指定的格式转换成字符串
*
* @param date
* 时间
* @param pattern
* 格式
* @return
* 字符串
*/
public static String formatDateToString(Date date, String pattern) {
LocalDateTime localDateTime = convertDateToLocalDateTime(date);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern);
return localDateTime.format(dateTimeFormatter);
}
/**
* 将时间格式的字符串按照指定的格式转换成时间类型
*
* @param dateStr
* 时间格式的字符串
* @param pattern
* 格式
* @return
* Date对象
*/
public static Date formatStringToDate(String dateStr, String pattern) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern);
return convertLocalDateTimeToDate(LocalDateTime.parse(dateStr,dateTimeFormatter));
}
/**
* 获取指定时间所在月份的第一天的0点0分0秒
*
* @param date
* 时间
* @return
* 指定时间所在月份的第一天的0点0分0秒
*/
public static Date getBeginMonth(Date date){
LocalDate localDate = convertDateToLocalDate(date);
localDate = LocalDate.of(localDate.getYear(),localDate.getMonthValue(),localDate.getMonth().minLength());
return convertLocalDateToDate(localDate);
}
/**
* 获取指定时间所在月份的最后一天的0点0分0秒
*
* @param date
* 时间
* @return
* 指定时间所在月份的最后一天的0点0分0秒
*/
public static Date getEndMonth(Date date){
LocalDate localDate = convertDateToLocalDate(date);
localDate = LocalDate.of(localDate.getYear(),localDate.getMonthValue(),localDate.getMonth().maxLength());
return convertLocalDateToDate(localDate);
}
/*LocalDateTime和Date相互转换*******************************************************************************************************************************************************************/
/**
* 将LocalDateTime转成Date
*
* @param localDateTime
* LocalDateTime对象
* @return
* Date类型的时间
*/
public static Date convertLocalDateTimeToDate(LocalDateTime localDateTime){
if(localDateTime==null){
return null;
}
ZoneId zoneId = ZoneId.systemDefault();
Instant instant = localDateTime.atZone(zoneId).toInstant();
return Date.from(instant);
}
/**
* 将Date转成LocalDateTime
*
* @param date
* Date 对象
* @return
* LocalDateTime对象
*/
public static LocalDateTime convertDateToLocalDateTime(Date date){
Instant instant = date.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
return LocalDateTime.ofInstant(instant,zoneId);
}
/*LocalDate和Date相互转换*******************************************************************************************************************************************************************/
/**
* 将LocalDate转成Date
*
* @param localDate
* LocalDateTime对象
* @return
* Date类型的时间
*/
public static Date convertLocalDateToDate(LocalDate localDate){
if(localDate==null){
return null;
}
ZoneId zoneId = ZoneId.systemDefault();
Instant instant = localDate.atStartOfDay(zoneId).toInstant();
return Date.from(instant);
}
/**
* 将Date转成LocalDate
*
* @param date
* Date 对象
* @return
* LocalDate对象
*/
public static LocalDate convertDateToLocalDate(Date date){
Instant instant = date.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
return LocalDateTime.ofInstant(instant,zoneId).toLocalDate();
}
/*LocalTime和Date相互转换*******************************************************************************************************************************************************************/
/**
* 将LocalTime转成Date
*
* @param localTime
* LocalDate对象
* @return
* Date类型的时间
*/
public static Date convertLocalTimeToDate(LocalTime localTime){
if(localTime==null){
return null;
}
LocalDate localDate = LocalDate.now();
ZoneId zoneId = ZoneId.systemDefault();
Instant instant = LocalDateTime.of(localDate,localTime).atZone(zoneId).toInstant();
return Date.from(instant);
}
/**
* 将Date转成LocalTime
*
* @param date
* Date 对象
* @return
* LocalTime对象
*/
public static LocalTime convertDateToLocalTime(Date date){
Instant instant = date.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
return LocalDateTime.ofInstant(instant,zoneId).toLocalTime();
}
/*LocalDateTime和LocalDate相互转换*******************************************************************************************************************************************************************/
/**
* LocalDateTime转LocalDate
*
* @param localDateTime
* LocalDateTime对象
* @return
* LocalDate对象
*/
public static LocalDate convertLocalDateTimeToLocalDate(LocalDateTime localDateTime){
if(localDateTime==null){
return null;
}
return localDateTime.toLocalDate();
}
/**
* LocaleDate转LocalDateTime
*
* @param localDate
* LocalDate对象
* @return
* LocalDateTime对象
*/
public static LocalDateTime convertLocalDateToLocalDateTime(LocalDate localDate){
if(localDate==null){
return null;
}
return LocalDateTime.of(localDate,LocalTime.of(0,0,0,0));
}
/*LocalDateTime和LocalTime相互转换*******************************************************************************************************************************************************************/
/**
* LocalDateTime转LocalTime
*
* @param localDateTime
* LcalDateTime对象
* @returno
* LocaTime对象
*/
public static LocalTime convertLocalDateTimeToLocalTime(LocalDateTime localDateTime){
if(localDateTime==null){
return null;
}
return localDateTime.toLocalTime();
}
/**
* LocalTime转LocalDateTime
*
* @param localTime
* LocalTime对象
* @return
* LocalDateTime对象
*/
public static LocalDateTime convertLocalTimeToLocalDateTime(LocalTime localTime){
if(localTime==null){
return null;
}
LocalDate localDate = LocalDate.now();
return LocalDateTime.of(localDate,localTime);
}
}
| [
"Liziyi521521"
] | Liziyi521521 |
a15f48a9afb610005e5a1bda06021ce942f2ba30 | f715b1253b42bc618670f0a84ef6d116583d9eaa | /badugi-game-logic/src/main/java/com/badugi/game/logic/model/vo/api/match/TicketNum.java | 6e957fe71cae8d0d8be780868f1dcc8f0ee88938 | [
"MIT"
] | permissive | cietwwl/BadugiPokerServer | acf282544a2811be436f27abb52a1ace22712051 | 0b494f80d846fcb2e9db26721bd09add7d674783 | refs/heads/master | 2020-03-17T18:29:08.353095 | 2016-01-18T02:46:46 | 2016-01-18T02:46:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.badugi.game.logic.model.vo.api.match;
import java.io.Serializable;
public class TicketNum implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private Integer tp ;
private Integer tc;
public Integer getTp() {
return tp;
}
public void setTp(Integer tp) {
this.tp = tp;
}
public Integer getTc() {
return tc;
}
public void setTc(Integer tc) {
this.tc = tc;
}
}
| [
"[email protected]"
] | |
7ebd52215f71a6e939b71b0e0511c70f3af90d2c | d498e3f11950a41fe216395cc36b92bde0f66494 | /src/com/slk/wph/controller/WPH_Nursing/WphNursingController.java | 0f78e9a2f150777f84972e35fb04c9b5836aec72 | [] | no_license | yangShengkui/NoEscoet | c10e6871f038563942e42f063fc59d368b39d4ca | 0db0a446f1e033171e7bfe3f01f0927466dc7acf | refs/heads/master | 2020-03-23T19:16:26.502702 | 2018-07-23T05:21:37 | 2018-07-23T05:21:37 | 141,964,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,304 | java | package com.slk.wph.controller.WPH_Nursing;
import com.slk.wph.module.WPH_Orderingnursing.mapper.WphOrderingnursingMapper;
import com.slk.wph.module.WPH_Orderingnursing.mapper.WphOrderingnursingMapperCustom;
import com.slk.wph.module.WPH_Orderingnursing.po.WphOrderingnursingCustom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping(value="/WphNursing")
public class WphNursingController {
@Autowired
private WphOrderingnursingMapperCustom mapper;
DecimalFormat df = new java.text.DecimalFormat("#0.00");
@RequestMapping(value="/nursingOneDate")
public String nursingOneDate(){
return "WphNursing/nursingOneDate";
}
@RequestMapping(value="/nursingManyDate")
public String nursingManyDate(){
return "WphNursing/nursingManyDate";
}
/**
* 通过批量订一对一护理
*/
@RequestMapping(value="/addNursingOneDate")
public String addNursingOneDate(String date){
if(null!=date&&!"".equals(date)){
List<WphOrderingnursingCustom> list = mapper._selectCustomerAllNursing_(2,date);
// 退订
List<WphOrderingnursingCustom> tList = new ArrayList<WphOrderingnursingCustom>();
// 订护理
List<WphOrderingnursingCustom> dList = new ArrayList<WphOrderingnursingCustom>();
for (int i = 0, x = list.size(); i < x; i++) {
Double m = Double.parseDouble(df.format(list.get(i).getNewBalance()));
int j = new Date().compareTo(list.get(i).getOendDate());
if (m < 0 || j >= 0) {
tList.add(list.get(i));
} else {
list.get(i).setOrderDate(formatDate(date));
dList.add(list.get(i));
}
}
if (tList.size() != 0) {
mapper._updateByWphOne(tList);
mapper._tinsertWphOrderingnursing(tList);
mapper._tinsertOrdering(tList);
//批量退订修改护工状态
mapper._updateWorkStatus(tList);
}
if (dList.size() != 0) {
mapper._updateCustomer(dList);
mapper._insertoWphOrderingnursing_(dList);
mapper._insertoOrdering_(dList);
}
}
return "WphNursing/nursingOneDate";
}
@RequestMapping(value="/addNursingManyDate")
public String addNursingManyDate(String date){
if(null!=date&&!"".equals(date)) {
List<WphOrderingnursingCustom> list = mapper._selectCustomerAllNursing_(1,date);
if (list.size() != 0) {
for (int i=0;i<list.size();i++){
list.get(i).setOrderDate(formatDate(date));
}
mapper._updateCustomer(list);
mapper._insertWphOrderingnursing_(list);//
mapper._insertOrdering_(list);
}
}
return "WphNursing/nursingManyDate";
}
public String formatDate(String date){
try
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date newDate = dateFormat.parse(date);
Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
int second = c.get(Calendar.SECOND);
c.setTime(newDate);
c.add(Calendar.DATE, 1);
c.set(Calendar.HOUR_OF_DAY,hour);
c.set(Calendar.MINUTE,minute);
c.set(Calendar.SECOND,second);
date=dateFormat.format(c.getTime());
System.out.println(date);
}
catch (Exception e)
{
System.out.println(date);
}
return date;
}
}
| [
"[email protected]"
] | |
8fde2ccf0c26eb4763d0842fca5ae1030b47c1b6 | 99586ac083dd72b3a159649402fd050dfc1c15ab | /app/src/main/java/ca/gbc/comp3074/assignment2/TaskAdapter.java | da61516ed19727fd5ebe55fc1aaa12640e8a32f0 | [] | no_license | fatihkgm/Mobile_Group_Project | 6d3f7a04577e9ef36ef3ffa067fe398559d92d1d | cd004e8c181ae8477d928020b22d53a68957e6e0 | refs/heads/master | 2023-04-06T03:21:34.625550 | 2021-04-12T04:09:07 | 2021-04-12T04:09:07 | 314,954,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 67 | java | package ca.gbc.comp3074.assignment2;
public class TaskAdapter {
}
| [
"[email protected]"
] | |
66631903f6d0b3f9c18be443d73fe253533fafdc | 9810c2c99cb39711a155f47fe66cd1a6957b93e7 | /src/main/java/n10s/rdf/export/ExportProcessor.java | c9b5af219cb238927040fa482bb05ccfac439a5b | [
"Apache-2.0"
] | permissive | wangchuan2008888/neosemantics | 2540f371fc7aa3a6acf4c8fb08dc7eb155e0c5ca | 50c236b11c725811ee1206ab3c9ee2cc9b0c49f0 | refs/heads/3.5 | 2021-12-28T08:19:35.710289 | 2021-12-21T12:48:17 | 2021-12-21T12:48:17 | 203,540,819 | 0 | 0 | Apache-2.0 | 2021-12-21T12:48:18 | 2019-08-21T08:29:14 | Java | UTF-8 | Java | false | false | 10,925 | java | package n10s.rdf.export;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
import n10s.graphconfig.GraphConfig;
import n10s.graphconfig.Params;
import n10s.utils.InvalidNamespacePrefixDefinitionInDB;
import org.eclipse.rdf4j.model.*;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.model.vocabulary.XMLSchema;
import org.eclipse.rdf4j.model.vocabulary.XSD;
import org.neo4j.graphdb.*;
import org.neo4j.values.storable.PointValue;
import static n10s.graphconfig.Params.DEFAULT_BASE_SCH_NS;
import static n10s.graphconfig.Params.GEOSPARQL_NS;
import static n10s.graphconfig.Params.WKTLITERAL;
public abstract class ExportProcessor {
protected Transaction tx;
protected GraphDatabaseService graphdb;
protected final ValueFactory vf = SimpleValueFactory.getInstance();
protected boolean exportPropertiesInRels;
protected GraphConfig graphConfig;
protected final String BASE_SCH_NS;
public ExportProcessor(Transaction tx, GraphDatabaseService graphdb, GraphConfig gc) {
this.tx = tx;
this.graphdb = graphdb;
this.graphConfig = gc;
this.BASE_SCH_NS = (gc!=null?gc.getBaseSchemaNamespace():DEFAULT_BASE_SCH_NS);
}
public Stream<Statement> streamTriplesFromCypher(String cypher, Map<String, Object> params) {
final Result result = this.tx.execute(cypher, params);
Map<Long, IRI> ontologyEntitiesUris = new HashMap<>();
Set<Long> serializedNodeIds = new HashSet<>();
return result.stream().flatMap(row -> {
Set<Statement> rowResult = new HashSet<>();
Set<Entry<String, Object>> entries = row.entrySet();
List<Node> nodes = new ArrayList<>();
List<Relationship> rels = new ArrayList<>();
List<Path> paths = new ArrayList<>();
for (Entry<String, Object> entry : entries) {
Object o = entry.getValue();
if (o instanceof Node) {
nodes.add((Node) o);
} else if (o instanceof Relationship) {
rels.add((Relationship) o);
} else if (o instanceof Path) {
paths.add((Path) o);
} else if (o instanceof List){
// This is ugly. Only processes list but not list of lists... or maps... etc...
// that said, it should be good enough for an export feature.
((List) o).stream().forEach( x -> { if (x instanceof Node) {
nodes.add((Node) x);
} else if (x instanceof Relationship) {
rels.add((Relationship) x);
} else if (x instanceof Path) {
paths.add((Path) x);
} } );
}
// if it's not a node, a rel or a path or a collection thereof...
// then it cannot be converted to triples so we ignore it
}
for (Node node : nodes) {
//Do we need to keep a list of serializednodeids?
if (!serializedNodeIds.contains(node.getId()) && !filterNode(node, ontologyEntitiesUris)) {
serializedNodeIds.add(node.getId());
rowResult.addAll(processNode(node, ontologyEntitiesUris, null));
}
}
for (Relationship rel : rels) {
if( !filterRelationship(rel,ontologyEntitiesUris)) {
Statement baseStatement = processRelationship(rel, ontologyEntitiesUris);
rowResult.add(baseStatement);
if(this.exportPropertiesInRels) {
rel.getAllProperties()
.forEach((k, v) -> processPropOnRel(rowResult, baseStatement, k, v));
}
}
}
for (Path p : paths) {
p.iterator().forEachRemaining(propertyContainer -> {
if (propertyContainer instanceof Node) {
Node node = (Node) propertyContainer;
if (!serializedNodeIds.contains(node.getId())&&!filterNode(node, ontologyEntitiesUris)) {
serializedNodeIds.add(node.getId());
rowResult.addAll(processNode(node, ontologyEntitiesUris, null));
}
} else if (propertyContainer instanceof Relationship &&
!filterRelationship((Relationship) propertyContainer, ontologyEntitiesUris)) {
Statement baseStatement = processRelationship((Relationship) propertyContainer, ontologyEntitiesUris);
rowResult.add(baseStatement);
if(this.exportPropertiesInRels) {
propertyContainer.getAllProperties()
.forEach((k, v) -> processPropOnRel(rowResult, baseStatement, k, v));
}
}
}
);
}
return rowResult.stream();
});
}
public Stream<Statement> streamNodesBySearch(String label, String property, String propVal,
String valType, boolean includeContext) {
Set<Statement> result = new HashSet<>();
Map<Long, IRI> ontologyEntitiesUris = new HashMap<>();
ResourceIterator<Node> nodes = tx.findNodes(Label.label(label), property,
(valType == null ? propVal : castValue(valType, propVal)));
while (nodes.hasNext()) {
Node node = nodes.next();
result.addAll(processNode(node, ontologyEntitiesUris, null));
if (includeContext) {
Iterable<Relationship> relationships = node.getRelationships();
for (Relationship rel : relationships) {
Statement baseStatement = processRelationship(rel, ontologyEntitiesUris);
result.add(baseStatement);
if(this.exportPropertiesInRels) {
rel.getAllProperties().forEach((k, v) -> processPropOnRel(result, baseStatement, k, v));
}
}
}
}
return result.stream();
}
protected Literal createTypedLiteral(Object value) {
Literal result;
if (value instanceof String) {
result = getLiteralWithTagOrDTIfPresent((String) value);
} else if (value instanceof Integer) {
result = vf.createLiteral((Integer) value);
} else if (value instanceof Long) {
result = vf.createLiteral((Long) value);
} else if (value instanceof Float) {
result = vf.createLiteral((Float) value);
} else if (value instanceof Double) {
result = vf.createLiteral((Double) value);
} else if (value instanceof Boolean) {
result = vf.createLiteral((Boolean) value);
} else if (value instanceof LocalDateTime) {
result = vf
.createLiteral(((LocalDateTime) value).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME),
XMLSchema.DATETIME);
}else if (value instanceof ZonedDateTime) {
result = vf
.createLiteral(((ZonedDateTime) value).format(DateTimeFormatter.ISO_ZONED_DATE_TIME),
XMLSchema.DATETIME);
} else if (value instanceof LocalDate) {
result = vf
.createLiteral(((LocalDate) value).format(DateTimeFormatter.ISO_LOCAL_DATE),
XMLSchema.DATE);
} else if (value instanceof PointValue) {
// Using http://schemas.opengis.net/geosparql/1.0/geosparql_vocab_all.rdf#wktLiteral
result = vf
.createLiteral(pointValueToWTK((PointValue) value), vf.createIRI(GEOSPARQL_NS, WKTLITERAL));
} else {
// default to string
result = getLiteralWithTagOrDTIfPresent((String) value);
}
return result;
}
private String pointValueToWTK(PointValue pv) {
return "Point(" + pv.coordinate()[0] + " " + pv.coordinate()[1] + (pv.getCRS().getCode() == 9157?" "+pv.coordinate()[2]:"") + ")";
}
private Literal getLiteralWithTagOrDTIfPresent(String value) {
Pattern langTagPattern = Pattern.compile("^(.*)@([a-z,\\-]+)$");
final Pattern customDataTypePattern = Pattern
.compile("^(.*)" + Pattern.quote(Params.CUSTOM_DATA_TYPE_SEPERATOR) + "(.*)$");
Matcher langTag = langTagPattern.matcher(value);
Matcher customDT = customDataTypePattern.matcher(value);
if (langTag.matches()) {
return vf.createLiteral(langTag.group(1), langTag.group(2));
} else if (customDT.matches()) {
return vf.createLiteral(customDT.group(1), vf.createIRI(customDT.group(2)));
} else {
return vf.createLiteral(value);
}
}
protected Value getValueFromTriplePatternObject(TriplePattern tp) {
Value object;
if (tp.getLiteral()) {
if (tp.getLiteralLang() != null) {
object = vf.createLiteral(tp.getObject(), tp.getLiteralLang());
} else {
object = vf.createLiteral(tp.getObject(), vf.createIRI(tp.getLiteralType()));
}
} else {
object = vf.createIRI(tp.getObject());
}
return object;
}
Object castValue(String valType, String propVal) {
switch (valType) {
case "INTEGER":
return Integer.valueOf(propVal);
case "FLOAT":
return Float.valueOf(propVal);
case "BOOLEAN":
return Boolean.valueOf(propVal);
default:
return propVal;
}
}
Object castValueFromXSDType(Literal l) {
if (l.getDatatype().equals(XSD.LONG)) {
return l.longValue();
} else if (l.getDatatype().equals(XSD.INT) || l.getDatatype().equals(XSD.INTEGER)) {
return l.intValue();
} else if (l.getDatatype().equals(XSD.DECIMAL)) {
return l.decimalValue();
} else if (l.getDatatype().equals(XSD.FLOAT)) {
return l.floatValue();
} else if (l.getDatatype().equals(XSD.DOUBLE)) {
return l.doubleValue();
} else if (l.getDatatype().equals(XSD.BOOLEAN)) {
return l.booleanValue();
// } else if (l.getDatatype().equals(XSD.DATETIME)) {
// return l.calendarValue().d;
// } else if (l.getDatatype().equals(XSD.BOOLEAN)) {
// return l.booleanValue();
// } else if (l.getDatatype().equals(XSD.BOOLEAN)) {
// return l.booleanValue();
// } else if (l.getDatatype().equals(XSD.BOOLEAN)) {
// return l.booleanValue();
} else {
return l.stringValue();
}
}
protected abstract boolean filterRelationship(Relationship rel, Map<Long, IRI> ontologyEntitiesUris);
protected abstract boolean filterNode(Node node, Map<Long, IRI> ontologyEntitiesUris);
protected abstract void processPropOnRel(Set<Statement> rowResult, Statement baseStatement, String key, Object val);
protected abstract Statement processRelationship(Relationship rel, Map<Long, IRI> ontologyEntitiesUris);
protected abstract Set<Statement> processNode(Node node, Map<Long, IRI> ontologyEntitiesUris, String propNameFilter);
public abstract Stream<Statement> streamTriplesFromTriplePattern(TriplePattern tp)
throws InvalidNamespacePrefixDefinitionInDB;
public abstract Stream<Statement> streamLocalImplicitOntology();
}
| [
"[email protected]"
] | |
b67991d038777364b6a185bf052fbd5cf33e1e80 | 26d8ddc41f97f2d9b7aac96635e356f5544e323b | /MillenniumLauncher/src/launcher/LauncherUtils.java | 7f05c746bf86b05bdd35a526b0bdeaa0ce7b988a | [] | no_license | GNPower/Melennium | 8d961b65db5362c05b02894076f7e29ab96fac68 | 9e7369a3e1cec27b7cba0f6c1d770ca9b28bb90b | refs/heads/master | 2020-03-19T19:26:16.840993 | 2018-08-26T14:10:26 | 2018-08-26T14:10:26 | 136,855,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,667 | java | package launcher;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javafx.event.Event;
import javafx.scene.control.TextField;
import javafx.scene.control.TreeItem;
import javafx.stage.Stage;
public class LauncherUtils {
private static final String STYLE_PATH = "res/styles/";
public static void closeProgram(Stage window, Event e) {
e.consume();
if(!ConfirmationBox.display("Close", "Are you sure you want to close the program?"))
return;
System.out.println("closing me");
window.close();
}
public static void unimplementedAlert() {
AlertBox.display("Error", "That functionality is not implemented at this time.");
}
public static boolean validateInteger(TextField field) {
try {
int number = Integer.parseInt(field.getText());
System.out.println("numbers be cool");
}catch(NumberFormatException e) {
System.out.println("thats no number my guy!");
return false;
}
return true;
}
public static String getStyleURL(String name) {
String[] nameData = name.split("\\.");
if(nameData.length > 2) {
System.out.println("Error, .css files can only have one extension");
}
String path = STYLE_PATH + nameData[0] + ".css";
URL url = null;
try {
url = (new File(path)).toURI().toURL();
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url.toString();
}
public static TreeItem<String> createBranch(String name, TreeItem<String> parent) {
TreeItem<String> item = new TreeItem<String>(name);
item.setExpanded(true);
parent.getChildren().add(item);
return item;
}
}
| [
"[email protected]"
] | |
9e7e48a543318fb92fb65c34769fbeb797daea2e | f1dbc8e0181ead667676796e6343f0c3ef3eb2ab | /app/src/main/java/leora/com/baseapp/model/dbmodel/MachineProductivityAuditModel.java | b2661f2c4d109e3407a377db6a6dcda27caa7f01 | [] | no_license | AzrMohammed/mProductionAndroid | 4ffa4c8468156991c5e25e271e8043d2d3f768e4 | 868408931876c9d0ef4b61dd0f17b79bb4d3ce52 | refs/heads/master | 2020-04-09T04:36:58.564364 | 2019-01-03T10:17:01 | 2019-01-03T10:17:01 | 160,029,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | package leora.com.baseapp.model.dbmodel;
import java.io.Serializable;
/**
* Created by AZR on 06-12-2018.
*/
public class MachineProductivityAuditModel implements Serializable {
public String slug;
public String machine_slug;
public String product_slug;
public String process_slug;
public String process_description;
public String job_order_id;
public String work_done_from_time;
public String work_done_to_time;
public String quantity_approved;
public String quantity_rejected;
public String quantity_rework;
public String operator_name;
public String supervisor_name;
public String is_rework;
public String is_supervisor_approved;
public String comment;
public String status;
public String created_on;
public String updated_on;
public PMachineModel pMachineModel = new PMachineModel();
public ProductModel productModel = new ProductModel();
} | [
"[email protected]"
] | |
09417075473ab1016fb9ebd22b9fdd613521c7c5 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/plugin/cloudvoip/cloudvoice/service/p.java | 6b3d485ccd5edd74e88e229db0947d5099faab34 | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 464 | java | package com.tencent.mm.plugin.cloudvoip.cloudvoice.service;
public final class p
{
static int wUT;
static int wUU;
static int wUV;
static int wUW;
static int wUX;
static int wUY;
static int wUZ;
static int wVa;
static int wVb;
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes8.jar
* Qualified Name: com.tencent.mm.plugin.cloudvoip.cloudvoice.service.p
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
] | |
acb5b800f8fc2ff5cc389f4c196fac76bded843f | d1e9b11dbae7bcb907c8fdac06516b310af7bc3c | /src/main/java/com/hackathon/intelliplan/entity/Triggers.java | de0e68ddb3f593849d488851f32bf7b6dd7751a6 | [] | no_license | justsiddharth/intelli-planner | a27ab1aa38218c28400c6841f31e0c7d189fa7a3 | 3e25b54bcdb35187401c7b60a2a99e72f44fb471 | refs/heads/master | 2021-08-14T16:09:46.657897 | 2017-11-15T00:21:02 | 2017-11-16T05:21:34 | 110,752,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package com.hackathon.intelliplan.entity;
/**
* Created by sjain on 11/15/17.
*/
public enum Triggers {
WEATHER
}
| [
"[email protected]"
] | |
ba008c87d40dc94dd18df48387e93437c5bc46cc | 9f5cd51f815a77fb1174aef07aec288e35747c19 | /src/main/java/LeetcodeAndOffer/Leetcode/LC105.java | fb4c7805c6194594cf216560aaad5c4f07f9b8f4 | [
"Apache-2.0"
] | permissive | Galun-yase/WrittenExam | 521e06183205514bc2d70c67dd9e4b743fa20fc1 | 0251b7280a39f28d50f8e70dbc14aac9be59e5fb | refs/heads/master | 2023-09-01T20:14:09.181153 | 2023-09-01T16:39:26 | 2023-09-01T16:39:26 | 247,712,059 | 1 | 0 | Apache-2.0 | 2022-12-16T05:19:52 | 2020-03-16T13:40:15 | Java | UTF-8 | Java | false | false | 1,421 | java | package LeetcodeAndOffer.Leetcode;
import java.util.HashMap;
public class LC105 {
public TreeNode buildTree(int[] preorder, int[] inorder) {
HashMap<Integer, Integer> hashMap = new HashMap<>();
for (int i = 0; i < inorder.length; i++) {
hashMap.put(inorder[i], i);
}
TreeNode root = new TreeNode(preorder[0]);
for (int i = 1; i < preorder.length; i++) {
TreeNode node = new TreeNode(preorder[i]);
insertNode(root, node, hashMap);
}
return root;
}
private void insertNode(TreeNode root, TreeNode node, HashMap<Integer, Integer> hashMap) {
while (root != node) {
if (hashMap.get(node.val) < hashMap.get(root.val)) {
if (root.left == null) {
root.left = node;
}
root = root.left;
} else {
if (root.right == null) {
root.right = node;
}
root = root.right;
}
}
}
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode() {
}
TreeNode(int val) {
this.val = val;
}
TreeNode(int val, TreeNode left, TreeNode right) {
this.val = val;
this.left = left;
this.right = right;
}
}
}
| [
"[email protected]"
] | |
9936cd70662eca703cc050544e47f0d57014b8fe | ce9c5e0e85daf4a1a3622e05be4604c78c504900 | /src/com/ict09/jdbc/Ex03.java | f44968e86dc644bc4ad63a3b0529cbbda8836c14 | [] | no_license | kwnsghks/java_project | 2a6ed2cd4bd287dcafb852a376a2f58319496cd4 | bbe395eec6feb0256dbf99517486f2cb161a388c | refs/heads/master | 2023-04-11T05:22:09.558836 | 2021-04-30T09:21:47 | 2021-04-30T09:21:47 | 354,801,079 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 2,055 | java | package com.ict09.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class Ex03 {
public static void main(String[] args) {
// DB접속에 필요한 클래스 3개
Connection conn = null ;
Statement stmt = null ;
ResultSet rs = null ; // select 문 결과 받기 클래스
int result = 0 ; // select 문을 제외한 나머지 결과받기
try {
// 1. 드라이버 로딩
Class.forName("com.mysql.cj.jdbc.Driver");
// 2. 접속 정보
String url = "jdbc:mysql://localhost/test01db?characterEncoding=utf-8&serverTimezone=UTC";
String user = "test01" ;
String password = "1111";
conn = DriverManager.getConnection(url, user, password);
// 3. 쿼리문
// customer테이블에서 custid 가 7인 사람의 이름을 '박찬호', 주소를 '대한민국 서울' 로 변경하자
String sql = "update customer set name = '박찬호', address = '대한민국 서울' where custid = 7" ;
// 4. 실제 DB에 보낼 준비
stmt = conn.createStatement();
// 5. 실제 보내고 결과 받기
// select문이면 => rs.stmt.excuteQuery(sql);
// select문이 아니면
result = stmt.executeUpdate(sql);
// System.out.println(result);
if(result>0) {
System.out.println("갱신 성공");
sql = "select * from customer" ;
stmt = conn.createStatement() ;
rs = stmt.executeQuery(sql) ;
while(rs.next()) {
System.out.print(rs.getInt("custid")+"\t");
System.out.print(rs.getString("name")+"\t");
System.out.print(rs.getString("address")+"\t");
System.out.println(rs.getString("phone"));
}
}else {
System.out.println("갱신 실패-1");
}
} catch (Exception e) {
System.out.println("update 실패-2");
}finally {
try {
rs.close();
stmt.close();
conn.close();
} catch (Exception e2) {
// TODO: handle exception
}
}
}
}
| [
"user@DESKTOP-LHVF2H1"
] | user@DESKTOP-LHVF2H1 |
7947d10a52172a868211db84391dcff9661c42e6 | 8e48f44b5821a000e0f2a8b6b47de47150fe9a09 | /gettyimagesapi-sdk/src/main/java/com/gettyimages/search/filters/ProductType.java | 74d1a9bd0c5cdfcaaaeca1467edb9b58f6d4e914 | [
"MIT"
] | permissive | ssterli2/gettyimages-api_java | 4252efc9c44ac9e01ee1b71be529741409f0ec74 | d28d2dd2134baac2e89febf23edc62a27d3da8f7 | refs/heads/master | 2021-01-24T13:18:59.823398 | 2018-02-20T05:24:05 | 2018-02-20T05:24:05 | 123,167,408 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | package com.gettyimages.search.filters;
public enum ProductType {
EASYACCESS("easyaccess"),
EDITORIALSUBSCRIPTION("editorialsubscription"),
IMAGEPACK("imagepack"),
PREMIUMACCESS("premiumaccess"),
ROYALTYFREESUBSCRIPTION("royaltyfreesubscription"),
CREDITPACK("creditpack");
private String productType;
ProductType(String productType) {
this.productType = productType;
}
@Override
public String toString() {
return productType;
}
}
| [
"[email protected]"
] | |
f21c61de795099d3363d0acc65f34d36dbff92f1 | 90cf85d95931209e78afc42f97fb748156a4f71f | /EVM/src/evm/Gui/nt_elg.java | bb19651c1b81fa70f96ff7f0977e51ac72fbdfd6 | [] | no_license | VI-Suji/Digital-Voting-Machine | 26820f40470e959c797f37c8ccabaf4db2a1da81 | 25fec47b68a6936657735029fc7c972906587756 | refs/heads/master | 2022-12-01T16:30:25.295516 | 2020-08-14T06:42:40 | 2020-08-14T06:42:40 | 284,069,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,996 | 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 evm;
import evm.admin;
/**
*
* @author robinhood
*/
public class nt_elg extends javax.swing.JFrame {
/**
* Creates new form nt_elg
*/
public nt_elg() {
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();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Not Eligible");
jLabel1.setText("<html><body align=\"center\"><font size=6>You are <font color=\"red\">NOT</font> Eligible to<br>cast your vote</font></body></html>");
jButton1.setText("Retry");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(65, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(49, 49, 49))
.addGroup(layout.createSequentialGroup()
.addGap(157, 157, 157)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addContainerGap(32, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
this.dispose();
admin obj=new admin();
obj.setVisible(true); // TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(nt_elg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(nt_elg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(nt_elg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(nt_elg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new nt_elg().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
9df5fece63aa965c4daf78cd08327e3716ecce76 | e98f296893caee51bf4f1d87c15600b32468ee30 | /src/main/java/com/websystique/springmvc/model/User.java | ab04e5f6d63462b05bf8a41c0502c52394cf3422 | [] | no_license | dase1243/spring4 | 2b54f9842e238d1ea0620d0105cb094f41741436 | 5a436c3e9754b37133b1bebe14198fd9e2408d8a | refs/heads/master | 2021-01-19T17:04:20.555640 | 2017-09-26T20:07:31 | 2017-09-26T20:07:31 | 100,935,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,784 | java | package com.websystique.springmvc.model;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.hibernate.validator.constraints.NotEmpty;
@Entity
@Table(name = "APP_USER")
public class User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@NotEmpty
@Column(name = "SSO_ID", unique = true, nullable = false)
private String ssoId;
@NotEmpty
@Column(name = "PASSWORD", nullable = false)
private String password;
@NotEmpty
@Column(name = "FIRST_NAME", nullable = false)
private String firstName;
@NotEmpty
@Column(name = "LAST_NAME", nullable = false)
private String lastName;
@NotEmpty
@Column(name = "EMAIL", nullable = false)
private String email;
@NotEmpty
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "APP_USER_USER_PROFILE",
joinColumns = {@JoinColumn(name = "USER_ID")},
inverseJoinColumns = {@JoinColumn(name = "USER_PROFILE_ID")})
private Set<UserProfile> userProfiles = new HashSet<UserProfile>();
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSsoId() {
return ssoId;
}
public void setSsoId(String ssoId) {
this.ssoId = ssoId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Set<UserProfile> getUserProfiles() {
return userProfiles;
}
public void setUserProfiles(Set<UserProfile> userProfiles) {
this.userProfiles = userProfiles;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((ssoId == null) ? 0 : ssoId.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof User))
return false;
User other = (User) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (ssoId == null) {
if (other.ssoId != null)
return false;
} else if (!ssoId.equals(other.ssoId))
return false;
return true;
}
/*
* DO-NOT-INCLUDE passwords in toString function.
* It is done here just for convenience purpose.
*/
@Override
public String toString() {
return "User [id=" + id + ", ssoId=" + ssoId + ", password=" + password
+ ", firstName=" + firstName + ", lastName=" + lastName
+ ", email=" + email + "]";
}
} | [
"[email protected]"
] | |
f520bf84536d6c17a8458d4e95ec631510a1703c | 3acd2d5b19e7cda7e661a33a55f67d981fd5f071 | /Interview_Set9.java | ffeb9cdcc227190e935f9168ca44bc10a54edae9 | [] | no_license | emrahaktepe/JavaInterviewQnA | 39749f2cac36450ce6cdacee1e624378639ac031 | 40ef451594288622ddc528f26209cd72458f3746 | refs/heads/master | 2020-12-15T19:12:56.687545 | 2020-04-01T03:20:07 | 2020-04-01T03:20:07 | 235,224,377 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,659 | java | package JavaInterviewQnA;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class Interview_Set9 {
//1.Print A-Z 10 times in 26 rows
//A
//AB
//ABC
//2.Create a method where you find the sum of the numbers up to num
//3.Create a method where you find the sum of the divisors of the passing parameter
//4.Ask user for a number, print the cube of the number, do this repeatedly until user enters a negative number
//5.Given an array nums with 7 integers every element is repeated twice - except one. Find that element and print it to console.
//6.Given a String array words, iterate through each word and print first and last letter of each element in separate lines.
//7.Given the array words, it will print the word with the largest length. Assume that there are no 2 words with longest length
//8.String str = "Cybertek Batch Spartan is most hardworking Batch ever";,turn each word into char array print reverse of each char out with seperated by - output : k-e-t-r-e-b-y-C ...
//9.Create a string ArrayList with days of the week then find the day with most number of letters in it(longest String)
//10.Create a string ArrayList with days of the week then print the days of the week backwards
public static void main(String[] args) {
//printDaysBackwords10(new ArrayList<String> (List.of("mONDAY","tUESDAY","Wednesday","Thursday","Friday","Saturday","Sunday")));
//System.out.println(longestDayOfWeek9(new ArrayList<String> (List.of("mONDAY","tUESDAY","Wednesday","Thursday","Friday","Saturday","Sunday"))));
//printReversedWords8("Cybertek Batch Spartan is most hardworking Batch ever");
//printLongest7(new String[] {"ozkan","ayatas","ayse","sibel","aylin"});
//printLetters6(new String[] {"ozkan","ayata","ayse","sibel","aylin"});
//System.out.println(findUniqueNumber5(new int[] {1,1,2,3,4,3}));
//cubeOfNumber4();
//System.out.println(totalSumOfDivisors3(5));
//System.out.println(sumUpToNum2(5));
//formTriangleWithAlphabet1();
}
//10
public static void printDaysBackwords10(ArrayList<String> al) {
for(int i = al.size() - 1; i >= 0; i--) {
System.out.print(al.get(i) + " ");
}
}
//9
public static String longestDayOfWeek9(ArrayList<String> al) {
String longestDay = "";
for(String each : al) {
if(each.length() > longestDay.length())
longestDay = each;
}
return longestDay;
}
//8
public static void printReversedWords8(String str) {
String[] arrOfWords = str.split(" ");
for(int i = 0; i < arrOfWords.length; i++) {
char[] arrOfLetters = arrOfWords[i].toCharArray();
String eachResult = "";
for(int j = arrOfLetters.length - 1;j >= 0; j--)
eachResult+= arrOfLetters[j]+"-";
System.out.println(eachResult);
}
}
//7
public static void printLongest7(String[] words) {
String longest = "";
for(int i = 0; i < words.length; i++) {
if(words[i].length() > longest.length())
longest = words[i];
}
System.out.println(longest);
}
//6
public static void printLetters6(String[] words) {
//String[] words{"hey"} --> hy
for(int i = 0; i < words.length; i++) {
String eachWord = words[i];
System.out.println("#" + (i + 1) +"--> " +eachWord.charAt(0) + eachWord.charAt(eachWord.length() - 1));
}
}
//5
public static int findUniqueNumber5(int[] arr) {
//int[]{1,1,2,2,3,3,4} --> 4
Arrays.sort(arr);
for(int i = 0; i < arr.length - 1; i++) {
if(arr[i] == arr[i + 1]) {
if(i != arr.length - 3) {
i++;
}else {
return arr[i + 2];
}
}else {
return arr[i];
}
}
return 0;
}
//4
public static void cubeOfNumber4() {
Scanner scan = new Scanner(System.in);
System.out.println("Enter a number!");
int num = scan.nextInt();
while(num >= 0) {
System.out.println(num*num*num);
System.out.println("Enter another one!");
num = scan.nextInt();
}
System.out.println("Sorry u messed up by entering a negavite");
}
//3
public static int totalSumOfDivisors3(int num) {
int sum = 0;
for(int i = 1; i <= num; i++) {
if(num%i == 0)
sum+= i;
}
return sum;
}
//2
public static int sumUpToNum2(int num) {
int sum = 0;
for(int i = 0; i <= num; i++) {
sum+= i;
}
return sum;
}
//1
public static void formTriangleWithAlphabet1() {
for(int a = 1; a < 27; a++) {
for(int i = 65; i <= 90; i++) {
for(int j = 65; j <= i; j++) {
System.out.print((char) j);
}
System.out.println();
}
}
}
}
| [
"[email protected]"
] | |
30bc33c6528c26b27995df01a071f8683d1bfe20 | 5354fafa3c1557291da1abc319fbe2d48df51cae | /project_CS/Ichigo/EditorView.java | 93c79acca78db0395be24973b320b9066c53cc85 | [] | no_license | g1145442/project_CS | 56e8786b888764a7e6153d3812bf08db71d7d2b6 | 36a7530bc1b7af1422183eaa3ba97575335b4654 | refs/heads/master | 2021-03-12T20:26:10.644855 | 2013-07-02T06:12:49 | 2013-07-02T06:12:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 807 | java | package Ichigo;
import java.awt.Graphics;
/**
*
*
*/
public class EditorView extends mvc.View
{
/**
*
*/
private IchigoModel model;
/**
*
*/
private EditorController controller;
/**
*
*/
public EditorView(IchigoModel aIchigoModel)
{
super(aIchigoModel);
}
/**
*
*/
public EditorView(IchigoModel aIchigoModel,IchigoController aIchigoController)
{
super(aIchigoModel,aIchigoController);
}
/**
*
*/
public void setModel(IchigoModel aModel)
{
}
/**
*
*/
public IchigoModel getModel()
{
return null;
}
/**
*
*/
public void setController(IchigoController aController)
{
}
/**
*
*/
public IchigoController getController()
{
return null;
}
/**
*
*/
public void EditorView()
{
}
/**
*
*/
public void paintConponent(Graphics g)
{
}
}
| [
"[email protected]"
] | |
e510ad5b5d296c322af379e272900e6fb25873aa | 3bb9e1a187cb72e2620a40aa208bf94e5cee46f5 | /mobile_catalog/src/ong/eu/soon/mobile/json/ifx/element/ClientApp.java | cbb246b2f8f8ecf3ffa4a96ae4e93857d0c2340c | [] | no_license | eusoon/Mobile-Catalog | 2e6f766864ea25f659f87548559502358ac5466c | 869d7588447117b751fcd1387cd84be0bd66ef26 | refs/heads/master | 2021-01-22T23:49:12.717052 | 2013-12-10T08:22:20 | 2013-12-10T08:22:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package ong.eu.soon.mobile.json.ifx.element;
import ong.eu.soon.mobile.json.ifx.basetypes.IFXObject;
public class ClientApp extends IFXObject {
protected ClientApp(){
}
public final native Org getOrg()/*-{
return $wnd.cleanObject(this.org);
}-*/;
public final native void setOrg(Org org)/*-{
this.org = org;
}-*/;
public final native Name getName()/*-{
return $wnd.cleanObject(this.name);
}-*/;
public final native void setName(Name name)/*-{
this.name = name;
}-*/;
public final native Version getVersion()/*-{
return $wnd.cleanObject(this.version);
}-*/;
public final native void setVersion(Version version)/*-{
this.version = version;
}-*/;
}
| [
"[email protected]"
] | |
6dd67618a29a81829ee96c354b75c5acab4966d1 | d24fa0e3e4d0b16b6c3e5542ad8c82688cc6fd31 | /src/game/OthelloGame.java | c2465a65664c93cd8f70ac43f8ce5863d45cf7d3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mahi97/OthelloPlayer | 14a4ab1ff5a8dba26b8f2ed9d2a1e82e9fa5cbd4 | e68c419fdddf3e1506d66da7dcce27b3f08136cd | refs/heads/master | 2021-11-24T18:38:47.411728 | 2018-09-27T10:15:09 | 2018-09-27T10:15:09 | 118,744,495 | 4 | 0 | MIT | 2018-09-27T10:15:10 | 2018-01-24T09:41:36 | Java | UTF-8 | Java | false | false | 16,888 | java | package game;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author iuri
*/
public class OthelloGame extends AbstractGame {
public OthelloGame() {
size = 8;
}
@Override
public int testing_end_game(int[][] board, int markBoard) {
int win = 0, loss = 0, end = 0;
if (noSpace(board)) {
for (int row = 0; row < size; row++) {
for (int col = 0; col < size; col++) {
if (board[row][col] == markBoard) {
win++;
} else {
loss++;
}
}
}
if (win > loss) {
end = 1;
} else if (win == loss) {
end = 2;
}
}
int markBoardOpponent = 0;
int markBoardMine= 0;
for (int row = 0; row < size; row++) {
for (int col = 0; col < size; col++) {
if (board[row][col] != markBoard && board[row][col] != 0) {
markBoardOpponent++;
}
if (board[row][col] == markBoard) {
markBoardMine++;
}
}
}
if (markBoardOpponent == 0) {
end = 1;
}
if (getValidMoves(board, 1).isEmpty()
&& getValidMoves(board, -1).isEmpty()) {
if (markBoardMine > markBoardOpponent) {
end = 1;
} else if (markBoardMine == markBoardOpponent) {
end = 2;
}
}
return end;
}
@Override
public List<Move> getValidMoves(int[][] board, int markBoard) {
List<BoardSquare> boardPlaces = new ArrayList<>();
List<Move> boards = new ArrayList<>();
OthelloPlayer othelloPlayer = new OthelloPlayer(-1);
othelloPlayer.setBoardMark(markBoard);
int sizeI = board.length;
for (int i = 0; i < sizeI; i++) {
for (int j = 0; j < sizeI; j++) {
BoardSquare moviment = new BoardSquare(i, j);
if (validate_moviment(board, moviment, othelloPlayer) == 0) {
boardPlaces.add(moviment);
}
}
}
for (BoardSquare boardPlace : boardPlaces) {
int[][] b = start_board();
for (int i = 0; i < sizeI; i++) {
for (int j = 0; j < sizeI; j++) {
b[i][j] = board[i][j];
}
}
boards.add(new Move(do_move(b, boardPlace, othelloPlayer), boardPlace));
}
return boards;
}
@Override
public int validate_moviment(int[][] board, BoardSquare boardPlace, AbstractPlayer abstractPlayer) {
// skip moviment
if (boardPlace.getRow() == -1 && boardPlace.getCol() == -1) {
return 0;
}
if (board[boardPlace.getRow()][boardPlace.getCol()] == 0) {
// check col +
if (boardPlace.getCol() + 1 < size && board[boardPlace.getRow()][boardPlace.getCol() + 1] != 0 && board[boardPlace.getRow()][boardPlace.getCol() + 1] != abstractPlayer.getBoardMark()) {//check right
for (int i = boardPlace.getCol() + 1; i < size; i++) {
if (board[boardPlace.getRow()][i] == abstractPlayer.getBoardMark()) {
return 0;
}
if (board[boardPlace.getRow()][i] == 0) {
break;
}
}
}
// check col -
if (boardPlace.getCol() > 0 && board[boardPlace.getRow()][boardPlace.getCol() - 1] != 0 && board[boardPlace.getRow()][boardPlace.getCol() - 1] != abstractPlayer.getBoardMark()) {//check left
for (int i = boardPlace.getCol() - 1; i >= 0; i--) {
if (board[boardPlace.getRow()][i] == abstractPlayer.getBoardMark()) {
return 0;
}
if (board[boardPlace.getRow()][i] == 0) {
break;
}
}
}
// check row -
if (boardPlace.getRow() > 0 && board[boardPlace.getRow() - 1][boardPlace.getCol()] != 0 && board[boardPlace.getRow() - 1][boardPlace.getCol()] != abstractPlayer.getBoardMark()) {//check up
for (int i = boardPlace.getRow() - 1; i >= 0; i--) {
if (board[i][boardPlace.getCol()] == abstractPlayer.getBoardMark()) {
return 0;
}
if (board[i][boardPlace.getCol()] == 0) {
break;
}
}
}
// check row +
if (boardPlace.getRow() < size - 1 && board[boardPlace.getRow() + 1][boardPlace.getCol()] != 0 && board[boardPlace.getRow() + 1][boardPlace.getCol()] != abstractPlayer.getBoardMark()) {//check down
for (int i = boardPlace.getRow() + 1; i < size; i++) {
if (board[i][boardPlace.getCol()] == abstractPlayer.getBoardMark()) {
return 0;
}
if (board[i][boardPlace.getCol()] == 0) {
break;
}
}
}
// check main diagonal +
if (boardPlace.getCol() < size - 1 && boardPlace.getRow() < size - 1 && board[boardPlace.getRow() + 1][boardPlace.getCol() + 1] != 0 && board[boardPlace.getRow() + 1][boardPlace.getCol() + 1] != abstractPlayer.getBoardMark()) {//check down right
for (int i = boardPlace.getRow() + 1, j = boardPlace.getCol() + 1; i < size && j < size; i++, j++) {
if (board[i][j] == abstractPlayer.getBoardMark()) {
return 0;
}
if (board[i][j] == 0) {
break;
}
}
}
// check main diagonal -
if (boardPlace.getCol() > 0 && boardPlace.getRow() > 0 && board[boardPlace.getRow() - 1][boardPlace.getCol() - 1] != 0 && board[boardPlace.getRow() - 1][boardPlace.getCol() - 1] != abstractPlayer.getBoardMark()) {//check up left
for (int i = boardPlace.getRow() - 1, j = boardPlace.getCol() - 1; i >= 0 && j >= 0; i--, j--) {
if (board[i][j] == abstractPlayer.getBoardMark()) {
return 0;
}
if (board[i][j] == 0) {
break;
}
}
}
// check second diagonal +
if (boardPlace.getCol() > 0 && boardPlace.getRow() < size - 1 && board[boardPlace.getRow() + 1][boardPlace.getCol() - 1] != 0 && board[boardPlace.getRow() + 1][boardPlace.getCol() - 1] != abstractPlayer.getBoardMark()) {//check down left
for (int i = boardPlace.getRow() + 1, j = boardPlace.getCol() - 1; i < size && j >= 0; i++, j--) {
if (board[i][j] == abstractPlayer.getBoardMark()) {
return 0;
}
if (board[i][j] == 0) {
break;
}
}
}
// check second diagonal -
if (boardPlace.getCol() < size - 1 && boardPlace.getRow() > 0 && board[boardPlace.getRow() - 1][boardPlace.getCol() + 1] != 0 && board[boardPlace.getRow() - 1][boardPlace.getCol() + 1] != abstractPlayer.getBoardMark()) {//second up right
for (int i = boardPlace.getRow() - 1, j = boardPlace.getCol() + 1; i >= 0 && j < size; i--, j++) {
if (board[i][j] == abstractPlayer.getBoardMark()) {
return 0;
}
if (board[i][j] == 0) {
break;
}
}
}
} else {
return -1;
}
return -2;
}
public boolean checkAroundPositionAndPlayedPosition(int row, int col, BoardSquare boardPlace) {
if (row == boardPlace.getRow() && col == boardPlace.getCol()) {
return true;
}
if (row == boardPlace.getRow() + 1 && col == boardPlace.getCol() + 1) {
return true;
}
if (row == boardPlace.getRow() - 1 && col == boardPlace.getCol() - 1) {
return true;
}
if (row == boardPlace.getRow() - 1 && col == boardPlace.getCol() + 1) {
return true;
}
if (row == boardPlace.getRow() + 1 && col == boardPlace.getCol() - 1) {
return true;
}
if (row == boardPlace.getRow() + 1 && col == boardPlace.getCol()) {
return true;
}
if (row == boardPlace.getRow() - 1 && col == boardPlace.getCol()) {
return true;
}
if (row == boardPlace.getRow() && col == boardPlace.getCol() + 1) {
return true;
}
if (row == boardPlace.getRow() && col == boardPlace.getCol() - 1) {
return true;
}
return false;
}
@Override
public int[][] do_move(int[][] board, BoardSquare boardPlace, AbstractPlayer abstractPlayer) {
// skip play
if (boardPlace.getRow() == -1 && boardPlace.getCol() == -1) {
return board;
}
board[boardPlace.getRow()][boardPlace.getCol()] = abstractPlayer.getBoardMark();
// search own mark in backwards line
int position = -1;
for (int i = boardPlace.getRow() - 1; i >= 0; i--) {
// rdr - whether find an empty spot before the player mark
if (board[i][boardPlace.getCol()] == 0) {
break;
}
if (board[i][boardPlace.getCol()] == abstractPlayer.getBoardMark()) {
position = i;
break;
}
}
if (position != -1) {
position++;
for (int i = position; i < boardPlace.getRow(); i++) {
if (board[i][boardPlace.getCol()] != 0) {
board[i][boardPlace.getCol()] = abstractPlayer.getBoardMark();
}
}
}
// search own mark in forward lines
position = -1;
for (int i = boardPlace.getRow() + 1; i < 8; i++) {
// rdr - whether find an empty spot before the player marks
if (board[i][boardPlace.getCol()] == 0) {
break;
}
if (board[i][boardPlace.getCol()] == abstractPlayer.getBoardMark()) {
position = i;
break;
}
}
if (position != -1) {
position--;
for (int i = position; i > boardPlace.getRow(); i--) {
if (board[i][boardPlace.getCol()] != 0) {
board[i][boardPlace.getCol()] = abstractPlayer.getBoardMark();
}
}
}
/**
* **************************************************************************************
*/
//search own mark in col in backwards line
position = -1;
for (int i = boardPlace.getCol() - 1; i >= 0; i--) {
//rdr - whether find an empty spot before the player marks
if (board[boardPlace.getRow()][i] == 0) {
break;
}
if (board[boardPlace.getRow()][i] == abstractPlayer.getBoardMark()) {
position = i;
break;
}
}
if (position != -1) {
position++;
for (int i = position; i < boardPlace.getCol(); i++) {
if (board[boardPlace.getRow()][i] != 0) {
board[boardPlace.getRow()][i] = abstractPlayer.getBoardMark();
}
}
}
// search own mark in rows in forward lines
position = -1;
for (int i = boardPlace.getCol() + 1; i < 8; i++) {
// rdr - whether find an empty spot before the player marks
if (board[boardPlace.getRow()][i] == 0) {
break;
}
if (board[boardPlace.getRow()][i] == abstractPlayer.getBoardMark()) {
position = i;
break;
}
}
if (position != -1) {
position--;
for (int i = position; i > boardPlace.getCol(); i--) {
if (board[boardPlace.getRow()][i] != 0) {
board[boardPlace.getRow()][i] = abstractPlayer.getBoardMark();
}
}
}
/**
* ******************************************************
*/
// search own mark in backwards diagonals
int row = boardPlace.getRow() - 1;
int col = boardPlace.getCol() - 1;
// rdr - indicates whether an empty spot was found before player mark
boolean empty = false;
while (row >= 0 && col >= 0) {
if (board[row][col] == abstractPlayer.getBoardMark()) {
break;
}
// rdr - exits loop if an empty spot was found
if (board[row][col] == 0) {
empty = true;
break;
}
row--;
col--;
}
if (row >= 0 && col >= 0 && !empty) { // rdr - check if it is empty
while (row != boardPlace.getRow()
&& col != boardPlace.getCol()) {
if (board[row][col] != 0) {
board[row][col] = abstractPlayer.getBoardMark();
}
row++;
col++;
}
}
//search own mark in forward diagonal
row = boardPlace.getRow() + 1;
col = boardPlace.getCol() + 1;
empty = false;
while (row < 8 && col < 8) {
if (board[row][col] == abstractPlayer.getBoardMark()) {
break;
}
if (board[row][col] == 0) {
empty = true;
break;
}
row++;
col++;
}
if (row < 8 && col < 8 && !empty) {
while (row != boardPlace.getRow()
&& col != boardPlace.getCol()) {
if (board[row][col] != 0) {
board[row][col] = abstractPlayer.getBoardMark();
}
row--;
col--;
}
}
/**
* ******************************************************
*/
//search own mark in backwards inverse diagonal
row = boardPlace.getRow() - 1;
col = boardPlace.getCol() + 1;
empty = false;
while (row >= 0 && col < 8) {
if (board[row][col] == abstractPlayer.getBoardMark()) {
break;
}
if (board[row][col] == 0) {
empty = true;
break;
}
row--;
col++;
}
if (row >= 0 && col < 8 && !empty) {
while (row != boardPlace.getRow()
&& col != boardPlace.getCol()) {
if (board[row][col] != 0) {
board[row][col] = abstractPlayer.getBoardMark();
}
row++;
col--;
}
}
//search own mark in forwards inverse diagonal
row = boardPlace.getRow() + 1;
col = boardPlace.getCol() - 1;
empty = false;
while (row < 8 && col >= 0) {
if (board[row][col] == abstractPlayer.getBoardMark()) {
break;
}
if (board[row][col] == 0) {
empty = true;
break;
}
row++;
col--;
}
if (row < 8 && col >= 0 && !empty) {
while (row != boardPlace.getRow()
&& col != boardPlace.getCol()) {
if (board[row][col] != 0) {
board[row][col] = abstractPlayer.getBoardMark();
}
row--;
col++;
}
}
/**
* ******************************************************
*/
return board;
}
@Override
public int[][] start_board() {
int[][] board = new int[size][size];
board[3][3] = -1;
board[4][4] = -1;
board[3][4] = 1;
board[4][3] = 1;
return board;
}
public boolean noSpace(int[][] tab) {
for (int row = 0; row < size; row++) {
for (int col = 0; col < size; col++) {
if (tab[row][col] == 0) {
return false;
}
}
}
return true;
}
}
| [
"[email protected]"
] | |
6d6f6f339ecbd8bccbc075870fe57f42d1d69f3a | 24348d9912af566d5c83c7a2a0f1452e81f84aed | /src/main/java/com/xmmems/analyze/controller/AnalyzeController.java | 5f8daf7de5ef0ef1d35c89a0943462d3efa8ba3d | [] | no_license | XwjAccout/xmmems | 2c959264707a4a74ee52c6726776198080bc19ca | 722a0dd3332e35554fa56a6c02e77ecc61a6bd85 | refs/heads/master | 2023-06-26T16:33:32.421092 | 2021-07-30T05:35:19 | 2021-07-30T05:35:19 | 259,177,548 | 1 | 0 | null | 2020-07-02T03:09:13 | 2020-04-27T01:53:29 | Java | UTF-8 | Java | false | false | 1,795 | java | package com.xmmems.analyze.controller;
import com.xmmems.analyze.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @描述 多元统计分析
* @创建人 ithxw
* @创建时间 2020.07.16 11:48
*/
@RestController
@RequestMapping("/analyze")
public class AnalyzeController {
@Autowired
private QualityAnalysisService qualityAnalysisService;
@Autowired
private LinearRegressionService linearRegressionService;
@GetMapping("/linearRegression")
public Object linearRegression(@RequestParam("siteId") Integer siteId,
@RequestParam("itemId") Integer itemId,
@RequestParam("start") String start,
@RequestParam("end") String end) {
return linearRegressionService.linearRegression(siteId, start, end, itemId);
}
@GetMapping("/levelPercent")
public Object levelPercent(@RequestParam("siteId") Integer siteId, @RequestParam("year") Integer year, @RequestParam("itemIds") List<Integer> itemIds) {
return ResponseEntity.ok(qualityAnalysisService.levelPercent(year, siteId, itemIds));
}
@GetMapping("/mainTroubleList")
public Object mainTroubleList(@RequestParam("siteId") Integer siteId, @RequestParam("year") Integer year, @RequestParam("itemIds") List<Integer> itemIds) {
return ResponseEntity.ok(qualityAnalysisService.mainTroubleList(year, siteId, itemIds));
}
}
| [
"[email protected]"
] | |
97e19b1e1672e3e64b78fcd222fe09c27dbe9fb0 | c883e0f4eac61747dcd0fa1b87ed51047ce14b19 | /src/java/Web_Services/Helloworld.java | 755ea9d418f47655d915595294cd481972122c50 | [] | no_license | milind12/CodesterOnlineIde | 5c4f4a96b77bb57bd6f3c346a1985664c2ba9a55 | 2331e2c2da6c2a1624775845c4d0fb132d2fd57d | refs/heads/master | 2021-01-24T08:17:25.964722 | 2020-04-25T16:38:06 | 2020-04-25T16:38:06 | 93,375,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,592 | 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 Web_Services;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.PathParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
/**
* REST Web Service
*
* @author Milind Ghiya
*/
@Path("hello")
public class Helloworld {
@Context
private UriInfo context;
/**
* Creates a new instance of Helloworld
*/
public Helloworld() {
}
/**
* Retrieves representation of an instance of helloWorld.HelloWorld
*
* @return an instance of java.lang.String
*/
@GET
@Produces("text/html")
public String getHtml() {
return "<html><body><h1>Hello, World!!</body></h1></html>";
}
/**
* Retrieves representation of an instance of HelloWorld.Helloworld
*
* @return an instance of java.lang.String
*/
@GET
@Produces("application/xml")
public String getXml() {
//TODO return proper representation object
throw new UnsupportedOperationException();
}
/**
* PUT method for updating or creating an instance of Helloworld
*
* @param content representation for the resource
* @return an HTTP response with content of the updated or created resource.
*/
@PUT
@Consumes("application/xml")
public void putXml(String content) {
}
}
| [
"[email protected]"
] | |
a2a20269507c936954dbcff356dc0ac47b3719b3 | 18746f023c89bf7571a3595b2aaebf56cbc57c6b | /app/src/main/java/spfworld/spfworld/activity/StoreSerchListActivity.java | 290187383bc04161b9dc35e226810680c7275716 | [] | no_license | RRrongrui/aveve | 9218cf06e029c840ffedb598b26c1f54d3ea34d2 | c87aa3d246d71003840ac6489e7fb8c62417e69b | refs/heads/master | 2021-01-11T01:46:46.888913 | 2016-10-12T05:18:43 | 2016-10-12T05:18:43 | 70,665,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,655 | java | package spfworld.spfworld.activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import spfworld.spfworld.R;
import spfworld.spfworld.fragment.find.store.LinkWebViewFragment;
import spfworld.spfworld.fragment.find.store.StoreDetailFragment;
import spfworld.spfworld.fragment.find.store.StoreSearchFragment;
/**
* Created by guozhengke on 2016/9/27.
*/
public class StoreSerchListActivity extends AppCompatActivity {
private FragmentManager FM;
public Handler handler;
private List<Fragment> FGList;
private final int MAIN_CONTENT_SPACE_ID=R.id.store_serch_fragment;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.store_serch_activity);
//fragment切换
FM=getSupportFragmentManager();
FGList=iniFragmentList();
setFGshow(0);
//handler传值
handler=new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what){
case 0:
setFGshow(0);
break;
}
}
};
}
/**
* 按下标显示Fragment
*
* @param index
*/
public void setFGshow(int index) {
FragmentTransaction FT = FM.beginTransaction();
if (index < FGList.size()) {
for (int i = 0; i < FGList.size(); i++) {
if (index == i) {
FT.show(FGList.get(i));
} else {
FT.hide(FGList.get(i));
}
}
} else {
// Log.e("StoreDetailActivity", "下标越界没有此页面");
}
FT.commit();
}
/**
* 初始化Fragment将Fragment添加到事务中去
*/
public List<Fragment> iniFragmentList() {
List<Fragment> list = new ArrayList<Fragment>();
FragmentTransaction FT = FM.beginTransaction();
//商品搜索
StoreSearchFragment storeSearchFragment=new StoreSearchFragment();
FT.add(MAIN_CONTENT_SPACE_ID,storeSearchFragment,"商品搜索_TAG=0");
FT.commit();
list.add(storeSearchFragment);
return list;
}
} | [
"[email protected]"
] | |
a8e4f30cb6036f52bfff071b61ea248f059bc6bb | 27d5d44018262990bf91b8c3d9795e3f5819c4c8 | /src/main/java/com/iidooo/gauge/model/po/GaugeProduct.java | fc8cd01c04cd57c12a217a43b92eed1795c0e665 | [] | no_license | iidooo/gauge-connector | 34a490d86e6533e31243566b2cdcfa9ad00b433a | 7c3c8b4758ac1706bb6a2ec7cc41ab8e22b2e994 | refs/heads/master | 2021-01-20T20:24:34.423441 | 2017-06-12T02:22:09 | 2017-06-12T02:22:09 | 62,214,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,730 | java | package com.iidooo.gauge.model.po;
import java.util.Date;
public class GaugeProduct {
private Integer productID;
private Integer vehicleID;
private Integer driverID;
private String productModel;
private String productCode;
private String city;
private String remarks;
private Date updateTime;
private Integer updateUserID;
private Date createTime;
private Integer createUserID;
private Integer isDelete;
private Integer version;
public GaugeProduct() {
}
public Integer getProductID() {
return productID;
}
public void setProductID(Integer productID) {
this.productID = productID;
}
public Integer getVehicleID() {
return vehicleID;
}
public void setVehicleID(Integer vehicleID) {
this.vehicleID = vehicleID;
}
public Integer getDriverID() {
return driverID;
}
public void setDriverID(Integer driverID) {
this.driverID = driverID;
}
public String getProductModel() {
return productModel;
}
public void setProductModel(String productModel) {
this.productModel = productModel;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode == null ? null : productCode.trim();
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city == null ? null : city.trim();
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks == null ? null : remarks.trim();
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getUpdateUserID() {
return updateUserID;
}
public void setUpdateUserID(Integer updateUserID) {
this.updateUserID = updateUserID;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getCreateUserID() {
return createUserID;
}
public void setCreateUserID(Integer createUserID) {
this.createUserID = createUserID;
}
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
} | [
"[email protected]"
] | |
1be71019ca4fc1c7eb7776ea423a1e5019f3d47e | 5f6f03c31f476f7d395e14df0c868c0fec99301e | /ActiTimeFrameWork/src/com/actitime/projectandcustomerTest/ProjectAndCustomerTest.java | 78ae2c48e267526e48aa2ea6d7c4a2a67b75308a | [] | no_license | prakashk00/ActiRepositry | 68a70be975035c8c8dc3554f84b2b0e7936ebba5 | 40b3bffbd40fdf8b8dead7e1765194df0c905e62 | refs/heads/master | 2020-04-15T01:20:49.280593 | 2015-03-01T06:24:50 | 2015-03-01T06:24:50 | 31,488,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,766 | java | package com.actitime.projectandcustomerTest;
import java.io.IOException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.openqa.selenium.By;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.actitime.businessComponent.ProjectAndCustomerLib;
import com.actitime.genericLib.Driver;
import com.actitime.genericLib.ExcelLib;
import com.actitime.genericLib.ReportLib;
import com.actitime.genericLib.WebDriverCommomUtill;
import com.actitime.objectrepository.CustomerDetailsPage;
public class ProjectAndCustomerTest {
//object deceleration
ExcelLib eLib;
WebDriverCommomUtill wLib;
ProjectAndCustomerLib bLib;
CustomerDetailsPage customerdetailsPage;
ReportLib rLib ;
static String userName;
static String password;
@BeforeClass
public void configBeforeClass() throws InvalidFormatException, IOException{
System.out.println("execute ProjectAndCustomerTest test case");
// object initialization
eLib = new ExcelLib();
wLib = new WebDriverCommomUtill();
bLib = new ProjectAndCustomerLib();
customerdetailsPage = PageFactory.initElements(Driver.driver, CustomerDetailsPage.class);
rLib = new ReportLib();
userName= eLib.getExcelData("Sheet1" , 1 , 2);
password= eLib.getExcelData("Sheet1" , 1 , 3);
}
@BeforeMethod
public void configBeforeMtd() throws InvalidFormatException, IOException{
// get test data from excel
try{
//step 1 : login to APP
bLib.loginToAPP(userName, password);
//step 2: navigate ProjetAndCustomer Page
bLib.navigteToProjectAndCustomerPage();
}catch(Throwable t){
System.out.println(" Failed" + Driver.driver.getTitle());
rLib.takeScreenShot(Driver.driver.getTitle());
Driver.driver.close();
bLib.loginToAPP(userName, password);
}
}
@Test
public void createCustomer() throws InterruptedException, InvalidFormatException, IOException{
try{
String customerName= eLib.getExcelData("Sheet1" , 1 , 4);
//step 3: create Customer
bLib.createCustomer(customerName);
//step 4: verify customer
Driver.driver.findElement(By.linkText(customerName)).click();
String actCustomerNAme = customerdetailsPage.getCustomerNameText().getText();
Assert.assertEquals(actCustomerNAme, customerName,customerName + " = name is not verified");
}catch(Throwable t){
System.out.println(" Failed" + Driver.driver.getTitle());
rLib.takeScreenShot(Driver.driver.getTitle());
wLib.alertHandle();
Driver.driver.close();
//bLib.loginToAPP(userName, password);
}
}
@Test
public void modifyCustomer() throws InterruptedException, InvalidFormatException, IOException{
try{
String customerName= eLib.getExcelData("Sheet1" , 2 , 5);
// String[] arrName = customerName.split(";");
// String customerFirstName= arrName[0];
// String customerSecondName= arrName[1];
//step 3: create Customer
bLib.createCustomer(customerName);
//step 4: modify & verify customer
}catch(Throwable t){
System.out.println(" Failed" + Driver.driver.getTitle());
rLib.takeScreenShot(Driver.driver.getTitle());
wLib.alertHandle();
Driver.driver.close();
//bLib.loginToAPP(userName, password);
}
}
@AfterMethod
public void configAfterMtd(){
//ste 5 : logout
bLib.logOut();
}
@AfterClass
public void configAfterClass(){
//Driver.driver.quit();
System.out.println("===========ProjectAndCustomerTest Completed =================");
}
}
| [
"prakash@prakash-PC"
] | prakash@prakash-PC |
c8909b5dfeb5d5957617cbf9a429867413109e00 | f09c5e9ec42c361a143460be152ebfd62515d0e7 | /src/main/java/com/fedirchyk/blackjack/vo/GameTable.java | d83e2d185d81655ca294da3e09ecaa3431e9a56e | [] | no_license | ArtemFedirchyk/black-jack | 71fb2eb34b7111c9a88a807874f462b96c32aff0 | f0e5b2d73f9c38a3cbced33cef35ed6ad083ae3e | refs/heads/master | 2021-01-01T15:51:35.400810 | 2015-03-11T20:01:12 | 2015-03-11T20:01:12 | 29,904,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,315 | java | package com.fedirchyk.blackjack.vo;
import java.io.Serializable;
import java.util.Stack;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fedirchyk.blackjack.entity.Wallet;
/**
* This is general VO, which contains all common information about Game process and Player's wallet(including balance)
*
* @author artem.fedirchyk
*
*/
public class GameTable implements Serializable {
private static final long serialVersionUID = -3428335022552376416L;
private Wallet wallet;
private String gameStatus;
@JsonIgnore
private String gameAction;
private int dealerScores;
private int playerScores;
private int bet;
@JsonIgnore
private Card dealerHiddenCard;
@JsonIgnore
private Stack<Card> cardDeck = new Stack<Card>();
private Stack<Card> playerCards = new Stack<Card>();
private Stack<Card> dealerCards = new Stack<Card>();
public GameTable(Wallet wallet) {
this.wallet = wallet;
}
public Wallet getWallet() {
return wallet;
}
public void setWallet(Wallet wallet) {
this.wallet = wallet;
}
public String getGameStatus() {
return gameStatus;
}
public void setGameStatus(String gameStatus) {
this.gameStatus = gameStatus;
}
public String getGameAction() {
return gameAction;
}
public void setGameAction(String gameAction) {
this.gameAction = gameAction;
}
public int getDealerScores() {
return dealerScores;
}
public void setDealerScores(int dealerScores) {
this.dealerScores = dealerScores;
}
public int getPlayerScores() {
return playerScores;
}
public void setPlayerScores(int playerScores) {
this.playerScores = playerScores;
}
public int getBet() {
return bet;
}
public void setBet(int bet) {
this.bet = bet;
}
public Card getDealerHiddenCard() {
return dealerHiddenCard;
}
public void setDealerHiddenCard(Card dealerHiddenCard) {
this.dealerHiddenCard = dealerHiddenCard;
}
public Stack<Card> getCardDeck() {
return cardDeck;
}
public void setCardDeck(Stack<Card> cardDeck) {
this.cardDeck = cardDeck;
}
public Stack<Card> getPlayerCards() {
return playerCards;
}
public void setPlayerCards(Stack<Card> playerCards) {
this.playerCards = playerCards;
}
public Stack<Card> getDealerCards() {
return dealerCards;
}
public void setDealerCards(Stack<Card> dealerCards) {
this.dealerCards = dealerCards;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((wallet == null) ? 0 : wallet.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
GameTable other = (GameTable) obj;
if (wallet == null) {
if (other.wallet != null)
return false;
} else if (!wallet.equals(other.wallet))
return false;
return true;
}
}
| [
"[email protected]"
] | |
42ea42a1c9a4204cf0a52ba0b6ab3fc1971108bf | 2be34d47600854fd13b003bca430c97feaa340a8 | /springcloud/consumer-feign/src/main/java/com/zuql/consumerfeign/Controller/HelloController.java | f4c267a0cff27942ae7da8a211b44e4661e18fab | [] | no_license | zuql/demo | 1a99b58bb86cd8c4b6ec72d84644cb02bbaf1ac5 | c06ad8cb8647609b790eaf31af66accd6efdf11b | refs/heads/master | 2020-05-05T09:58:10.567402 | 2019-05-21T15:25:10 | 2019-05-21T15:25:10 | 179,924,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 490 | java | package com.zuql.consumerfeign.Controller;
import com.zuql.consumerfeign.client.EurekaServiceFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
public class HelloController {
@Autowired
public EurekaServiceFeign eurekaServiceFeign;
@GetMapping("/hello/{name}")
@ResponseBody
public String hello(@PathVariable String name){
return eurekaServiceFeign.hello(name);
}
}
| [
"[email protected]"
] | |
3797e98431cdc9de2bf3ceee56669f98acafe0bb | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-workspaces/src/main/java/com/amazonaws/services/workspaces/model/transform/OperationInProgressExceptionUnmarshaller.java | f06a7e9e7b978521bbddbaf9708d8f848dfd516c | [
"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 | 2,941 | 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.workspaces.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.workspaces.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* OperationInProgressException JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class OperationInProgressExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller {
private OperationInProgressExceptionUnmarshaller() {
super(com.amazonaws.services.workspaces.model.OperationInProgressException.class, "OperationInProgressException");
}
@Override
public com.amazonaws.services.workspaces.model.OperationInProgressException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {
com.amazonaws.services.workspaces.model.OperationInProgressException operationInProgressException = new com.amazonaws.services.workspaces.model.OperationInProgressException(
null);
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return operationInProgressException;
}
private static OperationInProgressExceptionUnmarshaller instance;
public static OperationInProgressExceptionUnmarshaller getInstance() {
if (instance == null)
instance = new OperationInProgressExceptionUnmarshaller();
return instance;
}
}
| [
""
] | |
fe9228512d3ece19183b85ffbdd57467c0a506b0 | 073479e31291261cf73f7eea6efd8efdfea817ce | /source/src/com/gubga/gui/recurso/TamanhoMaximo.java | 6183845afd435a8af5b73cebc63fcdee29512103 | [] | no_license | Garrocho/GUBGA | b7f7413b160c5c61d5f5928d6f72def5020d0522 | 813a4d1a93c93f048994879286557268da2e3451 | refs/heads/master | 2021-05-28T05:16:21.107202 | 2012-12-08T13:04:54 | 2012-12-08T13:04:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,369 | java | package com.gubga.gui.recurso;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
/**
* Esta classe extende um <code>PlainDocument</code>. Ela aplica a um componente a insercao com um numero maximo de caracteres.
*
* @author Charles Garrocho
*/
public class TamanhoMaximo extends PlainDocument {
private static final long serialVersionUID = 1L;
private int iMaxLength;
/**
* Este e o construtor. Ele define o numero maximo de caracteres que aceitara na insercao.
* @param maximo um <code>int</code> com a quantidade maxima de caracteres.
*/
public TamanhoMaximo(int maximo) {
super();
iMaxLength = maximo;
}
public void insertString(int offset, String str, AttributeSet attr) throws BadLocationException {
if (iMaxLength <= 0) // aceitara qualquer no. de caracteres
{
super.insertString(offset, str, attr);
return;
}
int ilen = (getLength() + str.length());
if (ilen <= iMaxLength) // se o comprimento final for menor...
super.insertString(offset, str, attr); // ...aceita str
else
{
if (getLength() == iMaxLength) return; // nada a fazer
String newStr = str.substring(0, (iMaxLength - getLength()));
super.insertString(offset, newStr, attr);
}
}
} | [
"[email protected]"
] | |
83b5ce31520ad3376fa6f130efea7b8921396623 | ba6f4404014d470fa444a3918668bdc12c0dce0e | /extend-mq/src/main/java/com/extend/mq/config/RocketMQConfiguration.java | e4903635f7c07c67608cc28b2a1f06a6d5c7c79b | [
"MIT"
] | permissive | jishuaige/spring-boot-extend | 4488c9c26d7515a72c4bc5efd7837c2dd3c03833 | 2a69c83fb3c7d6fe0c1b1bc276054e431d332c2c | refs/heads/master | 2023-06-09T07:09:26.852845 | 2021-06-25T15:31:13 | 2021-06-25T15:31:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,236 | java | package com.extend.mq.config;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
/**
* RocketMQConfiguration,属性配置。
*
* @author KevinClair
*/
public class RocketMQConfiguration {
private String topic;
private String tag;
private List<Map<String,Object>> params;
private Object obj;
private Method method;
private String consumer;
private MessageModel messageModel;
private int consumeThreadMax;
private int consumeThreadMin;
private long consumeTimeOut;
public Object getObj() {
return obj;
}
public void setObj(Object obj) {
this.obj = obj;
}
public Method getMethod() {
return method;
}
public void setMethod(Method method) {
this.method = method;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public List<Map<String, Object>> getParams() {
return params;
}
public void setParams(List<Map<String, Object>> params) {
this.params = params;
}
public String getConsumer() {
return consumer;
}
public void setConsumer(String consumer) {
this.consumer = consumer;
}
public MessageModel getMessageModel() {
return messageModel;
}
public void setMessageModel(MessageModel messageModel) {
this.messageModel = messageModel;
}
public int getConsumeThreadMax() {
return consumeThreadMax;
}
public void setConsumeThreadMax(int consumeThreadMax) {
this.consumeThreadMax = consumeThreadMax;
}
public int getConsumeThreadMin() {
return consumeThreadMin;
}
public void setConsumeThreadMin(int consumeThreadMin) {
this.consumeThreadMin = consumeThreadMin;
}
public long getConsumeTimeOut() {
return consumeTimeOut;
}
public void setConsumeTimeOut(long consumeTimeOut) {
this.consumeTimeOut = consumeTimeOut;
}
}
| [
"[email protected]"
] | |
13a0587c6752d1e7aa8dcf41478bd333791b780e | 1f8498c886dedd9cd9cb5296f25a5a4962abb6d4 | /stack-server/src/main/java/com/inductiveautomation/opcua/stack/server/handlers/UaTcpServerHelloHandler.java | ada417f8f067da6293a68d2a02a82809b5cc47cf | [
"Apache-2.0"
] | permissive | doutdex/opc-ua-stack | ea6c98f6ee92b48ee3f8778c75b37bcb5c221044 | a577af239a255a9de784ceded1be5b638aaccefa | refs/heads/master | 2021-01-17T21:53:09.912599 | 2015-02-16T14:28:09 | 2015-02-16T14:28:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,950 | java | package com.inductiveautomation.opcua.stack.server.handlers;
import java.io.IOException;
import java.nio.ByteOrder;
import java.util.List;
import com.google.common.primitives.Ints;
import com.inductiveautomation.opcua.stack.core.StatusCodes;
import com.inductiveautomation.opcua.stack.core.UaException;
import com.inductiveautomation.opcua.stack.core.channel.ChannelConfig;
import com.inductiveautomation.opcua.stack.core.channel.ChannelParameters;
import com.inductiveautomation.opcua.stack.core.channel.ExceptionHandler;
import com.inductiveautomation.opcua.stack.core.channel.SerializationQueue;
import com.inductiveautomation.opcua.stack.core.channel.headers.HeaderDecoder;
import com.inductiveautomation.opcua.stack.core.channel.messages.AcknowledgeMessage;
import com.inductiveautomation.opcua.stack.core.channel.messages.ErrorMessage;
import com.inductiveautomation.opcua.stack.core.channel.messages.HelloMessage;
import com.inductiveautomation.opcua.stack.core.channel.messages.MessageType;
import com.inductiveautomation.opcua.stack.core.channel.messages.TcpMessageDecoder;
import com.inductiveautomation.opcua.stack.core.channel.messages.TcpMessageEncoder;
import com.inductiveautomation.opcua.stack.server.tcp.SocketServer;
import com.inductiveautomation.opcua.stack.server.tcp.UaTcpServer;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.util.AttributeKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UaTcpServerHelloHandler extends ByteToMessageDecoder implements HeaderDecoder {
public static final AttributeKey<String> ENDPOINT_URL_KEY = AttributeKey.valueOf("endpoint-url");
private final Logger logger = LoggerFactory.getLogger(getClass());
private final SocketServer socketServer;
public UaTcpServerHelloHandler(SocketServer socketServer) {
this.socketServer = socketServer;
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception {
buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);
while (buffer.readableBytes() >= HeaderLength &&
buffer.readableBytes() >= getMessageLength(buffer)) {
int messageLength = getMessageLength(buffer);
MessageType messageType = MessageType.fromMediumInt(buffer.getMedium(buffer.readerIndex()));
switch (messageType) {
case Hello:
onHello(ctx, buffer.readSlice(messageLength));
break;
default:
throw new UaException(StatusCodes.Bad_TcpMessageTypeInvalid,
"unexpected MessageType: " + messageType);
}
}
}
private void onHello(ChannelHandlerContext ctx, ByteBuf buffer) throws UaException {
logger.debug("[remote={}] Received Hello message.", ctx.channel().remoteAddress());
HelloMessage hello = TcpMessageDecoder.decodeHello(buffer);
UaTcpServer server = socketServer.getServer(hello.getEndpointUrl());
if (server == null) {
throw new UaException(StatusCodes.Bad_TcpEndpointUrlInvalid,
"unrecognized endpoint url: " + hello.getEndpointUrl());
}
ctx.channel().attr(ENDPOINT_URL_KEY).set(hello.getEndpointUrl());
long remoteProtocolVersion = hello.getProtocolVersion();
long remoteReceiveBufferSize = hello.getReceiveBufferSize();
long remoteSendBufferSize = hello.getSendBufferSize();
long remoteMaxMessageSize = hello.getMaxMessageSize();
long remoteMaxChunkCount = hello.getMaxChunkCount();
if (remoteProtocolVersion < PROTOCOL_VERSION) {
throw new UaException(StatusCodes.Bad_ProtocolVersionUnsupported,
"unsupported protocol version: " + remoteProtocolVersion);
}
ChannelConfig config = server.getChannelConfig();
/* Our receive buffer size is determined by the remote send buffer size. */
long localReceiveBufferSize = Math.min(remoteSendBufferSize, config.getMaxChunkSize());
/* Our send buffer size is determined by the remote receive buffer size. */
long localSendBufferSize = Math.min(remoteReceiveBufferSize, config.getMaxChunkSize());
/* Max message size the remote can send us; not influenced by remote configuration. */
long localMaxMessageSize = config.getMaxMessageSize();
/* Max chunk count the remote can send us; not influenced by remote configuration. */
long localMaxChunkCount = config.getMaxChunkCount();
ChannelParameters parameters = new ChannelParameters(
Ints.saturatedCast(localMaxMessageSize),
Ints.saturatedCast(localReceiveBufferSize),
Ints.saturatedCast(localSendBufferSize),
Ints.saturatedCast(localMaxChunkCount),
Ints.saturatedCast(remoteMaxMessageSize),
Ints.saturatedCast(remoteReceiveBufferSize),
Ints.saturatedCast(remoteSendBufferSize),
Ints.saturatedCast(remoteMaxChunkCount)
);
int maxArrayLength = config.getMaxArrayLength();
int maxStringLength = config.getMaxStringLength();
SerializationQueue serializationQueue = new SerializationQueue(parameters, maxArrayLength, maxStringLength);
ctx.pipeline().addLast(new UaTcpServerAsymmetricHandler(server, serializationQueue));
ctx.pipeline().remove(this);
logger.debug("[remote={}] Removed HelloHandler, added AsymmetricHandler.", ctx.channel().remoteAddress());
AcknowledgeMessage acknowledge = new AcknowledgeMessage(
PROTOCOL_VERSION,
localReceiveBufferSize,
localSendBufferSize,
localMaxMessageSize,
localMaxChunkCount
);
ByteBuf messageBuffer = TcpMessageEncoder.encode(acknowledge);
ctx.executor().execute(() -> ctx.writeAndFlush(messageBuffer));
logger.debug("[remote={}] Sent Acknowledge message.", ctx.channel().remoteAddress());
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (cause instanceof IOException) {
ctx.close();
logger.debug("[remote={}] IOException caught; channel closed");
} else {
ErrorMessage errorMessage = ExceptionHandler.sendErrorMessage(ctx, cause);
if (cause instanceof UaException) {
logger.debug("[remote={}] UaException caught; sent {}",
ctx.channel().remoteAddress(), errorMessage, cause);
} else {
logger.error("[remote={}] Exception caught; sent {}",
ctx.channel().remoteAddress(), errorMessage, cause);
}
}
}
}
| [
"[email protected]"
] | |
51b5e83d7af8dec85f8662966e9009ba97484111 | fe11b9585e2778a4317ae3408c439720aa376c7e | /Phase 2-Nilay/Spring/Spring_04_09_2019/src/test/java/com/spring_example1/Spring_04_09_2019/AppTest.java | 37c612552f8f806b9f052e21f8c76d0985c4e6f1 | [] | no_license | Arunkarthik13/IBM-FSD-000GGD | c700f4bc7fa34be2e384e37d1d6b2cfa586a3662 | dcabf4c481bb30b8c00b8f72323d02ce4b14d017 | refs/heads/master | 2022-12-25T03:50:27.866654 | 2019-09-25T11:50:39 | 2019-09-25T11:50:39 | 195,184,683 | 0 | 0 | null | 2022-12-16T05:05:31 | 2019-07-04T06:47:13 | JavaScript | UTF-8 | Java | false | false | 665 | java | package com.spring_example1.Spring_04_09_2019;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"[email protected]"
] | |
709640b3d1f521c941f865655fb731ddc23146b1 | 7334d6d799347e15a8a49d88c85b880e4e33c72b | /project_rent/src/model/Epilogue.java | 022ecd7ce07d808ce319d4c2057bfec95aa66213 | [] | no_license | seong-kwang/team_null2 | 3ec50de9261cdb332bec2de92801ea934ca516d6 | 5378ad09ef43c18f3cab6afbb4c3257568355e1f | refs/heads/master | 2021-01-23T00:21:32.614371 | 2017-05-30T08:19:12 | 2017-05-30T08:19:12 | 92,810,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | package model;
public class Epilogue {
private int e_num;
private String e_title;
private String e_content;
public int getE_num() {
return e_num;
}
public void setE_num(int e_num) {
this.e_num = e_num;
}
public String getE_title() {
return e_title;
}
public void setE_title(String e_title) {
this.e_title = e_title;
}
public String getE_content() {
return e_content;
}
public void setE_content(String e_content) {
this.e_content = e_content;
}
@Override
public String toString() {
return "Epilogue [e_num=" + e_num + ", e_title=" + e_title + ", e_content=" + e_content + "]";
}
}
| [
"5CLASS-184@HB01-15"
] | 5CLASS-184@HB01-15 |
68e9cb957ad417809d72d558db08a6420115f8fa | 4312a71c36d8a233de2741f51a2a9d28443cd95b | /RawExperiments/Lang/lang1/3/AstorMain-lang1/src/variant-330/org/apache/commons/lang3/time/FastDateParser.java | 613437e31bce1e3b71a4347ad9add6b351479a6b | [] | no_license | SajjadZaidi/AutoRepair | 5c7aa7a689747c143cafd267db64f1e365de4d98 | e21eb9384197bae4d9b23af93df73b6e46bb749a | refs/heads/master | 2021-05-07T00:07:06.345617 | 2017-12-02T18:48:14 | 2017-12-02T18:48:14 | 112,858,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,547 | java | package org.apache.commons.lang3.time;
public class FastDateParser implements java.io.Serializable , org.apache.commons.lang3.time.DateParser {
private static final long serialVersionUID = 1L;
static final java.util.Locale JAPANESE_IMPERIAL = new java.util.Locale("ja" , "JP" , "JP");
private final java.lang.String pattern;
private final java.util.TimeZone timeZone;
private final java.util.Locale locale;
private transient java.util.regex.Pattern parsePattern;
private transient org.apache.commons.lang3.time.FastDateParser.Strategy[] strategies;
private transient int thisYear;
private transient java.lang.String currentFormatField;
private transient org.apache.commons.lang3.time.FastDateParser.Strategy nextStrategy;
protected FastDateParser(final java.lang.String pattern ,final java.util.TimeZone timeZone ,final java.util.Locale locale) {
this.pattern = pattern;
this.timeZone = timeZone;
this.locale = locale;
init();
}
private void init() {
final java.util.Calendar definingCalendar = java.util.Calendar.getInstance(timeZone, locale);
thisYear = definingCalendar.get(java.util.Calendar.YEAR);
final java.lang.StringBuilder regex = new java.lang.StringBuilder();
final java.util.List<org.apache.commons.lang3.time.FastDateParser.Strategy> collector = new java.util.ArrayList<org.apache.commons.lang3.time.FastDateParser.Strategy>();
final java.util.regex.Matcher patternMatcher = org.apache.commons.lang3.time.FastDateParser.formatPattern.matcher(pattern);
if (!(patternMatcher.lookingAt())) {
throw new java.lang.IllegalArgumentException((("Illegal pattern character '" + (pattern.charAt(patternMatcher.regionStart()))) + "'"));
}
currentFormatField = patternMatcher.group();
org.apache.commons.lang3.time.FastDateParser.Strategy currentStrategy = getStrategy(currentFormatField, definingCalendar);
for ( ; ; ) {
patternMatcher.region(patternMatcher.end(), patternMatcher.regionEnd());
if (!(patternMatcher.lookingAt())) {
nextStrategy = null;
break;
}
final java.lang.String nextFormatField = patternMatcher.group();
nextStrategy = getStrategy(nextFormatField, definingCalendar);
if (currentStrategy.addRegex(org.apache.commons.lang3.time.FastDateParser.this, regex)) {
collector.add(currentStrategy);
}
currentFormatField = nextFormatField;
currentStrategy = nextStrategy;
}
if ((patternMatcher.regionStart()) != (patternMatcher.regionEnd())) {
throw new java.lang.IllegalArgumentException(((("Failed to parse \"" + (pattern)) + "\" ; gave up at index ") + (patternMatcher.regionStart())));
}
if (currentStrategy.addRegex(org.apache.commons.lang3.time.FastDateParser.this, regex)) {
collector.add(currentStrategy);
}
currentFormatField = null;
strategies = collector.toArray(new org.apache.commons.lang3.time.FastDateParser.Strategy[collector.size()]);
parsePattern = java.util.regex.Pattern.compile(regex.toString());
}
@java.lang.Override
public java.lang.String getPattern() {
return pattern;
}
@java.lang.Override
public java.util.TimeZone getTimeZone() {
return timeZone;
}
@java.lang.Override
public java.util.Locale getLocale() {
return locale;
}
java.util.regex.Pattern getParsePattern() {
return parsePattern;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (!(obj instanceof org.apache.commons.lang3.time.FastDateParser)) {
return false;
}
final org.apache.commons.lang3.time.FastDateParser other = ((org.apache.commons.lang3.time.FastDateParser)(obj));
return ((pattern.equals(other.pattern)) && (timeZone.equals(other.timeZone))) && (locale.equals(other.locale));
}
@java.lang.Override
public int hashCode() {
return (pattern.hashCode()) + (13 * ((timeZone.hashCode()) + (13 * (locale.hashCode()))));
}
@java.lang.Override
public java.lang.String toString() {
return ((((("FastDateParser[" + (pattern)) + ",") + (locale)) + ",") + (timeZone.getID())) + "]";
}
private void readObject(final java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
in.defaultReadObject();
init();
}
@java.lang.Override
public java.lang.Object parseObject(final java.lang.String source) throws java.text.ParseException {
return parse(source);
}
@java.lang.Override
public java.util.Date parse(final java.lang.String source) throws java.text.ParseException {
final java.util.Date date = parse(source, new java.text.ParsePosition(0));
if (date == null) {
if (locale.equals(org.apache.commons.lang3.time.FastDateParser.JAPANESE_IMPERIAL)) {
throw new java.text.ParseException((((((("(The " + (locale)) + " locale does not support dates before 1868 AD)\n") + "Unparseable date: \"") + source) + "\" does not match ") + (parsePattern.pattern())) , 0);
}
throw new java.text.ParseException(((("Unparseable date: \"" + source) + "\" does not match ") + (parsePattern.pattern())) , 0);
}
return date;
}
@java.lang.Override
public java.lang.Object parseObject(final java.lang.String source, final java.text.ParsePosition pos) {
return parse(source, pos);
}
@java.lang.Override
public java.util.Date parse(final java.lang.String source, final java.text.ParsePosition pos) {
final int offset = pos.getIndex();
final java.util.regex.Matcher matcher = parsePattern.matcher(source.substring(offset));
if (!(matcher.lookingAt())) {
return null;
}
final java.util.Calendar cal = java.util.Calendar.getInstance(timeZone, locale);
cal.clear();
for (int i = 0 ; i < (strategies.length) ; ) {
final org.apache.commons.lang3.time.FastDateParser.Strategy strategy = strategies[(i++)];
strategy.setCalendar(org.apache.commons.lang3.time.FastDateParser.this, cal, matcher.group(i));
}
pos.setIndex((offset + (matcher.end())));
return cal.getTime();
}
private static java.lang.StringBuilder escapeRegex(final java.lang.StringBuilder regex, final java.lang.String value, final boolean unquote) {
regex.append("\\Q");
for (int i = 0 ; i < (value.length()) ; ++i) {
char c = value.charAt(i);
switch (c) {
case '\'' :
if (unquote) {
if ((++i) == (value.length())) {
return regex;
}
c = value.charAt(i);
}
break;
case '\\' :
if ((++i) == (value.length())) {
break;
}
regex.append(c);
c = value.charAt(i);
if (c == 'E') {
regex.append("E\\\\E\\");
c = 'Q';
}
break;
}
regex.append(c);
}
regex.append("\\E");
return regex;
}
private static java.util.Map<java.lang.String, java.lang.Integer> getDisplayNames(final int field, final java.util.Calendar definingCalendar, final java.util.Locale locale) {
return definingCalendar.getDisplayNames(field, java.util.Calendar.ALL_STYLES, locale);
}
int adjustYear(final int twoDigitYear) {
final int trial = (twoDigitYear + (thisYear)) - ((thisYear) % 100);
if (trial < ((thisYear) + 20)) {
return trial;
}
return trial - 100;
}
boolean isNextNumber() {
return ((nextStrategy) != null) && (nextStrategy.isNumber());
}
int getFieldWidth() {
return currentFormatField.length();
}
private abstract static class Strategy {
boolean isNumber() {
return false;
}
void setCalendar(final org.apache.commons.lang3.time.FastDateParser parser, final java.util.Calendar cal, final java.lang.String value) {
}
abstract boolean addRegex(org.apache.commons.lang3.time.FastDateParser parser, java.lang.StringBuilder regex);
}
private static final java.util.regex.Pattern formatPattern = java.util.regex.Pattern.compile("D+|E+|F+|G+|H+|K+|M+|S+|W+|Z+|a+|d+|h+|k+|m+|s+|w+|y+|z+|''|'[^']++(''[^']*+)*+'|[^'A-Za-z]++");
private org.apache.commons.lang3.time.FastDateParser.Strategy getStrategy(java.lang.String formatField, final java.util.Calendar definingCalendar) {
switch (formatField.charAt(0)) {
case '\'' :
if ((formatField.length()) > 2) {
formatField = formatField.substring(1, ((formatField.length()) - 1));
}
default :
return new org.apache.commons.lang3.time.FastDateParser.CopyQuotedStrategy(formatField);
case 'D' :
return org.apache.commons.lang3.time.FastDateParser.DAY_OF_YEAR_STRATEGY;
case 'E' :
return getLocaleSpecificStrategy(java.util.Calendar.DAY_OF_WEEK, definingCalendar);
case 'F' :
return org.apache.commons.lang3.time.FastDateParser.DAY_OF_WEEK_IN_MONTH_STRATEGY;
case 'G' :
return getLocaleSpecificStrategy(java.util.Calendar.ERA, definingCalendar);
case 'H' :
return org.apache.commons.lang3.time.FastDateParser.MODULO_HOUR_OF_DAY_STRATEGY;
case 'K' :
return org.apache.commons.lang3.time.FastDateParser.HOUR_STRATEGY;
case 'M' :
return (formatField.length()) >= 3 ? getLocaleSpecificStrategy(java.util.Calendar.MONTH, definingCalendar) : org.apache.commons.lang3.time.FastDateParser.NUMBER_MONTH_STRATEGY;
case 'S' :
return org.apache.commons.lang3.time.FastDateParser.MILLISECOND_STRATEGY;
case 'W' :
return org.apache.commons.lang3.time.FastDateParser.WEEK_OF_MONTH_STRATEGY;
case 'a' :
return getLocaleSpecificStrategy(java.util.Calendar.AM_PM, definingCalendar);
case 'd' :
return org.apache.commons.lang3.time.FastDateParser.DAY_OF_MONTH_STRATEGY;
case 'h' :
return org.apache.commons.lang3.time.FastDateParser.MODULO_HOUR_STRATEGY;
case 'k' :
return org.apache.commons.lang3.time.FastDateParser.HOUR_OF_DAY_STRATEGY;
case 'm' :
return org.apache.commons.lang3.time.FastDateParser.MINUTE_STRATEGY;
case 's' :
return org.apache.commons.lang3.time.FastDateParser.SECOND_STRATEGY;
case 'w' :
return org.apache.commons.lang3.time.FastDateParser.WEEK_OF_YEAR_STRATEGY;
case 'y' :
return (formatField.length()) > 2 ? org.apache.commons.lang3.time.FastDateParser.LITERAL_YEAR_STRATEGY : org.apache.commons.lang3.time.FastDateParser.ABBREVIATED_YEAR_STRATEGY;
case 'Z' :
case 'z' :
return getLocaleSpecificStrategy(java.util.Calendar.ZONE_OFFSET, definingCalendar);
}
}
@java.lang.SuppressWarnings(value = "unchecked")
private static java.util.concurrent.ConcurrentMap<java.util.Locale, org.apache.commons.lang3.time.FastDateParser.Strategy>[] caches = new java.util.concurrent.ConcurrentMap[java.util.Calendar.FIELD_COUNT];
private static java.util.concurrent.ConcurrentMap<java.util.Locale, org.apache.commons.lang3.time.FastDateParser.Strategy> getCache(final int field) {
synchronized(org.apache.commons.lang3.time.FastDateParser.caches) {
if ((org.apache.commons.lang3.time.FastDateParser.caches[field]) == null) {
org.apache.commons.lang3.time.FastDateParser.caches[field] = new java.util.concurrent.ConcurrentHashMap<java.util.Locale, org.apache.commons.lang3.time.FastDateParser.Strategy>(3);
}
return org.apache.commons.lang3.time.FastDateParser.caches[field];
}
}
private org.apache.commons.lang3.time.FastDateParser.Strategy getLocaleSpecificStrategy(final int field, final java.util.Calendar definingCalendar) {
final java.util.concurrent.ConcurrentMap<java.util.Locale, org.apache.commons.lang3.time.FastDateParser.Strategy> cache = org.apache.commons.lang3.time.FastDateParser.getCache(field);
org.apache.commons.lang3.time.FastDateParser.Strategy strategy = cache.get(locale);
if (strategy == null) {
strategy = field == (java.util.Calendar.ZONE_OFFSET) ? new org.apache.commons.lang3.time.FastDateParser.TimeZoneStrategy(locale) : new org.apache.commons.lang3.time.FastDateParser.TextStrategy(field , definingCalendar , locale);
final org.apache.commons.lang3.time.FastDateParser.Strategy inCache = cache.putIfAbsent(locale, strategy);
if (inCache != null) {
return inCache;
}
}
return strategy;
}
private static class CopyQuotedStrategy extends org.apache.commons.lang3.time.FastDateParser.Strategy {
private final java.lang.String formatField;
CopyQuotedStrategy(final java.lang.String formatField) {
this.formatField = formatField;
}
@java.lang.Override
boolean isNumber() {
char c = formatField.charAt(0);
if (c == '\'') {
c = formatField.charAt(1);
}
return java.lang.Character.isDigit(c);
}
@java.lang.Override
boolean addRegex(final org.apache.commons.lang3.time.FastDateParser parser, final java.lang.StringBuilder regex) {
org.apache.commons.lang3.time.FastDateParser.escapeRegex(regex, formatField, true);
return false;
}
}
private static class TextStrategy extends org.apache.commons.lang3.time.FastDateParser.Strategy {
private final int field;
private final java.util.Map<java.lang.String, java.lang.Integer> keyValues;
TextStrategy(final int field ,final java.util.Calendar definingCalendar ,final java.util.Locale locale) {
this.field = field;
this.keyValues = org.apache.commons.lang3.time.FastDateParser.getDisplayNames(field, definingCalendar, locale);
}
@java.lang.Override
boolean addRegex(final org.apache.commons.lang3.time.FastDateParser parser, final java.lang.StringBuilder regex) {
regex.append('(');
for (final java.lang.String textKeyValue : keyValues.keySet()) {
org.apache.commons.lang3.time.FastDateParser.escapeRegex(regex, textKeyValue, false).append('|');
}
regex.setCharAt(((regex.length()) - 1), ')');
return true;
}
@java.lang.Override
void setCalendar(final org.apache.commons.lang3.time.FastDateParser parser, final java.util.Calendar cal, final java.lang.String value) {
final java.lang.Integer iVal = keyValues.get(value);
if (iVal == null) {
final java.lang.StringBuilder sb = new java.lang.StringBuilder(value);
sb.append(" not in (");
for (final java.lang.String textKeyValue : keyValues.keySet()) {
sb.append(textKeyValue).append(' ');
}
sb.setCharAt(((sb.length()) - 1), ')');
throw new java.lang.IllegalArgumentException(sb.toString());
}
cal.set(field, iVal.intValue());
}
}
private static class NumberStrategy extends org.apache.commons.lang3.time.FastDateParser.Strategy {
private final int field;
NumberStrategy(final int field) {
this.field = field;
}
@java.lang.Override
boolean isNumber() {
return true;
}
@java.lang.Override
boolean addRegex(final org.apache.commons.lang3.time.FastDateParser parser, final java.lang.StringBuilder regex) {
if (parser.isNextNumber()) {
regex.append("(\\p{IsNd}{").append(parser.getFieldWidth()).append("}+)");
} else {
regex.append("(\\p{IsNd}++)");
}
return true;
}
@java.lang.Override
void setCalendar(final org.apache.commons.lang3.time.FastDateParser parser, final java.util.Calendar cal, final java.lang.String value) {
cal.set(field, modify(java.lang.Integer.parseInt(value)));
}
int modify(final int iValue) {
return iValue;
}
}
private static final org.apache.commons.lang3.time.FastDateParser.Strategy ABBREVIATED_YEAR_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.YEAR) {
@java.lang.Override
void setCalendar(final org.apache.commons.lang3.time.FastDateParser parser, final java.util.Calendar cal, final java.lang.String value) {
int iValue = java.lang.Integer.parseInt(value);
if (iValue < 100) {
iValue = parser.adjustYear(iValue);
}
cal.set(java.util.Calendar.YEAR, iValue);
}
};
private static class TimeZoneStrategy extends org.apache.commons.lang3.time.FastDateParser.Strategy {
private final java.lang.String validTimeZoneChars;
private final java.util.SortedMap<java.lang.String, java.util.TimeZone> tzNames = new java.util.TreeMap<java.lang.String, java.util.TimeZone>(java.lang.String.CASE_INSENSITIVE_ORDER);
TimeZoneStrategy(final java.util.Locale locale) {
for (final java.lang.String id : java.util.TimeZone.getAvailableIDs()) {
if (id.startsWith("GMT")) {
continue;
}
final java.util.TimeZone tz = java.util.TimeZone.getTimeZone(id);
tzNames.put(tz.getDisplayName(false, java.util.TimeZone.SHORT, locale), tz);
tzNames.put(tz.getDisplayName(false, java.util.TimeZone.LONG, locale), tz);
if (tz.useDaylightTime()) {
tzNames.put(tz.getDisplayName(true, java.util.TimeZone.SHORT, locale), tz);
tzNames.put(tz.getDisplayName(true, java.util.TimeZone.LONG, locale), tz);
}
}
final java.lang.StringBuilder sb = new java.lang.StringBuilder();
sb.append("(GMT[+\\-]\\d{0,1}\\d{2}|[+\\-]\\d{2}:?\\d{2}|");
for (final java.lang.String id : tzNames.keySet()) {
org.apache.commons.lang3.time.FastDateParser.escapeRegex(sb, id, false).append('|');
}
sb.setCharAt(((sb.length()) - 1), ')');
validTimeZoneChars = sb.toString();
}
@java.lang.Override
boolean addRegex(final org.apache.commons.lang3.time.FastDateParser parser, final java.lang.StringBuilder regex) {
regex.append(validTimeZoneChars);
return true;
}
@java.lang.Override
void setCalendar(final org.apache.commons.lang3.time.FastDateParser parser, final java.util.Calendar cal, final java.lang.String value) {
java.util.TimeZone tz;
if (((value.charAt(0)) == '+') || ((value.charAt(0)) == '-')) {
tz = java.util.TimeZone.getTimeZone(("GMT" + value));
} else {
if (value.startsWith("GMT")) {
tz = java.util.TimeZone.getTimeZone(value);
} else {
return "";
tz = tzNames.get(value);
if (tz == null) {
throw new java.lang.IllegalArgumentException((value + " is not a supported timezone name"));
}
}
}
cal.setTimeZone(tz);
}
}
private static final org.apache.commons.lang3.time.FastDateParser.Strategy NUMBER_MONTH_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.MONTH) {
@java.lang.Override
int modify(final int iValue) {
return iValue - 1;
}
};
private static final org.apache.commons.lang3.time.FastDateParser.Strategy LITERAL_YEAR_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.YEAR);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy WEEK_OF_YEAR_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.WEEK_OF_YEAR);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy WEEK_OF_MONTH_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.WEEK_OF_MONTH);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy DAY_OF_YEAR_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.DAY_OF_YEAR);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy DAY_OF_MONTH_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.DAY_OF_MONTH);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy DAY_OF_WEEK_IN_MONTH_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.DAY_OF_WEEK_IN_MONTH);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy HOUR_OF_DAY_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.HOUR_OF_DAY);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy MODULO_HOUR_OF_DAY_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.HOUR_OF_DAY) {
@java.lang.Override
int modify(final int iValue) {
return iValue % 24;
}
};
private static final org.apache.commons.lang3.time.FastDateParser.Strategy MODULO_HOUR_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.HOUR) {
@java.lang.Override
int modify(final int iValue) {
return iValue % 12;
}
};
private static final org.apache.commons.lang3.time.FastDateParser.Strategy HOUR_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.HOUR);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy MINUTE_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.MINUTE);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy SECOND_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.SECOND);
private static final org.apache.commons.lang3.time.FastDateParser.Strategy MILLISECOND_STRATEGY = new org.apache.commons.lang3.time.FastDateParser.NumberStrategy(java.util.Calendar.MILLISECOND);
}
| [
"[email protected]"
] | |
a8c6197383678a1a1bc84e77b7c040783901f3c2 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project70/src/main/java/org/gradle/test/performance/largejavamultiproject/project70/p352/Production7040.java | 34ca747bc68ac03026c81dd9df182c2c5638d48f | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,887 | java | package org.gradle.test.performance.largejavamultiproject.project70.p352;
public class Production7040 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"[email protected]"
] | |
95079583db6927f820e092bbe3a31757cc2fbc61 | 2312f810c8429264f5000070df03557437aaf8b3 | /app/src/main/java/com/test/shileiyu/jetpack/common/widget/AppBarDampingBehavior.java | 35ddade4d8c777bee7e7bd49ff04f72a4cc2213e | [] | no_license | yushilei1218/JetPack | 002d6d3469a478523cff9ff0e23118209e245b33 | 9f7366f820aa7bfe95c088ec26dba76c39af13b2 | refs/heads/master | 2020-03-26T10:50:01.986030 | 2018-11-19T06:25:47 | 2018-11-19T06:25:47 | 144,817,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,849 | java | package com.test.shileiyu.jetpack.common.widget;
import android.content.Context;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
/**
* @author shilei.yu
* @date 2018/8/20
*/
public class AppBarDampingBehavior extends AppBarLayout.Behavior {
public AppBarDampingBehavior() {
}
public AppBarDampingBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
String TAG = "AppBarDampingBehavior";
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout,
AppBarLayout child, View target, int dx, int dy, int[] consumed, int type) {
boolean isNeedDamping = false;
int temp = dy;
if (dy < 0) {
//向下滑动 并且Header露出的高度小于自身,则需要进行阻尼滑动
int appBarHeight = child.getHeight();
int offset = getTopAndBottomOffset();
if (offset < 0 && appBarHeight > -offset) {
isNeedDamping = true;
dy = (int) (dy * 0.7f);
}
Log.d(TAG, "offset " + offset + " appBar " + appBarHeight);
}
super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
Log.d(TAG, "consumed1 " + consumed[1]);
if (isNeedDamping) {
consumed[1] = (int) (dy*0.7f);
}
}
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type);
}
}
| [
"[email protected]"
] | |
28540e1ec2a4c33b5d95057da27cac70a18fd2ef | f2964965cc45ae699e4dd47d543bcdd233b1f682 | /opt/cassandra/build/test/classes/org/apache/cassandra/test/microbench/generated/BTreeSearchIteratorBench_searchFound_jmhTest.java | 64d4cbed46fa1edb1b9f74066a80ac861e8f9207 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause"
] | permissive | allprojects/thesis-consyst-operation-types | 1f10492a4089ba5849fa69d3b6f3544133b66328 | fbed2cabadd96958e11f6f60f531081cee44ad91 | refs/heads/master | 2023-08-17T08:33:06.359232 | 2021-04-12T14:19:09 | 2021-04-12T14:19:09 | 352,923,443 | 1 | 0 | Apache-2.0 | 2021-06-25T13:48:32 | 2021-03-30T08:17:52 | Java | UTF-8 | Java | false | false | 23,997 | java | package org.apache.cassandra.test.microbench.generated;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.Collection;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.runner.InfraControl;
import org.openjdk.jmh.infra.ThreadParams;
import org.openjdk.jmh.results.BenchmarkTaskResult;
import org.openjdk.jmh.results.Result;
import org.openjdk.jmh.results.ThroughputResult;
import org.openjdk.jmh.results.AverageTimeResult;
import org.openjdk.jmh.results.SampleTimeResult;
import org.openjdk.jmh.results.SingleShotResult;
import org.openjdk.jmh.util.SampleBuffer;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.results.RawResults;
import org.openjdk.jmh.results.ResultRole;
import java.lang.reflect.Field;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.infra.Control;
import org.openjdk.jmh.results.ScalarResult;
import org.openjdk.jmh.results.AggregationPolicy;
import org.openjdk.jmh.runner.FailureAssistException;
import org.apache.cassandra.test.microbench.generated.BTreeSearchIteratorBench_jmhType;
public final class BTreeSearchIteratorBench_searchFound_jmhTest {
boolean p000, p001, p002, p003, p004, p005, p006, p007, p008, p009, p010, p011, p012, p013, p014, p015;
boolean p016, p017, p018, p019, p020, p021, p022, p023, p024, p025, p026, p027, p028, p029, p030, p031;
boolean p032, p033, p034, p035, p036, p037, p038, p039, p040, p041, p042, p043, p044, p045, p046, p047;
boolean p048, p049, p050, p051, p052, p053, p054, p055, p056, p057, p058, p059, p060, p061, p062, p063;
boolean p064, p065, p066, p067, p068, p069, p070, p071, p072, p073, p074, p075, p076, p077, p078, p079;
boolean p080, p081, p082, p083, p084, p085, p086, p087, p088, p089, p090, p091, p092, p093, p094, p095;
boolean p096, p097, p098, p099, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111;
boolean p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127;
boolean p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143;
boolean p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159;
boolean p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175;
boolean p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191;
boolean p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207;
boolean p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223;
boolean p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239;
boolean p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251, p252, p253, p254, p255;
int startRndMask;
BenchmarkParams benchmarkParams;
IterationParams iterationParams;
ThreadParams threadParams;
Blackhole blackhole;
Control notifyControl;
public BenchmarkTaskResult searchFound_Throughput(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
RawResults res = new RawResults();
BTreeSearchIteratorBench_jmhType l_btreesearchiteratorbench0_G = _jmh_tryInit_f_btreesearchiteratorbench0_G(control);
control.preSetup();
control.announceWarmupReady();
while (control.warmupShouldWait) {
l_btreesearchiteratorbench0_G.searchFound();
res.allOps++;
}
notifyControl.startMeasurement = true;
searchFound_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_btreesearchiteratorbench0_G);
notifyControl.stopMeasurement = true;
control.announceWarmdownReady();
try {
while (control.warmdownShouldWait) {
l_btreesearchiteratorbench0_G.searchFound();
res.allOps++;
}
control.preTearDown();
} catch (InterruptedException ie) {
control.preTearDownForce();
}
if (control.isLastIteration()) {
if (BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.compareAndSet(l_btreesearchiteratorbench0_G, 0, 1)) {
try {
if (control.isFailing) throw new FailureAssistException();
if (l_btreesearchiteratorbench0_G.readyTrial) {
l_btreesearchiteratorbench0_G.readyTrial = false;
}
} catch (Throwable t) {
control.isFailing = true;
throw t;
} finally {
BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.set(l_btreesearchiteratorbench0_G, 0);
}
} else {
long l_btreesearchiteratorbench0_G_backoff = 1;
while (BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.get(l_btreesearchiteratorbench0_G) == 1) {
TimeUnit.MILLISECONDS.sleep(l_btreesearchiteratorbench0_G_backoff);
l_btreesearchiteratorbench0_G_backoff = Math.max(1024, l_btreesearchiteratorbench0_G_backoff * 2);
if (control.isFailing) throw new FailureAssistException();
if (Thread.interrupted()) throw new InterruptedException();
}
}
synchronized(this.getClass()) {
f_btreesearchiteratorbench0_G = null;
}
}
res.allOps += res.measuredOps;
int batchSize = iterationParams.getBatchSize();
int opsPerInv = benchmarkParams.getOpsPerInvocation();
res.allOps *= opsPerInv;
res.allOps /= batchSize;
res.measuredOps *= opsPerInv;
res.measuredOps /= batchSize;
BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps);
results.add(new ThroughputResult(ResultRole.PRIMARY, "searchFound", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void searchFound_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, BTreeSearchIteratorBench_jmhType l_btreesearchiteratorbench0_G) throws Throwable {
long operations = 0;
long realTime = 0;
result.startTime = System.nanoTime();
do {
l_btreesearchiteratorbench0_G.searchFound();
operations++;
} while(!control.isDone);
result.stopTime = System.nanoTime();
result.realTime = realTime;
result.measuredOps = operations;
}
public BenchmarkTaskResult searchFound_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
RawResults res = new RawResults();
BTreeSearchIteratorBench_jmhType l_btreesearchiteratorbench0_G = _jmh_tryInit_f_btreesearchiteratorbench0_G(control);
control.preSetup();
control.announceWarmupReady();
while (control.warmupShouldWait) {
l_btreesearchiteratorbench0_G.searchFound();
res.allOps++;
}
notifyControl.startMeasurement = true;
searchFound_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_btreesearchiteratorbench0_G);
notifyControl.stopMeasurement = true;
control.announceWarmdownReady();
try {
while (control.warmdownShouldWait) {
l_btreesearchiteratorbench0_G.searchFound();
res.allOps++;
}
control.preTearDown();
} catch (InterruptedException ie) {
control.preTearDownForce();
}
if (control.isLastIteration()) {
if (BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.compareAndSet(l_btreesearchiteratorbench0_G, 0, 1)) {
try {
if (control.isFailing) throw new FailureAssistException();
if (l_btreesearchiteratorbench0_G.readyTrial) {
l_btreesearchiteratorbench0_G.readyTrial = false;
}
} catch (Throwable t) {
control.isFailing = true;
throw t;
} finally {
BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.set(l_btreesearchiteratorbench0_G, 0);
}
} else {
long l_btreesearchiteratorbench0_G_backoff = 1;
while (BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.get(l_btreesearchiteratorbench0_G) == 1) {
TimeUnit.MILLISECONDS.sleep(l_btreesearchiteratorbench0_G_backoff);
l_btreesearchiteratorbench0_G_backoff = Math.max(1024, l_btreesearchiteratorbench0_G_backoff * 2);
if (control.isFailing) throw new FailureAssistException();
if (Thread.interrupted()) throw new InterruptedException();
}
}
synchronized(this.getClass()) {
f_btreesearchiteratorbench0_G = null;
}
}
res.allOps += res.measuredOps;
int batchSize = iterationParams.getBatchSize();
int opsPerInv = benchmarkParams.getOpsPerInvocation();
res.allOps *= opsPerInv;
res.allOps /= batchSize;
res.measuredOps *= opsPerInv;
res.measuredOps /= batchSize;
BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps);
results.add(new AverageTimeResult(ResultRole.PRIMARY, "searchFound", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void searchFound_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, BTreeSearchIteratorBench_jmhType l_btreesearchiteratorbench0_G) throws Throwable {
long operations = 0;
long realTime = 0;
result.startTime = System.nanoTime();
do {
l_btreesearchiteratorbench0_G.searchFound();
operations++;
} while(!control.isDone);
result.stopTime = System.nanoTime();
result.realTime = realTime;
result.measuredOps = operations;
}
public BenchmarkTaskResult searchFound_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
RawResults res = new RawResults();
BTreeSearchIteratorBench_jmhType l_btreesearchiteratorbench0_G = _jmh_tryInit_f_btreesearchiteratorbench0_G(control);
control.preSetup();
control.announceWarmupReady();
while (control.warmupShouldWait) {
l_btreesearchiteratorbench0_G.searchFound();
res.allOps++;
}
notifyControl.startMeasurement = true;
int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20); // at max, 20 timestamps per millisecond
int batchSize = iterationParams.getBatchSize();
int opsPerInv = benchmarkParams.getOpsPerInvocation();
SampleBuffer buffer = new SampleBuffer();
searchFound_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_btreesearchiteratorbench0_G);
notifyControl.stopMeasurement = true;
control.announceWarmdownReady();
try {
while (control.warmdownShouldWait) {
l_btreesearchiteratorbench0_G.searchFound();
res.allOps++;
}
control.preTearDown();
} catch (InterruptedException ie) {
control.preTearDownForce();
}
if (control.isLastIteration()) {
if (BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.compareAndSet(l_btreesearchiteratorbench0_G, 0, 1)) {
try {
if (control.isFailing) throw new FailureAssistException();
if (l_btreesearchiteratorbench0_G.readyTrial) {
l_btreesearchiteratorbench0_G.readyTrial = false;
}
} catch (Throwable t) {
control.isFailing = true;
throw t;
} finally {
BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.set(l_btreesearchiteratorbench0_G, 0);
}
} else {
long l_btreesearchiteratorbench0_G_backoff = 1;
while (BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.get(l_btreesearchiteratorbench0_G) == 1) {
TimeUnit.MILLISECONDS.sleep(l_btreesearchiteratorbench0_G_backoff);
l_btreesearchiteratorbench0_G_backoff = Math.max(1024, l_btreesearchiteratorbench0_G_backoff * 2);
if (control.isFailing) throw new FailureAssistException();
if (Thread.interrupted()) throw new InterruptedException();
}
}
synchronized(this.getClass()) {
f_btreesearchiteratorbench0_G = null;
}
}
res.allOps += res.measuredOps * batchSize;
res.allOps *= opsPerInv;
res.allOps /= batchSize;
res.measuredOps *= opsPerInv;
BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps);
results.add(new SampleTimeResult(ResultRole.PRIMARY, "searchFound", buffer, benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void searchFound_sample_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, SampleBuffer buffer, int targetSamples, long opsPerInv, int batchSize, BTreeSearchIteratorBench_jmhType l_btreesearchiteratorbench0_G) throws Throwable {
long realTime = 0;
long operations = 0;
int rnd = (int)System.nanoTime();
int rndMask = startRndMask;
long time = 0;
int currentStride = 0;
do {
rnd = (rnd * 1664525 + 1013904223);
boolean sample = (rnd & rndMask) == 0;
if (sample) {
time = System.nanoTime();
}
for (int b = 0; b < batchSize; b++) {
if (control.volatileSpoiler) return;
l_btreesearchiteratorbench0_G.searchFound();
}
if (sample) {
buffer.add((System.nanoTime() - time) / opsPerInv);
if (currentStride++ > targetSamples) {
buffer.half();
currentStride = 0;
rndMask = (rndMask << 1) + 1;
}
}
operations++;
} while(!control.isDone);
startRndMask = Math.max(startRndMask, rndMask);
result.realTime = realTime;
result.measuredOps = operations;
}
public BenchmarkTaskResult searchFound_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
BTreeSearchIteratorBench_jmhType l_btreesearchiteratorbench0_G = _jmh_tryInit_f_btreesearchiteratorbench0_G(control);
control.preSetup();
notifyControl.startMeasurement = true;
RawResults res = new RawResults();
int batchSize = iterationParams.getBatchSize();
searchFound_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_btreesearchiteratorbench0_G);
control.preTearDown();
if (control.isLastIteration()) {
if (BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.compareAndSet(l_btreesearchiteratorbench0_G, 0, 1)) {
try {
if (control.isFailing) throw new FailureAssistException();
if (l_btreesearchiteratorbench0_G.readyTrial) {
l_btreesearchiteratorbench0_G.readyTrial = false;
}
} catch (Throwable t) {
control.isFailing = true;
throw t;
} finally {
BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.set(l_btreesearchiteratorbench0_G, 0);
}
} else {
long l_btreesearchiteratorbench0_G_backoff = 1;
while (BTreeSearchIteratorBench_jmhType.tearTrialMutexUpdater.get(l_btreesearchiteratorbench0_G) == 1) {
TimeUnit.MILLISECONDS.sleep(l_btreesearchiteratorbench0_G_backoff);
l_btreesearchiteratorbench0_G_backoff = Math.max(1024, l_btreesearchiteratorbench0_G_backoff * 2);
if (control.isFailing) throw new FailureAssistException();
if (Thread.interrupted()) throw new InterruptedException();
}
}
synchronized(this.getClass()) {
f_btreesearchiteratorbench0_G = null;
}
}
int opsPerInv = control.benchmarkParams.getOpsPerInvocation();
long totalOps = opsPerInv;
BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps);
results.add(new SingleShotResult(ResultRole.PRIMARY, "searchFound", res.getTime(), benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void searchFound_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, BTreeSearchIteratorBench_jmhType l_btreesearchiteratorbench0_G) throws Throwable {
long realTime = 0;
result.startTime = System.nanoTime();
for (int b = 0; b < batchSize; b++) {
if (control.volatileSpoiler) return;
l_btreesearchiteratorbench0_G.searchFound();
}
result.stopTime = System.nanoTime();
result.realTime = realTime;
}
static volatile BTreeSearchIteratorBench_jmhType f_btreesearchiteratorbench0_G;
BTreeSearchIteratorBench_jmhType _jmh_tryInit_f_btreesearchiteratorbench0_G(InfraControl control) throws Throwable {
BTreeSearchIteratorBench_jmhType val = f_btreesearchiteratorbench0_G;
if (val != null) {
return val;
}
synchronized(this.getClass()) {
try {
if (control.isFailing) throw new FailureAssistException();
val = f_btreesearchiteratorbench0_G;
if (val != null) {
return val;
}
val = new BTreeSearchIteratorBench_jmhType();
Field f;
f = org.apache.cassandra.test.microbench.BTreeSearchIteratorBench.class.getDeclaredField("dirParam");
f.setAccessible(true);
f.set(val, control.getParam("dirParam"));
f = org.apache.cassandra.test.microbench.BTreeSearchIteratorBench.class.getDeclaredField("iteratorType");
f.setAccessible(true);
f.set(val, control.getParam("iteratorType"));
f = org.apache.cassandra.test.microbench.BTreeSearchIteratorBench.class.getDeclaredField("targetIdx");
f.setAccessible(true);
f.set(val, Integer.valueOf(control.getParam("targetIdx")));
val.setup();
val.readyTrial = true;
f_btreesearchiteratorbench0_G = val;
} catch (Throwable t) {
control.isFailing = true;
throw t;
}
}
return val;
}
}
| [
"[email protected]"
] | |
5adbfb9aaa80a712b1572345a5f1ddf2d9e77ddd | 46c12405ba8ea843c0b5ff9e243178f54ba69f9c | /app/src/main/java/com/example/juanc/mascotas/MainActivity.java | 38b5c524fe47ca03425fd724a25fe34da2314794 | [] | no_license | juancarlos-197/Mascotas | 77fbbf6c317475e695c46534d4e3a4fd75e7935b | 85e33a0cfa9b4c265cd914b075bc012b7d967b79 | refs/heads/master | 2020-07-19T02:24:59.615107 | 2017-06-14T13:32:28 | 2017-06-14T13:32:28 | 94,333,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.example.juanc.mascotas;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
] | |
504ce544974be4f6a11327423e884d9156fa4f15 | 8ef9fbc49cc49e4b04658ae5d6adfd3b58ca474a | /bboss-elasticsearch-rest-jdbc/src/main/java/org/frameworkset/elasticsearch/client/JDBCRestClientUtil.java | 85dac04e58b9fbe75a678b459dc16648d2040cc6 | [
"Apache-2.0"
] | permissive | dhyking/bboss-elastic | 78fe80155f180060104b3d2aa9eb7b97d6866174 | d22583134d3502a140fc096f30d40f5c15609068 | refs/heads/master | 2020-04-16T18:14:56.412768 | 2019-01-14T15:11:36 | 2019-01-14T15:11:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,941 | java | package org.frameworkset.elasticsearch.client;
import com.frameworkset.common.poolman.handle.ValueExchange;
import com.frameworkset.common.poolman.sql.PoolManResultSetMetaData;
import com.frameworkset.util.SimpleStringUtil;
import org.frameworkset.elasticsearch.ElasticSearchException;
import org.frameworkset.elasticsearch.ElasticSearchHelper;
import org.frameworkset.elasticsearch.serial.CharEscapeUtil;
import org.frameworkset.elasticsearch.template.ESUtil;
import org.frameworkset.soa.BBossStringWriter;
import org.frameworkset.util.annotations.DateFormateMeta;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.Writer;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
public class JDBCRestClientUtil extends ErrorWrapper{
private static Logger logger = LoggerFactory.getLogger(JDBCRestClientUtil.class);
private ClientInterface clientInterface;
private ESJDBC jdbcResultSet;
public JDBCRestClientUtil( ) {
clientInterface = ElasticSearchHelper.getRestClientUtil();
}
public JDBCRestClientUtil( String esCluster) {
clientInterface = ElasticSearchHelper.getRestClientUtil(esCluster);
}
/**
* 并行批处理导入
* @param indexName
* @param indexType
* @param batchsize
* @param refreshOption
* @return
*/
private String parallelBatchExecute(String indexName,String indexType,int batchsize,String refreshOption){
int count = 0;
StringBuilder builder = new StringBuilder();
BBossStringWriter writer = new BBossStringWriter(builder);
String ret = null;
ExecutorService service = jdbcResultSet.buildThreadPool();
List<Future> tasks = new ArrayList<Future>();
int taskNo = 0;
ImportCount totalCount = new ImportCount();
Exception exception = null;
Object lastValue = null;
try {
while (jdbcResultSet.next()) {
if(!assertCondition()) {
throw error;
}
lastValue = jdbcResultSet.getLastValue();
evalBuilk(writer, indexName, indexType, jdbcResultSet, "index");
count++;
if (count == batchsize) {
writer.flush();
String datas = builder.toString();
builder.setLength(0);
writer.close();
writer = new BBossStringWriter(builder);
count = 0;
tasks.add(service.submit(new TaskCall(refreshOption, datas,this,taskNo,totalCount,batchsize,jdbcResultSet.isPrintTaskLog())));
taskNo ++;
}
}
if (count > 0) {
if(this.error != null && !jdbcResultSet.isContinueOnError()) {
throw error;
}
writer.flush();
String datas = builder.toString();
tasks.add(service.submit(new TaskCall(refreshOption,datas,this,taskNo,totalCount,count,jdbcResultSet.isPrintTaskLog())));
taskNo ++;
if(isPrintTaskLog())
logger.info(new StringBuilder().append("submit tasks:").append(taskNo).toString());
}
else{
if(isPrintTaskLog())
logger.info(new StringBuilder().append("submit tasks:").append(taskNo).toString());
}
} catch (SQLException e) {
exception = e;
throw new ElasticSearchException(e);
} catch (ElasticSearchException e) {
exception = e;
throw e;
} catch (Exception e) {
exception = e;
throw new ElasticSearchException(e);
}
finally {
waitTasksComplete( jdbcResultSet, tasks, service,exception, lastValue,totalCount );
try {
writer.close();
} catch (Exception e) {
}
}
return ret;
}
/**
* 串行批处理导入
* @param indexName
* @param indexType
* @param batchsize
* @param refreshOption
* @return
*/
private String batchExecute(String indexName,String indexType,int batchsize,String refreshOption){
int count = 0;
StringBuilder builder = new StringBuilder();
BBossStringWriter writer = new BBossStringWriter(builder);
String ret = null;
int taskNo = 0;
Exception exception = null;
Object lastValue = null;
long start = System.currentTimeMillis();
long istart = 0;
long end = 0;
long totalCount = 0;
try {
istart = start;
while (jdbcResultSet.next()) {
lastValue = jdbcResultSet.getLastValue();
evalBuilk(writer, indexName, indexType, jdbcResultSet, "index");
count++;
if (count == batchsize) {
writer.flush();
String datas = builder.toString();
builder.setLength(0);
writer.close();
writer = new BBossStringWriter(builder);
count = 0;
taskNo ++;
ret = TaskCall.call(refreshOption,clientInterface,datas,jdbcResultSet);
jdbcResultSet.flushLastValue(lastValue);
if(isPrintTaskLog()) {
end = System.currentTimeMillis();
logger.info(new StringBuilder().append("Task[").append(taskNo).append("] complete,take time:").append((end - istart)).append("ms")
.append(",import ").append(batchsize).append(" records.").toString());
istart = end;
}
totalCount += batchsize;
}
}
if (count > 0) {
writer.flush();
String datas = builder.toString();
taskNo ++;
ret = TaskCall.call(refreshOption,clientInterface,datas,jdbcResultSet);
jdbcResultSet.flushLastValue(lastValue);
if(isPrintTaskLog()) {
end = System.currentTimeMillis();
logger.info(new StringBuilder().append("Task[").append(taskNo).append("] complete,take time:").append((end - istart)).append("ms")
.append(",import ").append(count).append(" records.").toString());
}
totalCount += count;
}
if(isPrintTaskLog()) {
end = System.currentTimeMillis();
logger.info(new StringBuilder().append("Execute Tasks:").append(taskNo).append(",All Take time:").append((end - start)).append("ms")
.append(",Import total ").append(totalCount).append(" records.").toString());
}
} catch (SQLException e) {
exception = e;
throw new ElasticSearchException(e);
} catch (ElasticSearchException e) {
exception = e;
throw e;
} catch (Exception e) {
exception = e;
throw new ElasticSearchException(e);
}
finally {
if(exception != null && !getESJDBC().isContinueOnError()){
getESJDBC().stop();
}
try {
writer.close();
} catch (Exception e) {
}
}
return ret;
}
private String serialExecute(String indexName, String indexType, ESJDBC jdbcResultSet, String refreshOption, int batchsize){
StringBuilder builder = new StringBuilder();
BBossStringWriter writer = new BBossStringWriter(builder);
Object lastValue = null;
Exception exception = null;
long start = System.currentTimeMillis();
long totalCount = 0;
try {
while (jdbcResultSet.next()) {
try {
lastValue = jdbcResultSet.getLastValue();
evalBuilk(writer, indexName, indexType, jdbcResultSet, "index");
totalCount ++;
} catch (Exception e) {
throw new ElasticSearchException(e);
}
}
writer.flush();
String ret = TaskCall.call(refreshOption,clientInterface,builder.toString(),jdbcResultSet);
jdbcResultSet.flushLastValue(lastValue);
if(isPrintTaskLog()) {
long end = System.currentTimeMillis();
logger.info(new StringBuilder().append("All Take time:").append((end - start)).append("ms")
.append(",Import total ").append(totalCount).append(" records.").toString());
}
return ret;
} catch (Exception e) {
exception = e;
throw new ElasticSearchException(e);
}
finally {
if(exception != null && !getESJDBC().isContinueOnError()){
getESJDBC().stop();
}
}
}
public String addDocuments(String indexName, String indexType, ESJDBC jdbcResultSet, String refreshOption, int batchsize) throws ElasticSearchException {
if(jdbcResultSet == null || jdbcResultSet.getResultSet() == null)
return null;
this.jdbcResultSet = jdbcResultSet;
if(isPrintTaskLog()) {
logger.info(new StringBuilder().append("import data to IndexName[").append(indexName)
.append("] IndexType[").append(indexType)
.append("] start.").toString());
}
if (batchsize <= 0) {
return serialExecute( indexName, indexType, jdbcResultSet, refreshOption, batchsize);
} else {
if(jdbcResultSet.getThreadCount() > 0 && jdbcResultSet.isParallel()){
return this.parallelBatchExecute(indexName,indexType,batchsize,refreshOption);
}
else{
return this.batchExecute(indexName,indexType,batchsize,refreshOption);
}
}
}
private void jobComplete(ExecutorService service,Exception exception,Object lastValue ){
if (jdbcResultSet.getScheduleService() == null) {//作业定时调度执行的话,需要关闭线程池
service.shutdown();
}
else{
if(this.assertCondition(exception)){
jdbcResultSet.flushLastValue( lastValue );
}
else{
service.shutdown();
this.getESJDBC().stop();
}
}
}
private boolean isPrintTaskLog(){
return getESJDBC().isPrintTaskLog() && logger.isInfoEnabled();
}
private void waitTasksComplete(ESJDBC jdbcResultSet,final List<Future> tasks,
final ExecutorService service,Exception exception,Object lastValue,final ImportCount totalCount ){
if(!jdbcResultSet.isAsyn() || jdbcResultSet.getScheduleService() != null) {
int count = 0;
for (Future future : tasks) {
try {
future.get();
count ++;
} catch (ExecutionException e) {
if(exception == null)
exception = e;
if(e.getCause() != null)
logger.error("",e.getCause());
else
logger.error("",e);
}catch (Exception e) {
if(exception == null)
exception = e;
logger.error("",e);
}
}
if(isPrintTaskLog()) {
logger.info(new StringBuilder().append("Complete tasks:").append(count).append(",Total import ").append(totalCount.getTotalCount()).append(" records.").toString());
}
jobComplete( service,exception,lastValue );
}
else{
Thread completeThread = new Thread(new Runnable() {
@Override
public void run() {
int count = 0;
for (Future future : tasks) {
try {
future.get();
count ++;
} catch (ExecutionException e) {
if(e.getCause() != null)
logger.error("",e.getCause());
else
logger.error("",e);
}catch (Exception e) {
logger.error("",e);
}
}
if(isPrintTaskLog()) {
logger.info(new StringBuilder().append("Complete tasks:").append(count).append(",Total import ").append(totalCount.getTotalCount()).append(" records.").toString());
}
jobComplete( service,null,null);
}
});
completeThread.start();
}
}
private Object handleDate(ResultSet row,int i)
{
Object value = null;
try {
try {
value = row.getTimestamp(i+1);
if(value != null)
value = ((java.sql.Timestamp)value).getTime();
else
value = 0;
} catch (Exception e) {
value = row.getDate(i+1);
if(value != null)
value = ((java.sql.Date)value).getTime();
else
value = 0;
}
} catch (Exception e) {
value = 0;
}
return value;
}
private static Object getEsParentId(ESJDBC jdbcResultSet) throws Exception {
if(jdbcResultSet.getEsParentIdField() != null) {
return jdbcResultSet.getValue(jdbcResultSet.getEsParentIdField());
}
else
return jdbcResultSet.getEsParentIdValue();
}
public static void buildMeta(Context context,Writer writer ,String indexType,String indexName, ESJDBC jdbcResultSet,String action) throws Exception {
Object id = context.getEsId();
Object parentId = getEsParentId( jdbcResultSet);
Object routing = jdbcResultSet.getValue(jdbcResultSet.getRoutingField());
if(routing == null)
routing = jdbcResultSet.getRoutingValue();
Object esRetryOnConflict = jdbcResultSet.getEsRetryOnConflict();
buildMeta( writer , indexType, indexName, jdbcResultSet, action, id, parentId,routing,esRetryOnConflict);
}
private static Object getVersion(ESJDBC esjdbc) throws Exception {
Object version = esjdbc.getEsVersionField() !=null? esjdbc.getValue(esjdbc.getEsVersionField()):esjdbc.getEsVersionValue();
return version;
}
public static void buildMeta(Writer writer ,String indexType,String indexName, ESJDBC esjdbc,String action,
Object id,Object parentId,Object routing,Object esRetryOnConflict) throws Exception {
if(id != null) {
writer.write("{ \"");
writer.write(action);
writer.write("\" : { \"_index\" : \"");
writer.write(indexName);
writer.write("\", \"_type\" : \"");
writer.write(indexType);
writer.write("\", \"_id\" : ");
BuildTool.buildId(id,writer,true);
if(parentId != null){
writer.write(", \"parent\" : ");
BuildTool.buildId(parentId,writer,true);
}
if(routing != null){
writer.write(", \"_routing\" : ");
BuildTool.buildId(routing,writer,true);
}
// if(action.equals("update"))
// {
if (esRetryOnConflict != null) {
writer.write(",\"_retry_on_conflict\":");
writer.write(String.valueOf(esRetryOnConflict));
}
Object version = getVersion( esjdbc);
if (version != null) {
writer.write(",\"_version\":");
writer.write(String.valueOf(version));
}
Object versionType = esjdbc.getEsVersionType();
if(versionType != null) {
writer.write(",\"_version_type\":\"");
writer.write(String.valueOf(versionType));
writer.write("\"");
}
writer.write(" } }\n");
}
else {
writer.write("{ \"");
writer.write(action);
writer.write("\" : { \"_index\" : \"");
writer.write(indexName);
writer.write("\", \"_type\" : \"");
writer.write(indexType);
if(parentId != null){
writer.write(", \"parent\" : ");
BuildTool.buildId(parentId,writer,true);
}
if(routing != null){
writer.write(", \"_routing\" : ");
BuildTool.buildId(routing,writer,true);
}
// if(action.equals("update"))
// {
{
if (esRetryOnConflict != null) {
writer.write(",\"_retry_on_conflict\":");
writer.write(String.valueOf(esRetryOnConflict));
}
Object version = getVersion( esjdbc);
if (version != null) {
writer.write(",\"_version\":");
writer.write(String.valueOf(version));
}
Object versionType = esjdbc.getEsVersionType();
if(versionType != null) {
writer.write(",\"_version_type\":\"");
writer.write(String.valueOf(versionType));
writer.write("\"");
}
}
writer.write("\" } }\n");
}
}
public static void evalBuilk(Writer writer, String indexName, String indexType, ESJDBC jdbcResultSet, String action) throws Exception {
if (jdbcResultSet != null) {
Context context = new ContextImpl(jdbcResultSet);
jdbcResultSet.refactorData(context);
buildMeta( context, writer , indexType, indexName, jdbcResultSet,action);
if(!action.equals("update")) {
// SerialUtil.object2json(param,writer);
serialResult( writer,jdbcResultSet,context);
}
else
{
writer.write("{\"doc\":");
serialResult( writer,jdbcResultSet,context);
if(jdbcResultSet.getEsDocAsUpsert() != null){
writer.write(",\"doc_as_upsert\":");
writer.write(String.valueOf(jdbcResultSet.getEsDocAsUpsert()));
}
if(jdbcResultSet.getEsReturnSource() != null){
writer.write(",\"_source\":");
writer.write(String.valueOf(jdbcResultSet.getEsReturnSource()));
}
writer.write("}\n");
}
}
}
private static void serialResult( Writer writer, ESJDBC esjdbc,Context context) throws Exception {
PoolManResultSetMetaData metaData = esjdbc.getMetaData();
int counts = metaData.getColumnCount();
writer.write("{");
Boolean useJavaName = esjdbc.getUseJavaName();
if(useJavaName == null)
useJavaName = true;
Boolean useLowcase = esjdbc.getUseLowcase();
if(useJavaName == null) {
useJavaName = false;
}
if(useLowcase == null)
{
useLowcase = false;
}
boolean hasSeted = false;
for(int i =0; i < counts; i++)
{
String colName = metaData.getColumnLabelByIndex(i);
// if("ROWNUM__".equals(colName))//去掉oracle的行伪列
// continue;
String javaName = null;
FieldMeta fieldMeta = context.getMappingName(colName);
if(fieldMeta != null) {
if(fieldMeta.getIgnore() != null && fieldMeta.getIgnore() == true)
continue;
javaName = fieldMeta.getEsFieldName();
}
else {
if(useJavaName) {
javaName = metaData.getColumnJavaNameByIndex(i);
}
else{
javaName = !useLowcase ?colName:metaData.getColumnLabelLowerByIndex(i);
}
}
if(javaName == null){
javaName = colName;
}
if(hasSeted )
writer.write(",");
else
hasSeted = true;
writer.write("\"");
writer.write(javaName);
writer.write("\":");
// int colType = metaData.getColumnTypeByIndex(i);
Object value = esjdbc.getValue( i, colName);
if(value != null) {
if (value instanceof String) {
writer.write("\"");
CharEscapeUtil charEscapeUtil = new CharEscapeUtil(writer);
charEscapeUtil.writeString((String) value, true);
writer.write("\"");
} else if (value instanceof Date) {
DateFormat dateFormat = null;
if(fieldMeta != null){
DateFormateMeta dateFormateMeta = fieldMeta.getDateFormateMeta();
if(dateFormateMeta != null){
dateFormat = dateFormateMeta.toDateFormat();
}
}
if(dateFormat == null)
dateFormat = esjdbc.getFormat();
String dataStr = ESUtil.getDate((Date) value,dateFormat);
writer.write("\"");
writer.write(dataStr);
writer.write("\"");
}
else if(value instanceof Clob)
{
String dataStr = ValueExchange.getStringFromClob((Clob)value);
writer.write("\"");
CharEscapeUtil charEscapeUtil = new CharEscapeUtil(writer);
charEscapeUtil.writeString(dataStr, true);
writer.write("\"");
}
else if(value instanceof Blob){
String dataStr = ValueExchange.getStringFromBlob((Blob)value);
writer.write("\"");
CharEscapeUtil charEscapeUtil = new CharEscapeUtil(writer);
charEscapeUtil.writeString(dataStr, true);
writer.write("\"");
}
else {
writer.write(String.valueOf(value));
}
}
else{
writer.write("null");
}
}
List<FieldMeta> fieldValueMetas = esjdbc.getFieldValues();
hasSeted = appendFieldValues( writer, esjdbc, fieldValueMetas, hasSeted);
fieldValueMetas = context.getFieldValues();
appendFieldValues( writer, esjdbc, fieldValueMetas, hasSeted);
writer.write("}\n");
}
private static boolean appendFieldValues(Writer writer, ESJDBC esjdbc,
List<FieldMeta> fieldValueMetas,boolean hasSeted) throws IOException {
if(fieldValueMetas != null && fieldValueMetas.size() > 0){
for(int i =0; i < fieldValueMetas.size(); i++)
{
FieldMeta fieldMeta = fieldValueMetas.get(i);
String javaName = fieldMeta.getEsFieldName();
Object value = fieldMeta.getValue();
// if(value == null)
// continue;
if(hasSeted)
writer.write(",");
else{
hasSeted = true;
}
writer.write("\"");
writer.write(javaName);
writer.write("\":");
// int colType = metaData.getColumnTypeByIndex(i);
if(value != null) {
if (value instanceof String) {
writer.write("\"");
CharEscapeUtil charEscapeUtil = new CharEscapeUtil(writer);
charEscapeUtil.writeString((String) value, true);
writer.write("\"");
} else if (value instanceof Date) {
DateFormat dateFormat = null;
if(fieldMeta != null){
DateFormateMeta dateFormateMeta = fieldMeta.getDateFormateMeta();
if(dateFormateMeta != null){
dateFormat = dateFormateMeta.toDateFormat();
}
}
if(dateFormat == null)
dateFormat = esjdbc.getFormat();
String dataStr = ESUtil.getDate((Date) value,dateFormat);
writer.write("\"");
writer.write(dataStr);
writer.write("\"");
}
else if(isBasePrimaryType(value.getClass())){
writer.write(String.valueOf(value));
}
else {
SimpleStringUtil.object2json(value,writer);
}
}
else{
writer.write("null");
}
}
}
return hasSeted;
}
public static final Class[] basePrimaryTypes = new Class[]{Integer.TYPE, Long.TYPE,
Boolean.TYPE, Float.TYPE, Short.TYPE, Double.TYPE,
Character.TYPE, Byte.TYPE, BigInteger.class, BigDecimal.class};
public static boolean isBasePrimaryType(Class type) {
if (!type.isArray()) {
if (type.isEnum()) {
return true;
} else {
Class[] var1 = basePrimaryTypes;
int var2 = var1.length;
for(int var3 = 0; var3 < var2; ++var3) {
Class primaryType = var1[var3];
if (primaryType.isAssignableFrom(type)) {
return true;
}
}
return false;
}
} else {
return false;
}
}
@Override
public ClientInterface getClientInterface() {
return this.clientInterface;
}
public ESJDBC getESJDBC(){
return this.jdbcResultSet;
}
}
| [
"[email protected]"
] | |
87c5b9168e035af2c9568d3b69bb31d5a07aee7b | ccc3268554528f5ed5cc119bbd88cfc45b55691d | /dist/gameserver/data/scripts/quests/_097_SagaOfTheShillienTemplar.java | bc0b232a65ddb40162f0656cc9a6758c688cd109 | [] | no_license | trickititit/java-source | 447ea16c2892377a4625f742118ebfd4e3116848 | 724453441846ce44e65372100a70770f21572837 | refs/heads/master | 2021-01-18T09:38:01.836585 | 2016-09-17T17:43:34 | 2016-09-17T17:43:34 | 68,445,261 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,728 | java | package quests;
import l2p.gameserver.scripts.ScriptFile;
public class _097_SagaOfTheShillienTemplar extends SagasSuperclass implements ScriptFile {
@Override
public void onLoad() {
}
@Override
public void onReload() {
}
@Override
public void onShutdown() {
}
public _097_SagaOfTheShillienTemplar() {
super(false);
NPC = new int[]{
31580,
31623,
31285,
31285,
31610,
31646,
31648,
31652,
31654,
31655,
31659,
31285
};
Items = new int[]{
7080,
7526,
7081,
7512,
7295,
7326,
7357,
7388,
7419,
7450,
7091,
0
};
Mob = new int[]{
27271,
27246,
27273
};
classid = 106;
prevclass = 0x21;
X = new int[]{
161719,
124355,
124376
};
Y = new int[]{
-92823,
82155,
82127
};
Z = new int[]{
-1893,
-2803,
-2796
};
Text = new String[]{
"PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!",
"... Oh ... good! So it was ... let's begin!",
"I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!",
"Paying homage to those who disrupt the orderly will be PLAYERNAME's death!",
"Now, my soul freed from the shackles of the millennium, Halixia, to the back side I come ...",
"Why do you interfere others' battles?",
"This is a waste of time.. Say goodbye...!",
"...That is the enemy",
"...Goodness! PLAYERNAME you are still looking?",
"PLAYERNAME ... Not just to whom the victory. Only personnel involved in the fighting are eligible to share in the victory.",
"Your sword is not an ornament. Don't you think, PLAYERNAME?",
"Goodness! I no longer sense a battle there now.",
"let...",
"Only engaged in the battle to bar their choice. Perhaps you should regret.",
"The human nation was foolish to try and fight a giant's strength.",
"Must...Retreat... Too...Strong.",
"PLAYERNAME. Defeat...by...retaining...and...Mo...Hacker",
"....! Fight...Defeat...It...Fight...Defeat...It..."
};
registerNPCs();
}
} | [
"[email protected]"
] | |
65b852c0a28c33afb4c619d052e8db30100d8589 | 2c7b9d018f3ee697a4c3813699af7fd49639dd66 | /lap10/src/Utils.java | bea575e99d285d2312ad3234ce1642d6324a690d | [] | no_license | tatdimay98hn/manhOOP | 792ac923d5311c4771ea04d9ffedb8521e0f1e46 | 6a4feb4a3083901a910368273ddf7d12a2cd0e31 | refs/heads/master | 2020-03-31T08:05:05.032999 | 2018-11-18T11:34:09 | 2018-11-18T11:34:09 | 152,045,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,440 | java |
import java.io.*;
public class Utils {
/**
* Read content from file
*
* @param path
* @return content
* @throws IOException
*/
public static String readContentFromFile(String path) throws IOException {
BufferedReader br = null;
FileReader fr = null;
String line = null;
try {
fr = new FileReader(path);
br = new BufferedReader(fr);
//br = new BufferedReader(new FileReader(filename));
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null) {
br.close();
}
if (fr != null) {
fr.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return line;
}
/**
* write Content To File
*
* @param path
* @throws IOException
*/
public static void writeContentToFile(String path) throws IOException {
BufferedWriter bw = null;
FileWriter fw = null;
try {
String content = "he he";
fw = new FileWriter(path);
bw = new BufferedWriter(fw);
bw.write(content);
System.out.println("done");
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bw != null) {
bw.close();
}
if (fw != null) {
fw.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
/**
* write Content To The End Of File
*
* @param path
* @throws IOException
*/
public static void writeContentToTheEndOfFile(String path) throws IOException {
try {
String data = "\n this is new content.";
FileWriter fw = new FileWriter(path, true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(data);
bw.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static void findFileByName(String folderPath, String fileName) {
File file = new File(folderPath);
if (file.exists()) {
if (file.isFile()) {
if (file.getName().endsWith(fileName)) {
System.out.println(file.getAbsolutePath());
}
}
File[] listFile = file.listFiles();
if (listFile != null) {
for (File f : listFile) {
findFileByName(f.getAbsolutePath(), fileName);
}
}
} else {
System.out.println("folderPath không tồn tại");
}
}
public static void main(String[] args) throws IOException {
String source = "C:\\Users\\Manh Nguyen\\Documents\\NetBeansProjects\\";
String key = "";
Utils file = new Utils();
file.findFileByName(source, key);
// writeContentToFile("okok.txt");
writeContentToTheEndOfFile("deptrai.txt");
String x = file.readContentFromFile("deptrai.txt");
}
}
| [
"[email protected]"
] | |
d05e7f5fdf51fc1d399a7a00be71471a15f4078e | 7a6b222fea3ebe4fa838cda3b6c7c98f438038f6 | /build/generated/source/proto/main/java/com/proto/account/MultiAccountResponseOrBuilder.java | c20a0d598eaf5f4e89e7352c736c4cd19d445882 | [] | no_license | kidcolie90/DistributedSystemsApp | b8ef94929f91ac99a9ea8717131bd8ce373d6aad | cc3f4ce1c45c5dcda3a542422a2a090589aaa6e5 | refs/heads/master | 2023-04-02T08:59:59.129413 | 2021-04-02T21:37:38 | 2021-04-02T21:37:38 | 343,881,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 542 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: account/account.proto
package com.proto.account;
public interface MultiAccountResponseOrBuilder extends
// @@protoc_insertion_point(interface_extends:MultiAccountResponse)
com.google.protobuf.MessageOrBuilder {
/**
* <code>string Result = 1;</code>
* @return The result.
*/
java.lang.String getResult();
/**
* <code>string Result = 1;</code>
* @return The bytes for result.
*/
com.google.protobuf.ByteString
getResultBytes();
}
| [
"[email protected]"
] | |
a69256202725af84baa573631c862807307eb3fa | fe405daca4057216c50cf137ec217529ec1090b0 | /src/main/java/edu/wctc/asm/model/Author.java | 4fa3381d2f9dbd00d22ece07e5be9bc9cd50b197 | [] | no_license | amellem/bookWebApp | 79f0edd242c054fb09e0c7df91fa8a1ea32970d5 | bc19c4e6e43652a1b367b3eb315e10edd2991750 | refs/heads/master | 2021-01-11T14:17:52.461454 | 2017-02-08T12:39:01 | 2017-02-08T12:39:01 | 81,317,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,321 | java | package edu.wctc.asm.model;
import java.util.Date;
import java.util.Objects;
/**
* This is a domain object, also called an "entity" object.
*
* @author jlombardo
*/
public class Author {
private final String NULL_MSG = " cannot be null";
private Integer authorId;
private String authorName;
private Date dateAdded;
public Author() {
}
public Author(Integer authorId) {
this.authorId = authorId;
}
public Author(Integer authorId, String authorName, Date dateAdded) {
this.authorId = authorId;
this.authorName = authorName;
this.dateAdded = dateAdded;
}
public final Integer getAuthorId() {
return authorId;
}
public final void setAuthorId(Integer authorId) throws IllegalArgumentException {
if(authorId == null) {
throw new IllegalArgumentException("author id" + NULL_MSG);
}
this.authorId = authorId;
}
public final String getAuthorName() {
return authorName;
}
public final void setAuthorName(String authorName) throws IllegalArgumentException {
if(authorName == null || authorName.isEmpty()) {
throw new IllegalArgumentException("author name is required");
}
this.authorName = authorName;
}
public final Date getDateAdded() {
return dateAdded;
}
public final void setDateAdded(Date dateAdded) throws IllegalArgumentException {
if(dateAdded == null) {
throw new IllegalArgumentException("date addedl" + NULL_MSG);
}
this.dateAdded = dateAdded;
}
@Override
public int hashCode() {
int hash = 7;
hash = 59 * hash + Objects.hashCode(this.authorId);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Author other = (Author) obj;
if (!Objects.equals(this.authorId, other.authorId)) {
return false;
}
return true;
}
@Override
public String toString() {
return "Author{" + "authorId=" + authorId + ", authorName=" + authorName + ", dateAdded=" + dateAdded + '}';
}
}
| [
"CloudAerius@DESKTOP-OLB5D1Q"
] | CloudAerius@DESKTOP-OLB5D1Q |
f3532f204ad1e076e423ca9afb3de817014c9ab9 | 801c39e8bbeee2e25ed1ba2b74aa039f8b3d62ae | /fizteh-java-2014/src/ru/fizteh/fivt/students/SergeyAksenov/JUnit/PutCommand.java | 6bf9db02af2da110dba9a73cd994168b7adc4f28 | [] | no_license | grapefroot/mipt | 2f6572b3120e28a0e63e28f2542782520384828f | 51d13fa07b37bdbdda943bd47d7e356a3a126177 | refs/heads/master | 2020-12-24T21:12:03.706690 | 2016-11-08T07:40:20 | 2016-11-08T07:40:20 | 56,529,254 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | package ru.fizteh.fivt.students.SergeyAksenov.JUnit;
public class PutCommand implements Command {
public void run(String[] args, JUnitTableProvider tableProvider) throws IllegalArgumentException {
if (!Executor.checkArgNumber(3, args.length, 3)) {
System.out.println("Invalid number of arguments");
return;
}
JUnitTable currentTable = tableProvider.getCurrentTable();
if (currentTable == null) {
System.out.println("no table");
return;
}
String oldValue = currentTable.put(args[1], args[2]);
if (oldValue != null) {
System.out.println("new");
return;
}
System.out.println("overwrite");
System.out.println(oldValue);
}
}
| [
"[email protected]"
] | |
8bf71f58bd49a424e379d8fc1bc33a76fcd0b25b | 4e87dde8c7b592c678e9db0dd05b882790266db8 | /components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/test/java/org/wso2/carbon/apimgt/rest/api/publisher/impl/ExportApiServiceImplTestCase.java | 84bf5dcd949ef4301c1891316e25c421d7439805 | [] | no_license | abimarank/carbon-apimgt | 5050f4667787c6f60464c8497bee8be2268b7b75 | ff29afce801fae5cdd511c7587cdd1055612dfac | refs/heads/master | 2020-04-05T22:42:02.694752 | 2017-08-09T12:54:03 | 2017-08-09T12:57:19 | 31,588,190 | 1 | 0 | null | 2015-03-03T08:41:35 | 2015-03-03T08:41:34 | null | UTF-8 | Java | false | false | 3,294 | java | /*
*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.apimgt.rest.api.publisher.impl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.apimgt.core.api.APIPublisher;
import org.wso2.carbon.apimgt.core.impl.APIPublisherImpl;
import org.wso2.carbon.apimgt.core.models.API;
import org.wso2.carbon.apimgt.core.models.APIDetails;
import org.wso2.carbon.apimgt.rest.api.publisher.common.SampleTestObjectCreator;
import org.wso2.carbon.apimgt.rest.api.publisher.utils.FileBasedApiImportExportManager;
import org.wso2.carbon.apimgt.rest.api.publisher.utils.RestAPIPublisherUtil;
import org.wso2.carbon.messaging.CarbonMessage;
import org.wso2.msf4j.Request;
import javax.ws.rs.core.Response;
import java.util.HashSet;
import java.util.Set;
import static junit.framework.TestCase.assertEquals;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.anyString;
import static org.powermock.api.mockito.PowerMockito.whenNew;
@RunWith(PowerMockRunner.class)
@PrepareForTest(RestAPIPublisherUtil.class)
public class ExportApiServiceImplTestCase {
private static final Logger log = LoggerFactory.getLogger(ExportApiServiceImplTestCase.class);
private static final String USER = "admin";
@Test
public void testExportApisGetNotFound() throws Exception {
printTestMethodName();
ExportApiServiceImpl exportApiService = new ExportApiServiceImpl();
APIPublisher apiPublisher = Mockito.mock(APIPublisherImpl.class);
PowerMockito.mockStatic(RestAPIPublisherUtil.class);
PowerMockito.when(RestAPIPublisherUtil.getApiPublisher(USER)).
thenReturn(apiPublisher);
Response response = exportApiService.
exportApisGet("", null, null, getRequest());
assertEquals(response.getStatus(), 404);
}
// Sample request to be used by tests
private Request getRequest() throws Exception {
CarbonMessage carbonMessage = Mockito.mock(CarbonMessage.class);
Request request = new Request(carbonMessage);
whenNew(Request.class).withArguments(carbonMessage).thenReturn(request);
return request;
}
private static void printTestMethodName () {
log.info("------------------ Test method: " + Thread.currentThread().getStackTrace()[2].getMethodName() +
" ------------------");
}
}
| [
"[email protected]"
] | |
ca21ab49b498e7258eb5ae8dc033ef1ad2b6a2d2 | a779b7d6e49a9a0d2afe2a19511a1f3a93b04148 | /242/ValidAnagram.java | 730815c097674bae81ef6be46687e9eaa41401c8 | [] | no_license | VickyWei1995/leetcode | c35fe2f6b66a7c460ab27cd2e9d333509b58ea73 | 908e0acee737bf9617b88283d2aed54890182f85 | refs/heads/master | 2022-08-18T10:27:23.113341 | 2022-07-30T10:01:59 | 2022-07-30T10:01:59 | 114,425,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 834 | java | package LeetCode;
import java.util.HashMap;
import java.util.Map;
public class ValidAnagram {
class Solution {
public boolean isAnagram(String s, String t) {
Map<Character,Integer> sMap = new HashMap<>();
for (char c = 'a'; c<='z'; c++) {
sMap.put(c,0);
}
for (int i=0; i<s.length();i++) {
int cur = sMap.get(s.charAt(i)) + 1;
sMap.put(s.charAt(i), cur);
}
for (int i=0; i<t.length(); i++) {
int cur = sMap.get(t.charAt(i)) - 1;
sMap.put(t.charAt(i), cur);
}
for (char key: sMap.keySet()) {
if (sMap.get(key) != 0) {
return false;
}
}
return true;
}
}
}
| [
"[email protected]"
] | |
5fad5350a112e445668c1cf049e9cd6412228740 | a90dd9340ac1b79d98ba4280c12e817421a0d333 | /src/main/java/comment_parser/TokenType.java | 85f2de9bcb6e504ece4f8f27eee0bfc7e3da4e84 | [] | no_license | oielbanna/Comment-Parser | 03074455a73a5210bf087c32d3156e1f7674d57b | db2b6e5e9e83f277441cd52a880659e7c2b9939e | refs/heads/master | 2020-08-30T13:26:20.876054 | 2019-10-30T04:37:16 | 2019-10-30T04:37:16 | 218,394,134 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package comment_parser;
/**
* The {@code TokeType} enumeration represents types of tokens that we need to
* support
*
* @author Omar Ibrahim
*
*/
public enum TokenType {
BlockComment,
LineComment,
Other
}
| [
"[email protected]"
] | |
05983165902e31c487fb0075b7cb89d6cb3499cf | ae0577286aa2db1155df2e69da90804358fa5089 | /src/main/java/org/acme/rest/VisitsResource.java | f0e31b4b4a23d15a1afc7c5b9d7778de3d803e6a | [] | no_license | danieloh30/quarkus-petclinic | 7dcafdd1629b9b8f8a7fe927a70f5fd8c5277657 | 110de8c75c08041ed7c10622f5dbbf2759661d69 | refs/heads/master | 2022-12-25T18:50:32.404724 | 2020-10-05T02:04:48 | 2020-10-05T02:04:48 | 293,838,405 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,677 | java | package org.acme.rest;
import java.net.URI;
import javax.inject.Inject;
import javax.transaction.Transactional;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.POST;
import javax.ws.rs.Produces;
import io.quarkus.qute.Template;
import io.quarkus.qute.TemplateInstance;
import org.jboss.resteasy.annotations.providers.multipart.MultipartForm;
import org.acme.service.OwnersService;
import org.acme.model.VisitForm;
import org.acme.model.Visit;
import org.acme.service.PetsService;
import org.jboss.resteasy.annotations.jaxrs.QueryParam;
@Path("/")
public class VisitsResource {
@Inject
OwnersService ownerService;
@Inject
PetsService petService;
@Inject
Template visit;
@GET
@Produces(MediaType.TEXT_HTML)
@Path("getVisit")
public TemplateInstance getPet(@QueryParam("ownerId") Long ownerId, @QueryParam("petId") Long petId) {
return visit.data("active", "owners")
.data("owner", ownerService.findById(ownerId))
.data("pet", petService.findById(petId));
}
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Transactional
@Path("addVisit")
public Response addPet(@MultipartForm VisitForm visitForm, @QueryParam("ownerId") Long ownerId, @QueryParam("petId") Long petId) {
Visit newVisit = visitForm.addVisit();
newVisit.setPet(petService.findById(petId));
newVisit.persist();
return Response.status(301)
.location(URI.create("/owners?id=" + ownerId))
.build();
}
} | [
"[email protected]"
] | |
882d8fe896414880ce011bf114ae7d9e26870c85 | b844043af2a13e24c9a322dbb4afc51af7cf8dcc | /ib-terminal-server/src/main/java/com/henyep/ib/terminal/server/dao/SystemParamsDao.java | eb219a5a0a8859f794c093acc22545045438677f | [] | no_license | oscarYeung/ib_terminal | 37b372ab9d33f4b029ee9a02bc519c0cc7e31c38 | c83e464752e45aa356f1aad24ed2f2f5066b2e90 | refs/heads/master | 2022-12-24T04:49:03.603352 | 2019-12-11T04:09:26 | 2019-12-11T04:09:26 | 218,199,664 | 1 | 2 | null | 2022-12-16T09:45:08 | 2019-10-29T03:49:19 | Java | UTF-8 | Java | false | false | 1,349 | java | package com.henyep.ib.terminal.server.dao;
import java.util.List;
import com.henyep.ib.terminal.api.dto.db.SystemParamsBean;
import com.henyep.ib.terminal.server.dto.mt4.model.Mt4WebServiceConnectionModel;
import com.henyep.ib.terminal.server.dto.mt4.model.Mt5WebServiceConnectionModel;
public interface SystemParamsDao {
public void saveSystemParams(final SystemParamsBean systemParams) throws Exception;
public List<SystemParamsBean> getAllSystemParamss() throws Exception;
public List<SystemParamsBean> getSystemParamsByKey(String name) throws Exception;
public int updateSystemParams(SystemParamsBean systemParams) throws Exception;
public int deleteSystemParams(String name) throws Exception;
public Double getMinMarginOutAmount() throws Exception;
public Integer getFreeMarginOutCount() throws Exception;
public Double getSubsequentMarginOutFee() throws Exception;
public boolean isDataSyncRunning() throws Exception;
public boolean isUpdatingIbCommission() throws Exception;
public boolean sendEmailNewUserRequestMarginOut() throws Exception;
public int updateSystemParamValue(String key, String value, String updatedBy) throws Exception;
public Mt4WebServiceConnectionModel getMt4ServiceConnectionModel() throws Exception;
public Mt5WebServiceConnectionModel getMt5ServiceConnectionModel() throws Exception;
}
| [
"[email protected]"
] | |
af8998c7d25f56fb73bb09b9f9d5b75d7fce571e | 03490aac8196b5b786a0db5ca9744ec090968ddf | /AVATAR_MapsForgeMapViewer/src/com/SATE2012/MapsForgeMapViewer/GMailSender.java | 1c54bcd3d6cefeca8c854cf2df927b3d53e7173b | [] | no_license | TecEdgeAVATAR/AVATAR | e8b4b9d802cbd2f6c1c9717edfde6271ff5a4b7f | e78851e63eadb2654b0fd982407e2b75e0eb08c6 | refs/heads/master | 2020-06-30T05:31:00.883225 | 2012-08-14T17:03:05 | 2012-08-14T17:03:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,076 | java | package com.SATE2012.MapsForgeMapViewer;
//import android.app.Activity;
//import javax.mail.Authenticator;
import javax . activation .DataHandler ;
import javax . activation . DataSource ;
import javax .mail .Message ;
import javax .mail . PasswordAuthentication ;
import javax .mail .Session ;
import javax .mail .Transport ;
import javax .mail .internet .InternetAddress ;
import javax .mail .internet .MimeMessage ;
import java . io . ByteArrayInputStream ;
import java . io . IOException ;
import java . io . InputStream ;
import java . io . OutputStream ;
import java.security.Security ;
import java . util . Properties ;
public class GMailSender extends javax.mail.Authenticator {
private String mailhost = "smtp.gmail.com" ;
private String user ;
private String password ;
private Session session ;
static {
Security.addProvider( new com.provider.JSSEProvider() ) ; }
public GMailSender ( String user , String password ) {
this .user = user ;
this .password = password ;
//Toast.makeText(getApplicationContext(), "in GMailSender", Toast.LENGTH_LONG).show();
Properties props = new Properties ( ) ;
props . setProperty ( "mail.transport.protocol" , "smtp" ) ;
props . setProperty ( "mail.host" , mailhost ) ;
props . put ( "mail.smtp.auth" , "true" ) ;
props . put ( "mail.smtp.port" , "465" ) ;
props . put ( "mail.smtp.socketFactory.port" , "465" ) ;
props . put ( "mail.smtp.socketFactory.class" ,
"javax.net.ssl.SSLSocketFactory" ) ;
props . put ( "mail.smtp.socketFactory.fallback" , "false" ) ;
props . setProperty ( "mail.smtp.quitwait" , "false" ) ;
session = Session . getDefaultInstance (props , this ) ;
}
protected PasswordAuthentication getPasswordAuthentication ( ) {
return new PasswordAuthentication (user , password ) ;
}
public synchronized void sendMail ( String subject , String body , String sender , String recipients ) throws Exception {
try {
MimeMessage message = new MimeMessage (session ) ;
DataHandler handler = new DataHandler ( new ByteArrayDataSource (body . getBytes ( ) , "text/plain" ) ) ;
message .setSender ( new InternetAddress (sender ) ) ;
message . setSubject ( subject ) ;
message .setDataHandler ( handler ) ;
if (recipients . indexOf ( ',' ) > 0 )
message .setRecipients (Message .RecipientType .TO , InternetAddress . parse (recipients ) ) ;
else
message .setRecipient (Message .RecipientType .TO , new InternetAddress (recipients ) ) ;
Transport . send (message ) ;
} catch ( Exception e ) {
}
}
public class ByteArrayDataSource implements DataSource {
private byte [ ] data ;
private String type ;
public ByteArrayDataSource ( byte [ ] data , String type ) {
super ( ) ;
this .data = data ;
this . type = type ;
}
public ByteArrayDataSource ( byte [ ] data ) {
super ( ) ;
this .data = data ;
}
public void setType ( String type ) {
this . type = type ;
}
public String getContentType ( ) {
if ( type == null )
return "application/octet-stream" ;
else
return type ;
}
public InputStream getInputStream ( ) throws IOException {
return new ByteArrayInputStream (data ) ;
}
public String getName ( ) {
return "ByteArrayDataSource" ;
}
public OutputStream getOutputStream ( ) throws IOException {
throw new IOException ( "Not Supported" ) ;
}
}
}
| [
"[email protected]"
] | |
a9b377d466a9b8e4aa9f1a9dd52c09a1163ec611 | 22b1f967750c313d8a2e6fc255fd3bca9f13c290 | /DynamicProgramming/300_LongestIncreasingSubsequence.java | 5a074591141ed30b8c13a6f6799c2c742f302300 | [
"MIT"
] | permissive | robin-qu/Leetcode | 333e997f1779fe41cbd4b0e057631454c1f37d13 | 9178287a7cc8fac7adb0e9bfd8d4771cd151d4a6 | refs/heads/master | 2021-06-24T18:49:25.879307 | 2021-01-21T05:28:20 | 2021-01-21T05:28:20 | 178,751,405 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,925 | java | // // DP
// class Solution {
// public int lengthOfLIS(int[] nums) {
// if (nums == null || nums.length == 0) {
// return 0;
// }
// int len = nums.length;
// int[] dp = new int[len];
// for (int i = 0; i < len; i++) {
// dp[i] = 1;
// }
// for (int i = 0; i < len; i++) {
// for (int j = 0; j < i; j++) {
// if (nums[j] < nums[i]) {
// dp[i] = Math.max(dp[i], dp[j] + 1);
// }
// }
// }
// int res = Integer.MIN_VALUE;
// for (int i = 0; i < len; i++) {
// res = Math.max(res, dp[i]);
// }
// return res;
// }
// }
// DP + Binary Search
class Solution {
public int lengthOfLIS(int[] nums) {
if (nums == null || nums.length == 0) {
return 0;
}
int len = nums.length;
int[] dp = new int[len + 1];
dp[0] = Integer.MIN_VALUE;
for (int i = 1; i < len + 1; i++) {
dp[i] = Integer.MAX_VALUE;
}
for (int i = 0; i < len; i++) {
int idx = binarySearch(dp, nums[i]);
dp[idx] = nums[i];
}
for (int i = len; i >= 0; i--) {
if (dp[i] != Integer.MAX_VALUE) {
return i;
}
}
return 0;
}
private int binarySearch(int[] nums, int value) {
int left = 0;
int right = nums.length - 1;
int mid;
while (left + 1 < right) {
mid = left + (right - left) / 2;
if (value < nums[mid]) {
right = mid;
} else if (nums[mid] < value) {
left = mid;
} else {
return mid;
}
}
return right;
}
} | [
"[email protected]"
] | |
b6268da07c448f9967c69322f7f22e113a54ae8e | 6b8fb7b61be0ceeea34476b602d676ab92600f15 | /src/main/java/testsystem/models/User.java | 89636e02840d007f4da3de02f3ece9d3a2514d08 | [] | no_license | kseniyafed/diplom | b6a8694b805160cf430d68ed9e49ce1fad9d9450 | 4e859d3386ce7e410fdf7effced9d477c1c2f4ed | refs/heads/master | 2020-03-17T13:51:44.015812 | 2018-05-21T13:40:08 | 2018-05-21T13:40:08 | 133,647,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,143 | java | package testsystem.models;
import org.springframework.web.bind.annotation.ModelAttribute;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String login;
private String password;
@OrderColumn
private String name;
private String surname;
@ManyToOne
private UserGroup userGroup;
@OneToMany(mappedBy = "user")
private List<Result> results = new ArrayList<Result>();
public User() {
}
public User(Long id, String name, String login, String password) {
this.id = id;
this.name = name;
this.login = login;
this.password = password;
}
public User(String name, String surname) {
this.name = name;
this.surname = surname;
}
public User(UserGroup userGroup, String login, String password, String name) {
this.name = name;
this.login = login;
this.password = password;
this.userGroup = userGroup;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ModelAttribute("login")
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public UserGroup getUserGroup() {
return userGroup;
}
public void setUserGroup(UserGroup userGroup) {
this.userGroup = userGroup;
}
public List<Result> getResults() {
return results;
}
public void setResults(List<Result> results) {
this.results = results;
}
}
| [
"[email protected]"
] | |
d96b357255dd83c7585d6af3067c5aa5cbcec447 | f74b2cd8c0be82b23ffb1b17199ff3554e04206f | /src/Leetcode/P0173_BinarySearchTreeIterator.java | 634d0f9f05e038193c9888e4883259f86db23ee3 | [] | no_license | UMN-HKC/Coding_Problems | c50aed861d4cee456d05b5857e2ef8672f363bce | 88e5de19728831896bb92e504d416df1cc882bb9 | refs/heads/master | 2021-07-09T04:16:58.937999 | 2020-09-19T21:31:36 | 2020-09-19T21:31:36 | 187,879,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,844 | java | package Leetcode;
import java.util.*;
public class P0173_BinarySearchTreeIterator {
// initial approach: use stack to do inorder traversal, since it is bst,
// which will result in increasing value, and queue to store correct inorder order
// this approach takes O(n) space will does not meet question's requirement
Queue<TreeNode> queue = new LinkedList<>();
Stack<TreeNode> stack = new Stack<>();
public BSTIterator(TreeNode root) {
while (root != null || !stack.empty()) {
if (root != null) {
stack.push(root);
root = root.left;
}
else {
root = stack.pop();
queue.offer(root);
root = root.right;
}
}
}
/** @return the next smallest number */
public int next() {
return queue.poll().val;
}
/** @return whether we have a next smallest number */
public boolean hasNext() {
return !queue.isEmpty();
}
// approach 2: in-progress inorder traversal
// use O(h) space and do inorder traversal in need
Stack<TreeNode> stack = new Stack<>();
public BSTIterator(TreeNode root) {
push(root);
}
/** @return the next smallest number */
public int next() {
TreeNode next = stack.pop();
if (next.right != null) {
push(next.right);
}
return next.val;
}
/** @return whether we have a next smallest number */
public boolean hasNext() {
return !stack.empty();
}
public void push(TreeNode node) {
while (node != null) {
stack.push(node);
node = node.left;
}
}
// approach 3: Morris Traversal
// time: O(n)
// space: O(1)
TreeNode cur;
public BSTIterator(TreeNode root) {
cur = root;
}
/** @return the next smallest number */
public int next() {
int res = 0;
if (cur.left == null) {
res = cur.val;
}
else {
while (cur.left != null) {
if (connectOrDisconnectPre(cur.left)) {
cur = cur.left;
}
else {
break;
}
}
res = cur.val;
}
cur = cur.right;
return res;
}
private boolean connectOrDisconnectPre(TreeNode node) {
while (node.right != null && node.right != cur) {
node = node.right;
}
if (node.right == cur) {
node.right = null;
return false;
}
else {
node.right = cur;
return true;
}
}
/** @return whether we have a next smallest number */
public boolean hasNext() {
return cur != null;
}
}
| [
"[email protected]"
] | |
bbf0444a99676d2ad1b7e296665bf0366fd695d2 | fbde2003f90183b996661875947166e3af2ed202 | /src/main/java/com/eureka/EurekaServerApplication.java | feadbe2b0c221a2890ca0fede206216d2ac5bc8d | [] | no_license | mmdfayaz/SpringBootEurekaServer | 422513d888215e6d0cf7184ec1f0aff3681fc735 | 040c85016a8e9b27ecf5d764f63294119cf99c33 | refs/heads/master | 2022-06-07T09:47:39.703673 | 2020-04-22T08:42:17 | 2020-04-22T08:42:17 | 257,838,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.eureka;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
| [
"[email protected]"
] | |
169313a434b24c18cda1cfab7140547823877015 | a30f6caaf508c032231ff5a804f3c1dec8f550bc | /app/src/test/java/com/pwpb/parcelable/ExampleUnitTest.java | 4cad39bc7d0eb6e041d34e2dfdc5f173d954de1e | [] | no_license | fakhrimf/Parcelable | 4ebc05e0e141f814c0c43f6d7685ec59aba52f98 | a2d68fe6e86d557778abe2b37464d19919dcbf98 | refs/heads/master | 2020-07-04T10:59:50.275258 | 2019-08-14T03:21:21 | 2019-08-14T03:21:21 | 202,266,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package com.pwpb.parcelable;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
4d95ce8a41ab08de22a01500c3cf00d6ceae5569 | abbf9b41dd6d566cefceae98186cdb3498b4252e | /src/main/java/com/coll/OnlineCollaborate/model/User.java | 4e981a290dca85c0fba1b28c62e0404f3546f244 | [] | no_license | Bhavanicloud/OnlineCollaborate | 4ba78e4bbf840a6575a257ccbd3652235e92ad8c | 64d3826fd9074022673a856136c9b5f5aa3be481 | refs/heads/master | 2023-04-09T18:31:21.075852 | 2021-04-14T13:13:41 | 2021-04-14T13:13:41 | 350,777,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,128 | java | package com.coll.OnlineCollaborate.model;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import org.springframework.stereotype.Component;
@Component
@Entity
public class User extends DomainResponse implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int userId;
private String firstName;
private String lastName;
private String username;
private String password;
private String email;
private String role;
private String status;
private boolean isOnline;
private boolean enabled;
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public boolean getIsOnline() {
return isOnline;
}
public void setIsOnline(boolean isOnline) {
this.isOnline = isOnline;
}
public boolean getEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}
| [
"[email protected]"
] | |
6f2de7b73b8b056a4532ac4d40b6780dd8ae1cc2 | 2df9cd24933c13fd1cb954e0eee9548e378cb41a | /app/src/main/java/com/dat/surpriseparty/MainActivity.java | d0016bfef817c58bafdb260a0fa29016628042aa | [] | no_license | andreathacker/surprise-party | 0db7eb9e9c2f8b51a5da7ca9ea32ca3d144cc094 | 0d4ba2ab7e094002f2b19d94dcf8221f5f916837 | refs/heads/master | 2022-01-29T11:20:42.113203 | 2016-02-23T03:47:52 | 2016-02-23T03:47:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,779 | java | package com.dat.surpriseparty;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
] | |
d58e9e4750cd3219a5fe73b95e28478fe7312ba9 | 7a5e508c9314d7037b360207416f1c551820ad11 | /src/main/java/com/itianyi/core/utils/security/DESCoder.java | 029ff21695efd08e33dbe39dd6ff6f5519cdadf5 | [
"MIT"
] | permissive | a123993930/youngfm | 1f1e94984e7c9e24fb35fac239e9ce6a9a010733 | c9df8e7acaa95bc6b9552f85fb3337920d2879ce | refs/heads/master | 2020-03-11T17:10:02.910873 | 2018-04-19T01:05:12 | 2018-04-19T01:05:12 | 130,139,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,977 | java | package com.itianyi.core.utils.security;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.security.Key;
/**
* DES安全编码组件
* <p/>
* <pre>
* 支持 DES、DESede(TripleDES,就是3DES)、AES、Blowfish、RC2、RC4(ARCFOUR)
* DES key size must be equal to 56
* DESede(TripleDES) key size must be equal to 112 or 168
* AES key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available
* Blowfish key size must be multiple of 8, and can only range from 32 to 448 (inclusive)
* RC2 key size must be between 40 and 1024 bits
* RC4(ARCFOUR) key size must be between 40 and 1024 bits
* 具体内容 需要关注 JDK Document http://.../docs/technotes/guides/security/SunProviders.html
* </pre>
*
* @version 1.0
* @since 1.0
*/
public abstract class DESCoder extends Coder {
/**
* ALGORITHM 算法 <br>
* 可替换为以下任意一种算法,同时key值的size相应改变。
* <p/>
* <pre>
* DES key size must be equal to 56
* DESede(TripleDES) key size must be equal to 112 or 168
* AES key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available
* Blowfish key size must be multiple of 8, and can only range from 32 to 448 (inclusive)
* RC2 key size must be between 40 and 1024 bits
* RC4(ARCFOUR) key size must be between 40 and 1024 bits
* </pre>
* <p/>
* 在Key toKey(byte[] key)方法中使用下述代码
* <code>SecretKey secretKey = new SecretKeySpec(key, ALGORITHM);</code> 替换
* <code>
* DESKeySpec dks = new DESKeySpec(key);
* SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
* SecretKey secretKey = keyFactory.generateSecret(dks);
* </code>
*/
public static final String ALGORITHM = "TripleDES";
/**
* 转换密钥<br>
*
* @param key
* @return
* @throws Exception
*/
private static Key toKey(byte[] key) throws Exception {
// DESKeySpec dks = new DESKeySpec(key);
// SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
// SecretKey secretKey = keyFactory.generateSecret(dks);
// 当使用其他对称加密算法时,如AES、Blowfish等算法时,用下述代码替换上述三行代码
SecretKey secretKey = new SecretKeySpec(key, ALGORITHM);
return secretKey;
}
/**
* 解密
*
* @param data
* @param key
* @return
* @throws Exception
*/
public static byte[] decrypt(byte[] data, String key) throws Exception {
Key k = toKey(decryptBASE64(key));
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, k);
return cipher.doFinal(data);
}
/**
* 加密
*
* @param data
* @param key
* @return
* @throws Exception
*/
public static byte[] encrypt(byte[] data, String key) throws Exception {
Key k = toKey(decryptBASE64(key));
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, k);
return cipher.doFinal(data);
}
/**
* 生成密钥
*
* @return
* @throws Exception
*/
public static String initKey() throws Exception {
return initKey(null);
}
/**
* 生成密钥
*
* @param seed
* @return
* @throws Exception
*/
public static String initKey(String seed) throws Exception {
seed = seed + "1234567890987654321012345678901234567890";
byte[] bytes = seed.getBytes();
byte[] result = new byte[24];
for (int i = 0; i < 24; i++) {
result[i] = bytes[i];
}
return encryptBASE64(result);
}
} | [
"[email protected]"
] | |
7adfdc399d812ebca8a94ef67c2e215365be5b41 | 1944df7d3f04e621c76889a2f894e2b9f2e6b805 | /src/main/java/org/sid/entities/Demande.java | d7695be7002b1c6c1792be6507cf13135f296c9e | [] | no_license | yassinerouis/winwinproject | 3b9fd624a92c3d689fcab26b8bdf5595ba3210e0 | f22baf8808de227c560a6fe68a3f40c21b2697f1 | refs/heads/master | 2020-12-06T10:37:09.502496 | 2020-01-08T12:59:28 | 2020-01-08T12:59:28 | 232,441,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,201 | java | package org.sid.entities;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
@Entity
public class Demande implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id @GeneratedValue
Long id;
String objet;
public Demande() {
super();
// TODO Auto-generated constructor stub
}
@OneToOne(fetch = FetchType.LAZY, optional = true)
@JoinColumn(name = "type_id", nullable = true)
TypeService type;
public Demande(Long id, String objet, String description) {
super();
this.id = id;
this.objet = objet;
Description = description;
}
String Description;
public String getObjet() {
return objet;
}
public void setObjet(String objet) {
this.objet = objet;
}
public String getDescription() {
return Description;
}
public TypeService getType() {
return type;
}
public void setType(TypeService type) {
this.type = type;
}
public void setDescription(String description) {
Description = description;
}
}
| [
"[email protected]"
] | |
1a77c4428e1d102da385bcbb67daaf59a6e2614d | 644913c3030bee657fabea1d165aca8c4dd89362 | /com.antilia.hibernate/src/com/antilia/hibernate/context/RequestContext.java | 978c1ef896f6c14d8e73fd45e3039f8a737a4001 | [] | no_license | bluecosmo/antilia | 9d864c65643907ef59a9e90fbb5c7104912db8fd | 1704f163734179b448b36706a542dd8f8c4ffa96 | refs/heads/master | 2021-01-10T14:12:58.332533 | 2010-05-10T05:07:08 | 2010-05-10T05:07:08 | 36,420,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,033 | java | /**
* This software is provided as IS by Antilia-Soft SL.
* Copyright 2006-2007.
*/
package com.antilia.hibernate.context;
import org.hibernate.Session;
import com.antilia.hibernate.cfg.IPersistenceUnit;
import com.antilia.hibernate.command.HibernateUtil;
/**
*
*
* @author Ernesto Reinaldo Barreiro ([email protected])
*
*/
public class RequestContext {
private String user;
private IPersistenceUnit persistenceUnit;
private IProgressReporter progressReporter;
private Tier tier;
private static final ThreadLocal<RequestContext> current = new ThreadLocal<RequestContext>();
private RequestContext() {
setTier(Tier.PRESENTATION);
}
public static RequestContext get() {
RequestContext requestContext = current.get();
if(requestContext == null) {
requestContext = new RequestContext();
current.set(requestContext);
}
return requestContext;
}
public static void unget() {
current.remove();
}
public Session getSession() {
return HibernateUtil.getSessionFactory(getPersistenceUnit()).getCurrentSession();
}
/**
* @return the persistenceUnit
*/
public IPersistenceUnit getPersistenceUnit() {
return persistenceUnit;
}
/**
* @param persistenceUnit the persistenceUnit to set
*/
public void setPersistenceUnit(IPersistenceUnit persistenceUnit) {
this.persistenceUnit = persistenceUnit;
}
public IProgressReporter getProgressReporter() {
return progressReporter;
}
public void setProgressReporter(IProgressReporter progressReporter) {
this.progressReporter = progressReporter;
}
/**
* @return the user
*/
public String getUser() {
return user;
}
/**
* @param user the user to set
*/
public void setUser(String user) {
this.user = user;
}
/**
* @return the tier
*/
public Tier getTier() {
return tier;
}
/**
* @param tier the tier to set
*/
public void setTier(Tier tier) {
this.tier = tier;
}
}
| [
"reiern70@0c16656c-7d50-0410-8e61-d121633fcfaf"
] | reiern70@0c16656c-7d50-0410-8e61-d121633fcfaf |
4a186bd6f46f8f6ed72c6462728c2c5f401fd43f | 26f53cfa98c975324875403f2412265b437deb24 | /jsw-model/src/main/java/com/jsw/entity/Page.java | 69af934d152cf81d29ad20403b5e18fbedce859a | [] | no_license | xutao0726/springmvc-dubbo | 312ba72e2bfa8019ca624b37dcd3d6aae913e7f0 | 62f76020ab0ac1f3f0d983643dfe86ca100ff2c9 | refs/heads/master | 2020-03-26T18:15:53.165873 | 2018-08-18T08:42:50 | 2018-08-18T08:42:50 | 144,984,091 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,384 | java | package com.jsw.entity;
import java.io.Serializable;
public class Page implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
public Integer start;
public Integer nowPage = 1; //当前页数
public Integer pageSize = 6; //每页的个数
public Integer count; //总个数
public Integer pageCount; //总页数
public String searchStr;
public String getSearchStr() {
return searchStr;
}
public void setSearchStr(String searchStr) {
this.searchStr = searchStr;
}
public Integer getStart() {
this.start = (nowPage - 1) * pageSize;
return start;
}
public void setStart(Integer start) {
this.start = start;
}
public Integer getNowPage() {
return nowPage;
}
public void setNowPage(Integer nowPage) {
this.nowPage = nowPage;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public Integer getPageCount() {
if(count==null||count==0)
return 0;
if(this.pageCount == null)
this.pageCount = count%pageSize>0?count/pageSize+1:count/pageSize;
return pageCount;
}
public void setPageCount(Integer pageCount) {
this.pageCount = pageCount;
}
}
| [
"[email protected]"
] | |
5e9a88a3e4540d15aef3d9e129f6ec0fe6191927 | d38eb8733503cc948f9326858a48c50c3f2b6ffa | /src/test/java/com/example/demotutorial/DemotutorialApplicationTests.java | e254b8f39ce07b559d2b01b801618258a65c7371 | [] | no_license | abhishekmahajan98/demotutorial | f3c0b78f8316ea0b4abea2860f13dcf5c4b1e6ad | cc30f1f431cd97bb4ae5fcb6171a92e822ecd23d | refs/heads/master | 2023-06-15T00:09:00.826363 | 2021-07-11T17:53:16 | 2021-07-11T17:53:16 | 385,017,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | package com.example.demotutorial;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class emotutorialApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
05b6a04681b7f7acfdfcf0d4e5cf2acac11094ba | 34c8b01849d7265c73bcc696e7f0c11312c7f84d | /jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ComponentTag.java | a1d418a1cbcebc8ebc212c42c840184ed9148553 | [
"Apache-2.0"
] | permissive | pwntester/jelly | 03ddb422005970ddfc86f0e1cc7c5b5a84f7e431 | cb7966734f339619e5ee8e57b08009acbf5e1d10 | refs/heads/master | 2021-01-16T11:55:47.916026 | 2017-11-27T20:21:47 | 2017-11-27T20:21:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,603 | java | /*
* Copyright 2002,2004 The Apache Software Foundation.
*
* 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.apache.commons.jelly.tags.swing;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.LayoutManager;
import java.awt.Point;
import java.awt.Window;
import java.awt.event.FocusListener;
import java.awt.event.KeyListener;
import java.awt.event.WindowListener;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.RootPaneContainer;
import javax.swing.border.Border;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.tags.core.UseBeanTag;
import org.apache.commons.jelly.tags.swing.converters.DebugGraphicsConverter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This tag creates a Swing component and adds it to its parent tag, optionally declaring this
* component as a variable if the <i>var</i> attribute is specified.</p>
*
* <p> This tag clears the reference to it's bean after doTag runs.
* This means that child tags can access the component (bean) normally
* during execution but should not hold a reference to this
* tag after their doTag completes.
* </p>
*
* @author <a href="mailto:[email protected]">James Strachan</a>
* @version $Revision: 331171 $
*/
public class ComponentTag extends UseBeanTag implements ContainerTag {
/** The Log to which logging calls will be made. */
private static final Log log = LogFactory.getLog(ComponentTag.class);
/** This is a converter that might normally be used through the
* BeanUtils product. However, it only applies to one Component
* property and not to all ints, so it's not registered with BeanUtils.
*/
private static final DebugGraphicsConverter debugGraphicsConverter = new DebugGraphicsConverter();
/** the factory of widgets */
private Factory factory;
public ComponentTag() {
}
public ComponentTag(Factory factory) {
this.factory = factory;
}
public String toString() {
Component comp = getComponent();
String componentName = (comp!=null) ? comp.getName() : null;
if (comp!=null && (componentName == null || componentName.length() == 0))
componentName = getComponent().toString();
return "ComponentTag with bean " + componentName;
}
/**
* Sets the Action of this component
*/
public void setAction(Action action) throws JellyTagException {
Component component = getComponent();
if ( component != null ) {
// lets just try set the 'action' property
try {
BeanUtils.setProperty( component, "action", action );
} catch (IllegalAccessException e) {
throw new JellyTagException(e);
} catch (InvocationTargetException e) {
throw new JellyTagException(e);
}
}
}
/**
* Sets the Font of this component
*/
public void setFont(Font font) throws JellyTagException {
Component component = getComponent();
if ( component != null ) {
// lets just try set the 'font' property
try {
BeanUtils.setProperty( component, "font", font );
}
catch (IllegalAccessException e) {
throw new JellyTagException(e);
}
catch (InvocationTargetException e) {
throw new JellyTagException(e);
}
}
}
/**
* Sets the Border of this component
*/
public void setBorder(Border border) throws JellyTagException {
Component component = getComponent();
if ( component != null ) {
try {
// lets just try set the 'border' property
BeanUtils.setProperty( component, "border", border );
}
catch (IllegalAccessException e) {
throw new JellyTagException(e);
}
catch (InvocationTargetException e) {
throw new JellyTagException(e);
}
}
}
/**
* Sets the LayoutManager of this component
*/
public void setLayout(LayoutManager layout) throws JellyTagException {
Component component = getComponent();
if ( component != null ) {
if ( component instanceof RootPaneContainer ) {
RootPaneContainer rpc = (RootPaneContainer) component;
component = rpc.getContentPane();
}
try {
// lets just try set the 'layout' property
BeanUtils.setProperty( component, "layout", layout );
}
catch (IllegalAccessException e) {
throw new JellyTagException(e);
}
catch (InvocationTargetException e) {
throw new JellyTagException(e);
}
}
}
private String tagName = null;
private XMLOutput currentOutput = null;
/** Puts this tag into the context under the given name
* allowing later calls to {@link #rerun()}.
* For example, it makes sense to use ${myTag.rerun()} as a child
* of an <code>action</code> element.
*
* @param the name to be used
*/
public void setTagName(String name) {
this.tagName = name;
}
/**
* Adds a WindowListener to this component
*/
public void addWindowListener(WindowListener listener) throws JellyTagException {
Component component = getComponent();
if ( component instanceof Window ) {
Window window = (Window) component;
window.addWindowListener(listener);
}
}
/**
* Adds a FocusListener to this component
*/
public void addFocusListener(FocusListener listener) throws JellyTagException {
Component component = getComponent();
component.addFocusListener(listener);
}
/**
* Adds a KeyListener to this component
*/
public void addKeyListener(KeyListener listener) throws JellyTagException {
Component component = getComponent();
component.addKeyListener(listener);
}
// Properties
//-------------------------------------------------------------------------
/**
* @return the visible component, if there is one.
*/
public Component getComponent() {
Object bean = getBean();
if ( bean instanceof Component ) {
return (Component) bean;
}
return null;
}
// ContainerTag interface
//-------------------------------------------------------------------------
/**
* Adds a child component to this parent
*/
public void addChild(Component component, Object constraints) throws JellyTagException {
Object parent = getBean();
if ( parent instanceof JFrame && component instanceof JMenuBar ) {
JFrame frame = (JFrame) parent;
frame.setJMenuBar( (JMenuBar) component );
}
else if ( parent instanceof RootPaneContainer ) {
RootPaneContainer rpc = (RootPaneContainer) parent;
if (constraints != null) {
rpc.getContentPane().add( component, constraints );
}
else {
rpc.getContentPane().add( component);
}
}
else if ( parent instanceof JScrollPane ) {
JScrollPane scrollPane = (JScrollPane) parent;
scrollPane.setViewportView( component );
}
else if ( parent instanceof JSplitPane) {
JSplitPane splitPane = (JSplitPane) parent;
if ( splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ) {
if ( splitPane.getTopComponent() == null ) {
splitPane.setTopComponent( component );
}
else {
splitPane.setBottomComponent( component );
}
}
else {
if ( splitPane.getLeftComponent() == null ) {
splitPane.setLeftComponent( component );
}
else {
splitPane.setRightComponent( component );
}
}
}
else if ( parent instanceof JMenuBar && component instanceof JMenu ) {
JMenuBar menuBar = (JMenuBar) parent;
menuBar.add( (JMenu) component );
}
else if ( parent instanceof Container ) {
Container container = (Container) parent;
if (constraints != null) {
container.add( component, constraints );
}
else {
container.add( component );
}
}
}
// Implementation methods
//-------------------------------------------------------------------------
/**
* A class may be specified otherwise the Factory will be used.
*/
protected Class convertToClass(Object classObject) throws MissingAttributeException, ClassNotFoundException {
if (classObject == null) {
return null;
}
else {
return super.convertToClass(classObject);
}
}
/**
* A class may be specified otherwise the Factory will be used.
*/
protected Object newInstance(Class theClass, Map attributes, XMLOutput output) throws JellyTagException {
if (attributes.containsKey("tagName")) {
this.setTagName((String)attributes.get("tagName"));
addIgnoreProperty("tagName");
}
if(tagName!=null) {
context.setVariable(tagName,this);
currentOutput = output;
}
try {
if (theClass != null ) {
return theClass.newInstance();
} else {
return factory.newInstance();
}
} catch (IllegalAccessException e) {
throw new JellyTagException(e);
} catch (InstantiationException e) {
throw new JellyTagException(e);
}
}
/**
* Either defines a variable or adds the current component to the parent
*/
protected void processBean(String var, Object bean) throws JellyTagException {
if (var != null) {
context.setVariable(var, bean);
}
Component component = getComponent();
if ( component != null ) {
ContainerTag parentTag = (ContainerTag) findAncestorWithClass( ContainerTag.class );
if ( parentTag != null ) {
parentTag.addChild(component, getConstraint());
}
else {
if (var == null) {
throw new JellyTagException( "The 'var' attribute must be specified or this tag must be nested inside a JellySwing container tag like a widget or a layout" );
}
}
}
}
/**
* Handles wierd properties that don't quite match the Java Beans contract
*/
protected void setBeanProperties(Object bean, Map attributes) throws JellyTagException {
Component component = getComponent();
if (component != null) {
if (attributes.containsKey("location")) {
Object value = attributes.get("location");
Point p = null;
if (value instanceof Point) {
p = (Point) value;
}
else if (value != null) {
p =
(Point) ConvertUtils.convert(
value.toString(),
Point.class);
}
component.setLocation(p);
addIgnoreProperty("location");
}
if (attributes.containsKey("size")) {
Object value = attributes.get("size");
Dimension d = null;
if (value instanceof Dimension) {
d = (Dimension) value;
}
else if (value != null) {
d =
(Dimension) ConvertUtils.convert(
value.toString(),
Dimension.class);
}
component.setSize(d);
addIgnoreProperty("size");
}
if (attributes.containsKey("debugGraphicsOptions")) {
try {
Object o = debugGraphicsConverter.convert(attributes.get("debugGraphicsOptions"));
attributes.put("debugGraphicsOptions", o);
} catch (IllegalArgumentException e) {
throw new JellyTagException(e);
}
}
if (attributes.containsKey("debugGraphics")) {
try {
Object o = debugGraphicsConverter.convert(attributes.get("debugGraphics"));
attributes.put("debugGraphicsOptions", o);
} catch (IllegalArgumentException e) {
throw new JellyTagException(e);
}
addIgnoreProperty("debugGraphics");
}
super.setBeanProperties(bean, attributes);
}
}
protected Object getConstraint() {
return null;
}
/**Overrides the default UseBean functionality to clear the bean after the
* tag runs. This prevents us from keeping references to heavy Swing objects
* around for longer than they are needed.
* @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
*/
public void doTag(XMLOutput output) throws JellyTagException {
super.doTag(output);
clearBean();
}
/** Sets the bean to null, to prevent it from
* sticking around in the event that this tag instance is
* cached. This method is called at the end of doTag.
*
*/
protected void clearBean() {
setBean(null);
}
}
| [
"[email protected]"
] | |
81a22703bfe966a7333ae6b8f9d3fa9664cbfed8 | 4811d6863b79883dc89721d393dbc89e881875dd | /alcs-domain/src/main/java/xy/alcs/domain/AwardsExample.java | 4520c25a7426c0cb0366440a812c2e017a5fd1f8 | [] | no_license | wangjufeng1002/alcs | 39acef4b1114244a003c7b0782f4b219133a92d7 | 05dfc71b806801b73f03ccf3a88496dd3edbd9f9 | refs/heads/master | 2021-09-23T00:57:48.496239 | 2018-09-19T14:07:19 | 2018-09-19T14:07:34 | 113,327,469 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,450 | java | package xy.alcs.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class AwardsExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public AwardsExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andAwardIdIsNull() {
addCriterion("award_id is null");
return (Criteria) this;
}
public Criteria andAwardIdIsNotNull() {
addCriterion("award_id is not null");
return (Criteria) this;
}
public Criteria andAwardIdEqualTo(Long value) {
addCriterion("award_id =", value, "awardId");
return (Criteria) this;
}
public Criteria andAwardIdNotEqualTo(Long value) {
addCriterion("award_id <>", value, "awardId");
return (Criteria) this;
}
public Criteria andAwardIdGreaterThan(Long value) {
addCriterion("award_id >", value, "awardId");
return (Criteria) this;
}
public Criteria andAwardIdGreaterThanOrEqualTo(Long value) {
addCriterion("award_id >=", value, "awardId");
return (Criteria) this;
}
public Criteria andAwardIdLessThan(Long value) {
addCriterion("award_id <", value, "awardId");
return (Criteria) this;
}
public Criteria andAwardIdLessThanOrEqualTo(Long value) {
addCriterion("award_id <=", value, "awardId");
return (Criteria) this;
}
public Criteria andAwardIdIn(List<Long> values) {
addCriterion("award_id in", values, "awardId");
return (Criteria) this;
}
public Criteria andAwardIdNotIn(List<Long> values) {
addCriterion("award_id not in", values, "awardId");
return (Criteria) this;
}
public Criteria andAwardIdBetween(Long value1, Long value2) {
addCriterion("award_id between", value1, value2, "awardId");
return (Criteria) this;
}
public Criteria andAwardIdNotBetween(Long value1, Long value2) {
addCriterion("award_id not between", value1, value2, "awardId");
return (Criteria) this;
}
public Criteria andContestIdIsNull() {
addCriterion("contest_id is null");
return (Criteria) this;
}
public Criteria andContestIdIsNotNull() {
addCriterion("contest_id is not null");
return (Criteria) this;
}
public Criteria andContestIdEqualTo(Long value) {
addCriterion("contest_id =", value, "contestId");
return (Criteria) this;
}
public Criteria andContestIdNotEqualTo(Long value) {
addCriterion("contest_id <>", value, "contestId");
return (Criteria) this;
}
public Criteria andContestIdGreaterThan(Long value) {
addCriterion("contest_id >", value, "contestId");
return (Criteria) this;
}
public Criteria andContestIdGreaterThanOrEqualTo(Long value) {
addCriterion("contest_id >=", value, "contestId");
return (Criteria) this;
}
public Criteria andContestIdLessThan(Long value) {
addCriterion("contest_id <", value, "contestId");
return (Criteria) this;
}
public Criteria andContestIdLessThanOrEqualTo(Long value) {
addCriterion("contest_id <=", value, "contestId");
return (Criteria) this;
}
public Criteria andContestIdIn(List<Long> values) {
addCriterion("contest_id in", values, "contestId");
return (Criteria) this;
}
public Criteria andContestIdNotIn(List<Long> values) {
addCriterion("contest_id not in", values, "contestId");
return (Criteria) this;
}
public Criteria andContestIdBetween(Long value1, Long value2) {
addCriterion("contest_id between", value1, value2, "contestId");
return (Criteria) this;
}
public Criteria andContestIdNotBetween(Long value1, Long value2) {
addCriterion("contest_id not between", value1, value2, "contestId");
return (Criteria) this;
}
public Criteria andTeamIdIsNull() {
addCriterion("team_id is null");
return (Criteria) this;
}
public Criteria andTeamIdIsNotNull() {
addCriterion("team_id is not null");
return (Criteria) this;
}
public Criteria andTeamIdEqualTo(String value) {
addCriterion("team_id =", value, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdNotEqualTo(String value) {
addCriterion("team_id <>", value, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdGreaterThan(String value) {
addCriterion("team_id >", value, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdGreaterThanOrEqualTo(String value) {
addCriterion("team_id >=", value, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdLessThan(String value) {
addCriterion("team_id <", value, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdLessThanOrEqualTo(String value) {
addCriterion("team_id <=", value, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdLike(String value) {
addCriterion("team_id like", value, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdNotLike(String value) {
addCriterion("team_id not like", value, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdIn(List<String> values) {
addCriterion("team_id in", values, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdNotIn(List<String> values) {
addCriterion("team_id not in", values, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdBetween(String value1, String value2) {
addCriterion("team_id between", value1, value2, "teamId");
return (Criteria) this;
}
public Criteria andTeamIdNotBetween(String value1, String value2) {
addCriterion("team_id not between", value1, value2, "teamId");
return (Criteria) this;
}
public Criteria andWorkIdIsNull() {
addCriterion("work_id is null");
return (Criteria) this;
}
public Criteria andWorkIdIsNotNull() {
addCriterion("work_id is not null");
return (Criteria) this;
}
public Criteria andWorkIdEqualTo(Long value) {
addCriterion("work_id =", value, "workId");
return (Criteria) this;
}
public Criteria andWorkIdNotEqualTo(Long value) {
addCriterion("work_id <>", value, "workId");
return (Criteria) this;
}
public Criteria andWorkIdGreaterThan(Long value) {
addCriterion("work_id >", value, "workId");
return (Criteria) this;
}
public Criteria andWorkIdGreaterThanOrEqualTo(Long value) {
addCriterion("work_id >=", value, "workId");
return (Criteria) this;
}
public Criteria andWorkIdLessThan(Long value) {
addCriterion("work_id <", value, "workId");
return (Criteria) this;
}
public Criteria andWorkIdLessThanOrEqualTo(Long value) {
addCriterion("work_id <=", value, "workId");
return (Criteria) this;
}
public Criteria andWorkIdIn(List<Long> values) {
addCriterion("work_id in", values, "workId");
return (Criteria) this;
}
public Criteria andWorkIdNotIn(List<Long> values) {
addCriterion("work_id not in", values, "workId");
return (Criteria) this;
}
public Criteria andWorkIdBetween(Long value1, Long value2) {
addCriterion("work_id between", value1, value2, "workId");
return (Criteria) this;
}
public Criteria andWorkIdNotBetween(Long value1, Long value2) {
addCriterion("work_id not between", value1, value2, "workId");
return (Criteria) this;
}
public Criteria andPrizeIsNull() {
addCriterion("prize is null");
return (Criteria) this;
}
public Criteria andPrizeIsNotNull() {
addCriterion("prize is not null");
return (Criteria) this;
}
public Criteria andPrizeEqualTo(Integer value) {
addCriterion("prize =", value, "prize");
return (Criteria) this;
}
public Criteria andPrizeNotEqualTo(Integer value) {
addCriterion("prize <>", value, "prize");
return (Criteria) this;
}
public Criteria andPrizeGreaterThan(Integer value) {
addCriterion("prize >", value, "prize");
return (Criteria) this;
}
public Criteria andPrizeGreaterThanOrEqualTo(Integer value) {
addCriterion("prize >=", value, "prize");
return (Criteria) this;
}
public Criteria andPrizeLessThan(Integer value) {
addCriterion("prize <", value, "prize");
return (Criteria) this;
}
public Criteria andPrizeLessThanOrEqualTo(Integer value) {
addCriterion("prize <=", value, "prize");
return (Criteria) this;
}
public Criteria andPrizeIn(List<Integer> values) {
addCriterion("prize in", values, "prize");
return (Criteria) this;
}
public Criteria andPrizeNotIn(List<Integer> values) {
addCriterion("prize not in", values, "prize");
return (Criteria) this;
}
public Criteria andPrizeBetween(Integer value1, Integer value2) {
addCriterion("prize between", value1, value2, "prize");
return (Criteria) this;
}
public Criteria andPrizeNotBetween(Integer value1, Integer value2) {
addCriterion("prize not between", value1, value2, "prize");
return (Criteria) this;
}
public Criteria andScoreIsNull() {
addCriterion("score is null");
return (Criteria) this;
}
public Criteria andScoreIsNotNull() {
addCriterion("score is not null");
return (Criteria) this;
}
public Criteria andScoreEqualTo(Float value) {
addCriterion("score =", value, "score");
return (Criteria) this;
}
public Criteria andScoreNotEqualTo(Float value) {
addCriterion("score <>", value, "score");
return (Criteria) this;
}
public Criteria andScoreGreaterThan(Float value) {
addCriterion("score >", value, "score");
return (Criteria) this;
}
public Criteria andScoreGreaterThanOrEqualTo(Float value) {
addCriterion("score >=", value, "score");
return (Criteria) this;
}
public Criteria andScoreLessThan(Float value) {
addCriterion("score <", value, "score");
return (Criteria) this;
}
public Criteria andScoreLessThanOrEqualTo(Float value) {
addCriterion("score <=", value, "score");
return (Criteria) this;
}
public Criteria andScoreIn(List<Float> values) {
addCriterion("score in", values, "score");
return (Criteria) this;
}
public Criteria andScoreNotIn(List<Float> values) {
addCriterion("score not in", values, "score");
return (Criteria) this;
}
public Criteria andScoreBetween(Float value1, Float value2) {
addCriterion("score between", value1, value2, "score");
return (Criteria) this;
}
public Criteria andScoreNotBetween(Float value1, Float value2) {
addCriterion("score not between", value1, value2, "score");
return (Criteria) this;
}
public Criteria andTimestampIsNull() {
addCriterion("TIMESTAMP is null");
return (Criteria) this;
}
public Criteria andTimestampIsNotNull() {
addCriterion("TIMESTAMP is not null");
return (Criteria) this;
}
public Criteria andTimestampEqualTo(Date value) {
addCriterion("TIMESTAMP =", value, "timestamp");
return (Criteria) this;
}
public Criteria andTimestampNotEqualTo(Date value) {
addCriterion("TIMESTAMP <>", value, "timestamp");
return (Criteria) this;
}
public Criteria andTimestampGreaterThan(Date value) {
addCriterion("TIMESTAMP >", value, "timestamp");
return (Criteria) this;
}
public Criteria andTimestampGreaterThanOrEqualTo(Date value) {
addCriterion("TIMESTAMP >=", value, "timestamp");
return (Criteria) this;
}
public Criteria andTimestampLessThan(Date value) {
addCriterion("TIMESTAMP <", value, "timestamp");
return (Criteria) this;
}
public Criteria andTimestampLessThanOrEqualTo(Date value) {
addCriterion("TIMESTAMP <=", value, "timestamp");
return (Criteria) this;
}
public Criteria andTimestampIn(List<Date> values) {
addCriterion("TIMESTAMP in", values, "timestamp");
return (Criteria) this;
}
public Criteria andTimestampNotIn(List<Date> values) {
addCriterion("TIMESTAMP not in", values, "timestamp");
return (Criteria) this;
}
public Criteria andTimestampBetween(Date value1, Date value2) {
addCriterion("TIMESTAMP between", value1, value2, "timestamp");
return (Criteria) this;
}
public Criteria andTimestampNotBetween(Date value1, Date value2) {
addCriterion("TIMESTAMP not between", value1, value2, "timestamp");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
b9601f81ce7f949d0b9a92bce2a89c6c23aaac3a | 66a5099794c7b7a4f44ea59bf5ac27f90f79ec72 | /corejava-exception/src/main/java/_03methodToPrintException/_04GetCauseMethodDemo.java | 27900d49efec041011e80de4cc4efc0a3616c117 | [] | no_license | Taher2011/java-core-java | 882432fe582d4d477cf61dd805d3badc95c18755 | 925a805df3627769c21c7875f8b2ab9512edf7f7 | refs/heads/master | 2023-03-08T07:57:45.916348 | 2023-02-25T02:01:49 | 2023-02-25T02:01:49 | 181,102,868 | 0 | 2 | null | 2020-10-14T00:19:06 | 2019-04-13T00:53:52 | Java | UTF-8 | Java | false | false | 736 | java | package _03methodToPrintException;
class InvalidCurrencyDataException extends RuntimeException {
public InvalidCurrencyDataException(String message) {
super(message);
}
public InvalidCurrencyDataException(String message, Throwable cause) {
super(message, cause);
}
}
class CurrencyService {
public String convertDollarsToEuros(String value) {
try {
int x = Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new InvalidCurrencyDataException("Invalid data");
}
return value;
}
}
public class _04GetCauseMethodDemo {
public static void main(String[] args) {
CurrencyService service = new CurrencyService();
service.convertDollarsToEuros("asd");
}
}
| [
"[email protected]"
] | |
fca4c4451230917c4e2fb0c35cabd683d6464e89 | c17cf93aa2a5b6505334588907730233fbfc5a1e | /src/test/java/com/example/html/HtmlApplicationTests.java | d155fb7fbdbd491627bb21a040f617011ec501bf | [] | no_license | HazarBharatKumar/Task | c03d05e8200641dddaa0b571c4e56e6950e2e8c1 | a7aa288df5a5b342d037037701b1b753a3a85f93 | refs/heads/master | 2023-01-27T17:38:43.627125 | 2020-12-12T07:27:38 | 2020-12-12T07:27:38 | 320,773,711 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | package com.example.html;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class HtmlApplicationTests {
@Test
void contextLoads() {
}
}
| [
"Khulsan@Shaik-PC"
] | Khulsan@Shaik-PC |
abac0cda5949963390dd44d4fa7f222ad5113d95 | cdc9a46ef2ccd4413c8691e4396b000c07f00625 | /src/main/java/com/group6/pro/repository/ProductRepository.java | b278305d0e754decd498a209939f3cabbbbc549c | [] | no_license | aldemirgozde/aldemirgozde.github.io | ec02efc92edd530f50b6e54e1b136ebd076643bf | f214c46be3a632ea7d91952af2322ca988d74622 | refs/heads/master | 2021-02-26T23:32:33.058195 | 2020-06-13T17:29:41 | 2020-06-13T17:29:41 | 245,559,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.group6.pro.repository;
import java.util.Set;
import org.springframework.data.jpa.repository.JpaRepository;
import com.group6.pro.model.Kitchens;
import com.group6.pro.model.Product;
public interface ProductRepository extends JpaRepository<Product, Long>{
Set<Product> findByKitchen(Kitchens kitchen);
}
| [
"[email protected]"
] | |
b4dcdaa5a42684420d63c6f710e3b1be63fbf217 | f952b5075cc4bb122d75507521fea1f0e4a4d538 | /src/main/java/com/microsoft/graph/requests/GroupReferenceRequestBuilder.java | 7e92297b26ad5806f109fee189777f5d2a63f00d | [
"MIT"
] | permissive | X2Mobile/msgraph-sdk-java | 368c49ab5b53dedc2d368f3fc4f49cd410ea28a6 | fff1d5776e5b48c97a45759836398784779528ef | refs/heads/dev | 2023-06-14T21:46:57.212619 | 2020-09-04T06:49:21 | 2021-07-13T12:47:13 | 292,762,649 | 0 | 0 | MIT | 2020-09-04T11:34:12 | 2020-09-04T05:59:02 | null | UTF-8 | Java | false | false | 4,092 | java |
// Template Source: BaseEntityReferenceRequestBuilder.java.tt
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.requests;
import com.microsoft.graph.http.IRequestBuilder;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.models.Group;
import com.microsoft.graph.models.AssignedLicense;
import com.microsoft.graph.models.ResourceSpecificPermissionGrant;
import com.microsoft.graph.models.DirectoryObject;
import com.microsoft.graph.models.ExtensionProperty;
import com.microsoft.graph.requests.AppRoleAssignmentCollectionRequestBuilder;
import com.microsoft.graph.requests.AppRoleAssignmentRequestBuilder;
import com.microsoft.graph.requests.DirectoryObjectWithReferenceRequestBuilder;
import com.microsoft.graph.requests.DirectoryObjectCollectionWithReferencesRequestBuilder;
import com.microsoft.graph.requests.UserRequestBuilder;
import com.microsoft.graph.requests.GroupRequestBuilder;
import com.microsoft.graph.requests.ApplicationRequestBuilder;
import com.microsoft.graph.requests.ServicePrincipalRequestBuilder;
import com.microsoft.graph.requests.DeviceRequestBuilder;
import com.microsoft.graph.requests.OrgContactRequestBuilder;
import com.microsoft.graph.requests.ResourceSpecificPermissionGrantCollectionRequestBuilder;
import com.microsoft.graph.requests.ResourceSpecificPermissionGrantRequestBuilder;
import com.microsoft.graph.requests.GroupSettingCollectionRequestBuilder;
import com.microsoft.graph.requests.GroupSettingRequestBuilder;
import com.microsoft.graph.requests.CalendarRequestBuilder;
import com.microsoft.graph.requests.EventCollectionRequestBuilder;
import com.microsoft.graph.requests.EventRequestBuilder;
import com.microsoft.graph.requests.ConversationCollectionRequestBuilder;
import com.microsoft.graph.requests.ConversationRequestBuilder;
import com.microsoft.graph.requests.ProfilePhotoRequestBuilder;
import com.microsoft.graph.requests.ProfilePhotoCollectionRequestBuilder;
import com.microsoft.graph.requests.ConversationThreadCollectionRequestBuilder;
import com.microsoft.graph.requests.ConversationThreadRequestBuilder;
import com.microsoft.graph.requests.DriveRequestBuilder;
import com.microsoft.graph.requests.DriveCollectionRequestBuilder;
import com.microsoft.graph.requests.SiteCollectionRequestBuilder;
import com.microsoft.graph.requests.SiteRequestBuilder;
import com.microsoft.graph.requests.ExtensionCollectionRequestBuilder;
import com.microsoft.graph.requests.ExtensionRequestBuilder;
import com.microsoft.graph.requests.GroupLifecyclePolicyCollectionRequestBuilder;
import com.microsoft.graph.requests.GroupLifecyclePolicyRequestBuilder;
import com.microsoft.graph.requests.PlannerGroupRequestBuilder;
import com.microsoft.graph.requests.OnenoteRequestBuilder;
import com.microsoft.graph.requests.TeamRequestBuilder;
import java.util.Arrays;
import java.util.EnumSet;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import com.microsoft.graph.http.BaseReferenceRequestBuilder;
import com.microsoft.graph.core.IBaseClient;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Group Reference Request Builder.
*/
public class GroupReferenceRequestBuilder extends BaseReferenceRequestBuilder<Group, GroupReferenceRequest> {
/**
* The request builder for the Group
*
* @param requestUrl the request URL
* @param client the service client
* @param requestOptions the options for this request
*/
public GroupReferenceRequestBuilder(@Nonnull final String requestUrl, @Nonnull final IBaseClient<?> client, @Nullable final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) {
super(requestUrl, client, requestOptions, GroupReferenceRequest.class);
}
}
| [
"[email protected]"
] | |
a2f3c008928653bf5d2ef3795d0620f5426ecb1d | ce5563046f0bce71167f05dbe65354a683acd99c | /app/src/test/java/com/example/covidtest/ExampleUnitTest.java | 5a0a7ba51f62ef243afdb29de3ab6573496054d5 | [] | no_license | alkathirikhalid/MobileTechTest | b50298abed1e4edbb01ede75e6c9600cc2140370 | b80b63dbaa26349225705adb079a8f9d1d03ece0 | refs/heads/master | 2023-08-25T04:42:55.140886 | 2021-10-16T18:08:08 | 2021-10-16T18:08:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.example.covidtest;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
e009064bab6730edbe54bc07682a7f3ad668731c | 259c0c3d260beec6351bfef8fda6b10f389e0b7f | /src/RandomGhost.java | 541d1ee7d85eac16d31ce891c3cc72b073a80650 | [] | no_license | janicek1m/PacMan | 4b45e853f5bd4465726b67d9c147597a541f0226 | 68df81a275c271e78ab8f4ab5b97371c99ce1f3b | refs/heads/main | 2023-02-06T09:47:07.448687 | 2020-12-23T19:21:18 | 2020-12-23T19:21:18 | 323,983,812 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,931 | java | import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class RandomGhost extends Ghost {
private int row = 7;
private int col = 1;
public static final int INIT_POS_X = 25;
public static final int INIT_POS_Y = 175;
private static final String IMG_FILE_FRIGHT = "files/frightened.png";
private static final String IMG_FILE_NORMAL = "files/random.png";
private static BufferedImage imgNormal;
private static BufferedImage imgFright;
private String direction = "RIGHT";
public RandomGhost(int courtWidth, int courtHeight) {
super(INIT_POS_X, INIT_POS_Y, courtWidth, courtHeight);
try {
if (imgNormal == null) {
imgNormal = ImageIO.read(new File(IMG_FILE_NORMAL));
}
if (imgFright == null) {
imgFright = ImageIO.read(new File(IMG_FILE_FRIGHT));
}
} catch (IOException e) {
System.out.println("Internal Error:" + e.getMessage());
}
}
public boolean isNextCellNavigable(String direction) {
if (direction.equals("RIGHT") && col < 18) {
return (Wall.getMaze()[row][col + 1] != 'w');
} else if (direction.equals("LEFT") && col > 1) {
return (Wall.getMaze()[row][col - 1] != 'w');
} else if (direction.equals("UP") && row > 1) {
return (Wall.getMaze()[row - 1][col] != 'w');
} else if (direction.equals("DOWN") && row < 18) {
return (Wall.getMaze()[row + 1][col] != 'w');
}
return false;
}
@Override
public void move() {
if (isNextCellNavigable(direction) && !getIsDead()) {
if (direction.equals("LEFT")) {
col--;
this.setPx(this.getPx() - 25);
} else if (direction.equals("RIGHT")) {
col++;
this.setPx(this.getPx() + 25);
} else if (direction.equals("UP")) {
row--;
this.setPy(this.getPy() - 25);
} else if (direction.equals("DOWN")) {
row++;
this.setPy(this.getPy() + 25);
}
}
this.direction = randomDirection();
}
@Override
public void reset() {
if (!getIsDead()) {
this.setPx(INIT_POS_X);
this.setPy(INIT_POS_Y);
row = 7;
col = 1;
}
}
@Override
public void draw(Graphics g) {
if (!getFrightenedMode()) {
g.drawImage(imgNormal, this.getPx(), this.getPy(),
this.getWidth(), this.getHeight(), null);
} else if (!getIsDead()) {
g.drawImage(imgFright, this.getPx(), this.getPy(),
this.getWidth(), this.getHeight(), null);
}
}
}
| [
"[email protected]"
] | |
514f436981c2cd16bd4c7d80e4b9e206432ea449 | b000bff55fa78503ade27051859489d448fe3d22 | /singleton-pattern/src/main/java/register/EnumSingleton.java | eb1a39af224a89bd231ab08dfee515b929f1b164 | [] | no_license | yourant/design-patterns | a90119206056d9340fd1ecebf22d5df66c9102f1 | eff196951c36b2e8f51e2aea3cdfbda6044d3135 | refs/heads/master | 2023-09-01T21:00:12.586960 | 2021-10-24T15:42:20 | 2021-10-24T15:42:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,678 | java | package register;
import annotations.ThreadSafe;
import lombok.Getter;
import lombok.Setter;
import java.io.*;
/**
* Created by qincasin on 2020/2/13.
* 注册式单例模式
*
*/
@ThreadSafe
public enum EnumSingleton {
/**
*
*/
INSTANCE;
@Setter
@Getter
private Object data;
public static EnumSingleton getInstance() {
return INSTANCE;
}
/**
* 枚举类单例模式 序列化 反序列化 测试 T
* 枚举类实现方式: 内部通过静态代码块给instance 进行赋值 是饿汉式的单例模式
* @param args
* @throws IOException
* @throws ClassNotFoundException
*/
public static void main(String[] args) throws IOException, ClassNotFoundException {
EnumSingleton instance1 = null;
EnumSingleton instance2 = EnumSingleton.getInstance();
instance2.setData(new Object());
FileOutputStream fileOutputStream = new FileOutputStream("EnumSingleton.obj");
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
objectOutputStream.writeObject(instance2);
objectOutputStream.flush();
objectOutputStream.close();
FileInputStream fileInputStream = new FileInputStream("EnumSingleton.obj");
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
instance1 = (EnumSingleton) objectInputStream.readObject();
fileInputStream.close();
System.out.println("test1111");
System.out.println(instance1.getData());
System.out.println(instance2.getData());
System.out.println(instance1 == instance2);
}
}
| [
"[email protected]"
] | |
5a00d528b6df075236de69595e0d824c63afe5a9 | d05e3e0c56d6882ec31ac83939f2babd1d393101 | /src/main/java/pe/gob/onpe/adan/model/adan/ReporteElector.java | 7ff28c4109c123659e5ae72b232740bafa9ad1ce | [] | no_license | bryanvaldez/spa-spring-angular | a1c2692f8081a84caa25af454fbdfeee9543c16d | b524c6588eb6f8345e263dfe5531dc10152a08ef | refs/heads/master | 2021-03-12T19:29:56.671360 | 2017-09-08T16:17:50 | 2017-09-08T16:17:50 | 102,880,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,931 | 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 pe.gob.onpe.adan.model.adan;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* @author bvaldez
*/
@Entity
@Table(name="TAB_SECCION_ELECTOR")
public class ReporteElector implements Serializable{
@Id
@Column(name = "N_TIPO_CONSULTA")
@JsonProperty("N_TIPO_CONSULTA")
private Integer N_TIPO_CONSULTA;
@Column(name = "C_TIPO_CONSULTA")
@JsonProperty("C_TIPO_CONSULTA")
private String C_TIPO_CONSULTA;
@Column(name = "C_CODIGO_ODPE")
@JsonProperty("C_CODIGO_ODPE")
private String C_CODIGO_ODPE;
@Column(name = "C_NOMBRE_ODPE")
@JsonProperty("C_NOMBRE_ODPE")
private String C_NOMBRE_ODPE;
@Column(name = "C_UBIGEO")
@JsonProperty("C_UBIGEO")
private String C_UBIGEO;
@Column(name = "C_DEPARTAMENTO")
@JsonProperty("C_DEPARTAMENTO")
private String C_DEPARTAMENTO;
@Column(name = "C_PROVINCIA")
@JsonProperty("C_PROVINCIA")
private String C_PROVINCIA;
@Column(name = "C_DISTRITO")
@JsonProperty("C_DISTRITO")
private String C_DISTRITO;
@Column(name = "N_TOTAL_EH")
@JsonProperty("N_TOTAL_EH")
private Integer N_TOTAL_EH;
@Column(name = "N_CANT_EH_MUJER")
@JsonProperty("N_CANT_EH_MUJER")
private Integer N_CANT_EH_MUJER;
@Column(name = "N_CANT_EH_HOMBRE")
@JsonProperty("N_CANT_EH_HOMBRE")
private Integer N_CANT_EH_HOMBRE;
@Column(name = "N_PORC_EH_MUJER")
@JsonProperty("N_PORC_EH_MUJER")
private Double N_PORC_EH_MUJER;
@Column(name = "N_PORC_EH_HOMBRE")
@JsonProperty("N_PORC_EH_HOMBRE")
private Double N_PORC_EH_HOMBRE;
@Column(name = "N_CANT_RANGO_EDAD_A")
@JsonProperty("N_CANT_RANGO_EDAD_A")
private Integer N_CANT_RANGO_EDAD_A;
@Column(name = "N_PORC_RANGO_EDAD_A")
@JsonProperty("N_PORC_RANGO_EDAD_A")
private Double N_PORC_RANGO_EDAD_A;
@Column(name = "N_CANT_RANGO_EDAD_B")
@JsonProperty("N_CANT_RANGO_EDAD_B")
private Integer N_CANT_RANGO_EDAD_B;
@Column(name = "N_PORC_RANGO_EDAD_B")
@JsonProperty("N_PORC_RANGO_EDAD_B")
private Double N_PORC_RANGO_EDAD_B;
@Column(name = "N_CANT_RANGO_EDAD_C")
@JsonProperty("N_CANT_RANGO_EDAD_C")
private Integer N_CANT_RANGO_EDAD_C;
@Column(name = "N_PORC_RANGO_EDAD_C")
@JsonProperty("N_PORC_RANGO_EDAD_C")
private Double N_PORC_RANGO_EDAD_C;
@Column(name = "N_CANT_RANGO_EDAD_D")
@JsonProperty("N_CANT_RANGO_EDAD_D")
private Integer N_CANT_RANGO_EDAD_D;
@Column(name = "N_PORC_RANGO_EDAD_D")
@JsonProperty("N_PORC_RANGO_EDAD_D")
private Double N_PORC_RANGO_EDAD_D;
@Column(name = "N_CANT_RANGO_EDAD_E")
@JsonProperty("N_CANT_RANGO_EDAD_E")
private Integer N_CANT_RANGO_EDAD_E;
@Column(name = "N_PORC_RANGO_EDAD_E")
@JsonProperty("N_PORC_RANGO_EDAD_E")
private Double N_PORC_RANGO_EDAD_E;
@Column(name = "N_CANT_RANGO_EDAD_F")
@JsonProperty("N_CANT_RANGO_EDAD_F")
private Integer N_CANT_RANGO_EDAD_F;
@Column(name = "N_PORC_RANGO_EDAD_F")
@JsonProperty("N_PORC_RANGO_EDAD_F")
private Double N_PORC_RANGO_EDAD_F;
// @Column(name = "N_TOTAL_CCPP")
// @JsonProperty("N_TOTAL_CCPP")
// private Integer N_TOTAL_CCPP;
public Integer getN_TIPO_CONSULTA() {
return N_TIPO_CONSULTA;
}
public void setN_TIPO_CONSULTA(Integer N_TIPO_CONSULTA) {
this.N_TIPO_CONSULTA = N_TIPO_CONSULTA;
}
public String getC_TIPO_CONSULTA() {
return C_TIPO_CONSULTA;
}
public void setC_TIPO_CONSULTA(String C_TIPO_CONSULTA) {
this.C_TIPO_CONSULTA = C_TIPO_CONSULTA;
}
public String getC_CODIGO_ODPE() {
return C_CODIGO_ODPE;
}
public void setC_CODIGO_ODPE(String C_CODIGO_ODPE) {
this.C_CODIGO_ODPE = C_CODIGO_ODPE;
}
public String getC_NOMBRE_ODPE() {
return C_NOMBRE_ODPE;
}
public void setC_NOMBRE_ODPE(String C_NOMBRE_ODPE) {
this.C_NOMBRE_ODPE = C_NOMBRE_ODPE;
}
public String getC_UBIGEO() {
return C_UBIGEO;
}
public void setC_UBIGEO(String C_UBIGEO) {
this.C_UBIGEO = C_UBIGEO;
}
public String getC_DEPARTAMENTO() {
return C_DEPARTAMENTO;
}
public void setC_DEPARTAMENTO(String C_DEPARTAMENTO) {
this.C_DEPARTAMENTO = C_DEPARTAMENTO;
}
public String getC_PROVINCIA() {
return C_PROVINCIA;
}
public void setC_PROVINCIA(String C_PROVINCIA) {
this.C_PROVINCIA = C_PROVINCIA;
}
public String getC_DISTRITO() {
return C_DISTRITO;
}
public void setC_DISTRITO(String C_DISTRITO) {
this.C_DISTRITO = C_DISTRITO;
}
public Integer getN_TOTAL_EH() {
return N_TOTAL_EH;
}
public void setN_TOTAL_EH(Integer N_TOTAL_EH) {
this.N_TOTAL_EH = N_TOTAL_EH;
}
public Integer getN_CANT_EH_MUJER() {
return N_CANT_EH_MUJER;
}
public void setN_CANT_EH_MUJER(Integer N_CANT_EH_MUJER) {
this.N_CANT_EH_MUJER = N_CANT_EH_MUJER;
}
public Integer getN_CANT_EH_HOMBRE() {
return N_CANT_EH_HOMBRE;
}
public void setN_CANT_EH_HOMBRE(Integer N_CANT_EH_HOMBRE) {
this.N_CANT_EH_HOMBRE = N_CANT_EH_HOMBRE;
}
public Double getN_PORC_EH_MUJER() {
return N_PORC_EH_MUJER;
}
public void setN_PORC_EH_MUJER(Double N_PORC_EH_MUJER) {
this.N_PORC_EH_MUJER = N_PORC_EH_MUJER;
}
public Double getN_PORC_EH_HOMBRE() {
return N_PORC_EH_HOMBRE;
}
public void setN_PORC_EH_HOMBRE(Double N_PORC_EH_HOMBRE) {
this.N_PORC_EH_HOMBRE = N_PORC_EH_HOMBRE;
}
public Integer getN_CANT_RANGO_EDAD_A() {
return N_CANT_RANGO_EDAD_A;
}
public void setN_CANT_RANGO_EDAD_A(Integer N_CANT_RANGO_EDAD_A) {
this.N_CANT_RANGO_EDAD_A = N_CANT_RANGO_EDAD_A;
}
public Double getN_PORC_RANGO_EDAD_A() {
return N_PORC_RANGO_EDAD_A;
}
public void setN_PORC_RANGO_EDAD_A(Double N_PORC_RANGO_EDAD_A) {
this.N_PORC_RANGO_EDAD_A = N_PORC_RANGO_EDAD_A;
}
public Integer getN_CANT_RANGO_EDAD_B() {
return N_CANT_RANGO_EDAD_B;
}
public void setN_CANT_RANGO_EDAD_B(Integer N_CANT_RANGO_EDAD_B) {
this.N_CANT_RANGO_EDAD_B = N_CANT_RANGO_EDAD_B;
}
public Double getN_PORC_RANGO_EDAD_B() {
return N_PORC_RANGO_EDAD_B;
}
public void setN_PORC_RANGO_EDAD_B(Double N_PORC_RANGO_EDAD_B) {
this.N_PORC_RANGO_EDAD_B = N_PORC_RANGO_EDAD_B;
}
public Integer getN_CANT_RANGO_EDAD_C() {
return N_CANT_RANGO_EDAD_C;
}
public void setN_CANT_RANGO_EDAD_C(Integer N_CANT_RANGO_EDAD_C) {
this.N_CANT_RANGO_EDAD_C = N_CANT_RANGO_EDAD_C;
}
public Double getN_PORC_RANGO_EDAD_C() {
return N_PORC_RANGO_EDAD_C;
}
public void setN_PORC_RANGO_EDAD_C(Double N_PORC_RANGO_EDAD_C) {
this.N_PORC_RANGO_EDAD_C = N_PORC_RANGO_EDAD_C;
}
public Integer getN_CANT_RANGO_EDAD_D() {
return N_CANT_RANGO_EDAD_D;
}
public void setN_CANT_RANGO_EDAD_D(Integer N_CANT_RANGO_EDAD_D) {
this.N_CANT_RANGO_EDAD_D = N_CANT_RANGO_EDAD_D;
}
public Double getN_PORC_RANGO_EDAD_D() {
return N_PORC_RANGO_EDAD_D;
}
public void setN_PORC_RANGO_EDAD_D(Double N_PORC_RANGO_EDAD_D) {
this.N_PORC_RANGO_EDAD_D = N_PORC_RANGO_EDAD_D;
}
public Integer getN_CANT_RANGO_EDAD_E() {
return N_CANT_RANGO_EDAD_E;
}
public void setN_CANT_RANGO_EDAD_E(Integer N_CANT_RANGO_EDAD_E) {
this.N_CANT_RANGO_EDAD_E = N_CANT_RANGO_EDAD_E;
}
public Double getN_PORC_RANGO_EDAD_E() {
return N_PORC_RANGO_EDAD_E;
}
public void setN_PORC_RANGO_EDAD_E(Double N_PORC_RANGO_EDAD_E) {
this.N_PORC_RANGO_EDAD_E = N_PORC_RANGO_EDAD_E;
}
public Integer getN_CANT_RANGO_EDAD_F() {
return N_CANT_RANGO_EDAD_F;
}
public void setN_CANT_RANGO_EDAD_F(Integer N_CANT_RANGO_EDAD_F) {
this.N_CANT_RANGO_EDAD_F = N_CANT_RANGO_EDAD_F;
}
public Double getN_PORC_RANGO_EDAD_F() {
return N_PORC_RANGO_EDAD_F;
}
public void setN_PORC_RANGO_EDAD_F(Double N_PORC_RANGO_EDAD_F) {
this.N_PORC_RANGO_EDAD_F = N_PORC_RANGO_EDAD_F;
}
// public Integer getN_TOTAL_CCPP() {
// return N_TOTAL_CCPP;
// }
//
// public void setN_TOTAL_CCPP(Integer N_TOTAL_CCPP) {
// this.N_TOTAL_CCPP = N_TOTAL_CCPP;
// }
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.