blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
fa292b2b6fb8738b30c8a6fcbe96929b972f9e49
461acdfede26ba5e0c53e47c54f36155c3b34cee
/Java_22_FileSampleData/src/com/biz/files/service/NameService.java
211e51315fdf39c000c2a129edad58ef0b02665b
[]
no_license
qussoa/20191002
dc5e13a0a7e35079aeb4a028c919cd8c310b5caf
2843d602c09a49ff0980af79743fdf49b1295def
refs/heads/master
2020-08-04T21:17:58.279045
2019-11-04T07:42:55
2019-11-04T07:42:55
212,282,154
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
package com.biz.files.service; public interface NameService { public void readNameList(String nameFile) throws Exception; public void readFamList(String famFile) throws Exception; public void writeNameFile(String korNameFile) throws Exception; }
c48d3d2ecdc0f8a17e0b9ca000807854dde6bff1
e43b47beb5e1d79637ccc2b6ae92977b659ec338
/app/src/main/java/com/imyyq/rvshowtime/ExampleFragment.java
647738a8827814f9a7c5e45319e91ee73d131a9d
[]
no_license
imyyq-star/RvShowTimeLib
fbff12716938f35343e9b8445266eef215cad645
22b03bcac800ae449ffca69a6b4ad864059291b4
refs/heads/master
2022-08-01T22:12:59.753016
2020-05-20T09:00:35
2020-05-20T09:00:35
265,505,749
2
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package com.imyyq.rvshowtime; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.imyyq.rvshowtime.databinding.FragmentExampleBinding; import com.imyyq.showtime.RvShowTimeInterface; public class ExampleFragment extends Fragment implements RvShowTimeInterface { private FragmentExampleBinding binding; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { binding = FragmentExampleBinding.inflate(inflater); return binding.getRoot(); } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Log.i("ExampleFragment", "commonLog - onActivityCreated: "+getFragmentManager()); RvUtil.initRv(getFragmentManager(), this, binding.rv); } }
50e7cd99f4f8f71b94b73dc626ac814c1db899fd
584ccf5c7bbf0185c3cede2d30ec309d40af4a14
/java/exercicios/src/Out7/MaiorInteiro.java
69f239f98c1c176d6ff29184089e7cfbfa14bacb
[]
no_license
WashingtonPSantos/turma11java
53fe4433b503a4626b24906d7f491d19de244098
8f2845a828955c855a51db7ab79937b7eb1b365b
refs/heads/master
2023-01-09T02:55:12.179821
2020-11-08T23:15:31
2020-11-08T23:15:31
298,044,432
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
1,001
java
package Out7; import java.util.Scanner; public class MaiorInteiro { public static void main(String[] args) { // 1- Faça um programa que receba três inteiros e diga qual deles é o maior. Scanner leia = new Scanner(System.in); int a,b,c; System.out.print("Digite o valor de a: "); a = leia.nextInt(); System.out.print("Digite o valor de b: "); b = leia.nextInt(); System.out.print("Digite o valor de c: "); c= leia.nextInt(); //System.out.println("O valor de a é: "+a+". O valor de b é: "+b+". O valor de c é:"+c); if (a>=b){ //System.out.println("a é maior que b"); if (a>=c) { System.out.println(" a é o maior"); } } if (b>=a){ //System.out.println("a é maior que b"); if (b>=c) { System.out.println(" b é o maior"); } } if (c>=a){ //System.out.println("a é maior que b"); if (c>=b) { System.out.println(" c é o maior"); } } else { System.out.println(" A,b e C são iguais"); } } }
4c46f34019c1a4a38744e00a85ecfd1115c022a0
7fe906aa8eebb9fb61a7bdc9ca1edf9989d28dc5
/egg-facade/src/main/java/com/egg/manager/persistence/em/user/db/mysql/mapper/EmUserRoleMapper.java
09eebb53773a562baf5dcf009cec62fa5f854002
[ "Apache-2.0" ]
permissive
lanlandetiankong/egg_manager
aad0f304233665ed87cb47c2c86945000d0b4997
868b3d74f1a94d303ef39ea1bd8171ab405c96b9
refs/heads/master
2022-09-11T05:06:40.576855
2021-02-03T13:48:48
2021-02-03T13:48:48
208,092,096
0
1
Apache-2.0
2022-09-01T23:13:00
2019-09-12T16:10:14
Java
UTF-8
Java
false
false
2,034
java
package com.egg.manager.persistence.em.user.db.mysql.mapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.egg.manager.persistence.commons.base.constant.db.mysql.EggMpSqlConst; import com.egg.manager.persistence.commons.base.query.pagination.antdv.AntdvSortMap; import com.egg.manager.persistence.commons.base.query.pagination.antdv.QueryFieldArr; import com.egg.manager.persistence.em.user.db.mysql.entity.EmUserAccountEntity; import com.egg.manager.persistence.em.user.db.mysql.entity.EmUserRoleEntity; import com.egg.manager.persistence.em.user.pojo.dto.EmUserRoleDto; import com.egg.manager.persistence.exchange.db.mysql.mapper.MyEggMapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @author zhoucj * @description * @date 2020/10/20 */ public interface EmUserRoleMapper extends MyEggMapper<EmUserRoleEntity> { /** * [分页搜索查询] - 用户角色 * @param page * @param queryFieldArr * @param sortMap * @return */ List<EmUserRoleDto> selectQueryPage(Page<EmUserRoleDto> page, @Param(EggMpSqlConst.PARAMOF_QUERY_FIELD_LIST) QueryFieldArr queryFieldArr, @Param(EggMpSqlConst.PARAMOF_SORT_MAP) AntdvSortMap sortMap); /** * 取得用户拥有的所有角色id集合 * @param userAccountId * @param filterEnable 是否只查询状态为可用的 * @return */ List<String> findAllRoleIdByUserAccountId(@Param(EggMpSqlConst.PARAMOF_USER_ACCOUNT_ID) String userAccountId, @Param("filterEnable") boolean filterEnable); /** * 根据用户id 修改指定角色关联 的可用状态 * @param userAccountId * @param roleIdList * @param stateVal * @param loginUser * @return */ int batchUpdateStateByUserAccountId(@Param(EggMpSqlConst.PARAMOF_USER_ACCOUNT_ID) String userAccountId, @Param("roleIdList") List<String> roleIdList, @Param("stateVal") Short stateVal , @Param(EggMpSqlConst.PARAMOF_LOGIN_USER) EmUserAccountEntity loginUser); }
c5915e9025d2e7b7c9cffa1ebb2b2d40514477ca
929557608e958cf7628b9e0bad8ac937c1ba7cd8
/src/main/java/hudson/plugins/analysis/core/AntBuilderCheck.java
92ba5ccf1b8d264283df4c90c024f5247ad6699a
[ "MIT" ]
permissive
loelala/analysis-core-plugin
2d56d3ac2bfc65f6d93bbfe259ac4e78ea741557
13edc435dae4ac8a8ee274011fc7216a1e51c88c
refs/heads/master
2021-04-15T19:00:54.583925
2018-03-12T09:55:29
2018-03-12T09:55:29
126,339,983
0
0
MIT
2018-04-23T09:43:59
2018-03-22T13:32:40
Java
UTF-8
Java
false
false
1,071
java
package hudson.plugins.analysis.core; import hudson.model.AbstractBuild; import hudson.model.Project; import hudson.tasks.Builder; import hudson.tasks.Ant; /** * Verifies if the build is an {@link Ant} task. * * @author Ulli Hafner */ public final class AntBuilderCheck { /** * Returns whether the current build uses ant. * * @param build * the current build * @return <code>true</code> if the current build uses ant, * <code>false</code> otherwise */ public static boolean isAntBuild(final AbstractBuild<?, ?> build) { if (build.getProject() instanceof Project) { Project<?, ?> project = (Project<?, ?>)build.getProject(); for (Builder builder : project.getBuilders()) { if (builder instanceof Ant) { return true; } } } return false; } /** * Creates a new instance of {@link AntBuilderCheck}. */ private AntBuilderCheck() { // prevent instantiation } }
b4e0bda611d2f9e5054de590f39e8dd802067dc4
36ec7e118a084c076ed911d69025766ace468ae5
/kodilla-hibernate/src/main/java/com/kodilla/hibernate/invoice/dao/ProductDao.java
b960e7bc4aa3717ea2630b34084f68d5562137ea
[]
no_license
andrzejsplewinski/Kodilla-Course
8a23815461d38c0d901fa165e9a5155be40ec7c2
08bb5c471948b2940f6e1a5d9185e578d6b0b294
refs/heads/master
2023-03-29T04:42:44.691089
2020-01-11T14:54:39
2020-01-11T14:54:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.kodilla.hibernate.invoice.dao; import com.kodilla.hibernate.invoice.Product; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import javax.transaction.Transactional; @Transactional @Repository public interface ProductDao extends CrudRepository<Product, Integer> { }
0febef08e3200fcc3e7c33bda0faeb12bbbd1395
eff9d1e6ce4032c7a2618cf8b40922401f3d1ce0
/ls-java-core/src/main/java/com/ls/lishuai/aqs/MutextDemo.java
e0cb8ff8e881324d4534dbab22397eaf32957046
[]
no_license
lishuai2016/all
67d8ff5db911ca5c38b249172d3dcbf4234d49d7
aa7d6774611c21e126e628268a6abd020138974f
refs/heads/master
2022-12-09T11:03:08.571479
2019-08-18T16:38:41
2019-08-18T16:38:44
200,311,974
5
4
null
2022-11-16T07:57:51
2019-08-03T00:08:21
Java
UTF-8
Java
false
false
621
java
package com.ls.lishuai.aqs; /** * @Author: lishuai * @CreateDate: 2018/8/3 17:18 */ public class MutextDemo { private static Mutex mutex = new Mutex(); public static void main(String[] args) { for (int i = 0; i < 10; i++) { Thread thread = new Thread(() -> { mutex.lock(); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } finally { mutex.unlock(); } }); thread.start(); } } }
2e5196d50bf4730a7d6be1ebbd5bb305ec657ebd
0706c4e0c89edd499ad0a885958421252d3fc2cc
/EmployeeImportance.java
7c465047419d8b29288b8857bf4ff57737bc422f
[]
no_license
leonngai/LeetCode-Questions
42d70f4b77914758cb620db3e6f872ae17560ab8
1ec409094601a6f74a2718e72d851c8a30e9ce18
refs/heads/master
2021-06-23T03:50:07.249584
2021-01-20T05:29:29
2021-01-20T05:29:29
176,599,413
0
0
null
null
null
null
UTF-8
Java
false
false
1,486
java
/* // Employee info class Employee { // It's the unique id of each node; // unique id of this employee public int id; // the importance value of this employee public int importance; // the id of direct subordinates public List<Integer> subordinates; }; */ class Solution { /* Things we need to do: 1. Traverse through the list of employees and add each employee into a hashmap with the id as key and reference of employee as value 2. While traversing the list if the employee id matches the id that we are looking for, add to the Queue 3. Perform a breadth first search of the matched employee, adding each employees subordinates into the Queue until it return empty Time Complexity: O(N) Space Complexity: O(N) */ public int getImportance(List<Employee> employees, int id) { int ans = 0; HashMap<Integer, Employee> hash = new HashMap<>(); Queue<Employee> q = new LinkedList<>(); for (Employee employee : employees) { hash.put(employee.id, employee); if (id == employee.id) q.add(employee); } while(!q.isEmpty()) { Employee temp = q.poll(); ans += temp.importance; for (int subordinateID : temp.subordinates) q.add(hash.get(subordinateID)); } return ans; } }
7ccc3319e8c37f888dba1269b02b86f8bc4e6464
15c5eadf6c6a4d3fa5bf5eb66f22e1cabd49df2c
/WeChatApp/WeChatApp/src/main/java/com/jisu/WeChatApp/pojo/MemberProhi.java
282ad74fab2223fb89d5dfd2b07546b0135625e4
[]
no_license
RunzhiH/WeChatApp
8eb168f94526fa87d6563e5a55e4a297234476b2
40f40bcfb588305a8923ce86085499c78a2835c7
refs/heads/master
2021-07-02T16:02:35.120383
2020-10-19T07:16:20
2020-10-19T07:16:20
186,799,624
0
0
null
2020-10-19T07:16:22
2019-05-15T09:59:34
JavaScript
UTF-8
Java
false
false
5,579
java
package com.jisu.WeChatApp.pojo; import java.util.Date; public class MemberProhi { /** * This field was generated by MyBatis Generator. This field corresponds to the database column member_prohi.member_prohi_id * @mbg.generated */ private String memberProhiId; /** * This field was generated by MyBatis Generator. This field corresponds to the database column member_prohi.prohi_status * @mbg.generated */ private Integer prohiStatus; /** * This field was generated by MyBatis Generator. This field corresponds to the database column member_prohi.prohi_type * @mbg.generated */ private Integer prohiType; /** * This field was generated by MyBatis Generator. This field corresponds to the database column member_prohi.member_no * @mbg.generated */ private String memberNo; /** * This field was generated by MyBatis Generator. This field corresponds to the database column member_prohi.member_type * @mbg.generated */ private Integer memberType; /** * This field was generated by MyBatis Generator. This field corresponds to the database column member_prohi.prohi_time * @mbg.generated */ private Integer prohiTime; /** * This field was generated by MyBatis Generator. This field corresponds to the database column member_prohi.create_time * @mbg.generated */ private Date createTime; /** * This method was generated by MyBatis Generator. This method returns the value of the database column member_prohi.member_prohi_id * @return the value of member_prohi.member_prohi_id * @mbg.generated */ public String getMemberProhiId() { return memberProhiId; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column member_prohi.member_prohi_id * @param memberProhiId the value for member_prohi.member_prohi_id * @mbg.generated */ public void setMemberProhiId(String memberProhiId) { this.memberProhiId = memberProhiId == null ? null : memberProhiId.trim(); } /** * This method was generated by MyBatis Generator. This method returns the value of the database column member_prohi.prohi_status * @return the value of member_prohi.prohi_status * @mbg.generated */ public Integer getProhiStatus() { return prohiStatus; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column member_prohi.prohi_status * @param prohiStatus the value for member_prohi.prohi_status * @mbg.generated */ public void setProhiStatus(Integer prohiStatus) { this.prohiStatus = prohiStatus; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column member_prohi.prohi_type * @return the value of member_prohi.prohi_type * @mbg.generated */ public Integer getProhiType() { return prohiType; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column member_prohi.prohi_type * @param prohiType the value for member_prohi.prohi_type * @mbg.generated */ public void setProhiType(Integer prohiType) { this.prohiType = prohiType; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column member_prohi.member_no * @return the value of member_prohi.member_no * @mbg.generated */ public String getMemberNo() { return memberNo; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column member_prohi.member_no * @param memberNo the value for member_prohi.member_no * @mbg.generated */ public void setMemberNo(String memberNo) { this.memberNo = memberNo == null ? null : memberNo.trim(); } /** * This method was generated by MyBatis Generator. This method returns the value of the database column member_prohi.member_type * @return the value of member_prohi.member_type * @mbg.generated */ public Integer getMemberType() { return memberType; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column member_prohi.member_type * @param memberType the value for member_prohi.member_type * @mbg.generated */ public void setMemberType(Integer memberType) { this.memberType = memberType; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column member_prohi.prohi_time * @return the value of member_prohi.prohi_time * @mbg.generated */ public Integer getProhiTime() { return prohiTime; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column member_prohi.prohi_time * @param prohiTime the value for member_prohi.prohi_time * @mbg.generated */ public void setProhiTime(Integer prohiTime) { this.prohiTime = prohiTime; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column member_prohi.create_time * @return the value of member_prohi.create_time * @mbg.generated */ public Date getCreateTime() { return createTime; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column member_prohi.create_time * @param createTime the value for member_prohi.create_time * @mbg.generated */ public void setCreateTime(Date createTime) { this.createTime = createTime; } }
88ea78c807bde06fa3ef734008c17dd3f3160f27
b249461bae017c99c0723ebd8c163977d2ed442d
/src/main/java/com/handsetdetection/cache/NoCache.java
d9d7ccf2500bd03710b4f1e97e80fba9c223f495
[ "MIT" ]
permissive
HandsetDetection/detection-apikit-java
d9916b8ed99475756a56f27ce3705dd8a3fa7929
a5b6d0fb29c94d2fe123967e452ca4851cfe9fb1
refs/heads/master
2020-04-06T03:47:04.631585
2017-10-10T06:44:07
2017-10-10T06:44:07
95,067,096
1
1
null
2017-10-10T06:44:08
2017-06-22T02:40:00
Java
UTF-8
Java
false
false
2,027
java
/* * Copyright (c) 2017, Richard Uren <[email protected]> * 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. * * 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package com.handsetdetection.cache; import com.fasterxml.jackson.core.type.TypeReference; /** * */ public class NoCache implements Cache { final String name = "none"; public NoCache() { } @Override public Object get(String key, TypeReference ref) { return null; } @Override public boolean set(String key, Object data, int ttl) { return true; } @Override public boolean del(String key) { return true; } @Override public boolean flush() { return true; } @Override public String getName() { return this.name; } }
04bdd37b97ff9b6e44a1b712bb838c9ed6a9b07f
c3e183b9b3ff1a511c6182893d70aaa352c167f0
/src/main/java/com/m2m/domain/TagTrainSampleWithBLOBs.java
cd3faf0b2b0899b80610d1227d414d386a0adaae
[]
no_license
hushunjian/rest
a47a6e00b038eb5fb635ec4362ff0b6a5a92813b
15b49ada2725bdba17a92986ed8372a0d56ef748
refs/heads/master
2021-05-04T12:33:54.762619
2018-02-05T11:37:10
2018-02-05T11:37:10
120,258,667
0
0
null
null
null
null
UTF-8
Java
false
false
2,031
java
package com.m2m.domain; public class TagTrainSampleWithBLOBs extends TagTrainSample { /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tag_train_sample.summary * * @mbggenerated Thu Jan 11 17:51:54 CST 2018 */ private String summary; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tag_train_sample.keywords * * @mbggenerated Thu Jan 11 17:51:54 CST 2018 */ private String keywords; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tag_train_sample.summary * * @return the value of tag_train_sample.summary * * @mbggenerated Thu Jan 11 17:51:54 CST 2018 */ public String getSummary() { return summary; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tag_train_sample.summary * * @param summary the value for tag_train_sample.summary * * @mbggenerated Thu Jan 11 17:51:54 CST 2018 */ public void setSummary(String summary) { this.summary = summary == null ? null : summary.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tag_train_sample.keywords * * @return the value of tag_train_sample.keywords * * @mbggenerated Thu Jan 11 17:51:54 CST 2018 */ public String getKeywords() { return keywords; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tag_train_sample.keywords * * @param keywords the value for tag_train_sample.keywords * * @mbggenerated Thu Jan 11 17:51:54 CST 2018 */ public void setKeywords(String keywords) { this.keywords = keywords == null ? null : keywords.trim(); } }
47edb9c2901bb14dd00ad8e7e5cc014519b5d903
2675014ce51aa2be088c1c3d4126153ea3bdcf94
/aws-java-sdk-kinesis/src/main/java/com/amazonaws/services/kinesisanalytics/model/transform/AddApplicationInputRequestMarshaller.java
4be78a8a0f089e2cd794e145e7f34ec49064d6dc
[ "Apache-2.0" ]
permissive
erbrito/aws-java-sdk
7b621cae16c470dfe26b917781cb00f5c6a0de4e
853b7e82d708465aca43c6013ab1221ce4d50852
refs/heads/master
2021-01-25T05:50:39.073013
2017-02-02T03:58:41
2017-02-02T03:58:41
80,691,444
1
0
null
null
null
null
UTF-8
Java
false
false
3,441
java
/* * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.kinesisanalytics.model.transform; import java.io.ByteArrayInputStream; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.DefaultRequest; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.kinesisanalytics.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.protocol.json.*; /** * AddApplicationInputRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AddApplicationInputRequestMarshaller implements Marshaller<Request<AddApplicationInputRequest>, AddApplicationInputRequest> { private final SdkJsonMarshallerFactory protocolFactory; public AddApplicationInputRequestMarshaller(SdkJsonMarshallerFactory protocolFactory) { this.protocolFactory = protocolFactory; } public Request<AddApplicationInputRequest> marshall(AddApplicationInputRequest addApplicationInputRequest) { if (addApplicationInputRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<AddApplicationInputRequest> request = new DefaultRequest<AddApplicationInputRequest>(addApplicationInputRequest, "AmazonKinesisAnalytics"); request.addHeader("X-Amz-Target", "KinesisAnalytics_20150814.AddApplicationInput"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (addApplicationInputRequest.getApplicationName() != null) { jsonGenerator.writeFieldName("ApplicationName").writeValue(addApplicationInputRequest.getApplicationName()); } if (addApplicationInputRequest.getCurrentApplicationVersionId() != null) { jsonGenerator.writeFieldName("CurrentApplicationVersionId").writeValue(addApplicationInputRequest.getCurrentApplicationVersionId()); } if (addApplicationInputRequest.getInput() != null) { jsonGenerator.writeFieldName("Input"); InputJsonMarshaller.getInstance().marshall(addApplicationInputRequest.getInput(), jsonGenerator); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", protocolFactory.getContentType()); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; } }
[ "" ]
2f876e3cfec33b3ddc36940386e7bb304abc97e0
fc105a83971ff483bc0ca7eb65be519912ee8a0a
/Milestone2ClassesObjects/src/main/java/PersonCodeAlong/Person.java
cd7b6caf27ac9e3d43fb3f5d4bd8a4547160787e
[]
no_license
NarishSingh/SG2-Java-OOP
9db64113683f5ca8614fbbce1023393c4d6fd196
cce0d49c8fab2cbe0aff950b674d77c49e798968
refs/heads/master
2023-04-08T11:36:07.923534
2020-05-17T20:35:27
2020-05-17T20:35:27
255,391,704
1
0
null
null
null
null
UTF-8
Java
false
false
1,083
java
package PersonCodeAlong; public class Person { /*fields*/ private String name; private int age; private Address home; //uses address class /*ctors*/ /* public Person() { //default } */ public Person(String name, int age, Address home) { this.name = name; setAge(age); //we can use out setters in constructors to ensure proper field entry this.home = home; } /*getter/setter*/ public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public final void setAge(int age) { // finals makes this a constant method and stops the overridable method warning if (age > 0 && age < 120) { this.age = age; } else { throw new IllegalArgumentException("Invalid age."); } } /*behaviors*/ @Override public String toString() { return "Person{" + "name=" + name + ", age=" + age + ", home=" + home + '}'; } }
5b2462a91c851b6f46c4028c2309c17d556d961d
eae7d9e7ba55065dfa63c25a4721122648c794cd
/EX_ReprDados/src/EX_01/TCPcliente.java
8f15e278ac57d3ac7aa206a3a9c8ecb0f5e998f3
[]
no_license
matheussguerra/SistemasDistribuidosListas
f89d20d4f30376dc36ccef95ba2f45accaa58206
6a2116358879643a1b493bda3d0f27d21557481f
refs/heads/master
2021-07-23T20:36:57.358997
2017-11-05T03:00:54
2017-11-05T03:00:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,063
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package EX_01; /** * * @author guerra */ /** * TCPClient: Cliente para conexao TCP * Descrição: Envia uma informacao ao servidor e finaliza a conexao */ import java.net.*; import java.io.*; import java.util.ArrayList; /** * * @author rodrigo */ public class TCPcliente { public static void main (String args[]) { Compromisso a,b; Socket s; ObjectOutputStream objOut; try { System.out.println ("Criando instâncias da classe Pessoa ...\n"); a = new Compromisso ("Entregar lista 3 de SD", "29/09/2017", "13:00"); b = new Compromisso("Entrgar lista de análise", "03/10/2017", "13:00"); System.out.println ("Conectando ao servidor ...\n"); s = new Socket ("localhost",6666); System.out.println ("Criando objetos de leitura/escrita ...\n"); objOut = new ObjectOutputStream (s.getOutputStream()); System.out.println ("Enviando objetos serializados ...\n"); objOut.writeObject(a); objOut.writeObject(b); objOut.flush(); DataOutputStream out =new DataOutputStream( s.getOutputStream()); System.out.println("Solicitando listagem..."); out.writeUTF("listar"); ObjectInputStream objIn = new ObjectInputStream (s.getInputStream()); ArrayList<Compromisso> lista = (ArrayList<Compromisso>) objIn.readObject(); System.out.println("Listando:\n"+ lista.get(0).toString() + "\n" + lista.get(1).toString()); System.out.println ("Finalizado."); } catch (Exception e) { System.out.println(e); } //catch } //main }
b34918ac783e749871bb35465638365b3e38e53f
1e8f616605bb5af4890a25875119eaa8bb847d69
/src/com/class31/TestParent.java
2d1c44341478325b7af52378e805e5f126231da6
[]
no_license
hasansinan17/BatchVJavaClasses
418743f42627cf8a99f09477135ba026a1578a1e
4e4de21841c43829865dbb44a3ad3929adf4925a
refs/heads/master
2020-09-04T21:06:45.945960
2020-02-04T22:00:03
2020-02-04T22:00:03
219,891,902
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package com.class31; public class TestParent { public static void main(String[] args) { Parent p=new Child(); p.hello(); } }
703fe0b0a0d5bc7e7b8011f07241f756b38c36c8
95ee120f82dddd550af025a760f496fbdc4ec099
/src/com/javarush/test/level27/lesson15/big01/statistic/StatisticEventManager.java
214a99858fdbdc999bfe69cd6ade91b1e5c3d9de
[]
no_license
vsprog/JavaRushHomeWork
863ce30d48b28e468fa9a60b5747893ba82fe468
faadfb3a28d3adbd892577e3ff5efa1aa6fe7e87
refs/heads/master
2021-06-10T13:17:24.199933
2017-01-23T05:51:13
2017-01-23T05:51:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,701
java
package com.javarush.test.level27.lesson15.big01.statistic; import com.javarush.test.level27.lesson15.big01.kitchen.Cook; import com.javarush.test.level27.lesson15.big01.statistic.event.CookedOrderEventDataRow; import com.javarush.test.level27.lesson15.big01.statistic.event.EventDataRow; import com.javarush.test.level27.lesson15.big01.statistic.event.EventType; import com.javarush.test.level27.lesson15.big01.statistic.event.VideoSelectedEventDataRow; import java.util.*; public class StatisticEventManager { private static final StatisticEventManager ourInstance = new StatisticEventManager(); private StatisticStorage storage = new StatisticStorage(); public static StatisticEventManager getInstance() { return ourInstance; } private StatisticEventManager() { } public void register(EventDataRow data) { storage.put(data); } private static class StatisticStorage { private Map<EventType, List<EventDataRow>> eventMapStorage = new HashMap<>(); private StatisticStorage() { for (EventType eventType : EventType.values()) { eventMapStorage.put(eventType, new ArrayList<EventDataRow>()); } } private void put(EventDataRow data) { eventMapStorage.get(data.getType()).add(data); } private List<EventDataRow> getEvents(EventType eventType) { return eventMapStorage.get(eventType); } } private static final int[] TIME_FIELDS = { Calendar.HOUR_OF_DAY, Calendar.HOUR, Calendar.AM_PM, Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND }; public TreeMap<Date, Long> getAdvertisementRevenueAgregatedByDay() { TreeMap<Date, Long> result = new TreeMap<>(); for (EventDataRow eventDataRow : storage.getEvents(EventType.SELECTED_VIDEOS)) { VideoSelectedEventDataRow vEventDataRow = (VideoSelectedEventDataRow) eventDataRow; GregorianCalendar gDate = new GregorianCalendar(); gDate.setTime(vEventDataRow.getDate()); for(int i : TIME_FIELDS) gDate.clear(i); Date date = gDate.getTime(); Long dayRevenue = result.get(date) ; if (dayRevenue == null) dayRevenue = Long.valueOf(0); result.put(date, dayRevenue + vEventDataRow.getAmount()); } return result; } public TreeMap<Date, HashMap<String, Integer>> getCookWorkloadingAgregatedByDay() { TreeMap<Date, HashMap<String, Integer>> result = new TreeMap<>(); for (EventDataRow eventDataRow : storage.getEvents(EventType.COOKED_ORDER)) { CookedOrderEventDataRow cookDataRow = (CookedOrderEventDataRow) eventDataRow; GregorianCalendar gDate = new GregorianCalendar(); gDate.setTime(cookDataRow.getDate()); for(int i : TIME_FIELDS) gDate.clear(i); Date date = gDate.getTime(); HashMap<String, Integer> cooksNameWorkDuration = result.get(date); if (cooksNameWorkDuration == null) { cooksNameWorkDuration = new HashMap<>(); result.put(date, cooksNameWorkDuration); } String cookName = cookDataRow.getCookName(); Integer cookWorkDuration = cooksNameWorkDuration.get(cookName); if (cookWorkDuration == null) cookWorkDuration = Integer.valueOf(0); cooksNameWorkDuration.put(cookName, cookWorkDuration + cookDataRow.getTime()); } return result; } }
4702560385d8c9624dcfd23324b514b68dd50e0c
3b91ed788572b6d5ac4db1bee814a74560603578
/com/tencent/mm/plugin/gallery/ui/ImagePreviewUI$17.java
030c09a3abb5f0ac3abc219610fccc17a3a65c6a
[]
no_license
linsir6/WeChat_java
a1deee3035b555fb35a423f367eb5e3e58a17cb0
32e52b88c012051100315af6751111bfb6697a29
refs/heads/master
2020-05-31T05:40:17.161282
2018-08-28T02:07:02
2018-08-28T02:07:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package com.tencent.mm.plugin.gallery.ui; import com.tencent.mm.plugin.gallery.model.m; import com.tencent.mm.plugin.gallery.model.m.a; class ImagePreviewUI$17 implements a { final /* synthetic */ ImagePreviewUI jEa; ImagePreviewUI$17(ImagePreviewUI imagePreviewUI) { this.jEa = imagePreviewUI; } public final void a(m mVar) { if (mVar.position == ImagePreviewUI.g(this.jEa).intValue()) { ImagePreviewUI.a(this.jEa, mVar.path, mVar.jBs); } } }
3ea8d976912f361eab94752451722fc942c2910a
721860fdbf1ae3c58ded3fe9c8a8e3ef5fdeb4f2
/AmazonProduct/product/src/main/java/com/product/product/Deo/BookingReporisoty.java
320f67803fc0603af36fbef7d9ea96b797e17f26
[]
no_license
PrabhatUpadhyay1/Spring-Boot-Rest-APIs
65e5985dfdc0c9fdfcf39f77b5bebbd7ba8675e1
1f1eb35f604d651c9bf93b396c17e7fe5c590a33
refs/heads/main
2023-07-18T08:17:26.837629
2021-08-18T16:07:26
2021-08-18T16:07:26
397,655,119
0
0
null
null
null
null
UTF-8
Java
false
false
591
java
package com.product.product.Deo; import java.util.List; import com.product.product.Entities.Booking; import com.product.product.Entities.ProductDetail; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; public interface BookingReporisoty extends CrudRepository<Booking, Integer> { @Query("select product from ProductDetail product where product.product_name =:name") public List<ProductDetail> getProductByName(@Param("name") String name); }
c76e0f2f478d22d37efd811a62748394f91e81c9
6930feb27097f713cfb9d113aa384ce5bbb5dba7
/src/main/java/com/crud/tasks/TasksApplication.java
25bba3f766543977ffcf9f89de1bb5ac31ebbb4e
[]
no_license
DawidBadura/SpringWeb-
a215385a0ead3fb6aee45c894936a7e941db1c59
1cc9b7838570b00b51cf7bcd11c633fe91806083
refs/heads/master
2023-03-22T03:36:36.416802
2021-03-16T21:38:35
2021-03-16T21:38:35
277,657,750
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
package com.crud.tasks; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class TasksApplication/* extends SpringBootServletInitializer*/ { /* @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(TasksApplication.class); }*/ public static void main(String[] args) { SpringApplication.run(TasksApplication.class, args); } }
9d3d3c658798809ef66df404533e0947bd7b9e44
7b40d383ff3c5d51c6bebf4d327c3c564eb81801
/src/android/support/v4/view/ViewGroupCompat$ViewGroupCompatJellybeanMR2Impl.java
0192c5520186ed186a5cd330ce1fc2382dc721ef
[]
no_license
reverseengineeringer/com.yik.yak
d5de3a0aea7763b43fd5e735d34759f956667990
76717e41dab0b179aa27f423fc559bbfb70e5311
refs/heads/master
2021-01-20T09:41:04.877038
2015-07-16T16:44:44
2015-07-16T16:44:44
38,577,543
2
0
null
null
null
null
UTF-8
Java
false
false
629
java
package android.support.v4.view; import android.view.ViewGroup; class ViewGroupCompat$ViewGroupCompatJellybeanMR2Impl extends ViewGroupCompat.ViewGroupCompatIcsImpl { public int getLayoutMode(ViewGroup paramViewGroup) { return ViewGroupCompatJellybeanMR2.getLayoutMode(paramViewGroup); } public void setLayoutMode(ViewGroup paramViewGroup, int paramInt) { ViewGroupCompatJellybeanMR2.setLayoutMode(paramViewGroup, paramInt); } } /* Location: * Qualified Name: android.support.v4.view.ViewGroupCompat.ViewGroupCompatJellybeanMR2Impl * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
eb86f262747e523138f34cff4d9c20def06b79c9
5e6abc6bca67514b4889137d1517ecdefcf9683a
/Client/src/main/java/com/runescape/scene/graphic/TextureLoader667.java
fea45c96a8c35f069c28fab8eace128d068fca10
[]
no_license
dginovker/RS-2009-317
88e6d773d6fd6814b28bdb469f6855616c71fc26
9d285c186656ace48c2c67cc9e4fb4aeb84411a4
refs/heads/master
2022-12-22T18:47:47.487468
2019-09-20T21:24:34
2019-09-20T21:24:34
208,949,111
2
2
null
2022-12-15T23:55:43
2019-09-17T03:15:17
Java
UTF-8
Java
false
false
6,152
java
package com.runescape.scene.graphic; import com.runescape.cache.def.TextureDefinition; import com.runescape.cache.texture.Texture; import com.runescape.net.requester.ResourceProvider; public class TextureLoader667 { public static int[] textureLastUsed; public static int textureGetCount; private static int loadedTextureCount; private static int textureTexelPoolPointer; private static int[][] texelArrayPool; private static int[][] texelCache; private static float brightness = 1.0F; public static void initTextures(int count, ResourceProvider resourceProvider) { Texture.init(count, resourceProvider); loadedTextureCount = count; textureLastUsed = new int[count]; texelCache = new int[count][]; } public static void clearTextureCache() { texelArrayPool = null; for (int i = 0; i < loadedTextureCount; i++) { texelCache[i] = null; } } public static void resetTextures() { if (texelArrayPool == null) { textureTexelPoolPointer = 50;//was parameter texelArrayPool = new int[textureTexelPoolPointer][0x10000]; for (int k = 0; k < loadedTextureCount; k++) { texelCache[k] = null; } } } public static void resetTexture(int textureId) { if (texelCache[textureId] == null) { return; } texelArrayPool[textureTexelPoolPointer++] = texelCache[textureId]; texelCache[textureId] = null; } public static int[] getTexturePixels(int textureId) { if (textureId == 0) { textureId = 24; } Texture texture = Texture.get(textureId); if (texture == null) { return null; } textureLastUsed[textureId] = textureGetCount++; if (texelCache[textureId] != null) { return texelCache[textureId]; } int[] texels; //Start of mem management code if (textureTexelPoolPointer > 0) { //Freed texture data arrays available texels = texelArrayPool[--textureTexelPoolPointer]; texelArrayPool[textureTexelPoolPointer] = null; } else { //No freed texture data arrays available, recycle least used texture's array int lastUsed = 0; int target = -1; for (int i = 0; i < loadedTextureCount; i++) { if (texelCache[i] != null && (textureLastUsed[i] < lastUsed || target == -1)) { lastUsed = textureLastUsed[i]; target = i; } } texels = texelCache[target]; texelCache[target] = null; } texelCache[textureId] = texels; //End of mem management code if (texture.width == 64) { for (int y = 0; y < 128; y++) { for (int x = 0; x < 128; x++) { texels[x + (y << 7)] = texture.getPixel((x >> 1) + ((y >> 1) << 6)); } } } else { for (int texelPtr = 0; texelPtr < 16384; texelPtr++) { texels[texelPtr] = texture.getPixel(texelPtr); } } TextureDefinition def = textureId >= 0 && textureId < TextureDefinition.textures.length ? TextureDefinition.textures[textureId] : null; int blendType = def != null ? def.anInt1226 : 0; if (blendType != 1 && blendType != 2) { blendType = 0; } for (int texelPtr = 0; texelPtr < 16384; texelPtr++) { int texel = texels[texelPtr]; int alpha; if (blendType == 2) { alpha = texel >>> 24; } else if (blendType == 1) { alpha = texel != 0 ? 0xff : 0; } else { alpha = texel >>> 24; if (def != null && !def.aBoolean1223) { alpha /= 5; } } texel &= 0xffffff; if (textureId == 1 || textureId == 24) { texel = adjustBrightnessLinear(texel, 190);//379 } else { texel = adjustBrightnessLinear(texel, 179); } if (textureId == 1 || textureId == 24) { // texel = adjustBrightness(texel, 0.90093F); } else { texel = adjustBrightness(texel, brightness); } texel &= 0xf8f8ff; texels[texelPtr] = texel | (alpha << 24); texels[16384 + texelPtr] = ((texel - (texel >>> 3)) & 0xf8f8ff) | (alpha << 24); texels[32768 + texelPtr] = ((texel - (texel >>> 2)) & 0xf8f8ff) | (alpha << 24); texels[49152 + texelPtr] = ((texel - (texel >>> 3) - (texel >>> 3)) & 0xf8f8ff) | (alpha << 24); } return texels; } private static int adjustBrightness(int rgb, float brightness) { return ((int) ((float) Math.pow((double) ((float) (rgb >>> 16) / 256.0F), (double) brightness) * 256.0F) << 16) | ((int) ((float) Math.pow((double) ((float) ((rgb >>> 8) & 0xff) / 256.0F), (double) brightness) * 256.0F) << 8) | (int) ((float) Math.pow((double) ((float) (rgb & 0xff) / 256.0F), (double) brightness) * 256.0F); } private static int adjustBrightnessLinear(int rgb, int factor) { return ((((rgb >>> 16) * factor) & 0xff00) << 8) | ((((rgb >>> 8) & 0xff) * factor) & 0xff00) | (((rgb & 0xff) * factor) >> 8); } public static void calculateTexturePalette(double brightness) { for (int textureId = 0; textureId != loadedTextureCount; ++textureId) { resetTexture(textureId); } } public static void clear() { texelArrayPool = null; texelCache = null; textureLastUsed = null; brightness = 1.0F; } public boolean isValid() { return texelArrayPool != null && texelCache != null; } }
bf9a9cd5b63f5e33da6e3f32972714394f1302ca
fe5b610f0ded630462e9f98806edc7b24dcc2ef0
/Downloads/AyoKeMasjid_v0.3_apkpure.com_source_from_JADX/com/google/android/gms/ads/formats/NativeAdOptions.java
b1ab5cd3983f4f867cebc8bb7ba876679e52ba7b
[]
no_license
rayga/n4rut0
328303f0adcb28140b05c0a18e54abecf21ef778
e1f706aeb6085ee3752cb92187bf339c6dfddef0
refs/heads/master
2020-12-25T15:18:25.346886
2016-08-29T22:51:25
2016-08-29T22:51:25
66,826,428
1
0
null
null
null
null
UTF-8
Java
false
false
1,585
java
package com.google.android.gms.ads.formats; public final class NativeAdOptions { public static final int ORIENTATION_ANY = 0; public static final int ORIENTATION_LANDSCAPE = 2; public static final int ORIENTATION_PORTRAIT = 1; private final boolean zznV; private final int zznW; private final boolean zznX; public static final class Builder { private boolean zznV; private int zznW; private boolean zznX; public Builder() { this.zznV = false; this.zznW = NativeAdOptions.ORIENTATION_ANY; this.zznX = false; } public NativeAdOptions build() { return new NativeAdOptions(); } public Builder setImageOrientation(int orientation) { this.zznW = orientation; return this; } public Builder setRequestMultipleImages(boolean shouldRequestMultipleImages) { this.zznX = shouldRequestMultipleImages; return this; } public Builder setReturnUrlsForImageAssets(boolean shouldReturnUrls) { this.zznV = shouldReturnUrls; return this; } } private NativeAdOptions(Builder builder) { this.zznV = builder.zznV; this.zznW = builder.zznW; this.zznX = builder.zznX; } public int getImageOrientation() { return this.zznW; } public boolean shouldRequestMultipleImages() { return this.zznX; } public boolean shouldReturnUrlsForImageAssets() { return this.zznV; } }
b39c86080f3fa89bb0661db8149e3795e6390e5b
958aa7834f07b09862eda5e73b4465e64294fb38
/src/main/java/com/sun/structure/FixedCapacityStackOfString.java
ed09c071f296cca788879c3d5a5d916044d0e946
[]
no_license
sunwnehongl/Algorithms
12e6ba58a24ffb5879adba00783f711c4adc481e
b1d3d83ed9e1da999c75492abdbd88bf5ede99a6
refs/heads/master
2022-06-27T04:32:00.993215
2022-06-18T15:31:41
2022-06-18T15:31:41
148,800,547
0
0
null
2020-10-13T14:01:15
2018-09-14T14:33:41
Java
GB18030
Java
false
false
1,050
java
package com.sun.structure; /** * @Auther: swh * @Date: 2019/6/10 23:07 * @Description: 固定容量的字符串栈的实现 */ public class FixedCapacityStackOfString { // 栈实现用来存放栈内容的字符串数组 private String [] items; // 栈当前的大小,也是下一个栈顶值得下标 private int size; /*** * 固定容量字符串栈的构造器,只有一个参数为固定栈的容量 * @param initCapacity 栈的容量 */ public FixedCapacityStackOfString(int initCapacity) { if (initCapacity > 0) { items = new String[initCapacity]; }else{ throw new IllegalArgumentException("Illegal Capacity: "+initCapacity); } } /*** * 栈的push方法,向栈顶添加一个字符串 * @param item 向栈顶添加的字符串 */ public void push(String item) { items[size++] = item; } public String pop() { return items[--size]; } public int size() { return size; } }
834caf5b59149f49be1986adee7b20407b3ed40d
d4850e773872f333b78f3056b52b12c501a4ce5e
/myapp/src/main/java/com/rockgarden/myapp/uitl/FeedContextMenu.java
b9ab45b57c220faf0bcfc9463a938107cbc0f1cd
[]
no_license
rockgarden/MyCard
0c359aa3611c16a6384cf3f6705f955dd42508a0
526de6b66a1b9c0ef4d4a3b596bc3fcd74eef898
refs/heads/master
2020-12-14T03:56:53.702161
2016-07-29T05:59:26
2016-07-29T05:59:26
46,687,989
0
2
null
null
null
null
UTF-8
Java
false
false
2,511
java
package com.rockgarden.myapp.uitl; import android.content.Context; import android.view.LayoutInflater; import android.view.ViewGroup; import android.widget.LinearLayout; import butterknife.ButterKnife; import butterknife.OnClick; import com.litesuits.common.utils.AndroidUtil; import com.rockgarden.myapp.R; /** * Created by froger_mcs on 15.12.14. */ public class FeedContextMenu extends LinearLayout { private static final int CONTEXT_MENU_WIDTH = AndroidUtil.dpToPx(240); private int feedItem = -1; private OnFeedContextMenuItemClickListener onItemClickListener; public FeedContextMenu(Context context) { super(context); init(); } private void init() { LayoutInflater.from(getContext()).inflate(R.layout.view_context_menu, this, true); setBackgroundResource(R.drawable.bg_container_shadow); setOrientation(VERTICAL); setLayoutParams(new LayoutParams(CONTEXT_MENU_WIDTH, ViewGroup.LayoutParams.WRAP_CONTENT)); } public void bindToItem(int feedItem) { this.feedItem = feedItem; } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); ButterKnife.bind(this); } public void dismiss() { ((ViewGroup) getParent()).removeView(FeedContextMenu.this); } @OnClick(R.id.btnReport) public void onReportClick() { if (onItemClickListener != null) { onItemClickListener.onReportClick(feedItem); } } @OnClick(R.id.btnSharePhoto) public void onSharePhotoClick() { if (onItemClickListener != null) { onItemClickListener.onSharePhotoClick(feedItem); } } @OnClick(R.id.btnCopyShareUrl) public void onCopyShareUrlClick() { if (onItemClickListener != null) { onItemClickListener.onCopyShareUrlClick(feedItem); } } @OnClick(R.id.btnCancel) public void onCancelClick() { if (onItemClickListener != null) { onItemClickListener.onCancelClick(feedItem); } } public void setOnFeedMenuItemClickListener(OnFeedContextMenuItemClickListener onItemClickListener) { this.onItemClickListener = onItemClickListener; } public interface OnFeedContextMenuItemClickListener { public void onReportClick(int feedItem); public void onSharePhotoClick(int feedItem); public void onCopyShareUrlClick(int feedItem); public void onCancelClick(int feedItem); } }
646ea779dc5373a3eae1a8cd724cfc9943c1eb96
2689a96a27b7d77bec4ba486baa9db8687645873
/HelloWorld/app/src/test/java/com/ceva/helloworld/ExampleUnitTest.java
1a97061cf06559e6585dd6a41a4673969b235b44
[]
no_license
barcvilla/android-studio-3
6b15ed1393989899253e78d38af53b7d22b869fb
9e4fac40d3ba118a85d61cc9f9ca0269b6672ac8
refs/heads/master
2020-03-10T10:01:25.098001
2018-05-25T21:10:08
2018-05-25T21:10:08
129,324,223
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.ceva.helloworld; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
5942fee0662cd373a43ac51e3515c4bd4816fc41
b104d5dcecb076f15f6c94d8ff54d8dcdf10bea7
/BE/backend/backend/src/main/java/com/backend/controller/TestController.java
d608cac4fb4d8706a6ae7bc440200f7681b6fc38
[]
no_license
daust05/test
a409cfe3a0ed0df106fa6c64c3d26aa9f364279c
0868c5a88711ed077e8442f2d6bf8595f65243da
refs/heads/main
2023-06-23T11:03:43.313900
2021-07-27T11:40:30
2021-07-27T11:40:30
389,958,368
0
0
null
null
null
null
UTF-8
Java
false
false
829
java
package com.backend.controller; import com.backend.model.SearchVO; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api") public class TestController { // http통신할때 post는 body에다 data를 집어넣어서 받아오겠다. // @RequestBody에 SearchVO에 있는 값을 매칭해서 보내줘라. @RequestMapping(method = RequestMethod.POST, path = "/postRequest") public SearchVO postRequest(@RequestBody SearchVO searchVo){ return searchVo; } @PostMapping(value = "/postMapping") public SearchVO postMapping(@RequestBody SearchVO searchVo){ return searchVo; } @GetMapping("/getMultiParametersRtnJson") public SearchVO getMultiParametersRtnJson(SearchVO searchVo) { return searchVo; } }
80ed64a9d74a8f6192832e944fd01e83588f1867
b31ea99b7ba411618e9a066ba0904c90373eaa39
/app/src/main/java/com/example/myapplication/MainActivity.java
06fe151a5b86c2c34e254978fe81ef6221dd8eb1
[]
no_license
rushil-thareja/DIS-PROJECT
ad55a55a4f1c1b4b74577ba50a66e60a28ee6b08
ff3a9768247a536407f5a9aa102ad71b59f43f55
refs/heads/master
2023-01-24T07:13:07.293148
2020-11-22T08:20:14
2020-11-22T08:20:14
314,793,049
0
0
null
null
null
null
UTF-8
Java
false
false
5,657
java
//package com.example.myapplication; // //import androidx.appcompat.app.AppCompatActivity; // //import android.os.Bundle; //import android.view.MotionEvent; //import android.widget.Toast; // //import com.google.ar.core.Anchor; //import com.google.ar.core.HitResult; //import com.google.ar.core.Plane; //import com.google.ar.sceneform.AnchorNode; //import com.google.ar.sceneform.rendering.Material; //import com.google.ar.sceneform.rendering.ModelRenderable; //import com.google.ar.sceneform.ux.ArFragment; //import com.google.ar.sceneform.ux.BaseArFragment; //import com.google.ar.sceneform.ux.TransformableNode; // //public class MainActivity extends AppCompatActivity { // private ArFragment arFragment; // private ModelRenderable modelRenderable; // // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_main); // arFragment = (ArFragment) getSupportFragmentManager().findFragmentById(R.id.fragment); // setUpModel(); // setUpPlane(); // } // private void setUpModel(){ // ModelRenderable.builder() // .setSource(this,R.raw.hamburger) // .build() // .thenAccept(renderable->modelRenderable = renderable) // .exceptionally(throwable -> { // Toast.makeText(MainActivity.this,"not loaded",Toast.LENGTH_LONG).show(); // return(null); // }); // // } // private void setUpPlane(){ // arFragment.setOnTapArPlaneListener(new BaseArFragment.OnTapArPlaneListener() { // @Override // public void onTapPlane(HitResult hitResult, Plane plane, MotionEvent motionEvent) { // Anchor anchor = hitResult.createAnchor(); // AnchorNode anchorNode = new AnchorNode(anchor); // anchorNode.setParent(arFragment.getArSceneView().getScene()); // createModel(anchorNode); // } // }); // } // private void createModel(AnchorNode anchorNode){ // TransformableNode node = new TransformableNode(arFragment.getTransformationSystem()); // node.setParent(anchorNode); // node.setRenderable(modelRenderable); // node.select(); // } //} package com.example.myapplication; import android.net.Uri; import android.os.Bundle; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.google.android.gms.tasks.OnSuccessListener; import com.google.ar.sceneform.AnchorNode; import com.google.ar.sceneform.assets.RenderableSource; import com.google.ar.sceneform.math.Vector3; import com.google.ar.sceneform.rendering.ModelRenderable; import com.google.ar.sceneform.ux.ArFragment; import com.google.firebase.FirebaseApp; import com.google.firebase.storage.FileDownloadTask; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import java.io.File; import java.io.IOException; public class MainActivity extends AppCompatActivity { private String choose_dish; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //call the getIntent() getstring methods here to get string from calling activity then enter that into choose_dish choose_dish = "dish"; FirebaseApp.initializeApp(this); FirebaseStorage storage = FirebaseStorage.getInstance(); String path = "restaurant/"+choose_dish+"/out.glb"; StorageReference modelRef = storage.getReference().child(path); ArFragment arFragment = (ArFragment) getSupportFragmentManager() .findFragmentById(R.id.arFragment); findViewById(R.id.downloadBtn) .setOnClickListener(v -> { try { File file = File.createTempFile("out", "glb"); modelRef.getFile(file).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() { @Override public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) { buildModel(file); } }); } catch (IOException e) { e.printStackTrace(); } }); arFragment.setOnTapArPlaneListener((hitResult, plane, motionEvent) -> { AnchorNode anchorNode = new AnchorNode(hitResult.createAnchor()); anchorNode.setRenderable(renderable); Vector3 vector3 = new Vector3(0.1f,0.1f,0.1f); anchorNode.setLocalScale(vector3); arFragment.getArSceneView().getScene().addChild(anchorNode); }); } private ModelRenderable renderable; private void buildModel(File file) { RenderableSource renderableSource = RenderableSource .builder() .setSource(this, Uri.parse(file.getPath()), RenderableSource.SourceType.GLB) .setRecenterMode(RenderableSource.RecenterMode.ROOT) .build(); ModelRenderable .builder() .setSource(this, renderableSource) .setRegistryId(file.getPath()) .build() .thenAccept(modelRenderable -> { Toast.makeText(this, "Model built", Toast.LENGTH_SHORT).show();; renderable = modelRenderable; }); } }
2236bfe54f0dd5ab2cc771887e8cf59c6f922490
a375989d20ba4a68672f4eea6659bc6a7861e568
/HackVG/app/src/main/java/com/hackvg/android/di/modules/DomainModule.java
a9b66281eeac07d329c1313ffbaf10d8d0652d62
[ "Apache-2.0" ]
permissive
gooYangFeng/Material-Movies
cf765c62812279304d11640a8c1f94b85fc2548e
0ebdd973148ca235abe061871fe9486deecd2c48
refs/heads/master
2020-05-23T10:10:45.012404
2015-11-26T10:12:39
2015-11-26T10:12:39
36,914,425
0
1
null
2015-06-05T05:49:08
2015-06-05T05:49:08
null
UTF-8
Java
false
false
1,019
java
/* * Copyright (C) 2015 Saúl Molinero. * * 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.hackvg.android.di.modules; import com.hackvg.model.rest.RestMovieSource; import com.squareup.otto.Bus; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; @Module public class DomainModule { @Provides @Singleton Bus provideBus () { return new Bus(); } @Provides @Singleton RestMovieSource provideDataSource (Bus bus) { return new RestMovieSource(bus); } }
429ae0f2c0baa2968fd791fe207c869db9961c6a
37761230cff9d8ebb731074020f6d4a52dc41ee1
/app/src/main/java/com/example/tps900/tps900/activity/TicketVerificationActivity.java
e78f0a26a6ff2ba02873d169afb4994ca95b0de1
[]
no_license
lihuaizhan/FengNing
fb828b07a323a901e0764a7dab2cadbf5e8779d3
8f7a3da71da63030a4adccc835679bfed84ce050
refs/heads/master
2020-03-22T23:44:21.125668
2018-07-13T09:21:21
2018-07-13T09:21:21
140,826,025
0
0
null
null
null
null
UTF-8
Java
false
false
35,238
java
package com.example.tps900.tps900.activity; import android.app.ProgressDialog; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Message; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; import com.alibaba.fastjson.JSON; import com.example.tps900.tps900.Bean.ConsumeTicketsBean; import com.example.tps900.tps900.Bean.GetOverifByEcodeBean; import com.example.tps900.tps900.Bean.GetTicketCode; import com.example.tps900.tps900.Bean.GetUpadateTicketBean; import com.example.tps900.tps900.Bean.TicketPrintBean; import com.example.tps900.tps900.R; import com.example.tps900.tps900.Utlis.Constant; import com.example.tps900.tps900.Utlis.OtherUtils; import com.example.tps900.tps900.Utlis.ThreadPoolUtils; import com.example.tps900.tps900.Utlis.TpsN900PrintUtils; import com.example.tps900.tps900.Webservice.GsWebServiceUtils; import com.godfery.Utils.ToastUtils; import com.godfery.keyboard.KeyboardUtil; import com.godfery.pay.HttpUtils; import com.godfery.Zxing.CaptureActivity; import java.util.Timer; import java.util.TimerTask; import static com.example.tps900.tps900.Utlis.Dailog.ErrDialog2; import static com.example.tps900.tps900.Utlis.OtherUtils.Bitmap2Bytes; import static com.example.tps900.tps900.Utlis.OtherUtils.getTime; import static com.example.tps900.tps900.Utlis.OtherUtils.sendMessageInfo; import static com.example.tps900.tps900.Webservice.GsWebServiceUtils.ConsumeTickets; import static com.example.tps900.tps900.Webservice.GsWebServiceUtils.GetOverifByEcode; import static com.godfery.keyboard.CustomEditLintener.EditListener; /** * 项目名称:TPS900 * 类名称: * 类描述: * 创建人:zxh * 创建时间:2017/4/17 13:24 * 修改人:zxh * 修改时间:2017/4/17 13:24 * 修改备注: * * @author zxh */ public class TicketVerificationActivity extends BaseActivity implements BaseActivity.CardCodeInterface { //扫描 private final int Scanning = 1; //线上核销 private final int Onlineverification = 2; //线下核销 private final int Offlineverification = 3; //通用失败 private final int Failed = 4; //清空 private final int Emptied = 5; //更新入园次数 private final int UpdataText = 6; TextView ticketName; TextView startTime; LinearLayout ticketLvBacket; TextView endTime; TextView ticketPersonNum; EditText practicalPersonNum; RadioButton ticketConfirm; RadioButton ticketCancel; ImageView ticketImgDelete; TextView ticketState; TextView ticketType; EditText ticketEtTicketCode; ImageView ticketImgDeleteCode; Button ticketQueryTicket; Button ticketBtnBor; Button ticketBtnComit; private Timer mTimer; private GetTicketCode getTicketCode; private GetUpadateTicketBean getUpadateTicketBean; //二维码,门票名称,开始日期,结束日期,可入景区数,可入人数 private String barcode, getTicketName, startDateTime, inParkTime, endDateTime, personNum; private String barcode2 = ""; Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { //扫描 case Scanning: Intent intent = new Intent(TicketVerificationActivity.this, CaptureActivity.class); startActivityForResult(intent, 100); break; //线下核销 case Offlineverification: Ticket_H(barcode2, Integer.valueOf(practicalPersonNum.getText().toString())); timerTask(); break; //线上核销 case Onlineverification: ConTickets(barcode, practicalPersonNum.getText().toString().trim()); timerTask(); break; //通用失败原因 case Failed: String msgInfo = msg.obj.toString(); ErrDialog2(TicketVerificationActivity.this, msgInfo, ""); timerTask(); break; case Emptied://清除数据 ticketName.setText(""); ticketState.setText(""); startTime.setText(""); endTime.setText(""); ticketPersonNum.setText(""); practicalPersonNum.setText(""); ticketType.setText(""); ticketEtTicketCode.setText(""); yearCode_img_lv.setVisibility(View.GONE); break; case UpdataText: practicalPersonNum.setText(inParkTime); break; default: break; } } }; private String TAG = "TicketVerActivity"; private GetOverifByEcodeBean getobe; private ProgressDialog progressDialog; //通用错误 private String msgErr; private ConsumeTicketsBean ticketsBean; private byte[] buff = new byte[125 * 250]; private ImageView yearImage; private Drawable drawable; private Bitmap bitmap; private BitmapDrawable drawable2; private LinearLayout yearCode_img_lv; private Button ticket_btn_code; private String type = ""; /** * 设置布局 * * @return */ @Override public int getLayoutId() { return R.layout.activity_ticket_verification; } /** * @author zxh * created at 2017/6/7 15:56 * 方法名: initView * 方法说明: 初始化操作 */ @Override public void initView() { setCardInterface(this); startTime = (TextView) findViewById(R.id.start_time); endTime = (TextView) findViewById(R.id.end_time); ticketPersonNum = (TextView) findViewById(R.id.ticket_personNum); practicalPersonNum = (EditText) findViewById(R.id.practical_personNum); ticketConfirm = (RadioButton) findViewById(R.id.ticket_confirm); ticketCancel = (RadioButton) findViewById(R.id.ticket_cancel); ticketImgDelete = (ImageView) findViewById(R.id.ticket_img_delete); ticketState = (TextView) findViewById(R.id.ticket_State); ticketType = (TextView) findViewById(R.id.ticket_type); ticketEtTicketCode = (EditText) findViewById(R.id.ticket_et_ticketCode); ticketImgDeleteCode = (ImageView) findViewById(R.id.ticket_img_deleteCode); ticketQueryTicket = (Button) findViewById(R.id.ticket_QueryTicket); ticket_btn_code = (Button) findViewById(R.id.ticket_btn_code); ticketBtnBor = (Button) findViewById(R.id.ticket_btn_bor); ticketBtnComit = (Button) findViewById(R.id.ticket_btn_comit); ticketName = (TextView) findViewById(R.id.ticket_name); ticketLvBacket = (LinearLayout) findViewById(R.id.ticket_lv_back);// yearCode_img_lv = (LinearLayout) findViewById(R.id.yearCode_img_lv);//yearCode_img_lv progressDialog = new ProgressDialog(TicketVerificationActivity.this); yearImage = (ImageView) findViewById(R.id.ticket_img_web); drawable = getResources().getDrawable(R.mipmap.touxiangyonghu_03); bitmap = OtherUtils.drawableToBitmap(drawable); drawable2 = new BitmapDrawable(bitmap); yearImage.setBackground(drawable2); yearCode_img_lv.setVisibility(View.GONE); } /** * @author zxh * created at 2017/6/7 16:15 * 方法名: initData * 方法说明: 一些数据操作 */ @Override public void initData() { EditListener(practicalPersonNum); EditListener(ticketEtTicketCode); practicalPersonNum.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { practicalPersonNum.setHint(""); ticketEtTicketCode.setHint("请输入门票串码"); new KeyboardUtil(getApplicationContext(), TicketVerificationActivity.this, practicalPersonNum, R.id.schemas_key_keyboard_view).showKeyboard(); } }); ticketEtTicketCode.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { ticketEtTicketCode.setHint(""); practicalPersonNum.setHint("请输入园次数"); new KeyboardUtil(getApplicationContext(), TicketVerificationActivity.this, ticketEtTicketCode, R.id.schemas_key_keyboard_view).showKeyboard(); } }); practicalPersonNum.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { String ticketNum = s.toString().trim(); String state = ticketState.getText().toString().trim(); if (!TextUtils.isEmpty(ticketNum) && TextUtils.isEmpty(state) && Integer.valueOf(inParkTime) != 0) { if (Integer.valueOf(ticketNum) > Integer.valueOf(inParkTime) || Integer.valueOf(ticketNum) == 0) { ToastUtils.show(TicketVerificationActivity.this, "请输入正确入园次数"); sendMessageInfo(handler, UpdataText); } } } }); ticketQueryTicket.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendMessageInfo(handler,Emptied); String ticketCode = ticketEtTicketCode.getText().toString().trim(); Log.e("门票串码---1", ticketCode + ""); if (TextUtils.isEmpty(ticketCode)) { ToastUtils.show(TicketVerificationActivity.this, "请输入门票串码"); } else { barcode = ticketCode; btn_QueryticketInfo(barcode); } } }); } public void onClick(View view) { int id = view.getId(); if (id == R.id.ticket_et_ticketCode) { ticketEtTicketCode.setHint(""); practicalPersonNum.setHint("请输入园次数"); new KeyboardUtil(getApplicationContext(), TicketVerificationActivity.this, ticketEtTicketCode, R.id.schemas_key_keyboard_view).showKeyboard(); } else if (id == R.id.practical_personNum) { practicalPersonNum.setHint(""); ticketEtTicketCode.setHint("请输入门票串码"); new KeyboardUtil(getApplicationContext(), TicketVerificationActivity.this, practicalPersonNum, R.id.schemas_key_keyboard_view).showKeyboard(); } else if (id == R.id.ticket_img_delete) { practicalPersonNum.setText(""); } else if (id == R.id.ticket_img_deleteCode) { ticketEtTicketCode.setText(""); } else if (id == R.id.ticket_QueryTicket) { String ticketCode = ticketEtTicketCode.getText().toString().trim(); Log.e("门票串码---1", ticketCode + ""); if (TextUtils.isEmpty(ticketCode)) { ToastUtils.show(this, "请输入门票串码"); } else { barcode = ticketCode; btn_QueryticketInfo(barcode); } } else if (id == R.id.ticket_btn_bor) { sendMessageInfo(handler, Scanning); } else if (id == R.id.ticket_btn_comit) { ThreadPoolUtils.runTaskInThread(new Runnable() { @Override public void run() { btn_comit(); } }); } else if (id == R.id.ticket_lv_back) { TicketVerificationActivity.this.startActivity(new Intent(this, MainActivity.class)); finish(); } else if (id == R.id.ticket_img_web) { if (getTicketCode.MEMBER_PHOTO != null) { bitmap = OtherUtils.stringtoBitmap(getTicketCode.MEMBER_PHOTO); buff = Bitmap2Bytes(bitmap); Intent intent = new Intent(TicketVerificationActivity.this, ImgShowActivity.class); intent.putExtra("bitmap", buff); TicketVerificationActivity.this.startActivity(intent); }else { drawable = getResources().getDrawable(R.mipmap.touxiangyonghu_03); bitmap = OtherUtils.drawableToBitmap(drawable); buff = Bitmap2Bytes(bitmap); Intent intent = new Intent(TicketVerificationActivity.this, ImgShowActivity.class); intent.putExtra("bitmap", buff); TicketVerificationActivity.this.startActivity(intent); } } else if (id == R.id.ticket_btn_code) { HttpUtils.showProgressDialog(progressDialog); ThreadPoolUtils.runTaskInThread(new Runnable() { @Override public void run() { DeviceN900(TicketVerificationActivity.this); } }); } } /** * @author zxh * created at 2017/6/7 15:54 * 方法名: Ticket_Verifi 线下门票查询 * 方法说明: 传入二维码 查看当前票是否有效 * "TICKET" */ public void Ticket_Verifi(final String barcode, String Type) { String GetTicketCheck = GsWebServiceUtils.GetTicketCheck(barcode, Type); HttpUtils.exitProgressDialog(progressDialog); Log.e("GetTicketCheck门票信息", GetTicketCheck); if (GetTicketCheck.equals("err")) { sendMessageInfo(handler, Failed, "请求数据失败,请检查网络或者检查配置"); } else { getTicketCode = JSON.parseObject(GetTicketCheck, GetTicketCode.class); if (getTicketCode.FLAG && getTicketCode.TICKETNAME != null) { runOnUiThread(new Runnable() { @Override public void run() { inParkTime = String.valueOf(getTicketCode.getINPARKTIME()); barcode2 = getTicketCode.getBARCODE(); getTicketName = getTicketCode.getTICKETNAME(); startDateTime = getTicketCode.getSTARTDATETIME(); endDateTime = getTicketCode.getENDDATETIME(); ticketName.setText(getTicketName); startTime.setText(startDateTime); ticketType.setText("线下票"); endTime.setText(endDateTime); ticketPersonNum.setText(String.valueOf(getTicketCode.getINPARKTIME())); practicalPersonNum.setText(String.valueOf(getTicketCode.getINPARKTIME())); Log.e("barcode", barcode); if (getTicketCode.MEMBER_PHOTO == null || TextUtils.isEmpty(getTicketCode.MEMBER_PHOTO)) { drawable = getResources().getDrawable(R.mipmap.touxiangyonghu_03); bitmap = OtherUtils.drawableToBitmap(drawable); drawable2 = new BitmapDrawable(bitmap); yearImage.setBackground(drawable2); } else { yearCode_img_lv.setVisibility(View.VISIBLE); bitmap = OtherUtils.stringtoBitmap(getTicketCode.MEMBER_PHOTO); drawable2 = new BitmapDrawable(bitmap); yearImage.setBackground(drawable2); } //可入人数为1并且为有效票 if (1 == getTicketCode.INPARKTIME && "有效票".equals(getTicketCode.SHOWMSG)) { HttpUtils.showProgressDialog(progressDialog); ThreadPoolUtils.runTaskInThread(new Runnable() { @Override public void run() { Ticket_H(barcode2, Integer.valueOf(practicalPersonNum.getText().toString())); } }); } else if (getTicketCode.INPARKTIME > 1) { ticketState.setText("未核销"); ticketState.setTextColor(Color.BLACK); } else if (0 == getTicketCode.INPARKTIME) { ticketState.setText(getTicketCode.SHOWMSG); ticketState.setTextColor(Color.RED); timerTask(); } } }); } else { //线下查询票失败 sendMessageInfo(handler, Failed, getTicketCode.SHOWMSG + "\n查询票信息失败"); } } } /** * @author zxh * created at 2017/6/7 15:54 * 方法名: Ticket_H 线下核销 * 方法说明: 传入二维码 和 入园人数进行核销 */ public void Ticket_H(final String barcode, final int count) { ThreadPoolUtils.runTaskInThread(new Runnable() { @Override public void run() { String ticket_H = GsWebServiceUtils.GetUpdateTicket(barcode, count, "TICKET"); HttpUtils.exitProgressDialog(progressDialog); Log.e("ticket_H门票信息", ticket_H); if (ticket_H.equals("err")) { sendMessageInfo(handler, Failed, "请求数据失败,请检查网络或者检查配置"); } else { getUpadateTicketBean = JSON.parseObject(ticket_H, GetUpadateTicketBean.class); if (getUpadateTicketBean.FLAG) { ThreadPoolUtils.runTaskInUIThread(new Runnable() { @Override public void run() { ticketName.setText(getTicketName); ticketState.setText("已核销"); ticketState.setTextColor(Color.RED); startTime.setText(startDateTime); endTime.setText(endDateTime); ticketPersonNum.setText(inParkTime); practicalPersonNum.setText(String.valueOf(getUpadateTicketBean.DATA)); ticketType.setText("线下票"); String time = getTime(); TpsN900PrintUtils.TpsN900Print_ticket(TicketVerificationActivity.this,"门票核销", "\n门票名称:" + getTicketCode.getTICKETNAME() + "\n门票价格:" + getTicketCode.getTICKETPRICE() + "元" + "\n入园开始日期:" + getTicketCode.getSTARTDATETIME() + "\n入园结束日期:" + getTicketCode.getENDDATETIME() + "\n门票核销日期:" + time + "\n可入园次数:" + getTicketCode.getINPARKTIME() + "次" + "\n实际入园次数:" + count + "\n门票二维码:" , barcode, "温馨提示:此票只作为核销凭证,不可视为报销凭证"); Constant.TicketPintList.clear(); Constant.TicketPintList.add(new TicketPrintBean( time, getTicketCode.getTICKETNAME(), getTicketCode.getTICKETPRICE(), String.valueOf(getTicketCode.getINPARKTIME()), String.valueOf(count), getTicketCode.getSTARTDATETIME(), getTicketCode.getENDDATETIME(),barcode)); if (ticketState.getText().toString().equals("已核销")) { timerTask(); } else if (ticketState.getText().toString().equals("核销失败")) { timerTask(); } } }); } else { ThreadPoolUtils.runTaskInUIThread(new Runnable() { @Override public void run() { ticketState.setText("核销失败"); ticketState.setTextColor(Color.RED); } }); //核销失败 sendMessageInfo(handler, Failed, "核销失败" + getUpadateTicketBean.MSG + "\n请检查网络或者检查配置"); } } } }); } /** * @author zxh * created at 2017/6/7 15:53 * 方法名: GetOByEcode 大平台门票查询 * 方法说明: */ public void GetOByEcode(final String Ecode, final String OrderNo) { try { String f00001409 = GetOverifByEcode(Ecode, OrderNo); Log.e("线上查询信息", f00001409); HttpUtils.exitProgressDialog(progressDialog); if (TextUtils.isEmpty(f00001409) || f00001409.equals("err")) { sendMessageInfo(handler, Failed, "请求数据失败,请检查网络或者检查配置"); } else if (!TextUtils.isEmpty(f00001409) && !f00001409.equals("err")) { getobe = JSON.parseObject(f00001409, GetOverifByEcodeBean.class); if (getobe.Success && getobe.Data != null) { ThreadPoolUtils.runTaskInUIThread(new Runnable() { @Override public void run() { Log.e(TAG, getobe.Message + "正确"); barcode2 = Ecode; inParkTime = getobe.Data.ProductCount; ticketName.setText(getobe.Data.ProductName); startTime.setText(getobe.Data.PlayStartDate); endTime.setText(getobe.Data.PlayEndDate); ticketPersonNum.setText(getobe.Data.ProductCount); practicalPersonNum.setText(getobe.Data.ProductCount); ticketEtTicketCode.setText(Ecode); ticketType.setText("线上票"); if (inParkTime.equals("1")) { HttpUtils.showProgressDialog(progressDialog); ThreadPoolUtils.runTaskInThread(new Runnable() { @Override public void run() { ConTickets(Ecode, inParkTime); } }); } else { ticketState.setText("未核销"); ticketState.setTextColor(Color.BLACK); } } }); } else { //线上查询失败 sendMessageInfo(handler, Failed, getobe.Message + "\n查询票信息失败"); } } } catch (Exception e) { } } /** * @author zxh * created at 2017/6/7 15:53 * 方法名: ConTickets 大平台门票核销 * 方法说明: 传入二维码和人数进行核销 */ public void ConTickets(final String ECode, final String VerifNum) { ThreadPoolUtils.runTaskInThread(new Runnable() { @Override public void run() { try { String consumeTickets = ConsumeTickets(ECode, VerifNum); HttpUtils.exitProgressDialog(progressDialog); if (!TextUtils.isEmpty(consumeTickets)) { if (consumeTickets.equals("err")) { //网络原因或者接口中断 sendMessageInfo(handler, Failed, "请求数据失败,请检查网络或者检查配置"); } else { ticketsBean = JSON.parseObject(consumeTickets, ConsumeTicketsBean.class); if (ticketsBean.Success) { Log.e(TAG, ticketsBean.Message + "正确"); ThreadPoolUtils.runTaskInUIThread(new Runnable() { @Override public void run() { ticketType.setText("线上票"); ticketState.setText("已核销"); ticketState.setTextColor(Color.RED); String time = getTime(); TpsN900PrintUtils.TpsN900Print_ticket(TicketVerificationActivity.this,"门票核销", "\n门票名称:" + getobe.Data.ProductName + "\n门票价格:" + getobe.Data.PrintPrice + "元" + "\n入园开始日期:" + getobe.Data.PlayStartDate + "\n入园结束日期:" + getobe.Data.PlayEndDate + "\n门票核销日期:" + time + "\n可入园次数:" + getobe.Data.ProductCount + "次" + "\n实际入园次数:" + VerifNum + "\n门票二维码:" , ECode, "温馨提示:此票只作为核销凭证,不可视为报销凭证"); Constant.TicketPintList.clear(); Constant.TicketPintList.add(new TicketPrintBean( time, getobe.Data.ProductName, getobe.Data.PrintPrice, getobe.Data.ProductCount, VerifNum, getobe.Data.PlayStartDate, getobe.Data.PlayEndDate,barcode)); if (ticketState.getText().toString().equals("已核销")) { timerTask(); } else if (ticketState.getText().toString().equals("核销失败")) { timerTask(); } } }); } else { Log.e(TAG, "失败了" + ticketsBean.Message); //核销失败 sendMessageInfo(handler, Failed, ticketsBean.Message + "\n核销失败"); } } } Log.e(TAG, "核销信息" + consumeTickets); } catch (Exception e) { } } }); } /** * @author zxh * created at 2017/6/7 15:52 * 方法名: 扫描核销方法 * 方法说明: 扫描到结果进行查询核销 */ @Override protected void onActivityResult(int requestCode, int resultCode, final Intent data) { if (data != null) { barcode = data.getStringExtra("result"); if (!TextUtils.isEmpty(barcode)) { btn_QueryticketInfo(barcode); } return; } else { Toast.makeText(TicketVerificationActivity.this, "扫描结果为空", Toast.LENGTH_LONG).show(); } } /** * @author zxh * created at 2017/6/7 15:50 * 方法名: timerTask * 方法说明: 定时消除字体 */ private void timerTask() { if (mTimer != null) { mTimer.cancel();// 退出之前的mTimer } mTimer = new Timer(); TimerTask timerTask01 = new TimerTask() { @Override public void run() { //清空页面 sendMessageInfo(handler, Emptied); } }; mTimer.schedule(timerTask01, 3000); } //提交数据 public void btn_comit() { TicketVerificationActivity.this.runOnUiThread(new Runnable() { @Override public void run() { if (TextUtils.isEmpty(ticketState.getText().toString().trim())) { ToastUtils.show(TicketVerificationActivity.this, "请先扫描门票"); return; } else if (ticketState.getText().toString().trim().equals("已核销")) { ToastUtils.show(TicketVerificationActivity.this, "请先扫描门票"); return; } else { String ticketNum = practicalPersonNum.getText().toString().trim(); if (TextUtils.isEmpty(ticketNum)) { ToastUtils.show(TicketVerificationActivity.this, "请输入入园次数"); practicalPersonNum.setText(inParkTime); } else if (Integer.valueOf(ticketNum) > Integer.valueOf(inParkTime) || Integer.valueOf(ticketNum) == 0) { ToastUtils.show(TicketVerificationActivity.this, "请输入正确入园次数"); practicalPersonNum.setText(inParkTime); } else { if (barcode.length() >= 24) { runOnUiThread(new Runnable() { @Override public void run() { HttpUtils.showProgressDialog(progressDialog); } }); //线下核销 sendMessageInfo(handler, Offlineverification); } else if (barcode.length() < 24 && barcode.length() > 10) { runOnUiThread(new Runnable() { @Override public void run() { HttpUtils.showProgressDialog(progressDialog); } }); //线上核销 sendMessageInfo(handler, Onlineverification); } else if (barcode.length() < 24 && barcode.length() <= 10) {//线下票 runOnUiThread(new Runnable() { @Override public void run() { HttpUtils.showProgressDialog(progressDialog); } }); //线下核销 sendMessageInfo(handler, Offlineverification); } } } } }); } /** * 根据串码判断是线上票还是线下票 * * @param barcode */ public void btn_QueryticketInfo(final String barcode) { //根据主页面传递过来的二维码判断是否是有效票 if (!TextUtils.isEmpty(barcode)) { if (barcode.length() >= 24) {//大于24位的就是线下票 HttpUtils.showProgressDialog(progressDialog); ThreadPoolUtils.runTaskInThread(new Runnable() { @Override public void run() { Ticket_Verifi(barcode, "TICKET"); } }); } else if (barcode.length() < 24 && barcode.length() > 10) {//小于24位的就是线上票 HttpUtils.showProgressDialog(progressDialog); ThreadPoolUtils.runTaskInThread(new Runnable() { @Override public void run() { GetOByEcode(barcode, ""); if (ticketState.getText().toString().equals("已核销")) { timerTask(); } else if (ticketState.getText().toString().equals("核销失败")) { timerTask(); } } }); } else if (barcode.length() < 24 && barcode.length() <= 10) {//线下票 HttpUtils.showProgressDialog(progressDialog); ThreadPoolUtils.runTaskInThread(new Runnable() { @Override public void run() { Ticket_Verifi(barcode, "MEMBER"); } }); } } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { openActivityAndCloseThis(MainActivity.class); return true; } return super.onKeyDown(keyCode, event); } /** * 读取卡号成功回调 * * @param cardNo 返回卡号 */ @Override public void onReadCardOk(String cardNo) { HttpUtils.exitProgressDialog(progressDialog); barcode = cardNo; btn_QueryticketInfo(cardNo); } }
3cc4519ae82a9ddbacfd2a793d90738f0a668c87
6baf22fbb88f13b0f5527efd0b983a2b00fad824
/src/ArrayedStructures/ArrayedStack.java
ad65aa8effcca1f8abc6a32e0eca61e53a2a2f9c
[]
no_license
drahsansaleem/DataStructures-ADT
c3b19387f55f59f3d828f54f1675bd99db1d8878
029ce909f55c88646f650d4f09a379b87a320be0
refs/heads/main
2023-09-03T02:49:39.118817
2021-03-25T09:56:49
2021-03-25T09:56:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,367
java
package ArrayedStructures; import AbstractDataTypes.ArrayedStructure; import AbstractDataTypes.DataStructure; import AbstractDataTypes.Stack; import util.StructureIterator; import java.util.List; @SuppressWarnings({"unchecked", "CStyleArrayDeclaration", "unused"}) public class ArrayedStack<T> implements Stack<T>, DataStructure, ArrayedStructure<T> { private int size; T[] stack; int top = 0; public ArrayedStack() { stack = (T[]) new Object[1]; } public void clear() { stack = (T[]) new Object[1]; } @Override public StructureIterator<T> toIterator() { return new StructureIterator<>() { @Override public T next() { return null; } @Override public boolean hasNext() { return false; } }; } @Override public List<T> toJavaList() { return null; } public ArrayedStack(int size) { this.size = size; stack = (T[]) new Object[size]; } public void push(T data) { if (size() == size) { expand(); } stack[top] = data; top++; } private void expand() { int length = size(); T newStack[] = (T[]) new Object[size * 2]; System.arraycopy(stack, 0, newStack, 0, length); stack = newStack; size *= 2; } public T pop() { if (isEmpty()) { throw new RuntimeException("ArrayedStack is empty!"); } else { top--; T data = stack[top]; stack[top] = null; shrink(); return data; } } private void shrink() { int length = size(); if (length <= (size / 2) / 2) size = size / 2; T newStack[] = (T[]) new Object[size]; System.arraycopy(stack, 0, newStack, 0, size); stack = newStack; } public T peek() { T data; data = stack[top - 1]; return data; } public void display() { for (Object t : stack) { System.out.println(t); } } public int size() { return top; } public boolean isEmpty() { return top <= 0; } @Override public boolean isFull() { return top==stack.length; } }
[ "Osadkovski" ]
Osadkovski
2f7ff3089d506b448bb81c720d462df714e51373
6193f2aab2b5aba0fcf24c4876cdcb6f19a1be88
/hgzb/src/private/nc/bs/pub/action/N_ZB07_WRITE.java
eda68e833b5297af9a1b3e5b277efe1966f3838b
[]
no_license
uwitec/nc-wandashan
60b5cac6d1837e8e1e4f9fbb1cc3d9959f55992c
98d9a19dc4eb278fa8aa15f120eb6ebd95e35300
refs/heads/master
2016-09-06T12:15:04.634079
2011-11-05T02:29:15
2011-11-05T02:29:15
41,097,642
0
0
null
null
null
null
GB18030
Java
false
false
2,237
java
package nc.bs.pub.action; import java.util.Hashtable; import nc.bs.pub.compiler.AbstractCompiler2; import nc.vo.pub.AggregatedValueObject; import nc.vo.pub.BusinessException; import nc.vo.pub.compiler.PfParameterVO; import nc.vo.trade.pub.HYBillVO; import nc.vo.uap.pf.PFBusinessException; public class N_ZB07_WRITE extends AbstractCompiler2 { private java.util.Hashtable m_methodReturnHas=new java.util.Hashtable(); private Hashtable m_keyHas=null; /** * * 分量调整单保存 * */ public N_ZB07_WRITE() { super(); } /* * 备注:平台编写规则类 * 接口执行类 */ public Object runComClass(PfParameterVO vo) throws BusinessException { try{ super.m_tmpVo=vo; try { super.m_tmpVo = vo; Object retObj = null; AggregatedValueObject billvo = getVo(); Object o = getUserObj(); if(billvo == null){ throw new BusinessException("传入数据为空"); } HYBillVO biddingvo = (HYBillVO)billvo; //只是执行了保存操作 retObj = runClass("nc.bs.zb.pub.HYBillSave", "saveBill","nc.vo.pub.AggregatedValueObject:01", vo, m_keyHas, m_methodReturnHas); return retObj; } catch (Exception ex) { if (ex instanceof BusinessException) throw (BusinessException) ex; else throw new PFBusinessException(ex.getMessage(), ex); } } catch (Exception ex) { if (ex instanceof BusinessException) throw (BusinessException) ex; else throw new PFBusinessException(ex.getMessage(), ex); } } /* * 备注:平台编写原始脚本 */ public String getCodeRemark(){ return null; } // return " try {\n super.m_tmpVo = vo;\n Object retObj = null;\n // 保存即提交\n retObj = runClass(\"nc.bs.gt.pub.HYBillSave\", \"saveBill\",\"nc.vo.pub.AggregatedValueObject:01\", vo, m_keyHas, m_methodReturnHas);\n return retObj;\n } catch (Exception ex) {\n if (ex instanceof BusinessException)\n throw (BusinessException) ex;\n else\n throw new PFBusinessException(ex.getMessage(), ex);\n }\n";} /* * 备注:设置脚本变量的HAS */ private void setParameter(String key,Object val) { if (m_keyHas==null){ m_keyHas=new Hashtable(); } if (val!=null) { m_keyHas.put(key,val); } } }
eaac8a8ecdad12af5ff22c2e87fa3f128271b1bc
3efa417c5668b2e7d1c377c41d976ed31fd26fdc
/src/br/com/mind5/masterData/paymentStatus/info/Paymenus.java
2eab75dda6b0003abb3af5ece0e1b5911f3b2e39
[]
no_license
grazianiborcai/Agenda_WS
4b2656716cc49a413636933665d6ad8b821394ef
e8815a951f76d498eb3379394a54d2aa1655f779
refs/heads/master
2023-05-24T19:39:22.215816
2023-05-15T15:15:15
2023-05-15T15:15:15
109,902,084
0
0
null
2022-06-29T19:44:56
2017-11-07T23:14:21
Java
UTF-8
Java
false
false
322
java
package br.com.mind5.masterData.paymentStatus.info; public enum Paymenus { ACCEPTED("ACCEPTED"), REFUSED("REFUSED"), WAITING("WAITING"); private final String codStatus; private Paymenus(String cod) { codStatus = cod; } public String getCodStatus() { return codStatus; } }
a5bd463bb5c90d30e3d2fcf4918fe0238497b68b
e3e054fc775c012b698ac3ae160183d6b4069c44
/app/src/main/java/com/example/sampah_ku/Dashboard.java
8060e0f8cdb0efba0a609a13feda8c34b092c53a
[]
no_license
denaldipf/Sampah-Ku
1be08bd748c1e8453caafc37391dcba75ac7d4d7
d13cf201d32eb8eb186159c71cb2d2c5124626cc
refs/heads/master
2023-05-03T00:47:01.013339
2021-05-22T16:44:48
2021-05-22T16:44:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.example.sampah_ku; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class Dashboard extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dashboard); } }
d137a87a53509a320374f16d76b0fdd9ab226161
4aa90348abcb2119011728dc067afd501f275374
/app/src/main/java/com/tencent/mm/plugin/game/gamewebview/ui/d$17.java
3c53963a6450f96ee415761b573d17b3ae898858
[]
no_license
jambestwick/HackWechat
0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6
6a34899c8bfd50d19e5a5ec36a58218598172a6b
refs/heads/master
2022-01-27T12:48:43.446804
2021-12-29T10:36:30
2021-12-29T10:36:30
249,366,791
0
0
null
2020-03-23T07:48:32
2020-03-23T07:48:32
null
UTF-8
Java
false
false
455
java
package com.tencent.mm.plugin.game.gamewebview.ui; class d$17 implements Runnable { final /* synthetic */ String iTF; final /* synthetic */ String iXg; final /* synthetic */ d mZC; d$17(d dVar, String str, String str2) { this.mZC = dVar; this.iXg = str; this.iTF = str2; } public final void run() { if (d.n(this.mZC) != null) { d.n(this.mZC).cJ(this.iXg, this.iTF); } } }
88881ebcbbc75b23d1ec614cdf89be1b1f047a6b
3093a2393cc807425404613120ca6f7eabdc61e5
/transaction-demo/src/main/java/com/anhe/pojo/v23mypackage/UploadDocumentReferenceDetail.java
f20d602fe8b6429ce2bc9ae9944b620adf6584c2
[]
no_license
tangyongshuang/practice-parent
928e1505f48bd84a4f8e7eaa28c0e08e617c4d38
ef74210f74f84722ee1220e8f11c9e3614dc98a7
refs/heads/master
2022-06-23T23:34:20.343807
2019-06-19T08:16:47
2019-06-19T08:16:47
190,373,049
0
0
null
2022-06-17T03:25:50
2019-06-05T10:13:58
Java
UTF-8
Java
false
false
6,499
java
package com.anhe.pojo.v23mypackage; import java.math.BigInteger; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; /** * <p>UploadDocumentReferenceDetail complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType name="UploadDocumentReferenceDetail"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="LineNumber" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/> * &lt;element name="CustomerReference" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="DocumentProducer" type="{http://fedex.com/ws/ship/v23}UploadDocumentProducerType" minOccurs="0"/> * &lt;element name="DocumentType" type="{http://fedex.com/ws/ship/v23}UploadDocumentType" minOccurs="0"/> * &lt;element name="DocumentId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="DocumentIdProducer" type="{http://fedex.com/ws/ship/v23}UploadDocumentIdProducer" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "UploadDocumentReferenceDetail", namespace = "http://fedex.com/ws/ship/v23", propOrder = { "lineNumber", "customerReference", "description", "documentProducer", "documentType", "documentId", "documentIdProducer" }) public class UploadDocumentReferenceDetail { @XmlElement(name = "LineNumber", namespace = "http://fedex.com/ws/ship/v23") @XmlSchemaType(name = "nonNegativeInteger") protected BigInteger lineNumber; @XmlElement(name = "CustomerReference", namespace = "http://fedex.com/ws/ship/v23") protected String customerReference; @XmlElement(name = "Description", namespace = "http://fedex.com/ws/ship/v23") protected String description; @XmlElement(name = "DocumentProducer", namespace = "http://fedex.com/ws/ship/v23") @XmlSchemaType(name = "string") protected UploadDocumentProducerType documentProducer; @XmlElement(name = "DocumentType", namespace = "http://fedex.com/ws/ship/v23") @XmlSchemaType(name = "string") protected UploadDocumentType documentType; @XmlElement(name = "DocumentId", namespace = "http://fedex.com/ws/ship/v23") protected String documentId; @XmlElement(name = "DocumentIdProducer", namespace = "http://fedex.com/ws/ship/v23") @XmlSchemaType(name = "string") protected UploadDocumentIdProducer documentIdProducer; /** * 获取lineNumber属性的值。 * * @return * possible object is * {@link BigInteger } * */ public BigInteger getLineNumber() { return lineNumber; } /** * 设置lineNumber属性的值。 * * @param value * allowed object is * {@link BigInteger } * */ public void setLineNumber(BigInteger value) { this.lineNumber = value; } /** * 获取customerReference属性的值。 * * @return * possible object is * {@link String } * */ public String getCustomerReference() { return customerReference; } /** * 设置customerReference属性的值。 * * @param value * allowed object is * {@link String } * */ public void setCustomerReference(String value) { this.customerReference = value; } /** * 获取description属性的值。 * * @return * possible object is * {@link String } * */ public String getDescription() { return description; } /** * 设置description属性的值。 * * @param value * allowed object is * {@link String } * */ public void setDescription(String value) { this.description = value; } /** * 获取documentProducer属性的值。 * * @return * possible object is * {@link UploadDocumentProducerType } * */ public UploadDocumentProducerType getDocumentProducer() { return documentProducer; } /** * 设置documentProducer属性的值。 * * @param value * allowed object is * {@link UploadDocumentProducerType } * */ public void setDocumentProducer(UploadDocumentProducerType value) { this.documentProducer = value; } /** * 获取documentType属性的值。 * * @return * possible object is * {@link UploadDocumentType } * */ public UploadDocumentType getDocumentType() { return documentType; } /** * 设置documentType属性的值。 * * @param value * allowed object is * {@link UploadDocumentType } * */ public void setDocumentType(UploadDocumentType value) { this.documentType = value; } /** * 获取documentId属性的值。 * * @return * possible object is * {@link String } * */ public String getDocumentId() { return documentId; } /** * 设置documentId属性的值。 * * @param value * allowed object is * {@link String } * */ public void setDocumentId(String value) { this.documentId = value; } /** * 获取documentIdProducer属性的值。 * * @return * possible object is * {@link UploadDocumentIdProducer } * */ public UploadDocumentIdProducer getDocumentIdProducer() { return documentIdProducer; } /** * 设置documentIdProducer属性的值。 * * @param value * allowed object is * {@link UploadDocumentIdProducer } * */ public void setDocumentIdProducer(UploadDocumentIdProducer value) { this.documentIdProducer = value; } }
315fb3c628eb71c3692100d7b576c89b05d9ca55
cfcbe9f1d135278d2e682b2e5a75f9aefbf79e69
/java/src/com/caleb/java/juc/ThreadUnsafeExample.java
ec5b47ed70454fcc91fbc374d4db6b3c211d7c4f
[ "Apache-2.0" ]
permissive
huayo65001/JavaDemo
6ba6c19ff50bcbcd1c820e7a77fbaa3bf72ad476
95f4ef8d041e02f6f59bdcf00c2c356127b1c95a
refs/heads/main
2023-09-01T14:30:41.094083
2021-10-24T03:33:00
2021-10-24T03:33:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,037
java
package com.caleb.java.juc; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * @author:hanzhigang * @Date : 2021/3/1 2:49 PM */ public class ThreadUnsafeExample { public static void main(String[] args) throws InterruptedException { final int threadSize = 1000; ThreadErrorTest example = new ThreadErrorTest(); final CountDownLatch countDownLatch = new CountDownLatch(threadSize); ExecutorService executorService = Executors.newCachedThreadPool(); for (int i = 0; i < threadSize; i++) { executorService.execute(() -> { example.add(); countDownLatch.countDown(); }); } countDownLatch.await(); executorService.shutdown(); System.out.println(example.getCnt()); } } class ThreadErrorTest{ private int cnt = 0; public void add(){ cnt++; } public int getCnt() { return cnt; } }
a33535641cee7a60a54b985d8c661bdc6eb1df80
ef5fc1ca0ba16a8e365aa9b493ad46ae27b2ee64
/core/src/org/academiadecodigo/hexaltistas/persistence/dao/UserDao.java
64cb8112d600dcb3176f8a47abb79cc07410a77d
[]
no_license
gui-pinto/Echo
5a842922fcb6844170d73de292f544acf57813de
6762bc97d58f282bc42c2f49adb7fb9daca505bb
refs/heads/master
2020-03-15T00:31:13.440584
2018-04-06T11:58:20
2018-04-06T11:58:20
131,870,881
1
0
null
2018-05-02T15:30:45
2018-05-02T15:30:44
null
UTF-8
Java
false
false
1,895
java
package org.academiadecodigo.hexaltistas.persistence.dao; import org.academiadecodigo.hexaltistas.model.User; import org.academiadecodigo.hexaltistas.persistence.TransactionException; import org.academiadecodigo.hexaltistas.persistence.jpa.JpaSessionManager; import org.hibernate.HibernateException; import javax.persistence.EntityManager; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; import java.util.List; public class UserDao { private JpaSessionManager sm; private User user; public List<User> findAll() { try { EntityManager em = sm.getCurrentSession(); CriteriaQuery<User> criteriaQuery = em.getCriteriaBuilder().createQuery(User.class); Root<User> root = criteriaQuery.from(User.class); return em.createQuery(criteriaQuery).getResultList(); // Using JPQL // return em.createQuery( "from " + modelType.getSimpleName(), modelType).getResultList(); } catch (HibernateException ex) { throw new TransactionException(ex); } } public User findById(Integer id) { try { EntityManager em = sm.getCurrentSession(); return em.find(User.class, id); } catch (HibernateException ex) { throw new TransactionException(ex); } } public User saveOrUpdate(User user) { try { EntityManager em = sm.getCurrentSession(); return em.merge(user); } catch (HibernateException ex) { throw new TransactionException(ex); } } public void delete(Integer id) { try { EntityManager em = sm.getCurrentSession(); em.remove(em.find(User.class, id)); } catch (HibernateException ex) { throw new TransactionException(ex); } } }
648bdbdedd5ef99edc0b897781893af29ef7c105
8e6883fb124e1a42ae786488bf13b8caf5fa9df9
/project/backend/src/main/java/ru/otus/project/service/BatchServiceImpl.java
c5593a7c62872de542aac843e63551fa79867be6
[]
no_license
zubata/2019-09-otus-spring-Zubkov
cedf4eb0ab2f69a7e0460d51a6cbfd8ae219fc7f
58c671320a117ab3c79d4d47fee9170e90a4240f
refs/heads/master
2022-12-04T13:12:01.650907
2020-06-15T22:56:07
2020-06-15T22:56:07
207,668,675
0
0
null
2019-09-11T07:45:24
2019-09-10T21:44:48
Java
UTF-8
Java
false
false
3,376
java
package ru.otus.project.service; import lombok.RequiredArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.launch.JobLauncher; import org.springframework.batch.core.launch.JobOperator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import ru.otus.project.batch.StepProducerConfig; import ru.otus.project.batch.StepVineConfig; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Optional; @Service public class BatchServiceImpl implements BatchService { private final JobLauncher jobLauncher; private final JobOperator jobOperator; private final StepProducerConfig stepProducer; private final StepVineConfig stepVine; private final List<Job> jobs; private List<JobExecution> jobExecutionList; private final Logger log; private final String folderpath; @Autowired public BatchServiceImpl(JobLauncher jobLauncher, JobOperator jobOperator, StepProducerConfig stepProducer, StepVineConfig stepVine, List<Job> jobs, @Value("${batch.file.path}") String folderpath) { this.jobLauncher = jobLauncher; this.jobOperator = jobOperator; this.stepProducer = stepProducer; this.stepVine = stepVine; this.jobs = jobs; jobExecutionList = new ArrayList<>(); log = LoggerFactory.getLogger("BatchService"); this.folderpath = folderpath; } @Override public File saveToCsv(String jobName) { setFileName(folderpath); Optional<Job> job = jobs.stream().filter(s -> s.getName().equals(jobName)).findFirst(); if (job.isPresent()) { try { if (checkJob(jobName, "COMPLETED") != -1) { jobOperator.startNextInstance(jobName); } else { jobExecutionList.add(jobLauncher.run(job.get(), new JobParameters())); } return new File(folderpath + (jobName.equals("vineJob") ? "/Vine.csv" : "/Producer.csv")); } catch (Exception e) { log.error(e.toString()); e.printStackTrace(); } } else { log.info(String.format("Job для %s не найдена", jobName)); } return null; } @Override public void restartJob(String jobName) { long jobId = checkJob(jobName, "FAILED"); try { jobOperator.restart(jobId); } catch (Exception e) { e.printStackTrace(); } } private long checkJob(String jobName, String status) { for (JobExecution je : jobExecutionList) { String tempJobName = je.getJobInstance().getJobName(); String tempStatus = je.getStatus().name(); if (tempJobName.equals(jobName) && tempStatus.equals(status)) { return je.getJobId(); } } return -1; } private void setFileName(String filePath) { stepVine.setResource(filePath + "/Vine.csv"); stepProducer.setResource(filePath + "/Producer.csv"); } }
a98af63f00bbaab44ae7901564c46878a5695f17
66a603509064e876e30c1351dae1e9d35f2b21cc
/spring-core-4.0/org/springframework/core/io/ClassPathResource.java
1c700739b4e0fbead448f81675c4685e233f838e
[ "Apache-2.0" ]
permissive
leogoing/spring_jeesite
4e6d2fc96a028da38058f0c6b6fb13a56f930d0c
c2dc3da3925f089ead933685942dbdb689f14d4b
refs/heads/master
2021-01-21T14:40:13.977630
2016-09-10T14:29:23
2016-09-10T14:29:23
56,330,057
0
0
null
null
null
null
UTF-8
Java
false
false
8,760
java
/* * Copyright 2002-2014 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 org.springframework.core.io; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URL; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; /** * 类路径资源<p> * {@link Resource} implementation for class path resources. * Uses either a given ClassLoader or a given Class for loading resources. * * <p>Supports resolution as {@code java.io.File} if the class path * resource resides in the file system, but not for resources in a JAR. * Always supports resolution as URL. * * @author Juergen Hoeller * @author Sam Brannen * @since 28.12.2003 * @see ClassLoader#getResourceAsStream(String) * @see Class#getResourceAsStream(String) */ public class ClassPathResource extends AbstractFileResolvingResource { private final String path; private ClassLoader classLoader; private Class<?> clazz; /** * Create a new {@code ClassPathResource} for {@code ClassLoader} usage. * A leading slash will be removed, as the ClassLoader resource access * methods will not accept it. * <p>The thread context class loader will be used for * loading the resource. * @param path the absolute path within the class path * @see java.lang.ClassLoader#getResourceAsStream(String) * @see org.springframework.util.ClassUtils#getDefaultClassLoader() */ public ClassPathResource(String path) { this(path, (ClassLoader) null); } /** * Create a new {@code ClassPathResource} for {@code ClassLoader} usage. * A leading slash will be removed, as the ClassLoader resource access * methods will not accept it. * @param path the absolute path within the classpath * @param classLoader the class loader to load the resource with, * or {@code null} for the thread context class loader * @see ClassLoader#getResourceAsStream(String) */ public ClassPathResource(String path, ClassLoader classLoader) { Assert.notNull(path, "Path must not be null"); String pathToUse = StringUtils.cleanPath(path); if (pathToUse.startsWith("/")) { pathToUse = pathToUse.substring(1); } this.path = pathToUse; this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader()); } /** * Create a new {@code ClassPathResource} for {@code Class} usage. * The path can be relative to the given class, or absolute within * the classpath via a leading slash. * @param path relative or absolute path within the class path * @param clazz the class to load resources with * @see java.lang.Class#getResourceAsStream */ public ClassPathResource(String path, Class<?> clazz) { Assert.notNull(path, "Path must not be null"); this.path = StringUtils.cleanPath(path); this.clazz = clazz; } /** * Create a new {@code ClassPathResource} with optional {@code ClassLoader} * and {@code Class}. Only for internal usage. * @param path relative or absolute path within the classpath * @param classLoader the class loader to load the resource with, if any * @param clazz the class to load resources with, if any */ protected ClassPathResource(String path, ClassLoader classLoader, Class<?> clazz) { this.path = StringUtils.cleanPath(path); this.classLoader = classLoader; this.clazz = clazz; } /** * 获取资源路径(无法重写)<p> * Return the path for this resource (as resource path within the class path). */ public final String getPath() { return this.path; } /** * 获取类加载器,为空则获取该类Class对象的类加载器(无法重写)<p> * Return the ClassLoader that this resource will be obtained from. */ public final ClassLoader getClassLoader() { return (this.clazz != null ? this.clazz.getClassLoader() : this.classLoader); } /** * 根据path属性判断URL资源是否存在与classes目录下<p> * This implementation checks for the resolution of a resource URL. * @see java.lang.ClassLoader#getResource(String) * @see java.lang.Class#getResource(String) */ @Override public boolean exists() { return (resolveURL() != null); } /** * 返回classes目录下的path属性标明的文件资源作为URL返回<p> * Resolves a URL for the underlying class path resource. * @return the resolved URL, or {@code null} if not resolvable */ protected URL resolveURL() { if (this.clazz != null) { return this.clazz.getResource(this.path);//返回classes目录下的path文件路径资源 } else if (this.classLoader != null) { return this.classLoader.getResource(this.path);//此时需要path为完成带包名的路径 } else { return ClassLoader.getSystemResource(this.path); } } /** * 返回classes目录下的path属性标明的文件资源转为URL再打开一个连接到这个URL用于读取并返回这个InputStream的连接<p> * This implementation opens an InputStream for the given class path resource. * @see java.lang.ClassLoader#getResourceAsStream(String) * @see java.lang.Class#getResourceAsStream(String) */ @Override public InputStream getInputStream() throws IOException { InputStream is; if (this.clazz != null) { is = this.clazz.getResourceAsStream(this.path); } else if (this.classLoader != null) { is = this.classLoader.getResourceAsStream(this.path); } else { is = ClassLoader.getSystemResourceAsStream(this.path); } if (is == null) { throw new FileNotFoundException(getDescription() + " cannot be opened because it does not exist"); } return is; } /** * 获取类路径下的资源URL<p> * This implementation returns a URL for the underlying class path resource, * if available. * @see java.lang.ClassLoader#getResource(String) * @see java.lang.Class#getResource(String) */ @Override public URL getURL() throws IOException { URL url = resolveURL(); if (url == null) { throw new FileNotFoundException(getDescription() + " cannot be resolved to URL because it does not exist"); } return url; } /** * 在当前资源路径的父级文件夹下并拼接传入路径字符串创建相同资源对象<p> * This implementation creates a ClassPathResource, applying the given path * relative to the path of the underlying resource of this descriptor. * @see org.springframework.util.StringUtils#applyRelativePath(String, String) */ @Override public Resource createRelative(String relativePath) { String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); return new ClassPathResource(pathToUse, this.classLoader, this.clazz); } /** * 获取path属性文件名<p> * This implementation returns the name of the file that this class path * resource refers to. * @see org.springframework.util.StringUtils#getFilename(String) */ @Override public String getFilename() { return StringUtils.getFilename(this.path); } /** * 资源路径描述<p> * This implementation returns a description that includes the class path location. */ @Override public String getDescription() { StringBuilder builder = new StringBuilder("class path resource ["); String pathToUse = path; if (this.clazz != null && !pathToUse.startsWith("/")) { builder.append(ClassUtils.classPackageAsResourcePath(this.clazz)); builder.append('/'); } if (pathToUse.startsWith("/")) { pathToUse = pathToUse.substring(1); } builder.append(pathToUse); builder.append(']'); return builder.toString(); } /** * This implementation compares the underlying class path locations. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof ClassPathResource) { ClassPathResource otherRes = (ClassPathResource) obj; return (this.path.equals(otherRes.path) && ObjectUtils.nullSafeEquals(this.classLoader, otherRes.classLoader) && ObjectUtils.nullSafeEquals(this.clazz, otherRes.clazz)); } return false; } /** * This implementation returns the hash code of the underlying * class path location. */ @Override public int hashCode() { return this.path.hashCode(); } }
2ec80f512ab41e99253d0c8e06e9faef9aac3497
1ef8371658b59f617395869bad526d87611fca60
/OpenCL_Demo/src/main/java/org/openpixi/pixi/physics/solver/relativistic/LeapFrogRelativistic.java
1716477da5b189601d8e3ff7907005c6e9b958e5
[]
no_license
PetcuAlexandru/OpenCL_Demo
8f0f0f7ab225c932c9e3488477743bbca636e08d
6389d6c1cb4ee8df616b9d2be2c3e6fdfc4372fe
refs/heads/master
2020-04-14T15:40:12.051133
2013-05-01T22:18:55
2013-05-01T22:18:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,148
java
/* * OpenPixi - Open Particle-In-Cell (PIC) Simulator * Copyright (C) 2012 OpenPixi.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.openpixi.pixi.physics.solver.relativistic; import org.openpixi.pixi.physics.*; import org.openpixi.pixi.physics.force.Force; import org.openpixi.pixi.physics.solver.Solver; /**This class represents the LeapFrog algorithm and the equations that are used one can be find here: * http://phycomp.technion.ac.il/~david/thesis/node34.html * and also here: * http://www.artcompsci.org/vol_1/v1_web/node34.html#leapfrog-step2 */ public class LeapFrogRelativistic implements Solver{ RelativisticVelocity relvelocity; public LeapFrogRelativistic(double c) { relvelocity = new RelativisticVelocity(c); } /** * LeapFrog algorithm. The damping is implemented with an linear error O(dt). * Warning: the velocity is stored half a time step ahead of the position. * @param p before the update: x(t), u(t+dt/2), a(t); * after the update: x(t+dt), u(t+3*dt/2), a(t+dt) * u(t) is the relativistic momentum */ public void step(Particle p, Force f, double dt) { double gamma = relvelocity.calculateGamma(p); // x(t+dt) = x(t) + c(t+dt/2) * dt / gamma p.setX(p.getX() + p.getVx() * dt / gamma); p.setY(p.getY() + p.getVy() * dt / gamma); // a(t+dt) = F(u(t+dt/2), x(t+dt)) / m // WARNING: Force is evaluated at two different times t+dt/2 and t+dt! p.setAx(f.getForceX(p) / p.getMass()); p.setAy(f.getForceY(p) / p.getMass()); // u(t+3*dt/2) = u(t+dt/2) + a(t+dt)*dt p.setVx(p.getVx() + p.getAx() * dt); p.setVy(p.getVy() + p.getAy() * dt); } /** * prepare method for bringing the velocity in the desired half step * @param p before the update: v(t); * after the update: v(t+dt/2) */ public void prepare(Particle p, Force f, double dt) { //a(t) = F(v(t), x(t)) / m p.setAx(f.getForceX(p) / p.getMass()); p.setAy(f.getForceY(p) / p.getMass()); //v(t + dt / 2) = v(t) + a(t)*dt / 2 p.setVx(p.getVx() + p.getAx() * dt); p.setVy(p.getVy() + p.getAy() * dt); } /** * complete method for bringing the velocity in the desired half step * @param p before the update: v(t+dt/2); * after the update: v(t) */ public void complete(Particle p, Force f, double dt) { //v(t) = v(t + dt / 2) - a(t)*dt / 2 p.setVx(p.getVx() - p.getAx() * dt); p.setVy(p.getVy() - p.getAy() * dt); } }
34ab05454da8da38990e77d189296e88732aa5cd
3d1669572512486a20f829795a4d4585c8e3c88c
/kodilla-patterns2/src/test/java/com/kodilla/patterns2/observer/homework/HomeworkTestSuite.java
72a1ae941887045c5ecab0bbea6a86f97c7310f3
[]
no_license
xmarcel99/kodilla-course
53b889bc58688b644e0b7427a5aa9094b2b86598
0b98643a46dfbc7f76618ae3b2d104534b0106de
refs/heads/master
2020-04-28T15:37:59.330807
2019-09-06T07:11:02
2019-09-06T07:11:02
175,382,070
0
0
null
null
null
null
UTF-8
Java
false
false
942
java
package com.kodilla.patterns2.observer.homework; import org.junit.Assert; import org.junit.Test; public class HomeworkTestSuite { @Test public void testUpdate() { //Given Teacher lincolnBurrows = new Teacher("Lincoln Borrows"); Teacher johnSmith = new Teacher("John Smitch"); Homework michaelScofield = new Homework("Michael Scofield",lincolnBurrows); Homework saraTencredi = new Homework("Sara Tencredi",lincolnBurrows); Homework walterWhite = new Homework("Walter White",johnSmith); //When michaelScofield.addTask("Create first Rest Api Controller"); michaelScofield.addTask("Sending request to diffrent server"); saraTencredi.addTask("For loop"); walterWhite.addTask("AOP - what is it ? "); //Then Assert.assertEquals(3,lincolnBurrows.getUpdateCounter()); Assert.assertEquals(1,johnSmith.getUpdateCounter()); } }
898cf46ab51ad8197afbfd76dfb521c52411373e
3582978b7a13f90ae9e9b42dff3775fa92e4f920
/src/main/java/com/mrs/marketsurveys/dto/UserDTO.java
e911d4feab98d31fdd697ce1db2c7605d2d2a93f
[]
no_license
arharg/marketsurveys
4c352c6922247baf11813f1f588bdc809c80b02b
a5ceef8a62d895be2de2e2edbd987761223c8733
refs/heads/master
2022-03-05T02:29:37.822337
2018-08-01T06:05:22
2018-08-01T06:05:22
212,514,913
0
0
null
null
null
null
UTF-8
Java
false
false
142
java
package com.mrs.marketsurveys.dto; import lombok.Data; public @Data class UserDTO { private String username; private String password; }
e339a3650ee481011b7e616e5dcbc277c051b619
e1ba03ea9a4f7f5b8727db9a415879eb399a206a
/code/android_day0701_homework/src/com/example/android_day0701_venn_homework/fragment/MessageFragment.java
9280a14dca1d797d0de47246a1b604112e53c990
[]
no_license
LloydFinch/MyAndroidCode
65f66ed64a331ca104a8bbdbda41076ef94f1f26
5bee5179d4eaf4f378a6974806ad9b73d4106d12
refs/heads/master
2021-06-20T21:20:38.809106
2017-08-13T02:20:36
2017-08-13T02:20:36
39,632,624
2
0
null
null
null
null
UTF-8
Java
false
false
2,354
java
package com.example.android_day0701_venn_homework.fragment; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import com.example.android_day0701_venn_homework.Adapter.MessageAdapter; import com.example.android_day0701_venn_homework.R; import com.example.android_day0701_venn_homework.contactsTool.ContactsTool; import com.example.android_day0701_venn_homework.entity.Message; import java.util.List; /** * project:com.example.android_day0701_venn_homework.fragment * user:VennUser * date:2015/7/2 */ public class MessageFragment extends Fragment implements AdapterView.OnItemClickListener { private static Context context; private MenuInflater menuInflater; private ListView listView; private MessageAdapter adapter; private List<Message> messageList; public void MessageFragment() { } public static void getContext(Context con) { context = con; } public void onAttach(Activity activity) { super.onAttach(activity); menuInflater = activity.getMenuInflater(); } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_message, container, false); listView = (ListView) view.findViewById(R.id.list_message); messageList= ContactsTool.getMessage(context); adapter = new MessageAdapter(context, messageList); listView.setAdapter(adapter); listView.setOnItemClickListener(this); return view; } public void onItemClick(AdapterView<?> parent, View view, int position, long id) { TextView textView2 = (TextView) view.findViewById(R.id.text_time); String time = textView2.getText().toString(); MesDetailFragment.getContext(context); MesDetailFragment.getMessage(messageList.get(position).getContent(), time); FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.fraglayout, new MesDetailFragment()); transaction.commit(); } }
44004c13b74cb48ddd8961779152b8f00c6c3e17
b77818b29a5f71b2564d01aa491a16a22e74939a
/Spring5-JavaAnnotationssComponent/src/main/java/com/cybertek/services/Java.java
d564f7bc07baa17f0ca282d5810610cc33202551
[]
no_license
karinatech/spring-kd
c51abed2ec52ceef85b8d2bf02041f12a3203479
7a90774606bc6d0da22a650bae15fdad1d8e2e06
refs/heads/main
2023-03-21T10:44:54.180438
2021-02-08T00:24:04
2021-02-08T00:24:04
304,911,117
0
0
null
2021-02-08T00:24:06
2020-10-17T15:41:08
JavaScript
UTF-8
Java
false
false
287
java
package com.cybertek.services; import com.cybertek.interfaces.Course; import org.springframework.stereotype.Component; @Component public class Java implements Course { @Override public void getTeachingHours() { System.out.println("Weekly Teaching Hours : "); } }
2c9f4905eed3d7c92c39d3476fa4d41fa1945c2d
0907c886f81331111e4e116ff0c274f47be71805
/sources/com/mopub/mraid/MraidCommandException.java
c022597eb866a5c4f27f83b0c2871cf43385d183
[ "MIT" ]
permissive
Minionguyjpro/Ghostly-Skills
18756dcdf351032c9af31ec08fdbd02db8f3f991
d1a1fb2498aec461da09deb3ef8d98083542baaf
refs/heads/Android-OS
2022-07-27T19:58:16.442419
2022-04-15T07:49:53
2022-04-15T07:49:53
415,272,874
2
0
MIT
2021-12-21T10:23:50
2021-10-09T10:12:36
Java
UTF-8
Java
false
false
332
java
package com.mopub.mraid; class MraidCommandException extends Exception { MraidCommandException() { } MraidCommandException(String str) { super(str); } MraidCommandException(String str, Throwable th) { super(str, th); } MraidCommandException(Throwable th) { super(th); } }
b9bfba9476e3c01a2be437988beda5c4001002a7
11cc2f89929f73d981194835084ab464c0e7ec73
/src/main/java/com/baldyoung/vita/merchant/service/MBillServiceImpl.java
aa1de95df7790c730bcd85d8dc9c20e8add52111
[]
no_license
baldyoung/vita
a7002995eb6b6141a54f9043e89e3679e2e90bfc
83a03f982e32030d2bab5312dd36d07e761bffc4
refs/heads/master
2022-11-28T15:55:59.522754
2020-06-27T00:09:18
2020-06-27T00:09:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,987
java
package com.baldyoung.vita.merchant.service; import com.baldyoung.vita.common.dao.BillDao; import com.baldyoung.vita.common.dao.DiningRoomDao; import com.baldyoung.vita.common.pojo.dto.bill.MBillDto; import com.baldyoung.vita.common.pojo.dto.order.MOrderDto; import com.baldyoung.vita.common.pojo.dto.orderItem.MOrderItemDto; import com.baldyoung.vita.common.pojo.entity.BillCountInfoEntity; import com.baldyoung.vita.common.pojo.entity.BillEntity; import com.baldyoung.vita.common.pojo.entity.DiningRoomEntity; import com.baldyoung.vita.common.pojo.exception.serviceException.ServiceException; import com.baldyoung.vita.common.service.impl.BillServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.Date; import java.util.LinkedList; import java.util.List; import static com.baldyoung.vita.common.pojo.enums.serviceEnums.ServiceExceptionEnum.BILL_NO_FOUND; import static com.baldyoung.vita.common.pojo.enums.serviceEnums.ServiceExceptionEnum.ILLEGAL_OPERATION; import static com.baldyoung.vita.common.utility.CommonMethod.isEmpty; import static com.baldyoung.vita.common.utility.CommonMethod.isEmptyCollection; @Service public class MBillServiceImpl { @Autowired private BillDao billDao; @Autowired private MOrderServiceImpl mOrderService; @Autowired private BillServiceImpl billService; @Autowired private DiningRoomDao diningRoomDao; /** * 获取指定就餐位的账单详情 * @param roomId * @return */ public MBillDto getBillInfo(Integer roomId) throws ServiceException { String billNumber = billService.getRoomBillNumberWithoutCreate(roomId); if (isEmpty(billNumber)) { throw new ServiceException(BILL_NO_FOUND); } return getBillInfo(billNumber); } /** * 获取指定就餐位的账单详情 * @param billNumber * @return */ public MBillDto getBillInfo(String billNumber) { BillEntity billEntity = billDao.selectBill(billNumber); MBillDto dto = new MBillDto(); dto.setBillCustomerNumber(billEntity.getBillCustomerNumber()); dto.setBillEndDateTime(billEntity.getBillEndDateTime()); dto.setBillId(billEntity.getBillId()); dto.setBillNumber(billEntity.getBillNumber()); dto.setBillOrderQuantity(billEntity.getBillOrderQuantity()); dto.setBillOwnerId(billEntity.getBillOwnerId()); dto.setBillOwnerName(billEntity.getBillOwnerName()); dto.setBillOwnerTypeFlag(billEntity.getBillOwnerTypeFlag()); dto.setBillReceivedAmount(billEntity.getBillReceivedAmount()); dto.setBillReceivedDateTime(billEntity.getBillReceivedDateTime()); dto.setBillRecentHandlerId(billEntity.getBillRecentHandlerId()); dto.setBillRecentHandlerName(billEntity.getBillRecentHandlerName()); dto.setBillRemarks(billEntity.getBillRemarks()); dto.setBillStartDateTime(billEntity.getBillStartDateTime()); dto.setBillTotalAmount(billEntity.getBillTotalAmount()); dto.setBillCustomerName(billEntity.getBillCustomerName()); dto.setOrderList(mOrderService.getAllOrderInRoom(billNumber)); return dto; } /** * 修改帐单信息 * @param entity */ public void updateBillInfo (BillEntity entity) { billDao.updateBillEntity(entity); } /** * 账单结账 * @param billNumber * @param totalAmount * @param receiveAmount */ public void settleAccount (String billNumber, BigDecimal totalAmount, BigDecimal receiveAmount, String remarks) throws ServiceException { BillEntity bill = billDao.selectBill(billNumber); if (null == bill || null == bill.getBillId()) { return; } Date newDate = new Date(); BillEntity newBill = new BillEntity(); newBill.setBillId(bill.getBillId()); if (null == bill.getBillTotalAmount() || (0 == bill.getBillTotalAmount().compareTo(new BigDecimal(0))) ) { newBill.setBillTotalAmount(totalAmount); } if (null != bill.getBillReceivedAmount()) { throw new ServiceException(ILLEGAL_OPERATION); } newBill.setBillReceivedAmount(receiveAmount); newBill.setBillEndDateTime(newDate); if (null != receiveAmount) { newBill.setBillReceivedDateTime(newDate); } newBill.setBillRemarks(remarks); billDao.updateBillEntity(newBill); DiningRoomEntity room = new DiningRoomEntity(); room.setDiningRoomId(bill.getBillOwnerId()); room.setCurrentBillNumber(""); diningRoomDao.updateDiningRoom(room); billService.deleteBillNumberBuffer(bill.getBillOwnerId()); setAllProductItemToFinish(billNumber); } /** * 统计指定条件下的账单数量 * @param diningRoomName * @param zeroFlag * @param unPay * @param finishFlag * @return */ public Integer getBillNumberWithCondition(String diningRoomName, Boolean zeroFlag, Boolean unPay, Boolean finishFlag) { return billDao.countWithCondition(diningRoomName, zeroFlag, unPay, finishFlag); } /** * 筛选符合条件的账单 * @param diningRoomName * @param zeroFlag * @param unPay * @param finishFlag * @param startIndex * @param maxSize * @return */ public List<BillEntity> getBillListWithCondition(String diningRoomName, Boolean zeroFlag, Boolean unPay, Boolean finishFlag, Integer startIndex, Integer maxSize) { List<BillEntity> result = billDao.selectWithCondition(diningRoomName, zeroFlag, unPay, finishFlag, startIndex, maxSize); return result; } /** * 获取当前所有账单的统计情况 * @return */ public BillCountInfoEntity getBillCountInfo() { BillCountInfoEntity entity = billDao.countAllBillCountInfo(); BillCountInfoEntity temp = billDao.countZeroBillNumber(); entity.setZeroBillNumber(temp.getZeroBillNumber()); temp = billDao.countUnPayBillCountInfo(); entity.setUnPayBillNumber(temp.getUnPayBillNumber()); entity.setTotalUnReceive(temp.getTotalUnReceive()); return entity; } /** * 将指定账单下所有未完成的商品项设置为已完成 * @param billNumber */ public void setAllProductItemToFinish(String billNumber) { List<MOrderDto> orderList = mOrderService.getAllOrderInRoom(billNumber); if (isEmptyCollection(orderList)) { return; } List<Integer> orderProductItemIdList = new LinkedList(); for (MOrderDto order : orderList) { List<MOrderItemDto> itemList = order.getItemList(); if (isEmptyCollection(itemList)) { continue; } for (MOrderItemDto item : itemList) { if (item.getOrderProductItemStatusFlag() == null) { continue; } int status = item.getOrderProductItemStatusFlag().intValue(); // 收集状态为“待确定”和“待发货”的商品项编号 if (0 == status || 2 == status) { orderProductItemIdList.add(item.getOrderProductItemId()); } } } if (!isEmptyCollection(orderProductItemIdList)) { mOrderService.setOrderProductItemToFinish(orderProductItemIdList); } } }
c4968af63940f70f1d045db207522cb14640c006
89658d5dd81a87be6a072942f4c95e5a0cd05487
/java-Deignpattern/src/com/aravinthrajchakkaravarthy/creationaldesignpattern/factorypatteren/AreaOfShapes.java
93fa44c47d5cc57480fdeb6b9308123cb0e7be19
[ "MIT" ]
permissive
586083/java-Design-pattern
ce89bb348c99612496add8818c0e3006908e986d
3b2bf0631e0106d28748d15cecb16281b87b662f
refs/heads/master
2022-10-06T12:26:57.229981
2020-06-11T12:35:22
2020-06-11T12:35:22
268,429,880
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.aravinthrajchakkaravarthy.creationaldesignpattern.factorypatteren; /** * Abstract Method which is used for create of object * * */ public abstract class AreaOfShapes { abstract void printAreaFormulae(); public AreaOfShapes() { System.out.println("In Area of Shapes"); } }
72c3e538fbcae24252fc4deeaa0066fdec978cc4
204dad31a76c313963ae88a955a5e0901ecc8154
/app/src/main/java/reclamation/dev/com/reclamation20/MapActivity.java
4b163769613a8bc82e4679eed2e21edd2b7c03d3
[]
no_license
ahmedhamzaoui/Reclamation2.0
67be077842379502d02ba61937f08cbce84fd653
7ff2f674de39adb645976a36949194edcdb106ce
refs/heads/master
2020-04-17T01:02:24.673231
2019-01-18T05:40:58
2019-01-18T05:40:58
166,073,109
0
0
null
null
null
null
UTF-8
Java
false
false
10,158
java
package reclamation.dev.com.reclamation20; import android.location.Location; import android.os.Bundle; import android.os.PersistableBundle; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.mapbox.android.core.location.LocationEngine; import com.mapbox.android.core.location.LocationEngineListener; import com.mapbox.android.core.location.LocationEnginePriority; import com.mapbox.android.core.location.LocationEngineProvider; import com.mapbox.android.core.permissions.PermissionsListener; import com.mapbox.android.core.permissions.PermissionsManager; import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin; import com.mapbox.mapboxsdk.plugins.locationlayer.modes.CameraMode; import com.mapbox.mapboxsdk.plugins.locationlayer.modes.RenderMode; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; import reclamation.dev.com.reclamation20.MyModels.Post; import reclamation.dev.com.reclamation20.Utils.ButtomNavigationHelper; public class MapActivity extends AppCompatActivity implements OnMapReadyCallback, LocationEngineListener, PermissionsListener, MapboxMap.OnMapClickListener{ BottomNavigationView navigation; private static final int ACTIVITY_NUM = 1; private MapView mapView; private MapboxMap map; private PermissionsManager permissionsManager; private LocationEngine locationEngine; private LocationLayerPlugin locationLayerPlugin; private Location originLocation; private Point originPosition; private Marker destinationMarker; ArrayList<Post> posts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); navigation = (BottomNavigationView) findViewById(R.id.bottomNavViewBar); ButtomNavigationHelper.setupButtomNavigationView(navigation); ButtomNavigationHelper.enableNavigation(MapActivity.this, this, navigation); Menu menu = navigation.getMenu(); MenuItem menuItem = menu.getItem(ACTIVITY_NUM); menuItem.setChecked(true); Mapbox.getInstance(this, getString(R.string.access_token)); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); getPosts(); } @Override public void onMapReady(MapboxMap mapboxMap) { map = mapboxMap; map.addOnMapClickListener(this); enableLocation(); initializeLocationLayer(); } private void enableLocation(){ if(PermissionsManager.areLocationPermissionsGranted(this)){ //do stuff initializeLocationEngine(); initializeLocationLayer(); }else { permissionsManager = new PermissionsManager(this); permissionsManager.requestLocationPermissions(this); } } @SuppressWarnings("MissingPermission") private void initializeLocationEngine(){ locationEngine = new LocationEngineProvider(this).obtainBestLocationEngineAvailable(); locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY); locationEngine.activate(); Location lastLocation = locationEngine.getLastLocation(); if(lastLocation != null){ originLocation = lastLocation; setCameraPosition(lastLocation); }else { locationEngine.addLocationEngineListener(this); } } @SuppressWarnings("MissingPermission") private void initializeLocationLayer(){ locationLayerPlugin = new LocationLayerPlugin(mapView, map, locationEngine); locationLayerPlugin.setLocationLayerEnabled(true); locationLayerPlugin.setCameraMode(CameraMode.TRACKING); locationLayerPlugin.setRenderMode(RenderMode.NORMAL); } private void setCameraPosition(Location location){ map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()),13.0)); } @Override @SuppressWarnings("MissingPermission") public void onConnected() { locationEngine.requestLocationUpdates(); } @Override public void onLocationChanged(Location location) { if(location != null){ originLocation = location; setCameraPosition(location); } } @Override public void onExplanationNeeded(List<String> permissionsToExplain) { } @Override public void onPermissionResult(boolean granted) { if(granted){ enableLocation(); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults); } @Override @SuppressWarnings("MissingPermission") protected void onStart() { super.onStart(); if(locationEngine != null){ locationEngine.removeLocationUpdates(); } if(locationLayerPlugin != null){ locationLayerPlugin.onStart(); } mapView.onStart(); } @Override protected void onResume() { super.onResume(); mapView.onResume(); } @Override protected void onPause() { super.onPause(); mapView.onPause(); } @Override protected void onStop() { super.onStop(); if(locationEngine != null){ locationEngine.removeLocationUpdates(); } if(locationLayerPlugin != null){ locationLayerPlugin.onStop(); } mapView.onStop(); } @Override public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) { super.onSaveInstanceState(outState, outPersistentState); mapView.onSaveInstanceState(outState); } @Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); } @Override protected void onDestroy() { super.onDestroy(); if(locationEngine != null){ locationEngine.deactivate(); } mapView.onDestroy(); } @Override public void onMapClick(@NonNull LatLng point) { //destinationMarker = map.addMarker(new MarkerOptions().position(point)); //originPosition = Point.fromLngLat(originLocation.getLongitude(), originLocation.getLatitude()); } private void getPosts(){ posts = new ArrayList<>(); RequestQueue mQueue = Volley.newRequestQueue(MapActivity.this); StringRequest stringRequest = new StringRequest( Request.Method.GET, Constants.URL_PUBLICATIONS, new Response.Listener<String>() { @Override public void onResponse(String response) { System.out.println("response "+response); try { JSONArray jsonArray = new JSONArray(response); for(int i=0;i<jsonArray.length();i++){ Post post = new Post(); post.setDescription(((JSONObject)jsonArray.get(i)).get("description").toString()); post.setTag(((JSONObject)jsonArray.get(i)).get("tag").toString()); post.setTitre(((JSONObject)jsonArray.get(i)).get("titre").toString()); post.setUserid(Integer.parseInt(((JSONObject)jsonArray.get(i)).get("userid").toString())); post.setLat(Double.parseDouble(((JSONObject)jsonArray.get(i)).get("lat").toString())); post.setLng(Double.parseDouble(((JSONObject)jsonArray.get(i)).get("lng").toString())); //System.out.println("publication "+ publication); System.out.println(post); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { Marker marker = mapboxMap.addMarker(new MarkerOptions() .position(new LatLng((post.getLat()), post.getLng())) .title(post.getTitre()) .snippet(post.getTag())); } }); posts.add(post); } System.out.println("publicationList "+posts); } catch (JSONException e) { e.printStackTrace(); } } } , new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { System.out.println("That didn't work ! " + error); } }); RequestQueue queue = Volley.newRequestQueue(MapActivity.this); queue.add(stringRequest); } }
35bdfb840a21bbb8da78a1b3a8e478684fabcc9b
b8dbb2575b0bc06056acf739ddec0d258cf28227
/src/gravitacija/Prepreke.java
0addf61996d286bd8c204bd8fc0e1376186ae882
[ "MIT" ]
permissive
Emenghost/GSwitch
d9cfc4d78f5d5d5e91f546dfb086135f57a01a7e
2973288a2704e58f39b77d0d6892c7865c0f455d
refs/heads/master
2023-03-15T23:46:46.029717
2017-12-14T09:47:28
2017-12-14T09:47:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,710
java
package gravitacija; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; public class Prepreke { /* konstruktor */ public Prepreke(int pozicija){ vidljiva = true; this.pozicija = pozicija; } /* slika donju prepreku */ public void slikajdole(Graphics g){ if(vidljiva) g.drawImage(donjaPrepreka,pozicija,koordinataDonje,sirinaPrepreke,visinaPrepreke,null); } /* slika gornju prepreku */ public void slikajgore(Graphics g){ if(vidljiva) g.drawImage(gornjaPrepreka,pozicija,koordinataGornje,sirinaPrepreke,visinaPrepreke,null); } /* pomera prepreku po "X" koordinatama */ public void pomeriPrepreku(){ this.pozicija--; if(pozicija == -40) vidljiva = false; } /*Geteri i Seteri*/ public int getPozicija() { return pozicija; } public void setPozicija(int pozicija) { this.pozicija = pozicija; } public boolean isVidljiva() { return vidljiva; } public void setVidljiva(boolean vidljiva) { this.vidljiva = vidljiva; } private int pozicija; // Pozicija prepreke protected Image donjaPrepreka = Toolkit.getDefaultToolkit().getImage("slike/prepreke/donja.gif"); // Slika donje prepreke protected Image gornjaPrepreka = Toolkit.getDefaultToolkit().getImage("slike/prepreke/gornja.gif"); // Slika gornje prepreke private final int koordinataDonje = 350; // "Y" donje koordinata prepreke private final int koordinataGornje = 150; // "Y" gornje koordinata prepreke private final int sirinaPrepreke = 40; // Sirina prepreke private final int visinaPrepreke = 40; // Visina prepreke private boolean vidljiva; // Da li je vidjiva }
0c414f5e084642120d12612decc7448b82c0f7ce
d1195c8554762cba6a7a5aaa801ca25b31080858
/src/main/java/com/poly/service/ReportService.java
d1704a3d11927112cd53738b32e68b2a31bdd716
[]
no_license
GoalShop/GoalShop-1
b8b556a7e1678d4a0f1866b8448e3e0ce7b47a79
643e0da373061cd42f60db3624e8bda5821fbad1
refs/heads/main
2023-08-19T19:17:41.616706
2021-10-30T08:07:36
2021-10-30T08:07:36
413,252,706
0
0
null
null
null
null
UTF-8
Java
false
false
508
java
package com.poly.service; import java.util.Date; import java.util.List; import com.poly.entity.ReportCategory; import com.poly.entity.ReportProductbyDay; import com.poly.entity.ReportTrademark; public interface ReportService { List<ReportCategory> getReportCategory() ; List<ReportProductbyDay> getReportProductbyDaynoMinMax(); List<ReportProductbyDay> getReportProductbyDayMinMax(Date minday , Date maxday); List<ReportCategory> revenueByMonth(); List<ReportTrademark> getReportTrademark(); }
6dd3f7c1acc41e22643e9ce46405206b66929af9
4d3f389f4fbb8391bae0264dee39e5fa99bf1b91
/src/DemoAndroidpn.java
69ab4b036e76dd5636d4f85fe4e8d2f52d7c1286
[]
no_license
CallMeSp/M_Push_server
634aad9d1840a24beed107d176c73f982f5b8221
fc1f8fcc62ed0fbd2d4c8f3e22ba9d55e5e1addc
refs/heads/master
2021-01-17T21:20:55.730014
2017-04-06T15:44:29
2017-04-06T15:49:21
84,176,333
1
2
null
null
null
null
UTF-8
Java
false
false
627
java
import org.androidpn.server.xmpp.push.NotificationManager; // // DemoAndroidpn.java // FeOA // // Created by LuTH on 2012-3-26. // Copyright 2012 flyrise. All rights reserved. // public class DemoAndroidpn { public static void main(String[] args) { String apiKey = "1234567890"; String title = "feoa"; String message = "Hello World!"; String uri = "http://www.baidu.com"; NotificationManager notificationManager = new NotificationManager(); //notificationManager.sendBroadcast(apiKey, title, message, uri); // notificationManager.sendNotifcationToUser(apiKey, username, title, // message, uri); } }
8bcf5fbe5956c69543521003dc9d3b587cc5964b
c0930ffdd17da708eb70113a428258537e350cc5
/RECUPERACION/Programacion/Ficheros/B2/src/v1/Main.java
f659a68e67433cf2a68fcb4308386dbb24dc62a2
[]
no_license
fartorr0810/Clases1DawB
d1a4b4ec9ba4e1838937648c9b858e742b8b7454
8bc23913afbd4d464cab8bde61f480cf69b3ac72
refs/heads/master
2023-06-03T01:56:59.406771
2021-06-18T08:34:24
2021-06-18T08:34:24
302,466,497
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
package v1; public class Main { public static void main(String[] args) { try { cargarDatos(".\\ficheros\\gratuidadlibrosdetextoandalucia.csv"); } catch (Exception e) { System.out.println(e.getMessage()); } } }
[ "xXxArroyoxXx" ]
xXxArroyoxXx
36b2f3ca695e7e1f3e3610f1df0097d777a1133d
8638a2efe2168eaa536bd89ca5f6b87927d17118
/Atcoder/ABC60/RandomGenerator/Main.java
e5ecc9656f26c6d9f3d741f79dbf6bd2c09e89f5
[]
no_license
Simply-divine/Competitive
5c5e6418ddaceb8fae3c643a2e120b23a256b67c
0a7e720322a57fd95cff0d796640ac69a6f45cdc
refs/heads/master
2022-12-26T21:32:04.483818
2020-04-18T15:52:40
2020-04-18T15:52:40
256,789,554
1
1
null
2020-10-01T06:37:57
2020-04-18T15:37:30
C++
UTF-8
Java
false
false
959
java
import java.io.*; import java.util.*; public class Main{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ try{ while(st==null||!st.hasMoreElements()){ st = new StringTokenizer(br.readLine()); } }catch(Exception e){ e.printStackTrace(); } return st.nextToken(); } public int nextInt(){ return Integer.parseInt(next()); } public long nextLong(){ return Long.parseLong(next()); } public double nextDouble(){ return Double.parseDouble(next()); } public String nextLine(){ String s = ""; try{ s = br.readLine(); }catch(Exception e){ e.printStackTrace(); } return s; } } public static void main(String[] args){ FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); out.flush(); out.close(); } }
9f4628b342dca107994401b94d265df3cd7b5794
bdefe06b209dc7dbf8844ecb86d636a33a5d6337
/erx-00d198182586de6f5c556aad995383d13c79bd5f/erx.git/eRX-Model/src/com/walgreens/pharmacy/rules/ResultType.java
2e8a4273163df9d2b3520ca4d46f0a0a2eeb894c
[]
no_license
tanickel/eRx
e0758713834a00ce8a55f053839d1c0ae95b6e4a
432281c1c9f0e790c75dde0cfb2946ce94ff1dfc
refs/heads/master
2021-01-22T23:48:56.938872
2014-09-07T13:38:43
2014-09-07T13:38:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package com.walgreens.pharmacy.rules; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; @XmlType(name = "ResultType") @XmlEnum public enum ResultType { COMPLETE, MANUAL, IN_PROGRESS; public String value() { return name(); } public static ResultType fromValue(String v) { return valueOf(v); } }
d6e7548391a3b22189eb3f419b3a0137a5a1d134
a33aac97878b2cb15677be26e308cbc46e2862d2
/data/libgdx/Touchpad_setResetOnTouchUp.java
9a45e80fd7d0efbd0b9dcdbda4765101290dffe0
[]
no_license
GabeOchieng/ggnn.tensorflow
f5d7d0bca52258336fc12c9de6ae38223f28f786
7c62c0e8427bea6c8bec2cebf157b6f1ea70a213
refs/heads/master
2022-05-30T11:17:42.278048
2020-05-02T11:33:31
2020-05-02T11:33:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
159
java
/** * @param reset Whether to reset the knob to the center on touch up. */ public void setResetOnTouchUp(boolean reset) { this.resetOnTouchUp = reset; }
6254716c471b7dbfd5de186336d5af6c15a546dc
687c566d7be328cb5db50ed1109bf1400cb3e5fb
/spring-boot-hbase/src/main/java/com/newtouch/work/common/JsonResult.java
029308bf7454865aa35fac84d7ce0819cffd63bf
[]
no_license
yepengfei2020/springboot-study
0e3ca335a561574e18e3b40f4b6150263ae820c9
b41a5f7601b7a5162cd9b01677b1703e050648f0
refs/heads/master
2023-04-14T05:41:26.816104
2021-04-15T08:30:11
2021-04-15T08:30:11
285,528,803
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package com.newtouch.work.common; import lombok.AllArgsConstructor; import lombok.Data; import java.io.Serializable; /** * @program: JsonResult * @description: 格式化回参 * @author: yepengfei * @create: 2021/3/19、9:46 * @Version 1.0 **/ @Data @AllArgsConstructor public class JsonResult<T> implements Serializable { private boolean status; // 状态码 private String message; // 提示信息 private T result; // 返回结果 }
cb5f23002a6efa438c465b764ea2eb74345f8420
83cd57de03e311569f3fcc82b64c0fbce9628603
/proto-google-common-protos/src/main/java/com/google/api/ResourceOrBuilder.java
4f01229e9fbed3ee0c70ac67bb213df1afe3bc41
[ "Apache-2.0", "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-generic-cla" ]
permissive
michaelbausor/common-protos-java
8c4bc1656afc119af3141f4d1f46a642738da584
dcabdd777225dd60ec1464f7137b99b007e7863a
refs/heads/master
2020-05-15T12:56:35.533136
2019-04-04T03:44:41
2019-04-04T03:44:41
182,283,613
0
0
Apache-2.0
2019-04-19T15:13:41
2019-04-19T15:13:40
null
UTF-8
Java
false
true
1,952
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/api/resource.proto package com.google.api; public interface ResourceOrBuilder extends // @@protoc_insertion_point(interface_extends:google.api.Resource) com.google.protobuf.MessageOrBuilder { /** * <pre> * Required. The resource's name template. * Examples: * - "projects/{project}/topics/{topic}" * - "projects/{project}/knowledgeBases/{knowledge_base}" * </pre> * * <code>string pattern = 1;</code> */ java.lang.String getPattern(); /** * <pre> * Required. The resource's name template. * Examples: * - "projects/{project}/topics/{topic}" * - "projects/{project}/knowledgeBases/{knowledge_base}" * </pre> * * <code>string pattern = 1;</code> */ com.google.protobuf.ByteString getPatternBytes(); /** * <pre> * The name that should be used in code to describe the resource, * in PascalCase. * If omitted, this is inferred from the name of the message. * This is required if the resource is being defined without the context * of a message (see `resource_definition`, below). * Example: * option (google.api.resource_definition) = { * pattern: "projects/{project}" * symbol: "Project" * }; * </pre> * * <code>string symbol = 2;</code> */ java.lang.String getSymbol(); /** * <pre> * The name that should be used in code to describe the resource, * in PascalCase. * If omitted, this is inferred from the name of the message. * This is required if the resource is being defined without the context * of a message (see `resource_definition`, below). * Example: * option (google.api.resource_definition) = { * pattern: "projects/{project}" * symbol: "Project" * }; * </pre> * * <code>string symbol = 2;</code> */ com.google.protobuf.ByteString getSymbolBytes(); }
2f360b20e66d0d27bcc6481fda926bdeac02e847
55de95d91949317699659cd2c11bbfc921ed11a5
/design-patterns/src/main/java/com/cui/behavior/ovserver/Clients.java
f875db650174a3b73b905d5e420fa5c29e59cd3f
[ "Apache-2.0" ]
permissive
Common-zhou/wang-wen-jun
b4d9e30f5112ceeb88de445cb13117cb0f208d8e
c76aa1f276ec97ac551928c6bb1e7e3b1abb83d9
refs/heads/master
2023-08-17T18:58:47.476291
2021-09-17T08:47:25
2021-09-17T08:47:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.cui.behavior.ovserver; /** * @description: 客户端测试 * @date: 2020/7/18 21:48 * @author: wei·man cui */ public class Clients { public static void main(String[] args) { //定义观察目标对象 AllyControlCenter acc; acc = new ConcreteAllyControlCenter("金庸群侠"); //定义四个观察者对象 Observer player1, player2, player3, player4; player1 = new Player("杨过"); acc.join(player1); player2 = new Player("令狐冲"); acc.join(player2); player3 = new Player("张无忌"); acc.join(player3); player4 = new Player("段誉"); acc.join(player4); //某成员遭受攻击 player1.beAttacked(acc); } }
b30801375284c1b194357725b1eee47feef3f348
6654423f2d38204cbe86e05957d0012be8dd5073
/3- Strategy Design Pattern/src/Dog.java
7bf520085235aa3df1e3fcdd1b4888a411deaf39
[]
no_license
musichopin/Derek-Banas_Design-Patterns
110cc5cfe1af595a247dcd286bf8875cfe046ac1
d3561a613356b75a85261698d5c3cac6939e2a57
refs/heads/master
2021-01-16T21:03:56.294873
2019-02-13T20:09:35
2019-02-13T20:09:35
59,821,814
1
1
null
null
null
null
UTF-8
Java
false
false
751
java
public class Dog extends Animal{ public void digHole(){ System.out.println("Dug a hole"); } public Dog(){ super(); setSound("Bark"); // We set the Flys interface polymorphically // This sets the behavior as a non-flying Animal flyingType = new CantFly(); // polymorphism } /* BAD * You could override the fly method, but we are breaking * the rule that we need to abstract what is different to * the subclasses. we need to continue to abstract out what * is different and put just those things that are different * inside of the classes. public void fly(){ System.out.println("I can't fly"); } *It would be also wrong to implement abstract fly method *for creating duplicates */ }
2b239263993a596e3bc68164527c9f9e7f7b3a6c
be994f700995a7e3a809509a2af46cadd01aafb4
/app/src/main/java/com/kinga/meritraknare_material/ChooseProgramActivity.java
a7b25847aeb866211b5565b476063f4bd59f5763
[]
no_license
abdusalamApps/MeritRaknareMaterial
1996c4ca4fcc76692169d4be4cd53819797c91b7
7d008a0437b0f2b0a88c4a418653e1338a8e3572
refs/heads/master
2020-04-18T23:12:09.220717
2019-01-27T14:01:56
2019-01-27T14:01:56
167,815,320
0
0
null
null
null
null
UTF-8
Java
false
false
3,843
java
package com.kinga.meritraknare_material; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.ArrayList; public class ChooseProgramActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_choose_program); ListView listView = findViewById(R.id.program_listView); ArrayList<String> programs = new ArrayList<>(); programs.add(getString(R.string.ekonomiprogrammet)); programs.add(getString(R.string.estetiska_programmet)); programs.add(getString(R.string.humanistiska_programmet)); programs.add(getString(R.string.international_baccalaureate)); programs.add(getString(R.string.naturvetenskapsprogrammet)); programs.add(getString(R.string.samhallskunskapsprogrammet)); programs.add(getString(R.string.teknikprogrammet)); /* programs.add("Barn- och fritidsprogrammet"); programs.add("Bygg- och anläggningsprogrammet"); programs.add("El- och energiprogrammet"); programs.add("Fordons- och transportprogrammet"); programs.add("Handels- och administrationsprogrammet"); programs.add("Handels- och administrationsprogrammet"); programs.add("Hotell- och turismprogrammet"); programs.add("Industritekniska programmet"); programs.add("Estetiska programmet"); programs.add("Humanistiska programmet"); programs.add("International Baccalaureate"); programs.add("Naturvetenskapsprogrammet"); programs.add("Samhällsvetenskapsprogrammet"); programs.add("Teknikprogrammet");*/ ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, programs); listView.setAdapter(arrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { Intent intent = new Intent(ChooseProgramActivity.this, WelcomeActivity.class); intent.setData(Uri.parse("from chooseprogramactivity")); int programInt; switch (position){ case 0: programInt = Constants.ProgramsInts.EKONOMI; break; case 1: programInt = Constants.ProgramsInts.ESTETISK; break; case 2: programInt = Constants.ProgramsInts.HUMANISTISK; break; case 3: programInt = Constants.ProgramsInts.INTERNATIONAL; break; case 4: programInt = Constants.ProgramsInts.NATUR; break; case 5: programInt = Constants.ProgramsInts.SAMHALL; break; case 6: programInt = Constants.ProgramsInts.TEKNIK; break; default: programInt = Constants.ProgramsInts.EKONOMI; } intent.putExtra("program", programInt); startActivity(intent); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } }); } }
31ecbd56bb519875e4eff002362150c8906fdaad
06a06a75c59c516db98fe929417f9c4684e85ca3
/app/src/main/java/com/example/android/musicalstructure/MainActivity.java
4361da0f50595cbb474202c00ef5ef1f20abbd3b
[]
no_license
lenardmulholland/MusicalStructure
3e996195e60ee704a630a8563fb2559957d2dbbc
02b724e51db30ea0ce952fd963ff28708082ee13
refs/heads/master
2020-03-20T18:58:10.987145
2018-06-16T22:23:02
2018-06-16T22:23:02
137,613,941
1
0
null
null
null
null
UTF-8
Java
false
false
3,235
java
package com.example.android.musicalstructure; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ArrayList<Song> songs = new ArrayList<>(); songs.add(new Song("Moonlight Sonata", "Ludwig van Beethoven", "7:27")); songs.add(new Song("Für Elise", "Ludwig van Beethoven", "3:04")); songs.add(new Song("5th Symphony", "Ludwig van Beethoven", "7:43")); songs.add(new Song("Eine Kleine Nachtmusik", "Wolfgang Amadeus Mozzart", "5:42")); songs.add(new Song("Turkish March", "Wolfgang Amadeus Mozzart", "2:21")); songs.add(new Song("Requiem: Lacrimosa", "Wolfgang Amadeus Mozzart", "3:18")); songs.add(new Song("Le Nozze di Figaro", "Wolfgang Amadeus Mozzart", "4:28")); songs.add(new Song("Toccata and Fugue in D Minor", "Johann Sebastian Bach", "2:59")); songs.add(new Song("Jesu, Joy of Man's Desiring", "Johann Sebastian Bach", "3:29")); songs.add(new Song("Goldberg Variations BMV 988: 1. Aria", "Johann Sebastian Bach", "4:41")); songs.add(new Song("Air on the G String", "Johann Sebastian Bach", "2:36")); songs.add(new Song("Largo from Xerxes", "Georg Friedrich Händel", "5:50")); songs.add(new Song("Organ Concerto Op. 7, No: 4: 1. Adagio", "Georg Friedrich Händel", "6:29")); songs.add(new Song("Hallelujah Chorus", "Georg Friedrich Händel", "4:23")); songs.add(new Song("Swan Lake", "Pyotr Ilyich Tchaikovsky", "3:15")); songs.add(new Song("Waltz of the Flowers", "Pyotr Ilyich Tchaikovsky", "7:01")); songs.add(new Song("Serenade for Strings in C, Op.48 - 2. Valse", "Pyotr Ilyich Tchaikovsky", "3:52")); songs.add(new Song("Minute Waltz", "Frédéric Chopin", "2:37")); songs.add(new Song("Grande Valse Brillante", "Frédéric Chopin", "5:29")); songs.add(new Song("Nocturne No.2 in E Flat, Op. 9 No. 2", "Frédéric Chopin", "3:57")); songs.add(new Song("Raindrop Prélude", "Frédéric Chopin", "4:57")); SongAdapter adapter = new SongAdapter(this, songs); final ListView listView = (ListView) findViewById(R.id.list); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { Song selectedItem = (Song) listView.getItemAtPosition(position); final Bundle extra = new Bundle(); extra.putSerializable(NowPlayingActivity.SONG_INFO, selectedItem); Intent nowPlayingIntent = new Intent (view.getContext(), NowPlayingActivity.class); nowPlayingIntent.putExtras(extra); view.getContext().startActivity(nowPlayingIntent); } }); } }
223ab0c8eb7d553635582a1b950981441c579b4e
fd76d488c5057e4829b2d83f01370ea260d9912b
/Core/EnergyDominionCore/src/main/java/com/energy0124/energydominion/EnergyDominion.java
08c4553bf3cb0488ab442c220700dd2548152aea
[]
no_license
Energy0124/EnergyDominion
680f4931445e8eee9cca319010e5026422f8c285
263ab07e750dd6609f332f897f7fb98b48fa1326
refs/heads/master
2020-05-19T10:19:14.207419
2015-10-11T19:59:08
2015-10-11T19:59:08
13,497,109
0
0
null
null
null
null
UTF-8
Java
false
false
4,908
java
package com.energy0124.energydominion; import com.energy0124.energydominion.api.*; import com.energy0124.energydominion.core.DominionGameManager; import com.energy0124.energydominion.game.CardManager; import com.energy0124.energydominion.game.DominionCostFactory; import com.energy0124.energydominion.game.ExpansionManager; import com.energy0124.energydominion.game.GameManager; import core.DominionDeck; import core.LocalPlayer; import ro.fortsoft.pf4j.DefaultPluginManager; import ro.fortsoft.pf4j.PluginManager; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class EnergyDominion { private static PluginManager pluginManager; private static GameManager gameManager; private static CardManager cardManager; private static ExpansionManager expansionManager; private static String pluginPath = "expansions/"; private static boolean useDefaultBaseSet = true; public static void main(String[] args) { // System.out.println(System.getProperty("pf4j.pluginsDir", "plugins")); pluginManager = new DefaultPluginManager(new File(pluginPath)); // pluginManager = new DefaultPluginManager(); gameManager = new GameManager(); pluginManager.loadPlugins(); pluginManager.startPlugins(); init(); //simple test to check whether the expansion can be loaded test(pluginManager); //another test List<Player> playerList = new ArrayList(Arrays.asList(new LocalPlayer("Energy"), new LocalPlayer("Star"))); //create sample list of player Deck startingDeck = new DominionDeck(); Game testGame = gameManager.createLocalGame(playerList, startingDeck); //create a test game testGame.start(); //start the test game } private static void init() { DominionGameManager.setCostFactory(new DominionCostFactory()); } private static void test(PluginManager pm) { //todo: fix the bug that no expansion is found //may related to : // * if (type.isAssignableFrom(extensionClass) && extensionClass.isAnnotationPresent(Extension.class)) { //use debug to check List<DominionExpansion> expansions = pm.getExtensions(DominionExpansion.class); List<Card> cards = pm.getExtensions(Card.class); // List<Card> cards = pm.getExtensions(Card.class); /* for (Card card : cards) { System.out.println("--------------------------------------"); System.out.println(card.getClass().toString()); System.out.println(card.getName()); System.out.println("--------------------------------------"); } */ for (Expansion expansion : expansions) { System.out.println("--------------------------------------"); System.out.println(expansion.getClass().toString()); System.out.println(expansion.toString()); System.out.println("Name: " + expansion.getName()); if (expansion instanceof Expansion) { System.out.println("IsExpansion: True"); } System.out.println("CardList:"); System.out.println(expansion.getCardClassSet().toString()); for (Class card : expansion.getCardClassSet()) { System.out.println("**********"); System.out.println(card.getSimpleName()); try { System.out.println(card.newInstance().toString()); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } System.out.println("**********"); } System.out.println("--------------------------------------"); } for (Card card : cards) { System.out.println(card.getCardClass()); } } public static PluginManager getPluginManager() { return pluginManager; } public static void setPluginManager(PluginManager pluginManager) { EnergyDominion.pluginManager = pluginManager; } public static GameManager getGameManager() { return gameManager; } public static void setGameManager(GameManager gameManager) { EnergyDominion.gameManager = gameManager; } public static CardManager getCardManager() { return cardManager; } public static void setCardManager(CardManager cardManager) { EnergyDominion.cardManager = cardManager; } public static ExpansionManager getExpansionManager() { return expansionManager; } public static void setExpansionManager(ExpansionManager expansionManager) { EnergyDominion.expansionManager = expansionManager; } }
3d37fd9a087b9342cab9a141c81824c85921ab6e
e666a868e1536f6017624ac24c18172b5906fb56
/src/org/ulco/test/TriangleTest.java
69bbaa9cd1d441899c93c51f2ac513ed1335b470
[]
no_license
Cedricdelcroix/editorold
454d867b01e4533362b78ac4c4a19dbf74a87ff8
2d9abaf018c5f41e5ca37a65481c9ce87fb81630
refs/heads/master
2021-01-22T03:30:19.636509
2015-11-28T18:26:07
2015-11-28T18:26:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package org.ulco.test; import junit.framework.TestCase; import org.ulco.GraphicsObject; import org.ulco.Point; import org.ulco.Rectangle; import org.ulco.Triangle; public class TriangleTest extends TestCase { public void testType() throws Exception { Triangle triangle = new Triangle(new Point(0, 0), new Point(5, 2), new Point(10, 4)); assertTrue(triangle instanceof Triangle); assertTrue(triangle instanceof GraphicsObject); } public void testJson() throws Exception { Triangle triangle = new Triangle(new Point(0, 0), new Point(5, 2), new Point(10, 4)); assertEquals(triangle.toJson(), "{ type: triangle, point1: { type: point, x: 0.0, y: 0.0 }, point2: { type: point, x: 5.0, y: 2.0 }, point3: { type: point, x: 10.0, y: 4.0 } }"); } public void testCopy() throws Exception { Triangle triangle = new Triangle(new Point(0, 0), new Point(5, 2), new Point(10, 4)); assertEquals(triangle.toJson(), triangle.copy().toJson()); } }
89e20db0eb79f84944cdb16e93be7fe8e11302e1
e3f945b9a6b24ede83bf1a72fae8769ebd17503b
/src/main/java/org/sid/controller/SubscriptionController.java
bb854c4dfe486e89e0f85bddb20d0f29f3fa9c80
[]
no_license
MraniYoussef/Biblioth-que
7a3abc2b02c70363e8fafd7956d3e3edb3131d4a
a18e9d62c00e23fe795c0d3ee8e8854877f9b407
refs/heads/master
2023-07-18T09:58:14.988247
2021-08-17T22:49:22
2021-08-17T22:49:22
397,408,460
0
0
null
null
null
null
UTF-8
Java
false
false
2,318
java
package org.sid.controller; import java.util.List; import org.sid.entities.Book; import org.sid.entities.Subscription; import org.sid.service.BookService; import org.sid.service.SubscriptionService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/subscription") public class SubscriptionController { private final SubscriptionService subscriptionService; public SubscriptionController(SubscriptionService subscriptionService) { this.subscriptionService = subscriptionService; } @GetMapping("/all") public ResponseEntity<List<Subscription>> getAllSubscriptions(){ List<Subscription> subscriptions = subscriptionService.findAllSubscriptions(); return new ResponseEntity(subscriptions, HttpStatus.OK); } @GetMapping("/find/{id}") public ResponseEntity<Subscription> getSubscriptionByIdSubscription (@PathVariable("id") Long id){ Subscription subscription = subscriptionService .findSubscriptionByIdSubscription(id); return new ResponseEntity(subscription, HttpStatus.OK); } @PostMapping("/add") public ResponseEntity<Subscription> addSubscription(@RequestBody Long idMember){ Subscription newSubscription = subscriptionService.createSubscription(idMember); return new ResponseEntity(newSubscription, HttpStatus.CREATED); } @PutMapping("/update") public ResponseEntity<Subscription> updateSubscription (@RequestBody Subscription subscription){ Subscription updateSubscription = subscriptionService .updateSubscription(subscription); return new ResponseEntity(updateSubscription, HttpStatus.OK); } @DeleteMapping("/delete/{id}") public ResponseEntity<?> deleteSubscription(@PathVariable("id") Long id){ subscriptionService.deleteSubscription(id); return new ResponseEntity(HttpStatus.OK); } }
74465647075397019909363825d4b2beed78e2fe
c28da52d72b65ae7e237eca212e0b1a8c3035759
/src/main/java/com/sxu/data/WorkingDataTxTsProcess.java
34946f968ec64f606e7c37ef8688f71dc6856217
[]
no_license
1303575952/nettyserver
59f38e735baead083b69c243f9f67ccba31d2be4
359c9b03e2b1e714b8e805087a5461346b63fafd
refs/heads/master
2020-04-16T07:14:00.018600
2019-05-12T11:02:12
2019-05-12T11:02:12
165,378,550
1
0
null
2019-03-11T09:16:45
2019-01-12T11:11:29
Java
UTF-8
Java
false
false
24,210
java
package com.sxu.data; import com.sxu.db.JDBCConfiguration; import com.sxu.entity.WorkingDataEntity; import com.sxu.entity.WorkingDataTxTsEntity; import com.sxu.utils.TimeUtil; import org.apache.log4j.Logger; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; public class WorkingDataTxTsProcess { private static final Logger LOGGER = Logger.getLogger(WorkingDataTxTsProcess.class); /** * 通过帧拿到工况数据,封装到workingDataEntity中 * <p> * 查 basic_company 得到 区域编号region_id 行业编号industry_id 公司编号id 公司名称name * 查 basic_industry 得到 行业名称name * 查 basic_drain 得到 排口名称name * 查 basic_facility 得到 设施编号id * * @param workingDataEntity * @return */ public static List<WorkingDataTxTsEntity> getWorkingDataTxTsEntityFromWorkingData(WorkingDataEntity workingDataEntity) { //脱硫脱硝数据放入workingDataTxTsEntities List<WorkingDataTxTsEntity> workingDataTxTsEntities = new ArrayList<WorkingDataTxTsEntity>(); //一条完整工况数据中脱硫脱硝公共部分 String qiyeID = workingDataEntity.getQiyeID(); Integer regionId = 0; Integer industryId = 0; Integer companyId = 0; String companyName = ""; Connection connection = null; try { connection = JDBCConfiguration.getConn(); PreparedStatement queryCompany = connection.prepareStatement("select * from basic_company where license_number_simple = ? limit 1"); queryCompany.setString(1, qiyeID); ResultSet queryCompanySet = queryCompany.executeQuery(); while (queryCompanySet.next()) { regionId = queryCompanySet.getInt("region_id"); industryId = queryCompanySet.getInt("industry_id"); companyId = queryCompanySet.getInt("id"); companyName = queryCompanySet.getString("name"); } queryCompanySet.close(); queryCompany.close(); String industryName = ""; PreparedStatement queryIndustry = connection.prepareStatement("select * from basic_industry where id = ?"); queryIndustry.setInt(1, industryId); ResultSet queryIndustrySet = queryIndustry.executeQuery(); while (queryIndustrySet.next()) { industryName = queryIndustrySet.getString("name"); } queryIndustrySet.close(); queryIndustry.close(); Integer drainId = Integer.valueOf(workingDataEntity.getPaikoubianhao()); String drainName = ""; PreparedStatement queryDrain = connection.prepareStatement("select * from basic_drain where data_from_paikoubianhao = ? and company_id = ?"); queryDrain.setInt(1, drainId); queryDrain.setInt(2, companyId); ResultSet queryDrainSet = queryDrain.executeQuery(); while (queryDrainSet.next()) { drainName = queryDrainSet.getString("name"); } queryDrainSet.close(); queryDrain.close(); String publishTime = TimeUtil.nianyueriFormat(workingDataEntity.getNianyueri()) + " " + workingDataEntity.getShifenmiao_1(); String createTime = workingDataEntity.getInsert_time(); /** * 1机组1脱硝 */ WorkingDataTxTsEntity workingDataTxTsEntity_1_a = new WorkingDataTxTsEntity(); workingDataTxTsEntity_1_a.setPublishTime(publishTime); workingDataTxTsEntity_1_a.setPublishType("N"); workingDataTxTsEntity_1_a.setRegionId(regionId); workingDataTxTsEntity_1_a.setIndustryId(industryId); workingDataTxTsEntity_1_a.setIndustryName(industryName); workingDataTxTsEntity_1_a.setCompanyId(companyId); workingDataTxTsEntity_1_a.setCompanyName(companyName); workingDataTxTsEntity_1_a.setDrainId(drainId); workingDataTxTsEntity_1_a.setDrainName(drainName); String facilityName_1_a = workingDataEntity.getGongyileixingTX_1_a() + "-" + workingDataEntity.getJizubianhao_1() + workingDataEntity.getGuolubianhao_1() + workingDataEntity.getZhilisheshibianhao_1_a(); PreparedStatement queryFacilityName_1_a = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_1_a.setString(1, facilityName_1_a); queryFacilityName_1_a.setInt(2, companyId); Integer facilityId_1_a = 0; ResultSet queryFacilityName_1_aSet = queryFacilityName_1_a.executeQuery(); while (queryFacilityName_1_aSet.next()) { facilityId_1_a = queryFacilityName_1_aSet.getInt("id"); } workingDataTxTsEntity_1_a.setFacilityId(facilityId_1_a); queryFacilityName_1_aSet.close(); queryFacilityName_1_a.close(); workingDataTxTsEntity_1_a.setFacilityName(facilityName_1_a); workingDataTxTsEntity_1_a.setOperationConcentration(WorkingDataModel.nOperationConcentration( workingDataEntity.getRukouyanqiliang_1(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoO2nongdu_1_a(), workingDataEntity.getSCRfanyingqiXjinkouyanqiwendu1_1_a(), workingDataEntity.getAnqiliuliang_1_a() )); /*workingDataTxTsEntity_1_a.setOperatingEfficiency( WorkingDataModel.nEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_a() ) );*/ workingDataTxTsEntity_1_a.setOperatingEfficiency( WorkingDataModel.nModelEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_b() ) ); workingDataTxTsEntity_1_a.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_1_a); /** * 1机组2脱硝 */ WorkingDataTxTsEntity workingDataTxTsEntity_1_b = new WorkingDataTxTsEntity(); workingDataTxTsEntity_1_b.setPublishTime(publishTime); workingDataTxTsEntity_1_b.setPublishType("N"); workingDataTxTsEntity_1_b.setRegionId(regionId); workingDataTxTsEntity_1_b.setIndustryId(industryId); workingDataTxTsEntity_1_b.setIndustryName(industryName); workingDataTxTsEntity_1_b.setCompanyId(companyId); workingDataTxTsEntity_1_b.setCompanyName(companyName); workingDataTxTsEntity_1_b.setDrainId(drainId); workingDataTxTsEntity_1_b.setDrainName(drainName); String facilityName_1_b = workingDataEntity.getGongyileixingTX_1_b() + "-" + workingDataEntity.getJizubianhao_1() + workingDataEntity.getGuolubianhao_1() + workingDataEntity.getZhilisheshibianhao_1_b(); PreparedStatement queryFacilityName_1_b = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_1_b.setString(1, facilityName_1_b); queryFacilityName_1_b.setInt(2, companyId); Integer facilityId_1_b = 0; ResultSet queryFacilityName_1_bSet = queryFacilityName_1_b.executeQuery(); while (queryFacilityName_1_bSet.next()) { facilityId_1_b = queryFacilityName_1_bSet.getInt("id"); } workingDataTxTsEntity_1_b.setFacilityId(facilityId_1_b); queryFacilityName_1_bSet.close(); queryFacilityName_1_b.close(); workingDataTxTsEntity_1_b.setFacilityName(facilityName_1_b); workingDataTxTsEntity_1_b.setOperationConcentration(WorkingDataModel.nOperationConcentration( workingDataEntity.getRukouyanqiliang_1(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoO2nongdu_1_b(), workingDataEntity.getSCRfanyingqiXjinkouyanqiwendu1_1_b(), workingDataEntity.getAnqiliuliang_1_b() )); /*workingDataTxTsEntity_1_b.setOperatingEfficiency( WorkingDataModel.nEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_b() ) );*/ workingDataTxTsEntity_1_b.setOperatingEfficiency( WorkingDataModel.nModelEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_1_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_1_b() ) ); workingDataTxTsEntity_1_b.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_1_b); /** * 1机组脱硫 */ WorkingDataTxTsEntity workingDataTxTsEntity_1 = new WorkingDataTxTsEntity(); workingDataTxTsEntity_1.setPublishTime(publishTime); workingDataTxTsEntity_1.setPublishType("S"); workingDataTxTsEntity_1.setRegionId(regionId); workingDataTxTsEntity_1.setIndustryId(industryId); workingDataTxTsEntity_1.setIndustryName(industryName); workingDataTxTsEntity_1.setCompanyId(companyId); workingDataTxTsEntity_1.setCompanyName(companyName); workingDataTxTsEntity_1.setDrainId(drainId); workingDataTxTsEntity_1.setDrainName(drainName); String facilityName_1 = workingDataEntity.getGongyileixingTS_1() + "-" + workingDataEntity.getJizubianhao_1() + workingDataEntity.getGuolubianhao_1(); PreparedStatement queryFacilityName_1 = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_1.setString(1, facilityName_1); queryFacilityName_1.setInt(2, companyId); Integer facilityId_1 = 0; ResultSet queryFacilityName_1Set = queryFacilityName_1.executeQuery(); while (queryFacilityName_1Set.next()) { facilityId_1 = queryFacilityName_1Set.getInt("id"); } workingDataTxTsEntity_1.setFacilityId(facilityId_1); queryFacilityName_1Set.close(); queryFacilityName_1.close(); workingDataTxTsEntity_1.setFacilityName(facilityName_1); workingDataTxTsEntity_1.setOperationConcentration(WorkingDataModel.sOperationConcentration( workingDataEntity.getRukouyanqiliang_1(), workingDataEntity.getRukouliunongdu_1(), workingDataEntity.getRukouO2nongdu_1(), workingDataEntity.getRukouyanwen_1(), workingDataEntity.getShihuishigongjiangliang_1(), 0.95f, workingDataEntity.getShihuishijiangyemidu_1(), String.valueOf(workingDataEntity.getNo1xunhuanbengkaiguanzhuangtai_1() + workingDataEntity.getNo2xunhuanbengkaiguanzhuangtai_1() + workingDataEntity.getNo3xunhuanbengkaiguanzhuangtai_1() + workingDataEntity.getNo4xunhuanbengkaiguanzhuangtai_1() ) )); /*workingDataTxTsEntity_1.setOperatingEfficiency( WorkingDataModel.sEfficiency(workingDataEntity.getChukouliunongdu_1(), workingDataEntity.getChukouyanqiliang_1(), workingDataEntity.getRukouliunongdu_1(), workingDataEntity.getRukouyanqiliang_1() ) );*/ workingDataTxTsEntity_1.setOperatingEfficiency( WorkingDataModel.sModelEfficiency( workingDataEntity.getRukouyanqiliang_1(), workingDataEntity.getChukouyanqiliang_1(), workingDataEntity.getRukouliunongdu_1(), workingDataEntity.getChukouliunongdu_1() ) ); workingDataTxTsEntity_1.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_1); /** * 2机组1脱硝 */ WorkingDataTxTsEntity workingDataTxTsEntity_2_a = new WorkingDataTxTsEntity(); workingDataTxTsEntity_2_a.setPublishTime(publishTime); workingDataTxTsEntity_2_a.setPublishType("N"); workingDataTxTsEntity_2_a.setRegionId(regionId); workingDataTxTsEntity_2_a.setIndustryId(industryId); workingDataTxTsEntity_2_a.setIndustryName(industryName); workingDataTxTsEntity_2_a.setCompanyId(companyId); workingDataTxTsEntity_2_a.setCompanyName(companyName); workingDataTxTsEntity_2_a.setDrainId(drainId); workingDataTxTsEntity_2_a.setDrainName(drainName); String facilityName_2_a = workingDataEntity.getGongyileixingTX_2_a() + "-" + workingDataEntity.getJizubianhao_2() + workingDataEntity.getGuolubianhao_2() + workingDataEntity.getZhilisheshibianhao_2_a(); PreparedStatement queryFacilityName_2_a = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_2_a.setString(1, facilityName_2_a); queryFacilityName_2_a.setInt(2, companyId); Integer facilityId_2_a = 0; ResultSet queryFacilityName_2_aSet = queryFacilityName_2_a.executeQuery(); while (queryFacilityName_2_aSet.next()) { facilityId_2_a = queryFacilityName_2_aSet.getInt("id"); } workingDataTxTsEntity_2_a.setFacilityId(facilityId_2_a); queryFacilityName_2_aSet.close(); queryFacilityName_2_a.close(); workingDataTxTsEntity_2_a.setFacilityName(facilityName_2_a); workingDataTxTsEntity_2_a.setOperationConcentration(WorkingDataModel.nOperationConcentration( workingDataEntity.getRukouyanqiliang_2(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoO2nongdu_2_a(), workingDataEntity.getSCRfanyingqiXjinkouyanqiwendu1_2_a(), workingDataEntity.getAnqiliuliang_2_a() )); /*workingDataTxTsEntity_2_a.setOperatingEfficiency( WorkingDataModel.nEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_a() ) );*/ workingDataTxTsEntity_2_a.setOperatingEfficiency( WorkingDataModel.nModelEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_b() ) ); workingDataTxTsEntity_2_a.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_2_a); /** * 2机组2脱硝 */ WorkingDataTxTsEntity workingDataTxTsEntity_2_b = new WorkingDataTxTsEntity(); workingDataTxTsEntity_2_b.setPublishTime(publishTime); workingDataTxTsEntity_2_b.setPublishType("N"); workingDataTxTsEntity_2_b.setRegionId(regionId); workingDataTxTsEntity_2_b.setIndustryId(industryId); workingDataTxTsEntity_2_b.setIndustryName(industryName); workingDataTxTsEntity_2_b.setCompanyId(companyId); workingDataTxTsEntity_2_b.setCompanyName(companyName); workingDataTxTsEntity_2_b.setDrainId(drainId); workingDataTxTsEntity_2_b.setDrainName(drainName); String facilityName_2_b = workingDataEntity.getGongyileixingTX_2_b() + "-" + workingDataEntity.getJizubianhao_2() + workingDataEntity.getGuolubianhao_2() + workingDataEntity.getZhilisheshibianhao_2_b(); PreparedStatement queryFacilityName_2_b = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_2_b.setString(1, facilityName_2_b); queryFacilityName_2_b.setInt(2, companyId); Integer facilityId_2_b = 0; ResultSet queryFacilityName_2_bSet = queryFacilityName_2_b.executeQuery(); while (queryFacilityName_2_bSet.next()) { facilityId_2_b = queryFacilityName_2_bSet.getInt("id"); } workingDataTxTsEntity_2_b.setFacilityId(facilityId_2_b); queryFacilityName_2_bSet.close(); queryFacilityName_2_b.close(); workingDataTxTsEntity_2_b.setFacilityName(facilityName_2_b); workingDataTxTsEntity_2_b.setOperationConcentration(WorkingDataModel.nOperationConcentration( workingDataEntity.getRukouyanqiliang_2(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoO2nongdu_2_b(), workingDataEntity.getSCRfanyingqiXjinkouyanqiwendu1_2_b(), workingDataEntity.getAnqiliuliang_2_b() )); /*workingDataTxTsEntity_2_b.setOperatingEfficiency( WorkingDataModel.nEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_b() ) );*/ workingDataTxTsEntity_2_b.setOperatingEfficiency( WorkingDataModel.nModelEfficiency( workingDataEntity.getSCRfanyingqichukouyanqiNOXnongdu_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_a(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoliuliang_2_b(), workingDataEntity.getSCRfanyingqiXAIGqianyandaoyanqiNOXnongdu_2_b() ) ); workingDataTxTsEntity_2_b.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_2_b); /** * 2机组脱硫 */ WorkingDataTxTsEntity workingDataTxTsEntity_2 = new WorkingDataTxTsEntity(); workingDataTxTsEntity_2.setPublishTime(publishTime); workingDataTxTsEntity_2.setPublishType("S"); workingDataTxTsEntity_2.setRegionId(regionId); workingDataTxTsEntity_2.setIndustryId(industryId); workingDataTxTsEntity_2.setIndustryName(industryName); workingDataTxTsEntity_2.setCompanyId(companyId); workingDataTxTsEntity_2.setCompanyName(companyName); workingDataTxTsEntity_2.setDrainId(drainId); workingDataTxTsEntity_2.setDrainName(drainName); String facilityName_2 = workingDataEntity.getGongyileixingTS_2() + "-" + workingDataEntity.getJizubianhao_2() + workingDataEntity.getGuolubianhao_2(); PreparedStatement queryFacilityName_2 = connection.prepareStatement("select * from basic_facility where name = ? and company_id = ?"); queryFacilityName_2.setString(1, facilityName_2); queryFacilityName_2.setInt(2, companyId); Integer facilityId_2 = 0; ResultSet queryFacilityName_2Set = queryFacilityName_2.executeQuery(); while (queryFacilityName_2Set.next()) { facilityId_2 = queryFacilityName_2Set.getInt("id"); } workingDataTxTsEntity_2.setFacilityId(facilityId_2); queryFacilityName_2Set.close(); queryFacilityName_2.close(); workingDataTxTsEntity_2.setFacilityName(facilityName_2); workingDataTxTsEntity_2.setOperationConcentration(WorkingDataModel.sOperationConcentration( workingDataEntity.getRukouyanqiliang_2(), workingDataEntity.getRukouliunongdu_2(), workingDataEntity.getRukouO2nongdu_2(), workingDataEntity.getRukouyanwen_2(), workingDataEntity.getShihuishigongjiangliang_2(), 0.95f, workingDataEntity.getShihuishijiangyemidu_2(), String.valueOf(workingDataEntity.getNo1xunhuanbengkaiguanzhuangtai_2() + workingDataEntity.getNo2xunhuanbengkaiguanzhuangtai_2() + workingDataEntity.getNo3xunhuanbengkaiguanzhuangtai_2() + workingDataEntity.getNo4xunhuanbengkaiguanzhuangtai_2() ) )); /*workingDataTxTsEntity_2.setOperatingEfficiency( WorkingDataModel.sEfficiency( workingDataEntity.getChukouliunongdu_2(), workingDataEntity.getChukouyanqiliang_2(), workingDataEntity.getRukouliunongdu_2(), workingDataEntity.getRukouyanqiliang_2() ) );*/ workingDataTxTsEntity_2.setOperatingEfficiency( WorkingDataModel.sModelEfficiency( workingDataEntity.getRukouyanqiliang_2(), workingDataEntity.getChukouyanqiliang_2(), workingDataEntity.getRukouliunongdu_2(), workingDataEntity.getChukouliunongdu_2() ) ); workingDataTxTsEntity_2.setCreateTime(createTime); workingDataTxTsEntities.add(workingDataTxTsEntity_2); connection.close(); LOGGER.debug("关闭MySQL连接"); } catch (Exception e) { e.printStackTrace(); } return workingDataTxTsEntities; } }
11315f0b64e3ee692f38dccd181255c51ffc3c65
22a76a439c9208afb100a55ab7ad794b592edbd5
/src/project/pbo/states/IntroState.java
1e582e7e7e84c7e53e9373e2a4de2f83d8578e4d
[]
no_license
Ztrohub/ProjectPBO
a451499e8a1595af481c55b606a5f75310cb7729
e84d2ebbc0d714e85d54b81f39436b53341b63a1
refs/heads/master
2023-05-26T06:45:23.986864
2021-06-07T10:22:44
2021-06-07T10:22:44
359,666,977
1
0
null
null
null
null
UTF-8
Java
false
false
1,409
java
package project.pbo.states; import project.pbo.Handler; import project.pbo.gfx.Assets; import javax.sound.sampled.Clip; import java.awt.*; public class IntroState extends State{ private float alhpa = 0.1f; private int count = 0; private Clip clip; public IntroState(Handler handler) { super(handler); } @Override public void tick() { if (count < 100) alhpa += 0.01f; if (alhpa >= 1.0f){ alhpa = 1.0f; if (count < 100) count++; } if (count >= 100) alhpa -= 0.01f; if (alhpa <= 0.0f){ clip.stop(); Assets.initLogin(); State state = new LoginState(handler); state.playMusic(); State.setCurrentState(state); } } @Override public void render(Graphics g) { ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alhpa)); ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.drawImage(Assets.logoSTTS, 400, 180, 250, 250, null); } @Override public void playMusic() { clip = Assets.audioIntro; clip.stop(); clip.setFramePosition(0); clip.start(); handler.setVol(clip, 0.1f); } @Override public void loadFile() { } }
3c85f58b362f25d218a2e8ad868e5f09c3684b9f
53a40ee0c757ae65d3be5ded19daf133a5461300
/src/ru/medev/bubble/Bullet.java
5341348d20587bdba93d1d34fe8f018aa749dfed
[]
no_license
Vurikus/BubbleShutter
05ad8a477c0090abded5f8e50f8ab1e8fbd41457
ed6e0acc2639c93d8a185610bce952c886a09762
refs/heads/master
2021-01-14T18:58:27.310580
2020-02-24T11:44:30
2020-02-24T11:44:30
242,721,399
0
0
null
null
null
null
UTF-8
Java
false
false
1,161
java
package ru.medev.bubble; import java.awt.*; public class Bullet { //Field private double x; private double y; private double bulletDX; private double bulletDY; private double distDX; private double distDY; private double dist; private int r = 2; private int speed = 20; private Color color = Color.WHITE; //Constructor public Bullet(){ x = GamePanel.gamer.getX(); y = GamePanel.gamer.getY(); distDX = GamePanel.mouseX - x; distDY = GamePanel.mouseY - y; dist = Math.sqrt(distDX*distDX + distDY*distDY); bulletDX = (distDX/dist)*speed; bulletDY = (distDY/dist)*speed; } //Function public void update(){ y +=bulletDY; x +=bulletDX; } public void draw(Graphics2D g){ g.setColor(color); g.fillOval((int)x,(int)y,r,2*r); } public boolean remove(){ if(y<0 && y>GamePanel.HEIGHT && x<0 && x>GamePanel.WIDTH){ return true; } return false; } public double getX() {return x;} public double getY() {return y;} public int getR(){return r;} }
8aea8d2c30d2b099941dbde6c708732a75b5291e
848a720a736b82efffa25b39c099bf0eeb45434a
/server/src/main/java/learn/collaboreat/models/User.java
caed6bd098b080c7f252aff01e1828a97a1f21b2
[]
no_license
cbarkume/CollaborEat
97a373b6ae26bfc8f19788d15b2fe57ba93a9b62
6be8aea0783e184c7929ddc9e52673db5ee5ec6a
refs/heads/main
2023-01-12T20:05:03.121203
2020-11-20T00:02:06
2020-11-20T00:02:06
311,383,721
0
0
null
null
null
null
UTF-8
Java
false
false
2,629
java
package learn.collaboreat.models; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.PositiveOrZero; import java.util.ArrayList; import java.util.List; import java.util.Objects; public class User { @PositiveOrZero(message = "User ID must be positive or zero.") private int userId; @NotBlank(message = "First name is required.") private String firstName; @NotBlank(message = "Last name is required.") private String lastName; @NotBlank(message = "Email is required.") @Email(message = "Invalid Email") private String email; @NotBlank(message = "Password is required.") private String password; private List<Recipe> recipes = new ArrayList<>(); private List<String> roles = new ArrayList<>(); public List<String> getRoles() { return roles; } public void setRoles(List<String> roles) { this.roles = roles; } public List<Recipe> getRecipes() { return new ArrayList<>(recipes); } public void setRecipes(List<Recipe> recipes) { this.recipes = recipes; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public boolean hasRole(String role) { if (roles == null) { return false; } return roles.contains(role); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; return userId == user.userId && Objects.equals(firstName, user.firstName) && Objects.equals(lastName, user.lastName) && Objects.equals(email, user.email) && Objects.equals(password, user.password); } @Override public int hashCode() { return Objects.hash(userId, firstName, lastName, email, password); } }
c1343127f90cc58d68b4bd76bb6cf6a59d169a33
0741ac60786f806d8ee5eca758bb05bf22ffa13a
/src/main/java/vn/edu/vnu/uet/dkt/rest/model/semester/ListSemesterResponse.java
6f009a40e59a289c5244fb3a66547d3906fa2c34
[]
no_license
HaTu98/dkt
e4291d8b1fa94c9ca1534e7fc96f396696c6caaa
dfb10826f7e039deb9078742d8ceadbfc441a39b
refs/heads/master
2022-11-13T06:01:42.763870
2020-07-01T03:11:03
2020-07-01T03:11:03
232,301,784
0
2
null
null
null
null
UTF-8
Java
false
false
647
java
package vn.edu.vnu.uet.dkt.rest.model.semester; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.Setter; import vn.edu.vnu.uet.dkt.rest.model.PageResponse; import java.util.List; @Getter @Setter public class ListSemesterResponse { @JsonProperty(value = "SemesterResponse") List<SemesterResponse> semesterResponses; @JsonProperty(value = "Page") private PageResponse pageResponse; public ListSemesterResponse(List<SemesterResponse> semesterResponses, PageResponse pageResponse) { this.semesterResponses = semesterResponses; this.pageResponse = pageResponse; } }
033b10e707b6b045110ba6f5f7c8d98ccfa481c8
c4376def2ad77212bac10d18de4aa4cda0f3435a
/Queue/ArrayQueueTest.java
e268ca3357a8a092043a53dc465e26c3940315fa
[]
no_license
BrandonOdiwuor/Data-Structures-And-Algorithms-Java
34c6a47659ff1888c279c4164ce93cee79de2b1e
a20494f0030420b16473dd516e34f0ebf622e7e9
refs/heads/master
2021-01-19T12:16:16.732592
2017-01-26T15:29:08
2017-01-26T15:29:08
69,948,003
2
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
public class ArrayQueueTest extends MainTester{ public static void main(String[] args){ ArrayQueueTest tester = new ArrayQueueTest(); ArrayQueue<String> queue = new ArrayQueue<String>(); // Testing size() tester.testMethod(String.valueOf(queue.size()), "0"); // Testing isEmpty() tester.testMethod(String.valueOf(queue.isEmpty()), "true"); // Testing enqueue() queue.enqueue("Brandon Wayne Odiwuor"); tester.testMethod(Integer.toString(queue.size()), "1"); tester.testMethod(String.valueOf(queue.isEmpty()), "false"); queue.enqueue("Becker Otieno"); queue.enqueue("Hazel Joyce"); queue.enqueue("Brayden Gweth"); queue.enqueue("Jerdon Hawi"); tester.testMethod(Integer.toString(queue.size()), "5"); // Testing first() tester.testMethod(queue.first(), "Brandon Wayne Odiwuor"); // Testing deuque() tester.testMethod(queue.dequeue(), "Brandon Wayne Odiwuor"); tester.testMethod(queue.first(), "Becker Otieno"); tester.testMethod(Integer.toString(queue.size()), "4"); } }
632316442ef0203b2da2ae8f9004de56f94b2a29
89f0034faac613f49edce7d86e1ca1bdffe2fbdd
/myerpGWT/src/main/java/org/adempiere/model/AdField.java
c9424ad3add6d571a4da23e56a40745cdfe40bb5
[]
no_license
qq122343779/myerpGXT
3263cbb688f92839a8354bcba87e57fba73d937d
2173e093b74c7a3699027eb7776789477699a137
refs/heads/master
2021-01-17T11:44:50.496141
2014-02-17T00:20:54
2014-02-17T00:20:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,207
java
package org.adempiere.model; import javax.persistence.*; /** * Auto-generated by: * org.adempiere.AdempiereCustomizer */ @Entity @Table(name="ad_field") public class AdField extends org.adempiere.common.ADEntityBase { private static final long serialVersionUID = 1L; private Integer adClientId; private Integer adColumnId; private Integer adFieldId; private Integer adFieldgroupId; private Integer adOrgId; private Integer adReferenceId; private Integer adReferenceValueId; private Integer adTabId; private Integer adValRuleId; private String created; private Integer createdby; private String defaultvalue; private String description; private Integer displaylength; private String displaylogic; private String entitytype; private String help; private Integer includedTabId; private String infofactoryclass; private Boolean isactive; private Boolean iscentrallymaintained; private Boolean isdisplayed; private Boolean isencrypted; private Boolean isfieldonly; private Boolean isheading; private Boolean ismandatory; private Boolean isreadonly; private Boolean issameline; private String name; private String obscuretype; private Integer seqno; private Integer sortno; private String updated; private Integer updatedby; public AdField() { } public AdField(Integer adFieldId) { this.adFieldId = adFieldId; } @Basic @Column(name="AD_CLIENT_ID", columnDefinition="INT", nullable=false) public Integer getAdClientId() { return adClientId; } public void setAdClientId(Integer adClientId) { this.adClientId = adClientId; } @Basic @Column(name="AD_COLUMN_ID", columnDefinition="INT") public Integer getAdColumnId() { return adColumnId; } public void setAdColumnId(Integer adColumnId) { this.adColumnId = adColumnId; } @Id @Column(name="AD_FIELD_ID", columnDefinition="INT") public Integer getAdFieldId() { return adFieldId; } public void setAdFieldId(Integer adFieldId) { this.adFieldId = adFieldId; } @Basic @Column(name="AD_FIELDGROUP_ID", columnDefinition="INT") public Integer getAdFieldgroupId() { return adFieldgroupId; } public void setAdFieldgroupId(Integer adFieldgroupId) { this.adFieldgroupId = adFieldgroupId; } @Basic @Column(name="AD_ORG_ID", columnDefinition="INT", nullable=false) public Integer getAdOrgId() { return adOrgId; } public void setAdOrgId(Integer adOrgId) { this.adOrgId = adOrgId; } @Basic @Column(name="AD_REFERENCE_ID", columnDefinition="INT") public Integer getAdReferenceId() { return adReferenceId; } public void setAdReferenceId(Integer adReferenceId) { this.adReferenceId = adReferenceId; } @Basic @Column(name="AD_REFERENCE_VALUE_ID", columnDefinition="INT") public Integer getAdReferenceValueId() { return adReferenceValueId; } public void setAdReferenceValueId(Integer adReferenceValueId) { this.adReferenceValueId = adReferenceValueId; } @Basic @Column(name="AD_TAB_ID", columnDefinition="INT", nullable=false) public Integer getAdTabId() { return adTabId; } public void setAdTabId(Integer adTabId) { this.adTabId = adTabId; } @Basic @Column(name="AD_VAL_RULE_ID", columnDefinition="INT") public Integer getAdValRuleId() { return adValRuleId; } public void setAdValRuleId(Integer adValRuleId) { this.adValRuleId = adValRuleId; } @Basic @Column(columnDefinition="TIMESTAMP", nullable=false) public String getCreated() { return created; } public void setCreated(String created) { this.created = created; } @Basic @Column(columnDefinition="INT", nullable=false) public Integer getCreatedby() { return createdby; } public void setCreatedby(Integer createdby) { this.createdby = createdby; } @Basic @Column(length=2000) public String getDefaultvalue() { return defaultvalue; } public void setDefaultvalue(String defaultvalue) { this.defaultvalue = defaultvalue; } @Basic public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Basic @Column(columnDefinition="INT") public Integer getDisplaylength() { return displaylength; } public void setDisplaylength(Integer displaylength) { this.displaylength = displaylength; } @Basic @Column(length=2000) public String getDisplaylogic() { return displaylogic; } public void setDisplaylogic(String displaylogic) { this.displaylogic = displaylogic; } @Basic @Column(nullable=false, length=40) public String getEntitytype() { return entitytype; } public void setEntitytype(String entitytype) { this.entitytype = entitytype; } @Basic @Column(length=2000) public String getHelp() { return help; } public void setHelp(String help) { this.help = help; } @Basic @Column(name="INCLUDED_TAB_ID", columnDefinition="INT") public Integer getIncludedTabId() { return includedTabId; } public void setIncludedTabId(Integer includedTabId) { this.includedTabId = includedTabId; } @Basic public String getInfofactoryclass() { return infofactoryclass; } public void setInfofactoryclass(String infofactoryclass) { this.infofactoryclass = infofactoryclass; } @Basic @Column(nullable=false) public Boolean isIsactive() { return isactive; } public void setIsactive(Boolean isactive) { this.isactive = isactive; } @Basic @Column(nullable=false) public Boolean isIscentrallymaintained() { return iscentrallymaintained; } public void setIscentrallymaintained(Boolean iscentrallymaintained) { this.iscentrallymaintained = iscentrallymaintained; } @Basic @Column(nullable=false) public Boolean isIsdisplayed() { return isdisplayed; } public void setIsdisplayed(Boolean isdisplayed) { this.isdisplayed = isdisplayed; } @Basic @Column(nullable=false) public Boolean isIsencrypted() { return isencrypted; } public void setIsencrypted(Boolean isencrypted) { this.isencrypted = isencrypted; } @Basic @Column(nullable=false) public Boolean isIsfieldonly() { return isfieldonly; } public void setIsfieldonly(Boolean isfieldonly) { this.isfieldonly = isfieldonly; } @Basic @Column(nullable=false) public Boolean isIsheading() { return isheading; } public void setIsheading(Boolean isheading) { this.isheading = isheading; } @Basic public Boolean isIsmandatory() { return ismandatory; } public void setIsmandatory(Boolean ismandatory) { this.ismandatory = ismandatory; } @Basic @Column(nullable=false) public Boolean isIsreadonly() { return isreadonly; } public void setIsreadonly(Boolean isreadonly) { this.isreadonly = isreadonly; } @Basic @Column(nullable=false) public Boolean isIssameline() { return issameline; } public void setIssameline(Boolean issameline) { this.issameline = issameline; } @Basic @Column(nullable=false, length=60) public String getName() { return name; } public void setName(String name) { this.name = name; } @Basic @Column(length=3) public String getObscuretype() { return obscuretype; } public void setObscuretype(String obscuretype) { this.obscuretype = obscuretype; } @Basic @Column(columnDefinition="INT") public Integer getSeqno() { return seqno; } public void setSeqno(Integer seqno) { this.seqno = seqno; } @Basic @Column(columnDefinition="INT") public Integer getSortno() { return sortno; } public void setSortno(Integer sortno) { this.sortno = sortno; } @Basic @Column(columnDefinition="TIMESTAMP", nullable=false) public String getUpdated() { return updated; } public void setUpdated(String updated) { this.updated = updated; } @Basic @Column(columnDefinition="INT", nullable=false) public Integer getUpdatedby() { return updatedby; } public void setUpdatedby(Integer updatedby) { this.updatedby = updatedby; } }
[ "Administrator@Natural" ]
Administrator@Natural
cf2a1f23d035ab2643ef9a7bd60451a804f2dcb1
e22648f0b1a8db0569d37d1a7cef5440e27294f1
/src/main/java/com/group/service/GenerateDataService.java
d18cd60335401425b77ccb8e6f7160a13716fe73
[]
no_license
tnt123-83/advert-watcher
bdedf15f7091e6452ba21a94d7467736db8c5844
c5885b2668ed9dc842d33025d47107a0b5c8f082
refs/heads/master
2020-12-02T04:59:14.280087
2020-10-23T09:36:33
2020-10-23T09:36:33
230,896,831
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package com.group.service; import com.group.dto.AdvertDto; import java.util.ArrayDeque; import java.util.List; import java.util.Set; public interface GenerateDataService { void runGenerator(); ArrayDeque<AdvertDto> generateData(); Boolean isDataTransmited(); void setWorkingTaskCancelled(Boolean status); List<String> getResultTablesNames(); void setFoundAdverts(Set<AdvertDto> foundAdverts); }
db33d41b498166f38e9ef564b571d72778041dd6
324170a896c2af416f13f44d0d37615c5bdc7c3f
/lkl-mini-api/src/main/java/com/lakala/mini/dto/card/CardOrgQueryDTO.java
24ef5b12807f8bc537bc719dd275941d374fae3d
[]
no_license
wenchangwu/mini
76f1efcf55e27636ba39c02b14dd3df8c9c33343
e7725c69480ee5e6120aa6fc8c80589d11547aaa
refs/heads/master
2021-08-30T14:10:43.719415
2017-12-18T08:42:44
2017-12-18T08:42:44
114,058,799
0
0
null
null
null
null
UTF-8
Java
false
false
1,300
java
/** * */ package com.lakala.mini.dto.card; import java.util.List; import javax.xml.bind.annotation.XmlType; import org.apache.cxf.annotations.WSDLDocumentation; import org.apache.cxf.annotations.WSDLDocumentation.Placement; import com.lakala.core.dto.BaseQueryDTO; /** * 联名卡机构查询参数对象 * @author QW * @CardOrgQueryDTO.java * @2011-4-20 下午02:35:44 */ @XmlType(name = "CardOrgQuery") @WSDLDocumentation(value = "MINI联名卡机构查询参数", placement = Placement.BINDING) public class CardOrgQueryDTO extends BaseQueryDTO { private Long[] ids; private String[] codes; private String[] names; /** * 移机规则 *@since 1.4.0 */ private List<Integer> movingRule; public Long[] getIds() { return ids; } public void setIds(Long[] ids) { this.ids = ids; } public String[] getCodes() { return codes; } public void setCodes(String[] codes) { this.codes = codes; } public String[] getNames() { return names; } public void setNames(String[] names) { this.names = names; } /** * @return the movingRule */ public List<Integer> getMovingRule() { return movingRule; } /** * @param movingRule the movingRule to set */ public void setMovingRule(List<Integer> movingRule) { this.movingRule = movingRule; } }
[ "wwc5201314" ]
wwc5201314
4cd2e6c3eb795ad135fd9f5e0fc6c24c5993d57d
503ec69031e92a0e30627853dd02c435be4897bf
/app/src/main/java/com/nanodegree/android/stevenson/popularmovies/model/Trailer.java
4d467f7e2e5a7d0165dd3a5c3d5505a2c0045431
[]
no_license
Justin-Stevenson/Popular-Movies-java-
9b3efb1d58ad515ac089773259a7210bc2a083bf
c4488a6fcc6eb38e7907686093715cd66f43f57d
refs/heads/master
2022-05-13T12:36:18.149225
2019-06-27T23:00:44
2019-06-27T23:00:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package com.nanodegree.android.stevenson.popularmovies.model; public class Trailer { private String id; private String key; private String name; public String getId() { return id; } public String getKey() { return key; } public String getName() { return name; } }
e56cfa7b3eb0e8ec576ff0a3372f06ebc6024fc0
bc9bd0dea077b5f3aa191908d60ebf213a941379
/app/src/main/java/com/example/surbhimiglani/appetite/RegisterAsUser.java
ecc49067c8e991978e66c2f91644b30f968e45b8
[]
no_license
surbhimiglani/EmergencyApp
c9c7cbe7a71c39e30d61b6fa5ce663b7fdd16e88
24195404799bf44d1c28d38931bdb0e02dd2d474
refs/heads/master
2021-07-17T05:12:04.830543
2017-10-14T06:49:57
2017-10-14T06:49:57
106,900,537
0
0
null
null
null
null
UTF-8
Java
false
false
4,460
java
package com.example.surbhimiglani.appetite; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.HashMap; public class RegisterAsUser extends AppCompatActivity { private EditText inputEmail, inputPassword,inputaddress,inputphonenumber; private Button btnSignUp; private FirebaseAuth auth; private DatabaseReference userdatabase; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register_as_user); auth = FirebaseAuth.getInstance(); inputEmail = (EditText) findViewById(R.id.email2); inputPassword = (EditText) findViewById(R.id.password2); inputaddress = (EditText) findViewById(R.id.address); inputphonenumber = (EditText) findViewById(R.id.editText6); btnSignUp = (Button) findViewById(R.id.button3); userdatabase= FirebaseDatabase.getInstance().getReference().child("user"); btnSignUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String email = inputEmail.getText().toString().trim(); String password = inputPassword.getText().toString().trim(); String Adresss = inputaddress.getText().toString().trim(); String phonenmber = inputphonenumber.getText().toString().trim(); HashMap<String,String> DataMap= new HashMap<String, String>(); DataMap.put("Name",email); DataMap.put("Password",password); DataMap.put("Address",Adresss); DataMap.put("Number",phonenmber); if (TextUtils.isEmpty(email)) { Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show(); return; } if (TextUtils.isEmpty(password)) { Toast.makeText(getApplicationContext(), "Enter password!", Toast.LENGTH_SHORT).show(); return; } if (password.length() < 6) { Toast.makeText(getApplicationContext(), "Password too short, enter minimum 6 characters!", Toast.LENGTH_SHORT).show(); return; } userdatabase.push().setValue(DataMap); //create user auth.createUserWithEmailAndPassword(email, password) .addOnCompleteListener(RegisterAsUser.this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { Toast.makeText(RegisterAsUser.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show(); // If sign in fails, display a message to the user. If sign in succeeds // the auth state listener will be notified and logic to handle the // signed in user can be handled in the listener. if (!task.isSuccessful()) { Toast.makeText(RegisterAsUser.this, "Authentication failed." + task.getException(), Toast.LENGTH_SHORT).show(); } else { startActivity(new Intent(RegisterAsUser.this, Welcome.class)); finish(); } } }); } }); } }
065261a356e888f211330fbc079d81fb72a0ae18
bc794d54ef1311d95d0c479962eb506180873375
/posweb/src/main/java/com/keren/posweb/core/ifaces/UniteGestionManager.java
2fa14995285a85b0773c810a59a1ebfce2f862d1
[]
no_license
Teratech2018/Teratech
d1abb0f71a797181630d581cf5600c50e40c9663
612f1baf9636034cfa5d33a91e44bbf3a3f0a0cb
refs/heads/master
2021-04-28T05:31:38.081955
2019-04-01T08:35:34
2019-04-01T08:35:34
122,177,253
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package com.keren.posweb.core.ifaces; import com.bekosoftware.genericmanagerlayer.core.ifaces.GenericManager; import com.keren.posweb.model.UniteGestion; /** * Interface etendue par les interfaces locale et remote du manager * @since Tue Sep 04 17:34:18 GMT+01:00 2018 * */ public interface UniteGestionManager extends GenericManager<UniteGestion, Long> { public final static String SERVICE_NAME = "UniteGestionManager"; }
3596cec9b03b11574bd03b3b81cee24d563af738
aab3c4a9a7124faad8dbf09ff802dab56fcea9d6
/src/test/java/com/grayben/riskExtractor/headingMarker/MarkedText/MarkedTextOracle.java
1bc0a7b162391637bc4b3c71e15c5eedfdc09fe4
[ "MIT" ]
permissive
grayben/10K-item-extractor
2031fc88c9001f313dabb38b9a97892d2f106b59
1a4960bfbf460dc84d93dcccdd8f34e1721756dd
refs/heads/master
2021-01-21T04:47:57.324939
2016-04-24T02:54:10
2016-04-24T02:54:10
46,213,379
0
0
null
null
null
null
UTF-8
Java
false
false
6,399
java
package com.grayben.riskExtractor.headingMarker.markedText; import com.grayben.riskExtractor.headingMarker.ElectedText; import org.apache.commons.collections4.list.SetUniqueList; import java.util.*; public class MarkedTextOracle { private ElectedText testInput; private Set<String> testExpectedOutput; protected ElectedText getTestInput(){ return this.testInput; } protected Set<String> getTestExpectedOutput(){ return Collections.unmodifiableSet(this.testExpectedOutput); } protected MarkedTextOracle(List<TextElementClass> classifiedList){ this.testInput = generateTestInput(classifiedList); generateTestExpectedOutput(classifiedList, this.testInput); } protected boolean validateResult(Set<String> result){ Set<String> expectedResult = getTestExpectedOutput(); return result.equals(expectedResult); } private void generateTestExpectedOutput(List<TextElementClass> param, ElectedText testInput) { class IndexHelper { Integer startIndex; Integer endIndex; Integer currentIndex; Boolean onSelectedContent; Map<Integer, Integer> targetIndexRanges; List<TextElementClass> elementList; IndexHelper(List<TextElementClass> elementList){ startIndex = null; endIndex = null; currentIndex = null; onSelectedContent = false; targetIndexRanges = new HashMap<>(); this.elementList = elementList; } Map<Integer, Integer> process(){ ListIterator<TextElementClass> iterator = elementList.listIterator(); while (iterator.hasNext()) { currentIndex = iterator.nextIndex(); TextElementClass elementType = iterator.next(); if (elementType.equals(TextElementClass.ELECTED_HEADING)) { encounterElectedHeading(); } else if (elementType.equals(TextElementClass.NOMINATED_HEADING)) { encounterNominatedHeading(); } } //now, check to see if there was a non-terminated target section if(startIndex != null){ //the endIndex must be null, else the section should have been closed assert endIndex == null; currentIndex = elementList.size(); completeMapEntry(); } return targetIndexRanges; } void encounterElectedHeading(){ /* if we were already in a section, we need to break off and start a new section */ if(onSelectedContent){ completeMapEntry(); } beginMapEntry(); } void encounterNominatedHeading(){ if (onSelectedContent) { completeMapEntry(); } /* assign onSelectedContent := false -> (startIndex == null & endIndex == null) */ assert startIndex == null && endIndex == null; onSelectedContent = false; } void beginMapEntry(){ //assign(startIndex) -> startIndex was null assert startIndex == null; startIndex = currentIndex; onSelectedContent = true; } void completeMapEntry(){ //if(onSelectedContent) -> startIndex is assigned assert startIndex != null; //assign(endIndex) -> endIndex was null assert endIndex == null; // index - 1 because we don't want to include the heading endIndex = currentIndex - 1; targetIndexRanges.put(startIndex, endIndex); startIndex = null; endIndex = null; } } IndexHelper indexHelper = new IndexHelper(param); Map<Integer, Integer> targetIndexRanges = indexHelper.process(); this.testExpectedOutput = constructExpectedOutput(targetIndexRanges, testInput); } protected ElectedText generateTestInput(List<TextElementClass> param){ List<String> textInput = new ArrayList<>(); SetUniqueList<Integer> nomineeIndex = SetUniqueList.setUniqueList(new ArrayList<>()); SetUniqueList<Integer> electeeIndex = SetUniqueList.setUniqueList(new ArrayList<>()); ListIterator<TextElementClass> it = param.listIterator(); while(it.hasNext()){ int index; index = it.nextIndex(); TextElementClass elementType = it.next(); String stringToAdd; stringToAdd = index + ": " + elementType.archetype(); textInput.add(stringToAdd); if(elementType.equals(TextElementClass.ELECTED_HEADING)) { nomineeIndex.add(index); electeeIndex.add(index); } else if(elementType.equals(TextElementClass.NOMINATED_HEADING)) { nomineeIndex.add(index); } } return new ElectedText( textInput, nomineeIndex, electeeIndex ); } private Set<String> constructExpectedOutput(Map<Integer, Integer> targetIndexRanges, ElectedText testInput){ Iterator<Map.Entry<Integer, Integer>> it = targetIndexRanges.entrySet().iterator(); Set<String> testExpectedOutput = new HashSet<>(); while(it.hasNext()){ Map.Entry<Integer, Integer> entry = it.next(); int startIndex = entry.getKey(); int endIndex = entry.getValue(); //endIndex + 1 because subList is exclusive of endIndex index argument List<String> subList = testInput.getStringList().subList(startIndex, endIndex + 1); StringBuilder sb = new StringBuilder(); for (String string : subList ) { sb.append(string + " "); } testExpectedOutput.add(sb.toString().replaceAll("\\s+", " ").trim()); } return testExpectedOutput; } }
3787dbd7c7b1339e5d4782bf7e3a39978eaed5f6
cd08fe6078e65742b9d3e4576883d261392fbd73
/src/main/java/net/andreho/struct/EqualityAndHashCodeStrategy.java
b8b7828bf793c4f0c0da0787a12215e3aa637235
[ "Apache-2.0" ]
permissive
andreho/structs
d619f5001f9e62624d15d97bb3458d31a8803b86
eee225c15fe1f7fbad283937ed322e2e824a4cef
refs/heads/master
2021-09-01T21:43:04.340706
2017-12-28T20:03:19
2017-12-28T20:03:19
115,171,413
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package net.andreho.struct; public interface EqualityAndHashCodeStrategy<T> extends EqualityStrategy<T>, HashCodeStrategy<T> { }
81d8d68114244c7b6b2ed0e68ddbacb3adcbcdd7
62a6a855f5519ad35291512188ab8ac88a7ce74d
/src/main/java/io/github/lr/ip2country/utils/UtilsHelper.java
55870cc468a5c8c317b2877fac58cf2169c87f09
[]
no_license
LeandroRavanal/ip2country
a6b81107f1dce546d9757a469539bb03d89309df
1dda55ef8f2cf20502c684d059aac3eb1c40af80
refs/heads/master
2020-06-09T13:46:30.680417
2019-11-08T19:45:21
2019-11-08T19:45:21
193,444,235
0
0
null
null
null
null
UTF-8
Java
false
false
2,160
java
package io.github.lr.ip2country.utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpStatusCodeException; /** * Utilitario con funciones comunes. Contiene el calculo de distancia. * * @author lravanal * */ public class UtilsHelper { private static final Logger logger = LoggerFactory.getLogger(UtilsHelper.class); public static final double AR_LAT = -34; public static final double AR_LNG = -64; public static int distance2AR(double lat, double lng) { return (int) (distance(AR_LAT, lat, AR_LNG, lng, 0.0, 0.0) / 1000); } /** * Calculate distance between two points in latitude and longitude * taking into account height difference. * If you are not interested in height difference pass 0.0. * * lat1, lon1 Start point lat2, lon2 End point * el1 Start altitude in meters el2 End altitude in meters * @returns Distance in Meters */ private static double distance(double lat1, double lat2, double lon1, double lon2, double el1, double el2) { final int R = 6371; // Radius of the earth double latDistance = Math.toRadians(lat2 - lat1); double lonDistance = Math.toRadians(lon2 - lon1); double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); double distance = R * c * 1000; // convert to meters double height = el1 - el2; distance = Math.pow(distance, 2) + Math.pow(height, 2); return Math.sqrt(distance); } @SuppressWarnings("serial") public static void checkStatusResponse(ResponseEntity<?> responseEntity, String operationName) { if (!responseEntity.getStatusCode().is2xxSuccessful()) { logger.info("Operation Incompleted ({}): {}", operationName, responseEntity.getStatusCodeValue()); throw new HttpStatusCodeException(responseEntity.getStatusCode()) {}; } } }
7c3a93902e2811ea9f2729f6de6d11e28f512157
9264312fe90f4810eae8ed1c8fd0854af0ac60fb
/app/src/main/java/com/ldedusoft/ldbm/model/FixingInfo.java
5c302c24df6ad10fc99387e2e54862a83f64e3fc
[]
no_license
LDedusoft/ldbmAndroid
066651f19026672a6e4e0367d8c4a4f9921360a9
2457cf0e067b7a089a1b1300a8520729fb2143b8
refs/heads/master
2020-04-12T09:32:02.844425
2016-09-19T08:27:05
2016-09-19T08:27:05
63,291,473
0
0
null
null
null
null
UTF-8
Java
false
false
1,889
java
package com.ldedusoft.ldbm.model; import java.io.Serializable; /** * 查询配件信息 * Created by wangjianwei on 2016/7/9. * {ID:id;BianHao:编号;MingCheng:名称;TuHao:图号;CangKu:仓库;KuCun:库存数量; * KuCunJinE:库存金额;KuCunJunJia:库存均价;DanWei:单位} */ public class FixingInfo implements Serializable { private int ID; private String BianHao; private String MingCheng; private String TuHao; private String CangKu; private String KuCun; private String KuCunJinE; private String KuCunJunJia; private String DanWei; public int getID() { return ID; } public void setID(int ID) { this.ID = ID; } public String getBianHao() { return BianHao; } public void setBianHao(String bianHao) { BianHao = bianHao; } public String getMingCheng() { return MingCheng; } public void setMingCheng(String mingCheng) { MingCheng = mingCheng; } public String getTuHao() { return TuHao; } public void setTuHao(String tuHao) { TuHao = tuHao; } public String getCangKu() { return CangKu; } public void setCangKu(String cangKu) { CangKu = cangKu; } public String getKuCun() { return KuCun; } public void setKuCun(String kuCun) { KuCun = kuCun; } public String getKuCunJinE() { return KuCunJinE; } public void setKuCunJinE(String kuCunJinE) { KuCunJinE = kuCunJinE; } public String getKuCunJunJia() { return KuCunJunJia; } public void setKuCunJunJia(String kuCunJunJia) { KuCunJunJia = kuCunJunJia; } public String getDanWei() { return DanWei; } public void setDanWei(String danWei) { DanWei = danWei; } }
df1f1f63e05baae6a91bd8682c4509ce64d9fede
7f8dfa3921c4925814b25b144e68bb86684aaab8
/src/main/java/top/gradual/blog/service/BlogLinksService.java
8333c59b8fdb39faeaefc1b2b3ede1390881b288
[]
no_license
gradual-wu/Blog
2d4a2c2bd2c16ee2ef5b444ad86fa22af7265c3f
cb104e52be4566ab4a654ee750169311ff559a1c
refs/heads/master
2023-05-28T19:46:38.006496
2018-10-23T03:50:17
2018-10-23T03:50:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package top.gradual.blog.service; import java.util.List; import top.gradual.blog.domain.dto.LinkInputDTO; import top.gradual.blog.domain.dto.LinksDTO; /** * @Description: * @Author: gradual * @Date: 2018-09-20 上午9:22 */ public interface BlogLinksService { List<LinksDTO> getAllLinks(); boolean deleteLinks(long id); boolean updateLinks(LinkInputDTO inputDTO); LinksDTO insertLinks(LinkInputDTO inputDTO); }
321de0b97a95223f790f98cfa8410b8d8f8f050b
6b8b2bc5112c12cd0c18098e9554ed2a3ca0b083
/src/com/action/screenmirror/utils/Config.java
5c3042cf9ae64f0ac5aff321d9977dcd3dac0ce8
[]
no_license
Stmen/ScreenMirrorUDP
7100d5d3095167cb018c2114da54e19854e21b9c
3d0cfdbe7fff33ecd56d4c037343e0226e0d5989
refs/heads/master
2022-12-19T05:46:01.626455
2020-09-27T02:42:57
2020-09-27T02:42:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,039
java
package com.action.screenmirror.utils; /** * Created by Tianluhua on 2018/04/10 */ public class Config { public static final boolean useUdp = true; public static class MotionEventKey { public static final String JACTION = "action"; public static final String JX = "x"; public static final String JY = "y"; public static final int ACTION_DOWN = 0; public static final int ACTION_MOVE = 2; public static final int ACTION_UP = 1; } public static class ActionKey { public static final String CLIENT_IP_KEY = "phoneip:"; public static final String SERVICE_START_KEY = "start:"; public static final String SEND_PRE = "send"; public static final String RECEIVER_PRE = "receiver"; } public static class PortGlob { public static final int MULTIPORT = 9797; public static final int MULTIPORT_IPV6 = 19797; public static final int DATAPORT = 18686; public static final int TOUCHPORT = 18181; public static final int AUDIOPORT = 18687; public static final int UDPPACKETPORT = 18688; } public static class HandlerGlod { public static final int GET_BROADCASTADDRESS = 0; public static final int CHECK_IPTYPE = 1; public static final long GET_BROADCASTADDRESS_DELAY = 1000; public static final int SEND_BROADCAST = 2; public static final long SEND_BROADCAST_DELAY = 500; public static final int CHECK_DEVICE_LIVE = 3; public static final long CHECK_DEVICE_LIVE_DELAY = 2000; public static final int CONNECT_SUCCESS = 4; public static final int TOUCH_CONNECT_SUCCESS = 5; public static final int DATA_CONNECT_SUCCESS = 6; public static final int CONNECT_FAIL = 7; public static final int TIME_OUT = 8; public static final int AUDIO_CONNECT_SUCCESS = 9; public static final int REQUEST_CONNECT_TIMEOUT = 10; public static final long REQUEST_CONNECT_TIMEOUT_DELAY = 5000; public static final int CHECK_ALIVE = 11; public static final long CHECK_ALIVE_DELAY = 5000; } }
d3a193ef851687163bff7e7d110d7985ebe0621c
466357ff7e6bfab5304be1331cb8bd57732239ac
/Danny-Behnecke-Task2/src/statMeUp/saveSet.java
03a327e2185179fb3d0e18305b7ffb7999f614f4
[ "Apache-2.0" ]
permissive
TUBS-ISF/spl2015.danny.behnecke
8c2a6045017391780e7b8c9e12cbbcf66694f5e9
d33190c1a6e28abeaf4c2db92083d139b356cdae
refs/heads/master
2020-05-07T21:51:49.854571
2015-07-21T08:51:43
2015-07-21T08:51:43
34,387,624
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package statMeUp; public interface saveSet { public void saveResult(Set s);//TODO might change to bool public void saveResult(Set s, String path); }
c5fa4a8cd73e2dc53f1a2b64efcc45071ab895c2
4c2283bbc4efefc5f6378de88e2cdb254ad2a04b
/app/src/instigate/simCardChangeNotifier/mailing/CustomEmailSender.java
ca49b14bff3ff45776380b514861d748017b205a
[]
no_license
LianaHovhannisyan/build_system
9f5fe344fe8043f9e120c77e294da0617f4f35e8
1fe274cc5fdb0058a07dbee52bfa52de59a0475a
refs/heads/master
2016-08-12T18:35:26.009642
2015-11-26T18:27:25
2015-11-26T18:27:25
46,941,665
0
0
null
null
null
null
UTF-8
Java
false
false
1,296
java
package instigate.simCardChangeNotifier.mailing; import java.util.Set; import android.content.Context; import android.os.AsyncTask; import android.util.Log; import instigate.simCardChangeNotifier.BuildConfig; public class CustomEmailSender extends AsyncTask<Void, Void, Boolean> { private Set<String> messageRecipients; private String messageSubject; private String messageBody; private Context context; GMailSender sender = new GMailSender(context, "[email protected]", "InstigateMobile1"); public CustomEmailSender(Context cnt, Set<String> recipients, String subject, String body) { messageRecipients = recipients; messageSubject = subject; messageBody = body; context = cnt; } @Override protected Boolean doInBackground(Void... params) { if (BuildConfig.DEBUG) Log.v(CustomEmailSender.class.getName(), "doInBackground()"); try { for (String i : messageRecipients) { GMailSender sender = new GMailSender(context, "[email protected]", "InstigateMobile1"); sender.sendMail(messageSubject, messageBody, "[email protected]", i); Log.d("SendMail", "Mail was sent"); } } catch (Exception e) { Log.d("SendMail", e.getMessage(), e); e.printStackTrace(); return false; } return true; } };
117e83156e27eaf750747c7023e22e5d66122421
9754873d7ba54e9bf0b3f66910c0ee6e68d37507
/src/main/java/test/rabbitmq/demo/RabbitMQDemoApplication.java
e5ba209c6029f711a79169df2d5a4fbe741fca73
[]
no_license
a-gomezuc/rabbitmq-springboot
d6b1ff658cc7342a6b095bfe14ac4a85bcc4e5c4
f777d7789a9dc5abc61c2c735d0fe13cdaa99417
refs/heads/master
2023-03-29T18:37:11.008911
2021-04-10T10:23:00
2021-04-10T10:23:00
340,888,477
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package test.rabbitmq.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class RabbitMQDemoApplication { public static void main(String[] args) { SpringApplication.run(RabbitMQDemoApplication.class, args); } }
eb6a903aae340d7870c2519580e120ac1af44f64
0d53a22631a85aa5bef72676a890443ee8bc30d9
/MorseCodeConverter.java
679ccf152615f718348f716078ace6d2fc903b1a
[]
no_license
skim402/CMSC204_Assignment5_MorseCode
a83319c05b22a997ea3e0d1e626d663876191274
fe347f02e2cf6b747d24590f8a93a07044f26c1b
refs/heads/main
2023-09-04T15:24:11.133063
2021-11-19T04:18:50
2021-11-19T04:18:50
429,667,641
0
0
null
null
null
null
UTF-8
Java
false
false
1,749
java
import java.io.File; public class MorseCodeConverter<T> { protected static MorseCodeTree tree = new MorseCodeTree(); public MorseCodeConverter() { } /** * Convert String Morse Code Into English * * @param String encoded input * @return String decoded output * @throws None */ public static String convertToEnglish(String input) { String result = ""; String[] words = input.split(" / "); for (String word : words) { String[] letters = word.split(" "); for (String letter : letters) { result += MorseCodeConverter.tree.fetch(letter); } result += " "; } return result.trim(); } /** * Convert Morse Code File Into English * @param file * @return * @throws java.io.FileNotFoundException */ public static String convertToEnglish(java.io.File file) throws java.io.FileNotFoundException { if (file == null) { throw new java.io.FileNotFoundException("File provided was null"); } java.util.ArrayList<String> lines = new java.util.ArrayList<String>(); java.util.Scanner scanner = new java.util.Scanner(file); String result = ""; while (scanner.hasNext()) { lines.add(scanner.nextLine()); } for (int i = 0; i < lines.size(); i++) { result += MorseCodeConverter.convertToEnglish(lines.get(i)); } scanner.close(); return result.trim(); } /** * Print A MorseCodeTree * * @return String tree * @throws None */ public static String printTree() { if (tree == null) { return ""; } java.util.ArrayList<String> list = tree.toArrayList(); String result = ""; for (String letter : list) { result += letter + " "; } return result.trim(); } }
9fd785ad4328deb43b191c15f2ff698fd8f933b0
31911be132013532136d02030cd43b41ee264112
/lab9/TrowExeption.java
7d9673e9a321e872e3f4f2e70cf0df79868796da
[]
no_license
Sasha-pixel/ikbo-03-19
5f924eee692855131e4d1e6087a274c8b441a7e5
885a740168f0641d1d8946519095647d8eb4200e
refs/heads/master
2023-01-25T04:12:31.312387
2020-12-08T10:31:51
2020-12-08T10:31:51
292,034,156
0
0
null
2020-09-01T15:22:16
2020-09-01T15:22:15
null
UTF-8
Java
false
false
941
java
package ru.mirea.lab9; import java.util.Scanner; public class TrowExeption { public void getKey() { Scanner myScanner = new Scanner(System.in); System.out.print("Enter Key "); String key = myScanner.nextLine(); for (int i = 0;i < 2;i++) { try { printDetails(key); return; } catch (Exception e) { System.err.println(" =( "); } } } public void printDetails(String key) throws Exception { String message = getDetails(key); System.out.println( message ); } private String getDetails(String key) throws Exception { if(key.equals("")) { throw new Exception( "Key set to empty string" ); } return "data for " + key; } public static void main(String[] args) { new TrowExeption().getKey(); } }
0a392a8418b56aa39f33f04674792a18af175752
f619bbfc675e4cef2a6cbca442e71990392186ca
/mobilepayments/src/main/java/com/begateway/mobilepayments/view/SlashSpan.java
66081a5a4f1af67df5adb1b4ee11b47192c11667
[ "MIT" ]
permissive
a-yarohovich/begateway-android-sdk
14c027e07ddd009c9db74de79f8c5a0f8b7c3e9f
d81e25a4c892bdb490d8770e85c1394d871250ae
refs/heads/master
2023-01-29T09:55:04.644520
2020-11-17T17:46:06
2020-11-17T17:46:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package com.begateway.mobilepayments.view; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.FontMetricsInt; import android.text.style.ReplacementSpan; public class SlashSpan extends ReplacementSpan { @Override public int getSize(Paint paint, CharSequence text, int start, int end, FontMetricsInt fm) { float padding = paint.measureText(" ", 0, 1) * 2; float slash = paint.measureText("/", 0, 1); float textSize = paint.measureText(text, start, end); return (int) (padding + slash + textSize); } @Override public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { canvas.drawText(text.subSequence(start, end) + " / ", x, y, paint); } }
[ "" ]
ddd60e8077c3e0569ead44091c3a7dfe83ff2ec2
9757cad73573ba89c0322ba346fa63c08c290f18
/microcourse/src/main/java/com/mcourse/frame/utils/PropUtils.java
2a4acf9ab3fda820155511bead20c33252c400c1
[ "Apache-2.0" ]
permissive
wrcold520/mcourse
929cb4bfc3008b7f1cf67fdbfdc9bd591104513a
5992bbffd0acff6b08f79676b4dad7e783dd64f2
refs/heads/master
2021-07-10T03:38:19.589375
2017-10-09T10:16:34
2017-10-09T10:16:34
106,268,264
0
0
null
null
null
null
UTF-8
Java
false
false
2,758
java
package com.mcourse.frame.utils; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @Title 属性文件获取属性值的工具类 * @Description * * @Created Assassin * @DateTime 2017/05/23 16:47:55 */ public class PropUtils { public static final Logger logger = LoggerFactory.getLogger(PropUtils.class); private static Map<String, Map<String, String>> propMap = new LinkedHashMap<String, Map<String, String>>(); /** * 加载配置文件 * * @param filepath * 文件路径 * @param alias * 当前属性文件别名 * @param trim * value是否trim */ public static void use(String filepath, String alias, boolean trim) { Assert.hasLength(filepath); propMap.clear(); try { InputStream in = new FileInputStream(filepath); Properties prop = new Properties(); prop.load(in); Map<String, String> cntPropMap = new LinkedHashMap<String, String>(); Set<Object> keySet = prop.keySet(); for (Object keyObj : keySet) { if (ObjectUtils.isNotBlank(keyObj)) { String key = keyObj.toString(); cntPropMap.put(key, trim ? prop.getProperty(key).trim() : prop.getProperty(key)); } } propMap.put(alias, cntPropMap); } catch (IOException e) { e.printStackTrace(); } } /** * 获取资源文件的属性值 * * @param alias * 加载属性文件时使用的别名 * @param key * 属性key * @return */ public static String getString(String alias, String key) { Map<String, String> aliasPropMap = propMap.get(alias); if (aliasPropMap == null) { logger.warn("Current property files doesn't contails alias " + alias + ", you could load your property file like this: PropUtils.use(filepath, alias, trim)..."); return null; } else { return aliasPropMap.get(key); } } /** * 获取资源文件的属性值 * * @param alias * 加载属性文件时使用的别名 * @param key * 属性key * @return */ public static Integer getInt(String alias, String key) { String value = getString(alias, key); if (value == null) { return null; } else { return Integer.valueOf(value); } } /** * 获取资源文件的属性值 * * @param alias * 加载属性文件时使用的别名 * @param key * 属性key * @return */ public static Long getLong(String alias, String key) { String value = getString(alias, key); if (value == null) { return null; } else { return Long.valueOf(value); } } }
af5a381fc6e31d47fd016daf5f9d302cad5c8521
b474398887fd3f2fbebd29ccc580c5fb293e252d
/src/com/sun/corba/se/spi/activation/ServerNotRegistered.java
48787ca3ba5c0c0adef541b088670e83ddcf685c
[ "MIT" ]
permissive
AndyChenIT/JDKSourceCode1.8
65a27e356debdcedc15642849602174c6ea286aa
4aa406b5b52e19ef8a323f9f829ea1852105d18b
refs/heads/master
2023-09-02T15:14:37.857475
2021-11-19T10:13:31
2021-11-19T10:13:31
428,856,994
0
0
MIT
2021-11-17T00:26:30
2021-11-17T00:26:29
null
UTF-8
Java
false
false
892
java
package com.sun.corba.se.spi.activation; /** * com/sun/corba/se/spi/activation/ServerNotRegistered.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u201/12322/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl * Saturday, December 15, 2018 6:38:37 PM PST */ public final class ServerNotRegistered extends org.omg.CORBA.UserException { public int serverId = (int)0; public ServerNotRegistered () { super(ServerNotRegisteredHelper.id()); } // ctor public ServerNotRegistered (int _serverId) { super(ServerNotRegisteredHelper.id()); serverId = _serverId; } // ctor public ServerNotRegistered (String $reason, int _serverId) { super(ServerNotRegisteredHelper.id() + " " + $reason); serverId = _serverId; } // ctor } // class ServerNotRegistered
098a5b7f2e2fb8bad0505e595c3646a8d99317bd
71b183a47b44be4f564192f1f815d616e9b4b9e2
/app/src/main/java/com/maymanm/weathermap/viewmodel/DirectionsViweModel.java
8ee135e51449c2882f8857946c7b1b9b88b7ef6a
[]
no_license
MahmoudAymann/WeatherMap
a6cc98e0170d4c0923d48db807b80a13cc0bc886
2e6e590067b2735ceadcb5e1e27cf5250ccca96d
refs/heads/master
2020-06-03T00:46:56.589799
2019-06-11T12:24:01
2019-06-11T12:24:01
191,366,268
0
0
null
null
null
null
UTF-8
Java
false
false
712
java
package com.maymanm.weathermap.viewmodel; import androidx.lifecycle.LiveData; import androidx.lifecycle.ViewModel; import com.maymanm.weathermap.models.directions.DirectionsModel; import com.maymanm.weathermap.repository.DirectionRepository; /** * Created by MahmoudAyman on 6/11/2019. **/ public class DirectionsViweModel extends ViewModel { public LiveData<DirectionsModel> getDirectionsLiveData(String origin, String dest, String key){ return DirectionRepository.getInstance().getDirection(origin, dest, key); } public LiveData<String[]> getPolyLineLiveData(DirectionsModel directionsModel){ return DirectionRepository.getInstance().getPolyLine(directionsModel); } }
fe8c45491e0a8169cd3321f50027502cd5160b33
a7525ceff8431ccc08167aedd4f26c1f059eee5b
/app/src/main/java/com/example/rubs/renderscriptdemo/MainActivity.java
28183cd637691045d31f56ae9c2f00116c0ff540
[]
no_license
mytrendin/Renderscript
4099095e2bd0dd4b9d316645337b19833fb0ead2
8a37023b0cac6bce804c12273225e81b82f0e9f8
refs/heads/master
2021-01-21T21:05:38.090467
2017-05-24T14:59:30
2017-05-24T14:59:30
92,304,818
0
0
null
null
null
null
UTF-8
Java
false
false
688
java
package com.example.rubs.renderscriptdemo; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView outputImage = (ImageView)findViewById(R.id.outputImage); Bitmap outputBitmap = Bluer.blur(this, BitmapFactory.decodeResource(getResources(),R.drawable.picture)); outputImage.setImageBitmap(outputBitmap); } }
2b65453a3eb51256e85e7c26693f5d5b78b334ef
bf1c45b85e287cfec69ff1d30292dabac9f5b02e
/ismartlib/src/main/java/com/ismartlib/ui/dialog/SheetDialog.java
f2ccdff5461ebf86a2f8d72df5cc95e4e51579c0
[]
no_license
msdgwzhy6/android-ui-1
4bb144e62a9256dc02b3eccb6040de3f86d89fa6
6c93e49fe7a9a592d29b5f964fe0485ebce8c7ad
refs/heads/master
2021-01-19T22:43:39.465318
2017-04-03T14:40:10
2017-04-03T14:40:10
88,851,843
1
0
null
2017-04-20T10:11:50
2017-04-20T10:11:50
null
UTF-8
Java
false
false
3,373
java
package com.ismartlib.ui.dialog; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.BottomSheetBehavior; import android.support.design.widget.BottomSheetDialog; import android.util.DisplayMetrics; import android.view.View; import android.view.ViewGroup; /** *    ┏┓   ┏┓ *   ┏┛┻━━━┛┻┓ *   ┃       ┃ *   ┃   ━   ┃ *   ┃ ┳┛ ┗┳ ┃ *   ┃       ┃ *   ┃   ┻   ┃ *   ┃       ┃ *   ┗━┓   ┏━┛ *     ┃   ┃神兽保佑 *     ┃   ┃永无BUG! *     ┃   ┗━━━┓ *     ┃       ┣┓ *     ┃       ┏┛ *     ┗┓┓┏━┳┓┏┛ *      ┃┫┫ ┃┫┫ *      ┗┻┛ ┗┻┛ * ━━━━━━神兽出没━━━━━━ * Created by Administrator on 2016/9/23. * Email:[email protected] * BottomSheetDialog */ public class SheetDialog extends BottomSheetDialog { private Context mContext; public SheetDialog(@NonNull Context context) { super(context); this.mContext = context; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int screenHeight = getScreenHeight((Activity) mContext); int statusBarHeight = getStatusBarHeight(getContext()); int dialogHeight = screenHeight - statusBarHeight; getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, dialogHeight == 0 ? ViewGroup.LayoutParams.MATCH_PARENT : dialogHeight); } private int getScreenHeight(Activity activity) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); return displaymetrics.heightPixels; } private int getStatusBarHeight(Context context) { int statusBarHeight = 0; Resources res = context.getResources(); int resourceId = res.getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { statusBarHeight = res.getDimensionPixelSize(resourceId); } return statusBarHeight; } public void setView(View v) { setContentView(v); //防止用户滑动关闭后窗口不能被再次打开 View view = getDelegate().findViewById(android.support.design.R.id.design_bottom_sheet); final BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(view); bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { @Override public void onStateChanged(@NonNull View bottomSheet, int newState) { if (newState == BottomSheetBehavior.STATE_HIDDEN) { dismiss(); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } } @Override public void onSlide(@NonNull View bottomSheet, float slideOffset) { } }); } }
0e454ec3d175ab51d23bceb4fddb2c39ec78ce13
ee3db8c34dc91d6e8add03d603b3de412de96f5a
/viz/gov.noaa.nws.ncep.viz.resources/src/gov/noaa/nws/ncep/viz/resources/manager/SatelliteImageTypeList.java
9b4a8d0bf2520ca53902464abc014f8ee9575fd2
[]
no_license
Unidata/awips2-ncep
a9aa3a26d83e901cbfaac75416ce586fc56b77d7
0abdb2cf11fcc3b9daf482f282c0491484ea312c
refs/heads/unidata_18.2.1
2023-07-24T03:53:47.775210
2022-07-12T14:56:56
2022-07-12T14:56:56
34,419,331
2
5
null
2023-03-06T22:22:27
2015-04-22T22:26:52
Java
UTF-8
Java
false
false
963
java
package gov.noaa.nws.ncep.viz.resources.manager; import java.util.ArrayList; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * This class declares the top level of SatelliteArea.xml as * <SatelliteAreaList>. * * <pre> * SOFTWARE HISTORY * Date Ticket# Engineer Descriptio * ------------ ---------- ----------- -------------------------- * * 08/17/15 R7656 RCR Created. * * </pre> * * @author RCR * @version 1 */ @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class SatelliteImageTypeList { @XmlElement(name = "satelliteImageType") private ArrayList<SatelliteImageType> imageTypeList = null; public SatelliteImageTypeList() { } public ArrayList<SatelliteImageType> getImageTypeList() { return imageTypeList; } }
d2eceb1211ed8668eae9379fbb17bbe34b66304a
9c042b1dc728dc1e820cca4e11ac5fc883a6bd59
/logistikapp-logistic/src/com/retailsbs/logistikapp/logistic/dao/ibatis/FinderRouteStoreDAOImpl.java
f493625710bb6c7987814e1b264a8a4b0a4d9609
[]
no_license
mcacho09/web-lgk
8152180e8d8c4f6c419ff686c65851e8c523e262
085896dadb9a9916a82506943bbff4640348f7a8
refs/heads/master
2023-07-05T00:59:46.680873
2021-08-05T17:06:17
2021-08-05T17:06:17
393,114,561
0
0
null
null
null
null
UTF-8
Java
false
false
614
java
package com.retailsbs.logistikapp.logistic.dao.ibatis; import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; import com.retailsbs.logistikapp.logistic.dao.FinderRouteStoreDAO; public class FinderRouteStoreDAOImpl extends SqlMapClientDaoSupport implements FinderRouteStoreDAO { @Override public int delRouteStoreByIdRoute(Long id_route) { return getSqlMapClientTemplate().delete("finder_route_store.deleteByIdRoute", id_route); } @Override public int delRouteStoreByIdStore(Long id_store) { return getSqlMapClientTemplate().delete("finder_route_store.deleteByIdStore", id_store); } }
34765a791b12f287c407d1b8d4029cd3188adb45
3ff114b325735317d30dea3f9b38537b776aa6df
/javapr/src/loop/ForLoop.java
b44f78fca4ddefdb58a39a6ef355983ef4f1ad5e
[]
no_license
elankanei/javabasics
3c8104335e832d1b96e6ecd3ec6d7705f35b0479
7eb0cb584cf13281717656d3aa60d720d316da8c
refs/heads/master
2020-03-18T21:14:45.971003
2018-06-03T05:49:43
2018-06-03T05:49:43
135,269,264
0
0
null
null
null
null
UTF-8
Java
false
false
151
java
package loop; public class ForLoop { public static void main(String args[]) {int i; for(i=1;i<10;i++) { System.out.println(i); } } }
5a0d5b99956bd867ce96916b84e6eae03de5ebbc
92bd437b3e42069ff1d852a449bbdb02188cdcd8
/Chapter07/src/sub05/polymorphismTest.java
79f4417d6e0813aa2e927f40e29042537d2e10e4
[]
no_license
wingband/java
228b9fa654e2982aefa440e16a15807aa07dd90e
2c317703b3fa081989334fd09671606a9bc89c90
refs/heads/master
2022-09-17T16:50:04.154301
2020-05-27T01:33:19
2020-05-27T01:33:19
259,795,697
0
0
null
null
null
null
UHC
Java
false
false
511
java
package sub05; import java.util.Scanner; public class polymorphismTest { public static void main(String[] args) { OverWatch ow; System.out.println("플레이할 캐릭터 번호 선택(1.메이, 2.리퍼, 3.맥크리)"); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(n==1) { ow = new Mei(); }else if (n==2) { ow = new Reaper(); }else { ow = new Mccree(); } ow.name(); ow.lClick(); ow.rClick(); ow.shiftButton(); ow.eButton(); ow.qButton(); } }
75d8fc09a56930be93893b6e23170424080b69c0
02c5ca0e9a5fad1cc5b661e1fc55dffae5eef6a8
/src/main/java/com/lockertracker/model/LockerRentalModel.java
ce1ecbc2ba4c004038ae8c1c0696a55135733bb4
[]
no_license
ollainorbert/LockerTracker
355ae39485cae497262d3151684c0c878f5d53e6
8abaa262ee2a975ac2831b53a2b6931ef81f314d
refs/heads/master
2021-01-24T20:58:54.510074
2018-04-04T11:41:41
2018-04-04T11:41:41
123,265,051
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package com.lockertracker.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; @Entity @Table(name = "Lockerrentals", uniqueConstraints = { @UniqueConstraint(columnNames = { "lockerId", "userId" }) }) public class LockerRentalModel { @GeneratedValue @Id private long id; @Column(nullable = false) private short lockerId; @Column(nullable = false) private long userId; @Column(nullable = false) private Date createdAt; public long getId() { return id; } public void setId(long id) { this.id = id; } public short getLockerId() { return lockerId; } public void setLockerId(short lockerId) { this.lockerId = lockerId; } public long getUserId() { return userId; } public void setUserId(long userId) { this.userId = userId; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } }
0a018503bd18ce47330c75e0d353e34f0e091fa4
111d530d727a601c7298c7def60fc87b0a1723c2
/project1/src/main/Entity.java
d61696bd1bae7f0d5a1e5f8894d24175f7b7a93e
[]
no_license
fgudino3/cs4470-projects
279b7ebbece616bb23cb71bc516c36e8e33a1ae9
c3f82a9420f3e8f406971604505cc76f7c1ba451
refs/heads/master
2020-08-05T17:08:44.957748
2019-11-25T21:31:36
2019-11-25T21:31:36
212,627,812
0
0
null
null
null
null
UTF-8
Java
false
false
778
java
package main; public abstract class Entity { // Each entity will have a distance table protected int[][] distanceTable = new int[NetworkSimulator.NUMENTITIES] [NetworkSimulator.NUMENTITIES]; // The update function. Will have to be written in subclasses by students public abstract void update(Packet p); // The link cost change handlder. Will have to be written in appropriate // subclasses by students. Note that only Entity0 and Entity1 will need // this, and only if extra credit is being done public abstract void linkCostChangeHandler(int whichLink, int newCost); // Print the distance table of the current entity. protected abstract void printDT(); }
275c66c5d81a4391d051319acb873b10ef79436d
3bd543c20e59b480a420b96c25129a2ed70ca747
/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationContextUtils.java
47850c5c1a856c1ec1567625dfd671c7d4cae364
[ "Apache-2.0" ]
permissive
pengwei52/spring-framework-4.3.18.RELEASE
527710f642b22e3d1e5fda0e1c6745cf9f418d97
fd4ca1f313b16e57076bdccfbb38b52dabf52f75
refs/heads/master
2020-08-28T02:47:37.623269
2019-10-25T15:41:52
2019-10-25T15:41:52
217,565,397
0
0
null
null
null
null
UTF-8
Java
false
false
18,153
java
/* * Copyright 2002-2016 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 org.springframework.web.context.support; import java.io.Serializable; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.PropertySource.StubPropertySource; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestScope; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletWebRequest; import org.springframework.web.context.request.SessionScope; import org.springframework.web.context.request.WebRequest; /** * Convenience methods for retrieving the root {@link WebApplicationContext} for * a given {@link ServletContext}. This is useful for programmatically accessing * a Spring application context from within custom web views or MVC actions. * * <p>Note that there are more convenient ways of accessing the root context for * many web frameworks, either part of Spring or available as an external library. * This helper class is just the most generic way to access the root context. * * @author Juergen Hoeller * @see org.springframework.web.context.ContextLoader * @see org.springframework.web.servlet.FrameworkServlet * @see org.springframework.web.servlet.DispatcherServlet * @see org.springframework.web.jsf.FacesContextUtils * @see org.springframework.web.jsf.el.SpringBeanFacesELResolver */ // 从web应用的根目录读取配置文件,需要先在web.xml中配置,可以配置监听器或者servlet来实现 public abstract class WebApplicationContextUtils { private static final boolean jsfPresent = ClassUtils.isPresent("javax.faces.context.FacesContext", RequestContextHolder.class.getClassLoader()); /** * Find the root {@code WebApplicationContext} for this web app, typically * loaded via {@link org.springframework.web.context.ContextLoaderListener}. * <p>Will rethrow an exception that happened on root context startup, * to differentiate between a failed context startup and no context at all. * @param sc ServletContext to find the web application context for * @return the root WebApplicationContext for this web app * @throws IllegalStateException if the root WebApplicationContext could not be found * @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE */ public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException { WebApplicationContext wac = getWebApplicationContext(sc); if (wac == null) { throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?"); } return wac; } /** * Find the root {@code WebApplicationContext} for this web app, typically * loaded via {@link org.springframework.web.context.ContextLoaderListener}. * <p>Will rethrow an exception that happened on root context startup, * to differentiate between a failed context startup and no context at all. * @param sc ServletContext to find the web application context for * @return the root WebApplicationContext for this web app, or {@code null} if none * @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE */ public static WebApplicationContext getWebApplicationContext(ServletContext sc) { return getWebApplicationContext(sc, WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); } /** * Find a custom {@code WebApplicationContext} for this web app. * @param sc ServletContext to find the web application context for * @param attrName the name of the ServletContext attribute to look for * @return the desired WebApplicationContext for this web app, or {@code null} if none */ public static WebApplicationContext getWebApplicationContext(ServletContext sc, String attrName) { Assert.notNull(sc, "ServletContext must not be null"); Object attr = sc.getAttribute(attrName); if (attr == null) { return null; } if (attr instanceof RuntimeException) { throw (RuntimeException) attr; } if (attr instanceof Error) { throw (Error) attr; } if (attr instanceof Exception) { throw new IllegalStateException((Exception) attr); } if (!(attr instanceof WebApplicationContext)) { throw new IllegalStateException("Context attribute is not of type WebApplicationContext: " + attr); } return (WebApplicationContext) attr; } /** * Find a unique {@code WebApplicationContext} for this web app: either the * root web app context (preferred) or a unique {@code WebApplicationContext} * among the registered {@code ServletContext} attributes (typically coming * from a single {@code DispatcherServlet} in the current web application). * <p>Note that {@code DispatcherServlet}'s exposure of its context can be * controlled through its {@code publishContext} property, which is {@code true} * by default but can be selectively switched to only publish a single context * despite multiple {@code DispatcherServlet} registrations in the web app. * @param sc ServletContext to find the web application context for * @return the desired WebApplicationContext for this web app, or {@code null} if none * @since 4.2 * @see #getWebApplicationContext(ServletContext) * @see ServletContext#getAttributeNames() */ public static WebApplicationContext findWebApplicationContext(ServletContext sc) { WebApplicationContext wac = getWebApplicationContext(sc); if (wac == null) { Enumeration<String> attrNames = sc.getAttributeNames(); while (attrNames.hasMoreElements()) { String attrName = attrNames.nextElement(); Object attrValue = sc.getAttribute(attrName); if (attrValue instanceof WebApplicationContext) { if (wac != null) { throw new IllegalStateException("No unique WebApplicationContext found: more than one " + "DispatcherServlet registered with publishContext=true?"); } wac = (WebApplicationContext) attrValue; } } } return wac; } /** * Register web-specific scopes ("request", "session", "globalSession") * with the given BeanFactory, as used by the WebApplicationContext. * @param beanFactory the BeanFactory to configure */ public static void registerWebApplicationScopes(ConfigurableListableBeanFactory beanFactory) { registerWebApplicationScopes(beanFactory, null); } /** * Register web-specific scopes ("request", "session", "globalSession", "application") * with the given BeanFactory, as used by the WebApplicationContext. * @param beanFactory the BeanFactory to configure * @param sc the ServletContext that we're running within */ public static void registerWebApplicationScopes(ConfigurableListableBeanFactory beanFactory, ServletContext sc) { beanFactory.registerScope(WebApplicationContext.SCOPE_REQUEST, new RequestScope()); beanFactory.registerScope(WebApplicationContext.SCOPE_SESSION, new SessionScope(false)); beanFactory.registerScope(WebApplicationContext.SCOPE_GLOBAL_SESSION, new SessionScope(true)); if (sc != null) { ServletContextScope appScope = new ServletContextScope(sc); beanFactory.registerScope(WebApplicationContext.SCOPE_APPLICATION, appScope); // Register as ServletContext attribute, for ContextCleanupListener to detect it. sc.setAttribute(ServletContextScope.class.getName(), appScope); } beanFactory.registerResolvableDependency(ServletRequest.class, new RequestObjectFactory()); beanFactory.registerResolvableDependency(ServletResponse.class, new ResponseObjectFactory()); beanFactory.registerResolvableDependency(HttpSession.class, new SessionObjectFactory()); beanFactory.registerResolvableDependency(WebRequest.class, new WebRequestObjectFactory()); if (jsfPresent) { FacesDependencyRegistrar.registerFacesDependencies(beanFactory); } } /** * Register web-specific environment beans ("contextParameters", "contextAttributes") * with the given BeanFactory, as used by the WebApplicationContext. * @param bf the BeanFactory to configure * @param sc the ServletContext that we're running within */ public static void registerEnvironmentBeans(ConfigurableListableBeanFactory bf, ServletContext sc) { registerEnvironmentBeans(bf, sc, null); } /** * Register web-specific environment beans ("contextParameters", "contextAttributes") * with the given BeanFactory, as used by the WebApplicationContext. * @param bf the BeanFactory to configure * @param servletContext the ServletContext that we're running within * @param servletConfig the ServletConfig of the containing Portlet */ public static void registerEnvironmentBeans( ConfigurableListableBeanFactory bf, ServletContext servletContext, ServletConfig servletConfig) { if (servletContext != null && !bf.containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME)) { bf.registerSingleton(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME, servletContext); } if (servletConfig != null && !bf.containsBean(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME)) { bf.registerSingleton(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, servletConfig); } if (!bf.containsBean(WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME)) { Map<String, String> parameterMap = new HashMap<String, String>(); if (servletContext != null) { Enumeration<?> paramNameEnum = servletContext.getInitParameterNames(); while (paramNameEnum.hasMoreElements()) { String paramName = (String) paramNameEnum.nextElement(); parameterMap.put(paramName, servletContext.getInitParameter(paramName)); } } if (servletConfig != null) { Enumeration<?> paramNameEnum = servletConfig.getInitParameterNames(); while (paramNameEnum.hasMoreElements()) { String paramName = (String) paramNameEnum.nextElement(); parameterMap.put(paramName, servletConfig.getInitParameter(paramName)); } } bf.registerSingleton(WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME, Collections.unmodifiableMap(parameterMap)); } if (!bf.containsBean(WebApplicationContext.CONTEXT_ATTRIBUTES_BEAN_NAME)) { Map<String, Object> attributeMap = new HashMap<String, Object>(); if (servletContext != null) { Enumeration<?> attrNameEnum = servletContext.getAttributeNames(); while (attrNameEnum.hasMoreElements()) { String attrName = (String) attrNameEnum.nextElement(); attributeMap.put(attrName, servletContext.getAttribute(attrName)); } } bf.registerSingleton(WebApplicationContext.CONTEXT_ATTRIBUTES_BEAN_NAME, Collections.unmodifiableMap(attributeMap)); } } /** * Convenient variant of {@link #initServletPropertySources(MutablePropertySources, * ServletContext, ServletConfig)} that always provides {@code null} for the * {@link ServletConfig} parameter. * @see #initServletPropertySources(MutablePropertySources, ServletContext, ServletConfig) */ public static void initServletPropertySources(MutablePropertySources propertySources, ServletContext servletContext) { initServletPropertySources(propertySources, servletContext, null); } /** * Replace {@code Servlet}-based {@link StubPropertySource stub property sources} with * actual instances populated with the given {@code servletContext} and * {@code servletConfig} objects. * <p>This method is idempotent with respect to the fact it may be called any number * of times but will perform replacement of stub property sources with their * corresponding actual property sources once and only once. * @param propertySources the {@link MutablePropertySources} to initialize (must not * be {@code null}) * @param servletContext the current {@link ServletContext} (ignored if {@code null} * or if the {@link StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME * servlet context property source} has already been initialized) * @param servletConfig the current {@link ServletConfig} (ignored if {@code null} * or if the {@link StandardServletEnvironment#SERVLET_CONFIG_PROPERTY_SOURCE_NAME * servlet config property source} has already been initialized) * @see org.springframework.core.env.PropertySource.StubPropertySource * @see org.springframework.core.env.ConfigurableEnvironment#getPropertySources() */ public static void initServletPropertySources( MutablePropertySources propertySources, ServletContext servletContext, ServletConfig servletConfig) { Assert.notNull(propertySources, "'propertySources' must not be null"); if (servletContext != null && propertySources.contains(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME) && propertySources.get(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME) instanceof StubPropertySource) { propertySources.replace(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, new ServletContextPropertySource(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, servletContext)); } if (servletConfig != null && propertySources.contains(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME) && propertySources.get(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME) instanceof StubPropertySource) { propertySources.replace(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME, new ServletConfigPropertySource(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME, servletConfig)); } } /** * Return the current RequestAttributes instance as ServletRequestAttributes. * @see RequestContextHolder#currentRequestAttributes() */ private static ServletRequestAttributes currentRequestAttributes() { RequestAttributes requestAttr = RequestContextHolder.currentRequestAttributes(); if (!(requestAttr instanceof ServletRequestAttributes)) { throw new IllegalStateException("Current request is not a servlet request"); } return (ServletRequestAttributes) requestAttr; } /** * Factory that exposes the current request object on demand. */ @SuppressWarnings("serial") private static class RequestObjectFactory implements ObjectFactory<ServletRequest>, Serializable { @Override public ServletRequest getObject() { return currentRequestAttributes().getRequest(); } @Override public String toString() { return "Current HttpServletRequest"; } } /** * Factory that exposes the current response object on demand. */ @SuppressWarnings("serial") private static class ResponseObjectFactory implements ObjectFactory<ServletResponse>, Serializable { @Override public ServletResponse getObject() { ServletResponse response = currentRequestAttributes().getResponse(); if (response == null) { throw new IllegalStateException("Current servlet response not available - " + "consider using RequestContextFilter instead of RequestContextListener"); } return response; } @Override public String toString() { return "Current HttpServletResponse"; } } /** * Factory that exposes the current session object on demand. */ @SuppressWarnings("serial") private static class SessionObjectFactory implements ObjectFactory<HttpSession>, Serializable { @Override public HttpSession getObject() { return currentRequestAttributes().getRequest().getSession(); } @Override public String toString() { return "Current HttpSession"; } } /** * Factory that exposes the current WebRequest object on demand. */ @SuppressWarnings("serial") private static class WebRequestObjectFactory implements ObjectFactory<WebRequest>, Serializable { @Override public WebRequest getObject() { ServletRequestAttributes requestAttr = currentRequestAttributes(); return new ServletWebRequest(requestAttr.getRequest(), requestAttr.getResponse()); } @Override public String toString() { return "Current ServletWebRequest"; } } /** * Inner class to avoid hard-coded JSF dependency. */ private static class FacesDependencyRegistrar { public static void registerFacesDependencies(ConfigurableListableBeanFactory beanFactory) { beanFactory.registerResolvableDependency(FacesContext.class, new ObjectFactory<FacesContext>() { @Override public FacesContext getObject() { return FacesContext.getCurrentInstance(); } @Override public String toString() { return "Current JSF FacesContext"; } }); beanFactory.registerResolvableDependency(ExternalContext.class, new ObjectFactory<ExternalContext>() { @Override public ExternalContext getObject() { return FacesContext.getCurrentInstance().getExternalContext(); } @Override public String toString() { return "Current JSF ExternalContext"; } }); } } }