blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M โ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
01bc84b21999f53bb029099f78e74fd8354a5838 | 2d84aead79b51e8440616eb1b075757bd7755133 | /collectionTest/src/basic/StackQueueTest.java | 4f1eab70c7bc58279529de6ba948676952ee8e91 | [] | no_license | jinsu009/highJava | c7387051ae67bf4d5495d20141fd5de0977a827b | aa12cdd5138335dd6520ec797fe65a516cb46fb6 | refs/heads/master | 2022-12-07T18:17:56.943058 | 2020-08-24T11:54:36 | 2020-08-24T11:54:36 | 289,911,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,893 | java | package basic;
//20.02.05
import java.util.*;
public class StackQueueTest {
/*
* - Stack : ํ์
์ ์ถ(LIFO) >> Stack LinkedList
*
* - Queue : ์ ์
์ ์ถ(FIFO) >> LinkedList
*/
public static void main(String[] args) {
/*
* stack ์ ๋ช
๋ น
* 1. ์๋ฃ ์
๋ ฅ : push(์
๋ ฅํ ๊ฐ)
* 2. ์๋ฃ ์ถ๋ ฅ : pop() > ์๋ฃ๋ฅผ ๊บผ๋ด์จ ํ ๊บผ๋ด์จ ์๋ฃ๋ฅผ stack์์ ์ญ์ ํ๋ค.
* peak() > ์๋ฃ๋ฅผ ๊บผ๋ด์จ๋ค.
* 3. ์คํ์ด ๋น์๋์ง ์ฌ๋ถ ๊ฒ์ฌ : isEmpty() > ๋น์์ผ๋ฉด true, ๊ทธ๋ ์ง ์์ผ๋ฉด false
* (isEmpty ๋ array, arraylist์ ์ ๋ถ ์กด์ฌํ๋ ๊ธฐ๋ฅ)
*/
LinkedList<String> stack = new LinkedList<>();
System.out.println("๋น์๋์ง ์ฌ๋ถ >> "+ stack.isEmpty());
stack.push("์ฌ๊ณผ");
//add๋ฅผ ์ฌ์ฉํด๋ ์ข์ง๋ง ์์์น ๋ชปํ ์ค๋ฅ๊ฐ ๋ฐ์ํ ์ ์๋ค.
stack.push("ํฌ๋");
stack.push("๋ฐ๋๋");
stack.push("์ฉ๊ณผ");
System.out.println("ํ์ฌ์ stack >> " + stack);
//์ถ๋ ฅ์์ : ์ฉ๊ณผ , ๋ฐ๋๋, ํฌ๋, ์ฌ๊ณผ
//์ ์ผ ๋ง์ง๋ง์ ์
๋ ฅํ ๋
์์ด ์ ์ผ ์์ ์ธ๋ฑ์ค์ ์ ์ฅ๋๋ค.
System.out.println("๋น์๋์ง ์ฌ๋ถ >> "+ stack.isEmpty());
String data = stack.pop();
System.out.println("๊บผ๋ด์จ ์๋ฃ >> " + data);
System.out.println("๊บผ๋ด์จ ์๋ฃ >> " + stack.pop());
System.out.println("ํ์ฌ์ stack >> " + stack);
System.out.println("ํ์ฌ ์ฌ์ฉํ ์์๋ ์๋ฃ : " + stack.peek());
System.out.println("ํ์ฌ์ stack >> " + stack);
stack.push("ํค์");
System.out.println("ํ์ฌ์ stack >> " + stack);
System.out.println("๊บผ๋ด์จ ์๋ฃ >> " + stack.pop());
System.out.println("ํ์ฌ์ stack >> " + stack);
//---------------------------------------------
System.out.println("===============================");
/*
* Queue ๋ช
๋ น
* 1. ์๋ฃ ์
๋ ฅ : offer(์
๋ ฅํ ์๋ฃ)
* 2. ์๋ฃ ์ถ๋ ฅ : poll > ํ์์ ์๋ฃ๋ฅผ ๊บผ๋ด๊ณ ๊บผ๋ด์จ ์๋ฃ๋ ํ์์ ์ญ์ ํ๋ค.
* peek > ํ์์ ์๋ฃ๋ฅผ ๊บผ๋ด์ง๋ง ์ญ์ ๋ ํ์ง ์๋๋ค.
*/
LinkedList<String> queue = new LinkedList<>();
queue.offer("๊ฐ์์ง");
queue.offer("๊ณ ์์ด");
queue.offer("์ฟผ์นด");
queue.offer("์ฝ์๋ผ");
System.out.println("ํ์ฌ์ queue >> " + queue);
String temp = queue.poll();
System.out.println("๊บผ๋ด์จ ์๋ฃ >> " + temp);
System.out.println("๊บผ๋ด์จ ์๋ฃ >> " + queue.poll());
System.out.println("ํ์ฌ์ queue >> " + queue);
System.out.println("ํ์ฌ ์ฌ์ฉํ ์ ์๋ queue ๋ฐ์ดํฐ >> " + queue.peek());
System.out.println("ํ์ฌ์ queue >> " + queue);
queue.offer("ํจ๋ง");
System.out.println("ํ์ฌ์ queue >> " + queue);
System.out.println("๊บผ๋ด์จ ์๋ฃ >> " + queue.poll());
System.out.println("ํ์ฌ์ queue >> " + queue);
}
}
| [
"chlrkd_009@naver.com"
] | chlrkd_009@naver.com |
c01ca58643839a9a0ec307a580befcaafa644c78 | 05e69d1cc8be0ebdce3a871f4d25478894c70872 | /app/src/main/java/com/xtelsolution/xmec/model/resp/RESP_Drug.java | cc28160c526404cdca65b5be234209f7dccbc11d | [] | no_license | vihahb/xmec-phase1 | c8b2f5c228d898d5f3442c9bc17d91b2c28a4603 | 7d77662fb5aec5d410b82390d22e489fee095212 | refs/heads/master | 2021-08-31T16:40:51.800498 | 2017-12-22T03:35:59 | 2017-12-22T03:35:59 | 115,071,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package com.xtelsolution.xmec.model.resp;
import com.google.gson.annotations.Expose;
import com.xtelsolution.xmec.model.entity.Drug;
import com.xtelsolution.xmec.model.entity.RESP_Basic;
import java.util.List;
/**
* Author: Lรช Cรดng Long Vลฉ
* Date: 10/27/2017
* Email: leconglongvu@gmail.com
*/
public class RESP_Drug extends RESP_Basic {
@Expose
private List<Drug> data;
public RESP_Drug() {
}
public RESP_Drug(List<Drug> data) {
this.data = data;
}
public List<Drug> getData() {
return data;
}
public void setData(List<Drug> data) {
this.data = data;
}
} | [
"vivh@vivhs-MacBook-Pro.local"
] | vivh@vivhs-MacBook-Pro.local |
240e10941d8524205cf45c67ec4571c9b1a5b9fe | df79dbcfc869b9d2180a44e34aa1e5ef208d1655 | /springboot/webApplicationMergewithOther/src/main/java/com/parag/main/WebApplicationMergewithOtherApplication.java | 9f16cdb855f88cf4ef54b1051f951fc47d725931 | [] | no_license | paragkhedkar07/TotalProjects | a170e3d5455a046b62709986f3f00a95b49fee70 | 7791da688c121d2422a4f4e52e91256c9b7606e5 | refs/heads/master | 2023-03-14T23:47:43.492749 | 2021-03-27T14:59:08 | 2021-03-27T14:59:08 | 352,097,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.parag.main;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class WebApplicationMergewithOtherApplication {
public static void main(String[] args) {
SpringApplication.run(WebApplicationMergewithOtherApplication.class, args);
System.out.println("hello1");
}
}
| [
"paragkhedkar07@gmail.com"
] | paragkhedkar07@gmail.com |
9798ef9f1cdaf540bdda3892f3789c7eeae41e7d | fbf1c5df5bae7b441ee40ec0791f0bb3dc418da0 | /Yoga/src/main/java/com/magpie/yoga/service/TopicService.java | 3434c4c3c9d1925f7798c7d32d1fa309c58112ae | [] | no_license | fitflowappp/backend | c4d8e53219bf1e72336ced74ffbe917d07d4db06 | b58be54f6eb80c72d92eee5c74c4e6af57e2e08a | refs/heads/master | 2021-09-06T21:57:01.113836 | 2018-02-12T08:09:19 | 2018-02-12T08:09:19 | 109,380,944 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 860 | java | package com.magpie.yoga.service;
import java.util.List;
import com.magpie.yoga.model.Sort;
import com.magpie.yoga.model.Topic;
import com.magpie.yoga.model.TopicSingles;
import com.magpie.yoga.model.TopicSort;
public interface TopicService {
public List<Topic> findAll();
public Topic find(String topicId);
public Topic findOneByChallengeId(String challengeId);
public List<TopicSingles> findSingles(String topicId);
public Topic save(Topic topic);
public TopicSingles saveSingles(TopicSingles topicSingles);
/**
* ไฟๅญtopic็singlesๅ่กจ๏ผๅๆถๅป้คๅๅ
ไปๅ่กจๅป้ค็singles
*/
public void saveSingles(List<? extends TopicSingles> topicSingles,String topicId);
public boolean delete(String topicId);
public boolean deleteTopicSingles(String topicId);
public boolean sortTopicAndDeleteOther(List<TopicSort> sortList);
}
| [
"xia_jok@126.com"
] | xia_jok@126.com |
c8c7911c1d75dd816961498d77ca602124002c36 | 04f2945762012b30007fa6e09d4893384f6d60f9 | /platform/src/main/java/com/yanhuada/platform/dao/PlatformNoticeMapper.java | 040c5cb640ba2effa05c3c61d4e4df1cc00cf6b5 | [] | no_license | yanhuada/zero-backend | 0a054e27df051954275d087198c16bed4f54cc4d | 7745b528c8d61ed178eb0eba60409f6f8f91ad66 | refs/heads/master | 2023-01-19T14:34:31.303416 | 2020-12-03T15:34:31 | 2020-12-03T15:34:31 | 318,236,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package com.yanhuada.platform.dao;
import com.yanhuada.dao.mapper.NoticeMapper;
/**
* @author yanhuada
* CREATE ON 2020/8/14 14:08
*/
public interface PlatformNoticeMapper extends NoticeMapper {
}
| [
"2584135898@qq.com"
] | 2584135898@qq.com |
e66004c8ee02557804cb84f47d956006fdd2c36f | 9725f230d1330703a963fba3ba6f369a10887526 | /aliyun-java-sdk-elasticsearch/src/main/java/com/aliyuncs/elasticsearch/model/v20170613/UpdateSynonymsDictsRequest.java | ad3e6a97ff4aec263f4a61b820124ff6c4553983 | [
"Apache-2.0"
] | permissive | czy95czy/aliyun-openapi-java-sdk | 21e74b8f23cced2f65fb3a1f34648c7bf01e3c48 | 5410bde6a54fe40a471b43e50696f991f5df25aa | refs/heads/master | 2020-07-13T02:18:08.645626 | 2019-08-29T03:16:37 | 2019-08-29T03:16:37 | 204,966,560 | 0 | 0 | NOASSERTION | 2019-08-28T23:38:50 | 2019-08-28T15:38:50 | null | UTF-8 | Java | false | false | 1,433 | java | /*
* 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.aliyuncs.elasticsearch.model.v20170613;
import com.aliyuncs.RoaAcsRequest;
import com.aliyuncs.http.MethodType;
/**
* @author auto create
* @version
*/
public class UpdateSynonymsDictsRequest extends RoaAcsRequest<UpdateSynonymsDictsResponse> {
public UpdateSynonymsDictsRequest() {
super("elasticsearch", "2017-06-13", "UpdateSynonymsDicts", "elasticsearch");
setUriPattern("/openapi/instances/[InstanceId]/synonymsDict");
setMethod(MethodType.PUT);
}
private String instanceId;
public String getInstanceId() {
return this.instanceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
if(instanceId != null){
putPathParameter("InstanceId", instanceId);
}
}
@Override
public Class<UpdateSynonymsDictsResponse> getResponseClass() {
return UpdateSynonymsDictsResponse.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
1f562d98c32933f31b31992d6b2a63e5cf18ee1d | a5d5384f8ae51cc867bc67d1ae902cff6728116c | /day5/encog/src/main/java/org/encog/util/normalize/segregate/RangeSegregator.java | e6c9a867917f42c7a4062bb594b83092e3f3941a | [] | no_license | joshuajnoble/SecretLifeOfObjects | 66be3bca0559014f224b4dbe7030e7651c6b2805 | aae0f631860d3f01f1252e8a157bb3425c29596b | refs/heads/master | 2020-04-29T03:18:00.959777 | 2015-06-13T15:53:11 | 2015-06-13T15:53:11 | 35,483,832 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,604 | java | /*
* Encog(tm) Core v3.3 - Java Version
* http://www.heatonresearch.com/encog/
* https://github.com/encog/encog-java-core
* Copyright 2008-2014 Heaton Research, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information on Heaton Research copyrights, licenses
* and trademarks visit:
* http://www.heatonresearch.com/copyright
*/
package org.encog.util.normalize.segregate;
import java.util.ArrayList;
import java.util.Collection;
import org.encog.util.normalize.DataNormalization;
import org.encog.util.normalize.input.InputField;
/**
* Range segregators are used to segregate data and include or exclude if it is
* within a certain range.
*/
public class RangeSegregator implements Segregator {
/**
* The source field that this is based on.
*/
private InputField sourceField;
/**
* If none of the ranges match, should this data be included.
*/
private boolean include;
/**
* The ranges.
*/
private final Collection<SegregationRange> ranges =
new ArrayList<SegregationRange>();
/**
* The normalization object.
*/
private DataNormalization normalization;
/**
* Default constructor for reflection.
*/
public RangeSegregator() {
}
/**
* Construct a range segregator.
*
* @param sourceField
* The source field.
* @param include
* Default action, if the data is not in any of the ranges,
* should it be included.
*/
public RangeSegregator(final InputField sourceField,
final boolean include) {
this.sourceField = sourceField;
this.include = include;
}
/**
* Add a range.
*
* @param low
* The low end of the range.
* @param high
* The high end of the range.
* @param include
* Should this range be included.
*/
public void addRange(final double low, final double high,
final boolean include) {
final SegregationRange range = new SegregationRange(low, high, include);
addRange(range);
}
/**
* Add a range.
*
* @param range
* The range to add.
*/
public void addRange(final SegregationRange range) {
this.ranges.add(range);
}
/**
* @return The normalization object used by this object.
*/
public DataNormalization getNormalization() {
return this.normalization;
}
/**
* @return The source field that the ranges are compared against.
*/
public InputField getSourceField() {
return this.sourceField;
}
/**
* Init the object.
* @param normalization The normalization object that owns this range.
*/
public void init(final DataNormalization normalization) {
this.normalization = normalization;
}
/**
* @return True if the current row should be included according to this
* segregator.
*/
public boolean shouldInclude() {
final double value = this.sourceField.getCurrentValue();
for (final SegregationRange range : this.ranges) {
if (range.inRange(value)) {
return range.isIncluded();
}
}
return this.include;
}
/**
* Nothing needs to be done to setup for a pass.
*/
public void passInit() {
}
}
| [
"jnoble@teague.com"
] | jnoble@teague.com |
4954893fb065a95d7cc85743d085e6724ebefe7d | fee93639544564fbf506371ec6b6be8884479a37 | /app/net/zookeeper/live/common/NodeProperty.java | a010a164882d9f9fdd91d793eea57e943bafea7c | [] | no_license | nkorange/zookeeper-live | d12e5f0b9a3e39c2e026b945e64126087625ba28 | 2ecd5083b489d6b03dffd33c9e7a05883f81a8d0 | refs/heads/master | 2016-12-12T17:54:51.954109 | 2016-05-03T08:59:17 | 2016-05-03T08:59:17 | 30,816,995 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,997 | java | package net.zookeeper.live.common;
import java.util.Date;
/**
* Node property stored on zookeeper
*
* @author zpf.073@gmail.com
*
*/
public class NodeProperty {
private String cZxid;
private String ctime;
private String mZxid;
private String mtime;
private String pZxid;
private int cversion;
private int dataVersion;
private int aclVersion;
private String ephemeralOwner;
private int dataLength;
private int numChildren;
public NodeProperty() {
}
public String getcZxid() {
return cZxid;
}
public void setcZxid(String cZxid) {
this.cZxid = cZxid;
}
public String getCtime() {
return ctime;
}
public void setCtime(String ctime) {
this.ctime = ctime;
}
public String getmZxid() {
return mZxid;
}
public void setmZxid(String mZxid) {
this.mZxid = mZxid;
}
public String getMtime() {
return mtime;
}
public void setMtime(String mtime) {
this.mtime = mtime;
}
public String getpZxid() {
return pZxid;
}
public void setpZxid(String pZxid) {
this.pZxid = pZxid;
}
public int getCversion() {
return cversion;
}
public void setCversion(int cversion) {
this.cversion = cversion;
}
public int getDataVersion() {
return dataVersion;
}
public void setDataVersion(int dataVersion) {
this.dataVersion = dataVersion;
}
public int getAclVersion() {
return aclVersion;
}
public void setAclVersion(int aclVersion) {
this.aclVersion = aclVersion;
}
public String getEphemeralOwner() {
return ephemeralOwner;
}
public void setEphemeralOwner(String ephemeralOwner) {
this.ephemeralOwner = ephemeralOwner;
}
public int getDataLength() {
return dataLength;
}
public void setDataLength(int dataLength) {
this.dataLength = dataLength;
}
public int getNumChildren() {
return numChildren;
}
public void setNumChildren(int numChildren) {
this.numChildren = numChildren;
}
}
| [
"pengfei.zhu@dewmobile.net"
] | pengfei.zhu@dewmobile.net |
8818146ca0aa81d15b7e718e0fbe5d836c92f49d | b72d5f6e87219e5b1e9ef35d5a206d6c56c0658e | /app/src/main/java/com/huanhong/appointment/net/httploader/MeetRoomsLoader.java | ebc2d87bd16d50e285ed3254edaae2311a1b230f | [] | no_license | cbb1993/Appointment | bc11f5df61658742da48b72d3363af28cdeb0503 | e8cdd31da0947ae1ce339d8df40139894cbd40cf | refs/heads/master | 2023-01-13T11:35:49.893996 | 2020-11-02T13:20:11 | 2020-11-02T13:20:11 | 198,140,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,320 | java | package com.huanhong.appointment.net.httploader;
import com.huanhong.appointment.bean.LoginReponseBean;
import com.huanhong.appointment.bean.Room;
import com.huanhong.appointment.constant.Constant;
import com.huanhong.appointment.net.BaseResponse;
import com.huanhong.appointment.net.ObjectLoader;
import com.huanhong.appointment.net.PayLoad;
import com.huanhong.appointment.net.RetrofitServiceManager;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;
/**
* Created by dhy
* Date: 2019/5/9
* Time: 11:18
* describe:
*/
public class MeetRoomsLoader extends ObjectLoader {
private RequestService mScanService;
public MeetRoomsLoader() {
mScanService = RetrofitServiceManager.getInstance().create(RequestService.class);
}
public Observable<List<Room>> getRooms(HashMap<String, String> map) {
return observe(mScanService.getRooms(LoginReponseBean.getToken(),map)).map(new PayLoad<List<Room>>());
}
public interface RequestService {
@GET(Constant.ROOMS)
Observable<BaseResponse<List<Room>>> getRooms(@Header("Authorization") String token,@QueryMap HashMap<String, String> map);
}
}
| [
"chenbinbin@nissanchina.cn"
] | chenbinbin@nissanchina.cn |
5a397b28cf0d2c3059b7100763d53e68a6246b19 | dc9b460fcaeb29ddae0437f84f05ef3b9bfd76db | /com.PeerAdmin/src/main/java/com/PeerAdmin/SingleAndMultiple.java | 16ce4fce11588907fcaa1aaa8259abb469093b47 | [] | no_license | kuldeepc08/Project | 7d7e94f34c44a59d1e05eac7f9182bce8f2c0052 | fb965ee02d5c33eb8297ba3dd19bbfe61e89249f | refs/heads/master | 2021-08-15T22:37:02.026967 | 2017-11-18T12:47:10 | 2017-11-18T12:47:10 | 108,850,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,767 | java | package com.PeerAdmin;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class SingleAndMultiple{
WebDriver driver;
public SingleAndMultiple(WebDriver driver)
{
this.driver=driver;
}
public void frames()
{
List<WebElement> iframeElements = driver.findElements(By.tagName("iframe"));
System.out.println("The total number of iframes are " + iframeElements.size());
WebElement frame = driver.findElement(By.id("surveysIframe"));
WebDriverWait wait = new WebDriverWait(driver, 150);
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(frame));
System.out.println("in the Frame?");
}
public WebElement mainPanel()
{
WebElement panel = driver.findElement(By.xpath("//app-display-single-choice-radio/div/div"));
return panel;
}
public void singleandMultipleHeader()
{
frames();
WebElement header = mainPanel().findElement(By.cssSelector(".heading-top>p"));
System.out.println("Single and multiple question Header is - " +header.getText());
driver.switchTo().defaultContent();
}
public void contentBelowSingleandMultiple()
{
frames();
WebElement content = mainPanel().findElement
(By.xpath("//app-display-single-choice-radio/div/div/p/p"));
System.out.println("Content below single and multiple is - " +content.getText());
driver.switchTo().defaultContent();
}
public void selectRadioButton()
{
frames();
WebElement size= mainPanel().findElement(By.xpath("//span/div[1]/div/div/div/label"));
System.out.println("" +size);
size.click();
driver.switchTo().defaultContent();
}
public void learnMoreSingleAndMultiple()
{
frames();
WebElement learnMore = mainPanel().findElement(By.cssSelector(".learn-more.magtop10>a>span"));
learnMore.click();
driver.switchTo().defaultContent();
}
public void learnMoreText()
{
frames();
WebElement learnMoreText = mainPanel().findElement
(By.cssSelector(".well>p>p"));
System.out.println("Learn more Text for single and matrix Question - " +learnMoreText.getText());
driver.switchTo().defaultContent();
}
public void clickOnContinue()
{
frames();
WebElement button = mainPanel().findElement(By.xpath("//label[contains(text(),'Continue')]"));
button.click();
driver.switchTo().defaultContent();
}
public void allFunctionsSingleAndMultiple()
{
singleandMultipleHeader();
// contentBelowSingleandMultiple();
selectRadioButton();
learnMoreSingleAndMultiple();
learnMoreText();
clickOnContinue();
}
}
| [
"kuldeepc08@gmail.com"
] | kuldeepc08@gmail.com |
f227e54c0da0b00ac3366bb18a46de3eb2ed0240 | 0d9b8485fef19c33945f542c95edf95f218fb2b7 | /src/main/java/cn/com/czcb/service/IFeedbackService.java | 514740e42aee3b41063b07155defd34f2f851c20 | [] | no_license | x7iaob/czcb | 700fea1c65a31e15052dc1037a616839fe8f67ef | 650b6fd1e2ac484ad6506305a43bef30921683fd | refs/heads/master | 2020-06-18T14:38:24.729182 | 2018-07-22T17:19:08 | 2018-07-22T17:19:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 248 | java | /**
* 2018/4/9 10:53:19 Wen Jun created.
*/
package cn.com.czcb.service;
import cn.com.czcb.model.Feedback;
/**
* Service ๆฅๅฃ
* Created by Wen Jun on 2018/04/09.
*/
public interface IFeedbackService extends IModelService<Feedback> {
}
| [
"w1999wtw3537@sina.com"
] | w1999wtw3537@sina.com |
601f5157f0d79f7c02c82e8b488c8b0083fd73ab | 0c8061feacdb220c4bc09e9ce059f0d67bef1f4a | /Base/src/struct/BreakDemo.java | 2c273057774f527dd715389c2c70efd4eb2e948b | [] | no_license | usertutu/Code-Java | 162120773bcb576b3580aa105e12ce35cee4f9fc | 34c16a04167616fc67400a675044ab5094951322 | refs/heads/main | 2023-03-10T10:02:37.318971 | 2021-03-02T07:15:16 | 2021-03-02T07:15:16 | 316,701,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | package struct;
public class BreakDemo {
public static void main(String[] args) {
/*
* break ๅจไปปไฝๅพช็ฏ่ฏญๅฅ็ไธปไฝ้จๅ๏ผๅๅฏ็จbreakๆงๅถๅพช็ฏ็ๆต็จใbreak็จไบ
* ๅผบ่ก้ๅบๅพช็ฏ๏ผไธๆง่กๅพช็ฏไธญๅฉไฝ็่ฏญๅฅ๏ผbreakๅจswitchไธญไฝฟ็จ๏ผ
*
* continue ่ฏญๅฅๅจๅพช็ฏ่ฏญๅฅไฝไธญ๏ผ็จไบ็ปๆญขๆๆฌกๅพช็ฏ๏ผ
* ๅณ่ทณ่ฟๅพช็ฏไฝไธญๆชๆง่ก็่ฏญๅฅ๏ผๆฅ็่ฟ่กไธๆฌกๆฏๅฆๆง่กๅพช็ฏ็ๅคๆญ
*
*
* */
}
}
| [
"484027291@qq.com"
] | 484027291@qq.com |
c7221d3af995a6a06c830a81ca7786c0caa05012 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_804d7d57a26f0837cc126c08996f8bfaad87b02d/SchedulerThreadTest/11_804d7d57a26f0837cc126c08996f8bfaad87b02d_SchedulerThreadTest_s.java | f13b2763dc74c5029a12c4020f529db902fd3787 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,941 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ode.scheduler.simple;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ode.scheduler.simple.SchedulerThread;
import org.apache.ode.scheduler.simple.Task;
import org.apache.ode.scheduler.simple.TaskRunner;
import junit.framework.TestCase;
/**
* Test of SchedulerThread.
*
* @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
*/
public class SchedulerThreadTest extends TestCase implements TaskRunner {
static final long SCHED_TOLERANCE = 40;
SchedulerThread _st;
List<TR> _tasks = new ArrayList<TR>(100);
public void setUp() throws Exception {
_st = new SchedulerThread(this);
}
public void testSchedulingResolution() throws Exception {
_st.start();
long schedtime = System.currentTimeMillis() + 300;
_st.enqueue(new Task(schedtime));
Thread.sleep(600);
assertEquals(1,_tasks.size());
assertTrue(_tasks.get(0).time < schedtime + SCHED_TOLERANCE / 2);
assertTrue(_tasks.get(0).time > schedtime - SCHED_TOLERANCE / 2);
}
public void testStartStop() throws Exception {
_st.start();
long schedtime = System.currentTimeMillis() + 500;
_st.enqueue(new Task(schedtime));
_st.stop();
Thread.sleep(600);
assertEquals(0,_tasks.size());
_st.start();
Thread.sleep(SCHED_TOLERANCE);
assertEquals(1,_tasks.size());
}
public void testParallelEnqueue() throws Exception {
_st.start();
final long startTime = System.currentTimeMillis() + 100;
final AtomicInteger ai = new AtomicInteger(300);
// enque in reverse order
Runnable run = new Runnable() {
public void run() {
Task tsk = new Task(startTime + ai.getAndDecrement() * 5);
_st.enqueue(tsk);
}
};
ExecutorService es = Executors.newFixedThreadPool(50);
for (int i = 0; i < 300; ++i)
es.execute(run);
Thread.sleep(300 + 300 * 5);
assertEquals(300,_tasks.size());
// Make sure they got scheduled in the right order
for (int i = 0; i < 299; ++i)
assertTrue(_tasks.get(i).task.schedDate < _tasks.get(i+1).task.schedDate);
// Check scheduling tolerance
for (TR tr : _tasks) {
assertTrue(tr.time < tr.task.schedDate + SCHED_TOLERANCE / 2);
assertTrue(tr.time > tr.task.schedDate - SCHED_TOLERANCE / 2);
}
}
public void runTask(Task task) {
synchronized(_tasks) {
_tasks.add(new TR(System.currentTimeMillis(),task));
}
}
class TR {
long time;
Task task;
TR(long time, Task task) {
this.time = time;
this.task = task;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
aa776278d30317cd6a626656516087553701e9b9 | f8e513c4d1082dc26fb161f160140122326f9899 | /src/main/java/it/euris/academy/finalCinema/data/dto/SpettatoreDto.java | c35c443a708bae6f6852005c7df20b9617f6fdb1 | [] | no_license | atlassers/aca_exam_na | a5813158433639830337745cccc843e68c43bfb3 | a614e0fe777eb1f15f78cf56e6a7a715076b663f | refs/heads/main | 2023-08-27T07:13:57.239666 | 2021-10-29T14:28:27 | 2021-10-29T14:28:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 968 | java | package it.euris.academy.finalCinema.data.dto;
import it.euris.academy.finalCinema.data.archetype.Dto;
import it.euris.academy.finalCinema.data.model.Spettatore;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
public class SpettatoreDto implements Dto {
private String idSpettatore;
private String nome;
private String cognome;
private String dataNascita;
@Override
public Spettatore toModel() {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
Spettatore s= Spettatore.builder()
.idSpettatore(Long.valueOf(idSpettatore))
.nome(nome)
.cognome(cognome)
.build();
try {
s.setDataNascita(formatter.parse(dataNascita));
} catch (ParseException e) {
e.printStackTrace();
}
return s;
}
}
| [
"nardanarda89@gmail.com"
] | nardanarda89@gmail.com |
54375540019416c51fd11f59900156d6aaa8d256 | dec6defc3f29f63626defb1a94bcce7bc5dc1c30 | /src/main/java/com/kodingkingdom/kodebuilder/var/NumVar.java | c18238816baa2f9c5f17d9c21f517e3d0a72dcd8 | [] | no_license | jay-kodingkingdom/kkmc-kodebuilder | 0950273eef0e43303eb767c92aa15c425d774c8b | 1b763b475228a96b4fe893de2bd6f3e54f14624d | refs/heads/master | 2021-09-20T12:03:21.836734 | 2018-08-09T09:49:39 | 2018-08-09T09:49:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | package com.kodingkingdom.kodebuilder.var;
public abstract class NumVar extends KodeVar{
public NumVar(String Name){name=Name;}
@Override
public abstract void setdata(Object Data);
@Override
public abstract Long getdata();}
| [
"jay.kodingkingdom@gmail.com"
] | jay.kodingkingdom@gmail.com |
1e6b21f522ed7e42ac9dec22573f5e99bcd6820f | 6c17927167f840e7578a3a1dc1d4c6b98241ed18 | /JAXB/src/com/classResolver/bean/Foo.java | 4ce7c036e211e930a0229166aa41b60bbde89a5c | [] | no_license | hungmans6779/StudySpringProject | 7b9d01af6b850995f6fda46ce8e94a065903d5aa | ea7901cd88c069577fb39aa312cc4838c49d4a74 | refs/heads/master | 2020-04-14T01:19:08.344883 | 2018-12-30T03:13:50 | 2018-12-30T03:13:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package com.classResolver.bean;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlIDREF;
import javax.xml.bind.annotation.XmlRootElement;
public class Foo {
public int a;
public String b;
@XmlIDREF
public Object c;
@Override
public String toString() {
return "Foo [a=" + a + ", b=" + b + ", c=" + c + "]";
}
}
| [
"hungmans6779@msn.com"
] | hungmans6779@msn.com |
a50f30592f2668b612a1e262d92d872d0f2a0301 | d21f2e6bdcdac6526449b0aa5d959a8a9ae706e3 | /gupaoedu-vip-distributed-io/src/main/java/com/gupaoedu/vip/distributed/io/nettydemo/v0/NettyServer.java | f1cd89a5e6c86cd45487898b77fde9899ed2a82f | [] | no_license | menyin/gupaovip | f353ef0587f92adfab14caa56a1a8886d0296fc0 | 5ff52875eabb0ea9646d13c74d83437d10ce65c1 | refs/heads/master | 2023-08-31T20:47:57.159931 | 2023-08-09T03:18:17 | 2023-08-09T03:18:17 | 157,330,297 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,329 | java | package com.gupaoedu.vip.distributed.io.nettydemo.v0;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
import io.netty.util.CharsetUtil;
public class NettyServer {
private static final String DEFAULT_IP = "127.0.0.1";
private static final int DEFAULT_PORT = 7777;
private static final int BOSS_NTHREADS = Runtime.getRuntime().availableProcessors()*2;
private static final int WORK_NTHREADS = 100;
private static final EventLoopGroup bossGroup = new NioEventLoopGroup(BOSS_NTHREADS);//ไธป็บฟ็จ็ป๏ผ็ธๅฝไบnio้็mianReactor
private static final EventLoopGroup workGroup = new NioEventLoopGroup(WORK_NTHREADS);//ๅทฅไฝ็บฟ็จ็ป๏ผ็ธๅฝไบnio้็subReactor
public static void main(String[] args) {
try {
start();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private static void start() throws InterruptedException {
start(DEFAULT_IP, DEFAULT_PORT);
}
private static void start(String ip, int port) throws InterruptedException {
ServerBootstrap serverBootstrap = initServerBootstrap();//ServerBootstrapไธบๆๅก็ซฏๅทฅๅ
ท็ฑป
ChannelFuture channelFuture = serverBootstrap.bind(ip, port).sync();//sync()ๆฏไปฅๅๆญฅ็ๆนๅผ๏ผๅณๅจbind()ๅฎๆๅๆญคไปฃ็ ไผ้ปๅก
System.out.println("ๆๅก็ซฏๅทฒๅฏๅจ....");
//ๆณจๆๆญคๅค็closeFuture()ๆฏๆณจๅๅ
ณ้ญfuture็ไบไปถ๏ผ่ไธๆฏๅ
ณ้ญfutureๆไฝใๅณๅจfuture่ขซๅ
ณ้ญๅๆญคไปฃ็ ไผ้ปๅก
//closeFuture()ๅ
ถๅฎๆฏ่ฟๅไบไธไธชpromiseๅฏน่ฑก๏ผ็ธๅฝไบไธไธช้ฉๅญใ้่ฟpromiseๅฏไปฅๆฅๆถไบไปถๅๆฐๅนถๅไธๅกๅค็
channelFuture.channel().closeFuture().sync();
System.out.println("ๆๅก็ซฏๅ
ณ้ญ....");
}
private static ServerBootstrap initServerBootstrap() {
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new ChannelInitializer<Channel>() {//่ฟไบๅๅงๅ็ๅ
ๅฎนไนๅฏไปฅๅจserverBootstrap.option()/childOption()ๆนๆณ้ๅๅงๅใๅฆๅค.attr()/.childAttr()ไนๅฏไปฅ่ฎพ็ฝฎๆๅก็ซฏๅๅฎขๆท็ซฏ็ไธไบๅฑๆง
protected void initChannel(Channel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();//pipelineๅฐฑๆฏไธไธชchannelHandler็ๅฎนๅจ๏ผๆฏไธไธชๅๅ้พ่กจ็็ปๆ
//ไปฅไธๆฏๅจpipelineๅฐพ้จๆทปๅ handler
pipeline.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4));
pipeline.addLast(new StringDecoder(CharsetUtil.UTF_8));
pipeline.addLast(new StringEncoder(CharsetUtil.UTF_8));
pipeline.addLast(new TcpServerHandler());
}
});
return serverBootstrap;
}
public static void shutdown(){
//๏ผ๏ผๆญคๅค้่ฆๅ
ณๆณจๅฆไฝไผ้
็ๅ
ณ้ญๆๅก
workGroup.shutdownGracefully();
bossGroup.shutdownGracefully();
}
}
| [
"845257580@qq.com"
] | 845257580@qq.com |
142435e8e99403fe916e4e06c7c84067152fe49a | 9d539ea5b13190eb416791a12c5f9350dc1a4812 | /src/Messages/Main.java | b995bf53d2cc97e1187d0c50aecb365924c6835c | [] | no_license | tomshenhao/JAVA_Learning | 42d3a7e68244ee47c83a1de6d8dc5a562fe0cf3f | d4277bd896b8e53a3c6d66336f1c8a79705117af | refs/heads/master | 2020-07-28T13:07:32.441931 | 2019-12-19T19:21:48 | 2019-12-19T19:21:48 | 209,420,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,815 | java | package Messages;
import java.util.Random;
public class Main {
public static void main(String[] args) {
Message message = new Message();
(new Thread(new Writer(message))).start();
(new Thread(new Reader(message))).start();
}
}
class Message{
private String message;
private boolean empty=true;
public synchronized String read() {
while(empty) {
try {
wait();
} catch (InterruptedException e) {
}
}
empty=true;
notifyAll();
return message;
}
public synchronized void write(String message) {
while(!empty) {
try {
wait();
} catch (InterruptedException e) {
}
}
empty=false;
this.message=message;
notifyAll();
}
}
class Writer implements Runnable{
private Message message;
public Writer(Message message) {
this.message=message;
}
public void run() {
String messages[]= {
"Humpty Dumpty sat on a wall",
"Humpty Dumpty had a great fall",
"All the king's horses and all the kings's men",
"Couldn's put Humpty Dumpty together again"
};
Random random = new Random();
for(int i=0; i<messages.length; i++) {
message.write(messages[i]);
try {
Thread.sleep(random.nextInt(2000));
} catch (InterruptedException e) {
}
}
message.write("Finished");
}
}
class Reader implements Runnable{
private Message message;
public Reader(Message message) {
this.message=message;
}
public void run() {
Random random = new Random();
for(String latestMessage=message.read(); !latestMessage.equals("Finished");latestMessage = message.read()) {
System.out.println(latestMessage);
try {
Thread.sleep(random.nextInt(2000));
} catch (InterruptedException e) {
}
}
}
} | [
"t822660@spark.co.nz"
] | t822660@spark.co.nz |
a17fdb57081fe8d42e39d9955b65904dbecc6ba5 | 26a1f63cbca0ee5100c4065cf550df9a8b8ddc2e | /src/org/mindinformatics/gwt/domeo/client/ui/annotation/forms/multipletargets/MultipleTargetsAnnotationFormsPanel.java | 2b45a5044f9fc3425058f301e7687af95eaaa2b6 | [
"Apache-2.0"
] | permissive | sayvaz/DomeoClient | 16a0e209ccfc9bb056ad7d21fafe93711f55bc41 | de0cd7069555e8f4b6f6f4b47500237e92b004e1 | refs/heads/master | 2021-01-01T05:38:18.824438 | 2013-07-31T16:40:56 | 2013-07-31T16:40:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,015 | java | package org.mindinformatics.gwt.domeo.client.ui.annotation.forms.multipletargets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.mindinformatics.gwt.domeo.client.IDomeo;
import org.mindinformatics.gwt.domeo.client.ui.annotation.actions.IAnnotationEditListener;
import org.mindinformatics.gwt.domeo.client.ui.annotation.forms.AFormComponent;
import org.mindinformatics.gwt.domeo.client.ui.annotation.forms.AFormsManager;
import org.mindinformatics.gwt.domeo.client.ui.annotation.forms.IAllowsMultipleTargets;
import org.mindinformatics.gwt.domeo.client.ui.annotation.forms.IFormGenerator;
import org.mindinformatics.gwt.domeo.client.ui.annotation.tiles.ITileComponent;
import org.mindinformatics.gwt.domeo.client.ui.east.annotation.AnnotationSummaryTable;
import org.mindinformatics.gwt.domeo.client.ui.lenses.selectors.TPrefixSuffixTextSelectorTile;
import org.mindinformatics.gwt.domeo.model.MAnnotation;
import org.mindinformatics.gwt.domeo.model.selectors.MSelector;
import org.mindinformatics.gwt.domeo.plugins.annotation.selection.ui.tile.TSelectionTile;
import org.mindinformatics.gwt.framework.component.IAnnotationRefreshableComponent;
import org.mindinformatics.gwt.framework.component.IRefreshableComponent;
import org.mindinformatics.gwt.framework.component.resources.model.MGenericResource;
import org.mindinformatics.gwt.framework.src.IContainerPanel;
import org.mindinformatics.gwt.framework.src.IContentPanel;
import org.mindinformatics.gwt.framework.src.IResizable;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TabLayoutPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* @author Paolo Ciccarese <paolo.ciccarese@gmail.com>
*/
public class MultipleTargetsAnnotationFormsPanel extends AFormsManager implements IContentPanel,
IAnnotationEditListener, IRefreshableComponent, IAnnotationRefreshableComponent, IResizable {
private static final String TITLE = "Multiple Target Annotation Creation";
private static final String TITLE_EDIT = "Multiple Target Annotation Editing";
interface Binder extends UiBinder<HorizontalPanel, MultipleTargetsAnnotationFormsPanel> { }
private static final Binder binder = GWT.create(Binder.class);
private IDomeo _domeo;
private IContainerPanel _containerPanel;
private String _title;
private Element _element;
private List<AFormComponent> forms = new ArrayList<AFormComponent>();
@UiField FlowPanel main;
@UiField VerticalPanel targetsPanel;
@UiField TabLayoutPanel tabToolsPanel;
@UiField SpanElement footerSpan;
private MAnnotation _annotation;
private ArrayList<MAnnotation> _targets;
public MultipleTargetsAnnotationFormsPanel(IDomeo domeo) {
_domeo = domeo;
initWidget(binder.createAndBindUi(this));
}
// ------------------------------------------------------------------------
// CREATION OF ANNOTATIONS OF VARIOUS KIND
// ------------------------------------------------------------------------
public MultipleTargetsAnnotationFormsPanel(IDomeo domeo, final ArrayList<MAnnotation> targets) {
_domeo = domeo;
_title = TITLE;
_targets = targets;
// Create layout
initWidget(binder.createAndBindUi(this));
this.setWidth((Window.getClientWidth() - 340) + "px");
refreshTargets();
//tabToolsPanel.setWidth((Window.getClientWidth() - 840) + "px");
tabToolsPanel.setHeight("590px");
initializeForms();
}
public MultipleTargetsAnnotationFormsPanel(IDomeo domeo, final MAnnotation annotation) {
_domeo = domeo;
_title = TITLE_EDIT;
_annotation = annotation;
// Create layout
initWidget(binder.createAndBindUi(this));
this.setWidth((Window.getClientWidth() - 340) + "px");
refreshTargets();
tabToolsPanel.setHeight("590px");
initializeForms();
}
public Element getSelectedElement() {
return _element;
}
public int getImageY() {
return _element.getAbsoluteTop();
}
@Override
public void refresh() {
//initializeForms();
refreshTargets();
}
public void initializeForms() {
tabToolsPanel.clear();
if(_annotation==null) {
Collection<IFormGenerator> formGenerators = _domeo.getAnnotationFormsManager().getAnnotationFormGenerators();
Iterator<IFormGenerator> it = formGenerators.iterator();
while(it.hasNext()) {
AFormComponent form = it.next().getForm(this);
if(form instanceof IAllowsMultipleTargets) {
form.setWidth("600px");
if(form instanceof IResizable) forms.add(form);
tabToolsPanel.add(form, form.getTitle());
}
}
} else {
IFormGenerator formGenerator = _domeo.getAnnotationFormsManager().getAnnotationForm(_annotation.getClass().getName());
if(formGenerator!=null) {
AFormComponent form = formGenerator.getForm(this, _annotation);
form.setWidth("600px");
tabToolsPanel.add(form, form.getTitle());
}
}
}
public void refreshTargets() {
targetsPanel.clear();
if(_annotation == null) {
ArrayList<MAnnotation> annotations = _domeo.getClipboardManager().getBufferedAnnotation();
for(MAnnotation annotation: annotations) {
ITileComponent c = _domeo.getAnnotationTailsManager().getAnnotationTile(annotation.getClass().getName(), _domeo.getContentPanel().getAnnotationFrameWrapper());
if(c==null) {
VerticalPanel vp = new VerticalPanel();
vp.add(new Label(annotation.getLocalId() + " - " + annotation.getClass().getName() + " - " + annotation.getY()));
targetsPanel.add(vp);
} else {
try {
if(c instanceof TSelectionTile) ((TSelectionTile)c).initializeLens(annotation, this);
else c.initializeLens(annotation);
targetsPanel.add(c.getTile());
} catch(Exception e) {
// If something goes wrong just display the default tile
e.printStackTrace();
VerticalPanel vp = new VerticalPanel();
vp.add(new Label(annotation.getLocalId() + " - " + annotation.getClass().getName() + " - " + annotation.getY()));
targetsPanel.add(vp);
}
}
}
} else {
for(MSelector selector: _annotation.getSelectors()) {
TPrefixSuffixTextSelectorTile tile = new TPrefixSuffixTextSelectorTile(_domeo, this);
tile.initializeLens(_annotation, selector);
targetsPanel.add(tile);
}
}
}
public void refreshAnnotationForImage(MAnnotation annotation) {
targetsPanel.clear();
List<MAnnotation> annotations = new ArrayList<MAnnotation>();
annotations.add(annotation);
AnnotationSummaryTable table = new AnnotationSummaryTable(_domeo, this);
table.init();
table.refreshPanel(annotations);
targetsPanel.add(table);
}
public String getTitle() {
return _title;
}
@Override
public void setContainer(IContainerPanel containerPanel) {
_containerPanel = containerPanel;
}
@Override
public IContainerPanel getContainer() {
return _containerPanel;
}
public void hideContainer() {
_domeo.getComponentsManager().removeComponent(this);
_containerPanel.hide();
}
public void displayMessage(String message) {
footerSpan.setInnerHTML(message);
}
public void clearMessage() {
footerSpan.setInnerHTML("");
}
// @Override
public void resized() {
this.setWidth((Window.getClientWidth() - 340) + "px");
tabToolsPanel.setWidth((Window.getClientWidth() - 610) + "px");
for(AFormComponent form:forms) {
if(form instanceof IResizable) ((IResizable)form).resized();
}
}
@Override
public void editAnnotation(MAnnotation annotation) {
}
@Override
public MGenericResource getResource() {
// TODO Auto-generated method stub
return null;
}
@Override
public ArrayList<MAnnotation> getTargets() {
return _targets;
}
}
| [
"paolo.ciccarese@gmail.com"
] | paolo.ciccarese@gmail.com |
260fe328509b61763dea77e3f40d34363bfcdc6a | 1ec73a5c02e356b83a7b867580a02b0803316f0a | /java/bj/DesignPattern/JavaPattern/_12_ไปฃ็ๆจกๅผ/section11/IGamePlayer.java | 18812babb644089c1f77d07598d9a341dded6deb | [] | no_license | jxsd0084/JavaTrick | f2ee8ae77638b5b7654c3fcf9bceea0db4626a90 | 0bb835fdac3c2f6d1a29d1e6e479b553099ece35 | refs/heads/master | 2021-01-20T18:54:37.322832 | 2016-06-09T03:22:51 | 2016-06-09T03:22:51 | 60,308,161 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package bj.DesignPattern.JavaPattern._12_ไปฃ็ๆจกๅผ.section11;
/**
* @author cbf4Life cbf4life@126.com
* I'm glad to share my knowledge with you all.
* ๆธธๆ็ฉๅฎถ
*/
public interface IGamePlayer {
// ็ปๅฝๆธธๆ
public void login( String user, String password );
// ๆๆช๏ผ่ฟๆฏ็ฝ็ปๆธธๆ็ไธป่ฆ็น่ฒ
public void killBoss();
// ๅ็บง
public void upgrade();
}
| [
"chenlong88882001@163.com"
] | chenlong88882001@163.com |
5b4dcca3f4d0e1a9830dda9c87298494247d979b | a9463fcc723cab6d527904b7ebb8d30d3c913159 | /tic-server/android/cardevice-gps/app/src/main/java/com/alibaba/sdk/android/oss/OSS.java | 9c4b242c802be280d9423f73c4750ba18ccabfe0 | [] | no_license | yangx2015/wdxc | 85cddf42da4a84c92714d882994bf2ad72824491 | ff7cee63edde5d5d82559dcceccf395ee68df548 | refs/heads/master | 2021-10-24T20:16:40.190679 | 2019-03-21T02:25:04 | 2019-03-21T02:25:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,211 | java | /**
* Copyright (C) Alibaba Cloud Computing, 2015
* All rights reserved.
*
* ็ๆๆๆ ๏ผC๏ผ้ฟ้ๅทดๅทดไบ่ฎก็ฎ๏ผ2015
*/
package com.alibaba.sdk.android.oss;
import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
import com.alibaba.sdk.android.oss.model.AbortMultipartUploadRequest;
import com.alibaba.sdk.android.oss.model.AbortMultipartUploadResult;
import com.alibaba.sdk.android.oss.model.AppendObjectRequest;
import com.alibaba.sdk.android.oss.model.AppendObjectResult;
import com.alibaba.sdk.android.oss.model.CompleteMultipartUploadRequest;
import com.alibaba.sdk.android.oss.model.CompleteMultipartUploadResult;
import com.alibaba.sdk.android.oss.model.CopyObjectRequest;
import com.alibaba.sdk.android.oss.model.CopyObjectResult;
import com.alibaba.sdk.android.oss.model.DeleteBucketRequest;
import com.alibaba.sdk.android.oss.model.DeleteBucketResult;
import com.alibaba.sdk.android.oss.model.DeleteObjectRequest;
import com.alibaba.sdk.android.oss.model.DeleteObjectResult;
import com.alibaba.sdk.android.oss.model.GetBucketACLRequest;
import com.alibaba.sdk.android.oss.model.GetBucketACLResult;
import com.alibaba.sdk.android.oss.model.GetObjectRequest;
import com.alibaba.sdk.android.oss.model.GetObjectResult;
import com.alibaba.sdk.android.oss.model.HeadObjectRequest;
import com.alibaba.sdk.android.oss.model.HeadObjectResult;
import com.alibaba.sdk.android.oss.model.InitiateMultipartUploadRequest;
import com.alibaba.sdk.android.oss.model.InitiateMultipartUploadResult;
import com.alibaba.sdk.android.oss.model.ListObjectsRequest;
import com.alibaba.sdk.android.oss.model.ListObjectsResult;
import com.alibaba.sdk.android.oss.model.ListPartsRequest;
import com.alibaba.sdk.android.oss.model.ListPartsResult;
import com.alibaba.sdk.android.oss.model.CreateBucketRequest;
import com.alibaba.sdk.android.oss.model.CreateBucketResult;
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
import com.alibaba.sdk.android.oss.model.PutObjectResult;
import com.alibaba.sdk.android.oss.model.ResumableUploadRequest;
import com.alibaba.sdk.android.oss.model.ResumableUploadResult;
import com.alibaba.sdk.android.oss.model.UploadPartRequest;
import com.alibaba.sdk.android.oss.model.UploadPartResult;
import java.io.IOException;
/**
* ้ฟ้ไบๅผๆพๅญๅจๆๅก๏ผOpen Storage Service๏ผ OSS๏ผ็่ฎฟ้ฎๆฅๅฃใ
* <p>
* ้ฟ้ไบๅญๅจๆๅก๏ผOpen Storage Service๏ผ็ฎ็งฐOSS๏ผ๏ผๆฏ้ฟ้ไบๅฏนๅคๆไพ็ๆตท้๏ผๅฎๅ
จ๏ผไฝๆๆฌ๏ผ
* ้ซๅฏ้ ็ไบๅญๅจๆๅกใ็จๆทๅฏไปฅ้่ฟ็ฎๅ็RESTๆฅๅฃ๏ผๅจไปปไฝๆถ้ดใไปปไฝๅฐ็นไธไผ ๅไธ่ฝฝๆฐๆฎ๏ผ
* ไนๅฏไปฅไฝฟ็จWEB้กต้ขๅฏนๆฐๆฎ่ฟ่ก็ฎก็ใ<br />
* ๅบไบOSS๏ผ็จๆทๅฏไปฅๆญๅปบๅบๅ็งๅคๅชไฝๅไบซ็ฝ็ซใ็ฝ็ใไธชไบบไผไธๆฐๆฎๅคไปฝ็ญๅบไบๅคง่งๆจกๆฐๆฎ็ๆๅกใ
* </p>
*
* <p>
* OSSไธบSDK็ๆฅๅฃ็ฑป๏ผๅฐ่ฃ
ไบOSS็RESTFul Apiๆฅๅฃ๏ผ่่ๅฐ็งปๅจ็ซฏไธ่ฝๅจUI็บฟ็จๅ่ตท็ฝ็ป่ฏทๆฑ็็ผ็จ่ง่๏ผ
* SDKไธบๆๆๆฅๅฃๆไพไบๅผๆญฅ็่ฐ็จๅฝขๅผ๏ผไนๆไพไบๅๆญฅๆฅๅฃใ
* </p>
*/
public interface OSS {
/**
* ๅผๆญฅไธไผ ๆไปถ
* Put Object็จไบไธไผ ๆไปถใ
*
* @param request ่ฏทๆฑไฟกๆฏ
* @param completedCallback
* @return
*/
public OSSAsyncTask<PutObjectResult> asyncPutObject(
PutObjectRequest request, OSSCompletedCallback<PutObjectRequest, PutObjectResult> completedCallback);
/**
* ๅๆญฅไธไผ ๆไปถ
* Put Object็จไบไธไผ ๆไปถใ
*
* @param request ่ฏทๆฑไฟกๆฏ
* @return
* @throws ClientException
* @throws ServiceException
*/
public PutObjectResult putObject(PutObjectRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅไธ่ฝฝๆไปถ
* ็จไบ่ทๅๆไธชObject๏ผๆญคๆไฝ่ฆๆฑ็จๆทๅฏน่ฏฅObjectๆ่ฏปๆ้ใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<GetObjectResult> asyncGetObject(
GetObjectRequest request, OSSCompletedCallback<GetObjectRequest, GetObjectResult> completedCallback);
/**
* ๅๆญฅไธ่ฝฝๆไปถ
* ็จไบ่ทๅๆไธชObject๏ผๆญคๆไฝ่ฆๆฑ็จๆทๅฏน่ฏฅObjectๆ่ฏปๆ้ใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public GetObjectResult getObject(GetObjectRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅๅ ้คๆไปถ
* DeleteObject็จไบๅ ้คๆไธชObjectใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<DeleteObjectResult> asyncDeleteObject(
DeleteObjectRequest request, OSSCompletedCallback<DeleteObjectRequest, DeleteObjectResult> completedCallback);
/**
* ๅๆญฅๅ ้คๆไปถ
* DeleteObject็จไบๅ ้คๆไธชObjectใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public DeleteObjectResult deleteObject(DeleteObjectRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅ่ฟฝๅ ๆไปถ
* Append Objectไปฅ่ฟฝๅ ๅ็ๆนๅผไธไผ ๆไปถใ
* ้่ฟAppend Objectๆไฝๅๅปบ็Object็ฑปๅไธบAppendable Object๏ผ่้่ฟPut Objectไธไผ ็ObjectๆฏNormal Objectใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<AppendObjectResult> asyncAppendObject(
AppendObjectRequest request, OSSCompletedCallback<AppendObjectRequest, AppendObjectResult> completedCallback);
/**
* ๅๆญฅ่ฟฝๅ ๆไปถ
* Append Objectไปฅ่ฟฝๅ ๅ็ๆนๅผไธไผ ๆไปถใ
* ้่ฟAppend Objectๆไฝๅๅปบ็Object็ฑปๅไธบAppendable Object๏ผ่้่ฟPut Objectไธไผ ็ObjectๆฏNormal Objectใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public AppendObjectResult appendObject(AppendObjectRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅ่ทๅๆไปถๅ
ไฟกๆฏ
* Head Objectๅช่ฟๅๆไธชObject็metaไฟกๆฏ๏ผไธ่ฟๅๆไปถๅ
ๅฎนใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<HeadObjectResult> asyncHeadObject(
HeadObjectRequest request, OSSCompletedCallback<HeadObjectRequest, HeadObjectResult> completedCallback);
/**
* ๅๆญฅ่ทๅๆไปถๅ
ไฟกๆฏ
* Head Objectๅช่ฟๅๆไธชObject็metaไฟกๆฏ๏ผไธ่ฟๅๆไปถๅ
ๅฎนใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public HeadObjectResult headObject(HeadObjectRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅๅคๅถๆไปถ
* ๆท่ดไธไธชๅจOSSไธๅทฒ็ปๅญๅจ็objectๆๅฆๅคไธไธชobject๏ผๅฏไปฅๅ้ไธไธชPUT่ฏทๆฑ็ปOSS๏ผๅนถๅจPUT่ฏทๆฑๅคดไธญๆทปๅ ๅ
็ด โx-oss-copy-sourceโๆฅๆๅฎๆท่ดๆบใ
* OSSไผ่ชๅจๅคๆญๅบ่ฟๆฏไธไธชCopyๆไฝ๏ผๅนถ็ดๆฅๅจๆๅกๅจ็ซฏๆง่ก่ฏฅๆไฝใๅฆๆๆท่ดๆๅ๏ผๅ่ฟๅๆฐ็objectไฟกๆฏ็ป็จๆทใ
* ่ฏฅๆไฝ้็จไบๆท่ดๅฐไบ1GB็ๆไปถ๏ผๅฝๆท่ดไธไธชๅคงไบ1GB็ๆไปถๆถ๏ผๅฟ
้กปไฝฟ็จMultipart Uploadๆไฝ๏ผๅ
ทไฝ่งUpload Part Copyใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<CopyObjectResult> asyncCopyObject(
CopyObjectRequest request, OSSCompletedCallback<CopyObjectRequest, CopyObjectResult> completedCallback);
/**
* ๅๆญฅๅคๅถๆไปถ
* ๆท่ดไธไธชๅจOSSไธๅทฒ็ปๅญๅจ็objectๆๅฆๅคไธไธชobject๏ผๅฏไปฅๅ้ไธไธชPUT่ฏทๆฑ็ปOSS๏ผๅนถๅจPUT่ฏทๆฑๅคดไธญๆทปๅ ๅ
็ด โx-oss-copy-sourceโๆฅๆๅฎๆท่ดๆบใ
* OSSไผ่ชๅจๅคๆญๅบ่ฟๆฏไธไธชCopyๆไฝ๏ผๅนถ็ดๆฅๅจๆๅกๅจ็ซฏๆง่ก่ฏฅๆไฝใๅฆๆๆท่ดๆๅ๏ผๅ่ฟๅๆฐ็objectไฟกๆฏ็ป็จๆทใ
* ่ฏฅๆไฝ้็จไบๆท่ดๅฐไบ1GB็ๆไปถ๏ผๅฝๆท่ดไธไธชๅคงไบ1GB็ๆไปถๆถ๏ผๅฟ
้กปไฝฟ็จMultipart Uploadๆไฝ๏ผๅ
ทไฝ่งUpload Part Copyใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public CopyObjectResult copyObject(CopyObjectRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅๅๅปบbucket
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<CreateBucketResult> asyncCreateBucket(
CreateBucketRequest request, OSSCompletedCallback<CreateBucketRequest, CreateBucketResult> completedCallback);
/**
* ๅๆญฅๅๅปบbucket
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public CreateBucketResult createBucket(CreateBucketRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅๅ ้คbucket
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<DeleteBucketResult> asyncDeleteBucket(
DeleteBucketRequest request, OSSCompletedCallback<DeleteBucketRequest, DeleteBucketResult> completedCallback);
/**
* ๅๆญฅๅ ้คbucket
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public DeleteBucketResult deleteBucket(DeleteBucketRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅ่ทๅbucket ACLๆ้
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<GetBucketACLResult> asyncGetBucketACL(
GetBucketACLRequest request, OSSCompletedCallback<GetBucketACLRequest, GetBucketACLResult> completedCallback);
/**
* ๅๆญฅ่ทๅbucket ACLๆ้
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public GetBucketACLResult getBucketACL(GetBucketACLRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅ็ฝๅๆไปถ
* Get Bucketๆไฝๅฏ็จๆฅlist BucketไธญๆๆObject็ไฟกๆฏใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<ListObjectsResult> asyncListObjects(
ListObjectsRequest request, OSSCompletedCallback<ListObjectsRequest, ListObjectsResult> completedCallback);
/**
* ๅๆญฅ็ฝๅๆไปถ
* Get Bucketๆไฝๅฏ็จๆฅlist BucketไธญๆๆObject็ไฟกๆฏใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public ListObjectsResult listObjects(ListObjectsRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅๅๅงๅๅๅไธไผ
* ไฝฟ็จMultipart Uploadๆจกๅผไผ ่พๆฐๆฎๅ๏ผๅฟ
้กปๅ
่ฐ็จ่ฏฅๆฅๅฃๆฅ้็ฅOSSๅๅงๅไธไธชMultipart Uploadไบไปถใ
* ่ฏฅๆฅๅฃไผ่ฟๅไธไธชOSSๆๅกๅจๅๅปบ็ๅ
จๅฑๅฏไธ็Upload ID๏ผ็จไบๆ ่ฏๆฌๆฌกMultipart Uploadไบไปถใ
* ็จๆทๅฏไปฅๆ นๆฎ่ฟไธชIDๆฅๅ่ตท็ธๅ
ณ็ๆไฝ๏ผๅฆไธญๆญขMultipart Uploadใๆฅ่ฏขMultipart Upload็ญใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<InitiateMultipartUploadResult> asyncInitMultipartUpload(
InitiateMultipartUploadRequest request, OSSCompletedCallback<InitiateMultipartUploadRequest, InitiateMultipartUploadResult> completedCallback);
/**
* ๅๆญฅๅๅงๅๅๅไธไผ
* ไฝฟ็จMultipart Uploadๆจกๅผไผ ่พๆฐๆฎๅ๏ผๅฟ
้กปๅ
่ฐ็จ่ฏฅๆฅๅฃๆฅ้็ฅOSSๅๅงๅไธไธชMultipart Uploadไบไปถใ
* ่ฏฅๆฅๅฃไผ่ฟๅไธไธชOSSๆๅกๅจๅๅปบ็ๅ
จๅฑๅฏไธ็Upload ID๏ผ็จไบๆ ่ฏๆฌๆฌกMultipart Uploadไบไปถใ
* ็จๆทๅฏไปฅๆ นๆฎ่ฟไธชIDๆฅๅ่ตท็ธๅ
ณ็ๆไฝ๏ผๅฆไธญๆญขMultipart Uploadใๆฅ่ฏขMultipart Upload็ญใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public InitiateMultipartUploadResult initMultipartUpload(InitiateMultipartUploadRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅไธไผ ๅๅ
* ๅๅงๅไธไธชMultipart Uploadไนๅ๏ผๅฏไปฅๆ นๆฎๆๅฎ็ObjectๅๅUpload IDๆฅๅๅ๏ผPart๏ผไธไผ ๆฐๆฎใ
* ๆฏไธไธชไธไผ ็Part้ฝๆไธไธชๆ ่ฏๅฎ็ๅท็ ๏ผpart number๏ผ่ๅดๆฏ1~10,000๏ผใ
* ๅฏนไบๅไธไธชUpload ID๏ผ่ฏฅๅท็ ไธไฝๅฏไธๆ ่ฏ่ฟไธๅๆฐๆฎ๏ผไนๆ ่ฏไบ่ฟๅๆฐๆฎๅจๆดไธชๆไปถๅ
็็ธๅฏนไฝ็ฝฎใ
* ๅฆๆไฝ ็จๅไธไธชpartๅท็ ๏ผไธไผ ไบๆฐ็ๆฐๆฎ๏ผ้ฃไนOSSไธๅทฒๆ็่ฟไธชๅท็ ็Partๆฐๆฎๅฐ่ขซ่ฆ็ใ
* ้คไบๆๅไธๅPartไปฅๅค๏ผๅ
ถไป็partๆๅฐไธบ100KB๏ผๆๅไธๅPartๆฒกๆๅคงๅฐ้ๅถใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<UploadPartResult> asyncUploadPart(
UploadPartRequest request, OSSCompletedCallback<UploadPartRequest, UploadPartResult> completedCallback);
/**
* ๅๆญฅไธไผ ๅๅ
* ๅๅงๅไธไธชMultipart Uploadไนๅ๏ผๅฏไปฅๆ นๆฎๆๅฎ็ObjectๅๅUpload IDๆฅๅๅ๏ผPart๏ผไธไผ ๆฐๆฎใ
* ๆฏไธไธชไธไผ ็Part้ฝๆไธไธชๆ ่ฏๅฎ็ๅท็ ๏ผpart number๏ผ่ๅดๆฏ1~10,000๏ผใ
* ๅฏนไบๅไธไธชUpload ID๏ผ่ฏฅๅท็ ไธไฝๅฏไธๆ ่ฏ่ฟไธๅๆฐๆฎ๏ผไนๆ ่ฏไบ่ฟๅๆฐๆฎๅจๆดไธชๆไปถๅ
็็ธๅฏนไฝ็ฝฎใ
* ๅฆๆไฝ ็จๅไธไธชpartๅท็ ๏ผไธไผ ไบๆฐ็ๆฐๆฎ๏ผ้ฃไนOSSไธๅทฒๆ็่ฟไธชๅท็ ็Partๆฐๆฎๅฐ่ขซ่ฆ็ใ
* ้คไบๆๅไธๅPartไปฅๅค๏ผๅ
ถไป็partๆๅฐไธบ100KB๏ผๆๅไธๅPartๆฒกๆๅคงๅฐ้ๅถใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public UploadPartResult uploadPart(UploadPartRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅๅฎๆๅๅไธไผ
* ๅจๅฐๆๆๆฐๆฎPart้ฝไธไผ ๅฎๆๅ๏ผๅฟ
้กป่ฐ็จComplete Multipart Upload APIๆฅๅฎๆๆดไธชๆไปถ็Multipart Uploadใ
* ๅจๆง่ก่ฏฅๆไฝๆถ๏ผ็จๆทๅฟ
้กปๆไพๆๆๆๆ็ๆฐๆฎPart็ๅ่กจ๏ผๅ
ๆฌpartๅท็ ๅETAG๏ผ๏ผOSSๆถๅฐ็จๆทๆไบค็Partๅ่กจๅ๏ผไผ้ไธ้ช่ฏๆฏไธชๆฐๆฎPart็ๆๆๆงใ
* ๅฝๆๆ็ๆฐๆฎPart้ช่ฏ้่ฟๅ๏ผOSSๅฐๆ่ฟไบๆฐๆฎpart็ปๅๆไธไธชๅฎๆด็Objectใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<CompleteMultipartUploadResult> asyncCompleteMultipartUpload(
CompleteMultipartUploadRequest request, OSSCompletedCallback<CompleteMultipartUploadRequest, CompleteMultipartUploadResult> completedCallback);
/**
* ๅๆญฅๅฎๆๅๅไธไผ
* ๅจๅฐๆๆๆฐๆฎPart้ฝไธไผ ๅฎๆๅ๏ผๅฟ
้กป่ฐ็จComplete Multipart Upload APIๆฅๅฎๆๆดไธชๆไปถ็Multipart Uploadใ
* ๅจๆง่ก่ฏฅๆไฝๆถ๏ผ็จๆทๅฟ
้กปๆไพๆๆๆๆ็ๆฐๆฎPart็ๅ่กจ๏ผๅ
ๆฌpartๅท็ ๅETAG๏ผ๏ผOSSๆถๅฐ็จๆทๆไบค็Partๅ่กจๅ๏ผไผ้ไธ้ช่ฏๆฏไธชๆฐๆฎPart็ๆๆๆงใ
* ๅฝๆๆ็ๆฐๆฎPart้ช่ฏ้่ฟๅ๏ผOSSๅฐๆ่ฟไบๆฐๆฎpart็ปๅๆไธไธชๅฎๆด็Objectใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public CompleteMultipartUploadResult completeMultipartUpload(CompleteMultipartUploadRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅๅๆถๅๅไธไผ
* ่ฏฅๆฅๅฃๅฏไปฅๆ นๆฎ็จๆทๆไพ็Upload IDไธญๆญขๅ
ถๅฏนๅบ็Multipart Uploadไบไปถใ
* ๅฝไธไธชMultipart Uploadไบไปถ่ขซไธญๆญขๅ๏ผๅฐฑไธ่ฝๅไฝฟ็จ่ฟไธชUpload IDๅไปปไฝๆไฝ๏ผๅทฒ็ปไธไผ ็Partๆฐๆฎไนไผ่ขซๅ ้คใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<AbortMultipartUploadResult> asyncAbortMultipartUpload(
AbortMultipartUploadRequest request, OSSCompletedCallback<AbortMultipartUploadRequest, AbortMultipartUploadResult> completedCallback);
/**
* ๅๆญฅๅๆถๅๅไธไผ
* ่ฏฅๆฅๅฃๅฏไปฅๆ นๆฎ็จๆทๆไพ็Upload IDไธญๆญขๅ
ถๅฏนๅบ็Multipart Uploadไบไปถใ
* ๅฝไธไธชMultipart Uploadไบไปถ่ขซไธญๆญขๅ๏ผๅฐฑไธ่ฝๅไฝฟ็จ่ฟไธชUpload IDๅไปปไฝๆไฝ๏ผๅทฒ็ปไธไผ ็Partๆฐๆฎไนไผ่ขซๅ ้คใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public AbortMultipartUploadResult abortMultipartUpload(AbortMultipartUploadRequest request)
throws ClientException, ServiceException;
/**
* ๅผๆญฅ็ฝๅๅๅ
* List Partsๅฝไปคๅฏไปฅ็ฝๅๅบๆๅฎUpload IDๆๅฑ็ๆๆๅทฒ็ปไธไผ ๆๅPartใ
*
* @param request
* @param completedCallback
* @return
*/
public OSSAsyncTask<ListPartsResult> asyncListParts(
ListPartsRequest request, OSSCompletedCallback<ListPartsRequest, ListPartsResult> completedCallback);
/**
* ๅๆญฅ็ฝๅๅๅ
* List Partsๅฝไปคๅฏไปฅ็ฝๅๅบๆๅฎUpload IDๆๅฑ็ๆๆๅทฒ็ปไธไผ ๆๅPartใ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public ListPartsResult listParts(ListPartsRequest request)
throws ClientException, ServiceException;
/******************** extension function **********************/
/**
* ๆดๆฐ้ดๆ่ฎพ็ฝฎ๏ผ่ฐ็จๅ๏ผๆง็่ฎพ็ฝฎไผๅคฑๆ
*/
public void updateCredentialProvider(OSSCredentialProvider credentialProvider);
/**
* ๅผๆญฅๆญ็นไธไผ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public OSSAsyncTask<ResumableUploadResult> asyncResumableUpload(
ResumableUploadRequest request, OSSCompletedCallback<ResumableUploadRequest, ResumableUploadResult> completedCallback);
/**
* ๅๆญฅๆญ็นไธไผ
*
* @param request
* @return
* @throws ClientException
* @throws ServiceException
*/
public ResumableUploadResult resumableUpload(ResumableUploadRequest request)
throws ClientException, ServiceException;
/**
* ็ญพๅObject็่ฎฟ้ฎURL๏ผไปฅไพฟๆๆ็ฌฌไธๆน่ฎฟ้ฎ
*
* @param bucketName ๅญๅจObject็Bucketๅ
* @param objectKey Objectๅ
* @param expiredTimeInSeconds URL็ๆๆๆถ้ฟ๏ผ็งไธบๅไฝ
* @return
* @throws ClientException
*/
public String presignConstrainedObjectURL(String bucketName, String objectKey, long expiredTimeInSeconds)
throws ClientException;
/**
* ็ญพๅๅ
ฌๅผๅฏ่ฎฟ้ฎ็URL
*
* @param bucketName ๅญๅจObject็Bucketๅ
* @param objectKey Objectๅ
* @return
*/
public String presignPublicObjectURL(String bucketName, String objectKey);
/**
* ๆฃๆฅๆๅฎObjectๆฏๅฆๅญๅจ
*
* @param bucketName
* @param objectKey
* @return
* @throws ClientException
* @throws ServiceException
*/
public boolean doesObjectExist(String bucketName, String objectKey)
throws ClientException, ServiceException;
/**
* ๅฆๆ่ฎพ็ฝฎๆญ็นไธไผ ๅๆถๆถไธๅ ้คไบไปถ๏ผ้ฃไนๅ ้คๆถ้่ฆ่ฐ็จ่ฟไธชๆฅๅฃๅฎๆ
*
* @param request
* @throws IOException
*/
public void abortResumableUpload(ResumableUploadRequest request) throws IOException;
}
| [
"1085772106@qq.com"
] | 1085772106@qq.com |
7ad7f1c7400f7928f96715ccf1d911db1eb0771d | e474547e28b8fbc051148bd3a96d149e39fec12b | /app/src/main/java/my/prog/ipv4v6converter/App.java | 35d1403c9c539b8a5d91932559da3f391d1c2a17 | [] | no_license | lepekha/ipv4v6calculator | f11d2cd5e3cc7f0a2f0a8133deadb58d5171053f | 58d44a997bcedf2b672fba48daadba68a498ae4e | refs/heads/master | 2021-05-08T08:34:40.553280 | 2017-10-16T19:57:54 | 2017-10-16T19:57:54 | 107,045,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,082 | java | package my.prog.ipv4v6converter;
import android.app.Application;
import my.prog.ipv4v6converter.di.AppComponent;
import my.prog.ipv4v6converter.di.AppModule;
import my.prog.ipv4v6converter.di.DaggerAppComponent;
import my.prog.ipv4v6converter.di.DataModule;
import my.prog.ipv4v6converter.di.EntityModule;
import my.prog.ipv4v6converter.di.PresenterModule;
import my.prog.ipv4v6converter.di.ViewModule;
/**
* Created by Ruslan on 12.09.2017.
*/
public class App extends Application {
private static AppComponent component;
public static AppComponent getComponent(){
return component;
}
@Override
public void onCreate() {
super.onCreate();
buildComponent();
}
protected void buildComponent(){
component = DaggerAppComponent.builder()
.appModule(new AppModule(this))
.dataModule(new DataModule())
.entityModule(new EntityModule())
.presenterModule(new PresenterModule())
.viewModule(new ViewModule())
.build();
}
}
| [
"ruslan.lepekha@gmail.com"
] | ruslan.lepekha@gmail.com |
d87fc4637cd4fafbbdace4c5d2f295d9b862c3a6 | 4aa23c91d62e24e2edc0acd5bf617a668955e07c | /dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventSupport.java | 4994079c78d3d2a903c6d12ccafc031543503283 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | kas54/dhis2-core | f98bab4af13359b271c59a784e42468b2a7e03aa | ffc2b4b374d92ff8d3312694572cf1d9188fdf96 | refs/heads/master | 2022-12-19T02:07:55.742445 | 2020-09-19T10:47:19 | 2020-09-19T10:47:19 | 297,113,793 | 1 | 0 | BSD-3-Clause | 2020-09-20T16:11:21 | 2020-09-20T16:11:20 | null | UTF-8 | Java | false | false | 618 | java | package org.hisp.dhis.dxf2.events.event;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Date;
import org.postgis.PGgeometry;
import com.vividsolutions.jts.geom.Geometry;
import lombok.experimental.UtilityClass;
@UtilityClass
class JdbcEventSupport
{
// Any chances we are duplicating this elsewhere ?
Timestamp toTimestamp( Date date )
{
return date != null ? new Timestamp( date.getTime() ) : null;
}
PGgeometry toGeometry( Geometry geometry ) throws SQLException
{
return geometry != null ? new PGgeometry( geometry.toText() ) : null;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
92ff21f3e907e7f67ec9062c795b841259738aa4 | bdc69306bbbe66ffdcf949be8c4d3b6dfe146580 | /src/jvm/storm/starter/CorrelationBase/FilterBolt.java | aba5c0d7a4d39f315844a28110ec280b39f668af | [] | no_license | StormProjectUFSM/StormCorrelationArchitecture | c90aac2f8a39430e822718df286a22e96a7e20a1 | 098548f463c8b11c01ccfab38c5b35408bdace96 | refs/heads/master | 2021-01-19T09:10:18.415531 | 2017-12-22T21:16:26 | 2017-12-22T21:16:26 | 87,731,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,973 | java | package storm.starter.CorrelationBase;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.io.File;
import java.io.FileWriter;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
import storm.starter.AlgorithmBase.CorrelationCreation;
import storm.starter.AlgorithmBase.PoliticsXML;
import org.apache.storm.tuple.Fields;
import org.apache.storm.tuple.Values;
import org.apache.storm.task.OutputCollector;
import org.apache.storm.task.TopologyContext;
import org.apache.storm.topology.IRichBolt;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.tuple.Tuple;
public class FilterBolt implements IRichBolt {
private long metadataOutID;
private String metadataOutName, metadataOutPath;
private String basePath, politicsPath, metadataPath, politicsName;
private PoliticsXML configuration;
private Map<String, Integer> counterMap;
private Map<String, List<String>> packetsMap;
private OutputCollector collector;
public FilterBolt(String basePath, String politicsName){
this.politicsPath = basePath + politicsName;
this.basePath = basePath;
this.politicsName = politicsName;
this.metadataPath = basePath + politicsName + "TMP";
new File(this.metadataPath).mkdir();
}
@Override
public void prepare(Map conf, TopologyContext context, OutputCollector collector) {
this.configuration = new PoliticsXML(this.politicsPath);
this.metadataOutName = this.configuration.getConfID();
this.metadataOutID = 0;
this.counterMap = new HashMap<String, Integer>();
this.packetsMap = new HashMap<String, List<String>>();
this.collector = collector;
this.counterMap.put(this.configuration.getCIPort(), 0);
this.packetsMap.put(this.configuration.getCIPort(), new ArrayList<String>());
}
@Override
public void execute(Tuple tuple) {
String call = tuple.getString(0);
if (!call.equals("")){
if(counterMap.containsKey(call)){
Integer c = counterMap.get(call) + 1;
counterMap.put(call, c);
if(!packetsMap.get(call).contains(tuple.getString(3))){
packetsMap.get(call).add(tuple.getString(3));
}
}
}
if(tuple.getString(4) != null){
this.metadataOutID++;
this.metadataOutPath = this.metadataPath + "/" + this.metadataOutName + this.metadataOutID + ".xml";
new CorrelationCreation(this.metadataOutPath, this.packetsMap, this.counterMap, null);
this.collector.emit(new Values(this.metadataOutPath));
}
collector.ack(tuple);
}
@Override
public void cleanup() {}
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("request"));
}
@Override
public Map<String, Object> getComponentConfiguration() {
return null;
}
}
| [
"stormprojectufsm@gmail.com"
] | stormprojectufsm@gmail.com |
10f90d53f16ec7525cc59213a1bb25e7e9c738bf | a27e3ac253ce1972c93ca8b62008cf6ee89b172d | /core/src/main/java/com/tailoredshapes/inventoryserver/dao/DAO.java | d819f8cc86e855688027716e6ae5b6ae9944222f | [] | no_license | tsmarsh/inventoryserver | 6573197be88e514f6ee379f15eedd233c22d3b82 | d6c92e93fb4cd05d92cb74e9c85b876de059f6bd | refs/heads/master | 2023-04-21T08:14:36.524753 | 2023-03-17T17:24:41 | 2023-03-17T17:24:41 | 89,962,278 | 2 | 0 | null | 2018-02-05T19:00:36 | 2017-05-01T20:55:32 | Java | UTF-8 | Java | false | false | 168 | java | package com.tailoredshapes.inventoryserver.dao;
public interface DAO<T> {
T create(T object);
T read(T object);
T update(T object);
T upsert(T object);
}
| [
"noreply@github.com"
] | noreply@github.com |
14e3b342ef9a7c2db73c425db7762155d05c1c71 | 4e064fab4746f54b4c9c09fdf506653855c626b6 | /app/src/main/java/com/i/detectepic/frame/net/IHttpResult.java | 50618013a2c95632e349ef9bd0cd290020045083 | [] | no_license | wangyunke/DetectePic | d7662257c1c17f2c6de2be83198527549082ff2e | 308c265c00e5b5d60802b7b5a3c38088caa4e314 | refs/heads/master | 2021-01-09T21:54:53.115682 | 2016-01-18T09:54:40 | 2016-01-18T09:54:40 | 49,861,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package com.i.detectepic.frame.net;
public interface IHttpResult {
void onStart();
void onFailure();
void onSuccess(String str);
void onFinish();
}
| [
"awangyunke@163.com"
] | awangyunke@163.com |
06ad50d130f5acbc87ed5aa22020d8c3e824ea36 | 062ba61f2cfe4cc51390f8472086664cdfea0a31 | /rh-system/src/main/java/br/com/rhsystem/repository/LocacaoVeiculoRepository.java | 2e6fa26f57e29b79f25589f48532f7b1a3d40303 | [] | no_license | phelypell1/system-rh | 5255e0c8c210b5cc83259189ab451aa2bd197cfa | 3fd783fdbba34998d1c1cf3a682469449e3dd0f0 | refs/heads/main | 2023-02-03T17:27:56.333437 | 2020-11-30T01:07:56 | 2020-11-30T01:07:56 | 316,510,499 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package br.com.rhsystem.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import br.com.rhsystem.model.LocacaoVeiculo;
@Repository
public interface LocacaoVeiculoRepository extends CrudRepository<LocacaoVeiculo, Long>{
}
| [
"phelypell1@hotmail.com"
] | phelypell1@hotmail.com |
a2be393eb19ed5b8feeaad8bd8d7e76547f5767b | 8db7aa882819d79a541deba97dd843bfd5dee5a7 | /0331_์คํ์ฑํ
๋ฐฉ/OpenChat.java | 0349504155d95000bdddbfab092105e99aa87be1 | [] | no_license | eraserrr/algorithm_programmers | 09621a05ad4caa52bcd593a4caf5712f794b4bba | 310240135676a95c0179f781f00242ea5f13e958 | refs/heads/main | 2023-05-01T02:25:17.131870 | 2021-05-14T08:34:19 | 2021-05-14T08:34:19 | 343,991,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,680 | java | // List ๋ ArrayList ์ ์ธํฐํ์ด์ค์ด๋ค.
// ์๋ฐ ๋ฌธ์์ด ์ง๋ฅผ ๋์๋ substring(int start, int end) ํน์ split(String ) ์ด์ฉํ๊ธฐ
// hashMap ์์ get, put ์ด์ฉ. key ํ์ธ์ containsKey() ํจ์ ์ด์ฉ
import java.util.*;
class Solution {
public String[] solution(String[] record) {
ArrayList<String> answer = new ArrayList<>();
HashMap<String, String> hashMap = new HashMap();
for(int i=record.length-1;i>=0;i--) {
String[] input = record[i].split(" ");
if (input[0].equals("Leave")){
continue;
}
if (hashMap.containsKey(input[1])==false) {
hashMap.put(input[1], input[2]);
}
}
for (int i=0;i< record.length;i++) {
String[] input = record[i].split(" ");
if (input[0].equals("Change"))
continue;
String msg = "";
if (input[0].equals("Enter"))
msg = "๋ค์ด์์ต๋๋ค.";
else {
msg = "๋๊ฐ์ต๋๋ค.";
}
answer.add(hashMap.get(input[1]) + "๋์ด " + msg);
}
String[] a = answer.toArray(new String[answer.size()]);
return a;
}
}
// ํ
์คํธ 1 ใ ํต๊ณผ (12.43ms, 53.3MB)
// ํ
์คํธ 2 ใ ํต๊ณผ (12.03ms, 53MB)
// ํ
์คํธ 3 ใ ํต๊ณผ (16.58ms, 52.6MB)
// ํ
์คํธ 4 ใ ํต๊ณผ (12.67ms, 53MB)
// ํ
์คํธ 5 ใ ํต๊ณผ (28.54ms, 54.7MB)
// ํ
์คํธ 6 ใ ํต๊ณผ (22.43ms, 54.7MB)
// ํ
์คํธ 7 ใ ํต๊ณผ (21.37ms, 55.3MB)
// ํ
์คํธ 8 ใ ํต๊ณผ (27.34ms, 54MB)
// ํ
์คํธ 9 ใ ํต๊ณผ (23.58ms, 54.7MB)
// ํ
์คํธ 10 ใ ํต๊ณผ (22.57ms, 54.3MB)
// ํ
์คํธ 11 ใ ํต๊ณผ (29.24ms, 54.6MB)
// ํ
์คํธ 12 ใ ํต๊ณผ (18.68ms, 53.8MB)
// ํ
์คํธ 13 ใ ํต๊ณผ (23.42ms, 54.3MB)
// ํ
์คํธ 14 ใ ํต๊ณผ (23.82ms, 56.3MB)
// ํ
์คํธ 15 ใ ํต๊ณผ (11.15ms, 52.3MB)
// ํ
์คํธ 16 ใ ํต๊ณผ (12.02ms, 53MB)
// ํ
์คํธ 17 ใ ํต๊ณผ (19.60ms, 53.1MB)
// ํ
์คํธ 18 ใ ํต๊ณผ (12.25ms, 63.3MB)
// ํ
์คํธ 19 ใ ํต๊ณผ (23.08ms, 56.2MB)
// ํ
์คํธ 20 ใ ํต๊ณผ (25.97ms, 54.4MB)
// ํ
์คํธ 21 ใ ํต๊ณผ (20.89ms, 54.5MB)
// ํ
์คํธ 22 ใ ํต๊ณผ (28.17ms, 54.3MB)
// ํ
์คํธ 23 ใ ํต๊ณผ (23.59ms, 55.2MB)
// ํ
์คํธ 24 ใ ํต๊ณผ (23.92ms, 54.7MB)
// ํ
์คํธ 25 ใ ํต๊ณผ (248.28ms, 151MB)
// ํ
์คํธ 26 ใ ํต๊ณผ (286.79ms, 165MB)
// ํ
์คํธ 27 ใ ํต๊ณผ (298.58ms, 167MB)
// ํ
์คํธ 28 ใ ํต๊ณผ (353.75ms, 171MB)
// ํ
์คํธ 29 ใ ํต๊ณผ (319.10ms, 168MB)
// ํ
์คํธ 30 ใ ํต๊ณผ (224.21ms, 159MB)
// ํ
์คํธ 31 ใ ํต๊ณผ (269.52ms, 155MB)
// ํ
์คํธ 32 ใ ํต๊ณผ (285.57ms, 144MB)
| [
"noreply@github.com"
] | noreply@github.com |
18c1a3e1ade9d6b0dc49b95126dad9f3ae9d8fd5 | 5ea5372d306353fdc6416ac56aeb437f6103fc89 | /test/net/ion/craken/node/problem/TestConfig.java | 611650fc64611a6128a6fdd67b765071f008694d | [] | no_license | nextjava/craken | 3e71e9a86a2fa8657814a8bf3b2e0f3e8b779ef3 | 6ff5401fdc32f30f5a045e10a6a8a1aff81c6fe8 | refs/heads/master | 2021-01-18T07:38:56.203488 | 2013-08-19T00:53:28 | 2013-08-19T00:53:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,177 | java | package net.ion.craken.node.problem;
import net.ion.craken.loaders.FastFileCacheStore;
import org.infinispan.configuration.cache.CacheMode;
import org.infinispan.configuration.cache.Configuration;
import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.loaders.file.FileCacheStore;
public class TestConfig {
public static Configuration createFastLocalCacheStore(int maxEntry) {
return new ConfigurationBuilder().clustering().cacheMode(CacheMode.DIST_SYNC).clustering().l1().enable().invocationBatching().clustering().hash().numOwners(1).unsafe()
.eviction().maxEntries(maxEntry)
.invocationBatching().enable().loaders().preload(true).shared(false).passivation(false).addCacheLoader().cacheLoader(new FastFileCacheStore()).addProperty("location", "./resource/search")
// ./resource/temp
.purgeOnStartup(false).ignoreModifications(false).fetchPersistentState(true).async().enabled(false).build();
}
public static Configuration createFastSearchCacheStore() {
return new ConfigurationBuilder().clustering().cacheMode(CacheMode.DIST_SYNC).clustering().l1().enable().invocationBatching().clustering().hash().numOwners(2).unsafe()
.invocationBatching().enable().loaders().preload(true).shared(false).passivation(false).addCacheLoader().cacheLoader(new FileCacheStore()).addProperty("location", "./resource/search")
// ./resource/temp
.purgeOnStartup(false).ignoreModifications(false).fetchPersistentState(true).async().enabled(false).build();
}
public static Configuration createOldSearchCacheStore(int maxEntries) {
return new ConfigurationBuilder().clustering().cacheMode(CacheMode.DIST_SYNC)
.eviction().maxEntries(maxEntries)
.clustering().l1().enable().invocationBatching().clustering().hash().numOwners(2).unsafe()
.invocationBatching().enable().loaders().preload(true).shared(false)
.passivation(false).addCacheLoader().cacheLoader(new FileCacheStore()).addProperty("location", "./resource/search")
// ./resource/temp
.purgeOnStartup(false).ignoreModifications(false).fetchPersistentState(true).async().enabled(false).build();
}
}
| [
"bleujin@gmail.com"
] | bleujin@gmail.com |
123c7ca2baf5cc683603636642dece8616ad8524 | 9b5053db1b5a03c8f72d87a5054688a50287efe2 | /com/google/android/gms/internal/zzcp.java | 9748f52d1a948eb395344156cbf44c5080de80f0 | [] | no_license | steamguard-totp/steam-mobile | f8d612b5c767248c3a29e29c0b9328e5d244c079 | f94cd2ec0404bfab69b00a582f90457295cccabb | refs/heads/master | 2021-09-04T07:04:22.229386 | 2018-01-16T23:39:37 | 2018-01-16T23:39:37 | 117,756,434 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,832 | java | package com.google.android.gms.internal;
import android.content.Context;
import android.view.View;
import com.google.android.gms.internal.zzcq.zza;
import com.google.android.gms.internal.zzcq.zzd;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.WeakHashMap;
@zzmb
public class zzcp implements zzcr {
private final Object zzrN = new Object();
private final zzqa zztr;
private final WeakHashMap<zzov, zzcq> zzvX = new WeakHashMap();
private final ArrayList<zzcq> zzvY = new ArrayList();
private final Context zzvZ;
private final zzja zzwa;
public zzcp(Context context, zzqa com_google_android_gms_internal_zzqa, zzja com_google_android_gms_internal_zzja) {
this.zzvZ = context.getApplicationContext();
this.zztr = com_google_android_gms_internal_zzqa;
this.zzwa = com_google_android_gms_internal_zzja;
}
public void zza(zzcq com_google_android_gms_internal_zzcq) {
synchronized (this.zzrN) {
if (!com_google_android_gms_internal_zzcq.zzdF()) {
this.zzvY.remove(com_google_android_gms_internal_zzcq);
Iterator it = this.zzvX.entrySet().iterator();
while (it.hasNext()) {
if (((Entry) it.next()).getValue() == com_google_android_gms_internal_zzcq) {
it.remove();
}
}
}
}
}
public void zza(zzec com_google_android_gms_internal_zzec, zzov com_google_android_gms_internal_zzov) {
zza(com_google_android_gms_internal_zzec, com_google_android_gms_internal_zzov, com_google_android_gms_internal_zzov.zzMZ.getView());
}
public void zza(zzec com_google_android_gms_internal_zzec, zzov com_google_android_gms_internal_zzov, View view) {
zza(com_google_android_gms_internal_zzec, com_google_android_gms_internal_zzov, new zzd(view, com_google_android_gms_internal_zzov), null);
}
public void zza(zzec com_google_android_gms_internal_zzec, zzov com_google_android_gms_internal_zzov, View view, zzjb com_google_android_gms_internal_zzjb) {
zza(com_google_android_gms_internal_zzec, com_google_android_gms_internal_zzov, new zzd(view, com_google_android_gms_internal_zzov), com_google_android_gms_internal_zzjb);
}
public void zza(zzec com_google_android_gms_internal_zzec, zzov com_google_android_gms_internal_zzov, zzcx com_google_android_gms_internal_zzcx, zzjb com_google_android_gms_internal_zzjb) {
synchronized (this.zzrN) {
zzcq com_google_android_gms_internal_zzcq;
if (zzi(com_google_android_gms_internal_zzov)) {
com_google_android_gms_internal_zzcq = (zzcq) this.zzvX.get(com_google_android_gms_internal_zzov);
} else {
com_google_android_gms_internal_zzcq = new zzcq(this.zzvZ, com_google_android_gms_internal_zzec, com_google_android_gms_internal_zzov, this.zztr, com_google_android_gms_internal_zzcx);
com_google_android_gms_internal_zzcq.zza((zzcr) this);
this.zzvX.put(com_google_android_gms_internal_zzov, com_google_android_gms_internal_zzcq);
this.zzvY.add(com_google_android_gms_internal_zzcq);
}
if (com_google_android_gms_internal_zzjb != null) {
com_google_android_gms_internal_zzcq.zza(new zzcs(com_google_android_gms_internal_zzcq, com_google_android_gms_internal_zzjb));
} else {
com_google_android_gms_internal_zzcq.zza(new zzct(com_google_android_gms_internal_zzcq, this.zzwa));
}
}
}
public void zza(zzec com_google_android_gms_internal_zzec, zzov com_google_android_gms_internal_zzov, zzgu com_google_android_gms_internal_zzgu) {
zza(com_google_android_gms_internal_zzec, com_google_android_gms_internal_zzov, new zza(com_google_android_gms_internal_zzgu), null);
}
public boolean zzi(zzov com_google_android_gms_internal_zzov) {
boolean z;
synchronized (this.zzrN) {
zzcq com_google_android_gms_internal_zzcq = (zzcq) this.zzvX.get(com_google_android_gms_internal_zzov);
z = com_google_android_gms_internal_zzcq != null && com_google_android_gms_internal_zzcq.zzdF();
}
return z;
}
public void zzj(zzov com_google_android_gms_internal_zzov) {
synchronized (this.zzrN) {
zzcq com_google_android_gms_internal_zzcq = (zzcq) this.zzvX.get(com_google_android_gms_internal_zzov);
if (com_google_android_gms_internal_zzcq != null) {
com_google_android_gms_internal_zzcq.zzdD();
}
}
}
public void zzk(zzov com_google_android_gms_internal_zzov) {
synchronized (this.zzrN) {
zzcq com_google_android_gms_internal_zzcq = (zzcq) this.zzvX.get(com_google_android_gms_internal_zzov);
if (com_google_android_gms_internal_zzcq != null) {
com_google_android_gms_internal_zzcq.stop();
}
}
}
public void zzl(zzov com_google_android_gms_internal_zzov) {
synchronized (this.zzrN) {
zzcq com_google_android_gms_internal_zzcq = (zzcq) this.zzvX.get(com_google_android_gms_internal_zzov);
if (com_google_android_gms_internal_zzcq != null) {
com_google_android_gms_internal_zzcq.pause();
}
}
}
public void zzm(zzov com_google_android_gms_internal_zzov) {
synchronized (this.zzrN) {
zzcq com_google_android_gms_internal_zzcq = (zzcq) this.zzvX.get(com_google_android_gms_internal_zzov);
if (com_google_android_gms_internal_zzcq != null) {
com_google_android_gms_internal_zzcq.resume();
}
}
}
}
| [
"jessejesse123@gmail.com"
] | jessejesse123@gmail.com |
18e7f06ccfcd742d59c8719c996557680cfd76e3 | 41cd097e6b9eb329c7ef026bb6b25950f9d0e343 | /chapter2/src/main/java/org/mouse/chapter2/util/PropsUtil.java | 8b57038561d425cb28eafb459eac339a06f46f60 | [] | no_license | MahoneWu/smart | 74d17a97b42f5ae013adc7b1e15ca1a17dc04eb4 | 14af318743518f6a2e495a357375b5311f47ceab | refs/heads/master | 2021-01-20T04:55:23.834487 | 2017-12-27T12:09:58 | 2017-12-27T12:09:58 | 101,395,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,877 | java | package org.mouse.chapter2.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Created by Mahone Wu on 2017/8/23.
*/
public class PropsUtil {
private static final Logger logger = LoggerFactory.getLogger(PropsUtil.class);
public static Properties loadProps(String fileName){
Properties properties = null;
InputStream is = null;
try{
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
if(null == is){
throw new FileNotFoundException(fileName + "file not found");
}
properties = new Properties();
properties.load(is);
}catch (IOException e){
logger.error("ๅ ่ฝฝๅฑๆงๅบ้ e = "+e);
}finally {
if(null != is){
try {
is.close();
} catch (IOException e) {
logger.error("ๅ
ณ้ญๆตๅคฑ่ดฅ e = "+e);
}
}
}
return properties;
}
public static String getString(Properties prop ,String key){
return getString(prop, key, "");
}
/**
* ่ทๅๅญ็ฌฆไธฒ
* @param prop
* @param key
* @param defaultValue
* @return
*/
public static String getString(Properties prop,String key,String defaultValue){
String value = defaultValue;
if(prop.contains(key)){
value = prop.getProperty(key);
}
return value;
}
public static int getInt(Properties prop,String key){
return getInt(prop,key,0);
}
public static int getInt(Properties prop,String key,int defaultValue){
int value = defaultValue;
return value;
}
}
| [
"2070509107@qq.com"
] | 2070509107@qq.com |
eb00356d9423acec3b3f13e888c04ef94f114328 | 36fb992399eaf298361ca9762f6a5828e843872f | /LessonBDHw/Driver.java | 75a193eef1034df0d9794a7f1041b82e8dabd99f | [] | no_license | KondratevArtem/KondratevArtem_11-901 | f4cf968d8ef547f7b081d84f9e2f5a7137f38bd1 | 7e79f00257696211018cc296baced4706a025138 | refs/heads/master | 2023-03-05T05:51:47.460013 | 2021-02-14T23:01:24 | 2021-02-14T23:01:24 | 294,017,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package LessonBD;
public class Driver {
private int id;
private String firstName;
private String lastName;
private int age;
public Driver(int id, String firstName, String lastName, int age) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
public int getId() {
return id;
}
public String toString() {
return "Driver" + "\n" + id + " " + firstName + " " + lastName + " " + age;
}
}
| [
"kondrartyom2@gmail.com"
] | kondrartyom2@gmail.com |
dfee3fc0a47fc8dcf182b3d929b034561e0005ee | b142609e28c9dea95bd1293e7223b13628cd7828 | /Client/EntityDef.java | 3e69ac2dc7579388ae146418a36162544c48fe4f | [] | no_license | Geczy/SAS2006 | b8ea952feaa80d289da4a6d1430e0b41e9fba735 | 3c262d9091b819cf705f010c83e90f6514126595 | refs/heads/master | 2020-05-07T05:47:07.213454 | 2013-08-10T00:41:24 | 2013-08-10T00:41:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,090 | java | import java.io.FileWriter;
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
public final class EntityDef
{
public static EntityDef forID(int i)
{
for(int j = 0; j < 20; j++)
if(cache[j].type == (long)i)
return cache[j];
anInt56 = (anInt56 + 1) % 20;
EntityDef entityDef = cache[anInt56] = new EntityDef();
stream.currentOffset = streamIndices[i];
entityDef.type = i;
entityDef.readValues(stream);
return entityDef;
}
public Model method160()
{
if(childrenIDs != null)
{
EntityDef entityDef = method161();
if(entityDef == null)
return null;
else
return entityDef.method160();
}
if(anIntArray73 == null)
return null;
boolean flag1 = false;
for(int i = 0; i < anIntArray73.length; i++)
if(!Model.method463(anIntArray73[i]))
flag1 = true;
if(flag1)
return null;
Model aclass30_sub2_sub4_sub6s[] = new Model[anIntArray73.length];
for(int j = 0; j < anIntArray73.length; j++)
aclass30_sub2_sub4_sub6s[j] = Model.method462(anIntArray73[j]);
Model model;
if(aclass30_sub2_sub4_sub6s.length == 1)
model = aclass30_sub2_sub4_sub6s[0];
else
model = new Model(aclass30_sub2_sub4_sub6s.length, aclass30_sub2_sub4_sub6s);
if(anIntArray76 != null)
{
for(int k = 0; k < anIntArray76.length; k++)
model.method476(anIntArray76[k], anIntArray70[k]);
}
return model;
}
public EntityDef method161()
{
int j = -1;
if(anInt57 != -1)
{
VarBit varBit = VarBit.cache[anInt57];
int k = varBit.anInt648;
int l = varBit.anInt649;
int i1 = varBit.anInt650;
int j1 = client.anIntArray1232[i1 - l];
j = clientInstance.variousSettings[k] >> l & j1;
} else
if(anInt59 != -1)
j = clientInstance.variousSettings[anInt59];
if(j < 0 || j >= childrenIDs.length || childrenIDs[j] == -1)
return null;
else
return forID(childrenIDs[j]);
}
public static void unpackConfig(StreamLoader streamLoader)
{
stream = new Stream(streamLoader.getDataForName("npc.dat"));
Stream stream2 = new Stream(streamLoader.getDataForName("npc.idx"));
int totalNPCs = stream2.readUnsignedWord();
streamIndices = new int[totalNPCs];
int i = 2;
for(int j = 0; j < totalNPCs; j++)
{
streamIndices[j] = i;
i += stream2.readUnsignedWord();
}
cache = new EntityDef[20];
for(int k = 0; k < 20; k++)
cache[k] = new EntityDef();
}
public static void nullLoader()
{
mruNodes = null;
streamIndices = null;
cache = null;
stream = null;
}
public Model method164(int j, int k, int ai[])
{
if(childrenIDs != null)
{
EntityDef entityDef = method161();
if(entityDef == null)
return null;
else
return entityDef.method164(j, k, ai);
}
Model model = (Model) mruNodes.insertFromCache(type);
if(model == null)
{
boolean flag = false;
for(int i1 = 0; i1 < anIntArray94.length; i1++)
if(!Model.method463(anIntArray94[i1]))
flag = true;
if(flag)
return null;
Model aclass30_sub2_sub4_sub6s[] = new Model[anIntArray94.length];
for(int j1 = 0; j1 < anIntArray94.length; j1++)
aclass30_sub2_sub4_sub6s[j1] = Model.method462(anIntArray94[j1]);
if(aclass30_sub2_sub4_sub6s.length == 1)
model = aclass30_sub2_sub4_sub6s[0];
else
model = new Model(aclass30_sub2_sub4_sub6s.length, aclass30_sub2_sub4_sub6s);
if(anIntArray76 != null)
{
for(int k1 = 0; k1 < anIntArray76.length; k1++)
model.method476(anIntArray76[k1], anIntArray70[k1]);
}
model.method469();
model.method479(84 + anInt85, 1000 + anInt92, -90, -580, -90, true);
mruNodes.removeFromCache(model, type);
}
Model model_1 = Model.aModel_1621;
model_1.method464(model, Class36.method532(k) & Class36.method532(j));
if(k != -1 && j != -1)
model_1.method471(ai, j, k);
else
if(k != -1)
model_1.method470(k);
if(anInt91 != 128 || anInt86 != 128)
model_1.method478(anInt91, anInt91, anInt86);
model_1.method466();
model_1.anIntArrayArray1658 = null;
model_1.anIntArrayArray1657 = null;
if(aByte68 == 1)
model_1.aBoolean1659 = true;
return model_1;
}
private void readValues(Stream stream)
{
do
{
int i = stream.readUnsignedByte();
if(i == 0)
return;
if(i == 1)
{
int j = stream.readUnsignedByte();
anIntArray94 = new int[j];
for(int j1 = 0; j1 < j; j1++)
anIntArray94[j1] = stream.readUnsignedWord();
} else
if(i == 2)
name = stream.readString();
else
if(i == 3)
description = stream.readBytes();
else
if(i == 12)
aByte68 = stream.readSignedByte();
else
if(i == 13)
anInt77 = stream.readUnsignedWord();
else
if(i == 14)
anInt67 = stream.readUnsignedWord();
else
if(i == 17)
{
anInt67 = stream.readUnsignedWord();
anInt58 = stream.readUnsignedWord();
anInt83 = stream.readUnsignedWord();
anInt55 = stream.readUnsignedWord();
} else
if(i >= 30 && i < 40)
{
if(actions == null)
actions = new String[5];
actions[i - 30] = stream.readString();
if(actions[i - 30].equalsIgnoreCase("hidden"))
actions[i - 30] = null;
} else
if(i == 40)
{
int k = stream.readUnsignedByte();
anIntArray76 = new int[k];
anIntArray70 = new int[k];
for(int k1 = 0; k1 < k; k1++)
{
anIntArray76[k1] = stream.readUnsignedWord();
anIntArray70[k1] = stream.readUnsignedWord();
}
} else
if(i == 60)
{
int l = stream.readUnsignedByte();
anIntArray73 = new int[l];
for(int l1 = 0; l1 < l; l1++)
anIntArray73[l1] = stream.readUnsignedWord();
} else
if(i == 90)
stream.readUnsignedWord();
else
if(i == 91)
stream.readUnsignedWord();
else
if(i == 92)
stream.readUnsignedWord();
else
if(i == 93)
aBoolean87 = false;
else
if(i == 95)
combatLevel = stream.readUnsignedWord();
else
if(i == 97)
anInt91 = stream.readUnsignedWord();
else
if(i == 98)
anInt86 = stream.readUnsignedWord();
else
if(i == 99)
aBoolean93 = true;
else
if(i == 100)
anInt85 = stream.readSignedByte();
else
if(i == 101)
anInt92 = stream.readSignedByte() * 5;
else
if(i == 102)
anInt75 = stream.readUnsignedWord();
else
if(i == 103)
anInt79 = stream.readUnsignedWord();
else
if(i == 106)
{
anInt57 = stream.readUnsignedWord();
if(anInt57 == 65535)
anInt57 = -1;
anInt59 = stream.readUnsignedWord();
if(anInt59 == 65535)
anInt59 = -1;
int i1 = stream.readUnsignedByte();
childrenIDs = new int[i1 + 1];
for(int i2 = 0; i2 <= i1; i2++)
{
childrenIDs[i2] = stream.readUnsignedWord();
if(childrenIDs[i2] == 65535)
childrenIDs[i2] = -1;
}
} else
if(i == 107)
aBoolean84 = false;
} while(true);
}
private EntityDef()
{
anInt55 = -1;
anInt57 = -1;
anInt58 = -1;
anInt59 = -1;
combatLevel = -1;
anInt64 = 1834;
anInt67 = -1;
aByte68 = 1;
anInt75 = -1;
anInt77 = -1;
type = -1L;
anInt79 = 32;
anInt83 = -1;
aBoolean84 = true;
anInt86 = 128;
aBoolean87 = true;
anInt91 = 128;
aBoolean93 = false;
}
public int anInt55;
private static int anInt56;
private int anInt57;
public int anInt58;
private int anInt59;
private static Stream stream;
public int combatLevel;
private final int anInt64;
public String name;
public String actions[];
public int anInt67;
public byte aByte68;
private int[] anIntArray70;
private static int[] streamIndices;
private int[] anIntArray73;
public int anInt75;
private int[] anIntArray76;
public int anInt77;
public long type;
public int anInt79;
private static EntityDef[] cache;
public static client clientInstance;
public int anInt83;
public boolean aBoolean84;
private int anInt85;
private int anInt86;
public boolean aBoolean87;
public int childrenIDs[];
public byte description[];
private int anInt91;
private int anInt92;
public boolean aBoolean93;
private int[] anIntArray94;
public static MRUNodes mruNodes = new MRUNodes(30);
}
| [
"info@mgates.me"
] | info@mgates.me |
318683334300c32362e6a58f46d367d26a6bbb30 | 38108c12261fc13406cfca09e86a32e75e879bbf | /app/src/test/java/com/nuvoton/exortsptest/ExampleUnitTest.java | 60def163299bd2de0f4210011b0accbd3795c711 | [] | no_license | timsheu/RtspExtractorTest | 800020f78ce3d7c7098ffe1c60de1c023641448c | 72c992bdca9017b4d6a4273634427d6dcf931ae8 | refs/heads/master | 2021-01-21T20:46:59.408750 | 2017-05-24T10:28:28 | 2017-05-24T10:28:28 | 92,279,971 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.nuvoton.exortsptest;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"timsheu.ash@gmail.com"
] | timsheu.ash@gmail.com |
b7a751ef602cecaa6423f5770a291d194232a7cb | 454c0642ce04b3f3b99f9162eacac41849559e57 | /src/java/com/songj/observer/Subject.java | 6a9377416c9ba8c37743f1200179844def5283fb | [] | no_license | songjian11/model | b381b2cad5bad1298edf6304cc031c9c7fc2c4d4 | bea02cfacd6cc7fc494277092e68a961689aba8f | refs/heads/master | 2021-03-14T01:45:32.156455 | 2020-03-12T02:53:22 | 2020-03-12T02:53:22 | 246,728,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 372 | java | package com.songj.observer;
import java.util.ArrayList;
import java.util.List;
public abstract class Subject {
protected List<Observer> list = new ArrayList<>();
public void add(Observer observer){
this.list.add(observer);
}
public void delete(Observer observer){
this.list.remove(observer);
}
public abstract void action();
}
| [
"songjian@mm.com"
] | songjian@mm.com |
47c881076ccc2e516d3b866ac80f6dcad6769179 | dc9aaa975408b59a541c054495f975ef1aef7d49 | /src/main/java/com/SuperBankApplication/SuperBankApplication/SuperBankApplication.java | f6bda902e17bce02b959783c1e4fceb74ce31aef | [] | no_license | Mecid90/BankService | a0e8e1f9b8f327f37ed2662f14690c4be57b50dc | b9515e721a22dd8e0c44f58721d29a866a6f82f8 | refs/heads/master | 2023-08-18T06:43:38.745380 | 2021-10-19T11:55:23 | 2021-10-19T11:55:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.SuperBankApplication.SuperBankApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SuperBankApplication {
public static void main(String[] args) {
SpringApplication.run(SuperBankApplication.class, args);
}
}
| [
"mecidm90@gmail.com"
] | mecidm90@gmail.com |
06fefc88dbb56c35f7f4ffa87ec7695501ecb8c1 | 28ea28bc29c79a33a418acfe54589f56504d8f9c | /main/src/main/java/pers/wangdj/active/utils/LogUtil.java | f3ed3925958660fcc784340deca66c9b70628ce3 | [] | no_license | wangdj2020/Active | 9c64fcc66aa0530c1555dea1c03d95dea7d1d5d3 | c85948968ea7d22722f18ac4af7241d7d4410ac4 | refs/heads/master | 2021-09-13T15:08:15.347308 | 2018-05-01T15:35:48 | 2018-05-01T15:35:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,355 | java | package pers.wangdj.active.utils;
import android.util.Log;
/**
* ้กน็ฎๅ๏ผ AndroidCommonProject
* ๅ
ๅ๏ผ pers.wangdj.active.utils
* ๆไปถๅ๏ผ LogUtil
* ๅๅปบ่
๏ผ wangdja
* ๅๅปบๆถ้ด๏ผ2018-01-17 10:36 ไธๅ
* ๆ่ฟฐ๏ผ ๆฅๅฟๅทฅๅ
ท็ฑป
*/
public class LogUtil {
private static final int VERBOSE = 1;
private static final int DEBUG = 2;
private static final int INFO = 3;
private static final int WARN = 4;
private static final int ERROR = 5;
private static final int NOTHING = 6;
/**
* ๆฅๅฟๆๅฐ็ญ็บงๆงๅถ๏ผไฝฟ็จ่ฟไธชๅผๆงๅถๆฅๅฟๆๅฐ็็บงๅซ
* wangdj @2018ๅนด1ๆ17ๆฅ10็น44ๅ
*/
private static int level = VERBOSE;
public static void v(String tag, String msg) {
if (level <= VERBOSE) {
Log.v(tag, msg);
}
}
public static void d(String tag, String msg) {
if (level <= DEBUG) {
Log.d(tag, msg);
}
}
public static void i(String tag, String msg) {
if (level <= INFO) {
Log.i(tag, msg);
}
}
public static void w(String tag, String msg) {
if (level <= WARN) {
Log.w(tag, msg);
}
}
public static void e(String tag, String msg) {
if (level <= ERROR) {
Log.e(tag, msg);
}
}
}
| [
"wangdja@yonyou.com"
] | wangdja@yonyou.com |
b64aae2beb035d05e3ae9e95badd36a2b2f7c4fd | 9afde84fc8e6143b1145c4b0f0707af1f6858d22 | /app/src/main/java/utils/LocalMediaLoader.java | f39a7bbf2a42166f82ec461a08bbe744f5c2c0ca | [] | no_license | T-cube/Tillo-android | e269620ddcf5bca06d619fa75284dd1704073c96 | d7e8691b3d0cffb797c29cb620523587e3743958 | refs/heads/master | 2020-03-14T01:47:29.973495 | 2018-11-22T02:33:27 | 2018-11-22T02:33:27 | 131,385,029 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,760 | java | package utils;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.util.Log;
import com.yumeng.tillo.R;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import model.model.LocalMedia;
import model.model.LocalMediaFolder;
public class LocalMediaLoader {
// load type
public static final int TYPE_CONTACK = 0;
public static final int TYPE_IMAGE = 1;
public static final int TYPE_VIDEO = 2;
private final static String[] IMAGE_PROJECTION = {
MediaStore.Images.Media.DATA,
MediaStore.Images.Media.DISPLAY_NAME,
MediaStore.Images.Media.DATE_ADDED,
MediaStore.Images.Media._ID};
private final static String[] VIDEO_PROJECTION = {
MediaStore.Video.Media.DATA,
MediaStore.Video.Media.DISPLAY_NAME,
MediaStore.Video.Media.DATE_ADDED,
MediaStore.Video.Media._ID,
MediaStore.Video.Media.DURATION};
private int type = TYPE_IMAGE;
private FragmentActivity activity;
public LocalMediaLoader(FragmentActivity activity, int type) {
this.activity = activity;
this.type = type;
}
HashSet<String> mDirPaths = new HashSet<String>();//ๆไปถๅคน่ทฏๅพ
public void loadAllImage(final LocalMediaLoadListener imageLoadListener) {
activity.getSupportLoaderManager().initLoader(type, null, new LoaderManager.LoaderCallbacks<Cursor>() {
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
CursorLoader cursorLoader = null;
if (id == TYPE_IMAGE) {
cursorLoader = new CursorLoader(
activity, MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
IMAGE_PROJECTION, MediaStore.Images.Media.MIME_TYPE + "=? or "
+ MediaStore.Images.Media.MIME_TYPE + "=?",
new String[]{"image/jpeg", "image/png"}, IMAGE_PROJECTION[2] + " DESC");
} else if (id == TYPE_VIDEO) {
cursorLoader = new CursorLoader(
activity, MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
VIDEO_PROJECTION, null, null, VIDEO_PROJECTION[2] + " DESC");
}
return cursorLoader;
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
ArrayList<LocalMediaFolder> imageFolders = new ArrayList<LocalMediaFolder>();//ไธ็ปๆไปถๅคน
LocalMediaFolder allImageFolder = new LocalMediaFolder();//ๆไปถๅคน
List<LocalMedia> allImages = new ArrayList<LocalMedia>();//ๅพ็
//whileๅพช็ฏ
while (data != null && data.moveToNext()) {
String path = data.getString(data.getColumnIndex(MediaStore.Images.Media.DATA));// ๅพ็็่ทฏๅพ
allImages.add(new LocalMedia(path));
File file = new File(path);
if (!file.exists())
continue;
// ่ทๅ่ฏฅๅพ็็็ฎๅฝ่ทฏๅพๅ
File parentFile = file.getParentFile();//ๅพ็ๅฏนๅบ็ๆไปถๅคน
if (parentFile == null || !parentFile.exists())
continue;
String dirPath = parentFile.getAbsolutePath();//ๆไปถๅคน่ทฏๅพ
// ๅฉ็จไธไธชHashSet้ฒๆญขๅคๆฌกๆซๆๅไธไธชๆไปถๅคน
if (mDirPaths.contains(dirPath)) {
continue;
} else {
mDirPaths.add(dirPath);
}
if (parentFile.list() == null)
continue;
// TODO: 2016/08/19 ๅค็ๆไปถๅคนๆฐๆฎ ๆไปถๅคนไธๆๆๅพ็้กบๅบๆฒกๆๅฏนๅบ
//ๅค็ๆไปถๅคนๆฐๆฎ
LocalMediaFolder localMediaFolder = getImageFolder(path, imageFolders);
Log.e("caoyang", "ๆฌๅฐๆไปถๅคนๅ็งฐโโโโโโ " + parentFile.toString());
//่ทๅๆไปถๅคน้็ๆๆๅพ็
File[] files = parentFile.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String filename) {
if (filename.endsWith(".jpg") | filename.endsWith(".png") || filename.endsWith(".jpeg"))
return true;
return false;
}
});
List<LocalMedia> images = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
//allImages.add(localMedia);
images.add(new LocalMedia(files[i].getAbsolutePath()));
}
if (images.size() > 0) {
Collections.sort(images);
localMediaFolder.setImages(images);
localMediaFolder.setFirstImagePath(images.get(0).getPath());
localMediaFolder.setImageNum(localMediaFolder.getImages().size());
imageFolders.add(localMediaFolder);
}
}
allImageFolder.setImages(allImages);
allImageFolder.setImageNum(allImageFolder.getImages().size());
if (allImages.size() != 0) {
allImageFolder.setFirstImagePath(allImages.get(0).getPath());
}
allImageFolder.setName(activity.getString(R.string.all_image));
imageFolders.add(allImageFolder);
sortFolder(imageFolders);
imageLoadListener.loadComplete(imageFolders);
if (data != null) data.close();
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
}
});
}
private void sortFolder(List<LocalMediaFolder> imageFolders) {
// ๆไปถๅคนๆๅพ็ๆฐ้ๆๅบ
Collections.sort(imageFolders, new Comparator<LocalMediaFolder>() {
@Override
public int compare(LocalMediaFolder lhs, LocalMediaFolder rhs) {
if (lhs.getImages() == null || rhs.getImages() == null) {
return 0;
}
int lsize = lhs.getImageNum();
int rsize = rhs.getImageNum();
return lsize == rsize ? 0 : (lsize < rsize ? 1 : -1);
}
});
}
private LocalMediaFolder getImageFolder(String path, List<LocalMediaFolder> imageFolders) {
File imageFile = new File(path);
File folderFile = imageFile.getParentFile();//ๅพ็ๅฏนๅบ็ๆไปถๅคน
//ๆๅฏปๆๆๆไปถๅคน
for (LocalMediaFolder folder : imageFolders) {
if (folder.getName().equals(folderFile.getName())) {
return folder;
}
}
LocalMediaFolder newFolder = new LocalMediaFolder();
newFolder.setName(folderFile.getName());
newFolder.setPath(folderFile.getAbsolutePath());
return newFolder;
}
public interface LocalMediaLoadListener {
void loadComplete(List<LocalMediaFolder> folders);
}
}
| [
"developer@yumeng.co"
] | developer@yumeng.co |
c67820069764282978538f0db01065caa8e9c098 | 17442c8820be22f458134e85826e8dbb249b3dd4 | /src/test/java/com/example/gwdemo/GwDemoApplicationTests.java | fe2bc8ba347d2a71f7ab4e93aa375fe1a2d7e27e | [] | no_license | abelsromero/scg-demo | 6fdb0d812254ee8a0b07f0d2f3f6865176433c07 | 1cc70ecd638e6711db43e013b84603a92f5536f7 | refs/heads/main | 2023-06-01T00:40:01.547743 | 2021-06-21T13:43:28 | 2021-06-21T13:43:28 | 378,942,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package com.example.gwdemo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class GwDemoApplicationTests {
@Test
void contextLoads() {
}
}
| [
"romeroab@vmware.com"
] | romeroab@vmware.com |
2440c8f9176ce2feb46fcd335a6694e4f4cef905 | f50c6357a17814a723d4b2756a10ac909a5b9f00 | /app/src/main/java/com/sage/demo0809/app/RxException.java | 6816ccb8a66ab79ea197e20ec4a769bd5437c057 | [] | no_license | salmanit/Demo0809 | cfbb421efc55c592266321f5a61ffc99b48ce61f | 967753d97f23173c3d2e1cde1d7fbcdbf5bad414 | refs/heads/master | 2021-01-16T20:41:48.346645 | 2017-10-27T07:37:48 | 2017-10-27T07:37:48 | 65,256,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package com.sage.demo0809.app;
/**
* Created by Sage on 2016/9/5.
*/
public class RxException extends Throwable {
public RxException(String detailMessage) {
super(detailMessage);
}
}
| [
"salmanit@163.com"
] | salmanit@163.com |
89ce61b4f37b07bda13f40a17d74ee357bbdfb51 | 067cbfde178da76642209703412ec8ee7c447145 | /app/src/main/java/com/example/codetribe/my_kid/sign_up.java | 342068f9263d24fcf6d19e58c8e446445b0b817a | [] | no_license | PfarsMavhs/My_KId | 88ca7acab12c560b307323083617add4cbadc537 | 99242e9c3a5fefcb70973177f49a6ed38423e27b | refs/heads/master | 2021-05-05T17:14:00.729817 | 2017-09-13T10:47:11 | 2017-09-13T10:47:11 | 101,984,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,161 | java | package com.example.codetribe.my_kid;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
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.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.Iterator;
public class sign_up extends AppCompatActivity {
private EditText inputEmail, inputPassword;
private Button btnSignUp;
TextView mainNav;
//firebase Authentification
private FirebaseAuth auth;
FirebaseAuth.AuthStateListener mAuthListener;
DatabaseReference mDatabaseRef,mUserCheckData;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
getSupportActionBar().setTitle("SignUp");
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
mDatabaseRef = FirebaseDatabase.getInstance().getReference();
mUserCheckData = FirebaseDatabase.getInstance().getReference().child("Users");
btnSignUp = (Button) findViewById(R.id.signupButton);
inputEmail = (EditText) findViewById(R.id.signupEmail);
inputPassword = (EditText) findViewById(R.id.signupPassword);
mainNav = (TextView)findViewById(R.id.link_to_login);
mainNav.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
startActivity(new Intent(sign_up.this, MainActivity.class));
finish();
}
});
mAuthListener = new FirebaseAuth.AuthStateListener(){
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null){
final String emailForVer = user.getEmail();
mDatabaseRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
checkUserValidation(dataSnapshot,emailForVer);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
//startActivity(new Intent(MainActivity.this, Welcome.class));
}else{
}
}
};
btnSignUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String email = inputEmail.getText().toString().trim();
String password = inputPassword.getText().toString().trim();
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;
}
final String userEmailString, userPassString;
userEmailString = inputEmail.getText().toString().trim();
userPassString = inputPassword.getText().toString().trim();
if(!TextUtils.isEmpty(userEmailString) && !TextUtils.isEmpty(userPassString))
{
auth.createUserWithEmailAndPassword(userEmailString,userPassString).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful())
{
DatabaseReference mChildDatabase = mDatabaseRef.child("Users").push();
String key_user = mChildDatabase.getKey();
mChildDatabase.child("isVerified").setValue("unverified");
mChildDatabase.child("userKey").setValue(key_user);
mChildDatabase.child("emailUser").setValue(userEmailString);
mChildDatabase.child("passWordUser").setValue(userPassString);
Toast.makeText(sign_up.this, "User Account Created", Toast.LENGTH_SHORT).show();
auth.signOut();
startActivity(new Intent(sign_up.this,MainActivity.class));
}else{
Toast.makeText(sign_up.this, "User Fialed to login", Toast.LENGTH_SHORT).show();
}
}
});
}
/* auth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(sign_up.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Toast.makeText(sign_up.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show();
// progressBar.setVisibility(View.GONE);
// 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(sign_up.this, "Authentication failed." + task.getException(),
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(sign_up.this, "Successfuly Created." + task.getException(),
Toast.LENGTH_SHORT).show();
finish();
startActivity(new Intent(sign_up.this, MainActivity.class));
}
}
});*/
}
});
}
public void checkUserValidation(DataSnapshot dataSnapshot, String emailForVer){
Iterator iterator = dataSnapshot.getChildren().iterator();
while(iterator.hasNext())
{
DataSnapshot dataUser = (DataSnapshot) iterator.next();
if(dataUser.child("emailUser").getValue().toString().equals(emailForVer)) {
if (dataUser.child("isVerified").getValue().toString().equals("unverified")) {
Intent intent = new Intent(sign_up.this, MainActivity.class);
intent.putExtra("User_KEY", dataUser.child("userKey").getValue().toString());
startActivity(intent);
} else {
startActivity(new Intent(sign_up.this, Mainapp.class));
}
}
}
}
}
| [
"mudaurrudzani@gmail.com"
] | mudaurrudzani@gmail.com |
2e39c7332de8429289829c4d0a4e6d7cd98bb4ab | 40953aa2b935b66705457ba5078a6012e883d39a | /WYD-WorldServer/src/com/wyd/empire/world/server/handler/cross/CrossOtherBigSkillHandler.java | 085f5734d028cbee1a6c155aaa735fb44a30b7b1 | [] | no_license | mestatrit/game | 91f303ba2ff9d26bdf54cdcf8c99a0c158cdf184 | e57b58aa5f282ed035664d08f6a5564161397029 | refs/heads/master | 2020-12-31T07:19:00.143960 | 2015-04-18T10:01:14 | 2015-04-18T10:01:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,018 | java | package com.wyd.empire.world.server.handler.cross;
import org.apache.log4j.Logger;
import com.wyd.empire.protocol.data.battle.OtherBigSkill;
import com.wyd.empire.protocol.data.cross.CrossOtherBigSkill;
import com.wyd.empire.world.room.Room;
import com.wyd.empire.world.room.Seat;
import com.wyd.empire.world.server.service.factory.ServiceManager;
import com.wyd.protocol.data.AbstractData;
import com.wyd.protocol.handler.IDataHandler;
/**
* ็ฉๅฎถไฝฟ็จๅคงๆ
*
* @author zguoqiu
*/
public class CrossOtherBigSkillHandler implements IDataHandler {
Logger log = Logger.getLogger(CrossOtherBigSkillHandler.class);
public void handle(AbstractData data) throws Exception {
CrossOtherBigSkill cobs = (CrossOtherBigSkill) data;
try {
Room room = ServiceManager.getManager().getRoomService().getRoom(cobs.getRoomId());
if (null != room) {
OtherBigSkill obs = new OtherBigSkill();
obs.setBattleId(cobs.getBattleId());
obs.setCurrentPlayerId(cobs.getCurrentPlayerId());
for (Seat seat : room.getPlayerList()) {
if (null != seat.getPlayer()
&& !seat.isRobot()
&& ServiceManager.getManager().getCrossService().getCrossPlayerId(seat.getPlayer().getId()) != obs
.getCurrentPlayerId()) {
obs.setPlayerId(ServiceManager.getManager().getCrossService().getCrossPlayerId(seat.getPlayer().getId()));
seat.getPlayer().sendData(obs);
}
}
Seat playerSeat = ServiceManager.getManager().getRoomService()
.getSeat(cobs.getRoomId(), ServiceManager.getManager().getCrossService().getPlayerId(obs.getCurrentPlayerId()));
if (null == playerSeat || null == playerSeat.getPlayer()) {
return;
}
// ๆดๆฐไปปๅก
if (!playerSeat.isRobot()) {
ServiceManager.getManager().getTaskService().useBigSkill(playerSeat.getPlayer());
ServiceManager.getManager().getTitleService().useBigSkill(playerSeat.getPlayer());
}
}
} catch (Exception e) {
log.info(e, e);
}
}
} | [
"huangwei2wei@126.com"
] | huangwei2wei@126.com |
94e1f0c74125a1403185e5a9185e1e4ed39a0788 | b1aaf43ed60f6f91f32f909783dd35aab4ac346b | /H2RDF+/src/main/java/gr/ntua/h2rdf/concurrent/Barrier.java | a3a3ad31dcbe65ae3962e75d9a148ef003ea6838 | [] | no_license | npapa/h2rdf | 96bd8f5861c26e564b1a2756983218455af549b6 | b1d8d05cc21d0a23adf64877f0bc2244b99e7584 | refs/heads/master | 2021-01-13T01:55:42.406671 | 2015-09-24T06:00:46 | 2015-09-24T06:00:46 | 32,719,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,487 | java | /*******************************************************************************
* Copyright [2013] [Nikos Papailiou]
*
* 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 gr.ntua.h2rdf.concurrent;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.data.Stat;
/**
* Barrier
*/
public class Barrier extends SyncPrimitive {
int size;
String name;
/**
* Barrier constructor
*
* @param address
* @param root
* @param size
*/
Barrier(String address, String root, int size) {
super(address);
this.input = input;
this.size = size;
// Create barrier node
if (zk != null) {
try {
Stat s = zk.exists(root, false);
if (s == null) {
zk.create(input, new byte[0], Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
}
} catch (KeeperException e) {
System.out
.println("Keeper exception when instantiating queue: "
+ e.toString());
} catch (InterruptedException e) {
System.out.println("Interrupted exception");
}
}
// My node name
try {
name = new String(InetAddress.getLocalHost().getCanonicalHostName().toString());
} catch (UnknownHostException e) {
System.out.println(e.toString());
}
}
/**
* Join barrier
*
* @return
* @throws KeeperException
* @throws InterruptedException
*/
boolean enter() throws KeeperException, InterruptedException{
zk.create(input + "/" + name, new byte[0], Ids.OPEN_ACL_UNSAFE,
CreateMode.EPHEMERAL_SEQUENTIAL);
while (true) {
synchronized (mutex) {
List<String> list = zk.getChildren(input, true);
if (list.size() < size) {
mutex.wait();
} else {
return true;
}
}
}
}
/**
* Wait until all reach barrier
*
* @return
* @throws KeeperException
* @throws InterruptedException
*/
boolean leave() throws KeeperException, InterruptedException{
zk.delete(input + "/" + name, 0);
while (true) {
synchronized (mutex) {
List<String> list = zk.getChildren(input, true);
if (list.size() > 0) {
mutex.wait();
} else {
return true;
}
}
}
}
}
| [
"npapa@cslab.ece.ntua.gr@29f01f91-bbd8-63f5-d2aa-eb046b36aed7"
] | npapa@cslab.ece.ntua.gr@29f01f91-bbd8-63f5-d2aa-eb046b36aed7 |
77b48354681eaaa1f163568070d81ce58ad54df9 | 36e33608e4f9a1bfd17d097cecb1ba1763e6a56d | /java/mes_producer/.svn/pristine/77/77b48354681eaaa1f163568070d81ce58ad54df9.svn-base | 3517ac288ad1b9bc92f00c410cb60e55fb9f73d7 | [
"Apache-2.0"
] | permissive | sirsir/TSE-TMEIC | fa8f6eed334f882b1a3d3540b2e926e1d9903ed4 | 9494a9dc05dc43f2353c3855bca4cfcaa67c830a | refs/heads/master | 2020-03-28T17:12:56.572061 | 2018-09-14T09:49:09 | 2018-09-14T09:49:09 | 148,768,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,310 | package jp.co.tmeic.mespd.entity;
import java.sql.Date;
import java.sql.Timestamp;
import javax.annotation.Generated;
import org.seasar.extension.jdbc.name.PropertyName;
/**
* {@link DShippingPlan}ใฎใใญใใใฃๅใฎ้ๅใงใใ
*
*/
@Generated(value = {"S2JDBC-Gen 2.4.46", "org.seasar.extension.jdbc.gen.internal.model.NamesModelFactoryImpl"})
public class DShippingPlanNames {
/**
* createDateใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return createDateใฎใใญใใใฃๅ
*/
public static PropertyName<Timestamp> createDate() {
return new PropertyName<Timestamp>("createDate");
}
/**
* updateDateใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return updateDateใฎใใญใใใฃๅ
*/
public static PropertyName<Timestamp> updateDate() {
return new PropertyName<Timestamp>("updateDate");
}
/**
* shippingNoใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return shippingNoใฎใใญใใใฃๅ
*/
public static PropertyName<String> shippingNo() {
return new PropertyName<String>("shippingNo");
}
/**
* shippingDateใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return shippingDateใฎใใญใใใฃๅ
*/
public static PropertyName<Date> shippingDate() {
return new PropertyName<Date>("shippingDate");
}
/**
* partNoใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return partNoใฎใใญใใใฃๅ
*/
public static PropertyName<String> partNo() {
return new PropertyName<String>("partNo");
}
/**
* partNameใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return partNameใฎใใญใใใฃๅ
*/
public static PropertyName<String> partName() {
return new PropertyName<String>("partName");
}
/**
* customerNameใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return customerNameใฎใใญใใใฃๅ
*/
public static PropertyName<String> customerName() {
return new PropertyName<String>("customerName");
}
/**
* modelใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return modelใฎใใญใใใฃๅ
*/
public static PropertyName<String> model() {
return new PropertyName<String>("model");
}
/**
* itemNoใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return itemNoใฎใใญใใใฃๅ
*/
public static PropertyName<String> itemNo() {
return new PropertyName<String>("itemNo");
}
/**
* planQtyใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return planQtyใฎใใญใใใฃๅ
*/
public static PropertyName<Integer> planQty() {
return new PropertyName<Integer>("planQty");
}
/**
* resultQtyใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return resultQtyใฎใใญใใใฃๅ
*/
public static PropertyName<Integer> resultQty() {
return new PropertyName<Integer>("resultQty");
}
/**
* planStartDateใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return planStartDateใฎใใญใใใฃๅ
*/
public static PropertyName<Timestamp> planStartDate() {
return new PropertyName<Timestamp>("planStartDate");
}
/**
* planEndDateใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return planEndDateใฎใใญใใใฃๅ
*/
public static PropertyName<Timestamp> planEndDate() {
return new PropertyName<Timestamp>("planEndDate");
}
/**
* @author S2JDBC-Gen
*/
public static class _DShippingNames extends PropertyName<DShippingPlan> {
/**
* ใคใณในใฟใณในใๆง็ฏใใพใใ
*/
public _DShippingNames() {
}
/**
* ใคใณในใฟใณในใๆง็ฏใใพใใ
*
* @param name
* ๅๅ
*/
public _DShippingNames(final String name) {
super(name);
}
/**
* ใคใณในใฟใณในใๆง็ฏใใพใใ
*
* @param parent
* ่ฆช
* @param name
* ๅๅ
*/
public _DShippingNames(final PropertyName<?> parent, final String name) {
super(parent, name);
}
/**
* createDateใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return createDateใฎใใญใใใฃๅ
*/
public PropertyName<Timestamp> createDate() {
return new PropertyName<Timestamp>(this, "createDate");
}
/**
* updateDateใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return updateDateใฎใใญใใใฃๅ
*/
public PropertyName<Timestamp> updateDate() {
return new PropertyName<Timestamp>(this, "updateDate");
}
/**
* shippingNoใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return shippingNoใฎใใญใใใฃๅ
*/
public PropertyName<String> shippingNo() {
return new PropertyName<String>(this, "shippingNo");
}
/**
* shippingDateใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return shippingDateใฎใใญใใใฃๅ
*/
public PropertyName<Date> shippingDate() {
return new PropertyName<Date>(this, "shippingDate");
}
/**
* partNoใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return partNoใฎใใญใใใฃๅ
*/
public PropertyName<String> partNo() {
return new PropertyName<String>(this, "partNo");
}
/**
* partNameใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return partNameใฎใใญใใใฃๅ
*/
public PropertyName<String> partName() {
return new PropertyName<String>(this, "partName");
}
/**
* customerNameใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return customerNameใฎใใญใใใฃๅ
*/
public PropertyName<String> customerName() {
return new PropertyName<String>(this, "customerName");
}
/**
* modelใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return modelใฎใใญใใใฃๅ
*/
public PropertyName<String> model() {
return new PropertyName<String>(this, "model");
}
/**
* itemNoใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return itemNoใฎใใญใใใฃๅ
*/
public PropertyName<String> itemNo() {
return new PropertyName<String>(this, "itemNo");
}
/**
* planQtyใฎใใญใใใฃๅใ่ฟใใพใใ
*
* @return planQtyใฎใใญใใใฃๅ
*/
public PropertyName<Integer> planQty() {
return new PropertyName<Integer>(this, "planQty");
}
}
} | [
"sirsak@gmail.com"
] | sirsak@gmail.com | |
840d9af28e6977b6973ae9cc085067ed4c949e83 | 6be97496188a4bab6dec33a8b51ff2e1acd2cea6 | /src/main/java/it/controllers/TopicAdder.java | b09378a6e5f8eec8cd3715c5e5d6ba9703b923e4 | [] | no_license | VLEXX/TIW-topicmanager | 82c3fd597418767d0c35fc6d80a8d790563f900d | 5a6523e1534786c699f7f2a8c0978ce22672c629 | refs/heads/master | 2023-07-03T10:39:39.678321 | 2021-07-27T09:07:41 | 2021-07-27T09:07:41 | 361,723,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,738 | java | package it.controllers;
import it.beans.TopicBean;
import it.beans.UserBean;
import it.dao.TopicDAO;
import org.thymeleaf.context.WebContext;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
@WebServlet(name = "TopicAdder", value = "/areapersonale/addtopic")
public class TopicAdder extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String topicname = request.getParameter("topicname");
String ftopicname = request.getParameter("fathertopicname");
TemplateEngineManager tem = new TemplateEngineManager(this.getServletContext());
WebContext webctx = new WebContext(request, response, this.getServletContext(), request.getLocale());
webctx.setVariable("username", ((UserBean)request.getSession().getAttribute("user")).getUsername());
//caso 1a: topicname nullo o vuoto
if(topicname == null || topicname.isBlank() || !topicname.matches("^[a-zA-Z0-9 ]*$") || topicname.contains(" ") || topicname.length() > 255){
System.out.println("TopicAdder: i dati non sono validi -> dispatching edited Home.html");
webctx.setVariable("errore", "<p style=\"color:red;\">E' obbligatorio specificare la nuova categoria e deve essere alfanumerica (spazi ammessi ma non consecutivi) e puo' avere un massimo di 255 caratteri</p>");
}else{
Connection c = null;
try {
c = DBConnectionSupplier.getConnection();
TopicDAO td = new TopicDAO(c);
Integer resultid = td.findIdByTopic(topicname);
//caso 1b/2a: topicname valido ma esiste giร nel db
if(resultid!=null){
System.out.println("TopicAdder: categoria giร presente nel DB -> dispatching edited Home.html");
webctx.setVariable("errore", "<p style=\"color:red;\">La categoria inserita esiste gia'</p>");
}else{
//caso 1b/2b/3a: categoria padre non nulla
if(ftopicname!=null && !ftopicname.isBlank()){
resultid = td.findIdByTopic(ftopicname);
//caso 1b/2b/3a/4a: categoria padre inesistente
if(resultid==null){
System.out.println("TopicAdder: la categoria padre specificata non esiste -> dispatching edited Home.html");
webctx.setVariable("errore", "<p style=\"color:red;\">Categoria padre specificata inesistente</p>");
}else{
ArrayList<Integer> children = td.findChildrenIdById(resultid);
//caso 1b/2b/3a/4b/5a: categoria padre esistente ma limite figli superato
if(children.size()>=9){
System.out.println("TopicAdder: limite massimo di 9 sottocategorie superato -> dispatching edited Home.html");
webctx.setVariable("errore", "<p style=\"color:red;\">Impossibile aggiungere piu' di 9 sottocategorie</p>");
}else{
System.out.println("TopicAdder: inserimento nuova categorie consentito");
td.insertNewTopic(topicname,resultid,children.size()+1);
webctx.setVariable("errore", "<p style=\"color:green;\">Categoria '"+topicname+"' inserita con successo.</p>");
}
}
//caso 1b/2b/3b: categoria padre nulla (radice)
}else{
ArrayList<Integer> children = td.findChildrenIdById(resultid);
//caso 1b/2b/3b/6a: limite figli alla radice superato
if(children.size()>=9){
System.out.println("TopicAdder: limite massimo di 9 sottocategorie superato (radice) -> dispatching edited Home.html");
webctx.setVariable("errore", "<p style=\"color:red;\">Impossibile aggiungere piu' di 9 sottocategorie</p>");
}else{
System.out.println("TopicAdder: inserimento nuova categorie consentito (radice)");
td.insertNewTopic(topicname,resultid,children.size()+1);
webctx.setVariable("errore", "<p style=\"color:green;\">Categoria '"+topicname+"' inserita con successo.</p>");
}
}
}
c.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
webctx.setVariable("DBerror","<br>Il servizio non รจ al momento disponibile, riprovare piรน tardi<br>");
tem.getTemplateEngine().process("Home", webctx, response.getWriter());
}
}
TopicDAO td2 = null;
try {
Connection c2 = DBConnectionSupplier.getConnection();
td2 = new TopicDAO(c2);
ArrayList<TopicBean> roottopiclist = td2.treeGenerator();
c2.close();
webctx.setVariable("rootTopicBeanAsList",roottopiclist);
} catch (SQLException throwables) {
throwables.printStackTrace();
webctx.setVariable("DBerror","<br>Il servizio non รจ al momento disponibile, riprovare piรน tardi<br>");
} finally{
tem.getTemplateEngine().process("Home", webctx, response.getWriter());
}
}
}
| [
"alex.saletti@mail.polimi.it"
] | alex.saletti@mail.polimi.it |
d5739787f713bf3b17b8362246404326dfeb01bc | e660cddaf9df6498e2456240cec97710df554515 | /spring-04-di/src/main/java/com/huang/pojo/User.java | 416c8dccdebe5b550de8e5ef2fd45d5e085977c4 | [] | no_license | SWPUCODER/springstudy | cc297f90de6bcf67491b792b99e1376785b91213 | f4ff51c0feeeae0bef3fa9bb1f84717342dc7cb9 | refs/heads/master | 2023-07-18T02:29:17.530668 | 2021-08-25T09:07:05 | 2021-08-25T09:07:05 | 399,367,150 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 529 | java | package com.huang.pojo;
public class User {
private String name;
private int age;
public User(String name, int age) {
this.name = name;
this.age = age;
}
public User() {
}
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "User{" +
"name='" + name + '\'' +
", age=" + age +
'}';
}
}
| [
"huangliangh@ENN.cn"
] | huangliangh@ENN.cn |
92d41d2fefb8348f094b2f3da07fa78d911e31a9 | df48dc6e07cdf202518b41924444635f30d60893 | /jinx-com4j/src/main/java/com/exceljava/com4j/excel/XlHebrewModes.java | d3bbf7b4457ddcf1d9134e8565e32410ab515f95 | [
"MIT"
] | permissive | ashwanikaggarwal/jinx-com4j | efc38cc2dc576eec214dc847cd97d52234ec96b3 | 41a3eaf71c073f1282c2ab57a1c91986ed92e140 | refs/heads/master | 2022-03-29T12:04:48.926303 | 2020-01-10T14:11:17 | 2020-01-10T14:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java | package com.exceljava.com4j.excel ;
import com4j.*;
/**
*/
public enum XlHebrewModes {
/**
* <p>
* The value of this constant is 0
* </p>
*/
xlHebrewFullScript, // 0
/**
* <p>
* The value of this constant is 1
* </p>
*/
xlHebrewPartialScript, // 1
/**
* <p>
* The value of this constant is 2
* </p>
*/
xlHebrewMixedScript, // 2
/**
* <p>
* The value of this constant is 3
* </p>
*/
xlHebrewMixedAuthorizedScript, // 3
}
| [
"tony@pyxll.com"
] | tony@pyxll.com |
1f9b9b089d5e9330e3bc787c5003fcd397f871a3 | d6d783d61ccbf8bebe02e1f24eac19fdf9c780b1 | /sell-product/src/test/java/com/chaox/sell/product/repository/ProductCategoryRepositoryTest.java | 090ffafe08bbeb68263cef5d8757525541b8c0cf | [] | no_license | LiQiongchao/springcloud-practice | b2fb940bfef02a23b55bd4fe020579b08331abf9 | 79cf34f98296b977bf11f7b51584eb618d78a72c | refs/heads/master | 2020-05-17T22:43:17.452042 | 2019-06-20T16:32:19 | 2019-06-20T16:32:19 | 184,010,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,176 | java | package com.chaox.sell.product.repository;
import com.chaox.sell.product.model.ProductCategory;
import org.hibernate.validator.constraints.br.TituloEleitoral;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.*;
/**
* @Author: LiQiongchao
* @Date: 2019/6/18 23:29
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class ProductCategoryRepositoryTest {
@Autowired
private ProductCategoryRepository productCategoryRepository;
@Test
public void findByCategoryType() {
List<ProductCategory> byCategoryType = productCategoryRepository.findByCategoryType(1);
Assert.assertTrue(byCategoryType.size() > 0);
}
@Test
public void findByCategoryTypeIn() {
List<ProductCategory> byCategoryType = productCategoryRepository.findByCategoryTypeIn(Arrays.asList(1,2));
Assert.assertTrue(byCategoryType.size() > 0);
}
} | [
"liqiongchao2016@gmail.com"
] | liqiongchao2016@gmail.com |
152a2a26b73215b071aeffc9d567986bab3aad6b | 2d26fde8afb5233cc26bcfec1c35611d60cef164 | /app/src/main/java/com/easyway/mismclient/ui/adapter/LsvGuiHuanAdapter.java | 9f540f926b4f2dfe866d74a52154fff01f19e307 | [] | no_license | hanks7/InventoryHou | 42e3708ec86a78296d9d9d38bb5d265ef8675578 | f62b2376be2f6d8c370f402c5ffe45b33587b09c | refs/heads/master | 2022-04-05T16:06:37.312103 | 2020-03-01T15:28:22 | 2020-03-01T15:28:22 | 240,670,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package com.easyway.mismclient.ui.adapter;
import android.content.Context;
import android.view.View;
import com.easyway.mismclient.model.DetailListBean;
import java.util.List;
/**
* ็็น้กตไธ็listview็adapter
*/
public class LsvGuiHuanAdapter extends LsvBusinessBaseAdapter {
public LsvGuiHuanAdapter(Context mContext, List list) {
super(mContext, list);
}
@Override
public void fillValue(int position, ViewHolder viewHolder, List list, boolean isClick) {
if(getCount()==1){
((DetailListBean) list.get(position)).setFactAmount(1);
}
viewHolder.mLlRealTimeAmount.setVisibility(View.INVISIBLE);
}
}
| [
"474664736@qq.com"
] | 474664736@qq.com |
da035708c037d2b0e60958678b458e8626bd411c | 92aae8f9caeeefb5780a941e915cc45b71a582c1 | /easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/cache/CacheTest.java | 7ff376f64f1f4823011eed22a06cbf75b99e5659 | [
"Apache-2.0"
] | permissive | alibaba/easyexcel | 2ba39bb5a410e218d3f85d0fd2b150df0699cc65 | 3effe20084d4b6cae929027b0483184fd6559902 | refs/heads/master | 2023-09-03T21:56:35.331134 | 2023-08-31T02:08:20 | 2023-08-31T02:08:20 | 120,395,176 | 30,634 | 7,900 | Apache-2.0 | 2023-08-31T02:08:22 | 2018-02-06T03:14:08 | Java | UTF-8 | Java | false | false | 1,783 | java | package com.alibaba.easyexcel.test.temp.cache;
import java.io.File;
import java.util.HashMap;
import java.util.UUID;
import com.alibaba.easyexcel.test.temp.poi.Poi2Test;
import com.alibaba.excel.util.FileUtils;
import com.alibaba.fastjson2.JSON;
import org.ehcache.Cache;
import org.ehcache.PersistentCacheManager;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.CacheManagerBuilder;
import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.ehcache.config.units.MemoryUnit;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
**/
public class CacheTest {
private static final Logger LOGGER = LoggerFactory.getLogger(Poi2Test.class);
@Test
public void cache() throws Exception {
File readTempFile = FileUtils.createCacheTmpFile();
File cacheFile = new File(readTempFile.getPath(), UUID.randomUUID().toString());
PersistentCacheManager persistentCacheManager =
CacheManagerBuilder.newCacheManagerBuilder().with(CacheManagerBuilder.persistence(cacheFile))
.withCache("cache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Integer.class, HashMap.class,
ResourcePoolsBuilder.newResourcePoolsBuilder().disk(10, MemoryUnit.GB)))
.build(true);
Cache<Integer, HashMap> cache = persistentCacheManager.getCache("cache", Integer.class, HashMap.class);
HashMap<Integer, String> map = new HashMap<Integer, String>();
map.put(1, "test");
cache.put(1, map);
LOGGER.info("dd1:{}", JSON.toJSONString(cache.get(1)));
cache.clear();
LOGGER.info("dd2:{}", JSON.toJSONString(cache.get(1)));
}
}
| [
"zhuangjiaju@qq.com"
] | zhuangjiaju@qq.com |
9999596e91a0c05a672ade61c933339251b1472e | d13f46e07ed47a4391cca47a27d503ee1e21acc2 | /app/src/main/java/com/hfda/playwithwords/Fragment_Introduction_Mode6.java | 84676c67578fca5d5604bd41232db450301d73d9 | [
"MIT"
] | permissive | ThanhHuong98/PlayWithWord | 013248c78d8f2271bbb449111956f1e273ec1443 | 8f1e357ac07565bcdc8ef2600458b3a8f8f3872c | refs/heads/master | 2020-03-31T03:01:10.412265 | 2019-01-18T00:12:25 | 2019-01-18T00:12:25 | 151,848,546 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,780 | java | package com.hfda.playwithwords;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
public class Fragment_Introduction_Mode6 extends Fragment implements View.OnClickListener
{
ImageButton backBtn;
Button nextBtn;
Introduction _container; //Activity bao hร m Fragment nร y
public Fragment_Introduction_Mode6() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
_container=(Introduction)getActivity(); //lแบฅy cรกi Activity ฤรณ
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
// Inflate the layout for this fragment
RelativeLayout layout = (RelativeLayout)inflater.inflate(R.layout.fragment_introduction_mode6, container, false);
nextBtn=layout.findViewById(R.id.btn_next);
backBtn=layout.findViewById(R.id.btn_back);
nextBtn.setOnClickListener(this);
backBtn.setOnClickListener(this);
return layout;
}
//khi ngฦฐแปi dรนng nhแบฅn button แป Fragment thรฌ sแบฝ gแปญi thรดng ฤiแปp lรชn cho Activity แป trรชn
@Override
public void onClick(View v)
{
String action=null;
if(v.getId() == nextBtn.getId())
{
action="NEXT";
}
if(v.getId() == backBtn.getId())
{
action="BACK";
}
_container.Action(action); //gแปญi lรชn cho Activity แป trรชn
}
} | [
"toandaominh1997@gmail.com"
] | toandaominh1997@gmail.com |
9c065bb35e53be6d3a58fc5381da5431dff00e26 | 049292189ac2340529581c216d91a95f8a303961 | /src/main/java/nyla/solutions/core/patterns/SetUpable.java | 3af396053a12739d35a085cc6b0d16ba14f20f8b | [
"Apache-2.0"
] | permissive | vaquarkhan/nyla | 934c8318a16dd7c7d846d68b370c860610c93b4c | eb6181b7a90022fc0f19938da5ff1013e8f064ba | refs/heads/master | 2020-07-20T08:13:40.920456 | 2019-05-20T14:42:18 | 2019-05-20T14:42:18 | 206,605,699 | 0 | 1 | Apache-2.0 | 2019-09-05T16:08:46 | 2019-09-05T16:08:46 | null | UTF-8 | Java | false | false | 86 | java | package nyla.solutions.core.patterns;
public interface SetUpable
{
void setUp();
}
| [
"greeng3@usxxgreeng3m4.corp.emc.com"
] | greeng3@usxxgreeng3m4.corp.emc.com |
1b998db073f7637f95df5b7977aa0860c1deafbd | 855e90639326db5a5fd4948882fa6951e11072d8 | /src/test/Temperature/FahrenheitTest.java | 2f516fbd11628ad2303fbb85b58336194efcacf2 | [] | no_license | hyanmandian/software-quality | 37c3ecedfa22da561ffed69070f1df910b8a159a | 1a15922233da24db7dcd240a837d20bb7a2c6a45 | refs/heads/master | 2020-04-17T19:46:46.505340 | 2016-10-26T00:08:38 | 2016-10-26T00:08:38 | 66,481,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package Temperature;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Before;
public class FahrenheitTest {
private Fahrenheit fahrenheit;
@Before
public void setUp() throws Exception {
this.fahrenheit = new Fahrenheit();
}
@Test
public void should150CelsiusWhen302Fahrenheit() {
double expected = 150;
double actual = this.fahrenheit.toCelsius(302);
assertEquals(0, Double.compare(expected, actual));
}
}
| [
"ALU201314277@uniritter.local"
] | ALU201314277@uniritter.local |
d3e989f3e9d54f979c94baf9428be5e19e9223bd | e6d06e86013701f7a0c6d7c26ae0903daff2f684 | /Data-structure/src/com/pushpak/Multithreading/MultithreadingProducerConsumer.java | ea500ec630c24330869b17bd7cf8ae3ee65a5e4e | [] | no_license | pushoo-sharma/Competitive-web-series | f6e3d567fd63a9667e3d6da5d0c21ceab8d991bb | 5f53f2a635b16effe138a6d57989746cbf23f8fb | refs/heads/master | 2020-04-05T13:45:56.227563 | 2018-11-14T15:16:03 | 2018-11-14T15:16:03 | 156,905,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,610 | java | package com.pushpak.Multithreading;
//class Food
//{
// int bread;
//
// public void createBread(int bread) {
// System.out.println("Producer produces bread no. "+ bread);
// this.bread = bread;
// }
//
// public void consumeBread() {
// System.out.println("Consumer consumes bread no. "+ this.bread);
// }
//}
class Food
{
int bread;
boolean valueSet = false ;
public synchronized void createBread(int bread) {
while(valueSet) {
try { wait(); } catch(Exception e) {}
}
System.out.println("Producer produces bread no. "+ bread);
this.bread = bread;
valueSet = true ;
notify();
}
public synchronized void consumeBread() {
while(valueSet) {
System.out.println("Consumer consumes bread no. "+ this.bread);
valueSet = false ;
}
notify();
}
}
class Producer implements Runnable
{
Food br;
public Producer(Food br) {
this.br = br;
Thread t1 = new Thread(this,"Producer");
t1.start();
}
@Override
public void run() {
int i = 0;
while(true) {
br.createBread(i++);
try { Thread.sleep(1000); } catch( Exception e ) { System.out.println(e); }
}
}
}
class Consumer implements Runnable
{
Food br;
public Consumer(Food br) {
this.br = br;
Thread t2 = new Thread(this,"Consumers");
t2.start();
}
@Override
public void run() {
while(true) {
br.consumeBread();
try { Thread.sleep(5000); } catch( Exception e ) { System.out.println(e); }
}
}
}
public class MultithreadingProducerConsumer {
public static void main(String[] args) {
Food bread = new Food();
new Producer(bread);
new Consumer(bread);
}
}
| [
"sharmatryhard@gmail.com"
] | sharmatryhard@gmail.com |
97ecd3f787df18857569ad6db69b830dec7652e6 | 7d36bb0422fbddd39897979b22215406cd9f7586 | /StatKatzXFL/test/statkatzxfl/StatKatzXFLTest.java | 51a6b4a950d50bf842be5c00256522d4edd0b36c | [] | no_license | kirbman/StatKatzXFL | e2dbd8b49d1db34df7909c52148781224a8abbfd | e3be35430be181ea9cfdd1d2e12330795816cfaf | refs/heads/master | 2021-01-20T07:56:50.017180 | 2017-05-02T21:31:42 | 2017-05-02T21:31:42 | 90,069,737 | 0 | 5 | null | 2017-05-02T21:31:42 | 2017-05-02T19:23:20 | Java | UTF-8 | Java | false | false | 2,367 | 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 statkatzxfl;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Cody
*/
public class StatKatzXFLTest {
public StatKatzXFLTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of QBR method, of class Quarterback.
*/
@Test
public void testQBR() {
Quarterback qb = new Quarterback(400, 36, 4, 1, .78);
assertEquals(358.8, qb.QBcalc(), .01);
}
/**
* Test of TotalOffense method, of class Offense.
*/
@Test
public void testTotalOffense() {
Offense team1 = new Offense(450,120,28,2,56);
double totalOffense;
totalOffense = team1.totalOffense();
double expected = 317;
assertEquals(expected, totalOffense, .001);
}
/**
* Test of OffensiveEfficiency method, of class Offense.
*/
@Test
public void testOffensiveEfficiency() {
Offense theO = new Offense(450,120,30,2,50);
double expected = 3;
double deffEff = theO.offensiveEfficiency();
assertEquals(expected, deffEff);
}
/**
* Test of TotalDefense method, of class Defense.
*/
@Test
public void testTotalDefense() {
Defense team1 = new Defense(250,67,10,2,4,57);
double totalDefense;
totalDefense = team1.totalDefense();
double expected = 317;
assertEquals(expected, totalDefense, .001);
}
/**
* Test of DefensiveEfficiency method, of class Defense.
*/
@Test
public void testDefensiveEfficiency() {
Defense theD = new Defense(2,2,2,2,2,2);
double expected = 3;
double deffEff = theD.defensiveEfficiency();
assertEquals(expected, deffEff);
}
/**
* Test of display method, of class Team.
*/
@Test
public void testDisplay() {
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c4067776f7ba5d9c0efec1e8dd6cdaff54537090 | b7cf7287d4961daa8c2b7af18adaad498681f134 | /ThreadTest/src/main/java/test2017/TestSync.java | acac070247f068b9b6fc940b75c4589e5351f081 | [] | no_license | 2391134843/Java_Process-management-system | fb73d174ff104854fe9858b298dd9709d16fc4cb | 71ad8e1e34e69de9fdebf0c867c9f9c3bb224dc8 | refs/heads/master | 2020-03-21T04:21:51.719594 | 2018-06-21T01:36:09 | 2018-06-21T01:36:09 | 138,104,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package test2017;
public class TestSync implements Runnable{
Timer2 timer = new Timer2();
public static void main(String []args){
TestSync test = new TestSync();
Thread t1= new Thread(test);
Thread t2 = new Thread(test);
t1.setName("t1");
t2.setName("t2");
t1.start();
t2.start();
}
public void run() {
timer.add(Thread.currentThread().getName());
}
}
class Timer2 {
private static int num = 0;
public synchronized void add(String name){
try{
num++;
Thread.sleep(1);
System.out.println(name+" ,ไฝ ๆฏ็ฌฌ"+num+" ไธชไฝฟ็จtimer็็บฟ็จ");
}catch(Exception ex){
ex.printStackTrace();
}
}
} | [
"2391134843@qq.com"
] | 2391134843@qq.com |
3c1992a0ab3a1b1f29c753f31258a614c3259670 | 9856541e29e2597f2d0a7ef4729208190d9bbebe | /spring-context/src/main/java/org/springframework/scripting/jruby/package-info.java | 3862e9bd0bfa3fa388a9e0e4edd52fdc53d12729 | [
"Apache-2.0"
] | permissive | lakeslove/springSourceCodeTest | 74bffc0756fa5ea844278827d86a085b9fe4c14e | 25caac203de57c4b77268be60df2dcb2431a03e1 | refs/heads/master | 2020-12-02T18:10:14.048955 | 2017-07-07T00:41:55 | 2017-07-07T00:41:55 | 96,483,747 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | /**
* Package providing integration of
* <a href="http://jruby.sourceforge.net">JRuby</a>
* into Spring's scripting infrastructure.
*/
package org.springframework.scripting.jruby;
| [
"lakeslove@126.com"
] | lakeslove@126.com |
b7ddbabbdc7f8acc0d37389f9a0972871c60abf4 | ac435fda878d5fcce0ccccca88834924f60b82b1 | /src/ForwardOrUp.java | 72c3f37f9ff1501dc377496cfbdfc91eeb34f655 | [] | no_license | jordysolis96/Cave-text-adventure-game | 1dd21a56dd4f34ad1e806d4edffd0d1c138dbba5 | bc47cc36b1e89a0b956fca54f0dd0711413feb69 | refs/heads/main | 2023-06-03T20:41:31.140976 | 2021-06-22T16:58:39 | 2021-06-22T16:58:39 | 330,722,138 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,395 | java | import java.util.Scanner;
public class ForwardOrUp {
public static void fowardOrUp(){
Scanner choice = new Scanner(System.in);
System.out.println("Will you walk forward or go up?");
System.out.println(1 + ": climb the rope.");
System.out.println(2 + ": walk forward.");
int Choice = choice.nextInt();
if(Choice == 1){
System.out.println("Goblins cut your rope and you fall to your death!");
System.out.println("Game Over!");
respawn();
}else if(Choice == 2){
System.out.println("Yeah that rope looked suspicious anyways...");
}else{
System.out.println("invalid input");
fowardOrUp();
}
}
public static void respawn() {
Scanner choice = new Scanner(System.in);
System.out.println("would you like to retry?");
System.out.println(1 + ": last check point");
System.out.println(2 + ": restart game");
System.out.println(3 + ": exit");
int respawn = choice.nextInt();
if (respawn == 1) {
fowardOrUp();
} else if (respawn == 2) {
Cave.game();
} else if (respawn == 3) {
System.out.println("See Ya!");
System.exit(0);
} else {
System.out.println("invalid input");
respawn();
}
}
}
| [
"jordy.muniz96@gmail.com"
] | jordy.muniz96@gmail.com |
9691e5dcddbc7ddb61ccae104d5b3de77bc2cc58 | 8d7220c19779c70d7684e0f073f663de1d9808ae | /Server_side/farmease/src/main/java/project/farmease/service/HomeAndSearchService.java | 77be716b2a89f35949dde3be829c754b39cd58dd | [] | no_license | hacker-vishal/farmeasy | f90741ef0562152c7745cce221ffb3fd522c5853 | ed2f189265061438ca3400abe6e1f3f6f0f4c589 | refs/heads/main | 2023-04-09T02:04:12.067692 | 2021-02-08T08:44:16 | 2021-02-08T08:44:16 | 317,878,031 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,253 | java | package project.farmease.service;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import project.farmease.dao.HostuserRepo;
import project.farmease.dao.UserRepo;
import project.farmease.dto.Response;
import project.farmease.farmeasyexception.FarmeasyException;
import project.farmease.pojo.Hostuser;
import project.farmease.pojo.HostuserId;
@Transactional
@Service
public class HomeAndSearchService {
Logger logger = LogManager.getLogger(HomeAndSearchService.class);
@Autowired
private UserRepo userRepo;
@Autowired
private HostuserRepo hostuserRepo;
public List<Hostuser> searchforservice(Hostuser hostuser) {
List<Hostuser> l = new ArrayList<Hostuser>();
// Hostuser h1 = new Hostuser("vish@email","tractor", "kubota", "ploughing", "pune", 222, null);
// Hostuser h2 = new Hostuser("vish@email","harvester", "kubota", "harvesting", "blr", 222, null);
// Hostuser h3 = new Hostuser("vish@email","tractor", "kubota", "ploughing", "blr", 222, null);
//assume this result came from db
// l.add(h1);
// l.add(h2);
// l.add(h3);
try {
l = hostuserRepo.findmatchingservice(hostuser.getEquipmenttype(),hostuser.getLocation());
//logger.debug(hostdto.getEquipmenttype(),hostdto.getLocation());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new FarmeasyException("Error while searching services!", e);
}
List<Hostuser> delete = new ArrayList<Hostuser>();
for(Hostuser h:l)
{
//log.debug(equipment+" "+location);
if(!((h.getEquipmenttype().equalsIgnoreCase(hostuser.getEquipmenttype())) && (h.getLocation().equalsIgnoreCase(hostuser.getLocation()))))
{
//log.debug("condition satisfied got in");
delete.add(h);
}
}
l.removeAll(delete);
//log.debug("list members got "+l.size());
return l;
}
public Response registerhost(Hostuser hostuser) {
Response resp = new Response(0,"User Already Exists!");
//db data assume
// Hostuser host = new Hostuser("a@b","tractor", "kubota", "ploughing", "pune", 222, null);
Boolean isUserPresent = false;
Boolean isHostUserPresent = false;
try {
logger.debug(hostuser.getHostemail());
isUserPresent=userRepo.existsById(hostuser.getHostemail());
} catch (Exception e) {
// TODO Auto-generated catch block
logger.error("Invalid Operation!");
throw new FarmeasyException("Error in registration of host!", e);
}
//if(!(host.getHostemail().equals(hostuser.getHostemail())))
if(isUserPresent)
{
isHostUserPresent=hostuserRepo.existsByHostemail(hostuser.getHostemail());
if(isHostUserPresent)
{
HostuserId id = new HostuserId(hostuser.getHostemail(), hostuser.getEquipmenttype(), hostuser.getManufacturer(), hostuser.getServicetype(), hostuser.getLocation());
Boolean isHostpresent=false;
try {
isHostpresent = hostuserRepo.existsById(id);
} catch (Exception e) {
logger.error(e);
throw new FarmeasyException("Error in registration of host!", e);
}
if (!isHostpresent) {
try {
hostuserRepo.save(hostuser);
} catch (Exception e) {
logger.error(e);
throw new FarmeasyException("Error in registration of host!", e);
}
resp.setStatus(1);
resp.setMessage("Inserted successfully!");
}
}
else
{
try {
hostuserRepo.save(hostuser);
} catch (Exception e) {
logger.error(e);
throw new FarmeasyException("Error in registration of host!", e);
}
resp.setStatus(1);
resp.setMessage("Inserted successfully!");
}
}
else
{
resp.setMessage("You need to signup first!!!");
}
return resp;
}
public List<Hostuser> getlistofservice(String hostemail) {
List<Hostuser> l = new ArrayList<Hostuser>();
try {
if(hostemail!=null)
l = hostuserRepo.findByHostemail(hostemail);
} catch (Exception e) {
logger.error(e);
throw new FarmeasyException("Error in fetching list of host!", e);
}
return l;
}
}
| [
"vishalgupta.dac@gmail.com"
] | vishalgupta.dac@gmail.com |
e2a882690ca887b14bbbc4ddf5529e9e44d2da53 | c338a992ac859d7023e8b0fa462af13e94da66db | /nicomsoft_use9/src/OCR/NewOCRTest.java | b02412b834f27c4a8a0521c8073810621d61d420 | [] | no_license | ClareQi/MyRepository | ce7ea461e466dcd8906443bb2bdfdc56fd236587 | f8483d5e00f771c9c548b9b0511d76c38579681b | refs/heads/master | 2021-01-16T18:38:05.408148 | 2018-05-21T10:37:38 | 2018-05-21T10:37:38 | 100,104,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,972 | java | //package OCR;
//
//import java.io.File;
//import java.io.IOException;
//
//public class NewOCRTest {
//
// private static Integer ocrMode;
//
// private static String tessPath="D:\\tools\\Tesseract-OCR";
//
// private static String txtPath="F:\\ProcessedImage\\OCRResult.txt";
//
// public static void main(String[] args) throws Exception {
// //้็ท๎้ฅๅงๅข้จๅฌๆๆต ่ทบใ็บ๎็ท
// String filePath="F:/0901OcrResult";
// //็ๆจปๆๆฃฐๅซ๎ฉ้ๅๆ้จๅซๆต้ๅจๆๆต ่ทบใ็บ๎็ท
// String processedPath="F:/ProcessedImage";
// //้ฅๅงๅขๆฃฐๅซ๎ฉ้ๅๆฎๅฆฏโณ็ดก
// ocrMode=6;
// ImageRecognition(new File(filePath),new File(processedPath));
// }
//
// public static void ImageRecognition(File filePath,File processedPath) throws Exception{
// File[] filelist = filePath.listFiles();
// for (int i = 0; i < filelist.length; i++) {
// if(filelist[i].isDirectory()){
// ImageRecognition(filelist[i],processedPath);
// } else {
// //็ต็ฐๆต้ๅช็น็ๅฒ๎ฉๆพถๅญๆ
// File processedFile=null;
// try {
// for (int j = 1; j < ocrMode; j++) {
// long start=System.currentTimeMillis();
// processedFile=Preprocessing(j,filelist[i],processedPath);
// System.out.println("็ผๅฟ็นๆฃฐๅซ๎ฉ้ๅๆ้จๅซๆต้ๅท็ดฐ"+processedFile.getAbsolutePath());
// String recognizeStr=new OCRHelper().recognizeText(processedFile, tessPath);
// recognizeStr=FilterTest.StringFilter(recognizeStr);
// recognizeStr=FilterTest.removeMessyCode(recognizeStr);
// System.err.println("็ๅๅ้็ๆฝต้จๅญๆฎ้ๅง็ง้ๅญ๎้๏ฟฝ"+recognizeStr);
// long end=System.currentTimeMillis();
// long period=end-start;
// WriteStringToTxt.write(j,txtPath,recognizeStr,processedFile.getName(),period);
// if(StringUtil.isNotBlank(recognizeStr)){
// double chinesePercentage = OCRUtils.countChinesePercentage(recognizeStr);
// Integer chineseNum = OCRUtils.countChineseNum(recognizeStr);
// //ๆถ๎
ๆ้็ณ็ฎ็ๅฐ็น25%้ดๆ ฌ๏ฟฝๅญๅฏ้๏ฟฝ10ๆถ๎่
้ๅท็ด้ดๆ ฌ๏ฟฝๅญๅฏ้๎ก็ฌ
้ๆคพ่
้ๅฉๆฎ้จๅซๆต็ปๅฉๆซ้็ๆ้จๅฌๆๆต ่ทบใๆถๅฌฎๆฝฐ
// if( chinesePercentage > 0.25|| chineseNum > 10|| recognizeStr.indexOf("qq") > -1
// || recognizeStr.indexOf("wechat:") > -1
// || recognizeStr.indexOf("1688") > -1
// || recognizeStr.indexOf("aliexpress") > -1
// || recognizeStr.indexOf("FedEx.") > -1
// || recognizeStr.indexOf("EMS.") > -1
// || recognizeStr.indexOf("DHL.") > -1
// || recognizeStr.indexOf("UPS") > -1
// || recognizeStr.indexOf("ali") > -1) {
// MoveFile.moveFileToDir(processedFile.getAbsolutePath(), processedFile.getParent()+File.separator+"FilterImage"+File.separator+filelist[i].getName(),"","");
// }
// }
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
//
// /**
// * ้ฅๅงๅข้จๅฏ๎ฉๆพถๅญๆ้็ฐ็ดก
// * @param i
// * @throws Exception
// */
// private static File Preprocessing(int i,File unProcessed,File processed) throws Exception {
// File processedImage=null;
// File processedImage_first=null;
// switch (i)
// {
// //ๆต ๅฌ็ฒ้๎ไผๆด๏น๎ฉ้๏ฟฝ
// case 1:
// processedImage=GrayImage.grayPic(unProcessed.getAbsolutePath(),processed.getAbsolutePath()+File.separator+"onlyGrey"+File.separator+unProcessed.getName());
// break;
// //ๆต ๅฌ็ฒ้๎็ฐฉ้็
ๅฏฒๆพถๅญๆ
// case 2:
// processedImage=BinarizationImage.binaryPictures(unProcessed.getAbsolutePath(),processed.getAbsolutePath()+File.separator+"onlyBinary"+File.separator+unProcessed.getName());
// break;
// //้็ทๆต
// case 3:
// processedImage=MoveFile.copyFile3(unProcessed.getAbsolutePath(),processed.getAbsolutePath()+File.separator+"Orginal"+File.separator+unProcessed.getName());
// break;
// //้ๅ ขไผๆด๏นๆๆตๅฑฝ๏ฟฝ็
ๅฏฒ
// case 4:
// processedImage_first=GrayImage.grayPic(unProcessed.getAbsolutePath(),processed.getAbsolutePath()+File.separator+"GrayFirstBinarySecond"+File.separator+unProcessed.getName());
// processedImage=BinarizationImage.binaryPictures(processedImage_first.getAbsolutePath(),processedImage_first.getParent()+File.separator+"BinarySecond"+File.separator+unProcessed.getName());
// break;
// //้ๅ ็ฐฉ้็
ๅฏฒ้ๅบฃไผๆด๏ฟฝ
// case 5:
// processedImage_first=BinarizationImage.binaryPictures(unProcessed.getAbsolutePath(),processed.getAbsolutePath()+File.separator+"BinaryFirstGreySecond"+File.separator+unProcessed.getName());
// processedImage=BinarizationImage.binaryPictures(processedImage_first.getAbsolutePath(),processedImage_first.getParent()+File.separator+"GreySecond"+File.separator+unProcessed.getName());
// ;break;
// }
// return processedImage;
// }
//
//}
| [
"Administrator@MS-20170901VXSB"
] | Administrator@MS-20170901VXSB |
87621944bfc32c94c132cff2536bae1e9b342cc9 | a4f65f4ff4f0bc750492a3e801d0abecbc54de8a | /app/src/main/java/com/c17206413/payup/ui/adapter/PaymentAdapter.java | 070494894a9c75233537789808e15b7cecbab63b | [] | no_license | EoinGohery/PayUp | b5f9784b792fadf6ed2dcc9434e5d4f97c7cb2e0 | 0d76a5137953ce13456ba3395a0262f6a8962e64 | refs/heads/master | 2023-07-11T21:36:53.570540 | 2021-08-11T14:06:09 | 2021-08-11T14:06:09 | 312,862,443 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,403 | java | package com.c17206413.payup.ui.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.c17206413.payup.R;
import com.c17206413.payup.ui.model.Payment;
import java.text.NumberFormat;
import java.util.List;
//recycler adapter for displaying payment informatiion
public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHolder> {
private final Context mContext;
//list of payment objects
private final List<Payment> mPayments;
//click listener for recycler adapter
private final PaymentListener paymentListener;
//adapter constructor
public PaymentAdapter(Context mContext, List<Payment> mPayments, PaymentListener paymentListener) {
this.mPayments = mPayments;
this.mContext = mContext;
this.paymentListener = paymentListener;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.payment_item, parent, false);
return new ViewHolder(view, paymentListener);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
//set specific payment information to each adapter object on view holder
Payment paymentDetails = mPayments.get(position);
holder.price.setText(NumberFormat.getCurrencyInstance().format(paymentDetails.getAmount()));
holder.userName.setText(paymentDetails.getUsername());
holder.serviceName.setText(paymentDetails.getServiceName());
//if payment is due set text to correct values and set money in/out to correct logo
if (paymentDetails.getType().equals("due")) {
holder.payButton.setText(R.string.app_name);
holder.indicator.setVisibility(View.INVISIBLE);
holder.indicator.setImageResource(R.drawable.ic_arrow_down);
//if payment is incoming set text to correct values and set money in/out to correct logo
} else if (paymentDetails.getType().equals("incoming")) {
holder.payButton.setText(R.string.received);
holder.indicator.setVisibility(View.INVISIBLE);
holder.indicator.setImageResource(R.drawable.ic_arrow_up);
}
//if payment is not active hide the pay button and display indicator
if (!paymentDetails.getActive()) {
holder.indicator.setVisibility(View.VISIBLE);
holder.payButton.setVisibility(View.GONE);
}
}
@Override
//get the total number of items in list
public int getItemCount() {
return mPayments.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
public TextView serviceName;
public TextView price;
public TextView userName;
public PaymentListener PaymentListener;
public Button payButton;
public ImageView indicator;
public ViewHolder(View itemView, PaymentListener paymentListener) {
super(itemView);
//payment listener
this.PaymentListener = paymentListener;
//UI elements
serviceName = itemView.findViewById(R.id.service_name);
price = itemView.findViewById(R.id.price);
userName = itemView.findViewById(R.id.user_id);
indicator = itemView.findViewById(R.id.in_out_indicator);
//On click listener for entire object
itemView.setOnClickListener(this);
//On click listener for pay button inside object
payButton = itemView.findViewById(R.id.pay_button);
payButton.setOnClickListener(v -> PaymentListener.payButtonOnClick(v, getAdapterPosition()));
}
@Override
public void onClick(View v) {
PaymentListener.onPaymentDetailsClick(getAdapterPosition());
}
}
//payment listener interface (methods to be overwritten in fragment classes)
public interface PaymentListener {
void onPaymentDetailsClick(int position);
void payButtonOnClick(View v, int adapterPosition);
}
}
| [
"37302139+EoinGohery@users.noreply.github.com"
] | 37302139+EoinGohery@users.noreply.github.com |
6f6d853ceb1ecc658888fca79abb632c1a6c40d3 | 05e80421b32486437891845b23585c3edf0ccfe8 | /sleuth-service/src/main/java/com/ygego/product/SleuthServer.java | 64e1c46dcd23e1619a8af3645a5ac3b89e027dd3 | [] | no_license | zhanghuanhuan123/springcloudDemo | 3d98532938cd302950be08f4734c8ad9a4d17d96 | b07b84ee37364b1735046f50093a92e3e5cbb6a1 | refs/heads/master | 2020-04-07T22:48:33.104578 | 2018-12-27T03:15:45 | 2018-12-27T03:15:45 | 158,785,979 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 469 | java | package com.ygego.product;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import zipkin.server.EnableZipkinServer;
@EnableDiscoveryClient
@SpringBootApplication
@EnableZipkinServer
public class SleuthServer {
public static void main(String[] args) {
SpringApplication.run(SleuthServer.class, args);
}
} | [
"zhanghuan@enn.cn"
] | zhanghuan@enn.cn |
57e16a286c0d1bac03ea8646a7f2c1ab1f8e4a31 | 5dad3924530039711715c4ed1860347f410d0523 | /opfmaps/src/main/java/org/onepf/opfmaps/model/OPFVisibleRegion.java | 3bf4e553487d8de7c32d698dc6e3c5f53436aa4a | [
"Apache-2.0"
] | permissive | siekierskip/OPFMaps | a333fe123be87008e909ca973b2f924b8bea6dc7 | 612b61580d61c7f2dadc789c1d22139e4aa9b8c5 | refs/heads/master | 2021-01-22T19:41:29.572425 | 2017-03-21T09:58:27 | 2017-03-21T09:58:27 | 85,189,480 | 0 | 0 | null | 2017-03-16T11:42:31 | 2017-03-16T11:42:31 | null | UTF-8 | Java | false | false | 5,104 | java | /*
* Copyright 2012-2015 One Platform Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onepf.opfmaps.model;
import android.os.Parcel;
import android.support.annotation.NonNull;
import org.onepf.opfmaps.OPFMapHelper;
import org.onepf.opfmaps.delegate.model.VisibleRegionDelegate;
/**
* Contains the four points defining the four-sided polygon that is visible in a map's camera.
* This polygon can be a trapezoid instead of a rectangle, because a camera can have tilt.
* If the camera is directly over the center of the camera, the shape is rectangular, but if the camera is tilted,
* the shape will appear to be a trapezoid whose smallest side is closest to the point of view.
*
* @author Roman Savin
* @since 06.08.2015
*/
public class OPFVisibleRegion implements VisibleRegionDelegate {
public static final Creator<OPFVisibleRegion> CREATOR = new Creator<OPFVisibleRegion>() {
@Override
public OPFVisibleRegion createFromParcel(final Parcel source) {
return new OPFVisibleRegion(source);
}
@Override
public OPFVisibleRegion[] newArray(final int size) {
return new OPFVisibleRegion[size];
}
};
@NonNull
private final VisibleRegionDelegate delegate;
public OPFVisibleRegion(@NonNull final OPFLatLng nearLeft,
@NonNull final OPFLatLng nearRight,
@NonNull final OPFLatLng farLeft,
@NonNull final OPFLatLng farRight,
@NonNull final OPFLatLngBounds latLngBounds) {
this.delegate = OPFMapHelper.getInstance().getDelegatesFactory()
.createVisibleRegionDelegate(nearLeft, nearRight, farLeft, farRight, latLngBounds);
}
public OPFVisibleRegion(@NonNull final VisibleRegionDelegate delegate) {
this.delegate = delegate;
}
@SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes")
private OPFVisibleRegion(@NonNull final Parcel parcel) {
try {
this.delegate = parcel.readParcelable(Class.forName(parcel.readString()).getClassLoader());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
/**
* Returns the {@link OPFLatLng} object that defines the far left corner of the camera.
*
* @return The {@link OPFLatLng} object that defines the far left corner of the camera.
*/
@Override
@NonNull
public OPFLatLng getFarLeft() {
return delegate.getFarLeft();
}
/**
* Returns the {@link OPFLatLng} object that defines the far right corner of the camera.
*
* @return The {@link OPFLatLng} object that defines the far right corner of the camera.
*/
@Override
@NonNull
public OPFLatLng getFarRight() {
return delegate.getFarRight();
}
/**
* Returns the smallest bounding box that includes the visible region defined in this class.
*
* @return The smallest bounding box that includes the visible region defined in this class.
*/
@Override
@NonNull
public OPFLatLngBounds getLatLngBounds() {
return delegate.getLatLngBounds();
}
/**
* Returns the {@link OPFLatLng} object that defines the bottom left corner of the camera.
*
* @return The {@link OPFLatLng} object that defines the bottom left corner of the camera.
*/
@Override
@NonNull
public OPFLatLng getNearLeft() {
return delegate.getNearLeft();
}
/**
* Returns the {@link OPFLatLng} object that defines the bottom right corner of the camera.
*
* @return The {@link OPFLatLng} object that defines the bottom right corner of the camera.
*/
@Override
@NonNull
public OPFLatLng getNearRight() {
return delegate.getNearRight();
}
@Override
public int describeContents() {
return delegate.describeContents();
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
dest.writeString(delegate.getClass().getCanonicalName());
dest.writeParcelable(delegate, flags);
}
@Override
public boolean equals(final Object other) {
return other != null
&& (other == this || other instanceof OPFVisibleRegion
&& delegate.equals(((OPFVisibleRegion) other).delegate));
}
@Override
public int hashCode() {
return delegate.hashCode();
}
@Override
public String toString() {
return delegate.toString();
}
}
| [
"savin9201@gmail.com"
] | savin9201@gmail.com |
5569e22dbd724db21c0543be11283ffb6197064d | 661250ea21bed5901f6b5ee5b1bc8aa516aee1a4 | /src/packet/DynamicID.java | 7a623c2208673f6cd7b1ed7507300cd862082b4f | [
"MIT"
] | permissive | falcon-it/com.falcon-it.sjcc | 30c5b0e8b786a25a07ab6e7dacfde76d8adda2f2 | 940f659aaa1f2f7747d9223abae0adbd2e05c3d3 | refs/heads/master | 2021-09-09T13:34:21.600611 | 2018-03-16T14:59:19 | 2018-03-16T14:59:19 | 116,553,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package packet;
/**
* ะธัะตััะตะนั ะดะปั ัะธะฟะพะฒ ั ะดะธะฝะฐะผะธัะตัะบะพะน ััััะบัััะพะน
* ัะตะฐะปะธะทะฐัะธั Cloneable ะฝัะถะฝะฐ ะดะปั ะบะพะฟะธัะพะฒะฐะฝะธั ะดะธะฝะฐะผะธัะตัะบะพะน
* ััััะบัััั ะพะฑัะตะบัะฐ
* @author Ilya Sokolov
*/
public interface DynamicID extends Cloneable {
/**
* @return ัะฐััะธัะฐะฝะฝัะน ะดะธะฝะฐะผะธัะตัะบะธะน id ัะธะฟะฐ
*/
int calculateDynamicID();
}
| [
"ilya.sokolov@live.ru"
] | ilya.sokolov@live.ru |
aec9d963f60a176027a64f0abfd5cd7a695775c2 | 6584824950425873527ce0189d17de0fbd6861e3 | /core/src/main/java/org/apache/carbondata/core/scan/wrappers/IntArrayWrapper.java | c1a75d5bda04756b9f23f368c7c3cfa632815d0b | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | ravipesala/incubator-carbondata | 203896f89c352b90374fea34512f62a22a03577d | 3d61af76efebeab1ed1adff7659a422b25f623ff | refs/heads/master | 2021-08-01T13:25:34.575132 | 2019-04-08T06:10:52 | 2019-04-08T06:19:48 | 62,142,167 | 1 | 1 | Apache-2.0 | 2018-03-07T18:57:13 | 2016-06-28T13:16:56 | Scala | UTF-8 | Java | false | false | 1,387 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.carbondata.core.scan.wrappers;
import java.util.Arrays;
/**
* Wrapper class for int[] data
*/
public class IntArrayWrapper {
private final int[] data;
public IntArrayWrapper(int[] data) {
this.data = data;
}
@Override public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
IntArrayWrapper that = (IntArrayWrapper) o;
return Arrays.equals(data, that.data);
}
@Override public int hashCode() {
return Arrays.hashCode(data);
}
}
| [
"ravi.pesala@gmail.com"
] | ravi.pesala@gmail.com |
d5ecd34b2bcc18e8173e42ae2a82a2ce30563ae1 | 483a348c51d6689509fe4f3cc210380b2fbd4d86 | /Desktop/CURSOS/CURSOANDROID/ANDROID/MODULO 1/04 CARA OU COROA/CaraCoroa/app/src/main/java/com/example/joo/caracoroa/Main2Activity.java | 6b5e6638723e44787a74b45963f532a09437404a | [] | no_license | jotapesabbado/Material-de-Cursos | be3a080542f003537f6c11327d5ddd8cc86ff472 | 4418f5ecc5776fadf910ff6dc07c75aea8cda6f2 | refs/heads/master | 2020-04-17T05:18:02.702162 | 2019-01-17T18:27:08 | 2019-01-17T18:27:08 | 166,272,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,226 | java | package com.example.joo.caracoroa;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
public class Main2Activity extends AppCompatActivity {
private ImageView moeda;
private ImageView botaovoltar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
moeda = (ImageView)findViewById(R.id.imageView3);
botaovoltar = (ImageView)findViewById(R.id.botaovoltar);
Bundle extra = getIntent().getExtras();
if(extra !=null){
String op = extra.getString("opcao");
if(op.equals("cara")){
moeda.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.moeda_cara));
}else{
moeda.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.moeda_coroa));
}
}
botaovoltar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
| [
"jotapesabbado@gmail.com"
] | jotapesabbado@gmail.com |
00a2d6516539d245510018f55bd8368ae262e908 | 0afb02f811bd62f4552bfe0ca953c3261401a753 | /src/com.wuss.leetCode/Main5.java | bdc5d36fcb7c39a3ecd27220399f39f31e915fc3 | [] | no_license | wuss12/leetcode | d53874310a3e246bedae86919ac7f5be30937242 | 08ea82f20ff20683599ab024cc8ea836932e0c8e | refs/heads/master | 2021-06-20T00:57:36.987641 | 2021-05-26T10:16:16 | 2021-05-26T10:16:16 | 215,947,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,466 | java | package com.wuss.leetCode;
/**
* ็ปๅฎไธไธชๅญ็ฌฆไธฒ s๏ผๆพๅฐ s ไธญๆ้ฟ็ๅๆๅญไธฒใไฝ ๅฏไปฅๅ่ฎพย s ็ๆๅคง้ฟๅบฆไธบ 1000ใ
*
* ็คบไพ 1๏ผ
*
* ่พๅ
ฅ: "babad"
* ่พๅบ: "bab"
* ๆณจๆ: "aba" ไนๆฏไธไธชๆๆ็ญๆกใ
*
* ๆฅๆบ๏ผๅๆฃ๏ผLeetCode๏ผ
* ้พๆฅ๏ผhttps://leetcode-cn.com/problems/longest-palindromic-substring
* ่ไฝๆๅฝ้ขๆฃ็ฝ็ปๆๆใๅไธ่ฝฌ่ฝฝ่ฏท่็ณปๅฎๆนๆๆ๏ผ้ๅไธ่ฝฌ่ฝฝ่ฏทๆณจๆๅบๅคใ
*/
public class Main5 {
public String longestPalindrome(String s) {
int len = s.length();
if(len <= 1){
return s;
}
boolean[][] booleans = new boolean[len][len];
int start = 0,longest = 1;
for (int i=0;i<len;i++){
booleans[i][i] = true;
if(i < len -1){
if(s.charAt(i) == s.charAt(i+1)){
booleans[i][i+1] = true;
start = i;
longest = 2;
}
}
}
int end = 0;
for (int l = 3;l<=len;l++){
for (int j=0;j<len - l +1;j++){
end = j+l -1;
if(s.charAt(j) == s.charAt(end) && booleans[j+1][end-1]){
booleans[j][end] = true;
start = j;
longest = l;
}
}
}
return s.substring(start,start+longest);
}
public static void main(String[] args) {
Main5 main5 = new Main5();
String str ="kztakrekvefgchersuoiuatzlmwynzjhdqqftjcqmntoyckqfawikkdrnfgbwtdpbkymvwoumurjdzygyzsbmwzpcxcdmmpwzmeibligwiiqbecxwyxigikoewwrczkanwwqukszsbjukzumzladrvjefpegyicsgctdvldetuegxwihdtitqrdmygdrsweahfrepdcudvyvrggbkthztxwicyzazjyeztytwiyybqdsczozvtegodacdokczfmwqfmyuixbeeqluqcqwxpyrkpfcdosttzooykpvdykfxulttvvwnzftndvhsvpgrgdzsvfxdtzztdiswgwxzvbpsjlizlfrlgvlnwbjwbujafjaedivvgnbgwcdbzbdbprqrflfhahsvlcekeyqueyxjfetkxpapbeejoxwxlgepmxzowldsmqllpzeymakcshfzkvyykwljeltutdmrhxcbzizihzinywggzjctzasvefcxmhnusdvlderconvaisaetcdldeveeemhugipfzbhrwidcjpfrumshbdofchpgcsbkvaexfmenpsuodatxjavoszcitjewflejjmsuvyuyrkumednsfkbgvbqxfphfqeqozcnabmtedffvzwbgbzbfydiyaevoqtfmzxaujdydtjftapkpdhnbmrylcibzuqqynvnsihmyxdcrfftkuoymzoxpnashaderlosnkxbhamkkxfhwjsyehkmblhppbyspmcwuoguptliashefdklokjpggfiixozsrlwmeksmzdcvipgkwxwynzsvxnqtchgwwadqybkguscfyrbyxudzrxacoplmcqcsmkraimfwbauvytkxdnglwfuvehpxd";
System.out.println(main5.longestPalindrome(str));
}
}
| [
"XdasA2J9zK_sRJfA8HrW"
] | XdasA2J9zK_sRJfA8HrW |
7f1f03e1a9d33a549daeb71887bf2cd4abcd97ee | 70d03f14dbbded7f40d5c6aef6a3d8247c6de635 | /app/src/test/java/com/universl/hp/hithatawadinawadan/ExampleUnitTest.java | abc17452d30ec808c11721ec2ba0dba02ec0002b | [
"MIT"
] | permissive | rayanprasanna/talks-app | 09a303275ce4710e5392711715645f99bac878c6 | 9c7682037759d647bc2a2abf02437f58a1d0d802 | refs/heads/master | 2020-12-27T13:28:34.626035 | 2020-02-03T08:36:19 | 2020-02-03T08:36:19 | 237,918,659 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.universl.hp.hithatawadinawadan;
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);
}
} | [
"rayanprasanna224@gmail.com"
] | rayanprasanna224@gmail.com |
8bb30825ece555d39c87113c29e22741253d2130 | a417315e509010cbb3795eeab2316823ec3432f0 | /r01fBase/r01fBaseClasses/src/main/java/r01f/types/contact/PersonWithContactInfoBuilder.java | 18424e33a4484a148b5ffd48d088bfff6eae3949 | [] | no_license | opendata-euskadi/fabric-r01f | 060172ffad586cb97d42c7f057ce72b3f85fb6d3 | 09dd9924846f6710edaee0200417cd9879fddaca | refs/heads/master | 2022-06-12T05:51:36.422357 | 2021-09-17T07:54:30 | 2021-09-17T07:54:30 | 200,734,383 | 1 | 0 | null | 2022-05-16T19:25:13 | 2019-08-05T21:57:08 | Java | UTF-8 | Java | false | false | 2,397 | java | package r01f.types.contact;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import r01f.patterns.IsBuilder;
@NoArgsConstructor(access=AccessLevel.PRIVATE)
public abstract class PersonWithContactInfoBuilder
implements IsBuilder {
/////////////////////////////////////////////////////////////////////////////////////////
// BUILDER
/////////////////////////////////////////////////////////////////////////////////////////
public static PersonWithContactInfoBuilderPersonStep create() {
return new PersonWithContactInfoBuilder() { /* nothing */ }
.new PersonWithContactInfoBuilderPersonStep(new PersonWithContactInfo());
}
public static PersonWithContactInfo create(final Person<? extends PersonID> person,
final ContactInfo contactInfo) {
return new PersonWithContactInfo(person,
contactInfo);
}
/////////////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////////////
@RequiredArgsConstructor(access=AccessLevel.PRIVATE)
public final class PersonWithContactInfoBuilderPersonStep {
private final PersonWithContactInfo _modelObj;
public PersonWithContactInfoBuilderContactStep noPerson() {
return new PersonWithContactInfoBuilderContactStep(_modelObj);
}
public PersonWithContactInfoBuilderContactStep forPerson(final Person<? extends PersonID> person) {
_modelObj.setPerson(person);
return new PersonWithContactInfoBuilderContactStep(_modelObj);
}
}
@RequiredArgsConstructor(access=AccessLevel.PRIVATE)
public final class PersonWithContactInfoBuilderContactStep {
private final PersonWithContactInfo _modelObj;
public PersonWithContactInfoBuilderBuildStep noContactInfo() {
return new PersonWithContactInfoBuilderBuildStep(_modelObj);
}
public PersonWithContactInfoBuilderBuildStep withContactInfo(final ContactInfo contactInfo) {
_modelObj.setContactInfo(contactInfo);
return new PersonWithContactInfoBuilderBuildStep(_modelObj);
}
}
@RequiredArgsConstructor(access=AccessLevel.PRIVATE)
public final class PersonWithContactInfoBuilderBuildStep {
private final PersonWithContactInfo _modelObj;
public PersonWithContactInfo build() {
return _modelObj;
}
}
}
| [
"futuretelematics@gmail.com"
] | futuretelematics@gmail.com |
f5ed8fb402e32986569c620dd0dbaa0586a7c0de | 8666674c9e58ffa28e56d68710d96fb4d327dbcd | /src/day3/Myfirstjavaprogam.java | 070bdcbe427aba649bfbce8319829b591a13bf59 | [] | no_license | League-Workshop/intro-to-java-workshop-isabelledl | c33a11d6bd2543ada06b6f869f93cd0c9c70a198 | a5500698629aeca3649a4e8db64081d5e0513392 | refs/heads/master | 2021-06-24T03:00:15.575593 | 2017-08-18T21:50:04 | 2017-08-18T21:50:04 | 100,305,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package day3;
import org.jointheleague.graphical.robot.Robot;
public class Myfirstjavaprogam {
public static void main(String[] args) {
Robot r2d2 = new Robot();
r2d2.penDown();
r2d2.setPenColor(255, 255, 255);
for (int i = 0; i < 4; i++) {
r2d2.move(246);
r2d2.turn(90);
r2d2.setSpeed(5);
r2d2.move(50);
r2d2.turn(80);
r2d2.turn(90);
r2d2.move(125);
r2d2.sparkle();
}
}
} | [
"rhymeinparentheses@gmail.com"
] | rhymeinparentheses@gmail.com |
4b7c6e73083060081af7154f39b7a80cdc24ffd8 | 7c17167e5a2e8e76a818350dabf84260c028c6c3 | /OscillationParameters.java | b138f1d374e14caef2609f28099b341d373a5bd0 | [] | no_license | pbl22ist/pbl22-g10 | 7bafac3838651f3a600309d3c5494f529c3f4b8a | d0f5d33cb72f72800d15a49541063700e1bebc5d | refs/heads/master | 2021-01-20T11:11:35.710651 | 2012-12-14T06:57:35 | 2012-12-14T06:57:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 701 | java | package robocode;
public class OscillationParameters{
public double enemyAbsoluteCenterX;
public double enemyAbsoluteCenterY;
public double ememyOmega;
public double enemyRadius;
public double prevTerminalX;
public double prevTerminalY;
public double prevTime;
public double setAbsoluteTerminal(
double x2,
double y2,
double t2){
double x1 = prevTerminalX;
double y1 = prevTerminalY;
double t1 = prevTime;
double dx = x2 - x1;
double dy = y2 - y1;
enemyAbsoluteCenterX = (x1 + x2) / 2;
enemyAbsoluteCenterY = (y1 + y2) / 2;
enemyRadius = Math.sqrt(dx*dx + dy*dy)/2;
enemyOmega = 180 / (t2 - t1);
prevTerminalX = x2;
prevTerminalY = y2;
prevTime = t2;
}
} | [
"klta.memorhy@gmail.com"
] | klta.memorhy@gmail.com |
ad56a47c15ee36d9d735a1838fe901ab097c693c | d72cdc4a0158ee3ecae5e1b2d9cdb9bb7e241763 | /tools/base/common/src/main/java/com/android/utils/SdkUtils.java | 5caa5d20ec95a5b9e0484e349421234de93b70ed | [
"Apache-2.0"
] | permissive | yanex/uast-lint-common | 700fc4ca41a3ed7d76cb33cab280626a0c9d717b | 34f5953acd5e8c0104bcc2548b2f2e3f5ab8c675 | refs/heads/master | 2021-01-20T18:08:31.404596 | 2016-06-08T19:58:58 | 2016-06-08T19:58:58 | 60,629,527 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,164 | java | /*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.utils;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.google.common.base.CaseFormat;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.io.ByteStreams;
import com.google.common.io.Closeables;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.List;
import java.util.Properties;
import static com.android.SdkConstants.DOT_WEBP;
import static com.android.SdkConstants.DOT_XML;
import static com.android.SdkConstants.DOT_PNG;
import static com.android.SdkConstants.DOT_GIF;
import static com.android.SdkConstants.DOT_9PNG;
import static com.android.SdkConstants.DOT_JPEG;
import static com.android.SdkConstants.DOT_JPG;
import static com.android.SdkConstants.DOT_BMP;
/** Miscellaneous utilities used by the Android SDK tools */
public class SdkUtils {
/**
* Returns true if the given string ends with the given suffix, using a
* case-insensitive comparison.
*
* @param string the full string to be checked
* @param suffix the suffix to be checked for
* @return true if the string case-insensitively ends with the given suffix
*/
public static boolean endsWithIgnoreCase(@NonNull String string, @NonNull String suffix) {
return string.regionMatches(true /* ignoreCase */, string.length() - suffix.length(),
suffix, 0, suffix.length());
}
/**
* Returns true if the given sequence ends with the given suffix (case
* sensitive).
*
* @param sequence the character sequence to be checked
* @param suffix the suffix to look for
* @return true if the given sequence ends with the given suffix
*/
public static boolean endsWith(@NonNull CharSequence sequence, @NonNull CharSequence suffix) {
return endsWith(sequence, sequence.length(), suffix);
}
/**
* Returns true if the given sequence ends at the given offset with the given suffix (case
* sensitive)
*
* @param sequence the character sequence to be checked
* @param endOffset the offset at which the sequence is considered to end
* @param suffix the suffix to look for
* @return true if the given sequence ends with the given suffix
*/
public static boolean endsWith(@NonNull CharSequence sequence, int endOffset,
@NonNull CharSequence suffix) {
if (endOffset < suffix.length()) {
return false;
}
for (int i = endOffset - 1, j = suffix.length() - 1; j >= 0; i--, j--) {
if (sequence.charAt(i) != suffix.charAt(j)) {
return false;
}
}
return true;
}
/**
* Returns true if the given string starts with the given prefix, using a
* case-insensitive comparison.
*
* @param string the full string to be checked
* @param prefix the prefix to be checked for
* @return true if the string case-insensitively starts with the given prefix
*/
public static boolean startsWithIgnoreCase(@NonNull String string, @NonNull String prefix) {
return string.regionMatches(true /* ignoreCase */, 0, prefix, 0, prefix.length());
}
/**
* Returns true if the given string starts at the given offset with the
* given prefix, case insensitively.
*
* @param string the full string to be checked
* @param offset the offset in the string to start looking
* @param prefix the prefix to be checked for
* @return true if the string case-insensitively starts at the given offset
* with the given prefix
*/
public static boolean startsWith(@NonNull String string, int offset, @NonNull String prefix) {
return string.regionMatches(true /* ignoreCase */, offset, prefix, 0, prefix.length());
}
/**
* Strips the whitespace from the given string
*
* @param string the string to be cleaned up
* @return the string, without whitespace
*/
public static String stripWhitespace(@NonNull String string) {
StringBuilder sb = new StringBuilder(string.length());
for (int i = 0, n = string.length(); i < n; i++) {
char c = string.charAt(i);
if (!Character.isWhitespace(c)) {
sb.append(c);
}
}
return sb.toString();
}
/**
* Returns true if the given string has an upper case character.
*
* @param s the string to check
* @return true if it contains uppercase characters
*/
public static boolean hasUpperCaseCharacter(@NonNull String s) {
for (int i = 0; i < s.length(); i++) {
if (Character.isUpperCase(s.charAt(i))) {
return true;
}
}
return false;
}
/** For use by {@link #getLineSeparator()} */
private static String sLineSeparator;
/**
* Returns the default line separator to use.
* <p>
* NOTE: If you have an associated IDocument (Eclipse), it is better to call
* TextUtilities#getDefaultLineDelimiter(IDocument) since that will
* allow (for example) editing a \r\n-delimited document on a \n-delimited
* platform and keep a consistent usage of delimiters in the file.
*
* @return the delimiter string to use
*/
@NonNull
public static String getLineSeparator() {
if (sLineSeparator == null) {
// This is guaranteed to exist:
sLineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
}
return sLineSeparator;
}
/**
* Wraps the given text at the given line width, with an optional hanging
* indent.
*
* @param text the text to be wrapped
* @param lineWidth the number of characters to wrap the text to
* @param hangingIndent the hanging indent (to be used for the second and
* subsequent lines in each paragraph, or null if not known
* @return the string, wrapped
*/
@NonNull
public static String wrap(
@NonNull String text,
int lineWidth,
@Nullable String hangingIndent) {
if (hangingIndent == null) {
hangingIndent = "";
}
int explanationLength = text.length();
StringBuilder sb = new StringBuilder(explanationLength * 2);
int index = 0;
while (index < explanationLength) {
int lineEnd = text.indexOf('\n', index);
int next;
if (lineEnd != -1 && (lineEnd - index) < lineWidth) {
next = lineEnd + 1;
} else {
// Line is longer than available width; grab as much as we can
lineEnd = Math.min(index + lineWidth, explanationLength);
if (lineEnd - index < lineWidth) {
next = explanationLength;
} else {
// then back up to the last space
int lastSpace = text.lastIndexOf(' ', lineEnd);
if (lastSpace > index) {
lineEnd = lastSpace;
next = lastSpace + 1;
} else {
// No space anywhere on the line: it contains something wider than
// can fit (like a long URL) so just hard break it
next = lineEnd + 1;
}
}
}
if (sb.length() > 0) {
sb.append(hangingIndent);
} else {
lineWidth -= hangingIndent.length();
}
sb.append(text.substring(index, lineEnd));
sb.append('\n');
index = next;
}
return sb.toString();
}
/**
* Returns the given localized string as an int. For example, in the
* US locale, "1,000", will return 1000. In the French locale, "1.000" will return
* 1000. It will return 0 for empty strings.
* <p>
* To parse a string without catching parser exceptions, call
* {@link #parseLocalizedInt(String, int)} instead, passing the
* default value to be returned if the format is invalid.
*
* @param string the string to be parsed
* @return the integer value
* @throws ParseException if the format is not correct
*/
public static int parseLocalizedInt(@NonNull String string) throws ParseException {
if (string.isEmpty()) {
return 0;
}
return NumberFormat.getIntegerInstance().parse(string).intValue();
}
/**
* Returns the given localized string as an int. For example, in the
* US locale, "1,000", will return 1000. In the French locale, "1.000" will return
* 1000. If the format is invalid, returns the supplied default value instead.
*
* @param string the string to be parsed
* @param defaultValue the value to be returned if there is a parsing error
* @return the integer value
*/
public static int parseLocalizedInt(@NonNull String string, int defaultValue) {
try {
return parseLocalizedInt(string);
} catch (ParseException e) {
return defaultValue;
}
}
/**
* Returns the given localized string as a double. For example, in the
* US locale, "3.14", will return 3.14. In the French locale, "3,14" will return
* 3.14. It will return 0 for empty strings.
* <p>
* To parse a string without catching parser exceptions, call
* {@link #parseLocalizedDouble(String, double)} instead, passing the
* default value to be returned if the format is invalid.
*
* @param string the string to be parsed
* @return the double value
* @throws ParseException if the format is not correct
*/
public static double parseLocalizedDouble(@NonNull String string) throws ParseException {
if (string.isEmpty()) {
return 0.0;
}
return NumberFormat.getNumberInstance().parse(string).doubleValue();
}
/**
* Returns the given localized string as a double. For example, in the
* US locale, "3.14", will return 3.14. In the French locale, "3,14" will return
* 3.14. If the format is invalid, returns the supplied default value instead.
*
* @param string the string to be parsed
* @param defaultValue the value to be returned if there is a parsing error
* @return the double value
*/
public static double parseLocalizedDouble(@NonNull String string, double defaultValue) {
try {
return parseLocalizedDouble(string);
} catch (ParseException e) {
return defaultValue;
}
}
/**
* Returns the corresponding {@link File} for the given file:// url
*
* @param url the URL string, e.g. file://foo/bar
* @return the corresponding {@link File} (which may or may not exist)
* @throws MalformedURLException if the URL string is malformed or is not a file: URL
*/
@NonNull
public static File urlToFile(@NonNull String url) throws MalformedURLException {
return urlToFile(new URL(url));
}
@NonNull
public static File urlToFile(@NonNull URL url) throws MalformedURLException {
try {
return new File(url.toURI());
}
catch (IllegalArgumentException e) {
MalformedURLException ex = new MalformedURLException(e.getLocalizedMessage());
ex.initCause(e);
throw ex;
}
catch (URISyntaxException e) {
return new File(url.getPath());
}
}
/**
* Returns the corresponding URL string for the given {@link File}
*
* @param file the file to look up the URL for
* @return the corresponding URL
* @throws MalformedURLException in very unexpected cases
*/
public static String fileToUrlString(@NonNull File file) throws MalformedURLException {
String url = fileToUrl(file).toExternalForm();
// Use three slashes, which is the form most widely recognized by terminal emulators.
if (!url.startsWith("file:///")) {
url = url.replaceFirst("file:/", "file:///");
}
return url;
}
/**
* Returns the corresponding URL for the given {@link File}
*
* @param file the file to look up the URL for
* @return the corresponding URL
* @throws MalformedURLException in very unexpected cases
*/
public static URL fileToUrl(@NonNull File file) throws MalformedURLException {
return file.toURI().toURL();
}
/** Prefix in comments which mark the source locations for merge results */
public static final String FILENAME_PREFIX = "From: ";
/**
* Creates the path comment XML string. Note that it does not escape characters
* such as & and <; those are expected to be escaped by the caller (for
* example, handled by a call to {@link org.w3c.dom.Document#createComment(String)})
*
*
* @param file the file to create a path comment for
* @param includePadding whether to include padding. The final comment recognized by
* error recognizers expect padding between the {@code <!--} and
* the start marker (From:); you can disable padding if the caller
* already is in a context where the padding has been added.
* @return the corresponding XML contents of the string
*/
public static String createPathComment(@NonNull File file, boolean includePadding)
throws MalformedURLException {
String url = fileToUrlString(file);
int dashes = url.indexOf("--");
if (dashes != -1) { // Not allowed inside XML comments - for SGML compatibility. Sigh.
url = url.replace("--", "%2D%2D");
}
if (includePadding) {
return ' ' + FILENAME_PREFIX + url + ' ';
} else {
return FILENAME_PREFIX + url;
}
}
/**
* Translates an XML name (e.g. xml-name) into a Java / C++ constant name (e.g. XML_NAME)
* @param xmlName the hyphen separated lower case xml name.
* @return the equivalent constant name.
*/
public static String xmlNameToConstantName(String xmlName) {
return CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, xmlName);
}
/**
* Translates a camel case name (e.g. xmlName) into a Java / C++ constant name (e.g. XML_NAME)
* @param camelCaseName the camel case name.
* @return the equivalent constant name.
*/
public static String camelCaseToConstantName(String camelCaseName) {
return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, camelCaseName);
}
/**
* Translates a Java / C++ constant name (e.g. XML_NAME) into camel case name (e.g. xmlName)
* @param constantName the constant name.
* @return the equivalent camel case name.
*/
public static String constantNameToCamelCase(String constantName) {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, constantName);
}
/**
* Translates a Java / C++ constant name (e.g. XML_NAME) into a XML case name (e.g. xml-name)
* @param constantName the constant name.
* @return the equivalent XML name.
*/
public static String constantNameToXmlName(String constantName) {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, constantName);
}
/**
* Get the R field name from a resource name, since
* AAPT will flatten the namespace, turning dots, dashes and colons into _
*
* @param resourceName the name to convert
* @return the corresponding R field name
*/
@NonNull
public static String getResourceFieldName(@NonNull String resourceName) {
// AAPT will flatten the namespace, turning dots, dashes and colons into _
for (int i = 0, n = resourceName.length(); i < n; i++) {
char c = resourceName.charAt(i);
if (c == '.' || c == ':' || c == '-') {
return resourceName.replace('.', '_').replace('-', '_').replace(':', '_');
}
}
return resourceName;
}
public static final List<String> IMAGE_EXTENSIONS = ImmutableList.of(
DOT_PNG, DOT_9PNG, DOT_GIF, DOT_JPEG, DOT_JPG, DOT_BMP, DOT_WEBP);
/**
* Returns true if the given file path points to an image file recognized by
* Android. See http://developer.android.com/guide/appendix/media-formats.html
* for details.
*
* @param path the filename to be tested
* @return true if the file represents an image file
*/
public static boolean hasImageExtension(String path) {
for (String ext: IMAGE_EXTENSIONS) {
if (endsWithIgnoreCase(path, ext)) {
return true;
}
}
return false;
}
/**
* Escapes the given property file value (right hand side of property assignment)
* as required by the property file format (e.g. escapes colons and backslashes)
*
* @param value the value to be escaped
* @return the escaped value
*/
@NonNull
public static String escapePropertyValue(@NonNull String value) {
// Slow, stupid implementation, but is 100% compatible with Java's property file
// implementation
Properties properties = new Properties();
properties.setProperty("k", value); // key doesn't matter
StringWriter writer = new StringWriter();
try {
properties.store(writer, null);
String s = writer.toString();
int end = s.length();
// Writer inserts trailing newline
String lineSeparator = SdkUtils.getLineSeparator();
if (s.endsWith(lineSeparator)) {
end -= lineSeparator.length();
}
int start = s.indexOf('=');
assert start != -1 : s;
return s.substring(start + 1, end);
}
catch (IOException e) {
return value; // shouldn't happen; we're not going to disk
}
}
}
| [
"yan.zhulanow@jetbrains.com"
] | yan.zhulanow@jetbrains.com |
f77fb6273854493f684ff49c014fd447c1e0fbf2 | b6fb5393cb54d9966b239c40e6383c1eab5bf1a1 | /app/src/main/java/com/chaungying/common/view/DownPopWindowPerItemView.java | 07db50bbae30a49dd8dde521aa672f8e976d8c05 | [] | no_license | 122088387/Test | c749eb212c36564686c91d36b8d5d12a425907b2 | e069e8f89caa22da9e885acd26f3ddc146d2fcf2 | refs/heads/master | 2021-01-12T09:05:02.159542 | 2016-12-18T07:58:03 | 2016-12-18T07:58:03 | 76,760,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,671 | java | package com.chaungying.common.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.chaungying.ji_xiao.bean.JobHeader;
import com.chaungying.wuye3.R;
/**
* @author ็ๆ่ต or 2016/7/27
*/
public class DownPopWindowPerItemView extends RelativeLayout {
private TextView tv;
private JobHeader.ItemsBean itemsBeanList;
private String fieldname;
public String getFieldname() {
return fieldname;
}
public void setFieldname(String fieldname) {
this.fieldname = fieldname;
}
//ไธบไบ็ญ้ๆถไฝฟ็จ
private int val;
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
public JobHeader.ItemsBean getItemsBeanList() {
return itemsBeanList;
}
public void setItemsBean(JobHeader.ItemsBean itemsBean) {
this.itemsBeanList = itemsBean;
}
public DownPopWindowPerItemView(Context context) {
this(context, null);
}
public DownPopWindowPerItemView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public DownPopWindowPerItemView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.down_pop_window_item_view, this);
tv = (TextView) findViewById(R.id.tv_down_pop);
}
public void setText(String title) {
tv.setText(title);
}
public String getTitle() {
return tv.getText().toString();
}
}
| [
"122088387@qq.com"
] | 122088387@qq.com |
52998cf1fbe34028a00f257ac41909470805147c | ee866d57cb93d913f974614a38d11568bbe52aed | /src/main/java/com/xz/Controller/MerchandiseController.java | 0a6577e3e9dc6b1385af7418faf4073bb2767f26 | [] | no_license | Dong-prog/Vending | d7dc1e3d9b1dc121227e5f36ce283f27950f0baa | 713c1a84b7e1aed597ec8e19a55975ae0f05eeed | refs/heads/master | 2022-12-16T04:18:20.426837 | 2020-09-22T11:26:31 | 2020-09-22T11:26:31 | 297,615,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,776 | java | package com.xz.Controller;
import com.xz.pojo.Merchandise;
import com.xz.pojo.User;
import com.xz.service.MerchandiseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.*;
@Controller
@RequestMapping("/Merchandise")
public class MerchandiseController {
@Autowired
public MerchandiseService merchandiseService;
@RequestMapping("/addMerchandise")
@ResponseBody
public Map<String,String> add_Merchandise(@RequestBody Merchandise merchandise){
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
merchandise.setDate(sdf.format(date));
boolean success;
Map<String, String > map = new HashMap<>();
success = merchandiseService.add_Merchandise(merchandise);
if(success == true) {
map.put("add","success");
System.out.println("add Merchandise success");
}
else {
map.put("add","fail");
System.out.println("add Merchandise fail");
}
return map;
}
@RequestMapping("/getAllMerchandise")
public String SelectAllMerchandise(Model model, HttpServletRequest request){
HttpSession session = request.getSession();
User user = (User)session.getAttribute("SESSION_USER");
List<Merchandise> list;
list = merchandiseService.selectAllMerchandise();
model.addAttribute("ListAllMerchandise",list);
System.out.println("GET ALL MERCHANDISE ");
for (int i = 0; i < list.size(); i++)
{
System.out.println(list.get(i).getManufactureId()+list.get(i).getDate());
}
if(user.getRole().equals("ACE")){
System.out.println("merchandise");
return "merchandise";
}
else if(user.getRole().equals("FIX")){
return "redirect:";
}
else if(user.getRole().equals("MAC")){
System.out.println("merchandise-machine");
return "merchandise-machine";
}
else {
System.out.println("merchandise-manufac");
return "merchandise-manufac";
}
}
@RequestMapping("/deleteAMerchandise")
@ResponseBody
public Map<String,String> deleteAMerchandise(@RequestBody Merchandise merchandise){
System.out.println("delete A Merchandise");
boolean success;
success = merchandiseService.deleteAMerchandise(merchandise.getMerchandiseId());
Map<String, String > map = new HashMap<>();
if(success){
map.put("delete","success");
System.out.println("delete merchandise success");
}
else{
map.put("delete","fail");
System.out.println("delete merchandise fail");
}
return map;
}
@RequestMapping("/updateAMerchandise")
@ResponseBody
public Map<String,String> updateAMerchandise(@RequestBody Merchandise merchandise){
System.out.println("update A User ");
System.out.println(merchandise.getMerchandiseId()+" "+merchandise.getManufactureId()
+" "+merchandise.getPrice()+" "+merchandise.getInventory()+" "+merchandise.getName());
boolean success;
success = merchandiseService.updateAMerchandise(merchandise);
if(success == true) System.out.println("update Merchandise success");
else System.out.println("update Merchandise fail");
Map<String, String > map = new HashMap<>();
map.put("update","success");
return map;
}
//ๆณจๅๆถๆฃๆฅMerchandiseIdๆฏๅฆๅญๅจ
@RequestMapping("/checkMerchandiseId")
@ResponseBody
public Map<String, Integer> checkMerchandiseId(@RequestBody Merchandise merchandise) {
Map<String, Integer> map = new HashMap<>();
Merchandise m = new Merchandise();
m = merchandiseService.checkMerchandise(merchandise);
Integer code = 0;
//ๅฆๆ MerchandiseId ไธบ็ฉบ ๅ ็จๆทๅๅฏ็จ
if (m == null) {
//ๅฏ็จ
code = 1;
} else {
//ไธๅฏ็จ
code = 0;
System.out.println("ๅทฒๅญๅจ็idไปฅๅๅ็งฐ"+m.getMerchandiseId()+" "+m.getName());
}
map.put("IsExist", code);
return map;
}
}
| [
"2573139450@qq.com"
] | 2573139450@qq.com |
d5c00ef29eb6502c462cc08d3c823cfe6b691df4 | ec29e93670d70f795a0009740091e9b3e9e23551 | /java/sp-auth/src/main/java/com/anji/sp/model/po/SpRoleMenuPO.java | 8388cdc4f99839c6f2c047f4732517d6b8c34944 | [
"Apache-2.0"
] | permissive | anji-plus/appsp | 2a107739e5468880ec891d78bdade7d11fd008b3 | 7b05527a31819622905269fbf592c99201378daf | refs/heads/master | 2023-03-03T23:29:58.131509 | 2021-02-18T05:27:57 | 2021-02-18T05:27:57 | 329,180,031 | 21 | 8 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | package com.anji.sp.model.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* ่ง่ฒไธ่ๅๅฏนๅบๅ
ณ็ณปPO
*
* @author kean 2020-06-27
*/
@Data
@TableName("sp_role_menu")
@ApiModel("่ง่ฒไธ่ๅๅฏนๅบๅ
ณ็ณปPO")
public class SpRoleMenuPO implements Serializable {
@ApiModelProperty("id")
@TableId(value = "id", type = IdType.INPUT)
private Long id;
@ApiModelProperty("่ง่ฒid")
private Long roleId;
@ApiModelProperty("่ๅid")
private Long menuId;
public SpRoleMenuPO() {
}
} | [
"qizhiyuan@anji-plus.com"
] | qizhiyuan@anji-plus.com |
f3266f87a78488f3d1f9cc6d5c9c75e78d48aaf3 | 60f326b74cd345c9d283372d5ead97f5dc26fc31 | /serviceLayer/src/main/java/com/hcl/service/impl/SensorFeedServiceImpl.java | 3d647092b151c8d9897b04ce3e24051beca6a63e | [] | no_license | SalmanZubair/GithubSonoco | 35854aed0cadef919b6a746c2c6acb434a424f94 | 1baf25dbe7044c70f1a339064758cad6ffe59cf5 | refs/heads/master | 2021-01-15T18:22:22.625208 | 2017-08-16T08:45:52 | 2017-08-16T08:45:52 | 99,781,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,022 | java | package com.hcl.service.impl;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.hcl.dao.SensorFeedDao;
import com.hcl.dao.exception.DaoException;
import com.hcl.service.SensorFeedService;
import com.hcl.service.exception.ServiceException;
@Service("sensorFeedService")
@Transactional
public class SensorFeedServiceImpl implements SensorFeedService {
@Autowired
SensorFeedDao sensorFeedDao;
private static final Logger logger = Logger
.getLogger(SensorFeedServiceImpl.class);
@Override
public JSONObject getParameterDetails(String boilerId, String lossId,
String method,String timeStamp) throws ServiceException {
try {
return sensorFeedDao.getParameterDetails(boilerId, lossId, method,timeStamp);
} catch (DaoException e) {
logger.error(e);
throw new ServiceException(e.getMessage());
}
}
}
| [
"salman.v21@gmail.com"
] | salman.v21@gmail.com |
e0421035f76f3e7f66a699364541e54097c64211 | ec1cec29232a35b0a5b7bf8f8c6baeaca09402f6 | /src/main/java/com/sunder/mongospringbootexample/model/AgeEvent.java | e6f78b3d4ae2e3c2ef6f9cfc85883f6813fe8e66 | [] | no_license | kamatchsunder/springbootmongo | 58b06a3eba67b76d9403f66674be7116186921b5 | 17b8e0bb6a9b8928f4ec7c326a74684c541a3746 | refs/heads/master | 2020-03-18T13:32:28.624248 | 2018-05-25T02:09:20 | 2018-05-25T02:09:20 | 134,790,659 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 268 | java | package com.sunder.mongospringbootexample.model;
import com.fasterxml.jackson.annotation.JsonInclude;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AgeEvent {
private String age;
public AgeEvent(String age) {
this.age = age;
}
}
| [
"ksubbu@ooyala.com"
] | ksubbu@ooyala.com |
ed13aa839a4ced23d8d175c67a7382118e73b1c5 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/main/java/org/gradle/test/performancenull_467/Productionnull_46603.java | 5ce122fc5bb9ec88f3b8f0f8fd23cc5664d141da | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 588 | java | package org.gradle.test.performancenull_467;
public class Productionnull_46603 {
private final String property;
public Productionnull_46603(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
4f96dc5509bb15a4cf8a01a33c46a88fc2bb05a8 | 92dd6bc0a9435c359593a1f9b309bb58d3e3f103 | /src/Dec2020Leetcode/_0018FourSum.java | 042f03e6037bc0d378fd3c8345896563326c0814 | [
"MIT"
] | permissive | darshanhs90/Java-Coding | bfb2eb84153a8a8a9429efc2833c47f6680f03f4 | da76ccd7851f102712f7d8dfa4659901c5de7a76 | refs/heads/master | 2023-05-27T03:17:45.055811 | 2021-06-16T06:18:08 | 2021-06-16T06:18:08 | 36,981,580 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,222 | java | package Dec2020Leetcode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
public class _0018FourSum {
public static void main(String[] args) {
System.out.println(fourSum(new int[] { 1, 0, -1, 0, -2, 2 }, 0));
System.out.println(fourSum(new int[] {}, 0));
}
public static List<List<Integer>> fourSum(int[] nums, int target) {
List<List<Integer>> output = new ArrayList<List<Integer>>();
if (nums.length < 4)
return output;
Arrays.sort(nums);
List<Integer> list = new ArrayList<Integer>();
HashSet<List<Integer>> set = new HashSet<List<Integer>>();
for (int i = 0; i < nums.length - 3; i++) {
for (int j = i + 1; j < nums.length - 2; j++) {
int left = j + 1;
int right = nums.length - 1;
while (left < right) {
int sum = nums[i] + nums[j] + nums[left] + nums[right];
if (sum == target) {
list = new ArrayList<Integer>(Arrays.asList(nums[i], nums[j], nums[left], nums[right]));
if (!set.contains(list)) {
set.add(list);
output.add(list);
}
left++;
right--;
} else if (sum > target) {
right--;
} else {
left++;
}
}
}
}
return output;
}
}
| [
"hsdars@gmail.com"
] | hsdars@gmail.com |
85f0bfe87fabaac7e2f0730b8867c337d809a5d0 | 1721194c34b03510191151d19981fe54a88d0821 | /app/src/main/java/com/ijouaf/akos/SignupActivity.java | e115b743038f489a1ef0cfce8d0c378505b18b3f | [] | no_license | faoujisoka/Mobile_Challenge | 3eec6c214e6d2d5a3dc58f0dc1465f917c3aa426 | 90fd7b54f750a495d8e2287a7eba98ac8108a74a | refs/heads/master | 2021-05-06T04:51:36.674648 | 2017-12-23T00:02:18 | 2017-12-23T00:02:18 | 115,009,009 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,333 | java | package com.ijouaf.akos;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import butterknife.ButterKnife;
import butterknife.Bind;
public class SignupActivity extends AppCompatActivity {
private static final String TAG = "SignupActivity";
@Bind(R.id.input_name) EditText _nameText;
@Bind(R.id.input_address) EditText _addressText;
@Bind(R.id.input_email) EditText _emailText;
@Bind(R.id.input_mobile) EditText _mobileText;
@Bind(R.id.input_password) EditText _passwordText;
@Bind(R.id.input_reEnterPassword) EditText _reEnterPasswordText;
@Bind(R.id.btn_signup) Button _signupButton;
@Bind(R.id.link_login) TextView _loginLink;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
ButterKnife.bind(this);
_signupButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
signup();
}
});
_loginLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Finish the registration screen and return to the Login activity
Intent intent = new Intent(getApplicationContext(),LoginActivity.class);
startActivity(intent);
finish();
overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
}
});
}
public void signup() {
Log.d(TAG, "Signup");
if (!validate()) {
onSignupFailed();
return;
}
_signupButton.setEnabled(false);
final ProgressDialog progressDialog = new ProgressDialog(SignupActivity.this,
R.style.AppTheme_Dark_Dialog);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Creating Account...");
progressDialog.show();
String name = _nameText.getText().toString();
String address = _addressText.getText().toString();
String email = _emailText.getText().toString();
String mobile = _mobileText.getText().toString();
String password = _passwordText.getText().toString();
String reEnterPassword = _reEnterPasswordText.getText().toString();
// TODO: Implement your own signup logic here.
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
// On complete call either onSignupSuccess or onSignupFailed
// depending on success
onSignupSuccess();
// onSignupFailed();
progressDialog.dismiss();
}
}, 3000);
}
public void onSignupSuccess() {
_signupButton.setEnabled(true);
setResult(RESULT_OK, null);
finish();
}
public void onSignupFailed() {
Toast.makeText(getBaseContext(), "Login failed", Toast.LENGTH_LONG).show();
_signupButton.setEnabled(true);
}
public boolean validate() {
boolean valid = true;
String name = _nameText.getText().toString();
String address = _addressText.getText().toString();
String email = _emailText.getText().toString();
String mobile = _mobileText.getText().toString();
String password = _passwordText.getText().toString();
String reEnterPassword = _reEnterPasswordText.getText().toString();
if (name.isEmpty() || name.length() < 3) {
_nameText.setError("at least 3 characters");
valid = false;
} else {
_nameText.setError(null);
}
if (address.isEmpty()) {
_addressText.setError("Enter Valid Address");
valid = false;
} else {
_addressText.setError(null);
}
if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
_emailText.setError("enter a valid email address");
valid = false;
} else {
_emailText.setError(null);
}
if (mobile.isEmpty() || mobile.length()!=10) {
_mobileText.setError("Enter Valid Mobile Number");
valid = false;
} else {
_mobileText.setError(null);
}
if (password.isEmpty() || password.length() < 4 || password.length() > 10) {
_passwordText.setError("between 4 and 10 alphanumeric characters");
valid = false;
} else {
_passwordText.setError(null);
}
if (reEnterPassword.isEmpty() || reEnterPassword.length() < 4 || reEnterPassword.length() > 10 || !(reEnterPassword.equals(password))) {
_reEnterPasswordText.setError("Password Do not match");
valid = false;
} else {
_reEnterPasswordText.setError(null);
}
return valid;
}
} | [
"soukaina05.faouji@gmail.com"
] | soukaina05.faouji@gmail.com |
e4cd56a5a98c1b83b312e30393fb1b9e62ce6207 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/smallest/e9c6206d3a4862876b0dead881ac55078f11e291f60215ab028651f06fcbee2a591a31a7727037774542df4fe051a89460d85f6067a0b9729ae86e4afe1e6e92/000/mutations/166/smallest_e9c6206d_000.java | 2dc5fe142a29820d339ea448c916893774e1458f | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,285 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class smallest_e9c6206d_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
smallest_e9c6206d_000 mainClass = new smallest_e9c6206d_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
DoubleObj a = new DoubleObj (), b = new DoubleObj (), c =
new DoubleObj (), d = new DoubleObj ();
output +=
(String.format ("Please enter 4 numbers separated by spaces > "));
a.value = scanner.nextDouble ();
b.value = scanner.nextDouble ();
c.value = scanner.nextDouble ();
d.value = scanner.nextDouble ();
if (a.value < b.value && a.value < c.value && a.value < d.value) {
output += (String.format ("%.0f is the smallest\n", a.value));
} else if (b.value < a.value && b.value < c.value && b.value < d.value) {
output += (String.format ("%.0f is the smallest\n", b.value));
} else if (c.value < b.value && c.value < b.value && c.value < d.value) {
output += (String.format ("%.0f is the smallest\n", c.value));
} else if (d.value < b.value && d.value < c.value && d.value < a.value) {
output += (String.format ("%.0f is the smallest\n", d.value));
}
if (true)
return;;
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
11b55a14f8ee4729c98ced271e20172f40e56de2 | 131914ac4c4eae2a89d21e9ddfe9a3d5325596b2 | /src/main/java/com/huobi/domain/enums/MergeLevel.java | 2b787bd52522f7bf255345cdd31d112e07753c10 | [] | no_license | squirrel-outlaw/huobiContract | 1bd8bf8c0192abe462bce7c715c0e9b276cc30e0 | af4b189fdca3a5b283db2c8bedcfc89cc5856a4e | refs/heads/master | 2020-04-13T22:41:15.520164 | 2019-01-31T12:57:40 | 2019-01-31T12:57:40 | 163,485,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java | package com.huobi.domain.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
/**
* created by jacky. 2018/7/21 2:24 PM
* ๏ผๅๅนถๆทฑๅบฆ0-5๏ผ๏ผstep0ๆถ๏ผไธๅๅนถๆทฑๅบฆ
*/
@AllArgsConstructor
public enum MergeLevel {
STEP0("step0"),
STEP1("step1"),
STEP2("step2"),
STEP3("step3"),
STEP4("step4"),
STEP5("step5");
private String code;
@JsonValue
public String getCode() {
return code;
}
}
| [
"squirrel_2009@163.com"
] | squirrel_2009@163.com |
bda60f662bf2ad2128134fdd3bf543e213688674 | f8542255c1aa665d9875395089f33b06d2b4a8ad | /app/src/main/java/project/game/Theme.java | 8bdc12eae1b3da747074323dc644f80fcb020b99 | [] | no_license | mjmjmjcvc/DotLine | 9595e36f598acf04836868286d6ac3ef8b67abd7 | 3699bad7727268c7636fab5a5f3092a06e50d048 | refs/heads/master | 2020-04-04T15:10:30.435998 | 2018-11-07T07:55:21 | 2018-11-07T07:55:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package project.game;
import android.graphics.Color;
public class Theme {
public static int[] playerColors = new int[]{Color.parseColor("#4444ff"), Color.parseColor("#ff4444")};
public static int space = 150;
public static int radius = 15;
public static int backgroundColor = Color.parseColor("#222222");
}
| [
"programmer.bahiraei@gmail.com"
] | programmer.bahiraei@gmail.com |
2fce7179329ec7dd0d5d0ab0fb699ffed88739da | 6a6bc193b1d1bd9cd1a37debc2ee2756096b1f1f | /src/main/java/cn/ileng/core/tags/form/LabelTag.java | 720877e1f4ca806d381dcdbbc3d77195680486a1 | [] | no_license | xjLeng/jeeweb-mybatis | 2f63c90d94513835a67112fba9c4654d1eecf94f | 63f00abbb7a462895501bc3037e011ea35369560 | refs/heads/master | 2021-01-15T11:49:23.534273 | 2017-09-13T01:04:38 | 2017-09-13T01:04:38 | 99,635,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | package cn.ileng.core.tags.form;
@SuppressWarnings("serial")
public class LabelTag extends org.springframework.web.servlet.tags.form.LabelTag {
}
| [
"18085137706@163.com"
] | 18085137706@163.com |
6cabd04c28732930cd67e095fb03d0d430acc736 | 5e97b7f36c0b33f2cce26ed6ef72087baff6c1f0 | /src/main/java/com/johngodoi/StringUtils.java | 44c1ee2ced666f3ff699f97ca2c9e6e4eb861a8b | [] | no_license | johngodoi/learning-spark-java8 | eb71765927d7e2185f9afdc0437397948f0f1fc8 | 63afc3f49dde9d4ada98352652ec8999b40f0a22 | refs/heads/master | 2021-01-22T05:32:54.688213 | 2020-05-22T18:39:38 | 2020-05-22T18:39:38 | 102,281,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package com.johngodoi;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class StringUtils {
static List<String> splitLinesOnWords(String s) {
Stream<String> listStream = Arrays.stream(replace(Arrays.asList("]","[","{","}","(",")","\""),s)
.split("[ ,:/><]"));
return listStream.collect(Collectors.toList());
}
static String replace(List<String> patterns, String in){
if(patterns.isEmpty()) return in;
return replace(patterns.subList(1, patterns.size()), in.replace(patterns.get(0), ""));
}
}
| [
"4JQbJf.sE[z"
] | 4JQbJf.sE[z |
897ff8ba11299533ebaf9c807dabf2fe4d798b38 | 5a221569453bddc94b854b182dfe2b0655fa03db | /XMLParsing Using DOM (Tap)/src/com/androidpeople/xml/parsing/XMLParsingDOMExample.java | 2fdb5a0be7a68b01a51c94ad1397f11cbb6084e0 | [] | no_license | aekawit/GitProject | bd9fc3a0d8964a3b3207c5635ab57a3e92201720 | 5468fcdfeadbc510ebd37fb594a5dd4eef67a6ff | refs/heads/master | 2021-01-16T18:30:29.451242 | 2015-04-27T06:28:28 | 2015-04-27T06:28:28 | 30,597,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,678 | java | package com.androidpeople.xml.parsing;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.LinearLayout;
import android.widget.ListView;
public class XMLParsingDOMExample extends Activity {
String a = "";
HashMap<String, Object> hm;
ListView list;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/** Create a new layout to display the view */
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(1);
list=(ListView)findViewById(R.id.gridView1);
/** Create a new textview array to display the results */
try {
URL url = new URL("http://www.umr-lab.com/device.xml");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(url.openStream()));
doc.getDocumentElement().normalize();
NodeList nodeList = doc.getElementsByTagName("device");
} catch (Exception e) {
System.out.println("XML Pasing Excpetion = " + e);
}
}
private Element[] getnodeVal(NodeList nlist) {
Element[] element=new Element[nlist.getLength()];
for (int i = 0; i < nlist.getLength(); i++) {
Node node = nlist.item(i);
element[i] = (Element) node;
}
return element;
}
}
| [
"clash.aek@hotmail.com"
] | clash.aek@hotmail.com |
ee2bc4d67a98b8359841e76fb5bcb261b559b298 | 76092178f3db6cefe0ef18db2ec5e509bb441b73 | /src/test/java/learningtest/spring/factorybean/FactoryBeanTest.java | 618276cf3ac0ddf27fdaf7a4a425b187c12deee6 | [] | no_license | SimKyunam/tobySpring-practice-1 | 0d699fd53c6eeb0077fca1a2fc4ed702748ff0d9 | 330f2a0afeba95c963e5882f062ecfbf3d576d17 | refs/heads/master | 2023-06-06T06:35:54.080566 | 2021-07-05T14:38:17 | 2021-07-05T14:38:17 | 329,926,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | package learningtest.spring.factorybean;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.CoreMatchers.*;
/**
* Created by mileNote on 2021-03-21
* Blog : https://milenote.tistory.com
* Github : https://github.com/SimKyunam
*/
@ExtendWith(SpringExtension.class)
@ContextConfiguration(locations="/FactoryBeanTest-context.xml")
class FactoryBeanTest {
@Autowired
ApplicationContext context;
@Test
public void getMessageFromFactoryBean(){
Object message = context.getBean("message");
assertThat(message.getClass(), is(Message.class));
assertThat(((Message)message).getText(), is("Factory Bean"));
}
@Test
public void getFactoryBean() throws Exception{
Object factory = context.getBean("&message");
assertThat(factory.getClass(), is(MessageFactoryBean.class));
}
} | [
"ppp9026@naver.com"
] | ppp9026@naver.com |
5e02db0de2379dcc330a0139bcfb83d2ab4f7733 | f9a99f62a13c42528a95aac5df9b4e8e27353511 | /app/src/main/java/com/example/Diary2/AddJournalActivity.java | 9316dcf9182a68800d7ae5ff89942a575d155b30 | [] | no_license | zzkigzz48/Diary-ver.2 | 36c56a2556d15132f636bf688fe61e7b8716766f | feebc8308c3e7fb200283fe4d409cf5bace3c11b | refs/heads/master | 2020-09-14T12:29:42.386189 | 2019-11-21T08:46:14 | 2019-11-21T08:46:14 | 223,128,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,436 | java | package com.example.Diary2;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.Diary2.HistoryCustomAdapter.HistoryAdapter;
import com.example.Diary2.model.HistoryItem;
import com.example.Diary2.model.JournalItem;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import petrov.kristiyan.colorpicker.ColorPicker;
public class AddJournalActivity extends AppCompatActivity {
private EditText mEdtTitle, mEdtContent;
private ImageButton mBtnDelete;
private int mYear, mMonth, mDay, mHour, mMinute;
private JournalItem editItem;
private RecyclerView mRvHistory;
private List<HistoryItem> historyList;
private HistoryAdapter historyAdapter;
public ArrayList<String> colorList = new ArrayList(Arrays.asList(new String[]{"#d9d9d9", "#ffcdd2", "#f8bbd0",
"#e1bee7", "#bbdefb", "#d7ccc8", "#ffe0b2", "#fff9c4", "#c8e6c9", "#b2dfdb"}));
private int state, basecolor;
private String username;
private boolean isEdited = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add_journal_activity);
addDefaultValues();
addComponents();
}
private void addDefaultValues() {
state = MainActivity.REQUEST_ADD_JOURNAL;
editItem = new JournalItem();
Intent intent = getIntent();
username = intent.getExtras().getString("username");
((TextView) findViewById(R.id.edt_toolbar_edit_title)).setText("Welcome " + username);
int requestCode = intent.getExtras().getInt("request");
if (requestCode == MainActivity.REQUEST_EDIT_JOURNAL) {
state = MainActivity.REQUEST_EDIT_JOURNAL;
Bundle bundle = intent.getBundleExtra("package");
JournalItem item = (JournalItem) bundle.getSerializable("journalItem");
editItem.setId(item.getId());
editItem.setTitle(item.getTitle());
editItem.setContent(item.getContent());
editItem.setDate(item.getDate());
editItem.setColor(item.getColor());
editItem.setHistoryList(item.getHistoryList());
basecolor = editItem.getColor();
mRvHistory = findViewById(R.id.rv_journal_history);
historyList = new ArrayList<>();
historyList.addAll(editItem.getHistoryList());
historyAdapter = new HistoryAdapter(this, historyList);
mRvHistory.setLayoutManager(new LinearLayoutManager(this));
mRvHistory.setAdapter(historyAdapter);
} else {
editItem.setDate(Calendar.getInstance().getTime());
editItem.setColor(Color.parseColor("#bbdefb"));
}
}
private void addComponents() {
Toolbar mCustomToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mCustomToolbar);
ImageButton mBtnBack = findViewById(R.id.btn_back);
mBtnBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setResult(RESULT_CANCELED);
finish();
}
});
mEdtTitle = findViewById(R.id.edt_title);
mEdtContent = findViewById(R.id.edt_content);
if (state == MainActivity.REQUEST_EDIT_JOURNAL) {
mEdtTitle.setText(editItem.getTitle());
mEdtContent.setText(editItem.getContent());
}
ImageButton mBtnOk = findViewById(R.id.btn_done);
mBtnOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mEdtTitle.getText().toString().equals("") || mEdtContent.getText().toString().equals("")) {
Toast.makeText(AddJournalActivity.this, "Insert information", Toast.LENGTH_SHORT).show();
} else {
String newTitle = mEdtTitle.getText().toString();
String newContent = mEdtContent.getText().toString();
HistoryItem historyItem;
if (state == MainActivity.REQUEST_ADD_JOURNAL) {
historyItem = new HistoryItem("0", true, username,
username + " created this Journal", new Date());
} else {
String oldTitle = editItem.getTitle();
String oldContent = editItem.getContent();
String historyContent = "";
if (!newTitle.equals(oldTitle)) {
isEdited = true;
historyContent += "Title changed: " + oldTitle + " to " + newTitle + "\n";
}
if (!newContent.equals(oldContent)) {
isEdited = true;
historyContent += "Content changed: " + oldContent + " to " + newContent;
}
if (basecolor != editItem.getColor()) {
isEdited = true;
historyContent += "Color changed: " + basecolor + " to " + editItem.getColor();
}
int nextId = editItem.getHistoryList().size();
historyItem = new HistoryItem(nextId + "",
false, username, historyContent, new Date());
}
if (isEdited) {
editItem.getHistoryList().add(0, historyItem);
editItem.setTitle(newTitle);
editItem.setContent(newContent);
Bundle bundle = new Bundle();
bundle.putSerializable("journalItem", editItem);
Intent intent = new Intent();
intent.putExtra("requestConfirm", MainActivity.REQUEST_EDIT_JOURNAL);
intent.putExtra("bundle", bundle);
setResult(Activity.RESULT_OK, intent);
finish();
} else {
setResult(Activity.RESULT_CANCELED);
finish();
}
}
}
});
mBtnDelete = findViewById(R.id.btn_delete_diary);
mBtnDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
deleteJournalConfirm();
}
});
}
private void deleteJournalConfirm() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Journal Delete Confirm");
builder.setMessage("Confirm to delete this journal?");
builder.setCancelable(false);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (state == MainActivity.REQUEST_ADD_JOURNAL) {
setResult(Activity.RESULT_CANCELED);
finish();
} else {
Intent intent = new Intent();
intent.putExtra("requestConfirm", MainActivity.REQUEST_DELETE_JOURNAL);
setResult(Activity.RESULT_OK, intent);
finish();
}
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.show();
}
public void onClickDatePickerButton(View v) {
if (state == MainActivity.REQUEST_ADD_JOURNAL) {
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
Calendar itemCal = Calendar.getInstance();
itemCal.setTime(editItem.getDate());
itemCal.set(year, monthOfYear, dayOfMonth);
editItem.setDate(itemCal.getTime());
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
} else {
Toast.makeText(this, "You cannot change the date", Toast.LENGTH_SHORT).show();
}
}
public void onClickTimePickerButton(View v) {
if (state == MainActivity.REQUEST_ADD_JOURNAL) {
// Get Current Time
final Calendar c = Calendar.getInstance();
mHour = c.get(Calendar.HOUR_OF_DAY);
mMinute = c.get(Calendar.MINUTE);
// Launch Time Picker Dialog
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
Calendar itemCal = Calendar.getInstance();
itemCal.setTime(editItem.getDate());
itemCal.set(Calendar.HOUR_OF_DAY, hourOfDay);
itemCal.set(Calendar.MINUTE, minute);
editItem.setDate(itemCal.getTime());
}
}, mHour, mMinute, false);
timePickerDialog.show();
} else {
Toast.makeText(this, "You cannot change the time", Toast.LENGTH_SHORT).show();
}
}
public void onClickColorPickerButton(View v) {
final ColorPicker colorPicker = new ColorPicker(this);
colorPicker.setColors(colorList);
colorPicker.setDefaultColorButton(R.color.colorPrimary);
colorPicker.setRoundColorButton(true)
.setColumns(5)
.setOnChooseColorListener(new ColorPicker.OnChooseColorListener() {
@Override
public void onChooseColor(int position, int color) {
editItem.setColor(color);
}
@Override
public void onCancel() {
}
})
.show();
}
}
| [
"dokhoa342@gmail.com"
] | dokhoa342@gmail.com |
236d4219658c537fa4bdf8c68be22a839456544e | c9c7a850fec31eca2f23d8e991babed2d654abb4 | /src/main/java/it/uniroma3/siw/model/Artista.java | 14f27e55f5b823a1c0e42541ef02b9bd40bf81c1 | [] | no_license | Fgico/SIWMuseo-con-Spring-Boot | fcf46bf890894d71dde8e4285557e1b5390f95be | 135b1d00aa0a5462935beca0c808edaaa4057cb2 | refs/heads/main | 2023-04-25T18:59:41.505007 | 2021-06-06T14:44:07 | 2021-06-06T14:44:07 | 373,989,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,595 | java | package it.uniroma3.siw.model;
import java.time.LocalDate;
import java.util.LinkedList;
import java.util.List;
import javax.persistence.*;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
@Entity
public class Artista implements myEntity{
public Artista() {
setCreazioni(new LinkedList<Opera>());
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (id ^ (id >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Artista other = (Artista) obj;
if (id != other.id)
return false;
return true;
}
public Artista(String nome, String cognome) {
setNome(nome);
setCognome(cognome);
setCreazioni(new LinkedList<Opera>());
}
@Id
@GeneratedValue (strategy = GenerationType.AUTO)
private Long id;
public Long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCognome() {
return cognome;
}
public void setCognome(String cognome) {
this.cognome = cognome;
}
public String getNazionalita() {
return nazionalita;
}
public void setNazionalita(String nazionalita) {
this.nazionalita = nazionalita;
}
public LocalDate getDataNascita() {
return dataNascita;
}
public void setDataNascita(LocalDate dataNascita) {
this.dataNascita = dataNascita;
}
public String getLuogoNascita() {
return luogoNascita;
}
public void setLuogoNascita(String luogoNascita) {
this.luogoNascita = luogoNascita;
}
public LocalDate getDataMorte() {
return dataMorte;
}
public void setDataMorte(LocalDate dataMorte) {
this.dataMorte = dataMorte;
}
public String getLuogoMorte() {
return luogoMorte;
}
public void setLuogoMorte(String luogoMorte) {
this.luogoMorte = luogoMorte;
}
public List<Opera> getCreazioni() {
return creazioni;
}
public void setCreazioni(List<Opera> creazioni) {
this.creazioni = creazioni;
}
@Column
private String nome;
@Column
private String cognome;
@Column
private String nazionalita;
@Column
private LocalDate dataNascita;
@Column
private String luogoNascita;
@Column(nullable = true)
private LocalDate dataMorte;
@Column(nullable = true)
private String luogoMorte;
@OneToMany (mappedBy = "creatore")
@Cascade(value=CascadeType.DELETE)
private List<Opera> creazioni;
}
| [
"Fgico@outlook.it"
] | Fgico@outlook.it |
e7ab0643ceab263db65caf7595ea9249141cdb59 | c37836a5a5269a0ed7b99dfc9874bf31addfe39f | /Data/weka-commit-2/weka-471488a008658075579d5ef6d2496d6fecc67550/weka/classifiers/trees/j48/C45Split.java | b9deb546b8e8664ef7a5cdd8534f76346449bc44 | [] | no_license | lijunyou/AST_Similarity_Detector | bef8621cb7282e09f5839341e2ab5a219a060cd6 | f21f51874d4c4fd8018fdf9010bc5d24c9e5442e | refs/heads/master | 2020-04-13T05:15:24.150922 | 2018-12-24T12:11:34 | 2018-12-24T12:11:34 | 162,986,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,185 | java | /*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* C45Split.java
* Copyright (C) 1999 Eibe Frank
*
*/
package weka.classifiers.trees.j48;
import java.util.*;
import weka.core.*;
/**
* Class implementing a C4.5-type split on an attribute.
*
* @author Eibe Frank (eibe@cs.waikato.ac.nz)
* @version $Revision: 1.8 $
*/
public class C45Split extends ClassifierSplitModel{
/** Desired number of branches. */
private int m_complexityIndex;
/** Attribute to split on. */
private int m_attIndex;
/** Minimum number of objects in a split. */
private int m_minNoObj;
/** Value of split point. */
private double m_splitPoint;
/** InfoGain of split. */
private double m_infoGain;
/** GainRatio of split. */
private double m_gainRatio;
/** The sum of the weights of the instances. */
private double m_sumOfWeights;
/** Number of split points. */
private int m_index;
/** Static reference to splitting criterion. */
private static InfoGainSplitCrit infoGainCrit = new InfoGainSplitCrit();
/** Static reference to splitting criterion. */
private static GainRatioSplitCrit gainRatioCrit = new GainRatioSplitCrit();
/**
* Initializes the split model.
*/
public C45Split(int attIndex,int minNoObj, double sumOfWeights) {
// Get index of attribute to split on.
m_attIndex = attIndex;
// Set minimum number of objects.
m_minNoObj = minNoObj;
// Set the sum of the weights
m_sumOfWeights = sumOfWeights;
}
/**
* Creates a C4.5-type split on the given data. Assumes that none of
* the class values is missing.
*
* @exception Exception if something goes wrong
*/
public void buildClassifier(Instances trainInstances)
throws Exception {
// Initialize the remaining instance variables.
m_numSubsets = 0;
m_splitPoint = Double.MAX_VALUE;
m_infoGain = 0;
m_gainRatio = 0;
// Different treatment for enumerated and numeric
// attributes.
if (trainInstances.attribute(m_attIndex).isNominal()) {
m_complexityIndex = trainInstances.attribute(m_attIndex).numValues();
m_index = m_complexityIndex;
handleEnumeratedAttribute(trainInstances);
}else{
m_complexityIndex = 2;
m_index = 0;
trainInstances.sort(trainInstances.attribute(m_attIndex));
handleNumericAttribute(trainInstances);
}
}
/**
* Returns index of attribute for which split was generated.
*/
public final int attIndex() {
return m_attIndex;
}
/**
* Gets class probability for instance.
*
* @exception Exception if something goes wrong
*/
public final double classProb(int classIndex,Instance instance,
int theSubset) throws Exception {
if (theSubset <= -1) {
double [] weights = weights(instance);
if (weights == null) {
return m_distribution.prob(classIndex);
} else {
double prob = 0;
for (int i = 0; i < weights.length; i++) {
prob += weights[i] * m_distribution.prob(classIndex, i);
}
return prob;
}
} else {
if (Utils.gr(m_distribution.perBag(theSubset), 0)) {
return m_distribution.prob(classIndex, theSubset);
} else {
return m_distribution.prob(classIndex);
}
}
}
/**
* Returns coding cost for split (used in rule learner).
*/
public final double codingCost() {
return Utils.log2(m_index);
}
/**
* Returns (C4.5-type) gain ratio for the generated split.
*/
public final double gainRatio() {
return m_gainRatio;
}
/**
* Creates split on enumerated attribute.
*
* @exception Exception if something goes wrong
*/
private void handleEnumeratedAttribute(Instances trainInstances)
throws Exception {
Instance instance;
m_distribution = new Distribution(m_complexityIndex,
trainInstances.numClasses());
// Only Instances with known values are relevant.
Enumeration enum = trainInstances.enumerateInstances();
while (enum.hasMoreElements()) {
instance = (Instance) enum.nextElement();
if (!instance.isMissing(m_attIndex))
m_distribution.add((int)instance.value(m_attIndex),instance);
}
// Check if minimum number of Instances in at least two
// subsets.
if (m_distribution.check(m_minNoObj)) {
m_numSubsets = m_complexityIndex;
m_infoGain = infoGainCrit.
splitCritValue(m_distribution,m_sumOfWeights);
m_gainRatio =
gainRatioCrit.splitCritValue(m_distribution,m_sumOfWeights,
m_infoGain);
}
}
/**
* Creates split on numeric attribute.
*
* @exception Exception if something goes wrong
*/
private void handleNumericAttribute(Instances trainInstances)
throws Exception {
int firstMiss;
int next = 1;
int last = 0;
int splitIndex = -1;
double currentInfoGain;
double defaultEnt;
double minSplit;
Instance instance;
int i;
// Current attribute is a numeric attribute.
m_distribution = new Distribution(2,trainInstances.numClasses());
// Only Instances with known values are relevant.
Enumeration enum = trainInstances.enumerateInstances();
i = 0;
while (enum.hasMoreElements()) {
instance = (Instance) enum.nextElement();
if (instance.isMissing(m_attIndex))
break;
m_distribution.add(1,instance);
i++;
}
firstMiss = i;
// Compute minimum number of Instances required in each
// subset.
minSplit = 0.1*(m_distribution.total())/
((double)trainInstances.numClasses());
if (Utils.smOrEq(minSplit,m_minNoObj))
minSplit = m_minNoObj;
else
if (Utils.gr(minSplit,25))
minSplit = 25;
// Enough Instances with known values?
if (Utils.sm((double)firstMiss,2*minSplit))
return;
// Compute values of criteria for all possible split
// indices.
defaultEnt = infoGainCrit.oldEnt(m_distribution);
while (next < firstMiss) {
if (trainInstances.instance(next-1).value(m_attIndex)+1e-5 <
trainInstances.instance(next).value(m_attIndex)) {
// Move class values for all Instances up to next
// possible split point.
m_distribution.shiftRange(1,0,trainInstances,last,next);
// Check if enough Instances in each subset and compute
// values for criteria.
if (Utils.grOrEq(m_distribution.perBag(0),minSplit) &&
Utils.grOrEq(m_distribution.perBag(1),minSplit)) {
currentInfoGain = infoGainCrit.
splitCritValue(m_distribution,m_sumOfWeights,
defaultEnt);
if (Utils.gr(currentInfoGain,m_infoGain)) {
m_infoGain = currentInfoGain;
splitIndex = next-1;
}
m_index++;
}
last = next;
}
next++;
}
// Was there any useful split?
if (m_index == 0)
return;
// Compute modified information gain for best split.
m_infoGain = m_infoGain-(Utils.log2(m_index)/m_sumOfWeights);
if (Utils.smOrEq(m_infoGain,0))
return;
// Set instance variables' values to values for
// best split.
m_numSubsets = 2;
m_splitPoint =
(trainInstances.instance(splitIndex+1).value(m_attIndex)+
trainInstances.instance(splitIndex).value(m_attIndex))/2;
// Restore distributioN for best split.
m_distribution = new Distribution(2,trainInstances.numClasses());
m_distribution.addRange(0,trainInstances,0,splitIndex+1);
m_distribution.addRange(1,trainInstances,splitIndex+1,firstMiss);
// Compute modified gain ratio for best split.
m_gainRatio = gainRatioCrit.
splitCritValue(m_distribution,m_sumOfWeights,
m_infoGain);
}
/**
* Returns (C4.5-type) information gain for the generated split.
*/
public final double infoGain() {
return m_infoGain;
}
/**
* Prints left side of condition..
*
* @param data training set.
*/
public final String leftSide(Instances data) {
return data.attribute(m_attIndex).name();
}
/**
* Prints the condition satisfied by instances in a subset.
*
* @param index of subset
* @param data training set.
*/
public final String rightSide(int index,Instances data) {
StringBuffer text;
text = new StringBuffer();
if (data.attribute(m_attIndex).isNominal())
text.append(" = "+
data.attribute(m_attIndex).value(index));
else
if (index == 0)
text.append(" <= "+
Utils.doubleToString(m_splitPoint,6));
else
text.append(" > "+
Utils.doubleToString(m_splitPoint,6));
return text.toString();
}
/**
* Returns a string containing java source code equivalent to the test
* made at this node. The instance being tested is called "i".
*
* @param index index of the nominal value tested
* @param data the data containing instance structure info
* @return a value of type 'String'
*/
public final String sourceExpression(int index, Instances data) {
StringBuffer expr = null;
if (index < 0) {
return "i[" + m_attIndex + "] == null";
}
if (data.attribute(m_attIndex).isNominal()) {
expr = new StringBuffer("i[");
expr.append(m_attIndex).append("]");
expr.append(".equals(\"").append(data.attribute(m_attIndex)
.value(index)).append("\")");
} else {
expr = new StringBuffer("((Double) i[");
expr.append(m_attIndex).append("])");
if (index == 0) {
expr.append(".doubleValue() <= ").append(m_splitPoint);
} else {
expr.append(".doubleValue() > ").append(m_splitPoint);
}
}
return expr.toString();
}
/**
* Sets split point to greatest value in given data smaller or equal to
* old split point.
* (C4.5 does this for some strange reason).
*/
public final void setSplitPoint(Instances allInstances) {
double newSplitPoint = -Double.MAX_VALUE;
double tempValue;
Instance instance;
if ((allInstances.attribute(m_attIndex).isNumeric()) &&
(m_numSubsets > 1)) {
Enumeration enum = allInstances.enumerateInstances();
while (enum.hasMoreElements()) {
instance = (Instance) enum.nextElement();
if (!instance.isMissing(m_attIndex)) {
tempValue = instance.value(m_attIndex);
if (Utils.gr(tempValue,newSplitPoint) &&
Utils.smOrEq(tempValue,m_splitPoint))
newSplitPoint = tempValue;
}
}
m_splitPoint = newSplitPoint;
}
}
/**
* Returns the minsAndMaxs of the index.th subset.
*/
public final double [][] minsAndMaxs(Instances data, double [][] minsAndMaxs,
int index) {
double [][] newMinsAndMaxs = new double[data.numAttributes()][2];
for (int i = 0; i < data.numAttributes(); i++) {
newMinsAndMaxs[i][0] = minsAndMaxs[i][0];
newMinsAndMaxs[i][1] = minsAndMaxs[i][1];
if (i == m_attIndex)
if (data.attribute(m_attIndex).isNominal())
newMinsAndMaxs[m_attIndex][1] = 1;
else
newMinsAndMaxs[m_attIndex][1-index] = m_splitPoint;
}
return newMinsAndMaxs;
}
/**
* Sets distribution associated with model.
*/
public void resetDistribution(Instances data) throws Exception {
Instances insts = new Instances(data, data.numInstances());
for (int i = 0; i < data.numInstances(); i++) {
if (whichSubset(data.instance(i)) > -1) {
insts.add(data.instance(i));
}
}
Distribution newD = new Distribution(insts, this);
newD.addInstWithUnknown(data, m_attIndex);
m_distribution = newD;
}
/**
* Returns weights if instance is assigned to more than one subset.
* Returns null if instance is only assigned to one subset.
*/
public final double [] weights(Instance instance) {
double [] weights;
int i;
if (instance.isMissing(m_attIndex)) {
weights = new double [m_numSubsets];
for (i=0;i<m_numSubsets;i++)
weights [i] = m_distribution.perBag(i)/m_distribution.total();
return weights;
}else{
return null;
}
}
/**
* Returns index of subset instance is assigned to.
* Returns -1 if instance is assigned to more than one subset.
*
* @exception Exception if something goes wrong
*/
public final int whichSubset(Instance instance)
throws Exception {
if (instance.isMissing(m_attIndex))
return -1;
else{
if (instance.attribute(m_attIndex).isNominal())
return (int)instance.value(m_attIndex);
else
if (Utils.smOrEq(instance.value(m_attIndex),m_splitPoint))
return 0;
else
return 1;
}
}
}
| [
"ljy_nju_1996@outlook.com"
] | ljy_nju_1996@outlook.com |
7fe73d002a3c29c835f4f5f7b01669d9ea3263e9 | d8bfc5ec1c965103e453989a0940100768b1ae46 | /app/src/main/java/com/anikinkirill/instgraph/BaseApplication.java | 18adc6a586f007fe4df69863a8a51903c2c453bb | [] | no_license | ANIKINKIRILL/InstGraph | 50807dec1dae41d5f3e79b13d8b9291622c1db1c | 9b52669ef00a932cf659ae122ea730284a106925 | refs/heads/master | 2020-06-09T05:22:05.085312 | 2019-06-24T18:22:01 | 2019-06-24T18:22:01 | 193,379,203 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package com.anikinkirill.instgraph;
import com.anikinkirill.instgraph.dependencyinjection.app.DaggerAppComponent;
import dagger.android.AndroidInjector;
import dagger.android.support.DaggerApplication;
public class BaseApplication extends DaggerApplication {
@Override
protected AndroidInjector<? extends DaggerApplication> applicationInjector() {
return DaggerAppComponent.builder().application(this).build();
}
}
| [
"ky.anikin@mail.ru"
] | ky.anikin@mail.ru |
40823133aa3076243b2d83690f51d083d7a6594e | 1e512ece5b7669771480fa8a4bb7c10eb4708e93 | /src/main/java/com/bricknbolt/web/rest/package-info.java | aa857cfb3e943df31e62d76f48674423d308c269 | [] | no_license | BulkSecurityGeneratorProject/bricknbolt | 778713e1abca6097a6ddb51f2355ce71dadd1294 | 30df57eb846e5f4448607d32628195ba73267919 | refs/heads/master | 2022-12-14T22:59:35.850330 | 2019-09-07T03:41:44 | 2019-09-07T03:41:44 | 296,565,539 | 0 | 0 | null | 2020-09-18T08:46:00 | 2020-09-18T08:45:59 | null | UTF-8 | Java | false | false | 73 | java | /**
* Spring MVC REST controllers.
*/
package com.bricknbolt.web.rest;
| [
"suman@flabbertech.com"
] | suman@flabbertech.com |
17906d17df78236ed0f762b5db4a88e6895cd3a1 | 869a721fd94c25b8ddf9459c9e445d4aa082eb4b | /src/main/java/com/jundongy/taskRecorder/TaskRecorderApplication.java | 50f7162aa6a909e74089002a8e3e3434d33e27bc | [] | no_license | Eustaceyi/Task-Recorder | 1fdc97b6f7f24af67cccf1bc6c215ba2742af5b5 | d1bd3a445a7055f24c461abbafe3908f96ac8ab7 | refs/heads/master | 2021-01-01T10:09:09.694700 | 2020-02-09T02:37:26 | 2020-02-09T02:37:26 | 239,232,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.jundongy.taskRecorder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TaskRecorderApplication {
public static void main(String[] args) {
SpringApplication.run(TaskRecorderApplication.class, args);
}
}
| [
"eustaceyi@gmail.com"
] | eustaceyi@gmail.com |
42849f894242f498edcb372e58ccfbc8481a89ec | 667ba854b3f884015ae5064527eea2afbc5e10d1 | /addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/appmanager/NavigationHelper.java | 930f5c8ce30217c03ac66f68d02d332f0da58441 | [
"Apache-2.0"
] | permissive | AlexKrukov/java_pft | e90b35e8c43df6a49df93be70b339eea1b654632 | 22e6efa7f6500562987b3a51eab9739b964da9b3 | refs/heads/master | 2020-03-19T10:50:34.659226 | 2018-07-26T02:19:46 | 2018-07-26T02:19:46 | 116,407,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package ru.stqa.pft.addressbook.appmanager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class NavigationHelper extends HelperBase {
public NavigationHelper(WebDriver wd) {
super(wd);
}
public void groupPage() {
if (isElementPresent(By.tagName("h1"))
&& wd.findElement(By.tagName("h1")).getText().equals("Groups")
&& isElementPresent(By.name("new"))) {
return;
}
click(By.linkText("groups"));
}
public void homePage() {
if (isElementPresent(By.id("maintable"))) {
return;
}
click(By.name("home"));
}
}
| [
"a_bot@github.com"
] | a_bot@github.com |
2353afc8c0e98f064cb91c2680b778cb7121b965 | 0a532b9d7ebc356ab684a094b3cf840b6b6a17cd | /java-source/src/main/javax/xml/transform/sax/SAXResult.java | f6f7e47c8c12a4a1142831731216ac9de924e20c | [
"Apache-2.0"
] | permissive | XWxiaowei/JavaCode | ac70d87cdb0dfc6b7468acf46c84565f9d198e74 | a7e7cd7a49c36db3ee479216728dd500eab9ebb2 | refs/heads/master | 2022-12-24T10:21:28.144227 | 2020-08-22T08:01:43 | 2020-08-22T08:01:43 | 98,070,624 | 10 | 4 | Apache-2.0 | 2022-12-16T04:23:38 | 2017-07-23T02:51:51 | Java | UTF-8 | Java | false | false | 3,509 | java | /*
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.xml.transform.sax;
import javax.xml.transform.Result;
import org.xml.sax.ContentHandler;
import org.xml.sax.ext.LexicalHandler;
/**
* <p>Acts as an holder for a transformation Result.</p>
*
* @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a>
*/
public class SAXResult implements Result {
/**
* If {@link javax.xml.transform.TransformerFactory#getFeature}
* returns true when passed this value as an argument,
* the Transformer supports Result output of this type.
*/
public static final String FEATURE =
"http://javax.xml.transform.sax.SAXResult/feature";
/**
* Zero-argument default constructor.
*/
public SAXResult() {
}
/**
* Create a SAXResult that targets a SAX2 {@link org.xml.sax.ContentHandler}.
*
* @param handler Must be a non-null ContentHandler reference.
*/
public SAXResult(ContentHandler handler) {
setHandler(handler);
}
/**
* Set the target to be a SAX2 {@link org.xml.sax.ContentHandler}.
*
* @param handler Must be a non-null ContentHandler reference.
*/
public void setHandler(ContentHandler handler) {
this.handler = handler;
}
/**
* Get the {@link org.xml.sax.ContentHandler} that is the Result.
*
* @return The ContentHandler that is to be transformation output.
*/
public ContentHandler getHandler() {
return handler;
}
/**
* Set the SAX2 {@link org.xml.sax.ext.LexicalHandler} for the output.
*
* <p>This is needed to handle XML comments and the like. If the
* lexical handler is not set, an attempt should be made by the
* transformer to cast the {@link org.xml.sax.ContentHandler} to a
* <code>LexicalHandler</code>.</p>
*
* @param handler A non-null <code>LexicalHandler</code> for
* handling lexical parse events.
*/
public void setLexicalHandler(LexicalHandler handler) {
this.lexhandler = handler;
}
/**
* Get a SAX2 {@link org.xml.sax.ext.LexicalHandler} for the output.
*
* @return A <code>LexicalHandler</code>, or null.
*/
public LexicalHandler getLexicalHandler() {
return lexhandler;
}
/**
* Method setSystemId Set the systemID that may be used in association
* with the {@link org.xml.sax.ContentHandler}.
*
* @param systemId The system identifier as a URI string.
*/
public void setSystemId(String systemId) {
this.systemId = systemId;
}
/**
* Get the system identifier that was set with setSystemId.
*
* @return The system identifier that was set with setSystemId, or null
* if setSystemId was not called.
*/
public String getSystemId() {
return systemId;
}
//////////////////////////////////////////////////////////////////////
// Internal state.
//////////////////////////////////////////////////////////////////////
/**
* The handler for parse events.
*/
private ContentHandler handler;
/**
* The handler for lexical events.
*/
private LexicalHandler lexhandler;
/**
* The systemID that may be used in association
* with the node.
*/
private String systemId;
}
| [
"2809641033@qq.com"
] | 2809641033@qq.com |
bf0a079a74b130f9301ecf216c2218a8f0bb677c | 0208dc692b4c1d7138142db2a280986de679ad78 | /src/main/java/com/fradou/nutrition/security/api/AuthenticationApiEntryPoint.java | 69a6f7218350e805824acd279ee16ed35cfad9c5 | [] | no_license | alexandrefradet/my-nutrition-api | 84e5268db1fa2303279c297a6c88bb1c0df10c82 | c0044a664fd2eaf37620a770c644e49279944ca5 | refs/heads/master | 2021-09-22T01:32:42.044870 | 2018-08-29T15:38:32 | 2018-08-29T15:38:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,471 | java | package com.fradou.nutrition.security.api;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fradou.nutrition.mvc.utils.work.ApiErrorMessage;
/**
* Custom entryPoint for api calls
*
* @author AF
*/
@Component
public class AuthenticationApiEntryPoint implements AuthenticationEntryPoint {
@Autowired
private ObjectMapper objectMapper;
@Override
public void commence(
HttpServletRequest request,
HttpServletResponse response,
AuthenticationException exception) throws IOException, ServletException {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
response.setStatus(HttpStatus.UNAUTHORIZED.value());
response.setCharacterEncoding(StandardCharsets.UTF_8.toString());
ApiErrorMessage errorMessage = new ApiErrorMessage(401, "Please authenticate.");
PrintWriter out = response.getWriter();
objectMapper.writeValue(out, errorMessage);
}
}
| [
"alex.fradet.1@gmail.com"
] | alex.fradet.1@gmail.com |
2054b0691e631d63a781f1c2465dd32bfae85f63 | 32c6f5340d3ae4d7968730858ead7691606819d4 | /Modul2/src/com/RiZe/Tugas/No1/Club.java | afded934d825e8843430b5a4ac2a2d48fccf34b6 | [] | no_license | IzaN32/Praktikum-PBO | bfda874712a0cc1d0295df66d515d50eba80f683 | 69682cac10bb642f13b0cce43cc0682e522dab04 | refs/heads/main | 2023-03-02T03:13:55.551477 | 2021-02-14T23:41:42 | 2021-02-14T23:41:42 | 305,392,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | package com.RiZe.Tugas.No1;
public class Club {
String Name;
int Since;
String Stadion;
int ChampUcl;
String Desc;
public Club() {
}
public Club(String name) {
this.Name = name;
}
public Club(String Name, String Desc) {
this.Name = Name;
this.Desc = Desc;
}
public Club(String Name, int Since, String stadion) {
this.Name = Name;
this.Since = Since;
this.Stadion = stadion;
}
public Club(String Name, int Since, String stadion, int ChampUcl, String Desc) {
this.Name = Name;
this.Since = Since;
this.Stadion = stadion;
this.ChampUcl = ChampUcl;
this.Desc = Desc;
}
public void getTeam(){
System.out.println("Nama Club\t\t: " + Name);
System.out.println("Tahun Berdiri\t: " + Since);
System.out.println("Nama Stadion\t: " + Stadion);
System.out.println("Juara UCL\t\t: " + ChampUcl);
System.out.println("Deskripsi Club\t: " + Desc);
}
} | [
"34876769+IzaN32@users.noreply.github.com"
] | 34876769+IzaN32@users.noreply.github.com |
3fc5b716b71af75537c5a510a9ae094e7d438e11 | 0571cc8af1f9c9db2aeaf28cb549c78c37b2242e | /codewithmosh/Stack/MinStack.java | 229d25da5965c105ea2a739f8a30b87d29c3fee7 | [] | no_license | caffeineGMT/Algorithm | 0e6346b5c4387763387fb03b51fcb0fece07d0fc | 0a3e4e99966d971249ad66a5c7637c1d82c8e0a1 | refs/heads/master | 2023-07-23T15:14:40.258481 | 2021-09-10T04:02:23 | 2021-09-10T04:02:23 | 291,360,315 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | import java.util.Stack;
// Design a stack that supports push, pop and retrieving the minimum value in constant time.
// Solution: https://www.youtube.com/watch?v=nGwn8_-6e7w
// Essentially it is saving the min state when pushing each item to the main stack. However, the space can be optimized if not pushing each state to minStack
public class MinStack {
private Stack<Integer> stack = new Stack<>();
private Stack<Integer> minStack = new Stack<>();
public void push(int value) {
stack.push(value);
if (minStack.empty() || value < minStack.peek())
minStack.push(value);
}
public int pop() {
var top = stack.pop();
if (top == minStack.peek())
minStack.pop();
return top;
}
public int min() {
return minStack.peek();
}
@Override
public String toString() {
return minStack.toString();
}
public static void main(String[] args) {
var test = new MinStack();
test.push(10);
test.push(20);
test.push(30);
test.push(8);
test.push(1);
test.pop();
// test.pop();
System.out.println(test.min());
System.out.println(test.toString());
}
} | [
"guomaitao@gmail.com"
] | guomaitao@gmail.com |
2bbdbee8a130ef1425068990461fbd585215ad2e | e0a7b472d831d49d321445bfb4c2364ec05a2c2f | /jbsrs/videogenapp/src/main/java/fr/istic/m2il/idm/videogenapp/service/MailService.java | 02bb116eaed1d762866ca40100fc3afc015a4f29 | [] | no_license | FAMILIAR-project/VideoGen2 | 4f3f5c7905abbe547493f345c708ddfee0b90cee | 9352cd08224c1dc9ea4d1a6f9b40d01d013ad005 | refs/heads/master | 2022-12-10T22:25:15.822814 | 2018-03-30T15:48:58 | 2018-03-30T15:48:58 | 108,225,846 | 2 | 30 | null | 2020-09-18T15:30:33 | 2017-10-25T05:53:59 | Java | UTF-8 | Java | false | false | 3,905 | java | package fr.istic.m2il.idm.videogenapp.service;
import fr.istic.m2il.idm.videogenapp.domain.User;
import io.github.jhipster.config.JHipsterProperties;
import org.apache.commons.lang3.CharEncoding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.MessageSource;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.mail.internet.MimeMessage;
import java.util.Locale;
/**
* Service for sending emails.
* <p>
* We use the @Async annotation to send emails asynchronously.
*/
@Service
public class MailService {
private final Logger log = LoggerFactory.getLogger(MailService.class);
private static final String USER = "user";
private static final String BASE_URL = "baseUrl";
private final JHipsterProperties jHipsterProperties;
private final JavaMailSender javaMailSender;
private final MessageSource messageSource;
private final SpringTemplateEngine templateEngine;
public MailService(JHipsterProperties jHipsterProperties, JavaMailSender javaMailSender,
MessageSource messageSource, SpringTemplateEngine templateEngine) {
this.jHipsterProperties = jHipsterProperties;
this.javaMailSender = javaMailSender;
this.messageSource = messageSource;
this.templateEngine = templateEngine;
}
@Async
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {
log.debug("Send email[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}",
isMultipart, isHtml, to, subject, content);
// Prepare message using a Spring helper
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
try {
MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
message.setTo(to);
message.setFrom(jHipsterProperties.getMail().getFrom());
message.setSubject(subject);
message.setText(content, isHtml);
javaMailSender.send(mimeMessage);
log.debug("Sent email to User '{}'", to);
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.warn("Email could not be sent to user '{}'", to, e);
} else {
log.warn("Email could not be sent to user '{}': {}", to, e.getMessage());
}
}
}
@Async
public void sendEmailFromTemplate(User user, String templateName, String titleKey) {
Locale locale = Locale.forLanguageTag(user.getLangKey());
Context context = new Context(locale);
context.setVariable(USER, user);
context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl());
String content = templateEngine.process(templateName, context);
String subject = messageSource.getMessage(titleKey, null, locale);
sendEmail(user.getEmail(), subject, content, false, true);
}
@Async
public void sendActivationEmail(User user) {
log.debug("Sending activation email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "activationEmail", "email.activation.title");
}
@Async
public void sendCreationEmail(User user) {
log.debug("Sending creation email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "creationEmail", "email.activation.title");
}
@Async
public void sendPasswordResetMail(User user) {
log.debug("Sending password reset email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "passwordResetEmail", "email.reset.title");
}
}
| [
"ramadansum@gmail.com"
] | ramadansum@gmail.com |
94bd500657d3311d5f71e462ff0c60728f9b3c4b | ddac29cfa4f36b7c1328f476e5278e914c117d6f | /tmc-langs-make/src/main/java/fi/helsinki/cs/tmc/langs/make/ValgrindParser.java | 65d089b64fd047ca3111eb678527a20eb85ce6f1 | [] | no_license | UMTesti/tmc-langs | 4d7358f7d41a4aecafdd2445862683cc98cc6015 | 9ece6e36e0ba639cd9c32767e3207235455af35f | refs/heads/master | 2020-12-25T08:37:57.560012 | 2015-08-27T09:07:30 | 2015-08-27T09:07:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,283 | java | package fi.helsinki.cs.tmc.langs.make;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ValgrindParser {
private static final String VALGRIND_PID_WARNING
= "Valgrind output has more PIDs than the expected (# of test cases + 1).";
private static final String VALGRIND_ERROR_SUMMARY_PATTERN =
"==[0-9]+== ERROR SUMMARY: ([0-9]+)";
private static final String LINUX_VALGRIND_WARNING = "Please install valgrind. "
+ "For Debian-based distributions, run `sudo apt-get install valgrind`.";
private static final String OSX_VALGRIND_WARNING =
"Please install valgrind. For OS X we recommend using homebrew"
+ "(http://mxcl.github.com/homebrew/) and `brew install valgrind`.";
private static final String WINDOWS_VALGRIND_WARNING = "Windows doesn't support valgrind yet.";
private static final String OTHER_VALGRIND_WARNING = "Please install valgrind if possible.";
private static final String NO_VALGRIND_MESSAGE =
"Warning, valgrind not available - unable to run local memory tests\n";
private static final String VALGRIND_SUBMIT_MESSAGE = "\nYou may also submit the exercise "
+ "to the server to have it memory-tested.";
private static final String CANT_PARSE_PID = "Couldn't parse PID from Valgrind log";
private Path output;
private Logger log = LoggerFactory.getLogger(ValgrindParser.class);
public ValgrindParser(Path output) {
this.output = output;
}
/**
* Adds valgrinds outputs to test cases.
*/
public void addOutputs(List<CTestCase> tests) {
if (output != null) {
try {
addValgrindOutput(tests);
} catch (IOException e) {
log.error(e.toString());
}
} else {
addWarningToValgrindOutput(tests);
}
}
private void addWarningToValgrindOutput(List<CTestCase> tests) {
String message;
String platform = System.getProperty("os.name").toLowerCase();
if (platform.contains("linux")) {
message = LINUX_VALGRIND_WARNING;
} else if (platform.contains("mac")) {
message = OSX_VALGRIND_WARNING;
} else if (platform.contains("windows")) {
message = WINDOWS_VALGRIND_WARNING;
} else {
message = OTHER_VALGRIND_WARNING;
}
for (CTestCase test : tests) {
test.setValgrindTrace(NO_VALGRIND_MESSAGE + message + VALGRIND_SUBMIT_MESSAGE);
}
}
private void addValgrindOutput(List<CTestCase> tests) throws IOException {
Scanner scanner = new Scanner(output, "UTF-8");
// Contains total amount of memory used and such things.
// Useful if we later want to add support for testing memory usage
String parentOutput = "";
String[] outputs = new String[tests.size()];
int[] pids = new int[tests.size()];
int[] errors = new int[tests.size()];
for (int i = 0; i < outputs.length; i++) {
outputs[i] = "";
}
Pattern errorPattern = Pattern.compile(VALGRIND_ERROR_SUMMARY_PATTERN);
String line = scanner.nextLine();
int firstPid = parsePid(line);
parentOutput += "\n" + line;
boolean warningLogged = false;
while (scanner.hasNextLine()) {
line = scanner.nextLine();
int pid = parsePid(line);
if (pid == -1) {
continue;
}
if (pid == firstPid) {
parentOutput += "\n" + line;
} else {
int outputIndex = findIndex(pid, pids);
if (outputIndex == -1) {
if (!warningLogged) {
log.warn(VALGRIND_PID_WARNING);
warningLogged = true;
}
continue;
}
outputs[outputIndex] += "\n" + line;
Matcher matcher = errorPattern.matcher(line);
if (matcher.find()) {
errors[outputIndex] = Integer.parseInt(matcher.group(1));
}
}
}
scanner.close();
for (int i = 0; i < outputs.length; i++) {
if (errors[i] == 0) {
// Workaround for a bug where any valgrind output is considered a potential error.
outputs[i] = null;
}
tests.get(i).setValgrindTrace(outputs[i]);
}
}
private int findIndex(int pid, int[] pids) {
for (int i = 0; i < pids.length; i++) {
if (pids[i] == pid) {
return i;
}
if (pids[i] == 0) {
pids[i] = pid;
return i;
}
}
return -1;
}
private int parsePid(String line) {
try {
return Integer.parseInt(line.split(" ")[0].replaceAll("(==|--)", ""));
} catch (Exception e) {
log.error(CANT_PARSE_PID);
return -1;
}
}
}
| [
"messionyk@gmail.com"
] | messionyk@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.