blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
232ee47b12df28332eeae6ed9b6a31dcd69baae6
b5b358a5965a9eb29528b8c62ef4d17205b25cd6
/Exo19.java
92ebb72cf0bc2c3b4b91259cfc7fcbd75ab3c743
[]
no_license
74med/Exo-refait-Solo
e1c3c6e53b08f77d21caf6c061a7fb77b9d47636
1156d203d115d2d1bb5d14e853cf9e0b68ed3951
refs/heads/master
2020-04-11T19:22:41.520836
2018-12-16T19:15:58
2018-12-16T19:15:58
162,031,913
0
0
null
null
null
null
UTF-8
Java
false
false
1,486
java
package exo19; import java.util.Arrays; import java.util.Collections; public class Exo19 { public static void main(String[] args) { /* Exercice 19 Tri à bulle Déclarez et initialisez un tableau de 8 entiers. Remplir aléatoirement ce tableau avec des nombres entre 0 et 100. Afficher ce tableau en l'état. Ecrivez l'algorithme qui trie un tableau d'entiers dans l'ordre croissant. Ré-afficher le tableau une fois trié.*/ /* int tableauEntier[] = new int[8]; for (int i = 0; i<tableauEntier.length; i++){ tableauEntier[i] = (int)(Math.random() * 101); System.out.println(tableauEntier[i]); } } }*/ /* exemple du net mais pas tous compris // initialiser le tableau int array[] = new array[8]; // créer un tableau qui contient des objets Integer Integer[] integerArray = new Integer[array.length]; // afficher tous les entiers avant le tri // copier tous les valeurs dans un tableau de type Integer for (int i=0; i < array.length; i++) { System.out.println("nombre: " + array[i]); //instancier un nouveau Integer integerArray[i] = new Integer(array[i]); } // trier le tableau, puis l'inverser Arrays.sort(integerArray, Collections.reverseOrder()); // lafficher tous les entiers après le tri System.out.println("Tableau trié\n"); for (int entier : integerArray) { System.out.println("nombre: " + entier); } } }*/
[ "noreply@github.com" ]
noreply@github.com
8c4fe63a5ed715fd6604867d1ee62e35b97ad71a
7130e47450bd80f35c7213c88a737e639d329e6f
/wxxr-mobile-net/src/main/java/com/wxxr/mobile/core/rpc/rest/LocaleDelegate.java
c368b803b35196d228d2ff4b86ee591d6e4c1e52
[]
no_license
wxynick/framework
983be31104b360008a2d36565bc82d74b82804fc
93b5fe0c3e40ad434325b1755d0b1be5255977ac
refs/heads/master
2016-09-06T18:33:32.119410
2014-04-04T11:52:21
2014-04-04T11:52:21
9,125,521
0
1
null
null
null
null
UTF-8
Java
false
false
739
java
package com.wxxr.mobile.core.rpc.rest; import com.wxxr.javax.ws.rs.ext.RuntimeDelegate; import com.wxxr.mobile.core.util.LocaleHelper; import java.util.Locale; /** * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @version $Revision$ */ public class LocaleDelegate implements RuntimeDelegate.HeaderDelegate<Locale> { public Locale fromString(String value) throws IllegalArgumentException { if (value == null) throw new IllegalArgumentException("Locale value is null"); return LocaleHelper.extractLocale(value); } public String toString(Locale value) { if (value == null) throw new IllegalArgumentException("param was null"); return LocaleHelper.toLanguageString(value); } }
[ "" ]
fb5d21ea35e98e0afb91bc52477ae21544fe4a72
46deef925916e73e036fa0eaff7025118a27d7c1
/src/main/java/com/team/solventa/util/LocalDateSerializer.java
cec346c7439c3e91d80738141c8493602973cc05
[]
no_license
TechSourav/Proyecto
52822ffe288b801f379aa34f651ca011739b549e
1f101f7e1ced707f732a1c6ccb46344f9adc4963
refs/heads/master
2020-06-17T03:42:59.636862
2017-08-05T13:01:43
2017-08-05T13:01:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,036
java
package com.team.solventa.util; import java.io.IOException; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; @Component("LocalDateSerializer") public class LocalDateSerializer extends JsonSerializer<Object> { public LocalDateSerializer() { super(); } @Override public void serialize(final Object localDate, final JsonGenerator jsonGenerator, final SerializerProvider provider) throws IOException { final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy"); if (localDate instanceof LocalDate) { jsonGenerator.writeString(((LocalDate) localDate).format(dateFormat)); } if (localDate instanceof LocalDateTime) { jsonGenerator.writeString(((LocalDateTime) localDate).format(dateFormat)); } } }
[ "Jhonny@Jhonny.home" ]
Jhonny@Jhonny.home
dc37423b5f6611a431fba9773c67c8391fb47483
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/neo4j/2015/12/MigrationStatus.java
894521e476992b4b7a9d9b99e6b339b312112457
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
3,544
java
/* * Copyright (c) 2002-2015 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.kernel.impl.storemigration; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.Writer; import java.nio.charset.StandardCharsets; import org.neo4j.helpers.Pair; import org.neo4j.io.fs.FileSystemAbstraction; enum MigrationStatus { migrating, moving, countsRebuilding, completed; public boolean isNeededFor( MigrationStatus current ) { return current == null || this.ordinal() >= current.ordinal(); } public String maybeReadInfo( FileSystemAbstraction fs, File stateFile, String currentInfo ) { if ( currentInfo != null ) { return currentInfo; } Pair<String,String> data = readFromFile( fs, stateFile, this ); return data == null ? null : data.other(); } public static MigrationStatus readMigrationStatus( FileSystemAbstraction fs, File stateFile ) { Pair<String,String> data = readFromFile( fs, stateFile, null ); if ( data == null ) { return null; } return MigrationStatus.valueOf( data.first() ); } private static Pair<String, String> readFromFile( FileSystemAbstraction fs, File file, MigrationStatus expectedSate ) { try ( BufferedReader reader = new BufferedReader( fs.openAsReader( file, StandardCharsets.UTF_8 ) ) ) { String state = reader.readLine().trim(); if ( expectedSate != null && !expectedSate.name().equals( state ) ) { throw new IllegalStateException( "Not in the expected state, expected=" + expectedSate.name() + ", actual=" + state ); } String info = reader.readLine().trim(); return Pair.of( state, info ); } catch ( FileNotFoundException e ) { return null; } catch ( IOException e ) { throw new RuntimeException( e ); } } public void setMigrationStatus( FileSystemAbstraction fs, File stateFile, String info ) { if ( fs.fileExists( stateFile ) ) { try { fs.truncate( stateFile, 0 ); } catch ( IOException e ) { throw new RuntimeException( e ); } } try ( Writer writer = fs.openAsWriter( stateFile, StandardCharsets.UTF_8, false ) ) { writer.write( name() ); writer.write( '\n' ); writer.write( info ); writer.flush(); } catch ( IOException e ) { throw new RuntimeException( e ); } } }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
01782fd8dcb4845967e04c025acfa11402f50b6d
770caff1b2110dc1743a73f87f58a7fc28de469d
/RegistrationApp/app/src/main/java/com/example/registrationapp/syllabussss.java
9a7153968aea7fbf21cca9a2ff2376a3cf055705
[]
no_license
Twin-Matrix/registration2
fbc88f32ff657a5aaac870f4621aa00f54f7bfee
09a93161030cd78b9df5bf32888eb8fb93d8ed28
refs/heads/master
2022-10-09T07:53:04.895785
2020-06-07T09:43:26
2020-06-07T09:43:26
270,244,250
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.example.registrationapp; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class syllabussss extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_syllabussss); } }
[ "64961839+Twin-Matrix@users.noreply.github.com" ]
64961839+Twin-Matrix@users.noreply.github.com
231168b10b136035152728d222f2b4f0f95e4952
9687349bd52bc8fd5ddb17a4c2f315019349b47e
/inner/Main.java
8d9bbe2996f9430e38e0211d754848a11f5fe45f
[]
no_license
kangtaeksu/JAVA
f211d356b49d3d8368ec2b14b689082160c52577
2ebcc5dd892ea124ded536fa63cbae5c6e55c22d
refs/heads/master
2023-03-15T02:11:42.100362
2021-03-14T04:00:14
2021-03-14T04:00:14
346,269,569
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package kosta.inner; public class Main { public static void main(String[] args) { SNSmessenger sns = new SNSmessenger(); // sns.send("OK"); MessageSender ms = new MessageSender() { @Override void send(String message) { // TODO Auto-generated method stub System.out.println("Emailsender"); } }; ms.send("ok"); } }
[ "gangtaeksoo@naver.com" ]
gangtaeksoo@naver.com
671d817fcbf0bb53dafa970c14665e085816a9e5
4dfd6fd90e4031d3626654692abae51f2d0e3640
/CoursesOnline-master/BackEnd/src/main/java/com/xjt/service/IUserService.java
18a5365282a769540d7fb6f4216aaee463f85ada
[]
no_license
YOUHEBUKELIAN/OnlineCourse
cf999963db0e473dad0549954e5ba5b12fc8bf6c
9f47d68ef4218b3739fa170e2a57c0cfe13ddcdd
refs/heads/master
2022-04-20T03:42:55.604520
2020-04-20T08:59:29
2020-04-20T08:59:29
257,223,216
0
0
null
null
null
null
UTF-8
Java
false
false
3,058
java
package com.xjt.service; import com.xjt.model.ReturnClass; import com.xjt.model.User; import org.springframework.web.multipart.MultipartFile; import java.io.FileNotFoundException; import java.util.List; import java.util.Map; public interface IUserService { /******** *CREATED BY CHEN ANRAN *2019.7.4 */ //public User selectUser(long userId); //用户登录 ReturnClass login(String openid,String nickName,String avatarUrl); //用户评论 ReturnClass makeComment(String resourceId, String openid, String content,String motion); //ReturnClass getCommentList(String resourseId); //获取收藏列表 ReturnClass getFavResList(String openid); //情绪判断 String judgeCommentEmotion(String content); //获取蹭课列表 ReturnClass getCourseBySchool(String University); //点击课程收藏按钮 ReturnClass cilckCourseFavourite(String openid,String Cid); //点击资源收藏按钮 ReturnClass cilckResourceFavourite(String openid,String resId); // CREATE BY LIJIA JUN //搜索课程 ReturnClass SearchCourse(String keyword); //取消课程收藏 ReturnClass cancelCourseFavourite(String openid,String Cid); //取消资源收藏 ReturnClass cancelResourceFavourite(String openid,String resId); // CREATE BY LIJIA JUN //根据关键字查询资源 ReturnClass SearchResource(String keyword); // CREATE BY LI HU /** CREATE BY LH 2019.7.5 */ //用户评论插入待审核区 ReturnClass makeAuditComment(String resourceId, String openid, String content, String motion); String auditComment(String content); //用户上传文件 //ReturnClass uploadFile(String fileName, MultipartFile multipartFile) throws FileNotFoundException; //根据upid获得上传的资源列表 ReturnClass getUploadResourceList(String open_id); //获取文件信息 ReturnClass getFileInfo(String file_id,String ftype,String url,String chapter,String openid,String resId); /* CREATE BY LH 2017.7.6 */ String searchErrorCorrection(String str); //发送校友圈信息 //ReturnClass monentInfo(String openid, String content, List<String> url); ReturnClass monentInfo(String openid, String content, String url); //对资源评分 ReturnClass resourceScore(String openid,String resId,String score); //用户签到 ReturnClass signUp(String openid, String date); ReturnClass getRecommendByOpenid(String openid); //显示用户自己上传的文件 ReturnClass displayOwnFile(String openid); //删除上传的文件 ReturnClass deleteOwnFile(String file_id); //删除消息 ReturnClass deleteMessage(String mid); //添加校友圈文件信息 //ReturnClass addMomentFileInfo(String file_id,String ftype,String url,String openid); //课程号,是否收藏 Map<String,Boolean> IsCollect(String openid); /* CREATE BY LH 2019.7.10 获得Echart */ ReturnClass getEchartInfo(String openid); }
[ "947320114@qq.com" ]
947320114@qq.com
499fc4fdbb41feb904c06948ca189e3478254fee
e0c10c22372ac5835b66488b9177e25262f3c024
/src/test/java/com/skilrock/stepdefinitions/first/Steps.java
6e67cabac3b5888633ea8dec4945e3b337b951d2
[]
no_license
AmanSinha23/demoProject
0e959063b9f83285b94d2ab5ff736f9f4236d8da
5c48df442785c3f73516c16a50133a93938c623f
refs/heads/master
2020-04-02T00:17:08.222845
2018-10-21T10:39:14
2018-10-21T10:39:14
153,797,172
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
package com.skilrock.stepdefinitions.first; import com.skilrock.dge.common.pages.LoginPage; import com.skilrock.stepdefinitions.attachhooks.AttachHooks; import cucumber.api.java.en.When; import static org.assertj.core.api.Assertions.*; public class Steps { LoginPage login = new LoginPage(AttachHooks.driver); @When("^we enter (.*) and (.*)$") public void we_enter_username_and_password(String userName,String password) throws Throwable { assertThat(login.enterUserNameAndPassword(userName, password)).isTrue(); } @When("^click on login$") public void click_on_login() throws Throwable { assertThat(login.clickOnLogin()).isTrue(); // Write code here that turns the phrase above into concrete actions // throw new PendingException(); } }
[ "amansinha23@gmail.com" ]
amansinha23@gmail.com
a8dcbe1eec12b7338c4b5140a73de1c28c8761c2
6f1aa53e10966be0e476706986ed79a5aff2da00
/account-service/src/main/java/org/mymoney/accountservice/config/WebConfigurer.java
f964e7d0c27a35a33170eafbf18ba52f5bbb35db
[ "Apache-2.0" ]
permissive
mbocek/mymoney
ba1d779f5cd096b7c4832b955ed696d63cdeff5b
a7418b298005e5e71027c57702aa75e9f4877ebd
refs/heads/master
2021-01-12T04:49:09.200422
2017-01-15T07:09:31
2017-01-15T07:09:31
77,798,315
0
0
null
null
null
null
UTF-8
Java
false
false
4,784
java
package org.mymoney.accountservice.config; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.servlet.InstrumentedFilter; import com.codahale.metrics.servlets.MetricsServlet; import com.hazelcast.core.HazelcastInstance; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.embedded.*; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; import java.util.*; import javax.inject.Inject; import javax.servlet.*; /** * Configuration of web application with Servlet 3.0 APIs. */ @Configuration public class WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); @Inject private Environment env; @Inject private JHipsterProperties jHipsterProperties; @Autowired(required = false) private MetricRegistry metricRegistry; @Inject private HazelcastInstance hazelcastInstance; @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", Arrays.toString(env.getActiveProfiles())); } EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC); initMetrics(servletContext, disps); if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT)) { initH2Console(servletContext); } log.info("Web application fully configured"); } /** * Customize the Servlet engine: Mime types, the document root, the cache. */ @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711 mappings.add("html", "text/html;charset=utf-8"); // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64 mappings.add("json", "text/html;charset=utf-8"); container.setMimeMappings(mappings); } /** * Initializes Metrics. */ private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType> disps) { log.debug("Initializing Metrics registries"); servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, metricRegistry); servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, metricRegistry); log.debug("Registering Metrics Filter"); FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", new InstrumentedFilter()); metricsFilter.addMappingForUrlPatterns(disps, true, "/*"); metricsFilter.setAsyncSupported(true); log.debug("Registering Metrics Servlet"); ServletRegistration.Dynamic metricsAdminServlet = servletContext.addServlet("metricsServlet", new MetricsServlet()); metricsAdminServlet.addMapping("/management/metrics/*"); metricsAdminServlet.setAsyncSupported(true); metricsAdminServlet.setLoadOnStartup(2); } @Bean @ConditionalOnProperty(name = "jhipster.cors.allowed-origins") public CorsFilter corsFilter() { log.debug("Registering CORS filter"); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); source.registerCorsConfiguration("/api/**", config); source.registerCorsConfiguration("/v2/api-docs", config); source.registerCorsConfiguration("/oauth/**", config); return new CorsFilter(source); } /** * Initializes H2 console. */ private void initH2Console(ServletContext servletContext) { log.debug("Initialize H2 console"); ServletRegistration.Dynamic h2ConsoleServlet = servletContext.addServlet("H2Console", new org.h2.server.web.WebServlet()); h2ConsoleServlet.addMapping("/h2-console/*"); h2ConsoleServlet.setInitParameter("-properties", "src/main/resources/"); h2ConsoleServlet.setLoadOnStartup(1); } }
[ "michal.bocek@gmail.com" ]
michal.bocek@gmail.com
9d161501e788b3c1bf9eee2341c2afe85a8f7f90
5d6c374a2518d469d674a1327d21d8e0cf2b54f7
/thirdparty/javax.media.jai.osgi/src/main/java/com/sun/media/jai/iterator/WritableRandomIterCSMShort.java
9a4782e9354a8639c07780238e8491af4383772e
[]
no_license
HGitMaster/geotools-osgi
648ebd9343db99a1e2688d9aefad857f6521898d
09f6e327fb797c7e0451e3629794a3db2c55c32b
refs/heads/osgi
2021-01-19T08:33:56.014532
2014-03-19T18:04:03
2014-03-19T18:04:03
4,750,321
3
0
null
2014-03-19T13:50:54
2012-06-22T11:21:01
Java
UTF-8
Java
false
false
1,077
java
/* * $RCSfile: WritableRandomIterCSMShort.java,v $ * * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. * * Use is subject to license terms. * * $Revision: 1.1 $ * $Date: 2005/02/11 04:55:45 $ * $State: Exp $ */ package com.sun.media.jai.iterator; import java.awt.Rectangle; import java.awt.image.WritableRenderedImage; import javax.media.jai.iterator.WritableRandomIter; /** * @since EA2 */ public final class WritableRandomIterCSMShort extends RandomIterCSMShort implements WritableRandomIter { public WritableRandomIterCSMShort(WritableRenderedImage im, Rectangle bounds) { super(im, bounds); } public void setSample(int x, int y, int b, int val) { } public void setSample(int x, int y, int b, float val) { } public void setSample(int x, int y, int b, double val) { } public void setPixel(int x, int y, int[] iArray) { } public void setPixel(int x, int y, float[] fArray) { } public void setPixel(int x, int y, double[] dArray) { } }
[ "devnull@localhost" ]
devnull@localhost
c2cbe86cebd9d80f8c534713dd16b62b34fa670c
07bfc32f974d55875dfd95af5c9fed609f908835
/src/main/java/com/run_NER.java
b37afcade5976eb553ffac6418ac08b1459d561e
[]
no_license
OverlordYuan/API
19c9155f1073a33415674a96f7d7c5b2e28262a3
5c10e10f342fb2cb97afe69c8ef75a683bbe4bab
refs/heads/master
2022-12-26T10:11:03.528315
2020-02-18T05:55:20
2020-02-18T05:55:20
241,283,978
0
0
null
2022-12-16T08:45:35
2020-02-18T05:54:45
Java
UTF-8
Java
false
false
3,979
java
package com; import com.API.API_NER; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.util.ExcelUtils; import com.util.csvUtils; import com.util.readfile; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import static java.lang.Thread.sleep; public class run_NER { private static Logger logger = LoggerFactory.getLogger(run_NER.class.getName()); private static ExcelUtils ex = new ExcelUtils(); private static csvUtils cs = new csvUtils(); private static readfile rf = new readfile(); private static List<String> con = new ArrayList<String>(); private static List<String> b_person = new ArrayList<String>(); private static List<String> t_person = new ArrayList<String>(); private static List<String> j_person = new ArrayList<String>(); private static List<String> b_organization = new ArrayList<String>(); private static List<String> t_organization = new ArrayList<String>(); private static List<String> j_organization = new ArrayList<String>(); private static List<String> b_location = new ArrayList<String>(); private static List<String> t_location = new ArrayList<String>(); private static List<String> j_location = new ArrayList<String>(); private static void Analysis(Object item,int i){ JSONObject obj = (JSONObject) item; JSONArray entitysArray = obj.getJSONArray("entities"); Set<String> PER = new HashSet<String>(); Set<String> ORG = new HashSet<String>(); Set<String> LOC = new HashSet<String>(); if(entitysArray!=null){ for (Object entity_item : entitysArray) { JSONObject entity = (JSONObject)entity_item; if(!entity.isEmpty()){ if(entity.get("typeName").toString().equals("1-person")){ PER.add(entity.get("entity").toString()); }else if(entity.get("typeName").toString().equals("2-organization")){ ORG.add(entity.get("entity").toString()); }else { LOC.add(entity.get("entity").toString()); } } } } if(i==0){ b_person.add(PER.toString()); b_organization.add(ORG.toString()); b_location.add(LOC.toString()); }else if(i==1){ t_person.add(PER.toString()); t_organization.add(ORG.toString()); t_location.add(LOC.toString()); }else { j_person.add(PER.toString()); j_organization.add(ORG.toString()); j_location.add(LOC.toString()); } } private static void save(){ String[] names ={"baidu","tencent","jd"}; JSONObject res = new JSONObject(); for(int i=0;i<3;i++){ if(i==0){ res.put("content",con); res.put("person",b_person); res.put("organization",b_organization); res.put("location",b_location); }else if(i==1){ // res.put("content",con); res.put("person",t_person); res.put("organization",t_organization); res.put("location",t_location); }else { // res.put("content",con); res.put("person",j_person); res.put("organization",j_organization); res.put("location",j_location); } String[] INFO = {"content","person", "organization", "location"}; String outpath ="output/"+names[i]+".xls"; ex.exportExcel(outpath,res,INFO); } } public static void main(String[] args) throws InterruptedException { List<JSONObject> files = rf.read("input/data"); int j = 0; long start = System.currentTimeMillis(); int count = 0; for(JSONObject file:files){ List<List<String>> content = cs.readCSV(file.get("absolutepath").toString()); List<String> contents = content.get(0); count += content.size(); int i = 0; for(String item:contents){ System.out.println(i++); sleep(10*3); JSONArray obj = JSONArray.parseArray(API_NER.NER_all(item)); for(int k=0;k<3;k++){ JSONObject NER = obj.getJSONObject(k); Analysis(NER,k); } con.add(item); } save(); } System.out.println(count); long end = System.currentTimeMillis(); logger.info("Time elapse = {} ms.",(end - start)); } }
[ "1075909452@qq.com" ]
1075909452@qq.com
5aba598fc57785c13b4d81d65c62a3137050977a
a3a955fec4bb73732cd77abce90802b84a25907f
/src/BodyMassIndex.java
14d463601fe383ab3e703a0eedca812527020b8e
[]
no_license
LKukowski/uebung_3_3
388853268f7b5922ec06b26954506da7967a7164
964dc89512410ea66656aab8a15cac0942af97d8
refs/heads/master
2021-01-15T12:42:24.083682
2015-10-29T16:05:47
2015-10-29T16:05:47
45,190,368
0
0
null
2015-10-29T14:59:40
2015-10-29T14:59:39
null
UTF-8
Java
false
false
3,226
java
public class BodyMassIndex { public static void main(String[] args) { double KoerperGewicht = 90; double KoerperGroesse = 1.90; double Alter = 65; boolean GeschlechtMaennlich = false; double QuadratderKoerperGroesse = KoerperGroesse * KoerperGroesse; double BMI = KoerperGewicht / QuadratderKoerperGroesse; System.out.println("Ihr BMI ist " + BMI); if (GeschlechtMaennlich == true) { if (Alter <= 24) { if (BMI <= 20) { System.out.println("Untergewicht");} else { if (BMI >= 25) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } else { if (Alter <= 34) { if (BMI <= 21) { System.out.println("Untergewicht");} else { if (BMI >= 26) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } else { if (Alter <= 44) { if (BMI <= 22) { System.out.println("Untergewicht");} else { if (BMI >= 27) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } else { if (Alter <= 54) { if (BMI <= 23) { System.out.println("Untergewicht");} else { if (BMI >= 28) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } else { if (Alter <= 64) { if (BMI <= 24) { System.out.println("Untergewicht");} else { if (BMI >= 29) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } { if (Alter > 64) { if (BMI <= 25) { System.out.println("Untergewicht");} else { if (BMI >= 30) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } } } } } } } else { if (GeschlechtMaennlich == false) { if (Alter <= 24) { if (BMI <= 19) { System.out.println("Untergewicht");} else { if (BMI >= 24) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } else { if (Alter <= 34) { if (BMI <= 20) { System.out.println("Untergewicht");} else { if (BMI >= 25) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } else { if (Alter <= 44) { if (BMI <= 21) { System.out.println("Untergewicht");} else { if (BMI >= 26) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } else { if (Alter <= 54) { if (BMI <= 22) { System.out.println("Untergewicht");} else { if (BMI >= 27) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } else { if (Alter <= 64) { if (BMI <= 23) { System.out.println("Untergewicht");} else { if (BMI >= 28) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } { if (Alter > 64) { if (BMI <= 24) { System.out.println("Untergewicht");} else { if (BMI >= 29) { System.out.println("Uebergewicht");} else {System.out.println("Normalgewicht");} } } } } } } } } } } }
[ "lukas.kukowski@nordakademie.de" ]
lukas.kukowski@nordakademie.de
642354c0498bd63300ed8afc8715642dd2f2abc6
3c3716a281a8778c51e27f690c4656a56bde7bc6
/UserRepository.java
1a8466c558650a58f90335490f9334ba71aaee62
[]
no_license
veronikaomrp/JavaEE
5f712433a4332922bccd88229e2102a458e7b8b7
6a37d85ca142bd4f0de0f6e129a8832027f13de0
refs/heads/master
2022-12-28T04:11:25.811983
2020-10-09T05:41:50
2020-10-09T05:41:50
299,871,609
0
0
null
null
null
null
UTF-8
Java
false
false
203
java
package del.ac.id.demo.jpa; import org.springframework.data.jpa.repository.JpaRepository; public interface UserRepository extends JpaRepository<User, String> { User findByUsername(String username); }
[ "noreply@github.com" ]
noreply@github.com
2854c140a61c35abbce98a69fcd71c57ef4cff29
fba1ac8b1600df5bfdeb12feed69399ff088f3cb
/src/test/java/stepDefination/hrmsapplication.java
15fb8726ca5f220b90573fefe353a8dd508a0000
[]
no_license
vijiliviya/DennyCucumberproject
e1bd8b0fffe2291199709ab458768117288c84f5
3eecef2f36845f5fd93cfd7331ce6b8f3dadc29a
refs/heads/master
2021-07-07T16:13:05.220080
2019-07-30T10:49:35
2019-07-30T10:49:35
199,632,560
0
0
null
2020-10-13T14:58:53
2019-07-30T10:46:56
Java
UTF-8
Java
false
false
3,686
java
package stepDefination; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import org.junit.Assert; import com.app.commonFunctionsLibrary.BaseUtil; import com.app.commonFunctionsLibrary.CommonFunctions; import cucumber.api.java.en.And; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import pages.HRMS_Page; import pages.PMS_Page; public class hrmsapplication extends BaseUtil { static String confvalue; static FileInputStream con; static Properties conf = new Properties(); private BaseUtil base; HRMS_Page hrmspage = new HRMS_Page(base); PMS_Page pmspage = new PMS_Page(base); CommonFunctions lib = new CommonFunctions(); /* * To read the values from config properties * */ public String getConfigValues(String key) throws IOException { String object = System.getProperty("user.dir") + "\\src\\test\\resources\\config\\config.properties"; con = new FileInputStream(object); conf.load(con); confvalue = conf.getProperty(key); return confvalue; } @Given("^Open chrome and start HRMS application$") public void open_chrome_and_start_HRMS_application() throws Throwable { /*hrmspage.launchUrl("HRMSURL"); String actLogValue = hrmspage.getLoginButton(); Assert.assertEquals("Login", actLogValue);*/ } @When("^Login as HR on HRMS application$") public void login_as_HR_on_HRMS_application() throws IOException { /*hrmspage.sendCredentials("pmsHrUserName"); hrmspage.clickLoginButton();*/ } @Then("^HR should able to see the HRMS home page$") public void hr_should_able_to_see_the_HRMS_home_page() throws Throwable { /*pmspage.verifypageTitle("hrmsAdminPageTitle");*/ } @And("^create a new user and verify$") public void create_a_new_user_and_verify() throws Throwable { /*hrmspage.clickUserTab(); String actval = lib.getValue("hrmsUserTitle"); Assert.assertEquals("Users", actval);*/ } @Then("^HR should able to see created user$") public void hr_should_able_to_see_created_user() throws Throwable { /*hrmspage.createNewUserAndVerify(); hrmspage.logoutHrms();*/ } @And("^Login as created user and update the details$") public void Login_as_created_user_and_update_the_details() throws Throwable { /*hrmspage.launchUrl("HRMSURL"); String actLogValue = hrmspage.getLoginButton(); Assert.assertEquals("Login", actLogValue); hrmspage.sendCredentials("hrmsEmailUser"); hrmspage.clickLoginButton(); pmspage.verifypageTitle("hrmsRegisteredPageTitle"); hrmspage.updateBasicDetails(); hrmspage.updateAcademic(); hrmspage.updateEmployment(); hrmspage.updateCertification(); hrmspage.updateFamily(); hrmspage.updateEmployeeDocuments();*/ } @Then("^User should able to see the updated details$") public void User_should_able_to_see_the_updated_details() throws Throwable { /*hrmspage.updateEmployeeSkills (getConfigValues("hrmsSkillSet"));*/ } @And("^Logout the application and login as HR$") public void Logout_the_application_and_login_as_HR() { /*hrmspage.logoutHrms();*/ } @Then("^Verify the created employee details$") public void Verify_the_created_employee_details() throws InterruptedException, IOException { hrmspage.launchUrl("HRMSURL"); String actLogValue = hrmspage.getLoginButton(); Assert.assertEquals("Login", actLogValue); hrmspage.sendCredentials("pmsHrUserName"); hrmspage.clickLoginButton(); pmspage.verifypageTitle("hrmsAdminPageTitle"); hrmspage.clickOnEmployeesSideMenuAndChooseActiveEmployee(); hrmspage.searchEmployee(getConfigValues("hrmsEmailUser")); hrmspage.validateExistingUser(); hrmspage.logoutHrms(); } }
[ "DDominicraj@corp.encoress.com" ]
DDominicraj@corp.encoress.com
a35ee9bc5423aeae2e09b3b6ab40bd77dfa20ac8
9c4914ef96a8814a37e8a30a62cae43cb626b1e0
/app/src/main/java/my/burger/now/app/MainActivity.java
b20dd219d85a354a1cf425946920642d145427bc
[]
no_license
jackfreelance/MyBurgerNowAndroid
f79f8101688a03af0e45da6aebc90eb6d9925663
309dd57dbb595897040bda0047d7f91b6ef11881
refs/heads/master
2021-01-12T12:19:46.543865
2016-10-31T12:40:27
2016-10-31T12:40:27
72,433,474
0
0
null
null
null
null
UTF-8
Java
false
false
7,381
java
package my.burger.now.app; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.ComponentName; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.RadioGroup; import my.burger.now.app.configuration.Configuration; import my.burger.now.app.connexion.AsyncPostService; import my.burger.now.app.connexion.LogOut; import my.burger.now.app.connexion.MyTestReceiver; import org.json.JSONException; import org.json.JSONObject; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MainActivity extends AppCompatActivity { EditText _emailText; EditText _passwordText; AlertDialog.Builder dialog = null; RadioGroup rg; int loco = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); ImageView logo = new ImageView(this); logo.setImageResource(R.mipmap.ic_logo); rg = (RadioGroup) findViewById(R.id.radiog); setSupportActionBar(toolbar); getSupportActionBar().setIcon(getResources().getDrawable(R.mipmap.ic_burgeur)); getSupportActionBar().setDisplayShowTitleEnabled(false); stpServ(null); //–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––// _emailText = (EditText)findViewById(R.id.editText_email); _passwordText = (EditText)findViewById(R.id.editText_password); dialog = new AlertDialog.Builder(this); dialog.setCancelable(false); dialog.setPositiveButton("OK", null); new LogOut(MainActivity.this).logout(); } public boolean validate() { boolean valid = true; String email = _emailText.getText().toString(); String password = _passwordText.getText().toString(); if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) { dialog.setTitle(getResources().getString(R.string.lb_tt_erreur_email)); dialog.setMessage(getResources().getString(R.string.lb_tt_instruction_email_err)); valid = false; } else { _emailText.setError(null); if (password.isEmpty() || password.length() < 5 || password.length() > 20) { dialog.setTitle(getResources().getString(R.string.lb_tt_erreur_mdp)); dialog.setMessage(password+""+getResources().getString(R.string.lb_tt_instruction_mdp_err)); valid = false; } else { _passwordText.setError(null); } } return valid; } public void toAceuil(View v){ if (!validate()) { onLoginFailed(); return; } final ProgressDialog progressDialog = new ProgressDialog(MainActivity.this, R.style.Theme_AppCompat_Dialog); progressDialog.setIndeterminate(true); progressDialog.setMessage("Authenticating..."); progressDialog.show(); String email = _emailText.getText().toString(); String password = _passwordText.getText().toString(); // TODO: Implement your own authentication logic here. new android.os.Handler().postDelayed( new Runnable() { public void run() { // On complete call either onLoginSuccess or onLoginFailed onLoginSuccess(); // onLoginFailed(); progressDialog.dismiss(); } }, 3000); } public void stpServ(View v){ PackageManager pm = MainActivity.this.getPackageManager(); ComponentName componentName = new ComponentName(MainActivity.this, MyTestReceiver.class); pm.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } public void onLoginSuccess() { String usr = null; try { JSONObject user = new JSONObject(); user.put("mail", _emailText.getText().toString()); try { user.put("pwd", SHA1(_passwordText.getText().toString())); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } usr = user.toString(); } catch (JSONException e) { e.printStackTrace(); } //String[] name = new String[]{"mail","pwd"}; String[] name = new String[]{"action","login","password","locomotion"}; String[] value = new String[0]; SharedPreferences preferences = PreferenceManager .getDefaultSharedPreferences(this); SharedPreferences.Editor editor = preferences.edit(); editor.putString("email", _emailText.getText().toString()); int selectedId=rg.getCheckedRadioButtonId(); if(selectedId==R.id.radioButtonApied){ loco = 1; }else if(selectedId==R.id.radioButtonAroulette){ loco = 2; }else{ loco = 3; } try { editor.putString("pwd", SHA1(_passwordText.getText().toString())); editor.commit(); value = new String[]{"login",_emailText.getText().toString(),SHA1(_passwordText.getText().toString()),""+loco}; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } AsyncPostService login = new AsyncPostService(this,name,value, Configuration.IPWEB+"/webapp/f/fonctions2.php"); login.execute(); } public void onLoginFailed() { dialog.show(); } private static String convertToHex(byte[] data) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < data.length; i++) { int halfbyte = (data[i] >>> 4) & 0x0F; int two_halfs = 0; do { if ((0 <= halfbyte) && (halfbyte <= 9)) { buf.append((char) ('0' + halfbyte)); } else { buf.append((char) ('a' + (halfbyte - 10))); } halfbyte = data[i] & 0x0F; } while(two_halfs++ < 1); } return buf.toString(); } public static String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] sha1hash = new byte[40]; md.update(text.getBytes("iso-8859-1"), 0, text.length()); sha1hash = md.digest(); return convertToHex(sha1hash); } }
[ "stg.dev.jack@et.in" ]
stg.dev.jack@et.in
2397b5c8242c746d8b32d004d0dc003b602fe0a8
0d62ea4e9f215ed8fcd74d43ea6e60033f0b3786
/src/model/VisiteurExpression.java
a7fbffb7e60a6a2b2d6311f499baca1c4f694410
[]
no_license
dadou666/LgBasic
a8ce86cac491e25c7b4d6f390754ed4c906150f4
ef2082305feeddbc282834c1305d05f554f0127d
refs/heads/master
2021-07-12T03:03:39.117921
2019-02-03T10:27:39
2019-02-03T10:27:39
139,249,239
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package model; public interface VisiteurExpression { public void visiter(Objet objet); public void visiter(Appel appel); public void visiter(TestType testType); public void visiter(Acces acces); public void visiter(VarRef varRef); public void visiter(Literal literal); }
[ "david.besnard666@gmail.com" ]
david.besnard666@gmail.com
f45616db6159a9325ca27a0eaa905d1eb97b9013
c2a2331d4360cdda82e268cc2e10acadd79598e9
/src/main/java/CalendarQuickstart.java
3b9ec07b6752173b13103d40bec6d829f74a4199
[]
no_license
Rakirnd/CalendarAPITest
65ab81dfc75006b97f1deed3f07070898696f259
ae53e8d09d46c412b87e12a6f43d31e5c0e60723
refs/heads/main
2023-04-26T13:36:43.780970
2021-05-23T11:20:17
2021-05-23T11:20:17
370,032,626
0
0
null
null
null
null
UTF-8
Java
false
false
4,385
java
import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp; import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.gson.GsonFactory; import com.google.api.client.util.DateTime; import com.google.api.client.util.store.FileDataStoreFactory; import com.google.api.services.calendar.Calendar; import com.google.api.services.calendar.CalendarScopes; import com.google.api.services.calendar.model.Event; import com.google.api.services.calendar.model.Events; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.security.GeneralSecurityException; import java.util.Collections; import java.util.List; public class CalendarQuickstart { private static final String APPLICATION_NAME = "Google Calendar API Java Quickstart"; private static final JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance(); private static final String TOKENS_DIRECTORY_PATH = "tokens"; /** * Global instance of the scopes required by this quickstart. * If modifying these scopes, delete your previously saved tokens/ folder. */ private static final List<String> SCOPES = Collections.singletonList(CalendarScopes.CALENDAR_READONLY); private static final String CREDENTIALS_FILE_PATH = "credentials.json"; /** * Creates an authorized Credential object. * @param HTTP_TRANSPORT The network HTTP Transport. * @return An authorized Credential object. * @throws IOException If the credentials.json file cannot be found. */ private static Credential getCredentials(final NetHttpTransport HTTP_TRANSPORT) throws IOException { // Load client secrets. InputStream in = CalendarQuickstart.class.getResourceAsStream(CREDENTIALS_FILE_PATH); if (in == null) { throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH); } GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)); // Build flow and trigger user authorization request. GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES) .setDataStoreFactory(new FileDataStoreFactory(new java.io.File(TOKENS_DIRECTORY_PATH))) .setAccessType("offline") .build(); LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build(); return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user"); } public static void main(String... args) throws IOException, GeneralSecurityException { // Build a new authorized API client service. final NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport(); Calendar service = new Calendar.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredentials(HTTP_TRANSPORT)) .setApplicationName(APPLICATION_NAME) .build(); // List the next 10 events from the primary calendar. DateTime now = new DateTime(System.currentTimeMillis()); Events events = service.events().list("primary") .setMaxResults(10) .setTimeMin(now) .setOrderBy("startTime") .setSingleEvents(true) .execute(); List<Event> items = events.getItems(); if (items.isEmpty()) { System.out.println("No upcoming events found."); } else { System.out.println("Upcoming events"); for (Event event : items) { DateTime start = event.getStart().getDateTime(); if (start == null) { start = event.getStart().getDate(); } System.out.printf("%s (%s)\n", event.getSummary(), start); } } } }
[ "admin@0000LPF1PN2D5.BT.WAN" ]
admin@0000LPF1PN2D5.BT.WAN
ee541b71820451f0f6f4257ece77d2d06ece644e
29ea9870260cca46f22b2562702cfab7c87bb7f7
/sms-open-api-dist/src/main/java/com/leonzhangxf/sms/api/MessageV1Api.java
fb2b7beea08035cbe7e5f573c32df766ad0ba9b8
[ "Apache-2.0" ]
permissive
leonzhangxf/sms
92b38e482f5369e108be34c762eb65e6b9e223c8
59abd6bc58ed5743f390150222aed4355d3350a6
refs/heads/master
2023-01-19T13:36:31.729101
2020-03-13T04:31:18
2020-03-13T04:31:18
246,988,351
0
0
Apache-2.0
2023-01-04T14:34:26
2020-03-13T04:30:46
Java
UTF-8
Java
false
false
4,442
java
package com.leonzhangxf.sms.api; import com.leonzhangxf.sms.domain.dto.MessageV1DTO; import com.leonzhangxf.sms.exception.SingleMessageException; import com.leonzhangxf.sms.message.MessageResponse; import com.leonzhangxf.sms.service.MessageService; import com.leonzhangxf.sms.enumeration.SendResponseStatus; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @Api(tags = "V1版本") @RestController @RequestMapping("v1") public class MessageV1Api { private Logger logger = LoggerFactory.getLogger(MessageV1Api.class); private MessageService messageService; @ApiOperation(value = "短信服务发送短信接口V1版本", notes = "需要根据参数使用HmacSHA256签名算法生成签名。" + "将参数拼接为“mobile_templateId_timestamp”,并同时传入下发的key,进行签名。将生成的签名一同加入请求参数。") @PostMapping("message") public ResponseEntity<String> message(@Validated @ModelAttribute MessageV1DTO message, BindingResult validateResult) { // 1.参数校验 // 1.1初步校验 if (validateResult.hasErrors()) { FieldError error = validateResult.getFieldError(); if (null != error) { String errorMessage = error.getDefaultMessage(); return ResponseEntity.badRequest().body(errorMessage); } } // 2.短信发送,并异步保存发送日志 MessageResponse response; try { response = messageService.singleMessageV1(message); } catch (SingleMessageException ex) { logger.error("短信服务商未知错误,参数列表:{},异常信息:{}", message, ex.getMessage()); return ResponseEntity.status(ex.getStatus()).body(ex.getMessage()); } if (null == response) { logger.error("短信服务商未知错误,参数列表:{},没有响应。", message); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("获取短信服务商响应异常,请稍后再试!"); } // 3.处理响应 ResponseEntity<String> res; switch (response.getResponseStatus()) { case OK: res = ResponseEntity.ok("短信发送成功"); break; case BAD_REQUEST: logger.warn("请求短信服务商异常,参数列表:{},请求响应:{}", message, response); res = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("请求短信服务商异常,请稍后再试!"); break; case FORBIDDEN: logger.info("短信请求渠道限流,参数列表:{},请求响应:{}", message, response); res = ResponseEntity.status(HttpStatus.FORBIDDEN).body("短信渠道限流,请稍后再试!"); break; case INTERNAL_SERVER_ERROR: logger.warn("短信服务商响应异常,参数列表:{},请求响应:{}", message, response); res = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("短信服务商响应异常,请稍后再试!"); break; default: logger.error("短信服务商未知错误,参数列表:{},请求响应:{}", message, response); res = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("短信服务商未知错误,请稍后再试!"); } return res; } @Autowired public void setMessageService(MessageService messageService) { this.messageService = messageService; } }
[ "leon_zhangxf@qq.com" ]
leon_zhangxf@qq.com
be99f0a9b3e03e48f6980935504dcc254a8f3154
e39469a2286b37b1daa633eb5b564bd36fb69f24
/Closest_Number_In_Binary_Search_Tree/src/Solution.java
1ec65c8c7a56eb6b21421d3461443b9e8a028250
[]
no_license
meilanlin/Algorithm-Questions-Code
5c4ac09cd42ff3e062845be82ad9dc2bbc14d908
9a7681c0c54b2ebde56d954655e731bc33bf8b29
refs/heads/master
2020-04-17T09:55:54.276034
2019-08-14T20:42:27
2019-08-14T20:42:27
166,480,074
0
1
null
null
null
null
UTF-8
Java
false
false
1,559
java
/* In a binary search tree, find the node containing the closest number to the given target number. Assumptions: The given root is not null. There are no duplicate keys in the binary search tree. Examples: 5 / \ 2 11 / \ 6 14 closest number to 4 is 5 closest number to 10 is 11 closest number to 6 is 6 How is the binary tree represented? We use the level order traversal sequence with a special symbol "#" denoting the null node. For Example: The sequence [1, 2, 3, #, #, 4] represents the following binary tree: 1 / \ 2 3 / 4 https://app.laicode.io/app/problem/135 */ /** * public class TreeNode { * public int key; * public TreeNode left; * public TreeNode right; * public TreeNode(int key) { * this.key = key; * } * } */ public class Solution { public int closest(TreeNode root, int target) { int globalDiff = Math.abs(target - root.key); int result = root.key; // use bfs Queue<TreeNode> queue = new LinkedList<>(); queue.offer(root); int size = queue.size(); while(size != 0){ TreeNode cur = queue.poll(); if(cur.key == target) return cur.key; int localDiff = Math.abs(target - cur.key); if(localDiff < globalDiff) { globalDiff = localDiff; result = cur.key; } if(cur.key < target && cur.right != null){ queue.offer(cur.right); }else if(cur.key > target && cur.left != null){ queue.offer(cur.left); } size = queue.size(); } return result; } }
[ "victorlizonglin@gmail.com" ]
victorlizonglin@gmail.com
6334a95c2002fc167d30a3cc4e294f59c785fabe
1f7db7080ee9a0b855854c8702a1835aff741a5a
/060-time-window/contracts/src/test/java/com/template/proposal/state/SalesProposalTests.java
bf049aea33d7a98665326008ea37016fcfd604d0
[]
no_license
chrischabot/corda-training-code
2f6f1a246d071aa21c2332cb4ef46b2ecd44ab66
c7ad2ef8c1f79f85606140ccd847676fdda474c8
refs/heads/master
2022-05-30T10:51:09.229620
2020-05-07T12:21:57
2020-05-07T12:21:57
262,039,581
0
0
null
null
null
null
UTF-8
Java
false
false
8,374
java
package com.template.proposal.state; import com.r3.corda.lib.tokens.contracts.states.NonFungibleToken; import com.r3.corda.lib.tokens.contracts.types.IssuedTokenType; import com.r3.corda.lib.tokens.contracts.types.TokenType; import com.r3.corda.lib.tokens.money.FiatCurrency; import net.corda.core.contracts.*; import net.corda.core.crypto.SecureHash; import net.corda.core.identity.AbstractParty; import net.corda.core.identity.CordaX500Name; import net.corda.core.identity.Party; import net.corda.testing.core.TestIdentity; import org.junit.Test; import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.Arrays; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; public class SalesProposalTests { private final Party notary = new TestIdentity( new CordaX500Name("Notary", "Washington D.C.", "US")).getParty(); private final Party usMint = new TestIdentity( new CordaX500Name("US Mint", "Washington D.C.", "US")).getParty(); private final AbstractParty alice = new TestIdentity( new CordaX500Name("Alice", "London", "GB")).getParty(); private final AbstractParty bob = new TestIdentity( new CordaX500Name("Bob", "New York", "US")).getParty(); private final AbstractParty carly = new TestIdentity( new CordaX500Name("Carly", "New York", "US")).getParty(); private final TokenType usd = FiatCurrency.Companion.getInstance("USD"); private final IssuedTokenType mintUsd = new IssuedTokenType(usMint, usd); private final Amount<IssuedTokenType> amount1 = new Amount<>(15L, mintUsd); private final Amount<IssuedTokenType> amount2 = new Amount<>(20L, mintUsd); private final NonFungibleToken aliceNFToken = new NonFungibleToken( mintUsd, alice, new UniqueIdentifier(), null); private final NonFungibleToken bobNFToken = new NonFungibleToken( mintUsd, bob, new UniqueIdentifier(), null); private final StateAndRef<NonFungibleToken> aliceRef1 = new StateAndRef<>( new TransactionState<>(aliceNFToken, notary), new StateRef(SecureHash.randomSHA256(), 0)); private final StateAndRef<NonFungibleToken> aliceRef2 = new StateAndRef<>( new TransactionState<>(aliceNFToken, notary), new StateRef(SecureHash.randomSHA256(), 1)); private final StateAndRef<NonFungibleToken> bobRef1 = new StateAndRef<>( new TransactionState<>(bobNFToken, notary), new StateRef(SecureHash.randomSHA256(), 0)); private final Instant oneMinuteAway = Instant.now().plus(Duration.ofMinutes(1)); @Test(expected = NullPointerException.class) public void cannotConstructWithNullLinearId() { //noinspection ConstantConditions new SalesProposal(null, aliceRef1, bob, amount1, oneMinuteAway); } @Test(expected = NullPointerException.class) public void cannotConstructWithNullAsset() { //noinspection ConstantConditions new SalesProposal(new UniqueIdentifier(), null, bob, amount1, oneMinuteAway); } @Test(expected = NullPointerException.class) public void cannotConstructWithNullBuyer() { //noinspection ConstantConditions new SalesProposal(new UniqueIdentifier(), aliceRef1, null, amount1, oneMinuteAway); } @Test(expected = NullPointerException.class) public void cannotConstructWithNullPrice() { //noinspection ConstantConditions new SalesProposal(new UniqueIdentifier(), aliceRef1, bob, null, oneMinuteAway); } @Test(expected = NullPointerException.class) public void cannotConstructWithNullExpirationDate() { //noinspection ConstantConditions new SalesProposal(new UniqueIdentifier(), aliceRef1, bob, amount1, null); } @Test public void canConstructWithSameSellerAndBuyer() { final SalesProposal proposal = new SalesProposal(new UniqueIdentifier(), aliceRef1, alice, amount1, oneMinuteAway); assertEquals(proposal.getSeller(), proposal.getBuyer()); } @Test public void participantsAreBoth() { final SalesProposal proposal = new SalesProposal(new UniqueIdentifier(), aliceRef1, bob, amount1, oneMinuteAway); assertEquals(proposal.getParticipants(), Arrays.asList(alice, bob)); } @Test public void gettersWork() { final UniqueIdentifier linearId = new UniqueIdentifier(); final SalesProposal proposal = new SalesProposal(linearId, aliceRef1, carly, amount1, oneMinuteAway); assertEquals(linearId, proposal.getLinearId()); assertEquals(aliceRef1, proposal.getAsset()); assertEquals(alice, proposal.getSeller()); assertEquals(carly, proposal.getBuyer()); assertEquals(amount1, proposal.getPrice()); assertEquals(oneMinuteAway, proposal.getExpirationDate()); } @Test public void equalsDependsOnAllElements() { final UniqueIdentifier linearId1 = new UniqueIdentifier(); final UniqueIdentifier linearId2 = new UniqueIdentifier(); assertEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway), new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway)); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway), new SalesProposal(linearId2, aliceRef1, bob, amount1, oneMinuteAway)); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway), new SalesProposal(linearId1, aliceRef2, bob, amount1, oneMinuteAway)); assertNotEquals( new SalesProposal(linearId1, aliceRef1, carly, amount1, oneMinuteAway), new SalesProposal(linearId1, bobRef1, carly, amount1, oneMinuteAway)); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway), new SalesProposal(linearId1, aliceRef1, carly, amount1, oneMinuteAway)); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway), new SalesProposal(linearId1, aliceRef1, bob, amount2, oneMinuteAway)); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway), new SalesProposal(linearId1, aliceRef1, bob, amount1, Instant.now().plus(2, ChronoUnit.MINUTES))); } @Test public void hashCodeDependsOnAllElements() { final UniqueIdentifier linearId1 = new UniqueIdentifier(); final UniqueIdentifier linearId2 = new UniqueIdentifier(); assertEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway).hashCode(), new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway).hashCode()); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway).hashCode(), new SalesProposal(linearId2, aliceRef1, bob, amount1, oneMinuteAway).hashCode()); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway).hashCode(), new SalesProposal(linearId1, aliceRef2, bob, amount1, oneMinuteAway).hashCode()); assertNotEquals( new SalesProposal(linearId1, aliceRef1, carly, amount1, oneMinuteAway).hashCode(), new SalesProposal(linearId1, bobRef1, carly, amount1, oneMinuteAway).hashCode()); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway).hashCode(), new SalesProposal(linearId1, aliceRef1, carly, amount1, oneMinuteAway).hashCode()); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway).hashCode(), new SalesProposal(linearId1, aliceRef1, bob, amount2, oneMinuteAway).hashCode()); assertNotEquals( new SalesProposal(linearId1, aliceRef1, bob, amount1, oneMinuteAway).hashCode(), new SalesProposal(linearId1, aliceRef1, bob, amount1, Instant.now().plus(2, ChronoUnit.MINUTES)).hashCode()); } }
[ "xavierlepretre@users.noreply.github.com" ]
xavierlepretre@users.noreply.github.com
6b775f9cf43e815733efd88f79c4a67b06607836
80237245a1208388286ad236999c24491554c045
/app/src/main/java/com/example/skarwa/letmeethappen/fragments/PastEventsFragment.java
4ecda3b1f5186f25536f1999fd5a8c1b6f132108
[ "Apache-2.0" ]
permissive
CodepathGroup8-JenniferSonali/LetMeetHappen
37886b90cac1106fe0a0ab76170377c5b08f75df
ece6158750f67c177fdd0f12dfc972b219034311
refs/heads/master
2021-07-23T02:30:13.468345
2017-10-31T16:25:10
2017-10-31T16:25:10
106,121,088
0
0
null
2017-10-10T04:01:52
2017-10-07T18:30:29
Java
UTF-8
Java
false
false
896
java
package com.example.skarwa.letmeethappen.fragments; import android.os.Bundle; import android.support.annotation.Nullable; import com.example.skarwa.letmeethappen.models.Event; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.Query; /** * Created by jennifergodinez on 10/2/17. */ public class PastEventsFragment extends EventsListFragment { private static final String TAG = "PastEventsFragment"; @Override public Query getQuery(DatabaseReference databaseReference) { Query query = FirebaseDatabase.getInstance() .getReference() .child(USER_EVENTS) .child(getUid()) .orderByChild("eventStatus") .equalTo("SUCCESSFUL"); //TODO : change this to fetch past events return query; } }
[ "skarwa@vmware.com" ]
skarwa@vmware.com
69d2e3e1d3205e7917c913e2877573c250d0d85a
bbd17175acd5b6af517b9da0ac2fa3d4d2ee7cb1
/WebSearch/src/GoogleQuery.java
70ad4b76177605c7d7e25ca662af22892a0d4a5a
[]
no_license
107306010/SearchEngineProject
395301559fdb92f19c90a56ccf410ced9b3dd937
041e3d483d4e82f8aa05662ed92d727349570a22
refs/heads/master
2023-03-13T18:44:39.047059
2021-03-07T17:26:18
2021-03-07T17:26:18
254,779,483
0
1
null
null
null
null
UTF-8
Java
false
false
2,620
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.HashMap; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.net.URLEncoder; public class GoogleQuery { public String searchKeyword; public String url; public String content; public String time; HashMap<String, String> title_time = new HashMap<String, String>();//store title and time public Boolean results=true; public GoogleQuery(String searchKeyword) { this.searchKeyword = searchKeyword; this.url = "https://news.google.com/search?q="+encodeURL(searchKeyword)+"&hl=zh-TW&gl=TW&ceid=TW%3Azh-Hant"; } public String fetchContent() throws IOException { String retVal = ""; URL u = new URL(url); URLConnection conn = u.openConnection(); conn.setRequestProperty("User-agent", "Chrome/7.0.517.44"); InputStream in = conn.getInputStream(); InputStreamReader inReader = new InputStreamReader(in,"utf-8"); BufferedReader bufReader = new BufferedReader(inReader); String line = null; while((line=bufReader.readLine())!=null) { retVal += line; } return retVal; } public HashMap<String, String> query() throws IOException { if(content==null) { content= fetchContent(); } HashMap<String, String> retVal = new HashMap<String, String>(); Document doc = Jsoup.parse(content); Elements lis = doc.select("div"); lis = lis.select(".NiLAwe"); for(Element li : lis) { try { String title = li.select(".DY5T1d").get(0).text(); String citeUrl = "https://news.google.com" + li.select("a").get(0).attr("href").substring(1); if(li.select(".ww6dff").size()!=0) { time=li.select(".WW6dff").get(0).attr("datetime").substring(0,10); } //we directly catch the URL in google search page so the results //we catch may have some unnecessary web sites.Thus, we need to add 'googleURL' to //connect the web page title_time.put(title,time); retVal.put(title, citeUrl); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); } } return retVal; } public static String encodeURL(String url) { try { String encodeURL = URLEncoder.encode( url, "UTF-8" ); return encodeURL; } catch (UnsupportedEncodingException e) { return "Error: " + e.getMessage(); } } }
[ "Timmy0823777@gmail.com" ]
Timmy0823777@gmail.com
48c60cbcba7f9482dfafddb73dbf24d17fbccaa8
0f17744866189335207d85a84c2e55426782b2d7
/app/src/main/java/com/example/rentalapp/Alerts.java
c3a99406af64ce9cfd66787d14b112c4958f128f
[]
no_license
VigneshEetaram/Apartment_Rental_Application
d9677801e19695e243467f38e2c215bca7b4f121
bf59a8f59c7b4ab5a9717244a0297cd494cfc0ea
refs/heads/master
2023-03-19T03:16:45.677657
2021-03-09T01:25:55
2021-03-09T01:25:55
330,565,553
0
1
null
2021-02-15T00:14:39
2021-01-18T05:40:06
Java
UTF-8
Java
false
false
880
java
package com.example.rentalapp; public class Alerts { String date,title,description,id; public Alerts(String date, String title, String description, String id) { this.date = date; this.title = title; this.description = description; this.id = id; } public Alerts() { } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getId() { return id; } public void setId(String id) { this.id = id; } }
[ "jobingrg52@gmail.com" ]
jobingrg52@gmail.com
6d365e017f8aa7c04c52f69299e96e3ec76fa146
0486641be9ea8df8a73150d6bc22642af068569c
/Documents/NetBeansProjects/TP3_DesignPattern_Test/src/test/java/BuilderPatternJUnitTest.java
eb5a8e233c033a7622176b7a98484851d17fbd89
[]
no_license
bonganiklaas/Assignment5_DesignPatterns
4759d7a32ec0031f3aac2153e0f6fe05e72e0386
fa5eda78027b3d1af276f0920cbb81bc0466abdc
refs/heads/master
2021-01-13T02:37:08.787503
2015-03-24T18:22:33
2015-03-24T18:22:33
32,816,685
0
1
null
null
null
null
UTF-8
Java
false
false
1,635
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import com.bongani.tp3_designpattern_test.DesignPatters.builderpattern.Meal; import com.bongani.tp3_designpattern_test.DesignPatters.builderpattern.MealBuilder; import com.bongani.tp3_designpattern_test.DesignPatters.builderpattern.MealDirector; import com.bongani.tp3_designpattern_test.DesignPatters.builderpattern.ItalianMealBuilder; import com.bongani.tp3_designpattern_test.DesignPatters.builderpattern.JapaneseMealBuilder; import org.junit.*; /** * * @author Bongani klaas */ public class BuilderPatternJUnitTest { public BuilderPatternJUnitTest() { } @BeforeClass public static void setUpClass() throws Exception { } @AfterClass public static void tearDownClass() throws Exception { } @Before public void setUp() { } @After public void tearDown() { } // TODO add test methods here. // The methods must be annotated with annotation @Test. For example: // @Test public void testBuilderPattern() { MealBuilder mealBuilder = new ItalianMealBuilder (); MealDirector mealDirector = new MealDirector(mealBuilder); mealDirector .constructMeal () ; Meal meal = mealDirector .getMeal() ; System .out.println("Meal is : " + meal); mealBuilder = new JapaneseMealBuilder () ; mealDirector = new MealDirector(mealBuilder); mealDirector .constructMeal () ; meal = mealDirector .getMeal() ; System .out.println("Meal is : " + meal); } }
[ "BKLAAS1@L001F16100C29.capetown.gov.za" ]
BKLAAS1@L001F16100C29.capetown.gov.za
ffe28d0e34a94a4c95995767587a1f54d6002409
fb8186a72923b4c8e89cc65a64b911b99c0e6b83
/price/src/main/java/com/qzl/controller/PrizeController.java
798667f44e4e4de65c89f36092bb2c14a27fbbb0
[]
no_license
zoudmbean/qzl_prize
69ccc5a34294b74bc4711e6fdd8df04857d73ed9
57ee7affaa7b5340ac1a8fad01fe4612a39ec6a0
refs/heads/master
2022-12-27T09:23:49.670918
2020-09-22T14:44:24
2020-09-22T14:44:24
297,680,301
1
0
null
null
null
null
UTF-8
Java
false
false
756
java
package com.qzl.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.qzl.pojo.Price; import com.qzl.service.IPriceService; import com.qzl.util.ResultEntity; /**奖品管理 * @author Administrator * */ @RestController @RequestMapping("/price") public class PrizeController { @Autowired private IPriceService priceService; /** 添加奖品 * @param price * @return */ @PostMapping("/add") public ResultEntity<String> addPrice(Price price){ return priceService.addPrice(price); } }
[ "zoudmbean@163.com" ]
zoudmbean@163.com
2a3a13be71c6490ac9c06e33fc5f5dea0378fe48
8618354b67bef48eacfb844e7464b4640f81809c
/src/main/java/com/is/pretrst/entity/query/DReportQuery.java
70e726d8c707be898e54fe18abd04b623f3166a5
[]
no_license
jinyu-liang/isms
d20e0118f9f92294fa69e999ead03e62eb76311e
9cefd53111673e9bbe4fc1c9f7099a8701cae779
refs/heads/master
2020-05-29T14:36:04.398721
2020-05-09T06:56:37
2020-05-09T06:56:37
65,609,375
1
0
null
null
null
null
UTF-8
Java
false
false
2,151
java
package com.is.pretrst.entity.query; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import com.is.pretrst.entity.DReport; /** * * @ClassName: DReport * @Description: DReport表的对应的查询对象,增加Date/Double/int型字段的区间查询属性字段 * @author * @date 2013-09-11 17:24:27 * */ public class DReportQuery extends DReport { private static final long serialVersionUID = 1L; /** * Integer字段:number 的查询条件 */ /* 查询条件:Number 的开始区间 */ private Integer numberStart; public Integer getNumberStart(){ return numberStart; } public void setNumberStart(Integer numberStart){ this.numberStart = numberStart; } /* 查询条件:number 的结束区间 */ private Integer numberEnd; public Integer getNumberEnd(){ return numberEnd; } public void setNumberEnd(Integer numberEnd){ this.numberEnd = numberEnd; } public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("reportId",getReportId()) .append("title",getTitle()) .append("projectCode",getProjectCode()) .append("projName",getProjName()) .append("unitPrice",getUnitPrice()) .append("amount",getAmount()) .append("number",getNumber()) .append("numberStart",getNumberStart()) .append("numberEnd",getNumberEnd()) .append("memo",getMemo()) .append("reportUserCd",getReportUserCd()) .append("reportTm",getReportTm()) .append("processUserCd",getProcessUserCd()) .append("processTm",getProcessTm()) .append("statusCd",getStatusCd()) .append("verifiedUserCd",getVerifiedUserCd()) .append("verifiedHeadTm",getVerifiedHeadTm()) .append("verifiedHeadMemo",getVerifiedHeadMemo()) .append("verifiedHeadStatus",getVerifiedHeadStatus()) .toString(); } }
[ "ljyshiqian@126.com" ]
ljyshiqian@126.com
7ec104c3162e2fac92e792f2a51e6e2b3d1564a7
c44fe4620cc675f67fe3a8f2beabfd9f633009f7
/source/com/quattroresearch/antibody/plugin/QRClassLoader.java
ba7a2da1a36c24ee3123fa17c294179d967d552d
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
PistoiaHELM/HELMAntibodyEditor
93c5d112fae58b9b00329b4e2945eca97659af48
0501027254cf7d04c10c914928987b2d904edb7c
refs/heads/master
2021-01-10T21:46:23.183666
2017-11-14T23:38:19
2017-11-14T23:38:19
33,665,627
7
4
null
2017-11-14T23:38:20
2015-04-09T11:39:27
Java
UTF-8
Java
false
false
3,832
java
/******************************************************************************* * Copyright C 2015, quattro research GmbH, Roche pREDi (Roche Innovation Center Penzberg) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ package com.quattroresearch.antibody.plugin; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; /** * * {@code QRClassLoader} loads class from a list of jar files. Derived from a solution by <a * href="http://weblogs.java.net/blog/malenkov/archive/2008/07/how_to_load_cla.html">Sergey Malenkov</a> * * @author <b>Stefan Klostermann:</b> Stefan DOT Klostermann AT roche DOT com, Roche Pharma Research and Early * Development - Informatics, Roche Innovation Center Penzberg * @author <b>Marco Erdmann</b> erdmann AT quattro-research DOT com, quattro research GmbH * @author <b>Marco Lanig:</b> lanig AT quattro-research DOT com, quattro research GmbH * * @version $Id: QRClassLoader.java 15209 2015-03-09 10:24:30Z schirmb $ */ public class QRClassLoader extends ClassLoader { List<File> jarFiles; public QRClassLoader(List<File> jarFiles) { this.jarFiles = jarFiles; } @Override protected Class<?> findClass(String name) throws ClassNotFoundException { Class<?> alreadyLoadedClass = findLoadedClass(name); if (alreadyLoadedClass != null) { return alreadyLoadedClass; } try { for (File jar : jarFiles) { Class<?> clazz = findClassInJarFile(name, jar); if (clazz == null) { continue; } else { return clazz; } } throw new ClassNotFoundException("Class " + name + " not found in given list of jarFiles."); } catch (IOException exception) { throw new ClassNotFoundException(name, exception); } } private Class<?> findClassInJarFile(String name, File jar) throws ZipException, IOException { ZipFile jarFile = null; jarFile = new ZipFile(jar); ZipEntry entry = jarFile .getEntry(name.replace('.', '/') + ".class"); if (entry == null) { return null; } else { byte[] buffer = new byte[1024]; InputStream in = jarFile.getInputStream(entry); ByteArrayOutputStream out = new ByteArrayOutputStream( buffer.length); int length = in.read(buffer); while (length > 0) { out.write(buffer, 0, length); length = in.read(buffer); } return defineClass(name, out.toByteArray(), 0, out.size()); } } }
[ "lanig@quattro-research.com" ]
lanig@quattro-research.com
e3a4993f36134b0c39781358a0ac04137baba1a8
c498cefc16ba5d75b54d65297b88357d669c8f48
/gameserver/src/ru/catssoftware/gameserver/gmaccess/handlers/petition.java
e10664e10190ddfbcfb1927561a3f1bd3845a545
[]
no_license
ManWithShotgun/l2i-JesusXD-3
e17f7307d9c5762b60a2039655d51ab36ec76fad
8e13b4dda28905792621088714ebb6a31f223c90
refs/heads/master
2021-01-17T16:10:42.561720
2016-07-22T18:41:22
2016-07-22T18:41:22
63,967,514
1
2
null
null
null
null
UTF-8
Java
false
false
3,290
java
package ru.catssoftware.gameserver.gmaccess.handlers; import ru.catssoftware.Config; import ru.catssoftware.gameserver.gmaccess.gmHandler; import ru.catssoftware.gameserver.instancemanager.PetitionManager; import ru.catssoftware.gameserver.model.L2Object; import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance; import ru.catssoftware.gameserver.network.SystemMessageId; public class petition extends gmHandler { private static final String[] commands = { "view_petitions", "view_petition", "accept_petition", "reject_petition", "reset_petitions", "force_peti", "change_peti_state" }; @Override public void runCommand(L2PcInstance admin, String... params) { if (admin == null) return; final String command = params[0]; L2Object targetChar = admin.getTarget(); int petitionId = -1; try { petitionId = Integer.parseInt(params[1]); } catch (Exception e) { } if (command.equals("view_petitions")) { PetitionManager.getInstance().sendPendingPetitionList(admin); return; } else if (command.equals("view_petition")) { PetitionManager.getInstance().viewPetition(admin, petitionId); return; } else if (command.equals("change_peti_state")) { if(Config.PETITIONING_ALLOWED) { Config.PETITIONING_ALLOWED = false; admin.sendMessage("Петиции отключены"); } else { Config.PETITIONING_ALLOWED = true; admin.sendMessage("Петиции включены"); } return; } else if (command.startsWith("accept_petition")) { if (PetitionManager.getInstance().isPlayerInConsultation(admin)) { admin.sendPacket(SystemMessageId.ONLY_ONE_ACTIVE_PETITION_AT_TIME); return; } if (PetitionManager.getInstance().isPetitionInProcess(petitionId)) { admin.sendPacket(SystemMessageId.PETITION_UNDER_PROCESS); return; } if (!PetitionManager.getInstance().acceptPetition(admin, petitionId)) admin.sendPacket(SystemMessageId.NOT_UNDER_PETITION_CONSULTATION); } else if (command.startsWith("reject_petition")) { if (!PetitionManager.getInstance().rejectPetition(admin, petitionId)) admin.sendPacket(SystemMessageId.FAILED_CANCEL_PETITION_TRY_LATER); } else if (command.equals("reset_petitions")) { if (PetitionManager.getInstance().isPetitionInProcess()) { admin.sendPacket(SystemMessageId.PETITION_UNDER_PROCESS); return; } PetitionManager.getInstance().clearPendingPetitions(); } else if (command.startsWith("force_peti")) { try { if (targetChar == null || !(targetChar instanceof L2PcInstance)) { admin.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); // incorrect target! return; } L2PcInstance targetPlayer = (L2PcInstance) targetChar; String val = ""; if (params.length > 1) { for (int x=1; x < params.length; x++) val += (" " + params[x]); } petitionId = PetitionManager.getInstance().submitPetition(targetPlayer, val, 9); PetitionManager.getInstance().acceptPetition(admin, petitionId); } catch (StringIndexOutOfBoundsException e) { admin.sendMessage("Используйте: //force_peti [text]"); return; } } } @Override public String[] getCommandList() { return commands; } }
[ "u3n3ter7@mail.ru" ]
u3n3ter7@mail.ru
ede0d1c2f22d5dcfabffaffd706adf80843a80a4
08fddad936268a891bc0fba01c8e84b90e4167cf
/spring-security/src/main/java/com/fis/springsecurity/WebSecurityConfig.java
97eb71cb8813297d3718df2c69943c9f67564da7
[]
no_license
Alliot404/FIS_Spring
5352f53de4250b31143a635a472a826b8c9553d1
a4a0dc547b28906cd08f5e961192e9427ba401a9
refs/heads/main
2023-07-15T17:59:11.919904
2021-08-15T12:28:40
2021-08-15T12:28:40
394,170,425
0
0
null
null
null
null
UTF-8
Java
false
false
2,737
java
/* * package com.fis.springsecurity; * * import org.springframework.context.annotation.Bean; import * org.springframework.context.annotation.Configuration; import * org.springframework.security.config.annotation.web.builders.HttpSecurity; * import org.springframework.security.config.annotation.web.configuration. * EnableWebSecurity; import * org.springframework.security.config.annotation.web.configuration. * WebSecurityConfigurerAdapter; import * org.springframework.security.core.userdetails.User; import * org.springframework.security.core.userdetails.UserDetails; import * org.springframework.security.core.userdetails.UserDetailsService; import * org.springframework.security.provisioning.InMemoryUserDetailsManager; * * @Configuration * * @EnableWebSecurity public class WebSecurityConfig extends * WebSecurityConfigurerAdapter { * * @Override protected void configure(HttpSecurity http) throws Exception { http * .authorizeRequests() .antMatchers("/", "/home","/emp/all").permitAll() * .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") * .permitAll() .and() .logout() .permitAll(); } * * @Bean * * @Override public UserDetailsService userDetailsService() { UserDetails user = * User.withDefaultPasswordEncoder() .username("user") .password("password") * .roles("USER") .build(); * * return new InMemoryUserDetailsManager(user); } } */ package com.fis.springsecurity; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.provisioning.InMemoryUserDetailsManager; @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/", "/home","/products","/welcome").permitAll() .anyRequest().authenticated().and() .formLogin().loginPage("/login").permitAll().and().logout().permitAll(); } @Bean @Override public UserDetailsService userDetailsService() { UserDetails user = User.withDefaultPasswordEncoder().username("abhi").password("abhi").roles("USER") .build(); return new InMemoryUserDetailsManager(user); } }
[ "abhilashramu1999@gmail.com" ]
abhilashramu1999@gmail.com
507d4f5d724d3a1cffad2a09a9f19cf9f94cbf6f
f1460a0cd5af7c51c9b96f39e234ce0c5858dfe7
/fr/rexey/posaver/Main.java
34e44c5cce4215c225a5ff5cc4b3ff8ee2fbaa40
[]
no_license
ange64/PoSaver
d9ae1a5efd13a100b3afea1ac1a557c8f21e151e
cfebc4b52b5bb17502a37835156a186403a78bf3
refs/heads/master
2020-04-22T06:38:19.406986
2019-02-11T20:47:12
2019-02-11T20:47:12
170,197,315
0
0
null
null
null
null
UTF-8
Java
false
false
3,830
java
package fr.rexey.posaver; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import java.util.HashMap; public class Main extends JavaPlugin implements Listener { private HashMap<String, IntPos> positions; @Override public void onEnable() { super.onEnable(); positions = new HashMap<>(); for (String key : this.getConfig().getKeys(false)) { positions.put(key, new IntPos(this.getConfig().getString(key))); } } @Override public void onDisable() { super.onDisable(); for (String s : positions.keySet()) { this.getConfig().set(s, positions.get(s).toString()); } saveConfig(); } @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!(sender instanceof Player)) { return false; } Player p = (Player) sender; switch (label) { case "saveposof": return handleSavePosOf(p,args); case "saveposfromchat": return handlesaveposfromchat(p,args); case "showposof": return handleLoadPosOf(p,args); case "listpos": return handleListPos(p); } return true; } private boolean handlesaveposfromchat(Player sender, String[] args) { if( args.length != 4 ){ sender.sendRawMessage("bad formatting : /saveposfromchat name x y z"); } else if( positions.containsKey(args[0])) { sender.sendRawMessage("this position name already exist. be more imaginative !"); return false; } else { IntPos tmp = new IntPos(Integer.valueOf(args[1]),Integer.valueOf(args[2]),Integer.valueOf(args[3])); positions.put(args[0],tmp); sender.sendRawMessage("the position " + tmp.displayString() + " has been saved as " + args[0]); } return true; } private boolean handleSavePosOf(Player sender, String[] args) { if (args.length == 0) { sender.sendRawMessage("you need to name the position"); return false; } else if ( args.length > 1) { sender.sendRawMessage("name of the position must not contain spaces"); return false; } else if( positions.containsKey(args[0])) { sender.sendRawMessage("this position name already exist. be more imaginative !"); return false; } else { IntPos tmp = new IntPos( sender.getLocation()); positions.put(args[0],tmp); sender.sendRawMessage("the position " + tmp.displayString() + " has been saved as " + args[0]); } return true; } private boolean handleLoadPosOf(Player sender, String[] args) { if (args.length == 0) { sender.sendRawMessage("you need to choose the name of the position you want to show"); return false; } else if ( args.length > 1) { sender.sendRawMessage("name of the position must not contain spaces"); return false; } else if( !positions.containsKey(args[0])) { sender.sendRawMessage("this position does not exist"); } else { sender.sendRawMessage(args[0] + " is at " + positions.get(args[0]).displayString() ); } return true; } private boolean handleListPos(Player sender) { if( positions.size() == 0){ sender.sendRawMessage("no positions saved yet"); } else { positions.forEach((s, intPos) -> sender.sendRawMessage(s + " is at " + intPos.displayString() ) ); } return true; } }
[ "ange.wawrzyniak@etu.u-bordeaux.fr" ]
ange.wawrzyniak@etu.u-bordeaux.fr
848b2fed31937e57b2009d28a2f8d3da13615df9
9a6e1bbc0638657747cf31e04acb59c31504f511
/sistema/src/main/java/br/com/xlabi/configuration/CustomResponseEntityExceptionHandler.java
e5381e86df2ec88df7a0c2a9a18341ca94244131
[]
no_license
adrielcordazzo/catedral
1c6c141a1eaeda4e06d28e6d2788443d22568de6
d631deabdd0f0e6d9cbf94559d085842e05178f0
refs/heads/master
2018-09-07T17:21:06.913747
2018-06-04T20:52:28
2018-06-04T20:52:28
112,979,735
0
0
null
null
null
null
UTF-8
Java
false
false
3,304
java
package br.com.xlabi.configuration; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.FieldError; import org.springframework.validation.ObjectError; import org.springframework.web.HttpMediaTypeNotSupportedException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import br.com.xlabi.result.Result; @ControllerAdvice public class CustomResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(Exception.class) protected Result handleError(HttpServletRequest req, Exception ex) { logger.error("Request: " + req.getRequestURL() + " raised " + ex); ex.printStackTrace(); System.out.println("errro 500 sei la 1"); Result result = new Result(); return result; } @Override protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { List<FieldError> fieldErrors = ex.getBindingResult().getFieldErrors(); List<ObjectError> globalErrors = ex.getBindingResult().getGlobalErrors(); Result result = new Result(); for (FieldError fieldError : fieldErrors) { result.addError(fieldError.getField(), fieldError.getDefaultMessage()); } for (ObjectError objectError : globalErrors) { result.addError(objectError.getObjectName(), objectError.getDefaultMessage()); } System.out.println("errro 400 sei la 1" + status.name()); return new ResponseEntity<Object>(result, headers, status); } @Override protected ResponseEntity<Object> handleHttpMediaTypeNotSupported(HttpMediaTypeNotSupportedException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { Result result = new Result(); System.out.println("errro 400 sei la 3" + status.name()); String unsupported = "Unsupported content type: " + ex.getContentType(); String supported = "Supported content types: " + MediaType.toString(ex.getSupportedMediaTypes()); result.addError(unsupported, supported); return new ResponseEntity<Object>(result, headers, status); } @Override protected ResponseEntity<Object> handleHttpMessageNotReadable(HttpMessageNotReadableException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { Throwable mostSpecificCause = ex.getMostSpecificCause(); ex.printStackTrace(); Result result = new Result(); System.out.println("errro 400 sei la 4" + status.name()); if (mostSpecificCause != null) { String exceptionName = mostSpecificCause.getClass().getName(); String message = mostSpecificCause.getMessage(); result.addError(exceptionName, message); } else { result.addErrorMessage(ex.getMessage()); } return new ResponseEntity<Object>(result, headers, status); } }
[ "adrielcordazzo@gmail.com" ]
adrielcordazzo@gmail.com
bffb7241e3f94b2ffdd5446619d3d2f9e014488c
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipseswt_cluster/15600/src_0.java
ccf68d232e7920a9e609b5a6a6859eafd0ff3c12
[]
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
39,321
java
/******************************************************************************* * Copyright (c) 2000, 2007 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.widgets; import org.eclipse.swt.internal.wpf.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; /** * Instances of this class represent a selectable user interface * object that displays a list of strings and issues notification * when a string is selected. A list may be single or multi select. * <p> * <dl> * <dt><b>Styles:</b></dt> * <dd>SINGLE, MULTI</dd> * <dt><b>Events:</b></dt> * <dd>Selection, DefaultSelection</dd> * </dl> * <p> * Note: Only one of SINGLE and MULTI may be specified. * </p><p> * IMPORTANT: This class is <em>not</em> intended to be subclassed. * </p> */ public class List extends Scrollable { boolean ignoreSelection; /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. * Style bits are also inherited from superclasses. * </p> * * @param parent a composite control which will be the parent of the new instance (cannot be null) * @param style the style of control to construct * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> * </ul> * * @see SWT#SINGLE * @see SWT#MULTI * @see Widget#checkSubclass * @see Widget#getStyle */ public List (Composite parent, int style) { super (parent, checkStyle (style)); } /** * Adds the argument to the end of the receiver's list. * * @param string the new item * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #add(String,int) */ public void add (String string) { checkWidget (); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); int item = OS.gcnew_ListBoxItem (); int strPtr = createDotNetString (string, false); OS.ContentControl_Content (item, strPtr); OS.GCHandle_Free (strPtr); int items = OS.ItemsControl_Items (handle); OS.ItemCollection_Add (items, item); OS.GCHandle_Free (items); OS.GCHandle_Free (item); } /** * Adds the argument to the receiver's list at the given * zero-relative index. * <p> * Note: To add an item at the end of the list, use the * result of calling <code>getItemCount()</code> as the * index or use <code>add(String)</code>. * </p> * * @param string the new item * @param index the index for the item * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #add(String) */ public void add (String string, int index) { checkWidget (); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); if (index < 0 || index > getItemCount ()) error (SWT.ERROR_INVALID_RANGE); int item = OS.gcnew_ListBoxItem (); int strPtr = createDotNetString (string, false); OS.ContentControl_Content (item, strPtr); OS.GCHandle_Free (strPtr); int items = OS.ItemsControl_Items (handle); OS.ItemCollection_Insert (items, index, item); OS.GCHandle_Free (items); OS.GCHandle_Free (item); } /** * Adds the listener to the collection of listeners who will * be notified when the user changes the receiver's selection, by sending * it one of the messages defined in the <code>SelectionListener</code> * interface. * <p> * <code>widgetSelected</code> is called when the selection changes. * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked. * </p> * * @param listener the listener which should be notified when the user changes the receiver's selection * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see SelectionListener * @see #removeSelectionListener * @see SelectionEvent */ public void addSelectionListener(SelectionListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection,typedListener); addListener (SWT.DefaultSelection,typedListener); } static int checkStyle (int style) { return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0); } void createHandle () { handle = OS.gcnew_ListBox (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.Selector_IsSynchronizedWithCurrentItem (handle, true); if ((style & SWT.MULTI) != 0) OS.ListBox_SelectionMode (handle, OS.SelectionMode_Extended); } /** * Deselects the items at the given zero-relative indices in the receiver. * If the item at the given zero-relative index in the receiver * is selected, it is deselected. If the item at the index * was not selected, it remains deselected. Indices that are out * of range and duplicate indices are ignored. * * @param indices the array of indices for the items to deselect * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the set of indices is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void deselect (int [] indices) { checkWidget (); if (indices == null) error (SWT.ERROR_NULL_ARGUMENT); if (indices.length == 0) return; int count = getItemCount (); int items = OS.ItemsControl_Items (handle); ignoreSelection = true; for (int i = 0; i < indices.length; i++) { int index = indices [i]; if (0 <= index && index < count) { int item = OS.ItemCollection_GetItemAt (items, index); OS.ListBoxItem_IsSelected (item, false); OS.GCHandle_Free (item); } } ignoreSelection = false; OS.GCHandle_Free (items); } /** * Deselects the item at the given zero-relative index in the receiver. * If the item at the index was already deselected, it remains * deselected. Indices that are out of range are ignored. * * @param index the index of the item to deselect * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void deselect (int index) { checkWidget (); if (index == -1) return; if (0 <= index && index < getItemCount ()) { int items = OS.ItemsControl_Items (handle); int item = OS.ItemCollection_GetItemAt (items, index); OS.GCHandle_Free (items); ignoreSelection = true; OS.ListBoxItem_IsSelected (item, false); ignoreSelection = false; OS.GCHandle_Free (item); } } /** * Deselects the items at the given zero-relative indices in the receiver. * If the item at the given zero-relative index in the receiver * is selected, it is deselected. If the item at the index * was not selected, it remains deselected. The range of the * indices is inclusive. Indices that are out of range are ignored. * * @param start the start index of the items to deselect * @param end the end index of the items to deselect * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void deselect (int start, int end) { checkWidget (); if (start > end) return; int count = getItemCount (); int items = OS.ItemsControl_Items (handle); ignoreSelection = true; for (int i = end; i >= start; i--) { if (0 <= i && i < count) { int item = OS.ItemCollection_GetItemAt (items, i); OS.ListBoxItem_IsSelected (item, false); OS.GCHandle_Free (item); } } ignoreSelection = false; OS.GCHandle_Free (items); } /** * Deselects all selected items in the receiver. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void deselectAll () { checkWidget (); ignoreSelection = true; OS.ListBox_UnselectAll (handle); ignoreSelection = false; } /** * Returns the zero-relative index of the item which currently * has the focus in the receiver, or -1 if no item has focus. * * @return the index of the selected item * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getFocusIndex () { checkWidget (); int items = OS.ItemsControl_Items (handle); int index = OS.ItemCollection_CurrentPosition (items); OS.GCHandle_Free (items); return index; } /** * Returns the item at the given, zero-relative index in the * receiver. Throws an exception if the index is out of range. * * @param index the index of the item to return * @return the item at the given index * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getItem (int index) { checkWidget (); int count = getItemCount (); if (index < 0 || index >= count) error (SWT.ERROR_INVALID_RANGE); int items = OS.ItemsControl_Items (handle); int item = OS.ItemCollection_GetItemAt (items, index); int content = OS.ContentControl_Content (item); String string = createJavaString (content); OS.GCHandle_Free (item); OS.GCHandle_Free (items); OS.GCHandle_Free (content); return string; } /** * Returns the number of items contained in the receiver. * * @return the number of items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getItemCount () { checkWidget (); int items = OS.ItemsControl_Items (handle); int count = OS.ItemCollection_Count (items); OS.GCHandle_Free (items); return count; } /** * Returns the height of the area which would be used to * display <em>one</em> of the items in the list. * * @return the height of one item * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getItemHeight () { checkWidget (); //FIXME: How to find default row height? int result = 15; if (OS.ItemsControl_HasItems (handle)) { int items = OS.ItemsControl_Items (handle); int item = OS.ItemCollection_GetItemAt (items, 0); OS.GCHandle_Free (items); result = (int) OS.FrameworkElement_ActualHeight (item); OS.GCHandle_Free (item); } return result; } /** * Returns a (possibly empty) array of <code>String</code>s which * are the items in the receiver. * <p> * Note: This is not the actual structure used by the receiver * to maintain its list of items, so modifying the array will * not affect the receiver. * </p> * * @return the items in the receiver's list * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String [] getItems () { checkWidget (); int count = getItemCount (); String [] result = new String [count]; for (int i=0; i<count; i++) result [i] = getItem (i); return result; } /** * Returns an array of <code>String</code>s that are currently * selected in the receiver. The order of the items is unspecified. * An empty array indicates that no items are selected. * <p> * Note: This is not the actual structure used by the receiver * to maintain its selection, so modifying the array will * not affect the receiver. * </p> * @return an array representing the selection * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String [] getSelection () { checkWidget (); int [] indices = getSelectionIndices (); String [] result = new String [indices.length]; for (int i=0; i<indices.length; i++) { result [i] = getItem (indices [i]); } return result; } /** * Returns the number of selected items contained in the receiver. * * @return the number of selected items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getSelectionCount () { checkWidget (); int selectedItems = OS.ListBox_SelectedItems (handle); int result = OS.ICollection_Count (selectedItems); OS.GCHandle_Free (selectedItems); return result; } /** * Returns the zero-relative index of the item which is currently * selected in the receiver, or -1 if no item is selected. * * @return the index of the selected item or -1 * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getSelectionIndex () { checkWidget (); return OS.Selector_SelectedIndex (handle); } /** * Returns the zero-relative indices of the items which are currently * selected in the receiver. The order of the indices is unspecified. * The array is empty if no items are selected. * <p> * Note: This is not the actual structure used by the receiver * to maintain its selection, so modifying the array will * not affect the receiver. * </p> * @return the array of indices of the selected items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int [] getSelectionIndices () { checkWidget (); int items = OS.ItemsControl_Items (handle); int list = OS.ListBox_SelectedItems (handle); int enumerator = OS.IList_GetEnumerator (list); int count = OS.ICollection_Count (list); int [] indices = new int [count]; int index = 0; while (OS.IEnumerator_MoveNext (enumerator)) { int item = OS.IEnumerator_Current (enumerator); indices [index++] = OS.ItemCollection_IndexOf (items, item); OS.GCHandle_Free (item); } OS.GCHandle_Free (enumerator); OS.GCHandle_Free (list); OS.GCHandle_Free (items); sortAscending (indices); return indices; } /** * Returns the zero-relative index of the item which is currently * at the top of the receiver. This index can change when items are * scrolled or new items are added or removed. * * @return the index of the top item * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getTopIndex () { checkWidget (); int topIndex = 0; if (OS.ItemsControl_HasItems (handle)) { int items = OS.ItemsControl_Items (handle); int item = OS.ItemCollection_GetItemAt (items, 0); OS.GCHandle_Free (items); int virtualizingStackPanel = OS.VisualTreeHelper_GetParent (item); OS.GCHandle_Free (item); if (virtualizingStackPanel != 0) { topIndex = (int) OS.VirtualizingStackPanel_VerticalOffset (virtualizingStackPanel); OS.GCHandle_Free (virtualizingStackPanel); } } return topIndex; } void HandleMouseDoubleClick (int sender, int e) { if (!checkEvent (e)) return; postEvent (SWT.DefaultSelection); } void HandleSelectionChanged (int sender, int e) { if (!checkEvent (e)) return; if (!ignoreSelection) postEvent(SWT.Selection); } void HandlePreviewKeyDown (int sender, int e) { super.HandlePreviewKeyDown (sender, e); if (!checkEvent (e)) return; int key = OS.KeyEventArgs_Key (e); if (key == OS.Key_Return) { postEvent (SWT.DefaultSelection); } } void hookEvents () { super.hookEvents (); int handler = OS.gcnew_SelectionChangedEventHandler (jniRef, "HandleSelectionChanged"); OS.Selector_SelectionChanged (handle, handler); OS.GCHandle_Free (handler); handler = OS.gcnew_MouseButtonEventHandler (jniRef, "HandleMouseDoubleClick"); OS.Control_MouseDoubleClick (handle, handler); OS.GCHandle_Free (handler); } /** * Gets the index of an item. * <p> * The list is searched starting at 0 until an * item is found that is equal to the search item. * If no item is found, -1 is returned. Indexing * is zero based. * * @param string the search item * @return the index of the item * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int indexOf (String string) { return indexOf (string, 0); } /** * Searches the receiver's list starting at the given, * zero-relative index until an item is found that is equal * to the argument, and returns the index of that item. If * no item is found or the starting index is out of range, * returns -1. * * @param string the search item * @param start the zero-relative index at which to start the search * @return the index of the item * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int indexOf (String string, int start) { checkWidget (); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); int count = getItemCount (); if (start >= count) return -1; start = Math.max (start, 0); int strPtr = createDotNetString (string, false); int items = OS.ItemsControl_Items (handle); int index = -1; while (start < count && index == -1) { int item = OS.ItemCollection_GetItemAt (items, start); int content = OS.ContentControl_Content (item); OS.GCHandle_Free (item); if (content != 0) { if (OS.Object_Equals (content, strPtr)) index = start; OS.GCHandle_Free (content); } start++; } OS.GCHandle_Free (strPtr); OS.GCHandle_Free (items); return index; } /** * Returns <code>true</code> if the item is selected, * and <code>false</code> otherwise. Indices out of * range are ignored. * * @param index the index of the item * @return the selection state of the item at the index * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public boolean isSelected (int index) { checkWidget (); boolean selected = false; if (index >= 0 && index < getItemCount ()) { int items = OS.ItemsControl_Items (handle); int item = OS.ItemCollection_GetItemAt (items, index); selected = OS.ListBoxItem_IsSelected (item); OS.GCHandle_Free (items); OS.GCHandle_Free (item); } return selected; } /** * Removes the items from the receiver at the given * zero-relative indices. * * @param indices the array of indices of the items * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> * <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void remove (int [] indices) { checkWidget (); if (indices == null) error (SWT.ERROR_NULL_ARGUMENT); if (indices.length == 0) return; int [] newIndices = new int [indices.length]; System.arraycopy (indices, 0, newIndices, 0, indices.length); sort (newIndices); int start = newIndices [newIndices.length - 1], end = newIndices [0]; int count = getItemCount (); if (!(0 <= start && start <= end && end < count)) { error (SWT.ERROR_INVALID_RANGE); } int items = OS.ItemsControl_Items (handle); for (int i = newIndices.length-1; i >= 0; i--) { OS.ItemCollection_RemoveAt (items, indices [i]); } OS.GCHandle_Free (items); } /** * Removes the item from the receiver at the given * zero-relative index. * * @param index the index for the item * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void remove (int index) { checkWidget (); if (index < 0 || index >= getItemCount ()) error (SWT.ERROR_INVALID_RANGE); int items = OS.ItemsControl_Items (handle); OS.ItemCollection_RemoveAt (items, index); OS.GCHandle_Free (items); } /** * Removes the items from the receiver which are * between the given zero-relative start and end * indices (inclusive). * * @param start the start of the range * @param end the end of the range * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void remove (int start, int end) { checkWidget (); if (start > end) return; int count = getItemCount (); if (!(0 <= start && start <= end && end < count)) error (SWT.ERROR_INVALID_RANGE); if (start == 0 && end == count - 1) { removeAll (); return; } int items = OS.ItemsControl_Items (handle); for (int i = end; i >= start; i--) { OS.ItemCollection_RemoveAt (items, i); } OS.GCHandle_Free (items); } /** * Searches the receiver's list starting at the first item * until an item is found that is equal to the argument, * and removes that item from the list. * * @param string the item to remove * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void remove (String string) { checkWidget (); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); int index = indexOf (string, 0); if (index == -1) error (SWT.ERROR_INVALID_ARGUMENT); remove (index); } /** * Removes all of the items from the receiver. * <p> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void removeAll () { checkWidget (); int items = OS.ItemsControl_Items (handle); ignoreSelection = true; OS.ItemCollection_Clear (items); ignoreSelection = false; OS.GCHandle_Free (items); } /** * Removes the listener from the collection of listeners who will * be notified when the user changes the receiver's selection. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see SelectionListener * @see #addSelectionListener */ public void removeSelectionListener(SelectionListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.Selection, listener); eventTable.unhook (SWT.DefaultSelection,listener); } /** * Selects the items at the given zero-relative indices in the receiver. * The current selection is not cleared before the new items are selected. * <p> * If the item at a given index is not selected, it is selected. * If the item at a given index was already selected, it remains selected. * Indices that are out of range and duplicate indices are ignored. * If the receiver is single-select and multiple indices are specified, * then all indices are ignored. * * @param indices the array of indices for the items to select * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see List#setSelection(int[]) */ public void select (int [] indices) { checkWidget (); if (indices == null) error (SWT.ERROR_NULL_ARGUMENT); int length = indices.length; if (length == 0 || ((style & SWT.SINGLE) != 0 && length > 1)) return; select (indices, false); } void select (int [] indices, boolean scroll) { int i = 0; while (i < indices.length) { int index = indices [i]; if (index != -1) { select (index, false); } i++; } if (scroll) showSelection (); } /** * Selects the item at the given zero-relative index in the receiver's * list. If the item at the index was already selected, it remains * selected. Indices that are out of range are ignored. * * @param index the index of the item to select * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void select (int index) { checkWidget (); select (index, false); } void select (int index, boolean scroll) { if (index < 0) return; int count = getItemCount (); if (index >= count) return; int items = OS.ItemsControl_Items (handle); int item = OS.ItemCollection_GetItemAt (items, index); OS.GCHandle_Free (items); ignoreSelection = true; OS.ListBoxItem_IsSelected (item, true); ignoreSelection = false; if (scroll) OS.FrameworkElement_BringIntoView (item); OS.GCHandle_Free (item); } /** * Selects the items in the range specified by the given zero-relative * indices in the receiver. The range of indices is inclusive. * The current selection is not cleared before the new items are selected. * <p> * If an item in the given range is not selected, it is selected. * If an item in the given range was already selected, it remains selected. * Indices that are out of range are ignored and no items will be selected * if start is greater than end. * If the receiver is single-select and there is more than one item in the * given range, then all indices are ignored. * * @param start the start of the range * @param end the end of the range * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see List#setSelection(int,int) */ public void select (int start, int end) { checkWidget (); if (end < 0 || start > end || ((style & SWT.SINGLE) != 0 && start != end)) return; int count = getItemCount (); if (count == 0 || start >= count) return; start = Math.max (0, start); end = Math.min (end, count - 1); ignoreSelection = true; if ((style & SWT.SINGLE) != 0) { select (start, false); } else { select (start, end, false); } ignoreSelection = false; } void select (int start, int end, boolean scroll) { int items = OS.ItemsControl_Items (handle); ignoreSelection = true; for (int i = start; i<=end; i++) { int item = OS.ItemCollection_GetItemAt (items, i); OS.ListBoxItem_IsSelected (item, true); OS.GCHandle_Free (item); } ignoreSelection = false; OS.GCHandle_Free (items); if (scroll) showSelection (); } /** * Selects all of the items in the receiver. * <p> * If the receiver is single-select, do nothing. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void selectAll () { checkWidget (); if ((style & SWT.SINGLE) != 0) return; ignoreSelection = true; OS.ListBox_SelectAll (handle); ignoreSelection = false; } /** * Sets the text of the item in the receiver's list at the given * zero-relative index to the string argument. * * @param index the index for the item * @param string the new text for the item * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setItem (int index, String string) { checkWidget (); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); int topIndex = getTopIndex (); boolean isSelected = isSelected (index); remove (index); add (string, index); if (isSelected) select (index, false); setTopIndex (topIndex); } /** * Sets the receiver's items to be the given array of items. * * @param items the array of items * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the items array is null</li> * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setItems (String [] items) { checkWidget (); if (items == null) error (SWT.ERROR_NULL_ARGUMENT); for (int i=0; i<items.length; i++) { if (items [i] == null) error (SWT.ERROR_INVALID_ARGUMENT); } int itemCollection = OS.ItemsControl_Items (handle); ignoreSelection = true; OS.ItemCollection_Clear (itemCollection); for (int i = 0; i < items.length; i++) { String string = items [i]; int item = OS.gcnew_ListBoxItem (); int strPtr = createDotNetString (string, false); OS.ContentControl_Content (item, strPtr); OS.GCHandle_Free (strPtr); OS.ItemCollection_Add (itemCollection, item); OS.GCHandle_Free (item); } ignoreSelection = false; OS.GCHandle_Free (itemCollection); } /** * Selects the items at the given zero-relative indices in the receiver. * The current selection is cleared before the new items are selected. * <p> * Indices that are out of range and duplicate indices are ignored. * If the receiver is single-select and multiple indices are specified, * then all indices are ignored. * * @param indices the indices of the items to select * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see List#deselectAll() * @see List#select(int[]) */ public void setSelection (int [] indices) { checkWidget (); if (indices == null) error (SWT.ERROR_NULL_ARGUMENT); deselectAll (); int length = indices.length; if (length == 0 || ((style & SWT.SINGLE) != 0 && length > 1)) return; select (indices, true); } /** * Sets the receiver's selection to be the given array of items. * The current selection is cleared before the new items are selected. * <p> * Items that are not in the receiver are ignored. * If the receiver is single-select and multiple items are specified, * then all items are ignored. * * @param items the array of items * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see List#deselectAll() * @see List#select(int[]) * @see List#setSelection(int[]) */ public void setSelection (String [] items) { checkWidget (); if (items == null) error (SWT.ERROR_NULL_ARGUMENT); deselectAll (); int length = items.length; if (length == 0 || ((style & SWT.SINGLE) != 0 && length > 1)) return; for (int i=length-1; i>=0; --i) { String string = items [i]; int index = 0; if (string != null) { while ((index = indexOf (string, index)) != -1) { select (index, false); if ((style & SWT.SINGLE) != 0 && isSelected (index)) { showSelection (); return; } index++; } } } } /** * Selects the item at the given zero-relative index in the receiver. * If the item at the index was already selected, it remains selected. * The current selection is first cleared, then the new item is selected. * Indices that are out of range are ignored. * * @param index the index of the item to select * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @see List#deselectAll() * @see List#select(int) */ public void setSelection (int index) { checkWidget (); deselectAll (); select (index, true); } /** * Selects the items in the range specified by the given zero-relative * indices in the receiver. The range of indices is inclusive. * The current selection is cleared before the new items are selected. * <p> * Indices that are out of range are ignored and no items will be selected * if start is greater than end. * If the receiver is single-select and there is more than one item in the * given range, then all indices are ignored. * * @param start the start index of the items to select * @param end the end index of the items to select * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see List#deselectAll() * @see List#select(int,int) */ public void setSelection (int start, int end) { checkWidget (); deselectAll (); if (end < 0 || start > end || ((style & SWT.SINGLE) != 0 && start != end)) return; int count = getItemCount (); if (count == 0 || start >= count) return; start = Math.max (0, start); end = Math.min (end, count - 1); if ((style & SWT.SINGLE) != 0) { select (start, true); } else { select (start, end, true); } } /** * Sets the zero-relative index of the item which is currently * at the top of the receiver. This index can change when items * are scrolled or new items are added and removed. * * @param index the index of the top item * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setTopIndex (int index) { checkWidget (); //FIXME: VirtualizingStackPanel.VerticalIndex cannot be set. } /** * Shows the selection. If the selection is already showing in the receiver, * this method simply returns. Otherwise, the items are scrolled until * the selection is visible. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void showSelection () { //TODO: does this scroll the first selected item into view if // part of the selection is visible already??? checkWidget (); int items = OS.ItemsControl_Items (handle); int selectedItems = OS.ListBox_SelectedItems (handle); int enumerator = OS.IList_GetEnumerator (selectedItems); if (OS.IEnumerator_MoveNext (enumerator)) { int item = OS.IEnumerator_Current (enumerator); OS.ListBox_ScrollIntoView (handle, item); OS.GCHandle_Free (item); } OS.GCHandle_Free (enumerator); OS.GCHandle_Free (selectedItems); OS.GCHandle_Free (items); } }
[ "375833274@qq.com" ]
375833274@qq.com
172edfaff14428ee24953658ae34f9446910eaeb
286ab67d5eaf7192678b4bd5cfc55d3fb9c737a5
/src/SystemTest/DaoTest.java
6218432528c7a37b21e0e8f1fbc35a223480130b
[]
no_license
Husky-Gong/FlowerManageSystem
f8c5959adf693ba1698feee27b8d6e41cce8a7f0
01b05964b329b6d61b630a04c3c7321032b8cc8b
refs/heads/master
2020-12-07T16:50:40.473879
2020-01-31T09:30:56
2020-01-31T09:30:56
232,754,770
0
0
null
null
null
null
UTF-8
Java
false
false
3,491
java
package SystemTest; import java.util.Map; import org.junit.Test; import DAOs.BaseDao; import FunctionHelper.DeleteHelper; import FunctionHelper.FindHelper; import FunctionHelper.InsertHelper; import SystemClass.Flower; import SystemClass.People; public class DaoTest { /* * ------------INSERT------------- * people and flower both work! */ @SuppressWarnings("unchecked") @Test public <T> void testInsertEntity() throws Exception{ System.out.println("You are now testing Insert entity......"); InsertHelper testInsert = new InsertHelper(); Flower newFlower = testInsert.addNewFlw(); BaseDao<T> testDao = new BaseDao<T>(); int i = testDao.insertEntity((T) newFlower); System.out.println(i); } @SuppressWarnings("unchecked") @Test public <T> void testInsertEntity2() throws Exception { System.out.println("You are now testing insert user entity......"); InsertHelper testInsert = new InsertHelper(); People newUser = testInsert.addNewUser(); BaseDao<T> testDao = new BaseDao<T>(); int i = testDao.insertEntity((T) newUser); System.out.println(i); } /* * --------------GET ALL------------- * people and flower both work! */ @SuppressWarnings("unchecked") @Test public <T> void testFindEntity() throws Exception { System.out.println("You are now testing find entity......"); FindHelper find = new FindHelper(); BaseDao<T> testDao = new BaseDao<T>(); Map<String,T> flwMap = testDao.findEntity((T) find.getFlowers()); for(Map.Entry<String, T> entry: flwMap.entrySet()) { String key = entry.getKey(); T obj = entry.getValue(); System.out.println(key); System.out.println(obj); System.out.println("-------------"); } } @SuppressWarnings("unchecked") @Test public <T> void testFindEntity2() throws Exception { System.out.println("You are now testing find user entity......"); FindHelper find = new FindHelper(); BaseDao<T> testDao = new BaseDao<T>(); System.out.println("User table below:"); Map<String,T> userMap = testDao.findEntity((T) find.getUser()); for(Map.Entry<String, T> entry:userMap.entrySet()) { String key = entry.getKey(); T obj = entry.getValue(); System.out.println(key); System.out.println(obj); System.out.println("---------------"); } } /* * ----------------DELETE---------------- * people and flower both work! */ @SuppressWarnings("unchecked") @Test public <T> void testDeleteEntity() throws Exception { System.out.println("You are now testing delete entity......"); DeleteHelper deleteFlower = new DeleteHelper(); BaseDao<T> testDao = new BaseDao<T>(); int i = testDao.deleteEntity((T) deleteFlower.deleteFlower()); System.out.println(i); } @SuppressWarnings("unchecked") @Test public <T> void testDeleteEntity2() throws Exception { System.out.println("Your are now testing delete user entity......"); DeleteHelper deleteUser = new DeleteHelper(); BaseDao<T> testDao = new BaseDao<T>(); int i = testDao.deleteEntity((T) deleteUser.deleteUser()); System.out.println(i); } /* * user Modify test */ @SuppressWarnings("unchecked") @Test public <T> void testModifyEntity() throws Exception { System.out.println("You are now testing Modify entity......"); BaseDao<T> testDao = new BaseDao<T>(); Flower flower = new Flower("Lily",25.55,100); //People user = new People("zexi","Zz010013","pangzi",107.22,"manager"); int i = testDao.modifyEntity((T) flower); System.out.println(i); } }
[ "gong.ze@husky.neu.edu" ]
gong.ze@husky.neu.edu
99e786194688d7cbee2952ead0bd43c186cd8063
f0455261f9400c21a203689b385b7d568717926a
/src/main/java/com/guoyi/jerkaero/web/rest/errors/LoginAlreadyUsedException.java
0eeb2f28706b067a4f356261996e4466206904e3
[]
no_license
wangbl11/jerkaero
7d04d2a89ab30d40d32f6f0ee3e72ee06956db10
dd11c13c70a2cced1e34305c76af0342cfd4df26
refs/heads/master
2020-03-21T17:22:22.711038
2018-12-19T12:22:31
2018-12-19T12:22:31
138,828,026
0
0
null
null
null
null
UTF-8
Java
false
false
280
java
package com.guoyi.jerkaero.web.rest.errors; public class LoginAlreadyUsedException extends BadRequestAlertException { public LoginAlreadyUsedException() { super(ErrorConstants.LOGIN_ALREADY_USED_TYPE, "Login already in use", "userManagement", "userexists"); } }
[ "wangbl11@qq.com" ]
wangbl11@qq.com
3f1f3514616a7547d39bc5233807816d3701ab70
49b57339d939ea3f498249d3aacca1dec543163b
/jadx-snap-new/sources/com/addlive/djinni/ServiceListener.java
cd483ec8875808f4068541edb831b6dad7c2405b
[]
no_license
8secz-johndpope/snapchat-re
1655036c41518c3a2aaa0c2543dc49f4acb93eaf
04f5c5bb627d21f620088525fffcf5c99abd7ce5
refs/heads/master
2020-08-24T09:14:38.209745
2019-06-14T05:13:44
2019-06-14T05:13:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,654
java
package com.addlive.djinni; import java.util.concurrent.atomic.AtomicBoolean; public abstract class ServiceListener { static final class CppProxy extends ServiceListener { static final /* synthetic */ boolean $assertionsDisabled = false; private final AtomicBoolean destroyed = new AtomicBoolean(false); private final long nativeRef; static { Class cls = ServiceListener.class; } private CppProxy(long j) { if (j != 0) { this.nativeRef = j; return; } throw new RuntimeException("nativeRef is zero"); } private native void nativeDestroy(long j); private native void native_onConnectionLost(long j, ConnectionLostEvent connectionLostEvent); private native void native_onMediaStreamEvent(long j, UserStateChangedEvent userStateChangedEvent); private native void native_onMediaTransportTypeChanged(long j, MediaTransportTypeChangedEvent mediaTransportTypeChangedEvent); private native void native_onMessage(long j, MessageEvent messageEvent); private native void native_onSessionReconnected(long j, SessionReconnectedEvent sessionReconnectedEvent); private native void native_onSpeechActivity(long j, SpeechActivityEvent speechActivityEvent); private native void native_onUserEvent(long j, UserStateChangedEvent userStateChangedEvent); public final void destroy() { if (!this.destroyed.getAndSet(true)) { nativeDestroy(this.nativeRef); } } /* Access modifiers changed, original: protected|final */ public final void finalize() { destroy(); super.finalize(); } public final void onConnectionLost(ConnectionLostEvent connectionLostEvent) { native_onConnectionLost(this.nativeRef, connectionLostEvent); } public final void onMediaStreamEvent(UserStateChangedEvent userStateChangedEvent) { native_onMediaStreamEvent(this.nativeRef, userStateChangedEvent); } public final void onMediaTransportTypeChanged(MediaTransportTypeChangedEvent mediaTransportTypeChangedEvent) { native_onMediaTransportTypeChanged(this.nativeRef, mediaTransportTypeChangedEvent); } public final void onMessage(MessageEvent messageEvent) { native_onMessage(this.nativeRef, messageEvent); } public final void onSessionReconnected(SessionReconnectedEvent sessionReconnectedEvent) { native_onSessionReconnected(this.nativeRef, sessionReconnectedEvent); } public final void onSpeechActivity(SpeechActivityEvent speechActivityEvent) { native_onSpeechActivity(this.nativeRef, speechActivityEvent); } public final void onUserEvent(UserStateChangedEvent userStateChangedEvent) { native_onUserEvent(this.nativeRef, userStateChangedEvent); } } public abstract void onConnectionLost(ConnectionLostEvent connectionLostEvent); public abstract void onMediaStreamEvent(UserStateChangedEvent userStateChangedEvent); public abstract void onMediaTransportTypeChanged(MediaTransportTypeChangedEvent mediaTransportTypeChangedEvent); public abstract void onMessage(MessageEvent messageEvent); public abstract void onSessionReconnected(SessionReconnectedEvent sessionReconnectedEvent); public abstract void onSpeechActivity(SpeechActivityEvent speechActivityEvent); public abstract void onUserEvent(UserStateChangedEvent userStateChangedEvent); }
[ "blevy@protonmail.com" ]
blevy@protonmail.com
e65fee50806664a8ca3c9451ce8b86b2b5f89151
819b539ff0fec27b521b5a897e56a31a25f05407
/OcavaScenarioTest/src/test/java/com/ocadotechnology/scenario/FuturesThenSteps.java
45fd2ec09f6e7bc882591ed4d72ddb9a61eed220
[ "Apache-2.0" ]
permissive
ocadotechnology/Ocava
62999e4348be15311aa2da2f7e645351a3ea467f
bde071d519ac93ae5c4b3af80f9b6c4bf91f0872
refs/heads/master
2023-07-07T02:10:21.235160
2023-05-31T22:25:05
2023-06-09T10:59:25
99,997,703
23
8
Apache-2.0
2023-06-14T22:43:56
2017-08-11T06:14:18
Java
UTF-8
Java
false
false
1,050
java
/* * Copyright © 2017-2023 Ocado (Ocava) * * 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.ocadotechnology.scenario; import org.junit.jupiter.api.Assertions; public class FuturesThenSteps { private final StepManager<?> stepManager; public FuturesThenSteps(StepManager<?> stepManager) { this.stepManager = stepManager; } public <T> void assertEquals(T expected, StepFuture<T> futureActual) { stepManager.addExecuteStep(() -> Assertions.assertEquals(expected, futureActual.get())); } }
[ "colin.janke@ocado.com" ]
colin.janke@ocado.com
05c5d8f6745d63917532642f450103350e6ba837
82450c678164c92ae7e8a6eb0d74b4a0d12beb7d
/Trust/src/main/java/com/trust/app/service/MarqueTracteurServiceImpl.java
867028e42adab0ca0adbfea6eb908bf220ce6e7a
[]
no_license
litoumas/trust
dcce5b9fc0124a3c01b55484d02c03e88f155b51
dc3d26dabaec6830e273cb79030befc5c2d05ae7
refs/heads/master
2020-04-09T04:50:54.139092
2019-04-26T07:15:05
2019-04-26T07:15:05
160,023,083
0
0
null
null
null
null
UTF-8
Java
false
false
1,659
java
package com.trust.app.service; import java.io.Serializable; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.trust.app.dao.MarqueTracteurDAO; import com.trust.app.model.MarqueTracteur; @Service @ManagedBean(name = "marqueTracteurService") @SessionScoped public class MarqueTracteurServiceImpl implements MarqueTracteurService,Serializable{ /** * */ private static final long serialVersionUID = -1120798525255629783L; private static final Logger logger = LoggerFactory.getLogger(MarqueTracteurServiceImpl.class); private MarqueTracteurDAO marqueTracteurDAO; public void setMarqueTracteurDAO(MarqueTracteurDAO marqueTracteurDAO) { this.marqueTracteurDAO = marqueTracteurDAO; } @Override @Transactional public void addMarqueTracteur(MarqueTracteur c) { this.marqueTracteurDAO.addMarqueTracteur(c); } @Override @Transactional public List<MarqueTracteur> listMarqueTracteurs() { return this.marqueTracteurDAO.listMarqueTracteurs(); } @Override @Transactional public void deleteMarqueTracteur(MarqueTracteur c) { this.marqueTracteurDAO.deleteMarqueTracteur(c); } @Override @Transactional public void updateMarqueTracteur(MarqueTracteur c) { this.marqueTracteurDAO.updateMarqueTracteur(c); } @Override public void testLog() { } @Override @Transactional public MarqueTracteur findWithDesig(String designation) { return this.marqueTracteurDAO.findWithDesig(designation); } }
[ "Litoumas@gmail.com" ]
Litoumas@gmail.com
b70ff707b7fc638a60a20caa2e92cbac21404bd4
0c1533a264452a9d87905cde879c8e1bd8888f5d
/app/src/main/java/com/example/pickuplaundry/SetupItem.java
dfb68b41587279187a04ff75a819e4dfbb06dcfb
[]
no_license
shamikhbal/Fevenni
49f531dc3a46f43b652fc1664811220887a4ea4a
73efaaec7ef1d6ec4f8da013b054fbe9015b0911
refs/heads/master
2022-11-24T07:36:49.257734
2020-07-24T12:23:08
2020-07-24T12:23:08
282,211,945
0
0
null
null
null
null
UTF-8
Java
false
false
8,643
java
package com.example.pickuplaundry; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.drawerlayout.widget.DrawerLayout; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.google.android.material.navigation.NavigationView; import com.google.firebase.auth.FirebaseAuth; public class SetupItem extends AppCompatActivity { Button btnSubmit; TextView tshirt, pant, skirt, scarf, jacket, other, washMachine, dryer; private FirebaseAuth firebaseAuth; //Custom Navigation bar private Toolbar toolbar; private DrawerLayout drawerLayout; private NavigationView navigationView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_setup_item); //Custom Navigation bar toolbar=findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_nav); drawerLayout=findViewById(R.id.drawer_layout); navigationView=findViewById(R.id.navigationView); navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { switch (menuItem.getItemId()){ case R.id.nav_profile: menuItem.setChecked(true); Intent p = new Intent(SetupItem.this, UserProfile.class); startActivity(p); drawerLayout.closeDrawers(); return true; case R.id.nav_createorder: menuItem.setChecked(true); Intent h = new Intent(SetupItem.this, Home.class); startActivity(h); drawerLayout.closeDrawers(); return true; case R.id.nav_orderhistory: menuItem.setChecked(true); Intent o = new Intent(SetupItem.this, OrderHistory.class); startActivity(o); drawerLayout.closeDrawers(); return true; case R.id.nav_logout: menuItem.setChecked(true); Logout(); drawerLayout.closeDrawers(); return true; } return false; } }); firebaseAuth=FirebaseAuth.getInstance(); btnSubmit = findViewById(R.id.btn_next); tshirt = findViewById(R.id.tshirtQ); pant = findViewById(R.id.pantQ); skirt = findViewById(R.id.skirtQ); scarf = findViewById(R.id.scarfQ); jacket = findViewById(R.id.jacketQ); other = findViewById(R.id.otherQ); washMachine = findViewById(R.id.washingMachineQ); dryer = findViewById(R.id.dryerQ); Intent i = getIntent(); final String pickLoc=i.getStringExtra("pickLoc"); final String delLoc=i.getStringExtra("delLoc"); final String kol=i.getStringExtra("kol"); final String pickDay=i.getStringExtra("pickDay"); final String pickTime=i.getStringExtra("pickTime"); final String delDay=i.getStringExtra("delDay"); final String delTime=i.getStringExtra("delTime"); btnSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int tshirtq = 0; int pantq = 0; int skirtq = 0; int scarfq = 0; int jacketq = 0; int otherq = 0; int washq = 0; int dryq = 0; tshirtq = Integer.parseInt(tshirt.getText().toString()); pantq = Integer.parseInt(pant.getText().toString()); skirtq = Integer.parseInt(skirt.getText().toString()); scarfq = Integer.parseInt(scarf.getText().toString()); jacketq = Integer.parseInt(jacket.getText().toString()); otherq = Integer.parseInt(other.getText().toString()); washq = Integer.parseInt(washMachine.getText().toString()); dryq = Integer.parseInt(dryer.getText().toString()); int totalItem = tshirtq + pantq + skirtq + scarfq + jacketq + otherq; if(washq<=0 || dryq<=0){ Toast.makeText(SetupItem.this, "Washing Machine & Dryer Cannot Be Less Than 1", Toast.LENGTH_SHORT).show(); } else if(washq>5 || dryq>5){ Toast.makeText(SetupItem.this, "Washing Machine & Dryer Cannot Be More Than 5", Toast.LENGTH_SHORT).show(); } else if(totalItem >30 && (washq==1 || dryq==1)){ Toast.makeText(SetupItem.this, "Too Many Item For 1 Washing Machine & Dryer", Toast.LENGTH_SHORT).show(); } else if(totalItem >60 && (washq==2 || dryq==2)){ Toast.makeText(SetupItem.this, "Too Many Item For 2 Washing Machine & Dryer", Toast.LENGTH_SHORT).show(); } else if(totalItem >90 && (washq==3 || dryq==3)){ Toast.makeText(SetupItem.this, "Too Many Item For 3 Washing Machine & Dryer", Toast.LENGTH_SHORT).show(); } else if(totalItem >120 && (washq==4 || dryq==4)){ Toast.makeText(SetupItem.this, "Too Many Item For 4 Washing Machine & Dryer", Toast.LENGTH_SHORT).show(); } else if(totalItem >150 && (washq==5 || dryq==5)){ Toast.makeText(SetupItem.this, "Too Many Item For 5 Washing Machine & Dryer", Toast.LENGTH_SHORT).show(); } else{ Intent intent = new Intent(SetupItem.this,ComfirmOrder.class); // Time and Location Setting intent.putExtra("PickLoc", pickLoc); intent.putExtra("DelLoc", delLoc); intent.putExtra("Kol", kol); intent.putExtra("PickDay", pickDay); intent.putExtra("PickTime", pickTime); intent.putExtra("DelDay", delDay); intent.putExtra("DelTime", delTime); // Setup Item intent.putExtra("t-shirt", tshirtq); intent.putExtra("Pant", pantq); intent.putExtra("Skirt", skirtq); intent.putExtra("Scarf", scarfq); intent.putExtra("Jacket", jacketq); intent.putExtra("Other", otherq); intent.putExtra("Wash", washq); intent.putExtra("Dry", dryq); startActivity(intent); } } }); } // LogOut Menu Function private void Logout(){ firebaseAuth.signOut(); finish(); startActivity(new Intent(SetupItem.this, MainActivity.class)); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { switch (item.getItemId()){ case R.id.logoutMenu: { Logout(); break; } case R.id.profile: { Intent i = new Intent(SetupItem.this, UserProfile.class); startActivity(i); break; } case R.id.makeOrder: { Intent i = new Intent(SetupItem.this, Home.class); startActivity(i); break; } case R.id.orderHistory: { Intent i = new Intent(SetupItem.this, OrderHistory.class); startActivity(i); break; } } return super.onOptionsItemSelected(item); } }
[ "shamikhbal5@gmail.com" ]
shamikhbal5@gmail.com
2becff5a4b9bfc0fa8bb4ba4b71a68adeb16389f
9ee40237fa9cfdc9256065ac735cf60695109f50
/app/src/main/java/com/witnip/bmi/Adapters/WaterIntakeAdapter.java
34cd25be3c95efbcae5d2952c35125a71dc7bc63
[]
no_license
witnip/BMI
9cc0a57b4e45fec4f27b9cf35ac5dbcc8fbefdcf
fb0959063af59883f3cc29453a02150f16748bdd
refs/heads/main
2023-03-08T10:07:53.539710
2020-12-27T23:43:03
2020-12-27T23:43:03
320,599,261
0
0
null
null
null
null
UTF-8
Java
false
false
2,131
java
package com.witnip.bmi.Adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.firebase.ui.database.FirebaseRecyclerAdapter; import com.firebase.ui.database.FirebaseRecyclerOptions; import com.witnip.bmi.Model.WaterIntakeModel; import com.witnip.bmi.R; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; public class WaterIntakeAdapter extends RecyclerView.Adapter<WaterIntakeAdapter.WaterIntakeViewHolder> { Context context; ArrayList<WaterIntakeModel> waterIntakeList; public WaterIntakeAdapter(Context context, ArrayList<WaterIntakeModel> waterIntakeList) { this.context = context; this.waterIntakeList = waterIntakeList; } @NonNull @Override public WaterIntakeViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(context).inflate(R.layout.water_intake_list,parent,false); return new WaterIntakeViewHolder(view); } @Override public void onBindViewHolder(@NonNull WaterIntakeViewHolder holder, int position) { holder.lblWaterIntake.setText(String.format("%s", waterIntakeList.get(position).getWaterIntake())); holder.lblDate.setText(waterIntakeList.get(position).getDate()); holder.lblTime.setText(waterIntakeList.get(position).getTime()); } @Override public int getItemCount() { return waterIntakeList.size(); } class WaterIntakeViewHolder extends RecyclerView.ViewHolder{ TextView lblWaterIntake; TextView lblDate; TextView lblTime; public WaterIntakeViewHolder(@NonNull View itemView) { super(itemView); lblWaterIntake = itemView.findViewById(R.id.lblWaterIntake); lblDate = itemView.findViewById(R.id.lblDate); lblTime = itemView.findViewById(R.id.lblTime); } } }
[ "alamnizam1992@gmail.com" ]
alamnizam1992@gmail.com
2aa91a8755732052c2dc2680e1ba88cbf2d527eb
222139dcc338b0469a9b005458f135bbcece2cb5
/src/main/java/com/example/tuancan/dto/RecipeAndQuantity.java
253a3c790b50f1602c8d667262ddd2dcf1c50f21
[]
no_license
15982224307/tuancan1
b2a2a812079f479373da7aa8bc9182e96a8dfb3d
2ee07c47562480d30f39b91f9fece54623d0e93b
refs/heads/master
2020-03-26T19:25:33.488838
2019-03-11T12:50:35
2019-03-11T12:50:35
145,264,027
2
0
null
null
null
null
UTF-8
Java
false
false
536
java
package com.example.tuancan.dto; import com.example.tuancan.model.Recipe; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; import javax.persistence.Column; @Data @NoArgsConstructor @AllArgsConstructor public class RecipeAndQuantity { /* 食谱编号 */ private Integer recipeId; /* 食谱名称 */ private String recipeName; /*荤素*/ private Integer recipeMeatOrVegetable; /*点餐数量*/ private Integer quantity; }
[ "wangchao@163.com" ]
wangchao@163.com
034101d4cbc207d163e2d8c1a93df73ed1415fe7
3bca3679ee63a464912376b44e3171ff17b0ebc9
/src/main/java/com/project/service/PhimService.java
4cec8d799f251298c7fd4b44a1b394b0037c7a03
[]
no_license
HaseNguyen/MovieAPI
bc9561e2a099f9bdda83ad5b4c8534ea5830954f
c51ae4442c3f7ff7619065044607a1639cc0f99a
refs/heads/master
2023-02-19T00:32:05.443571
2021-01-07T03:32:31
2021-01-07T03:32:31
314,527,084
0
0
null
null
null
null
UTF-8
Java
false
false
2,530
java
package com.project.service; import java.io.File; import java.io.FileNotFoundException; import javax.servlet.http.HttpServletRequest; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.project.dto.AddNewPhimDTO; import com.project.entity.Phim; import com.project.repository.PhimRepository; // Handle Logic for API Phim @Service public class PhimService { private static String UPLOADED_FOLDER = "F://temp//"; private static String UPLOADED_FOLDER_RESULT = "static/upload/"; @Autowired PhimRepository phimRepository ; public Phim addNewPhim(@RequestBody AddNewPhimDTO addNewPhimDTO) { ModelMapper modelMapper = new ModelMapper(); Phim phim = modelMapper.map(addNewPhimDTO, Phim.class ); try { int maxPhim_ID = phimRepository.maxPHIM_ID(); phim.setMAPHIM("MVC" + (maxPhim_ID + 001)); } catch (Exception e) { // TODO: handle exception System.out.println("ID null"); phim.setMAPHIM("MVC1"); } phimRepository.save(phim); return phim; } public String UploadFile( @RequestParam MultipartFile file, HttpServletRequest request) { //Lay duong dan tuyet doi cua thu muc upload String path = request.getServletContext().getRealPath("/" + UPLOADED_FOLDER); try { File dir = new File(path); if(!dir.exists()) { dir.mkdirs(); //Neu thu muc chua co thi tao moi } //Luu file File pathFile = new File(path + file.getOriginalFilename()); file.transferTo(pathFile); return UPLOADED_FOLDER_RESULT + file.getOriginalFilename(); } catch(FileNotFoundException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } return null; } public Object editPhim(@PathVariable int id, @RequestBody AddNewPhimDTO editPhim) { // TODO Auto-generated method stub ModelMapper modelMapper = new ModelMapper(); Phim phim = modelMapper.map(editPhim, Phim.class ); phim.setPHIM_ID(id); phim.setMAPHIM(phimRepository.findMaPhim(id)); phimRepository.save(phim); return phim; } }
[ "46945964+HaseNguyen@users.noreply.github.com" ]
46945964+HaseNguyen@users.noreply.github.com
24111f90672c9bb074afb6c0d628600bcf6d900d
b1ee33574bd422acba679ddd935aaffd85546886
/TeddyBear/OCR_TTS/app/src/main/java/com/wistron/demo/tool/teddybear/dcs/wakeup/WakeUp.java
4682682ff2ef62c9abd963ef42c46313490aba70
[]
no_license
dezzzel/AVS_DuerOS_App
49385059dd29202dad90d5b03a5267adeaf8a82c
ebf18159b5d0d186e4c12aca30ec548a703c5d3e
refs/heads/master
2020-04-20T09:24:25.342965
2018-01-11T08:13:44
2018-01-11T08:13:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,985
java
package com.wistron.demo.tool.teddybear.dcs.wakeup; import com.wistron.demo.tool.teddybear.dcs.systeminterface.IAudioRecord; import com.wistron.demo.tool.teddybear.dcs.systeminterface.IWakeUp; import java.util.Collections; import java.util.LinkedList; import java.util.List; /** * Created by ivanjlzhang on 17-9-22. */ public class WakeUp { private IWakeUp iWakeUp; private List<IWakeUp.IWakeUpListener> wakeUpListeners; private IAudioRecord iAudioRecord; public WakeUp(IWakeUp iWakeUp, IAudioRecord iAudioRecord) { this.iWakeUp = iWakeUp; this.iAudioRecord = iAudioRecord; this.wakeUpListeners = Collections.synchronizedList(new LinkedList<IWakeUp.IWakeUpListener>()); this.iWakeUp.addWakeUpListener(new IWakeUp.IWakeUpListener() { @Override public void onWakeUpSucceed() { fireOnWakeUpSucceed(); } }); // 启动音频采集 this.iAudioRecord.startRecord(); } private void fireOnWakeUpSucceed() { for (IWakeUp.IWakeUpListener listener : wakeUpListeners) { listener.onWakeUpSucceed(); } } /** * 开始唤醒,麦克风处于打开状态,一旦检测到有音频开始唤醒解码 */ public void startWakeUp() { iWakeUp.startWakeUp(); } /** * 停止唤醒,关闭麦克风 */ public void stopWakeUp() { iWakeUp.stopWakeUp(); } /** * 释放资源-解码so库资源 */ public void releaseWakeUp() { iAudioRecord.stopRecord(); iWakeUp.releaseWakeUp(); } /** * 添加唤醒成功后的监听 */ public void addWakeUpListener(IWakeUp.IWakeUpListener listener) { wakeUpListeners.add(listener); } public void removeWakeUpListener(IWakeUp.IWakeUpListener listener) { if (wakeUpListeners.contains(listener)) { wakeUpListeners.remove(listener); } } }
[ "Ivan_JL_Zhang@Wistron.com" ]
Ivan_JL_Zhang@Wistron.com
ac4c1db33dac0ba96200d8431545035b0f1be1e0
8b9015b75c084f261e9f04d8d4790f2cbd58e641
/Analyser/src/module-info.java
71398c8f2a5c7dc7b584848ebf0d19c1410ad852
[]
no_license
Kekananen/BSA-Analyser
fd12a9550010ff8e2cbf7922de65d31f281d520c
b38f94ca7ecf3e44940f36dbd9d674b4c8244dbd
refs/heads/master
2021-01-25T23:49:46.504280
2020-03-24T17:45:59
2020-03-24T17:45:59
243,230,627
0
1
null
2020-03-24T17:46:01
2020-02-26T10:05:10
Java
UTF-8
Java
false
false
57
java
module bsa_analyser.github.io { requires java.desktop; }
[ "kekananen@gmail.com" ]
kekananen@gmail.com
6ce84a57ec8d33034b237986fb099c4c8f2cfd3b
a85180a40ea759a92faadbf3538a25bd6b7eba28
/1.JavaSyntax/src/com/javarush/task/task09/task0917/Solution.java
b40d0ed61187a65d57ea08e27b1bb25680c133ed
[]
no_license
CODE-DK/JavaRush
8eec4013b87b6b99da1bdc76576709530b89731a
37c58f9bd886edc9f0c896e71137f1a60dc3d686
refs/heads/master
2021-10-11T11:23:46.327973
2019-01-24T21:05:49
2019-01-24T21:05:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,076
java
package com.javarush.task.task09.task0917; /* Перехват unchecked-исключений */ public class Solution { public static void main(String[] args) throws Exception{ processExceptions(new Solution()); } public static void processExceptions(Solution obj) { try{ obj.method1(); obj.method2(); obj.method3(); }catch (NullPointerException e){ printStack(e); }catch (IndexOutOfBoundsException e){ printStack(e); }catch (NumberFormatException e){ printStack(e); } } public static void printStack(Throwable throwable) { System.out.println(throwable); for (StackTraceElement element : throwable.getStackTrace()) { System.out.println(element); } } public void method1() { throw new NullPointerException(); } public void method2() { throw new IndexOutOfBoundsException(); } public void method3() { throw new NumberFormatException(); } }
[ "dkom91@gmail.com" ]
dkom91@gmail.com
36e05f7753b2b9d9fbfd43170e69fe170467811f
1229ed535b3f231c8f51d5947c03a499ca8718b6
/app/src/main/java/example/ASPIRE/MyoHMI_Android/Plotter.java
42461a7775cd53aed8aa4347e4af9ccae137515f
[]
no_license
juphan/Myo-HMI-Android-master
6e5be28f835ceb176b498d82f481dea95ecb3cbd
bd18d3b5dfb2c4d169d05356d3d939a6586f2755
refs/heads/master
2020-12-01T16:42:21.445284
2020-01-27T23:03:12
2020-01-27T23:03:12
222,800,115
0
0
null
null
null
null
UTF-8
Java
false
false
19,908
java
package example.ASPIRE.MyoHMI_Android; import android.app.Activity; import android.graphics.Color; import android.graphics.Typeface; import android.os.Handler; import android.util.Log; import com.echo.holographlibrary.Line; import com.echo.holographlibrary.LineGraph; import com.echo.holographlibrary.LinePoint; import com.github.mikephil.charting.charts.LineChart; import com.github.mikephil.charting.charts.RadarChart; import com.github.mikephil.charting.components.AxisBase; import com.github.mikephil.charting.components.Legend; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.components.YAxis; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.data.LineData; import com.github.mikephil.charting.data.LineDataSet; import com.github.mikephil.charting.data.RadarData; import com.github.mikephil.charting.data.RadarDataSet; import com.github.mikephil.charting.data.RadarEntry; import com.github.mikephil.charting.formatter.IAxisValueFormatter; import com.github.mikephil.charting.formatter.IFillFormatter; import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider; import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; import com.github.mikephil.charting.interfaces.datasets.IRadarDataSet; import java.util.ArrayList; /** * Created by Alex on 6/30/2017. */ public class Plotter extends Activity { //boolean emg; private static RadarChart mChart; private static Handler mHandler; private static int currentTab = 0; //current tab from MainActivity private static int nowGraphIndexIMU = 0; private static boolean[] featuresSelected = new boolean[]{true, true, true, true, true, true}; public boolean startup = true; protected Typeface mTfLight; int[][] dataList1_a = new int[10][50]; int[][] dataList1_b = new int[10][50]; private LineChart cubicChart; private LineGraph lineGraph; private int lineColor = Color.rgb(64, 64, 64); private int nowGraphIndex = 3; private ArrayList<Number> f0, f1, f2, f3, f4, f5; private int w, x, y, z; private double pitch, roll, yaw; public Plotter() { } public Plotter(RadarChart chart) { mChart = chart; mHandler = new Handler(); mChart.setNoDataText(""); mChart.setBackgroundColor(Color.TRANSPARENT); mChart.getDescription().setEnabled(false); mChart.setWebLineWidth(1f); mChart.setWebColor(Color.LTGRAY); mChart.setWebLineWidthInner(1f); mChart.setWebColorInner(Color.LTGRAY); mChart.setWebAlpha(100); // mChart.getLegend().setTextSize(20f); mChart.getLegend().setPosition(Legend.LegendPosition.BELOW_CHART_CENTER); XAxis xAxis = mChart.getXAxis(); //xAxis.setTypeface(mTfLight); xAxis.setTextSize(10f); xAxis.setYOffset(0f); xAxis.setXOffset(0f); xAxis.setValueFormatter(new IAxisValueFormatter() { private String[] mActivities = new String[]{"1", "2", "3", "4", "5", "6", "7", "8"}; @Override public String getFormattedValue(float value, AxisBase axis) { return mActivities[(int) value % mActivities.length]; } }); YAxis yAxis = mChart.getYAxis(); //yAxis.setTypeface(mTfLight); yAxis.setLabelCount(8, false); yAxis.setTextSize(9f); yAxis.setAxisMinimum(0); yAxis.setAxisMaximum(128); yAxis.setDrawLabels(false); twoDimArray featemg = new twoDimArray(); featemg.createMatrix(6, 8); this.setCurrentTab(1); for (int i = 0; i < 8; i++) { for (int j = 0; j < 6; j++) { featemg.setMatrixValue(j, i, 128); } } this.pushFeaturePlotter(featemg); for (int i = 0; i < 8; i++) { for (int j = 0; j < 6; j++) { featemg.setMatrixValue(j, i, 0); } } this.pushFeaturePlotter(featemg); // this.setCurrentTab(0); } public Plotter(Handler handler, LineGraph line) { mHandler = handler; lineGraph = line; } public Plotter(Handler handler, LineChart cubicLine) { mHandler = handler; cubicChart = cubicLine; cubicChart.setViewPortOffsets(0, 0, 0, 0); cubicChart.setBackgroundColor(Color.rgb(51, 0, 100)); // no description text cubicChart.getDescription().setEnabled(false); // enable touch gestures cubicChart.setTouchEnabled(true); // enable scaling and dragging cubicChart.setDragEnabled(true); cubicChart.setScaleEnabled(true); // if disabled, scaling can be done on x- and y-axis separately cubicChart.setPinchZoom(true); cubicChart.setDrawGridBackground(false); //cubicChart.setVisibleXRangeMinimum(0); //cubicChart.setVisibleYRangeMinimum(); cubicChart.setMaxHighlightDistance(300); XAxis x = cubicChart.getXAxis(); x.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE); x.setTextSize(12f); x.setLabelCount(7, true);// force 10 labels x.setTextColor(Color.WHITE); x.setDrawAxisLine(true); x.setDrawGridLines(false); x.setAxisMinimum(0f); x.setEnabled(true); /*cubicChart.getAxisLeft().setValueFormatter(new IAxisValueFormatter() { @Override public String getFormattedValue(float value, AxisBase axis) { return String.format("%.2f $",value); } });*/ YAxis y = cubicChart.getAxisLeft(); y.setTypeface(mTfLight); y.setLabelCount(10, true);// force 10 labels y.setTextColor(Color.WHITE); y.setTextSize(12f);// set the text size y.setAxisMinimum(0f);// start at zero //y.setAxisMaximum(100f);// the axis maximum is 100 y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART); y.setDrawGridLines(true); y.setGranularity(1f); // interval 1 y.setAxisLineColor(Color.WHITE); cubicChart.getAxisRight().setEnabled(false); // add data setData(4, 5); cubicChart.getLegend().setEnabled(true); cubicChart.animateXY(2000, 2000); // dont forget to refresh the drawing cubicChart.invalidate(); } public static void setIMU(int imu) { nowGraphIndexIMU = imu; } private void setData(int count, float range) { ArrayList<Entry> xVals = new ArrayList<Entry>(); ArrayList<Entry> yVals = new ArrayList<Entry>(); ArrayList<Entry> zVals = new ArrayList<Entry>(); /* for (int i = 0; i < count; i++) { float mult = range / 2f; float val = (float) (Math.random() * mult) + 50; xVals.add(new Entry(i, val)); } for (int i = 0; i < count-1; i++) { float mult = range; float val = (float) (Math.random() * mult) + 450; yVals.add(new Entry(i, val)); // if(i == 10) { // yVals2.add(new Entry(i, val + 50)); // } } for (int i = 0; i < count; i++) { float mult = range; float val = (float) (Math.random() * mult) + 500; zVals.add(new Entry(i, val)); }*/ for (int i = 0; i < count; i++) { float mult = (range + 1); float val = (float) (Math.random() * mult) + 20;// + (float) // ((mult * // 0.1) / 10); xVals.add(new Entry(i, val)); yVals.add(new Entry(i, val + 10)); zVals.add(new Entry(i + 2, val + 20)); } LineDataSet x, y, z; if (cubicChart.getData() != null && cubicChart.getData().getDataSetCount() > 0) { x = (LineDataSet) cubicChart.getData().getDataSetByIndex(0); y = (LineDataSet) cubicChart.getData().getDataSetByIndex(1); z = (LineDataSet) cubicChart.getData().getDataSetByIndex(2); x.setValues(xVals); y.setValues(yVals); z.setValues(zVals); cubicChart.getData().notifyDataChanged(); cubicChart.notifyDataSetChanged(); } else { // create a dataset and give it a type x = new LineDataSet(yVals, "x"); x.setMode(LineDataSet.Mode.CUBIC_BEZIER); x.setCubicIntensity(0.2f); x.setDrawFilled(false); x.setDrawCircles(true); //check for numbers x.setLineWidth(1.8f); x.setCircleRadius(4f); x.setCircleColor(Color.WHITE); x.setHighLightColor(Color.rgb(244, 250, 117)); x.setColor(Color.WHITE); x.setFillColor(Color.WHITE); x.setFillAlpha(40); x.setDrawHorizontalHighlightIndicator(true); x.setFillFormatter(new IFillFormatter() { @Override public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { return 0; } }); y = new LineDataSet(yVals, "y"); y.setMode(LineDataSet.Mode.CUBIC_BEZIER); y.setCubicIntensity(0.2f); y.setDrawFilled(true); y.setDrawCircles(true); y.setLineWidth(1.8f); y.setCircleRadius(4f); y.setCircleColor(Color.WHITE); y.setHighLightColor(Color.rgb(244, 117, 117)); y.setColor(Color.WHITE); y.setFillColor(Color.BLACK); y.setFillAlpha(80); y.setDrawHorizontalHighlightIndicator(true); y.setFillFormatter(new IFillFormatter() { @Override public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { return 0; } }); z = new LineDataSet(yVals, "z"); z.setMode(LineDataSet.Mode.CUBIC_BEZIER); z.setCubicIntensity(0.2f); z.setDrawFilled(true); z.setDrawCircles(true); z.setLineWidth(1.8f); z.setCircleRadius(4f); z.setCircleColor(Color.WHITE); z.setHighLightColor(Color.rgb(244, 117, 117)); z.setColor(Color.WHITE); z.setFillColor(Color.BLACK); z.setFillAlpha(80); z.setDrawHorizontalHighlightIndicator(true); z.setFillFormatter(new IFillFormatter() { @Override public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { return 0; } }); // create a data object with the datasets //LineData data = new LineData(x,y,z); LineData data = new LineData(x, y, z); data.setValueTypeface(mTfLight); data.setValueTextSize(12f); data.setDrawValues(true); data.setValueTextColor(Color.WHITE); // set data cubicChart.setData(data); //cubicChart.invalidate(); } } public void pushPlotter(byte[] data) { // setData(); if (data.length == 16 && (currentTab == 0 || currentTab == 1)) { // if ((data.length == 16 && currentTab == 0)||startup) { // Log.d("tag", String.valueOf(startup)); mHandler.post(new Runnable() { @Override public void run() { // dataView.setText(callback_msg); // Log.d("In: ", "EMG Graph"); lineGraph.removeAllLines(); for (int inputIndex = 0; inputIndex < 8; inputIndex++) { dataList1_a[inputIndex][0] = data[0 + inputIndex]; dataList1_b[inputIndex][0] = data[7 + inputIndex]; } // 折れ線グラフ int number = 50; int addNumber = 100; Line line = new Line(); while (0 < number) { number--; addNumber--; //1点目add if (number != 0) { for (int setDatalistIndex = 0; setDatalistIndex < 8; setDatalistIndex++) { dataList1_a[setDatalistIndex][number] = dataList1_a[setDatalistIndex][number - 1]; } } LinePoint linePoint = new LinePoint(); linePoint.setY(dataList1_a[nowGraphIndex][number]); //ランダムで生成した値をSet linePoint.setX(addNumber); //x軸を1ずつずらしてSet //linePoint.setColor(Color.parseColor("#9acd32")); // 丸の色をSet line.addPoint(linePoint); //2点目add /////number--; addNumber--; if (number != 0) { for (int setDatalistIndex = 0; setDatalistIndex < 8; setDatalistIndex++) { dataList1_b[setDatalistIndex][number] = dataList1_b[setDatalistIndex][number - 1]; } } linePoint = new LinePoint(); linePoint.setY(dataList1_b[nowGraphIndex][number]); //ランダムで生成した値をSet linePoint.setX(addNumber); //x軸を1ずつずらしてSet //linePoint.setColor(Color.parseColor("#9acd32")); // 丸の色をSet line.addPoint(linePoint); } line.setColor(lineColor); // 線の色をSet line.setShowingPoints(false); lineGraph.addLine(line); lineGraph.setRangeY(-128, 128); // 表示するY軸の最低値・最高値 今回は0から1まで } }); } else if (data.length == 20 && currentTab == 1) {//emg=false; w = data[0]; x = data[1]; y = data[2]; z = data[3]; roll = Math.atan(2 * (x * w + z * y) / (2 * (x ^ 2 + y ^ 2) - 1)); } } public void pushFeaturePlotter(twoDimArray featureData) { if (mChart != null && currentTab == 1) { mHandler.post(new Runnable() { @Override public void run() { f0 = featureData.getInnerArray(0); f1 = featureData.getInnerArray(1); f2 = featureData.getInnerArray(2); f3 = featureData.getInnerArray(3); f4 = featureData.getInnerArray(4); f5 = featureData.getInnerArray(5); ArrayList<RadarEntry> entries0 = new ArrayList<>(); ArrayList<RadarEntry> entries1 = new ArrayList<RadarEntry>(); ArrayList<RadarEntry> entries2 = new ArrayList<RadarEntry>(); ArrayList<RadarEntry> entries3 = new ArrayList<RadarEntry>(); ArrayList<RadarEntry> entries4 = new ArrayList<RadarEntry>(); ArrayList<RadarEntry> entries5 = new ArrayList<RadarEntry>(); for (int i = 0; i < 8; i++) { //2000 per division 14 000 in total entries0.add(new RadarEntry(setMaxValue(f0.get(i).floatValue() * 200))); entries1.add(new RadarEntry(setMaxValue(f1.get(i).floatValue() * 200))); entries2.add(new RadarEntry(setMaxValue(f2.get(i).floatValue() * 200))); entries3.add(new RadarEntry(setMaxValue(f3.get(i).floatValue() * 170))); entries4.add(new RadarEntry(setMaxValue(f4.get(i).floatValue() * 200))); entries5.add(new RadarEntry(setMaxValue(f5.get(i).floatValue() * 200))); } ArrayList<IRadarDataSet> sets = new ArrayList<IRadarDataSet>(); RadarDataSet set0 = new RadarDataSet(entries0, "MAV"); set0.setColor(Color.rgb(123, 174, 157)); set0.setFillColor(Color.rgb(78, 118, 118)); set0.setDrawFilled(true); set0.setFillAlpha(180); set0.setLineWidth(2f); RadarDataSet set1 = new RadarDataSet(entries1, "WAV"); set1.setColor(Color.rgb(241, 148, 138)); set1.setFillColor(Color.rgb(205, 97, 85)); set1.setDrawFilled(true); set1.setFillAlpha(180); set1.setLineWidth(2f); RadarDataSet set2 = new RadarDataSet(entries2, "Turns"); set2.setColor(Color.rgb(175, 122, 197)); set2.setFillColor(Color.rgb(165, 105, 189)); set2.setDrawFilled(true); set2.setFillAlpha(180); set2.setLineWidth(2f); RadarDataSet set3 = new RadarDataSet(entries3, "Zeros"); set3.setColor(Color.rgb(125, 206, 160)); set3.setFillColor(Color.rgb(171, 235, 198)); set3.setDrawFilled(true); set3.setFillAlpha(180); set3.setLineWidth(2f); RadarDataSet set4 = new RadarDataSet(entries4, "SMAV"); set4.setColor(Color.rgb(39, 55, 70)); set4.setFillColor(Color.rgb(93, 109, 126)); set4.setDrawFilled(true); set4.setFillAlpha(180); set4.setLineWidth(2f); RadarDataSet set5 = new RadarDataSet(entries5, "AdjUnique"); set5.setColor(Color.rgb(10, 100, 126)); // 100 50 70 set5.setFillColor(Color.rgb(64, 154, 180)); set5.setDrawFilled(true); set5.setFillAlpha(180); set5.setLineWidth(2f); if (featuresSelected[0]) sets.add(set0); if (featuresSelected[1]) sets.add(set1); if (featuresSelected[2]) sets.add(set2); if (featuresSelected[3]) sets.add(set3); if (featuresSelected[4]) sets.add(set4); if (featuresSelected[5]) sets.add(set5); if (!sets.isEmpty()) { RadarData data = new RadarData(sets); data.setValueTextSize(18f); data.setDrawValues(false); mChart.setData(data); mChart.notifyDataSetChanged(); mChart.invalidate(); } else { mChart.clear(); } } }); } else if (mChart == null) { Log.d("wassup ", "mchart might be null************************************"); } } public void setEMG(int color, int emg) { lineColor = color; nowGraphIndex = emg; } public void setCurrentTab(int tab) { currentTab = tab; } public void setFeatures(boolean[] features) { featuresSelected = features; } public float setMaxValue(float inValue) { float value = inValue; if (inValue > 14000) { value = 14000; } return value; } }
[ "justinphan96@gmail.com" ]
justinphan96@gmail.com
c38bfedc4952e48d56216b5c7b39a0538de365ac
e77b126b3d07b2e244b0c8c19f8ee3a8055b783c
/app/src/main/java/com/troyafiat/myapplication/MainActivity.java
5053887d5ec7470781d4273b488d7b73c59e3f4d
[]
no_license
troyafiat/HelloWorld
10d9b9186c10b1ac42525ad454201ffc8dfe64d5
6da88e3a4366e44188c150fc6dedda65e0c34cd4
refs/heads/master
2016-09-16T03:25:19.193149
2015-07-30T16:56:09
2015-07-30T16:56:09
39,961,854
0
0
null
null
null
null
UTF-8
Java
false
false
1,126
java
package com.troyafiat.myapplication; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @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); } }
[ "troyafiat@Troy-Afiats-MacBook-Pro.local" ]
troyafiat@Troy-Afiats-MacBook-Pro.local
edd236b636918e8da6a7bcd0d88a5bc565b9db70
4e9198d475736c474b7488b85b3a97923f78c058
/app/src/test/java/ankit/developer/unknowns/animatedgradientbackground/ExampleUnitTest.java
cce3e546abbf031e1f8f6315a87d0ec6af61caff
[]
no_license
unknownsdeveloper/AnimatedGradientBackground
fbf7ce20cad67c58ff02193abe39264c46487d26
1af567d25bd2239bed7dc2cf257ec0d97a269079
refs/heads/master
2021-01-24T08:06:23.629745
2017-06-05T06:24:23
2017-06-05T06:24:23
93,371,938
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package ankit.developer.unknowns.animatedgradientbackground; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "unknownsdeveloper@gmail.com" ]
unknownsdeveloper@gmail.com
9f8171acc79a39ad87bd37ca616f85faf4861291
24676dea3ce4bf2be53c3f78ab9555775b2820bd
/code/client/client-lib/src/main/java/com/google/broker/client/endpoints/CancelSessionToken.java
9594f2e4b2a7f61720e49d15e8c359f3cc04d150
[ "Apache-2.0" ]
permissive
muskanmahajan37/gcp-token-broker
cc821a2ce77a0b70921f599a9e0aabc94e0b6421
7054b650d77aed4944e694abb1669948f4dc26ec
refs/heads/master
2022-12-29T17:04:58.955537
2020-05-21T00:18:48
2020-05-21T00:18:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,353
java
// Copyright 2020 Google LLC // 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.google.broker.client.endpoints; import com.google.broker.client.connect.BrokerGateway; import com.google.broker.client.connect.BrokerServerInfo; // Classes dynamically generated by protobuf-maven-plugin: import com.google.cloud.broker.apps.brokerserver.protobuf.CancelSessionTokenRequest; public class CancelSessionToken { public static void submit(BrokerServerInfo serverInfo, String sessionToken) { BrokerGateway gateway = new BrokerGateway(serverInfo); gateway.setSPNEGOToken(); CancelSessionTokenRequest request = CancelSessionTokenRequest.newBuilder() .setSessionToken(sessionToken) .build(); gateway.getStub().cancelSessionToken(request); gateway.getManagedChannel().shutdown(); } }
[ "jphalip@gmail.com" ]
jphalip@gmail.com
3b5f11311f5dbbb8350f7bac114c6246bf2b0bb4
b0aa5fa2da4848ef6194763615d6473272a954b0
/micro-service/课程项目/content-center/src/main/java/com/soft1851/contentcenter/dao/NoticeMapper.java
73bcbd08001272b2a9d0dac074f6d33a8ccbab1e
[]
no_license
WHL1998w/micro-service
806273854742c895048e541c6701cf13cbff475b
89cdceee7556007b93757ffd862e29d9abde7948
refs/heads/master
2022-12-29T21:13:33.206693
2020-10-05T04:54:29
2020-10-05T04:54:29
297,012,659
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package com.soft1851.contentcenter.dao; import com.soft1851.contentcenter.domain.entity.Notice; import tk.mybatis.mapper.common.Mapper; /** * @ClassName * @Description TODO * @Author wanghuanle * @Date **/ public interface NoticeMapper extends Mapper<Notice> { }
[ "wanghuanle@qq.com" ]
wanghuanle@qq.com
a552be2f8072460468929882cadf1f240f93f6f9
9f202690bdc92f71c11d74e17b98097aa8377b28
/src/main/java/com/zlimbo/bcweb/domain/Invoice.java
6d228f7ab7b32937049e7ed82bbf3852167f5bf5
[]
no_license
zLimbo/bcweb
071131fcbfe56f5e45f51829e3b2bb087651019d
6ec7eccdbefe097dab9926a71313e0c0422cc2eb
refs/heads/master
2022-12-31T11:08:37.394984
2020-10-22T12:21:05
2020-10-22T12:21:05
301,273,000
0
0
null
null
null
null
UTF-8
Java
false
false
24,895
java
package com.zlimbo.bcweb.domain; import jnr.ffi.annotations.In; import java.text.SimpleDateFormat; import java.util.*; public class Invoice { private String hashValue; private String invoiceNo; private String buyerName; private String buyerTaxesNo; private String sellerName; private String sellerTaxesNo; private String invoiceDate; private String invoiceType; private String taxesPoint; private String taxes; private String price; private String pricePlusTaxes; private String invoiceNumber; private String statementSheet; private String statementWeight; private String timestamp; private String contractAddress; public Invoice() { } public Invoice(String hashValue, String invoiceNo, String buyerName, String buyerTaxesNo, String sellerName, String sellerTaxesNo, String invoiceDate, String invoiceType, String taxesPoint, String taxes, String price, String pricePlusTaxes, String invoiceNumber, String statementSheet, String statementWeight, String timestamp, String contractAddress) { this.hashValue = hashValue; this.invoiceNo = invoiceNo; this.buyerName = buyerName; this.buyerTaxesNo = buyerTaxesNo; this.sellerName = sellerName; this.sellerTaxesNo = sellerTaxesNo; this.invoiceDate = invoiceDate; this.invoiceType = invoiceType; this.taxesPoint = taxesPoint; this.taxes = taxes; this.price = price; this.pricePlusTaxes = pricePlusTaxes; this.invoiceNumber = invoiceNumber; this.statementSheet = statementSheet; this.statementWeight = statementWeight; this.timestamp = timestamp; this.contractAddress = contractAddress; } public String getHashValue() { return hashValue; } public void setHashValue(String hashValue) { this.hashValue = hashValue; } public String getInvoiceNo() { return invoiceNo; } public void setInvoiceNo(String invoiceNo) { this.invoiceNo = invoiceNo; } public String getBuyerName() { return buyerName; } public void setBuyerName(String buyerName) { this.buyerName = buyerName; } public String getBuyerTaxesNo() { return buyerTaxesNo; } public void setBuyerTaxesNo(String buyerTaxesNo) { this.buyerTaxesNo = buyerTaxesNo; } public String getSellerName() { return sellerName; } public void setSellerName(String sellerName) { this.sellerName = sellerName; } public String getSellerTaxesNo() { return sellerTaxesNo; } public void setSellerTaxesNo(String sellerTaxesNo) { this.sellerTaxesNo = sellerTaxesNo; } public String getInvoiceDate() { return invoiceDate; } public void setInvoiceDate(String invoiceDate) { this.invoiceDate = invoiceDate; } public String getInvoiceType() { return invoiceType; } public void setInvoiceType(String invoiceType) { this.invoiceType = invoiceType; } public String getTaxesPoint() { return taxesPoint; } public void setTaxesPoint(String taxesPoint) { this.taxesPoint = taxesPoint; } public String getTaxes() { return taxes; } public void setTaxes(String taxes) { this.taxes = taxes; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getPricePlusTaxes() { return pricePlusTaxes; } public void setPricePlusTaxes(String pricePlusTaxes) { this.pricePlusTaxes = pricePlusTaxes; } public String getInvoiceNumber() { return invoiceNumber; } public void setInvoiceNumber(String invoiceNumber) { this.invoiceNumber = invoiceNumber; } public String getStatementSheet() { return statementSheet; } public void setStatementSheet(String statementSheet) { this.statementSheet = statementSheet; } public String getStatementWeight() { return statementWeight; } public void setStatementWeight(String statementWeight) { this.statementWeight = statementWeight; } public String getTimestamp() { return timestamp; } public void setTimestamp(String timestamp) { this.timestamp = timestamp; } public String getContractAddress() { return contractAddress; } public void setContractAddress(String contractAddress) { this.contractAddress = contractAddress; } public static Invoice getRandomInvoice() { Random random = new Random(); Invoice invoice = new Invoice(); String hashValue = getHexString(32); String invoiceNo = getOctString(10); String[] buyer = COMPANY_TAXESNO[random.nextInt(COMPANY_TAXESNO.length)]; String[] seller = COMPANY_TAXESNO[random.nextInt(COMPANY_TAXESNO.length)]; String buyerName = buyer[0]; String buyerTaxesNo = buyer[1]; String sellerName = seller[0]; String sellerTaxesNo = seller[1]; String invoiceDate = new SimpleDateFormat("yyyy-MM-dd" ).format(new Date()); String invoiceType = INVOICE_KIND[random.nextInt(INVOICE_KIND.length)]; String taxesPoint = (10 + random.nextInt(10)) + "%"; int taxesRaw = 100 + random.nextInt(1000); int priceRaw = 10000 + random.nextInt(100000); String taxes = "" + taxesRaw; String price = "" + priceRaw; String pricePlusTaxes = "" + (taxesRaw + priceRaw); String invoiceNumber = "" + (1 + random.nextInt(3)); String statementSheet = "" + (1 + random.nextInt(3)); String statementWeight = (1 + random.nextInt(10)) + "kg"; String timestamp = "" + System.currentTimeMillis(); String contractAddress = getHexString(16); return new Invoice( hashValue, invoiceNo, buyerName, buyerTaxesNo, sellerName, sellerTaxesNo, invoiceDate, invoiceType, taxesPoint, taxes, price, pricePlusTaxes, invoiceNumber, statementSheet, statementWeight, timestamp, contractAddress); } final static String[] INVOICE_KIND = {"增值税发票", "普通发票", "专业发票"}; public static List<Character> Hex = Arrays.asList('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); // 返回指定的十六进制字符串 public static String getHexString(int length) { StringBuilder stringBuilder = new StringBuilder("0x"); Random random = new Random(); while (length-- != 0) { stringBuilder.append(Hex.get(random.nextInt(16))); } return stringBuilder.toString(); } public static String getOctString(int length) { StringBuilder stringBuilder = new StringBuilder("0x"); Random random = new Random(); while (length-- != 0) { stringBuilder.append(Hex.get(random.nextInt(10))); } return stringBuilder.toString(); } final static String[][] COMPANY_TAXESNO = { {"证券简称", "736763JRERB3H54"}, {"荣丰控股", "737462HU9S9DTV8"}, {"三湘印象", "7387169WWD894R7"}, {"科华生物", "734551HGHYFPFA1"}, {"思源电气", "73994732QUV1XE0"}, {"威尔泰", "739185FCFOYGHBX"}, {"中国海诚", "739272L15GREYJ8"}, {"汉钟精机", "731305KG24YXJG9"}, {"悦心健康", "7342506SXUSOGI0"}, {"延华智能", "737055XVKT065P9"}, {"海得控制", "736059BSIW8FX25"}, {"二三四五", "733586OLXQYVX56"}, {"宏达新材", "731090NISOL3SV0"}, {"上海莱士", "738228RGSDL42H5"}, {"美邦服饰", "734878VQ2382VF6"}, {"神开股份", "736219HEXL3WNW6"}, {"普利特", "733135P67MTGUG0"}, {"新朋股份", "735120MK0AYVQP2"}, {"柘中股份", "737417TS3T23JK9"}, {"中远海科", "7308634W22HY8N6"}, {"摩恩电气", "735324TP9IO6X53"}, {"松芝股份", "733206X24M35MA7"}, {"嘉麟杰", "733979FK8NVYNT3"}, {"协鑫集成", "73665460YTH5UA1"}, {"新时达", "739237HU7DLFS01"}, {"徐家汇", "7365211MU3P3P5X"}, {"顺灏股份", "738962FEXP7C5E0"}, {"百润股份", "735114V6OYDWAJX"}, {"姚记科技", "734450L20PON6EX"}, {"金安国纪", "738111YSESAJP22"}, {"康达新材", "7391739NQT6ROD9"}, {"良信电器", "731974JGB72L8C0"}, {"纳尔股份", "7369379YTKT4QD1"}, {"力盛赛车", "7319402V7M3FSN4"}, {"天海防务", "735895GTW8V03F9"}, {"网宿科技", "7337180P2X6PUS6"}, {"上海凯宝", "739536F7QW2K8R9"}, {"东方财富", "7373367NFM873UX"}, {"旗天科技", "739917AU6DQ2Y25"}, {"安诺其", "7398825GAOGR6R5"}, {"华平股份", "7348944KPNEPFY7"}, {"锐奇股份", "739343RH42B0QG4"}, {"泰胜风能", "7329333SBDVNC8X"}, {"科泰电源", "7334375PVF7SOV9"}, {"万达信息", "7324609HBLXQ8M9"}, {"汉得信息", "735830YQTWOXGO3"}, {"东富龙", "731887ICQKDTBR1"}, {"华峰超纤", "7312692PXGMUYX9"}, {"科大智能", "732830VVL5VSYY1"}, {"金力泰", "7317969P4JTFW20"}, {"上海钢联", "7399005G79UCVY8"}, {"永利股份", "738082QB080WVA3"}, {"上海新阳", "730561WBXHCUJ4X"}, {"天玑科技", "739093RODNBA4U7"}, {"卫宁健康", "735980FGEJ72SC0"}, {"巴安水务", "734156KOPSU5JQ5"}, {"开能健康", "732671A9RD43Q7X"}, {"安科瑞", "738566C559JDY68"}, {"凯利泰", "739016XI5KO3BU8"}, {"中颖电子", "739439P60C8CSO6"}, {"华虹计通", "731091EL2JQF4AX"}, {"新文化", "732516K86BH9EY0"}, {"鼎捷软件", "738245L775DFQR4"}, {"安硕信息", "739758Q85U0J5T6"}, {"飞凯材料", "734989THUOVL9R4"}, {"普丽盛", "734644GG33N5XB2"}, {"华铭智能", "732727TKKEQGR27"}, {"信息发展", "732897N308J4BK4"}, {"沃施股份", "739108USVBJMV83"}, {"润欣科技", "739937L6YA0SRD0"}, {"海顺新材", "734748UAO3E7SC3"}, {"维宏股份", "734905HMDA7PDF9"}, {"雪榕生物", "739077CX5TMVOF3"}, {"古鳌科技", "735089TDWX0TW69"}, {"会畅通讯", "736280SI9J3UEJ6"}, {"移为通信", "739030WXYQWLBF3"}, {"汇纳科技", "739027AR27XJQ5X"}, {"富瀚微", "731294241FWESA8"}, {"华测导航", "738555MC5WN8P17"}, {"透景生命", "736446KTH55TKQ3"}, {"上海瀚讯", "7388580KH1G8XC2"}, {"矩子科技", "731234LM4MKOAQ1"}, {"浦发银行", "735682D7BKUIP00"}, {"上海机场", "736805HWF9QNNC5"}, {"上港集团", "730093PMES3ICQ8"}, {"宝钢股份", "734934Y73NDRUN3"}, {"上海电力", "738335WE7B8HYJ9"}, {"中远海能", "738928DPR7U5658"}, {"国投资本", "733019TIKK775I8"}, {"中船科技", "7379237HDX52G01"}, {"上海梅林", "730115CTYLL1220"}, {"东风科技", "732092XSIJJUCW6"}, {"中视传媒", "7332881UDWYQ6G5"}, {"大名城", "731979HS4YE90X5"}, {"开创国际", "730359CMXQXO4D9"}, {"上汽集团", "739487RMLNASKP9"}, {"东方航空", "7385243VRE8KYG2"}, {"ST长投", "733374B9KLS6S06"}, {"中国船舶", "7399465MHRXA5K5"}, {"航天机电", "733046K6PK2SFB4"}, {"上海建工", "732912DBHM76VWX"}, {"上海贝岭", "73815746CLN9IC5"}, {"ST创兴", "7355809WB7KEIF3"}, {"复星医药", "731896L35F0EW76"}, {"紫江企业", "735474V8WSKU8M0"}, {"开开实业", "7311720HCR3HQT4"}, {"东方创业", "735674C2NN28XK4"}, {"浦东建设", "738720DNQRDAFL6"}, {"上海家化", "737825I51MLRB77"}, {"振华重工", "7304037HH6A8XM6"}, {"现代制药", "736977KDKUD1AG5"}, {"鹏欣资源", "737111PQHNJHRC9"}, {"中化国际", "739874L8BDK4J56"}, {"华丽家族", "733240U6SJXIQA5"}, {"上海能源", "7301500XLP6F144"}, {"置信电气", "7334654QCYJT384"}, {"交大昂立", "738418NJ1TLXDE7"}, {"宏达矿业", "734030770NJEHB8"}, {"光明乳业", "733392XGO2IXJC1"}, {"方正科技", "7395081WWPAFYX7"}, {"云赛智联", "733225S2NFVR7W6"}, {"市北高新", "734297CCHAGU0A2"}, {"汇通能源", "738253SK8AWND94"}, {"绿地控股", "733334NWC4DL569"}, {"ST沪科", "737385Q2XESW4N3"}, {"ST毅达", "736531RDEPB2K05"}, {"大众交通", "733492JTWEWF2Y1"}, {"老凤祥", "731697K29NY5VX7"}, {"神奇制药", "738595P09I2CIP8"}, {"丰华股份", "739994PMBILTC41"}, {"金枫酒业", "735047TV94IS5I8"}, {"氯碱化工", "733610M2DUADG00"}, {"海立股份", "734075SM23UXDT4"}, {"天宸股份", "73679221H4MFHJ8"}, {"华鑫股份", "739063KTAA7OHO7"}, {"光大嘉宝", "730415FUU5METM0"}, {"华谊集团", "734111DBL850569"}, {"复旦复华", "736407SMITD17U7"}, {"申达股份", "737110Q6DR3E6J8"}, {"新世界", "735041XLVYVCLT7"}, {"华建集团", "735719NU4PPSSG9"}, {"龙头股份", "7385455PA15XTF1"}, {"ST富控", "73114966NG61T88"}, {"大众公用", "739273VWKQNT3VX"}, {"三爱富", "731154VB73S8NY0"}, {"东方明珠", "737278RMY1Y6001"}, {"新黄浦", "733850EXAHMGYJ1"}, {"浦东金桥", "733574U9OE1OFX4"}, {"号百控股", "730460TU01YHP88"}, {"万业企业", "7388015IALW219X"}, {"申能股份", "7348453LGJDBTX0"}, {"爱建集团", "731914A97V77CU6"}, {"同达创业", "7387993UQY50UAX"}, {"外高桥", "731535U96US9ER7"}, {"城投控股", "730487GDYC4U1C5"}, {"锦江投资", "733051IJCDIHO36"}, {"飞乐音响", "7301833GPSWEYF3"}, {"ST游久", "734494GFE9MASR1"}, {"申华控股", "736375XKYS179X2"}, {"ST中安", "737455LFIPCUEE4"}, {"豫园股份", "731065Y3GK86NS1"}, {"昂立教育", "7314705HCSPI4H6"}, {"强生控股", "737120FLLHCKL70"}, {"陆家嘴", "734250N6QT428U7"}, {"中华企业", "73915701H5QLXT6"}, {"交运股份", "7360014M44J7WJ2"}, {"上海凤凰", "731126D8LAHXH10"}, {"上海石化", "73810463XNW9XX5"}, {"上海三毛", "735105XB25JAT55"}, {"亚通股份", "737707HEPL9AF52"}, {"绿庭投资", "732243JAO5UMVO0"}, {"ST岩石", "730457JP1BB2KG5"}, {"光明地产", "734710V7233GV56"}, {"ST爱旭", "734249EH6KSNYS4"}, {"华域汽车", "736195P9OS45392"}, {"上实发展", "735615U0QXPTMP6"}, {"锦江酒店", "730688D1J3XCAC0"}, {"ST运盛", "73292259D8HIEYX"}, {"安信信托", "730117JGDPQ0IC8"}, {"中路股份", "731720LJNC238Y3"}, {"耀皮玻璃", "73145750J4TIA14"}, {"隧道股份", "7332763RDE6X229"}, {"上海物贸", "733037YEJG1PBI9"}, {"世茂股份", "739529HJRYA7T44"}, {"益民集团", "732763O7Y67XYV6"}, {"新华传媒", "7396682JSLTBNH8"}, {"兰生股份", "736554N381OWVN8"}, {"百联股份", "733459OUGAJ3EC1"}, {"第一医药", "737108YSYJGYHQX"}, {"申通地铁", "730357EIH33KLVX"}, {"上海机电", "739017PGDOY03Y9"}, {"界龙实业", "737656V70L17144"}, {"海通证券", "734316Y2KXBNEDX"}, {"上海九百", "731115X7YEW5BL0"}, {"上柴股份", "730422AT9W1L2MX"}, {"上工申贝", "734630V36POYMC2"}, {"宝信软件", "735899P8TVGFAUX"}, {"同济科技", "738966V2M5LEBF3"}, {"上海临港", "733845U5RN6RSK5"}, {"华东电脑", "736559JEEJJU3B7"}, {"海欣股份", "735730MIQ0ALLJ4"}, {"妙可蓝多", "731558VRTFVT7F6"}, {"张江高科", "735909FYLDU4NM4"}, {"东方证券", "735129ND823XM16"}, {"春秋航空", "7378857IBHDI7R8"}, {"上海环境", "738233PBCS3DBL3"}, {"国泰君安", "732937RPHHXXOC5"}, {"上海银行", "738717X6KKTAO3X"}, {"环旭电子", "736512YSS67YA6X"}, {"交通银行", "736776U6SW94297"}, {"大智慧", "737166PKJ1ISGX7"}, {"上海电影", "731929JNI82P4C5"}, {"中国太保", "7328842Q69Q0QJ1"}, {"上海医药", "733219HT9S541Y4"}, {"中国核建", "7336417CGJ9SL35"}, {"广电电气", "732351UJVO5BYI7"}, {"中银证券", "739207FMHXVL3C4"}, {"上海电气", "732454E9VPUAL76"}, {"光大证券", "73112946NHRQ5S8"}, {"美凯龙", "7366025TH7FY4I7"}, {"中远海发", "734338ULCG7TM33"}, {"招商轮船", "736591EPX2ELQE9"}, {"宝钢包装", "732110OOWW63K24"}, {"龙宇燃油", "7306245UDIIST56"}, {"联明股份", "7357429TSAEJXD6"}, {"北特科技", "7331264G7YJI7B9"}, {"创力集团", "735457QC618NR54"}, {"爱普股份", "7385691CXW3L5B6"}, {"新通联", "739024LJUDT83G9"}, {"全筑股份", "733576F5SD6NC45"}, {"凯众股份", "737771HBR6DJ2N2"}, {"泛微网络", "7364413YLO78W85"}, {"德邦股份", "737059GJPYWCH83"}, {"博通集成", "738070D71LJHAB5"}, {"剑桥科技", "730572JDQHTPX05"}, {"润达医疗", "736876ODGJOQIS4"}, {"华培动力", "7350244DDXJMB98"}, {"华贸物流", "733646088UMTNG8"}, {"上海沪工", "735445NUVO6HK44"}, {"拉夏贝尔", "73292660BSX7AIX"}, {"上海亚虹", "730749V2MF4FUD7"}, {"网达软件", "737066QDWMRRYM2"}, {"汇得科技", "733768RX5OM53Q3"}, {"日播时尚", "737677E8S3MAXTX"}, {"保隆科技", "731114ANPJPBH71"}, {"上海洗霸", "730623QPOXS2QF0"}, {"爱婴室", "7341497UIITXW01"}, {"菲林格尔", "7313040BPF80YMX"}, {"格尔软件", "7356204QBST0040"}, {"移远通信", "739295PWHU3CYB2"}, {"宏和科技", "733827SG9M9USLX"}, {"上海雅仕", "730489Y87PHI0G5"}, {"上海天洋", "733441WIOMYM9S4"}, {"水星家纺", "737158JDC38B944"}, {"亚士创能", "7383016GDI3XSU2"}, {"风语筑", "7361005EPY6I8A9"}, {"恒为科技", "7329568NWIBM1B3"}, {"翔港科技", "737570R8NXR99FX"}, {"韦尔股份", "736468S7WQUKDC0"}, {"欧普照明", "732181O2IWRQ7P1"}, {"荣泰健康", "738436M2RVGKFIX"}, {"艾艾精工", "737554D5T4139J6"}, {"地素时尚", "738550Q2Q5VUEH8"}, {"中曼石油", "738369IQBCPQ8Y3"}, {"徕木股份", "7373156T606ROC8"}, {"畅联股份", "735690Q7MIUXB64"}, {"彤程新材", "731981CVVT1FH75"}, {"璞泰来", "7347026SMUGEPV1"}, {"永冠新材", "732606QA6Y4MCP0"}, {"晶华新材", "735238QU5746C17"}, {"至纯科技", "730833CX5DIKC40"}, {"密尔克卫", "7397406M1NT7QR0"}, {"海利生物", "736779TB2F4YC93"}, {"鸣志电器", "734506A7QUSWDN4"}, {"龙韵股份", "7376418DYMUPCKX"}, {"岱美股份", "7377832LFXY42B8"}, {"来伊份", "731694UVDB318EX"}, {"科博达", "734084BYDM98AE7"}, {"雅运股份", "7320064G5K6KY09"}, {"华荣股份", "7372401S01HNR08"}, {"飞科电器", "734492OBVOW2BE8"}, {"数据港", "73940845KXTQ7M8"}, {"吉祥航空", "733723T0KTPB7L7"}, {"元祖股份", "737965JLDF6SY40"}, {"城地股份", "737145NMSSW1CK1"}, {"天永智能", "735398PI8IM35V2"}, {"晨光文具", "732267ECFHFF431"}, {"金桥信息", "734241B9GRK34C8"}, {"威派格", "732934IEPT3VCR2"}, {"克来机电", "731077BFO5WFVE0"}, {"康德莱", "736309QM2GOYVD5"}, {"至正股份", "7336385JAOIHBB0"}, {"澜起科技", "7365513E7BVS5P8"}, {"中微公司", "731893EMEDQ7502"}, {"心脉医疗", "737353FBNQSLS11"}, {"乐鑫科技", "7377029EIXPJ8A0"}, {"安集科技", "737989QKUG99X21"}, {"申联生物", "730146LCBBRPNT6"}, {"晶晨股份", "737962HN9EDUP17"}, {"普元信息", "7359276QNU45K35"}, {"聚辰股份", "7319047HA2DM8U0"}, {"优刻得", "734884BPHUJYY37"}, {"柏楚电子", "7388021KSTN0P29"}, {"美迪西", "73565890PDDO093"}, {"昊海生科", "736326ROHSMAYW6"}, {"晶丰明源", "7347372A9BX0IL4"} }; //生成企业组织机构代码 public static String getORGANIZATION_CODE(){ int [] in = { 3, 7, 9, 10, 5, 8, 4, 2 }; String data = ""; String yz = ""; int a = 0; //随机生成英文字母和数字 for (int i = 0; i < in.length; i++){ String word = getCharAndNumr(1,0).toUpperCase(); if (word.matches("[A-Z]")) { a += in[i] * getAsc(word); }else{ a += in[i] * Integer.parseInt(word); } data += word; } //确定序列 int c9 = 11 - a % 11; //判断c9大小,安装 X 0 或者C9 if (c9 == 10) { yz = "X"; } else if (c9 == 11) { yz = "0"; } else { yz = c9 + ""; } data += "-"+yz; return data.toUpperCase(); } //生成税务登记号码 public static String getTAX_REGISTRATION_CODE(){ String data = ""; String first = "73"+getCharAndNumr(4,2); String end = getORGANIZATION_CODE(); data= first+end; data =data.toUpperCase().replaceAll("-",""); if (!test5(data.toUpperCase())) getTAX_REGISTRATION_CODE(); return data; } public static int getAsc(String st) { byte[] gc = st.getBytes(); int ascNum = (int) gc[0] - 55; return ascNum; } public static boolean test5(String data){ String regex = "[1-8][1-6]\\d{4}[a-zA-Z0-9]{9}$"; if (!data.matches(regex)) { return false; }else return true; } public static String getCharAndNumr(int length,int status) { Random random = new Random(); StringBuffer valSb = new StringBuffer(); String charStr = "0123456789abcdefghijklmnopqrstuvwxy"; if (status == 1) charStr = "0123456789"; if (status == 2) charStr = "0123456789"; if (status == 3) charStr = "0123456789ABCDEFGHJKLMNPQRTUWXY"; int charLength = charStr.length(); for (int i = 0; i < length; i++) { int index = random.nextInt(charLength); if (status==1&&index==0){ index =3;} valSb.append(charStr.charAt(index)); } return valSb.toString(); } }
[ "z_limbo@foxmail.com" ]
z_limbo@foxmail.com
cc3b658ff1d9bd9598cb8ca1c473d98f3e090b2d
a620f87920534d699ce819fe81dbf9c580e04ae2
/SanderMark/QL/src/com/form/language/issue/Error.java
e851877447e9b413fcb6991ea6c05f642c96f728
[]
no_license
software-engineering-amsterdam/many-ql
59384e104574a431a72a34abeed13c2d330aa01b
029b5298ad1c5886819bea0b7b681ea699b9b2a0
refs/heads/master
2021-01-18T18:37:16.136867
2015-09-29T11:53:41
2015-09-29T11:53:41
29,917,329
7
14
null
2020-10-12T19:24:31
2015-01-27T14:20:59
Java
UTF-8
Java
false
false
345
java
package com.form.language.issue; public class Error extends Issue{ public Error(QLToken offendingToken, String message) { super(offendingToken, message); } @Override public String toString() { return "Error: " + message + " Line: " + offendingToken.getLine() + ", Column: " + offendingToken.getCharPositionInLine(); } }
[ "sanderbos89@gmail.com" ]
sanderbos89@gmail.com
47aa061a607142198a000a27ca85c11add1b68b4
12a22e859dc12f67c0e2daea493f9effd204bf3f
/src/Question1460.java
d9955c38c1b77d09b164549dbcf747ebd1246294
[]
no_license
fuenhui/leetcode
6806dff93deb62c9ecc0a50ea8f59f621cc9854e
bf2f59023a465ff8b5422f64614719201ff71d5e
refs/heads/master
2023-03-17T02:18:28.153410
2021-03-08T12:55:14
2021-03-08T12:55:14
327,229,472
0
0
null
null
null
null
UTF-8
Java
false
false
600
java
import java.util.Arrays; /** * https://leetcode-cn.com/problems/make-two-arrays-equal-by-reversing-sub-arrays/ * * @author fuenhui * @date 2021/03/06 */ public class Question1460 { public boolean canBeEqual(int[] target, int[] arr) { if (target.length != arr.length) { return false; } int[] a = Arrays.stream(target).sorted().toArray(); int[] b = Arrays.stream(arr).sorted().toArray(); for (int i = 0; i < a.length; i++) { if (a[i] != b[i]) { return false; } } return true; } }
[ "fuenhui@163.com" ]
fuenhui@163.com
e2e2ca0b7655edc65f9481f9400dc839049cfcd0
687c0a1b8b2fe3a2700810a13b4e8e13301c3087
/leetcode/array_string/IsSubsequence.java
5d72288c0c1edf2b2a3d95ab940b0601ee4034c5
[ "MIT" ]
permissive
hzheng/algo-problems
871f40e07d92636513ffcceef30f2b387ca0cbae
780f6cc6799cb82954b2ba2386aa7391f71d5003
refs/heads/main
2023-02-19T06:57:38.417365
2023-02-14T19:08:41
2023-02-14T19:08:41
153,545,000
4
1
null
null
null
null
UTF-8
Java
false
false
4,551
java
import java.util.*; import org.junit.Test; import static org.junit.Assert.*; // LC392: https://leetcode.com/problems/is-subsequence/ // // Given a string s and a string t, check if s is subsequence of t. // Follow up: // If there are lots of incoming S, say S1, S2, ... , Sk where k >= 1B, and you // want to check one by one to see if T has its subsequence. In this scenario, // how would you change your code? public class IsSubsequence { // Two Pointers // beats 44.79%(46 ms for 14 tests) public boolean isSubsequence(String s, String t) { int sLen = s.length(); int tLen = t.length(); int i = 0; for (int j = 0; i < sLen && j < tLen; j++) { if (s.charAt(i) == t.charAt(j)) { i++; } } return i == sLen; } // Two Pointers // beats 66.68%(33 ms for 14 tests) public boolean isSubsequence2(String s, String t) { int sLen = s.length(); int tLen = t.length(); for (int i = 0, j = 0; i < sLen && j < tLen; j++) { if (s.charAt(i) == t.charAt(j)) { if (++i == sLen) return true; } } return sLen == 0; } // beats 96.66%(2 ms for 14 tests) public boolean isSubsequence3(String s, String t) { int sLen = s.length(); int tLen = t.length(); if (tLen < sLen) return false; for (int i = 0, prev = 0; i < sLen; i++, prev++) { prev = t.indexOf(s.charAt(i), prev); if (prev == -1) return false; } return true; } // Solution of Choice // beats 96.66%(2 ms for 14 tests) public boolean isSubsequence4(String s, String t) { int index = 0; for (char c : s.toCharArray()) { index = t.indexOf(c, index); if (++index == 0) return false; } return true; } // Recursion // beats 45.96%(45 ms for 14 tests) public boolean isSubsequence5(String s, String t) { if (s.isEmpty()) return true; for (int i = 0; i < t.length(); i++) { if (t.charAt(i) == s.charAt(0)) { return isSubsequence5(s.substring(1), t.substring(i + 1)); } } return false; } // Recursion // beats 89.54%(11 ms for 14 tests) public boolean isSubsequence5_2(String s, String t) { return isSubsequence(s.toCharArray(), t.toCharArray(), 0, 0); } private boolean isSubsequence(char[] s, char[] t, int sIndex, int tIndex) { if (sIndex == s.length) return true; for (int i = tIndex; i < t.length; i++) { if (t[i] == s[sIndex]) return isSubsequence(s, t, sIndex + 1, ++i); } return false; } // Solution of Choice // Binary Search (for follow-up) // beats 27.80%(57 ms for 14 tests) public boolean isSubsequence6(String s, String t) { @SuppressWarnings("unchecked") List<Integer>[] list = new List[26]; for (int i = 0; i < t.length(); i++) { int index = t.charAt(i) - 'a'; if (list[index] == null) { list[index] = new ArrayList<>(); } list[index].add(i); } for (int i = 0, prev = 0; i < s.length(); i++) { int index = s.charAt(i) - 'a'; if (list[index] == null) return false; int j = Collections.binarySearch(list[index], prev); if (j < 0) { j = -j - 1; } if (j == list[index].size()) return false; prev = list[index].get(j) + 1; } return true; } void test(String s, String t, boolean expected) { assertEquals(expected, isSubsequence(s, t)); assertEquals(expected, isSubsequence2(s, t)); assertEquals(expected, isSubsequence3(s, t)); assertEquals(expected, isSubsequence4(s, t)); assertEquals(expected, isSubsequence5(s, t)); assertEquals(expected, isSubsequence5_2(s, t)); assertEquals(expected, isSubsequence6(s, t)); } @Test public void test1() { test("", "ace", true); test("ac", "ace", true); test("ace", "abcde", true); test("aec", "abcde", false); test("abc", "ahbgdc", true); test("axc", "ahbgdc", false); test("abcd", "ahbagdbcccaaad", true); test("abcd", "ahbagdbcccaaa", false); } public static void main(String[] args) { org.junit.runner.JUnitCore.main("IsSubsequence"); } }
[ "xyzdll@gmail.com" ]
xyzdll@gmail.com
d88b1517d20ec2de80f03b9fb5bc93ee1688469b
fa8156730cbec6e0f2acaf6f0f34f61f7de15aea
/src/Demo130121.java
a0e0a517a8e12f2901804942a002bd9cbeac489a
[]
no_license
yeputons/Android239
165e83f712b1037197367665600f270f7bc69834
3cea610b478ffe69c75b699c8973eb70539305a9
refs/heads/master
2020-06-06T06:27:31.335417
2013-04-22T07:47:49
2013-04-22T07:47:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,496
java
public class Demo130121 { public static void main(String[] args) { helloWorld(); int[][] array = initializeNewArray(3, 4); // array = new int[3][4] fillArray(array); System.out.println(array[2][3]); demonstratePrint(); } private static void helloWorld() { System.out.printf("Hello World! 2+2=%d\n", 2 + 2); } private static int[][] initializeNewArray(int size1, int size2) { return new int[size1][size2]; } // Remember, the 'array' variable here is just a reference to a memory area, // where the data lies. So if you change data, it changes in the caller. // But if you changes the variable itself, it won't affect environment. private static void fillArray(int[][] array) { for (int i = 0; i < array.length; i++) for (int j = 0; j < array[i].length; j++) array[i][j] = i + j; // The following lines do nothing array = new int[1][1]; array[0][0] = 239; } private static void demonstratePrint() { String s = "a" + Integer.toString(2) + "b"; int minusTwo = Integer.parseInt("-2"); double floatingPointNumber = 1.0 / 239.0; // %.4f means 'round to four digits'. There are other options, just google // 'printf formatting' System.out.printf("s=%s, minusTwo=%d, floatingPointNumber=%.4f=%f\n", s, minusTwo, floatingPointNumber, floatingPointNumber); } }
[ "egor.suvorov@gmail.com" ]
egor.suvorov@gmail.com
b36ec6e0ffcbc74df0eb6b6aa577c0c05583cd49
c753b739b8e5484c0251113b797c442ef0b3bb49
/src/org/greatfree/framework/container/cps/threenode/coordinator/Coordinator.java
69d21289acd69a34b0389f279f8de84f379e933e
[]
no_license
640351963/Wind
144c0e9e9f3fdf3ee398f9f1a26a3434ca2dfabf
0493d95a1fa8de2de218e651e8ce16be00b8ba38
refs/heads/master
2023-05-03T03:17:06.737980
2021-05-22T19:24:41
2021-05-22T19:24:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,607
java
package org.greatfree.framework.container.cps.threenode.coordinator; import java.io.IOException; import org.greatfree.data.ServerConfig; import org.greatfree.exceptions.RemoteReadException; import org.greatfree.message.ServerMessage; import org.greatfree.server.container.PeerContainer; import org.greatfree.server.container.ServerTask; import org.greatfree.util.TerminateSignal; // Created: 12/31/2018, Bing Li public class Coordinator { private PeerContainer peer; public Coordinator() { } private static Coordinator instance = new Coordinator(); public static Coordinator CPS_CONTAINER() { if (instance == null) { instance = new Coordinator(); return instance; } else { return instance; } } public void stop(long timeout) throws ClassNotFoundException, IOException, InterruptedException, RemoteReadException { TerminateSignal.SIGNAL().setTerminated(); this.peer.stop(timeout); } public void start(String peerName, int port, ServerTask task, boolean isRegistryNeeded) throws IOException, ClassNotFoundException, RemoteReadException { this.peer = new PeerContainer(peerName, port, task, isRegistryNeeded); this.peer.start(); } public void notify(ServerMessage notification) throws IOException, InterruptedException { this.peer.syncNotify(ServerConfig.TERMINAL_ADDRESS, ServerConfig.TERMINAL_PORT, notification); } public ServerMessage read(ServerMessage request) throws ClassNotFoundException, RemoteReadException, IOException { return (ServerMessage)this.peer.read(ServerConfig.TERMINAL_ADDRESS, ServerConfig.TERMINAL_PORT, request); } }
[ "bing.li@asu.edu" ]
bing.li@asu.edu
72d40a7062d631a65e6383211cf8e579951b701b
d900abda383c0d596af675f894e0176614caf8a9
/src/main/java/HierarchicalBayesianAnalysis/ScaledInvChiSquareDistribution.java
a1b6b9bb10e8421cb941b6955d8973ee199dbf31
[]
no_license
Jakob666/allele-specificM6A
ceecc91c5d20a5256fd557d4f87708506aef8426
a9d4fa71554262c5ce96f3a9c6b45efb8971a31d
refs/heads/master
2021-08-22T20:13:03.259235
2021-03-08T10:03:54
2021-03-08T10:03:54
175,590,080
1
0
null
2020-10-13T12:22:35
2019-03-14T09:31:09
Java
UTF-8
Java
false
false
947
java
package HierarchicalBayesianAnalysis; import org.apache.commons.math3.distribution.GammaDistribution; public class ScaledInvChiSquareDistribution { private GammaDistribution gd; /** * Constructor * if X ~ scaled-inv-Chi(v, t^2), then X ~ inv-gamma(v/2, vt^2/2) * if X ~ gamma(k, theta), then 1/X ~ inv-gamma(k, 1 / theta) => if X ~ gamma(v/2, 2/vt^2), then 1/X ~ inv-gamma(v/2, vt^2/2) * @param v number of chi-squared degrees of freedom, large than 0 * @param tauSquare scaling parameter, large than 0 */ public ScaledInvChiSquareDistribution(double v, double tauSquare) { double gammaShape = v * 0.5; double gammaScale = 2 / v / tauSquare; this.gd = new GammaDistribution(gammaShape, gammaScale); } public double sample() { return Math.pow(this.gd.sample(), -1); } public double logDensity(double x) { return this.gd.logDensity(1/x); } }
[ "hubs@mail2.sysu.edu.cn" ]
hubs@mail2.sysu.edu.cn
d68a4a6703b7c9cd9780c46c6f3be56331eb08ef
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/Math-1/org.apache.commons.math3.fraction.BigFraction/BBC-F0-opt-20/27/org/apache/commons/math3/fraction/BigFraction_ESTest_scaffolding.java
f49f6c968339c77322a51f549ae1941f1c781588
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
6,296
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sat Oct 23 11:14:42 GMT 2021 */ package org.apache.commons.math3.fraction; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class BigFraction_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.math3.fraction.BigFraction"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { /*No java.lang.System property to set*/ } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(BigFraction_ESTest_scaffolding.class.getClassLoader() , "org.apache.commons.math3.fraction.BigFractionField", "org.apache.commons.math3.exception.util.ExceptionContextProvider", "org.apache.commons.math3.fraction.BigFraction", "org.apache.commons.math3.exception.util.ArgUtils", "org.apache.commons.math3.exception.MathArithmeticException", "org.apache.commons.math3.exception.NumberIsTooSmallException", "org.apache.commons.math3.util.FastMath$ExpIntTable", "org.apache.commons.math3.util.FastMath$lnMant", "org.apache.commons.math3.exception.NotPositiveException", "org.apache.commons.math3.exception.MathIllegalStateException", "org.apache.commons.math3.util.FastMath$ExpFracTable", "org.apache.commons.math3.exception.MathIllegalArgumentException", "org.apache.commons.math3.util.MathUtils", "org.apache.commons.math3.exception.MathIllegalNumberException", "org.apache.commons.math3.exception.util.LocalizedFormats", "org.apache.commons.math3.exception.ZeroException", "org.apache.commons.math3.exception.ConvergenceException", "org.apache.commons.math3.util.FastMath", "org.apache.commons.math3.FieldElement", "org.apache.commons.math3.exception.util.Localizable", "org.apache.commons.math3.fraction.FractionConversionException", "org.apache.commons.math3.exception.util.ExceptionContext", "org.apache.commons.math3.util.ArithmeticUtils", "org.apache.commons.math3.exception.NullArgumentException", "org.apache.commons.math3.Field", "org.apache.commons.math3.exception.NotFiniteNumberException", "org.apache.commons.math3.util.FastMathLiteralArrays", "org.apache.commons.math3.fraction.BigFractionField$LazyHolder" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(BigFraction_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.apache.commons.math3.exception.util.LocalizedFormats", "org.apache.commons.math3.util.MathUtils", "org.apache.commons.math3.fraction.BigFraction", "org.apache.commons.math3.util.FastMath", "org.apache.commons.math3.util.FastMathLiteralArrays", "org.apache.commons.math3.util.FastMath$lnMant", "org.apache.commons.math3.util.FastMath$ExpIntTable", "org.apache.commons.math3.util.FastMath$ExpFracTable", "org.apache.commons.math3.fraction.BigFractionField", "org.apache.commons.math3.fraction.BigFractionField$LazyHolder", "org.apache.commons.math3.exception.MathIllegalStateException", "org.apache.commons.math3.exception.ConvergenceException", "org.apache.commons.math3.fraction.FractionConversionException", "org.apache.commons.math3.exception.util.ExceptionContext", "org.apache.commons.math3.exception.util.ArgUtils", "org.apache.commons.math3.util.ArithmeticUtils", "org.apache.commons.math3.exception.MathIllegalArgumentException", "org.apache.commons.math3.exception.MathIllegalNumberException", "org.apache.commons.math3.exception.ZeroException", "org.apache.commons.math3.exception.NullArgumentException", "org.apache.commons.math3.exception.MathArithmeticException", "org.apache.commons.math3.exception.NumberIsTooSmallException", "org.apache.commons.math3.exception.NotPositiveException" ); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
f55cbcc79ce373f46e1058d8c389b47b5214d5d7
104d74ab14c1e5763724e346c4fe1cd1eeb71018
/cdi-bundle/src/main/java/com/cognodyne/dw/cdi/config/CdiConfigurable.java
5dfdec8427df18f07c1be7ae037c33c40f76c579
[ "Apache-2.0" ]
permissive
mstoeckel/dw-cdi
516ad25d72242b1dca02276c6cce83076d942ebc
0b1254b157bd817e50d4f5ea6356aa50b12ee767
refs/heads/master
2020-03-23T17:22:46.848949
2019-02-24T23:21:28
2019-02-24T23:21:28
141,857,029
0
0
null
null
null
null
UTF-8
Java
false
false
157
java
package com.cognodyne.dw.cdi.config; import java.util.Optional; public interface CdiConfigurable { Optional<CdiConfiguration> getCdiConfiguration(); }
[ "mstoeckel@cognodyne.com" ]
mstoeckel@cognodyne.com
76e46a820951a57c8dfeb8b3e4f3e254a3d51e47
0a54c21eb8e0e90c547d245d586b13fd52a80b1c
/core/src/main/java/org/apache/commons/vfs2/provider/jar/JarFileSystem.java
52790e44ee136a098f2964445e62500652f813f0
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
dulanjalidilmi/wso2-commons-vfs
d2347a56cda48812eb6d407fd3eaf72623abcd6e
eca81d47c705b68b1cfff464c3dd3fc3e57f5811
refs/heads/master
2022-01-18T10:40:29.080278
2018-03-08T07:20:06
2018-03-08T07:20:06
238,889,454
0
0
Apache-2.0
2020-02-07T09:45:26
2020-02-07T09:45:25
null
UTF-8
Java
false
false
6,763
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.vfs2.provider.jar; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.jar.Attributes; import java.util.jar.Attributes.Name; import java.util.jar.JarFile; import java.util.jar.Manifest; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileSystemOptions; import org.apache.commons.vfs2.provider.AbstractFileName; import org.apache.commons.vfs2.provider.zip.ZipFileObject; import org.apache.commons.vfs2.provider.zip.ZipFileSystem; /** * A read-only file system for Jar files. * * @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a> * @version $Revision: 1040766 $ $Date: 2010-12-01 02:06:53 +0530 (Wed, 01 Dec 2010) $ */ public class JarFileSystem extends ZipFileSystem { private Attributes attributes; protected JarFileSystem(final AbstractFileName rootName, final FileObject file, final FileSystemOptions fileSystemOptions) throws FileSystemException { super(rootName, file, fileSystemOptions); } @Override protected ZipFile createZipFile(File file) throws FileSystemException { try { return new JarFile(file); } catch (IOException ioe) { throw new FileSystemException("vfs.provider.jar/open-jar-file.error", file, ioe); } } @Override protected ZipFileObject createZipFileObject(AbstractFileName name, ZipEntry entry) throws FileSystemException { return new JarFileObject(name, entry, this, true); } /** * Returns the capabilities of this file system. */ @Override protected void addCapabilities(final Collection<Capability> caps) { // super.addCapabilities(caps); caps.addAll(JarFileProvider.capabilities); } Attributes getAttributes() throws IOException { if (attributes == null) { final Manifest man = ((JarFile) getZipFile()).getManifest(); if (man == null) { attributes = new Attributes(1); } else { attributes = man.getMainAttributes(); if (attributes == null) { attributes = new Attributes(1); } } } return attributes; } Object getAttribute(Name attrName) throws FileSystemException { try { final Attributes attr = getAttributes(); final String value = attr.getValue(attrName); return value; } catch (IOException ioe) { throw new FileSystemException(attrName.toString(), ioe); } } Name lookupName(String attrName) { if (Name.CLASS_PATH.toString().equals(attrName)) { return Name.CLASS_PATH; } else if (Name.CONTENT_TYPE.toString().equals(attrName)) { return Name.CONTENT_TYPE; } else if (Name.EXTENSION_INSTALLATION.toString().equals(attrName)) { return Name.EXTENSION_INSTALLATION; } else if (Name.EXTENSION_LIST.toString().equals(attrName)) { return Name.EXTENSION_LIST; } else if (Name.EXTENSION_NAME.toString().equals(attrName)) { return Name.EXTENSION_NAME; } else if (Name.IMPLEMENTATION_TITLE.toString().equals(attrName)) { return Name.IMPLEMENTATION_TITLE; } else if (Name.IMPLEMENTATION_URL.toString().equals(attrName)) { return Name.IMPLEMENTATION_URL; } else if (Name.IMPLEMENTATION_VENDOR.toString().equals(attrName)) { return Name.IMPLEMENTATION_VENDOR; } else if (Name.IMPLEMENTATION_VENDOR_ID.toString().equals(attrName)) { return Name.IMPLEMENTATION_VENDOR_ID; } else if (Name.IMPLEMENTATION_VERSION.toString().equals(attrName)) { return Name.IMPLEMENTATION_VENDOR; } else if (Name.MAIN_CLASS.toString().equals(attrName)) { return Name.MAIN_CLASS; } else if (Name.MANIFEST_VERSION.toString().equals(attrName)) { return Name.MANIFEST_VERSION; } else if (Name.SEALED.toString().equals(attrName)) { return Name.SEALED; } else if (Name.SIGNATURE_VERSION.toString().equals(attrName)) { return Name.SIGNATURE_VERSION; } else if (Name.SPECIFICATION_TITLE.toString().equals(attrName)) { return Name.SPECIFICATION_TITLE; } else if (Name.SPECIFICATION_VENDOR.toString().equals(attrName)) { return Name.SPECIFICATION_VENDOR; } else if (Name.SPECIFICATION_VERSION.toString().equals(attrName)) { return Name.SPECIFICATION_VERSION; } else { return new Name(attrName); } } /** * Retrives the attribute with the specified name. The default * implementation simply throws an exception. * @param attrName The attiribute's name. * @return The value of the attribute. * @throws FileSystemException if an error occurs. */ @Override public Object getAttribute(String attrName) throws FileSystemException { final Name name = lookupName(attrName); return getAttribute(name); } @Override protected ZipFile getZipFile() throws FileSystemException { return super.getZipFile(); } }
[ "vanjikumaran@gmail.com" ]
vanjikumaran@gmail.com
d3deae833df8533edaff37073ddabdb83d7a6704
a3e14333fee1218a3071452f4960e098bd19d4f8
/chap07/src/chap07/sec07/exam03_field_polymorphism/Car.java
49855f6de7867dae1f91b24ff8cd2683f9df90f1
[]
no_license
newkayak12/newkayak_javastart
cd4f550f619a9e250c540911bf39138d76e14f17
788f87deede52bd8ab95c06e61f38cf4795d73ca
refs/heads/master
2023-08-25T03:54:02.443339
2021-10-19T10:03:54
2021-10-19T10:03:54
318,547,565
0
0
null
null
null
null
UTF-8
Java
false
false
616
java
package chap07.sec07.exam03_field_polymorphism; public class Car { Tire fLT = new Tire("frontLeft",6); Tire fRT = new Tire("frontRight", 2); Tire bLT = new Tire("backLeft",3); Tire bRT = new Tire("backRight",4); int run () { System.out.println("There is a car running"); if( fLT.roll()==false) { stop(); return 1; } if( fRT.roll()==false ) { stop(); return 2; } if ( bLT.roll()==false ) { stop(); return 3; } if( bRT.roll()==false ) { stop(); return 4; } return 0; } void stop() { System.out.println("The car stops"); } }
[ "newkayak12@gmail.com" ]
newkayak12@gmail.com
ad5017b1090f12ea9d07e70f45f8c5b7ae17ea45
9d0a5a99ce2448974dec7c6d5cb5d0a2001c6cea
/DocumentJDBC/src/main/java/com/example/service/impl/DocumentServiceImpl.java
ff3ec1e38b96447573b883f8c822d1225f0239bb
[]
no_license
ChrisMitov/ProjectsSpring
5fb4f6cd9d835bbd019b5c712aac076b5a0ef223
3f41a131d8b9c61a4335aaf7a3dc0c8618074bb5
refs/heads/master
2021-01-09T08:02:59.714046
2016-07-18T07:54:53
2016-07-18T07:54:53
63,166,879
0
0
null
null
null
null
UTF-8
Java
false
false
957
java
package com.example.service.impl; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.example.model.Document; import com.example.repository.DocumentRepository; import com.example.service.DocumentService; @Service public class DocumentServiceImpl implements DocumentService { private DocumentRepository repo; @Autowired public DocumentServiceImpl(DocumentRepository repo) { this.repo = repo; } @Override public Iterable<Document> getDocuments() { return repo.getDocuments(); } @Override public void addDocument(Document doc) { repo.addDocument(doc); } @Override public Optional<Document> findById(long id) { return repo.findById(id); } @Override public void updateDocument(long id, Document document) { repo.updateDocument(id, document); } @Override public void deleteDocument(long id) { repo.deleteDocument(id); } }
[ "mitov.christian@gmail.com" ]
mitov.christian@gmail.com
00de5b82bad1be176bea87ec7cb697d96906123a
f2c1da4c440a876a8dfb7304f8e8eede4074d4d8
/matrix/src/main/java/com/skrill/interns/MatrixCalculator/matrix/IMatrix.java
b7de2886159f79e1bbcc4e53bfe4ec3485548077
[]
no_license
sabinagergova/OrangeHub
85daa39ebee3fbc5021034a5590792dfe4e75fba
ee9d27c7094d08803f9becc4f6b6dceea3f3ba20
refs/heads/master
2021-06-22T08:15:21.587208
2017-08-14T12:48:34
2017-08-14T12:48:34
100,260,547
0
0
null
null
null
null
UTF-8
Java
false
false
285
java
package com.skrill.interns.MatrixCalculator.matrix; import java.math.BigDecimal; public interface IMatrix { public BigDecimal[] getRow(int i); public BigDecimal[] getCol(int i); public BigDecimal getElement(int i, int j); public int getDimension(); }
[ "sabina.gergova@paysafe.com" ]
sabina.gergova@paysafe.com
a3755a99b802bfcf6551f0691da59f16d34d74ae
d7bd567f241e16acf51cc2de3f27cc50e8fe73f2
/src/main/java/com/djtemplate4j/Filter.java
17a07cc16060619ffdb34c0df000b1f0514cedd6
[]
no_license
tanob/djtemplate4j
e9b4a4f8f7c05c61284d0469a6a3bf8e15c5dd81
bbfa884753a911f25af9d06e20137ab82b922116
refs/heads/master
2020-05-03T10:51:30.863975
2010-04-21T02:50:40
2010-04-21T02:50:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
88
java
package com.djtemplate4j; public interface Filter { String filter(String input); }
[ "adrianob@gmail.com" ]
adrianob@gmail.com
d9bee9cd035a17e912515cdc964dcc1c15e3bcac
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/thinkaurelius--titan/1ac3be429688bdd5938901943c4c5761bdabf0a8/after/OrderedKeyValueStoreAdapter.java
23d99a20976f73b3753fd8ee517cee0f389187aa
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
5,599
java
package com.thinkaurelius.titan.diskstorage.util; import com.thinkaurelius.titan.diskstorage.Entry; import com.thinkaurelius.titan.diskstorage.OrderedKeyColumnValueStore; import com.thinkaurelius.titan.diskstorage.TransactionHandle; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class OrderedKeyValueStoreAdapter extends KeyValueStoreAdapter implements OrderedKeyColumnValueStore{ protected final OrderedKeyValueStore store; public OrderedKeyValueStoreAdapter(OrderedKeyValueStore store) { super(store); this.store=store; } public OrderedKeyValueStoreAdapter(OrderedKeyValueStore store, int keyLength) { super(store,keyLength); this.store=store; } @Override public boolean containsKey(ByteBuffer key, TransactionHandle txh) { ContainsSelector select = new ContainsSelector(key); store.getSlice(key, ByteBufferUtil.nextBiggerBuffer(key), select, txh); return select.contains(); } @Override public List<Entry> getSlice(ByteBuffer key, ByteBuffer columnStart, ByteBuffer columnEnd, int limit, TransactionHandle txh) { return convert(store.getSlice(concatenate(key,columnStart), concatenate(key,columnEnd), limit, txh)); } @Override public List<Entry> getSlice(ByteBuffer key, ByteBuffer columnStart, ByteBuffer columnEnd, TransactionHandle txh) { return convert(store.getSlice(concatenate(key,columnStart), concatenate(key,columnEnd), txh)); } public List<Entry> convert(List<KeyValueEntry> entries) { if (entries==null) return null; List<Entry> newentries = new ArrayList<Entry>(entries.size()); for (KeyValueEntry entry : entries) { newentries.add(new Entry(getColumn(entry.getKey()),entry.getValue())); } return newentries; } public Map<ByteBuffer,List<Entry>> convertKey(List<KeyValueEntry> entries) { if (entries==null) return null; Map<ByteBuffer,List<Entry>> keyentries = new HashMap<ByteBuffer,List<Entry>>((int)Math.sqrt(entries.size())); ByteBuffer key = null; List<Entry> newentries = null; for (KeyValueEntry entry : entries) { ByteBuffer currentKey = getKey(entry.getKey()); if (key==null || !key.equals(currentKey)) { if (key!=null) { assert newentries!=null; keyentries.put(key, newentries); } key = currentKey; newentries = new ArrayList<Entry>((int)Math.sqrt(entries.size())); } newentries.add(new Entry(getColumn(entry.getKey()),entry.getValue())); } if (key!=null) { assert newentries!=null; keyentries.put(key, newentries); } return keyentries; } // protected final ByteBuffer getMaxKey(ByteBuffer key) { // int len = key.remaining(); // ByteBuffer max = ByteBuffer.allocate(len); // for (int i=0;i<len;i++) { // max.put(Byte.MIN_VALUE); // } // max.flip(); // return max; // } private class ContainsSelector implements KeySelector { private final ByteBuffer checkKey; private boolean contains = false; private ContainsSelector(ByteBuffer key) { checkKey = key; } public boolean contains() { return contains; } @Override public boolean include(ByteBuffer keycolumn) { contains = equalKey(keycolumn, checkKey); return false; } @Override public boolean reachedLimit() { return true; } } private class KeyColumnSliceSelector implements KeySelector { private final ByteBuffer keyStart; private final ByteBuffer keyEnd; private final boolean startKeyInc; private final boolean endKeyInc; private final ByteBuffer columnStart; private final ByteBuffer columnEnd; private final boolean startColumnIncl; private final boolean endColumnIncl; private final int keyLimit; private final int columnLimit; private final boolean abortOnLimitExcess; public KeyColumnSliceSelector(ByteBuffer keyStart, ByteBuffer keyEnd, boolean startKeyInc, boolean endKeyInc, ByteBuffer columnStart, ByteBuffer columnEnd, boolean startColumnIncl, boolean endColumnIncl, int keyLimit, int columnLimit, boolean abortOnLimit) { this.keyStart=keyStart; this.keyEnd=keyEnd; this.startKeyInc=startKeyInc; this.endKeyInc=endKeyInc; this.columnStart=columnStart; this.columnEnd=columnEnd; this.startColumnIncl=startColumnIncl; this.endColumnIncl=endColumnIncl; this.keyLimit=keyLimit; this.columnLimit=columnLimit; this.abortOnLimitExcess=abortOnLimit; } private ByteBuffer currentKey = null; private int countKey = 0; private int countColumn = 0; private boolean reachedLimit = false; private boolean reachedCountLimit = false; @Override public boolean include(ByteBuffer keycolumn) { if (currentKey==null && !startKeyInc) { //Check if current equals start if (equalKey(keycolumn, keyStart)) return false; } if (!endKeyInc && equalKey(keycolumn, keyEnd)) { reachedLimit = true; return false; } if (currentKey==null || !equalKey(keycolumn,currentKey)) { currentKey = getKey(keycolumn); countKey++; if (countKey>keyLimit) { reachedCountLimit = true; reachedLimit = true; return false; } countColumn = 0; } if (countColumn>=columnLimit) return false; if (columnInRange(keycolumn,columnStart,columnEnd, startColumnIncl,endColumnIncl)) { countColumn++; if (countColumn>=columnLimit) { reachedCountLimit=true; if (abortOnLimitExcess) reachedLimit=true; } return true; } else return false; } @Override public boolean reachedLimit() { return reachedLimit; } public boolean reachedCountLimit() { return reachedCountLimit; } } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
821a428f81afb41426e55a305af40352b5b5022f
cd5eaa39834658c503379028e94f6185f6e5ae20
/app/src/main/java/com/example/textinputlayoutfloatinglabeledittext/MainActivity.java
49fbfa820af4ae73b256381671f2ababb6ef6f8c
[]
no_license
divyansh199/Text_Input_layout_Floating_LabelEditText
f44c151cad06867cb5177bd87a608b339a61eb6f
7996bb59c72654da597767fa70b64e7c70acfa83
refs/heads/master
2022-11-04T21:52:08.251085
2020-06-17T07:10:26
2020-06-17T07:10:26
272,903,411
0
0
null
null
null
null
UTF-8
Java
false
false
2,491
java
package com.example.textinputlayoutfloatinglabeledittext; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Toast; import com.google.android.material.textfield.TextInputLayout; public class MainActivity extends AppCompatActivity { private TextInputLayout textInputEmail; private TextInputLayout textInputUsername; private TextInputLayout textInputPassword; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textInputEmail = findViewById(R.id.text_input_email); textInputUsername=findViewById(R.id.text_input_username); textInputPassword=findViewById(R.id.text_input_password); } private boolean validateEmail() { String emailInput = textInputEmail.getEditText().getText().toString().trim(); if(emailInput.isEmpty()) { textInputEmail.setError("field can't be empty"); return false; } else { textInputEmail.setError(null); return true; } } private boolean validateUsername(){ String usernameInput = textInputUsername.getEditText().getText().toString().trim(); if( usernameInput.isEmpty()){ textInputUsername.setError("Field can't be empty"); return false; }else if (usernameInput.length() > 15){ textInputUsername.setError("Username too long"); return false; }else { textInputUsername.setError(null); return true; } } private boolean validatePassword() { String passwordInput = textInputPassword.getEditText().getText().toString().trim(); if (passwordInput.isEmpty()) { textInputEmail.setError("field can't be empty"); return false; } else { textInputPassword.setError(null); return true; } } public void confirmInput(View v) { if(!validateEmail() | !validateUsername() | !validatePassword() ){ return; } String input = "Email: " + textInputEmail.getEditText().getText().toString(); input += "\n"; input += "Username:" + textInputUsername.getEditText().getText().toString(); input += "\n"; input += "password"+ textInputPassword.getEditText().getText().toString(); Toast.makeText(this,input, Toast.LENGTH_SHORT).show(); } }
[ "dawaghmare@mitaoe.ac.in" ]
dawaghmare@mitaoe.ac.in
adf432a3844bc8196d04ff224786dfe4405be00d
65981f65e5d1dd676e4b5f48f3b81e1f55ed39ce
/konig-core/src/main/java/io/konig/core/impl/EdgeMapImpl.java
6254dd77f38e23f9247a0469006819dcd3853161
[]
no_license
konigio/konig
dd49aa70aa63e6bdeb1161f26cf9fba8020e1bfb
2c093aa94be40ee6a0fa533020f4ef14cecc6f1d
refs/heads/master
2023-08-11T12:12:53.634492
2019-12-02T17:05:03
2019-12-02T17:05:03
48,807,429
4
3
null
2022-12-14T20:21:51
2015-12-30T15:42:21
Java
UTF-8
Java
false
false
1,349
java
package io.konig.core.impl; /* * #%L * konig-core * %% * Copyright (C) 2015 - 2016 Gregory McFall * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.openrdf.model.URI; import io.konig.core.Edge; public class EdgeMapImpl { private Map<URI, Set<Edge>> map = new LinkedHashMap<URI, Set<Edge>>(); public void add(Edge edge) { Set<Edge> set = map.get(edge.getPredicate()); if (set == null) { set = new LinkedHashSet<Edge>(); map.put(edge.getPredicate(), set); } set.add(edge); } public Set<Edge> get(URI predicate) { return map.get(predicate); } public Set<Entry<URI, Set<Edge>>> entries() { return map.entrySet(); } }
[ "gregory.mcfall@gmail.com" ]
gregory.mcfall@gmail.com
58d5051a9734a38ceffe91d6558f3ba115cfd2e2
674da8bb30900e9e3b15f49c7bd1275f48755759
/MemoryApp/PartAMemoryCatcher/src/MemoryCatcherApp/AllResourcesHolder.java
ad53facdc0d8d31878355789f64af1efdbb9be86
[]
no_license
sked1985/Project
20dcd22a4c61a05bdce5e16ca4e7d75bc25b8a15
08a8f057ad7f18eb394ef6e627aa90430c9bee07
refs/heads/master
2021-01-16T20:55:59.680388
2014-12-05T02:41:45
2014-12-05T02:41:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
942
java
package MemoryCatcherApp; /** * MemoryCatcherApp/AllResourcesHolder.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from C:/Users/Arnis/Desktop/Project/MemoryApp/PartAMemoryCatcher/src/partamemorycatcher/MemoryCatcher.idl * 04 December 2014 23:09:19 o'clock GMT */ public final class AllResourcesHolder implements org.omg.CORBA.portable.Streamable { public MemoryCatcherApp.Resources value[] = null; public AllResourcesHolder () { } public AllResourcesHolder (MemoryCatcherApp.Resources[] initialValue) { value = initialValue; } public void _read (org.omg.CORBA.portable.InputStream i) { value = MemoryCatcherApp.AllResourcesHelper.read (i); } public void _write (org.omg.CORBA.portable.OutputStream o) { MemoryCatcherApp.AllResourcesHelper.write (o, value); } public org.omg.CORBA.TypeCode _type () { return MemoryCatcherApp.AllResourcesHelper.type (); } }
[ "arnislupiks@gmail.com" ]
arnislupiks@gmail.com
42a0c2b613f33fb08b36cf801eb7a8728be19b58
08345dde7830b0080ae84c0dee096053febea69d
/crazyLectures/src/main/java/com/sumnear/c0402/SwitchTest.java
bdd6ea85875b7ad9a32889b0e00d134cb8cc2be5
[]
no_license
sumnear/codeLife
fbf2a929fd4b829c1cdd69464b30e169a5bc7fcf
227a2a2480d27fd1961e62f89173216d045736b1
refs/heads/master
2022-12-23T07:36:10.508350
2021-06-27T13:06:34
2021-06-27T13:06:34
198,769,670
0
0
null
2022-12-16T05:24:26
2019-07-25T06:18:32
Java
UTF-8
Java
false
false
858
java
package com.sumnear.c0402; /** * Description: * <br/>网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> * <br/>Copyright (C), 2001-2016, Yeeku.H.Lee * <br/>This program is protected by copyright laws. * <br/>Program Name: * <br/>Date: * @author Yeeku.H.Lee kongyeeku@163.com * @version 1.0 */ public class SwitchTest { public static void main(String[] args) { // 声明变量score,并为其赋值为'C' char score = 'C'; // 执行swicth分支语句 switch (score) { case 'A': System.out.println("优秀"); break; case 'B': System.out.println("良好"); break; case 'C': System.out.println("中"); break; case 'D': System.out.println("及格"); break; case 'F': System.out.println("不及格"); break; default: System.out.println("成绩输入错误"); } } }
[ "402347012@qq.com" ]
402347012@qq.com
ccf74ab04208f1976bb0a8adddc45152abecce52
45b09d839f9f69e5529576794943c7122dc1f092
/src/com/ustcinfo/wangxianlin/reflection/Cat.java
0859efdcf07a60f2bd9fb22a5dd8ac109cfd16c4
[]
no_license
HeloWXL/java-base
18dca9ba83db8f1d829e6421afd5db82d6d17e5b
24ca25c79616951f1e12fd1db19be51621d060c9
refs/heads/master
2021-07-25T00:58:32.789899
2020-10-17T06:29:22
2020-10-17T06:29:22
225,619,514
0
0
null
null
null
null
UTF-8
Java
false
false
1,723
java
package com.ustcinfo.wangxianlin.reflection; import java.io.IOException; import java.nio.CharBuffer; public class Cat implements Readable{ /** * 名字 */ public String name; /** * 颜色 */ private String color; /** * 品种 */ String type; /** * 无参构造方法 */ public Cat() { } /** * 有参构造方法 */ public Cat(String name, String color, String type) { this.name = name; this.color = color; this.type = type; } /** * 有参构造方法 */ public Cat(String name) { this.name = name; } /** * @Description: 吃饭 * @params: [] * @return: void */ public void eat(){ System.out.println("吃饭"); } /** * @Description: 睡觉 * @params: [] * @return: void */ private void sleep(){ System.out.println("睡觉"); } /** * getter setter方法 */ public String getName() { return name; } public void setName(String name) { this.name = name; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public String getType() { return type; } public void setType(String type) { this.type = type; } @Override public String toString() { return "Cat{" + "name='" + name + '\'' + ", color='" + color + '\'' + ", type='" + type + '\'' + '}'; } @Override public int read(CharBuffer cb) throws IOException { return 0; } }
[ "756316064@qq.com" ]
756316064@qq.com
692972a4b510e8372ddf0d8aa1615931e45a8cfe
2483722ab44756195867400d6fbd0a4daffbc017
/src/registry-api/src/main/java/de/geoinfoffm/registry/api/UpdateUserException.java
64362b9cdf91d75ece5c26490f1313f7a2a797e7
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
ISO-TC211/registry-base
ee0b9de0b2483973d35cd04b88854a685fde7d53
1b84d41c56282bfd243c18d720ffb68e9544579a
refs/heads/master
2022-12-05T23:35:03.984355
2021-11-24T03:23:50
2021-11-24T03:23:50
162,589,131
0
1
NOASSERTION
2022-11-23T22:18:00
2018-12-20T14:18:18
Java
UTF-8
Java
false
false
2,963
java
/** * Copyright (c) 2014, German Federal Agency for Cartography and Geodesy * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * The names "German Federal Agency for Cartography and Geodesy", * "Bundesamt für Kartographie und Geodäsie", "BKG", "GDI-DE", * "GDI-DE Registry" and the names of other contributors must not * be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN * FEDERAL AGENCY FOR CARTOGRAPHY AND GEODESY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package de.geoinfoffm.registry.api; import de.geoinfoffm.registry.core.model.RegistryUser; /** * Exception class that indicates an exception during the update * of a {@link RegistryUser}. * * @author Florian Esser * */ public class UpdateUserException extends Exception { /** * */ public UpdateUserException() { // TODO Auto-generated constructor stub } /** * @param message */ public UpdateUserException(String message) { super(message); // TODO Auto-generated constructor stub } /** * @param cause */ public UpdateUserException(Throwable cause) { super(cause); // TODO Auto-generated constructor stub } /** * @param message * @param cause */ public UpdateUserException(String message, Throwable cause) { super(message, cause); // TODO Auto-generated constructor stub } /** * @param message * @param cause * @param enableSuppression * @param writableStackTrace */ public UpdateUserException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); // TODO Auto-generated constructor stub } }
[ "fe@bespire.de" ]
fe@bespire.de
91f64093a5230983fe4f96a9b3141f333f42e9cc
067f541d167c044b320e63285a203c096011a73d
/huimai_sellergoods_interface/src/main/java/com/huimai/sellergoods/service/SpecificationOptionService.java
da8f59c868955f98309221e343bd07bfb86e30fa
[]
no_license
lishupan/huimai-mall
fcf2f08186a5b42f1640f06743ef5fc4d19f8600
01046366f89de9aa3c1389c687bfb354575d2a7f
refs/heads/master
2023-06-10T19:28:02.088609
2021-07-05T07:19:24
2021-07-05T07:19:24
383,049,662
0
0
null
null
null
null
UTF-8
Java
false
false
1,027
java
package com.huimai.sellergoods.service; import com.huimai.entity.PageResult; import com.huimai.pojo.TbSpecificationOption; import java.util.List; /** * 规格选项服务层接口 * @author Administrator * */ public interface SpecificationOptionService { /** * 返回全部列表 * @return */ public List<TbSpecificationOption> findAll(); /** * 返回分页列表 * @return */ public PageResult findPage(int pageNum, int pageSize); /** * 增加 */ public void add(TbSpecificationOption specification_option); /** * 修改 */ public void update(TbSpecificationOption specification_option); /** * 根据ID获取实体 * @param id * @return */ public TbSpecificationOption findOne(Long id); /** * 批量删除 * @param ids */ public void delete(Long[] ids); /** * 分页 * @param pageNum 当前页 码 * @param pageSize 每页记录数 * @return */ public PageResult findPage(TbSpecificationOption specification_option, int pageNum, int pageSize); }
[ "1778047278@qq.com" ]
1778047278@qq.com
2e62fff79274a21a33b1a9ff548209270f27102b
4ca2db4ab8b33d440a68c1204b9b7100a7aafae9
/wicket-chartist-showcase/src/main/java/org/wicket/chartist/showcase/HomePage.java
d68ed5eaee429fba7efb998f08507863f6c6d78e
[ "Apache-2.0" ]
permissive
mmielimonka/wicket-chartist
5d70c44380fe1592f10a76d3332f572465f602e4
2e1e89e0065fa3c866366b7cbaee972df7441c15
refs/heads/master
2016-08-03T06:20:05.723669
2015-06-24T07:39:14
2015-06-24T07:39:14
35,538,792
0
0
null
null
null
null
UTF-8
Java
false
false
6,480
java
/** * Copyright 2015 Wicked Chartist * * 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.wicket.chartist.showcase; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.markup.html.WebPage; import org.wicketchartist.behavior.ChartistBehavior; import org.wicketchartist.chart.ChartContainer; import org.wicketchartist.chart.ChartistBarChart; import org.wicketchartist.chart.ChartistLineChart; import org.wicketchartist.chart.ChartistPieChart; import org.wicketchartist.chart.data.BarLineChartData; import org.wicketchartist.chart.data.ChartSeries; import org.wicketchartist.chart.data.LineChartOptions; import org.wicketchartist.chart.data.PieChartData; /** * Homepage. * * @author mielimonka */ public class HomePage extends WebPage implements Serializable { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1L; /** The bar chart. */ private ChartistBarChart barChart; /** The pie chart. */ private ChartistPieChart pieChart; /** The chart. */ private ChartistLineChart chart; /** The container. */ ChartContainer container = new ChartContainer(); /** The link. */ private AjaxLink link; /** The link2. */ private AjaxLink link2; /** The link3. */ private AjaxLink link3; /** * Constructor that is invoked when page is invoked without a session. */ public HomePage() { ChartistBehavior beh = new ChartistBehavior(); add(beh); addBarChart(); addLineChart(); addPieChart(); addComponents(); } /** * Adds the line chart. */ private void addLineChart() { List<Float> testdata = new ArrayList<Float>(); testdata.add(1f); testdata.add(2f); testdata.add(3f); testdata.add(5f); testdata.add(8f); testdata.add(13f); List<ChartSeries> series = new ArrayList<ChartSeries>(); ChartSeries s = new ChartSeries(); s.setData(testdata); series.add(s); List<String> labels = new ArrayList<String>(); labels.add("1"); labels.add("2"); labels.add("3"); labels.add("4"); labels.add("5"); labels.add("6"); BarLineChartData chartData = new BarLineChartData(); chartData.setLabels(labels); chartData.setSeries(series); chart = new ChartistLineChart("chart1"); LineChartOptions options = new LineChartOptions(); options.setShowArea(true); chart.setAddSVGPathAnimation(true); try { chart.setChartData(chartData); chart.setOptions(options); } catch (Exception e) { } chart.setTooltipEnabled(true); container.addChart(chart, this); } /** * Adds the bar chart. */ private void addBarChart() { List<Float> testdata = new ArrayList<Float>(); testdata.add(1f); testdata.add(2f); testdata.add(3f); testdata.add(5f); testdata.add(8f); testdata.add(13f); List<ChartSeries> series = new ArrayList<ChartSeries>(); ChartSeries s = new ChartSeries(); s.setData(testdata); series.add(s); List<String> labels = new ArrayList<String>(); labels.add("1"); labels.add("2"); labels.add("3"); labels.add("4"); labels.add("5"); labels.add("6"); BarLineChartData chartData = new BarLineChartData(); chartData.setSeries(series); chartData.setLabels(labels); barChart = new ChartistBarChart("chart"); try { barChart.setChartData(chartData); } catch (Exception e) { } container.addChart(barChart, this); } /** * Adds the pie chart. */ private void addPieChart() { List<Float> testdata = new ArrayList<Float>(); testdata.add(1f); testdata.add(2f); testdata.add(3f); List<String> labels = new ArrayList<String>(); labels.add("Label1"); labels.add("Label2"); labels.add("Label3"); PieChartData chartData = new PieChartData(); chartData.setSeries(testdata); chartData.setLabels(labels); pieChart = new ChartistPieChart("chart2"); try { pieChart.setChartData(chartData); } catch (Exception e) { } container.addChart(pieChart, this); } /** * Adds the components. */ private void addComponents() { link = new AjaxLink("update_button") { @Override public void onClick(AjaxRequestTarget target) { BarLineChartData data = (BarLineChartData) chart.getChartData(); data.getLabels().add("UPDATED"); chart.update(target, chart.getChartData()); } }; add(link); link2 = new AjaxLink("update_button1") { @Override public void onClick(AjaxRequestTarget target) { BarLineChartData data = (BarLineChartData) barChart.getChartData(); ChartSeries s = new ChartSeries(); List<Float> d = new ArrayList<Float>(); d.add(10f); s.setData(d); data.getSeries().add(s); barChart.update(target, barChart.getChartData()); } }; add(link2); link3 = new AjaxLink("update_button2") { @Override public void onClick(AjaxRequestTarget target) { PieChartData data = (PieChartData) pieChart.getChartData(); data.getSeries().add(10f); pieChart.update(target, pieChart.getChartData()); } }; add(link3); } }
[ "michael.mielimonka@adesso.de" ]
michael.mielimonka@adesso.de
2678c64552a1a7d7fb6c602b7167c8898606c5a9
b22f0e03956b6a7514216c5d53b130d6a73e15b6
/wear/src/main/java/com/example/haroonyousuf/wear/Service/SunshineWatchService.java
9d8b5ebf6c51e3bba4407117ee16396970bb9dd0
[ "Apache-2.0" ]
permissive
mharoon/go-ubiquitous
e3e117a508986592bb0891e23b8090f9a9cc4170
f5bcd606172cea1460ad54f61b8787b38ba4ca3a
refs/heads/master
2021-01-17T13:18:10.662197
2016-06-19T18:41:32
2016-06-19T18:41:32
58,607,643
0
0
null
null
null
null
UTF-8
Java
false
false
21,428
java
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.haroonyousuf.wear.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; import android.support.wearable.watchface.CanvasWatchFaceService; import android.support.wearable.watchface.WatchFaceStyle; import android.text.format.Time; import android.view.SurfaceHolder; import android.view.WindowInsets; import com.example.haroonyousuf.wear.R; import com.example.haroonyousuf.wear.Util.Utility; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.wearable.DataApi; import com.google.android.gms.wearable.DataEvent; import com.google.android.gms.wearable.DataEventBuffer; import com.google.android.gms.wearable.DataItem; import com.google.android.gms.wearable.DataMap; import com.google.android.gms.wearable.DataMapItem; import com.google.android.gms.wearable.Wearable; import java.lang.ref.WeakReference; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.TimeUnit; /** * Digital watch face with seconds. In ambient mode, the seconds aren't displayed. On devices with * low-bit ambient mode, the text is drawn without anti-aliasing in ambient mode. */ public class SunshineWatchService extends CanvasWatchFaceService { private static final Typeface NORMAL_TYPEFACE = Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL); /** * Update rate in milliseconds for interactive mode. We update once a second since seconds are * displayed in interactive mode. */ private static final long INTERACTIVE_UPDATE_RATE_MS = TimeUnit.SECONDS.toMillis(1); /** * Handler message id for updating the time periodically in interactive mode. */ private static final int MSG_UPDATE_TIME = 0; @Override public Engine onCreateEngine() { return new Engine(); } private static class EngineHandler extends Handler { private final WeakReference<SunshineWatchService.Engine> mWeakReference; public EngineHandler(SunshineWatchService.Engine reference) { mWeakReference = new WeakReference<>(reference); } @Override public void handleMessage(Message msg) { SunshineWatchService.Engine engine = mWeakReference.get(); if (engine != null) { switch (msg.what) { case MSG_UPDATE_TIME: engine.handleUpdateTimeMessage(); break; } } } } private class Engine extends CanvasWatchFaceService.Engine implements GoogleApiClient.OnConnectionFailedListener, GoogleApiClient.ConnectionCallbacks, DataApi.DataListener { final Handler mUpdateTimeHandler = new EngineHandler(this); boolean mRegisteredTimeZoneReceiver = false; Paint mBackgroundPaint; int mTapCount; /** * Whether the display supports fewer bits for each color in ambient mode. When true, we * disable anti-aliasing in ambient mode. */ boolean mLowBitAmbient; private GoogleApiClient mGoogleApiClient; private Resources resources; private static final String WEATHER_PATH = "/weather"; private static final String HIGH_TEMPERATURE = "high_temperature"; private static final String LOW_TEMPERATURE = "low_temperature"; private static final String WEATHER_CONDITION = "weather_condition"; private static final int SPACE_BETWEEN_TEMPERATURES = 10; Paint backgroundPaint; Paint timeTextPaint; Paint linePaint; Paint dateTextPaint; Paint highTemperatureTextPaint; Paint lowTemperatureTextPaint; boolean isAmbientMode; Calendar calendar; float timeYOffset; float dateYOffset; float weatherYOffset; Bitmap conditionIcon; String highTemperature; String lowTemperature; boolean lowBitAmbient; int digitalTextColor = -1; int digitalTextColorSecondary = -1; final BroadcastReceiver mTimeZoneReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { calendar.setTimeZone(TimeZone.getDefault()); invalidate(); } }; @Override public void onCreate(SurfaceHolder holder) { super.onCreate(holder); /*setWatchFaceStyle(new WatchFaceStyle.Builder(SunshineWatchService.this) .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE) .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE) .setShowSystemUiTime(false) .setAcceptsTapEvents(true) .build()); Resources resources = SunshineWatchService.this.getResources(); mYOffset = resources.getDimension(R.dimen.digital_y_offset); mBackgroundPaint = new Paint(); mBackgroundPaint.setColor(resources.getColor(R.color.background)); mTextPaint = new Paint(); mTextPaint = createTextPaint(resources.getColor(R.color.digital_text)); mTime = new Time();*/ mGoogleApiClient = new GoogleApiClient.Builder(SunshineWatchService.this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Wearable.API) .build(); setWatchFaceStyle(new WatchFaceStyle.Builder(SunshineWatchService.this) .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE) .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE) .setShowSystemUiTime(false) .build()); resources = SunshineWatchService.this.getResources(); timeYOffset = resources.getDimension(R.dimen.time_y_offset); dateYOffset = resources.getDimension(R.dimen.date_y_offset); weatherYOffset = resources.getDimension(R.dimen.weather_y_offset); backgroundPaint = new Paint(); backgroundPaint.setColor(ContextCompat.getColor(SunshineWatchService.this, R.color.background)); digitalTextColor = ContextCompat.getColor(SunshineWatchService.this, R.color.digital_text); digitalTextColorSecondary = ContextCompat.getColor(SunshineWatchService.this, R.color.digital_text_secondary); linePaint = new Paint(); linePaint.setColor(digitalTextColorSecondary); timeTextPaint = createTextPaint(digitalTextColor); dateTextPaint = createTextPaint(digitalTextColorSecondary); highTemperatureTextPaint = createTextPaint(digitalTextColor); lowTemperatureTextPaint = createTextPaint(digitalTextColorSecondary); // allocate a Calendar to calculate local time using the UTC time and time zone calendar = Calendar.getInstance(); } @Override public void onDestroy() { mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME); super.onDestroy(); } private Paint createTextPaint(int textColor) { Paint paint = new Paint(); paint.setColor(textColor); paint.setTypeface(NORMAL_TYPEFACE); paint.setAntiAlias(true); return paint; } @Override public void onVisibilityChanged(boolean visible) { super.onVisibilityChanged(visible); if (visible) { mGoogleApiClient.connect(); registerReceiver(); // Update time zone in case it changed while we weren't visible. calendar.setTimeZone(TimeZone.getDefault()); } else { if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) { Wearable.DataApi.removeListener(mGoogleApiClient, this); mGoogleApiClient.disconnect(); } unregisterReceiver(); } // Whether the timer should be running depends on whether we're visible (as well as // whether we're in ambient mode), so we may need to start or stop the timer. updateTimer(); } private void registerReceiver() { if (mRegisteredTimeZoneReceiver) { return; } mRegisteredTimeZoneReceiver = true; IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED); SunshineWatchService.this.registerReceiver(mTimeZoneReceiver, filter); } private void unregisterReceiver() { if (!mRegisteredTimeZoneReceiver) { return; } mRegisteredTimeZoneReceiver = false; SunshineWatchService.this.unregisterReceiver(mTimeZoneReceiver); } @Override public void onApplyWindowInsets(WindowInsets insets) { super.onApplyWindowInsets(insets); // Load resources that have alternate values for round watches. /*Resources resources = SunshineWatchService.this.getResources(); boolean isRound = insets.isRound(); mXOffset = resources.getDimension(isRound ? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset); float textSize = resources.getDimension(isRound ? R.dimen.digital_text_size_round : R.dimen.digital_text_size); mTextPaint.setTextSize(textSize);*/ // Load resources that have alternate values for round watches. Resources resources = SunshineWatchService.this.getResources(); float timeTextSize = resources.getDimension(R.dimen.time_text_size); timeTextPaint.setTextSize(timeTextSize); float dateTextSize = resources.getDimension(R.dimen.date_text_size); dateTextPaint.setTextSize(dateTextSize); float temperatureTextSize = resources.getDimension(R.dimen.temperature_text_size); highTemperatureTextPaint.setTextSize(temperatureTextSize); lowTemperatureTextPaint.setTextSize(temperatureTextSize); } @Override public void onPropertiesChanged(Bundle properties) { super.onPropertiesChanged(properties); mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false); } @Override public void onTimeTick() { super.onTimeTick(); invalidate(); } @Override public void onAmbientModeChanged(boolean inAmbientMode) { /*super.onAmbientModeChanged(inAmbientMode); if (mAmbient != inAmbientMode) { mAmbient = inAmbientMode; if (mLowBitAmbient) { mTextPaint.setAntiAlias(!inAmbientMode); } invalidate(); } // Whether the timer should be running depends on whether we're visible (as well as // whether we're in ambient mode), so we may need to start or stop the timer. updateTimer();*/ super.onAmbientModeChanged(inAmbientMode); if (isAmbientMode != inAmbientMode) { linePaint.setColor(inAmbientMode ? digitalTextColor : digitalTextColorSecondary); dateTextPaint.setColor(inAmbientMode ? digitalTextColor : digitalTextColorSecondary); lowTemperatureTextPaint.setColor(inAmbientMode ? digitalTextColor : digitalTextColorSecondary); isAmbientMode = inAmbientMode; if (lowBitAmbient) { timeTextPaint.setAntiAlias(!inAmbientMode); dateTextPaint.setAntiAlias(!inAmbientMode); highTemperatureTextPaint.setAntiAlias(!inAmbientMode); lowTemperatureTextPaint.setAntiAlias(!inAmbientMode); } invalidate(); } // Whether the timer should be running depends on whether we're visible (as well as // whether we're in ambient mode), so we may need to start or stop the timer. updateTimer(); } /** * Captures tap event (and tap type) and toggles the background color if the user finishes * a tap. */ @Override public void onTapCommand(int tapType, int x, int y, long eventTime) { Resources resources = SunshineWatchService.this.getResources(); switch (tapType) { case TAP_TYPE_TOUCH: // The user has started touching the screen. break; case TAP_TYPE_TOUCH_CANCEL: // The user has started a different gesture or otherwise cancelled the tap. break; case TAP_TYPE_TAP: // The user has completed the tap gesture. mTapCount++; mBackgroundPaint.setColor(ContextCompat.getColor(getBaseContext(), mTapCount % 2 == 0 ? R.color.background : R.color.background2)); break; } invalidate(); } @Override public void onDraw(Canvas canvas, Rect bounds) { /*// Draw the background. if (isInAmbientMode()) { canvas.drawColor(Color.BLACK); } else { canvas.drawRect(0, 0, bounds.width(), bounds.height(), mBackgroundPaint); } // Draw H:MM in ambient mode or H:MM:SS in interactive mode. mTime.setToNow(); String text = mAmbient ? String.format("%d:%02d", mTime.hour, mTime.minute) : String.format("%d:%02d:%02d", mTime.hour, mTime.minute, mTime.second); canvas.drawText(text, mXOffset, mYOffset, mTextPaint);*/ // Draw the background. if (isInAmbientMode()) { canvas.drawColor(Color.BLACK); } else { canvas.drawRect(0, 0, bounds.width(), bounds.height(), backgroundPaint); } // Draw H:MM in ambient mode or H:MM:SS in interactive mode. calendar.setTimeInMillis(System.currentTimeMillis()); int seconds = calendar.get(Calendar.SECOND); int minutes = calendar.get(Calendar.MINUTE); int hours = calendar.get(Calendar.HOUR); String time = isAmbientMode ? String.format("%d:%02d", hours, minutes) : String.format("%d:%02d:%02d", hours, minutes, seconds); // Draw time text in x-center of screen float timeTextWidth = timeTextPaint.measureText(time); float halfTimeTextWidth = timeTextWidth / 2; float xOffsetTime = bounds.centerX() - halfTimeTextWidth; canvas.drawText(time, xOffsetTime, timeYOffset, timeTextPaint); // Draw date text in x-center of screen SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, MMM dd yyyy", Locale.US); String date = dateFormat.format(calendar.getTime()).toUpperCase(Locale.US); float dateTextWidth = dateTextPaint.measureText(date); float halfDateTextWidth = dateTextWidth / 2; float xOffsetDate = bounds.centerX() - halfDateTextWidth; canvas.drawText(date, xOffsetDate, dateYOffset, dateTextPaint); // Draw high and low temperature, icon for weather condition if (conditionIcon != null && highTemperature != null && lowTemperature != null) { float highTemperatureTextWidth = highTemperatureTextPaint.measureText(highTemperature); float lowTemperatureTextWidth = lowTemperatureTextPaint.measureText(lowTemperature); Rect temperatureBounds = new Rect(); highTemperatureTextPaint.getTextBounds(highTemperature, 0, highTemperature.length(), temperatureBounds); float lineYOffset = (dateYOffset + weatherYOffset) / 2 - (temperatureBounds.height() / 2); canvas.drawLine(bounds.centerX() - 4 * SPACE_BETWEEN_TEMPERATURES, lineYOffset, bounds.centerX() + 4 * SPACE_BETWEEN_TEMPERATURES, lineYOffset, linePaint); float xOffsetHighTemperature; if (isAmbientMode) { xOffsetHighTemperature = bounds.centerX() - ((highTemperatureTextWidth + lowTemperatureTextWidth + SPACE_BETWEEN_TEMPERATURES) / 2); } else { xOffsetHighTemperature = bounds.centerX() - (highTemperatureTextWidth / 2); canvas.drawBitmap(conditionIcon, xOffsetHighTemperature - conditionIcon.getWidth() - 2 * SPACE_BETWEEN_TEMPERATURES, weatherYOffset - (temperatureBounds.height() / 2) - (conditionIcon.getHeight() / 2), null); } float xOffsetLowTemperature = xOffsetHighTemperature + highTemperatureTextWidth + SPACE_BETWEEN_TEMPERATURES; canvas.drawText(highTemperature, xOffsetHighTemperature, weatherYOffset, highTemperatureTextPaint); canvas.drawText(lowTemperature, xOffsetLowTemperature, weatherYOffset, lowTemperatureTextPaint); } } /** * Starts the {@link #mUpdateTimeHandler} timer if it should be running and isn't currently * or stops it if it shouldn't be running but currently is. */ private void updateTimer() { mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME); if (shouldTimerBeRunning()) { mUpdateTimeHandler.sendEmptyMessage(MSG_UPDATE_TIME); } } /** * Returns whether the {@link #mUpdateTimeHandler} timer should be running. The timer should * only run when we're visible and in interactive mode. */ private boolean shouldTimerBeRunning() { return isVisible() && !isInAmbientMode(); } /** * Handle updating the time periodically in interactive mode. */ private void handleUpdateTimeMessage() { invalidate(); if (shouldTimerBeRunning()) { long timeMs = System.currentTimeMillis(); long delayMs = INTERACTIVE_UPDATE_RATE_MS - (timeMs % INTERACTIVE_UPDATE_RATE_MS); mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs); } } @Override public void onConnected(Bundle bundle) { Wearable.DataApi.addListener(mGoogleApiClient, this); } @Override public void onConnectionSuspended(int i) { } @Override public void onDataChanged(DataEventBuffer dataEventBuffer) { for (DataEvent dataEvent : dataEventBuffer) { if (dataEvent.getType() == DataEvent.TYPE_CHANGED) { DataItem dataItem = dataEvent.getDataItem(); if (dataItem.getUri().getPath().compareTo(WEATHER_PATH) == 0) { DataMap dataMap = DataMapItem.fromDataItem(dataItem).getDataMap(); setWeatherData(dataMap.getString(HIGH_TEMPERATURE), dataMap.getString(LOW_TEMPERATURE), dataMap.getInt(WEATHER_CONDITION)); invalidate(); } } } } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { } private void setWeatherData(String highTemperature, String lowTemperature, int weatherCondition) { this.highTemperature = highTemperature; this.lowTemperature = lowTemperature; this.conditionIcon = BitmapFactory.decodeResource(resources, Utility.getIconResourceForWeatherCondition(weatherCondition)); } } }
[ "muhammadharoon.yousuf2@trgworld.com" ]
muhammadharoon.yousuf2@trgworld.com
95adcb22b70e2e1e4a5a3a8150155c8c0658f356
ccf88150ae3bb786a7eaa4475945a287f90cf874
/app/src/test/java/instagram/android/example/com/instagram/ExampleUnitTest.java
6675eadc03f6a36525b253b5db6bbe7f5227e8d3
[]
no_license
PayalMenon/23andme
23f54c2c486bfa597f78cee0a310e2832e2e8f3b
df3b1458940daf4e7c0fcbb8e9c9eaf2c6ac1e4a
refs/heads/master
2021-01-16T18:24:49.241139
2017-09-24T12:44:53
2017-09-24T12:44:53
100,074,404
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
package instagram.android.example.com.instagram; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "payal.menon@asurion.com" ]
payal.menon@asurion.com
89260bc0590081f29e44c62cda1001fdda8a8458
252ec00573658d233da2958117b8f9ee502c4568
/myapplication/app/src/main/java/com/example/pssin/auction/Mypage_Point.java
321f8e7a0c3ac1ac455a7d6ef13c78758f44ec27
[]
no_license
Ruminem/softwareproject_final_report
115ba0e972cc97b65d57c85a6510e0f8471f1da0
8a48cdfdc65e4754829e09d7bf8de0e0168251ae
refs/heads/master
2020-09-25T19:44:11.219880
2019-12-05T10:20:58
2019-12-05T10:20:58
226,074,944
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.example.pssin.auction; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; public class Mypage_Point extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mypage_point); } }
[ "pssin1@naver.com" ]
pssin1@naver.com
1cb0337a2460499655dbd5c01e36a6141ad51347
2af8793999fd93cf6bdadc5d1700deb4dffb878d
/library/src/main/java/com/harreke/easyapp/frameworks/base/IActivityData.java
8fbd7bd2255b7754311f97e739370a5468078e37
[ "Apache-2.0" ]
permissive
DukerSunny/EasyApp
c02b1c31d36e8d9a581a60af0ebb6d86b7d99566
48adc40ac166981247211ac00ac1a47bdd781908
refs/heads/master
2021-01-12T22:21:13.702255
2015-08-03T05:38:20
2015-08-03T05:38:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
292
java
package com.harreke.easyapp.frameworks.base; import android.os.Bundle; /** * Created by 启圣 on 2015/6/5. */ public interface IActivityData { /** * 接受并处理来自Fragment的消息 * * @param bundle 消息 */ void receiveFragmentData(Bundle bundle); }
[ "1478103312@qq.com" ]
1478103312@qq.com
4606bb95ffeeefa311c0366821a9434ab68f19de
908e1f2dfd7b2ec9a510ef54e245fa379188da2a
/trunk/muzi-system/src/main/java/com/muzi/system/util/Query.java
50da40bf31ccb7ba8580dcff87fe4abc1b274cfa
[]
no_license
muzi-jiang/muzi
4c1d963e3952fe14b867d34880a14f4cfe9717fb
fcc8791a50c16d6160b84cc5795912d92595197f
refs/heads/master
2022-12-26T07:22:22.556885
2020-12-16T07:39:26
2020-12-16T07:39:26
220,027,459
1
0
null
null
null
null
UTF-8
Java
false
false
966
java
package com.muzi.system.util; import java.util.LinkedHashMap; import java.util.Map; /** * 查询参数 * @author Administrator * */ public class Query extends LinkedHashMap<String, Object> { private static final long serialVersionUID = 1L; // private int offset; // 每页条数 private int limit; public Query(Map<String, Object> params) { this.putAll(params); // 分页参数 this.offset = Integer.parseInt(params.get("offset").toString()); this.limit = Integer.parseInt(params.get("limit").toString()); this.put("offset", offset); this.put("page", offset / limit + 1); this.put("limit", limit); } public int getOffset() { return offset; } public void setOffset(int offset) { this.put("offset", offset); } public int getLimit() { return limit; } public void setLimit(int limit) { this.limit = limit; } }
[ "1421686777@qq.com" ]
1421686777@qq.com
11c9c6298f297e38aa0780780704a7c9e7212400
adfc518a40bae0e7e0ef08700de231869cdc9e07
/src/main/java/zes/openworks/web/introduction/AgremManageVO.java
ca637b6a22fe01112f6245a9540a255224f04fd5
[ "Apache-2.0" ]
permissive
tenbirds/OPENWORKS-3.0
49d28a2f9f9c9243b8f652de1d6bc97118956053
d9ea72589854380d7ad95a1df7e5397ad6d726a6
refs/heads/master
2020-04-10T02:49:18.841692
2018-12-07T03:40:00
2018-12-07T03:40:00
160,753,369
0
1
null
null
null
null
UTF-8
Java
false
false
2,101
java
/* * Copyright (c) 2012 ZES Inc. All rights reserved. * This software is the confidential and proprietary information of ZES Inc. * You shall not disclose such Confidential Information and shall use it * only in accordance with the terms of the license agreement you entered into * with ZES Inc. (http://www.zesinc.co.kr/) */ package zes.openworks.web.introduction; import zes.base.vo.PaggingVO; /** * * * @version 1.0 * @since openworks-2.0 프로젝트. (After JDK 1.6) * @author (주)제스아이엔씨 기술연구소 *<pre> *<< 개정이력(Modification Information) >> * * 수정일 수정자 수정내용 *-------------- -------- ------------------------------- * 2018. 3. 8. 이홍석 신규 *</pre> * @see */ public class AgremManageVO extends PaggingVO { private static final long serialVersionUID = -9066643876847956548L; private String userId; /** 사용자 아이디 */ private String cmpnyNm; /** 협약승인기업명 */ private String q_companyName; /** 검색 - 기업명 */ /** * String userId을 반환 * @return String userId */ public String getUserId() { return userId; } /** * userId을 설정 * @param userId 을(를) String userId로 설정 */ public void setUserId(String userId) { this.userId = userId; } /** * String cmpnyNm을 반환 * @return String cmpnyNm */ public String getCmpnyNm() { return cmpnyNm; } /** * cmpnyNm을 설정 * @param cmpnyNm 을(를) String cmpnyNm로 설정 */ public void setCmpnyNm(String cmpnyNm) { this.cmpnyNm = cmpnyNm; } /** * String q_companyName을 반환 * @return String q_companyName */ public String getQ_companyName() { return q_companyName; } /** * q_companyName을 설정 * @param q_companyName 을(를) String q_companyName로 설정 */ public void setQ_companyName(String q_companyName) { this.q_companyName = q_companyName; } }
[ "tenbirds@gmail.com" ]
tenbirds@gmail.com
a92c147b81b1ceb32d76341bf26f35c3f5a13bd8
6888191eaf8d9caa056baa48083e187d466d8052
/WeChatMenuConsumer/src/main/java/com/wxMenuConsumer/controller/job/MenuTypeController.java
889b299b85fe06df422e8fc82a8259e1dc683999
[]
no_license
jizhizhihui/WeChatMenuMaster
8c4bc559ce098746a2354005bcb5e87140671a23
b2e40887522a6888eb9bbd32c3bd811c20eb9c4e
refs/heads/master
2023-01-30T17:55:56.824102
2020-12-14T02:21:09
2020-12-14T02:21:09
315,288,640
0
0
null
null
null
null
UTF-8
Java
false
false
2,119
java
package com.wxMenuConsumer.controller.job; import com.alibaba.dubbo.config.annotation.Reference; import com.wxMenuAPI.common.result.CommonResult; import com.wxMenuAPI.project.entity.MenuType; import com.wxMenuAPI.project.service.IMenuTypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; /** * 分类控制器 * * @author com.JZhi * @since 2020-11-23 */ @RestController @RequestMapping("/api/menu-type") @Api(tags = "分类") public class MenuTypeController { @Reference(version = "1.0.0") private IMenuTypeService menuTypeService; @GetMapping("get/{id}") @ApiOperation("获取分类信息,ID") public CommonResult get(@PathVariable int id) { return CommonResult.success(menuTypeService.getById(id)); } @GetMapping("gets") @ApiOperation("获取所有分类信息") public CommonResult gets() { return CommonResult.success(menuTypeService.list()); } @GetMapping("getParentChildrenMenu") @ApiOperation("获取父菜单和子菜单信息") public CommonResult getParentChildrenMenu() { return CommonResult.success(menuTypeService.getParentChildrenMenu()); } @PutMapping("update") @ApiOperation("更新分类信息") public CommonResult update(@RequestBody MenuType menuType) { if(menuTypeService.updateById(menuType)) return CommonResult.success("SUCCESS"); return CommonResult.failed("FAIL"); } @DeleteMapping("delete/{id}") @ApiOperation("删除分类信息") public CommonResult delete(@PathVariable int id) { if (menuTypeService.removeById(id)) return CommonResult.success("SUCCESS"); return CommonResult.failed("FAIL"); } @PostMapping("add") @ApiOperation("新增分类信息") public CommonResult add(@RequestBody MenuType menuType) { if (menuTypeService.getById(menuType.getId()) != null) return CommonResult.success(menuTypeService.save(menuType)); return CommonResult.failed("ID 不存在"); } }
[ "1340355186@qq.com" ]
1340355186@qq.com
da20b3952e51925200c1ca982c0fa8e0427e092b
ce8b9289cc7308baa82996ffd6811da91dd882d9
/kodilla-testing/src/main/java/com/kodilla/testing/library/LibraryUser.java
eaeb6fdc078dd3e334553d092fd8fe245620e35a
[]
no_license
Cayam331/Kodilla-course
1b42bec52b3aacd5be3041b74519af5df71a906f
b23f3dac110e1248ae3d49019a53e03d0408be6a
refs/heads/master
2020-03-24T00:00:18.685364
2018-08-30T16:34:06
2018-08-30T16:34:06
142,125,948
0
0
null
null
null
null
UTF-8
Java
false
false
1,033
java
package com.kodilla.testing.library; public class LibraryUser { String firstname; String lastname; String peselId; public String getFirstname() { return firstname; } @Override public String toString() { return "LibraryUser{" + "firstname='" + firstname + '\'' + ", lastname='" + lastname + '\'' + ", peselId='" + peselId + '\'' + '}'; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } public String getPeselId() { return peselId; } public void setPeselId(String peselId) { this.peselId = peselId; } public LibraryUser(String firstname, String lastname, String peselId) { this.firstname = firstname; this.lastname = lastname; this.peselId = peselId; } }
[ "eryk.ku@interia.pl" ]
eryk.ku@interia.pl
0ff5253eed18073619e1aace6c0e7bc2cc3c57a7
98ce206f1c14c48aef456684ac6743c957db1e7a
/MusicServer/src/MusicServer.java
60e48d11b442b54382097e7fe4c789f6b766f111
[]
no_license
OliveiraLucas10/study-playground
a464f64f3180e8589749fb225bb2a8499ca545cf
b09c2093f37df8b63cb27887d09b8b295dd87691
refs/heads/master
2020-04-26T09:56:30.477471
2019-03-02T17:24:42
2019-03-02T17:24:42
173,472,714
0
0
null
null
null
null
UTF-8
Java
false
false
1,920
java
import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; import java.util.Iterator; public class MusicServer { ArrayList<ObjectOutputStream> clientOutputStreams; public static void main(String[] args) { new MusicServer().go(); } public class ClientHandler implements Runnable { ObjectInputStream in; Socket clientSocket; public ClientHandler(Socket socket) { try { clientSocket = socket; in = new ObjectInputStream(clientSocket.getInputStream()); } catch (Exception e) { e.printStackTrace(); } } @Override public void run() { Object o2 = null; Object o1 = null; try { while ((o1 = in.readObject()) != null) { o2 = in.readObject(); System.out.println("read two objects"); tellEveryOne(o1, o2); } } catch (Exception e) { e.printStackTrace(); } } } public void go() { clientOutputStreams = new ArrayList<ObjectOutputStream>(); try { ServerSocket serverSocket = new ServerSocket(4242); while (true) { Socket clientSocket = serverSocket.accept(); ObjectOutputStream out = new ObjectOutputStream(clientSocket.getOutputStream()); clientOutputStreams.add(out); Thread t = new Thread(new ClientHandler(clientSocket)); t.start(); System.out.println("got a connection"); } } catch (Exception e) { e.printStackTrace(); } } public void tellEveryOne(Object one, Object two) { Iterator it = clientOutputStreams.iterator(); while (it.hasNext()) { try { ObjectOutputStream out = (ObjectOutputStream) it.next(); out.writeObject(one); out.writeObject(two); } catch (Exception e) { e.printStackTrace(); } } } }
[ "oliveiraborgeslucas@gmail.com" ]
oliveiraborgeslucas@gmail.com
69d519d90f85cb7a57268e279cb555fcd7fb70a4
baf8d5cc9b833ca08d54d655273e080f27ef677a
/src/main/java/pl/java/scalatech/repository/PetRepository.java
8c6bbae6cb5c8f5e5d3c0f73326ccb4979c9a687
[]
no_license
przodownikR1/bootPetclinicCamp
363849161ed5375690fc3de9a2d1db0ba607caf5
358286095b2e06e228f1fcf0db5ba35be225f8ba
refs/heads/master
2020-07-19T12:53:43.886926
2016-09-11T09:23:20
2016-09-11T09:23:20
67,339,739
0
0
null
null
null
null
UTF-8
Java
false
false
2,048
java
/* * Copyright 2002-2013 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 pl.java.scalatech.repository; import java.util.List; import org.springframework.dao.DataAccessException; import pl.java.scalatech.model.Pet; import pl.java.scalatech.model.PetType; /** * Repository class for <code>Pet</code> domain objects All method names are compliant with Spring Data naming * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation * * @author Ken Krebs * @author Juergen Hoeller * @author Sam Brannen * @author Michael Isvy */ public interface PetRepository { /** * Retrieve all <code>PetType</code>s from the data store. * * @return a <code>Collection</code> of <code>PetType</code>s */ List<PetType> findPetTypes() throws DataAccessException; /** * Retrieve a <code>Pet</code> from the data store by id. * * @param id the id to search for * @return the <code>Pet</code> if found * @throws org.springframework.dao.DataRetrievalFailureException * if not found */ Pet findById(int id) throws DataAccessException; /** * Save a <code>Pet</code> to the data store, either inserting or updating it. * * @param pet the <code>Pet</code> to save * @see BaseEntity#isNew */ void save(Pet pet) throws DataAccessException; }
[ "przodownik@tlen.pl" ]
przodownik@tlen.pl
3724b57d7c766af75014cd87e826aee8b28f4a1d
86cf61187d22b867d1e5d3c8a23d97e806636020
/src/main/java/base/operators/operator/learner/functions/PolynomialRegressionModel.java
b908164068af22a73f5eedc391a3d48bba10f3c4
[]
no_license
hitaitengteng/abc-pipeline-engine
f94bb3b1888ad809541c83d6923a64c39fef9b19
165a620b94fb91ae97647135cc15a66d212a39e8
refs/heads/master
2022-02-22T18:49:28.915809
2019-10-27T13:40:58
2019-10-27T13:40:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,371
java
/** * Copyright (C) 2001-2019 by RapidMiner and the contributors * * Complete list of developers available at our web site: * * http://rapidminer.com * * This program is free software: you can redistribute it and/or modify it under the terms of the * GNU Affero General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License along with this program. * If not, see http://www.gnu.org/licenses/. */ package base.operators.operator.learner.functions; import base.operators.example.Attribute; import base.operators.example.Example; import base.operators.example.ExampleSet; import base.operators.example.set.ExampleSetUtilities; import base.operators.operator.OperatorException; import base.operators.operator.learner.SimplePredictionModel; import base.operators.tools.Tools; /** * The model for the polynomial regression. * * @author Ingo Mierswa */ public class PolynomialRegressionModel extends SimplePredictionModel { private static final long serialVersionUID = 5503523600824976254L; private String[] attributeConstructions; private double[][] coefficients; private double[][] degrees; private double offset; public PolynomialRegressionModel(ExampleSet exampleSet, double[][] coefficients, double[][] degrees, double offset) { super(exampleSet, ExampleSetUtilities.SetsCompareOption.EQUAL, ExampleSetUtilities.TypesCompareOption.ALLOW_SAME_PARENTS); this.attributeConstructions = base.operators.example.Tools.getRegularAttributeConstructions(exampleSet); this.coefficients = coefficients; this.degrees = degrees; this.offset = offset; } @Override public double predict(Example example) throws OperatorException { return calculatePrediction(example, coefficients, degrees, offset); } /** * Calculates the prediction using the values of the example at its regular attributes. */ public static double calculatePrediction(Example example, double[][] coefficients, double[][] degrees, double offset) { double prediction = 0; int index = 0; for (Attribute attribute : example.getAttributes()) { double value = example.getValue(attribute); for (int f = 0; f < coefficients.length; f++) { prediction += coefficients[f][index] * Math.pow(value, degrees[f][index]); } index++; } prediction += offset; return prediction; } /** * Calculates the prediction using the values of the example for the given attributes. */ public static double calculatePrediction(Example example, Attribute[] attributes, double[][] coefficients, double[][] degrees, double offset) { double prediction = 0; int index = 0; for (Attribute attribute : attributes) { double value = example.getValue(attribute); for (int f = 0; f < coefficients.length; f++) { prediction += coefficients[f][index] * Math.pow(value, degrees[f][index]); } index++; } prediction += offset; return prediction; } @Override protected boolean supportsConfidences(Attribute label) { return false; } @Override public String toString() { StringBuffer result = new StringBuffer(); boolean first = true; int index = 0; for (int i = 0; i < attributeConstructions.length; i++) { for (int f = 0; f < coefficients.length; f++) { result.append(getCoefficientString(coefficients[f][index], first) + " * " + attributeConstructions[i] + " ^ " + Tools.formatNumber(degrees[f][i]) + Tools.getLineSeparator()); first = false; } index++; } result.append(getCoefficientString(offset, first)); return result.toString(); } private String getCoefficientString(double coefficient, boolean first) { if (!first) { if (coefficient >= 0) { return "+ " + Tools.formatNumber(Math.abs(coefficient)); } else { return "- " + Tools.formatNumber(Math.abs(coefficient)); } } else { if (coefficient >= 0) { return " " + Tools.formatNumber(Math.abs(coefficient)); } else { return "- " + Tools.formatNumber(Math.abs(coefficient)); } } } }
[ "wangj_lc@inspur.com" ]
wangj_lc@inspur.com
2ac8dc5d31a4acc1510ac87938087a6325b8e756
3106d521475f4cd34574c198352179fe3894eeed
/src/main/java/com/dao/ProductCategoryDao.java
e67d4505e4b087960a1ba477064a195020958626
[]
no_license
lalala1874/xiaoyuanshangpu
7a44f64eccbed0d2b94ebed48094c14d7b2d56b0
c268c2033a5a75470d705f1360731e8143defafa
refs/heads/github
2022-12-24T10:50:56.135728
2019-11-14T13:52:25
2019-11-14T13:52:25
210,502,715
0
0
null
2022-12-16T04:58:06
2019-09-24T03:22:10
Java
UTF-8
Java
false
false
458
java
package com.dao; import com.dto.ProductCatetgoryExecution; import com.entity.ProductCategory; import org.apache.ibatis.annotations.Param; import java.util.List; public interface ProductCategoryDao { List<ProductCategory> queryProductCategoryList(long shopId); int batchInsertProductCategory(List<ProductCategory> productCategoryList); int deleteProductCategory(@Param("productCategoryId")Long productCategoryId,@Param("shopId")Long shopId); }
[ "1229860674@qq.com" ]
1229860674@qq.com
547660b7f67f6ef4d60048369cbcd1146676774b
b6c0c5b2811b923a74ea97e1b9731f7ffa421f40
/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/AppModuleMapping.java
d446e3a7461cf8970bf53625cbfab4439219096e
[ "Apache-2.0" ]
permissive
glahiru/airavata
b1ae8dc98af27933ee303ff7300351c070de262d
9e7ed4ba8336091717ff1dc823d084f6b349ae08
refs/heads/master
2021-01-23T18:08:23.120559
2014-10-24T05:38:39
2014-10-24T05:40:30
23,710,309
0
1
null
null
null
null
UTF-8
Java
false
false
2,294
java
/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.aiaravata.application.catalog.data.model; import javax.persistence.*; import java.io.Serializable; @Entity @Table(name = "APP_MODULE_MAPPING") @IdClass(AppModuleMapping_PK.class) public class AppModuleMapping implements Serializable { @Id @Column(name = "INTERFACE_ID") private String interfaceID; @Id @Column(name = "MODULE_ID") private String moduleID; @ManyToOne(cascade= CascadeType.MERGE) @JoinColumn(name = "INTERFACE_ID") private ApplicationInterface applicationInterface; @ManyToOne(cascade= CascadeType.MERGE) @JoinColumn(name = "MODULE_ID") private ApplicationModule applicationModule; public String getInterfaceID() { return interfaceID; } public void setInterfaceID(String interfaceID) { this.interfaceID = interfaceID; } public String getModuleID() { return moduleID; } public void setModuleID(String moduleID) { this.moduleID = moduleID; } public ApplicationInterface getApplicationInterface() { return applicationInterface; } public void setApplicationInterface(ApplicationInterface applicationInterface) { this.applicationInterface = applicationInterface; } public ApplicationModule getApplicationModule() { return applicationModule; } public void setApplicationModule(ApplicationModule applicationModule) { this.applicationModule = applicationModule; } }
[ "kamalasini@gmail.com" ]
kamalasini@gmail.com
b9a31a934af3f1d77ceb20d12e99c678f31dca7d
aea1ab14e2c1f7cf66c958e4954192bbaeff152c
/springCloudZuul/src/main/java/com/example/springcloudzuul/SpringcloudzuulApplication.java
c5f3fafcb60a1cc2f1005a6078146ad78dc64f84
[]
no_license
xuepengbo0826/springcloud
44429131fdc7332551e2d3e256012992d54e4170
d97d69c4946001a5481af6e60221a81d77bec4a1
refs/heads/master
2020-03-23T21:15:55.552821
2018-07-27T03:55:22
2018-07-27T03:55:22
141,362,816
0
0
null
null
null
null
UTF-8
Java
false
false
517
java
package com.example.springcloudzuul; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; @SpringBootApplication @EnableEurekaClient @EnableZuulProxy public class SpringcloudzuulApplication { public static void main(String[] args) { SpringApplication.run(SpringcloudzuulApplication.class, args); } }
[ "xuepengbo@chinasofti.com" ]
xuepengbo@chinasofti.com
4c6bc8d819093b26cfe7f0193dfbc3583eff8ebd
2f64eeab6347144d6ec4e173e9ca5a2268af76b5
/src/de/gameplayjdk/jwfcimage/usecase/UseCaseAttachAvailableExtension.java
4916dbfb64622c53b4a9ef3cf4a64649e2692f43
[ "MIT" ]
permissive
GameplayJDK/java-tilemap-playground
4b0c50596f1ca431b586fc4fdd7c96369d30572c
aa73d76035131c47633efc8768a7cebe00221caa
refs/heads/master
2020-09-09T19:30:01.148068
2020-01-03T16:39:12
2020-01-03T16:39:12
221,543,463
0
0
null
null
null
null
UTF-8
Java
false
false
3,015
java
/* * The MIT License (MIT) * Copyright (c) 2019 GameplayJDK * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package de.gameplayjdk.jwfcimage.usecase; import de.gameplayjdk.jwfcimage.extension.access.Application; import de.gameplayjdk.jwfcimage.extension.simple.ExtensionSimple; import de.gameplayjdk.jwfcimage.mvp.clean.UseCaseAbstract; public class UseCaseAttachAvailableExtension extends UseCaseAbstract<UseCaseAttachAvailableExtension.RequestValue, UseCaseAttachAvailableExtension.ResponseValue, UseCaseAttachAvailableExtension.ErrorResponseValue> { public static UseCaseAttachAvailableExtension newInstance() { return new UseCaseAttachAvailableExtension(Application.getInstance()); } private final Application application; private final ExtensionSimple defaultExtension; public UseCaseAttachAvailableExtension(Application application) { this.application = application; this.defaultExtension = new ExtensionSimple(); } @Override protected void executeUseCase(RequestValue requestValue) { this.application.attachAvailableExtension(this.defaultExtension); if (this.application.attachAvailableExtension()) { this.callOnSuccessCallback(); return; } this.callOnErrorCallback(); } private void callOnSuccessCallback() { ResponseValue responseValue = new ResponseValue(); this.getUseCaseCallback() .onSuccess(responseValue); } private void callOnErrorCallback() { ErrorResponseValue errorResponseValue = new ErrorResponseValue(); this.getUseCaseCallback() .onError(errorResponseValue); } public static class RequestValue implements UseCaseAbstract.RequestValueInterface { } public static class ResponseValue implements UseCaseAbstract.ResponseValueInterface { } public static class ErrorResponseValue implements UseCaseAbstract.ErrorResponseValueInterface { } }
[ "github@gameplayjdk.de" ]
github@gameplayjdk.de
bc9e32bb86fa26f6480c8e047d9f024ac3fa1e36
2ca93846ab8f638a7d8cd80f91566ee3632cf186
/Entire Dataset/1-45/realism/Analog.java
203323de51daa7959a7887f4ddc4167f38fdcd94
[ "MIT" ]
permissive
hjc851/SourceCodePlagiarismDetectionDataset
729483c3b823c455ffa947fc18d6177b8a78a21f
f67bc79576a8df85e8a7b4f5d012346e3a76db37
refs/heads/master
2020-07-05T10:48:29.980984
2019-08-15T23:51:55
2019-08-15T23:51:55
202,626,196
0
0
null
null
null
null
UTF-8
Java
false
false
6,246
java
package realism; import depositional.WeekGoverness; import throughputMaterials.FissionableCavil; import farmer.*; import memory.*; import read.*; import static java.lang.String.format; public class Analog { private static final int synX2805int = 0; private static final String synX2804String = " ----------------------------------------------- "; private static final String synX2803String = " ----------------------------------------------- "; private static final String synX2802String = "Average Count"; private static final String synX2801String = "Average Time"; private static final String synX2800String = "Storage ID"; private static final String synX2799String = "| %-14s | %-12s | %-12s |"; private static final String synX2798String = " ----------------------------------------------- "; private static final String synX2797String = "Storage"; private static final String synX2796String = " ----------------------------------------------------- "; private static final String synX2795String = "|-----------------------------------------------------|"; private static final String synX2794String = "Blocked"; private static final String synX2793String = "Starving"; private static final String synX2792String = "Production"; private static final String synX2791String = "Producer ID"; private static final String synX2790String = "| %-14s | %-12s | %-8s | %-8s |"; private static final String synX2789String = " ----------------------------------------------------- "; private static final String synX2788String = "Assemblers"; private static final String synX2787String = "Statistics\n"; private static final String synX2786String = "ProducibleObject count: "; private static final String synX2785String = "Storage Capacity: %d"; private static final String synX2784String = "Time Limit: %.2f Last Producer Finish Time: %.2f\nStandard Mean: %.2f Standard Range: %.2f"; private double monthRestricting = 0.0; public Analog(double momentRestrain, double authoritativeHateful, double criterialRank) { this.monthRestricting = (momentRestrain); this.definitiveSkilled = (authoritativeHateful); this.regulationGraze = (criterialRank); this.symposiumSufferance = (new read.ExtravaganzaWait()); this.vintner = (new farmer.Breeder[8]); this.depot = (new memory.Garage[5]); depot[0] = (new memory.Garage()); depot[1] = (new memory.Garage()); depot[2] = (new memory.Garage()); depot[3] = (new memory.Garage()); depot[4] = (new memory.Garage()); vintner[0] = (new farmer.FarmerBegins(this.definitiveSkilled, this.regulationGraze, depot[0])); vintner[1] = (new farmer.PromoterTrain( this.definitiveSkilled, this.regulationGraze, depot[1], depot[0])); vintner[2] = (new farmer.PromoterTrain( this.definitiveSkilled * 2.0, this.regulationGraze * 2.0, depot[2], depot[1])); vintner[3] = (new farmer.PromoterTrain( this.definitiveSkilled * 2.0, this.regulationGraze * 2.0, depot[2], depot[1])); vintner[4] = (new farmer.PromoterTrain( this.definitiveSkilled, this.regulationGraze, depot[3], depot[2])); vintner[5] = (new farmer.PromoterTrain( this.definitiveSkilled * 2.0, this.regulationGraze * 2.0, depot[4], depot[3])); vintner[6] = (new farmer.PromoterTrain( this.definitiveSkilled * 2.0, this.regulationGraze * 2.0, depot[4], depot[3])); vintner[7] = (new farmer.ManufacturersEnding(this.definitiveSkilled, this.regulationGraze, depot[4])); depot[0].fitComing(vintner[1]); depot[0].laidPast(vintner[0]); depot[1].fitComing(vintner[2], vintner[3]); depot[1].laidPast(vintner[1]); depot[2].fitComing(vintner[4]); depot[2].laidPast(vintner[2], vintner[3]); depot[3].fitComing(vintner[5], vintner[6]); depot[3].laidPast(vintner[4]); depot[4].fitComing(vintner[7]); depot[4].laidPast(vintner[5], vintner[6]); this.symposiumSufferance.putSummit( new read.ProduceTriathlon( depositional.WeekGoverness.flowMonth(), ProduceTriathlon.TailResume, vintner[0])); } private double definitiveSkilled = 0.0; private synchronized void brailleNumerals() { System.out.println( format( synX2784String, this.monthRestricting, depositional.WeekGoverness.flowMonth(), this.definitiveSkilled, this.regulationGraze)); System.out.println(format(synX2785String, memory.Garage.warehousingRestriction())); System.out.println(synX2786String + throughputMaterials.FissionableCavil.flowNumbers()); System.out.println(); System.out.println(synX2787String); System.out.println(synX2788String); System.out.println(synX2789String); System.out.println( format(synX2790String, synX2791String, synX2792String, synX2793String, synX2794String)); System.out.println(synX2795String); for (farmer.Breeder leong : vintner) { System.out.println(leong.indicators()); } System.out.println(synX2796String); System.out.println(); System.out.println(synX2797String); System.out.println(synX2798String); System.out.println(format(synX2799String, synX2800String, synX2801String, synX2802String)); System.out.println(synX2803String); for (memory.Garage waffen : depot) { System.out.println(waffen.survey()); } System.out.println(synX2804String); } public synchronized double sentenceConfine() { return this.monthRestricting; } private farmer.Breeder vintner[] = null; private read.ExtravaganzaWait symposiumSufferance = null; private static realism.Analog latestAnalogy = null; public synchronized void go() { Analog.latestAnalogy = (this); while (depositional.WeekGoverness.flowMonth() < this.monthRestricting && this.symposiumSufferance.figures() > synX2805int) { this.symposiumSufferance.theExposition().procedureCase(); } this.brailleNumerals(); } private memory.Garage depot[] = null; private double regulationGraze = 0.0; public static synchronized realism.Analog liveSimulator() { return latestAnalogy; } }
[ "hayden.cheers@me.com" ]
hayden.cheers@me.com
894f964719549c8e1a2c6d64278a7d8c4b1ad484
63b4e7dade0c809d64ad05561d3768b0a319921f
/NASB/src/main/java/com/nasb/ReportTemplateManagerService.java
1d8272af1b27cf24c9c8be62b8f5aa6016c4aef3
[]
no_license
GeertjanWielenga/NetApacheSyncopeBeans
87e165b1e819209951aa3890b3ca649a448f6a4a
08c89195d9dc2e6f4e68b425806bc7f4f1a79e73
refs/heads/master
2020-04-02T13:00:00.440418
2016-07-14T22:17:42
2016-07-14T22:17:42
63,371,537
0
0
null
null
null
null
UTF-8
Java
false
false
2,507
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.nasb; import java.io.InputStream; import java.util.List; import javax.ws.rs.core.Response; import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.client.lib.SyncopeClientFactoryBean; import org.apache.syncope.common.lib.to.ReportTemplateTO; import org.apache.syncope.common.lib.types.ReportTemplateFormat; import org.apache.syncope.common.rest.api.service.ReportTemplateService; public class ReportTemplateManagerService { private ReportTemplateService service; public ReportTemplateManagerService(final String url, final String userName, final String password) { SyncopeClient syncopeClient = new SyncopeClientFactoryBean().setAddress(url).create(userName, password); service = syncopeClient.getService(ReportTemplateService.class); } public List<ReportTemplateTO> list() { return service.list(); } public boolean create(final ReportTemplateTO reportTemplateTO) { return Response.Status.CREATED.getStatusCode() == service.create(reportTemplateTO).getStatus(); } public ReportTemplateTO read(final String key) { return service.read(key); } public boolean delete(final String key) { service.delete(key); return true; } public Object getFormat(final String key, final ReportTemplateFormat format) { return service.getFormat(key, format).getEntity(); } public void setFormat(final String key, final ReportTemplateFormat format, final InputStream templateIn) { service.setFormat(key, format, templateIn); } public boolean removeFormat(final String key, final ReportTemplateFormat format) { return false; } }
[ "gwieleng@GWIELENG-NL.nl.oracle.com" ]
gwieleng@GWIELENG-NL.nl.oracle.com
96fff68c925713b9020bd562cc1949b1df07c3fd
9eeb9b2bce5d3447ea7fa76b171690203c09e4ea
/app/src/main/java/com/bethena/magazinefans/widget/UnScrollableViewPager.java
c63a1cedf070b8c8f100054422b3727ef06c4c17
[]
no_license
chenminglin/MagazineFans
4ccda639261504d35974d41fda96a0a569e343c9
dc72dca07c1137f4955e6cf1c6fb99b367dec838
refs/heads/master
2020-03-16T18:28:41.366415
2018-05-30T07:13:57
2018-05-30T07:13:57
132,868,990
0
0
null
null
null
null
UTF-8
Java
false
false
1,009
java
package com.bethena.magazinefans.widget; import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; public class UnScrollableViewPager extends ViewPager { private boolean scrollable = true; public UnScrollableViewPager(Context context) { super(context); } public UnScrollableViewPager(Context context, AttributeSet attrs) { super(context, attrs); } @Override public boolean onTouchEvent(MotionEvent ev) { return !scrollable && super.onTouchEvent(ev); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return !scrollable && super.onInterceptTouchEvent(ev); } public boolean isScrollable() { return scrollable; } public void setScrollable(boolean scrollable) { this.scrollable = scrollable; } @Override public void setCurrentItem(int item) { setCurrentItem(item, false); } }
[ "chenml@13322ty.com" ]
chenml@13322ty.com
d121d530c5ca79bbb718897a0f64b643a64676e1
79a96ee20bc1242c2d5c7cd7d649c77ddf645964
/authenticator-domain/src/main/java/com/charlyghislain/authenticator/domain/domain/exception/ValidationException.java
551aaeccfac0108e5ffa344812ecb9558ca86d5a
[ "MIT" ]
permissive
cghislai/authenticator
dd8a959fa7dfe98e2367c10c068d9a3c89be41e4
1cd9318e352e1a2228d422bf9ac64c8b225618fe
refs/heads/rc
2022-04-30T23:03:46.217608
2019-09-29T21:31:07
2019-09-29T21:31:07
145,702,351
1
0
MIT
2022-03-08T21:17:05
2018-08-22T11:53:28
Java
UTF-8
Java
false
false
525
java
package com.charlyghislain.authenticator.domain.domain.exception; import javax.validation.ConstraintViolation; import java.util.Set; public class ValidationException extends AuthenticatorException { private Set<ConstraintViolation<?>> constraintViolations; public ValidationException(Set<ConstraintViolation<?>> constraintViolations) { this.constraintViolations = constraintViolations; } public Set<ConstraintViolation<?>> getConstraintViolations() { return constraintViolations; } }
[ "charlyghislain@gmail.com" ]
charlyghislain@gmail.com
de81033532ae941b0f5d891a1505a7f653d661a5
94d16f9e54f857b96410fa396cb791c8d23dc68f
/src/dragonball/model/game/Game.java
0a9bcad23552172510b4b44c2e410d1e2dac8765
[]
no_license
seifhussam/DragonBall-Game
b01e7ab01279fb1bb15116f209fe1351a60bab45
94f432c8591bb22128ceb730bbfbb1db3990eaa1
refs/heads/master
2021-06-13T01:03:00.982498
2021-05-31T07:33:23
2021-05-31T07:33:23
90,458,684
0
0
null
null
null
null
UTF-8
Java
false
false
20,049
java
package dragonball.model.game; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.LinkedList; import dragonball.model.attack.Attack; import dragonball.model.attack.MaximumCharge; import dragonball.model.attack.SuperAttack; import dragonball.model.attack.SuperSaiyan; import dragonball.model.attack.UltimateAttack; import dragonball.model.battle.Battle; import dragonball.model.battle.BattleEvent; import dragonball.model.battle.BattleEventType; import dragonball.model.battle.BattleListener; import dragonball.model.battle.BattleOpponent; import dragonball.model.cell.Collectible; import dragonball.model.cell.EmptyCell; import dragonball.model.character.fighter.Fighter; import dragonball.model.character.fighter.NonPlayableFighter; import dragonball.model.character.fighter.PlayableFighter; import dragonball.model.dragon.Dragon; import dragonball.model.dragon.DragonWish; import dragonball.model.exceptions.MissingFieldException; import dragonball.model.exceptions.UnknownAttackTypeException; import dragonball.model.player.Player; import dragonball.model.player.PlayerListener; import dragonball.model.tournament.MatchStatus; import dragonball.model.tournament.Tournament; import dragonball.model.tournament.TournamentListener; import dragonball.model.tournament.TournamentMatch; import dragonball.model.tournament.TournamentStatus; import dragonball.model.world.World; import dragonball.model.world.WorldListener; public class Game implements PlayerListener, WorldListener, BattleListener, Serializable,TournamentListener { /** * */ private static final long serialVersionUID = 1L; private Player player; private World world; private ArrayList<NonPlayableFighter> weakFoes; private ArrayList<NonPlayableFighter> strongFoes; private ArrayList<Attack> attacks; private ArrayList<Dragon> dragons; private GameState state; private transient GameListener gameListener; private static String savedBefore ; private ArrayList<NonPlayableFighter> Tournamentfoes ; private Tournament tournament ; public String getSavedBefore() { return savedBefore; } public static void setSavedBefore(String savedBefore) { Game.savedBefore = savedBefore; } public void setPlayer(Player player) { this.player = player; } public Game() { player = new Player(""); attacks = new ArrayList<Attack>(); dragons = new ArrayList<Dragon>(); weakFoes = new ArrayList<NonPlayableFighter>(); strongFoes = new ArrayList<NonPlayableFighter>(); setTournamentfoes(new ArrayList<NonPlayableFighter>()) ; world = new World(); player.setPlayerListener(this); world.setWorldListener(this); try { try { loadAttacks("Database-Attacks.csv"); } catch (MissingFieldException e ) { loadAttacks("Database-Attacks-aux.csv"); } catch (UnknownAttackTypeException e ) { loadAttacks("Database-Attacks-aux.csv"); } try { loadDragons("Database-Dragons.csv"); } catch(MissingFieldException e) { loadDragons("Database-Dragons-aux.csv"); } try { loadFoes("Database-Foes-Range"+getn()+".csv"); } catch (MissingFieldException e ) { loadFoes("Database-Foes-aux.csv"); } } catch (IOException f ) { f.printStackTrace(); } for (int i = 0; i < 4; i++) { try { loadTournamentFoes("Database-Foes-Range"+(i+1)+".csv"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } world.generateMap(weakFoes, strongFoes); state = GameState.WORLD; } public void save (String path) { try { ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream( new File(path))); // Serializing the object and writing it on the hard disk. oos.writeObject(this); // Updating the last saved file path to the current file. savedBefore = path; // close the output stream. oos.close(); } catch(IOException i ) { i.printStackTrace(); } } public void load (String fileName) throws IOException, ClassNotFoundException { Game g ; FileInputStream fileIn = new FileInputStream(fileName); ObjectInputStream in = new ObjectInputStream(fileIn); g = (Game) in.readObject(); this.dragons = g.dragons ; this.attacks = g.attacks ; this.gameListener = g.gameListener ; this.world = g.world ; this.player = g.player ; System.out.println(g.player.getActiveFighter()); this.player.setActiveFighter(g.player.getActiveFighter() ); this.player.setPlayerListener(this); this.world.setWorldListener(this); this.state = g.state ; this.weakFoes = g.weakFoes ; this.strongFoes = g.strongFoes ; try { in.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { fileIn.close(); } catch (IOException e) { // TODO Auto-generated catch block } } public void setListener(GameListener gameListener) { this.gameListener = gameListener; } private int getn() { if (player==null){ return 1 ; } if(player.getActiveFighter()==null) { return 1 ; } if (player.getActiveFighter().getLevel() <= 10) return 1; else if (player.getActiveFighter().getLevel() <= 20) return 2; else if (player.getActiveFighter().getLevel() <= 30) return 3; else if (player.getActiveFighter().getLevel() <= 40) return 4; else if (player.getActiveFighter().getLevel() >40) return 5; return 1 ; } private LinkedList<String> loadCSV(String path) throws IOException { LinkedList<String> result = new LinkedList<String>(); FileReader fileReader = new FileReader(path); BufferedReader bf = new BufferedReader(fileReader); String temp = ""; while ((temp = bf.readLine()) != null) { result.add(temp); } fileReader.close(); return result; } private int damageSearch(String name) { for (int i = 0; i < this.attacks.size(); i++) { if (name.equals(attacks.get(i).getName())) return attacks.get(i).getDamage(); } return -1; } public void loadDragons(String path) throws IOException { this.dragons = new ArrayList<>(); LinkedList<String> Dragons = loadCSV(path); if (!path.contains(".csv" )){ loadDragons("Database-Dragons-aux.csv"); } int sourceLine = 0 ; while (!Dragons.isEmpty()) { sourceLine++ ; String FirstLine[] = Dragons.removeFirst().split(","); if(FirstLine.length!=3){ dragons = new ArrayList<Dragon>() ; throw new MissingFieldException(path+" "+sourceLine+" "+(3-FirstLine.length),path, sourceLine, 3-FirstLine.length) ; } String SecondLine[] = Dragons.removeFirst().split(","); String ThirdLine[] = Dragons.removeFirst().split(","); sourceLine +=2 ; ArrayList<SuperAttack> DragonssuperAttacks = new ArrayList<SuperAttack>(); ArrayList<UltimateAttack> DragonsUltimateAttacks = new ArrayList<UltimateAttack>(); for (int j = 0; j < SecondLine.length; j++) { DragonssuperAttacks.add(new SuperAttack(SecondLine[j], damageSearch(SecondLine[j]))); } for (int j = 0; j < ThirdLine.length; j++) { DragonsUltimateAttacks.add(new UltimateAttack(ThirdLine[j], damageSearch(ThirdLine[j]))); } this.dragons.add(new Dragon(FirstLine[0], DragonssuperAttacks, DragonsUltimateAttacks, Integer.parseInt(FirstLine[1]), Integer.parseInt(FirstLine[2]))); } } public void loadFoes(String path) throws IOException { this.strongFoes = new ArrayList<>() ; this.weakFoes = new ArrayList<>() ; LinkedList<String> Foes = loadCSV(path); if (!path.contains(".csv")){ loadFoes("Database-Foes-aux.csv"); } int sourceLine = 0 ; while (!Foes.isEmpty()) { sourceLine++ ; String FirstLine[] = Foes.removeFirst().split(","); if(FirstLine.length!=8){ strongFoes = new ArrayList<NonPlayableFighter>() ; weakFoes = new ArrayList<NonPlayableFighter>() ; throw new MissingFieldException(path+" "+sourceLine +" "+(8-FirstLine.length),path, sourceLine, 7-FirstLine.length) ; } sourceLine+=2 ; String SLine = Foes.removeFirst(); String SecondLine[] = SLine.split(","); String TLine = "" ; try { TLine = Foes.removeFirst(); } catch (Exception e) { } String ThirdLine[] = TLine.split(","); ArrayList<SuperAttack> FoessuperAttacks = new ArrayList<SuperAttack>(); ArrayList<UltimateAttack> FoesUltimateAttacks = new ArrayList<UltimateAttack>(); boolean b1 = false; boolean b2 = false; for (int i = 0; i < SLine.length(); i++) { if (SLine.charAt(i) != ' ') { b1 = true; break; } } for (int i = 0; i < TLine.length(); i++) { if (TLine.charAt(i) != ' ') { b2 = true; break; } } boolean b = Boolean.parseBoolean(FirstLine[7]); for (int j = 0; j < SecondLine.length && b1; j++) { if (SecondLine[j].equals("Maximum Charge")) FoessuperAttacks.add((MaximumCharge) new MaximumCharge()); else FoessuperAttacks.add(new SuperAttack(SecondLine[j], damageSearch(SecondLine[j]))); } for (int j = 0; j < ThirdLine.length && b2; j++) { if (ThirdLine[j].equals("Super Saiyan")) FoesUltimateAttacks.add((SuperSaiyan) new SuperSaiyan()); else FoesUltimateAttacks.add(new UltimateAttack(ThirdLine[j], damageSearch(ThirdLine[j]))); } if (b){ this.strongFoes.add(new NonPlayableFighter(FirstLine[0], Integer.parseInt(FirstLine[1]), Integer .parseInt(FirstLine[2]), Integer .parseInt(FirstLine[3]), Integer .parseInt(FirstLine[4]), Integer .parseInt(FirstLine[5]), Integer .parseInt(FirstLine[6]), true, FoessuperAttacks, FoesUltimateAttacks)); } else { this.weakFoes.add(new NonPlayableFighter(FirstLine[0], Integer .parseInt(FirstLine[1]), Integer.parseInt(FirstLine[2]), Integer .parseInt(FirstLine[3]), Integer .parseInt(FirstLine[4]), Integer .parseInt(FirstLine[5]), Integer .parseInt(FirstLine[6]), false, FoessuperAttacks, FoesUltimateAttacks)); } } } public void loadTournamentFoes(String path) throws IOException { LinkedList<String> Foes = loadCSV(path); if (!path.contains(".csv")){ loadFoes("Database-Foes-aux.csv"); } int sourceLine = 0 ; while (!Foes.isEmpty()) { sourceLine++ ; String FirstLine[] = Foes.removeFirst().split(","); if(FirstLine.length!=8){ strongFoes = new ArrayList<NonPlayableFighter>() ; weakFoes = new ArrayList<NonPlayableFighter>() ; throw new MissingFieldException(path+" "+sourceLine +" "+(8-FirstLine.length),path, sourceLine, 7-FirstLine.length) ; } sourceLine++; String SLine = Foes.removeFirst(); String SecondLine[] = SLine.split(","); String TLine = "" ; try { sourceLine++; TLine = Foes.removeFirst(); } catch (Exception e) { } String ThirdLine[] = TLine.split(","); ArrayList<SuperAttack> FoessuperAttacks = new ArrayList<SuperAttack>(); ArrayList<UltimateAttack> FoesUltimateAttacks = new ArrayList<UltimateAttack>(); boolean b1 = false; boolean b2 = false; for (int i = 0; i < SLine.length(); i++) { if (SLine.charAt(i) != ' ') { b1 = true; break; } } for (int i = 0; i < TLine.length(); i++) { if (TLine.charAt(i) != ' ') { b2 = true; break; } } for (int j = 0; j < SecondLine.length && b1; j++) { if (SecondLine[j].equals("Maximum Charge")) FoessuperAttacks.add((MaximumCharge) new MaximumCharge()); else FoessuperAttacks.add(new SuperAttack(SecondLine[j], damageSearch(SecondLine[j]))); } for (int j = 0; j < ThirdLine.length && b2; j++) { if (ThirdLine[j].equals("Super Saiyan")) FoesUltimateAttacks.add((SuperSaiyan) new SuperSaiyan()); else FoesUltimateAttacks.add(new UltimateAttack(ThirdLine[j], damageSearch(ThirdLine[j]))); } // System.out.println(FirstLine[0]+" "+FirstLine[6]); this.Tournamentfoes.add(new NonPlayableFighter(FirstLine[0], Integer.parseInt(FirstLine[1]), Integer .parseInt(FirstLine[2]), Integer .parseInt(FirstLine[3]), Integer .parseInt(FirstLine[4]), Integer .parseInt(FirstLine[5]), Integer .parseInt(FirstLine[6]),Boolean.parseBoolean(FirstLine[7]), FoessuperAttacks, FoesUltimateAttacks)); } } public void loadAttacks(String path) throws IOException { this.attacks = new ArrayList<>() ; LinkedList<String> Attacks = loadCSV(path); if (!path.contains(".csv")){ loadAttacks("Database-Attacks-aux.csv"); } int sourceLine = 0 ; while (!Attacks.isEmpty()) { String temp[] = ("" + Attacks.removeFirst()).split(","); sourceLine++ ; if (temp.length!=3) { attacks = new ArrayList<Attack>() ; throw new MissingFieldException(path+" "+sourceLine+" "+(3-temp.length),path, sourceLine, 3-temp.length); } String s = temp[1]; int x = Integer.parseInt(temp[2]); if (temp[0].equals("UA")) attacks.add(new UltimateAttack(s, x)); else if (temp[0].equals("SA")) attacks.add(new SuperAttack(s, x)); else if (temp[0].equals("MC")) attacks.add(new MaximumCharge()); else if (temp[0].equals("SS")) attacks.add(new SuperSaiyan()); else throw new UnknownAttackTypeException(path, sourceLine, temp[0]) ; } } public GameListener getGameListener() { return gameListener; } public Player getPlayer() { return player; } public World getWorld() { return world; } public ArrayList<NonPlayableFighter> getWeakFoes() { return weakFoes; } public ArrayList<NonPlayableFighter> getStrongFoes() { return strongFoes; } public ArrayList<Attack> getAttacks() { return attacks; } public ArrayList<Dragon> getDragons() { return dragons; } public GameState getState() { return state; } @Override public void onBattleEvent(BattleEvent e) { // TODO Auto-generated method stub if (e.getType().equals(BattleEventType.STARTED)) { state = GameState.BATTLE; } else if (e.getType().equals(BattleEventType.ENDED)) { state = GameState.WORLD; if (e.getWinner()==player.getActiveFighter()){ world.getMap()[world.getPlayerRow()][world.getPlayerColumn()] = new EmptyCell() ; ArrayList<SuperAttack> sa =((Fighter) ((Battle) e.getSource()).getFoe()).getSuperAttacks(); for (int i = 0; i <sa.size(); i++) { boolean b = true ; int j = 0 ; for ( j = 0; j < player.getSuperAttacks().size() ; j++) { if (sa.get(i).getName().equals(player.getSuperAttacks().get(j).getName()) && sa.get(i).getDamage() == player.getSuperAttacks().get(j).getDamage()){ b = false ; } } if (b) { player.getSuperAttacks().add(sa.get(i)) ; } } ArrayList<UltimateAttack> ua =((Fighter) ((Battle) e.getSource()).getFoe()).getUltimateAttacks(); for (int i = 0; i <ua.size(); i++) { boolean b = true ; int j = 0 ; for ( j = 0; j < player.getUltimateAttacks().size() ; j++) { if (ua.get(i).getName().equals(player.getUltimateAttacks().get(j).getName()) && ua.get(i).getDamage() == player.getUltimateAttacks().get(j).getDamage()){ b = false ; } } if (b) { player.getUltimateAttacks().add(ua.get(i)) ; } } ((PlayableFighter)e.getWinner()).setXp( ((PlayableFighter)e.getWinner()).getXp()+ (((Fighter) e.getCurrentOpponent()).getLevel()* 5)); if (((NonPlayableFighter) ((Battle)e.getSource()).getFoe()).isStrong()) { player.setExploredMaps(player.getExploredMaps() + 1); world = new World(); world.generateMap(weakFoes, strongFoes); } } } else { try { load("save.ser") ; } catch (Exception e1) { // TODO Auto-generated catch block world = new World () ; world.generateMap(weakFoes, strongFoes); world.resetPlayerPosition(); world.setWorldListener(this); } } if (gameListener != null){ gameListener.onBattleEvent(e); } } @Override public void onFoeEncountered(NonPlayableFighter foe) { // TODO Auto-generated method stub Battle b = new Battle(player.getActiveFighter(), foe); b.setListener(this); b.start(); state = GameState.BATTLE; } @Override public void onCollectibleFound(Collectible collectible) { // TODO Auto-generated method stub if (collectible == Collectible.SENZU_BEAN){ player.setSenzuBeans(player.getSenzuBeans() + 1); if (gameListener != null) gameListener.onCollectibleFound(collectible); } else if(collectible ==Collectible.DRAGON_BALL){ player.setDragonBalls(player.getDragonBalls()+ 1); if (gameListener != null) gameListener.onCollectibleFound(collectible); if (player.getDragonBalls() == 7){ player.setDragonBalls(0); player.callDragon(); } } } @Override public void onDragonCalled() { // TODO Auto-generated method stub if (dragons.size() != 0 ){ int random = (int) (Math.random() * dragons.size()); if (gameListener != null) gameListener.onDragonCalled(dragons.get(random)); state = GameState.DRAGON; } } @Override public void onWishChosen(DragonWish wish) { // TODO Auto-generated method stub state = GameState.WORLD; } @Override public void onStageComplete(int Stage) { // TODO Auto-generated method stub if (gameListener!=null) gameListener.onStageComplete(Stage) ; } @Override public void onTournamentChange(TournamentStatus status) { // TODO Auto-generated method stub if (status == TournamentStatus.STARTED){ state = GameState.TOURNAMENT ; } else if (status== TournamentStatus.ENDED){ state = GameState.MAIN ; } if (gameListener!=null){ gameListener.onTournamentEvent(status) ; } } public ArrayList<NonPlayableFighter> getTournamentfoes() { return Tournamentfoes; } public void setTournamentfoes(ArrayList<NonPlayableFighter> tournamentfoes) { Tournamentfoes = tournamentfoes; } public Tournament getTournament() { return tournament; } public void setTournament(Tournament tournament) { this.tournament = tournament; } public static void main(String[] args) { Game g = new Game() ; // //for (int i = 0; i < g.getTournamentfoes().size(); i++) { // if (g.getTournamentfoes().get(i).isStrong()) // System.out.println(g.getTournamentfoes().get(i).getName()); //} } @Override public void onMatchStatusChange(BattleEvent e, TournamentMatch match) { // TODO Auto-generated method stub if (gameListener!=null) { gameListener.onTournamentMatchEvent(e, match.getMatchStatus()); } } }
[ "seifel-din.mostafa@student.guc.edu.eg" ]
seifel-din.mostafa@student.guc.edu.eg
0c0cd261901b23ac1b384aa32dc22115e6d71670
3b77bbc21dc5a1cb0ba0f0260e4e28aed41435c6
/src/main/java/com/hl7/eventdecode/MessageMain.java
4667f68446a4b1a512adee6e32676d2d249b3857
[]
no_license
hl7-decode/HL7-decoding
b6259783a4b0d3b0491554c7028c75963848e13d
919ac577a9f8408eb71942be052e985f92b75b4b
refs/heads/master
2022-07-07T19:41:28.710570
2019-05-31T05:47:57
2019-05-31T05:47:57
169,846,035
0
1
null
2022-06-21T01:10:53
2019-02-09T08:18:07
Java
UTF-8
Java
false
false
2,316
java
package com.hl7.eventdecode; import com.hl7.eventdecode.deal.*; import com.hl7.eventdecode.event.*; import com.hl7.eventdecode.segment.MSH; import java.util.Date; public class MessageMain { private Terser terser; public MessageMain(String message){ try{ // System.out.println(new Date().getTime()); this.terser = new Terser(message); // System.out.println(new Date().getTime()); }catch (Exception e){ e.printStackTrace(); } } public String createADT(){ String type = new MSH(this.terser).getEventType(); if(type.equals("A01")){ return new A01(this.terser).GetMessage(); }else if (type.equals("A03")){ return new A03(this.terser).getMessage(); }else if (type.equals("A06")){ return new A06(this.terser).getMessage(); }else if (type.equals("A07")){ return new A07(this.terser).getMessage(); }else if (type.equals("A08")){ return new A08(this.terser).getMessage(); }else if(type.equals("A23")){ new A23(this.terser).opreation(); }else{ } return "解析错误"; } public static void main(String[] args) { System.out.println(new Date().getTime()); MessageMain m = new MessageMain(new String("MSH|^~\\\\&|HIS|RIH|EKG|EKG|199904140038||ADT^A03||P|2.2\n" + "PID|0001|000098743234||^^^^0|wuqinggang^吴庆港||1998-01-08|男|||山东省威海市哈尔滨工业大学威海||17863136706|17863136709||未婚|||370832111144447777|||汉族||||||中国||||||威海404医院||||||||||||||||||||||||||||||||||||||||||||||||||\n" + "DB1||||双目失明|2019-01-01|2019-01-10\n" + "NK1|||母子||||||||||||女|||||||||||||||diqiu^地球|17865412365|山东省威海市哈尔滨工业大学\n" + "PV1|||F病区^E病房^1病床^皮肤科|R|||李大嘴|吕秀才|白展堂||||||||莫小贝|||||||||||||||||||健康出院||||||||2019-04-07|2019-04-10||||||||\n" + "NTE|||||多休息|佟湘玉|2019-01-08\n" + "AL1||DA|青霉素|SV|休克").replaceAll("\n", "\r")); System.out.println(new Date().getTime()); m.createADT(); System.out.println(new Date().getTime()); } }
[ "2916144319@qq.com" ]
2916144319@qq.com
0b13f347ccb6b194238399a9e87886838754023e
bbb9932d8169e38d025d08387dbba0c35e3d559b
/goods_service/src/main/java/com/wangong/goods_service/mapper/GoodsPictureMapper.java
6b8ab390a176bde0e52634f0a31a61eeaaf675b5
[]
no_license
yangsiyu0016/wear
68fd72d538f1c5010d4bae660dd7b04a059fc703
cc7c0bf16aa2f469ac12b034fb8a5ba8bad8f88b
refs/heads/main
2023-02-01T00:49:22.462941
2020-12-15T08:43:40
2020-12-15T08:43:40
321,245,377
0
0
null
null
null
null
UTF-8
Java
false
false
1,282
java
package com.wangong.goods_service.mapper; import com.wangong.common.domain.goods.GoodsPicture; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** * 商品图片持久层 */ @Mapper public interface GoodsPictureMapper { /** * 根据商品id获取图片集合 * @param goodsId * @return */ List<GoodsPicture> getGoodsPicByGoodsId(@Param("goodsId") String goodsId); /** * 根据id获取商品图片 * @param id * @return */ GoodsPicture getGoodsPicById(@Param("id") String id); /** * 添加商品图片 * @param goodsPicture */ void addGoodsPic(@Param("goodsPicture") GoodsPicture goodsPicture); /** * 更新商品图片 * @param goodsPicture */ void editGoodsPic(@Param("goodsPicture") GoodsPicture goodsPicture); /** * 根据id删除商品图片 * @param id */ void deleteGoodsPic(@Param("id") String id); /** * 根据商品id删除商品图片 * @param goodsId */ void deleteGoodsPicByGoodsId(@Param("goodsId") String goodsId); /** * 根据图片路径删除 * @param picUrl */ void deleteByPicUrl(@Param("picUrl") String picUrl); }
[ "47880703+yangsiyu0016@users.noreply.github.com" ]
47880703+yangsiyu0016@users.noreply.github.com
608e323a91622c8464844f3f155132becfb479f6
adfed9eb3263479f81f48e2d2953c42ac5ee06d8
/src/com/company/Order.java
869ae7b545f59b832da8a4965470d338fa3ba1be
[]
no_license
Baloo31/MAPSeminar2
2c1113fb6d1d7a81e8511468a1da24a2259635d4
a3a288b0c842fe620d39db4012ad1f5123e428d2
refs/heads/master
2023-08-16T10:13:30.114000
2021-10-06T16:12:53
2021-10-06T16:12:53
414,264,151
0
0
null
null
null
null
UTF-8
Java
false
false
602
java
package com.company; import java.util.List; import java.util.Date; public class Order { private Date orderDate; private List<OrderLine> orderLines; public Order(Date orderDate, List<OrderLine> orderLines) { this.orderDate = orderDate; this.orderLines = orderLines; } public double calculateTotalPrice(){ double sum = 0; for (OrderLine x: orderLines){ sum += x.calculatePrice(); } return sum; } public void addOrderLine(OrderLine newOrderLine){ orderLines.add(newOrderLine); } }
[ "78239922+Baloo31@users.noreply.github.com" ]
78239922+Baloo31@users.noreply.github.com
7e75e74ef3e7b797603c3354ebab142125bcb8c0
bfc6d6d79fa0c76326bb5d2446b34f6ca4aadb25
/post_insurance/src/java/com/gdpost/web/entity/insurance/PayList.java
4d2405c989933060f2a4e4487832d8de71c5791d
[]
no_license
missaouib/POST_INSURANCE
0d8671ece83f6d5ed721df8e3333147348194805
f12c6c21c126b0e568da0b5d5a128ae95c655524
refs/heads/master
2023-03-19T03:01:54.960909
2021-02-26T10:58:39
2021-02-26T10:58:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,684
java
package com.gdpost.web.entity.insurance; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.hibernate.annotations.ColumnTransformer; import com.gdpost.web.entity.Idable; import com.gdpost.web.entity.main.Organization; /** * AbstractTPayFailList entity provides the base persistence definition of the * TPayFailList entity. @author MyEclipse Persistence Tools */ @Entity @Table(name = "t_pay_list") public class PayList implements Idable<Long>, Serializable { /** * */ private static final long serialVersionUID = 2283160516619772095L; public static final Integer PAY_TO = 1; public static final Integer PAY_FROM = 2; // Fields private Long id; private String accountName; private String account; private String money; private String failDesc; private Date backDate; private String feeType; private String relNo; private Organization organization; private Integer payType; private String status; private Long operateId; private Date operateTime; private Boolean successFlag; // Constructors @Column(name="success_flag") public Boolean getSuccessFlag() { return successFlag; } public void setSuccessFlag(Boolean successFlag) { this.successFlag = successFlag; } /** default constructor */ public PayList() { } /** full constructor */ public PayList(String accountName, String account, String money, String failDesc, Date backDate, String feeType, String relNo, Integer payType, Long operateId, Date operateTime) { this.accountName = accountName; this.account = account; this.money = money; this.failDesc = failDesc; this.backDate = backDate; this.feeType = feeType; this.relNo = relNo; this.payType = payType; this.operateId = operateId; this.operateTime = operateTime; } // Property accessors @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", unique = true, nullable = false) public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } @Column(name = "account_name", length = 32) public String getAccountName() { return this.accountName; } public void setAccountName(String accountName) { this.accountName = accountName; } @Column(name = "account", length = 256) @ColumnTransformer( forColumn="account", read="cast(aes_decrypt(unhex(account), '" + com.gdpost.web.MySQLAESKey.AESKey + "') as char(100))", write="hex(aes_encrypt(?,'" + com.gdpost.web.MySQLAESKey.AESKey + "'))") public String getAccount() { return this.account; } public void setAccount(String account) { this.account = account; } @Column(name = "money", precision = 22, scale = 0) public String getMoney() { return this.money; } public void setMoney(String money) { this.money = money; } @Column(name = "fail_desc", length = 32) public String getFailDesc() { return this.failDesc; } public void setFailDesc(String failDesc) { this.failDesc = failDesc; } @Column(name = "back_date", length = 10) public Date getBackDate() { return this.backDate; } public void setBackDate(Date backDate) { this.backDate = backDate; } @Column(name = "fee_type", length = 16) public String getFeeType() { return this.feeType; } public void setFeeType(String feeType) { this.feeType = feeType; } @Column(name = "rel_no", length = 32) public String getRelNo() { return this.relNo; } public void setRelNo(String relNo) { this.relNo = relNo; } @ManyToOne(optional=true) @JoinColumn(name="org_name", referencedColumnName="name", nullable=true, insertable=false, updatable=false ) public Organization getOrganization() { return organization; } public void setOrganization(Organization organization) { this.organization = organization; } @Column(name = "pay_type") public Integer getPayType() { return this.payType; } public void setPayType(Integer payType) { this.payType = payType; } @Column(name = "status") public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } @Column(name = "operate_id") public Long getOperateId() { return this.operateId; } public void setOperateId(Long operateId) { this.operateId = operateId; } @Column(name = "operate_time", length = 19) public Date getOperateTime() { return this.operateTime; } public void setOperateTime(Date operateTime) { this.operateTime = operateTime; } }
[ "beming@21cn.com" ]
beming@21cn.com
163d02699139d6aa66b602266d08eda48ac783f0
db0499f9b9bd603c7e0e8c12e6ccb9d2a5bcb117
/src/main/java/teamroots/embers/block/BlockMechEdge.java
9c6629bca05829a830c52755b2ec4f16647ccbda
[ "MIT" ]
permissive
Yulife/Embers
c6ab448477a1abb6a0898f36848abb341e4d8dc3
ed34150617578b8499327260a12a0e9dca05ccdc
refs/heads/master
2021-01-12T17:43:18.032948
2016-10-22T08:16:31
2016-10-22T08:16:31
71,630,242
0
1
null
2016-10-22T09:43:18
2016-10-22T09:43:18
null
UTF-8
Java
false
false
5,803
java
package teamroots.embers.block; import java.util.List; import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import teamroots.embers.RegistryManager; import teamroots.embers.tileentity.ITileEntityBase; import teamroots.embers.tileentity.TileEntityEmitter; import teamroots.embers.tileentity.TileEntityPipe; import teamroots.embers.tileentity.TileEntityTank; public class BlockMechEdge extends BlockBase { public static final PropertyInteger state = PropertyInteger.create("state", 0, 8); public BlockMechEdge(Material material, String name, boolean addToTab) { super(material, name, addToTab); } @Override public BlockStateContainer createBlockState(){ return new BlockStateContainer(this, state); } @Override public int getMetaFromState(IBlockState state){ return state.getValue(this.state); } @Override public IBlockState getStateFromMeta(int meta){ return getDefaultState().withProperty(state,meta); } public void breakBlockSafe(World world, BlockPos pos, EntityPlayer player){ if (world.getTileEntity(pos) instanceof ITileEntityBase){ ((ITileEntityBase)world.getTileEntity(pos)).breakBlock(world, pos, world.getBlockState(pos), player); if (!world.isRemote && !player.capabilities.isCreativeMode){ world.spawnEntityInWorld(new EntityItem(world,pos.getX()+0.5,pos.getY()+0.5,pos.getZ()+0.5,new ItemStack(world.getBlockState(pos).getBlock()))); } } world.setBlockToAir(pos); } @Override public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player){ if (state.getValue(this.state) == 0){ breakBlockSafe(world,pos.south(),player); breakBlockSafe(world,pos.south(2),player); breakBlockSafe(world,pos.east(),player); breakBlockSafe(world,pos.west(),player); breakBlockSafe(world,pos.east().south(),player); breakBlockSafe(world,pos.west().south(),player); breakBlockSafe(world,pos.east().south(2),player); breakBlockSafe(world,pos.west().south(2),player); } if (state.getValue(this.state) == 1){ breakBlockSafe(world,pos.east(),player); breakBlockSafe(world,pos.east(2),player); breakBlockSafe(world,pos.south(),player); breakBlockSafe(world,pos.south(2),player); breakBlockSafe(world,pos.east().south(),player); breakBlockSafe(world,pos.east(2).south(),player); breakBlockSafe(world,pos.east().south(2),player); breakBlockSafe(world,pos.east(2).south(2),player); } if (state.getValue(this.state) == 2){ breakBlockSafe(world,pos.east(),player); breakBlockSafe(world,pos.east(2),player); breakBlockSafe(world,pos.north(),player); breakBlockSafe(world,pos.south(),player); breakBlockSafe(world,pos.north().east(),player); breakBlockSafe(world,pos.south().east(),player); breakBlockSafe(world,pos.north().east(2),player); breakBlockSafe(world,pos.south().east(2),player); } if (state.getValue(this.state) == 3){ breakBlockSafe(world,pos.east(),player); breakBlockSafe(world,pos.east(2),player); breakBlockSafe(world,pos.north(),player); breakBlockSafe(world,pos.north(2),player); breakBlockSafe(world,pos.east().north(),player); breakBlockSafe(world,pos.east(2).north(),player); breakBlockSafe(world,pos.east().north(2),player); breakBlockSafe(world,pos.east(2).north(2),player); } if (state.getValue(this.state) == 4){ breakBlockSafe(world,pos.north(),player); breakBlockSafe(world,pos.north(2),player); breakBlockSafe(world,pos.east(),player); breakBlockSafe(world,pos.west(),player); breakBlockSafe(world,pos.east().north(),player); breakBlockSafe(world,pos.west().north(),player); breakBlockSafe(world,pos.east().north(2),player); breakBlockSafe(world,pos.west().north(2),player); } if (state.getValue(this.state) == 5){ breakBlockSafe(world,pos.west(),player); breakBlockSafe(world,pos.west(2),player); breakBlockSafe(world,pos.north(),player); breakBlockSafe(world,pos.north(2),player); breakBlockSafe(world,pos.west().north(),player); breakBlockSafe(world,pos.west(2).north(),player); breakBlockSafe(world,pos.west().north(2),player); breakBlockSafe(world,pos.west(2).north(2),player); } if (state.getValue(this.state) == 6){ breakBlockSafe(world,pos.west(),player); breakBlockSafe(world,pos.west(2),player); breakBlockSafe(world,pos.north(),player); breakBlockSafe(world,pos.south(),player); breakBlockSafe(world,pos.north().west(),player); breakBlockSafe(world,pos.south().west(),player); breakBlockSafe(world,pos.north().west(2),player); breakBlockSafe(world,pos.south().west(2),player); } if (state.getValue(this.state) == 7){ breakBlockSafe(world,pos.west(),player); breakBlockSafe(world,pos.west(2),player); breakBlockSafe(world,pos.south(),player); breakBlockSafe(world,pos.south(2),player); breakBlockSafe(world,pos.west().south(),player); breakBlockSafe(world,pos.west(2).south(),player); breakBlockSafe(world,pos.west().south(2),player); breakBlockSafe(world,pos.west(2).south(2),player); } } }
[ "elucentgames@gmail.com" ]
elucentgames@gmail.com
420746bf1f77c718f0431d38bcffeab19f5522ae
5d8ef0459a9187608332b3cb98c655f434ca7a58
/src/test/com/app/TicketServiceImpTest.java
45ee550a609c4a2eccf935eb17ed493100971cba
[ "MIT" ]
permissive
yangx01123/TicketService
82d194c2f122502e5c2f847ccede59d67b04d750
44afc3de361d96b9440a8aee438c120791f21e59
refs/heads/master
2021-05-10T16:16:23.987545
2018-01-26T06:25:43
2018-01-26T06:25:43
118,571,115
0
0
MIT
2018-01-26T06:25:44
2018-01-23T07:00:01
Java
UTF-8
Java
false
false
5,065
java
package com.app; import com.util.Log; import org.junit.Test; import com.util.UniqId; import static com.util.Config.holdingAge; import static com.util.Config.totalNumSeats; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotSame; /** * Test class for TicketServiceImp. */ public class TicketServiceImpTest { private TicketServiceImp tsi = new TicketServiceImp(); @Test public void numSeatsAvailable() throws Exception { assertEquals(totalNumSeats, tsi.numSeatsAvailable()); } @Test public void findAndHoldSeats() throws Exception { holdMatch(totalNumSeats); sleep(holdingAge + 1); holdMatch(0); sleep(holdingAge + 1); holdMatch(totalNumSeats + 1); } @Test public void reserveSeats() throws Exception { sleep(holdingAge + 1); reserveMatch(totalNumSeats); sleep(holdingAge + 1); } @Test public void singleThread() { int numSeats = 10; SeatHold sh = tsi.findAndHoldSeats(numSeats, getTestEmail()); Log.logHold(sh, tsi); int firstId = sh.get_id(); sleep(holdingAge + 1); assertEquals("Test expired holdings (vacant pool)", totalNumSeats, tsi.get_vacant().size()); assertEquals("Test expired holdings (holded pool)", 0, tsi.get_holded().size()); assertEquals("Test expired holdings (reserved pool)", 0, tsi.get_reserved().size()); sh = tsi.findAndHoldSeats(numSeats, getTestEmail()); Log.logHold(sh, tsi); int secondId = sh.get_id(); assertEquals("Test non-expired holdings (vacant pool)", totalNumSeats - numSeats, tsi.get_vacant().size()); assertEquals("Test non-expired holdings (holded pool)", numSeats, tsi.get_holded().size()); assertEquals("Test non-expired holdings (reserved pool)", 0, tsi.get_reserved().size()); assertNotSame(String.format("SeatHold ID: %s should be different from SeatHold ID: %s", firstId, secondId), firstId, secondId); String confirmCode = tsi.reserveSeats(secondId, getTestEmail()); Log.logReserve(sh, confirmCode, tsi); assertEquals("Test reserved holdings (vacant pool)", totalNumSeats - numSeats, tsi.get_vacant().size()); assertEquals("Test reserved holdings (holded pool)", 0, tsi.get_holded().size()); assertEquals("Test reserved holdings (reserved pool)", numSeats, tsi.get_reserved().size()); } @Test public void multiThread_holdCompeting() { int numSeats = totalNumSeats / 3 + 5; Runnable r1 = createHoldThread(numSeats); Runnable r2 = createHoldThread(numSeats); Runnable r3 = createHoldThread(numSeats); r1.run(); r2.run(); r3.run(); assertEquals("Test holding competing", totalNumSeats, tsi.get_vacant().size() + tsi.get_holded().size() + tsi.get_reserved().size()); } @Test public void multiThread_reserveCompeting() { int numSeats = totalNumSeats / 3 + 5; Runnable r1 = createReserveThread(numSeats); Runnable r2 = createReserveThread(numSeats); Runnable r3 = createReserveThread(numSeats); r1.run(); r2.run(); r3.run(); assertEquals("Test reserve competing", totalNumSeats, tsi.get_vacant().size() + tsi.get_holded(). size() + tsi.get_reserved().size()); } private Runnable createHoldThread(int numSeats) { return () -> { SeatHold sh = tsi.findAndHoldSeats(numSeats, getTestEmail()); Log.logHold(sh, tsi); }; } private Runnable createReserveThread(int numSeats) { return () -> { SeatHold sh = tsi.findAndHoldSeats(numSeats, getTestEmail()); String confirmCode = tsi.reserveSeats(sh.get_id(), getTestEmail()); Log.logReserve(sh, confirmCode, tsi); }; } private String getTestEmail() { return "test@" + UniqId.uniqueCurrentTimeMS(); } private void holdMatch(int numHoldSeats) { int expected = numHoldSeats; if (numHoldSeats > totalNumSeats) expected = totalNumSeats; SeatHold sh = tsi.findAndHoldSeats(numHoldSeats, getTestEmail()); Log.logHold(sh, tsi); assertEquals(expected, sh.get_seats().size()); } private void reserveMatch(int numReserveSeats) { int expected = numReserveSeats; if (numReserveSeats > totalNumSeats) expected = totalNumSeats; SeatHold sh = tsi.findAndHoldSeats(numReserveSeats, getTestEmail()); String confirmCode = tsi.reserveSeats(sh.get_id(), getTestEmail()); Log.logReserve(sh, confirmCode, tsi); assertEquals(expected, tsi.get_reserved().size()); } private void sleep(int sec) { synchronized (Thread.currentThread()) { try { Thread.sleep(sec * 1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } }
[ "noreply@github.com" ]
noreply@github.com
07c460b31e81d85c77db9051d30bfdf6cb69aa1e
a49d8576e1d69e545d8d388bd1b80af701f3fa32
/dp-admin/src/main/java/com/iuni/dp/admin/datastat/action/MallYqfOrderDailyStatAction.java
ad2f805d2d1dac4a39ba0195172d11cb3fe8767f
[]
no_license
hedgehog-zowie/dp-parent
8ead398fb5da0e4a691141f39828758792900634
f2bbdfd197f0331effea241903c1b39c79fd7f14
refs/heads/master
2020-03-27T23:08:00.141799
2015-12-04T10:04:39
2015-12-04T10:04:39
37,246,741
3
1
null
null
null
null
UTF-8
Java
false
false
5,862
java
package com.iuni.dp.admin.datastat.action; import java.io.UnsupportedEncodingException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.iuni.dp.admin.common.action.BaseAction; import com.iuni.dp.admin.datastat.utils.ExcelUtils; import com.iuni.dp.persist.datastat.model.MallYqfOrderDailyStat; import com.iuni.dp.service.common.bean.Page; import com.iuni.dp.service.common.exception.ServiceException; import com.iuni.dp.service.datastat.service.MallYqfOrderDailyStatService; /** * 金立商城CPS销售数据统计 * @author ZuoChangjun 2013-9-6 * @version dp-admin-1.0.0 */ @Controller("mallYqfOrderDailyStatAction") @Scope("prototype") public class MallYqfOrderDailyStatAction extends BaseAction { private static final long serialVersionUID = -9059865076156626736L; private static final Logger logger = LoggerFactory.getLogger(MallYqfOrderDailyStatAction.class); private String beginDate;// 注册开始日期 private String endDate;// 注册结束日期 private Long cid;// 广告活动ID private String source;// 数据来源:公司名 private String channel;// 推广渠道:合作方式 /** * CPS推广销售数据列表 */ private List<MallYqfOrderDailyStat> mallYqfOrderDailyStatList; /** * CPS推广销售数据总计 */ private MallYqfOrderDailyStat mallYqfOrderSum; @Autowired private MallYqfOrderDailyStatService mallYqfOrderDailyStatService; /** * 分页查询CPS推广订单数据 * * @return */ public String queryMallYqfOrderDailyStats() { Map<String, Object> paramsMap = new HashMap<String, Object>(); paramsMap.put("beginDate", StringUtils.defaultIfEmpty(beginDate, null)); paramsMap.put("endDate", StringUtils.defaultIfEmpty(endDate, null)); paramsMap.put("cid", cid); paramsMap.put("source", StringUtils.defaultIfEmpty(source, null)); paramsMap.put("channel", StringUtils.defaultIfEmpty(channel, null)); try { // 查询总记录 Integer totalRecord = mallYqfOrderDailyStatService.queryMallYqfOrderDailyStatsCount(paramsMap); if (totalRecord == null || totalRecord.intValue() == 0) { return SUCCESS; } // 根据当前页、总记录数、页大小获得Page page = Page.genPage(page.getCurrentPage(), totalRecord, page.getPageSize()); // 设置分页起始值 paramsMap.put("startRec", page.getStartRec()); paramsMap.put("endRec", page.getEndRec()); // 查询列表 mallYqfOrderDailyStatList = mallYqfOrderDailyStatService.queryMallYqfOrderDailyStats(paramsMap); // 查询总计 mallYqfOrderSum=mallYqfOrderDailyStatService.queryMallYqfOrderDailyStatsSum(paramsMap); } catch (ServiceException se) { logger.error("queryMallYqfOrderDailyStats error:" + se.getMessage()); return ERROR; } catch (Exception e) { logger.error("queryMallYqfOrderDailyStats error:" + e.getMessage()); return ERROR; } return SUCCESS; } /** * 导出excel金立商城CPS推广销售数据 * * @return */ public void mallYqfOrderDailyStats2Excel() { Map<String, Object> paramsMap = new HashMap<String, Object>(); // 设置分页起始值 paramsMap.put("startRec", 1); paramsMap.put("endRec", Integer.MAX_VALUE); paramsMap.put("beginDate", StringUtils.defaultIfEmpty(beginDate, null)); paramsMap.put("endDate", StringUtils.defaultIfEmpty(endDate, null)); paramsMap.put("cid", cid); paramsMap.put("source", StringUtils.defaultIfEmpty(source, null)); paramsMap.put("channel", StringUtils.defaultIfEmpty(channel, null)); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String fileName = "金立商城CPS推广_" + sdf.format(new Date()); try { fileName = new String(fileName.getBytes(), "ISO8859-1"); } catch (UnsupportedEncodingException e) { logger.error("mallYqfOrderDailyStats2Excel UnsupportedEncodingException:" + e.getMessage()); } int columnNum = 8; ExcelUtils exportExcelUtils = new ExcelUtils(response,fileName, columnNum); try { // 查询列表 mallYqfOrderDailyStatList = mallYqfOrderDailyStatService.queryMallYqfOrderDailyStats(paramsMap); // 查询总计 mallYqfOrderSum = mallYqfOrderDailyStatService.queryMallYqfOrderDailyStatsSum(paramsMap); mallYqfOrderSum.setBizDate("总计"); mallYqfOrderDailyStatList.add(mallYqfOrderSum); exportExcelUtils.mallYqfOrderDailyStats2Excel(mallYqfOrderDailyStatList); } catch (Exception e) { logger.error("mallYqfOrderDailyStats2Excel error:" + e.getMessage()); } } public String getBeginDate() { return beginDate; } public void setBeginDate(String beginDate) { this.beginDate = beginDate; } public String getEndDate() { return endDate; } public void setEndDate(String endDate) { this.endDate = endDate; } public List<MallYqfOrderDailyStat> getMallYqfOrderDailyStatList() { return mallYqfOrderDailyStatList; } public void setMallYqfOrderDailyStatList( List<MallYqfOrderDailyStat> mallYqfOrderDailyStatList) { this.mallYqfOrderDailyStatList = mallYqfOrderDailyStatList; } public MallYqfOrderDailyStat getMallYqfOrderSum() { return mallYqfOrderSum; } public void setMallYqfOrderSum(MallYqfOrderDailyStat mallYqfOrderSum) { this.mallYqfOrderSum = mallYqfOrderSum; } public Long getCid() { return cid; } public void setCid(Long cid) { this.cid = cid; } public String getSource() { return source; } public void setSource(String source) { this.source = source; } public String getChannel() { return channel; } public void setChannel(String channel) { this.channel = channel; } }
[ "hedgehog.zowie@gmail.com" ]
hedgehog.zowie@gmail.com
29058fd2e8092e8cbce8669a2f2b80aa24869dca
19c004fe5ef9610afd40d60c7fc4b0967747612b
/app/src/main/java/com/jike/jikexutils/domain/Child.java
68c1a3948507de1d180009ff0fcb8435533595b5
[]
no_license
Crown1991/jikeXutils
480ddeed0b3f9e29313cc4ae70972da6bf0fb88a
8a7e3b2cd570e737323d880acd20088823cae3db
refs/heads/master
2021-01-17T06:35:55.849957
2016-07-08T09:32:15
2016-07-08T09:32:15
62,793,775
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.jike.jikexutils.domain; /** * Created by Administrator on 2016/7/8. */ public class Child { private String name; public Child(String name) { this.name = name; } public void setName(String name) { this.name = name; } public String getName() { return name; } }
[ "867755898@qq.com" ]
867755898@qq.com