blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f6b390581953f98307c711800895678b2c266f2d | 3adddc59151b8bbdfd8f8c3904737db9e0dea900 | /src/main/java/com/vn/osp/notarialservices/user/dto/User.java | 40ee0976eff1658427b630c2b428698308e9347f | [] | no_license | TieuTruc14/uchi_v3_tccc_api | e3dca8fcdc88ee9ef37f6c4ca6d2e7037fc492af | 27b88b78a72f6addf30bef911892d31d3a7dbf73 | refs/heads/master | 2020-03-31T13:19:29.952367 | 2018-10-09T12:56:40 | 2018-10-09T12:56:40 | 152,250,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,457 | java | package com.vn.osp.notarialservices.user.dto;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.vn.osp.notarialservices.common.dto.BaseEntityBeans;
/**
* Created by longtran on 20/10/2016.
*/
@XStreamAlias("User")
public class User extends BaseEntityBeans {
private Long id;
private Long office_id;
private String family_name;
private String first_name;
private String account;
private String password;
private Long sex;
private Long active_flg;
private Long active_ccv;
private Long hidden_flg;
private String role;
private String birthday;
private String telephone;
private String mobile;
private String email;
private String address;
private String last_login_date;
private Long entry_user_id;
private String entry_user_name;
private String entry_date_time;
private Long update_user_id;
private String update_user_name;
private String update_date_time;
private String file_path;
private String file_name;
public User() {
}
@JsonCreator
public User(
@JsonProperty(value = "userId", required = false) final Long id,
@JsonProperty(value = "office_id", required = false) final Long office_id,
@JsonProperty(value = "family_name", required = false) final String family_name,
@JsonProperty(value = "first_name", required = false) final String first_name,
@JsonProperty(value = "account", required = false) final String account,
@JsonProperty(value = "password", required = false) final String password,
@JsonProperty(value = "sex", required = false) final Long sex,
@JsonProperty(value = "active_flg", required = false) final Long active_flg,
@JsonProperty(value = "active_ccv", required = false) final Long active_ccv,
@JsonProperty(value = "hidden_flg", required = false) final Long hidden_flg,
@JsonProperty(value = "role", required = false) final String role,
@JsonProperty(value = "birthday", required = false) final String birthday,
@JsonProperty(value = "telephone", required = false) final String telephone,
@JsonProperty(value = "mobile", required = false) final String mobile,
@JsonProperty(value = "email", required = false) final String email,
@JsonProperty(value = "address", required = false) final String address,
@JsonProperty(value = "last_login_date", required = false) final String last_login_date,
@JsonProperty(value = "entry_user_id", required = false) final Long entry_user_id,
@JsonProperty(value = "entry_user_name", required = false) final String entry_user_name,
@JsonProperty(value = "entry_date_time", required = false) final String entry_date_time,
@JsonProperty(value = "update_user_id", required = false) final Long update_user_id,
@JsonProperty(value = "update_user_name", required = false) final String update_user_name,
@JsonProperty(value = "update_date_time", required = false) final String update_date_time,
@JsonProperty(value = "file_path", required = false) final String file_path,
@JsonProperty(value = "file_name", required = false) final String file_name) {
this.id = id;
this.office_id = office_id;
this.family_name = family_name;
this.first_name = first_name;
this.account = account;
this.password = password;
this.sex = sex;
this.active_flg = active_flg;
this.active_ccv = active_ccv;
this.hidden_flg = hidden_flg;
this.role = role;
this.birthday = birthday;
this.telephone = telephone;
this.mobile = mobile;
this.email = email;
this.address = address;
this.last_login_date = last_login_date;
this.entry_user_id = entry_user_id;
this.entry_user_name = entry_user_name;
this.entry_date_time = entry_date_time;
this.update_user_id = update_user_id;
this.update_user_name = update_user_name;
this.update_date_time = update_date_time;
this.file_name = file_name;
this.file_path = file_path;
}
public Long getActive_ccv() {
return active_ccv;
}
public void setActive_ccv(Long active_ccv) {
this.active_ccv = active_ccv;
}
public Long getUserId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getOffice_id() {
return office_id;
}
public void setOffice_id(Long office_id) {
this.office_id = office_id;
}
public String getFamily_name() {
return family_name;
}
public void setFamily_name(String family_name) {
this.family_name = family_name;
}
public String getFirst_name() {
return first_name;
}
public void setFirst_name(String first_name) {
this.first_name = first_name;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Long getSex() {
return sex;
}
public void setSex(Long sex) {
this.sex = sex;
}
public Long getActive_flg() {
return active_flg;
}
public void setActive_flg(Long active_flg) {
this.active_flg = active_flg;
}
public Long getHidden_flg() {
return hidden_flg;
}
public void setHidden_flg(Long hidden_flg) {
this.hidden_flg = hidden_flg;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getLast_login_date() {
return last_login_date;
}
public void setLast_login_date(String last_login_date) {
this.last_login_date = last_login_date;
}
public Long getEntry_user_id() {
return entry_user_id;
}
public void setEntry_user_id(Long entry_user_id) {
this.entry_user_id = entry_user_id;
}
public String getEntry_user_name() {
return entry_user_name;
}
public void setEntry_user_name(String entry_user_name) {
this.entry_user_name = entry_user_name;
}
public String getEntry_date_time() {
return entry_date_time;
}
public void setEntry_date_time(String entry_date_time) {
this.entry_date_time = entry_date_time;
}
public Long getUpdate_user_id() {
return update_user_id;
}
public void setUpdate_user_id(Long update_user_id) {
this.update_user_id = update_user_id;
}
public String getUpdate_user_name() {
return update_user_name;
}
public void setUpdate_user_name(String update_user_name) {
this.update_user_name = update_user_name;
}
public String getUpdate_date_time() {
return update_date_time;
}
public void setUpdate_date_time(String update_date_time) {
this.update_date_time = update_date_time;
}
public String getFile_path() {
return file_path;
}
public void setFile_path(String file_path) {
this.file_path = file_path;
}
public String getFile_name() {
return file_name;
}
public void setFile_name(String file_name) {
this.file_name = file_name;
}
}
| [
"manh.phamtien142@gmail.com"
] | manh.phamtien142@gmail.com |
c1693d74331a937d601f8736c75f3a64bee500fe | aa06bdccac49af8d235306f511a93d038afeb635 | /CarsokAPI-login/src/main/java/com/uton/carsokApi/service/ICarsokCarTofrontOrderService.java | 4d47f555b287e10e0d83f35e2c81aa58d52e6b45 | [] | no_license | MiracleWhy/TEST | bb37580b5f5b9776ee8263dc184be89a1eccf053 | d4f812d2d41af62a9ca0f76d5290d57d79a8404d | refs/heads/master | 2020-03-19T05:48:20.726233 | 2018-06-04T04:18:43 | 2018-06-04T04:18:43 | 135,963,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | java | package com.uton.carsokApi.service;
import com.baomidou.mybatisplus.service.IService;
import com.uton.carsokApi.controller.request.CarTofrontPrepayRequest;
import com.uton.carsokApi.model.CarsokCarTofrontOrder;
import java.util.Map;
import java.util.SortedMap;
/**
* <p>
* 服务类
* </p>
*
* @author csw
* @since 2018-01-17
*/
public interface ICarsokCarTofrontOrderService extends IService<CarsokCarTofrontOrder> {
SortedMap<String,String> prepay(CarTofrontPrepayRequest c);
boolean notify(Map map);
}
| [
"402839788@qq.com"
] | 402839788@qq.com |
044eb36a0001a09496686847d00b3e94d36e20fd | 17e8438486cb3e3073966ca2c14956d3ba9209ea | /dso/branches/dirtyread/code/base/dso-l2/tests.unit/com/tc/objectserver/tx/ServerTransactionManagerImplTest.java | a87da79fc29901205e7649203ea62071923fb20d | [] | no_license | sirinath/Terracotta | fedfc2c4f0f06c990f94b8b6c3b9c93293334345 | 00a7662b9cf530dfdb43f2dd821fa559e998c892 | refs/heads/master | 2021-01-23T05:41:52.414211 | 2015-07-02T15:21:54 | 2015-07-02T15:21:54 | 38,613,711 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,796 | java | /*
* All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright
* notice. All rights reserved.
*/
package com.tc.objectserver.tx;
import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
import com.tc.exception.ImplementMe;
import com.tc.exception.TCRuntimeException;
import com.tc.net.ClientID;
import com.tc.net.NodeID;
import com.tc.net.protocol.tcm.ChannelID;
import com.tc.net.protocol.tcm.MessageChannel;
import com.tc.object.ObjectID;
import com.tc.object.dmi.DmiDescriptor;
import com.tc.object.dna.impl.ObjectStringSerializer;
import com.tc.object.lockmanager.api.LockID;
import com.tc.object.net.ChannelStats;
import com.tc.object.tx.ServerTransactionID;
import com.tc.object.tx.TransactionID;
import com.tc.object.tx.TxnBatchID;
import com.tc.object.tx.TxnType;
import com.tc.objectserver.api.ObjectInstanceMonitor;
import com.tc.objectserver.gtx.TestGlobalTransactionManager;
import com.tc.objectserver.impl.ObjectInstanceMonitorImpl;
import com.tc.objectserver.impl.TestObjectManager;
import com.tc.objectserver.l1.api.TestClientStateManager;
import com.tc.objectserver.l1.impl.TransactionAcknowledgeAction;
import com.tc.objectserver.lockmanager.api.TestLockManager;
import com.tc.objectserver.managedobject.BackReferences;
import com.tc.objectserver.persistence.impl.NullPersistenceTransactionProvider;
import com.tc.objectserver.persistence.impl.TestTransactionStore;
import com.tc.stats.counter.Counter;
import com.tc.stats.counter.CounterImpl;
import com.tc.util.SequenceID;
import com.tc.util.concurrent.NoExceptionLinkedQueue;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import junit.framework.TestCase;
public class ServerTransactionManagerImplTest extends TestCase {
private ServerTransactionManagerImpl transactionManager;
private TestTransactionAcknowledgeAction action;
private TestClientStateManager clientStateManager;
private TestLockManager lockManager;
private TestObjectManager objectManager;
private TestTransactionStore transactionStore;
private Counter transactionRateCounter;
private TestChannelStats channelStats;
private TestGlobalTransactionManager gtxm;
private ObjectInstanceMonitor imo;
private NullPersistenceTransactionProvider ptxp;
protected void setUp() throws Exception {
super.setUp();
this.action = new TestTransactionAcknowledgeAction();
this.clientStateManager = new TestClientStateManager();
this.lockManager = new TestLockManager();
this.objectManager = new TestObjectManager();
this.transactionStore = new TestTransactionStore();
this.transactionRateCounter = new CounterImpl();
this.channelStats = new TestChannelStats();
this.gtxm = new TestGlobalTransactionManager();
this.imo = new ObjectInstanceMonitorImpl();
newTransactionManager();
this.ptxp = new NullPersistenceTransactionProvider();
}
protected void tearDown() throws Exception {
super.tearDown();
}
private void newTransactionManager() {
this.transactionManager = new ServerTransactionManagerImpl(this.gtxm, this.transactionStore, this.lockManager,
this.clientStateManager, this.objectManager,
new NullTransactionalObjectManager(), this.action,
this.transactionRateCounter, this.channelStats,
new ServerTransactionManagerConfig());
this.transactionManager.goToActiveMode();
this.transactionManager.start(Collections.EMPTY_SET);
}
public void testRootCreatedEvent() {
Map roots = new HashMap();
roots.put("root", new ObjectID(1));
// first test w/o any listeners attached
this.transactionManager.commit(ptxp, Collections.EMPTY_SET, roots, Collections.EMPTY_LIST);
// add a listener
Listener listener = new Listener();
this.transactionManager.addRootListener(listener);
roots.clear();
roots.put("root2", new ObjectID(2));
this.transactionManager.commit(ptxp, Collections.EMPTY_SET, roots, Collections.EMPTY_LIST);
assertEquals(1, listener.rootsCreated.size());
Root root = (Root) listener.rootsCreated.remove(0);
assertEquals("root2", root.name);
assertEquals(new ObjectID(2), root.id);
// add another listener
Listener listener2 = new Listener();
this.transactionManager.addRootListener(listener2);
roots.clear();
roots.put("root3", new ObjectID(3));
this.transactionManager.commit(ptxp, Collections.EMPTY_SET, roots, Collections.EMPTY_LIST);
assertEquals(1, listener.rootsCreated.size());
root = (Root) listener.rootsCreated.remove(0);
assertEquals("root3", root.name);
assertEquals(new ObjectID(3), root.id);
root = (Root) listener2.rootsCreated.remove(0);
assertEquals("root3", root.name);
assertEquals(new ObjectID(3), root.id);
// add a listener that throws an exception
this.transactionManager.addRootListener(new ServerTransactionManagerEventListener() {
public void rootCreated(String name, ObjectID id) {
throw new RuntimeException("This exception is supposed to be here");
}
});
this.transactionManager.commit(ptxp, Collections.EMPTY_SET, roots, Collections.EMPTY_LIST);
}
public void testAddAndRemoveTransactionListeners() throws Exception {
TestServerTransactionListener l1 = new TestServerTransactionListener();
TestServerTransactionListener l2 = new TestServerTransactionListener();
transactionManager.addTransactionListener(l1);
transactionManager.addTransactionListener(l2);
Set txns = new HashSet();
ClientID cid1 = new ClientID(new ChannelID(1));
List dnas = Collections.unmodifiableList(new LinkedList());
ObjectStringSerializer serializer = null;
Map newRoots = Collections.unmodifiableMap(new HashMap());
TxnType txnType = TxnType.NORMAL;
HashSet tids = new HashSet();
for (int i = 0; i < 10; i++) {
TransactionID tid1 = new TransactionID(i);
SequenceID sequenceID = new SequenceID(i);
LockID[] lockIDs = new LockID[0];
ServerTransaction tx = new ServerTransactionImpl(gtxm, new TxnBatchID(1), tid1, sequenceID, lockIDs, cid1, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
txns.add(tx);
tids.add(tx.getServerTransactionID());
}
doStages(cid1, txns, false);
// check for events
Object o[] = (Object[]) l1.incomingContext.take();
assertNotNull(o);
o = (Object[]) l2.incomingContext.take();
assertNotNull(o);
for (int i = 0; i < 10; i++) {
ServerTransactionID tid1 = (ServerTransactionID) l1.appliedContext.take();
ServerTransactionID tid2 = (ServerTransactionID) l2.appliedContext.take();
assertEquals(tid1, tid2);
// System.err.println("tid1 = " + tid1 + " tid2 = " + tid2 + " tids = " + tids);
assertTrue(tids.contains(tid1));
tid1 = (ServerTransactionID) l1.completedContext.take();
tid2 = (ServerTransactionID) l2.completedContext.take();
assertEquals(tid1, tid2);
assertTrue(tids.contains(tid1));
}
// No more events
o = (Object[]) l1.incomingContext.poll(2000);
assertNull(o);
o = (Object[]) l2.incomingContext.poll(2000);
assertNull(o);
ServerTransactionID tid = (ServerTransactionID) l1.appliedContext.poll(2000);
assertNull(tid);
tid = (ServerTransactionID) l2.appliedContext.poll(2000);
assertNull(tid);
tid = (ServerTransactionID) l1.completedContext.poll(2000);
assertNull(tid);
tid = (ServerTransactionID) l2.completedContext.poll(2000);
assertNull(tid);
// unregister one
transactionManager.removeTransactionListener(l2);
// more txn
tids.clear();
txns.clear();
for (int i = 10; i < 20; i++) {
TransactionID tid1 = new TransactionID(i);
SequenceID sequenceID = new SequenceID(i);
LockID[] lockIDs = new LockID[0];
ServerTransaction tx = new ServerTransactionImpl(gtxm, new TxnBatchID(2), tid1, sequenceID, lockIDs, cid1, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
txns.add(tx);
tids.add(tx.getServerTransactionID());
}
doStages(cid1, txns, false);
// Events to only l1
o = (Object[]) l1.incomingContext.take();
assertNotNull(o);
o = (Object[]) l2.incomingContext.poll(2000);
assertNull(o);
for (int i = 0; i < 10; i++) {
ServerTransactionID tid1 = (ServerTransactionID) l1.appliedContext.take();
ServerTransactionID tid2 = (ServerTransactionID) l2.appliedContext.poll(1000);
assertNotNull(tid1);
assertNull(tid2);
assertTrue(tids.contains(tid1));
tid1 = (ServerTransactionID) l1.completedContext.take();
tid2 = (ServerTransactionID) l2.completedContext.poll(1000);
assertNotNull(tid1);
assertNull(tid2);
assertTrue(tids.contains(tid1));
}
}
/**
* A transaction is broadcasted to another client, the orginating client disconnects and then the broadcasted client
* disconnects. This test was written to illustrate a scenario where when multiple clients were disconnecting, were
* acks are being waited for, a concurrent modification exception was thrown.
*/
public void test2ClientsDisconnectAtTheSameTime() throws Exception {
ClientID cid1 = new ClientID(new ChannelID(1));
TransactionID tid1 = new TransactionID(1);
TransactionID tid2 = new TransactionID(2);
TransactionID tid3 = new TransactionID(3);
ClientID cid2 = new ClientID(new ChannelID(2));
ClientID cid3 = new ClientID(new ChannelID(3));
ClientID cid4 = new ClientID(new ChannelID(4));
ClientID cid5 = new ClientID(new ChannelID(5));
LockID[] lockIDs = new LockID[0];
List dnas = Collections.unmodifiableList(new LinkedList());
ObjectStringSerializer serializer = null;
Map newRoots = Collections.unmodifiableMap(new HashMap());
TxnType txnType = TxnType.NORMAL;
SequenceID sequenceID = new SequenceID(1);
ServerTransaction tx1 = new ServerTransactionImpl(gtxm, new TxnBatchID(1), tid1, sequenceID, lockIDs, cid1, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
Set txns = new HashSet();
txns.add(tx1);
Set txnIDs = new HashSet();
txnIDs.add(new ServerTransactionID(cid1, tid1));
transactionManager.incomingTransactions(cid1, txnIDs, txns, false);
transactionManager.addWaitingForAcknowledgement(cid1, tid1, cid2);
transactionManager.addWaitingForAcknowledgement(cid1, tid1, cid3);
transactionManager.addWaitingForAcknowledgement(cid1, tid1, cid4);
transactionManager.addWaitingForAcknowledgement(cid1, tid1, cid5);
doStages(cid1, txns, true);
// Adding a few more transactions to that Transaction Records are created for everybody
txns.clear();
txnIDs.clear();
ServerTransaction tx2 = new ServerTransactionImpl(gtxm, new TxnBatchID(2), tid2, sequenceID, lockIDs, cid2, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
txns.add(tx2);
txnIDs.add(new ServerTransactionID(cid2, tid2));
transactionManager.incomingTransactions(cid2, txnIDs, txns, false);
transactionManager.acknowledgement(cid2, tid2, cid3);
doStages(cid2, txns, true);
txns.clear();
txnIDs.clear();
ServerTransaction tx3 = new ServerTransactionImpl(gtxm, new TxnBatchID(2), tid3, sequenceID, lockIDs, cid3, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
txns.add(tx3);
txnIDs.add(new ServerTransactionID(cid3, tid3));
transactionManager.incomingTransactions(cid3, txnIDs, txns, false);
transactionManager.acknowledgement(cid3, tid3, cid4);
transactionManager.acknowledgement(cid3, tid3, cid2);
doStages(cid2, txns, true);
assertTrue(transactionManager.isWaiting(cid1, tid1));
transactionManager.acknowledgement(cid1, tid1, cid3);
assertTrue(transactionManager.isWaiting(cid1, tid1));
transactionManager.acknowledgement(cid1, tid1, cid4);
assertTrue(transactionManager.isWaiting(cid1, tid1));
transactionManager.acknowledgement(cid1, tid1, cid5);
assertTrue(transactionManager.isWaiting(cid1, tid1));
// Client 1 disconnects
transactionManager.shutdownNode(cid1);
// Still waiting for tx1
assertTrue(transactionManager.isWaiting(cid1, tid1));
// Client 2 disconnects now
// Concurrent Modification exception used to be thrown here.
transactionManager.shutdownNode(cid2);
// Not waiting for tx1 anymore
assertFalse(transactionManager.isWaiting(cid1, tid1));
// Client 3 disconnects now
// Concurrent Modification exception used to be thrown here.
transactionManager.shutdownNode(cid2);
}
public void tests() throws Exception {
ClientID cid1 = new ClientID(new ChannelID(1));
TransactionID tid1 = new TransactionID(1);
TransactionID tid2 = new TransactionID(2);
TransactionID tid3 = new TransactionID(3);
TransactionID tid4 = new TransactionID(4);
TransactionID tid5 = new TransactionID(5);
TransactionID tid6 = new TransactionID(6);
ClientID cid2 = new ClientID(new ChannelID(2));
ClientID cid3 = new ClientID(new ChannelID(3));
LockID[] lockIDs = new LockID[0];
List dnas = Collections.unmodifiableList(new LinkedList());
ObjectStringSerializer serializer = null;
Map newRoots = Collections.unmodifiableMap(new HashMap());
TxnType txnType = TxnType.NORMAL;
SequenceID sequenceID = new SequenceID(1);
ServerTransaction tx1 = new ServerTransactionImpl(gtxm, new TxnBatchID(1), tid1, sequenceID, lockIDs, cid1, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
// Test with one waiter
Set txns = new HashSet();
txns.add(tx1);
Set txnIDs = new HashSet();
txnIDs.add(new ServerTransactionID(cid1, tid1));
transactionManager.incomingTransactions(cid1, txnIDs, txns, false);
transactionManager.addWaitingForAcknowledgement(cid1, tid1, cid2);
assertTrue(transactionManager.isWaiting(cid1, tid1));
assertTrue(action.clientID == null && action.txID == null);
transactionManager.acknowledgement(cid1, tid1, cid2);
assertTrue(action.clientID == null && action.txID == null);
doStages(cid1, txns);
assertTrue(action.clientID == cid1 && action.txID == tid1);
assertFalse(transactionManager.isWaiting(cid1, tid1));
// Test with 2 waiters
action.clear();
gtxm.clear();
txns.clear();
txnIDs.clear();
sequenceID = new SequenceID(2);
ServerTransaction tx2 = new ServerTransactionImpl(gtxm, new TxnBatchID(2), tid2, sequenceID, lockIDs, cid1, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
txns.add(tx2);
txnIDs.add(new ServerTransactionID(cid1, tid2));
transactionManager.incomingTransactions(cid1, txnIDs, txns, false);
transactionManager.addWaitingForAcknowledgement(cid1, tid2, cid2);
transactionManager.addWaitingForAcknowledgement(cid1, tid2, cid3);
assertTrue(action.clientID == null && action.txID == null);
assertTrue(transactionManager.isWaiting(cid1, tid2));
transactionManager.acknowledgement(cid1, tid2, cid2);
assertTrue(action.clientID == null && action.txID == null);
assertTrue(transactionManager.isWaiting(cid1, tid2));
transactionManager.acknowledgement(cid1, tid2, cid3);
assertTrue(action.clientID == null && action.txID == null);
doStages(cid1, txns);
assertTrue(action.clientID == cid1 && action.txID == tid2);
assertFalse(transactionManager.isWaiting(cid1, tid2));
// Test shutdown client with 2 waiters
action.clear();
gtxm.clear();
txns.clear();
txnIDs.clear();
sequenceID = new SequenceID(3);
ServerTransaction tx3 = new ServerTransactionImpl(gtxm, new TxnBatchID(3), tid3, sequenceID, lockIDs, cid1, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
txns.add(tx3);
txnIDs.add(new ServerTransactionID(cid1, tid3));
transactionManager.incomingTransactions(cid1, txnIDs, txns, false);
transactionManager.addWaitingForAcknowledgement(cid1, tid3, cid2);
transactionManager.addWaitingForAcknowledgement(cid1, tid3, cid3);
assertTrue(action.clientID == null && action.txID == null);
assertTrue(transactionManager.isWaiting(cid1, tid3));
transactionManager.shutdownNode(cid3);
assertEquals(cid3, this.clientStateManager.shutdownClient);
assertTrue(transactionManager.isWaiting(cid1, tid3));
transactionManager.acknowledgement(cid1, tid3, cid2);
doStages(cid1, txns);
assertTrue(action.clientID == cid1 && action.txID == tid3);
assertFalse(transactionManager.isWaiting(cid1, tid3));
// Test shutdown client that no one is waiting for
action.clear();
gtxm.clear();
txns.clear();
txnIDs.clear();
clientStateManager.shutdownClient = null;
sequenceID = new SequenceID(4);
ServerTransaction tx4 = new ServerTransactionImpl(gtxm, new TxnBatchID(4), tid4, sequenceID, lockIDs, cid1, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
txns.add(tx4);
txnIDs.add(new ServerTransactionID(cid1, tid4));
transactionManager.incomingTransactions(cid1, txnIDs, txns, false);
transactionManager.addWaitingForAcknowledgement(cid1, tid4, cid2);
transactionManager.addWaitingForAcknowledgement(cid1, tid4, cid3);
transactionManager.shutdownNode(cid1);
assertTrue(action.clientID == null && action.txID == null);
// It should still be waiting, since we only do cleans ups on completion of all transactions.
assertNull(clientStateManager.shutdownClient);
assertTrue(transactionManager.isWaiting(cid1, tid4));
// adding new transactions should throw an error
boolean failed = false;
try {
transactionManager.incomingTransactions(cid1, txnIDs, txns, false);
failed = true;
} catch (Throwable t) {
// failed as expected.
}
if (failed) {
//
throw new Exception("Calling incomingTransaction after client shutdown didnt throw an error as excepted!!! ;(");
}
transactionManager.acknowledgement(cid1, tid4, cid2);
assertTrue(transactionManager.isWaiting(cid1, tid4));
transactionManager.acknowledgement(cid1, tid4, cid3);
assertFalse(transactionManager.isWaiting(cid1, tid4));
// shutdown is not called yet since apply commit and broadcast need to complete.
assertNull(clientStateManager.shutdownClient);
List serverTids = new ArrayList();
serverTids.add(new ServerTransactionID(cid1, tid4));
transactionManager.commit(ptxp, Collections.EMPTY_SET, Collections.EMPTY_MAP, serverTids);
assertNull(clientStateManager.shutdownClient);
transactionManager.broadcasted(cid1, tid4);
assertEquals(cid1, clientStateManager.shutdownClient);
// Test with 2 waiters on different tx's
action.clear();
gtxm.clear();
txns.clear();
txnIDs.clear();
sequenceID = new SequenceID(5);
ServerTransaction tx5 = new ServerTransactionImpl(gtxm, new TxnBatchID(5), tid5, sequenceID, lockIDs, cid1, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
sequenceID = new SequenceID(6);
ServerTransaction tx6 = new ServerTransactionImpl(gtxm, new TxnBatchID(5), tid6, sequenceID, lockIDs, cid1, dnas,
serializer, newRoots, txnType, new LinkedList(),
DmiDescriptor.EMPTY_ARRAY, 1);
txns.add(tx5);
txns.add(tx6);
txnIDs.add(new ServerTransactionID(cid1, tid5));
txnIDs.add(new ServerTransactionID(cid1, tid6));
transactionManager.incomingTransactions(cid1, txnIDs, txns, false);
transactionManager.addWaitingForAcknowledgement(cid1, tid5, cid2);
transactionManager.addWaitingForAcknowledgement(cid1, tid6, cid2);
assertTrue(action.clientID == null && action.txID == null);
assertTrue(transactionManager.isWaiting(cid1, tid5));
assertTrue(transactionManager.isWaiting(cid1, tid6));
transactionManager.acknowledgement(cid1, tid5, cid2);
assertFalse(transactionManager.isWaiting(cid1, tid5));
assertTrue(transactionManager.isWaiting(cid1, tid6));
doStages(cid1, txns);
assertTrue(action.clientID == cid1 && action.txID == tid5);
}
private void doStages(ClientID cid1, Set txns) {
doStages(cid1, txns, true);
}
private void doStages(ClientID cid1, Set txns, boolean skipIncoming) {
// process stage
if (!skipIncoming) transactionManager.incomingTransactions(cid1, getServerTransactionIDs(txns), txns, false);
for (Iterator iter = txns.iterator(); iter.hasNext();) {
ServerTransaction tx = (ServerTransaction) iter.next();
// apply stage
transactionManager.apply(tx, Collections.EMPTY_MAP, new BackReferences(), imo);
// commit stage
Set committedIDs = new HashSet();
committedIDs.add(tx.getServerTransactionID());
this.transactionManager.commit(ptxp, Collections.EMPTY_SET, Collections.EMPTY_MAP, committedIDs);
// broadcast stage
transactionManager.broadcasted(tx.getSourceID(), tx.getTransactionID());
}
}
private Set getServerTransactionIDs(Set txns) {
Set s = new HashSet(txns.size());
for (Iterator iter = txns.iterator(); iter.hasNext();) {
ServerTransaction st = (ServerTransaction) iter.next();
s.add(st.getServerTransactionID());
}
return s;
}
private static final class TestChannelStats implements ChannelStats {
public LinkedQueue notifyTransactionContexts = new LinkedQueue();
public Counter getCounter(MessageChannel channel, String name) {
throw new ImplementMe();
}
public void notifyTransaction(NodeID nodeID) {
try {
notifyTransactionContexts.put(nodeID);
} catch (InterruptedException e) {
throw new TCRuntimeException(e);
}
}
public void notifyObjectRemove(MessageChannel channel, int numObjectsRemoved) {
throw new ImplementMe();
}
public void notifyObjectRequest(MessageChannel channel, int numObjectsRequested) {
throw new ImplementMe();
}
public void notifyTransactionAckedFrom(NodeID nodeID) {
//NOP
}
public void notifyTransactionBroadcastedTo(NodeID nodeID) {
//NOP
}
}
private static class Root {
final String name;
final ObjectID id;
Root(String name, ObjectID id) {
this.name = name;
this.id = id;
}
}
private static class Listener implements ServerTransactionManagerEventListener {
final List rootsCreated = new ArrayList();
public void rootCreated(String name, ObjectID id) {
rootsCreated.add(new Root(name, id));
}
}
private static class TestServerTransactionListener implements ServerTransactionListener {
NoExceptionLinkedQueue incomingContext = new NoExceptionLinkedQueue();
NoExceptionLinkedQueue appliedContext = new NoExceptionLinkedQueue();
NoExceptionLinkedQueue completedContext = new NoExceptionLinkedQueue();
public void incomingTransactions(NodeID source, Set serverTxnIDs) {
incomingContext.put(new Object[] { source, serverTxnIDs });
}
public void transactionApplied(ServerTransactionID stxID) {
appliedContext.put(stxID);
}
public void transactionCompleted(ServerTransactionID stxID) {
completedContext.put(stxID);
}
public void addResentServerTransactionIDs(Collection stxIDs) {
throw new ImplementMe();
}
public void clearAllTransactionsFor(NodeID deadNode) {
throw new ImplementMe();
}
public void transactionManagerStarted(Set cids) {
throw new ImplementMe();
}
}
public class TestTransactionAcknowledgeAction implements TransactionAcknowledgeAction {
public NodeID clientID;
public TransactionID txID;
public void acknowledgeTransaction(ServerTransactionID stxID) {
this.txID = stxID.getClientTransactionID();
this.clientID = stxID.getSourceID();
}
public void clear() {
txID = null;
clientID = null;
}
}
}
| [
"sbale@7fc7bbf3-cf45-46d4-be06-341739edd864"
] | sbale@7fc7bbf3-cf45-46d4-be06-341739edd864 |
8fcfeb418f5e4dc1d71f6a15bb4d10a89ecfe917 | 8a4f835c9f488a9f848c28c0149cf6e33f2a2b99 | /locman-api/src/main/java/com/run/locman/api/query/service/FaultOrderProcessTypeQueryService.java | 2029599d3702410cd6c38e9c0fbc804513e308cf | [] | no_license | zhfly1992/locman | 7b2e06ebfab18a9c602ba2ea3b0bedfbb8a3b290 | aae464cfa5b25baaaa8ee4eea5659b184ea62339 | refs/heads/master | 2023-01-05T23:24:57.121823 | 2020-11-04T03:05:22 | 2020-11-04T03:05:22 | 309,865,193 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 617 | java | package com.run.locman.api.query.service;
import com.run.entity.common.RpcResponse;
import com.run.locman.api.entity.FaultOrderProcessType;
import java.util.List;
/**
* @Description:
* @author: 田明
* @version: 1.0, 2017年12月06日
*/
public interface FaultOrderProcessTypeQueryService {
/**
* @Description: 获取故障工单类型
* @return
*/
RpcResponse<List<FaultOrderProcessType>> getFaultOrderType();
/**
* @Description: 根據id查询对应工单类型信息
* @param id
* @return
*/
RpcResponse<FaultOrderProcessType> findById(String id);
}
| [
"zhanghe"
] | zhanghe |
be564dfa7f14a8c9add3fa0596214daadc05f9c4 | 157a11b6c54139a8ba772c18f285a4e6eeca9be9 | /app/src/main/java/maruf/com/myapplication/rayonbuntu/tampilan/MainTampil.java | b67d57201ef85871aac2adaf901c213694cc3931 | [] | no_license | ax873/kasvv2 | 9f13770ccf600f4e77e89bae7758795adc080d6b | 16b3c8b2277f65b79b406413543801835970b485 | refs/heads/main | 2023-02-21T23:32:57.830505 | 2021-01-27T11:11:25 | 2021-01-27T11:18:12 | 332,471,892 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,670 | java | package maruf.com.myapplication.rayonbuntu.tampilan;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
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.ArrayList;
import java.util.List;
import maruf.com.myapplication.HomeFragmen;
import maruf.com.myapplication.R;
import maruf.com.myapplication.menunavigasi;
import maruf.com.myapplication.rayonbuntu.coba.setsaldo;
import maruf.com.myapplication.rayonbuntu.setter.kaslist;
import maruf.com.myapplication.rayonbuntu.setterr.setkas;
public class MainTampil extends AppCompatActivity {
private ListView listviewkas;
public static final String KS_NAMA="nama";
public static final String KS_ID="id";
public static final String KS_S="NAMA";
public static final String KS_RANTING="ranting";
public static final String KS_JUMLAH="jumlah";
public static final String KS_DESK="desk";
public static final String KS_TITLE="title";
EditText caari;
TextView txtapayah;
DatabaseReference databasw1;
List<setkas> kaslist;
Button klik;
String buu;
TextView rayon;
DatabaseReference databasekas;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_tampil);
FirebaseDatabase database = FirebaseDatabase.getInstance();
rayon=findViewById(R.id.yeray);
Intent a = getIntent();
String idu = a.getStringExtra(HomeFragmen.KS_S);
rayon.setText(idu);
buu=rayon.getText().toString();
databasw1 = database.getReference("Rayon").child("saldo");
databasekas = FirebaseDatabase.getInstance().getReference(buu);
kaslist = new ArrayList<>();
rayon=findViewById(R.id.yeray);
listviewkas = (ListView) findViewById(R.id.lisviewkas);
txtapayah=(TextView) findViewById(R.id.idapayah);
caari=findViewById(R.id.iidcari);
klik=findViewById(R.id.idklikcari);
klik.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cari();
}
});
// databasw1.addValueEventListener(new ValueEventListener() {
// @Override
// public void onDataChange(DataSnapshot dataSnapshot) {
// // This method is called once with the initial value and again
// // whenever data at this location is updated.
//
//
// int hasil;
// TextView tuunjuk = (TextView) findViewById(R.id.idapayah1);
// NumberFormat format = NumberFormat.getCurrencyInstance(Locale.ENGLISH);
// hasil= Integer.parseInt(txtapayah.getText().toString());
// Locale loca = new Locale("in", "ID");
// NumberFormat formatRupiah = NumberFormat.getCurrencyInstance(loca);
// tuunjuk.setText(formatRupiah.format((double)hasil));
// txtapayah.setVisibility(View.INVISIBLE);
//
//
// }
//
//
//
// @Override
// public void onCancelled(DatabaseError error) {
// // Failed to read value
//
// }
// });
listviewkas.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
setkas kas=kaslist.get(position);
Intent a =new Intent(getApplicationContext(), MainUbah.class);
a.putExtra(KS_ID,kas.getIdkas());
a.putExtra(KS_NAMA,kas.getNama());
a.putExtra(KS_RANTING,kas.getRanting());
a.putExtra(KS_JUMLAH,kas.getJumlah());
a.putExtra(KS_DESK,kas.getDesk());
a.putExtra(KS_TITLE,kas.getTitle());
String nua=rayon.getText().toString();
a.putExtra(KS_S,nua);
startActivity(a);
}
});
}
@Override
protected void onStart() {
super.onStart();
String buu=rayon.getText().toString();
databasw1.child(buu).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
setsaldo mahasiswa = dataSnapshot.getValue(setsaldo.class);
txtapayah.setText(mahasiswa.getSaldo());
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
databasekas.child(buu).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
kaslist.clear();
for(DataSnapshot setnapasopt:dataSnapshot.getChildren()){
setkas kas=setnapasopt.getValue(setkas.class);
kaslist.add(kas);
}
kaslist adapter=new kaslist(MainTampil.this,kaslist);
listviewkas.setAdapter(adapter);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void cari() {
String d=caari.getText().toString();
String buu=rayon.getText().toString();
DatabaseReference query = FirebaseDatabase.getInstance().getReference(buu).child(buu);
query.orderByChild("desk").startAt(d).endAt(d+"\uf8ff").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
kaslist.clear();
for(DataSnapshot setnapasopt:dataSnapshot.getChildren()){
setkas kas=setnapasopt.getValue(setkas.class);
kaslist.add(kas);
}
kaslist adapter=new kaslist(MainTampil.this,kaslist);
listviewkas.setAdapter(adapter);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| [
"marufmaftuchin959@mail.com"
] | marufmaftuchin959@mail.com |
0d6432ffe28f4760646ee2b3fba9dba2af58625c | 405cff85a5a1697d449d39086ba8c74a9db0854b | /src/main/java/com/jeasyframeworks/extentions/captcha/color/SingleColorFactory.java | 787feafcb911aa6780f8f7ee289355bf1a182348 | [] | no_license | aijiacy/JeeAdmin | af1134ea2f1a8477cab5eb4af3d9707e1ca82b4c | f537afb847679f8146780d5e1c64a70c1d1993cf | refs/heads/master | 2016-09-06T04:40:27.579040 | 2015-06-18T15:09:50 | 2015-06-18T15:09:50 | 32,217,684 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | /*
* Copyright (c) 2009 Piotr Piastucki
*
* This file is part of Patchca CAPTCHA library.
*
* Patchca is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Patchca 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Patchca. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jeasyframeworks.extentions.captcha.color;
import java.awt.*;
public class SingleColorFactory implements ColorFactory {
private Color color;
public SingleColorFactory() {
color = Color.BLACK;
}
public SingleColorFactory(Color color) {
this.color = color;
}
public Color getColor(int index) {
return color;
}
public void setColor(Color color) {
this.color = color;
}
}
| [
"cymsn81@126.com"
] | cymsn81@126.com |
9c550d3f70179c3be7a395088aa50a42fecfd9b6 | d9493c1a388fb7d505db859a46ab16f09b9456a4 | /java/DatabaseIntegrityCheck/Properties/Resources.java | ffd76a349dafcdbd7b27f4789fa7167fdc159ed5 | [] | no_license | leelingco/opendental | f29c51a76bf455496bbc307ab0a5cd588792e7a0 | aaf621b2b5b64e1d8d0f3318050d143abeefe594 | refs/heads/master | 2021-01-21T00:25:30.774258 | 2016-02-16T04:23:27 | 2016-02-16T04:23:27 | 51,807,222 | 0 | 0 | null | 2016-02-16T04:12:27 | 2016-02-16T04:12:27 | null | UTF-8 | Java | false | false | 2,078 | java | //
// Translated by CS2J (http://www.cs2j.com): 2/15/2016 7:58:25 PM
//
package DatabaseIntegrityCheck.Properties;
import DatabaseIntegrityCheck.Properties.Resources;
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
/**
* A strongly-typed resource class, for looking up localized strings, etc.
*/
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
public class Resources
{
private static System.Resources.ResourceManager resourceMan = new System.Resources.ResourceManager();
private static System.Globalization.CultureInfo resourceCulture = new System.Globalization.CultureInfo();
public Resources() throws Exception {
}
/**
* Returns the cached ResourceManager instance used by this class.
*/
public static System.Resources.ResourceManager getResourceManager() throws Exception {
if (Object.ReferenceEquals(resourceMan, null))
{
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("DatabaseIntegrityCheck.Properties.Resources", Resources.class.Assembly);
resourceMan = temp;
}
return resourceMan;
}
/**
* Overrides the current thread's CurrentUICulture property for all
* resource lookups using this strongly typed resource class.
*/
public static System.Globalization.CultureInfo getCulture() throws Exception {
return resourceCulture;
}
public static void setCulture(System.Globalization.CultureInfo value) throws Exception {
resourceCulture = value;
}
}
| [
"leelingco@yahoo.com"
] | leelingco@yahoo.com |
676aa77f39ca9bd7072642793f43740af5027731 | 4d218f24a722a9985cce8fa25dcf8c8c11c3d5fc | /GPedido/src/main/java/org/institutoserpis/ad/Pedido.java | 20647de5d8e67737166860d5e7b3af4d6ba05e4b | [] | no_license | luisso96/ad | 3a75e4dc012fa8ebf44d65e0ec523a3f39163cc3 | 6e110e634c062c794e6f01fe39c7e1d4932af917 | refs/heads/master | 2020-05-18T08:03:30.561470 | 2016-02-09T09:45:03 | 2016-02-09T09:45:03 | 42,501,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 866 | java | package org.institutoserpis.ad;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.GenericGenerator;
@Entity
public class Pedido {
private Long id;
private Cliente cliente;
private Calendar fecha;
@Id
@GeneratedValue(generator="increment")
@GenericGenerator(name="increment", strategy = "increment")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@ManyToOne
@JoinColumn(name="cliente")
public Cliente getCliente() {
return cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
public Calendar getFecha() {
return fecha;
}
public void setFecha(Calendar fecha) {
this.fecha = fecha;
}
}
| [
"luisalmendrosrios@gmail.com"
] | luisalmendrosrios@gmail.com |
3c68845e960b097a11db74a5c6e30bd5b0d50414 | a8bd89a097a02ed3a2f664fe8afa387a47a59e6f | /minDepth.java | 9637d709cb3105abb3e7dab6ba837554907fd872 | [] | no_license | YektaDemirci/practice | c1cf9dc1357f52ba8655aff8e24c1667081c9520 | dfc02be947f6d4f48d353a4a0e610242916ae6a2 | refs/heads/master | 2023-02-25T02:42:23.032979 | 2021-01-31T18:35:05 | 2021-01-31T18:35:05 | 325,077,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,389 | java | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode() {}
* TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) {
* this.val = val;
* this.left = left;
* this.right = right;
* }
* }
*/
/*My BFS solution*/
class Solution {
public int minDepth(TreeNode root) {
if(root == null)
return 0;
Deque<TreeNode> queue = new ArrayDeque<>();
queue.add(root);
int ctr=1;
while(!queue.isEmpty()) {
int size=queue.size();
for(int i=0; i<size;i++) {
if(queue.peek().left==null && queue.peek().right==null)
return ctr;
if (queue.peek().left!=null) queue.add(queue.peek().left);
if(queue.peek().right!=null) queue.add(queue.peek().right);
root=queue.pop();
}
ctr++;
}
return ctr;
}
}
/*Short in line DFS solution, but must be slower than my solution
public class Solution {
public int minDepth(TreeNode root) {
if(root == null) return 0;
int left = minDepth(root.left);
int right = minDepth(root.right);
return (left == 0 || right == 0) ? left+right+1 : Math.min(left,right)+1;
}
}
*/
| [
"ydemirci@uwaterloo.ca"
] | ydemirci@uwaterloo.ca |
644906214f4416efe01683424d07af924ec5ad0d | 90d760cfe3406dade85d9e0924cd7578ae3c9c40 | /iotthings-master/src/main/java/com/ymc/iotthings/mqtt/listener/ExceptionEventListener.java | 3afd7cb1ea5a35e068a64360f37745767a2f3811 | [] | no_license | liucile/myRepository | 36ec14af8bb41ecff35900b1e3ef52023137675f | 7b7640bbca78523ac8cd6e94928a5a174619804d | refs/heads/master | 2022-12-06T17:47:33.601561 | 2020-05-02T10:17:27 | 2020-05-02T10:17:27 | 210,993,086 | 0 | 0 | null | 2022-11-24T07:43:04 | 2019-09-26T03:37:47 | Java | UTF-8 | Java | false | false | 549 | java | package com.ymc.iotthings.mqtt.listener;
import com.ymc.iotthings.mqtt.channel.WrappedChannel;
import io.netty.channel.ChannelHandlerContext;
import java.util.EventListener;
/**
* 异常监听器
*
* @author daoshenzzg@163.com
* @date 2018/12/30 16:20
*/
public interface ExceptionEventListener extends EventListener {
/**
* 异常捕获
*
* @param ctx
* @param channel
* @param cause
* @return
*/
EventBehavior exceptionCaught(ChannelHandlerContext ctx, WrappedChannel channel, Throwable cause);
} | [
"vip163lcl@163.com"
] | vip163lcl@163.com |
e40e584ee5d96ed287a9db5668755e6a902b8718 | dd3884f507a0c7bad753ceea6bcea52c8cdf5286 | /ShoppingListPlusPlus/app/src/main/java/com/udacity/firebase/shoppinglistplusplus/ui/activeLists/ShoppingListsFragment.java | ba7d3db171777ab009edcdcb34d0c1f7bd25b3fa | [] | no_license | Abdelsattar/ShopingList- | b022495692d020fb47fea91f81f328d07e5201b0 | bcb3153faae6292d41c651424b8198a2b0de0978 | refs/heads/master | 2016-09-01T15:12:23.123406 | 2016-03-27T22:13:08 | 2016-03-27T22:13:08 | 52,817,890 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,409 | java | package com.udacity.firebase.shoppinglistplusplus.ui.activeLists;
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.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import com.firebase.client.DataSnapshot;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import com.firebase.client.ValueEventListener;
import com.udacity.firebase.shoppinglistplusplus.R;
import com.udacity.firebase.shoppinglistplusplus.model.ShoppingList;
import com.udacity.firebase.shoppinglistplusplus.utils.Constants;
import com.udacity.firebase.shoppinglistplusplus.utils.Utils;
import java.util.Date;
/**
* A simple {@link Fragment} subclass that shows a list of all shopping lists a user can see.
* Use the {@link ShoppingListsFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class ShoppingListsFragment extends Fragment {
private ListView mListView;
private TextView mTextViewListName;
private TextView mTextViewOwner;
private TextView mTextViewEditTime;
public ShoppingListsFragment() {
/* Required empty public constructor */
}
/**
* Create fragment and pass bundle with data as it's arguments
* Right now there are not arguments...but eventually there will be.
*/
public static ShoppingListsFragment newInstance() {
ShoppingListsFragment fragment = new ShoppingListsFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
/**
* Initialize instance variables with data from bundle
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
/**
* Initalize UI elements
*/
View rootView = inflater.inflate(R.layout.fragment_shopping_lists, container, false);
initializeScreen(rootView);
/**
* Set interactive bits, such as click events and adapters
*/
Firebase listNameRef = new Firebase(Constants.FIREBASE_URL).child("activeList");
listNameRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//String listName = dataSnapshot.getValue().toString();
ShoppingList shoppingList = dataSnapshot.getValue(ShoppingList.class);
if(shoppingList != null){
mTextViewListName.setText(shoppingList.getListName());
mTextViewOwner.setText(shoppingList.getOwner());
if (shoppingList.getTimestampLastChanged() != null) {
mTextViewEditTime.setText(
Utils.SIMPLE_DATE_FORMAT.format(
new Date(shoppingList.getTimestampLastChangedLong())));
} else {
mTextViewEditTime.setText("");
}
}
}
@Override
public void onCancelled(FirebaseError firebaseError) {
}
});
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
});
return rootView;
}
@Override
public void onDestroy() {
super.onDestroy();
}
/**
* Link layout elements from XML
*/
private void initializeScreen(View rootView) {
mListView = (ListView) rootView.findViewById(R.id.list_view_active_lists);
mTextViewListName = (TextView) rootView.findViewById(R.id.text_view_list_name);
mTextViewOwner = (TextView) rootView.findViewById(R.id.text_view_created_by_user);
mTextViewEditTime = (TextView) rootView.findViewById(R.id.text_view_edit_time);
}
}
| [
"m.abdel_sattarahmed@yahoo.com"
] | m.abdel_sattarahmed@yahoo.com |
4ca8911c7c8e84f1f6d7271957a2c9e9e7f562bf | 1b71664258e8385c537a844c603e1b12485f4b76 | /ID2217 - Network Programming with Java/Homework 5/app/src/androidTest/java/se/mattec/id2212/hw5/ApplicationTest.java | 2993e4a9a2319b4f9f0d9e81585a57f88569a632 | [] | no_license | mattec92/KTH | de820eb87a6b5c6a8613c7b47a861ec9fbac5223 | 71555a12bc3ec4dcbcde1282922aa27952d3cba7 | refs/heads/master | 2021-01-18T01:14:52.803913 | 2016-07-02T16:50:53 | 2016-07-02T16:50:53 | 38,773,656 | 12 | 19 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package se.mattec.id2212.hw5;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest
extends ApplicationTestCase<Application>
{
public ApplicationTest()
{
super(Application.class);
}
} | [
"mattec92@hotmail.com"
] | mattec92@hotmail.com |
7a4fa92b09093088a79bafbe34b9966973e223ec | 48de0085fcc8ce372498a4b944857fe3e4c96a4d | /LojaDeGames/src/main/java/br/org/generation/lojadegames/controller/ProdutosController.java | 0522d6fa53d7496fe38dee1671b6c86a7768e5ee | [] | no_license | juliabarao/LojaDeGames | 917f60f301f366e201080740d948fb66277a061c | 5d510b2ef29e1bdde247b3b9c866ed497ab0b182 | refs/heads/main | 2023-08-07T10:33:28.121893 | 2021-09-19T18:54:35 | 2021-09-19T18:54:35 | 401,407,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,196 | java | package br.org.generation.lojadegames.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import br.org.generation.lojadegames.model.Produtos;
import br.org.generation.lojadegames.repository.ProdutosRepository;
@RestController
@RequestMapping("/produtos")
@CrossOrigin(origins = "*", allowedHeaders = "*")
public class ProdutosController {
@Autowired
private ProdutosRepository produtosRepository;
@GetMapping
public ResponseEntity <List<Produtos>> getAll(){
return ResponseEntity.ok(produtosRepository.findAll());
}
@GetMapping("/{id}")
public ResponseEntity<Produtos> getById(@PathVariable long id){
return produtosRepository.findById(id)
.map(resp -> ResponseEntity.ok(resp))
.orElse(ResponseEntity.notFound().build());
}
@GetMapping("/nome/{nome}")
public ResponseEntity<List<Produtos>> getByNome(@PathVariable String nome){
return ResponseEntity.ok(produtosRepository.findAllByNomeContainingIgnoreCase(nome));
}
@PostMapping
public ResponseEntity<Produtos> postProdutos(@RequestBody Produtos produtos){
return ResponseEntity.status(HttpStatus.CREATED).body(produtosRepository.save(produtos));
}
@PutMapping
public ResponseEntity<Produtos> putProdutos(@RequestBody Produtos produtos){
return ResponseEntity.status(HttpStatus.OK).body(produtosRepository.save(produtos));
}
@DeleteMapping("/{id}")
public void deleteProdutos(@PathVariable long id) {
produtosRepository.deleteById(id);
}
}
| [
"noreply@github.com"
] | juliabarao.noreply@github.com |
eacacd9dd9c00bf5c2e724461dea43fc7f444bac | 4994f6033808d0f6a183bacf301b43d464d72cfd | /engine/src/main/java/org/camunda/bpm/engine/impl/batch/deletion/DeleteProcessInstancesBatchJobDeclaration.java | ea711892b23f57dee0b22604bf81d444ac81ea2b | [
"Apache-2.0"
] | permissive | NONO9527/camunda-bpm-platform | 86c0645a7cf1105338d1ad836af2356c73cbe3f2 | fe12354ba966df01d6634a7b534f436221f6b1d7 | refs/heads/master | 2021-06-08T03:11:52.701464 | 2016-09-15T09:26:52 | 2016-09-15T09:26:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,307 | 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 org.camunda.bpm.engine.impl.batch.deletion;
import org.camunda.bpm.engine.batch.Batch;
import org.camunda.bpm.engine.impl.batch.BatchJobConfiguration;
import org.camunda.bpm.engine.impl.batch.BatchJobContext;
import org.camunda.bpm.engine.impl.context.Context;
import org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider;
import org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider;
import org.camunda.bpm.engine.impl.jobexecutor.JobDeclaration;
import org.camunda.bpm.engine.impl.jobexecutor.JobHandlerConfiguration;
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity;
import org.camunda.bpm.engine.impl.persistence.entity.MessageEntity;
/**
* @author Askar Akhmerov
*/
public class DeleteProcessInstancesBatchJobDeclaration extends JobDeclaration<BatchJobContext, MessageEntity> {
public DeleteProcessInstancesBatchJobDeclaration() {
super(Batch.TYPE_PROCESS_INSTANCE_DELETION);
}
@Override
protected ExecutionEntity resolveExecution(BatchJobContext context) {
return null;
}
@Override
protected MessageEntity newJobInstance(BatchJobContext context) {
return new MessageEntity();
}
@Override
protected JobHandlerConfiguration resolveJobHandlerConfiguration(BatchJobContext context) {
return new BatchJobConfiguration(context.getConfiguration().getId());
}
@Override
protected String resolveJobDefinitionId(BatchJobContext context) {
return context.getBatch().getBatchJobDefinitionId();
}
public ParameterValueProvider getJobPriorityProvider() {
long batchJobPriority = Context.getProcessEngineConfiguration()
.getBatchJobPriority();
return new ConstantValueProvider(batchJobPriority);
}
}
| [
"askar.akhmerov@camunda.com"
] | askar.akhmerov@camunda.com |
57176c0ea38907cd5e7ff86c04c6aecb75ff9212 | a21abc706b050ecc8b019e0081e454cee5a1c593 | /app/src/main/java/com/example/level1/info.java | 8ede88a9d27d9e5023bcb8e6aff5be0de9e108fb | [] | no_license | JefMei/Level1 | 6ae95cde42e03af16d34901639bb73f1ddf3feef | 305254323f57cf0f02d5880cd6eaf65d4bd5b8bc | refs/heads/master | 2021-01-18T06:49:36.432458 | 2016-03-13T06:47:35 | 2016-03-13T06:47:35 | 52,762,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,632 | java | package com.example.level1;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.util.ArrayList;
import java.util.List;
/**
* Created by 梅梅 on 2016/2/25.
*/
public class info extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.info);
TextView bigname = (TextView) findViewById(R.id.bigname);
TextView name = (TextView) findViewById(R.id.name);
TextView pass = (TextView) findViewById(R.id.pass);
TextView time = (TextView) findViewById(R.id.time);
TextView note = (TextView) findViewById(R.id.note);
ImageView rt = (ImageView) findViewById(R.id.rt);
ImageView delete = (ImageView) findViewById(R.id.delete);
android.support.design.widget.FloatingActionButton change = (FloatingActionButton) findViewById(R.id.change);
final InfoItem infoItem = (InfoItem) getIntent().getSerializableExtra("InfoItem");
final int position = (int) getIntent().getSerializableExtra("position");
bigname.setText(infoItem.getName());
name.setText(infoItem.getAccount());
pass.setText(infoItem.getPass());
time.setText(infoItem.getTime());
note.setText(infoItem.getNote());
//不返回结果值的intent 该怎样写
rt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setResult(RESULT_CANCELED);
finish();
}
});
change.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(info.this,Changeinfo.class);
intent.putExtra("position",position);
intent.putExtra("InfoItem",infoItem);
startActivityForResult(intent,0);
}
});
//删除指定数据并返回主界面
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//删除数据
Gson gson = new Gson();
SharedPreferences pref = getSharedPreferences("info",MODE_APPEND);
SharedPreferences.Editor editor = pref.edit();
String json = pref.getString("infodata",null);
String json1 = pref.getString("data",null);
List<InfoItem> infodata = gson.fromJson(json,
new TypeToken<ArrayList<InfoItem>>(){}.getType());
List<Item> data = gson.fromJson(json1,
new TypeToken<ArrayList<Item>>(){}.getType());
infodata.remove(position);
data.remove(position);
String json2 = gson.toJson(infodata);
String json3 = gson.toJson(data);
editor.putString("infodata",json2);
editor.putString("data",json3);
editor.commit();
//返回主界面
setResult(RESULT_CANCELED);
finish();
}
});
}
protected void onActivityResult(int requestCode , int resultCode, Intent data){
super.onActivityResult(requestCode,resultCode,data);
if(resultCode == RESULT_OK){
TextView bigname = (TextView) findViewById(R.id.bigname);
TextView name = (TextView) findViewById(R.id.name);
TextView pass = (TextView) findViewById(R.id.pass);
TextView time = (TextView) findViewById(R.id.time);
TextView note = (TextView) findViewById(R.id.note);
final InfoItem infoItem1 = (InfoItem) data.getSerializableExtra("InfoItem1");
if(infoItem1 != null){
bigname.setText(infoItem1.getName());
name.setText(infoItem1.getAccount());
pass.setText(infoItem1.getPass());
time.setText(infoItem1.getTime());
note.setText(infoItem1.getNote());
}
}
else {
Toast.makeText(this,"未作任何修改",Toast.LENGTH_SHORT).show();
}
}
}
| [
"a616764899@126.com"
] | a616764899@126.com |
8d3f15e8726363f6a9b772f98718d5f5da78eea2 | 7628f5a8100269be53c8053fc395db820b489dd9 | /day04-code/src/cn/itcast/day04/May2101demo/Computer.java | bf6224d691243c75684f0660c18bfca255b25295 | [] | no_license | Seeumt/basic-code | 41731b3991dcfa7b3b15fb18a91295fbe0a3b16b | 30179d9948162e0b5f509a972562a5a259f888db | refs/heads/master | 2020-06-24T05:24:48.169652 | 2019-07-23T10:58:24 | 2019-07-23T10:58:24 | 198,861,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,085 | java | package cn.itcast.day04.May2101demo;
public class Computer {
public void powerOn(){
System.out.println("笔记本电脑开机!");
}
public void powerOff(){
System.out.println("笔记本电脑关机!");
}
// 使用接口作为方法参数
public void useDevice(USB usb){
usb.open();// 运行看右边!!! 要是输入一个具体的子类对象 调用接口里的抽象方法? 就是全都有的方法(抽象方法)
// 这样才能根据创建对象时 等号=右边的类名称 知道是什么这是个什么对象,应当给它调用属于它的覆盖重写后的方法
//可是这样想不就是知道了 传进来的是某个实现类了吗?
// usb.click(); 父类怎么能调用子类非继承或实现方法呢?!
if(usb instanceof Mouse){
Mouse m = (Mouse) usb;//把usb向下转型
m.click();
}else if (usb instanceof Keyboard){
Keyboard k =(Keyboard) usb;
k.type();
}
usb.close();
}
}
| [
"wx_f040e0a8a069476b8c7e7007293656a6@git.code.tencent.com"
] | wx_f040e0a8a069476b8c7e7007293656a6@git.code.tencent.com |
faacc0eed75c6508ed033176c6c7d64e16f7e229 | 965b824bdaa3867f7a9f62d00be9d10a3ee24890 | /src/main/java/com/pravila/samples/logserver/persistence/LogMessage.java | 1c4133a23cff5d69ba76ff73aace343338429946 | [] | no_license | Elisaveta/LogServer | 4ff0c774fa6e93064ace7eeb2d020dddf0fa95e0 | bf55171604f942aad83aa0f39368d4bd0becc478 | refs/heads/master | 2021-01-10T20:50:07.789037 | 2014-09-16T20:55:01 | 2014-09-16T20:55:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,402 | java | package com.pravila.samples.logserver.persistence;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* @author Elisaveta Manasieva
* create database table
*
*/
@Entity
@Table(name = "logmessage")
public class LogMessage implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", nullable = false)
private int id;
@Column(name = "level")
private String level;
@Column(name = "date")
private Long date;
@Column(name = "class_name")
private String className;
@Column(name = "message")
private String message;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public Long getDate() {
return date;
}
public void setDate(Long date) {
this.date = date;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| [
"manasievae@gmail.com"
] | manasievae@gmail.com |
84f8a638f1892685e1c704836d22ca08dccb8b8c | 8a68a5ef4ee88205f0a20e57e0459f746ca87785 | /json/AndroidVolley/RequestQueue/app/src/main/java/akand/com/requestqueue/MainActivity.java | c17667993a3afed1978fc74fcd859cdaf8e5a8ac | [] | no_license | akandMehedi/GIT | c4a0b60def6d659c592ddbd9a019899f40c8c67f | d00d7126b48f2fb045c832342a64072085312fc1 | refs/heads/master | 2021-01-22T12:17:55.687532 | 2017-05-30T10:58:03 | 2017-05-30T10:58:03 | 92,714,726 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,400 | java | package akand.com.requestqueue;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.android.volley.Cache;
import com.android.volley.Network;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.BasicNetwork;
import com.android.volley.toolbox.DiskBasedCache;
import com.android.volley.toolbox.HurlStack;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
public class MainActivity extends AppCompatActivity {
TextView textView;
Button button;
RequestQueue requestQueue;
String server_url = "http://192.168.0.110:8080/xampp/response.php";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView) findViewById(R.id.textView);
button = (Button) findViewById(R.id.button);
Cache cache = new DiskBasedCache(getCacheDir(),1024*1024);
Network network = new BasicNetwork(new HurlStack());
requestQueue = new RequestQueue(cache,network);
requestQueue.start();
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
StringRequest stringRequest = new StringRequest(Request.Method.POST, server_url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
textView.setText(response);
requestQueue.stop();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
textView.setText("Error....!");
error.printStackTrace();
requestQueue.stop();
}
});
requestQueue.add(stringRequest);
}
});
}
}
| [
"mehedi.hasan@technodhaka.com"
] | mehedi.hasan@technodhaka.com |
97f18eaa649c111744fc180d1fa07df62fe4a0ca | f959f0ddea0579455fd63efd73f68796ca3c89a3 | /thinkis-weixin/src/main/java/com/thinkis/modules/wx/config/WxGzh1Config.java | 71f0e04163fa9a043e707c79a675afcbc0774ff9 | [
"MIT"
] | permissive | chocoai/firsthinkis | 951e48acd86c4e8eb69d3a4b7bdcf2489828f813 | 63920660440c8b08ab6f81bccdd948f3464ac6f2 | refs/heads/master | 2022-04-06T12:37:57.431079 | 2019-12-22T03:37:52 | 2019-12-22T03:37:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 906 | java | package com.thinkis.modules.wx.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* @author Binary Wang
*/
@Configuration
public class WxGzh1Config extends WxConfig {
@Value("#{gzh1WxProperties.wx_token}")
private String token;
@Value("#{gzh1WxProperties.wx_appid}")
private String appid;
@Value("#{gzh1WxProperties.wx_appsecret}")
private String appsecret;
@Value("#{gzh1WxProperties.wx_aeskey}")
private String aesKey;
@Override
public String getToken() {
return this.token;
}
@Override
public String getAppid() {
return this.appid;
}
@Override
public String getAppsecret() {
return this.appsecret;
}
@Override
public String getAesKey() {
return this.aesKey;
}
@Override
public WxAccountEnum getWxAccountEnum() {
return WxAccountEnum.GZH1;
}
}
| [
"18229712137@189.cn"
] | 18229712137@189.cn |
19e467040b6df92849f3aa7e3fdcf5acbb55ea93 | 988f367cd005d253ab1c8e0cec82d5f4ffef4557 | /src/main/java/org/jon/lv/manager/DeleteManager.java | 2eaebc2367bd2c3f4be9dc7594cc64f343e5c954 | [] | no_license | gspandy/elasticsearch-engine | d8e5533cffbdc52a647aa5afe8b4cf3f84e40d18 | 4b9865fff019e155b28cb1c6c6a3b2ff9dcdaca8 | refs/heads/master | 2023-08-09T18:24:42.130496 | 2017-05-11T02:27:45 | 2017-05-11T02:27:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,482 | java | package org.jon.lv.manager;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.deletebyquery.DeleteByQueryAction;
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder;
import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse;
import org.elasticsearch.client.Client;
import org.jon.lv.common.ESTools;
import org.jon.lv.result.APIResult;
/**
* @Description: ES 删除索引
* Author lv bin
* @date 2016/12/13 16:28
* version V1.0.0
*/
public class DeleteManager {
public static Client client = ESTools.client;
// 查询所有
private static String QUERY_ALL = "{\"query\": {\"match_all\": {}}}";
/**
* 根据id删除ES数据
* @param index
* @param type
* @param id
* @return
*/
public static APIResult<String> deleteById(String index, String type, String id) {
DeleteResponse response = client.prepareDelete(index, type, id).setRefresh(true).execute().actionGet();
boolean isFound = response.isFound();
if (isFound) {
return new APIResult<String>(500, "删除ES失败!");
}
return new APIResult<String>(200, "删除ES成功!");
}
/**
* 清空index下的某个type---等价于清空表
* @param index
* @param type
* @return
*/
public static APIResult<String> emptyType(String index, String type) {
return deleteByQuery(index, type, QUERY_ALL);
}
/**
* 删除index下的某个type
* ---2.0以上版本已经失效-5.0版本回归支持-请勿使用-目前版本2.4.1 报错
* @param index
* @param type
* @return
*/
@Deprecated
public static APIResult<String> deleteType(String index, String type) {
DeleteResponse response = client.prepareDelete().setIndex(index).setType(type).execute().actionGet();
boolean isFound = response.isFound();
if (isFound) {
return new APIResult<String>(500, "删除ES失败!");
}
return new APIResult<String>(200, "删除ES成功!");
}
/**
* 根据索引名称删除索引---等价于 删除整个数据库操作 --勿用
* @param index 索引名称
*/
public static void deleteIndex(String index) {
IndicesExistsRequest indicesExistsRequest = new IndicesExistsRequest();
indicesExistsRequest.indices(new String[]{index.toLowerCase()});
boolean exists = client.admin().indices().exists(indicesExistsRequest).actionGet().isExists();
if (exists) {
client.admin().indices().prepareDelete(index.toLowerCase()).execute().actionGet();
}
}
/**
* 根据查询条件删除
* @param index
* @param type
* @param queryString
* @return
*/
public static APIResult<String> deleteByQuery(String index, String type, String queryString){
DeleteByQueryResponse response = new DeleteByQueryRequestBuilder(client,
DeleteByQueryAction.INSTANCE)
.setIndices(index)
.setTypes(type)
.setSource(queryString)
.execute()
.actionGet();
if (response.getTotalFailed() > 0l) {
return new APIResult<String>(500, "删除ES-Type失败!");
}
return new APIResult<String>(200, "删除ES-Type成功!");
}
}
| [
"lvbin@oriental-finance.com"
] | lvbin@oriental-finance.com |
057dd46610b582659e7c1f4bade70cb7e381ede6 | 610e3f2d3ee2d04241bc0d05dd91cef127d842c0 | /src/com/ivend/iintegrationservice/_2010/_12/AwardPointsResponse.java | e7189c3b32e42f8f4c76ab70ad12bf7073177c3f | [] | no_license | MasterInc/InventoryUpdateWS | 5d9ff02b7cf868035e68a6410714b087edcde367 | a768dfefc0ee4dc6b6e4467a0a74b49707846dcf | refs/heads/master | 2021-01-10T16:16:46.270984 | 2015-11-27T21:34:01 | 2015-11-27T21:34:01 | 46,999,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java |
package com.ivend.iintegrationservice._2010._12;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "AwardPointsResponse")
public class AwardPointsResponse {
}
| [
"jahir.nava@gmail.com"
] | jahir.nava@gmail.com |
eded52f3b3da466d215fea3b308419b942d7247b | 1d63cd7498eee6a668808a785f8c0c430891c938 | /GalaxIR/src/fr/umlv/ir2/galaxir/core/GalaxyItemManager.java | f5c3918400160f36487eb3f4b89e5b397ca67a36 | [] | no_license | jordanemarcel/galaxir | bc908b4f87a09ef6c91affc7a21c1a895410b2fd | b63ab1cb1300711cca3d36f169f043cf438d7570 | refs/heads/master | 2020-12-25T17:25:27.150335 | 2016-08-16T20:54:30 | 2016-08-16T20:54:30 | 38,625,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 651 | java | package fr.umlv.ir2.galaxir.core;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.Point2D;
import fr.umlv.ir2.galaxir.items.GalaxyItem;
import fr.umlv.remix.ItemManager;
public class GalaxyItemManager implements ItemManager<GalaxyItem> {
@Override
public boolean contains(Point2D location , GalaxyItem item) {
return item.contains(location);
}
@Override
public void draw(Graphics2D g, GalaxyItem item) {
item.draw(g);
}
@Override
public boolean intersects(Shape selection, GalaxyItem item) {
return false;
}
@Override
public boolean isContained(Shape selection, GalaxyItem item) {
return false;
}
}
| [
"jordane.marcel@dcea9ff8-939b-11dd-ba38-7ff88368ef84"
] | jordane.marcel@dcea9ff8-939b-11dd-ba38-7ff88368ef84 |
a3797172e2de76a565e41de974b933f21e721bb7 | 55c49dd6dad872c1258714c2f3f1e11ffdc887b9 | /src/main/java/business/services/BmiFacade.java | c5a178eb96286d520e00f0fbd2d09b8c9f000212 | [] | no_license | uiop860/bmiOpgaveFlow4 | 9d6d001a587a66c09f47d1d1160b5d6adebba238 | 439f7e57ef9b143a0bbfce78887c1a80dcb9dc58 | refs/heads/main | 2023-04-02T02:52:01.717331 | 2021-04-15T08:48:43 | 2021-04-15T08:48:43 | 357,183,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package business.services;
import business.exceptions.UserException;
import business.persistence.BmiMapper;
import business.persistence.Database;
import java.util.List;
public class BmiFacade {
private BmiMapper bmiMapper;
public BmiFacade(Database database) {
this.bmiMapper = new BmiMapper(database);
}
public void InsertBmiEntry(double bmi, double height, double weight, String gender, String category, int sportid, int userid, List<Integer> hobbyList) throws UserException {
bmiMapper.insertBmiEntry(bmi,height,weight, gender, category,sportid,userid,hobbyList);
}
}
| [
"oliverstaehr96@gmail.com"
] | oliverstaehr96@gmail.com |
4190b2ed27546a70e3d75794bbd7c150f497399b | 451b0bf816a04272a0caa2c9cbbaf2f8816da795 | /Lista8/Questao5Lista8/src/questao5/Cliente.java | 4c940292587e518bc0c7f7d92d0ae99f2c70de74 | [] | no_license | ImAyron/Computer-Programming-2-object-orientation-with-JAVA-language- | 7c4853689f98d7443f472e22a900122dba517e75 | e1e93fa5f81f3bbc442195ab204b79bc7a84a903 | refs/heads/main | 2023-05-01T04:51:17.848859 | 2021-05-09T21:56:56 | 2021-05-09T21:56:56 | 365,853,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 535 | java | package questao5;
public class Cliente {
public static void main(String[] args) {
AbstractFactory f1=ProdutorFactory.GetFactory("Fabrica Ford");
CarroPopular f2=f1.CriaCarroPopular("Palio");
f2.exibirInfoPopular();
CarroPopular f3=f1.CriaCarroPopular("Fiesta");
f3.exibirInfoPopular();
AbstractFactory f6=ProdutorFactory.GetFactory("Fabrica Fiat");
CarroSedan f4=f6.CriaCarroSedan("Siena");
f4.exibirInforSedan();
CarroSedan f14=f6.CriaCarroSedan("Fiesta Sedan");
f14.exibirInforSedan();
}
}
| [
"ayronpaiva@outlook.com"
] | ayronpaiva@outlook.com |
aa15ef94ec85361d9b6d092623513f1e5dc1774c | f2bae3afa17745be9bc3bc98b9540b98f1cfd3c9 | /src/com/massivecraft/factions/update/OldConf.java | 5d89098073e730794ebead4521f1d6c2fd19d7f0 | [] | no_license | Hillimy/Factions | 7814bcce65ebd6f2ea29544bbf0eda8cd25a9802 | 399af19ec059126ea8c6563997bbea393834b2b2 | refs/heads/master | 2021-01-20T15:30:21.591448 | 2017-02-22T15:17:54 | 2017-02-22T15:17:54 | 82,819,037 | 1 | 0 | null | 2017-02-22T15:17:02 | 2017-02-22T15:17:02 | null | UTF-8 | Java | false | false | 9,384 | java | package com.massivecraft.factions.update;
import java.util.List;
import java.util.Map;
import org.bukkit.event.EventPriority;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.massivecore.store.Entity;
public class OldConf extends Entity<OldConf>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
public void transferTo(MConf mconf)
{
//mconf.enabled = this.enabled;
mconf.factionIdNone = this.factionIdNone;
mconf.factionIdSafezone = this.factionIdSafezone;
mconf.factionIdWarzone = this.factionIdWarzone;
mconf.defaultPlayerFactionId = this.defaultPlayerFactionId;
mconf.defaultPlayerRole = this.defaultPlayerRole;
mconf.defaultPlayerPower = this.defaultPlayerPower;
//mconf.defaultFactionOpen = this.defaultFactionOpen;
//mconf.defaultFactionFlags = this.defaultFactionFlags;
//mconf.defaultFactionPerms = this.defaultFactionPerms;
mconf.powerMax = this.powerMax;
mconf.powerMin = this.powerMin;
mconf.powerPerHour = this.powerPerHour;
mconf.powerPerDeath = this.powerPerDeath;
mconf.canLeaveWithNegativePower = this.canLeaveWithNegativePower;
mconf.factionMemberLimit = this.factionMemberLimit;
mconf.factionPowerMax = this.factionPowerMax;
mconf.factionNameLengthMin = this.factionNameLengthMin;
mconf.factionNameLengthMax = this.factionNameLengthMax;
mconf.factionNameForceUpperCase = this.factionNameForceUpperCase;
mconf.claimsMustBeConnected = this.claimsMustBeConnected;
mconf.claimingFromOthersAllowed = this.claimingFromOthersAllowed;
mconf.claimsCanBeUnconnectedIfOwnedByOtherFaction = this.claimsCanBeUnconnectedIfOwnedByOtherFaction;
mconf.claimsRequireMinFactionMembers = this.claimsRequireMinFactionMembers;
mconf.claimedLandsMax = this.claimedLandsMax;
mconf.homesEnabled = this.homesEnabled;
mconf.homesMustBeInClaimedTerritory = this.homesMustBeInClaimedTerritory;
mconf.homesTeleportCommandEnabled = this.homesTeleportCommandEnabled;
mconf.homesTeleportAllowedFromEnemyTerritory = this.homesTeleportAllowedFromEnemyTerritory;
mconf.homesTeleportAllowedFromDifferentWorld = this.homesTeleportAllowedFromDifferentWorld;
mconf.homesTeleportAllowedEnemyDistance = this.homesTeleportAllowedEnemyDistance;
mconf.homesTeleportIgnoreEnemiesIfInOwnTerritory = this.homesTeleportIgnoreEnemiesIfInOwnTerritory;
mconf.homesTeleportToOnDeathActive = this.homesTeleportToOnDeathActive;
mconf.homesTeleportToOnDeathPriority = this.homesTeleportToOnDeathPriority;
mconf.permanentFactionsDisableLeaderPromotion = this.permanentFactionsDisableLeaderPromotion;
mconf.actionDeniedPainAmount = this.actionDeniedPainAmount;
mconf.disablePVPForFactionlessPlayers = this.disablePVPForFactionlessPlayers;
mconf.enablePVPAgainstFactionlessInAttackersLand = this.enablePVPAgainstFactionlessInAttackersLand;
mconf.territoryShieldFactor = this.territoryShieldFactor;
mconf.denyCommandsPermanentFactionMember = this.denyCommandsPermanentFactionMember;
mconf.denyCommandsTerritoryRelation = this.denyCommandsTerritoryRelation;
mconf.lwcRemoveOnChange = this.lwcRemoveOnChange;
mconf.econEnabled = this.econEnabled;
mconf.econLandReward = this.econLandReward;
mconf.econUniverseAccount = this.econUniverseAccount;
mconf.econChunkCost = this.econChunkCost;
mconf.econCostCreate = this.econCostCreate;
mconf.econCostSethome = this.econCostSethome;
mconf.econCostJoin = this.econCostJoin;
mconf.econCostLeave = this.econCostLeave;
mconf.econCostKick = this.econCostKick;
mconf.econCostInvite = this.econCostInvite;
mconf.econCostDeinvite = this.econCostDeinvite;
mconf.econCostHome = this.econCostHome;
mconf.econCostName = this.econCostName;
mconf.econCostDescription = this.econCostDescription;
mconf.econCostTitle = this.econCostTitle;
mconf.econCostFlag = this.econCostOpen;
mconf.econRelCost = this.econRelCost;
mconf.bankEnabled = this.bankEnabled;
mconf.bankFactionPaysCosts = this.bankFactionPaysCosts;
mconf.bankFactionPaysLandCosts = this.bankFactionPaysLandCosts;
}
// -------------------------------------------- //
// UNIVERSE ENABLE SWITCH
// -------------------------------------------- //
public boolean enabled = true;
// -------------------------------------------- //
// SPECIAL FACTION IDS
// -------------------------------------------- //
public String factionIdNone = null;
public String factionIdSafezone = null;
public String factionIdWarzone = null;
// -------------------------------------------- //
// DEFAULTS
// -------------------------------------------- //
public String defaultPlayerFactionId = null;
public Rel defaultPlayerRole = null;
public double defaultPlayerPower = 0.0;
//public boolean defaultFactionOpen = false;
//public Map<FFlag, Boolean> defaultFactionFlags = null;
//public Map<FPerm, Set<Rel>> defaultFactionPerms = null;
// -------------------------------------------- //
// MESSAGES
// -------------------------------------------- //
public boolean broadcastNameChange = false;
// -------------------------------------------- //
// POWER
// -------------------------------------------- //
public double powerMax = 10.0;
public double powerMin = 0.0;
public double powerPerHour = 2.0;
public double powerPerDeath = -2.0;
public boolean canLeaveWithNegativePower = true;
// -------------------------------------------- //
// CORE
// -------------------------------------------- //
public int factionMemberLimit = 0;
public double factionPowerMax = 0.0;
public int factionNameLengthMin = 3;
public int factionNameLengthMax = 16;
public boolean factionNameForceUpperCase = false;
// -------------------------------------------- //
// CLAIMS
// -------------------------------------------- //
public boolean claimsMustBeConnected = true;
public boolean claimingFromOthersAllowed = true;
public boolean claimsCanBeUnconnectedIfOwnedByOtherFaction = false;
public int claimsRequireMinFactionMembers = 1;
public int claimedLandsMax = 0;
// -------------------------------------------- //
// HOMES
// -------------------------------------------- //
public boolean homesEnabled = true;
public boolean homesMustBeInClaimedTerritory = true;
public boolean homesTeleportCommandEnabled = true;
public boolean homesTeleportAllowedFromEnemyTerritory = true;
public boolean homesTeleportAllowedFromDifferentWorld = true;
public double homesTeleportAllowedEnemyDistance = 32.0;
public boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true;
public boolean homesTeleportToOnDeathActive = false;
public EventPriority homesTeleportToOnDeathPriority = null;
// -------------------------------------------- //
// ASSORTED
// -------------------------------------------- //
public boolean permanentFactionsDisableLeaderPromotion = false;
public double actionDeniedPainAmount = 2.0D;
public boolean disablePVPForFactionlessPlayers = false;
public boolean enablePVPAgainstFactionlessInAttackersLand = false;
public double territoryShieldFactor = 0.3D;
// -------------------------------------------- //
// DENY COMMANDS
// -------------------------------------------- //
// commands which will be prevented if the player is a member of a permanent faction
public List<String> denyCommandsPermanentFactionMember = null;
// commands which will be prevented when in claimed territory of another faction
public Map<Rel, List<String>> denyCommandsTerritoryRelation = null;
// -------------------------------------------- //
// INTEGRATION: LWC
// -------------------------------------------- //
public Map<EventFactionsChunkChangeType, Boolean> lwcRemoveOnChange = null;
// -------------------------------------------- //
// INTEGRATION: ECONOMY
// -------------------------------------------- //
public boolean econEnabled = false;
// TODO: Rename to include unit.
public double econLandReward = 0.00;
public String econUniverseAccount = null;
public Map<EventFactionsChunkChangeType, Double> econChunkCost = null;
public double econCostCreate = 200.0;
public double econCostSethome = 0.0;
public double econCostJoin = 0.0;
public double econCostLeave = 0.0;
public double econCostKick = 0.0;
public double econCostInvite = 0.0;
public double econCostDeinvite = 0.0;
public double econCostHome = 0.0;
public double econCostName = 0.0;
public double econCostDescription = 0.0;
public double econCostTitle = 0.0;
public double econCostOpen = 0.0;
public Map<Rel, Double> econRelCost = null;
//Faction banks, to pay for land claiming and other costs instead of individuals paying for them
public boolean bankEnabled = true;
//public static boolean bankMembersCanWithdraw = false; //Have to be at least moderator to withdraw or pay money to another faction
public boolean bankFactionPaysCosts = true; //The faction pays for faction command costs, such as sethome
public boolean bankFactionPaysLandCosts = true; //The faction pays for land claiming costs.
}
| [
"olof@sylt.nu"
] | olof@sylt.nu |
ccd86f43bc54f8097d16d765356d85235dff9902 | de61ec2cfadb8d5271539050084ba3c197e214ba | /Spring/SpringData/SpringDBUpdate/src/main/java/com/demo/model/FoodGroup.java | 22b5fc0e97ae3fb4cd27ce5ebe6aabe025166c55 | [] | no_license | subirkumar7/LearningCode | c959642a6aa002b33903160e251b04fd416c1072 | db27a56a097e344500890e9087aa4f51ac58338a | refs/heads/master | 2020-03-16T12:34:39.153771 | 2018-06-05T20:56:25 | 2018-06-05T20:56:25 | 132,670,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | package com.demo.model;
public class FoodGroup {
private int id;
private String name;
private String description;
public FoodGroup(){}
public FoodGroup(String name, String description){
this.name = name;
this.description=description;
}
public FoodGroup(int id, String name, String description){
this.id = id;
this.name = name;
this.description=description;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String talkAboutYourself() {
String answer = this.getId() +"|"+ this.getName().trim() +"|"+ this.getDescription().trim()+"|\n";
return answer;
}
}
| [
"sk@abc.com"
] | sk@abc.com |
ea7b964a44e87d319349d94b7760dde494af3ec7 | 245199dfc56b3fbd1617d6f621764f76b7507914 | /app/src/test/java/com/okan/startqueue/ExampleUnitTest.java | ba1e390e76324e07914ee4010b883f00421a553b | [] | no_license | OkancanCosar/StartingJobs | 13bacc1aa20b94c9ae1f874ebe72a30185fde60d | 724300ad08b74c4866aeffa9a6938d8215e2e193 | refs/heads/master | 2020-04-28T01:25:53.238203 | 2019-07-27T08:40:34 | 2019-07-27T08:40:34 | 174,856,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package com.okan.startqueue;
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);
}
} | [
"okan1cosar@gmail.com"
] | okan1cosar@gmail.com |
513ad32c9d9c9c052f384c95e3073f654bba25e5 | 07710dd8515d11b490fce9824fe677d764731039 | /app/src/main/java/com/alpha/productscanner/ui/ar/ArPresenter.java | 4b1c01fe85d420687ff05aa297ea47bf4e02530e | [] | no_license | ADX2099/as_goproject_android_arForAll | ccf33c29060ff201fe16cb5e03000ecb6db6ca69 | 86bcc62dc0994854508417c2c0a145886d846a9e | refs/heads/master | 2023-01-22T22:50:40.106635 | 2020-11-30T16:20:13 | 2020-11-30T16:20:13 | 317,279,603 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,057 | java | package com.alpha.productscanner.ui.ar;
import com.alpha.productscanner.dto.response.ResponseBrand;
import com.alpha.productscanner.dto.response.ResponseServer;
import com.alpha.productscanner.model.BrandModel;
public class ArPresenter implements ArInterface.Presenter {
BrandModel model;
ArActivity view;
public ArPresenter(ArActivity view){
model = new BrandModel(this);
this.view = view;
}
public void getBrand(int idBrand){
//validaciones de negocio
model.GetBrandInfoById(idBrand);
}
@Override
public void onSuccess(ResponseBrand response) {
if (response.getCode()==0){
if (response.getBrands().size()>0){
view.onSuccess(response.getBrands().get(0));
}else{
view.onFailure("Marca no encontrada.");
}
}else{
view.onFailure(response.getMessage());
}
}
@Override
public void onFailure(ResponseServer rerror) {
view.onFailure(rerror.getMessage());
}
}
| [
"adriang_84@hotmail.com"
] | adriang_84@hotmail.com |
9e740fd3c06953bcb24c8a5518c31fdf3ce6c751 | cfcb1fac2549feaaa36b61341a08cb3c5132dd96 | /src/main/java/com/gafis/xj/model/FileInfo.java | d47d28ab25d7d5ed1ffbdbb12b175e515b01b1e8 | [] | no_license | sxl531/xj | 234a6651eb12eb1a243da41665d23fc494369f65 | 9334a6ced9acaed314fffb24611fe81e594939cc | refs/heads/master | 2020-04-02T09:25:46.113595 | 2018-10-23T08:33:59 | 2018-10-23T08:33:59 | 154,292,429 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,300 | java | package com.gafis.xj.model;
import java.util.Date;
public class FileInfo {
private String pkId; //主键
private int programType; //程序类型:0:采集程序;1:补录程序
private String version; //版本号
private String fileName; //文件名
private String filePath; //文件路径
private String enableFlag; //禁用启用标志
private Date uploadTime; //上传时间
public String getPkId() {
return pkId;
}
public void setPkId(String pkId) {
this.pkId = pkId;
}
public int getProgramType() {
return programType;
}
public void setProgramType(int programType) {
this.programType = programType;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getEnableFlag() {
return enableFlag;
}
public void setEnableFlag(String enableFlag) {
this.enableFlag = enableFlag;
}
public Date getUploadTime() {
return uploadTime;
}
public void setUploadTime(Date uploadTime) {
this.uploadTime = uploadTime;
}
}
| [
"337944232@qq.com"
] | 337944232@qq.com |
d0e62076cf843aa2cbc0333306c42c484895c945 | 96e20b4109da34fff8a1f7f1bbc9400b380522a8 | /licenseIntegration.gui/src/licenseIntegration/gui/MainWindow.java | d95d880ea1f8efb77918d3a21ad2b9a3c18f72fe | [
"Apache-2.0"
] | permissive | florianwittmann/master-thesis | 8dae9c5347af40f0e980feab090b2a75b615ab32 | b24b635e30b756ef6648f0461fd29723b07ea343 | refs/heads/master | 2016-08-06T23:42:02.944759 | 2015-04-04T20:09:16 | 2015-04-04T20:09:16 | 33,418,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,673 | java | package licenseIntegration.gui;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumnModel;
import org.jvalue.licenseintegration.common.LicenseVectorJSONLoader;
import org.jvalue.licenseintegration.modell.IllegalLicenseCombinationException;
import org.jvalue.licenseintegration.modell.LicenseAttribute;
import org.jvalue.licenseintegration.modell.LicenseVector;
public class MainWindow implements ActionListener
{
final static String lineSeparator = System.getProperty("line.separator");
JFrame mainWindow;
JMenuItem addLicenseMenuItem;
JFileChooser chooser;
JMenuItem resetLicensesMenuItem;
JLabel label;
JTable table = new JTable();
ArrayList<LicenseVector> licenseVectors = new ArrayList<LicenseVector>();
ArrayList<String> tableHeaders = new ArrayList<String>();
public static void main(String[] args)
{
new MainWindow();
}
public MainWindow() {
mainWindow = new JFrame("LicenseIntegration");
mainWindow.setSize(700,500);
//mainWindow.add(new JLabel("Beispiel JLabel"));
JMenuBar menuBar = new JMenuBar();
//Build the first menu.
JMenu menu = new JMenu("Licenses");
menu.setMnemonic(KeyEvent.VK_F);
menuBar.add(menu);
//a group of JMenuItems
addLicenseMenuItem = new JMenuItem("Add",
KeyEvent.VK_A);
addLicenseMenuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_A, ActionEvent.ALT_MASK));
addLicenseMenuItem.addActionListener(this);
menu.add(addLicenseMenuItem);
resetLicensesMenuItem = new JMenuItem("Reset",
KeyEvent.VK_R);
resetLicensesMenuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_R, ActionEvent.ALT_MASK));
resetLicensesMenuItem.addActionListener(this);
menu.add(resetLicensesMenuItem);
mainWindow.add(menuBar, BorderLayout.NORTH);
label = new JLabel("No license yet. Add the first license to start.",SwingConstants.CENTER);
table = new JTable(0,0);
table.setVisible(false);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
mainWindow.add(scrollPane, BorderLayout.CENTER);
mainWindow.add(label, BorderLayout.SOUTH);
table.setFillsViewportHeight(true);
mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainWindow.setVisible(true);
chooser = new JFileChooser();
}
private void redrawLicenseTable() {
StringBuilder error = null;
if(licenseVectors.size()==0) {
table.setVisible(false);
table.setModel(new DefaultTableModel(0,0));
label.setVisible(true);
return;
} else {
table.setVisible(true);
label.setVisible(false);
}
int count = licenseVectors.size() == 1 ? 2 : licenseVectors.size()+2;
DefaultTableModel tableModel = new DefaultTableModel(0,count) {
@Override
public boolean isCellEditable(int row, int column) {
//all cells false
return false;
}
};
tableModel.setColumnCount(count);
LicenseVector licenseVector = null;
for(int i=0; i< count-1; i++) {
LicenseVector colLicenseVector;
if(i==licenseVectors.size()) {
colLicenseVector = licenseVector;
} else {
colLicenseVector = licenseVectors.get(i);
try {
licenseVector = licenseVector==null ?
colLicenseVector : licenseVector.combineWith(colLicenseVector);
} catch (IllegalLicenseCombinationException e) {
error = new StringBuilder();
error.append("Illegal license combination!" + lineSeparator);
error.append(e.getMessage() + lineSeparator);
if(i==1) {
error.append("Conflicting: " + tableHeaders.get(i-1) + " and " + tableHeaders.get(i) + lineSeparator);
} else {
error.append("Successfully combined licenses " + 1 + "-" + i + " to following licensevector:" + lineSeparator);
error.append(licenseVector + lineSeparator);
error.append("Conflict in combining this with " + tableHeaders.get(i) + lineSeparator );
}
licenseVector = null;
}
}
ArrayList<LicenseAttribute> attributes = new ArrayList<LicenseAttribute>();
if(colLicenseVector != null)
attributes =colLicenseVector.getAttributes();
for(int j = 0; j<attributes.size(); j++) {
int tableRow = getOrCreateTableRowFor(tableModel, attributes.get(j));
tableModel.setValueAt(attributes.get(j).getValue().toString(), tableRow, i+1);
}
}
table.setModel(tableModel);
JTableHeader th = table.getTableHeader();
TableColumnModel tcm = th.getColumnModel();
th.setReorderingAllowed(false);
TableColumnModel colModel = table.getColumnModel();
for(int i=0; i<count;i++) {
colModel.getColumn(i).setPreferredWidth(150);
String headerValue;
if(i==0) {
headerValue="Attribute";
} else if(count > 2 && i==count-1) {
headerValue="Combined result";
} else {
headerValue = tableHeaders.get(i-1);
}
tcm.getColumn(i).setHeaderValue(headerValue);
}
th.repaint();
if(error!=null)
JOptionPane.showMessageDialog(mainWindow, error.toString());
}
private int getOrCreateTableRowFor(DefaultTableModel tableModel, LicenseAttribute licenseAttribute) {
for(int i=0; i< tableModel.getRowCount(); i++) {
if(tableModel.getValueAt(i, 0).toString().equals(licenseAttribute.getName())) {
return i;
}
}
int rowCount = tableModel.getRowCount();
tableModel.setRowCount(rowCount+1);
tableModel.setValueAt(licenseAttribute.getName(), rowCount, 0);
return rowCount;
}
@Override
public void actionPerformed(ActionEvent event) {
if (event.getSource() == addLicenseMenuItem){
int returnVal = chooser.showOpenDialog(null);
if(returnVal == JFileChooser.APPROVE_OPTION) {
tableHeaders.add(chooser.getSelectedFile().getName());
addLicense(chooser.getSelectedFile().getAbsolutePath());
redrawLicenseTable();
}
} else if (event.getSource() == resetLicensesMenuItem){
licenseVectors.clear();
tableHeaders.clear();
redrawLicenseTable();
}
}
private void addLicense(String filePath) {
try {
LicenseVector vector = new LicenseVectorJSONLoader().loadLicenseVectorFromFile(filePath);
licenseVectors.add(vector);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
} | [
"dev@florianwittmann.de"
] | dev@florianwittmann.de |
8dc3d80ff270c0182d454a02d6a8b96047823945 | 1490723c47743f2b836dee1d4370d6ead60afcfd | /src/main/java/cursoSelenium/utils/LogUtils.java | d2c3bcbbfbbc0432ba0b80e7dd8b5f60a756cf53 | [] | no_license | rflnavas/SeleniumCourse | 56be587c6dfb1cdec8de39ad1bda276ef12a7e03 | abed1edbcf5891924d8c9b6ad7b285bb42c30543 | refs/heads/master | 2021-01-17T21:20:36.727081 | 2016-09-19T21:32:12 | 2016-09-19T21:32:12 | 68,611,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 452 | java | package cursoSelenium.utils;
import java.io.InputStream;
import org.apache.log4j.PropertyConfigurator;
public class LogUtils {
private LogUtils() {
}
public static void prepareConfig(Class<?> clazz){
InputStream is = clazz.getClassLoader()
.getResourceAsStream("log4j.properties");
PropertyConfigurator.configure(is);
}
public static int getLineNumber(){
return Thread.currentThread().getStackTrace()[2].getLineNumber();
}
}
| [
"rafanavas2005@gmail.com"
] | rafanavas2005@gmail.com |
623487aacc40dbb4fadcbfc3b0598b70c4f01694 | 854474ec1363f38cd8e45023c3e690fe77c1684f | /150324_JAVA_BASIC/src/p150409_Chapter10/Ex10_05_EnumEx.java | e71b59699b3b3c6f3bd4e3b62be88d8578cb8b22 | [] | no_license | laction/demo | 4cc1da2a1429cb89cf27e19bbab2dcaa49621a6e | 52fad0c6fd7edd1e43fabcae6912e9010480f9b0 | refs/heads/master | 2020-04-06T06:46:24.319585 | 2015-04-30T07:31:12 | 2015-04-30T07:31:12 | 34,836,577 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,083 | java | package p150409_Chapter10;
// 열거형 예제
// enum : 5.0 이후부터 예약어임.
public class Ex10_05_EnumEx {
public enum Lesson{
JAVA,XML,EJB,JSP,Spring
}
public static void main(String[] args) {
Lesson le = Lesson.JAVA;
System.out.println("Lesson : "+le);
System.out.println("XML : " + Lesson.XML);
System.out.println("JSP : " + Lesson.JSP);
System.out.println("Spring : " + Lesson.Spring);
if(le instanceof Object){
System.out.println("나는 le 객체다");
System.out.println(le.toString());
System.out.println(le.getClass());
System.out.println("저장된 변수 값 : "+ le.ordinal());
}
Lesson [] lessons = Lesson.values();
System.out.println("lessons.length : " + lessons.length);
for(Lesson e : lessons) System.out.println(e+" : "+e.ordinal());
}
}
//Lesson : JAVA
//XML : XML
//JSP : JSP
//Spring : Spring
//나는 le 객체다
//JAVA
//class p150409_Chapter10.Ex10_05_EnumEx$Lesson
//저장된 변수 값 : 0
//lessons.length : 5
//JAVA : 0
//XML : 1
//EJB : 2
//JSP : 3
//Spring : 4
| [
"laction0@gmail.com"
] | laction0@gmail.com |
284afc74e26bde06b78dabbf789e92636e84c0e1 | 82d5a039008e3e310aeeae854e549a9281b6f49e | /ckcbe/src/main/java/sudhesh/controller/ConnectController.java | a6f01a369e8d7cf988dbdccb91495a198796d5c6 | [] | no_license | SudheshRao/connectkincircle | ac70ad3f7f9916917991d66e93e5083af8012bbd | 1bc3de8e8f982718b91eff3988198d6fab3adf9e | refs/heads/master | 2020-12-24T09:23:10.523630 | 2017-01-19T06:31:23 | 2017-01-19T06:31:23 | 73,295,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,761 | java | package sudhesh.controller;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import sudhesh.DAO.ConnectDaoImpl;
import sudhesh.DAO.kinDAOImpl;
import sudhesh.model.Connects;
import sudhesh.model.Errore;
import sudhesh.model.Kin;
import sudhesh.model.Notifications;
@Controller
public class ConnectController {
@Autowired
private ConnectDaoImpl connectdao;
@Autowired
private kinDAOImpl kindao;
@RequestMapping(value="/connectrequest",method=RequestMethod.POST)
public ResponseEntity<?> sendFriendRequest(@RequestBody String name,HttpSession session){
Kin kin=(Kin) session.getAttribute("kin");
if(kin==null)
return new ResponseEntity<Errore>(new Errore(1,"Unauthorized user"),HttpStatus.UNAUTHORIZED);
else{
connectdao.sendconnectRequest(kin.getName(),name);
Notifications notify =new Notifications();
notify.setFromkin(kin.getName());
notify.setTokin(name);
notify.setNotifiy("You have recieved a connect request from "+kin.getName());
notify.setTim(Calendar.getInstance().getTime());
connectdao.savenotification(notify);
Notifications notifyme =new Notifications();
notifyme.setFromkin("CKC");
notifyme.setTokin(kin.getName());
notifyme.setNotifiy("You have sent Connect request to "+name);
notifyme.setTim(Calendar.getInstance().getTime());
connectdao.savenotification(notifyme);
return new ResponseEntity<Void>(HttpStatus.OK);
}
}
@RequestMapping(value="/getAllConnects",method=RequestMethod.GET)
public ResponseEntity<?> getAllFriends(HttpSession session){
Kin kin=(Kin)session.getAttribute("kin");
if(kin!=null){
List<Kin> k=new ArrayList<Kin>();
List<Connects> connects=connectdao.getConnects(kin.getName());
if(connects!=null){
for(Connects c:connects){
if(c.getFromId()==kin.getName())
k.add(kindao.getKinByName(c.getToId()));
else k.add(kindao.getKinByName(c.getFromId()));
}
}
return new ResponseEntity<List<Kin>>(k,HttpStatus.OK);
}
else
return new ResponseEntity<Errore>(new Errore(1,"Unauthorized user"),HttpStatus.UNAUTHORIZED);
}
@RequestMapping(value="/updateConnectRequest/{connectStatus}/{fromId}",method=RequestMethod.PUT)
public ResponseEntity<?> updatePendingRequest(@PathVariable(value="connectStatus") char connectstatus,@PathVariable(value="fromId") String fromId,HttpSession session){
Kin kin=(Kin)session.getAttribute("kin");
if(kin==null)
return new ResponseEntity<Errore>(new Errore(1,"Unauthorized user"),HttpStatus.UNAUTHORIZED);
else{
connectdao.updatePendingRequest(connectstatus,fromId,kin.getName());
Notifications notify =new Notifications();
if(connectstatus=='A')
{notify.setFromkin(kin.getName());
notify.setTokin(fromId);
notify.setNotifiy(kin.getName()+" has accepted your Connect request ");
notify.setTim(Calendar.getInstance().getTime());
connectdao.savenotification(notify);}
else{notify.setFromkin(kin.getName());
notify.setTokin(fromId);
notify.setNotifiy("Sorry!!! "+kin.getName()+" has denied your Connect request ");
notify.setTim(Calendar.getInstance().getTime());
connectdao.savenotification(notify);
}
return new ResponseEntity<Void>(HttpStatus.OK);
}
}
@RequestMapping(value="/pendingrequest",method=RequestMethod.GET)
public ResponseEntity<?> getAllPendingRequest(HttpSession session){
Kin kin=(Kin)session.getAttribute("kin");
if(kin==null)
return new ResponseEntity<Errore>(new Errore(1,"Unauthorized user"),HttpStatus.UNAUTHORIZED);
else{
List<Kin> k=new ArrayList<Kin>();
List<Connects> pendingRequest=connectdao.getPendingRequest(kin.getName());
if(pendingRequest!=null){
for(Connects c:pendingRequest){
k.add(kindao.getKinByName(c.getFromId()));
}
}
return new ResponseEntity<List<Kin>>(k,HttpStatus.OK);
}
}
//get all Kins
@RequestMapping(value="/getAllKins",method=RequestMethod.GET)
public ResponseEntity<?> getAllKins(HttpSession session){
Kin pkin=(Kin) session.getAttribute("kin");
if(pkin==null)
return new ResponseEntity<Errore>(new Errore(1,"Unauthorized user"),HttpStatus.UNAUTHORIZED);
List<Kin> fkin=connectdao.getiConnects(pkin.getName());
return new ResponseEntity<List<Kin>>(fkin,HttpStatus.OK);
}
}
| [
"sudheshraop@gmail.com"
] | sudheshraop@gmail.com |
90e4b4881786f81136fd2488e47d4015c15e64e1 | 3ffd5fd90abdb626cd7ec2bd466b90aff8d72561 | /src/bolt/WordCounter.java | 8a8a90c13b29c3b9ecc06822102591921364cd36 | [] | no_license | ferrisbueller/storm-example | 0fe2a30b13be811726a40461a4434a24ecffed32 | e28a94c0e45d9439b9badf1743caca111592c401 | refs/heads/master | 2021-01-18T18:25:18.414799 | 2014-11-25T06:17:36 | 2014-11-25T06:17:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,594 | java | package bolt;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.IRichBolt;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.tuple.Tuple;
public class WordCounter implements IRichBolt {
private TopologyContext context ;
private OutputCollector collector;
Map<String , Integer> wordCounts;
String name;
Integer id;
@Override
public void prepare(Map stormConf, TopologyContext context,
OutputCollector collector) {
this.context = context ;
this.collector = collector;
this.name = context.getThisComponentId();
this.id = context.getThisTaskId();
wordCounts = new HashMap<String , Integer>();
}
@Override
public void execute(Tuple input) {
String word = input.getString(0);
if (!wordCounts.containsKey(word)) {
wordCounts.put(word, 1);
} else {
Integer prevCount = wordCounts.get(word);
wordCounts.put(word , prevCount + 1);
}
collector.ack(input);
}
@Override
public void cleanup() {
System.out.println("Cleanup happening");
for (Entry<String, Integer> wordCount : wordCounts.entrySet()) {
System.out.println("Word Count for " + wordCount.getKey() + " is " + wordCount.getValue());
}
System.out.println("Cleanup completed");
}
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
// DECLARE NOTHING
}
@Override
public Map<String, Object> getComponentConfiguration() {
// TODO Auto-generated method stub
return null;
}
}
| [
"ravi@ravi-ThinkPad-T420.(none)"
] | ravi@ravi-ThinkPad-T420.(none) |
35ebb521c979fb7b6bc657c68d17c94a3e91d5d4 | 16d4dcfe24ba267c508ca5f7f88082a5341c27b3 | /app/src/main/java/com/shangwf/app/utils/NumberUtil.java | abfd40d83000a1c4f27960c540acc774907bf0dc | [] | no_license | shangwfa/ComAPP | 1c1eb1a8383a3bf6f47132dd0ea577a99011a6aa | 6cdea61d914d47ff16be238a9f5293a4620d3c23 | refs/heads/master | 2020-12-24T18:51:40.923021 | 2016-05-13T08:25:59 | 2016-05-13T08:25:59 | 58,244,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,032 | java | package com.shangwf.app.utils;
/**
* @author MaTianyu
* @date 2014-11-21
*/
public class NumberUtil {
public static int convertToint(String intStr, int defValue) {
try {
return Integer.parseInt(intStr);
} catch (NumberFormatException e) {
//e.printStackTrace();
}
return defValue;
}
public static long convertTolong(String longStr, long defValue) {
try {
return Long.parseLong(longStr);
} catch (NumberFormatException e) {
//e.printStackTrace();
}
return defValue;
}
public static float convertTofloat(String fStr, float defValue) {
try {
return Float.parseFloat(fStr);
} catch (NumberFormatException e) {
//e.printStackTrace();
}
return defValue;
}
public static double convertTodouble(String dStr, double defValue) {
try {
return Double.parseDouble(dStr);
} catch (NumberFormatException e) {
//e.printStackTrace();
}
return defValue;
}
public static Integer convertToInteger(String intStr) {
try {
return Integer.parseInt(intStr);
} catch (NumberFormatException e) {
//e.printStackTrace();
}
return null;
}
public static Long convertToLong(String longStr) {
try {
return Long.parseLong(longStr);
} catch (NumberFormatException e) {
//e.printStackTrace();
}
return null;
}
public static Float convertToFloat(String fStr) {
try {
return Float.parseFloat(fStr);
} catch (NumberFormatException e) {
//e.printStackTrace();
}
return null;
}
public static Double convertToDouble(String dStr) {
try {
return Double.parseDouble(dStr);
} catch (NumberFormatException e) {
//e.printStackTrace();
}
return null;
}
}
| [
"shangwfa@126.com"
] | shangwfa@126.com |
d3abec2cf7b02f4eac4de15d686ba9fb2adf2bf2 | ad9166789c4ca76c75a3bc5d0f4c4566299fd9dd | /app/src/main/java/com/quixomtbx/jewelrap/app.java | c5d561ac5ebf02897ae55f816b8c910ee203812b | [] | no_license | PiyushSinghk41/JewelRap | 7d31eeca44a1b7482b6645f8b881018ffb77b3ba | 03ba6088ce0d3b7c3506bad761f776b124fb48f5 | refs/heads/master | 2021-04-12T09:50:30.110248 | 2017-12-15T08:28:53 | 2017-12-15T08:28:56 | 126,442,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.quixomtbx.jewelrap;
import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;
/**
* Created by c31 on 6/30/2016.
*/
public class app extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
| [
"mukulraw199517@gmail.com"
] | mukulraw199517@gmail.com |
5dc1c63f252416fe75881fabe4e40ece80084626 | e0fd595a98ca7a23ecf90f4c08801bf7e0361bf2 | /results_without_immortals/annotated/UrlValidator/1/UrlValidator.java | 2257ec44fecce23bf5caca9c5ed2b9476b86ed33 | [] | no_license | amchristi/AdFL | 690699a1c3d0d0e84e412b79826aa1b51b572979 | 40c879e7fe5f87afbf4abc29e442a6e37b1e6541 | refs/heads/master | 2021-12-15T11:43:07.539575 | 2019-07-18T05:56:21 | 2019-07-18T05:56:21 | 176,834,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,445 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.validator.routines;
import java.io.Serializable;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.*;
/**
* <p><b>URL Validation</b> routines.</p>
* Behavior of validation is modified by passing in options:
* <ul>
* <li>ALLOW_2_SLASHES - [FALSE] Allows double '/' characters in the path
* component.</li>
* <li>NO_FRAGMENT- [FALSE] By default fragments are allowed, if this option is
* included then fragments are flagged as illegal.</li>
* <li>ALLOW_ALL_SCHEMES - [FALSE] By default only http, https, and ftp are
* considered valid schemes. Enabling this option will let any scheme pass validation.</li>
* </ul>
*
* <p>Originally based in on php script by Debbie Dyer, validation.php v1.2b, Date: 03/07/02,
* http://javascript.internet.com. However, this validation now bears little resemblance
* to the php original.</p>
* <pre>
* Example of usage:
* Construct a UrlValidator with valid schemes of "http", and "https".
*
* String[] schemes = {"http","https"}.
* UrlValidator urlValidator = new UrlValidator(schemes);
* if (urlValidator.isValid("ftp://foo.bar.com/")) {
* System.out.println("url is valid");
* } else {
* System.out.println("url is invalid");
* }
*
* prints "url is invalid"
* If instead the default constructor is used.
*
* UrlValidator urlValidator = new UrlValidator();
* if (urlValidator.isValid("ftp://foo.bar.com/")) {
* System.out.println("url is valid");
* } else {
* System.out.println("url is invalid");
* }
*
* prints out "url is valid"
* </pre>
*
* @see
* <a href="http://www.ietf.org/rfc/rfc2396.txt">
* Uniform Resource Identifiers (URI): Generic Syntax
* </a>
*
* @version $Revision: 1713573 $
* @since Validator 1.4
*/
public class UrlValidator implements Serializable {
private static final long serialVersionUID = 7557161713937335013L;
/**
* Allows all validly formatted schemes to pass validation instead of
* supplying a set of valid schemes.
*/
public static final long ALLOW_ALL_SCHEMES = 1 << 0;
/**
* Allow two slashes in the path component of the URL.
*/
public static final long ALLOW_2_SLASHES = 1 << 1;
/**
* Enabling this options disallows any URL fragments.
*/
public static final long NO_FRAGMENTS = 1 << 2;
/**
* Allow local URLs, such as http://localhost/ or http://machine/ .
* This enables a broad-brush check, for complex local machine name
* validation requirements you should create your validator with
* a {@link RegexValidator} instead ({@link #UrlValidator(RegexValidator, long)})
*/
public static final long ALLOW_LOCAL_URLS = 1 << 3;
/**
* This expression derived/taken from the BNF for URI (RFC2396).
*/
private static final String URL_REGEX = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?";
// 12 3 4 5 6 7 8 9
private static final Pattern URL_PATTERN = Pattern.compile(URL_REGEX);
/**
* Schema/Protocol (ie. http:, ftp:, file:, etc).
*/
private static final int PARSE_URL_SCHEME = 2;
/**
* Includes hostname/ip and port number.
*/
private static final int PARSE_URL_AUTHORITY = 4;
private static final int PARSE_URL_PATH = 5;
private static final int PARSE_URL_QUERY = 7;
private static final int PARSE_URL_FRAGMENT = 9;
/**
* Protocol scheme (e.g. http, ftp, https).
*/
private static final String SCHEME_REGEX = "^\\p{Alpha}[\\p{Alnum}\\+\\-\\.]*";
private static final Pattern SCHEME_PATTERN = Pattern.compile(SCHEME_REGEX);
// Drop numeric, and "+-." for now
// TODO does not allow for optional userinfo.
// Validation of character set is done by isValidAuthority
// allows for IPV4 but not IPV6
private static final String AUTHORITY_CHARS_REGEX = "\\p{Alnum}\\-\\.";
// do this as separate match because : could cause ambiguity with port prefix
private static final String IPV6_REGEX = "[0-9a-fA-F:]+";
// userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
// sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
// We assume that password has the same valid chars as user info
private static final String USERINFO_CHARS_REGEX = "[a-zA-Z0-9%-._~!$&'()*+,;=]";
// since neither ':' nor '@' are allowed chars, we don't need to use non-greedy matching
private static final String USERINFO_FIELD_REGEX = // At least one character for the name
USERINFO_CHARS_REGEX + "+:" + USERINFO_CHARS_REGEX + // password may be absent
"*@";
private static final String AUTHORITY_REGEX = "(?:\\[(" + IPV6_REGEX + ")\\]|(?:(?:" + USERINFO_FIELD_REGEX + ")?([" + AUTHORITY_CHARS_REGEX + "]*)))(:\\d*)?(.*)?";
// 1 e.g. user:pass@ 2 3 4
private static final Pattern AUTHORITY_PATTERN = Pattern.compile(AUTHORITY_REGEX);
private static final int PARSE_AUTHORITY_IPV6 = 1;
// excludes userinfo, if present
private static final int PARSE_AUTHORITY_HOST_IP = 2;
// Not needed, because it is validated by AUTHORITY_REGEX
// private static final int PARSE_AUTHORITY_PORT = 3;
/**
* Should always be empty. The code currently allows spaces.
*/
private static final int PARSE_AUTHORITY_EXTRA = 4;
private static final String PATH_REGEX = "^(/[-\\w:@&?=+,.!/~*'%$_;\\(\\)]*)?$";
private static final Pattern PATH_PATTERN = Pattern.compile(PATH_REGEX);
private static final String QUERY_REGEX = "^(.*)$";
private static final Pattern QUERY_PATTERN = Pattern.compile(QUERY_REGEX);
/**
* Holds the set of current validation options.
*/
private final long options;
/**
* The set of schemes that are allowed to be in a URL.
*/
// Must be lower-case
private final Set<String> allowedSchemes;
/**
* Regular expressions used to manually validate authorities if IANA
* domain name validation isn't desired.
*/
private final RegexValidator authorityValidator;
/**
* If no schemes are provided, default to this set.
*/
// Must be lower-case
private static final String[] DEFAULT_SCHEMES = { "http", "https", "ftp" };
/**
* Singleton instance of this class with default schemes and options.
*/
private static final UrlValidator DEFAULT_URL_VALIDATOR = new UrlValidator();
/**
* Returns the singleton instance of this class with default schemes and options.
* @return singleton instance with default schemes and options
*/
public static UrlValidator getInstance() {
writelineStatic("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "17bd1d20-2785-422a-b0f5-6429660edb92");
return DEFAULT_URL_VALIDATOR;
}
/**
* Create a UrlValidator with default properties.
*/
public UrlValidator() {
this(null);
}
/**
* Behavior of validation is modified by passing in several strings options:
* @param schemes Pass in one or more url schemes to consider valid, passing in
* a null will default to "http,https,ftp" being valid.
* If a non-null schemes is specified then all valid schemes must
* be specified. Setting the ALLOW_ALL_SCHEMES option will
* ignore the contents of schemes.
*/
public UrlValidator(String[] schemes) {
this(schemes, 0L);
}
/**
* Initialize a UrlValidator with the given validation options.
* @param options The options should be set using the public constants declared in
* this class. To set multiple options you simply add them together. For example,
* ALLOW_2_SLASHES + NO_FRAGMENTS enables both of those options.
*/
public UrlValidator(long options) {
this(null, null, options);
}
/**
* Behavior of validation is modified by passing in options:
* @param schemes The set of valid schemes. Ignored if the ALLOW_ALL_SCHEMES option is set.
* @param options The options should be set using the public constants declared in
* this class. To set multiple options you simply add them together. For example,
* ALLOW_2_SLASHES + NO_FRAGMENTS enables both of those options.
*/
public UrlValidator(String[] schemes, long options) {
this(schemes, null, options);
}
/**
* Initialize a UrlValidator with the given validation options.
* @param authorityValidator Regular expression validator used to validate the authority part
* This allows the user to override the standard set of domains.
* @param options Validation options. Set using the public constants of this class.
* To set multiple options, simply add them together:
* <p><code>ALLOW_2_SLASHES + NO_FRAGMENTS</code></p>
* enables both of those options.
*/
public UrlValidator(RegexValidator authorityValidator, long options) {
this(null, authorityValidator, options);
}
/**
* Customizable constructor. Validation behavior is modifed by passing in options.
* @param schemes the set of valid schemes. Ignored if the ALLOW_ALL_SCHEMES option is set.
* @param authorityValidator Regular expression validator used to validate the authority part
* @param options Validation options. Set using the public constants of this class.
* To set multiple options, simply add them together:
* <p><code>ALLOW_2_SLASHES + NO_FRAGMENTS</code></p>
* enables both of those options.
*/
public UrlValidator(String[] schemes, RegexValidator authorityValidator, long options) {
this.options = options;
if (isOn(ALLOW_ALL_SCHEMES)) {
allowedSchemes = Collections.emptySet();
} else {
if (schemes == null) {
schemes = DEFAULT_SCHEMES;
}
allowedSchemes = new HashSet<String>(schemes.length);
for (int i = 0; i < schemes.length; i++) {
allowedSchemes.add(schemes[i].toLowerCase(Locale.ENGLISH));
}
}
this.authorityValidator = authorityValidator;
}
/**
* <p>Checks if a field has a valid url address.</p>
*
* Note that the method calls #isValidAuthority()
* which checks that the domain is valid.
*
* @param value The value validation is being performed on. A <code>null</code>
* value is considered invalid.
* @return true if the url is valid.
*/
public boolean isValid(String value) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "af436f38-6abe-4deb-a069-35e23b51f69e");
if (value == null) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "be4243dc-4390-4355-9fc4-15816f6e2188");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "aab4bcb0-aae0-4933-b4d9-f2ea0f2585b5");
// Check the whole url address structure
Matcher urlMatcher = URL_PATTERN.matcher(value);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "acf092bc-7989-4fc7-8876-5730647335c3");
if (!urlMatcher.matches()) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "0e4c3819-75ab-4744-abda-7d4dd57ea652");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "2df3bb1a-0667-42aa-8ac5-f3beb2215960");
String scheme = urlMatcher.group(PARSE_URL_SCHEME);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "b16e690f-ae40-4664-874c-dc8327651a6e");
if (!isValidScheme(scheme)) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "8f5ca61f-c320-4ba2-86d0-850ffd594464");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "7785e91d-ea69-48eb-8eae-b22a1ebc5513");
String authority = urlMatcher.group(PARSE_URL_AUTHORITY);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "3d7b005b-0997-4372-9f46-3c070fea0622");
if ("file".equals(scheme)) {
// drop through to continue validation
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "33e81cf0-564e-4d8b-a8d7-71322a5d0fad");
// Special case - file: allows an empty authority
if (!"".equals(authority)) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "5f6a5bfc-6e0c-40ad-bff4-02db599172f4");
if (authority.contains(":")) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "f8dcb65a-383d-41e5-b50e-b218ada9c156");
// but cannot allow trailing :
return false;
}
}
} else {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "98e1bb0d-377d-48b4-b41d-d978cdd9ee22");
// Validate the authority
if (!isValidAuthority(authority)) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "49d6e0b2-4ec5-4efa-92e4-b3bdf64241fe");
return false;
}
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "56a34640-74fe-410d-8ba0-b1812e177b8e");
if (!isValidPath(urlMatcher.group(PARSE_URL_PATH))) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "547377bd-3307-486f-8b26-cd3d1529ee46");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "8447000e-f69f-4852-ae5b-0fc6398a2ad3");
if (!isValidQuery(urlMatcher.group(PARSE_URL_QUERY))) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "d1e0f16a-8402-4a28-b11f-852bf11ce6c0");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "02023f0c-6564-4b52-9d6d-62699f278c53");
if (!isValidFragment(urlMatcher.group(PARSE_URL_FRAGMENT))) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "2593bca1-d944-4d87-9cc8-7477a4ff07ab");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "74819e34-cbf4-4446-b373-1983097f57d5");
return true;
}
/**
* Validate scheme. If schemes[] was initialized to a non null,
* then only those schemes are allowed.
* Otherwise the default schemes are "http", "https", "ftp".
* Matching is case-blind.
* @param scheme The scheme to validate. A <code>null</code> value is considered
* invalid.
* @return true if valid.
*/
protected boolean isValidScheme(String scheme) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "ffb92ffd-675b-4f2e-9b66-4e159f52841f");
if (scheme == null) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "b9a7ebc1-8c9d-4113-98f6-3b0814b9587e");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "efe27fd7-d7c0-43f2-b88d-b9138b1849b4");
// TODO could be removed if external schemes were checked in the ctor before being stored
if (!SCHEME_PATTERN.matcher(scheme).matches()) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "33bd90db-b2e4-4998-ac4b-5666a47d5201");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "a1ee5d86-a909-4c11-8703-652e800370ab");
if (isOff(ALLOW_ALL_SCHEMES) && !allowedSchemes.contains(scheme.toLowerCase(Locale.ENGLISH))) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "b1302111-81b7-4739-8419-ebb2e4cddbdb");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "09e63d3c-1da7-4c35-bc5f-576ecf001792");
return true;
}
/**
* Returns true if the authority is properly formatted. An authority is the combination
* of hostname and port. A <code>null</code> authority value is considered invalid.
* Note: this implementation validates the domain unless a RegexValidator was provided.
* If a RegexValidator was supplied and it matches, then the authority is regarded
* as valid with no further checks, otherwise the method checks against the
* AUTHORITY_PATTERN and the DomainValidator (ALLOW_LOCAL_URLS)
* @param authority Authority value to validate, alllows IDN
* @return true if authority (hostname and port) is valid.
*/
protected boolean isValidAuthority(String authority) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "f8883285-3728-4438-850a-514df642fac2");
if (authority == null) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "0cf3d2c0-a71e-49b5-914f-502ce60c6f68");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "740e1773-807a-4127-b230-d58c2cc7ca80");
// check manual authority validation if specified
if (authorityValidator != null && authorityValidator.isValid(authority)) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "100ceaf2-3410-4c5c-b185-1343d95058c7");
return true;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "65f4807a-207d-4fa6-94cb-b1948b93401b");
// convert to ASCII if possible
final String authorityASCII = DomainValidator.unicodeToASCII(authority);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "2fa0faaf-5d35-4951-aef3-683335c75f2e");
Matcher authorityMatcher = AUTHORITY_PATTERN.matcher(authorityASCII);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "8be7781d-c4c1-4e0d-a605-47ddd5c153c0");
if (!authorityMatcher.matches()) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "74c3d2e5-7016-44ea-b57b-0703089ba88b");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "a7be9c04-ac19-45f4-bebb-46ae561b2711");
// We have to process IPV6 separately because that is parsed in a different group
String ipv6 = authorityMatcher.group(PARSE_AUTHORITY_IPV6);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "56a17bf4-a375-4b7e-a901-adde3f537323");
if (ipv6 != null) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "c1e92493-b146-4014-ba76-02b9598122cc");
InetAddressValidator inetAddressValidator = InetAddressValidator.getInstance();
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "09e1f5d8-c62a-475d-b4ee-f269b4ac18e0");
if (!inetAddressValidator.isValidInet6Address(ipv6)) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "d73c9c43-9f91-49e2-b2ca-ab7a8959b357");
return false;
}
} else {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "40eb40fa-6a77-4b32-ac76-f75179562f0d");
String hostLocation = authorityMatcher.group(PARSE_AUTHORITY_HOST_IP);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "a41acb66-2f07-449e-ae6b-2e8475ff27bc");
// check if authority is hostname or IP address:
// try a hostname first since that's much more likely
DomainValidator domainValidator = DomainValidator.getInstance(isOn(ALLOW_LOCAL_URLS));
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "78b5aaa1-36e4-4659-97b4-578b664f5c58");
if (!domainValidator.isValid(hostLocation)) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "534137c2-23f4-4b62-a6be-1fb5b377d83b");
// try an IPv4 address
InetAddressValidator inetAddressValidator = InetAddressValidator.getInstance();
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "1ea90cc2-0955-413e-9d33-ad24b4e08966");
if (!inetAddressValidator.isValidInet4Address(hostLocation)) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "081e5c29-9624-4ec6-a52a-99d3e91bf5c4");
// isn't IPv4, so the URL is invalid
return false;
}
}
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "4cd02165-d80a-4717-8ae0-655fdc5d2836");
String extra = authorityMatcher.group(PARSE_AUTHORITY_EXTRA);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "15acbb63-51a1-44c4-9fbd-5564d30557b5");
if (extra != null && extra.trim().length() > 0) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "423845db-7d71-46b0-8ead-5dd681f1df66");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "be2d9a78-aa51-487e-9222-a9850e0fd01c");
return true;
}
/**
* Returns true if the path is valid. A <code>null</code> value is considered invalid.
* @param path Path value to validate.
* @return true if path is valid.
*/
protected boolean isValidPath(String path) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "a9489262-b7b7-444c-b4f2-4aac1bb52216");
if (path == null) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "709f0300-8b1b-4031-89f9-bd11a1003233");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "7d830dee-6b95-4037-beb6-f625d4a067a0");
if (!PATH_PATTERN.matcher(path).matches()) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "d40ac067-bdd5-47f3-92b6-fb41d5e4a3bc");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "7506bd2d-444a-4dda-b83f-6985735b78e6");
try {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "d46a1a44-1c34-4108-8aaf-31df8ce27041");
URI uri = new URI(null, null, path, null);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "86f8c8d6-ae15-40d1-9a60-11e7a6f7e3cf");
String norm = uri.normalize().getPath();
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "3e9379ab-b311-44a1-894a-fd49c45a8f24");
if (// Trying to go via the parent dir
norm.startsWith("/../") || norm.equals("/..")) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "d529e06c-b16f-4ac8-a722-eb35d60cd342");
// Trying to go to the parent dir
return false;
}
} catch (URISyntaxException e) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "10cac4d6-eaab-441c-954e-93efd62cb6f9");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "6e00f311-dfab-45cd-bf7e-b983c94ab659");
int slash2Count = countToken("//", path);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "42d10dfb-7806-4992-a768-85390b569ceb");
if (isOff(ALLOW_2_SLASHES) && (slash2Count > 0)) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "c6707cc9-ec3a-4ead-bd97-cb4cc76eabef");
return false;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "f7f258a6-1f97-4c41-b4d2-5ac45c7b0e52");
return true;
}
/**
* Returns true if the query is null or it's a properly formatted query string.
* @param query Query value to validate.
* @return true if query is valid.
*/
protected boolean isValidQuery(String query) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "9243ce4c-21df-4f4f-8aef-707933db40af");
if (query == null) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "95ef25a8-56fa-4b9b-8177-079fdc487884");
return true;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "cbfb82cc-fad9-4f20-b68c-7f7308da2a43");
return QUERY_PATTERN.matcher(query).matches();
}
/**
* Returns true if the given fragment is null or fragments are allowed.
* @param fragment Fragment value to validate.
* @return true if fragment is valid.
*/
protected boolean isValidFragment(String fragment) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "09678718-3a1e-417e-b09c-f6240a78fdab");
if (fragment == null) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "f6bc79a1-52a6-45e1-bda1-dedf6d714770");
return true;
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "a4abedb6-2287-4fa9-b2de-5c598e0e48ff");
return isOff(NO_FRAGMENTS);
}
/**
* Returns the number of times the token appears in the target.
* @param token Token value to be counted.
* @param target Target value to count tokens in.
* @return the number of tokens.
*/
protected int countToken(String token, String target) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "1019a521-cbbd-4c38-a435-6175b87b3d08");
int tokenIndex = 0;
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "383bd536-eb5c-4b6d-9963-e17b12b11511");
int count = 0;
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "c3041160-2240-4854-9019-4538bd8fe2ce");
while (tokenIndex != -1) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "c10c51a6-be44-4977-a36c-e4c523dd513d");
tokenIndex = target.indexOf(token, tokenIndex);
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "f46c4ba6-5dc0-4d52-9b7b-83ae287f76cb");
if (tokenIndex > -1) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "3468a457-9fba-42c9-a91e-fe4348266796");
tokenIndex++;
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "2314ea8e-36e6-437e-8c89-41b7acc60a6c");
count++;
}
}
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "24a9d3e7-473e-4bd5-bcd4-a10c3b5c42a1");
return count;
}
/**
* Tests whether the given flag is on. If the flag is not a power of 2
* (ie. 3) this tests whether the combination of flags is on.
*
* @param flag Flag value to check.
*
* @return whether the specified flag value is on.
*/
private boolean isOn(long flag) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "da353d5c-304a-4ac3-8023-7ebba1566f95");
return (options & flag) > 0;
}
/**
* Tests whether the given flag is off. If the flag is not a power of 2
* (ie. 3) this tests whether the combination of flags is off.
*
* @param flag Flag value to check.
*
* @return whether the specified flag value is off.
*/
private boolean isOff(long flag) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "65d7ac62-6522-45ad-a27e-6d5c8eda428c");
return (options & flag) == 0;
}
// Unit test access to pattern matcher
Matcher matchURL(String value) {
writeline("/home/ubuntu/results/coverage/UrlValidator/UrlValidator_1_10.coverage", "5f67e285-9601-429f-8957-3aa7e84e9161");
return URL_PATTERN.matcher(value);
}
void writeline(String fullFilePath, String text) {
try {
File file = new File(fullFilePath);
FileWriter fileWriter = new FileWriter(file, true);
BufferedWriter output = new BufferedWriter(fileWriter);
output.append(text);
output.newLine();
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
static void writelineStatic(String fullFilePath, String text) {
try {
File file = new File(fullFilePath);
FileWriter fileWriter = new FileWriter(file, true);
BufferedWriter output = new BufferedWriter(fileWriter);
output.append(text);
output.newLine();
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"amchristi@bitbucket.org"
] | amchristi@bitbucket.org |
f05411b38c8a7fbaaca5a5ead6d32614a8a4fa04 | d81829789fcdca5d930cab48aa024a0720e43c88 | /GameDemo/src/com/atet/tvmarket/entity/RelativeGameReq.java | 85a47c490b6fdc996be616278ab83bc51c979d49 | [] | no_license | clouse/gamedemo | e420cd2fc3138628ba31af779893e6f852a8ba21 | e54a32a6441e9d8b973e40b1b262bf7c6b333468 | refs/heads/master | 2021-01-10T13:10:26.880391 | 2015-12-17T06:33:52 | 2015-12-17T06:33:52 | 48,152,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package com.atet.tvmarket.entity;
public class RelativeGameReq implements AutoType {
private String deviceId;
private String gameId;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getGameId() {
return gameId;
}
public void setGameId(String gameId) {
this.gameId = gameId;
}
@Override
public String toString() {
return "RelativeGameReq [deviceId=" + deviceId + ", gameId=" + gameId
+ "]";
}
}
| [
"clouse@yeah.net"
] | clouse@yeah.net |
b7e480f327e0bc1a1c2ee75f7f3a2bd9bd9c3127 | b48ceeccd61da07a45ee1fdc68c1b3f4310e4739 | /src/basic/com/huateng/report/pboc/servlet/PersonalReportServlet7.java | 5dabb5700ecf1816397ad35b8f8ce4bfeefd7f6b | [] | no_license | chenshibi/IBSCORE | 0a8f66560c10b8ae49d94e513359074904e5f4ad | effb4f25a4c3b5e21f34df0cadf8f8b39f2bbd98 | refs/heads/master | 2022-04-22T16:27:36.702522 | 2020-04-17T10:47:14 | 2020-04-17T10:47:14 | 256,475,829 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,084 | java | package com.huateng.report.pboc.servlet;
import java.io.IOException;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.huateng.ebank.business.common.GlobalInfo;
import com.huateng.report.pboc.service.PbocQueryService;
/**
*
* @author Grassy
* @editor quxin 20190620
* @version 二代个人信息汇总
*/
public class PersonalReportServlet7 extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(PersonalReportServlet.class);
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
logger.error("don't support get method!");
throw new ServletException("Security Issue detected!");
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession httpSession = request.getSession();
if (httpSession == null) {
throw new ServletException("Security Issue detected!");
}
GlobalInfo globalInfo = (GlobalInfo) httpSession.getAttribute(GlobalInfo.KEY_GLOBAL_INFO);
if (null != globalInfo) {
GlobalInfo.setCurrentInstance(globalInfo);
String sessionId = httpSession.getId();
globalInfo.setSessionId(sessionId);
} else {
throw new ServletException("User not login!");
}
String uuid = request.getParameter("uuid");
logger.info("uuid = " + uuid);
Map<String, Object> map = PbocQueryService.getInstance().getPersonalReport(uuid);
request.setAttribute("map", map);
request.setAttribute("uuid", uuid);
request.getRequestDispatcher("/fpages/crms/ftl/PersonalReport7.ftl").forward(request, response);
}
}
| [
"chensibiy@163.com"
] | chensibiy@163.com |
af7daa957cbcd0f8ea1f1e03c27b10baf9ebd762 | a2fa8067f6b7c3ae3757245b144f6ad8f92b5893 | /modules/framework-model/src/main/java/rogue/app/framework/model/AppObjectController.java | 455b6300fc50829ce63be8bab9a3f791727bbc72 | [
"Apache-2.0"
] | permissive | roguexz/rogue.io | f7fc9faa9e8426eeba58d86690ec61e2b9a9043e | 2038cd048124a405bc07f50f8b033b2a2531fc79 | refs/heads/master | 2020-04-23T15:44:31.509891 | 2013-12-22T07:45:16 | 2013-12-22T07:45:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,931 | java | /*
* Copyright 2013, Rogue.IO
*
* 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 rogue.app.framework.model;
import rogue.app.framework.AppRuntimeException;
import rogue.app.framework.annotations.ControllerFor;
import rogue.app.framework.patterns.Delegation;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* An <code>AppObjectController</code> provides an abstract implementation of the
* {@link rogue.app.framework.model.AppObjectCollection} interface, which serves as the root object for most
* controllers within the framework. Additionally, it implements the {@link rogue.app.framework.model.ResourceSelection}
* interface, which provides a stateful notion to the various operations that get executed on the application object
* itself. The <code>AppObjectController</code> supports the notion of hierarchical (chained) controllers where the
* state of a child controller is influenced by the currently selected resource of the parent controller.
*/
public abstract class AppObjectController<T extends AppObject<T, K>, K> implements AppObjectCollection<T, K>,
Delegation<AppObjectCollection<T, K>>, ResourceSelection<T>, Serializable
{
private static final String CLASS_NAME = AppObjectController.class.getName();
private static final Logger LOGGER = Logger.getLogger(CLASS_NAME);
/**
* The controller collection to which this controller belongs. This information used primarily for constructing
* pretty URIs.
*/
private AppObjectControllerCollection controllerCollection;
/**
* The preferred name of this controller.
*/
private String controllerName;
/**
* Class reference of the model object.
*/
private Class<T> appObjClassRef;
/**
* The logical parent of this controller.
*/
private AppObjectController<?, ?> parentController;
/**
* Map to store the logic child controllers owned by this controller object.
*/
private Map<Class<? extends AppObject>, AppObjectController<?, ?>> childControllersMap;
private Map<String, Class<? extends AppObject>> namedChildControllerTypes;
private boolean reinitializeChildControllers = true;
private AppObject<?, ?> parentResource;
private ResourceSelectionHolder<T> resourceSelectionHolder;
private boolean singleSelection;
// Immutable references
private Map<String, AppObjectController<?, ?>> namedChildControllers = Collections.emptyMap();
private List<AppObjectController<?, ?>> childControllersList;
protected AppObjectController()
{
// Default no-arg constructor required for CDI.
processAnnotations();
this.resourceSelectionHolder = new ResourceSelectionHolder<>();
resourceSelectionHolder.setBinaryMode(false);
}
protected AppObjectController(AppObjectController<?, ?> parentController)
{
processAnnotations();
this.resourceSelectionHolder = new ResourceSelectionHolder<>();
resourceSelectionHolder.setBinaryMode(false);
this.parentController = parentController;
}
/**
* Get the {@link AppObjectControllerCollection collection) to which this controller belongs. If this controller is
* a child to another controller & the controller collection has not been specifically overrident, then the entire
* hierarchy will be traversed till the controller collection has been found.
*
* @return the collection to which this controller belongs.
*/
public AppObjectControllerCollection getControllerCollection()
{
return controllerCollection != null ? controllerCollection :
parentController != null ? parentController.getControllerCollection() : null;
}
/**
* Set the {@link AppObjectControllerCollection collection) to which this controller belongs.
*
* @param controllerCollection the collection to which this controller belongs.
*/
public void setControllerCollection(AppObjectControllerCollection controllerCollection)
{
this.controllerCollection = controllerCollection;
}
/**
* Get the application object class associated with this controller.
*
* @return the application object class associated with this controller.
*/
public Class<T> getAppObjClassRef()
{
return appObjClassRef;
}
/**
* Get the preferred name for this controller.
*
* @return the preferred name for this controller.
*/
public String getControllerName()
{
return controllerName;
}
/**
* Get the <i>logical</i> parent of this controller.
*
* @return the <i>logical</i> parent of this controller.
*/
public AppObjectController<?, ?> getParentController()
{
return parentController;
}
public AppObject getParentResource()
{
return parentResource;
}
public void setParentResource(AppObject<?, ?> parentResource)
{
this.parentResource = parentResource;
}
/**
* Identifies if the current controller is intended to work on a single object only or not. If the controller is
* intended for operating on a single selection, then the {@link #getSelectedResource()} will return the object
* that is to be manipulated.
*
* @return true if the controller is intended to work on a single resource, false otherwise.
*/
public boolean isSingleSelection()
{
return singleSelection;
}
public void setSingleSelection(boolean singleSelection)
{
this.singleSelection = singleSelection;
}
/**
* Get a map of named child controllers. This is a convenience method that helps with better EL support.
*
* @return a map of named child controllers.
*/
public Map<String, AppObjectController<?, ?>> getChildControllers()
{
if (namedChildControllers == null)
{
List<AppObjectController<?, ?>> list = getChildControllersList();
namedChildControllers = new HashMap<>(list.size());
for (AppObjectController<?, ?> controller : list)
{
namedChildControllers.put(controller.getControllerName(), controller);
}
namedChildControllers = Collections.unmodifiableMap(namedChildControllers);
}
return namedChildControllers;
}
/**
* Get a list of child controllers associated with the currently selected ApplicationObject.
*
* @return a list of child controllers associated with the currently selected ApplicationObject.
*/
public List<AppObjectController<?, ?>> getChildControllersList()
{
if (getSelectedResource() == null || childControllersMap == null)
{
return Collections.emptyList();
}
initChildControllers();
if (childControllersList == null)
{
childControllersList = new ArrayList<>();
childControllersList.addAll(childControllersMap.values());
childControllersList = Collections.unmodifiableList(childControllersList);
}
return childControllersList;
}
/**
* Get a child controller by its preferred name.
*
* @param name the name of the child controller.
* @return a named child controller if found, or null.
*/
public AppObjectController<?, ?> getChildController(String name)
{
final String METHOD_NAME = "getChildController(name)";
if (namedChildControllerTypes != null)
{
Class<? extends AppObject> type = namedChildControllerTypes.get(name);
if (type != null)
{
return getChildController(type);
}
else
{
LOGGER.logp(Level.WARNING, CLASS_NAME, METHOD_NAME, "No child controller found with name: " + name);
}
}
return null;
}
@SuppressWarnings("SuspiciousMethodCalls")
public AppObjectController<?, ?> getChildController(Class<?> childType)
{
initChildControllers();
return childControllersMap != null ? childControllersMap.get(childType) : null;
}
protected void addChildController(AppObjectController<?, ?> controller)
{
final String METHOD_NAME = "addChildController";
if (childControllersMap == null)
{
childControllersMap = new LinkedHashMap<>(2);
namedChildControllerTypes = new HashMap<>(2);
}
if (!childControllersMap.containsKey(controller.getAppObjClassRef()))
{
childControllersMap.put(controller.getAppObjClassRef(), controller);
String ccName = controller.getControllerName();
if (namedChildControllerTypes.containsKey(ccName) && namedChildControllerTypes.get(ccName) != controller
.getAppObjClassRef())
{
LOGGER.logp(Level.WARNING, CLASS_NAME, METHOD_NAME,
"Attempting to add child controller which has a name that conflicts with an existing object type can lead to unexpected results. Controller name: "
+ ccName + " is mapped to both " + namedChildControllerTypes
.get(ccName).getName() + " & " + controller.getAppObjClassRef().getName());
}
namedChildControllerTypes.put(controller.getControllerName(), controller.getAppObjClassRef());
// TODO or NOT TODO .. Should I set the child controllers parent as this guy? Kinda makes sense
controller.parentController = this;
}
childControllersList = null;
namedChildControllers = null;
}
protected void removeChildController(AppObjectController<?, ?> controller)
{
if (childControllersMap != null && controller != null)
{
childControllersMap.remove(controller.getAppObjClassRef());
namedChildControllerTypes.remove(controller.getControllerName());
childControllersList = null;
namedChildControllers = null;
}
}
private void initChildControllers()
{
if (reinitializeChildControllers)
{
if (childControllersMap != null && !childControllersMap.isEmpty())
{
T item = getSelectedResource();
for (AppObjectController<?, ?> controller : childControllersMap.values())
{
if (controller == null)
{
if (LOGGER.isLoggable(Level.FINE))
{
LOGGER.logp(Level.FINE, CLASS_NAME, "initChildControllers",
"A child controller is null. This should never happen. Debug the code.");
}
continue;
}
if (!Objects.equals(item, controller.getParentResource()))
{
controller.setParentResource(item);
}
}
}
reinitializeChildControllers = false;
}
}
///
/// Methods defined by ResourceSelection
///
/**
* {@inheritDoc}
*/
@Override
public T getSelectedResource()
{
return resourceSelectionHolder.getSelectedResource();
}
/**
* {@inheritDoc}
*/
@Override
public void setSelectedResource(T resource)
{
resourceSelectionHolder.setSelectedResource(resource);
reinitializeChildControllers = true;
}
/**
* {@inheritDoc}
*/
@Override
public T[] getSelectedResources()
{
return resourceSelectionHolder.getSelectedResources();
}
/**
* {@inheritDoc}
*/
@Override
public void setSelectedResources(T[] resources)
{
resourceSelectionHolder.setSelectedResources(resources);
}
/**
* Get the resource selection holder implementation that is used by this controller.
*
* @return the resource selection holder implementation that is used by this controller.
*/
protected ResourceSelection<T> getResourceSelectionHolder()
{
return resourceSelectionHolder;
}
///
/// Methods defined by AppObjectCollection
///
/**
* {@inheritDoc}
*/
@Override
public T getNewInstance() throws AppRuntimeException
{
return getDelegate().getNewInstance();
}
/**
* {@inheritDoc}
*/
@Override
public T getNewInstance(AppObject<?, ?> parent) throws AppRuntimeException
{
return getDelegate().getNewInstance(parent);
}
/**
* {@inheritDoc}
*/
@Override
public T getMutableInstance(T appObject) throws AppRuntimeException
{
return getDelegate().getMutableInstance(appObject);
}
/**
* {@inheritDoc}
*/
@Override
public Query newQueryInstance() throws AppRuntimeException
{
return getDelegate().newQueryInstance();
}
/**
* {@inheritDoc}
*/
@Override
public T findById(K id) throws AppRuntimeException
{
return getDelegate().findById(id);
}
/**
* {@inheritDoc}
*/
@Override
public K parseId(String idAsString) throws AppRuntimeException
{
return getDelegate().parseId(idAsString);
}
/**
* {@inheritDoc}
*/
@Override
public List<T> find(Query query) throws AppRuntimeException
{
return getDelegate().find(query);
}
/**
* {@inheritDoc}
*/
@Override
public long count(Query query) throws AppRuntimeException
{
return getDelegate().count(query);
}
/**
* {@inheritDoc}
*/
@Override
public void save(T appObject) throws AppRuntimeException
{
getDelegate().save(appObject);
}
/**
* {@inheritDoc}
*/
@Override
public void deleteById(K... keys) throws AppRuntimeException
{
List<T> appObjects = new ArrayList<>();
for (K id : keys)
{
T appObj = findById(id);
if (appObj != null)
{
appObjects.add(appObj);
}
}
delete(appObjects.toArray((T[]) Array.newInstance(getAppObjClassRef(), appObjects.size())));
}
/**
* {@inheritDoc}
*/
@Override
public void delete(AppObject[] appObjects) throws AppRuntimeException
{
if (appObjects == null || appObjects.length == 0)
{
return;
}
// Since there is no notion of child controllers in the AppObjectCollection, the necessary cascade delete
// is performed here itself.
for (AppObject resource : appObjects)
{
CompositeQuery cq = new CompositeQuery(resource);
cq.setStartIndex(0);
cq.setMaxResults(-1);
setSelectedResource((T) resource);
for (AppObjectController<?, ?> childController : getChildControllersList())
{
List<? extends AppObject> children = childController.find(cq);
childController.delete(children.toArray(new AppObject[children.size()]));
}
setSelectedResource(null);
}
// Finally delete all the existing objects as well.
getDelegate().delete(appObjects);
}
///
/// Process the annotations associated with the controller object.
///
private void processAnnotations()
{
ControllerFor controller = getClass().getAnnotation(ControllerFor.class);
if (controller != null)
{
Class<T> classRef = (Class<T>) controller.model();
if (classRef != null)
{
this.appObjClassRef = classRef;
}
else
{
throw new AppRuntimeException("Controller class reference is null");
}
this.controllerName = controller.name();
}
else
{
throw new AppRuntimeException(
"Missing controller annotation. Please ensure that the annotation has been set for the controller.");
}
}
}
| [
"harsha.ramesh@gmail.com"
] | harsha.ramesh@gmail.com |
0d28e6c47c9b4d07d1abbb1bfe8433a9412f1c3a | ac82c09fd704b2288cef8342bde6d66f200eeb0d | /projects/OG-Bloomberg/src/main/java/com/opengamma/bbg/replay/BloombergTicksReplayer.java | 4b9cd8b307c1f4a98912d80d5b5f1fbac8643560 | [
"Apache-2.0"
] | permissive | cobaltblueocean/OG-Platform | 88f1a6a94f76d7f589fb8fbacb3f26502835d7bb | 9b78891139503d8c6aecdeadc4d583b23a0cc0f2 | refs/heads/master | 2021-08-26T00:44:27.315546 | 2018-02-23T20:12:08 | 2018-02-23T20:12:08 | 241,467,299 | 0 | 2 | Apache-2.0 | 2021-08-02T17:20:41 | 2020-02-18T21:05:35 | Java | UTF-8 | Java | false | false | 6,251 | java | /**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.bbg.replay;
import java.lang.Thread.UncaughtExceptionHandler;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import org.fudgemsg.FudgeMsg;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.Lifecycle;
import org.threeten.bp.ZonedDateTime;
import com.opengamma.util.ArgumentChecker;
import com.opengamma.util.TerminatableJob;
/**
*
*/
public class BloombergTicksReplayer implements Lifecycle {
/** Logger. */
private static Logger s_logger = LoggerFactory.getLogger(BloombergTicksReplayer.class);
private static final int DEFAULT_QUEUE_SIZE = 1000;
private final BloombergTickReceiver _bloombergTickReceiver;
private final String _rootDir;
private final BlockingQueue<FudgeMsg> _ticksQueue = new ArrayBlockingQueue<FudgeMsg>(DEFAULT_QUEUE_SIZE);
private final Mode _mode;
private final ZonedDateTime _startTime;
private final ZonedDateTime _endTime;
private final boolean _infiniteLoop;
private final Set<String> _securities;
private Thread _tickPlayerThread;
private TerminatableJob _ticksPlayerJob;
private Thread _ticksLoaderThread;
private TerminatableJob _ticksLoaderJob;
//exception thrown during replay
private Throwable _exception;
public BloombergTicksReplayer(Mode mode, String rootDir, BloombergTickReceiver bloombergTickReceiver, ZonedDateTime startTime, ZonedDateTime endTime) {
this(mode, rootDir, bloombergTickReceiver, startTime, endTime, false, Collections.<String>emptySet());
}
public BloombergTicksReplayer(Mode mode, String rootDir, BloombergTickReceiver bloombergTickReceiver, ZonedDateTime startTime, ZonedDateTime endTime, boolean infiniteLoop) {
this(mode, rootDir, bloombergTickReceiver, startTime, endTime, infiniteLoop, Collections.<String>emptySet());
}
public BloombergTicksReplayer(Mode mode, String rootDir, BloombergTickReceiver bloombergTickReceiver, ZonedDateTime startTime, ZonedDateTime endTime, Set<String> securities) {
this(mode, rootDir, bloombergTickReceiver, startTime, endTime, false, securities);
}
public BloombergTicksReplayer(Mode mode, String rootDir, BloombergTickReceiver bloombergTickReceiver, ZonedDateTime startTime, ZonedDateTime endTime, boolean infiniteLoop, Set<String> securities) {
ArgumentChecker.notNull(rootDir, "rootDir");
ArgumentChecker.notNull(bloombergTickReceiver, "tickHandler");
ArgumentChecker.notNull(mode, "mode");
ArgumentChecker.notNull(startTime, "startTime");
ArgumentChecker.notNull(endTime, "endTime");
ArgumentChecker.notNull(securities, "securities");
_mode = mode;
_rootDir = rootDir;
_bloombergTickReceiver = bloombergTickReceiver;
_startTime = startTime;
_endTime = endTime;
_infiniteLoop = infiniteLoop;
_securities = securities;
}
@Override
public synchronized boolean isRunning() {
s_logger.debug("isLoaderRunning {}", isLoaderRunning());
s_logger.debug("isPlayerRunning {}", isPlayerRunning());
return isLoaderRunning() && isPlayerRunning();
}
/**
* @return true if the player is running
*/
public boolean isPlayerRunning() {
return _tickPlayerThread != null && _tickPlayerThread.isAlive();
}
/**
* @return true if the loader is running
*/
public boolean isLoaderRunning() {
return _ticksLoaderThread != null && _ticksLoaderThread.isAlive();
}
@Override
public synchronized void start() {
startLoader();
//Wait for some ticks to process
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
Thread.interrupted();
s_logger.warn("interrupted from sleeping");
}
startPlayer();
}
/**
*
*/
private void startLoader() {
s_logger.info("starting ticksLoader-job");
TicksLoaderJob ticksLoaderJob = new TicksLoaderJob(_rootDir, _securities, _ticksQueue, _startTime, _endTime, _infiniteLoop);
_ticksLoaderJob = ticksLoaderJob;
Thread thread = new Thread(_ticksLoaderJob, "TicksLoader");
// thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
_exception = e;
s_logger.warn(e.getMessage(), e);
}
});
thread.start();
_ticksLoaderThread = thread;
}
/**
*
*/
private void startPlayer() {
s_logger.info("starting ticksPlayer-job");
TicksPlayerJob ticksPlayer = new TicksPlayerJob(_ticksQueue, _bloombergTickReceiver, _mode, _ticksLoaderThread);
_ticksPlayerJob = ticksPlayer;
Thread thread = new Thread(_ticksPlayerJob, "TicksPlayer");
// thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
_exception = e;
s_logger.warn(e.getMessage(), e);
}
});
thread.start();
_tickPlayerThread = thread;
}
@Override
public synchronized void stop() {
if (isLoaderRunning()) {
stopTerminatableJob(_ticksLoaderJob, _ticksLoaderThread);
}
if (isPlayerRunning()) {
stopTerminatableJob(_ticksPlayerJob, _tickPlayerThread);
}
}
private void stopTerminatableJob(TerminatableJob terminatableJob,
Thread thread) {
s_logger.debug("stopping {}", thread);
if (thread != null && thread.isAlive()) {
if (terminatableJob != null) {
terminatableJob.terminate();
}
try {
thread.join(1000); //wait for 1sec
} catch (InterruptedException e) {
Thread.interrupted();
s_logger.warn("Interrupted waiting for {} thread to finish", thread);
}
}
}
protected Throwable getException() {
return _exception;
}
/**
* An enumeration describing how to replay the ticks.
*/
public enum Mode {
/**
* Replay at the original latency.
*/
ORIGINAL_LATENCY,
/**
* Replay as fast as possible.
*/
AS_FAST_AS_POSSIBLE
}
}
| [
"cobaltblue.ocean@gmail.com"
] | cobaltblue.ocean@gmail.com |
4b0ecc7cbdf64ce7887a58dc645985ac1ed4f9c2 | 72c030579557e51e4f831e2686b802566ddfb38c | /src/servlet/topicServlet.java | c4092315fbdf281b3657bc7d18ed6695c3dddccc | [] | no_license | yc488/bbs | ae1315ea0bd5c18d1549b9c3aa68c11037c7d269 | ea6662381bbc7ad2d80713d9df2c4bcc9d92c9d9 | refs/heads/master | 2020-05-14T03:05:09.837173 | 2019-04-16T13:26:33 | 2019-04-16T13:26:33 | 181,692,735 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 19,212 | java | package servlet;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.alibaba.fastjson.JSON;
import bean.Board;
import bean.PageBean;
import bean.Reply;
import bean.Topic;
import bean.User;
import bean.UserInfo;
import biz.BizException;
import biz.BoardBiz;
import biz.ReplyBiz;
import biz.TopicBiz;
import utils.Myutil;
@WebServlet("/topic")
public class topicServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
Topic topic =new Topic();
TopicBiz tb=new TopicBiz();
ReplyBiz rb=new ReplyBiz();
BoardBiz bb=new BoardBiz();
public topicServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html; charset=UTF-8");
String flag = request.getParameter("flag");
switch (flag) {
case "topicList":
topicList(request,response);
break;
case "post":
post(request,response);
break;
case "topicDetail":
topicDetail(request,response);
break;
case "answer":
answer(request,response);
break;
case "del":
del(request,response);
break;
case "firstPage":
firstPage(request, response);
break;
case "nextPage":
nextPage(request, response);
break;
case "lastPage":
lastPage(request, response);
break;
case "finalPage":
finalPage(request, response);
break;
case "topicHostList":
topicHostList(request, response);
break;
case "personTopTopic":
personTopTopic(request, response);
break;
case "showBigBoardList":
showBigBoardList(request, response);
break;
case "updateBigBoard":
updateBigBoard(request, response);
break;
case "addBigBoard":
addBigBoard(request, response);
break;
case "delBigBoard":
delBigBoard(request, response);
break;
case "listDel":
listDel(request, response);
break;
case "hostDel":
hostDel(request, response);
break;
case "search":
search(request, response);
break;
case "myTopic":
myTopic(request, response);
break;
default:
break;
}
}
/**
* 查找帖子
* @param request
* @param response
* @throws IOException
* @throws ServletException
*/
private void search(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String topicname = request.getParameter("topicname");
try {
List<Topic> searchTopic = tb.searchTopic(topicname);
HttpSession session=request.getSession();
session.setAttribute("searchTopic", searchTopic);
request.getRequestDispatcher("/pages/searchTopic.jsp").forward(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("/pages/searchTopic.jsp").forward(request, response);
}
}
//每个板块热帖的删除
private void hostDel(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int topicid = Integer.parseInt(request.getParameter("topicid")) ;
topic.setTopicid(topicid);
try {
tb.delTopic(topic);
request.setAttribute("msg", "删除成功");
topicHostList(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("/pages/hostList.jsp").forward(request, response);
}
}
//每个板块list的删除
private void listDel(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int topicid = Integer.parseInt(request.getParameter("topicid")) ;
topic.setTopicid(topicid);
try {
tb.delTopic(topic);
request.setAttribute("msg", "删除成功");
topicList(request,response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("/pages/list.jsp").forward(request, response);
}
}
//删除主板块
private void delBigBoard(HttpServletRequest request, HttpServletResponse response) throws IOException {
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
Board board=new Board();
board.setBoardid(boardid);
try {
bb.delBigBoard(board);
response.getWriter().write("1");
} catch (BizException e) {
e.printStackTrace();
response.getWriter().write("0");
}
}
//增加主板块
private void addBigBoard(HttpServletRequest request, HttpServletResponse response) throws IOException {
String boardname = request.getParameter("boardname");
Board board=new Board();
board.setBoardname(boardname);
try {
bb.addBigBoard(board);
response.getWriter().write("1");
} catch (BizException e) {
e.printStackTrace();
response.getWriter().write("0");
}
}
//修改主板块信息
private void updateBigBoard(HttpServletRequest request, HttpServletResponse response) throws IOException {
String boardname = request.getParameter("boardname");
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
Board board=new Board();
board.setBoardid(boardid);
board.setBoardname(boardname);
try {
bb.updateBigBoard(board);
response.getWriter().write("1");
} catch (BizException e) {
e.printStackTrace();
response.getWriter().write("0");
}
}
//后台主板块管理
@SuppressWarnings("unchecked")
private void showBigBoardList(HttpServletRequest request, HttpServletResponse response) throws IOException {
List<Board> bigBoardList = bb.bigBoardList();
@SuppressWarnings("rawtypes")
Map map=new HashMap<>();
map.put("rows", bigBoardList);
String jsonString = JSON.toJSONString(map);
response.getWriter().write(jsonString);
}
//风云人物的所有帖子
private void personTopTopic(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Integer uid = Integer.parseInt(request.getParameter("uid"));
topic .setUid(uid);
List<Topic> personTopTopic;
try {
personTopTopic = tb.personTopTopic(topic);
HttpSession session=request.getSession();
session.setAttribute("personTopTopic", personTopTopic);
request.getRequestDispatcher("/pages/personTopTopic.jsp").forward(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("/pages/personTopTopic.jsp").forward(request, response);
}
}
//每个板块前10的热帖
private void topicHostList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Board board=new Board();
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
board.setBoardid(boardid);
HttpSession session=request.getSession();
@SuppressWarnings("unchecked")
Map<Integer, List<Board>> map=(Map<Integer, List<Board>>) session.getAttribute("boardMap");
for( Map.Entry<Integer, List<Board>> entry: map.entrySet() ) {
List<Board> listBoard=entry.getValue();
for( Board b:listBoard) {
if( b.getBoardid()==board.getBoardid()) {
board=b;
break;
}
}
}
session.setAttribute("board", board);
topic.setBoardid(board.getBoardid());
List<Topic> pagebean;
try {
pagebean = tb.findHostTopic(topic);
session.setAttribute("pagebean", pagebean);
request.getRequestDispatcher("/pages/hostList.jsp").forward(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("/pages/hostList.jsp").forward(request, response);
}
}
//用户的帖子
private void myTopic(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Integer uid = Integer.parseInt(request.getParameter("uid"));
topic .setUid(uid);
List<Topic> personTopic;
try {
personTopic = tb.myTopic(topic);
HttpSession session=request.getSession();
session.setAttribute("personTopic", personTopic);
request.getRequestDispatcher("/pages/myTopic.jsp").forward(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("/pages/myTopic.jsp").forward(request, response);
}
}
//首页
public void firstPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Integer pages = Integer.parseInt(request.getParameter("pages")) ;
Topic topic=new Topic();
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
topic.setBoardid(boardid);
topic.setPages(pages);
PageBean<Topic> pagebean = null;
try {
pagebean = tb.findPageBean(topic);
HttpSession session = request.getSession();
pagebean.setPages(pages);
session.setAttribute("pagebean",pagebean);
request.getRequestDispatcher("pages/list.jsp").forward(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("pages/list.jsp").forward(request, response);
}
}
//下一页
public void nextPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
@SuppressWarnings("unchecked")
PageBean<Topic> pageBean = (PageBean<Topic>) session.getAttribute("pagebean");
Integer pages = Integer.parseInt(request.getParameter("pages")) ;
if(pageBean.getTotalPage()<=pages) {
pages=pageBean.getTotalPage().intValue();
}
Topic topic=new Topic();
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
topic.setBoardid(boardid);
topic.setPages(pages);
PageBean<Topic> pagebean;
try {
pagebean = tb.findPageBean(topic);
pagebean.setPages(pages);
session.setAttribute("pagebean",pagebean);
request.getRequestDispatcher("pages/list.jsp").forward(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("pages/list.jsp").forward(request, response);
}
}
//上一页
public void lastPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Integer pages = Integer.parseInt(request.getParameter("pages")) ;
if(pages>1) {
pages--;
}
Topic topic=new Topic();
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
topic.setBoardid(boardid);
HttpSession session = request.getSession();
topic.setPages(pages);
PageBean<Topic> pagebean;
try {
pagebean = tb.findPageBean(topic);
pagebean.setPages(pages);
session.setAttribute("pagebean",pagebean);
request.getRequestDispatcher("pages/list.jsp").forward(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("pages/list.jsp").forward(request, response);
}
}
//末页
public void finalPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Integer pages = Integer.parseInt(request.getParameter("pages")) ;
Topic topic=new Topic();
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
topic.setBoardid(boardid);
HttpSession session = request.getSession();
topic.setPages(pages);
PageBean<Topic> pagebean;
try {
pagebean = tb.findPageBean(topic);
pagebean.setPages(pages);
session.setAttribute("pagebean",pagebean);
request.getRequestDispatcher("pages/list.jsp").forward(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("pages/list.jsp").forward(request, response);
}
}
//删除帖子
private void del(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int topicid = Integer.parseInt(request.getParameter("topicid")) ;
topic.setTopicid(topicid);
try {
tb.delTopic(topic);
request.setAttribute("msg", "删除成功");
personTopTopic(request,response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("/pages/personTopTopic.jsp").forward(request, response);
}
}
//回复帖子
private void answer(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
int uid = Integer.parseInt(request.getParameter("uid")) ;
int topicid = Integer.parseInt(request.getParameter("topicid")) ;
Integer pages =0;
if(request.getParameter("pages")==null || "".equals(request.getParameter("pages"))) {
pages=1;
}else {
pages = Integer.parseInt(request.getParameter("pages"));
}
UserInfo userinfo=(UserInfo) request.getSession().getAttribute("userinfo");
System.out.println("登录时的userinfo"+userinfo);
String content = request.getParameter("content");
topic.setUid(uid);
topic.setTopicid(topicid);
topic.setContent(content);
User user=(User) request.getSession().getAttribute("user");
try {
rb.answer(topic,user.getEmail());
System.out.println("回帖后的"+rb.getUserinfo());
if(rb.getFlag()==false) {
request.getSession().setAttribute("userinfo", rb.getUserinfo());
response.getWriter().write("<script language='javascript'>"
+ "alert('请注意用词!!!');"
+ "window.location='topic?flag=topicDetail&topicid="+topic.getTopicid()+"&pages="+pages+"'"
+ "</script>");
}else {
response.sendRedirect("topic?flag=topicDetail&topicid="+topic.getTopicid()+"&pages="+pages);
}
} catch (BizException e) {
request.setAttribute("msg", e.getMessage());
System.out.println(e.getMessage());
request.getRequestDispatcher("pages/answer.jsp").forward(request, response);
}
}
//每个帖子的详情
private void topicDetail(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Integer topicid = Integer.parseInt(request.getParameter("topicid"));
topic.setTopicid(topicid);
HttpSession session=request.getSession();
//查询该帖子的详情
Topic topicdetail=null;
try {
topicdetail = tb.topicdetail(topic);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("pages/detail.jsp").forward(request, response);
}
if(request.getParameter("boardid")!=null) {
Board board=new Board();
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
board.setBoardid(boardid);
@SuppressWarnings("unchecked")
Map<Integer, List<Board>> map=(Map<Integer, List<Board>>) session.getAttribute("boardMap");
for( Map.Entry<Integer, List<Board>> entry: map.entrySet() ) {
List<Board> listBoard=entry.getValue();
for( Board b:listBoard) {
if( b.getBoardid()==board.getBoardid()) {
board=b;
break;
}
}
}
session.setAttribute("board", board);
}
session.setAttribute("topicdetail", topicdetail);
Integer pages=0;
if(request.getParameter("replyPages")==null || "".equals(request.getParameter("replyPages"))) {
pages=1;
}else {
pages = Integer.parseInt(request.getParameter("replyPages")) ;
}
//查询回复该贴的列表
topic.setPages(pages);
PageBean<Reply> pagebean = rb.findPageBean(topic);
//所有回复该帖的列表
session.setAttribute("pagebeanReply", pagebean);
request.getRequestDispatcher("pages/detail.jsp").forward(request, response);
}
//发帖
private void post(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
Map<String, String[]> parameterMap = request.getParameterMap();
topic = Myutil.MapToJavaBean(parameterMap, Topic.class);
Integer uid = Integer.parseInt(request.getParameter("uid")) ;
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
topic.setUid(uid);
topic.setBoardid(boardid);
User user=null;
HttpSession session = request.getSession();
if(session.getAttribute("user")!=null) {
user = (User) session.getAttribute("user");
topic.setUid(user.getUid() );
}
UserInfo userinfo=(UserInfo) session.getAttribute("userinfo");
System.out.println("登录时的"+userinfo);
try {
tb.post(topic,user.getEmail());
System.out.println("发帖后的"+tb.getUserinfo());
if(tb.getFlag()==false) { //tb.getUserinfo().getTime()>userinfo.getTime()
request.getSession().setAttribute("userinfo", tb.getUserinfo());
response.getWriter().write("<script language='javascript'>"
+ "alert('请注意用词!!!');"
+ "window.location='topic?flag=topicList&boardid="+topic.getBoardid()+"'"
+ "</script>");
}else {
request.getSession().setAttribute("userinfo", tb.getUserinfo());
response.sendRedirect("topic?flag=topicList&boardid="+topic.getBoardid());
}
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("pages/post.jsp").forward(request, response);
}
}
//帖子列表
private void topicList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Board board=new Board();
Integer boardid = Integer.parseInt(request.getParameter("boardid"));
Integer pages =0;
if(request.getParameter("pages")==null || "".equals(request.getParameter("pages"))) {
pages=1;
}else {
pages = Integer.parseInt(request.getParameter("pages"));
}
board.setBoardid(boardid);
HttpSession session=request.getSession();
@SuppressWarnings("unchecked")
Map<Integer, List<Board>> map=(Map<Integer, List<Board>>) session.getAttribute("boardMap");
for( Map.Entry<Integer, List<Board>> entry: map.entrySet() ) {
List<Board> listBoard=entry.getValue();
for( Board b:listBoard) {
if( b.getBoardid()==board.getBoardid()) {
board=b;
break;
}
}
}
session.setAttribute("board", board);
topic.setBoardid(board.getBoardid());
topic.setPages(pages);
//每页查询到的帖子
PageBean<Topic> pagebean;
try {
pagebean = tb.findPageBean(topic);
pagebean.setPages(pages);
session.setAttribute("pagebean", pagebean);
request.getRequestDispatcher("/pages/list.jsp").forward(request, response);
} catch (BizException e) {
e.printStackTrace();
request.setAttribute("msg", e.getMessage());
request.getRequestDispatcher("pages/list.jsp").forward(request, response);
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| [
"591005846@qq.com"
] | 591005846@qq.com |
62e25f9a593f28172f87f03f0081290c3b555b21 | b821160be6752bf1ca255f6fa8b096b722c3ecdd | /jabbot-binding-api/src/main/java/org/wanna/jabbot/binding/BindingCreationException.java | db0f153afa91d376c41cb76ed0b3b651f637d854 | [
"Artistic-2.0"
] | permissive | midoricorp/jabbot | df6caaf4540a0c9cfa39d2ee47b965ec4157a7a6 | f0d65325e01098c98c3afccddcbafbb9e6614f17 | refs/heads/master | 2022-11-20T00:26:22.345738 | 2022-03-25T09:36:51 | 2022-03-25T09:36:51 | 20,357,183 | 19 | 2 | Artistic-2.0 | 2022-11-16T09:25:57 | 2014-05-31T14:21:12 | Java | UTF-8 | Java | false | false | 427 | java | package org.wanna.jabbot.binding;
/**
* This exception is used to notify that an error occured while trying to create a {@link Binding}
*
* @author vmorsiani <vmorsiani>
* @since 2015-02-15
*/
public class BindingCreationException extends Exception{
public BindingCreationException(String message) {
super(message);
}
public BindingCreationException(String message, Throwable cause) {
super(message, cause);
}
}
| [
"vmorsiani@gmail.com"
] | vmorsiani@gmail.com |
b283fe884eb8cc261c3d1562fa998f315dcdc7fe | b3c72aac6ebd39925f864e86da0513db70fe9bfe | /app/src/main/java/com/example/videobroadcast/ui/main/PlaceholderFragment.java | e71146ff3bc2046f9a36b08c594bcaa16d3cb473 | [] | no_license | albanLM/VideoBroadcast | 9d7aedf68cd8395c5a2c5027143fb85a80ba8305 | fc4eff4f36d30539c8a41eb2dc68e717e8b8014a | refs/heads/master | 2022-12-23T22:48:42.484094 | 2020-10-08T13:50:05 | 2020-10-08T13:50:05 | 302,244,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,791 | java | package com.example.videobroadcast.ui.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import com.example.videobroadcast.R;
/**
* A placeholder fragment containing a simple view.
*/
public class PlaceholderFragment extends Fragment {
private static final String ARG_SECTION_NUMBER = "section_number";
private PageViewModel pageViewModel;
public static PlaceholderFragment newInstance(int index) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle bundle = new Bundle();
bundle.putInt(ARG_SECTION_NUMBER, index);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pageViewModel = ViewModelProviders.of(this).get(PageViewModel.class);
int index = 1;
if (getArguments() != null) {
index = getArguments().getInt(ARG_SECTION_NUMBER);
}
pageViewModel.setIndex(index);
}
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_main, container, false);
final TextView textView = root.findViewById(R.id.section_label);
/*pageViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});*/
return root;
}
} | [
"alban.lemoult@gmail.com"
] | alban.lemoult@gmail.com |
57ca6ec62b0aa56e8871734ea96aef0da43c655f | b3ed882afb78a0798b0e0c02d52e4e8d7722960e | /console/src/main/java/net/johanneslink/scoreboard/console/Main.java | 7842abe454493c3e7b123465ed7a4808b6bade1c | [] | no_license | jlink-workshop/scoreboard | b13c97378f83c516172f32f3189a41030162c862 | 317709b0fbcb273bebbba36d9b41a09467f1c644 | refs/heads/main | 2022-08-06T17:22:16.957746 | 2019-11-27T17:41:32 | 2019-11-27T17:41:32 | 125,973,201 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 839 | java | package net.johanneslink.scoreboard.console;
import java.io.*;
import net.johanneslink.scoreboard.core.ScoreboardPresenter;
public class Main {
public static void main(String args[]) {
Console console = new SystemConsole();
ScoreboardConsoleApp app = new ScoreboardConsoleApp(console);
CommandInterpreter interpreter = new DefaultCommandInterpreter();
app.run(new ScoreboardPresenter(), interpreter);
}
private static class SystemConsole implements Console {
private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
@Override
public void println(String line) {
System.out.println(line);
}
@Override
public String readLine() {
try {
return reader.readLine();
} catch (IOException shouldNeverHappen) {
throw new RuntimeException(shouldNeverHappen);
}
}
}
}
| [
"business@johanneslink.net"
] | business@johanneslink.net |
d4b0b0de4dea23289ab83c8fd899562a03285279 | ae0ab07cc46b518a1ee9959248e845e0e7f5fbbb | /generator/schema2template/src/test/resources/test-reference/odf/generation/odfdom-java/odf-schema-1.3/org/odftoolkit/odfdom/dom/attribute/draw/DrawZIndexAttribute.java | e2efb1b8fc91f18ee3fde01146daa83cb105bc38 | [
"BSD-3-Clause",
"MIT",
"W3C",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-generic-cla"
] | permissive | tdf/odftoolkit | 22c19bfadb6e5cba0176296ab51f963ab264b256 | e38051da51b06d962a09012c765addeaae6e6874 | refs/heads/master | 2023-08-09T08:42:40.878413 | 2023-08-03T14:37:12 | 2023-08-04T08:32:14 | 161,654,269 | 95 | 52 | Apache-2.0 | 2023-09-14T16:15:30 | 2018-12-13T14:57:43 | Java | UTF-8 | Java | false | false | 3,278 | java |
/************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved.
*
* Use is subject to license terms.
*
* 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. You can also
* obtain a copy of the License at http://odftoolkit.org/docs/license.txt
*
* 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.
*
************************************************************************/
/*
* This file is automatically generated.
* Don't edit manually.
*/
package org.odftoolkit.odfdom.dom.attribute.draw;
import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
import org.odftoolkit.odfdom.pkg.OdfAttribute;
import org.odftoolkit.odfdom.pkg.OdfFileDom;
import org.odftoolkit.odfdom.pkg.OdfName;
/**
* DOM implementation of OpenDocument attribute {@odf.attribute draw:z-index}.
*
*/
public class DrawZIndexAttribute extends OdfAttribute {
public static final OdfName ATTRIBUTE_NAME = OdfName.newName(OdfDocumentNamespace.DRAW, "z-index");
/**
* Create the instance of OpenDocument attribute {@odf.attribute draw:z-index}.
*
* @param ownerDocument The type is <code>OdfFileDom</code>
*/
public DrawZIndexAttribute(OdfFileDom ownerDocument) {
super(ownerDocument, ATTRIBUTE_NAME);
}
/**
* Returns the attribute name.
*
* @return the <code>OdfName</code> for {@odf.attribute draw:z-index}.
*/
@Override
public OdfName getOdfName() {
return ATTRIBUTE_NAME;
}
/**
* @return Returns the name of this attribute.
*/
@Override
public String getName() {
return ATTRIBUTE_NAME.getLocalName();
}
/**
* @param value The <code>int</code> value of the attribute.
*/
public void setIntValue(int value) {
super.setValue(String.valueOf(value));
}
/**
* @return Returns the <code>int</code> value of the attribute
*/
public int intValue() {
String val = super.getValue();
return Integer.parseInt(val);
}
/**
* Returns the default value of {@odf.attribute draw:z-index}.
*
* @return the default value as <code>String</code> dependent of its element name
* return <code>null</code> if the default value does not exist
*/
@Override
public String getDefault() {
return null;
}
/**
* Default value indicator. As the attribute default value is dependent from its element, the attribute has only a default, when a parent element exists.
*
* @return <code>true</code> if {@odf.attribute draw:z-index} has an element parent
* otherwise return <code>false</code> as undefined.
*/
@Override
public boolean hasDefault() {
return false;
}
/**
* @return Returns whether this attribute is known to be of type ID (i.e. xml:id ?)
*/
@Override
public boolean isId() {
return false;
}
}
| [
"michael.stahl@allotropia.de"
] | michael.stahl@allotropia.de |
0e531e62a42bf96567ecaf2fc06244e9d7ac82de | d699876ce2c25ee643a3ab0f306a0219328119b4 | /DAOsobreDAO/src/jaxbObj/ProducteType.java | 60779e54a7527c0ea4d540ca0e270bfacb289638 | [] | no_license | Pau1990Dam/M06_UF4 | c69ca6d1be367e6666050f919528e0111e3354b4 | 8b54ffa9c6ce85f39eee93a550a5107bb3329abc | refs/heads/master | 2021-01-21T13:29:22.897957 | 2017-09-01T15:35:51 | 2017-09-01T15:35:51 | 102,127,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,997 | java |
package jaxbObj;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para producteType complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* <complexType name="producteType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="id">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}unsignedShort">
* </restriction>
* </simpleType>
* </element>
* <element name="nom">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* </restriction>
* </simpleType>
* </element>
* <element name="preu">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}float">
* <minInclusive value="0"/>
* </restriction>
* </simpleType>
* </element>
* <element name="stock">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}unsignedShort">
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "producteType", propOrder = {
"id",
"nom",
"preu",
"stock"
})
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
public class ProducteType {
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
protected int id;
@XmlElement(required = true)
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
protected String nom;
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
protected float preu;
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
protected int stock;
/**
* Obtiene el valor de la propiedad id.
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
public int getId() {
return id;
}
/**
* Define el valor de la propiedad id.
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
public void setId(int value) {
this.id = value;
}
/**
* Obtiene el valor de la propiedad nom.
*
* @return
* possible object is
* {@link String }
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
public String getNom() {
return nom;
}
/**
* Define el valor de la propiedad nom.
*
* @param value
* allowed object is
* {@link String }
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
public void setNom(String value) {
this.nom = value;
}
/**
* Obtiene el valor de la propiedad preu.
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
public float getPreu() {
return preu;
}
/**
* Define el valor de la propiedad preu.
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
public void setPreu(float value) {
this.preu = value;
}
/**
* Obtiene el valor de la propiedad stock.
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
public int getStock() {
return stock;
}
/**
* Define el valor de la propiedad stock.
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2017-04-22T04:15:12+02:00", comments = "JAXB RI v2.2.8-b130911.1802")
public void setStock(int value) {
this.stock = value;
}
}
| [
"14270729b@iespoblenou.org"
] | 14270729b@iespoblenou.org |
b9ab985338c9572637d2d209bafe189cb8be2b5d | 685b234bb56cfbff855c221999bc4bd41d418256 | /src/hackerRank/interviewPrep/Greedy/MinimunAbsoluteDiffInAnArray.java | 02a57ae54cf0ce79bb9121b2723dd8e2c91332e4 | [] | no_license | maximbu/coding | 1c81a20ceb258d530b37a4159bfb54933ba658b8 | 9be1f394babc4a0d37f0bfc91f8772adb7148ea9 | refs/heads/master | 2021-04-09T13:18:15.432970 | 2020-02-15T13:24:50 | 2020-02-20T20:58:41 | 125,671,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 624 | java | package hackerRank.interviewPrep.Greedy;
import java.util.Arrays;
public class MinimunAbsoluteDiffInAnArray {
static int minimumAbsoluteDifference(int[] arr) {
int ans = Integer.MAX_VALUE;
Arrays.sort(arr);
for (int i = 1; i < arr.length; i++) {
ans = Math.min(ans, Math.abs(arr[i] - arr[i - 1]));
}
return ans;
}
public static void main(String[] s) {
System.out.println(minimumAbsoluteDifference(new int[]{-59, -36, -13, 1, -53, -92, -2, -96, -54, 75}));
System.out.println(minimumAbsoluteDifference(new int[]{1, -3, 71, 68, 17}));
}
}
| [
"maximbu@gmail.com"
] | maximbu@gmail.com |
5f1a648250ce5e55d9f90339fedf4ea77bb16fda | dd978e493e9d700085b46f2b8d84d01067c05c76 | /src/main/java/org/nuxeo/ecm/platform/template/adapters/AbstractTemplateDocument.java | c56a8b5c38dbb86f6fad9e7e2351a59cf271d46d | [] | no_license | amtech/nuxeo-platform-rendering-templates | f097f0e70128ff501f3e51c7c5116056d75ab226 | ff873fababb1bcf4c3895f349acf06aa54d81b3d | refs/heads/master | 2020-04-09T06:56:15.831386 | 2012-04-06T13:53:25 | 2012-04-06T13:53:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,407 | java | /*
* (C) Copyright 2006-20012 Nuxeo SAS (http://nuxeo.com/) and contributors.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl.html
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* Contributors:
* Nuxeo - initial API and implementation
*
*/
package org.nuxeo.ecm.platform.template.adapters;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.CoreInstance;
import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.platform.template.TemplateInput;
import org.nuxeo.ecm.platform.template.XMLSerializer;
import org.nuxeo.ecm.platform.template.adapters.doc.TemplateBasedDocument;
import org.nuxeo.ecm.platform.template.adapters.source.TemplateSourceDocument;
import org.nuxeo.ecm.platform.template.processors.TemplateProcessor;
import org.nuxeo.ecm.platform.template.service.TemplateProcessorService;
import org.nuxeo.runtime.api.Framework;
/**
* Base class for shared code bewteen the {@link TemplateBasedDocument} and the
* {@link TemplateSourceDocument}.
*
* @author Tiry (tdelprat@nuxeo.com)
*
*/
public abstract class AbstractTemplateDocument implements Serializable {
private static final long serialVersionUID = 1L;
protected static Log log = LogFactory.getLog(AbstractTemplateDocument.class);
protected DocumentModel adaptedDoc;
protected CoreSession getSession() {
if (adaptedDoc == null) {
return null;
}
return adaptedDoc.getCoreSession();
}
public DocumentModel getAdaptedDoc() {
return adaptedDoc;
}
protected void doSave() throws ClientException {
adaptedDoc = getSession().saveDocument(adaptedDoc);
}
public DocumentModel save() throws ClientException {
doSave();
return adaptedDoc;
}
}
| [
"tdelprat@nuxeo.com"
] | tdelprat@nuxeo.com |
faeeea52b982f9212fbe6aa746b821ee5901db29 | 02244287fbdd53a3a2b1dcd67f35b26ba33d3750 | /Day1/src/homework/demo3.java | 610c3bf6d23bc67e08c5f73e6ce4ab582a0cf710 | [] | no_license | A203/Dongju | 1f7dfebdaca2d4446d4735a59b41c8c73f90a244 | 7039829636fc0a8eb5dd89231868eb8db36d35b3 | refs/heads/master | 2016-09-06T09:28:05.967646 | 2015-07-15T06:29:30 | 2015-07-15T06:29:30 | 38,697,183 | 0 | 0 | null | null | null | null | ISO-8859-7 | Java | false | false | 235 | java | package homework;
public class demo3 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
char s='Κύ';
char x='O';
System.out.println(s);
System.out.println(x);
}
} | [
"dongju1181@qq.com"
] | dongju1181@qq.com |
07e2fe087687692273dc8aaa808a5c09e5cb5229 | 23bf4d7b2ab2d3e91f4008a8ba929f12dc718184 | /app/src/main/java/com/example/lee/dailygram/Profile/AccountSettingsActivity.java | 69050bc5817f6cb9c4c8fe318f4d480bdac8698f | [] | no_license | zhye78/Dailygram | f1c37877044594a7e7256294ecf1059014b5eb23 | 7d2bd9e394771466b21ac7cc141a922094432626 | refs/heads/master | 2021-06-28T22:35:20.325915 | 2021-02-04T08:52:45 | 2021-02-04T08:52:45 | 215,820,256 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,222 | java | package com.example.lee.dailygram.Profile;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import com.example.lee.dailygram.R;
import com.example.lee.dailygram.Utils.BottomNavigationViewHelper;
import com.example.lee.dailygram.Utils.FirebaseMethods;
import com.example.lee.dailygram.Utils.SectionsStatePagerAdapter;
import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx;
import java.util.ArrayList;
public class AccountSettingsActivity extends AppCompatActivity {
private static final String TAG = "AccountSettingsActivity";
private static final int ACTIVITY_NUM=4;//프로필 액티비티 인텐트 넘버
private Context mContext;
public SectionsStatePagerAdapter pagerAdapter;
private ViewPager mViewPager;
private RelativeLayout mRelativeLayout;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_accountsettings);
mContext = AccountSettingsActivity.this;
Log.d(TAG,"onCreate: started");
mViewPager = (ViewPager)findViewById(R.id.viewpager_container);
mRelativeLayout = (RelativeLayout)findViewById(R.id.relLayout1);
setupSettingsList();
setupBottomNavigationView();
setupFragments();
getIncomingIntent();
//네비게이션에서 프로필 액티비티로 다시 옮겨질때
ImageView backArrow = (ImageView) findViewById(R.id.backArrow);
backArrow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "onClick: navigating back to 'ProfileActivity'.");
finish();
}
});
}
private void getIncomingIntent(){
Intent intent=getIntent();
if(intent.hasExtra(getString(R.string.selected_image))
|| intent.hasExtra(getString(R.string.selected_bitmap))) {
//if there is an imageUrl attached as an extra, then it was chosen from the gallery/photo fragment
// Log.d(TAG, "getIncomingIntent: New incoming imgUrl");
if(intent.getStringExtra(getString(R.string.return_to_fragment)).equals(getString(R.string.edit_profile_fragment))) {
if (intent.hasExtra(getString(R.string.selected_image))) {
//set the new profile picture
FirebaseMethods firebaseMethods = new FirebaseMethods(AccountSettingsActivity.this);
firebaseMethods.uploadNewPhoto(getString(R.string.profile_photo), null, 0,
intent.getStringExtra(getString(R.string.selected_image)), null);
} else if (intent.hasExtra(getString(R.string.selected_bitmap))) {
//set the new profile picture
FirebaseMethods firebaseMethods = new FirebaseMethods(AccountSettingsActivity.this);
firebaseMethods.uploadNewPhoto(getString(R.string.profile_photo), null, 0,
null, (Bitmap) intent.getParcelableExtra(getString(R.string.selected_bitmap)));
}
}
}
if(intent.hasExtra(getString(R.string.calling_activity))){
Log.d(TAG, "getIncomingIntent: received incoming intent from "+getString(R.string.profile_activity));
setViewPager(pagerAdapter.getFragmentNumber(getString(R.string.edit_profile_fragment)));
}
}
private void setupFragments(){
pagerAdapter = new SectionsStatePagerAdapter(getSupportFragmentManager());
pagerAdapter.addFragment(new EditProfileFragment(),getString(R.string.edit_profile_fragment)); //프래그먼트 0
pagerAdapter.addFragment(new SignOutFragment(),getString(R.string.sign_out_fragment)); //프래그먼트 1
}
public void setViewPager(int fragmentNumber){
mRelativeLayout.setVisibility(View.GONE);
Log.d(TAG, "setViewPager: navigating to fragment :"+fragmentNumber);
mViewPager.setAdapter(pagerAdapter);
mViewPager.setCurrentItem(fragmentNumber);
}
//strings.xml에서 설정한 string을 options (ArrayList) 에 담고 어댑터를 이용해 찍기
private void setupSettingsList(){
Log.d(TAG, "setupSettingsList : initializing Account Settings list.");
ListView listView = (ListView)findViewById(R.id.lvAccountSettings);
ArrayList<String> options = new ArrayList<>();
options.add(getString(R.string.edit_profile_fragment)); //프래그먼트0
options.add(getString(R.string.sign_out_fragment)); //프래그먼트 1
ArrayAdapter adapter = new ArrayAdapter(mContext,android.R.layout.simple_list_item_1,options);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG, "onItemClick: navigating to fragment : "+position);
setViewPager(position);
}
});
}
//bottomNavigationView 셋업
private void setupBottomNavigationView(){
Log.d(TAG,"setupBottomNavigationView : setting up BottomNavigationView !");
BottomNavigationViewEx bottomNavigationViewEx = (BottomNavigationViewEx)findViewById(R.id.bottomNavViewBar);
BottomNavigationViewHelper.setupBottomNavigationView(bottomNavigationViewEx);
BottomNavigationViewHelper.enableNavigation(mContext,this,bottomNavigationViewEx);
Menu menu = bottomNavigationViewEx.getMenu();
MenuItem menuItem = menu.getItem(ACTIVITY_NUM);
menuItem.setChecked(true);
}
}
| [
"ccoje2155@naver.com"
] | ccoje2155@naver.com |
7e7c647f4c2e14735267cd543f3e417e15a4ae79 | e80c8493c7017083b98c92a873f3d9b227052320 | /src/main/java/com/ms/util/poi/BookMark.java | dcc985948d343c7f0984c70dce6729b3da10b49f | [] | no_license | se7enms/springboot | 0c50e36cce74242e33ea338cd6697cc03c4faec4 | c94c0b699fcc528808d29ff5cc0e26079459fd56 | refs/heads/master | 2020-03-28T21:10:40.830389 | 2019-03-08T08:37:18 | 2019-03-08T08:37:18 | 149,135,511 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 30,057 | java | package com.ms.util.poi;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xwpf.usermodel.*;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.List;
import java.util.Stack;
/**
*
* Word 文件中标签的封装类,保存了其定义和内部的操作
*
* @author
*
* <p>
* Modification History:
* </p>
* <p>
* Date Author Description
*/
public class BookMark {
// 以下为定义的常量
/** 替换标签时,设于标签的后面 **/
private static final int INSERT_AFTER = 0;
/** 替换标签时,设于标签的前面 **/
static final int INSERT_BEFORE = 1;
/** 替换标签时,将内容替换书签 **/
private static final int REPLACE = 2;
/** docx中定义的部分常量引用 **/
static final String RUN_NODE_NAME = "w:r";
private static final String TEXT_NODE_NAME = "w:t";
private static final String BOOKMARK_START_TAG = "bookmarkStart";
private static final String BOOKMARK_END_TAG = "bookmarkEnd";
private static final String BOOKMARK_ID_ATTR_NAME = "w:id";
static final String STYLE_NODE_NAME = "w:rPr";
/** 内部的标签定义类 **/
private CTBookmark ctBookmark = null;
/** 标签所处的段落 **/
private XWPFParagraph _para = null;
/** 标签所在的表cell对象 **/
private XWPFTableCell _tableCell = null;
/** 标签名称 **/
private String _bookmarkName = null;
/** 该标签是否处于表格内 **/
private boolean _isCell = false;
/**
* 构造函数
*
* @param ctBookmark
* @param para
*/
public BookMark(CTBookmark ctBookmark, XWPFParagraph para) {
this.ctBookmark = ctBookmark;
this._para = para;
this._bookmarkName = ctBookmark.getName();
this._tableCell = null;
this._isCell = false;
}
/**
* 构造函数,用于表格中的标签
*
* @param ctBookmark
* @param para
* @param tableCell
*/
public BookMark(CTBookmark ctBookmark, XWPFParagraph para,XWPFTableCell tableCell) {
this(ctBookmark, para);
this._tableCell = tableCell;
this._isCell = true;
}
public boolean isInTable() {
return this._isCell;
}
public XWPFTable getContainerTable() {
return this._tableCell.getTableRow().getTable();
}
public XWPFTableRow getContainerTableRow() {
return this._tableCell.getTableRow();
}
public String getBookmarkName() {
return this._bookmarkName;
}
/**
* Insert text into the Word document in the location indicated by this
* bookmark.
*
* @param bookmarkValue
* An instance of the String class that encapsulates the text to
* insert into the document.
* @param where
* A primitive int whose value indicates where the text ought to
* be inserted. There are three options controlled by constants;
* insert the text immediately in front of the bookmark
* (Bookmark.INSERT_BEFORE), insert text immediately after the
* bookmark (Bookmark.INSERT_AFTER) and replace any and all text
* that appears between the bookmark's square brackets
* (Bookmark.REPLACE).
*/
public void insertTextAtBookMark(String bookmarkValue, int where,ParagraphAlignment paragraphAlignment) {
// 根据标签的类型,进行不同的操作
if (this._isCell) {
this.handleBookmarkedCells(bookmarkValue, where,paragraphAlignment);
} else {
// 普通标签,直接创建一个元素
XWPFRun run = this._para.createRun();
run.setText(bookmarkValue);
switch (where) {
case BookMark.INSERT_AFTER:
this.insertAfterBookmark(run);
break;
case BookMark.INSERT_BEFORE:
this.insertBeforeBookmark(run);
break;
case BookMark.REPLACE:
this.replaceBookmark(run);
break;
}
}
}
public void insertTableTitle(String bookmarkValue) {
ReportUtil reportUtil = new ReportUtil();
reportUtil.insertTableTitle(this._para, bookmarkValue);
}
/**根据书签替换对应文本,在表格中插入数据
* @param bookmarkValue 书签
* @param isBold 加粗
* @param fontSize 字号
* @param fontFamily 字体
*/
public void repalceTextAtBookMark(String bookmarkValue,boolean isBold,boolean isUnderline,int fontSize,String fontFamily) {
// 普通标签,直接创建一个元素
XWPFRun run = this._para.createRun();
run.setText(bookmarkValue);
run.setBold(isBold);
run.setFontSize(fontSize);
run.setFontFamily(fontFamily);
if(isUnderline) {
run.setUnderline(UnderlinePatterns.SINGLE);
}
this.replaceBookmark(run);
}
/**
* Inserts some text into a Word document in a position that is immediately
* after a named bookmark.
*
* Bookmarks can take two forms, they can either simply mark a location
* within a document or they can do this but contain some text. The
* difference is obvious from looking at some XML markup. The simple
* placeholder bookmark will look like this;
*
* <pre>
*
* <w:bookmarkStart w:name="AllAlone" w:id="0"/><w:bookmarkEnd w:id="0"/>
*
* </pre>
*
* Simply a pair of tags where one tag has the name bookmarkStart, the other
* the name bookmarkEnd and both share matching id attributes. In this case,
* the text will simply be inserted into the document at a point immediately
* after the bookmarkEnd tag. No styling will be applied to the text, it
* will simply inherit the documents defaults.
*
* The more complex case looks like this;
*
* <pre>
*
* <w:bookmarkStart w:name="InStyledText" w:id="3"/>
* <w:r w:rsidRPr="00DA438C">
* <w:rPr>
* <w:rFonts w:hAnsi="Engravers MT" w:ascii="Engravers MT" w:cs="Arimo"/>
* <w:color w:val="FF0000"/>
* </w:rPr>
* <w:t>text</w:t>
* </w:r>
* <w:bookmarkEnd w:id="3"/>
*
* </pre>
*
* Here, the user has selected the word 'text' and chosen to insert a
* bookmark into the document at that point. So, the bookmark tags 'contain'
* a character run that is styled. Inserting any text after this bookmark,
* it is important to ensure that the styling is preserved and copied over
* to the newly inserted text.
*
* The approach taken to dealing with both cases is similar but slightly
* different. In both cases, the code simply steps along the document nodes
* until it finds the bookmarkEnd tag whose ID matches that of the
* bookmarkStart tag. Then, it will look to see if there is one further node
* following the bookmarkEnd tag. If there is, it will insert the text into
* the paragraph immediately in front of this node. If, on the other hand,
* there are no more nodes following the bookmarkEnd tag, then the new run
* will simply be positioned at the end of the paragraph.
*
* Styles are dealt with by 'looking' for a 'w:rPr' element whilst iterating
* through the nodes. If one is found, its details will be captured and
* applied to the run before the run is inserted into the paragraph. If
* there are multiple runs between the bookmarkStart and bookmarkEnd tags
* and these have different styles applied to them, then the style applied
* to the last run before the bookmarkEnd tag - if any - will be cloned and
* applied to the newly inserted text.
*
* @param run
* An instance of the XWPFRun class that encapsulates the text
* that is to be inserted into the document following the
* bookmark.
*/
private void insertAfterBookmark(XWPFRun run) {
Node nextNode = null;
Node insertBeforeNode = null;
Node styleNode = null;
int bookmarkStartID = 0;
int bookmarkEndID = -1;
// Capture the id of the bookmarkStart tag. The code will step through
// the document nodes 'contained' within the start and end tags that
// have
// matching id numbers.
bookmarkStartID = this.ctBookmark.getId().intValue();
// Get the node for the bookmark start tag and then enter a loop that
// will step from one node to the next until the bookmarkEnd tag with
// a matching id is fouind.
nextNode = this.ctBookmark.getDomNode();
while (bookmarkStartID != bookmarkEndID) {
// Get the next node along and check to see if it is a bookmarkEnd
// tag. If it is, get its id so that the containing while loop can
// be terminated once the correct end tag is found. Note that the
// id will be obtained as a String and must be converted into an
// integer. This has been coded to fail safely so that if an error
// is encuntered converting the id to an int value, the while loop
// will still terminate.
nextNode = nextNode.getNextSibling();
if (nextNode.getNodeName().contains(BookMark.BOOKMARK_END_TAG)) {
try {
bookmarkEndID = Integer.parseInt(nextNode.getAttributes()
.getNamedItem(BookMark.BOOKMARK_ID_ATTR_NAME)
.getNodeValue());
} catch (NumberFormatException nfe) {
bookmarkEndID = bookmarkStartID;
}
} // If we are not dealing with a bookmarkEnd node, are we dealing
// with a run node that MAY contains styling information. If so,
// then get that style information from the run.
else {
if (nextNode.getNodeName().equals(BookMark.RUN_NODE_NAME)) {
styleNode = this.getStyleNode(nextNode);
}
}
}
// After the while loop completes, it should have located the correct
// bookmarkEnd tag but we cannot perform an insert after only an insert
// before operation and must, therefore, get the next node.
insertBeforeNode = nextNode.getNextSibling();
// Style the newly inserted text. Note that the code copies or clones
// the style it found in another run, failure to do this would remove
// the
// style from one node and apply it to another.
if (styleNode != null) {
run.getCTR()
.getDomNode()
.insertBefore(styleNode.cloneNode(true),
run.getCTR().getDomNode().getFirstChild());
}
// Finally, check to see if there was a node after the bookmarkEnd
// tag. If there was, then this code will insert the run in front of
// that tag. If there was no node following the bookmarkEnd tag then the
// run will be inserted at the end of the paragarph and this was taken
// care of at the point of creation.
if (insertBeforeNode != null) {
this._para.getCTP().getDomNode()
.insertBefore(run.getCTR().getDomNode(), insertBeforeNode);
}
}
/**
* Inserts some text into a Word document immediately in front of the
* location of a bookmark.
*
* This case is slightly more straightforward than inserting after the
* bookmark. For example, it is possible only to insert a new node in front
* of an existing node. When inserting after the bookmark, then end node had
* to be located whereas, in this case, the node is already known, it is the
* CTBookmark itself. The only information that must be discovered is
* whether there is a run immediately in front of the boookmarkStart tag and
* whether that run is styled. If there is and if it is, then this style
* must be cloned and applied the text which will be inserted into the
* paragraph.
*
* @param run
* An instance of the XWPFRun class that encapsulates the text
* that is to be inserted into the document following the
* bookmark.
*/
private void insertBeforeBookmark(XWPFRun run) {
Node insertBeforeNode = null;
Node childNode = null;
Node styleNode = null;
// Get the dom node from the bookmarkStart tag and look for another
// node immediately preceding it.
insertBeforeNode = this.ctBookmark.getDomNode();
childNode = insertBeforeNode.getPreviousSibling();
// If a node is found, try to get the styling from it.
if (childNode != null) {
styleNode = this.getStyleNode(childNode);
// If that previous node was styled, then apply this style to the
// text which will be inserted.
if (styleNode != null) {
run.getCTR()
.getDomNode()
.insertBefore(styleNode.cloneNode(true),
run.getCTR().getDomNode().getFirstChild());
}
}
// Insert the text into the paragraph immediately in front of the
// bookmarkStart tag.
this._para.getCTP().getDomNode()
.insertBefore(run.getCTR().getDomNode(), insertBeforeNode);
}
/**
* Replace the text - if any - contained between the bookmarkStart and it's
* matching bookmarkEnd tag with the text specified. The technique used will
* resemble that employed when inserting text after the bookmark. In short,
* the code will iterate along the nodes until it encounters a matching
* bookmarkEnd tag. Each node encountered will be deleted unless it is the
* final node before the bookmarkEnd tag is encountered and it is a
* character run. If this is the case, then it can simply be updated to
* contain the text the users wishes to see inserted into the document. If
* the last node is not a character run, then it will be deleted, a new run
* will be created and inserted into the paragraph between the bookmarkStart
* and bookmarkEnd tags.
*
* @param run
* An instance of the XWPFRun class that encapsulates the text
* that is to be inserted into the document following the
* bookmark.
*/
private void replaceBookmark(XWPFRun run) {
Node nextNode = null;
Node styleNode = null;
Node lastRunNode = null;
Node toDelete = null;
NodeList childNodes = null;
Stack<Node> nodeStack = null;
boolean textNodeFound = false;
boolean foundNested = true;
int bookmarkStartID = 0;
int bookmarkEndID = -1;
int numChildNodes = 0;
nodeStack = new Stack<Node>();
bookmarkStartID = this.ctBookmark.getId().intValue();
nextNode = this.ctBookmark.getDomNode();
nodeStack.push(nextNode);
// Loop through the nodes looking for a matching bookmarkEnd tag
while (bookmarkStartID != bookmarkEndID) {
nextNode = nextNode.getNextSibling();
nodeStack.push(nextNode);
// If an end tag is found, does it match the start tag? If so, end
// the while loop.
if (nextNode.getNodeName().contains(BookMark.BOOKMARK_END_TAG)) {
try {
bookmarkEndID = Integer.parseInt(nextNode.getAttributes()
.getNamedItem(BookMark.BOOKMARK_ID_ATTR_NAME)
.getNodeValue());
} catch (NumberFormatException nfe) {
bookmarkEndID = bookmarkStartID;
}
}
// else {
// Place a reference to the node on the nodeStack
// nodeStack.push(nextNode);
// }
}
// If the stack of nodes found between the bookmark tags is not empty
// then they have to be removed.
if (!nodeStack.isEmpty()) {
// Check the node at the top of the stack. If it is a run, get it's
// style - if any - and apply to the run that will be replacing it.
// lastRunNode = nodeStack.pop();
lastRunNode = nodeStack.peek();
if ((lastRunNode.getNodeName().equals(BookMark.RUN_NODE_NAME))) {
styleNode = this.getStyleNode(lastRunNode);
if (styleNode != null) {
run.getCTR()
.getDomNode()
.insertBefore(styleNode.cloneNode(true),
run.getCTR().getDomNode().getFirstChild());
}
}
// Delete any and all node that were found in between the start and
// end tags. This is slightly safer that trying to delete the nodes
// as they are found while stepping through them in the loop above.
// If we are peeking, then this line can be commented out.
// this._para.getCTP().getDomNode().removeChild(lastRunNode);
this.deleteChildNodes(nodeStack);
}
// Place the text into position, between the bookmark tags.
this._para.getCTP().getDomNode()
.insertBefore(run.getCTR().getDomNode(), nextNode);
}
/**
* When replacing the bookmark's text, it is necessary to delete any nodes
* that are found between matching start and end tags. Complications occur
* here because it is possible to have bookmarks nested within bookmarks to
* almost any level and it is important to not remove any inner or nested
* bookmarks when replacing the contents of an outer or containing bookmark.
* This code successfully handles the simplest occurrence - where one
* bookmark completely contains another - but not more complex cases where
* one bookmark overlaps another in the markup. That is still to do.
*
* @param nodeStack
* An instance of the Stack class that encapsulates references to
* any and all nodes found between the opening and closing tags
* of a bookmark.
*/
private void deleteChildNodes(Stack<Node> nodeStack) {
Node toDelete = null;
int bookmarkStartID = 0;
int bookmarkEndID = 0;
boolean inNestedBookmark = false;
// The first element in the list will be a bookmarkStart tag and that
// must not be deleted.
for (int i = 1; i < nodeStack.size(); i++) {
// Get an element. If it is another bookmarkStart tag then
// again, we do not want to delete it, it's matching end tag
// or any nodes that fall inbetween.
toDelete = nodeStack.elementAt(i);
if (toDelete.getNodeName().contains(BookMark.BOOKMARK_START_TAG)) {
bookmarkStartID = Integer.parseInt(toDelete.getAttributes()
.getNamedItem(BookMark.BOOKMARK_ID_ATTR_NAME)
.getNodeValue());
inNestedBookmark = true;
} else if (toDelete.getNodeName().contains(
BookMark.BOOKMARK_END_TAG)) {
bookmarkEndID = Integer.parseInt(toDelete.getAttributes()
.getNamedItem(BookMark.BOOKMARK_ID_ATTR_NAME)
.getNodeValue());
if (bookmarkEndID == bookmarkStartID) {
inNestedBookmark = false;
}
} else {
if (!inNestedBookmark) {
this._para.getCTP().getDomNode().removeChild(toDelete);
}
}
}
}
/**
* Recover styling information - if any - from another document node. Note
* that it is only possible to accomplish this if the node is a run (w:r)
* and this could be tested for in the code that calls this method. However,
* a check is made in the calling code as to whether a style has been found
* and only if a style is found is it applied. This method always returns
* null if it does not find a style making that checking process easier.
*
* @param parentNode
* An instance of the Node class that encapsulates a reference to
* a document node.
* @return An instance of the Node class that encapsulates the styling
* information applied to a character run. Note that if no styling
* information is found in the run OR if the node passed as an
* argument to the parentNode parameter is NOT a run, then a null
* value will be returned.
*/
private Node getStyleNode(Node parentNode) {
Node childNode = null;
Node styleNode = null;
if (parentNode != null) {
// If the node represents a run and it has child nodes then
// it can be processed further. Note, whilst testing the code, it
// was observed that although it is possible to get a list of a
// nodes
// children, even when a node did have children, trying to obtain
// this
// list would often return a null value. This is the reason why the
// technique of stepping from one node to the next is used here.
if (parentNode.getNodeName().equalsIgnoreCase(
BookMark.RUN_NODE_NAME)
&& parentNode.hasChildNodes()) {
// Get the first node and catch it's reference for return if
// the first child node is a style node (w:rPr).
childNode = parentNode.getFirstChild();
if (childNode.getNodeName().equals("w:rPr")) {
styleNode = childNode;
} else {
// If the first node was not a style node and there are
// other
// child nodes remaining to be checked, then step through
// the remaining child nodes until either a style node is
// found or until all child nodes have been processed.
while ((childNode = childNode.getNextSibling()) != null) {
if (childNode.getNodeName().equals(
BookMark.STYLE_NODE_NAME)) {
styleNode = childNode;
// Note setting to null here if a style node is
// found in order order to terminate any further
// checking
childNode = null;
}
}
}
}
}
return (styleNode);
}
/**
* Get the text - if any - encapsulated by this bookmark. The creator of a
* Word document can chose to select one or more items of text and then
* insert a bookmark at that location. The highlighted text will appear
* between the square brackets that denote the location of a bookmark in the
* document's text and they will be returned by a call to this method.
*
* @return An instance of the String class encapsulating any text that
* appeared between the opening and closing square bracket
* associated with this bookmark.
* @throws XmlException
* Thrown if a problem is encountered parsing the XML markup
* recovered from the document in order to construct a CTText
* instance which may required to obtain the bookmarks text.
*/
public String getBookmarkText() throws XmlException {
StringBuilder builder = null;
// Are we dealing with a bookmarked table cell? If so, the entire
// contents of the cell - if anything - must be recovered and returned.
if (this._tableCell != null) {
builder = new StringBuilder(this._tableCell.getText());
} else {
builder = this.getTextFromBookmark();
}
return (builder == null ? null : builder.toString());
}
/**
* There are two types of bookmarks. One is a simple placeholder whilst the
* second is still a placeholder but it 'contains' some text. In the second
* instance, the creator of the document has selected some text and then
* chosen to insert a bookmark there and the difference if obvious when
* looking at the XML markup.
*
* The simple case;
*
* <pre>
*
* <w:bookmarkStart w:name="AllAlone" w:id="0"/><w:bookmarkEnd w:id="0"/>
*
* </pre>
*
* The more complex case;
*
* <pre>
*
* <w:bookmarkStart w:name="InStyledText" w:id="3"/>
* <w:r w:rsidRPr="00DA438C">
* <w:rPr>
* <w:rFonts w:hAnsi="Engravers MT" w:ascii="Engravers MT" w:cs="Arimo"/>
* <w:color w:val="FF0000"/>
* </w:rPr>
* <w:t>text</w:t>
* </w:r>
* <w:bookmarkEnd w:id="3"/>
*
* </pre>
*
* This method assumes that the user wishes to recover the content from any
* character run that appears in the markup between a matching pair of
* bookmarkStart and bookmarkEnd tags; thus, using the example above again,
* this method would return the String 'text' to the user. It is possible
* however for a bookmark to contain more than one run and for a bookmark to
* contain other bookmarks. In both of these cases, this code will return
* the text contained within any and all runs that appear in the XML markup
* between matching bookmarkStart and bookmarkEnd tags. The term 'matching
* bookmarkStart and bookmarkEndtags' here means tags whose id attributes
* have matching value.
*
* @return An instance of the StringBuilder class encapsulating the text
* recovered from any character run elements found between the
* bookmark's start and end tags. If no text is found then a null
* value will be returned.
* @throws XmlException
* Thrown if a problem is encountered parsing the XML markup
* recovered from the document in order to construct a CTText
* instance which may be required to obtain the bookmarks text.
*/
private StringBuilder getTextFromBookmark() throws XmlException {
int startBookmarkID = 0;
int endBookmarkID = -1;
Node nextNode = null;
Node childNode = null;
CTText text = null;
StringBuilder builder = null;
String rawXML = null;
// Get the ID of the bookmark from it's start tag, the DOM node from the
// bookmark (to make looping easier) and initialise the StringBuilder.
startBookmarkID = this.ctBookmark.getId().intValue();
nextNode = this.ctBookmark.getDomNode();
builder = new StringBuilder();
// Loop through the nodes held between the bookmark's start and end
// tags.
while (startBookmarkID != endBookmarkID) {
// Get the next node and, if it is a bookmarkEnd tag, get it's ID
// as matching ids will terminate the while loop..
nextNode = nextNode.getNextSibling();
if (nextNode.getNodeName().contains(BookMark.BOOKMARK_END_TAG)) {
// Get the ID attribute from the node. It is a String that must
// be converted into an int. An exception could be thrown and so
// the catch clause will ensure the loop ends neatly even if the
// value might be incorrect. Must inform the user.
try {
endBookmarkID = Integer.parseInt(nextNode.getAttributes()
.getNamedItem(BookMark.BOOKMARK_ID_ATTR_NAME)
.getNodeValue());
} catch (NumberFormatException nfe) {
endBookmarkID = startBookmarkID;
}
} else {
// This is not a bookmarkEnd node and can processed it for any
// text it may contain. Note the check for both type - it must
// be a run - and contain children. Interestingly, it seems as
// though the node may contain children and yet the call to
// nextNode.getChildNodes() will still return an empty list,
// hence the need to step through the child nodes.
if (nextNode.getNodeName().equals(BookMark.RUN_NODE_NAME)
&& nextNode.hasChildNodes()) {
// Get the text from the child nodes.
builder.append(this.getTextFromChildNodes(nextNode));
}
}
}
return (builder);
}
/**
* Iterates through all and any children of the Node whose reference will be
* passed as an argument to the node parameter, and recover the contents of
* any text nodes. Testing revealed that a node can be called a text node
* and yet report it's type as being something different, an element node
* for example. Calling the getNodeValue() method on a text node will return
* the text the node encapsulates but doing the same on an element node will
* not. In fact, the call will simply return a null value. As a result, this
* method will test the nodes name to catch all text nodes - those whose
* name is to 'w:t' and then it's type. If the type is reported to be a text
* node, it is a trivial task to get at it's contents. However, if the type
* is not reported as a text type, then it is necessary to parse the raw XML
* markup for the node to recover it's value.
*
* @param node
* An instance of the Node class that encapsulates a reference to
* a node recovered from the document being processed. It should
* be passed a reference to a character run - 'w:r' - node.
* @return An instance of the String class that encapsulates the text
* recovered from the nodes children, if they are text nodes.
* @throws XmlException
* Thrown if a problem is encountered parsing the XML markup
* recovered from the document in order to construct the CTText
* instance which may be required to obtain the bookmarks text.
*/
private String getTextFromChildNodes(Node node) throws XmlException {
NodeList childNodes = null;
Node childNode = null;
CTText text = null;
StringBuilder builder = new StringBuilder();
int numChildNodes = 0;
// Get a list of chid nodes from the node passed to the method and
// find out how many children there are in the list.
childNodes = node.getChildNodes();
numChildNodes = childNodes.getLength();
// Iterate through the children one at a time - it is possible for a
// run to ciontain zero, one or more text nodes - and recover the text
// from an text type child nodes.
for (int i = 0; i < numChildNodes; i++) {
// Get a node and check it's name. If this is 'w:t' then process as
// text type node.
childNode = childNodes.item(i);
if (childNode.getNodeName().equals(BookMark.TEXT_NODE_NAME)) {
// If the node reports it's type as txet, then simply call the
// getNodeValue() method to get at it's text.
if (childNode.getNodeType() == Node.TEXT_NODE) {
builder.append(childNode.getNodeValue());
} else {
// Correct the type by parsing the node's XML markup and
// creating a CTText object. Call the getStringValue()
// method on that to get the text.
text = CTText.Factory.parse(childNode);
builder.append(text.getStringValue());
}
}
}
return (builder.toString());
}
private void handleBookmarkedCells(String bookmarkValue, int where,ParagraphAlignment paragraphAlignment) {
PoiWordUtil poiWordUtil = new PoiWordUtil();
List<XWPFParagraph> paraList = null;
XWPFRun run = null;
XWPFParagraph para = null;
XWPFRun readRun = null;
// Get a list if paragraphs from the table cell and remove any and all.
paraList = this._tableCell.getParagraphs();
for (int i = 0; i < paraList.size(); i++) {
this._tableCell.removeParagraph(i);
}
para = this._tableCell.addParagraph();
para.setAlignment(paragraphAlignment);
run = para.createRun();
if(bookmarkValue==null||bookmarkValue.equals("null")){
bookmarkValue="";
}
run.setText(bookmarkValue);
run.setFontSize(12);
run.setFontFamily("宋体");
poiWordUtil.setParagraphSpacingInfo(para, true, null, null, null, null, true, "360", STLineSpacingRule.AUTO);
}
private void handleBookmarkedCells_insert(String bookmarkValue,String bookmarkName, int where,String highlight) {
PoiWordUtil poiWordUtil = new PoiWordUtil();
List<XWPFParagraph> paraList = null;
// Get a list if paragraphs from the table cell and remove any and all.
paraList = this._tableCell.getParagraphs();
for (int i = 0; i < paraList.size(); i++) {
int runNum = Integer.parseInt(bookmarkName.substring(bookmarkName.length()-1, bookmarkName.length()));
XWPFRun run = this._tableCell.getParagraphs().get(i).insertNewRun(runNum);
run.setText(bookmarkValue);
if(!StringUtils.isEmpty(highlight)){
run.getCTR().addNewRPr().addNewHighlight().setVal(STHighlightColor.Enum.forString(highlight));
}
run.setFontSize(12);
}
}
} | [
"se7enmmss@gmail.com"
] | se7enmmss@gmail.com |
a9491bffc5d02072158935349daccdc4b3e4ec09 | 1b0840cf836cd8b7a2298ffbd239d1e405d69e8b | /parquet-mr-apache-parquet-1.7.0/parquet-column/src/main/java/org/apache/parquet/schema/PrimitiveType.java | e8d98c07573191eddb495a1b52efdecf65ee6bc0 | [
"Apache-2.0"
] | permissive | Lionel-Coding-Lee/readKafka | e64c3d0efdc561dada466edde702b6f81ec861d8 | 7308cb209419e3c81cb30d446cbba2ec44a6a156 | refs/heads/master | 2021-01-20T01:38:11.903866 | 2017-04-25T05:58:29 | 2017-04-25T05:58:29 | 89,309,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,597 | 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.parquet.schema;
import java.util.Arrays;
import java.util.List;
import org.apache.parquet.column.ColumnReader;
import org.apache.parquet.io.InvalidRecordException;
import org.apache.parquet.io.api.Binary;
import org.apache.parquet.io.api.PrimitiveConverter;
import org.apache.parquet.io.api.RecordConsumer;
/**
*
* Representation of a Primitive type
*
* @author Julien Le Dem
*
*/
public final class PrimitiveType extends Type {
public static interface PrimitiveTypeNameConverter<T, E extends Exception> {
T convertFLOAT(PrimitiveTypeName primitiveTypeName) throws E;
T convertDOUBLE(PrimitiveTypeName primitiveTypeName) throws E;
T convertINT32(PrimitiveTypeName primitiveTypeName) throws E;
T convertINT64(PrimitiveTypeName primitiveTypeName) throws E;
T convertINT96(PrimitiveTypeName primitiveTypeName) throws E;
T convertFIXED_LEN_BYTE_ARRAY(PrimitiveTypeName primitiveTypeName) throws E;
T convertBOOLEAN(PrimitiveTypeName primitiveTypeName) throws E;
T convertBINARY(PrimitiveTypeName primitiveTypeName) throws E;
}
/**
* Supported Primitive types
*
* @author Julien Le Dem
*/
public static enum PrimitiveTypeName {
INT64("getLong", Long.TYPE) {
@Override
public String toString(ColumnReader columnReader) {
return String.valueOf(columnReader.getLong());
}
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
ColumnReader columnReader) {
recordConsumer.addLong(columnReader.getLong());
}
@Override
public void addValueToPrimitiveConverter(
PrimitiveConverter primitiveConverter, ColumnReader columnReader) {
primitiveConverter.addLong(columnReader.getLong());
}
@Override
public <T, E extends Exception> T convert(PrimitiveTypeNameConverter<T, E> converter) throws E {
return converter.convertINT64(this);
}
},
INT32("getInteger", Integer.TYPE) {
@Override
public String toString(ColumnReader columnReader) {
return String.valueOf(columnReader.getInteger());
}
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
ColumnReader columnReader) {
recordConsumer.addInteger(columnReader.getInteger());
}
@Override
public void addValueToPrimitiveConverter(
PrimitiveConverter primitiveConverter, ColumnReader columnReader) {
primitiveConverter.addInt(columnReader.getInteger());
}
@Override
public <T, E extends Exception> T convert(PrimitiveTypeNameConverter<T, E> converter) throws E {
return converter.convertINT32(this);
}
},
BOOLEAN("getBoolean", Boolean.TYPE) {
@Override
public String toString(ColumnReader columnReader) {
return String.valueOf(columnReader.getBoolean());
}
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
ColumnReader columnReader) {
recordConsumer.addBoolean(columnReader.getBoolean());
}
@Override
public void addValueToPrimitiveConverter(
PrimitiveConverter primitiveConverter, ColumnReader columnReader) {
primitiveConverter.addBoolean(columnReader.getBoolean());
}
@Override
public <T, E extends Exception> T convert(PrimitiveTypeNameConverter<T, E> converter) throws E {
return converter.convertBOOLEAN(this);
}
},
BINARY("getBinary", Binary.class) {
@Override
public String toString(ColumnReader columnReader) {
return String.valueOf(columnReader.getBinary());
}
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
ColumnReader columnReader) {
recordConsumer.addBinary(columnReader.getBinary());
}
@Override
public void addValueToPrimitiveConverter(
PrimitiveConverter primitiveConverter, ColumnReader columnReader) {
primitiveConverter.addBinary(columnReader.getBinary());
}
@Override
public <T, E extends Exception> T convert(PrimitiveTypeNameConverter<T, E> converter) throws E {
return converter.convertBINARY(this);
}
},
FLOAT("getFloat", Float.TYPE) {
@Override
public String toString(ColumnReader columnReader) {
return String.valueOf(columnReader.getFloat());
}
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
ColumnReader columnReader) {
recordConsumer.addFloat(columnReader.getFloat());
}
@Override
public void addValueToPrimitiveConverter(
PrimitiveConverter primitiveConverter, ColumnReader columnReader) {
primitiveConverter.addFloat(columnReader.getFloat());
}
@Override
public <T, E extends Exception> T convert(PrimitiveTypeNameConverter<T, E> converter) throws E {
return converter.convertFLOAT(this);
}
},
DOUBLE("getDouble", Double.TYPE) {
@Override
public String toString(ColumnReader columnReader) {
return String.valueOf(columnReader.getDouble());
}
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
ColumnReader columnReader) {
recordConsumer.addDouble(columnReader.getDouble());
}
@Override
public void addValueToPrimitiveConverter(
PrimitiveConverter primitiveConverter, ColumnReader columnReader) {
primitiveConverter.addDouble(columnReader.getDouble());
}
@Override
public <T, E extends Exception> T convert(PrimitiveTypeNameConverter<T, E> converter) throws E {
return converter.convertDOUBLE(this);
}
},
INT96("getBinary", Binary.class) {
@Override
public String toString(ColumnReader columnReader) {
return Arrays.toString(columnReader.getBinary().getBytes());
}
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
ColumnReader columnReader) {
recordConsumer.addBinary(columnReader.getBinary());
}
@Override
public void addValueToPrimitiveConverter(
PrimitiveConverter primitiveConverter, ColumnReader columnReader) {
primitiveConverter.addBinary(columnReader.getBinary());
}
@Override
public <T, E extends Exception> T convert(PrimitiveTypeNameConverter<T, E> converter) throws E {
return converter.convertINT96(this);
}
},
FIXED_LEN_BYTE_ARRAY("getBinary", Binary.class) {
@Override
public String toString(ColumnReader columnReader) {
return String.valueOf(columnReader.getBinary());
}
@Override
public void addValueToRecordConsumer(RecordConsumer recordConsumer,
ColumnReader columnReader) {
recordConsumer.addBinary(columnReader.getBinary());
}
@Override
public void addValueToPrimitiveConverter(
PrimitiveConverter primitiveConverter, ColumnReader columnReader) {
primitiveConverter.addBinary(columnReader.getBinary());
}
@Override
public <T, E extends Exception> T convert(PrimitiveTypeNameConverter<T, E> converter) throws E {
return converter.convertFIXED_LEN_BYTE_ARRAY(this);
}
};
public final String getMethod;
public final Class<?> javaType;
private PrimitiveTypeName(String getMethod, Class<?> javaType) {
this.getMethod = getMethod;
this.javaType = javaType;
}
/**
* reads the value from the columnReader with the appropriate accessor and returns a String representation
* @param columnReader
* @return a string
*/
abstract public String toString(ColumnReader columnReader);
/**
* reads the value from the columnReader with the appropriate accessor and writes it to the recordConsumer
* @param recordConsumer where to write
* @param columnReader where to read from
*/
abstract public void addValueToRecordConsumer(RecordConsumer recordConsumer,
ColumnReader columnReader);
abstract public void addValueToPrimitiveConverter(
PrimitiveConverter primitiveConverter, ColumnReader columnReader);
abstract public <T, E extends Exception> T convert(PrimitiveTypeNameConverter<T, E> converter) throws E;
}
private final PrimitiveTypeName primitive;
private final int length;
private final DecimalMetadata decimalMeta;
/**
* @param repetition OPTIONAL, REPEATED, REQUIRED
* @param primitive STRING, INT64, ...
* @param name the name of the type
*/
public PrimitiveType(Repetition repetition, PrimitiveTypeName primitive,
String name) {
this(repetition, primitive, 0, name, null, null, null);
}
/**
* @param repetition OPTIONAL, REPEATED, REQUIRED
* @param primitive STRING, INT64, ...
* @param length the length if the type is FIXED_LEN_BYTE_ARRAY, 0 otherwise (XXX)
* @param name the name of the type
*/
public PrimitiveType(Repetition repetition, PrimitiveTypeName primitive, int length, String name) {
this(repetition, primitive, length, name, null, null, null);
}
/**
* @param repetition OPTIONAL, REPEATED, REQUIRED
* @param primitive STRING, INT64, ...
* @param name the name of the type
* @param originalType (optional) the original type to help with cross schema convertion (LIST, MAP, ...)
*/
public PrimitiveType(Repetition repetition, PrimitiveTypeName primitive,
String name, OriginalType originalType) {
this(repetition, primitive, 0, name, originalType, null, null);
}
/**
* @param repetition OPTIONAL, REPEATED, REQUIRED
* @param primitive STRING, INT64, ...
* @param name the name of the type
* @param length the length if the type is FIXED_LEN_BYTE_ARRAY, 0 otherwise (XXX)
* @param originalType (optional) the original type to help with cross schema conversion (LIST, MAP, ...)
*/
@Deprecated
public PrimitiveType(Repetition repetition, PrimitiveTypeName primitive,
int length, String name, OriginalType originalType) {
this(repetition, primitive, length, name, originalType, null, null);
}
/**
* @param repetition OPTIONAL, REPEATED, REQUIRED
* @param primitive STRING, INT64, ...
* @param name the name of the type
* @param length the length if the type is FIXED_LEN_BYTE_ARRAY, 0 otherwise
* @param originalType (optional) the original type (MAP, DECIMAL, UTF8, ...)
* @param decimalMeta (optional) metadata about the decimal type
* @param id the id of the field
*/
PrimitiveType(
Repetition repetition, PrimitiveTypeName primitive,
int length, String name, OriginalType originalType,
DecimalMetadata decimalMeta, ID id) {
super(name, repetition, originalType, id);
this.primitive = primitive;
this.length = length;
this.decimalMeta = decimalMeta;
}
/**
* @param id the field id
* @return a new PrimitiveType with the same fields and a new id
*/
@Override
public PrimitiveType withId(int id) {
return new PrimitiveType(getRepetition(), primitive, length, getName(), getOriginalType(), decimalMeta, new ID(id));
}
/**
* @return the primitive type
*/
public PrimitiveTypeName getPrimitiveTypeName() {
return primitive;
}
/**
* @return the type length
*/
public int getTypeLength() {
return length;
}
/**
* @return the decimal type metadata
*/
public DecimalMetadata getDecimalMetadata() {
return decimalMeta;
}
/**
* @return true
*/
@Override
public boolean isPrimitive() {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public void accept(TypeVisitor visitor) {
visitor.visit(this);
}
/**
* {@inheritDoc}
*/
@Override
public void writeToStringBuilder(StringBuilder sb, String indent) {
sb.append(indent)
.append(getRepetition().name().toLowerCase())
.append(" ")
.append(primitive.name().toLowerCase());
if (primitive == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) {
sb.append("(" + length + ")");
}
sb.append(" ").append(getName());
if (getOriginalType() != null) {
sb.append(" (").append(getOriginalType());
DecimalMetadata meta = getDecimalMetadata();
if (meta != null) {
sb.append("(")
.append(meta.getPrecision())
.append(",")
.append(meta.getScale())
.append(")");
}
sb.append(")");
}
if (getId() != null) {
sb.append(" = ").append(getId());
}
}
@Override @Deprecated
protected int typeHashCode() {
return hashCode();
}
@Override @Deprecated
protected boolean typeEquals(Type other) {
return equals(other);
}
/**
* {@inheritDoc}
*/
@Override
protected boolean equals(Type other) {
if (!other.isPrimitive()) {
return false;
}
PrimitiveType otherPrimitive = other.asPrimitiveType();
return super.equals(other)
&& primitive == otherPrimitive.getPrimitiveTypeName()
&& length == otherPrimitive.length
&& eqOrBothNull(decimalMeta, otherPrimitive.decimalMeta);
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
int hash = super.hashCode();
hash = hash * 31 + primitive.hashCode();
hash = hash * 31 + length;
if (decimalMeta != null) {
hash = hash * 31 + decimalMeta.hashCode();
}
return hash;
}
@Override
public int getMaxRepetitionLevel(String[] path, int i) {
if (path.length != i) {
throw new InvalidRecordException("Arrived at primitive node, path invalid");
}
return isRepetition(Repetition.REPEATED)? 1 : 0;
}
@Override
public int getMaxDefinitionLevel(String[] path, int i) {
if (path.length != i) {
throw new InvalidRecordException("Arrived at primitive node, path invalid");
}
return isRepetition(Repetition.REQUIRED) ? 0 : 1;
}
@Override
public Type getType(String[] path, int i) {
if (path.length != i) {
throw new InvalidRecordException("Arrived at primitive node at index " + i + " , path invalid: " + Arrays.toString(path));
}
return this;
}
@Override
protected List<String[]> getPaths(int depth) {
return Arrays.<String[]>asList(new String[depth]);
}
@Override
void checkContains(Type subType) {
super.checkContains(subType);
if (!subType.isPrimitive()) {
throw new InvalidRecordException(subType + " found: expected " + this);
}
PrimitiveType primitiveType = subType.asPrimitiveType();
if (this.primitive != primitiveType.primitive) {
throw new InvalidRecordException(subType + " found: expected " + this);
}
}
@Override
public <T> T convert(List<GroupType> path, TypeConverter<T> converter) {
return converter.convertPrimitiveType(path, this);
}
@Override
protected boolean containsPath(String[] path, int depth) {
return path.length == depth;
}
@Override
protected Type union(Type toMerge) {
return union(toMerge, true);
}
@Override
protected Type union(Type toMerge, boolean strict) {
if (!toMerge.isPrimitive() || (strict && !primitive.equals(toMerge.asPrimitiveType().getPrimitiveTypeName()))) {
throw new IncompatibleSchemaModificationException("can not merge type " + toMerge + " into " + this);
}
Types.PrimitiveBuilder<PrimitiveType> builder = Types.primitive(
primitive, toMerge.getRepetition());
if (PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == primitive) {
builder.length(length);
}
return builder.named(getName());
}
}
| [
"lipf@dtdream.com"
] | lipf@dtdream.com |
cfd16058f75a8d186630b4b67960ab316f87d76f | 9c9067d9bfa19f052a433ec4111c97b686a6ac5e | /ch24/customer-support-v18/source/main/java/jun/projavawebapp/site/AuthenticationService.java | c4087869c177d1592f03b8871a48f35248a5e918 | [
"MIT"
] | permissive | jdcsma/projavawebapp | c289123b59db4901a6d1760a9641c3117a357e73 | 50c596fb91fdc9e4c8b97b76557929fea2041bb6 | refs/heads/master | 2022-12-22T01:59:01.812147 | 2020-05-27T17:21:11 | 2020-05-27T17:21:11 | 185,805,881 | 0 | 0 | MIT | 2022-12-16T15:27:38 | 2019-05-09T13:36:51 | Java | UTF-8 | Java | false | false | 755 | java | package jun.projavawebapp.site;
import jun.projavawebapp.site.entities.UserPrincipal;
import jun.projavawebapp.site.validation.NotBlank;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
@Validated
public interface AuthenticationService {
UserPrincipal authenticate(
@NotBlank(message = "{validate.authenticate.username}")
String username,
@NotBlank(message = "{validate.authenticate.password}")
String password
);
void saveUser(
@NotNull(message = "{validate.authenticate.saveUser}") @Valid
UserPrincipal principal,
String newPassword
);
}
| [
"jdcsma@163.com"
] | jdcsma@163.com |
54156055ab641c9bc6e01629b783fd4353e6a04c | 959546e3be36e222733c6d83a6eb23b0a00c2dc3 | /databasemigration/src/main/java/com/spring/databasemigration/databasemigration/concast/TableConcast.java | cad825253c403a6d004373588f33e19e0a72fed9 | [] | no_license | AAAJMLAAA/jml | 4932626789190323b21ba6c7cf27d3ceb9ad3e06 | 3474a3f39997350c0069e3208482eb8969b5dea0 | refs/heads/master | 2023-08-04T07:03:51.321827 | 2021-01-06T13:04:41 | 2021-01-06T13:04:41 | 203,125,892 | 0 | 0 | null | 2023-07-22T13:55:48 | 2019-08-19T07:58:30 | JavaScript | UTF-8 | Java | false | false | 363 | java | package com.spring.databasemigration.databasemigration.concast;
public class TableConcast {
public final static String TARGET_PATH = "E:/module/text/table.sql";
public final static String TARGET_PATH2 = "E:/module/text/data.sql";
public final static String TEMPLATE_PATH = "D:/jml_work/202001/eclipse/databasemigration/src/main/resources/templates";
}
| [
"19506@LAPTOP-4JIDEAQ2"
] | 19506@LAPTOP-4JIDEAQ2 |
fd6dca0c4e90c9a86f59e44754bcea3351ce1a8e | f4e15ee34808877459d81fd601d6be03bdfb4a9d | /javax/servlet/ServletContextEvent.java | d6880a61ab94b6871a8c6a9b6dc43a86132ef937 | [] | no_license | Lianite/wurm-server-reference | 369081debfa72f44eafc6a080002c4a3970f8385 | e4dd8701e4af13901268cf9a9fa206fcb5196ff0 | refs/heads/master | 2023-07-22T16:06:23.426163 | 2020-04-07T23:15:35 | 2020-04-07T23:15:35 | 253,933,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | //
// Decompiled by Procyon v0.5.30
//
package javax.servlet;
import java.util.EventObject;
public class ServletContextEvent extends EventObject
{
public ServletContextEvent(final ServletContext source) {
super(source);
}
public ServletContext getServletContext() {
return (ServletContext)super.getSource();
}
}
| [
"jdraco6@gmail.com"
] | jdraco6@gmail.com |
c0b1d8876a11a9b21c1e8d004f3524479b7b6be7 | f3a62c4a1d384905e42d5332d4febde1c1103f02 | /src/L22AlgorithmsExercises/Ex01ReverseArray.java | 0d0b1194877fb85b883f545ef82dd7690bf7f277 | [
"MIT"
] | permissive | VasAtanasov/SoftUni-Java-Advanced-January-2019 | 019f5734e5805134d22fae6fad6f3b764205f6fa | a09cafd1e1306ee028985329e5384065248b9b97 | refs/heads/master | 2020-04-14T21:26:23.040048 | 2019-03-16T11:04:54 | 2019-03-16T11:04:54 | 164,128,508 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,278 | java | package L22AlgorithmsExercises;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Ex01ReverseArray {
private static BufferedReader reader;
static {
reader = new BufferedReader(new InputStreamReader(System.in));
}
public static void main(String[] args) throws IOException {
int[] numbers = Arrays.stream(reader.readLine().split("\\s+"))
.mapToInt(Integer::parseInt)
.toArray();
System.out.println(Arrays.toString(reverseArray(numbers)).replaceAll("[\\[\\],]",""));
}
private static int[] reverseArray(int[] array) {
return reverseArray(array.clone(), 0, array.length - 1);
}
private static int[] reverseArray(int[] array, int startIndex, int endIndex) {
if (startIndex >= endIndex) { // base condition, nothing to do when there is one or no element to consider
return array;
}
// swap array[startIndex] and array[endIndex]
int temp = array[startIndex];
array[startIndex] = array[endIndex];
array[endIndex] = temp;
// recurse with the decreasing bounds
return reverseArray(array, startIndex + 1, endIndex - 1);
}
}
| [
"vas.atanasov@gmail.com"
] | vas.atanasov@gmail.com |
203788464e9dff01bc21d75f963c31922f95ba9e | eabb770e8cfb1dc75ef12667ad19d7565459f428 | /TabsWithSwipeGesture/src/com/rollingscenes/picasso/MarkableInputStream.java | ebd0253af2d228a73e5f8994c1f14c62cb32243b | [] | no_license | KunalBhavsar/Roller | 3d8eae7257c537777c2e564ac1811e4c8581fffb | 92bd4187a00a5dce77e0d52e70c3609ff396adaa | refs/heads/master | 2016-09-05T23:20:01.170911 | 2015-07-18T10:16:00 | 2015-07-18T10:16:00 | 39,294,537 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,625 | java | /*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rollingscenes.picasso;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* An input stream wrapper that supports unlimited independent cursors for
* marking and resetting. Each cursor is a token, and it's the caller's
* responsibility to keep track of these.
*/
final class MarkableInputStream extends InputStream {
private static final int DEFAULT_BUFFER_SIZE = 4096;
private final InputStream in;
private long offset;
private long reset;
private long limit;
private long defaultMark = -1;
public MarkableInputStream(InputStream in) {
this(in, DEFAULT_BUFFER_SIZE);
}
public MarkableInputStream(InputStream in, int size) {
if (!in.markSupported()) {
in = new BufferedInputStream(in, size);
}
this.in = in;
}
/** Marks this place in the stream so we can reset back to it later. */
@Override public void mark(int readLimit) {
defaultMark = savePosition(readLimit);
}
/**
* Returns an opaque token representing the current position in the stream.
* Call {@link #reset(long)} to return to this position in the stream later.
* It is an error to call {@link #reset(long)} after consuming more than
* {@code readLimit} bytes from this stream.
*/
public long savePosition(int readLimit) {
long offsetLimit = offset + readLimit;
if (limit < offsetLimit) {
setLimit(offsetLimit);
}
return offset;
}
/**
* Makes sure that the underlying stream can backtrack the full range from
* {@code reset} thru {@code limit}. Since we can't call {@code mark()}
* without also adjusting the reset-to-position on the underlying stream this
* method resets first and then marks the union of the two byte ranges. On
* buffered streams this additional cursor motion shouldn't result in any
* additional I/O.
*/
private void setLimit(long limit) {
try {
if (reset < offset && offset <= this.limit) {
in.reset();
in.mark((int) (limit - reset));
skip(reset, offset);
} else {
reset = offset;
in.mark((int) (limit - offset));
}
this.limit = limit;
} catch (IOException e) {
throw new IllegalStateException("Unable to mark: " + e);
}
}
/** Resets the stream to the most recent {@link #mark mark}. */
@Override public void reset() throws IOException {
reset(defaultMark);
}
/** Resets the stream to the position recorded by {@code token}. */
public void reset(long token) throws IOException {
if (offset > limit || token < reset) {
throw new IOException("Cannot reset");
}
in.reset();
skip(reset, token);
offset = token;
}
/** Skips {@code target - current} bytes and returns. */
private void skip(long current, long target) throws IOException {
while (current < target) {
long skipped = in.skip(target - current);
if (skipped == 0) {
if (read() == -1) {
break; // EOF
} else {
skipped = 1;
}
}
current += skipped;
}
}
@Override public int read() throws IOException {
int result = in.read();
if (result != -1) {
offset++;
}
return result;
}
@Override public int read(byte[] buffer) throws IOException {
int count = in.read(buffer);
if (count != -1) {
offset += count;
}
return count;
}
@Override public int read(byte[] buffer, int offset, int length) throws IOException {
int count = in.read(buffer, offset, length);
if (count != -1) {
this.offset += count;
}
return count;
}
@Override public long skip(long byteCount) throws IOException {
long skipped = in.skip(byteCount);
offset += skipped;
return skipped;
}
@Override public int available() throws IOException {
return in.available();
}
@Override public void close() throws IOException {
in.close();
}
@Override public boolean markSupported() {
return in.markSupported();
}
}
| [
"kunal.vaghmare@gmail.com"
] | kunal.vaghmare@gmail.com |
59582d2a37e539457bfe510b7719782c7d80a2e5 | 787847aed280440367a635d1bec7e90e2f06a6e2 | /mybatisProject/src/member/controller/SearchFrmServlet.java | 5aac7b30cbd7cbf19f8f330b38b713cc11b925d9 | [] | no_license | tjwnstlr3459/oneday_3459 | 53bdb5e3addffe76a7a78dc9b8df6e3635194854 | ad12d3b221f9e035ab06fbb56feafd6415161ede | refs/heads/master | 2023-06-20T18:22:41.673134 | 2021-07-17T03:35:36 | 2021-07-17T03:35:36 | 366,296,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package member.controller;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class SearchFrmServlet
*/
@WebServlet(name = "SearchFrm", urlPatterns = { "/searchFrm" })
public class SearchFrmServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public SearchFrmServlet() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/views/member/search.jsp");
rd.forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"tjwnstlr3459@naver.com"
] | tjwnstlr3459@naver.com |
1f82f62c4fec146dc0b91008c878d4a4c3411f53 | 1ce5b926c0daec77c8574ac401ab433a5bee6224 | /elearning/src/main/java/com/modular/persistence/dao/QuestionDAO.java | 8f211f58fbb0e099c6292b8d3fa7d844d46cf827 | [] | no_license | Paul2696/modular | 648c408c53b57336cdbb99ae7b76cebe29aad81c | 9836660e72901c809348166d78534229c0deeb36 | refs/heads/master | 2022-07-12T11:36:00.534454 | 2020-09-03T21:02:24 | 2020-09-03T21:02:24 | 191,044,947 | 0 | 0 | null | 2022-05-20T21:02:18 | 2019-06-09T19:09:27 | JavaScript | UTF-8 | Java | false | false | 232 | java | package com.modular.persistence.dao;
import com.modular.persistence.model.Question;
import java.util.List;
public interface QuestionDAO extends BaseDAO<Question> {
List<Question> getAllQuestions() throws DataBaseException;
}
| [
"paul.hermosillo.haro@gmail.com"
] | paul.hermosillo.haro@gmail.com |
806e7e9408355a0b915b68fa567327b0de6eb66b | 604cf521bdd05796a2c4117764a964de485e9984 | /02_template/src/persistencia/OrdenarPorCursoENome.java | 84902165ec3cf3115388c3f467e3e8420382bd8b | [] | no_license | GabriOliv/java-netbeans-design-pattern | f6fcb113ccb387242be9f0976b1835790c87a7ef | f34ec931d09ce870fd22e439fd32ef5a1d87f9bc | refs/heads/main | 2023-03-20T04:59:34.953775 | 2021-03-19T22:04:55 | 2021-03-19T22:04:55 | 333,215,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 668 | java | package persistencia;
import classededados.Aluno;
public class OrdenarPorCursoENome extends AlunoPersistenciaCursoENome{
public OrdenarPorCursoENome(String curso, String nome) {
super(curso, nome);
}
@Override
public boolean ePrimeiro(Aluno aluno1, Aluno aluno2){
if(aluno1.getCurso().compareToIgnoreCase(aluno2.getCurso()) < 0) return true;
else{
if(aluno1.getCurso().compareToIgnoreCase(aluno2.getCurso()) > 0) return false;
else if(aluno1.getNome().compareToIgnoreCase(aluno2.getNome()) <= 0) return true;
else return false;
}
}
}
| [
"gabcomp.gov@gmail.com"
] | gabcomp.gov@gmail.com |
0a5f66d26ba335cd6b200491984f7bb7a8d4b4dd | 447520f40e82a060368a0802a391697bc00be96f | /apks/malware/app81/source/com/tencent/android/tpush/horse/Tools.java | 4a9198ddd89145df09f41799b8e781a569dd7114 | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 4,337 | java | package com.tencent.android.tpush.horse;
import android.content.Context;
import com.tencent.android.tpush.XGPushManager;
import com.tencent.android.tpush.horse.data.OptStrategyList;
import com.tencent.android.tpush.logging.TLog;
import com.tencent.android.tpush.service.a.a;
import com.tencent.android.tpush.service.b.k;
import com.tencent.android.tpush.service.cache.CacheManager;
import com.tencent.android.tpush.service.d.d;
import java.util.HashSet;
import java.util.Iterator;
public class Tools
{
public static final String KEY = ".com.tencent.tpush.toolschannel";
public static final String SHARE_NAME = ".com.tencent.tpush.toolschannel_name";
public static final String STRATEGY = ".com.tencent.tpush.toolsstrategy";
public static final String TOOLS_NAME_UNI_SUFFIX = ".com.tencent.tpush.tools";
public static final int TYPE_DEFAULT = 0;
public static final int TYPE_HTTP = 2;
public static final int TYPE_HTTP_WAP = 3;
public static final int TYPE_TCP = 1;
public Tools() {}
public static void clearAll(Context paramContext)
{
TLog.i("TPush", ">> clearCache");
clearOptKeyList(paramContext);
clearCacheServerItems(paramContext);
clearOptStrategyItem(paramContext);
clearMultPkgs(paramContext);
XGPushManager.clearLocalNotifications(paramContext);
d.a(paramContext, "isClearCache.com.tencent.tpush.cache.redirect", "memeda3");
}
public static void clearCacheServerItems(Context paramContext)
{
if (paramContext != null) {
TLog.v("XGService", "@@ clearCacheServerItems(" + paramContext.getPackageName() + ")");
}
try
{
CacheManager.clearDomainServerItem(paramContext);
CacheManager.saveDomain(paramContext, "");
CacheManager.saveDomainKeyList(paramContext, null);
a.a(paramContext, 0L);
return;
}
catch (Throwable paramContext)
{
TLog.e("XGService", paramContext.getMessage());
}
}
public static void clearMultPkgs(Context paramContext)
{
if (paramContext != null) {
TLog.v("XGService", "@@ clearMultPkgs(" + paramContext.getPackageName() + ")");
}
try
{
k.a().a(paramContext);
return;
}
catch (Exception paramContext)
{
TLog.e("XGService", paramContext.getMessage());
}
}
public static void clearOptKeyList(Context paramContext)
{
if (paramContext != null) {
CacheManager.clearOptKeyList(paramContext);
}
}
public static void clearOptStrategyItem(Context paramContext)
{
if (paramContext != null)
{
TLog.v("XGService", "@@ clearOptStrategyItem(" + paramContext.getPackageName() + ")");
try
{
d.a(paramContext, d.g(paramContext) + ".com.tencent.tpush.cache.redirect", "");
Iterator localIterator = CacheManager.getOptKeyList(paramContext).iterator();
while (localIterator.hasNext()) {
CacheManager.addOptStrategyList(paramContext, (String)localIterator.next(), new OptStrategyList());
}
return;
}
catch (Exception localException)
{
CacheManager.clearOptKeyList(paramContext);
TLog.e("XGService", localException.getMessage());
CacheManager.addOptStrategyList(paramContext, d.g(paramContext), new OptStrategyList());
}
}
}
public static void clearRegisterInfo(Context paramContext, long paramLong)
{
if (paramContext != null) {
TLog.v("XGService", "@@ clearRegisterInfo(" + paramContext.getPackageName() + "," + paramLong + ")");
}
try
{
CacheManager.removeRegisterInfoByPkgName(paramContext.getPackageName());
return;
}
catch (Exception paramContext)
{
TLog.e("XGService", paramContext.getMessage());
}
}
public static int getChannelType(Context paramContext)
{
int i = 0;
if (paramContext != null)
{
TLog.v("XGService", "@@ getChannelType(" + paramContext.getPackageName() + ")");
i = d.b(paramContext, ".com.tencent.tpush.toolschannel", 0);
}
return i;
}
public static void setChannelType(Context paramContext, int paramInt)
{
if (paramContext != null)
{
TLog.v("XGService", "@@ setChannelType(" + paramContext.getPackageName() + "," + paramInt + ")");
d.a(paramContext, ".com.tencent.tpush.toolschannel", paramInt);
}
}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
f5c92f2227ce470e50030fd6432a38df0862d91b | a2272f1002da68cc554cd57bf9470322a547c605 | /src/jdk/jdk.internal.vm.compiler/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/IntegerExactExceptionTest.java | 155bb618676f4f8d47b0e069888a276706567c85 | [] | no_license | framework-projects/java | 50af8953ab46c509432c467c9ad69cc63818fa63 | 2d131cb46f232d3bf909face20502e4ba4b84db0 | refs/heads/master | 2023-06-28T05:08:00.482568 | 2021-08-04T08:42:32 | 2021-08-04T08:42:32 | 312,414,414 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,128 | java | /*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.graalvm.compiler.replacements.test;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.code.InvalidInstalledCodeException;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import org.graalvm.compiler.core.test.GraalCompilerTest;
import org.junit.Test;
public class IntegerExactExceptionTest extends GraalCompilerTest {
static int intCounter = 32;
public void testIntegerExactOverflowSnippet(int input) {
try {
intCounter = Math.addExact(intCounter, input);
} catch (ArithmeticException e) {
intCounter = intCounter / 2;
}
}
@Test
public void testIntegerExact() throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getResolvedJavaMethod("testIntegerExactOverflowSnippet");
InstalledCode code = getCode(method);
code.executeVarargs(this, Integer.MAX_VALUE);
if (!code.isValid()) {
code = getCode(method);
code.executeVarargs(this, Integer.MAX_VALUE);
assertTrue(code.isValid());
}
}
public void testIntegerExactOverflowWithoutHandlerSnippetW(int input) {
try {
intCounter = Math.addExact(intCounter, input);
} finally {
intCounter = intCounter / 2;
}
}
@Test
public void testIntegerExactWithoutHandler() throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getResolvedJavaMethod("testIntegerExactOverflowWithoutHandlerSnippetW");
InstalledCode code = getCode(method);
try {
code.executeVarargs(this, Integer.MAX_VALUE);
} catch (ArithmeticException e) {
// An ArithmeticException is expected to be thrown.
}
if (!code.isValid()) {
code = getCode(method);
try {
code.executeVarargs(this, Integer.MAX_VALUE);
} catch (ArithmeticException e) {
// An ArithmeticException is expected to be thrown.
}
assertTrue(code.isValid());
}
}
public void testIntegerExactOverflowWithoutUse1(int input) {
Math.addExact(intCounter, input);
}
public void testIntegerExactOverflowWithoutUse2(int input, boolean cond) {
if (cond) {
Math.addExact(intCounter, input);
} else {
intCounter = Math.addExact(intCounter, input);
}
}
public void testIntegerExactOverflowWithoutUse3() {
Math.addExact(Integer.MAX_VALUE, 1);
}
@Test
public void testIntegerExactWithoutUse1() throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getResolvedJavaMethod("testIntegerExactOverflowWithoutUse1");
InstalledCode code = getCode(method);
boolean gotException = false;
try {
code.executeVarargs(this, Integer.MAX_VALUE);
} catch (ArithmeticException e) {
gotException = true;
}
assertTrue(gotException);
}
@Test
public void testIntegerExactWithoutUse2() throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getResolvedJavaMethod("testIntegerExactOverflowWithoutUse2");
InstalledCode code = getCode(method);
boolean gotException = false;
try {
code.executeVarargs(this, Integer.MAX_VALUE, true);
} catch (ArithmeticException e) {
gotException = true;
}
assertTrue(gotException);
}
@Test
public void testIntegerExactWithoutUse3() throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getResolvedJavaMethod("testIntegerExactOverflowWithoutUse3");
InstalledCode code = getCode(method);
boolean gotException = false;
try {
code.executeVarargs(this);
} catch (ArithmeticException e) {
gotException = true;
}
assertTrue(gotException);
}
static long longCounter = 10;
public void testLongExactOverflowSnippet(long input) {
try {
longCounter = Math.addExact(longCounter, input);
} catch (ArithmeticException e) {
longCounter = longCounter / 2;
}
}
@Test
public void testLongExact() throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getResolvedJavaMethod("testLongExactOverflowSnippet");
InstalledCode code = getCode(method);
code.executeVarargs(this, Long.MAX_VALUE);
if (!code.isValid()) {
code = getCode(method);
code.executeVarargs(this, Long.MAX_VALUE);
assertTrue(code.isValid());
}
}
public void testLongExactWithoutHandlerSnippet(long input) {
try {
longCounter = Math.addExact(longCounter, input);
} finally {
longCounter = longCounter / 2;
}
}
@Test
public void testLongExactWithoutHandler() throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getResolvedJavaMethod("testLongExactWithoutHandlerSnippet");
InstalledCode code = getCode(method);
try {
code.executeVarargs(this, Long.MAX_VALUE);
} catch (ArithmeticException e) {
// An ArithmeticException is expected to be thrown.
}
if (!code.isValid()) {
code = getCode(method);
try {
code.executeVarargs(this, Long.MAX_VALUE);
} catch (ArithmeticException e) {
// An ArithmeticException is expected to be thrown.
}
assertTrue(code.isValid());
}
}
public void testLongExactOverflowWithoutUse1(long input) {
Math.addExact(longCounter, input);
}
public void testLongExactOverflowWithoutUse2(long input, boolean cond) {
if (cond) {
Math.addExact(longCounter, input);
} else {
longCounter = Math.addExact(longCounter, input);
}
}
@Test
public void testLongExactWithoutUse1() throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getResolvedJavaMethod("testLongExactOverflowWithoutUse1");
InstalledCode code = getCode(method);
boolean gotException = false;
try {
code.executeVarargs(this, Long.MAX_VALUE);
} catch (ArithmeticException e) {
gotException = true;
}
assertTrue(gotException);
}
@Test
public void testLongExactWithoutUse2() throws InvalidInstalledCodeException {
ResolvedJavaMethod method = getResolvedJavaMethod("testLongExactOverflowWithoutUse2");
InstalledCode code = getCode(method);
boolean gotException = false;
try {
code.executeVarargs(this, Long.MAX_VALUE, true);
} catch (ArithmeticException e) {
gotException = true;
}
assertTrue(gotException);
}
}
| [
"chovavea@outlook.com"
] | chovavea@outlook.com |
8761c3707dab262663bd98b2beda66bfe80f2fd1 | ae002b973979b76c30072569e7bfc6b9d849f118 | /Person.java | 7006a6fac0250b16b7cecc488137ed742cfc4f8f | [] | no_license | 164469-Urvi/Day-1 | f0ed4efc97c8c207569864dff22e84d516bba3f4 | 06c2b989760d3e72afcfc3da419b22f9f806a48f | refs/heads/master | 2020-04-04T09:58:52.177653 | 2018-11-30T12:51:35 | 2018-11-30T12:51:35 | 155,838,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 372 | java | import java.util.TreeSet;
public class Person {
public static void main(String[] args) {
TreeSet<Student> tree=new TreeSet<Student>(new Weight());
tree.add(new Student("Karan",55,520));
tree.add(new Student("Kajal",50,540));
tree.add(new Student("Tisha",45,545));
tree.add(new Student("Falguni",45,550));
for(Student s:tree){
System.out.println(s);
}
}
}
| [
"urvipatwa18@gmail.com"
] | urvipatwa18@gmail.com |
d0d195c26e48c3c52d88d901de68042280ff0569 | adeea3ebe59372554fab748a239934f1601b66c2 | /ScantronPDFProducer/Column.java | 57bd6dea1784b696e8704221c0170b2b69290c7a | [] | no_license | maltahan/Justin-Paul-s-Projects | 3894b32c61d9b6de30f9ccfe6838a8f41752495c | da945dd0c12620c1b58271b99032de1da5e2f371 | refs/heads/master | 2021-01-25T08:19:24.332904 | 2012-09-25T04:20:14 | 2012-09-25T04:20:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | import java.lang.*;
import java.io.*;
import java.util.List;
import java.util.ArrayList;
import java.util.*;
import com.pdfjet.*;
public class Column
{
// instance variables - replace the example below with your own
//Linelength needs to come from strings in the array - how does we get outz?
private int lineLength = 0;
public Column(int numCol)
{
assert numCol != 0;
this.lineLength = 85/numCol;
}
public String arrayToString(LinkedList<String> array){
String stri = "";
for (String x : array){
stri = stri + x + "\n" + "\n";
}
return stri;
}
public String create(String question)
{
LinkedList<String> col = new LinkedList<String>();
while(question.length() > lineLength){
col.add(question.substring(0,lineLength));
question = question.substring(lineLength);
}
col.add(question);
String end = new String();
for(String x : col){
end = end + "\n" + x;
}
return end;
}
}
| [
"justin.s.paul@vanderbilt.edu"
] | justin.s.paul@vanderbilt.edu |
54761988b1777dd25dc3386244b3a1e106115fa9 | b60da22bc192211b3978764e63af23e2e24081f5 | /cdc/src/share/javavm/test/GCTest/DirectMem/Jsrc/DMArrayRWBodyRefTest.java | bb0c1374c57fa0e2911c3a209eeaed8e89344291 | [] | no_license | clamp03/JavaAOTC | 44d566927c057c013538ab51e086c42c6348554e | 0ade633837ed9698cd74a3f6928ebde3d96bd3e3 | refs/heads/master | 2021-01-01T19:33:51.612033 | 2014-12-02T14:29:58 | 2014-12-02T14:29:58 | 27,435,591 | 5 | 4 | null | null | null | null | UTF-8 | Java | false | false | 3,113 | java | /*
* @(#)DMArrayRWBodyRefTest.java 1.6 06/10/10
*
* Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* 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 version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*
*/
import java.util.Random;
public class DMArrayRWBodyRefTest extends Thread {
private String [] privateArray;
public static Object lock;
public DMArrayRWBodyRefTest(int num) {
privateArray = new String[num];
}
private native void nSetArray(String[] dstArray, String[] srcArray, int arrayLength);
public void setArray(String [] srcArray) {
this.nSetArray(this.privateArray, srcArray, getArrayLength());
}
public String [] getArray() {
int arrLength = getArrayLength();
String [] stringArray = new String[arrLength];
for(int i=0; i<arrLength; i++)
stringArray[i] = privateArray[i];
return stringArray;
}
public int getArrayLength() {
return this.privateArray.length;
}
public void run() {
int arrayLength;
boolean pass=true;
Random rd = new Random();
arrayLength = getArrayLength();
String [] inArray = new String[arrayLength];
for(int i=0; i<arrayLength; i++)
inArray[i] = String.valueOf(rd.nextInt());
setArray(inArray);
String [] outArray = getArray();
for(int i=0; i<arrayLength; i++) {
if(inArray[i] != outArray[i]) {
pass = false;
break;
}
}
System.out.println();
if(pass)
System.out.println("PASS: DMArrayRWBodyRefTest, Data written and read were same");
else
System.out.println("FAIL: DMArrayRWBodyRefTest, Data written and read were not same");
}
public static void main(String args[]) {
Random rd = new Random();
Object lck = new Object();
DMArrayRWBodyRefTest.lock = lck;
GcThread.lock = lck;
GcThread gc = new GcThread();
DMArrayRWBodyRefTest test = new DMArrayRWBodyRefTest(rd.nextInt(100));
gc.setPriority(test.getPriority() + 1);
gc.start();
test.start();
try {
test.join();
} catch (Exception e) {}
gc.interrupt();
}
}
| [
"clamp03@gmail.com"
] | clamp03@gmail.com |
dcc7636a98bcbcf189ced0ece0e374d103af3605 | 1976f2f2cfb323ca85e3af8664bdc69d1a100018 | /export_manager_web/src/main/java/com/langsun/web/controller/chat/NewConfigurator.java | 73378e168fcdd8bb32befd490c103d20b50e5e47 | [] | no_license | LangSun-ottawa/SaaS_Export_System | db97370d4f818e161f344967d8328789affd14f2 | d030f01de57feb2866f996fcab8ff29ed8ec7638 | refs/heads/master | 2023-02-25T02:38:01.448479 | 2021-02-01T05:24:22 | 2021-02-01T05:24:22 | 332,104,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 694 | java | package com.langsun.web.controller.chat;
import org.springframework.web.socket.server.standard.SpringConfigurator;
import javax.servlet.http.HttpSession;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
import javax.websocket.server.ServerEndpointConfig;
public class NewConfigurator extends SpringConfigurator {
@Override
public void modifyHandshake(ServerEndpointConfig config, HandshakeRequest request, HandshakeResponse response) {
HttpSession httpSession = (HttpSession) request.getHttpSession();
System.out.println(httpSession);
config.getUserProperties().put(HttpSession.class.getName(), httpSession);
}
}
| [
"slang.ottawa@gmail.com"
] | slang.ottawa@gmail.com |
5b1782cd427bcac211ed1f7fec8b3b72580797fe | d3ab23c66b99a1096bc838b625535be721c692f0 | /cloud-provider-payment8004/src/main/java/cn/zlx/springcloud/controller/PaymentController.java | 5587e993305b42fbb919e3ad6b1715655983de4f | [] | no_license | zhonglaogen/cloud2020 | 3a6a81e3fa12e9087974485c6aab78ba8564cd4d | 692a1568a50ee941729c34239111f59f0504daab | refs/heads/master | 2022-06-25T13:23:24.092071 | 2020-03-25T14:02:37 | 2020-03-25T14:02:37 | 249,994,102 | 0 | 0 | null | 2022-06-21T03:03:56 | 2020-03-25T14:02:23 | Java | UTF-8 | Java | false | false | 714 | java | package cn.zlx.springcloud.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.UUID;
/**
* @Description:
* @author: zhonglianxi
* @date: 2020-03-18
*/
@RestController
public class PaymentController {
@Value("${server.port}")
private String serverPort;
@RequestMapping(value = "/payment/zk")
public String paymentzk(){
return " zkspringcloud with zookeeper" + serverPort + "\t" + UUID.randomUUID().toString();
}
}
| [
"ZLXzlxxs98@163.com"
] | ZLXzlxxs98@163.com |
4427d237cc5a378bf17592b82bfd82873f9afbce | eb93ee5ee0cf6e14cff1328834633d9ad8615e10 | /app/src/androidTest/java/com/example/zhangjiawen/myapplication5/ApplicationTest.java | 3c3a11bc60765ddd1e032fbec11ddb53fde950eb | [] | no_license | pray-for/MusicPlayer | 57bab4c6c27a930d0c0e86927ebb43f5e47d432d | a59e54e7880d43b9285ecfc374d35252e455c254 | refs/heads/master | 2021-01-24T11:18:47.616065 | 2017-01-12T02:45:05 | 2017-01-12T02:45:05 | 70,241,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.example.zhangjiawen.myapplication5;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"822032714@qq.com"
] | 822032714@qq.com |
9edcbab78099d488989c2e0eb032b5770182a391 | 98ce066218363a92aabe158d319bde293a1e4383 | /src/main/java/com/ithinksky/patterns/a04behavioral/t01strategy/Context.java | b7c97598785d99449418c7b5d80e8f9327ab3f1b | [
"MIT"
] | permissive | ithinksky/java-patterns | 92d8bcfa8ed958018d77e99d9cbb93b67292bfc7 | 372735e3296b6cf14ec980fd342afd4ebc60f92f | refs/heads/master | 2022-08-15T15:46:27.733636 | 2022-07-29T02:47:10 | 2022-07-29T02:47:10 | 263,059,035 | 6 | 2 | MIT | 2020-07-02T18:51:07 | 2020-05-11T14:01:40 | Java | UTF-8 | Java | false | false | 446 | java | package com.ithinksky.patterns.a04behavioral.t01strategy;
/**
* @author tengpeng.gao
*/
public class Context {
private TravelStrategy travelStrategy;
public TravelStrategy getTravelStrategy() {
return travelStrategy;
}
public void setTravelStrategy(TravelStrategy travelStrategy) {
this.travelStrategy = travelStrategy;
}
public void travelMode(){
this.travelStrategy.travelMode();
}
}
| [
"tengpeng.gao@gmail.com"
] | tengpeng.gao@gmail.com |
25c44805a69d49262b7cc12f77e608b16f16944f | 29b6a856a81a47ebab7bfdba7fe8a7b845123c9e | /dingtalk/java/src/main/java/com/aliyun/dingtalkh3yun_1_0/Client.java | 71f7e1187339efa17ba12ef61573cb72b16d55a2 | [
"Apache-2.0"
] | permissive | aliyun/dingtalk-sdk | f2362b6963c4dbacd82a83eeebc223c21f143beb | 586874df48466d968adf0441b3086a2841892935 | refs/heads/master | 2023-08-31T08:21:14.042410 | 2023-08-30T08:18:22 | 2023-08-30T08:18:22 | 290,671,707 | 22 | 9 | null | 2021-08-12T09:55:44 | 2020-08-27T04:05:39 | PHP | UTF-8 | Java | false | false | 48,121 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.dingtalkh3yun_1_0;
import com.aliyun.tea.*;
import com.aliyun.dingtalkh3yun_1_0.models.*;
public class Client extends com.aliyun.teaopenapi.Client {
public com.aliyun.gateway.spi.Client _client;
public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
super(config);
this._client = new com.aliyun.gateway.dingtalk.Client();
this._spi = _client;
this._endpointRule = "";
if (com.aliyun.teautil.Common.empty(_endpoint)) {
this._endpoint = "api.dingtalk.com";
}
}
public BatchInsertBizObjectResponse batchInsertBizObjectWithOptions(BatchInsertBizObjectRequest request, BatchInsertBizObjectHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.bizObjectJsonArray)) {
body.put("bizObjectJsonArray", request.bizObjectJsonArray);
}
if (!com.aliyun.teautil.Common.isUnset(request.isDraft)) {
body.put("isDraft", request.isDraft);
}
if (!com.aliyun.teautil.Common.isUnset(request.opUserId)) {
body.put("opUserId", request.opUserId);
}
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
body.put("schemaCode", request.schemaCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "BatchInsertBizObject"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/forms/instances/batch"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new BatchInsertBizObjectResponse());
}
public BatchInsertBizObjectResponse batchInsertBizObject(BatchInsertBizObjectRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
BatchInsertBizObjectHeaders headers = new BatchInsertBizObjectHeaders();
return this.batchInsertBizObjectWithOptions(request, headers, runtime);
}
public CancelProcessInstanceResponse cancelProcessInstanceWithOptions(CancelProcessInstanceRequest request, CancelProcessInstanceHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.processInstanceId)) {
body.put("processInstanceId", request.processInstanceId);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "CancelProcessInstance"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/processes/instances/cancel"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new CancelProcessInstanceResponse());
}
public CancelProcessInstanceResponse cancelProcessInstance(CancelProcessInstanceRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
CancelProcessInstanceHeaders headers = new CancelProcessInstanceHeaders();
return this.cancelProcessInstanceWithOptions(request, headers, runtime);
}
public CreateBizObjectResponse createBizObjectWithOptions(CreateBizObjectRequest request, CreateBizObjectHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.bizObjectJson)) {
body.put("bizObjectJson", request.bizObjectJson);
}
if (!com.aliyun.teautil.Common.isUnset(request.isDraft)) {
body.put("isDraft", request.isDraft);
}
if (!com.aliyun.teautil.Common.isUnset(request.opUserId)) {
body.put("opUserId", request.opUserId);
}
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
body.put("schemaCode", request.schemaCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "CreateBizObject"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/forms/instances"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new CreateBizObjectResponse());
}
public CreateBizObjectResponse createBizObject(CreateBizObjectRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
CreateBizObjectHeaders headers = new CreateBizObjectHeaders();
return this.createBizObjectWithOptions(request, headers, runtime);
}
public CreateProcessesInstanceResponse createProcessesInstanceWithOptions(CreateProcessesInstanceRequest request, CreateProcessesInstanceHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.bizObjectId)) {
body.put("bizObjectId", request.bizObjectId);
}
if (!com.aliyun.teautil.Common.isUnset(request.opUserId)) {
body.put("opUserId", request.opUserId);
}
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
body.put("schemaCode", request.schemaCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "CreateProcessesInstance"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/processes/instances"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new CreateProcessesInstanceResponse());
}
public CreateProcessesInstanceResponse createProcessesInstance(CreateProcessesInstanceRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
CreateProcessesInstanceHeaders headers = new CreateProcessesInstanceHeaders();
return this.createProcessesInstanceWithOptions(request, headers, runtime);
}
public DeleteBizObjectResponse deleteBizObjectWithOptions(DeleteBizObjectRequest request, DeleteBizObjectHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.bizObjectId)) {
query.put("bizObjectId", request.bizObjectId);
}
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
query.put("schemaCode", request.schemaCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "DeleteBizObject"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/forms/instances"),
new TeaPair("method", "DELETE"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new DeleteBizObjectResponse());
}
public DeleteBizObjectResponse deleteBizObject(DeleteBizObjectRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
DeleteBizObjectHeaders headers = new DeleteBizObjectHeaders();
return this.deleteBizObjectWithOptions(request, headers, runtime);
}
public DeleteProcessesInstanceResponse deleteProcessesInstanceWithOptions(DeleteProcessesInstanceRequest request, DeleteProcessesInstanceHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.isAutoUpdateBizObject)) {
query.put("isAutoUpdateBizObject", request.isAutoUpdateBizObject);
}
if (!com.aliyun.teautil.Common.isUnset(request.processInstanceId)) {
query.put("processInstanceId", request.processInstanceId);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "DeleteProcessesInstance"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/processes/instances"),
new TeaPair("method", "DELETE"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new DeleteProcessesInstanceResponse());
}
public DeleteProcessesInstanceResponse deleteProcessesInstance(DeleteProcessesInstanceRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
DeleteProcessesInstanceHeaders headers = new DeleteProcessesInstanceHeaders();
return this.deleteProcessesInstanceWithOptions(request, headers, runtime);
}
public GetAppsResponse getAppsWithOptions(GetAppsRequest request, GetAppsHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.queryType)) {
body.put("queryType", request.queryType);
}
if (!com.aliyun.teautil.Common.isUnset(request.values)) {
body.put("values", request.values);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "GetApps"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/apps/search"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new GetAppsResponse());
}
public GetAppsResponse getApps(GetAppsRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
GetAppsHeaders headers = new GetAppsHeaders();
return this.getAppsWithOptions(request, headers, runtime);
}
public GetAttachmentTemporaryUrlResponse getAttachmentTemporaryUrlWithOptions(GetAttachmentTemporaryUrlRequest request, GetAttachmentTemporaryUrlHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.attachmentId)) {
query.put("attachmentId", request.attachmentId);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "GetAttachmentTemporaryUrl"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/attachments/temporaryUrls"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new GetAttachmentTemporaryUrlResponse());
}
public GetAttachmentTemporaryUrlResponse getAttachmentTemporaryUrl(GetAttachmentTemporaryUrlRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
GetAttachmentTemporaryUrlHeaders headers = new GetAttachmentTemporaryUrlHeaders();
return this.getAttachmentTemporaryUrlWithOptions(request, headers, runtime);
}
public GetOrganizationsResponse getOrganizationsWithOptions(GetOrganizationsRequest request, GetOrganizationsHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.departmentId)) {
query.put("departmentId", request.departmentId);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "GetOrganizations"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/departments"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new GetOrganizationsResponse());
}
public GetOrganizationsResponse getOrganizations(GetOrganizationsRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
GetOrganizationsHeaders headers = new GetOrganizationsHeaders();
return this.getOrganizationsWithOptions(request, headers, runtime);
}
public GetRoleUsersResponse getRoleUsersWithOptions(GetRoleUsersRequest request, GetRoleUsersHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.roleId)) {
query.put("roleId", request.roleId);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "GetRoleUsers"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/roles/roleUsers"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new GetRoleUsersResponse());
}
public GetRoleUsersResponse getRoleUsers(GetRoleUsersRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
GetRoleUsersHeaders headers = new GetRoleUsersHeaders();
return this.getRoleUsersWithOptions(request, headers, runtime);
}
public GetRolesResponse getRolesWithOptions(GetRolesHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders)
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "GetRoles"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/roles"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new GetRolesResponse());
}
public GetRolesResponse getRoles() throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
GetRolesHeaders headers = new GetRolesHeaders();
return this.getRolesWithOptions(headers, runtime);
}
public GetUploadUrlResponse getUploadUrlWithOptions(GetUploadUrlRequest request, GetUploadUrlHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.bizObjectId)) {
query.put("bizObjectId", request.bizObjectId);
}
if (!com.aliyun.teautil.Common.isUnset(request.fieldName)) {
query.put("fieldName", request.fieldName);
}
if (!com.aliyun.teautil.Common.isUnset(request.isOverwrite)) {
query.put("isOverwrite", request.isOverwrite);
}
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
query.put("schemaCode", request.schemaCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "GetUploadUrl"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/attachments/uploadUrls"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new GetUploadUrlResponse());
}
public GetUploadUrlResponse getUploadUrl(GetUploadUrlRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
GetUploadUrlHeaders headers = new GetUploadUrlHeaders();
return this.getUploadUrlWithOptions(request, headers, runtime);
}
public GetUsersResponse getUsersWithOptions(GetUsersRequest request, GetUsersHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.departmentId)) {
query.put("departmentId", request.departmentId);
}
if (!com.aliyun.teautil.Common.isUnset(request.isRecursive)) {
query.put("isRecursive", request.isRecursive);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "GetUsers"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/users"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new GetUsersResponse());
}
public GetUsersResponse getUsers(GetUsersRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
GetUsersHeaders headers = new GetUsersHeaders();
return this.getUsersWithOptions(request, headers, runtime);
}
public LoadBizFieldsResponse loadBizFieldsWithOptions(LoadBizFieldsRequest request, LoadBizFieldsHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
query.put("schemaCode", request.schemaCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "LoadBizFields"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/forms/loadBizFields"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new LoadBizFieldsResponse());
}
public LoadBizFieldsResponse loadBizFields(LoadBizFieldsRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
LoadBizFieldsHeaders headers = new LoadBizFieldsHeaders();
return this.loadBizFieldsWithOptions(request, headers, runtime);
}
public LoadBizObjectResponse loadBizObjectWithOptions(LoadBizObjectRequest request, LoadBizObjectHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.bizObjectId)) {
query.put("bizObjectId", request.bizObjectId);
}
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
query.put("schemaCode", request.schemaCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "LoadBizObject"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/forms/instances/loadInstances"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new LoadBizObjectResponse());
}
public LoadBizObjectResponse loadBizObject(LoadBizObjectRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
LoadBizObjectHeaders headers = new LoadBizObjectHeaders();
return this.loadBizObjectWithOptions(request, headers, runtime);
}
public LoadBizObjectsResponse loadBizObjectsWithOptions(LoadBizObjectsRequest request, LoadBizObjectsHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.matcherJson)) {
body.put("matcherJson", request.matcherJson);
}
if (!com.aliyun.teautil.Common.isUnset(request.pageNumber)) {
body.put("pageNumber", request.pageNumber);
}
if (!com.aliyun.teautil.Common.isUnset(request.pageSize)) {
body.put("pageSize", request.pageSize);
}
if (!com.aliyun.teautil.Common.isUnset(request.returnFields)) {
body.put("returnFields", request.returnFields);
}
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
body.put("schemaCode", request.schemaCode);
}
if (!com.aliyun.teautil.Common.isUnset(request.sortByFields)) {
body.put("sortByFields", request.sortByFields);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "LoadBizObjects"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/forms/instances/search"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new LoadBizObjectsResponse());
}
public LoadBizObjectsResponse loadBizObjects(LoadBizObjectsRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
LoadBizObjectsHeaders headers = new LoadBizObjectsHeaders();
return this.loadBizObjectsWithOptions(request, headers, runtime);
}
public QueryAppFunctionNodesResponse queryAppFunctionNodesWithOptions(QueryAppFunctionNodesRequest request, QueryAppFunctionNodesHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.appCode)) {
query.put("appCode", request.appCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "QueryAppFunctionNodes"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/apps/functionNodes"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new QueryAppFunctionNodesResponse());
}
public QueryAppFunctionNodesResponse queryAppFunctionNodes(QueryAppFunctionNodesRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
QueryAppFunctionNodesHeaders headers = new QueryAppFunctionNodesHeaders();
return this.queryAppFunctionNodesWithOptions(request, headers, runtime);
}
public QueryProcessesInstanceResponse queryProcessesInstanceWithOptions(QueryProcessesInstanceRequest request, QueryProcessesInstanceHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.bizObjectId)) {
query.put("bizObjectId", request.bizObjectId);
}
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
query.put("schemaCode", request.schemaCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "QueryProcessesInstance"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/processes/instances"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new QueryProcessesInstanceResponse());
}
public QueryProcessesInstanceResponse queryProcessesInstance(QueryProcessesInstanceRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
QueryProcessesInstanceHeaders headers = new QueryProcessesInstanceHeaders();
return this.queryProcessesInstanceWithOptions(request, headers, runtime);
}
public QueryProcessesWorkItemsResponse queryProcessesWorkItemsWithOptions(QueryProcessesWorkItemsRequest request, QueryProcessesWorkItemsHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.processInstanceId)) {
query.put("processInstanceId", request.processInstanceId);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "QueryProcessesWorkItems"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/processes/workItems"),
new TeaPair("method", "GET"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new QueryProcessesWorkItemsResponse());
}
public QueryProcessesWorkItemsResponse queryProcessesWorkItems(QueryProcessesWorkItemsRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
QueryProcessesWorkItemsHeaders headers = new QueryProcessesWorkItemsHeaders();
return this.queryProcessesWorkItemsWithOptions(request, headers, runtime);
}
public UpdateBizObjectResponse updateBizObjectWithOptions(UpdateBizObjectRequest request, UpdateBizObjectHeaders headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> body = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.bizObjectId)) {
body.put("bizObjectId", request.bizObjectId);
}
if (!com.aliyun.teautil.Common.isUnset(request.bizObjectJson)) {
body.put("bizObjectJson", request.bizObjectJson);
}
if (!com.aliyun.teautil.Common.isUnset(request.schemaCode)) {
body.put("schemaCode", request.schemaCode);
}
java.util.Map<String, String> realHeaders = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(headers.commonHeaders)) {
realHeaders = headers.commonHeaders;
}
if (!com.aliyun.teautil.Common.isUnset(headers.xAcsDingtalkAccessToken)) {
realHeaders.put("x-acs-dingtalk-access-token", com.aliyun.teautil.Common.toJSONString(headers.xAcsDingtalkAccessToken));
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", realHeaders),
new TeaPair("body", com.aliyun.openapiutil.Client.parseToMap(body))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "UpdateBizObject"),
new TeaPair("version", "h3yun_1.0"),
new TeaPair("protocol", "HTTP"),
new TeaPair("pathname", "/v1.0/h3yun/forms/instances"),
new TeaPair("method", "PUT"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "none"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.execute(params, req, runtime), new UpdateBizObjectResponse());
}
public UpdateBizObjectResponse updateBizObject(UpdateBizObjectRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
UpdateBizObjectHeaders headers = new UpdateBizObjectHeaders();
return this.updateBizObjectWithOptions(request, headers, runtime);
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
31c01d77471a9d5bce7780632c0b48f787ddc839 | c741e37d397605107fbd03a1772dcc94b15f2354 | /src/main/java/com/cherniauski/trening/task4/ScoolStationery.java | 7aff4ca1e3a3da83d2eabe3baf777471da50ddf4 | [] | no_license | andredly/tasks | 652b27230c1bf4d61292ce9b945886751ae86b23 | f7e7e235e5d47d4737e54edfa2145552f391a8a8 | refs/heads/master | 2021-01-10T22:48:55.269422 | 2016-10-15T16:34:09 | 2016-10-15T16:34:09 | 70,350,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 144 | java | package com.cherniauski.trening.task4;
/**
* Created by Andre on 10.10.2016.
*/
public abstract class ScoolStationery extends Stationery {
}
| [
"emubem1@gmail.com"
] | emubem1@gmail.com |
644c4a94006eca16567cf9dab773921a6e9b9b7e | 380d1187ac2cebd2a33827790913ff3d8d6be17b | /src/main/java/concurrency/FixedDiningPhilosophers.java | dd5e3c700dedf0604eeee55a18ad0e172c250f5b | [] | no_license | XingxianDeng/ThinkingInJavaSample | eb9340fed48af79c60fdddcc6272c5d2d4d17538 | f3414c706c19020cf348461242956bfdac743c9b | refs/heads/master | 2021-06-22T01:41:04.337907 | 2017-08-30T14:06:43 | 2017-08-30T14:06:43 | 84,512,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,241 | java | package concurrency;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
* @author dylan
* @version 1.00 7/6/16 8:33 AM
*/
public class FixedDiningPhilosophers {
public static void main(String[] args) throws Exception {
int ponder = 5;
if (args.length > 0)
ponder = Integer.parseInt(args[0]);
int size = 5;
if (args.length > 1)
size = Integer.parseInt(args[1]);
ExecutorService exec = Executors.newCachedThreadPool();
Chopstick[] sticks = new Chopstick[size];
for (int i = 0; i < size; i++)
sticks[i] = new Chopstick();
for (int i = 0; i < size; i++)
if (i < (size - 1))
exec.execute(new Philosopher(
sticks[i], sticks[i+1], i, ponder));
else
exec.execute(new Philosopher(
sticks[0], sticks[i], i, ponder));
if (args.length == 3 && args[2].equals("timeout"))
TimeUnit.SECONDS.sleep(5);
else {
System.out.println("Press 'Enter' to quit");
System.in.read();
}
exec.shutdownNow();
}
}
| [
"dxx1104@gmail.com"
] | dxx1104@gmail.com |
7b0e740ed022f8ca142ecbedba596a6c9fa283b3 | c5fb6bbc723c3d54669b4e156fc04982f1f145e4 | /app/src/main/java/hcmute/edu/vn/nhom/project_foody/adapter/ListView_Adapter.java | 768359f69872fefd06a1aa7aac016e753dd4381f | [] | no_license | xuannam99/project_Foody | 13361d5a29c90420cec7bee4666dca5593edbbb9 | 130940c035c3de862b6e687f56331bdaa98fa4b7 | refs/heads/master | 2022-11-05T13:34:25.287994 | 2020-06-25T04:38:44 | 2020-06-25T04:38:44 | 274,829,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,097 | java | package hcmute.edu.vn.nhom.project_foody.adapter;
import android.app.Activity;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import hcmute.edu.vn.nhom.project_foody.myclass.Tinh_Thanh;
import hcmute.edu.vn.nhom.project_foody.R;
public class ListView_Adapter extends BaseAdapter implements Filterable {
List<Tinh_Thanh> listPlace;
List<Tinh_Thanh> listPlace2;
LayoutInflater inflater;
Activity activity;
ViewHolder holder=null;
ItemFilter filter = new ItemFilter();
public ListView_Adapter(Activity activity,List<Tinh_Thanh> listPlace)
{
this.activity =activity;
this.listPlace = listPlace;
this.listPlace2 = listPlace;
inflater = activity.getLayoutInflater();
}
@Override
public int getCount() {
return listPlace.size();
}
@Override
public Object getItem(int position)
{
return listPlace.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.list_place_view, parent, false);
holder = new ViewHolder();
holder.txt_name_place = (TextView) convertView.findViewById(R.id.name_place_id);
holder.img_check_place = (ImageView) convertView.findViewById(R.id.img_check_place);
convertView.setTag(holder);
}
else holder = (ViewHolder)convertView.getTag();
//Bind dữ liệu phần tử vào View
Tinh_Thanh palce = (Tinh_Thanh) getItem(position);
if(palce.getSelectded())
{
holder.txt_name_place.setText(palce.getName_place());
holder.txt_name_place.setTextColor(Color.parseColor("#0564AF"));
holder.img_check_place.setImageResource(R.drawable.tick);
}
else {
holder.txt_name_place.setText(palce.getName_place());
holder.txt_name_place.setTextColor(Color.parseColor("#FF000000"));
holder.img_check_place.setImageResource(0);
}
return convertView;
}
public void updateRecords(List<Tinh_Thanh> listPlace){
this.listPlace = listPlace;
notifyDataSetChanged();
}
@Override
public Filter getFilter() {
return filter;
}
private class ItemFilter extends Filter {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
String filterString = constraint.toString().toLowerCase().trim();
if (!TextUtils.isEmpty(filterString)) {
// We perform filtering operation
final ArrayList<Tinh_Thanh> nlist = new ArrayList<Tinh_Thanh>();
for (Tinh_Thanh item : listPlace2) {
if (item.getName_place().toLowerCase().contains(filterString)) {
nlist.add(item);
}
}
results.values = nlist;
results.count = nlist.size();
}
return results;
}
@SuppressWarnings("unchecked")
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
if (results != null && results.count > 0) {
listPlace = (ArrayList<Tinh_Thanh>) results.values;
// update the filtered data
notifyDataSetChanged();
} else {
notifyDataSetInvalidated();
}
}
}
class ViewHolder{
TextView txt_name_place;
ImageView img_check_place;
}
}
| [
"teo12011999@gmail.com"
] | teo12011999@gmail.com |
f8402b5ffff21ecf30323e227704d593b907bcb4 | 4e386c6708201f0daf9854f173ad66104dcd6549 | /poc/humantask/org.wso2.tools.humantask.model/src/org/wso2/carbonstudio/eclipse/humantask/model/ht/TGrouplist.java | 5c5003af3bac521c089ffd36e11fcf41007f0213 | [] | no_license | whosaner/tools | a386071bf55ec43f091c26c44d34e2c72017c68f | 11aad72b0f098672ade5f6c00b2c5742ffbcb845 | refs/heads/master | 2021-01-17T12:49:47.402884 | 2014-07-24T16:09:16 | 2014-07-24T16:09:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,445 | java | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.wso2.carbonstudio.eclipse.humantask.model.ht;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>TGrouplist</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.wso2.carbonstudio.eclipse.humantask.model.ht.TGrouplist#getGroup <em>Group</em>}</li>
* </ul>
* </p>
*
* @see org.wso2.carbonstudio.eclipse.humantask.model.ht.HTPackage#getTGrouplist()
* @model extendedMetaData="name='tGrouplist' kind='elementOnly'"
* @generated
*/
public interface TGrouplist extends EObject {
/**
* Returns the value of the '<em><b>Group</b></em>' attribute list.
* The list contents are of type {@link java.lang.String}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Group</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Group</em>' attribute list.
* @see org.wso2.carbonstudio.eclipse.humantask.model.ht.HTPackage#getTGrouplist_Group()
* @model unique="false" dataType="org.wso2.carbonstudio.eclipse.humantask.model.ht.TGroup"
* extendedMetaData="kind='element' name='group' namespace='##targetNamespace'"
* @generated
*/
EList<String> getGroup();
} // TGrouplist
| [
"melan@a5903396-d722-0410-b921-86c7d4935375"
] | melan@a5903396-d722-0410-b921-86c7d4935375 |
bd7c3ac73db383f58bb89d3c7f60c94baa981543 | 4901044651fd26c86ad195c6f609230da0353d0c | /bukoliandroidsdk/src/main/java/com/mobillium/bukoliandroidsdk/models/ResponsePoints.java | 423ad9ff9a4e39a60d5a298ac38b559f32f6ca09 | [
"Apache-2.0"
] | permissive | bukoli/bukoli-android | a050aad68e56f2bbab2d71c14c360d00a513c58b | 75e33750795744e13e55ab0cd2a72d18788cff52 | refs/heads/master | 2021-01-11T01:18:08.035201 | 2017-03-20T13:35:38 | 2017-03-20T13:35:38 | 71,035,955 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 892 | java | package com.mobillium.bukoliandroidsdk.models;
import java.util.ArrayList;
/**
* Created by oguzhandongul on 06/05/16.
*/
public class ResponsePoints {
ArrayList<BukoliPoint> data = new ArrayList<>();
Pagination pagination;
String address;
public ResponsePoints(ArrayList<BukoliPoint> data, Pagination pagination) {
this.data = data;
this.pagination = pagination;
}
public ArrayList<BukoliPoint> getData() {
return data;
}
public Pagination getPagination() {
return pagination;
}
public void setData(ArrayList<BukoliPoint> data) {
this.data = data;
}
public void setPagination(Pagination pagination) {
this.pagination = pagination;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
} | [
"oguzhandongul@Oguzhans-MacBook-Pro.local"
] | oguzhandongul@Oguzhans-MacBook-Pro.local |
cf7d1853d72f5b527e3b7c243dd9857dda1581ac | b8ff87ce74e3a136f7eb2728d519131b1dc07a97 | /src/main/java/projekteszk/ProjekteszkApplication.java | 5833e82bc8922a69751742070b4afde9994c26d9 | [] | no_license | palakos/proba | b07b421c0a1003c995ab766b15c60d5f815b3de5 | e857cb54c1791ebf4613c11223691c32060ada0e | refs/heads/master | 2021-10-28T15:19:45.116924 | 2021-10-27T16:30:38 | 2021-10-27T16:30:38 | 179,862,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | package projekteszk;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ProjekteszkApplication {
public static void main(String[] args) {
SpringApplication.run(ProjekteszkApplication.class, args);
}
}
| [
"paldi.akos@gmail.com"
] | paldi.akos@gmail.com |
e1130ef9e06c5edfedb0330cddc69f03a55ce04b | 0000c58c1d0e99c0af47e4bf3721f0cd0c351b83 | /practica1/src/practica1/Eliminar.java | 13e16d709fb46edde5a0118ee456632ee2b9b47a | [] | no_license | mrgold92/acceso-a-datos | b22314155d96cddf04fd7a1c6d9838668e2e3442 | a1ce542bcce70ddb8e66a9cdb69e80cd0b5f5f46 | refs/heads/master | 2020-08-13T20:28:42.533309 | 2019-10-20T01:06:06 | 2019-10-20T01:06:06 | 215,033,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,208 | java | package practica1;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Scanner;
public class Eliminar {
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
File ruta = new File(Comun.getRuta());
File ruta2 = new File(System.getProperty("user.home") + File.separator + "departamentos2.dat");
boolean existe = false;
while (!existe) {
if (Comun.comprobarDepartamento(1)) {
existe = true;
try {
ObjectInputStream entrada = new ObjectInputStream(new FileInputStream(ruta));
Departamento[] dep = (Departamento[]) entrada.readObject();
ArrayList<Departamento> c = new ArrayList<Departamento>();
ObjectOutputStream salida = new ObjectOutputStream(new FileOutputStream(ruta2));
System.out.println("Dime un departamento a eliminar: ");
System.out.print("Disponibles: ");
Comun.departamentosDisponibles();
int departamento = teclado.nextInt();
teclado.close();
for (int i = 0; i < dep.length; i++) {
if (dep[i].getNumeroDepartamento() != departamento) {
c.add(dep[i]);
}
}
Departamento[] nuevo = new Departamento[c.size()];
for (int i = 0; i < c.size(); i++) {
nuevo[i] = c.get(i);
}
salida.writeObject(nuevo);
entrada.close();
salida.close();
ruta.delete();
ObjectInputStream entrada2 = new ObjectInputStream(new FileInputStream(ruta2));
Departamento[] dep3 = (Departamento[]) entrada2.readObject();
entrada.close();
ObjectOutputStream salida2 = new ObjectOutputStream(new FileOutputStream(ruta));
salida2.writeObject(dep3);
salida2.close();
ruta2.delete();
System.out.println("Departamento eliminado.");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
System.out.println("El departamento no existe.");
existe = false;
}
}
}
}
| [
"salazarrodero.david@gmail.com"
] | salazarrodero.david@gmail.com |
d7eb2f6cd42ed2cd355679b0fdda898b67ff03aa | a0721276cb9ac6c0703fbed0cc446922fdc69b88 | /Quickfly/src/GUI/CustomerBookAFlight.java | 3c93422be6f66d1c8399f37eceb82b2e3e29ef7e | [] | no_license | AlexAnATL/Flight_ReservationApp_CIS3270 | e0f4401a34db0de64775ed58b94b9430eed09ae6 | 08fcd4a2c951a68ac81f113d6e524dc80106994f | refs/heads/master | 2022-06-01T22:42:32.491249 | 2020-05-03T17:49:23 | 2020-05-03T17:49:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,477 | java | package GUI;
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import java.sql.SQLException;
import Classes.Flight;
import DataBase.DatabaseMethods;
import DataBase.Methods;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.*;
public class CustomerBookAFlight{
static Stage window = new Stage();
static Scene scene1,scene2;
static TableView<Flight> table;
public static void bookflight() {
window.setTitle("Book a flight");
////Creating table
//flight Id column
TableColumn<Flight, String> flightIdColumn = new TableColumn<>("Flight Id");
flightIdColumn.setMinWidth(200);
flightIdColumn.setCellValueFactory(new PropertyValueFactory<>("flightId"));
////Date column
TableColumn< Flight, String> dateColumn = new TableColumn<>("Date");
dateColumn.setMinWidth(200);
dateColumn.setCellValueFactory(new PropertyValueFactory<>("dateCreated"));
//origin city column
TableColumn< Flight, String> originCityColumn = new TableColumn<>("Departure City");
originCityColumn.setMinWidth(200);
originCityColumn.setCellValueFactory(new PropertyValueFactory<>("cityName"));
//Destinantion city column
TableColumn< Flight, String> destinationCityColumn = new TableColumn<>("Destination City");
destinationCityColumn.setMinWidth(200);
destinationCityColumn.setCellValueFactory(new PropertyValueFactory<>("destinationCity"));
//limit column
TableColumn<Flight, String> timeInColumn = new TableColumn<>("Arrival Time");
timeInColumn.setMinWidth(150);
timeInColumn.setCellValueFactory(new PropertyValueFactory<>("timeIn"));
//paasenger column
TableColumn<Flight, String> timeOutColumn = new TableColumn<>("Departure Time");
timeOutColumn.setMinWidth(150);
timeOutColumn.setCellValueFactory(new PropertyValueFactory<>("timeOut"));
//add Button
Button addButton= new Button("Add");
addButton.setOnAction(e -> {
ObservableList<Flight> flightSelected, allFlights;
allFlights = table.getItems();
flightSelected = table.getSelectionModel().getSelectedItems();
try {
DatabaseMethods.addSelectedFlights(flightSelected);
} catch (Exception e1) {
Methods.popup("Error", "No Field Selected");
e1.printStackTrace();
}
});
//Check your flight
Button checkButton = new Button("Check Your Flight");
checkButton.setOnAction(e ->{
try {
CustomerAddedFlight.customerTickets();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
});
//Main menu button
Button mainmenu = new Button("MainMenu");
mainmenu.setOnAction(e ->{
try {
CustomerAddedFlight.closeCustomerFlights();
MainMenuC.menuScreen();
window.close();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
});
window.setOnCloseRequest(e -> {
try {
CustomerAddedFlight.closeCustomerFlights();
MainMenuC.menuScreen();
} catch (Exception e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
});
//HBox
HBox hbox = new HBox();
hbox.setPadding(new Insets(5,5,5,5));
hbox.setSpacing(1);
hbox.getChildren().addAll(addButton , checkButton,mainmenu );
//table 1
//table 1
table = new TableView<>();
try {
table.setItems(getFlight());
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
table.getColumns().addAll(flightIdColumn,dateColumn, originCityColumn, destinationCityColumn,timeInColumn, timeOutColumn);
//book a flight
VBox layout = new VBox(10);
layout.getChildren().addAll(table, hbox);
scene1 = new Scene(layout);
window.setResizable(false);
window.setScene(scene1);
window.show();
}
//table1
public static ObservableList<Flight> getFlight() throws Exception{
ObservableList<Flight> flight = FXCollections.observableArrayList();
for(int i = 0; i < DatabaseMethods.numberOfFlights(); i++) {
flight.add(new Flight(DatabaseMethods.returnFlightIdFormat(i), DatabaseMethods.returnFlightDateFormat(i), DatabaseMethods.returnFlightCityFormat(i),
DatabaseMethods.returnFlightDestinationFormat(i), DatabaseMethods.returnFlightTimeInFormat(i), DatabaseMethods.returnFlightTimeOutFormat(i)));
}
return flight;
}
} | [
"noreply@github.com"
] | AlexAnATL.noreply@github.com |
fe77b97ae980429342fc158fb7db1f870089762f | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipsejdt_cluster/49464/tar_1.java | 30619107f45d2983ed07ee240e9ce6fe4944a755 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,809 | java | /*******************************************************************************
* Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contributions for
* bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE
* bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null"
* bug 403147 - [compiler][null] FUP of bug 400761: consolidate interaction between unboxing, NPE, and deferred checking
* Bug 417758 - [1.8][null] Null safety compromise during array creation.
* Bug 427163 - [1.8][null] bogus error "Contradictory null specification" on varags
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409247 - [1.8][compiler] Verify error with code allocating multidimensional array
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
import java.util.List;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.impl.*;
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
@SuppressWarnings({"rawtypes"})
public class ArrayAllocationExpression extends Expression {
public TypeReference type;
//dimensions.length gives the number of dimensions, but the
// last ones may be nulled as in new int[4][5][][]
public Expression[] dimensions;
public Annotation [][] annotationsOnDimensions; // jsr308 style annotations.
public ArrayInitializer initializer;
private TypeBinding expectedType;
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
for (int i = 0, max = this.dimensions.length; i < max; i++) {
Expression dim;
if ((dim = this.dimensions[i]) != null) {
flowInfo = dim.analyseCode(currentScope, flowContext, flowInfo);
dim.checkNPEbyUnboxing(currentScope, flowContext, flowInfo);
}
}
// account for potential OutOfMemoryError:
flowContext.recordAbruptExit();
if (this.initializer != null) {
return this.initializer.analyseCode(currentScope, flowContext, flowInfo);
}
return flowInfo;
}
/**
* Code generation for a array allocation expression
*/
public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
int pc = codeStream.position;
if (this.initializer != null) {
this.initializer.generateCode(this.type, this, currentScope, codeStream, valueRequired);
return;
}
int explicitDimCount = 0;
for (int i = 0, max = this.dimensions.length; i < max; i++) {
Expression dimExpression;
if ((dimExpression = this.dimensions[i]) == null) break; // implicit dim, no further explict after this point
dimExpression.generateCode(currentScope, codeStream, true);
explicitDimCount++;
}
// array allocation
if (explicitDimCount == 1) {
// Mono-dimensional array
codeStream.newArray(this.type, this, (ArrayBinding)this.resolvedType);
} else {
// Multi-dimensional array
codeStream.multianewarray(this.type, this.resolvedType, explicitDimCount, this);
}
if (valueRequired) {
codeStream.generateImplicitConversion(this.implicitConversion);
} else {
codeStream.pop();
}
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
public StringBuffer printExpression(int indent, StringBuffer output) {
output.append("new "); //$NON-NLS-1$
this.type.print(0, output);
for (int i = 0; i < this.dimensions.length; i++) {
if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
output.append(' ');
printAnnotations(this.annotationsOnDimensions[i], output);
output.append(' ');
}
if (this.dimensions[i] == null)
output.append("[]"); //$NON-NLS-1$
else {
output.append('[');
this.dimensions[i].printExpression(0, output);
output.append(']');
}
}
if (this.initializer != null) this.initializer.printExpression(0, output);
return output;
}
public TypeBinding resolveType(BlockScope scope) {
// Build an array type reference using the current dimensions
// The parser does not check for the fact that dimension may be null
// only at the -end- like new int [4][][]. The parser allows new int[][4][]
// so this must be checked here......(this comes from a reduction to LL1 grammar)
TypeBinding referenceType = this.type.resolveType(scope, true /* check bounds*/);
// will check for null after dimensions are checked
this.constant = Constant.NotAConstant;
if (referenceType == TypeBinding.VOID) {
scope.problemReporter().cannotAllocateVoidArray(this);
referenceType = null;
}
// check the validity of the dimension syntax (and test for all null dimensions)
int explicitDimIndex = -1;
loop: for (int i = this.dimensions.length; --i >= 0;) {
if (this.dimensions[i] != null) {
if (explicitDimIndex < 0) explicitDimIndex = i;
} else if (explicitDimIndex > 0) {
// should not have an empty dimension before an non-empty one
scope.problemReporter().incorrectLocationForNonEmptyDimension(this, explicitDimIndex);
break loop;
}
}
// explicitDimIndex < 0 says if all dimensions are nulled
// when an initializer is given, no dimension must be specified
if (this.initializer == null) {
if (explicitDimIndex < 0) {
scope.problemReporter().mustDefineDimensionsOrInitializer(this);
}
// allow new List<?>[5] - only check for generic array when no initializer, since also checked inside initializer resolution
if (referenceType != null && !referenceType.isReifiable()) {
scope.problemReporter().illegalGenericArray(referenceType, this);
}
} else if (explicitDimIndex >= 0) {
scope.problemReporter().cannotDefineDimensionsAndInitializer(this);
}
// dimensions resolution
for (int i = 0; i <= explicitDimIndex; i++) {
Expression dimExpression;
if ((dimExpression = this.dimensions[i]) != null) {
TypeBinding dimensionType = dimExpression.resolveTypeExpecting(scope, TypeBinding.INT);
if (dimensionType != null) {
this.dimensions[i].computeConversion(scope, TypeBinding.INT, dimensionType);
}
}
}
// building the array binding
if (referenceType != null) {
if (this.dimensions.length > 255) {
scope.problemReporter().tooManyDimensions(this);
}
if (this.type.annotations != null
&& (referenceType.tagBits & TagBits.AnnotationNullMASK) == TagBits.AnnotationNullMASK)
{
scope.problemReporter().contradictoryNullAnnotations(this.type.annotations[this.type.annotations.length-1]);
}
LookupEnvironment environment = scope.environment();
if (environment.usesNullTypeAnnotations()
&& this.annotationsOnDimensions == null // don't annotate if explicit annotations are given on dimensions ...
&& ((referenceType.tagBits & TagBits.AnnotationNullMASK) == 0) // ... or leaf type
&& this.expectedType != null) // need this to determine our action
{
Expression lastDim = this.dimensions[this.dimensions.length-1];
if (lastDim instanceof IntLiteral && ((IntLiteral) lastDim).value == 0) {
long tagBit = this.expectedType.leafComponentType().tagBits & TagBits.AnnotationNullMASK;
// let new X[0] be seen as "@NonNull X[]", or "@Nullable X[]" just as expected
AnnotationBinding[] nullAnnotations = environment.nullAnnotationsFromTagBits(tagBit);
if (nullAnnotations != null)
referenceType = environment.createAnnotatedType(referenceType, nullAnnotations);
}
}
this.resolvedType = scope.createArrayType(referenceType, this.dimensions.length);
if (this.annotationsOnDimensions != null) {
this.resolvedType = resolveAnnotations(scope, this.annotationsOnDimensions, this.resolvedType);
long[] nullTagBitsPerDimension = ((ArrayBinding)this.resolvedType).nullTagBitsPerDimension;
if (nullTagBitsPerDimension != null) {
for (int i = 0; i < this.annotationsOnDimensions.length; i++) {
if ((nullTagBitsPerDimension[i] & TagBits.AnnotationNullMASK) == TagBits.AnnotationNullMASK) {
scope.problemReporter().contradictoryNullAnnotations(this.annotationsOnDimensions[i]);
nullTagBitsPerDimension[i] = 0;
}
}
}
}
// check the initializer
if (this.initializer != null) {
if ((this.initializer.resolveTypeExpecting(scope, this.resolvedType)) != null)
this.initializer.binding = (ArrayBinding)this.resolvedType;
}
if ((referenceType.tagBits & TagBits.HasMissingType) != 0) {
return null;
}
}
return this.resolvedType;
}
@Override
public void setExpectedType(TypeBinding expectedType) {
this.expectedType = expectedType;
}
public void traverse(ASTVisitor visitor, BlockScope scope) {
if (visitor.visit(this, scope)) {
int dimensionsLength = this.dimensions.length;
this.type.traverse(visitor, scope);
for (int i = 0; i < dimensionsLength; i++) {
Annotation [] annotations = this.annotationsOnDimensions == null ? null : this.annotationsOnDimensions[i];
int annotationsLength = annotations == null ? 0 : annotations.length;
for (int j = 0; j < annotationsLength; j++) {
annotations[j].traverse(visitor, scope);
}
if (this.dimensions[i] != null)
this.dimensions[i].traverse(visitor, scope);
}
if (this.initializer != null)
this.initializer.traverse(visitor, scope);
}
visitor.endVisit(this, scope);
}
public void getAllAnnotationContexts(int targetType, int info, List allTypeAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allTypeAnnotationContexts);
this.type.traverse(collector, (BlockScope) null);
if (this.annotationsOnDimensions != null) {
int dimensionsLength = this.dimensions.length;
for (int i = 0; i < dimensionsLength; i++) {
Annotation [] annotations = this.annotationsOnDimensions[i];
int annotationsLength = annotations == null ? 0 : annotations.length;
for (int j = 0; j < annotationsLength; j++) {
annotations[j].traverse(collector, (BlockScope) null);
}
}
}
}
public Annotation[][] getAnnotationsOnDimensions() {
return this.annotationsOnDimensions;
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
5794dc116d10ab946091de141660b90490f52281 | f08d2515493d909b3cae4f180730f55868fa3576 | /src/test/java/com/asg/automation/testrunner/ida/AmazonSpectrum_PIItag.java | 9f9e3342abf28743607679da756859460815650b | [] | no_license | vijayanand-88/DIQA | 78486b62a3dba0abaa3c8a1df3103dc65b9acca4 | d8848dc87e2aa57d7c2bf19fd957943bbda8dba1 | refs/heads/master | 2023-05-04T23:58:11.348263 | 2021-05-18T01:32:12 | 2021-05-18T01:32:12 | 368,365,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,285 | java | package com.asg.automation.testrunner.ida;
import com.asg.automation.utils.DynamicPropertyLoader;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Parameters;
/**
* Created by gokul on 26/06/2020.
*/
@CucumberOptions(
features = {
"src/test/resources/features/ida/awsplugins/AmazonSpectrum_PIItag_validation.feature"
},
glue = {"com.asg.automation.stepdefinition"},
plugin = {"json:target/cucumber.json", "html:target/cucumber-html-reports"})
public class AmazonSpectrum_PIItag extends AbstractTestNGCucumberTests {
@Parameters({"project", "env_HostName", "ambari_HostName", "browserName", "executionType", "seleniumHub"})
@BeforeSuite
public void init(String project, String env_HostName, String ambari_HostName, String browserName, String executionType, String seleniumHub) {
if (project.equalsIgnoreCase("ida")) {
DynamicPropertyLoader dynamicPropertyLoader = new DynamicPropertyLoader();
dynamicPropertyLoader.DynamicLoader(project, env_HostName, ambari_HostName, browserName, executionType, seleniumHub);
}
}
}
| [
"vijayanand.c@asg.com"
] | vijayanand.c@asg.com |
c292616de42b22fbfc544b4dacc7a82e3299535b | cd99ee71dfb2c6728c7559784618ba8606bec00f | /src/main/java/cz/abdykili/eshop/exception/ItaResponseException.java | 0691cfa128471745f90ec16282def0995a3ae1c9 | [] | no_license | Abdykarov/spring-boot-eshop | 5ff6586ab1b536da16407333b99fa998c3a26899 | da2d945aaa8133dbe920dee023a981e0945fb8c1 | refs/heads/master | 2023-07-29T09:25:19.633459 | 2021-09-11T15:36:22 | 2021-09-11T15:36:22 | 389,195,583 | 0 | 0 | null | 2021-08-01T14:19:23 | 2021-07-24T20:31:23 | Java | UTF-8 | Java | false | false | 347 | java | package cz.abdykili.eshop.exception;
import lombok.Data;
import org.springframework.http.HttpStatus;
import java.time.ZonedDateTime;
@Data
public class ItaResponseException {
private final String message;
private final HttpStatus httpStatus;
private final String throwableException;
private final ZonedDateTime zonedDateTime;
}
| [
"abdykili@abdykili.abdykili.com"
] | abdykili@abdykili.abdykili.com |
65b94081a77761145a99bf5a6dda89ceb5d4b2f6 | 69ed18f94b2c1caf9742d983f5daf28f40614ca2 | /WorkQueue/src/com/pccw/wq/schema/form/WqStatusLogFormDTO.java | 3e25d26ad5efbf5d2839b18b82b7a38ce904c1e6 | [] | no_license | RodexterMalinao/springBoard | d1b4f9d2f7e76f63e2690f414863096e3e271369 | aa4bf03395b12d923d28767e1561049c45ee3261 | refs/heads/master | 2020-09-03T07:21:15.415737 | 2019-12-16T07:12:22 | 2019-12-16T07:12:22 | 219,409,720 | 0 | 1 | null | 2019-12-16T07:12:23 | 2019-11-04T03:28:03 | Java | UTF-8 | Java | false | false | 678 | java | /*
* Created on Nov 3, 2011
*
* @author Alfredo P. Ricafort
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.pccw.wq.schema.form;
import com.pccw.wq.schema.dto.WorkQueueAssgnStatusLogDTO;
public class WqStatusLogFormDTO extends WorkQueueAssgnStatusLogDTO {
/**
*
*/
private static final long serialVersionUID = 1768230647275700686L;
private String latestStatusInd;
public String getLatestStatusInd() {
return latestStatusInd;
}
public void setLatestStatusInd(String latestStatusInd) {
this.latestStatusInd = latestStatusInd;
}
}
| [
"acer_08_06@yahoo.com"
] | acer_08_06@yahoo.com |
54e62ce5caed11b0fc46493fedc0362c4c2df3b9 | c57b383cb55bbb55a5526600034d8fa57b62f629 | /java_rpg_game/Enemies/Skeleton.java | be78eb0ef1d1619d0d9e41cc10a013dd3b262086 | [] | no_license | SeanGeraets/FirstAndroidApp---Text-RPG-Game | 6eb797e04200c134a721750a3e0a83ea0133560a | 862102bd7a1f56bbc3a9965237157be19ecd4441 | refs/heads/master | 2020-12-05T18:19:20.563657 | 2020-01-29T19:10:40 | 2020-01-29T19:10:40 | 232,204,623 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,945 | java | package com.example.java_rpg_game.Enemies;
import java.io.Serializable;
public class Skeleton implements Serializable {
/**
* Integer to hold the skeletons current health
*/
private int skeletonCurrentHealth;
/**
* Integer to hold the skeletons maximum health
*/
private int skeletonMaxHealth;
/**
* Integer to hold the skeletons current mp
*/
private int skeletonCurrentMp;
/**
* Integer to hold the skeletons maximum mp
*/
private int skeletonMaxMp;
/**
* Integer to hold the skeletons attack
*/
private int skeletonAttack;
/**
* Integer to hold the skeletons defense
*/
private int skeletonDefense;
/**
* Integer to hold the skeletons experience given to the player upon death
*/
private int skeletonExperience;
/**
* Integer to hold the skeletons gold dropped upon death
*/
private int skeletonGoldDropped;
/**
* String to hold the skeletons name
*/
private String skeletonName;
/**
* Basic constructor
*/
public Skeleton(){
setSkeletonCurrentHealth(7);
setSkeletonMaxHealth(7);
setSkeletonCurrentMp(0);
setSkeletonMaxMp(0);
setSkeletonAttack(1);
setSkeletonDefense(0);
setSkeletonExperience(10);
setSkeletonGoldDropped(5);
setSkeletonName("Skeleton");
}
/**
* Gets the skeletons current health
* @return
*/
public int getSkeletonCurrentHealth() {
return skeletonCurrentHealth;
}
/**
* Sets the skeletons current health to a new value
* @param skeletonCurrentHealth
*/
public void setSkeletonCurrentHealth(int skeletonCurrentHealth) {
this.skeletonCurrentHealth = skeletonCurrentHealth;
}
/**
* Gets the skeletons current mp
* @return
*/
public int getSkeletonCurrentMp() {
return skeletonCurrentMp;
}
/**
* Sets the skeletons current mp to a new value
* @param skeletonCurrentMp
*/
public void setSkeletonCurrentMp(int skeletonCurrentMp) {
this.skeletonCurrentMp = skeletonCurrentMp;
}
/**
* Gets the skeletons maximum mp
* @return
*/
public int getSkeletonMaxMp() {
return skeletonMaxMp;
}
/**
* Sets the skeletons maximum mp to a new value
* @param skeletonMaxMp
*/
public void setSkeletonMaxMp(int skeletonMaxMp) {
this.skeletonMaxMp = skeletonMaxMp;
}
/**
* Gets the skeletons maximum health
* @return
*/
public int getSkeletonMaxHealth() {
return skeletonMaxHealth;
}
/**
* Sets the skeletons maximum health to a new value
* @param skeletonMaxHealth
*/
public void setSkeletonMaxHealth(int skeletonMaxHealth) {
this.skeletonMaxHealth = skeletonMaxHealth;
}
/**
* Gets the skeletons attack
* @return
*/
public int getSkeletonAttack() {
return skeletonAttack;
}
/**
* Sets the skeletons attack to a new value
* @param skeletonAttack
*/
public void setSkeletonAttack(int skeletonAttack) {
this.skeletonAttack = skeletonAttack;
}
/**
* Gets the skeletons defense
* @return
*/
public int getSkeletonDefense() {
return skeletonDefense;
}
/**
* Sets the skeletons defense to a new value
* @param skeletonDefense
*/
public void setSkeletonDefense(int skeletonDefense) {
this.skeletonDefense = skeletonDefense;
}
/**
* Gets the skeletons experience
* @return
*/
public int getSkeletonExperience() {
return skeletonExperience;
}
/**
* Sets the skeletons experience to a new value
* @param skeletonExperience
*/
public void setSkeletonExperience(int skeletonExperience) {
this.skeletonExperience = skeletonExperience;
}
/**
* Gets the skeletons gold value
* @return
*/
public int getSkeletonGoldDropped() {
return skeletonGoldDropped;
}
/**
* Sets the skeletons gold to a new value
* @param skeletonGoldDropped
*/
public void setSkeletonGoldDropped(int skeletonGoldDropped) {
this.skeletonGoldDropped = skeletonGoldDropped;
}
/**
* String to hold the skeleton name
*/ /**
* Gets the skeletons name
* @return
*/
public String getSkeletonName(){
return skeletonName;
}
/**
* Sets the skeletons name to a new value
* @param skeletonName
*/
public void setSkeletonName(String skeletonName) {
this.skeletonName = skeletonName;
}
}
| [
"noreply@github.com"
] | SeanGeraets.noreply@github.com |
e49636878d006d24344680e18c676a83020f5966 | 1a6bf8bbe8c6195bbaad5456c33c8e96ad5ad821 | /game/api/wrappers/map/LocalPath.java | 12468ffc223ad482d5b1c51b47d06ea47d11c21b | [] | no_license | Jangan-CB/testingsdasd | c9dc84d3df8565fa0bf10e934122c8668f592de1 | 7f32800ca2560dfbbb12b0d2c656cabefaf9f03c | refs/heads/master | 2020-06-06T18:29:03.541508 | 2015-04-22T14:16:35 | 2015-04-22T14:16:35 | 34,393,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,316 | java | package org.powerbot.game.api.wrappers.map;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.powerbot.game.api.methods.Calculations;
import org.powerbot.game.api.methods.Game;
import org.powerbot.game.api.methods.Walking;
import org.powerbot.game.api.methods.interactive.Players;
import org.powerbot.game.api.wrappers.Tile;
import static org.powerbot.game.api.wrappers.Tile.Flag.BLOCKED;
import static org.powerbot.game.api.wrappers.Tile.Flag.WALL_EAST;
import static org.powerbot.game.api.wrappers.Tile.Flag.WALL_NORTH;
import static org.powerbot.game.api.wrappers.Tile.Flag.WALL_NORTHEAST;
import static org.powerbot.game.api.wrappers.Tile.Flag.WALL_NORTHWEST;
import static org.powerbot.game.api.wrappers.Tile.Flag.WALL_SOUTH;
import static org.powerbot.game.api.wrappers.Tile.Flag.WALL_SOUTHEAST;
import static org.powerbot.game.api.wrappers.Tile.Flag.WALL_SOUTHWEST;
import static org.powerbot.game.api.wrappers.Tile.Flag.WALL_WEST;
public class LocalPath extends Path {
private final Tile end;
private Tile base;
private int[][] flags;
private int offX, offY;
private TilePath tilePath;
public LocalPath(final Tile end) {
this.end = end;
}
@Override
public boolean traverse(final EnumSet<TraversalOption> options) {
return getNext() != null && tilePath.traverse(options);
}
@Override
public boolean validate() {
return getNext() != null && Calculations.distanceTo(getEnd()) > Math.sqrt(2);
}
/**
* {@inheritDoc}
*/
@Override
public boolean init() {
if (!Game.getMapBase().equals(base)) {
final int[][] flags = adjustCollisionFlags(Walking.getCollisionFlags(Game.getPlane()));
if (flags != null) {
base = Game.getMapBase();
final Tile start = Players.getLocal().getLocation();
final Tile[] tiles = findPath(start, end);
if (tiles == null) {
base = null;
return false;
}
tilePath = new TilePath(tiles);
}
}
return true;
}
@Override
public Tile getNext() {
if (!init()) {
return null;
}
return tilePath.getNext();
}
@Override
public Tile getStart() {
return null;
}
@Override
public Tile getEnd() {
return end;
}
public TilePath getTilePath() {
return tilePath;
}
private Tile[] findPath(final Tile start, final Tile end) {
if (start.getPlane() != end.getPlane()) {
return null;
}
final int curr_plane = start.getPlane();
final int base_x = base.getX(), base_y = base.getY();
final int curr_x = start.getX() - base_x, curr_y = start.getY() - base_y;
int dest_x = end.getX() - base_x, dest_y = end.getY() - base_y;
final int plane = Game.getPlane();
if (curr_plane != plane) {
return null;
}
flags = Walking.getCollisionFlags(plane);
final Tile offset = Walking.getCollisionOffset(plane);
offX = offset.getX();
offY = offset.getY();
if (flags == null || curr_x < 0 || curr_y < 0 || curr_x >= flags.length || curr_y >= flags.length) {
return null;
} else if (dest_x < 0 || dest_y < 0 || dest_x >= flags.length || dest_y >= flags.length) {
if (dest_x < 0) {
dest_x = 0;
} else if (dest_x >= flags.length) {
dest_x = flags.length - 1;
}
if (dest_y < 0) {
dest_y = 0;
} else if (dest_y >= flags.length) {
dest_y = flags.length - 1;
}
}
final HashSet<Vertex> open = new HashSet<Vertex>();
final HashSet<Vertex> closed = new HashSet<Vertex>();
Vertex curr = new Vertex(curr_x, curr_y, curr_plane);
final Vertex dest = new Vertex(dest_x, dest_y, curr_plane);
curr.f = heuristic(curr, dest);
open.add(curr);
while (!open.isEmpty()) {
curr = lowest_f(open);
if (curr.equals(dest)) {
return path(curr, base_x, base_y);
}
open.remove(curr);
closed.add(curr);
for (final Vertex next : successors(curr)) {
if (!closed.contains(next)) {
final double t = curr.g + dist(curr, next);
boolean use_t = false;
if (!open.contains(next)) {
open.add(next);
use_t = true;
} else if (t < next.g) {
use_t = true;
}
if (use_t) {
next.prev = curr;
next.g = t;
next.f = t + heuristic(next, dest);
}
}
}
}
return null;
}
public static double heuristic(final Vertex start, final Vertex end) {
final double dx = Math.abs(start.x - end.x);
final double dy = Math.abs(start.y - end.y);
final double diag = Math.min(dx, dy);
final double straight = dx + dy;
return Math.sqrt(2.0) * diag + straight - 2 * diag;
}
public static double dist(final Vertex start, final Vertex end) {
if (start.x != end.x && start.y != end.y) {
return 1.41421356;
} else {
return 1.0;
}
}
public static Vertex lowest_f(final Set<Vertex> open) {
Vertex best = null;
for (final Vertex t : open) {
if (best == null || t.f < best.f) {
best = t;
}
}
return best;
}
private List<Vertex> successors(final Vertex t) {
final LinkedList<Vertex> tiles = new LinkedList<Vertex>();
final int x = t.x, y = t.y, z = t.z;
final int f_x = x - offX, f_y = y - offY;
final int here = flags[f_x][f_y];
final int upper = flags.length - 1;
if (f_y > 0 && (here & WALL_SOUTH) == 0 && (flags[f_x][f_y - 1] & BLOCKED) == 0) {
tiles.add(new Vertex(x, y - 1, z));
}
if (f_x > 0 && (here & WALL_WEST) == 0 && (flags[f_x - 1][f_y] & BLOCKED) == 0) {
tiles.add(new Vertex(x - 1, y, z));
}
if (f_y < upper && (here & WALL_NORTH) == 0 && (flags[f_x][f_y + 1] & BLOCKED) == 0) {
tiles.add(new Vertex(x, y + 1, z));
}
if (f_x < upper && (here & WALL_EAST) == 0 && (flags[f_x + 1][f_y] & BLOCKED) == 0) {
tiles.add(new Vertex(x + 1, y, z));
}
if (f_x > 0 && f_y > 0 && (here & (WALL_SOUTHWEST | WALL_SOUTH | WALL_WEST)) == 0
&& (flags[f_x - 1][f_y - 1] & BLOCKED) == 0
&& (flags[f_x][f_y - 1] & (BLOCKED | WALL_WEST)) == 0
&& (flags[f_x - 1][f_y] & (BLOCKED | WALL_SOUTH)) == 0) {
tiles.add(new Vertex(x - 1, y - 1, z));
}
if (f_x > 0 && f_y < upper && (here & (WALL_NORTHWEST | WALL_NORTH | WALL_WEST)) == 0
&& (flags[f_x - 1][f_y + 1] & BLOCKED) == 0
&& (flags[f_x][f_y + 1] & (BLOCKED | WALL_WEST)) == 0
&& (flags[f_x - 1][f_y] & (BLOCKED | WALL_NORTH)) == 0) {
tiles.add(new Vertex(x - 1, y + 1, z));
}
if (f_x < upper && f_y > 0 && (here & (WALL_SOUTHEAST | WALL_SOUTH | WALL_EAST)) == 0
&& (flags[f_x + 1][f_y - 1] & BLOCKED) == 0
&& (flags[f_x][f_y - 1] & (BLOCKED | WALL_EAST)) == 0
&& (flags[f_x + 1][f_y] & (BLOCKED | WALL_SOUTH)) == 0) {
tiles.add(new Vertex(x + 1, y - 1, z));
}
if (f_x > 0 && f_y < upper && (here & (WALL_NORTHEAST | WALL_NORTH | WALL_EAST)) == 0
&& (flags[f_x + 1][f_y + 1] & BLOCKED) == 0
&& (flags[f_x][f_y + 1] & (BLOCKED | WALL_EAST)) == 0
&& (flags[f_x + 1][f_y] & (BLOCKED | WALL_NORTH)) == 0) {
tiles.add(new Vertex(x + 1, y + 1, z));
}
return tiles;
}
public static Tile[] path(final Vertex end, final int base_x, final int base_y) {
final LinkedList<Tile> path = new LinkedList<Tile>();
Vertex p = end;
while (p != null) {
path.addFirst(p.get(base_x, base_y));
p = p.prev;
}
return path.toArray(new Tile[path.size()]);
}
public static final class Vertex {
public final int x, y, z;
public Vertex prev;
public double g, f;
public boolean special;
public Vertex(final int x, final int y, final int z) {
this(x, y, z, false);
}
public Vertex(final int x, final int y, final int z, final boolean special) {
this.x = x;
this.y = y;
this.z = z;
this.special = special;
g = f = 0;
}
@Override
public int hashCode() {
return x << 4 | y;
}
@Override
public boolean equals(final Object o) {
if (o instanceof Vertex) {
final Vertex n = (Vertex) o;
return x == n.x && y == n.y && z == n.z;
}
return false;
}
@Override
public String toString() {
return "(" + x + "," + y + ")";
}
public Tile get(final int baseX, final int baseY) {
return new Tile(x + baseX, y + baseY, z);
}
}
private int[][] adjustCollisionFlags(final int[][] flags) {
final int lx = flags.length - 1;
for (int x = 0; x <= lx; x++) {
final int ly = flags[x].length - 1;
for (int y = 0; y <= ly; y++) {
if (x == 0 || y == 0 || x == lx || y == ly) {
flags[x][y] = -1;
}
}
}
return flags;
}
}
| [
"khalil@shaw.ca"
] | khalil@shaw.ca |
9400c1bb3758fddc23bec73c59c2ae8c4661b614 | 3e7ec44148203c7cf7923119e43156c15ccd2717 | /skillpier-android/.svn/pristine/71/719b3d34f172c52526da3ca9bdf1967467537169.svn-base | ff1fe90a32da4bf2482db7dbe1f5433f99c38333 | [] | no_license | tingken/laugh_file | 188d3d148f77bf2fd895aa95dbaa8a8240a6a939 | 92a5e2dce13fe8ac9c5e88d1b95dc7dba2cbaa70 | refs/heads/master | 2021-01-20T04:21:19.083956 | 2017-10-21T03:33:15 | 2017-10-21T03:33:15 | 89,673,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,334 | /*
package com.quark.skillopedia.ui.widget;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface.OnCancelListener;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Message;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.DatePicker;
import android.widget.LinearLayout;
import android.widget.TextView;
import AppParam;
import com.quark.skillopedia.R;
import java.util.ArrayList;
@SuppressLint("NewApi")
public class ActionSheet {
static String sexstr;
static String xueliStr;
static LinearLayout layout;
static Context context;
static String user_id;
public interface OnActionSheetSelected {
void onClick(int whichButton);
}
private ActionSheet() {
}
static ArrayList<TextView> d = new ArrayList<TextView>();;
//=======sex start======
//性别
public static Dialog showSheetSex(final Context context, final OnActionSheetSelected actionSheetSelected,
OnCancelListener cancelListener,final TextView view,final Handler handler) {
SharedPreferences sp = context.getSharedPreferences(AppParam.SHAREDPREFERENCESKEY, context.MODE_PRIVATE);
user_id = sp.getString("user_id", "");
final Dialog dlg = new Dialog(context, R.style.ActionSheet);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.actionsheetsex, null);
final int cFullFillWidth = 10000;
layout.setMinimumWidth(cFullFillWidth);
final TextView sex_man = (TextView)layout.findViewById(R.id.sex_man);
final TextView sex_lady = (TextView)layout.findViewById(R.id.sex_lady);
final TextView cancel = (TextView)layout.findViewById(R.id.cancel);
sex_man.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String sexStr = sex_man.getText().toString();
view.setText(sexStr);
// submintSext("男");
Message msg = new Message();
msg.obj = "男";
msg.what=1;
handler.sendMessage(msg);
dlg.dismiss();
}
});
sex_lady.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String sexStr = sex_lady.getText().toString();
view.setText(sexStr);
// submintSext("女");
Message msg = new Message();
msg.obj = "女";
msg.what=1;
handler.sendMessage(msg);
dlg.dismiss();
}
});
cancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dlg.dismiss();
}
});
Window w = dlg.getWindow();
WindowManager.LayoutParams lp = w.getAttributes();
lp.x = 0;
final int cMakeBottom = -1000;
lp.y = cMakeBottom;
lp.gravity = Gravity.BOTTOM;
dlg.onWindowAttributesChanged(lp);
dlg.setCanceledOnTouchOutside(true);
if (cancelListener != null)
dlg.setOnCancelListener(cancelListener);
dlg.setContentView(layout);
dlg.show();
return dlg;
}
//===========sex end==========
*/
/**
* 获取系统SDK版本
* @return
*//*
public static int getSDKVersionNumber() {
int sdkVersion;
try {
sdkVersion = Integer.valueOf(android.os.Build.VERSION.SDK);
} catch (NumberFormatException e) {
sdkVersion = 0;
}
return sdkVersion;
}
*/
/**
* 从当前Dialog中查找DatePicker子控件
*
* @param group
* @return
*//*
private DatePicker findDatePicker(ViewGroup group) {
if (group != null) {
for (int i = 0, j = group.getChildCount(); i < j; i++) {
View child = group.getChildAt(i);
if (child instanceof DatePicker) {
return (DatePicker) child;
} else if (child instanceof ViewGroup) {
DatePicker result = findDatePicker((ViewGroup) child);
if (result != null)
return result;
}
}
}
return null;
}
}
*/
| [
"36757049@qq.com"
] | 36757049@qq.com | |
87f4ab2e1e3286be62585351e9b4e6dff4fc826b | 30071eeffe55c8b0ccc4855544b341aebf1234d4 | /src/by/babashev/tictactoe/controller/GameVariables.java | bcaf4319b1d1c278debae6121717727520648d11 | [] | no_license | Stimul-Al/TicTacToe | 225dd526c216fafab42c50425da5f3b0fa043b3e | dd2168277897dc8b5ec0e27823701bd46dc8bda6 | refs/heads/main | 2023-03-31T11:09:37.039215 | 2021-04-05T07:53:32 | 2021-04-05T07:53:32 | 354,753,768 | 0 | 0 | null | 2021-04-05T07:48:20 | 2021-04-05T07:26:42 | Java | UTF-8 | Java | false | false | 308 | java | package by.babashev.tictactoe.controller;
public enum GameVariables {
Y("y"),
N("n"),
B("b"),
P("p");
private final String variables;
GameVariables(String variables) {
this.variables = variables;
}
public String getVariables() {
return variables;
}
}
| [
"Fktrctqf,fitd"
] | Fktrctqf,fitd |
f73897f52f0b6f013cf17826f18c7e883545cdf9 | bb022e4a515b8f94969d71c6eb1eaecde542631f | /src/main/java/com/xiu/utopia/dto/DescField.java | 3eb31517a460ea99ee709e0023dd71b079235f3e | [] | no_license | liushangzaibeijing/utopia | d485b2a80ea3967e6a137f1d6226debe9ff4cefe | c69e8b89f8e9afece113ed444f741cbcdf9cacfd | refs/heads/master | 2022-07-03T09:56:50.354615 | 2019-12-15T03:06:33 | 2019-12-15T03:06:33 | 160,199,596 | 2 | 0 | null | 2022-06-17T02:11:37 | 2018-12-03T13:59:17 | Java | UTF-8 | Java | false | false | 1,301 | java | package com.xiu.utopia.dto;
/**
* 自定义的数据类型 来描述针对不同字段的是否分词,是否检索,是否存储等操作
*/
public class DescField {
/**
* 字段名称
*/
private String fieldName;
/**
* 是否存储
*/
private Boolean store;
/**
* 是否分词
*/
private Boolean analyzer;
public DescField(String fieldName, Boolean store, Boolean analyzer) {
this.fieldName = fieldName;
this.store = store;
this.analyzer = analyzer;
}
public DescField(String fieldName, Boolean store) {
this.fieldName = fieldName;
this.store = store;
this.store = true;
}
public DescField(String fieldName) {
this.fieldName = fieldName;
this.store = true;
this.analyzer = true;
}
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public Boolean getStore() {
return store;
}
public void setStore(Boolean store) {
this.store = store;
}
public Boolean getAnalyzer() {
return analyzer;
}
public void setAnalyzer(Boolean analyzer) {
this.analyzer = analyzer;
}
}
| [
"15901544506@163.com"
] | 15901544506@163.com |
0d427131d73d4955d99338c2a564e2c414082de6 | ada925ffcae6c0d8a6b743458923d3b357807687 | /dark_horse__spring/src/main/java/com/kosa/vo/HorseChartVO.java | cb22a599716ff39e6abfc01b9497f3cc6dfbd457 | [] | no_license | kjh950711/Web-Project | ae134382f721f18f7b27ac546ae41adcd4437b4b | 3181429836b87a255b5c038f706296024ccc39a5 | refs/heads/main | 2023-02-05T03:53:00.411460 | 2020-12-31T12:49:40 | 2020-12-31T12:49:40 | 325,561,290 | 0 | 0 | null | 2020-12-30T15:28:03 | 2020-12-30T13:44:24 | CSS | UTF-8 | Java | false | false | 500 | java | package com.kosa.vo;
public class HorseChartVO {
private int gameMonth;
private int avgRankMon;
public int getGameMonth() {
return gameMonth;
}
public void setGameMonth(int gameMonth) {
this.gameMonth = gameMonth;
}
public int getAvgRankMon() {
return avgRankMon;
}
public void setAvgRankMon(int avgRankMon) {
this.avgRankMon = avgRankMon;
}
@Override
public String toString() {
return "HorseChartVO [gameMonth=" + gameMonth + ", avgRankMon=" + avgRankMon + "]";
}
}
| [
"57468087+kjh950711@users.noreply.github.com"
] | 57468087+kjh950711@users.noreply.github.com |
f56bf42adaa7ef84a5f33ca847ae82c3d2fda7f7 | 98fa3b331fb7ef8c8e163bc2ee5b98704f77a6cf | /app/src/main/java/com/gexton/hospitalfinderapp/models/HospitalBean.java | 0f23df4e0e9f865f94beff9d5810579d2bb419d0 | [] | no_license | Asadrao125/HospitalFinderApp | 6e648e85a90a52fe3f65e619c1a6788cbfd319e7 | e24d7ecf9843fef9435a07ddfada1724e264738f | refs/heads/master | 2023-06-08T19:41:02.935067 | 2021-06-30T15:43:57 | 2021-06-30T15:43:57 | 329,903,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 822 | java | package com.gexton.hospitalfinderapp.models;
public class HospitalBean {
public String hospitalName;
public String imageHospital;
public Double lat, lng;
public String address;
public HospitalBean(String hospitalName, String imageHospital, Double lat, Double lng, String address) {
this.hospitalName = hospitalName;
this.imageHospital = imageHospital;
this.lat = lat;
this.lng = lng;
this.address = address;
}
@Override
public String toString() {
return "HospitalBean{" +
"hospitalName='" + hospitalName + '\'' +
", imageHospital='" + imageHospital + '\'' +
", lat=" + lat +
", lng=" + lng +
", address='" + address + '\'' +
'}';
}
}
| [
"raoasad125@gmail.com"
] | raoasad125@gmail.com |
7a16f28e6715f0df20520ac007695e9fb119bab2 | 2746c60061db69c34d6959b0c215634b53122782 | /SpringBoot-full-config-starter-project-master1/src/main/java/com/roma/service/impl/EmailServiceImpl.java | 84f8ea0ff0ead3d4d1099eae30069d62aa56adbe | [] | no_license | ppzromko/BooksShopProject | fce13fcd43261658f9870c7bfcdb895fc8a72a11 | 9a17da3e5cc75dc50e3e1e524bcafffb2ad0a7eb | refs/heads/master | 2021-04-18T20:14:52.971096 | 2018-03-27T17:19:22 | 2018-03-27T17:19:22 | 126,511,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package com.roma.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;
import com.roma.domain.mail.Mail;
import com.roma.service.EmailService;
@Service
public class EmailServiceImpl implements EmailService {
@Autowired private JavaMailSender mailSender;
@Override
public void sendMessage(Mail mail) {
SimpleMailMessage message = new SimpleMailMessage();
message.setFrom(mail.getFrom());
message.setTo(mail.getTo());
message.setSubject(mail.getSubject());
message.setText(mail.getContent());
mailSender.send(message);
}
}
| [
"ppzromko@gmail.com"
] | ppzromko@gmail.com |
7581fa5bf28c60ff4f6066b8ece7df52fb3452e6 | 4a052eac5627e742d032d57fb0dc1e8fb9c8658e | /app/src/main/java/com/heroku/paulo101977/restfull/AbstractWebClient.java | 93d40fa341b58cca3beea6cd944252937716103f | [] | no_license | paulo101977/MultimidiaCoursera | 5fc19522bcdcfeede496295daba2486fefd5ddbe | d89a42f46c315e308691b904f1782542b1aef28c | refs/heads/master | 2021-01-12T12:07:48.222519 | 2016-11-01T17:32:19 | 2016-11-01T17:32:19 | 72,313,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.heroku.paulo101977.restfull;
/**
* Created by paulo on 01/11/2016.
*/
public abstract class AbstractWebClient {
//TODO abstracts to contract web RESTful
public abstract void getMethod();
public abstract void doMethod();
public abstract void updateMethod();
public abstract void removeMethod();
}
| [
"paulo10.1977@yahoo.com.br"
] | paulo10.1977@yahoo.com.br |
3a94cdbc3296873de21105cd93c89bcfd3fa25b0 | a4be94ead25f6f5514afa8562566eb9c12fabf9c | /listen-parent/listen-web/src/main/java/com/listen/controller/LibraryPoolController.java | 40c09e951912f06d0077c70c42a2223473ad7409 | [] | no_license | Exleryz/listen | 9c3c00e3cc91878ab79de2161746ca351ea5cd4c | b23aeb7e3ee4854494e0c3eb174f8e34b9bdd6f7 | refs/heads/master | 2022-12-23T03:58:48.060294 | 2019-11-09T10:08:09 | 2019-11-09T10:08:09 | 132,099,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,516 | java | package com.listen.controller;
import com.listen.common.utils.ListenResult;
import com.listen.pojo.Library;
import com.listen.pojo.LibraryPool;
import com.listen.pojo.SysLibraryLibraryPool;
import com.listen.pojo.User;
import com.listen.service.LibraryPoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
/**
* @author Exler
*/
@Controller
@RequestMapping("/libraryPool")
public class LibraryPoolController {
@Autowired
private LibraryPoolService libraryPoolService;
/**
* ajax 加载听力试卷
*
* @return
* @throws Exception
*/
@RequestMapping("/initSubject")
@ResponseBody
public ListenResult initSubject(Integer checkPoint, HttpServletRequest request) {
User user = (User) request.getAttribute("user");
if (null == user.getGrade() || null == checkPoint) {
return ListenResult.error("试卷加载异常");
}
ListenResult result = libraryPoolService.getCurrentGradeSubjects(user.getGrade(), user.getId(), checkPoint);
return result;
}
/**
* 查看当前关卡设置
*
* @return
* @throws Exception
*/
@RequestMapping("/getSetting")
@ResponseBody
public ListenResult getCurrentScoreSet(LibraryPool libraryPool) {
if (null == libraryPool.getGrade() || null == libraryPool.getCheckPoint()) {
return ListenResult.error("查询参数错误");
}
return libraryPoolService.selectPoolByGradeAndCheckPoint(libraryPool);
}
/**
* 查找题库池中所有题目
*
* @param lpId
* @param pageNum
* @param pageSize
* @return
*/
@RequestMapping("/queryList")
@ResponseBody
public ListenResult queryList(Integer lpId, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) {
if (null == lpId) {
return ListenResult.error("获取题目列表错误");
}
return libraryPoolService.queryLibraryListByPool(lpId, pageNum, pageSize);
}
/**
* 查询题库池中符合条件的题目
*
* @param library
* @param lpId
* @param pageNum
* @param pageSize
* @return
*/
@RequestMapping("/queryLibraries")
@ResponseBody
public ListenResult queryLibraries(Library library, Integer lpId,
@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) {
return libraryPoolService.queryLibraryListByLibrary(library, lpId, pageNum, pageSize);
}
/**
* 设置当前选中关卡
*
* @return
* @throws Exception
*/
@RequestMapping("/admin/updateLibraryPool")
@ResponseBody
public ListenResult updateLibraryPool(LibraryPool libraryPool) throws Exception {
if (null == libraryPool.getId()) {
return ListenResult.error("参数错误");
}
return libraryPoolService.updateLibraryPool(libraryPool);
}
/**
* 管理员给关卡添加题目
*
* @return
* @throws Exception
*/
@RequestMapping("/admin/addLibrary")
@ResponseBody
public ListenResult addLibrary(SysLibraryLibraryPool sysLibraryLibraryPool, @RequestParam(value = "libIds", defaultValue = "0") Integer[] libIds) {
if (null == libIds || libIds.length == 0 || null == sysLibraryLibraryPool.getLpId()) {
return ListenResult.error("参数错误, 无法添加");
}
return libraryPoolService.insertLibraryToLibraryPool(sysLibraryLibraryPool, libIds);
}
/**
* 管理员删除关卡中的题目
*
* @return
* @throws Exception
*/
@RequestMapping("/admin/deleteLibrary")
@ResponseBody
public ListenResult deleteLibraryInPool(SysLibraryLibraryPool sysLibraryLibraryPool, @RequestParam(value = "libIds", defaultValue = "0") Integer[] libIds) {
if (null == sysLibraryLibraryPool.getLpId() || null == libIds || libIds.length == 0) {
return ListenResult.error("参数错误,无法删除");
}
return libraryPoolService.deleteLibraryInPool(sysLibraryLibraryPool, libIds);
}
}
| [
"zyezhou@163.com"
] | zyezhou@163.com |
5501c4986ea2864727d5714b6b5562734a816beb | 267023152dcc918e61355d45b18426b087361a43 | /src/java/jogamp/common/os/android/StaticContext.java | 5585407da8b3fd28878e78f1fe181affc8a8a74a | [
"BSD-4-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause-No-Nuclear-Warranty",
"BSD-3-Clause",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | sgothel/gluegen | 0a843235ca39531b4105441f4fd628c8777ffa7d | 8850b3d7f82ca5f1f828192407574581abd82ef9 | refs/heads/master | 2023-08-17T19:20:36.735431 | 2023-08-14T02:27:37 | 2023-08-14T02:27:37 | 367,047 | 45 | 54 | NOASSERTION | 2022-02-06T21:20:44 | 2009-11-10T01:57:00 | Java | UTF-8 | Java | false | false | 3,591 | java | /**
* Copyright 2011 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
package jogamp.common.os.android;
import android.content.Context;
import android.util.Log;
import android.view.ViewGroup;
public class StaticContext {
private static Context appContext = null;
private static ViewGroup contentViewGroup = null;
private static boolean DEBUG = false;
/**
* Register Android application context for static usage.
*
* @param appContext mandatory application Context
* @throws RuntimeException if the context is already registered.
*/
public static final synchronized void init(final Context appContext) {
init(appContext, null);
}
/**
* Register Android application context w/ a ViewGroup for static usage.
*
* @param appContext mandatory application Context
* @param contentViewGroup optional ViewGroup acting as the Window's ContentView, usually a FrameLayout instance.
* @throws RuntimeException if the context is already registered.
*/
public static final synchronized void init(final Context appContext, final ViewGroup contentViewGroup) {
if(null != StaticContext.appContext) {
throw new RuntimeException("Context already set");
}
if(DEBUG) { Log.d(MD.TAG, "init(appCtx "+appContext+", viewGroup "+contentViewGroup+")"); }
StaticContext.appContext = appContext;
StaticContext.contentViewGroup = contentViewGroup;
}
/**
* Unregister the Android application Context and ViewGroup
*/
public static final synchronized void clear() {
if(DEBUG) { Log.d(MD.TAG, "clear()"); }
appContext = null;
contentViewGroup = null;
}
/**
* Return the registered Android application Context
* @return
*/
public static final synchronized Context getContext() {
return appContext;
}
/**
* Return the registered Android ViewGroup acting as the Window's ContentView
* @return
*/
public static final synchronized ViewGroup getContentViewGroup() {
return contentViewGroup;
}
}
| [
"sgothel@jausoft.com"
] | sgothel@jausoft.com |
8c04b5995aea38249b4212decd1b3f15f2d7c160 | d4563f7d16898440a766d24a03077091e0e56da7 | /cli-wrapper/src/main/java/com/ebay/maven/cli/Actions.java | efe9bca56eb326f29b1083fa8d6ee7cbd17009d6 | [] | no_license | tholu/maven-enhanced | 87a0fc7323205844fae1460063515d26dfc0bbb7 | b075c693b78e626ac3a5cb267136faf0252e4498 | refs/heads/master | 2021-05-27T19:40:49.017793 | 2012-12-05T14:41:21 | 2012-12-05T14:41:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 191 | java | package com.ebay.maven.cli;
public class Actions {
public static final String BINARYREPO_CREATE = "BINARYREPO_CREATE";
public static final String BINARYREPO_COPY = "BINARYREPO_COPY";
}
| [
"snambi@gmail.com"
] | snambi@gmail.com |
98e0156e350f2c3373f3116f14b44d1b0b1247a6 | da9c593ecad80e5413940a7f0fc35f41ef0728d5 | /src/jobInterview/niuke/test22/Main2.java | 2eaf32208046b103298a026d220f3ef5e5495893 | [] | no_license | yisuoyanyv/java-study | 02812404ac150ab1d7747943bd800c62010fe72f | 3dee3a3b07a6463248e6c7d6716de97cae616558 | refs/heads/master | 2022-05-22T13:10:08.287881 | 2022-04-01T12:35:29 | 2022-04-01T12:35:29 | 244,647,048 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 529 | java | package jobInterview.niuke.test22;
/**
* @author zhangjinglong
* @date 2020-04-28-7:28 下午
*/
public class Main2 {
public static void main(String[] args) {
int[] arr = new int[]{0, -1, 2, -3, 4, 5, -6, 7, -8};
int max = 0;
int cur = 0;
for (int i = 0; i < arr.length; i++) {
cur += arr[i];
if (cur < 0) {
cur = 0;
} else {
max = max < cur ? cur : max;
}
}
System.out.println(max);
}
}
| [
"840834298@qq.com"
] | 840834298@qq.com |
b764de184586698f2fe20c2956cfc9e06e6b456c | 8a8a0037e17f02a2980d1987fd38cd5ca69faee9 | /Registers-Service-Microservices/src/test/java/com/ms/RegistersServiceMicroservicesApplicationTests.java | 16cdc38feaa5e98913abf849136443e50af2908e | [] | no_license | chumankp/micro_service | 6124d33069c8ed467cd5c5e1ead3131d98b96d4d | aaf5cd8ac6c27b053c2c4825d3561233118a378c | refs/heads/master | 2022-06-02T17:04:45.483461 | 2022-05-19T13:36:35 | 2022-05-19T13:36:35 | 127,801,281 | 0 | 0 | null | 2022-05-19T13:28:21 | 2018-04-02T19:17:05 | Java | UTF-8 | Java | false | false | 346 | java | package com.ms;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class RegistersServiceMicroservicesApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"chuman.panda@gmail.com"
] | chuman.panda@gmail.com |
8bfd4436da5c52664f9bfcceffbc0e4442840987 | 2f33c42244bbe7f2ea7ab9ab0bd0ecea204d2a9d | /ProfilAdminManagerPegawaiPasar/app/src/main/java/id/aryad/sipasar/LoginActivity.java | af1c15d29809d63eecf87b507b74c4872b027cc8 | [] | no_license | spotikum/ProgMob | d8cc7c6c1336c2ba9be5feb45e9cffceabd57dc4 | 6f48f4655ebc3cd334782f39b6be9845be709a35 | refs/heads/main | 2023-05-06T00:29:33.159660 | 2021-05-30T01:34:53 | 2021-05-30T01:34:53 | 343,795,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,920 | java | package id.aryad.sipasar;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.util.ArrayList;
public class LoginActivity extends AppCompatActivity {
private EditText inputusername, inputPassword ;
private Button btnLogin;
private String i_username, i_password;
private ArrayList <ModelArrayList>IniArrayList;
private Boolean Status;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
inputusername = (EditText) findViewById(R.id.inputusername);
inputPassword = (EditText) findViewById(R.id.inputPassword);
btnLogin = (Button) findViewById(R.id.btnLogin);
IniArrayList = new ArrayList<>();
IniArrayList.add(new ModelArrayList(1, "aryaadmin", "pass123", "admin", 1, "spot", "Jln. Kenangan Indah No.1", R.drawable.profile));
IniArrayList.add(new ModelArrayList(2, "aryamanager", "pass123", "manager", 1, "mocha", "Jln. Kenangan Mantan No.2", R.drawable.profile));
IniArrayList.add(new ModelArrayList(3, "aryapegawai", "pass123", "pegawai", 1, "arya", "Jln. Kenangan Mantan No.7", R.drawable.profile));
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
i_username = inputusername.getText().toString();
i_password = inputPassword.getText().toString();
if(i_username.equals("") || i_password.equals("")){
Toast.makeText(getApplicationContext(), "hgaksjfbkajshta", Toast.LENGTH_LONG).show();
}else {
for (ModelArrayList login:IniArrayList){
if (login.username.equals(i_username)){
if (login.password.equals(i_password)){
if (login.status==1){
Intent IntenLogin = new Intent(LoginActivity.this, MainActivity.class);
IntenLogin.putExtra("id_pegawai", login.id_pegawai);
IntenLogin.putExtra("username", login.username);
IntenLogin.putExtra("password", login.password);
IntenLogin.putExtra("role", login.role);
IntenLogin.putExtra("status", login.status);
IntenLogin.putExtra("nama", login.nama);
IntenLogin.putExtra("alamat", login.alamat);
IntenLogin.putExtra("foto", login.foto);
startActivity(IntenLogin);
Toast.makeText(getApplicationContext(), "Welcome " +login.nama, Toast.LENGTH_SHORT).show();
break;
}else{
Toast.makeText(getApplicationContext(), "Akun tidak aktif", Toast.LENGTH_LONG).show();
break;
}
}else {
Status=false;
Toast.makeText(getApplicationContext(), "Password salah", Toast.LENGTH_LONG).show();
break;
}
}else {
Status = true;
}
}if (Status == true){
Toast.makeText(getApplicationContext(), "Akun tidak ditemukan", Toast.LENGTH_LONG).show();
}
}
}
});
}
} | [
"spot@tracert.id"
] | spot@tracert.id |
c0b8b8bd6ce43f3c6c2f24489c6459178e4823cb | 891bb79c68991c115d43208fd9016cf6a1a7f557 | /src/main/java/libnoiseforjava/module/Multiply.java | 6e85afee605ec30b8bd1c1cc7c53df2bbc34455c | [
"MIT"
] | permissive | Rsgm/space-rpg | d30932e045fa5574282c6e3f2b57082251b10069 | 031a68e709af30cba29a43e3d80ead4857707477 | refs/heads/master | 2016-08-08T03:42:47.252425 | 2016-01-28T18:18:56 | 2016-01-28T18:18:56 | 17,445,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,054 | java | /*
* Copyright (C) 2003, 2004 Jason Bevins (original libnoise code)
* Copyright 2010 Thomas J. Hodge (java port of libnoise)
*
* This file is part of libnoiseforjava.
*
* libnoiseforjava is a Java port of the C++ library libnoise, which may be found at
* http://libnoise.sourceforge.net/. libnoise was developed by Jason Bevins, who may be
* contacted at jlbezigvins@gmzigail.com (for great email, take off every 'zig').
* Porting to Java was done by Thomas Hodge, who may be contacted at
* libnoisezagforjava@gzagmail.com (remove every 'zag').
*
* libnoiseforjava is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* libnoiseforjava 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
* libnoiseforjava. If not, see <http://www.gnu.org/licenses/>.
*
*/
package libnoiseforjava.module;
import libnoiseforjava.exception.ExceptionInvalidParam;
public class Multiply extends ModuleBase {
/// Noise module that outputs the product of the two output values from
/// two source modules.
///
/// @image html modulemultiply.png
///
/// This noise module requires two source modules.
public Multiply(ModuleBase sourceModuleOne, ModuleBase sourceModuleTwo) throws ExceptionInvalidParam {
super(2);
setSourceModule(0, sourceModuleOne);
setSourceModule(1, sourceModuleTwo);
}
public double getValue(double x, double y, double z) {
assert (sourceModules[0] != null);
assert (sourceModules[1] != null);
return sourceModules[0].getValue(x, y, z)
* sourceModules[1].getValue(x, y, z);
}
}
| [
"rsgm123@gmail.com"
] | rsgm123@gmail.com |
741ddad9285057e6e36518649712d5694349eb9d | 83fba2be7705202cd0e21bc66bf8c6bbb846975d | /app/src/main/java/my/localocal/json/JSONUtils.java | aa4bce2ce04ba7b817027500dae286f2546f818f | [] | no_license | MystL/localocal_android | f3cc3749e755a10ec50849476e1978fff8e3c2f0 | 13c3d3416ffc9b061ab4eaff40c5a24a6ad590f0 | refs/heads/master | 2020-08-05T01:09:02.512254 | 2015-06-15T02:50:29 | 2015-06-15T02:50:29 | 37,438,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,185 | java | package my.localocal.json;
import java.util.Collection;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public abstract class JSONUtils{
public static Object toJSON(Object o) {
if (o == null) {
return "";
}
try {
if (o instanceof IJSONifyableObject)
return ((IJSONifyableObject) o).toJSON();
else if (o instanceof Boolean)
return Integer.valueOf(((Boolean) o).booleanValue() ? 1 : 0);
else if (o.getClass().isArray()) {
JSONArray json = new JSONArray();
for (Object o2 : ((Object[]) o)) {
json.put(toJSON(o2));
}
return json;
} else if (o instanceof Map<?, ?>) {
JSONObject json = new JSONObject();
for (Object key : ((Map<?, ?>) o).keySet()) {
json.put(key.toString(), toJSON(((Map<?, ?>) o).get(key)));
}
return json;
} else if (o instanceof Collection<?>) {
JSONArray json = new JSONArray();
for (Object o2 : ((Collection<?>) o)) {
json.put(toJSON(o2));
}
return json;
} else if (o.getClass().isEnum()) {
return o.toString();
} else
return o;
} catch (Exception e) {
return o;
}
}
}
| [
"melvinlee.yk@gmail.com"
] | melvinlee.yk@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.