blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
ca2f89aa30ee0627a4b3fb6faa07e1ea8860edb7
7e283753a084e2c130270fb6dfbfb2eef4832424
/src/main/java/com/yf/salary/util/PageInfo.java
abe7c550514ed3152ee5b5fb86194b15e843d139
[]
no_license
Fpeng2333/salary_system
e7415b7180bed6f913165ec03edfb301454346e9
40894b4e750cce0f83a51c6fc33b282948a4b89b
refs/heads/master
2022-07-12T21:51:17.350040
2019-09-12T09:02:31
2019-09-12T09:02:31
207,987,468
0
0
null
2022-06-29T17:38:31
2019-09-12T07:10:20
Java
UTF-8
Java
false
false
3,149
java
package com.yf.salary.util; import com.github.pagehelper.Page; import java.io.Serializable; import java.util.Collection; import java.util.List; /** * @描叙: 分页 数据结构 */ public class PageInfo<T> implements Serializable { private static final long serialVersionUID = 1L; //当前页 private int pageNum; //每页的数量 private int pageSize; //总记录数 private long total; //总页数 private int pages; //结果集 private List<T> list; //是否为第一页 private boolean isFirstPage = false; //是否为最后一页 private boolean isLastPage = false; public PageInfo() { } /** * 包装Page对象 * * @param list */ public PageInfo(List<T> list) { if (list instanceof Page) { Page page = (Page) list; this.pageNum = page.getPageNum(); this.pageSize = page.getPageSize(); this.pages = page.getPages(); this.list = page; this.total = page.getTotal(); } else if (list instanceof Collection) { this.pageNum = 1; this.pageSize = list.size(); this.pages = 1; this.list = list; this.total = list.size(); } if (list instanceof Collection) { //判断页面边界 judgePageBoudary(); } } /** * 判定页面边界 */ private void judgePageBoudary() { isFirstPage = pageNum == 1; isLastPage = pageNum == pages; } public int getPageNum() { return pageNum; } public void setPageNum(int pageNum) { this.pageNum = pageNum; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public long getTotal() { return total; } public void setTotal(long total) { this.total = total; } public int getPages() { return pages; } public void setPages(int pages) { this.pages = pages; } public List<T> getList() { return list; } public void setList(List<T> list) { this.list = list; } public boolean isIsFirstPage() { return isFirstPage; } public void setIsFirstPage(boolean isFirstPage) { this.isFirstPage = isFirstPage; } public boolean isIsLastPage() { return isLastPage; } public void setIsLastPage(boolean isLastPage) { this.isLastPage = isLastPage; } @Override public String toString() { final StringBuffer sb = new StringBuffer("PageInfo{"); sb.append("pageNum=").append(pageNum); sb.append(", pageSize=").append(pageSize); sb.append(", total=").append(total); sb.append(", pages=").append(pages); sb.append(", list=").append(list); sb.append(", isFirstPage=").append(isFirstPage); sb.append(", isLastPage=").append(isLastPage); sb.append(", navigatepageNums="); sb.append('}'); return sb.toString(); } }
6facc5fa98090cfd2f0cb22aa0445af3047a0ac5
80dded658a2def9f19efda0285e22405a8dd451c
/decompiled_src/Procyon/org/anddev/andengine/entity/particle/emitter/CircleOutlineParticleEmitter.java
776c678bc7047df5ad40d6ae81511f1ec0b39935
[ "Apache-2.0" ]
permissive
rLadia-demo/AttacknidPatch
57482e19c6e99e8923e299a121b9b2c74242b8ee
561fc5fa5c1bc5afa4bad28855bf16b480c3ab6a
refs/heads/master
2021-01-25T07:08:43.450419
2014-06-15T14:35:03
2014-06-15T14:35:03
20,852,359
1
0
null
null
null
null
UTF-8
Java
false
false
758
java
package org.anddev.andengine.entity.particle.emitter; import org.anddev.andengine.util.*; import android.util.*; public class CircleOutlineParticleEmitter extends BaseCircleParticleEmitter { public CircleOutlineParticleEmitter(final float n, final float n2, final float n3) { super(n, n2, n3); } public CircleOutlineParticleEmitter(final float n, final float n2, final float n3, final float n4) { super(n, n2, n3, n4); } @Override public void getPositionOffset(final float[] array) { final float n = 2.0f * (3.1415927f * MathUtils.RANDOM.nextFloat()); array[0] = this.mCenterX + FloatMath.cos(n) * this.mRadiusX; array[1] = this.mCenterY + FloatMath.sin(n) * this.mRadiusY; } }
fdd2bbc42a3d01486a90dcd61b6d428532547ca5
013c744f98ed140f8b751d76a372565b7a841ecf
/src/com/dosmil_e/kit/core/model/edoc/base/KitContentBase.java
bb8d43d0c24f5bf5e37f0d640e7c6a5e95f57c42
[]
no_license
carrascoMDD/Kit01
85ac077df93f1ed1b2ece6799fc3c130e0189359
edc0a9dcd3944f413b1206c0b834c78d8217b51b
refs/heads/master
2020-03-14T11:53:21.408340
2018-04-30T13:49:34
2018-04-30T13:49:34
131,598,995
0
0
null
null
null
null
UTF-8
Java
false
false
13,529
java
package com.dosmil_e.kit.core.model.edoc.base; import com.dosmil_e.modelbase.support.*; import com.dosmil_e.modelbase.flattrx.*; import java.lang.reflect.Field; public class KitContentBase extends com.dosmil_e.kit.core.model.structural.impl.KitAbstractDocumentImpl implements com.dosmil_e.kit.core.model.edoc.ifc.KitContentIfc { /**************************************************************************** * Static metainformation for Type of the EAIProject metamodel element ****************************************************************************/ public static com.dosmil_e.m3.core.ifc.M3TypeIfc vm3Type; /**************************************************************************** * State storage for Attributes of the KitContent metamodel element ****************************************************************************/ /**************************************************************************** * State storage for the Relationships of the KitContent metamodel element ****************************************************************************/ /**************************************************************************** * Constructors of the KitContent metamodel element ****************************************************************************/ public KitContentBase() { super(); } public KitContentBase( EAIMMCtxtIfc theCtxt) { super( theCtxt); } public KitContentBase( EAIMMCtxtIfc theCtxt, EAIMMNameIfc theName) { super( theCtxt, theName); } /**************************************************************************** * Implementation of the KitContentIfc and KitContentPriv interfaces ****************************************************************************/ /**************************************************************************** * Implementation of attributes of KitContent ****************************************************************************/ /**************************************************************************** * Implementation of relationships of KitContent ****************************************************************************/ /**************************************************************************** * Implementation of destructor of KitContent ****************************************************************************/ public void delete( EAIMMCtxtIfc theCtxt) throws EAIException { if( theCtxt == null) { return;} getM3Type( theCtxt); if( vm3Type == null) { return;} try { ((com.dosmil_e.m3.core.pub.M3TypePub) vm3Type). deleteElement( theCtxt, this); } catch( ClassCastException anEx) { return;} } /**************************************************************************** * Support ****************************************************************************/ /**************************************************************************** * Access and initialization of metainformation the metamodel element * for initialization, delegates on the model's metamodel root, that will * invoke metainfo initializers (phase1, phase2) on all the metamodel elements ****************************************************************************/ public static com.dosmil_e.m3.core.ifc.M3TypeIfc getStaticM3Type( EAIMMCtxtIfc theCtxt) { if( vm3Type == null) { vm3Type = com.dosmil_e.kit.core.model.edoc.meta.KitContentMeta.getStaticM3Type( theCtxt); } return vm3Type; } /**************************************************************************** * Access to metainformation for Type of the metamodel element ****************************************************************************/ public com.dosmil_e.m3.core.ifc.M3TypeIfc getM3Type( EAIMMCtxtIfc theCtxt) { return getStaticM3Type( theCtxt); } /**************************************************************************** * Implementation of restoreValue method (such that it has access to protected fields) ****************************************************************************/ // Restore a value on this metamodel element protected boolean restoreValue( EAIMMCtxtIfc theCtxt, Object theValueToRestore, String theFieldName) { if( theCtxt == null) { return true;} if( theFieldName == null) { return true;} if( EAIFlatTransactionMgrIfc.sLogTransactionBoundaries) { String aSourceName = new String("null"); String aSourceClassName = new String(); EAIMMNameIfc aName = null; try { aName = getName();} catch( EAIException anEx) {} if( aName != null) { aSourceName = aName.getString(); } aSourceClassName = getClass().getName(); System.out.println("--- Restoring field : " + theFieldName + " in element named " + aSourceName + " class " + aSourceClassName); } if( theFieldName.equals( sExistencePropertyName)) { return true;} Field aField = getField( theFieldName); if( aField == null) { return false;} Class aFieldType = aField.getType(); if( aFieldType == null) { return false;} if( !aFieldType.isPrimitive()) { try { aField.set( this, theValueToRestore);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} } else { String aFieldTypeName = aFieldType.getName(); if( aFieldTypeName.equals( int.class.getName())) { Integer aValueObject = null; try { aValueObject = (Integer) theValueToRestore;} catch( ClassCastException anException) {} if( aValueObject == null) { return false;} int aValue = aValueObject.intValue(); try { aField.setInt( this, aValue);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} } else { if( aFieldTypeName.equals( boolean.class.getName())) { Boolean aValueObject = null; try { aValueObject = (Boolean) theValueToRestore;} catch( ClassCastException anException) {} if( aValueObject == null) { return false;} boolean aValue = aValueObject.booleanValue(); try { aField.setBoolean( this, aValue);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} } else { if( aFieldTypeName.equals( float.class.getName())) { Float aValueObject = null; try { aValueObject = (Float) theValueToRestore;} catch( ClassCastException anException) {} if( aValueObject == null) { return false;} float aValue = aValueObject.floatValue(); try { aField.setFloat( this, aValue);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} } else { if( aFieldTypeName.equals( double.class.getName())) { Double aValueObject = null; try { aValueObject = (Double) theValueToRestore;} catch( ClassCastException anException) {} if( aValueObject == null) { return false;} double aValue = aValueObject.doubleValue(); try { aField.setDouble( this, aValue);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} } else { return false; }}}} } return true; } /**************************************************************************** * Implementations of getFieldValue method (such that it has access to protected fields) ****************************************************************************/ // Get a value from a field of this metamodel element public Object getFieldValue( EAIMMCtxtIfc theCtxt, Field theField) throws EAIException { if( theCtxt == null) { return null;} if( theField == null) { return null;} Object aValue = null; try { aValue = theField.get( this);} catch( IllegalArgumentException anException) { return null;} catch( IllegalAccessException anException) { return null;} catch( NullPointerException anException) { return null;} catch( ExceptionInInitializerError anException) { return null;} return aValue; } /**************************************************************************** * Implementations of setFieldToXXX method (such that it has access to protected fields) ****************************************************************************/ // Aux for log protected void logSetField( EAIMMCtxtIfc theCtxt, String theFieldKind, Field theField) { if( !EAIFlatTransactionMgrIfc.sLogTransactionBoundaries) { return;} String aSourceName = new String("null"); String aSourceClassName = new String(); EAIMMNameIfc aName = null; try { aName = getName();} catch( EAIException anEx) {} if( aName != null) { aSourceName = aName.getString(); } aSourceClassName = getClass().getName(); System.out.println("--- SettingField " + theFieldKind + " field : " + theField.getName() + " in element named " + aSourceName + " class " + aSourceClassName); } // Restore a value on this metamodel element public boolean setFieldToNonPrimitiveValue( EAIMMCtxtIfc theCtxt, Object theValueToSet, Field theField) throws EAIException { if( theCtxt == null) { return true;} if( theField == null) { return true;} logSetField( theCtxt, "Non Primitive", theField); try { theField.set( this, theValueToSet);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} return true; } public boolean setFieldToPrimitiveIntValue( EAIMMCtxtIfc theCtxt, Object theValueToSet, Field theField) throws EAIException { if( theCtxt == null) { return true;} if( theField == null) { return true;} logSetField( theCtxt, "Primitive int", theField); Integer aValueObject = null; try { aValueObject = (Integer) theValueToSet;} catch( ClassCastException anException) {} if( aValueObject == null) { return false;} int aValue = aValueObject.intValue(); try { theField.setInt( this, aValue);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} return true; } public boolean setFieldToPrimitiveBoolValue( EAIMMCtxtIfc theCtxt, Object theValueToSet, Field theField) throws EAIException { if( theCtxt == null) { return true;} if( theField == null) { return true;} logSetField( theCtxt, "Primitive boolean", theField); Boolean aValueObject = null; try { aValueObject = (Boolean) theValueToSet;} catch( ClassCastException anException) {} if( aValueObject == null) { return false;} boolean aValue = aValueObject.booleanValue(); try { theField.setBoolean( this, aValue);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} return true; } public boolean setFieldToPrimitiveFloatValue( EAIMMCtxtIfc theCtxt, Object theValueToSet, Field theField) throws EAIException { if( theCtxt == null) { return true;} if( theField == null) { return true;} logSetField( theCtxt, "Primitive float", theField); Float aValueObject = null; try { aValueObject = (Float) theValueToSet;} catch( ClassCastException anException) {} if( aValueObject == null) { return false;} float aValue = aValueObject.floatValue(); try { theField.setFloat( this, aValue);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} return true; } public boolean setFieldToPrimitiveDoubleValue( EAIMMCtxtIfc theCtxt, Object theValueToSet, Field theField) throws EAIException { if( theCtxt == null) { return true;} if( theField == null) { return true;} logSetField( theCtxt, "Primitive double", theField); Double aValueObject = null; try { aValueObject = (Double) theValueToSet;} catch( ClassCastException anException) {} if( aValueObject == null) { return false;} double aValue = aValueObject.doubleValue(); try { theField.setDouble( this, aValue);} catch( IllegalArgumentException anException) { return false;} catch( IllegalAccessException anException) { return false;} return true; } /**************************************************************************** * Serialization support ****************************************************************************/ private static final long serialVersionUID = -3331123456100000003L; }
b5865ba59182ea27ed92d100f870f952fd621f26
bafd16032742572d4df841ae19f404bb45dda1de
/src/main/java/com/xj/code/generate/entity/Dependency.java
43f2b22134d33140a4aeeb4f11c4b734f41dc9d2
[]
no_license
SkyXj/code-generate
1fc9893bb2f897a3b8802e34162d17c123ac989f
1b01a05d43bdf126fb24ac457feac548e6146634
refs/heads/master
2022-07-07T17:38:21.865067
2020-09-20T09:08:51
2020-09-20T09:08:51
219,493,252
0
0
null
2022-06-17T02:38:39
2019-11-04T12:11:28
FreeMarker
UTF-8
Java
false
false
1,652
java
/** * Copyright © 2018武汉中地数码科技有限公司. All rights reserved. * * @Title: Dependency.java * @Package: com.xj.code.generate.entity * @Description: TODO * @author: [email protected] * @date: 2019-10-30 09:28:52 * @Modify Description : * @Modify Person : * @version: V1.0 */ package com.xj.code.generate.entity; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableName; import javax.persistence.*; import java.math.BigDecimal; import lombok.Data; /** * 描述:模型 * @author sky * @date 2019-10-30 09:28:52 */ @Data @TableName("dependency") public class Dependency{ /** * */ private static final long serialVersionUID = 1L; /** * */ @TableField("id") @Column(name = "id",length = 10,nullable = false) private Integer id; /** * */ @TableField("groupId") @Column(name = "groupId",length = 255,nullable = true) private String groupid; /** * */ @TableField("artifactId") @Column(name = "artifactId",length = 255,nullable = true) private String artifactid; /** *version 为空代表不需要版本号 */ @TableField("version") @Column(name = "version",length = 50,nullable = true) private String version; /** *jar包的描述 */ @TableField("description") @Column(name = "description",length = 255,nullable = true) private String description; /** *模块名 */ @TableField("module") @Column(name = "module",length = 255,nullable = true) private String module; }
32744ed6c859a0dcc2e8309487dad39d0884c0a0
5208e3ae2901dc3475779674ded98be1b9434ce4
/src/main/java/kakalgy/netty/handler/ssl/ReferenceCountedOpenSslContext.java
2e7a9af0dd342596733698779a00fa8c2b4f7a8e
[]
no_license
kakalgy/Netty
65d14394854f9bdf7df10d115d7adb40e5213f8d
70015e3a82e91c0e3682e02165c596d44fa3cdf9
refs/heads/master
2021-01-09T06:31:47.648303
2017-03-08T15:47:35
2017-03-08T15:47:35
81,001,296
0
0
null
null
null
null
UTF-8
Java
false
false
2,149
java
package kakalgy.netty.handler.ssl; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; import kakalgy.netty.common.util.ReferenceCounted; import kakalgy.netty.common.util.internal.SystemPropertyUtil; import kakalgy.netty.common.util.internal.logging.InternalLogger; import kakalgy.netty.common.util.internal.logging.InternalLoggerFactory; /** * An implementation of {@link SslContext} which works with libraries that * support the <a href="https://www.openssl.org/">OpenSsl</a> C library API. * <p> * Instances of this class must be {@link #release() released} or else native * memory will leak!(这个类的实例必须被释放,否则会导致内存泄漏) * * <p> * Instances of this class <strong>must not</strong> be released before any * {@link ReferenceCountedOpenSslEngine} which depends upon the instance of this * class is released. Otherwise if any method of * {@link ReferenceCountedOpenSslEngine} is called which uses this class's JNI * resources the JVM may * crash.(如果任何一个基于这个类的实例的ReferenceCountedOpenSslEngine没有被释放,则这个类的实例也不能被释放, * 否则再调用ReferenceCountedOpenSslEngine的方法使用这个类的JNI资源时会导致JVM崩溃) */ public abstract class ReferenceCountedOpenSslContext extends SslContext implements ReferenceCounted { private static final InternalLogger logger = InternalLoggerFactory.getInstance(ReferenceCountedOpenSslContext.class); /** * 获得rejectClientInitiatedRenegotiation属性,属于SSL部分内容:Client-initiated * renegotiation */ private static final boolean JDK_REJECT_CLIENT_INITIATED_RENEGOTIATION = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { public Boolean run() { // TODO Auto-generated method stub return SystemPropertyUtil.getJavaSystemPropertyBoolean("jdk.tls.rejectClientInitiatedRenegotiation", false); } }); /** * 默认密码 */ private static final List<String> DEFAULT_CIPHERS; /** * */ private static final Integer DH_KEY_LENGTH; }
e6359e9c2d697af97d42c2e72936fc5dc9880e33
5d6ed24a732c8504510f4a4c7d73faf7f8d8eb33
/src/main/java/com/scarlatti/truefalse/GoodQualifier.java
c64eb8ed52787ddec5e705e08046137ca05d0c75
[]
no_license
alessandroscarlatti/true-false-demo
42eecc5545ce8803dd6fcc779f0784d7287b3415
d861e9fa3325c2ac077dc2bf66b6d10077acacf1
refs/heads/master
2021-04-29T15:59:44.525532
2018-02-17T22:48:42
2018-02-17T22:48:42
121,805,820
0
0
null
null
null
null
UTF-8
Java
false
false
990
java
package com.scarlatti.truefalse; import java.util.List; /** * ______ __ __ ____ __ __ __ _ * ___/ _ | / /__ ___ ___ ___ ____ ___/ /______ / __/______ _____/ /__ _/ /_/ /_(_) * __/ __ |/ / -_|_-<(_-</ _ `/ _ \/ _ / __/ _ \ _\ \/ __/ _ `/ __/ / _ `/ __/ __/ / * /_/ |_/_/\__/___/___/\_,_/_//_/\_,_/_/ \___/ /___/\__/\_,_/_/ /_/\_,_/\__/\__/_/ * Friday, 2/16/2018 */ public class GoodQualifier implements Qualifier { private List<String> adims = new ADim().trueValues(); private List<String> bdims = new BDim().trueValues(); private List<String> cdims = new CDim().trueValues(); private List<String> ddims = new DDim().trueValues(); @Override public boolean qualify(String adim, String bdim, String cdim, String ddim) { return ( adims.contains(adim) && bdims.contains(bdim) && cdims.contains(cdim) && ddims.contains(ddim) ); } }
3a7210436ce9152fcaf021699ba6f65228dcabb7
3a69c55621ff5c7842b684d74e3203029fa0fcfd
/src/main/java/org/aanguita/jacuzzi/maps/DoubleKeyMap.java
68f6109bc6c96122f06e5e7b7957c24805ee103b
[ "MIT" ]
permissive
albertoanguita/jacuzzi
119b6174d6a259157f1bf58f2e6b373c9fe5d9e1
cf9b40f37c55b8c5bef548aa2e8fe22777fd8982
refs/heads/master
2020-04-15T00:23:34.073057
2018-04-02T07:05:36
2018-04-02T07:05:36
42,078,122
1
0
MIT
2018-02-01T09:29:01
2015-09-07T22:54:16
Java
UTF-8
Java
false
false
2,698
java
package org.aanguita.jacuzzi.maps; import org.aanguita.jacuzzi.lists.tuple.Duple; import org.aanguita.jacuzzi.lists.tuple.Triple; import java.io.Serializable; import java.util.*; /** * A map implementation with two keys. Values can be retrieved with either key. */ public class DoubleKeyMap<K, S, V> implements Serializable { private final Map<K, Triple<K, S, V>> mainMap; private final Map<S, Triple<K, S, V>> secondaryMap; public DoubleKeyMap() { mainMap = new HashMap<>(); secondaryMap = new HashMap<>(); } public void put(K key, S secondaryKey, V value) { Triple<K, S, V> tripleValue = new Triple<>(key, secondaryKey, value); mainMap.put(key, tripleValue); secondaryMap.put(secondaryKey, tripleValue); } public V get(K key) { return mainMap.get(key).element3; } public S getSecondaryKey(K key) { return mainMap.get(key).element2; } public V getSecondary(S key) { return secondaryMap.get(key).element3; } public K getMainKey(S key) { return secondaryMap.get(key).element1; } public boolean containsKey(K key) { return mainMap.containsKey(key); } public boolean containsSecondaryKey(S secondaryKey) { return secondaryMap.containsKey(secondaryKey); } public Duple<S, V> remove(K key) { Triple<K, S, V> tripleValue = mainMap.remove(key); if (tripleValue != null) { secondaryMap.remove(tripleValue.element2); return new Duple<>(tripleValue.element2, tripleValue.element3); } else { return null; } } public Duple<K, V> removeSecondary(S secondaryKey) { Triple<K, S, V> tripleValue = secondaryMap.remove(secondaryKey); if (tripleValue != null) { mainMap.remove(tripleValue.element1); return new Duple<>(tripleValue.element1, tripleValue.element3); } else { return null; } } public boolean isEmpty() { return size() == 0; } public void clear() { mainMap.clear(); secondaryMap.clear(); } public int size() { return mainMap.size(); } public Set<K> keySet() { return mainMap.keySet(); } public Set<S> secondaryKeySet() { return secondaryMap.keySet(); } public Collection<V> values() { Collection<V> values = new ArrayList<>(); for (Triple<K, S, V> tripleValue : mainMap.values()) { values.add(tripleValue.element3); } return values; } public Collection<Triple<K, S, V>> entrySet() { return mainMap.values(); } }
7917fd6f0f46c8e931ac0c0497fb9ed8ca914818
a22c6fdaacdf1c63440b3d76c26932ff048fb0b9
/src/main/java/com/bazlur/tips/solid/ocp/after/Multiplier.java
de4bff7504c3844793cab47b0dd4e07723af8d9d
[]
no_license
rokon12/java-tips
ea8330d0d8d794f51eac947a2a0f39992659918f
60da5b720b6e16c6ca53e98fd3996772fc84b8e5
refs/heads/master
2016-09-12T15:40:36.943205
2016-03-08T00:21:09
2016-03-08T00:21:09
59,617,968
2
0
null
null
null
null
UTF-8
Java
false
false
346
java
package com.bazlur.tips.solid.ocp.after; public class Multiplier extends CalculateBase { public Multiplier() {} public Multiplier(double leftVal, double rightVal) { super(leftVal, rightVal); } @Override public void calculate() { double value = getLeftVal() * getRightVal(); setResult(value); } }
b97b070d4a50561dd406a1ced578c1b7401f2da3
9d12cecb3fc263d63229637df7a3f83908c4dee1
/src/main/java/passambler/util/ValueConstants.java
d5d8f540e86fb403486d9220d92b10ed86de50e7
[ "MIT" ]
permissive
MovingtoMars/Passambler
c24591e61a3b6641e2b1f25ffded256bb178dc3c
5ec6db362d98553959b3dd442cd1ee383dbc03f4
refs/heads/master
2021-01-17T11:23:45.830700
2015-06-13T12:40:22
2015-06-13T12:40:22
37,369,416
0
0
null
2015-06-13T11:44:01
2015-06-13T11:44:01
null
UTF-8
Java
false
false
512
java
package passambler.util; import passambler.value.BooleanValue; import passambler.value.Value; public class ValueConstants { public static final BooleanValue TRUE = new BooleanValue(true); public static final BooleanValue FALSE = new BooleanValue(false); public static final Value NIL = new Value() { @Override public String toString() { return "nil"; } }; public static final Value STOP = new Value(); public static final Value SKIP = new Value(); }
d5ca9eb38bfb7fab992ba631251bf14fdcd0a936
bf3cb01c375825cfa0d030e5392ef28db6d81e4f
/Database/app/src/main/java/com/example/database/RoomDao.java
a8e4495fb7cc88422d7b51686692bc97e420ebf2
[]
no_license
rosrcharch/arquivo
07421e63c889907c1af1f54f9b4dc8cbfa76c51c
c1d803af708ca15ece32e5daffbce07b6fc92cb9
refs/heads/master
2020-09-05T09:41:55.972877
2019-11-07T00:42:42
2019-11-07T00:42:42
220,053,993
0
0
null
null
null
null
UTF-8
Java
false
false
168
java
package com.example.database; import androidx.room.Dao; import androidx.room.Insert; @Dao public interface RoomDao { @Insert void salvar(String... nome); }
0a3cdca00cb03c27fa78d044bcff126f32d315b5
3a54a368e8551692935cd21c7ecbd736147cdd70
/BibCreator.java
9ae6030a74c07bcf509dd4c895c12266533e4f48
[]
no_license
smart-bo/249_assignment3
bc84cba7a2240218753002044b963fa81e706d94
9ed29e8cac9effa939fe2e48b8a041d2b0221a80
refs/heads/master
2020-10-01T21:31:26.703514
2019-12-12T14:46:35
2019-12-12T14:46:35
227,628,991
0
0
null
null
null
null
UTF-8
Java
false
false
10,804
java
// Assignment 3 // Written by: Zhang Bo, ID:40108654 // ----------------------------------------------------- package assignment3; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; /** * * @author maybe * @ver */ // This program could change a BIB file into other three format files: ACM, IEEE,and NJ. public class BibCreator { /** * * @ * */ static class FileInvalidException extends Exception { public FileInvalidException() { super("Error: Input file cannot be parsed due to missing information (i.e. month={}, title={}, etc.) "); } public FileInvalidException(String s,String emptyFile) { System.out.println("Error: Detected Empty Field!"); System.out.println("============================"); System.out.println(); System.out.println("Problem detected with input file: "+s); System.out.println("File is Invalid: Field '"+emptyFile+"' is Empty. Processing stoped at this point.Other EMPTYfield may be present as well!"); } } //use transfered scanner to open giving file. public static void openFile(Scanner sc,String file) { try { sc=new Scanner(new FileInputStream((file))); }catch(FileNotFoundException e){ System.out.println("Could not open input file "+file+ " for reading. Please check if file exists! Program will terminate after closing any opened files."); sc.close(); System.exit(0); } } //create three other format files by giving file public static void createFile(PrintWriter pw1,PrintWriter pw2,PrintWriter pw3,int i) { try { pw1=new PrintWriter(new FileOutputStream("IEEE"+i+".jason")); pw2=new PrintWriter(new FileOutputStream("ACM"+i+".jason")); pw3=new PrintWriter(new FileOutputStream("NJ"+i+".jason")); pw1.close(); pw2.close(); pw3.close(); }catch(IOException e) { System.out.println("File Latex"+i+".BIB can't be opened/created! Program will terminate after closing any opened files."); pw1.close(); pw2.close(); pw3.close(); System.exit(0); } } //check if the giving file is valid. //return true if file is valid. public static boolean fileValidation(Scanner sc,String file) { boolean valid=true; String emptyFile=null; String str=null; try { sc=new Scanner(new FileInputStream((file))); while(sc.hasNextLine()) { str=sc.nextLine(); if(str.contains("{}")) { emptyFile=str.substring(0,str.indexOf("{")-1); valid=false; throw new FileInvalidException(file,emptyFile); } } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FileInvalidException e) { System.out.println(); } sc.close(); return valid; } //use valid giving file to get the useful information for other files according the format. public static void processFilesForValidation(Scanner sc,int i) { String author=null;String journal=null;String title=null;String year=null; String volume=null;String number=null;String pages=null;String DOI=null;String month=null; try { sc = new Scanner(new FileInputStream("Latex"+i+".BIB")); while(sc.hasNextLine()) { String str; str=sc.nextLine(); if(str.contains("author")) { author=str.substring(str.indexOf("{")+1,str.indexOf("}"));} else if (str.contains("journal")) { journal=str.substring(str.indexOf("{")+1,str.indexOf("}"));} else if (str.contains("title")) { title=str.substring(str.indexOf("{")+1,str.indexOf("}"));} else if (str.contains("year")) { year=str.substring(str.indexOf("{")+1,str.indexOf("}"));} else if (str.contains("volume")) { volume=str.substring(str.indexOf("{")+1,str.indexOf("}"));} else if (str.contains("number")) { number=str.substring(str.indexOf("{")+1,str.indexOf("}"));} else if (str.contains("pages")) { pages=str.substring(str.indexOf("{")+1,str.indexOf("}"));} else if (str.contains("doi")) { DOI=str.substring(str.indexOf("{")+1,str.indexOf("}"));} else if (str.contains("month")) { month=str.substring(str.indexOf("{")+1,str.indexOf("}"));} else if (str.equals("}")) { writeFiles(sc,i,author,title,journal,volume,pages,year,month,DOI,number);} } }catch(Exception e){} } /** * *@param */ //write in the created files. public static void writeFiles(Scanner sc,int i,String author,String title,String journal,String volume,String pages,String year,String month,String DOI,String number) { PrintWriter pw1=null; PrintWriter pw2=null; PrintWriter pw3=null; try { int count=1; pw1=new PrintWriter(new FileOutputStream("IEEE"+i+".jason",true)); pw2=new PrintWriter(new FileOutputStream("ACM"+i+".jason",true)); pw3=new PrintWriter(new FileOutputStream("NJ"+i+".jason",true)); pw1.println(author+". "+"\""+ title+"\", "+journal+", "+"vol."+volume+", "+"no."+number+", "+"p."+pages+", "+month+year+". "+"\n"); if(author.contains("and")) { pw2.println("["+count+"]"+author.substring(0, author.indexOf(" and"))+" et al. "+year+". "+ title+". "+journal+". "+volume+", "+"("+year+"), "+pages+", "+"p."+pages+". DOI:https://doi.org/"+DOI+". "+"\n"); count++;} else {pw2.println("["+count+"]"+author+year+". "+ title+". "+journal+". "+volume+", "+"("+year+"), "+pages+", "+"p."+pages+". DOI:https://doi.org/"+DOI+". "+"\n"); count++;} pw3.println(author+". "+ title+". "+journal+". "+volume+", "+pages+"("+year+"). "+"\n"); pw1.flush(); pw2.flush(); pw3.flush(); }catch(FileNotFoundException e) { System.out.println("Problem opening files. Cannot proceed to copy.");System.exit(0);} } //display the file user choosed.exist the program after. public static void readFiles(BufferedReader br, String filename) throws IOException { int x = 0; br=new BufferedReader(new FileReader(filename)); System.out.println("Here are the contents of the successfully created Jason fill: "+filename); x = br.read(); while(x != -1) { System.out.print((char)x); // MUST CAST; otherwise all what is read will be shown as integers x = br.read(); } br.close(); System.out.println("Goodbye! Hope you have enjoyed creating the needed files using BibCreator."); System.exit(0); } public static void main(String[] args) { System.out.println("Welcome to Bibcreator! "); System.out.println("Created by Zhang Bo \n"); Scanner sc=null; int i=1; int validfile=0; for(;i<11;i++) { String file="Latex"+i+".BIB"; BibCreator.openFile(sc,file ); } PrintWriter pw1=null; PrintWriter pw2=null; PrintWriter pw3=null; for(i=1;i<11;i++) { BibCreator.createFile(pw1, pw2, pw3, i); } for(i=1;i<11;i++) { String file="Latex"+i+".BIB"; // boolean x= if(fileValidation(sc,file)) { processFilesForValidation(sc,i); validfile++; } else { File file1=new File("IEEE"+i+".jason"); File file2=new File("ACM"+i+".jason"); File file3=new File("NJ"+i+".jason"); file1.delete(); file2.delete(); file3.delete(); } } int invalidfile=10-validfile; System.out.println("A total of "+invalidfile+" files were invalid, and couldn't be processed. All other "+validfile+" \"Valid\" files have been created!\n"); int trytime=1; do{ System.out.println("Pls enter the name of one of the files that you need to review:"); Scanner input=new Scanner(System.in); String filename=input.nextLine(); BufferedReader br = null; try { readFiles(br,filename); }catch (FileNotFoundException e) { if(trytime<2) {System.out.println("Can not open input file. File does not exist; possibly it could not be created"); System.out.println("However, you will allowed another chance to enter another file name.\n"); trytime++;} else { System.out.println("Could not open input file gain! Either file does not exist or could not be created.\n"); System.out.println("Sorry ! Iam unable to display your desired files! Program will exit!"); System.exit(0); } } catch (IOException e) { System.out.println("Error: An error has occurred while reading from the file. "); System.out.println("Program will terminate."); System.exit(0);} }while(true); } }
6443e939fb6d315f1e0090bb750621c043396b1e
0c093e317fcdb2e518c139edcee97fedc657c2d2
/websocket/src/main/java/com/hz/web/WebsocketApplication.java
42f911d890a5167a30621778327aebfe8942a1a1
[]
no_license
hzprivate/frame-topic
f62779a21d5c8af413767abd911bcaed2f5fca06
ecd8f1b6713bb5ed23b67516dabb73ef31d7fe55
refs/heads/master
2023-04-18T08:47:39.362472
2021-04-27T15:32:06
2021-04-27T15:32:06
286,818,393
3
0
null
null
null
null
UTF-8
Java
false
false
362
java
package com.hz.web; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * @author hz * @create 2020-12-28 */ @SpringBootApplication public class WebsocketApplication { public static void main(String[] args) { SpringApplication.run(WebsocketApplication.class,args); } }
59f2399cc23ac0816c8baa9e49b4dbcf10662994
2ca5656fd8baa47cf1aa5daa0cfca945b4e4f0da
/app/src/main/java/com/icore/socialnetworklogins/MainActivity.java
a15b398cc174302086740c329256cab02cf40fba
[]
no_license
pavankvch/SocialNetworkLogin
53ed467951312cfcebc3ad72deba73342577a821
331d023566cdb3f72a737b8d4abddf855f207c6a
refs/heads/master
2021-01-12T18:07:19.174322
2016-10-31T14:33:44
2016-10-31T14:33:44
71,331,052
0
0
null
null
null
null
UTF-8
Java
false
false
6,727
java
package com.icore.socialnetworklogins; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.TextView; import com.facebook.AccessToken; import com.facebook.AccessTokenTracker; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.FacebookSdk; import com.facebook.Profile; import com.facebook.ProfileTracker; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; public class MainActivity extends AppCompatActivity { private CallbackManager callbackManager; private TextView textView; private AccessTokenTracker accessTokenTracker; private ProfileTracker profileTracker; LoginButton loginButton; AccessToken accessToken; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); facebookSDKInitialize(); setContentView(R.layout.activity_main); textView=(TextView)findViewById(R.id.textView); loginButton = (LoginButton) findViewById(R.id.login_button); loginButton.setReadPermissions("email"); getLoginDetails(loginButton); } /* Initialize the facebook sdk. And then callback manager will handle the login responses. */ protected void facebookSDKInitialize() { FacebookSdk.sdkInitialize(getApplicationContext()); callbackManager = CallbackManager.Factory.create(); accessTokenTracker = new AccessTokenTracker() { @Override protected void onCurrentAccessTokenChanged( AccessToken oldAccessToken, AccessToken currentAccessToken) { // Set the access token using // currentAccessToken when it's loaded or set. } }; profileTracker = new ProfileTracker() { @Override protected void onCurrentProfileChanged( Profile oldProfile, Profile currentProfile) { // App code Profile profile= Profile.getCurrentProfile(); displayMessage(currentProfile); } }; // If the access token is available already assign it. accessToken = AccessToken.getCurrentAccessToken(); } protected void getLoginDetails(LoginButton login_button){ // Callback registration login_button.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult login_result) { Log.d(" getLoginDetails( )", " "+login_result.getRecentlyGrantedPermissions()); Intent intent = new Intent(getApplicationContext(), HomePage.class); Bundle b = new Bundle(); b.putParcelable("PROFILE", Profile.getCurrentProfile()); intent.putExtras(b); intent.setClass(MainActivity.this, HomePage.class); startActivity(intent); // intent.putExtra("PROFILE", Profile.getCurrentProfile()); // startActivity(intent); } @Override public void onCancel() { } @Override public void onError(FacebookException error) { } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); callbackManager.onActivityResult(requestCode, resultCode, data); // Profile profile = Profile.getCurrentProfile(); // displayMessage(profile); Log.e("data",data.toString()); } @Override protected void onResume() { super.onResume(); } @Override protected void onPause() { super.onPause(); } @Override public void onDestroy() { super.onDestroy(); profileTracker.stopTracking(); accessTokenTracker.stopTracking(); } private void displayMessage(Profile profile){ if(profile != null){ Log.d(" getLoginDetails( )", " Profile Name: "+profile.getFirstName()+" "+profile.getLastName()); textView.setText(profile.getName()); } } } // private FacebookCallback<LoginResult> callback = new FacebookCallback<LoginResult>() { // @Override // public void onSuccess(LoginResult loginResult) { // AccessToken accessToken = loginResult.getAccessToken(); // Profile profile = Profile.getCurrentProfile(); // displayMessage(profile); // } // // @Override // public void onCancel() { // // } // // @Override // public void onError(FacebookException e) { // // } // }; // // public MainActivity() { // // } // callbackManager = CallbackManager.Factory.create(); // // accessTokenTracker= new AccessTokenTracker() { // @Override // protected void onCurrentAccessTokenChanged(AccessToken oldToken, AccessToken newToken) { // // } // }; // // @Override // public void onActivityResult(int requestCode, int resultCode, Intent data) { // super.onActivityResult(requestCode, resultCode, data); // callbackManager.onActivityResult(requestCode, resultCode, data); // // } // // private void displayMessage(Profile profile){ // if(profile != null){ // textView.setText(profile.getName()); // } // } // // @Override // public void onResume() { // super.onResume(); // setContentView(R.layout.activity_main); // Profile profile = Profile.getCurrentProfile(); // displayMessage(profile); // // LoginButton loginButton = (LoginButton)findViewById(R.id.login_button); // textView = (TextView) findViewById(R.id.textView); // // loginButton.setReadPermissions("user_friends"); //// loginButton.setFragment(getApplicationContext()); // loginButton.registerCallback(callbackManager, callback); // // profileTracker = new ProfileTracker() { // @Override // protected void onCurrentProfileChanged(Profile oldProfile, Profile newProfile) { // displayMessage(newProfile); // } // }; // // accessTokenTracker.startTracking(); // profileTracker.startTracking(); // } // // @Override // public void onStop() { // super.onStop(); // accessTokenTracker.stopTracking(); // profileTracker.stopTracking(); // }
d57744b4b6f59600b7055cf33bd12485abd031de
5f2e3796be2bd54e6b52ebb695e5f28ce8844442
/src/main/java/net/ijus/nidi/Configuration.java
03c926e1c7409318813a1c05855f073db6b21e5f
[ "MIT" ]
permissive
IJUS/nidi
a8f498c1ef59a7afcf00fdd5fe9220e4f6a6ffc2
e0f5d35013fd3db396e682d89fa745870c3e6389
refs/heads/master
2016-09-09T18:31:40.613790
2014-12-17T18:05:58
2014-12-17T18:05:58
21,172,051
0
1
null
2014-12-17T18:05:58
2014-06-24T16:23:07
Java
UTF-8
Java
false
false
3,758
java
package net.ijus.nidi; import net.ijus.nidi.builder.ContextBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Created by pfried on 6/16/14. */ public class Configuration { private static final Logger log = LoggerFactory.getLogger(Configuration.class); public static final String CONFIG_PROPERTY_NAME = "nidi.context.class"; public static void setMainContextFromClassName(String configClassName) throws InvalidConfigurationException { ContextHolder.setContext(configureNew(configClassName)); } public static void setMainContextFromClass(Class<? extends ContextConfig> clazz) throws InvalidConfigurationException { ContextHolder.setContext(configureNew(clazz)); } public static void setMainContextFromSystemProperty() throws InvalidConfigurationException { Context ctx = configureNewFromSystemProperty(); ContextHolder.setContext(ctx); } public static Context configureNewFromSystemProperty() throws InvalidConfigurationException { String ctxClass = System.getProperty(CONFIG_PROPERTY_NAME); if (ctxClass == null || ctxClass.length() == 0) { throw new InvalidConfigurationException("The nidi Context could not be created because no System property was set. Set the System property \"nidi.context.class\" to the fully qualified class name of a class that implements ContextConfig"); } return configureNew(ctxClass); } public static Context configureNew(String fqcn) throws InvalidConfigurationException { ContextBuilder builder = new ContextBuilder(); configure(builder, fqcn); return build(builder); } public static Context configureNew(Class<? extends ContextConfig> clazz) throws InvalidConfigurationException { ContextBuilder builder = new ContextBuilder(); configure(builder, clazz); return build(builder); } public static Context configureNew(ContextConfig config) throws InvalidConfigurationException { ContextBuilder builder = new ContextBuilder(); configure(builder, config); return build(builder); } /** * validates the builder, then builds and returns the Context * * @param builder * @return a validated Context */ public static Context build(ContextBuilder builder) throws InvalidConfigurationException { //TODO: validate return builder.build(); } public static void configure(final ContextBuilder builder, final String fqcn) throws InvalidConfigurationException { try { Class configClass = Class.forName(fqcn); configure(builder, configClass); } catch (ClassNotFoundException e) { throw new InvalidConfigurationException("Attempted to configure contextBuilder: " + builder.toString() + " using the class: " + fqcn + ", but the class was not found on the classpath"); } } public static void configure(ContextBuilder builder, final Class configClass) throws InvalidConfigurationException { Object config; try { config = configClass.newInstance(); } catch (Throwable t) { throw new InvalidConfigurationException("Error instantiating the configuration class: " + configClass.getCanonicalName(), t); } if (!(config instanceof ContextConfig)) { throw new InvalidConfigurationException("The Class: " + configClass.getName() + " does not implement ContextConfig"); } configure(builder, (ContextConfig) config); } public static void configure(ContextBuilder builder, ContextConfig config) throws InvalidConfigurationException { config.configure(builder); } }
4e8dd42a856513da1d59feaebf3f8f2d7b4ec855
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/MATH-40b-5-23-Single_Objective_GGA-IntegrationSingleObjective-BasicBlockCoverage-opt/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver_ESTest_scaffolding.java
66a8f0bd3321892716882b9796b2fd53154553ca
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
5,126
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Fri Oct 29 05:32:20 UTC 2021 */ package org.apache.commons.math.analysis.solvers; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class BracketingNthOrderBrentSolver_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.math.analysis.solvers.BracketingNthOrderBrentSolver"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(BracketingNthOrderBrentSolver_ESTest_scaffolding.class.getClassLoader() , "org.apache.commons.math.exception.MathIllegalStateException", "org.apache.commons.math.exception.NumberIsTooSmallException", "org.apache.commons.math.util.Incrementor", "org.apache.commons.math.exception.NullArgumentException", "org.apache.commons.math.exception.util.ExceptionContext", "org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils", "org.apache.commons.math.util.Incrementor$MaxCountExceededCallback", "org.apache.commons.math.util.FastMath", "org.apache.commons.math.util.MathUtils", "org.apache.commons.math.analysis.solvers.BracketingNthOrderBrentSolver$1", "org.apache.commons.math.analysis.solvers.UnivariateRealSolver", "org.apache.commons.math.exception.NotStrictlyPositiveException", "org.apache.commons.math.exception.NotFiniteNumberException", "org.apache.commons.math.analysis.SinFunction", "org.apache.commons.math.util.Precision", "org.apache.commons.math.exception.MathIllegalArgumentException", "org.apache.commons.math.analysis.QuinticFunction$1", "org.apache.commons.math.analysis.solvers.AbstractUnivariateRealSolver", "org.apache.commons.math.analysis.solvers.BaseAbstractUnivariateRealSolver", "org.apache.commons.math.util.FastMath$ExpIntTable", "org.apache.commons.math.exception.MathIllegalNumberException", "org.apache.commons.math.analysis.solvers.BracketedUnivariateRealSolver", "org.apache.commons.math.analysis.solvers.BracketingNthOrderBrentSolver", "org.apache.commons.math.util.FastMathLiteralArrays", "org.apache.commons.math.analysis.UnivariateFunction", "org.apache.commons.math.analysis.SinFunction$1", "org.apache.commons.math.analysis.solvers.AllowedSolution", "org.apache.commons.math.exception.NumberIsTooLargeException", "org.apache.commons.math.exception.MathInternalError", "org.apache.commons.math.analysis.solvers.BaseUnivariateRealSolver", "org.apache.commons.math.exception.TooManyEvaluationsException", "org.apache.commons.math.analysis.SincFunction", "org.apache.commons.math.analysis.XMinus5Function$1", "org.apache.commons.math.analysis.DifferentiableUnivariateFunction", "org.apache.commons.math.exception.util.Localizable", "org.apache.commons.math.analysis.Expm1Function", "org.apache.commons.math.util.Incrementor$1", "org.apache.commons.math.exception.MaxCountExceededException", "org.apache.commons.math.analysis.MonitoredFunction", "org.apache.commons.math.exception.MathArithmeticException", "org.apache.commons.math.analysis.Expm1Function$1", "org.apache.commons.math.analysis.QuinticFunction", "org.apache.commons.math.exception.util.LocalizedFormats", "org.apache.commons.math.analysis.SincFunction$1", "org.apache.commons.math.exception.util.ExceptionContextProvider", "org.apache.commons.math.analysis.XMinus5Function", "org.apache.commons.math.util.FastMath$ExpFracTable", "org.apache.commons.math.exception.NoBracketingException", "org.apache.commons.math.exception.util.ArgUtils" ); } }
cd3dee9e4d46fbcde20cf7ece3f4dda988082f92
088888d3292e2d117e20ec180e3930daba1fc2ef
/src/main/java/com/lsfoo/demo1/service/util/RandomUtil.java
8a356e0328411d303667e0639b3a602ce27f3af1
[]
no_license
lsfoo/jhipster-demo1
c63f5872c5ece22481cc66b2426d14be20c53efc
ae317316b4198ca545e298dd5041ce34f4982a7b
refs/heads/master
2020-03-27T05:48:19.334534
2018-08-25T02:20:49
2018-08-25T02:20:49
146,052,114
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
package com.lsfoo.demo1.service.util; import org.apache.commons.lang3.RandomStringUtils; /** * Utility class for generating random Strings. */ public final class RandomUtil { private static final int DEF_COUNT = 20; private RandomUtil() { } /** * Generate a password. * * @return the generated password */ public static String generatePassword() { return RandomStringUtils.randomAlphanumeric(DEF_COUNT); } /** * Generate an activation key. * * @return the generated activation key */ public static String generateActivationKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); } /** * Generate a reset key. * * @return the generated reset key */ public static String generateResetKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); } }
7abbcb07068c88b952c4b2309a22e6c6be108e27
2ab133fb163bcbc0bd7d293597de9890f6ad42d7
/Main.java
b031ddaef4091115af0f17722261797bef0de7b7
[]
no_license
Xuefeng-Qiao/WIF3003-Museum-Control-Ticketing-System
73b436257580ec8cb5d7ea0a1e3b8ed33fc96116
57534f784a536820089d8f7b96fba67c949b36e0
refs/heads/main
2023-05-30T18:58:32.746158
2021-06-17T05:29:58
2021-06-17T05:29:58
377,713,332
0
0
null
2021-06-17T05:29:59
2021-06-17T05:17:55
Java
UTF-8
Java
false
false
5,185
java
package main; import java.util.LinkedList; import java.util.Scanner; import java.util.concurrent.PriorityBlockingQueue; public class Main { public static volatile int START_TICKET_TIME = 480; public static volatile int START_TIME = 540; public static volatile int END_TICKET_TIME = 1020; public static volatile int END_TIME = 1080; public static volatile int MAX_HOURLY_LIMIT = 100; public static volatile int MAX_DAILY_LIMIT = 900; static volatile int time = START_TICKET_TIME; static TicketingSystem ticketingSystem; static VisitSystem visitSystem; static ExitSystem exitSystem; static LinkedList<Ticket> tickets = new LinkedList<>(); static PriorityBlockingQueue<Ticket> ticketsEntered = new PriorityBlockingQueue<>(); static LinkedList<Ticket> ticketsLeft = new LinkedList<>(); public static boolean input() { Scanner in = new Scanner(System.in); String text = ""; System.out.print("Start ticket time (default 8:00): "); text = in.nextLine(); if (!text.equals("")) { try { text=Integer.parseInt(text)*60+""; START_TICKET_TIME = Integer.parseInt(text); time = START_TICKET_TIME; } catch (Exception ignored) { return false; } } else { START_TICKET_TIME = 480; time = 480; } System.out.print("Start time (default 9:00): "); text = in.nextLine(); if (!text.equals("")) { try { text=Integer.parseInt(text)*60+""; START_TIME = Integer.parseInt(text); } catch (Exception ignored) { return false; } } else { START_TIME = 540; } System.out.print("End ticket time (default 17:00): "); text = in.nextLine(); if (!text.equals("")) { try { text=Integer.parseInt(text)*60+""; END_TICKET_TIME = Integer.parseInt(text); } catch (Exception ignored) { return false; } } else { END_TICKET_TIME = 1020; } System.out.print("End time (default 18:00): "); text = in.nextLine(); if (!text.equals("")) { try { text=Integer.parseInt(text)*60+""; END_TIME = Integer.parseInt(text); } catch (Exception ignored) { return false; } } else { END_TIME = 1080; } // validate if (START_TICKET_TIME > START_TIME) { System.out.println("Start ticket time cannot be later than start time."); return false; } if (START_TIME > END_TIME) { System.out.println("Start time cannot be later than end time."); return false; } if (END_TICKET_TIME > END_TIME) { System.out.println("End ticket time cannot be later than end time."); return false; } System.out.print("Max daily limit (default 900): "); text = in.nextLine(); if (!text.equals("")) { try { MAX_DAILY_LIMIT = Integer.parseInt(text); } catch (Exception ignored) { return false; } } else { MAX_DAILY_LIMIT = 900; } System.out.print("Max hourly limit (default 100): "); text = in.nextLine(); if (!text.equals("")) { try { MAX_HOURLY_LIMIT = Integer.parseInt(text); } catch (Exception ignored) { return false; } } else { MAX_HOURLY_LIMIT = 900; } return true; } public static String timeToString() { String h = Integer.toString(time / 60); if (h.length() == 1) h = "0" + h; String m = Integer.toString(time % 60); if (m.length() == 1) m = "0" + m; return h + m; } public static void main(String[] args) throws InterruptedException { boolean valid = input(); while (!valid) valid = input(); // new ticketing system ticketingSystem = new TicketingSystem(); visitSystem = new VisitSystem(); exitSystem = new ExitSystem(); while (time <= END_TIME) { // threads Thread visitThread = new Thread(visitSystem); Thread exitThread = new Thread(exitSystem); // buy tickets ticketingSystem.buy(); visitThread.start(); exitThread.start(); // sleep Thread.sleep(100); // move time time++; } // report System.out.println("Total tickets sold: " + ticketingSystem.totalTickets); System.out.println("Total tickets visited: " + visitSystem.totalTickets); System.out.println("Total tickets exit: " + ticketsLeft.size()); } }
9f2b122ca088962f9f795343fd329071f88ce6db
8d0a93dc17de1b54f8e6f0f300b812656874c837
/src/main/java/com/ull/Similarity/test.java
b9b57738cba6a06b0848f52211ab591d589185ef
[]
no_license
saiakash5/GraphMeasures
894ff75c8c4eeeb58a1a62589c6c80a21843087c
50e23586acc66eebae35dcb2eb8bdb461a0cc6b2
refs/heads/master
2021-03-24T13:47:25.530387
2017-09-22T17:45:12
2017-09-22T17:45:12
96,808,104
0
0
null
null
null
null
UTF-8
Java
false
false
737
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.ull.Similarity; import java.math.BigDecimal; import java.math.RoundingMode; import org.apache.flink.streaming.api.windowing.time.Time; /** * * @author Akash */ public class test { public static void main(String[] args) throws InterruptedException{ HashFuctionList hashlist = new HashFuctionList(10); for(int i=0; i<100;i++){ System.out.println(hashlist.hash(3, 2)); } System.out.println(Integer.MIN_VALUE); System.out.println(Integer.MAX_VALUE); } }
11ebe78d139f6427e4dd5523a99d52d92a21c98c
851f5b30f6f27966a7a7f7b0e99787bf42dc1119
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/AutoReleSet.java
3d66dd30d9b87da86ae42436e85f743a713aa62c
[]
no_license
Georgiy2035/FTC_11044_2020-2021_TeamCode
ea393a3127243fee3b08c483365107f3cd0a90a5
ab16723ed1b13b8c2611f537ae1ce5c8f8a5ed5d
refs/heads/master
2023-05-06T14:35:28.584768
2021-05-28T16:56:07
2021-05-28T16:56:07
349,987,453
0
0
null
null
null
null
UTF-8
Java
false
false
1,363
java
package org.firstinspires.ftc.teamcode; import android.os.Environment; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.HardwareMap; import org.firstinspires.ftc.robotcore.external.Telemetry; import java.io.File; import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.InputStreamReader; import static android.os.ParcelFileDescriptor.MODE_WORLD_READABLE; @Autonomous(name = "AutoReleSet") public class AutoReleSet extends LinearOpMode { Robot2020 R = new Robot2020(); @Override public void runOpMode() throws InterruptedException { R.gamepadInit(gamepad1, gamepad2); R.initHWD(telemetry, hardwareMap, this); R.init(); R.setNull(); R.SH.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); R.SH.setMode(DcMotor.RunMode.RUN_USING_ENCODER); //R.setNull(); R.holdLift.start(); R.flagLift = false; waitForStart(); while(!isStopRequested()){ R.autoReleSet(); } } }
78ffc12e952d752d55777b731b955ccfbf5b6977
bc02013c8a420c5348a5dc993536a44cf64ed1f0
/src/main/java/vn/edu/vnuk/airlines/controller/PaymentMethodController.java
34be1e35c183c2bc229fede2bf4adb76cebd88ed
[ "MIT" ]
permissive
ModernCoding/vnuk-airlines
84f7254ebec34064c9719503ae82cbee5394af79
1702762d70bde8ff195de85a6a5794224e8df9bc
refs/heads/master
2023-01-10T20:26:46.534881
2019-06-03T04:50:33
2019-06-03T04:50:33
184,721,234
0
1
MIT
2022-12-09T02:53:10
2019-05-03T08:17:15
HTML
UTF-8
Java
false
false
4,907
java
package vn.edu.vnuk.airlines.controller; import java.sql.SQLException; import java.util.ArrayList; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import vn.edu.vnuk.airlines.dao.PaymentMethodDao; import vn.edu.vnuk.airlines.model.PaymentMethod; import vn.edu.vnuk.airlines.model.PlaneManufacturer; @Controller public class PaymentMethodController { private PaymentMethodDao dao; @Autowired public void setPaymentMethodDao(PaymentMethodDao dao) { this.dao = dao; } @RequestMapping("/payment-methods") public String index(Model model, ServletRequest request) throws SQLException{ model.addAttribute("paymentMethod", dao.read()); model.addAttribute("template", "payment-method/index"); return "_layout"; } @RequestMapping("/payment-methods/{id}") public String show(@PathVariable("id") Long id, Model model, ServletRequest request) throws SQLException{ model.addAttribute("paymentMethod", dao.read(id)); model.addAttribute("template", "payment-method/show"); return "_layout"; } @RequestMapping("/payment-methods/new") public String add(PlaneManufacturer planeManufacturer, Model model, @ModelAttribute("fieldErrors") ArrayList<FieldError> fieldErrors){ for(FieldError fieldError : fieldErrors) { model.addAttribute( String.format("%sFieldError", fieldError.getField()), fieldError.getDefaultMessage() ); } model.addAttribute("template", "payment-method/new"); return "_layout"; } @RequestMapping("/payment-methods/{id}/edit") public String edit( @RequestParam(value="backToShow", defaultValue="false") Boolean backToShow, @PathVariable("id") Long id, PaymentMethod paymentMethod, Model model, ServletRequest request, @ModelAttribute("fieldErrors") ArrayList<FieldError> fieldErrors ) throws SQLException{ for(FieldError fieldError : fieldErrors) { model.addAttribute( String.format("%sFieldError", fieldError.getField()), fieldError.getDefaultMessage() ); } model.addAttribute("backToShow", backToShow); model.addAttribute("urlCompletion", backToShow ? String.format("/%s", id) : ""); model.addAttribute("paymentMethod", dao.read(id)); model.addAttribute("template", "payment-method/edit"); return "_layout"; } @RequestMapping(value="/payment-methods", method=RequestMethod.POST) public String create( @Valid PaymentMethod paymentMethod, BindingResult bindingResult, ServletRequest request, RedirectAttributes redirectAttributes ) throws SQLException{ if (bindingResult.hasErrors()) { redirectAttributes.addFlashAttribute("fieldErrors", bindingResult.getAllErrors()); return "redirect:/payment-methods/new"; } dao.create(paymentMethod); return "redirect:/payment-methods"; } @RequestMapping(value="/payment-methods/{id}", method=RequestMethod.PATCH) public String update( @RequestParam(value="backToShow", defaultValue="false") Boolean backToShow, @PathVariable("id") Long id, @Valid PaymentMethod paymentMethod, BindingResult bindingResult, ServletRequest request, RedirectAttributes redirectAttributes ) throws SQLException{ if (bindingResult.hasErrors()) { redirectAttributes.addFlashAttribute("fieldErrors", bindingResult.getAllErrors()); return String.format("redirect:/payment-methods/%s/edit", id); } dao.update(paymentMethod); return backToShow ? String.format("redirect:/payment-methods/%s", id) : "redirect:/payment-methods"; } // delete with ajax @RequestMapping(value="/payment-methods/{id}", method = RequestMethod.DELETE) public void delete(@PathVariable("id") Long id, ServletRequest request, HttpServletResponse response) throws SQLException { dao.delete(id); response.setStatus(200); } }
62de91c36b71e11f7d45622f06f9fc5fc76e171b
26832fe71c22a1e65c941708a58b3ca13f17b0ed
/src/main/java/org/baize/dao/manager/PersistPlayerMapper.java
9c9390c076f65d308c928e034cc05fadb45b1fe0
[]
no_license
zglbig/dao
775691a5d251641f825607040ccc9b03ec6afabf
a5f51509f4947cd31c8f04737df8a111bde30005
refs/heads/master
2021-07-26T23:15:06.420123
2017-11-07T02:57:28
2017-11-07T02:57:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,418
java
package org.baize.dao.manager; import com.alibaba.fastjson.JSON; import org.apache.commons.lang3.StringUtils; import org.baize.dao.model.*; /** * 作者: 白泽 * 时间: 2017/11/6. * 描述: */ public class PersistPlayerMapper { private int id; private String account; private String playerInfo; private String weath; private String shop; public PersistPlayerMapper() { } public PersistPlayerMapper(PlayerEntity entity){ this.id = entity.getId(); this.account = entity.getPlayerInfo().getAccount(); this.playerInfo = JSON.toJSONString(entity.getPlayerInfo()); this.weath = JSON.toJSONString(entity.getWeath()); this.shop = JSON.toJSONString(entity.getShop()); } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public String getPlayerInfo() { return playerInfo; } public void setPlayerInfo(String playerInfo) { this.playerInfo = playerInfo; } public String getWeath() { return weath; } public void setWeath(String weath) { this.weath = weath; } public String getShop() { return shop; } public void setShop(String shop) { this.shop = shop; } public PlayerEntity playerEntity(){ return new PlayerEntity(this); } public Persist persist(Persist p){ Persist persist = null; String str = obj(p); if(StringUtils.isEmpty(str)) return null; persist = JSON.parseObject(str,p.getClass()); persist.setId(id); return persist; } public String persistStr(Persist p){ String perSrt = "{}"; if(p == null) return perSrt; perSrt = JSON.toJSONString(p); return perSrt; } private String obj(Persist p){ String beanName = p.getClass().getSimpleName(); if(StringUtils.equalsIgnoreCase(beanName,"playerInfo")) return this.playerInfo; else if(StringUtils.equalsIgnoreCase(beanName,"weath")) return this.weath; else if(StringUtils.equalsIgnoreCase(beanName,"shop")) return this.shop; else return null; } }
f5da223d85c4ffd09fa137a11bb02cfc1f6f8e46
5547102ac729f8a0ce393c12c12af523dc60fc29
/src/main/java/com/baidu/oped/iop/m4/mvc/rest/conf/PolicyController.java
50b99597029e4206e8ffda5ca8e35a4bf8a55e37
[]
no_license
masonmei/meu-gateway
a2e133df2d8180d5d790aff66e13fb1a74d62367
e01d9aa3533a5b4e1d0c544b7c072d16afecea33
refs/heads/master
2021-01-10T07:21:32.158398
2016-04-19T13:58:07
2016-04-19T13:58:07
55,154,616
0
0
null
null
null
null
UTF-8
Java
false
false
3,243
java
package com.baidu.oped.iop.m4.mvc.rest.conf; import static com.baidu.oped.iop.m4.utils.ProjectConstans.Config.APP_NAME; import static com.baidu.oped.iop.m4.utils.ProjectConstans.Config.CONF_POLICY_MAPPING_PREFIX; import static com.baidu.oped.iop.m4.utils.ProjectConstans.Config.PRODUCT_NAME; import static com.baidu.oped.iop.m4.utils.ProjectConstans.Version.API_V1; import static org.springframework.web.bind.annotation.RequestMethod.DELETE; import static org.springframework.web.bind.annotation.RequestMethod.GET; import static org.springframework.web.bind.annotation.RequestMethod.POST; import static org.springframework.web.bind.annotation.RequestMethod.PUT; import com.baidu.oped.iop.m4.mvc.dto.alert.PolicyDto; import com.baidu.oped.iop.m4.mvc.dto.conf.alert.MergedPolicy; import com.baidu.oped.iop.m4.service.conf.PolicyService; import com.baidu.oped.iop.m4.utils.PageData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.MultiValueMap; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; /** * @author mason */ @RestController @RequestMapping(value = API_V1 + CONF_POLICY_MAPPING_PREFIX) public class PolicyController { private static final String POLICY = "policyName"; private static final String POLICY_PATH = "{" + POLICY + "}"; @Autowired private PolicyService policyService; @RequestMapping(method = GET) PageData<MergedPolicy> search(@PathVariable(PRODUCT_NAME) String productName, @PathVariable(APP_NAME) String appName, @RequestParam MultiValueMap<String, String> queryMap) { return policyService.search(productName, appName, queryMap) .getData(); } @RequestMapping(value = POLICY_PATH, method = GET) MergedPolicy find(@PathVariable(PRODUCT_NAME) String productName, @PathVariable(APP_NAME) String appName, @PathVariable(POLICY) String policyName) { return policyService.find(productName, appName, policyName) .getData(); } @RequestMapping(method = POST) MergedPolicy create(@PathVariable(PRODUCT_NAME) String productName, @PathVariable(APP_NAME) String appName, @RequestBody PolicyDto dto) { return policyService.create(productName, appName, dto) .getData(); } @RequestMapping(value = POLICY_PATH, method = PUT) MergedPolicy update(@PathVariable(PRODUCT_NAME) String productName, @PathVariable(APP_NAME) String appName, @PathVariable(POLICY) String policyName, @RequestBody PolicyDto dto) { return policyService.update(productName, appName, policyName, dto) .getData(); } @RequestMapping(value = POLICY_PATH, method = DELETE) MergedPolicy delete(@PathVariable(PRODUCT_NAME) String productName, @PathVariable(APP_NAME) String appName, @PathVariable(POLICY) String policyName) { return policyService.delete(productName, appName, policyName) .getData(); } }
9fc79eae1d7fd945c0199b70161eb76c662d7cc4
e5f4b6830622337b09f9882ef4ffafc2fb37e455
/src/rentcar/controller/handler/admin/rent/AdminRentDeleteHandler.java
c66346f7d5a3f1057941044e6de2122daf87caf0
[]
no_license
DaeguIT-MinSuKim/yi_java4st_2team_web
0f3734b07546494e20d89ec804288ab4c4d86fc4
d6fb6acc42f9d232af5caaa0f1815005964fad10
refs/heads/master
2023-01-10T20:06:04.416458
2020-11-10T01:31:13
2020-11-10T01:31:13
296,256,153
3
3
null
null
null
null
UTF-8
Java
false
false
885
java
package rentcar.controller.handler.admin.rent; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rentcar.controller.Command; import rentcar.dto.Rent; import rentcar.service.RentService; import rentcar.utils.Paging; public class AdminRentDeleteHandler implements Command { private RentService rentService = new RentService(); @Override public String process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int rentNo = Integer.parseInt(request.getParameter("rentNo")); // System.out.println("rentNo>>>>>>" + rentNo); int res = rentService.updateRent_isRent(rentNo); // 삭제하려고 했으나 반납유무 y로 수정함 response.getWriter().print(res); return null; } }
e70d0cde07ee93e6b0de436c8d5a3d754fb3d530
2bc2eadc9b0f70d6d1286ef474902466988a880f
/tags/mule-3.0.0-M2-20090808/modules/xml/src/test/java/org/mule/transformers/xml/AbstractXmlTransformerTestCase.java
625d250bf2496cae6a6666cf16c78ff8c6141efc
[]
no_license
OrgSmells/codehaus-mule-git
085434a4b7781a5def2b9b4e37396081eaeba394
f8584627c7acb13efdf3276396015439ea6a0721
refs/heads/master
2022-12-24T07:33:30.190368
2020-02-27T19:10:29
2020-02-27T19:10:29
243,593,543
0
0
null
2022-12-15T23:30:00
2020-02-27T18:56:48
null
UTF-8
Java
false
false
2,035
java
/* * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.module.xml.util.XMLUtils; import org.mule.transformer.AbstractTransformerTestCase; import javax.xml.transform.TransformerFactoryConfigurationError; import org.custommonkey.xmlunit.XMLUnit; import org.w3c.dom.Document; /** * Use this superclass if you intend to compare Xml contents. */ public abstract class AbstractXmlTransformerTestCase extends AbstractTransformerTestCase { protected AbstractXmlTransformerTestCase() { super(); XMLUnit.setIgnoreWhitespace(true); XMLUnit.setXSLTVersion("2.0"); try { XMLUnit.getTransformerFactory(); } catch (TransformerFactoryConfigurationError e) { XMLUnit.setTransformerFactory(XMLUtils.TRANSFORMER_FACTORY_JDK5); } } @Override public boolean compareResults(Object expected, Object result) { if (expected instanceof Document && result instanceof Document) { return XMLUnit.compareXML((Document)expected, (Document)result).similar(); } else if (expected instanceof String && result instanceof String) { try { String expectedString = this.normalizeString((String)expected); String resultString = this.normalizeString((String)result); return XMLUnit.compareXML(expectedString, resultString).similar(); } catch (Exception ex) { return false; } } // all other comparisons are passed up return super.compareResults(expected, result); } }
[ "rossmason@bf997673-6b11-0410-b953-e057580c5b09" ]
rossmason@bf997673-6b11-0410-b953-e057580c5b09
194f39f4c4a70869e1ce7ad349908e04f0b2a3e4
c44dccf7e1f3df8edf1039333aa4460401357b85
/Tablon/junio2013/Anuncio.java
27c7a121187b4f0627c097eb143147fcc54095d5
[]
no_license
luisfrap/TablonDeAnuncios
ea2ad526d9f6e59ff3673ca712b3d507a6f9e25a
fda4addfdecd6124323d248131a3b9b2cdd4fbec
refs/heads/master
2020-12-24T18:41:34.383383
2016-05-26T15:55:24
2016-05-26T15:55:24
59,763,472
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
package junio2013; /** * Created with IntelliJ IDEA. * User: anton_000 * Date: 11/06/13 * Time: 8:42 * To change this template use File | Settings | File Templates. */ public class Anuncio { public String titulo_; public String texto_; public String anunciante_; public Anuncio(String titulo, String texto, String anunciante) { titulo_ = titulo; texto_ = texto; anunciante_ = anunciante; } }
130b2871abf1b6f5f58cf09421f1ff927766f55f
0d8da8676c77c7f3deb12f9eb146736674000ec3
/src/main/java/com/hwua/mapper/MemberMapper.java
e08d07a9a131c380c41d51b5bb7793b9a06d771c
[]
no_license
869100035/crm_project
889dfabddb80eba5f5be327e98ac661730917030
55d1a5baaa8632a056d4d9bdb52187c5f27042fd
refs/heads/master
2022-02-24T08:42:42.482602
2020-03-19T02:46:15
2020-03-19T02:46:15
245,120,672
0
0
null
2022-02-09T22:05:49
2020-03-05T09:30:27
JavaScript
UTF-8
Java
false
false
204
java
package com.hwua.mapper; import com.hwua.pojo.Member; import org.springframework.stereotype.Component; @Component public interface MemberMapper { Member findMemberById(String id)throws Exception; }
d3002b8940601770c492f5c776ba8b8fa0abd2a7
2573e46de236be1625c560df6bd9dbac4f4fd596
/src/main/java/com/ittedu/os/edu/controller/website/WebSiteImagesTypeController.java
77d67953cf71bb56ba5883ab272b81abebb8d0b3
[]
no_license
ITTrain/ITTrainNet
4b5a1f48f28f3ec5a92bc458c93e89e0c8886c42
dffbe7eaed25a4ed9423fb7718331fb452ad0b0b
refs/heads/master
2022-12-23T07:12:59.697442
2018-12-26T13:02:47
2018-12-26T13:02:47
160,663,892
0
0
null
2022-12-16T01:41:52
2018-12-06T11:16:13
JavaScript
UTF-8
Java
false
false
3,331
java
package com.ittedu.os.edu.controller.website; import com.ittedu.os.common.controller.BaseController; import com.ittedu.os.edu.entity.website.WebSiteImagesType; import com.ittedu.os.edu.service.website.WebSiteImagesTypeService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 广告图类型 * @author www.ittedu.com */ @Controller @RequestMapping("/admin/imagetype") public class WebSiteImagesTypeController extends BaseController{ private static Logger logger = LoggerFactory.getLogger(WebSiteImagesTypeController.class); @Autowired private WebSiteImagesTypeService webSiteImagesTypeService; @InitBinder({"type"}) public void intitType(WebDataBinder binder){ binder.setFieldDefaultPrefix("type."); } /** * 查询图片类型列表 * @param request * @return ModelAndView */ @RequestMapping("/getlist") public ModelAndView queryImageList(HttpServletRequest request){ ModelAndView model =new ModelAndView(); try{ model.setViewName(getViewPath("/admin/website/images/imageType-list")); List<WebSiteImagesType> typeList = webSiteImagesTypeService.queryAllTypeList(); model.addObject("typeList", typeList); }catch (Exception e) { model.setViewName(this.setExceptionRequest(request, e)); logger.error("queryImageList()--error",e); } return model; } /** * 删除图片类型 * @param request * @param typeId 图片类型ID * @return ModelAndView */ @RequestMapping("/deletetype/{typeId}") public ModelAndView deleteType(HttpServletRequest request,@PathVariable("typeId") int typeId){ ModelAndView model =new ModelAndView(); try{ model.setViewName("redirect:/admin/imagetype/getlist"); webSiteImagesTypeService.deleteTypeById(typeId); }catch (Exception e) { model.setViewName(this.setExceptionRequest(request, e)); logger.error("deleteType()--error",e); } return model; } /** * 修改图片类型 * @param type * @return Map<String,Object> */ @RequestMapping("/updateType") @ResponseBody public Map<String,Object> updateType(@ModelAttribute("type") WebSiteImagesType type){ Map<String,Object> json = new HashMap<String,Object>(); try{ webSiteImagesTypeService.updateType(type); json = this.setJson(true, null, null); }catch (Exception e) { this.setAjaxException(json); logger.error("updateType()--error",e); } return json; } /** * 添加图片类型 * @param request * @param type * @return ModelAndView */ @RequestMapping("/addtype") public ModelAndView addType(HttpServletRequest request,@ModelAttribute("type") WebSiteImagesType type){ ModelAndView model =new ModelAndView(); try{ model.setViewName("redirect:/admin/imagetype/getlist"); type.setTypeName("新建图片类型"); webSiteImagesTypeService.createImageType(type); }catch (Exception e) { model.setViewName(this.setExceptionRequest(request, e)); logger.error("addType()--error",e); } return model; } }
68f2a99f7a33d241420a14cc37033d410b5749ce
6680767097a1ea2f27bb4786cb0b82f7bccc3674
/httplib/src/main/java/com/congxiaoyao/httplib/response/TaskRsp.java
48ed561716c14883f487222ea743e95413c9b840
[]
no_license
congxiaoyao/Xber-Driver
0e64e7d508920885f29946301e4a0aedde81cece
b613037b4357fcf7e0be30020e0b1b249de7d8f5
refs/heads/master
2021-01-20T03:17:00.709447
2018-09-09T08:22:07
2018-09-09T08:22:07
89,519,454
0
0
null
null
null
null
UTF-8
Java
false
false
3,225
java
package com.congxiaoyao.httplib.response; import java.util.Date; /** * Created by Jaycejia on 2017/2/18. */ public class TaskRsp { private Long taskId; private Long carId; private Date startTime; private Spot startSpot; private Date endTime; private Spot endSpot; private String content; private Long createUser; private Date createTime; private Date realStartTime; private Date realEndTime; private Integer status; private String note; public TaskRsp(Task task) { this.taskId = task.getTaskId(); this.startTime = task.getStartTime(); this.endTime = task.getEndTime(); this.content = task.getContent(); this.createUser = task.getCreateUser(); this.createTime = task.getCreateTime(); this.realStartTime = task.getRealStartTime(); this.realEndTime = task.getRealEndTime(); this.status = task.getStatus(); this.note = task.getNote(); } public Long getTaskId() { return taskId; } public void setTaskId(Long taskId) { this.taskId = taskId; } public Date getStartTime() { return startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } public Spot getStartSpot() { return startSpot; } public void setStartSpot(Spot startSpot) { this.startSpot = startSpot; } public Date getEndTime() { return endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } public Spot getEndSpot() { return endSpot; } public void setEndSpot(Spot endSpot) { this.endSpot = endSpot; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Long getCreateUser() { return createUser; } public void setCreateUser(Long createUser) { this.createUser = createUser; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getRealStartTime() { return realStartTime; } public void setRealStartTime(Date realStartTime) { this.realStartTime = realStartTime; } public Date getRealEndTime() { return realEndTime; } public void setRealEndTime(Date realEndTime) { this.realEndTime = realEndTime; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public String getNote() { return note; } public void setNote(String note) { this.note = note; } public Long getCarId() { return carId; } public void setCarId(Long carId) { this.carId = carId; } @Override public String toString() { return "TaskRsp{" + "taskId=" + taskId + ", content='" + content + '\'' + ", status=" + status + ", note='" + note + '\'' + '}'; } }
14497df1382819a0d8ab99d142fcb7ed3f22ba70
29ee2684847512e8ce9b6b9592a56e2b697ef0e8
/src/main/java/com/librarymanagement/model/UserDetail.java
ed93979b28e2537a474ba73ba16a2f9e9f57bc4e
[]
no_license
SachiAnn90/Library-Management
d9472059655bcb7a885dafaff3a738a36c4f58fb
a87a5da860a2107d397e65b94f1cce7d8c09444f
refs/heads/master
2022-12-23T14:42:39.882670
2020-10-07T13:53:20
2020-10-07T13:53:20
302,048,718
0
0
null
null
null
null
UTF-8
Java
false
false
695
java
package com.librarymanagement.model; public class UserDetail { private String userName; private String password; private String role; private boolean enabled; public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } }
0097aaab2726487868b2124a760b825c5139aa95
f9242e9068e5d103d8a90a1b5a7b84e9aa8bf09f
/Smart_Jobs/src/main/java/com/smart_jobs/repository/EmployerRepository.java
82ff2d13c567de90a84fc6ef340ee59de2867314
[]
no_license
rohit13-sys/smart_jobs
a5e74d4c95ee1270a0b43c171a39d00eb0f0d6ea
8bffb1a1a4f41324ee91b947f4ab16ffd8b639fd
refs/heads/main
2023-08-19T11:09:34.581575
2021-09-10T05:48:24
2021-09-10T05:48:24
403,939,223
3
0
null
2021-09-10T06:02:49
2021-09-07T10:40:37
Java
UTF-8
Java
false
false
367
java
package com.smart_jobs.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.smart_jobs.web.model.Employer; public interface EmployerRepository extends JpaRepository<Employer,Long>{ //@Query("select e from Employer e where e.login = ?1") Employer findByLogin_UserId(String email); int countByCompany_CompanyName(String name); }
1f638a3c97fa2a17d1cdfafa7e03d15b6e0f8738
1c80224bc1fe4290267b7e681cff6ae00b87d36a
/src/main/java/org/spring/aop/aspectj/AspectJBeforeAdvice.java
3fe65ceb9ebb13f5bab1b2427a18a3c5e9043548
[]
no_license
DowsonMok/MySpring
b2311b24b7b2df368250aea7646e2629130515f8
7b8ade02b8d06cfeb46e32a8ddc77c875ca61188
refs/heads/master
2020-06-06T19:01:43.056201
2019-06-07T00:15:36
2019-06-07T00:15:36
192,829,128
1
0
null
2019-06-20T01:43:26
2019-06-20T01:43:25
null
UTF-8
Java
false
false
624
java
package org.spring.aop.aspectj; import java.lang.reflect.Method; import org.aopalliance.intercept.MethodInvocation; import org.spring.aop.config.AspectInstanceFactory; //前置通知 public class AspectJBeforeAdvice extends AbstractAspectJAdvice { public AspectJBeforeAdvice(Method adviceMethod,AspectJExpressionPointcut pointcut,AspectInstanceFactory adviceObjectFactory){ super(adviceMethod,pointcut,adviceObjectFactory); } public Object invoke(MethodInvocation mi) throws Throwable { //例如: 调用TransactionManager的start方法 this.invokeAdviceMethod(); Object o = mi.proceed(); return o; } }
[ "goodMorning_zhifeng" ]
goodMorning_zhifeng
c46618ccd348d9a4de9b6cd934160e48bf167529
4434525effc52bfcf25f5860691f174293e1209e
/src/main/java/controller/struts/customComponent/typeConverter/LocalDateTimeConverter.java
090b5a1812724679ac85fb82b09005e5286cca28
[]
no_license
just-dude/medicalhotline
79b4e6f9acdf085f0769a7baca3292a21b458b26
a28993cd60f9a62243609e75c724e9cd9fdbed39
refs/heads/master
2020-03-28T02:48:24.889220
2018-09-06T01:07:06
2018-09-06T01:07:06
147,597,967
0
0
null
null
null
null
UTF-8
Java
false
false
1,493
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package controller.struts.customComponent.typeConverter; import com.opensymphony.xwork2.conversion.TypeConversionException; import org.apache.struts2.util.StrutsTypeConverter; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Map; /** * * @author SuslovAI */ public class LocalDateTimeConverter extends StrutsTypeConverter { private final static String INPUT_PATTERN = "dd.MM.yyyy HH:mm:ss"; private final static String OUTPUT_PATTERN= "dd.MM.yyyy HH:mm:ss"; @Override public Object convertFromString(Map context, String[] values, Class toClass) { DateTimeFormatter fmt; LocalDateTime localDateTime; try{ localDateTime= LocalDateTime.parse(values[0],DateTimeFormatter.ofPattern(INPUT_PATTERN)); } catch(Exception e){ String exceptioDescription="Invalid input: "+values[0]+" is not match to format: "+INPUT_PATTERN; throw new TypeConversionException(exceptioDescription,e); } return localDateTime; } @Override public String convertToString(Map context, Object o) { String localDateStr = ((LocalDateTime)o).format(DateTimeFormatter.ofPattern(OUTPUT_PATTERN)); return localDateStr; } }
954886b290813ecf357f7681e1d6ba0bca1c18dc
552917dd4d33154a50fe17e43b9c3fa432296603
/src/uk/co/chrisconnor/aoc/AdventOfCode.java
af1ff74915bea9ecab2f56eaacf8412f2bdd6aed
[]
no_license
cjconnor24/AdventOfCode2020
31331627404a948cea27f18ccedd30ca3a776c4f
e0d9af3011b6c7e108461729005767467d1716cc
refs/heads/master
2023-01-24T08:41:09.306326
2020-12-08T08:35:08
2020-12-08T08:35:08
317,623,999
0
0
null
null
null
null
UTF-8
Java
false
false
1,560
java
package uk.co.chrisconnor.aoc; public class AdventOfCode { public static void main(String[] args) { System.out.println("---------------"); System.out.println("Day One Answers"); System.out.println("---------------"); DayOne dayOne = new DayOne("day1.txt"); System.out.format("Answer part one:\t%d\n", dayOne.getPartOneAnswer()); System.out.format("Answer part two:\t%d\n", dayOne.getPartTwoAnswer()); System.out.println("---------------"); System.out.println("Day Two Answers"); System.out.println("---------------"); DayTwo dayTwo = new DayTwo("day2.txt"); System.out.format("Answer part one:\t%d\n", dayTwo.getPartOneAnswer()); System.out.format("Answer part two:\t%d\n", dayTwo.getPartTwoAnswer()); System.out.println("---------------"); System.out.println("Day Three Answers"); System.out.println("---------------"); DayThree dayThree = new DayThree("day3.txt"); System.out.format("Working part two:\t%d, %d, %d, %d, %d\n", dayThree.getPartOneAnswer(1, 1), dayThree.getPartOneAnswer(3, 1), dayThree.getPartOneAnswer(5, 1), dayThree.getPartOneAnswer(7, 1), dayThree.getPartOneAnswer(1, 2) ); System.out.format("Part two answer:\t%d",dayThree.getPartTwoAnswer()); DayFour dayFour = new DayFour("day4.txt"); System.out.println("There are valid passports: "+dayFour.getPartOneAnswer()); } }
84101a3adac016d67f8356b02c0c2f98274d22b1
26afd2fc42f0b8f55ae7e0be4ade41609b4206d0
/java-project/src/test/java/AppTest.java
fbf70364a8a7b45f7931f87075aa0728f3923fbe
[]
no_license
skysuk422/bitcamp
3586c83b55f7a1f5e62d0d9c1ec0768862bf7544
26c3a24d3cf1f0b2f373f118c016a1547365d906
refs/heads/master
2021-05-05T11:06:49.619867
2017-12-26T09:06:49
2017-12-26T09:06:49
104,423,417
0
0
null
null
null
null
UTF-8
Java
false
false
39
java
public class AppTest { }
81d2adde83a87a4fe4b3f1a9ea19b57012a6d9fe
e4020f36bd006131f51f8fe66b38867ca26dcecb
/src/main/java/com/example/demo/entities/OrderLine.java
e3d8298c605e2376d7c847f3a0d70dbb9c038d66
[]
no_license
onssfar/backPfemain-main
88937623930c26224d746f2f1a43f6cbf9e730f8
b467caae3775d1a5c7cbda327af646fe5d8fef8c
refs/heads/master
2023-04-22T05:14:18.854340
2021-05-02T22:29:27
2021-05-02T22:29:27
363,763,263
0
0
null
null
null
null
UTF-8
Java
false
false
1,387
java
package com.example.demo.entities; import lombok.*; import javax.persistence.*; import java.io.Serializable; import java.util.Date; @Data @Entity @Setter @Getter @AllArgsConstructor @ToString public class OrderLine implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "line_id") private Long id; @Column(name = "ligne_reference") private String unitReference; @Column(name = "unit_price") private float unitPrice; @Column(name = "quantity") private int quantity; @Column(name = "itemName") private String itemName; @Column(name = "ligne_statut") private String statut; //entre ligneCommande et fournisseur @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "idFournisseur") private Fournisseur fournisseur_id; // mappping d'une relation commande et orderLine // @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) //@JoinColumn(name = "Order_Id") //private Commande Order_Id; public OrderLine() { } public OrderLine(String unitReference, float unitPrice, int quantity, String itemName, String statut ) { this.unitReference = unitReference; this.unitPrice = unitPrice; this.quantity = quantity; this.itemName = itemName; this.statut = statut; } }
ba52aed6115107b3216418451a641fb5bb0f8c2a
a27bb22e29262fe3aab2533134404552f78373a4
/uk.ac.lancs.comp.vmlstar/src/uk/ac/lancs/comp/vmlstar/model/vmlstar/provider/CoreModelRefItemProvider.java
b0c8cc9ea37af52c13fdf05dc1344f6e3154a547
[ "MIT" ]
permissive
szschaler/vml_star
79036378c703894dcc9b9fd0e3531cf0eea78ed3
79733af9cf353cb2e8376ea808dbc115a8c7a8c8
refs/heads/master
2021-01-22T03:01:19.322891
2015-09-22T16:11:16
2015-09-22T16:11:16
42,944,217
0
0
null
null
null
null
UTF-8
Java
false
false
7,966
java
/** * <copyright> * </copyright> * * $Id$ */ package uk.ac.lancs.comp.vmlstar.model.vmlstar.provider; import java.util.Collection; import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.ResourceLocator; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemProviderAdapter; import org.eclipse.emf.edit.provider.ViewerNotification; import uk.ac.lancs.comp.vmlstar.model.vmlstar.CoreModelRef; import uk.ac.lancs.comp.vmlstar.model.vmlstar.VmlstarFactory; import uk.ac.lancs.comp.vmlstar.model.vmlstar.VmlstarPackage; /** * This is the item provider adapter for a {@link uk.ac.lancs.comp.vmlstar.model.vmlstar.CoreModelRef} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class CoreModelRefItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CoreModelRefItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addCoreURIPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Core URI feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addCoreURIPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_CoreModelRef_coreURI_feature"), getString("_UI_PropertyDescriptor_description", "_UI_CoreModelRef_coreURI_feature", "_UI_CoreModelRef_type"), VmlstarPackage.Literals.CORE_MODEL_REF__CORE_URI, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS); } return childrenFeatures; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EStructuralFeature getChildFeature(Object object, Object child) { // Check the type of the specified child object and return the proper feature to use for // adding (see {@link AddCommand}) it as a child. return super.getChildFeature(object, child); } /** * This returns CoreModelRef.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/CoreModelRef")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((CoreModelRef)object).getCoreURI(); return label == null || label.length() == 0 ? getString("_UI_CoreModelRef_type") : getString("_UI_CoreModelRef_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(CoreModelRef.class)) { case VmlstarPackage.CORE_MODEL_REF__CORE_URI: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case VmlstarPackage.CORE_MODEL_REF__ELEMENTS: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createVmlModel())); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createFeatureModelRef())); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createFeature())); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createCoreModelRef())); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createConcern())); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createVariant())); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createPointCutReference())); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createPointCut())); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createPCEAndOperator())); newChildDescriptors.add (createChildParameter (VmlstarPackage.Literals.CORE_MODEL_REF__ELEMENTS, VmlstarFactory.eINSTANCE.createPCEOrOperator())); } /** * Return the resource locator for this item provider's resources. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public ResourceLocator getResourceLocator() { return VmlEditPlugin.INSTANCE; } }
5d080d984d21298e8c07cb2f10b95f278462eaf3
8117fb5f96bd117a844d8ab6ba986dfffd976bbb
/de.unisiegen.gtitool.ui/source/de/unisiegen/gtitool/ui/preferences/listener/WordModeChangedListener.java
698951258dca0e7528aaf897cc7a22e0a6b82f60
[ "MIT" ]
permissive
cbsa-informatik-uni-siegen/gtitool
1bcb4bd8f15630b581f9f9a1faa542748de96b13
d3d8d9db1737f2d1cd7b0c2efa24d7f77e3e32da
refs/heads/master
2021-01-02T08:32:20.336020
2011-08-29T15:24:21
2011-08-29T15:24:21
2,287,830
1
1
null
null
null
null
UTF-8
Java
false
false
569
java
package de.unisiegen.gtitool.ui.preferences.listener; import java.util.EventListener; import de.unisiegen.gtitool.core.entities.Word; import de.unisiegen.gtitool.ui.preferences.item.WordModeItem; /** * The listener interface for receiving {@link Word} mode changes. * * @author Christian Fehler * @version $Id$ */ public interface WordModeChangedListener extends EventListener { /** * Invoked when the {@link Word} mode changed. * * @param newValue The new {@link WordModeItem}. */ public void wordModeChanged ( WordModeItem newValue ); }
f1f0a45130644a01a1c8cca9bb0bd36ed8e763f2
62cb6d6c13d4576cf44c10e407d3a13193d28de1
/gateway/src/main/java/com/example/microservices/gateway/GatewayApplication.java
a6920fb7decc2deff7c1c7d321a6a66b6d232a47
[]
no_license
Serg-Maximchuk/microservices-demo
740866356bc572d8deb609a3dda6395ff94c1076
5c7d07362f8385628384f80036fcc22bb17cf862
refs/heads/master
2020-03-19T16:37:15.851942
2018-07-17T05:46:43
2018-07-17T05:46:43
136,721,873
0
0
null
null
null
null
UTF-8
Java
false
false
515
java
package com.example.microservices.gateway; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; @EnableZuulProxy @EnableDiscoveryClient @SpringBootApplication public class GatewayApplication { public static void main(String[] args) { SpringApplication.run(GatewayApplication.class, args); } }
98af139638be2c8ad6c0caa8e794263dcc22189f
1ca86d5d065372093c5f2eae3b1a146dc0ba4725
/spring-swagger-codegen/spring-openapi-generator-api-client/src/main/java/com/surya/petstore/client/model/Tag.java
dcaba1a54bbedb83ff96f2484ae63e48f7a947c8
[]
no_license
Suryakanta97/DemoExample
1e05d7f13a9bc30f581a69ce811fc4c6c97f2a6e
5c6b831948e612bdc2d9d578a581df964ef89bfb
refs/heads/main
2023-08-10T17:30:32.397265
2021-09-22T16:18:42
2021-09-22T16:18:42
391,087,435
0
1
null
null
null
null
UTF-8
Java
false
false
2,973
java
/* * Swagger Petstore * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * The version of the OpenAPI document: 1.0.3 * Contact: [email protected] * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package com.surya.petstore.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.util.Objects; import io.swagger.annotations.ApiModelProperty; /** * Tag */ @JsonPropertyOrder({ Tag.JSON_PROPERTY_ID, Tag.JSON_PROPERTY_NAME }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-03-15T06:14:01.568992-05:00[America/Chicago]") public class Tag { public static final String JSON_PROPERTY_ID = "id"; private Long id; public static final String JSON_PROPERTY_NAME = "name"; private String name; public Tag id(Long id) { this.id = id; return this; } /** * Get id * @return id **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Tag name(String name) { this.name = name; return this; } /** * Get name * @return name **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Tag tag = (Tag) o; return Objects.equals(this.id, tag.id) && Objects.equals(this.name, tag.name); } @Override public int hashCode() { return Objects.hash(id, name); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Tag {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
4f27fb5a46861976242b3736e067ef60915a33f9
23e35a4a6857f5caa05d413674df481f1f2ccea5
/LabWork/src/Main/EmployeeIDGenerator.java
ad5679925796018154e80347afd4f8b7f44611d9
[]
no_license
hkabdulla341/MyCapGwork
723780160b1c34e72d40055c9e1b4a8f97f02934
e49e324b54d3a9aed4d24cbf2c2fa9cf3b7c0ef0
refs/heads/master
2021-05-11T11:19:57.271006
2018-02-23T07:56:22
2018-02-23T07:56:22
117,634,747
0
0
null
null
null
null
UTF-8
Java
false
false
594
java
package Main; public class EmployeeIDGenerator { private static int generatornum; public EmployeeIDGenerator() { generatornum = 0; } public static int getTotalEmployee() { return generatornum; } private static void incrementNum() { ++generatornum; } public static int getEmpolyeeNum() { int returnNum = generatornum++; incrementNum(); return returnNum; } public static void printTotalEmpoyee() { System.out.println("Total employee created :" + getTotalEmployee()); } }
72f532f996bbd487bb0a5d53ce0f8cc6b902a1a3
6e76685ece75b2d2c67db7dc83d7515657f87c7f
/recognition/src/main/java/com/xiongdi/recognition/activity/VerifyResultActivity.java
12a13dbc1212d65fe4b2e81dd97f00149f18acaf
[]
no_license
georgeemr/UsbHostModeFingerprint
a60e99228ad263d51d61030d71ef19bf3d852b3f
28f6597e80720ada8ac37a37fbedf8763c27b6bb
refs/heads/master
2020-03-26T15:51:48.692671
2016-10-26T08:56:52
2016-10-26T08:56:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
28,877
java
package com.xiongdi.recognition.activity; import android.app.Activity; import android.content.Intent; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; import android.graphics.Paint; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; import com.futronictech.AnsiSDKLib; import com.futronictech.UsbDeviceDataExchangeImpl; import com.xiongdi.recognition.R; import com.xiongdi.recognition.application.App; import com.xiongdi.recognition.audio.AudioPlay; import com.xiongdi.recognition.bean.Person; import com.xiongdi.recognition.db.PersonDao; import com.xiongdi.recognition.fragment.ProgressDialogFragment; import com.xiongdi.recognition.helper.OperateCardHelper; import com.xiongdi.recognition.util.AESUtil; import com.xiongdi.recognition.util.FileUtil; import com.xiongdi.recognition.util.StringUtil; import com.xiongdi.recognition.util.ToastUtil; import com.xiongdi.recognition.util.UsbManagerUtil; import com.xiongdi.recognition.widget.progressBar.ProgressBarView; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.Locale; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import rx.Observable; import rx.Subscriber; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1; import rx.functions.Func1; import rx.schedulers.Schedulers; /** * Created by moubiao on 2016/3/25. * 验证身份信息界面 */ public class VerifyResultActivity extends AppCompatActivity implements View.OnClickListener, NavigationView.OnNavigationItemSelectedListener { private final String TAG = "moubiao"; private final String KEY = "0123456789abcdef"; private final int SCAN_BARCODE_REQUEST_CODE = 10000; private final int SEARCH_REQUEST_CODE = 10001; private static final int READ_CARD_FLAG = 0; private final float MATCH_SCORE = 93.0f; private static final int MESSAGE_SHOW_IMAGE = 2; private static final int MESSAGE_SHOW_ERROR_MSG = 3; private DrawerLayout drawer; private ImageView pictureIMG, fingerIMG; private ProgressBarView mProgressBarView; private TextView personIDTV, personNameTV, personGenderTV, personBirthdayTV, personAddressTV; private ImageButton backTB, readCardBT, passportBT, verifyBT; private OperateCardHelper mOperateCardHelper; private ReadCardHandler mReadCardHandler; private ReadCardThread mReadCardThread; private boolean mReadSuccess = false; private ProgressDialogFragment progressDialog; private UsbManagerUtil mUsbManagerUtil; private VerifyThread mVerifyThread; private VerifyHandler mHandler; private UsbDeviceDataExchangeImpl usb_host_ctx; private boolean verifyPass = false; private Bitmap mFingerBitmap; //语音提示 private AudioPlay mAudioPlay; private AssetManager mAssetManager; private Person mCurPerson; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.verify_result_ayout); initData(); initView(); setListener(); } @Override protected void onDestroy() { super.onDestroy(); mOperateCardHelper.closeRFModel(); if (mVerifyThread != null) { mVerifyThread.cancel(); } usb_host_ctx.closeDevice(); usb_host_ctx.releaseResource(); } private void initData() { mUsbManagerUtil = new UsbManagerUtil(getApplicationContext(), new RequestPermissionHandler(this)); mOperateCardHelper = new OperateCardHelper(this); mOperateCardHelper.openRFModel(); mReadCardHandler = new ReadCardHandler(this); progressDialog = new ProgressDialogFragment(); mHandler = new VerifyHandler(this); usb_host_ctx = new UsbDeviceDataExchangeImpl(this, mHandler); mAudioPlay = new AudioPlay(); mAssetManager = getAssets(); } private void initView() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.common_navigation_drawer_open, R.string.common_navigation_drawer_close); if (drawer != null) { drawer.addDrawerListener(toggle); } toggle.syncState(); ((TextView) findViewById(R.id.verify_ID).findViewById(R.id.verify_title_tv)).setText(R.string.info_title_ID); ((TextView) findViewById(R.id.verify_name).findViewById(R.id.verify_title_tv)).setText(R.string.info_item_title_name); ((TextView) findViewById(R.id.verify_gender).findViewById(R.id.verify_title_tv)).setText(R.string.info_item_title_gender); ((TextView) findViewById(R.id.verify_birthday).findViewById(R.id.verify_title_tv)).setText(R.string.info_item_title_birthday); ((TextView) findViewById(R.id.verify_address).findViewById(R.id.verify_title_tv)).setText(R.string.info_item_title_address); pictureIMG = (ImageView) findViewById(R.id.verify_photo_img); fingerIMG = (ImageView) findViewById(R.id.verify_finger_img); mProgressBarView = (ProgressBarView) findViewById(R.id.scan_finger_progress); personIDTV = (TextView) findViewById(R.id.verify_ID).findViewById(R.id.verify_content_tv); personNameTV = (TextView) findViewById(R.id.verify_name).findViewById(R.id.verify_content_tv); personGenderTV = (TextView) findViewById(R.id.verify_gender).findViewById(R.id.verify_content_tv); personBirthdayTV = (TextView) findViewById(R.id.verify_birthday).findViewById(R.id.verify_content_tv); personAddressTV = (TextView) findViewById(R.id.verify_address).findViewById(R.id.verify_content_tv); backTB = (ImageButton) findViewById(R.id.bottom_left_bt); verifyBT = (ImageButton) findViewById(R.id.bottom_right_bt); if (verifyBT != null) { verifyBT.setBackgroundResource(R.drawable.common_gather_fingerprint); } passportBT = (ImageButton) findViewById(R.id.bottom_second_bt); if (passportBT != null) { passportBT.setVisibility(View.GONE); passportBT.setBackgroundResource(R.drawable.common_passport_bg); } readCardBT = (ImageButton) findViewById(R.id.bottom_first_bt); if (readCardBT != null) { readCardBT.setBackgroundResource(R.drawable.common_read_card_bg); } } private void setListener() { backTB.setOnClickListener(this); verifyBT.setOnClickListener(this); passportBT.setOnClickListener(this); readCardBT.setOnClickListener(this); NavigationView navigationView = (NavigationView) findViewById(R.id.navigation); if (navigationView != null) { navigationView.setNavigationItemSelectedListener(this); } } @Override public void onClick(View v) { switch (v.getId()) { case R.id.bottom_left_bt: finish(); break; case R.id.bottom_right_bt: if (mUsbManagerUtil.OpenDevice(0, true) && (mVerifyThread == null || mVerifyThread.isCanceled())) { verifyFingerprint(); } break; case R.id.bottom_first_bt: readCard(); break; case R.id.bottom_second_bt: break; default: break; } } private void showProgressBar(boolean show) { mProgressBarView.setVisibility(show ? View.VISIBLE : View.GONE); fingerIMG.setVisibility(show ? View.GONE : View.VISIBLE); } /** * 验证指纹 */ private void verifyFingerprint() { if (App.FINGERPRINT_PATH == null) { Log.e(TAG, "verifyFingerprint: fingerprint file path is null"); ToastUtil.getInstance().showToast(this, getString(R.string.no_fingerprint_template)); return; } if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { Log.e(TAG, "verifyFingerprint: external storage is not mounted"); ToastUtil.getInstance().showToast(this, "external storage is not mounted"); return; } if (usb_host_ctx.OpenDevice(0, true)) { byte[] fingerprintContent = null; File fingerprintFile; FileInputStream fis = null; try { Log.d(TAG, "verifyFingerprint: fingerprint path " + App.FINGERPRINT_PATH); fingerprintFile = new File(App.FINGERPRINT_PATH); if (!fingerprintFile.exists() || !fingerprintFile.canRead()) { Log.e(TAG, "verifyFingerprint: fingerprint file no exist"); return; } fingerprintContent = new byte[(int) fingerprintFile.length()]; fis = new FileInputStream(fingerprintFile); if (-1 == fis.read(fingerprintContent)) { Log.e(TAG, "verifyFingerprint: fingerprint content is null"); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (fis != null) { fis.close(); } } catch (IOException e) { e.printStackTrace(); } } mAudioPlay.resetMediaPlayer(); mAudioPlay.playAsset(AudioPlay.PUT_FINGER, mAssetManager); showProgressBar(true); mVerifyThread = new VerifyThread(0, fingerprintContent, MATCH_SCORE); mVerifyThread.start(); } else { ToastUtil.getInstance().showToast(this, "open usb host mode failed!"); } } /** * 验证指纹的线程 */ private class VerifyThread extends Thread { private AnsiSDKLib ansi_lib = null; private int fingerIndex = 0;//手指的编号 private byte[] templeData = null;//从文件里读取到的指纹数据 private float matchScore = 0;//匹配的标准值 private boolean cancel = false; public VerifyThread(int fingerIndex, byte[] templeData, float matchScore) { ansi_lib = new AnsiSDKLib(); this.fingerIndex = fingerIndex; this.templeData = templeData; this.matchScore = matchScore; } public void cancel() { cancel = true; try { this.join(); } catch (InterruptedException e) { e.printStackTrace(); } } public boolean isCanceled() { return cancel; } @Override public void run() { boolean dev_open = false; try { //打开设备 if (!ansi_lib.OpenDeviceCtx(usb_host_ctx)) { mHandler.obtainMessage(MESSAGE_SHOW_ERROR_MSG, -1, -1, ansi_lib.GetErrorMessage()).sendToTarget(); Log.e(TAG, "run: open fingerprint device failed!"); return; } dev_open = true; //计算指纹图像的大小 if (!ansi_lib.FillImageSize()) { mHandler.obtainMessage(MESSAGE_SHOW_ERROR_MSG, -1, -1, ansi_lib.GetErrorMessage()).sendToTarget(); Log.e(TAG, "run: get fingerprint image size failed!"); return; } byte[] img_buffer = new byte[ansi_lib.GetImageSize()]; //验证指纹 while (true) { Log.d(TAG, "run: search fingerprint---->"); if (isCanceled()) { break; } float[] matchResult = new float[1]; if (ansi_lib.VerifyTemplate(fingerIndex, templeData, img_buffer, matchResult)) { mFingerBitmap = createFingerBitmap(ansi_lib.GetImageWidth(), ansi_lib.GetImageHeight(), img_buffer); verifyPass = matchResult[0] > matchScore; mHandler.obtainMessage(MESSAGE_SHOW_IMAGE).sendToTarget(); Log.d(TAG, "run: verify passed match result = " + matchResult[0] + " success = " + verifyPass); if (verifyPass) { break; } } else { int lastError = ansi_lib.GetErrorCode(); if (lastError == AnsiSDKLib.FTR_ERROR_EMPTY_FRAME || lastError == AnsiSDKLib.FTR_ERROR_NO_FRAME || lastError == AnsiSDKLib.FTR_ERROR_MOVABLE_FINGER) { Thread.sleep(100); } else { Log.e(TAG, "run: verify failed"); String error = String.format("Verify failed. Error: %s.", ansi_lib.GetErrorMessage()); mHandler.obtainMessage(MESSAGE_SHOW_ERROR_MSG, -1, -1, error).sendToTarget(); break; } } } } catch (Exception e) { mHandler.obtainMessage(MESSAGE_SHOW_ERROR_MSG, -1, -1, e.getMessage()).sendToTarget(); } //关闭模块 if (dev_open) { ansi_lib.CloseDevice(); } } } /** * 创建指纹的bitmap * * @param imgWidth bitmap的宽 * @param imgHeight bitmap的高 * @param imgBytes bitmap的数据 * @return */ private Bitmap createFingerBitmap(int imgWidth, int imgHeight, byte[] imgBytes) { int[] pixels = new int[imgWidth * imgHeight]; for (int i = 0; i < imgWidth * imgHeight; i++) { pixels[i] = imgBytes[i]; } Bitmap emptyBmp = Bitmap.createBitmap(pixels, imgWidth, imgHeight, Bitmap.Config.RGB_565); int width, height; height = emptyBmp.getHeight(); width = emptyBmp.getWidth(); Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); Canvas c = new Canvas(result); Paint paint = new Paint(); ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm); paint.setColorFilter(f); c.drawBitmap(emptyBmp, 0, 0, paint); return result; } private static class VerifyHandler extends Handler { private WeakReference<VerifyResultActivity> mWeakReference; private int audioType; private AudioPlay mAudioPlay; private AssetManager mAssetManager; public VerifyHandler(VerifyResultActivity activity) { mWeakReference = new WeakReference<>(activity); mAudioPlay = new AudioPlay(); mAssetManager = activity.getAssets(); } @Override public void handleMessage(Message msg) { super.handleMessage(msg); final VerifyResultActivity activity = mWeakReference.get(); switch (msg.what) { case MESSAGE_SHOW_ERROR_MSG: String showErr = (String) msg.obj; ToastUtil.getInstance().showToast(activity, showErr); break; case MESSAGE_SHOW_IMAGE: activity.fingerIMG.setImageBitmap(activity.mFingerBitmap); if (activity.verifyPass) { mAudioPlay.resetMediaPlayer(); audioType = AudioPlay.VERIFY_PASSED; mAudioPlay.playAsset(audioType, mAssetManager); activity.showProgressBar(false); PersonDao personDao = new PersonDao(activity); Person person; if (activity.mCurPerson != null) { person = activity.mCurPerson; } else { Long recordCount = personDao.getQuantity(); person = personDao.queryById(Integer.parseInt(String.valueOf(recordCount))); } personDao.updateColumn("UPDATE person SET mChecked = 1 WHERE ID = " + person.getID()); activity.setResultDetail(person); } else { audioType = AudioPlay.VERIFY_FAILED; mAudioPlay.playAsset(audioType, mAssetManager); } break; default: break; } } } /** * 读卡 */ private void readCard() { showProgressBar(false); progressDialog.setData(getString(R.string.reading_from_card)); progressDialog.show(getSupportFragmentManager(), "save"); mReadCardThread = new ReadCardThread(); mReadCardThread.start(); } @Override public boolean onNavigationItemSelected(MenuItem item) { if (mVerifyThread != null) { showProgressBar(false); mVerifyThread.cancel(); } Intent intent = new Intent(); switch (item.getItemId()) { case R.id.nav_scan_barcode: intent.setClass(VerifyResultActivity.this, ScanBarcodeActivity.class); startActivityForResult(intent, SCAN_BARCODE_REQUEST_CODE); break; case R.id.nav_input_CNID: intent.setClass(VerifyResultActivity.this, SearchActivity.class); startActivityForResult(intent, SEARCH_REQUEST_CODE); break; default: break; } drawer.closeDrawer(GravityCompat.START); return false; } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.option_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (mVerifyThread != null) { showProgressBar(false); mVerifyThread.cancel(); } Intent intent = new Intent(); switch (item.getItemId()) { case R.id.menu_search: intent.setClass(VerifyResultActivity.this, SearchActivity.class); startActivityForResult(intent, SEARCH_REQUEST_CODE); break; case R.id.menu_scan_barcode: intent.setClass(VerifyResultActivity.this, ScanBarcodeActivity.class); startActivityForResult(intent, SCAN_BARCODE_REQUEST_CODE); break; default: break; } return super.onOptionsItemSelected(item); } /** * 读卡的线程 */ private class ReadCardThread extends Thread { @Override public void run() { mReadSuccess = mOperateCardHelper.readM1Card(); Message message = Message.obtain(); message.what = READ_CARD_FLAG; mReadCardHandler.sendMessage(message); } } /** * 处理读卡的handler */ private static class ReadCardHandler extends Handler { private WeakReference<VerifyResultActivity> mWeakReference; public ReadCardHandler(VerifyResultActivity activity) { mWeakReference = new WeakReference<>(activity); } @Override public void handleMessage(Message msg) { final VerifyResultActivity activity = mWeakReference.get(); switch (msg.what) { case READ_CARD_FLAG: activity.progressDialog.dismiss(); if (activity.mReadSuccess) { String[] cardData = activity.mOperateCardHelper.getBaseData(); PersonDao personDao = new PersonDao(activity); Person person = personDao.queryById(Integer.parseInt(cardData[0])); activity.mCurPerson = person; if (person.getChecked() == 1) { ToastUtil.getInstance().showToast(activity, "has checked!"); activity.refreshView(); return; } activity.personIDTV.setText(String.valueOf(cardData[0])); activity.personNameTV.setText(cardData[1]); activity.personGenderTV.setText(cardData[2]); activity.personBirthdayTV.setText(cardData[3]); activity.personAddressTV.setText(cardData[4]); Bitmap bitmap = activity.mOperateCardHelper.getPicture(); if (bitmap != null) { activity.pictureIMG.setImageBitmap(bitmap); } else { activity.pictureIMG.setImageResource(R.drawable.person_photo); } if (!StringUtil.hasLength(cardData[1])) { ToastUtil.getInstance().showToast(activity, activity.getString(R.string.common_no_data)); } activity.verifyFingerprint(); break; } default: break; } } } @Override protected void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case SCAN_BARCODE_REQUEST_CODE: if (data != null) { try { int id = Integer.parseInt(data.getStringExtra("scan_id")); showBarcodeData(id); } catch (java.lang.NumberFormatException e) { ToastUtil.getInstance().showToast(this, getString(R.string.common_invalid_data)); e.printStackTrace(); } } break; case SEARCH_REQUEST_CODE: App app = (App) getApplication(); setResultDetail(app.getPerson()); break; default: break; } } else { switch (requestCode) { case SCAN_BARCODE_REQUEST_CODE: refreshView(); break; default: break; } } } /** * 显示扫描二维码得到的数据 */ private void showBarcodeData(int id) { Observable.just(id) .map(new Func1<Integer, Person>() { @Override public Person call(Integer ID) { PersonDao personDao = new PersonDao(getApplicationContext()); return personDao.queryById(ID); } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<Person>() { @Override public void call(Person person) { if (person == null) { ToastUtil.getInstance().showToast(VerifyResultActivity.this, getString(R.string.common_no_data)); } else if (person.getChecked() == 0) { setResultDetail(person); } else { ToastUtil.getInstance().showToast(VerifyResultActivity.this, "has checked!"); } } }); } private void setResultDetail(final Person person) { if (person != null) { App.FINGERPRINT_PATH = person.getFingerprint(); mCurPerson = person; final String picPath = person.getPicture(); final String decryptPath = picPath + ".png"; Observable.create(new Observable.OnSubscribe<Object>() { @Override public void call(Subscriber<? super Object> subscriber) { if (picPath != null) { decryptFile(picPath, decryptPath); } subscriber.onCompleted(); } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<Object>() { @Override public void onCompleted() { personIDTV.setText(String.format(Locale.getDefault(), "%1$,05d", person.getID())); personNameTV.setText(person.getName()); personGenderTV.setText(person.getGender()); personBirthdayTV.setText(person.getBirthday()); personAddressTV.setText(person.getAddress()); Bitmap bitmap = BitmapFactory.decodeFile(decryptPath); if (bitmap != null) { pictureIMG.setImageBitmap(bitmap); } new FileUtil().deleteFile(decryptPath); } @Override public void onError(Throwable e) { } @Override public void onNext(Object o) { } }); } } /** * 解密照片 */ private void decryptFile(String filePath, String decryptPath) { AESUtil aesUtil2 = new AESUtil.Builder() .key(KEY) .keySize(256) .mode(Cipher.DECRYPT_MODE) .transformation("AES/CFB/PKCS5Padding") .ivParameter(new IvParameterSpec(new byte[16])) .builder(); aesUtil2.decryptFile(filePath, decryptPath); } private void refreshView() { personIDTV.setText(""); personNameTV.setText(""); personGenderTV.setText(""); personBirthdayTV.setText(""); personAddressTV.setText(""); pictureIMG.setImageResource(R.drawable.person_photo); } @Override public void onBackPressed() { if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } /** * 处理请求USB设备权限的handler */ private static class RequestPermissionHandler extends Handler { private WeakReference<VerifyResultActivity> mWeakReference; public RequestPermissionHandler(VerifyResultActivity activity) { mWeakReference = new WeakReference<>(activity); } @Override public void handleMessage(Message msg) { super.handleMessage(msg); final VerifyResultActivity activity = mWeakReference.get(); switch (msg.what) { case UsbDeviceDataExchangeImpl.MESSAGE_ALLOW_DEVICE: {//同意使用usb设备的权限申请 if (activity != null) { activity.verifyFingerprint(); } break; } case UsbDeviceDataExchangeImpl.MESSAGE_DENY_DEVICE: {//拒绝使用usb设备的权限申请 break; } default: break; } } } }
4156e95bf4f73f785bdad2fe8c8ea9f64852c17d
3f1b9c043c9dade6bd5a99c93f8d576c828fc82c
/src/Final_Ex6/Movie.java
d11e1257707b325d340ec3bee1ba508df6ab890a
[]
no_license
11611109/Java_Lab-Exercise
5549e17c2e29b7ff024260cd21717802bc60e55f
f39bff6a3df25d84c25c940c0b0f12501f47b385
refs/heads/master
2020-06-06T12:48:37.870385
2019-06-19T14:08:18
2019-06-19T14:08:18
192,744,349
0
0
null
null
null
null
UTF-8
Java
false
false
1,086
java
package Final_Ex6; import java.util.List; public class Movie { private String title; private int year; private List<String> directors; private List<String> producers; private List<String> actors; public Movie(String title, int year, List<String> directors, List<String> producers, List<String> actors) { this.title = title; this.year = year; this.directors = directors; this.producers = producers; this.actors = actors; } public List<String> getActors() { return actors; } public List<String> getDirectors() { return directors; } public List<String> getProducers() { return producers; } public String getTitle() { return title; } public int getYear() { return year; } public String toString() { return "Name: " + title + "\nYear: " + year + "\nDirected by: " + directors + "\nProduced by: " + producers + "\nActors: " + actors; } }
1813e4edc6e75975307ab7dd08b8e9f5ae47c425
37f9f5be9e5bb7e2dba1398768307fbf3a56d3dc
/Fortizo/Fortizo/obj/Debug/MonoAndroid60/android/src/md5baecf090ba52a9f3bfd5bbb24babe762/menuPage.java
e85a34ee9ad7f6310b5365cf12e4bf12aa36db9a
[]
no_license
JoeyAlpha5/Fortizo
6d67be424ec20b63f2b17594fc6746e27f38f46b
9903c37f11de6de2bf4ba377ffc2baeb61030df5
refs/heads/master
2022-03-23T08:02:55.481386
2019-12-12T13:22:28
2019-12-12T13:22:28
198,280,899
0
0
null
null
null
null
UTF-8
Java
false
false
1,214
java
package md5baecf090ba52a9f3bfd5bbb24babe762; public class menuPage extends android.app.Activity implements mono.android.IGCUserPeer { /** @hide */ public static final String __md_methods; static { __md_methods = "n_onCreate:(Landroid/os/Bundle;)V:GetOnCreate_Landroid_os_Bundle_Handler\n" + "n_onBackPressed:()V:GetOnBackPressedHandler\n" + ""; mono.android.Runtime.register ("Fortizo.menuPage, Fortizo", menuPage.class, __md_methods); } public menuPage () { super (); if (getClass () == menuPage.class) mono.android.TypeManager.Activate ("Fortizo.menuPage, Fortizo", "", this, new java.lang.Object[] { }); } public void onCreate (android.os.Bundle p0) { n_onCreate (p0); } private native void n_onCreate (android.os.Bundle p0); public void onBackPressed () { n_onBackPressed (); } private native void n_onBackPressed (); private java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
7f4576180161a5050a4779b3bdf5541314d6f3a8
d4fa1a6b143bc2069e15b13679c5a54f89aaa187
/xiaoyuan/src/main/java/com/xiaoyuan/XiaoyuanApplication.java
0ccc944d063002e2b9d4acc98ea3d94eff1d76b0
[]
no_license
xiaoyuan2020/xiaoyuan-root
54f57dc200e2d2bcf1c09b9033215e71234838d0
949082c1fcc5a648ddbbf85685f07ca33fea6abf
refs/heads/master
2020-06-03T19:39:27.651608
2019-06-13T11:33:49
2019-06-13T11:33:49
191,705,815
0
0
null
null
null
null
UTF-8
Java
false
false
321
java
package com.xiaoyuan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class XiaoyuanApplication { public static void main(String[] args) { SpringApplication.run(XiaoyuanApplication.class, args); } }
[ "duxiangyu" ]
duxiangyu
3b08f1ae016e7afa1bfa61b057b647c1ea1afce7
6c6596f01e3f74b1579cc272b0ec8970e03d8adb
/irm-sa.strategies/src/cz/cuni/mff/d3s/irmsa/strategies/commons/EvolutionaryAdaptationManager.java
61ead4f49979be96eb3e85c6526fa75753b6fe2c
[]
no_license
d3scomp/IRM-SA
5d4d42d38e7bfac7fae12afe8811ba440f52a496
ede622e1211d203528ee3ce5efc8d79372a41ac3
refs/heads/master
2021-01-19T15:40:10.209908
2015-04-27T09:10:23
2015-04-27T09:10:23
12,811,624
2
1
null
2014-07-25T15:42:18
2013-09-13T14:37:27
Java
UTF-8
Java
false
false
13,067
java
package cz.cuni.mff.d3s.irmsa.strategies.commons; import static cz.cuni.mff.d3s.irmsa.strategies.ComponentHelper.retrieveFromInternalData; import static cz.cuni.mff.d3s.irmsa.strategies.ComponentHelper.storeInInternalData; import java.util.List; import java.util.Set; import java.util.UUID; import cz.cuni.mff.d3s.deeco.annotations.Component; import cz.cuni.mff.d3s.deeco.annotations.In; import cz.cuni.mff.d3s.deeco.annotations.InOut; import cz.cuni.mff.d3s.deeco.annotations.Out; import cz.cuni.mff.d3s.deeco.annotations.PeriodicScheduling; import cz.cuni.mff.d3s.deeco.annotations.Process; import cz.cuni.mff.d3s.deeco.annotations.SystemComponent; import cz.cuni.mff.d3s.deeco.logging.Log; import cz.cuni.mff.d3s.deeco.model.architecture.api.Architecture; import cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentProcess; import cz.cuni.mff.d3s.deeco.model.runtime.api.RuntimeMetadata; import cz.cuni.mff.d3s.deeco.model.runtime.api.TimeTrigger; import cz.cuni.mff.d3s.deeco.model.runtime.api.Trigger; import cz.cuni.mff.d3s.deeco.task.ParamHolder; import cz.cuni.mff.d3s.deeco.task.ProcessContext; import cz.cuni.mff.d3s.irm.model.design.IRM; import cz.cuni.mff.d3s.irm.model.runtime.api.IRMInstance; import cz.cuni.mff.d3s.irm.model.runtime.api.InvariantInstance; import cz.cuni.mff.d3s.irm.model.trace.api.TraceModel; import cz.cuni.mff.d3s.irmsa.IRMInstanceGenerator; import cz.cuni.mff.d3s.irmsa.strategies.commons.variations.AdapteeSelector; import cz.cuni.mff.d3s.irmsa.strategies.commons.variations.DeltaComputor; import cz.cuni.mff.d3s.irmsa.strategies.commons.variations.DirectionSelector; import cz.cuni.mff.d3s.irmsa.strategies.commons.variations.InvariantFitnessCombiner; /** * Template adaptation manager for 1+1-ONLINE-EA. * Uses kind of template method / delegate design pattern. */ @Component @SystemComponent public abstract class EvolutionaryAdaptationManager { /** Default period of monitoring. */ static public final int MONITORING_PERIOD = 5000; /** Default period of adapting. */ static public final int ADAPTING_PERIOD = 5000; /** Run flag stored in internal data under this key. */ static final String RUN_FLAG = "runFlag"; /** Done flag stored in internal data under this key. */ static final String DONE_FLAG = "doneFlag"; /** Trace model stored in internal data under this key. */ static final String TRACE_MODEL = "trace"; /** Design model stored in internal data under this key. */ static final String DESIGN_MODEL = "design"; /** AdaptationManagerDelagate stored in internal data under this key. */ static final String ADAPTATION_DELEGATE = "adaptationManagerDelegate"; /** InvariantFitnessCombiner stored in internal data under this key. */ static final String INVARIANT_FITNESS_COMBINER = "invariantFitnessCombiner"; /** AdapteeSelector stored in internal data under this key. */ static final String ADAPTEE_SELECTOR = "adapteeSelector"; /** DirectionSelector stored in internal data under this key. */ static final String DIRECTION_SELECTOR = "directionSelector"; /** DeltaComputor stored in internal data under this key. */ static final String DELTA_COMPUTOR = "deltaComputor"; /** Adaptation bound stored in internal data under this key. */ static final String ADAPTATION_BOUND = "adaptationBound"; /** Constant meaning unbounded tries. */ static final Integer TRIES_UNBOUDED = new Integer(-1); /** Manager ID. */ public String id; /** Holds the state of the adapt method. */ public StateHolder<? extends Backup> state; /** Number of tries to adapt left. -1 for unbounded. */ public Integer maximumTries; /** Number of tries to adapt left. -1 for unbounded. */ public Integer triesLeft; /** Overall system fitness. */ public Double fitness = 0.0; /** * Only constructor. * @param initState initial state * @param maximumTries maximal number of tries for adaptation, -1 for unbounded */ protected EvolutionaryAdaptationManager(final StateHolder<?> initState, final int maximumTries) { this.id = createId(); state = initState; this.maximumTries = maximumTries; triesLeft = maximumTries; } /** * Creates id. Called in constructor! * @return new id */ protected String createId() { return String.format("EvolutionaryAdapatationManager_%s", UUID.randomUUID()); } @Process @PeriodicScheduling(period = MONITORING_PERIOD, order = 5) static public <T extends Backup> void monitorOverallFitness( @In("id") String id, @Out("fitness") ParamHolder<Double> fitness) { final ComponentProcess process = ProcessContext.getCurrentProcess(); final EvolutionaryAdaptationManagerDelegate<T> delegate = retrieveFromInternalData(ADAPTATION_DELEGATE); getTimeTrigger(process).setPeriod(delegate.getMonitorPeriod()); //set monitor period // final boolean run = retrieveFromInternalData(RUN_FLAG, false); final boolean done = retrieveFromInternalData(DONE_FLAG, false); if (!run || done) { return; //manager tells us not to run or our work is done } fitness.value = 0.0; // get runtime model from the process context final RuntimeMetadata runtime = (RuntimeMetadata) process.getComponentInstance().eContainer(); // get simulated time final long simulatedTime = ProcessContext.getTimeProvider().getCurrentMilliseconds(); System.out.println("*** Monitoring overall system fitness in runtime "+ runtime + " at time " + simulatedTime +" ***"); // skipping the first run of this process as replicas are not disseminated yet if (simulatedTime <= 0) { Log.w("First invocation of the fitness monitoring. Skipping this reasoning cycle."); return; } // get architecture, design, trace models and plug-ins from the process context final Architecture architecture = ProcessContext.getArchitecture(); final IRM design = retrieveFromInternalData(DESIGN_MODEL); final TraceModel trace = retrieveFromInternalData(TRACE_MODEL); final InvariantFitnessCombiner invariantFitnessCombiner = retrieveFromInternalData(INVARIANT_FITNESS_COMBINER); // generate the IRM runtime model instances final IRMInstanceGenerator generator = new IRMInstanceGenerator(architecture, design, trace); final List<IRMInstance> IRMInstances = generator.generateIRMInstances(); if (IRMInstances.isEmpty()) { //nothing to monitor InvariantInfosStorage.storeInvariantInfos(id, null); return; } //Create data structure for processing final Set<InvariantInfo<?>> infos = delegate.extractInvariants(IRMInstances); //Compute processes' fitnesses computeInvariantsFitness(infos); //Compute overall fitness fitness.value = invariantFitnessCombiner.combineInvariantFitness(infos); System.out.println("Overall System Fitness: " + fitness.value + "(at " + simulatedTime + ")"); InvariantInfosStorage.storeInvariantInfos(id, infos); } @Process @PeriodicScheduling(period = ADAPTING_PERIOD, order = 10) static public <T extends Backup> void adapt( @In("id") String id, @In("fitness") Double fitness, @InOut("state") ParamHolder<StateHolder<T>> stateHolder, @In("maximumTries") Integer maximumTries, @InOut("triesLeft") ParamHolder<Integer> triesLeft) { final boolean run = retrieveFromInternalData(RUN_FLAG, false); final boolean done = retrieveFromInternalData(DONE_FLAG, false); if (!run || done) { return; //manager tells us not to run or our work is done } final StateHolder<T> state = stateHolder.value; final EvolutionaryAdaptationManagerDelegate<T> delegate = retrieveFromInternalData(ADAPTATION_DELEGATE); final ComponentProcess process = ProcessContext.getCurrentProcess(); // get runtime model from the process context final RuntimeMetadata runtime = (RuntimeMetadata) process.getComponentInstance().eContainer(); // get simulated time final long simulatedTime = ProcessContext.getTimeProvider().getCurrentMilliseconds(); System.out.println("*** Adapting in runtime "+ runtime + " at time " + simulatedTime +" ***"); // skipping the first run of this process as replicas are not disseminated yet if (simulatedTime <= 0) { Log.w("First invocation of the EvolutionaryAdaptationManager. Skipping this adapting cycle."); return; } // get variations from the process context final InvariantFitnessCombiner invariantFitnessCombiner = retrieveFromInternalData(INVARIANT_FITNESS_COMBINER); final AdapteeSelector adapteeSelector = retrieveFromInternalData(ADAPTEE_SELECTOR); final DirectionSelector directionSelector = retrieveFromInternalData(DIRECTION_SELECTOR); final DeltaComputor deltaComputor = retrieveFromInternalData(DELTA_COMPUTOR); //retrieve invariant infos from last monitor run final Set<InvariantInfo<?>> infos = InvariantInfosStorage.retrieveInvariantInfos(id); if (infos == null) { //nothing to adapt, reset state resetAdaptState(process, delegate, state); return; } if (state.state == State.STARTED) { //first part of adaptation state.oldFitness = fitness; System.out.println("OLD FITNESS: " + state.oldFitness + "(at " + simulatedTime + ")"); final double adaptionBound = retrieveFromInternalData(ADAPTATION_BOUND); if (state.oldFitness >= adaptionBound) { //too good to mess with the system resetAdaptState(process, delegate, state); return; } //Select a (set of) processes to adapt final Set<InvariantInfo<?>> adaptees = adapteeSelector.selectAdaptees(infos); //Select direction(s) for (InvariantInfo<?> invariant: adaptees) { directionSelector.selectDirection(invariant); } //Compute delta(s) for (InvariantInfo<?> invariant: adaptees) { deltaComputor.computeDelta(invariant); } //Create child by applying the changes state.backup = delegate.applyChanges(adaptees, state.backup); //{Compute observe time} final long observeTime = delegate.computeObserveTime(adaptees, infos); //Run for observe time state.state = State.OBSERVED; //change period of this process final TimeTrigger trigger = getTimeTrigger(process); if (observeTime > trigger.getPeriod()) { //changing period takes effect only the run after the next one trigger.setPeriod(observeTime - trigger.getPeriod()); } state.observeTime = simulatedTime + observeTime; System.out.println("!!!ADAPTING!!!"); } else if (state.state == State.OBSERVED) { //observing done if (simulatedTime < state.observeTime) { System.out.println("Adaptation invoked too soon, waiting"); return; } System.out.println("NEW FITNESS: " + fitness); if (fitness > state.oldFitness) { //Take child as new parent //are we done? final double adaptionBound = retrieveFromInternalData(ADAPTATION_BOUND); if (fitness >= adaptionBound) { System.out.println("Adaptation successfully ended."); storeInInternalData(DONE_FLAG, true); } } else { //Keep parent delegate.restoreBackup(infos, state.backup); if (!maximumTries.equals(TRIES_UNBOUDED)) { triesLeft.value = triesLeft.value - 1; //are we done? if (triesLeft.value <= 0) { System.out.println("Adaptation failed, abort."); storeInInternalData(DONE_FLAG, true); triesLeft.value = maximumTries; } } } //inform variations about adaptation results final double improvement = fitness - state.oldFitness; invariantFitnessCombiner.adaptationImprovement(improvement, infos); adapteeSelector.adaptationImprovement(improvement, infos); directionSelector.adaptationImprovement(improvement, infos); deltaComputor.adaptationImprovement(improvement, infos); //{Mark non-prospective specimen as dead end or utilize Simulated annealing} final TimeTrigger trigger = getTimeTrigger(process); trigger.setPeriod(delegate.getDefaultAdaptingPeriod()); state.reset(); } else { Log.w("Unknown state " + state.state); } } /** * Returns time trigger of the given process or null. * @param process given process * @return time trigger of the given process or null */ static protected TimeTrigger getTimeTrigger(final ComponentProcess process) { for (Trigger trigger : process.getTriggers()) { if (trigger instanceof TimeTrigger) { return (TimeTrigger) trigger; } } return null; } /** * Computes fitness for invariant instances. * @param infos invariant instances to compute fitness for */ static protected void computeInvariantsFitness(final Set<InvariantInfo<?>> infos) { for (InvariantInfo<?> info : infos) { InvariantInstance instance = info.getInvariant(); info.fitness = instance.getFitness(); } } /** * Resets process' period and manager's state. * @param process adapt process * @param delegate adaptation manager delegate, provides period * @param state manager's current state */ static protected void resetAdaptState(final ComponentProcess process, final EvolutionaryAdaptationManagerDelegate<? extends Backup> delegate, final StateHolder<?> state) { final TimeTrigger trigger = getTimeTrigger(process); trigger.setPeriod(delegate.getDefaultAdaptingPeriod()); state.reset(); } }
f233147c379cff6a290f69511ed489e0f78dff11
b4fdb81be9aef1fed5418a56db55623d1118bec8
/src/main/java/com/example/mongoreactive/bean/Message.java
dd3ec9bb69bd326b544ee8bf766d60b548210a4c
[]
no_license
Sipturak/message
d71e2763c1291a856374160ecbe182d58c7430c3
ddbd4b917b6c2ce55bbb70280abaa1f0760c629a
refs/heads/master
2022-11-05T08:45:59.261611
2020-05-13T20:42:24
2020-05-13T20:42:24
263,730,648
0
0
null
null
null
null
UTF-8
Java
false
false
633
java
package com.example.mongoreactive.bean; import lombok.*; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import javax.validation.constraints.*; import java.io.Serializable; import java.time.LocalDate; @Data @AllArgsConstructor @NoArgsConstructor @Getter @Setter @ToString @Document public class Message implements Serializable { @Id private String id; @NotEmpty private String name; // @Size(min = 20, max = 150) @NotEmpty private String description; private LocalDate localDate; private UserDto userDto; }
dd921652052d03c12731d0d8ee95c5a58ca6e047
f339673b9138510e120701fe754010ff8ff94740
/src/main/java/cn/dbdj1201/netty/hello/client/NettyClient.java
2f311b73916f5b98241ec9533c8f10fb70f28ed6
[]
no_license
yz1201/deep
0a033e6423a1b3cac8e97a65db2dfc81e4b19784
492eac01bd2a6f4824c7f690196f35bd68b66468
refs/heads/master
2022-11-30T14:42:44.820355
2020-08-14T11:44:54
2020-08-14T11:44:54
287,456,171
0
0
null
null
null
null
UTF-8
Java
false
false
1,502
java
package cn.dbdj1201.netty.hello.client; import cn.dbdj1201.netty.hello.handler.ClientHandler; import io.netty.bootstrap.Bootstrap; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import lombok.extern.slf4j.Slf4j; import java.util.Arrays; /** * netty 客户端 * * @Author: dbdj1201 * @Date: 2020-08-14 10:48 */ @Slf4j public class NettyClient { public static void main(String[] args) throws InterruptedException { EventLoopGroup group = new NioEventLoopGroup(); Bootstrap b = new Bootstrap(); b.group(group) .channel(NioSocketChannel.class) .handler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel sc) throws Exception { sc.pipeline().addLast(new ClientHandler()); } }); ChannelFuture cf1 = b.connect("127.0.0.1", 40923) .syncUninterruptibly(); byte[] msg = "hello netty".getBytes(); System.out.println("Client: " + Arrays.toString(msg)); cf1.channel().writeAndFlush(Unpooled.copiedBuffer(msg)); cf1.channel().closeFuture().sync(); group.shutdownGracefully(); } }
aca1d36dac2b7b7b0aa3ab454c3e7b26483ea224
1bb5688062270907b57fb76dfd05a5f34ba8be1e
/src/main/java/ucf/assignments/ListofItemsController.java
82d3ff0c3e9b691b50dd43a0d0caf0e7beebf1f7
[]
no_license
MattyYeet/neet-5280-a5
6e4a2d3310016474fe9a7affd3873e5f2f925320
7062030c27f1325d4e4200061f8aa74129709c8c
refs/heads/master
2023-06-23T15:16:31.977872
2021-07-26T22:34:08
2021-07-26T22:34:08
387,655,152
0
0
null
null
null
null
UTF-8
Java
false
false
12,231
java
package ucf.assignments; /* * UCF COP3330 Summer 2021 Assignment 5 Solution * Copyright 2021 Matthew Neet */ import com.google.gson.Gson; import com.sun.jdi.NativeMethodException; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.MenuItem; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.FileChooser; import javafx.stage.Window; import java.io.*; import java.util.Formatter; import java.util.NoSuchElementException; public class ListofItemsController { public MenuItem Save; public MenuItem Load; @FXML public TextField nameOfItem = new TextField(); @FXML public TextField serialNumberBox = new TextField(); @FXML public TextField priceBox = new TextField(); @FXML private TextField filterSearch; @FXML public TableView<Items> tableView; @FXML private TableColumn<Items, String> NameCol; @FXML private TableColumn<Items, String> NumberCol; @FXML private TableColumn<Items, String> PriceCol; public ListofItemsController(){ } public static ObservableList<Items> ItemList = FXCollections.observableArrayList(); @FXML public void initialize(){ tableView.getSelectionModel().selectedItemProperty().addListener( (observable, oldValue, newValue) -> lookAtItem() ); try{ NameCol.setCellValueFactory(new PropertyValueFactory<>("itemName")); NumberCol.setCellValueFactory(new PropertyValueFactory<>("serialNumber")); PriceCol.setCellValueFactory(new PropertyValueFactory<>("price")); tableView.setItems(ItemList); } catch (Exception e){ System.out.println("I don't work on a fundamental level."); e.printStackTrace(); } } public String makeNewItem() throws IOException { if(ItemVerifier.checkSN(serialNumberBox.getText()).equals("I opened the sn help menu")) { return "SN broke so no item added"; } else if(ItemVerifier.checkPrice(priceBox.getText()).equals("I opened the price help menu")){ return "Price broke so no item added"; } else if(ItemVerifier.checkName(nameOfItem.getText()).equals("I opened the name help menu")){ return "Name broke so no item added"; } else { Double amount = Double.parseDouble(priceBox.getText()); Items item = new Items(); item.setItemName(nameOfItem.getText()); item.setSerialNumber(serialNumberBox.getText()); Formatter fmt = new Formatter(); fmt.format("%.2f", amount); item.setPrice("$" + fmt); ListofItemsController.ItemList.add(item); return "I added an item"; } } public void lookAtItem(){ if(!tableView.getItems().isEmpty()){ Items item = tableView.getSelectionModel().getSelectedItem(); priceBox.setText(item.getPrice()); serialNumberBox.setText(item.getSerialNumber()); nameOfItem.setText(item.getItemName()); } } public String editItem() throws IOException { Items item = tableView.getSelectionModel().getSelectedItem(); if(ItemVerifier.checkSN(serialNumberBox.getText()).equals("I opened the sn help menu")) { return "SN broke so no item added"; } else if(ItemVerifier.checkPrice(priceBox.getText()).equals("I opened the price help menu")){ return "Price broke so no item added"; } else if(ItemVerifier.checkName(nameOfItem.getText()).equals("I opened the name help menu")){ return "Name broke so no item added"; } else { item.setPrice(priceBox.getText()); item.setSerialNumber(serialNumberBox.getText()); item.setItemName(nameOfItem.getText()); priceBox.clear(); serialNumberBox.clear(); nameOfItem.clear(); tableView.refresh(); return "I edited an item"; } } public String deleteItem(){ ObservableList<Items> itemSelected, allItems; allItems = tableView.getItems(); itemSelected = tableView.getSelectionModel().getSelectedItems(); try { itemSelected.forEach(allItems::remove); } catch (NoSuchElementException ignore){} return "I deleted an item"; } public String searchItem(){ ObservableList<Items> filterList = FXCollections.observableArrayList(); for(Items item : ItemList){ tableView.setItems(filterList); if(item.getItemName().contains(filterSearch.getText().toLowerCase()) || item.getSerialNumber().contains(filterSearch.getText())){ filterList.add(item); } } tableView.refresh(); return "I searched for an item"; } public String refreshList(){ filterSearch.clear(); priceBox.clear(); serialNumberBox.clear(); nameOfItem.clear(); tableView.setItems(ItemList); tableView.refresh(); return "The table has been refreshed."; } public String saveList() throws IOException { FileChooser fileChooser = new FileChooser(); fileChooser.setInitialDirectory(new File(System.getProperty("user.home"))); System.out.println("I work for saving"); Window stage = tableView.getScene().getWindow(); fileChooser.setTitle("Save Menu"); fileChooser.setInitialFileName("myList"); fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter(".json", "*.json"), new FileChooser.ExtensionFilter(".tsv", "*.tsv"), new FileChooser.ExtensionFilter(".html", "*.html")); File file = fileChooser.showSaveDialog(stage); if(file == null){ return "A file was not selected"; } fileChooser.setInitialDirectory(file.getParentFile()); if(file.toString().endsWith(".json")) { //Saves it as a JSON try { BufferedWriter writer = new BufferedWriter(new FileWriter(file)); Gson gson = new Gson(); gson.toJson(tableView.getItems(), writer); writer.close(); } catch (IOException e) { System.out.println("Saving json doesn't work"); } return "I saved a json"; } if(file.toString().endsWith(".tsv")){ //Saves it as TSV PrintWriter writer = new PrintWriter(file); for (Items item : ItemList) { String text = item.getPrice() + "\t" + item.getSerialNumber() + "\t" + item.getItemName() + "\n"; writer.write(text); } writer.close(); return "I saved a tsv"; } if(file.toString().endsWith(".html")){ //Saves it as HTML PrintWriter writer = new PrintWriter(file); writer.write(""" <!DOCTYPE html> <html> <head> <style> table { font-family: arial, sans-serif; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 8px; } tr:nth-child(even) { background-color: #dddddd; } </style> </head> <body> <h2>Item List</h2> <table> <tr> <th>Price</th> <th>Serial Number</th> <th>Item Name</th> </tr> """); for(Items item : ItemList){ writer.write(" <tr>\n" + "\t<td>" + item.getPrice() + "</td>\n" + "\t<td>" + item.getSerialNumber() + "</td>\n" + "\t<td>" + item.getItemName() + "</td>\n" + "</tr>\n"); } writer.write(""" </table> </body> </html>"""); writer.close(); return "I saved a html"; } tableView.refresh(); return "I saved a list"; } public String loadList() throws IOException { FileChooser fileChooser = new FileChooser(); fileChooser.setInitialDirectory(new File(System.getProperty("user.home"))); System.out.println("I work for loading"); Window stage = tableView.getScene().getWindow(); fileChooser.setTitle("Load Menu"); fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter(".json", "*.json"), new FileChooser.ExtensionFilter(".tsv", "*.tsv"), new FileChooser.ExtensionFilter(".html", "*.html")); ItemList.clear(); File file = fileChooser.showOpenDialog(stage); if(file == null){ return "A file was not selected"; } fileChooser.setInitialDirectory(file.getParentFile()); if(file.toString().endsWith(".json")){ //Loads a JSON Gson gson = new Gson(); try { Reader reader = new FileReader(file); Items[] result = gson.fromJson(reader, Items[].class); for (Items x : result) ItemList.add(x); } catch (IOException e) { System.out.println("Loading json doesn't work"); } return "I loaded a json"; } if(file.toString().endsWith(".tsv")){ //Loads a TSV BufferedReader reader = new BufferedReader(new FileReader(file)); String text; while((text = reader.readLine()) != null){ String[] textList = text.split("\t"); //Price, SN, Name Items item = new Items(); item.setPrice(textList[0]); item.setSerialNumber(textList[1]); item.setItemName(textList[2]); ItemList.add(item); } return "I loaded a tsv"; } if(file.toString().endsWith(".html")){ //Loads a HTML BufferedReader reader = new BufferedReader(new FileReader(file)); StringBuilder textBuild = new StringBuilder(); String text; int count = 0; //Gets rid of all the fluff while((text = reader.readLine()) != null){ if(text.contains("<td>")){ text = text.replace("<td>", ""); text = text.replace("</td>", ""); text = text.replace("\t", ""); textBuild.append(text).append(" "); count += 1; } } reader.close(); //Loops and increments by three since each item has three things for(int i=0; i <= count; i+=3) { if(i + 3 > count){ break; } String[] info = textBuild.toString().split(" "); Items item = new Items(); item.setPrice(info[i]); item.setSerialNumber(info[i+1]); item.setItemName(info[i+2]); ItemList.add(item); } return "I loaded a html"; } return "I loaded a list"; } }
623bb37fb72395872ef8e366f2addd69315d1627
cdbd53ceb24f1643b5957fa99d78b8f4efef455a
/vertx-gaia/vertx-up/src/main/java/io/vertx/up/uca/jooq/JqAggregator.java
f2b13dee7a9e2dcdb65dcd479da5a6b9ff8e480d
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
chundcm/vertx-zero
f3dcb692ae6b9cc4ced52386cab01e5896e69d80
d2a2d096426c30d90be13b162403d66c8e72cc9a
refs/heads/master
2023-04-27T18:41:47.489584
2023-04-23T01:53:40
2023-04-23T01:53:40
244,054,093
0
0
Apache-2.0
2020-02-29T23:00:59
2020-02-29T23:00:58
null
UTF-8
Java
false
false
5,563
java
package io.vertx.up.uca.jooq; import io.vertx.core.Future; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import io.vertx.up.atom.query.engine.Qr; import java.math.BigDecimal; import java.util.List; import java.util.concurrent.ConcurrentMap; /** * @author <a href="http://www.origin-x.cn">Lang</a> */ @SuppressWarnings("all") class JqAggregator { private transient final AggregatorCount counter; private transient final AggregatorSum sum; private transient final AggregatorMax max; private transient final AggregatorMin min; private transient final AggregatorAvg avg; private transient final ActionGroup group; private JqAggregator(final JqAnalyzer analyzer) { this.group = new ActionGroup(analyzer); /* * Aggr */ this.counter = new AggregatorCount(analyzer); this.sum = new AggregatorSum(analyzer); this.min = new AggregatorMin(analyzer); this.max = new AggregatorMax(analyzer); this.avg = new AggregatorAvg(analyzer); } public static JqAggregator create(final JqAnalyzer analyzer) { return new JqAggregator(analyzer); } // -------------------- Count Operation ------------ /* * Internal Call and do not export this Programming API */ Long count(final Qr qr) { return this.count(null == qr.getCriteria() ? new JsonObject() : qr.getCriteria().toJson()); } <T> Future<Long> countAsync(final Qr qr) { return this.countAsync(null == qr.getCriteria() ? new JsonObject() : qr.getCriteria().toJson()); } /* * AgCount class for count * 1) countAll / countAllAsync */ Long countAll() { return this.counter.count(); } Future<Long> countAllAsync() { return this.counter.countAsync(); } <T> Long count(final JsonObject criteria) { return this.counter.count(criteria); } <T> Future<Long> countAsync(final JsonObject criteria) { return this.counter.countAsync(criteria); } /* * Count Function by group field here * The aggregation result is List<Map<String,Object>> reference here, * Here the result should be: * * Map Data Structure: * - Group1 = Group1's Counter * - Group2 = Group2's Counter * - ...... * - GroupN = GroupN's Counter * * The limitation is that the grouped field should be only one */ <T> ConcurrentMap<String, Integer> countBy(final JsonObject criteria, final String field) { return this.counter.countBy(criteria, field); } /* * Count function by group Fields here * The aggregation result is List<Map<String,Object>> reference here, * Here the result should be: * * List<JsonArray> Data Structure, here each element shouldd be: * { * "field1": "value1", * "field2": "value2", * ...... * "fieldN": "valueN", * "count": "COUNT" * } */ <T> JsonArray countBy(final JsonObject criteria, final String... fields) { return this.counter.countBy(criteria, fields); } // -------------------- Group Operation ------------ <T> ConcurrentMap<String, List<T>> group(final String field) { return this.group.group(field); } <T> ConcurrentMap<String, List<T>> group(final JsonObject criteria, final String field) { return this.group.group(criteria, field); } // -------------------- Sum Operation ------------ BigDecimal sum(final String field, final JsonObject criteria) { return this.sum.sum(field, criteria); } ConcurrentMap<String, BigDecimal> sum(final String field, final JsonObject criteria, final String groupField) { return this.sum.sum(field, criteria, groupField); } JsonArray sum(final String field, final JsonObject criteria, final String... groupFields) { return this.sum.sum(field, criteria, groupFields); } // ---------------------- Max Operation ------------- BigDecimal max(final String field, final JsonObject criteria) { return this.max.max(field, criteria); } ConcurrentMap<String, BigDecimal> max(final String field, final JsonObject criteria, final String groupField) { return this.max.max(field, criteria, groupField); } JsonArray max(final String field, final JsonObject criteria, final String... groupFields) { return this.max.max(field, criteria, groupFields); } // ---------------------- Min Operation ------------- BigDecimal min(final String field, final JsonObject criteria) { return this.min.min(field, criteria); } ConcurrentMap<String, BigDecimal> min(final String field, final JsonObject criteria, final String groupField) { return this.min.min(field, criteria, groupField); } JsonArray min(final String field, final JsonObject criteria, final String... groupFields) { return this.min.min(field, criteria, groupFields); } // ---------------------- Avg Operation ------------- BigDecimal avg(final String field, final JsonObject criteria) { return this.avg.avg(field, criteria); } ConcurrentMap<String, BigDecimal> avg(final String field, final JsonObject criteria, final String groupField) { return this.avg.avg(field, criteria, groupField); } JsonArray avg(final String field, final JsonObject criteria, final String... groupFields) { return this.avg.avg(field, criteria, groupFields); } }
35bbd4f33c6e4ba08d82fa2b15f914660297defe
abfa43751adf2540663c4e52d2b2c0be8ba7bdb9
/src/main/java/com/hunau/myweather/service/WeatherReportService.java
e53cb01f1398ac82d25f34bd11bb6d0334fb231b
[]
no_license
Cwwjj/myweather
bcb34f56a5eb439b65e47323afe733a6b75170ed
ed0c35814e9a2d242b83fe26d2611c3939421455
refs/heads/master
2021-06-22T22:03:45.506480
2019-10-16T03:33:15
2019-10-16T03:33:15
215,449,497
0
0
null
2021-06-04T02:14:42
2019-10-16T03:33:45
Java
UTF-8
Java
false
false
703
java
package com.hunau.myweather.service; /** * @param * @Description: * @Return: * @Author: 蔡文静 * @单位:湖南农业大学物联网工程专业 * @Date: * @开发版本:综合练习VO.1 */ import com.hunau.myweather.entity.Weather; import com.hunau.myweather.entity.WeatherResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class WeatherReportService { @Autowired private WeatherDataService weatherDataService; public Weather getDataByCityId(String cityId) { WeatherResponse response = weatherDataService.getDataByCityId(cityId); return response.getData(); } }
8e0b0de49916054701a448498d642810e156aace
d48345688f588283f96de61b184ad7c22049cacd
/src/main/java/com/litc/common/util/fts/SolrIndexOperTask.java
4b8a3365da712bd8961a4e6df0376754236ab356
[]
no_license
cnsdLyw/publish_manage
24c6f57da66de70dc6e15889cf59df01976da988
1dd5d67b787053e858a6c212240b47e789c1116a
refs/heads/master
2020-03-11T23:44:56.055036
2018-04-20T08:08:33
2018-04-20T08:08:33
130,330,647
0
0
null
null
null
null
UTF-8
Java
false
false
5,226
java
package com.litc.common.util.fts; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.litc.common.util.Constant; import com.litc.common.util.thread.WorkObjOperate; import com.litc.common.util.thread.WorkTask; /** * 业务逻辑处理类 * * @author sungao * @since 2015-12-28 */ public class SolrIndexOperTask implements WorkTask { private static final long serialVersionUID = 417805089265851324L; private final static Logger logger = LoggerFactory .getLogger(SolrIndexOperTask.class); private String operType; private List<String> resIds; private String taskFlag; private String type; private String desc; public SolrIndexOperTask(String operType, List<String> resIds) { this.operType = operType; this.resIds = resIds; this.taskFlag = java.util.UUID.randomUUID().toString(); this.type = Constant.TYPE_INDEX; this.desc = Constant.DESC_INDEX; } @Override public String getTaskFlag() { return this.taskFlag; } @Override public String getTaskType() { return this.type; } @Override public String getTaskDesc() { return this.desc; } @Override public void runTask() { /** List<ResFileInfo> resFileInfoList = null; ResBasicInfo resBasicInfo = null; if (operType.equals(Constant.METADATA) || operType.equals(Constant.FILEDATA)) { Map<String, String> attrMap = null; for (String id : resIds) { resBasicInfo = SpringContextHandler.getBean( ResBasicInfoService.class).findOne(id); if (resBasicInfo == null) { continue; } attrMap = new ConcurrentHashMap<String, String>(); String detailViewTemplate = SpringContextHandler.getBean( ResItemService.class).getResPropertyValue("", resBasicInfo.getRes_lib_id(), ITEM_PROP_NAME.View_DetailTemplate); String libid = resBasicInfo.getRes_lib_id(); String libName = SpringContextHandler .getBean(ResItemService.class) .findOne(resBasicInfo.getRes_lib_id()).getItem_name(); switch (operType) { case Constant.METADATA: attrMap.put("id", id); attrMap.put("title", resBasicInfo.getTitle()); attrMap.put("type", operType); attrMap.put("createtime", resBasicInfo.getCreate_time()); attrMap.put("updatetime", resBasicInfo.getUpdate_time()); attrMap.put("creator", resBasicInfo.getCreator()); attrMap.put("keyword", ""); attrMap.put("pictureurl", ""); attrMap.put("template", detailViewTemplate); attrMap.put("libid", libid); attrMap.put("libname", libName); Map<String, String> res = SpringContextHandler.getBean( ResStockInService.class).getResItemValue("", libid, id); for (Map.Entry<String, String> map : res.entrySet()) { if (map.getValue() != null && map.getKey() != null) attrMap.put(map.getKey() + Constant.INDEXEXTRE, map.getValue()); } SolrDataImportHandler.indexMetaDataByTempFile(attrMap); cancelTask(); break; case Constant.FILEDATA: resFileInfoList = SpringContextHandler.getBean( ResDownloadService.class).FindResFileList(id); for (ResFileInfo resFileInfo : resFileInfoList) { attrMap = new ConcurrentHashMap<String, String>(); attrMap.put( "id", id + Constant.UNDERLINE + resFileInfo.getFile_id()); attrMap.put("title", resBasicInfo.getTitle() + Constant.LEFTBRACKETS + resFileInfo.getFile_name() + Constant.RIGHTBRACKETS); attrMap.put("type", operType); attrMap.put("template", detailViewTemplate); attrMap.put("libid", libid); attrMap.put("libname", libName); attrMap.put("updatetime", resFileInfo.getUpdate_time()); try { SolrDataImportHandler.indexFilesSolrCell(attrMap, resFileInfoList); } catch (Exception e) { logger.error("添加文件索引异常", e.getMessage()); e.printStackTrace(); } } cancelTask(); break; default: { WorkObjOperate.updateStatus(WorkObjOperate.EXCEPTION, this.taskFlag); throw new RuntimeException( "invalid index operate! operateCode=" + operType); } } } } else { SolrDataImportHandler.indexDelete(resIds); List<String> ids = new ArrayList<String>(); for (String id : resIds) { resBasicInfo = SpringContextHandler.getBean( ResBasicInfoService.class).findOne(id); if (resBasicInfo == null) { continue; } resFileInfoList = SpringContextHandler.getBean( ResDownloadService.class).FindResFileList(id); for (ResFileInfo resFileInfo : resFileInfoList) { ids.add(resBasicInfo.getRes_id() + Constant.UNDERLINE + resFileInfo.getFile_id()); } } SolrDataImportHandler.indexDelete(ids); cancelTask(); } */ } @Override public void cancelTask() { WorkObjOperate.updateStatus(WorkObjOperate.FINISH, this.taskFlag); } @Override public int getProgress() { return 0; } }
24729486f791e1e4303a52a2d9ec23ac866ba172
3800e98126cffca78011dbd92de8a5df194afa3a
/app/src/main/java/ht/ihsi/inventaireterrain/Exceptions/RgphException.java
ee8739e832bb7f0eaa7ab7bd6ad4dbe8c3f2b0c3
[]
no_license
Grafritz/rgph-mobile-Inventaire-Terrain
11b701ac78377c2fb82a33bad0e428266f3f0a9e
88136124072f8f20812ee14b392c6bc73d5c7902
refs/heads/master
2021-01-01T16:31:35.997033
2018-09-18T16:20:27
2018-09-18T16:20:27
97,849,231
0
0
null
null
null
null
UTF-8
Java
false
false
1,075
java
/** * */ package ht.ihsi.inventaireterrain.Exceptions; /** * @author Jordany * */ @SuppressWarnings("serial") public class RgphException extends Exception { private Throwable cause = null; public RgphException() { super(); } public RgphException(String message) { super(message); } public RgphException(String message, Throwable cause) { super(message); this.cause = cause; } public Throwable getCause() { return cause; } public void printStackTrace() { super.printStackTrace(); if (cause != null) { System.err.println("Caused by:"); cause.printStackTrace(); } } public void printStackTrace(java.io.PrintStream ps) { super.printStackTrace(ps); if (cause != null) { ps.println("Caused by:"); cause.printStackTrace(ps); } } public void printStackTrace(java.io.PrintWriter pw) { super.printStackTrace(pw); if (cause != null) { pw.println("Caused by:"); cause.printStackTrace(pw); } } }
6d06b57adc123c1b102d1092dbfd20096bcadefb
b3e067e3c6676ce161769ff58f119fa966307ec5
/src/main/java/com/ysx/common/frameworkext/staticvalue/StaticValue.java
1f0fb8a558aaa2a3646177e9bd94ce9578edf0da
[]
no_license
yangshaoxiang/base-project
2ed74402c5b7caeab491ca81376d68350da3457f
862deb55d60b09f1e32b38911cfbcc21a9583fc9
refs/heads/master
2022-12-04T08:48:56.623056
2020-08-19T13:29:52
2020-08-19T13:29:52
288,684,880
0
1
null
null
null
null
UTF-8
Java
false
false
284
java
package com.ysx.common.frameworkext.staticvalue; import java.lang.annotation.*; /** * @Description: 注入静态属性 未完成 * @Author: ysx */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) @Documented public @interface StaticValue { String value(); }
92a9d4d33fb71ba155fc6fcef7c425eea33ebd61
d7e3b8458bb1f982ad1e93caf56be9bd692b75da
/src/com/company/BaseConverter.java
7e2dec769c35f98f3f52fc6b2d47a2c73987f783
[]
no_license
samsonmwathi/BaseConvertor
6efc40bc38d2df225f37d4f472bcd72a62dd0237
c781c88a9bcec143802b47f59e4771440e135883
refs/heads/main
2023-03-28T08:45:08.203035
2021-03-31T13:59:32
2021-03-31T13:59:32
352,963,141
0
0
null
null
null
null
UTF-8
Java
false
false
7,183
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.company; import java.util.Random; import java.util.Scanner; /** * * @author tony mogoa * * Main class than runs the program. * It contain methods for number system conversion. */ public class BaseConverter { private static final String[] doublesTableHeader = {"S/No.", "Decimal Number", "Binary Number", "Remarks"}; public static void main(String[] args){ startProgram(); } public static void test(){ final String[] header = {"Column 0", "Column 1", "Column 2", "Column 3"}; final String[][] data = {{"Cell [0][0]", "Cell [0][1]", "Cell [0][2]", "Cell [0][3]"}, {"Cell [1][0]", "Cell [1][1]", "Cell [1][2]", "Cell [1][3]"}}; Table table = new Table(header, data, Alignment.RIGHT); table.render(); } public static void startProgram(){ while(true){ printInstructions(); Scanner scanner = new Scanner(System.in); System.out.print("~"); String input = scanner.nextLine(); switch(input){ case "a": renderStatictable(); break; case "b": renderDynamicTable(); break; case "q": System.exit(0); default: try { double num = Double.parseDouble(input); if(isInteger(num)){ String result = convert((int) num, 2); System.out.println(num + " [10] => " + result + " [2]"); }else{ String[] result = convert(num, 2); System.out.println(num + " [10] => " + result[0] + " [2]" + " @" + result[1]); } } catch (NumberFormatException e) { System.out.println("Invalid input."); } break; } } } public static void renderStatictable(){ String[] header = {"Decimal (base 10)", "Binary (base 2)", "Hexadecimal(base 16)"}; String[][] data = new String[23][3]; for (int i = 0; i < 19; i++) { String[] row = {Integer.toString(i), convert(i, 2), convert(i, 16)}; data[i] = row; } int[] otherNums = {31, 100, 255, 256}; for (int i = 0; i < otherNums.length; i++) { String[] row = {Integer.toString(otherNums[i]), convert(otherNums[i], 2), convert(otherNums[i], 16)}; data[i + 19] = row; } Table cLITable = new Table(header, data, Alignment.RIGHT); cLITable.render(); } public static void renderDynamicTable(){ String[][] data = new String[30][4]; double[] randomDoubles = genRandom(); for(int i = 0; i < randomDoubles.length; i++){ String[] result = convert(randomDoubles[i], 2); String[] row = {Integer.toString(i + 1), Double.toString(randomDoubles[i]), result[0], result[1]}; data[i] = row; } Table cLITable = new Table(doublesTableHeader, data, Alignment.RIGHT); cLITable.render(); } public static String convert(int num, int toBase){ return format(calc(num, toBase), toBase); } public static String calc(int num, int toBase){ if(num == 0){ return ""; }else{ return calc(num / toBase, toBase) + "" + toSingleSymbol(num % toBase); } } public void calcIterative(int num){ int value = num; String output = ""; while(value > 0){ int bit = value % 2; value = value / 2; output = bit + output; } } public static String format(String num, int base){ String formattedNum = ""; if(num.equals("")){ return base == 2 ? "0000" : "0"; }else if(base == 2){ for (int i = 0; i < num.length(); i++) { //System.out.println(num); if((i + 1) % 4 == 0 && num.length() != i + 1){ formattedNum = " " + num.charAt(num.length() - 1 - i) + formattedNum; }else{ formattedNum = Character.toString(num.charAt(num.length() - 1 - i)) + formattedNum; } } int numPaddingZeros = 4 - (num.length() % 4); for (int i = 0; i < numPaddingZeros && num.length() % 4 > 0; i++) { formattedNum = "0" + formattedNum; } return formattedNum; }else{ return num; } } public static String toSingleSymbol(int num){ switch(num){ case 10: return "A"; case 11: return "B"; case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F"; default: return Integer.toString(num); } } public static String[] convert(double num, int toBase){ int integralPart = (int) Math.floor(num); double fractionPart = num - integralPart; String beforeRadix = convert(integralPart, toBase); String afterRadix = convertFraction(fractionPart); String remark = "Exact"; if(afterRadix.length() > 5){ remark = "Approximate"; afterRadix = afterRadix.substring(0, 5); } return new String[]{beforeRadix + "." + afterRadix, remark}; } public static boolean isInteger(double num){ return num - (int) Math.floor(num) == 0; } public static String convertFraction(double fraction){ if(fraction == 0){ return ""; }else{ double fractionx2 = fraction * 2; boolean isFractional = (fractionx2 - 1) < 0; return (isFractional ? "0" : "1") + convertFraction(isFractional ? fractionx2 : fractionx2 - 1); } } public static void printInstructions(){ System.out.println("Hi, these are the commands:\n"); System.out.println("\t=>a - show base 2 and 16 equivalents of base 10 0-18, 31, 100, 255, 256"); System.out.println("\t=>b - show base 2 of 30 random base 10 floating point numbers"); System.out.println("\t=>enter any number(even floats) to get the binary equivalent of it"); System.out.println("\t=>q - to quit"); } public static double[] genRandom(){ double[] doubles = new double[30]; for (int i = 0; i < 30; i++) { Random random = new Random(); int integerPart = random.nextInt(1000); int fractionPart = random.nextInt(1000); doubles[i] = Double.parseDouble(integerPart + "." + fractionPart); } return doubles; } }
203f6e255770fd06c368a33a5f5c68fc160f3b70
2a042368abf98f9731b2578065d41595848edec8
/1.1.singleton/src/singleton/version9/Program.java
48cd1240f1da1a3d8e680d177ec27dcf7c5f2191
[]
no_license
MakarandBhoir/JavaDesignPattern
04adf801a3f2ae24e6d2ff27403fac2db61aeede
88578f924fc4a34fd9eb27fbce29045dcb88a7f9
refs/heads/master
2021-04-12T09:56:48.586241
2017-06-16T09:22:20
2017-06-16T09:22:20
94,525,018
2
1
null
null
null
null
UTF-8
Java
false
false
105
java
package singleton.version9; public class Program { public static void main(String[] args) { } }
2f1e03aeefae92e26105731a8c97077e964a690d
2b11909173d0e915495dbc4d1d5ae2bfdefe9215
/src/Runtime/JIT/API/InstructionBuilder.java
6904ba8e2158fd5c0309d6f12ba854fd9b745265
[]
no_license
jm-boley/labomath
94537e2f440005af9f0207886ddb41c24df9fed0
26e6c28e6624c219016f853cfe33c785f71db939
refs/heads/master
2020-05-23T05:06:58.945642
2019-05-21T04:16:29
2019-05-21T04:16:29
186,646,201
0
0
null
null
null
null
UTF-8
Java
false
false
6,744
java
package Runtime.JIT.API; import Runtime.JIT.API.DataType; import Runtime.JIT.API.Instruction; import Runtime.JIT.API.Operand; import Runtime.JIT.SymbolTable; import Runtime.Machine.Interface.Opcodes; import Runtime.Machine.Interface.RegId; import java.util.ArrayList; import java.util.List; /** * * @author Joshua Boley */ public class InstructionBuilder { private final List<List<Instruction>> m_codeSegments; private int m_activeSegment; // Active instruction segment public InstructionBuilder() { m_codeSegments = new ArrayList<>(); m_codeSegments.add(new ArrayList<>()); m_activeSegment = 0; } /** * Returns the currently active instruction segment in the code segment chain * @return Active code segment */ public List<Instruction> getActiveCodeSegment() { return m_codeSegments.get(m_activeSegment); } /** * Returns the ID of the currently active instruction segment in the code * segment chain * @return */ public int getActiveCodeSegmentId() { return m_activeSegment; } /** * * @param idx */ public void setActiveCodeSegment(int idx) { if (idx > 0) m_activeSegment = idx; else throw new IllegalArgumentException(""); } /** * @return */ public int createCodeSegment() { m_codeSegments.add(new ArrayList<>()); return m_codeSegments.size() - 1; } public void createSymbol(String name, DataType datatype) { SymbolTable.registerVariable(name, datatype); } public int createStrLiteral(String value) { return 0; } public List<Instruction> commit() { List<Instruction> program = new ArrayList<>(); m_codeSegments.forEach((codeSegment) -> { program.addAll(codeSegment); }); return program; } public InstructionBuilder MOV(Operand dst, Operand src) { if (dst.getType() == DataType.Imm_Int4 || dst.getType() == DataType.Imm_Str) throw new RuntimeException(""); List<Operand> operands = new ArrayList<>(); operands.add(dst); operands.add(src); Instruction instr = new Instruction(Opcodes.MOV, operands); m_codeSegments .get(m_activeSegment) .add(instr); return this; } public InstructionBuilder ADD(RegId op1, RegId op2) { List<Operand> operands = new ArrayList<>(); operands.add(new Operand(op1)); operands.add(new Operand(op2)); Instruction instr = new Instruction(Opcodes.ADD, operands); m_codeSegments .get(m_activeSegment) .add(instr); return this; } public InstructionBuilder SUB(RegId op1, RegId op2) { List<Operand> operands = new ArrayList<>(); operands.add(new Operand(op1)); operands.add(new Operand(op2)); Instruction instr = new Instruction(Opcodes.SUB, operands); m_codeSegments .get(m_activeSegment) .add(instr); return this; } public InstructionBuilder MUL(RegId op1, RegId op2) { List<Operand> operands = new ArrayList<>(); operands.add(new Operand(op1)); operands.add(new Operand(op2)); Instruction instr = new Instruction(Opcodes.MULT, operands); m_codeSegments .get(m_activeSegment) .add(instr); return this; } public InstructionBuilder DIV(RegId op1, RegId op2) { List<Operand> operands = new ArrayList<>(); operands.add(new Operand(op1)); operands.add(new Operand(op2)); Instruction instr = new Instruction(Opcodes.DIV, operands); m_codeSegments .get(m_activeSegment) .add(instr); return this; } public InstructionBuilder EXP(RegId dst, RegId src) { List<Operand> operands = new ArrayList<>(); operands.add(new Operand(dst)); operands.add(new Operand(src)); m_codeSegments .get(m_activeSegment) .add(new Instruction(Opcodes.EXP, operands) ); return this; } public InstructionBuilder NEG(RegId dst) { List<Operand> operands = new ArrayList<>(); operands.add(new Operand(dst)); m_codeSegments .get(m_activeSegment) .add(new Instruction(Opcodes.NEG, operands) ); return this; } public InstructionBuilder PUSH(RegId src) { List<Operand> operands = new ArrayList<>(); operands.add(new Operand(src)); Instruction instr = new Instruction(Opcodes.PUSH, operands); m_codeSegments .get(m_activeSegment) .add(instr); return this; } public InstructionBuilder POP(RegId dst) { List<Operand> operands = new ArrayList<>(); operands.add(new Operand(dst)); Instruction instr = new Instruction(Opcodes.POP, operands); m_codeSegments .get(m_activeSegment) .add(instr); return this; } // InstructionBuilder CALL(Register64Low indirect); public InstructionBuilder PRINT(Operand src) { List<Operand> operands = new ArrayList<>(); operands.add(src); Instruction instr = new Instruction(Opcodes.PRNT, operands); m_codeSegments .get(m_activeSegment) .add(instr); return this; } public InstructionBuilder CLEAR() { m_codeSegments .get(m_activeSegment) .add(new Instruction(Opcodes.CLR, null)); return this; } public InstructionBuilder READ(Operand dst) { return this; } }
c0a62643328e06650d2a1c238647fed0a6421bc8
2b8cdd96826a4d5fa252c54b4ad6f9a021a6e6d7
/src/main/java/com/homk/common/utils/bean/BeanUtils.java
093c9d97881f3126f560558f80737acac579fc6a
[]
no_license
mengyangxu/Homk
dc4a7990a185f45b37846b2f03269baee7b1ebaf
370ea65010c8a48a2777f282af73645ad25170fb
refs/heads/master
2020-04-05T07:44:02.120406
2018-11-12T02:13:13
2018-11-12T02:13:13
156,686,600
0
0
null
null
null
null
UTF-8
Java
false
false
3,487
java
package com.homk.common.utils.bean; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Bean 工具类 * * @author ruoyi */ public class BeanUtils { /** Bean方法名中属性名开始的下标 */ private static final int BEAN_METHOD_PROP_INDEX = 3; /** * 匹配getter方法的正则表达式 */ private static final Pattern GET_PATTERN = Pattern.compile("get(\\p{javaUpperCase}\\w*)"); /** * 匹配setter方法的正则表达式 */ private static final Pattern SET_PATTERN = Pattern.compile("set(\\p{javaUpperCase}\\w*)"); /** * Bean属性复制工具方法。 * * @param dest 目标对象 * @param src 源对象 */ public static void copyBeanProp(Object dest, Object src) { List<Method> destSetters = getSetterMethods(dest); List<Method> srcGetters = getGetterMethods(src); try { for (Method setter : destSetters) { for (Method getter : srcGetters) { if (isMethodPropEquals(setter.getName(), getter.getName()) && setter.getParameterTypes()[0].equals(getter.getReturnType())) { setter.invoke(dest, getter.invoke(src)); } } } } catch (Exception e) { e.printStackTrace(); } } /** * 获取对象的setter方法。 * * @param obj 对象 * @return 对象的setter方法列表 */ public static List<Method> getSetterMethods(Object obj) { // setter方法列表 List<Method> setterMethods = new ArrayList<Method>(); // 获取所有方法 Method[] methods = obj.getClass().getMethods(); // 查找setter方法 for (Method method : methods) { Matcher m = SET_PATTERN.matcher(method.getName()); if (m.matches() && (method.getParameterTypes().length == 1)) { setterMethods.add(method); } } // 返回setter方法列表 return setterMethods; } /** * 获取对象的getter方法。 * * @param obj 对象 * @return 对象的getter方法列表 */ public static List<Method> getGetterMethods(Object obj) { // getter方法列表 List<Method> getterMethods = new ArrayList<Method>(); // 获取所有方法 Method[] methods = obj.getClass().getMethods(); // 查找getter方法 for (Method method : methods) { Matcher m = GET_PATTERN.matcher(method.getName()); if (m.matches() && (method.getParameterTypes().length == 0)) { getterMethods.add(method); } } // 返回getter方法列表 return getterMethods; } /** * 检查Bean方法名中的属性名是否相等。<br> * 如getName()和setName()属性名一样,getName()和setAge()属性名不一样。 * * @param m1 方法名1 * @param m2 方法名2 * @return 属性名一样返回true,否则返回false */ public static boolean isMethodPropEquals(String m1, String m2) { return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX)); } }
69972a9af9148091d3c71799f0c5edf363315eca
9e8243582366f4b9aa08b6880a96b531a83b29c6
/chapter006-class/src/classTutorial/CalculatorUsingStaticMemberRuntime.java
98b86ae3b20e97d8316cdc6f94c25ed69cf7e86a
[]
no_license
JiKang1991/studyJava-ThisIsJava
ceabbf04f2e5a5f0475c49e797d68e29406a62bd
1690ae93cd0495dbf33191fc2f58087727a590f8
refs/heads/main
2023-03-21T22:34:02.854117
2021-03-14T15:26:41
2021-03-14T15:26:41
327,818,852
0
0
null
null
null
null
UHC
Java
false
false
545
java
package classTutorial; /** * 정적 멤버를 사용하여 선언한 클래스를 실행하는 예제 * @author jikang * */ public class CalculatorUsingStaticMemberRuntime { public static void main(String[] args) { double result1 = 10 * 10 * CalculatorUsingStaticMember.pi; int result2 = CalculatorUsingStaticMember.plus(10, 5); int result3 = CalculatorUsingStaticMember.minus(10, 5); System.out.println("result1 : " + result1); System.out.println("result2 : " + result2); System.out.println("result3 : " + result3); } }
b593738e33b784ad3091f0f18d79123ae6ed32d3
e41ba546b607765e5d29bd0e1b8a33513ba5adc3
/src/com/silnov/thinkingjavaexercises/chapter8/exercise2/Triangle.java
e80860423b75cb730f4ae94e311828cc75336ee2
[]
no_license
alsilnov/ThinkingJavaExercises
3e1a37c0247cf5ef8e4c16dc47763e26ef874e8b
9b1d2f3267d868eede61f02bc74a8c73b30e7c9c
refs/heads/master
2021-10-20T17:27:13.387461
2021-10-08T11:45:36
2021-10-08T11:45:36
248,220,177
0
0
null
null
null
null
UTF-8
Java
false
false
500
java
package com.silnov.thinkingjavaexercises.chapter8.exercise2; public class Triangle extends Shape { @Override public void draw() { System.out.println("Triangle.draw()"); } @Override public void erase() { System.out.println("Triangle.erase()"); } @Override public void msgOverriden() { System.out.println("Triangle.msgOverriden()"); } private String name = "Triangle"; public String toString() { return this.name; } }
e8544c84fe264f4b9539f229e0a87cd88b7f095c
d61cbe04b46e3480d5f2acf356f8ccdbab28dbc7
/OpenWebinars/Programador Java Web/Java 8 para programadores Java/08_Final/src/ejemploclasefinal/CuadradoRelleno.java
45dd332a41b2639f3f40b16709afd986713c831d
[]
no_license
decalion/Formaciones-Platzi-Udemy
d479548c50f3413eba5bad3d01bdd6a33ba75f60
3180d5062d847cc466d4a614863a731189137e50
refs/heads/master
2022-11-30T18:59:39.796599
2021-06-08T20:11:18
2021-06-08T20:11:18
200,000,005
1
2
null
2022-11-24T09:11:48
2019-08-01T07:27:00
Java
UTF-8
Java
false
false
129
java
package ejemploclasefinal; //No nos permite exstender la clase Cuadrado //public class CuadradoRelleno extends Cuadrado{ // //}
52492dfd66e99426376106e54d6c649ecded4422
689a71eb48f04e65d8a461780b388d1d1680afe8
/TicketBookingEngine/src/com/tbe/servlet/EditQuantity.java
c86833f6d7b0b2907bc02615cbbbfc37c59926d4
[]
no_license
udamindu/ticketBookingEngine
036326d4486d89374ad97769ab98d7a986b30b2d
a1c757b0040c0562aa061ceb095bd7e59b649052
refs/heads/master
2021-01-20T19:34:30.922874
2016-07-20T03:55:26
2016-07-20T03:55:26
63,748,636
0
0
null
null
null
null
UTF-8
Java
false
false
1,554
java
package com.tbe.servlet; import java.io.IOException; 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 com.tbe.model.Category; /** * Servlet implementation class EditQuantity */ @WebServlet("/EditQuantity") public class EditQuantity extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public EditQuantity() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String cat = request.getParameter("Catergory").toString(); Category cm = new Category(cat); boolean isSuccess = cm.insertData(); if(isSuccess == true) { request.setAttribute("isSuccess", true); getServletContext().getRequestDispatcher("/views/resourse-add/resourse-add.jsp").forward(request, response); } else { response.getWriter().println("Failed"); } } }
bc9c6e634d7ce9bfcf852801ac0c1403b7cc1fa1
d0b24b9c1745d63600face96ae80c81384ea3baf
/src/com/sbs/example/jspCommunity/servlet/DispatcherServlet.java
e99f53e52295a7dd7a3941d64a7dc6350591d366
[]
no_license
SangWon7242/2021_0520_SBS_JSP
1b70ede4272306dbc11c7250fb796b858096d42a
1e3a33263d8b56266e2e8170b2c87f040f99a3ad
refs/heads/master
2023-04-12T11:26:36.626902
2021-05-21T01:51:30
2021-05-21T01:51:30
369,039,867
0
0
null
null
null
null
UTF-8
Java
false
false
1,704
java
package com.sbs.example.jspCommunity.servlet; 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; import com.sbs.example.jspCommunity.container.Container; import com.sbs.example.jspCommunity.servlet.controller.usr.MemberController; import com.sbs.example.mysqlutil.MysqlUtil; @WebServlet("/usr/*") public class DispatcherServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); resp.setContentType("text/html; charset=UTF-8"); String requestUri = req.getRequestURI(); // 웹 경로 나타남 String[] requestUriBits = requestUri.split("/"); // 하나하나를 슬래시로 나눔 if(requestUriBits.length < 5) { resp.getWriter().append("올바른 요청이 아니니다."); return; } String controllerName = requestUriBits[3]; String actionMethodName = requestUriBits[4]; // member냐 article이냐, showlist냐 showdetail이냐 String jspPath = null; MysqlUtil.setDBInfo("127.0.0.1", "sbsst", "sbs1234124", "jspCommunity"); if(controllerName.equals("member")) { MemberController memberController = Container.memberController; if(actionMethodName.equals("list")) { jspPath = memberController.showList(req, resp); } } MysqlUtil.closeConnection(); RequestDispatcher rd = req.getRequestDispatcher("/jsp/" + jspPath + ".jsp"); rd.forward(req, resp); } }
ae3a39a16bb7738bff933d5038ea45ec02349d2f
8ac01f42f67bb4d1deb0c118c5602c6aaf8b5ce9
/app/src/test/java/com/example/android/app9/ExampleUnitTest.java
d28dcce49fe8cfa00b97e3392fffdea38724c543
[]
no_license
srivatsav1/App9
c2269b9790cb668905caecceefaf3912abd561b4
a7189fcd6ba5fb56280a543b268154daca0e30b7
refs/heads/master
2021-01-13T11:38:44.024987
2017-02-07T18:54:27
2017-02-07T18:54:27
81,242,496
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package com.example.android.app9; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
131a5f2e1c61acf0eee96a662be556d6625a89dd
5d11982887c637e294a8aa370765922cfc7d6e6c
/src/ContactsTest.java
9142c4c1cf938ce9c59be060a4165ed8b372dd1f
[]
no_license
contacts-manager-edwin-matt/contacts-manager
a565f0d53071c2f2a4ef6deea5c3e1b5ac8b834f
1dc3dcddea9fca99eecc17ec92d50bf1dfab3730
refs/heads/master
2020-05-29T10:04:40.967237
2019-05-30T21:01:51
2019-05-30T21:01:51
189,085,269
0
0
null
2019-05-30T21:02:17
2019-05-28T18:50:50
Java
UTF-8
Java
false
false
4,626
java
//package util; import java.io.FileReader; import java.io.BufferedReader; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import util.Input; public class ContactsTest { static Input input = new Input(); public static void main(String[] args) { boolean keepGoing; Scanner scan = new Scanner(System.in); List<String> updatedList = new ArrayList<>(); String directory = "data"; Path folder = Paths.get(directory); Path file = Paths.get(directory, "contacts.txt"); if(Files.notExists(folder)){ try { Files.createDirectories(folder); System.out.println(folder + " was created"); } catch (IOException e) { e.printStackTrace(); } } if(!Files.exists(file)){ try { Files.createFile(file); System.out.println(file + " file was created"); } catch (IOException e) { e.printStackTrace(); } } do { System.out.println("1 - View contacts\n" + "2 - Add a new contact\n" + "3 - Search contact by name\n" + "4 - Delete an existing contact\n" + "Enter an option (1, 2, 3, or 4)"); int userAnswer = input.getInt(1, 4); switch (userAnswer) { case 1: try { System.out.println("Name " + " | " + " Phone number"); System.out.println("----------------------------"); List<String> namesFromFile = Files.readAllLines(file); for (String line : namesFromFile) { String name = line.split(" ")[0]; int number = Integer.parseInt(line.split(" ")[1]); System.out.println(name + " | " + number); } Files.write(file, updatedList); }catch (IOException e){ e.printStackTrace(); } break; case 2: try { System.out.println("Add a name: "); String inputName = scan.nextLine(); System.out.println("Add a number: "); int inputNumber = scan.nextInt(); String contactInfo = inputName + " " + inputNumber; Files.write( Paths.get("data", "contacts.txt"), Arrays.asList(contactInfo), StandardOpenOption.APPEND ); System.out.println("contact has been added"); } catch (IOException e){ e.printStackTrace(); } break; case 3: System.out.println("Give me a name"); String name = scan.nextLine(); try { List<String> namesFromFile = Files.readAllLines(file); String line = namesFromFile.get(0); if (name.equalsIgnoreCase(line)) { return; } System.out.println(line); } catch (IOException e) { e.printStackTrace(); } break; case 4: System.out.println("Delete contact: Enter name"); String deleteName = scan.nextLine(); try { List<String> namesFromFile = Files.readAllLines(file); String line = namesFromFile.get(0); if (deleteName.equalsIgnoreCase(line)) { } } catch (IOException e) { e.printStackTrace(); } break; default: System.err.println("Enter a correct option"); } System.out.println("Would you like to continue using the contact manager?"); keepGoing = input.yesNo(); } while (keepGoing); } }
cf9ee31ec426624f164f16e79e4b1de25038f6a9
5a9a77a8e453db6b9715f15d743bf94e65ec3d86
/app/src/main/java/com/nlnd/pokemonsearch/Utils/ListCallback.java
737913888ca06755ee4a3af41a681169bc922b32
[]
no_license
ipinlnd/PokemonSearch
191ae0bba0ea9a3fd0c14e0b40838ae59d89a7d7
edf7397f23bc1bb9aeca13decf4f95fd0ca93e31
refs/heads/master
2023-01-20T14:10:55.094777
2020-11-20T11:38:39
2020-11-20T11:38:39
314,533,353
0
0
null
null
null
null
UTF-8
Java
false
false
143
java
package com.nlnd.pokemonsearch.Utils; import java.util.List; public interface ListCallback { void onSuccess(List<String> urls); }
7960735994cec430ae54f783c340c4aa1b46fff9
6846a3e3c45388269dfc79d65de70b8756f4f22a
/src/com/ndemyanovskyi/collection/list/FilteredList.java
1aa1a40a89685ff258e2fec4236ac3e11abcb071
[]
no_license
ndemyanovskyi/Utils
3168c8aeee47ef708e64fc385ad42a3c875602ad
030d07a75127b03cd355cba5b9251480f8893ef6
refs/heads/master
2021-01-20T04:32:29.082238
2015-03-18T10:00:11
2015-03-18T10:00:11
32,188,954
0
0
null
null
null
null
UTF-8
Java
false
false
2,975
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.ndemyanovskyi.collection.list; import com.ndemyanovskyi.collection.FilteredCollection; import com.ndemyanovskyi.listiterator.FilteredListIterator; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.RandomAccess; import java.util.function.Predicate; public class FilteredList<E> extends FilteredCollection<E> implements DefaultList<E> { public FilteredList(List<E> base, Predicate<? super E> predicate) { super(base, predicate); } @Override protected List<E> base() { return (List<E>) super.base(); } @Override public boolean addAll(int index, Collection<? extends E> c) { boolean modified = false; for(E e : c) { if(super.add(e)) modified = true; } return modified; } @Override public E get(int index) { int position = 0; if(base() instanceof RandomAccess) { for(int i = 0; i < base().size(); i++) { E e = base().get(i); if(predicate().test(e) && ++position == index) { return e; } } } else { for(Iterator<E> it = base().iterator(); it.hasNext();) { E e = it.next(); if(predicate().test(e) && ++position == index) { return e; } } } throw new IndexOutOfBoundsException( "Index = " + index + "; Bounds = [0; " + position + "]"); } @Override public E set(int index, E element) { throw new UnsupportedOperationException("set"); } @Override public void add(int index, E element) { throw new UnsupportedOperationException("add"); } @Override public E remove(int index) { int position = 0; if(base() instanceof RandomAccess) { for(int i = 0; i < base().size(); i++) { E e = base().get(i); if(predicate().test(e)) position++; if(position == index) return base().remove(i); } } else { for(Iterator<E> it = base().iterator(); it.hasNext();) { E e = it.next(); if(predicate().test(e)) position++; if(position == index) { it.remove(); return e; } } } throw new IndexOutOfBoundsException( "Index = " + index + "; Bounds = [0; " + position + "]"); } @Override public ListIterator<E> listIterator() { return new FilteredListIterator<>(base().listIterator(), predicate()); } @Override public ListIterator<E> listIterator(int index) { ListIterator<E> it = new FilteredListIterator<>(base().listIterator(), predicate()); while(it.hasNext()) { it.next(); if(it.previousIndex() == index) { return it; } } throw new IndexOutOfBoundsException( "Index = " + index + "; Bounds = [0; " + it.nextIndex() + "]"); } @Override public FilteredList<E> subList(int fromIndex, int toIndex) { throw new UnsupportedOperationException("subList"); } }
[ "Назарій@192.168.1.14" ]
Назарій@192.168.1.14
6431862270c374efad9b0c39b2fde60f2ab8d349
57eb23cb5f6bca5179173425b5a0b3d695d55862
/src/main/java/me/yumin/common/model/data/BaseDO.java
619599cbb83587cbf09b003b6ab6263e6f727683
[]
no_license
wangym/java-common
f362acae610d7a21ba901fd67143e110eb5cde69
c920d2394e21bd688b7b483bfd27a9c3a51195d0
refs/heads/master
2021-01-15T09:25:01.778587
2016-10-17T05:44:45
2016-10-17T05:44:45
10,470,024
2
1
null
null
null
null
UTF-8
Java
false
false
646
java
package me.yumin.common.model.data; import lombok.Getter; import lombok.Setter; import me.yumin.common.model.BaseModel; import java.util.Date; /** * @author [email protected] * @since 2016-01-06 */ public abstract class BaseDO extends BaseModel { private static final long serialVersionUID = -8673404570046804823L; @Getter private Date gmtCreate; // 首次创建 @Getter private Date gmtModified; // 最后修改 @Getter @Setter private Integer rowVersion; // 行版本号 @Getter private Integer rowStatus; // 管理状态 @Getter @Setter private Integer bizType; // 业务类型 }
f91e7aee2dcafb43d4868425423889485f87cca9
fe7f84fde3da8039251dc699d4fe58e8ea58875e
/src/test/java/com/ejemplo/clienteshttp/Test_ClienteWebClient.java
dba8dabe21cdaf7e91296961984e7f0ac5cb1681
[]
no_license
rgomeznjava/Ejemplo_WebClient_Spring5_3_7
7fe7bb233f76cd615467714f4cd2e31315d56795
0ec77294b05dbb0616e7b476226e8084d59e35d0
refs/heads/master
2023-05-25T18:39:04.847271
2021-05-28T02:46:10
2021-05-28T02:46:10
370,529,118
1
0
null
null
null
null
UTF-8
Java
false
false
5,147
java
package com.ejemplo.clienteshttp; import java.io.File; import java.util.Properties; import org.apache.commons.io.FileUtils; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; /** * TEST CLIENTE HTTP EJEMPLO (Junit) * */ public class Test_ClienteWebClient { //Salto linea private static final String NEW_LINE = System.getProperty("line.separator"); //Propiedades para configuración, pruebas,etc. private static Properties properties; //Cliente private ClienteWebClient clienteWebClient; //CARPETA Para archivos xml, json,etc. private static String RUTA_PRUEBAS = "/PRUEBAS/"; /** * Inicializar datos para los Test * * @throws Exception */ @Before public void _testInicializar() throws Exception { //RUTA_PRUEBAS = "C:/PRUEBAS/"; //Load de fichero properties = Utilidades.loadPropertiesFile("application.properties"); //add o sobreescribir parametros properties.put("URL_PETICION_GET","https://dummy.restapiexample.com/api/v1/employees/"); properties.put("URL_PETICION_POST","https://xxxxxx/"); properties.put("URL_PETICION_PUT","https://xxxxxxx/"); properties.put("URL_PETICION_DELETE","https://xxxxx/"); properties.put("URL_PETICION_GOOGLE","https://www.google.es"); //Credenciales (caso de usarlas) properties.put("USUARIO","XXXXXX"); properties.put("PASSWORD","XXXXXX"); } //@Ignore ("descomentar para ignorar") @Test public void prueba_GET_TLS() throws Exception { System.out.println(NEW_LINE+"TEST ---> PRUEBA GET (HTTPS-TLS) ..."); //url peticion String urlPeticion = properties.getProperty("URL_PETICION_GET"); //CALL HTTP clienteWebClient = new ClienteWebClient(properties); //Objeto de negocio respuesta cliente RespuestaClienteHttp respuestaCliente = clienteWebClient.realizarPeticion_GET(urlPeticion); //200 Ok, 201 Created, 202 Accepted, 400 Bad request, 406 Not acceptable, 500 Error Server //Todos los igual o mayores de 3xx..4xx..5xx seran errores: //Excpeto los que utilicemos para errores de logica negocio 500 Error Server //400 Bad Request, 406 Not acceptable a medida o reutilizados //El TEST es OK, si trae cod.estado correspodiente a la prueba y recibe XML con confirmacion true/false Assert.assertTrue("TEST PRUEBA GET TLS NO HA PASADO: SE ESPERABA 200 OK", respuestaCliente.getCodigoEstado()==200 && respuestaCliente.getResultado().contains("Tiger Nixon")); } @Ignore ("descomentar para ignorar") @Test public void prueba_POST_XML() throws Exception { System.out.println(NEW_LINE+"TEST ---> PRUEBA POST XML...."); String urlPeticion = properties.getProperty("URL_PETICION_POST"); //Datos XML a enviar, obtenidos de file String nombreArchivoXML = "datos.xml"; File ficheroDatosXML = new File(RUTA_PRUEBAS + nombreArchivoXML); String datosXML = FileUtils.readFileToString(ficheroDatosXML, "UTF-8"); //CALL WS clienteWebClient = new ClienteWebClient(properties); //Objeto respuesta de negocio RespuestaClienteHttp respuestaCliente = clienteWebClient.realizarPeticion_POST(urlPeticion, datosXML); //El TEST es OK, si trae cod.estado correspondiente a la prueba Assert.assertTrue("TEST PRUEBA POST NO HA PASADO: SE ESPERABA 201 - Created", respuestaCliente.getCodigoEstado()==201); } @Ignore ("descomentar para ignorar") @Test public void prueba_DELETE() throws Exception { System.out.println(NEW_LINE+"TEST ---> BORRAR FORMULARIO DELETE...."); //url peticion String urlPeticion = properties.getProperty("URL_PETICION_DELETE"); //CALL WS clienteWebClient = new ClienteWebClient(properties); //Objeto de negocio respuesta cliente RespuestaClienteHttp respuestaCliente = clienteWebClient.realizarPeticion_DELETE(urlPeticion); //El TEST es OK, si trae cod.estado correspodiente a la prueba Assert.assertTrue("TEST BORRAR NO HA PASADO: SE ESPERABA 404 NO CONTENT", respuestaCliente.getCodigoEstado()==404); } @Ignore ("descomentar para ignorar") @Test public void prueba_modificar_PUT_XML() throws Exception { System.out.println(NEW_LINE+"TEST ---> MODIFICAR PUT...."); String urlPeticion = properties.getProperty("URL_PETICION_PUT"); //Datos XML a enviar, obtenidos de file String nombreArchivoXML = "datos.xml"; File ficheroDatosXML = new File(RUTA_PRUEBAS + nombreArchivoXML); String datosXML = FileUtils.readFileToString(ficheroDatosXML, "UTF-8"); //CALL HTTP PUT clienteWebClient = new ClienteWebClient(properties); //Objeto respuesta de negocio RespuestaClienteHttp respuestaCliente = clienteWebClient.realizarPeticion_PUT(urlPeticion, datosXML); //El TEST es OK, si trae cod.estado correspondiente a la prueba Assert.assertTrue("TEST MODIFICAR NO HA PASADO: SE ESPERABA 200- OK", respuestaCliente.getCodigoEstado()==200); } } //_fin
f0ed8117e0794f6f0afaa40e2bf61623c17fb937
5e6e44c6645e9be373a1550145761d7209ce73ad
/src/main/java/com/testapplication/reddit/model/User.java
a24ddc108f66227febd4da83b8783bf2b5f88f1e
[]
no_license
ManjyotThandi/RedditClone
ddf20a9aaafde7ee78d77b25a51cca56b01f2383
11d047148b48527082e80cad4791ba22cc909e10
refs/heads/main
2023-02-05T16:13:46.150380
2020-12-27T01:10:23
2020-12-27T01:10:23
314,415,150
0
0
null
2020-12-27T01:10:24
2020-11-20T01:35:20
Java
UTF-8
Java
false
false
787
java
package com.testapplication.reddit.model; import java.time.Instant; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.validation.constraints.Email; import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor @Entity public class User { @Id @GeneratedValue(generator = "sequence") private Long userId; @NotNull(message = "Please provide a username") private String userName; @NotNull(message = "Please provide a password") private String password; @Email @NotNull(message = "Please provide an email address") private String email; private Instant created; private boolean enabled; }
25f1ffdbf6e5cacd6659c8f35321028eee654d3d
becb59892712285678de095562d0495006173b0e
/src/com/zht/common/codegen/constant/GenConstant.java
807045460f260d626af543915b0a7411ee99ffc1
[]
no_license
zhaohuatai/zframees
2f1d5851bacc6f48943aec8856193ebb840bf35d
68e29e5bf4f07d83a6910d3e6f5fb3707f4d57c8
refs/heads/master
2021-01-19T11:22:28.647802
2015-08-04T08:11:48
2015-08-04T08:11:48
34,708,202
10
4
null
null
null
null
UTF-8
Java
false
false
1,740
java
/** * Copyright (c) 2015 https://github.com/zhaohuatai * * Licensed under the Apache License, Version 2.0 (the "License"); */ package com.zht.common.codegen.constant; import org.zht.framework.util.ConfigUtil; public class GenConstant { public static final String project_path=ConfigUtil.getConfig("system.properties", "project.path"); public static final String genTemplateDir="genTemplate"; public static final String hiberModel_template_dir=project_path+genTemplateDir+"/entity.java.ftl"; //action public static final String action_template_dir=project_path+genTemplateDir+"/Action.java.ftl"; public static final String action_template_just_from_main_dir=project_path+genTemplateDir+"/Action_main.java.ftl"; //dao public static final String daoInterface_template_dir=project_path+genTemplateDir+"/daointerface.java.ftl"; public static final String daoImpl_template_dir=project_path+genTemplateDir+"/daoimpl.java.ftl"; //Service public static final String serviceInterface_template_dir=project_path+genTemplateDir+"/ServiceInterface.java.ftl"; public static final String serviceImpl_template_dir=project_path+genTemplateDir+"/ServiceImpl.java.ftl"; //jsp public static final String jsp_list_dataGrid_template_dir=project_path+genTemplateDir+"/jsp_data_dataGrid.jsp.ftl"; public static final String jsp_list_treeGrid_template_dir=project_path+genTemplateDir+"/jsp_data_treeGrid.jsp.ftl"; public static final String jsp_add_template_dir=project_path+genTemplateDir+"/jsp_Add.jsp.ftl"; public static final String jsp_update_template_dir=project_path+genTemplateDir+"/jsp_Update.jsp.ftl"; public static final String jsp_listforlookup_template_dir=project_path+genTemplateDir+"/jsp_ListLookUp.jsp.ftl"; }
849c1ddb7c3c612fdd5647a04dc19dbb7de049f2
060d2a87839d9d47ca16e13d7b54cf6607af4531
/src/main/java/fr/chess/demo/beans/Position.java
595f44fd5cc7fbe0832c43fa1898dc825d738341
[]
no_license
alexisdemay/chess-demo-app
806f36ccd1296b98481aff39d66afcc2dddd64b2
0e4e9eae9d165363bae816acb3d6716e779c5e14
refs/heads/master
2020-04-29T13:39:20.548823
2019-04-04T21:11:54
2019-04-04T21:11:54
176,174,811
0
0
null
null
null
null
UTF-8
Java
false
false
1,592
java
package fr.chess.demo.beans; import fr.chess.demo.utils.ChessUtils; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; import lombok.extern.log4j.Log4j2; /** * The type Position. */ @Getter @Setter @Log4j2 @AllArgsConstructor public class Position { /** * The Coord x. */ private Integer coordX; /** * The Coord y. */ private Integer coordY; /** * Instantiates a new Position. * * @param position the position */ public Position(Position position) { this.coordX = position.getCoordX(); this.coordY = position.getCoordY(); } /** * Instantiates a new Position. * * @param position the position */ public Position(String position) { if (position == null || position.length() != 2 || !position.matches("^[a-z][0-9]")) { log.error("The actualPosition %s is incorrect", position); } else { this.coordX = ChessUtils.getCoordinateFromChar(position.charAt(0)); this.coordY = Integer.valueOf(String.valueOf(position.charAt(1))) - 1; } } /** * To string string. * * @param coordX the coord x * @param coordY the coord y * @return the string */ public static String toString(Integer coordX, Integer coordY) { return String.format("%s%s", ChessUtils.getCoordinateInString(coordX), coordY + 1); } @Override public String toString() { return String.format("%s%s", ChessUtils.getCoordinateInString(coordX), coordY + 1); } }
650992d61d872310ec3e7c2c9fb2e26a68ef4e89
82e6d43874c944a9899d29b0e616096ce7f463dd
/app/src/main/java/com/tianlunte/wangqytest/adapters/OneChatAdapter.java
1f5ac6825d1e09c838e02c7234c4e1806e2c381c
[]
no_license
tianlunte/WqyAndroidCameraExample
0a5aabaf0faed25a3c332c60aaa2946365e1ab5f
39f0683292b2c19e530dee8a4b1167fdf66e69d1
refs/heads/master
2020-12-24T18:32:03.560455
2016-05-18T07:09:57
2016-05-18T07:09:57
59,087,541
0
0
null
null
null
null
UTF-8
Java
false
false
2,707
java
package com.tianlunte.wangqytest.adapters; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Base64; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.tianlunte.wangqytest.R; import com.tianlunte.wangqytest.models.ChatMessage; import com.tianlunte.wangqytest.utils.CommUtils; import java.util.List; /** * Created by wangqingyun on 5/17/16. */ public class OneChatAdapter extends BaseAdapter { private List<ChatMessage> mDataList; public OneChatAdapter(List<ChatMessage> dataList) { mDataList = dataList; } @Override public int getCount() { return mDataList.size(); } @Override public Object getItem(int position) { return mDataList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup root) { OneChatHolder viewHolder; if(convertView == null) { convertView = LayoutInflater.from(root.getContext()).inflate(R.layout.item_one_chat_list, null); viewHolder = new OneChatHolder(convertView); convertView.setTag(viewHolder); } else { viewHolder = (OneChatHolder)convertView.getTag(); } ChatMessage chatMessage = mDataList.get(position); if(!CommUtils.isNullOrEmpty(chatMessage.getTextMessage())) { viewHolder.pTxtMessageView.setVisibility(View.VISIBLE); viewHolder.pImgMessageView.setVisibility(View.GONE); viewHolder.pTxtMessageView.setText(chatMessage.getTextMessage()); } else if(!CommUtils.isNullOrEmpty(chatMessage.getImageMessage())) { viewHolder.pTxtMessageView.setVisibility(View.GONE); viewHolder.pImgMessageView.setVisibility(View.VISIBLE); byte[] decodedString = Base64.decode(chatMessage.getImageMessage(), Base64.DEFAULT); Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); viewHolder.pImgMessageView.setImageBitmap(decodedByte); } return convertView; } protected static class OneChatHolder { protected TextView pTxtMessageView; protected ImageView pImgMessageView; protected OneChatHolder(View root) { pTxtMessageView = (TextView)root.findViewById(R.id.item_one_chat_text_message); pImgMessageView = (ImageView)root.findViewById(R.id.item_one_chat_image_message); } } }
[ "caojitianlunte@g,mail.com" ]
caojitianlunte@g,mail.com
c51b7fa4a9725d206082e3306fef197af95cdeef
bd18538accf6074cd5275170e075bf248ef192b8
/app/src/main/java/com/pumpit/app/ui/listener/update/UpdateProfileListener.java
fe688a254541654a2cce6040938a6bb67ef59c91
[]
no_license
ChocolateWarrior/Pump-It
b1626c97609c04b87c1c494f6865db478500eaa8
abe8160b05ee9b7f20fda24adea2169126adfc69
refs/heads/master
2021-03-05T03:16:33.974474
2020-06-12T13:52:00
2020-06-12T13:52:00
246,090,856
0
0
null
2020-06-12T13:52:01
2020-03-09T16:47:36
Java
UTF-8
Java
false
false
274
java
package com.pumpit.app.ui.listener.update; public interface UpdateProfileListener { void toggleFinish(); void disableClientsAttributes(); void disableTrainerAttributes(); void checkMaleSex(); void checkFemaleSex(); void onFailure(String message); }
56e1f98b6962aa1009e02146697724cc62e8b106
71444aa450e79456f1b5711b9b4f024c090edece
/src/main/java/com/zhuanglide/proxyspider/task/CollegeDBPipeline.java
7dafa59d01ee345cc0e2e5e223a42685b5c130c3
[]
no_license
wwjwell/proxy-spider
6be92de3effe28dc8890e5cc6125bc160084951c
dea2c1f5e993975420cffbda83a73c5f75a5de2d
refs/heads/master
2021-01-24T23:34:03.890853
2016-05-04T03:09:06
2016-05-04T03:09:06
49,543,149
3
0
null
null
null
null
UTF-8
Java
false
false
1,300
java
package com.zhuanglide.proxyspider.task; import com.zhuanglide.proxyspider.db.DBUtils; import com.zhuanglide.proxyspider.db.mapper.College; import com.zhuanglide.proxyspider.db.mapper.CollegeMapper; import com.zhuanglide.proxyspider.db.mapper.Proxy; import com.zhuanglide.proxyspider.db.mapper.ProxyMapper; import org.apache.ibatis.session.SqlSession; import us.codecraft.webmagic.ResultItems; import us.codecraft.webmagic.Task; import us.codecraft.webmagic.pipeline.Pipeline; import java.util.List; /** * Created by wwj on 16.1.13. */ public class CollegeDBPipeline implements Pipeline { public void process(ResultItems resultItems, Task task) { if (null != resultItems) { DBUtils dbUtils = DBUtils.instance(); SqlSession session = dbUtils.getSqlSession(); CollegeMapper mapper = dbUtils.getMapper(CollegeMapper.class, session); List<College> proxyList = (List<College>) resultItems.get(ProxyTask.IPS); if (null != proxyList) { for (College college : proxyList) { mapper.insert(college); System.out.println(college.getName() + " add db"); } } session.commit(); dbUtils.closeSqlSession(session); } } }
3c118d70c3e345922891631dbab05807aa048646
d016d31ade4639d53ff45f7c646c11e748d78b68
/src/main/java/net/lecigne/n2t/hackassembler/service/Converter.java
e1c727b1042b1d00b7bff094cb9d19c3d2e3ed75
[]
no_license
alecigne/hack-assembler
6c899bdb008ecc93830790325c70e620ad92efea
7d82ed48c451f288837d8ca49705bdbd5df2b686
refs/heads/master
2022-09-21T14:19:56.397421
2020-05-30T18:28:51
2020-05-30T19:06:24
266,218,821
0
0
null
null
null
null
UTF-8
Java
false
false
3,312
java
package net.lecigne.n2t.hackassembler.service; import net.lecigne.n2t.hackassembler.model.AInstruction; import net.lecigne.n2t.hackassembler.model.CInstruction; import net.lecigne.n2t.hackassembler.model.Instruction; import java.util.HashMap; import java.util.function.Function; public class Converter implements Function<Instruction, String> { private static final HashMap<String, String> DEST_MAP = new HashMap<>(); private static final HashMap<String, String> COMP_MAP = new HashMap<>(); private static final HashMap<String, String> JUMP_MAP = new HashMap<>(); private static final String CINST_PREFIX = "111"; public Converter() { initMaps(); } @Override public String apply(Instruction instruction) { switch (instruction.getInstructionType()) { case A: return convertAInstruction((AInstruction) instruction); case C: return convertCInstruction((CInstruction) instruction); default: return null; } } private String convertAInstruction(AInstruction aInstruction) { String binaryAddress = Integer.toBinaryString(Integer.parseInt(aInstruction.getAddress())); return String.format("%16s", binaryAddress).replace(' ', '0'); } private String convertCInstruction(CInstruction cInstruction) { return String.join("", CINST_PREFIX, COMP_MAP.get(cInstruction.getComp()), DEST_MAP.get(cInstruction.getDest()), JUMP_MAP.get(cInstruction.getJump())); } private void initMaps() { DEST_MAP.put(null, "000"); DEST_MAP.put("M", "001"); DEST_MAP.put("D", "010"); DEST_MAP.put("MD", "011"); DEST_MAP.put("A", "100"); DEST_MAP.put("AM", "101"); DEST_MAP.put("AD", "110"); DEST_MAP.put("AMD", "111"); COMP_MAP.put("0", "0101010"); COMP_MAP.put("1", "0111111"); COMP_MAP.put("-1", "0111010"); COMP_MAP.put("D", "0001100"); COMP_MAP.put("A", "0110000"); COMP_MAP.put("!D", "0001101"); COMP_MAP.put("!A", "0110001"); COMP_MAP.put("-D", "0001111"); COMP_MAP.put("-A", "0110011"); COMP_MAP.put("D+1", "0011111"); COMP_MAP.put("A+1", "0110111"); COMP_MAP.put("D-1", "0001110"); COMP_MAP.put("A-1", "0110010"); COMP_MAP.put("D+A", "0000010"); COMP_MAP.put("D-A", "0010011"); COMP_MAP.put("A-D", "0000111"); COMP_MAP.put("D&A", "0000000"); COMP_MAP.put("D|A", "0010101"); COMP_MAP.put("M", "1110000"); COMP_MAP.put("!M", "1110001"); COMP_MAP.put("-M", "1110011"); COMP_MAP.put("M+1", "1110111"); COMP_MAP.put("M-1", "1110010"); COMP_MAP.put("D+M", "1000010"); COMP_MAP.put("D-M", "1010011"); COMP_MAP.put("M-D", "1000111"); COMP_MAP.put("D&M", "1000000"); COMP_MAP.put("D|M", "1010101"); JUMP_MAP.put(null, "000"); JUMP_MAP.put("JGT", "001"); JUMP_MAP.put("JEQ", "010"); JUMP_MAP.put("JGE", "011"); JUMP_MAP.put("JLT", "100"); JUMP_MAP.put("JNE", "101"); JUMP_MAP.put("JLE", "110"); JUMP_MAP.put("JMP", "111"); } }
9603a005d150bb3cfe46d2c708f3fc9a7657121e
87004f677281a166bec218dfa3c6480f86f3541e
/customerprofile-CRUD/src/main/java/com/demo/customerprofile/probe/ProfileCrudProbeController.java
5033938c99229a510baa1fc1114fa74c032ca5ef
[]
no_license
pnkjsmwl/aws
6b174906dc547e7a469c049cd04518dd34466117
8fda4bdce465e9609604c7bfe7fa3e4671386c47
refs/heads/master
2022-12-22T02:41:35.002263
2019-07-11T15:21:22
2019-07-11T15:21:22
189,461,632
0
0
null
null
null
null
UTF-8
Java
false
false
1,023
java
package com.demo.customerprofile.probe; import java.util.HashMap; import java.util.Map; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class ProfileCrudProbeController { @GetMapping("/live") public ResponseEntity<?> liveCheck(){ Map<String,String> map = new HashMap<>(); map.put("Message", "Profile Crud App is live."); return ResponseEntity.status(200).body(map); } @GetMapping("/ready") public ResponseEntity<?> readyCheck(){ /* * Here we need to implement some kind of logic which determines whether app is ready to server traffic, logic could include * * 1. db connection check. * 2. if app is dependent on any FS then check if its available. * * */ Map<String,String> map = new HashMap<>(); map.put("Message", "Profile Crud App is ready."); return ResponseEntity.status(200).body(map); } }
c108058f61f2145cbd4d54ffa883559cbf88447b
ff1bf54b4886b12f04073479e8e71c8b225ce42a
/service/service-edu/src/main/java/com/atguigu/serviceedu/controller/EduVideoController.java
c1b7184a3a96cf1ff55bb3c64567b7d0f748b202
[]
no_license
YangJianbang/guli-parent
186d9fc4a250a5ace1b97486f622cc1e2e374522
d1f91a30230e4c47fae4e605f4f3c6defb50e783
refs/heads/master
2023-01-16T07:29:44.862171
2020-11-27T12:46:49
2020-11-27T12:46:49
311,391,396
0
0
null
null
null
null
UTF-8
Java
false
false
1,934
java
package com.atguigu.serviceedu.controller; import com.atguigu.commonutils.R; import com.atguigu.servicebase.exception.GuliException; import com.atguigu.serviceedu.client.VodClient; import com.atguigu.serviceedu.entity.EduVideo; import com.atguigu.serviceedu.service.EduVideoService; import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; /** * <p> * 课程视频 前端控制器 * </p> * * @author atguigu * @since 2020-10-27 */ @Api(description = "小节分类") @RestController @RequestMapping("/serviceedu/video") public class EduVideoController { @Autowired EduVideoService videoService; @Autowired VodClient vodClient; // 修改小节 @PostMapping("updateVideo") public R updateVideo(@RequestBody EduVideo eduVideo) { videoService.updateById(eduVideo); return R.ok(); } //根据小节ID获得小节 @GetMapping("getVideo/{id}") public R getVideo(@PathVariable String id) { EduVideo video = videoService.getById(id); return R.ok().data("video", video); } //根据小节ID删除小节 @DeleteMapping("deleteVideo/{id}") public R deleteVideo(@PathVariable String id) { System.out.println("11111"); EduVideo video = videoService.getById(id); String videoSourceId = video.getVideoSourceId(); if (!StringUtils.isEmpty(videoSourceId)) { R r = vodClient.deleteVideo(videoSourceId); if (r.getCode()!=20000){ throw new GuliException(20001,"timeout"); } } videoService.removeById(id); return R.ok(); } // 添加小节 @PostMapping("saveVideo") public R saveVideo(@RequestBody EduVideo eduVideo) { videoService.save(eduVideo); return R.ok(); } }
ca85c4b274f915e35bc6f542e5e2d8cdef329f5b
c7aa202c13c7b1e63941f29797b4cde9fb6c28f3
/app/src/main/java/info/camposha/retrofitlistviewjson/SplashActivity.java
979f18e6a1a20c6f0fb61c9229a962b50c4163a5
[]
no_license
ibalm9/NewRetrofitListViewJSONN
9edfd75645358f6e2ea9bce678160d033b4bd032
eda3087794e4353d2f74c626d8602d058b4d976d
refs/heads/master
2022-02-01T02:09:39.038093
2019-07-17T12:36:02
2019-07-17T12:36:02
194,690,741
0
0
null
null
null
null
UTF-8
Java
false
false
840
java
package info.camposha.retrofitlistviewjson; import android.app.Activity; import android.os.Bundle; import android.content.Intent; public class SplashActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); Thread thread = new Thread() { @Override public void run() { try { sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } finally{ startActivity(new Intent (SplashActivity.this, MainActivity.class)); finish(); } } }; thread.start(); } }
d3bdd214afe17438c8c199925beb7af6372ef0ba
59ba4749455e21d770f0c7e12442480e465d1b36
/src/Homework4_KthSmallestElementInaSortedMatrix_378/KthSmallestElementInaSortedMatrix.java
575631a34f2faad55b3a26a191795758f393b1ee
[]
no_license
junj0619/CodeLab
b24977e4d96a6bb3aa066f01a8d58e1b8d8d079d
84e52859bc97b1f0e8c5a79e3e05e8c4aa8c4c67
refs/heads/master
2021-06-07T21:45:50.037012
2020-04-14T18:55:17
2020-04-14T18:55:17
93,473,161
1
0
null
null
null
null
UTF-8
Java
false
false
923
java
/* * matrix = [ * [ 1, 5, 9], * [10, 11, 13], * [12, 13, 15] ],k = 8, * * return 13. * * Input: [[1,4],[2,5]] , k =2 * Output: 1 By using MaxHeap Incorrect !!! * Expected : 2 * * Beats : 22.19% * Runtime: 50 ms * **/ public class Solution { public int kthSmallest(int[][] matrix, int k) { int n = matrix.length * (matrix[0].length); PriorityQueue<Integer> minHeap = new PriorityQueue<>(); for(int i = 0; i < matrix.length; i++) { for(int j = 0; j < matrix[i].length; j++) { if(minHeap.isEmpty()){ minHeap.offer(matrix[i][j]); } else if(matrix[i][j] >= minHeap.peek()) { minHeap.offer(matrix[i][j]); } } } for(int i = 1; i < k; i++) { minHeap.poll(); } return minHeap.peek(); } }
a0efc169ad0781966fb40b1d61496408e4aaa0a3
14d37b2d909c80ae5b000baa1dee31c013da1e1d
/sygd-core/src/main/java/com/sygdsoft/jsonModel/CookHelper.java
0895478a8269a0837ab820f841d856d2f842703c
[]
no_license
sichengde/sygd-3.0
9f75dfdb589764e24707f6c203197be082afa5ef
f937d74f1dc4e9a3618c6ecb25de1e5bd741155a
refs/heads/master
2020-04-07T19:28:37.056155
2018-11-22T06:11:37
2018-11-22T06:11:37
158,650,277
0
0
null
null
null
null
UTF-8
Java
false
false
841
java
package com.sygdsoft.jsonModel; /** * Created by Administrator on 2017/2/19 0019. */ public class CookHelper { private String title;//营业部门/桌台/类别 private String name;//菜品名 private String num;//数量 private String cooked;//做没做 public CookHelper() { } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNum() { return num; } public void setNum(String num) { this.num = num; } public String getCooked() { return cooked; } public void setCooked(String cooked) { this.cooked = cooked; } }
a52edf52d0069e1c9fef5701b89e855f7020b4a2
0db469f7f1cea3297b55cc937745a264bd89a7de
/app/src/test/resources/org/jboss/hal/processor/mbui/form/Mbui_SaveHandlerView.java
f2bb46a543e1852bdbc9774ca8986685c0a8253c
[ "MIT", "Apache-2.0" ]
permissive
bmaxwell/console-1
df793c694a814df91821ce316547c30eeee75952
ee5f8f0fcf78645ff2df1bcf944c1fa5e1099018
refs/heads/master
2020-11-26T16:55:39.733526
2019-11-28T16:15:14
2019-11-28T16:15:14
229,145,923
1
0
Apache-2.0
2019-12-19T22:04:05
2019-12-19T22:04:04
null
UTF-8
Java
false
false
3,080
java
package org.jboss.hal.processor.mbui.form; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Generated; import javax.inject.Inject; import com.google.gwt.safehtml.shared.SafeHtmlUtils; import elemental2.dom.HTMLElement; import org.jboss.gwt.elemento.core.builder.ElementsBuilder; import org.jboss.gwt.elemento.core.Elements; import org.jboss.gwt.elemento.template.TemplateUtil; import org.jboss.hal.ballroom.form.Form; import org.jboss.hal.ballroom.table.Scope; import org.jboss.hal.ballroom.LayoutBuilder; import org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete; import org.jboss.hal.core.mbui.dialog.AddResourceDialog; import org.jboss.hal.core.mbui.form.GroupedForm; import org.jboss.hal.core.mbui.form.ModelNodeForm; import org.jboss.hal.core.mbui.table.ModelNodeTable; import org.jboss.hal.core.mbui.MbuiContext; import org.jboss.hal.dmr.Operation; import org.jboss.hal.dmr.ResourceAddress; import org.jboss.hal.meta.AddressTemplate; import org.jboss.hal.meta.Metadata; import org.jboss.hal.meta.security.Constraint; import org.jboss.hal.resources.Ids; import org.jboss.hal.spi.Message; import org.jboss.hal.spi.MessageEvent; import static java.util.Arrays.asList; import static org.jboss.gwt.elemento.core.Elements.*; import static org.jboss.hal.ballroom.LayoutBuilder.column; import static org.jboss.hal.ballroom.LayoutBuilder.row; import static org.jboss.hal.dmr.ModelDescriptionConstants.ADD; import static org.jboss.hal.dmr.ModelDescriptionConstants.READ_RESOURCE_OPERATION; /* * WARNING! This class is generated. Do not modify. */ @Generated("org.jboss.hal.processor.mbui.MbuiViewProcessor") public final class Mbui_SaveHandlerView extends SaveHandlerView { private final Metadata metadata0; private final Map<String, HTMLElement> expressionElements; @Inject @SuppressWarnings("unchecked") public Mbui_SaveHandlerView(MbuiContext mbuiContext) { super(mbuiContext); AddressTemplate metadata0Template = AddressTemplate.of("/subsystem=foo"); this.metadata0 = mbuiContext.metadataRegistry().lookup(metadata0Template); this.expressionElements = new HashMap<>(); form = new ModelNodeForm.Builder<org.jboss.hal.dmr.ModelNode>("form", metadata0) .onSave((form, changedValues) -> presenter.saveForm(form, changedValues)) .prepareReset(form -> resetSingletonForm("Form", metadata0Template.resolve(statementContext()), form, metadata0)) .build(); HTMLElement html0; HTMLElement root = row() .add(column() .add(html0 = div() .innerHtml(SafeHtmlUtils.fromSafeConstant("<h1>Form</h1>")) .get()) .add(form) ) .get(); expressionElements.put("html0", html0); registerAttachable(form); initElement(root); } @Override public void attach() { super.attach(); } }
034c97a456a9affc38f31941c7fbc4c8226cadf8
22301b53eb393890811d73de96dbbf30650ac61b
/server/app/src/main/java/ch/heigvd/res/CalculatorServer.java
593d54fc08ce5b9d99dfe66d7e9bc35d7c50f34f
[]
no_license
Jostoph/res_calculator
c59fc9b2d6b87067b1fdd7a5ecce7cb3010f8e18
a726ed1bd9b2241c18bd266cd2bcc549ad5a2084
refs/heads/master
2020-05-03T09:58:56.299789
2019-04-01T09:03:27
2019-04-01T09:03:27
178,568,122
0
0
null
null
null
null
UTF-8
Java
false
false
7,389
java
package ch.heigvd.res; import java.io.*; import java.net.ServerSocket; import java.net.Socket; /** * Class ch.heigvd.res.CalculatorServer * * Simple TCP server that binds a server socket on port 2019 and waits that a client connects. * When the connection with the client is established (supports only one client) the server asks * the client to enter a command. * The client can ask the server to solve some really simple computations and send back the answer, and * exit (end the program) by entering the "quit" or "exit" command. * * @author Jostoph * @version 1.0 * * Based on the StreamingTimeServer by Olivier Liechti (HEIG-VD RES Cours) */ public class CalculatorServer { // port number private final int listenPort = 2019; /** * Does the entire processing */ public void start() { System.out.println("Starting Calculator server..."); ServerSocket serverSocket = null; Socket clientSocket = null; BufferedReader reader = null; PrintWriter writer = null; // String to store client inputs String inputString; // tokens from client commands String[] tokens; // state of the server boolean running = true; try { // create server socket serverSocket = new ServerSocket(listenPort); // create client socket and wait for client (supports only a single client) System.out.println("Waiting for a client..."); clientSocket = serverSocket.accept(); System.out.println("Client connected"); // create input stream reader reader = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); // create output stream writer writer = new PrintWriter(clientSocket.getOutputStream()); // first operand double a; // second operand double b; writer.println("Welcome on the server !\n"); writer.println("What do you want to compute ? Type : (help) to have the list of commands"); send(writer); // processing loop, loop until client quits (or fatal error) while (running) { // wait for client input and read line inputString = reader.readLine(); // split input into tokens tokens = inputString.split(" "); // parse command if(tokens.length == 1) { switch (tokens[0]) { case "" : break; case "quit" : running = false; break; case "exit" : running = false; break; case "help" : printHelp(writer); break; default : } } else if(tokens.length == 3) { try { a = Double.parseDouble(tokens[1]); b = Double.parseDouble(tokens[2]); switch (tokens[0]) { case "add" : writer.println(tokens[1] + " + " + tokens[2] + " = " + (a + b) + "\n"); break; case "sub" : writer.println(tokens[1] + " - " + tokens[2] + " = " + (a - b) + "\n"); break; case "mul" : writer.println(tokens[1] + " * " + tokens[2] + " = " + (a * b) + "\n"); break; case "div" : writer.println(tokens[1] + " / " + tokens[2] + " = " + (a / b) + "\n"); break; default: invalidCMD(writer); } } catch (NumberFormatException nfe) { invalidArguments(writer); } } else { invalidCMD(writer); } if(running) { writer.println("Enter another command (quit) to exit :"); } else { writer.println("\nbye !"); } send(writer); } } catch (IOException ex) { printError(ex); } finally { try { if(reader != null) { reader.close(); } } catch (IOException ex) { printError(ex); } if(writer != null) { writer.close(); } try { if(clientSocket != null) { clientSocket.close(); } } catch (IOException ex) { printError(ex); } try { if(serverSocket != null) { serverSocket.close(); } } catch (IOException ex) { printError(ex); } } // server stop System.out.println("Stopping Calculator server..."); } /** * Add a message to tell the client that it is the last line * and flushes the writer * @param writer the output stream writer */ private void send(PrintWriter writer) { writer.println("\nmsg_end"); writer.flush(); } /** * Informs the client that command he entered is invalid * @param writer the output stream writer */ private void invalidCMD(PrintWriter writer) { writer.println("Invalid command ! Please type (help) to get the commands list."); } /** * Informs the client that the arguments he entered are invalid * @param writer the output stream writer */ private void invalidArguments(PrintWriter writer) { writer.println("Invalid arguments ! Please be sure to enter legit numbers !"); } /** * Prints the error message in the server shell in case of Exception * @param ex the caught exception */ private void printError(Exception ex) { System.out.println("Error : " + ex.getMessage() + "\n"); } /** * Sends the command list to the client * @param writer the output stream writer */ private void printHelp(PrintWriter writer) { StringBuilder sb = new StringBuilder("---- help ----\n\n"); sb.append("help : this page\n"); sb.append("quit : exit the program\n"); sb.append("exit : same as quit\n\n"); sb.append("add a b : computes a + b\n"); sb.append("sub a b : computes a - b\n"); sb.append("mul a b : computes a * b\n"); sb.append("div a b : computes a / b\n"); writer.println(sb); } /** * @param args the command line arguments (not used) */ public static void main(String[] args) { // create a new server instance CalculatorServer server = new CalculatorServer(); // start server server.start(); } }
f7bcbb1f3150793818874c637d57e5f730307c2c
395f2296a098ef043c81299846e0ea20de1c8904
/src/main/java/com/dhu/kgproject/controller/FileUploadController.java
0585aed9311975da9bd40a501f819cf7c325d28b
[]
no_license
caizhijian13/b117
53651c05eac2527db75a3878dc8d0232866694a1
fdd6871578d5cdd818ac98b1fdd32633a6c30cf7
refs/heads/master
2021-09-09T20:55:42.035085
2020-05-19T12:56:15
2020-05-19T12:56:15
206,287,420
1
0
null
2021-09-01T18:39:38
2019-09-04T09:53:33
JavaScript
UTF-8
Java
false
false
2,540
java
package com.dhu.kgproject.controller; import com.dhu.kgproject.storage.StorageFileNotFoundException; import com.dhu.kgproject.storage.StorageException; import com.dhu.kgproject.storage.StorageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.Resource; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.io.IOException; import java.util.stream.Collectors; public class FileUploadController { private final StorageService storageService; @Autowired public FileUploadController(StorageService storageService) { this.storageService = storageService; } @GetMapping("/file") public String listUploadedFiles(Model model) throws IOException { model.addAttribute("files", storageService.loadAll().map( path -> MvcUriComponentsBuilder.fromMethodName(FileUploadController.class, "serveFile", path.getFileName().toString()).build().toString()) .collect(Collectors.toList())); return "uploadForm"; } @GetMapping("/file/files/{filename:.+}") @ResponseBody public ResponseEntity<Resource> serveFile(@PathVariable String filename) { Resource file = storageService.loadAsResource(filename); return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getFilename() + "\"").body(file); } // @PostMapping("/") @RequestMapping("/file") public String handleFileUpload(@RequestParam("file") MultipartFile file, RedirectAttributes redirectAttributes) { storageService.store(file); redirectAttributes.addFlashAttribute("message", "You successfully uploaded " + file.getOriginalFilename() + "!"); return "redirect:/file"; } @ExceptionHandler(StorageFileNotFoundException.class) public ResponseEntity<?> handleStorageFileNotFound(StorageFileNotFoundException exc) { return ResponseEntity.notFound().build(); } }
2ab48be319d2b8551744327a5b41e2639ec41c8f
d41bac77263d76f6000214aaa5c5d3bd361128ab
/project_chatting/Server.java
049fc2497b56efabbe104435a1b3e79b0ab9d203
[]
no_license
jjh4435/project_chatting
e762ed86b019e8b011ffeff65ec695b0e471dc51
b75f4ebf7f2304b1bc77fc598eb17bc81b876232
refs/heads/master
2023-08-17T06:13:00.186145
2021-09-16T09:41:48
2021-09-16T09:41:48
407,046,480
0
0
null
null
null
null
UHC
Java
false
false
13,325
java
package project_chatting; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.StringTokenizer; import java.util.Vector; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; import javax.swing.text.DefaultCaret; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.ImageIcon; import db.ConfirmDB; import db.InsertDB; import db.SelectDB; import db.VO; import javax.swing.JScrollBar; import javax.swing.JScrollPane; public class Server extends JFrame implements ActionListener { // 인터페이스// private JPanel contentPane; private JTextArea chat_area1 = new JTextArea(""); private JButton start_btn = new JButton("서버가동"); private JButton chatLog_btn = new JButton("채팅로그"); private JButton conLog_btn = new JButton("접속로그"); private JButton exit_btn = new JButton("서버종료"); private JButton client_bnt = new JButton("\uD074\uB77C\uC774\uC5B8\uD2B8"); private final JLabel lblNewLabel = new JLabel("New label"); private JScrollPane scrollPane; //스크롤 아직 아래 고정 구현 x // network 변수 private ServerSocket server_socket = null; private Socket socket = null; private Vector user_vc = new Vector(); private StringTokenizer st; private StringTokenizer st2; private StringTokenizer st3; //시간 변수 SimpleDateFormat format1 = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss"); public Server() { // 서버 생성자 init(); // 화면 생성자 실행 start();// start 생성자 실행 } private void start() {// 버튼에 액션 넣어라 start_btn.addActionListener(this); exit_btn.addActionListener(this); chatLog_btn.addActionListener(this); conLog_btn.addActionListener(this); }//start-end private void init() {//init();를 통해 실행=> 화면 구성 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 700, 700); setTitle("서버관리자"); contentPane = new JPanel(); contentPane.setBackground(new Color(0, 0, 0)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); //===================================== start start_btn.setBackground(new Color(255, 69, 0)); start_btn.setForeground(Color.WHITE); start_btn.setFont(new Font("맑은 고딕", Font.BOLD, 15)); start_btn.setBounds(37, 558, 113, 60); contentPane.add(start_btn); //======================================chat log chatLog_btn.setBackground(new Color(255, 69, 0)); chatLog_btn.setForeground(Color.WHITE); chatLog_btn.setFont(new Font("맑은 고딕", Font.BOLD, 15)); chatLog_btn.setBounds(162, 558, 113, 60); contentPane.add(chatLog_btn); //=======================================connect log conLog_btn.setBackground(new Color(255, 69, 0)); conLog_btn.setForeground(Color.WHITE); conLog_btn.setFont(new Font("맑은 고딕", Font.BOLD, 15)); conLog_btn.setBounds(287, 558, 113, 60); contentPane.add(conLog_btn); //========================================client client_bnt.setBackground(new Color(255,69,0)); client_bnt.setForeground(Color.WHITE); client_bnt.setFont(new Font("맑은 고딕", Font.BOLD, 15)); client_bnt.setBounds(413, 558, 113, 60); contentPane.add(client_bnt); //========================================== exit exit_btn.setBackground(new Color(255, 69, 0)); exit_btn.setForeground(Color.WHITE); exit_btn.setFont(new Font("맑은 고딕", Font.BOLD, 15)); exit_btn.setBounds(537, 558, 113, 60); contentPane.add(exit_btn); //========================================== icon lblNewLabel.setIcon(new ImageIcon(Server.class.getResource("/icon2.png"))); lblNewLabel.setBounds(275, 10, 125, 130); contentPane.add(lblNewLabel); //========================================== chat area chat_area1.setEditable(false);//수정 불가 chat_area1.setFont(new Font("맑은 고딕", Font.PLAIN, 15)); chat_area1.setBorder(new LineBorder(new Color(255, 69, 0), 1, true)); chat_area1.setBounds(130, 153, 418, 387); scrollPane = new JScrollPane(chat_area1);//스크롤 추가 scrollPane.setBorder(new LineBorder(new Color(255, 69, 0), 1, true)); scrollPane.setBounds(130, 153, 418, 387); chat_area1.setCaretPosition(chat_area1.getDocument().getLength()); DefaultCaret caret = (DefaultCaret)chat_area1.getCaret();//?? caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); chat_area1.setLineWrap(true); contentPane.add(scrollPane); this.setVisible(true);//화면 띄움 //클라이언트 버튼을 누르면 클라이언트 메인 실행 client_bnt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Client.main(null); } }); }//init - end private void Server_strat() {//server_start 실행 try { server_socket = new ServerSocket(7770); } catch (IOException e) { // 오류 시 출력 메시지 없음 } if (server_socket != null) { Connection(); // 소켓에 값이 바인딩 되면 connection 생성자 실행 } } private void Connection() {//커낵션 생성자 Thread th = new Thread(new Runnable() {// 쓰레드에 runnable 내용을 넣음 @Override public void run() {//runnable 실행 while (true) { try { socket = server_socket.accept();//서버에서 받음 UserInfo user = new UserInfo(socket); user.start(); } catch (IOException e) { JOptionPane.showMessageDialog(null, "서버종료완료!", "확인", JOptionPane.ERROR_MESSAGE); break; } } // while-end } });//runnable-end th.start();//쓰레드 실행 } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == start_btn) { Server_strat(); // 소켓생성 및 대기상태 chat_area1.append("network connect ok...!\n"); start_btn.setEnabled(false); exit_btn.setEnabled(true); try { ConfirmDB con = new ConfirmDB(); int num = con.confirm(); if (num == 1 ) { chat_area1.append("db table not exist!\ntable create..!\ndb connect ok..!\n"); }else {chat_area1.append("db connect ok..!\n");} } catch (ClassNotFoundException | SQLException e1) { } } else if (e.getSource() == exit_btn) { if(server_socket == null) { exit_btn.setEnabled(false); //client.setVisible(false); }else { try { start_btn.setEnabled(true); server_socket.close(); user_vc.removeAllElements(); chat_area1.setText(""); } catch (IOException e1) {}} } else if (e.getSource() == chatLog_btn) { //////////////채팅로그보기 try { SelectDB sel = new SelectDB(); ArrayList<VO> vo = sel.select_chat(); for (VO v : sel.getArr_vo()) { chat_area1.append(format1.format(v.getTime())+"\n"); chat_area1.append(v.getStr()+"\n"); } } catch (ClassNotFoundException e1) { } catch (SQLException e1) { } } else if (e.getSource() == conLog_btn) { ////////////////////출입로그보기 try { SelectDB sel = new SelectDB(); ArrayList<VO> vo = sel.select_con(); for (VO v : sel.getArr_vo()) { chat_area1.append(format1.format(v.getTime())+"\n"); chat_area1.append(v.getStr()+"\n"); } } catch (ClassNotFoundException e1) { } catch (SQLException e1) { } } } //userinfo는 쓰레드 상속을 받음 //실행되기 전까지 userinfo를 받아 작업을 수행 class UserInfo extends Thread { //stream -> 데이터 입출력 // 단일방향으로 흘러가는 것, 동시 사용 불가 private InputStream is;//입력 //클라이언트에서 받은걸 다시 들여옴 private OutputStream os;//출력 private DataInputStream dis;//형식에 맞는 타입별로 변환 출력 private DataOutputStream dos;//형식에 맞는 타입별로 변환 //클라이언트 쪽에서 받아들어옴(1) 306 private Socket user_socket; private String nickname = ""; //============================생성자 public UserInfo(Socket soc) {//유저 인포로 가자 //Socket soc로 리턴 받음 this.user_socket = soc;//304 , 205 //soc는 user socket 임 UserNetwork();//생성자 실행 } private void UserNetwork() {//생성자 실행 try { is = user_socket.getInputStream(); dis = new DataInputStream(is); os = user_socket.getOutputStream(); dos = new DataOutputStream(os); nickname = dis.readUTF(); chat_area1.append(nickname + " 접속\n"); try { InsertDB insert = new InsertDB(); insert.log_insert(nickname + " 접속\n"); } catch (ClassNotFoundException e) { } catch (SQLException e) { }//catch-end chat_area1.append("현재 접속된 사용자 수 : " + (int)(user_vc.size()+1)+"\n"); BroadCast("NewUser/" + nickname); // 자신에게 기존 사용자를 받아오는 부분 for (int i = 0; i < user_vc.size(); i++) { UserInfo u = (UserInfo) user_vc.elementAt(i); //cast send_Message("OldUser/" + u.nickname); } user_vc.add(this); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Stream설정 에러!", "Error!", JOptionPane.ERROR_MESSAGE); } } public void run() { while (true) { try { String msg = dis.readUTF(); InMessage(msg); chat_area1.append(nickname+" 님으로부터 들어온 메세지: " +msg+"\n"); try { InsertDB insert = new InsertDB(); insert.chat_insert(msg); } catch (ClassNotFoundException e) { } catch (SQLException e) { } } catch (IOException e) { try { dos.close(); dis.close(); user_socket.close(); user_vc.remove(this); chat_area1.append(nickname+" 퇴장\n"); try { InsertDB insert = new InsertDB(); insert.log_insert(nickname+" 퇴장\n"); } catch (ClassNotFoundException e1) { } catch (SQLException e2) { } BroadCast("User_out/"+nickname); user_vc.remove(this); chat_area1.append("현재 접속된 사용자 수 : " + (int)(user_vc.size())+"\n"); break; }catch (IOException e1) {}//메세지 수신 } } }// run-end private void InMessage(String str) { st = new StringTokenizer(str, "/");//"whisper/"+nickname+"@"+textField.getText().trim()+"@"+user // whisper/나재은@rudals!ㄴㄴ String protocol = st.nextToken(); // whisper String message = st.nextToken(); // 나재은@rudals ! ㄴㄴ if (protocol.equals("Note")) { st = new StringTokenizer(message, "@"); String user = st.nextToken(); String note = st.nextToken(); for (int i = 0; i < user_vc.size(); i++) { UserInfo u = (UserInfo) user_vc.elementAt(i); if (u.nickname.equals(user)) { u.send_Message("Note/" + nickname + "@" + note); } } } // Note_end else if (protocol.equals("Chatting")) { BroadCast("Chatting/" + message); } else if (protocol.equals("whisper")) { //whisper UniCast("whisper/"+message); } } private void UniCast(String str) {//"whisper/"+nickname+"@"+textField.getText().trim()+"@"+user st2 = new StringTokenizer(str," to "); String nick = st2.nextToken();//"whisper/"+nickname String get_ncik = st2.nextToken();//user for (int i = 0; i<user_vc.size();i++) { UserInfo u = (UserInfo) user_vc.elementAt(i); if(u.nickname.equals(get_ncik)) { // st3 = new StringTokenizer(str,"!"); // String msg = st3.nextToken(); // String get = st3.nextToken(); u.send_Message(str); } if(u.nickname.equals(nickname)) { // st3 = new StringTokenizer(str,"!"); // String msg = st3.nextToken(); // String get = st3.nextToken(); u.send_Message(str); } } } private void BroadCast(String str) { // 전체 사용자에게 메세지 보내는 역할 for (int i = 0; i < user_vc.size(); i++) { UserInfo u = (UserInfo) user_vc.elementAt(i); u.send_Message(str); } } private void send_Message(String str) { try { dos.writeUTF(str); } catch (IOException e) { e.printStackTrace(); } } }//userinfo-end public static void main(String[] args) { new Server(); } }//server - end
daa813d052d27e46e78673a694e99737054f4d75
71e13a12227018277a6ff5df9e139cecdb00fd99
/src/com/aigootan/marketplace/scraper/Scraper.java
8dfa64216fe10555b094ce5dd91f2d4c6a7d7f2d
[]
no_license
byanto/marketplace-robot
39b49beb8818103305f0493c9829f87e8f8e47bb
075a6334d82851c4772ba3bb147513c254a9ad3c
refs/heads/master
2021-03-27T09:55:08.789554
2017-03-23T04:09:50
2017-03-23T04:09:50
85,905,528
0
0
null
null
null
null
UTF-8
Java
false
false
246
java
package com.aigootan.marketplace.scraper; import org.openqa.selenium.WebDriver; public class Scraper { private final WebDriver m_driver; protected Scraper(final WebDriver driver){ m_driver = driver; } public void scrap(){ } }
dad4f12a63b50cbbb1d2961cc1155cf38948b88b
63f5aa02aab6f4ac5b35e637cc4fc57656ced60c
/src/LeetCode/动态规划/最大正方形/Solution.java
4f2f8ca2e6bcdf3e69899c120ec6cca783cc66a3
[]
no_license
DarkMagicianss/JianZhiOffer_and_LeetCode
7031be57d2221bd6d4b456cde9d70f586c848a4c
e4d1c57fc54c3c17e88abb917a559ed02ce960fa
refs/heads/master
2021-12-23T07:52:42.560089
2021-08-09T01:50:07
2021-08-09T01:50:07
234,306,717
1
0
null
null
null
null
UTF-8
Java
false
false
1,303
java
/** * @author LinHu * @version 2021/3/27 */ public class Solution { public int maximalSquare(char[][] matrix) { if (matrix == null || matrix.length == 0 || matrix[0].length == 0)return 0; int[][] dp = new int[matrix.length][matrix[0].length]; int max_value = 0; for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[0].length; j++) { if (i == 0 || j == 0) dp[i][j] = matrix[i][j] - '0'; else { if(matrix[i][j] == '1') { dp[i][j] = Math.min(dp[i - 1][j - 1], Math.min(dp[i - 1][j], dp[i][j - 1])) + 1; } } max_value = Math.max(dp[i][j], max_value); } } return max_value * max_value; } public static void main(String[] args) { Solution s = new Solution(); String str1 = "leetcode"; String str2 = "applepenapple"; String str3 = "catsandog"; System.out.println(s.maximalSquare(new char[][]{{'1','0','1','0','0'},{'1','0','1','1','1'},{'1','1','1','1','1'},{'1','0','0','1','0'}})); System.out.println(s.maximalSquare(new char[][]{{'0','1'},{'1','0'}})); System.out.println(s.maximalSquare(new char[][]{{'0'}})); } }
ecc55836b630da830c7fe0cc6f4da50653709ef4
0e4ff5562ed5f9250a0b03e1f27ef33f202d6643
/src/main/java/app/controller/RegistrationController.java
c93d5f09b8de02318060fc8a4824f47cd21f8bf4
[]
no_license
DmitryYaroslavtsev/webapp2
9c563a400987dc8e6ef4f09c74f923b0c28190a2
98659133aeec92f7685a8a6d88e4e5ca55f1f3fd
refs/heads/master
2020-04-19T13:46:18.808811
2019-02-02T00:13:13
2019-02-02T00:13:13
168,225,861
0
0
null
null
null
null
UTF-8
Java
false
false
1,846
java
package app.controller; import app.domain.User; import app.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import javax.validation.Valid; @Controller public class RegistrationController { @Autowired private UserService userService; @GetMapping("/registration") public String registration() { return "registration"; } @PostMapping("/registration") public String addUser( @Valid User user, BindingResult bindingResult, Model model ) { if (user.getPassword() != null && !user.getPassword().equals(user.getPassword2())) { model.addAttribute("passwordError", "Passwords are different!"); } if (bindingResult.hasErrors()) { model.mergeAttributes( ControllerUtils.getErrors(bindingResult) ); return "registration"; } if (!userService.addUser(user)) { model.addAttribute("usernameError", "User exists!"); return "registration"; } return "redirect:/login"; } @GetMapping("/activate/{code}") public String activate(Model model, @PathVariable String code) { boolean isActivated = userService.activateUser(code); if (isActivated) { model.addAttribute("message", "User successfully activated"); } else { model.addAttribute("message", "Activation code is not found"); } return "login"; } }
2eb810671ba687de15d612a26bcb9145e7062a62
3dd35c0681b374ce31dbb255b87df077387405ff
/generated/com/guidewire/_generated/entity/HOPDwellAddlInterestInternal.java
f9790749ffbb58c50eb7788751c083cefb5da37e
[]
no_license
walisashwini/SBTBackup
58b635a358e8992339db8f2cc06978326fed1b99
4d4de43576ec483bc031f3213389f02a92ad7528
refs/heads/master
2023-01-11T09:09:10.205139
2020-11-18T12:11:45
2020-11-18T12:11:45
311,884,817
0
0
null
null
null
null
UTF-8
Java
false
false
1,869
java
package com.guidewire._generated.entity; @javax.annotation.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "HOPDwellAddlInterest.eti;HOPDwellAddlInterest.eix;HOPDwellAddlInterest.etx") @java.lang.SuppressWarnings(value = {"deprecation", "unchecked"}) public interface HOPDwellAddlInterestInternal extends com.guidewire._generated.entity.AddlInterestDetailInternal, gw.api.copier.EffDatedCopyable, gw.api.domain.account.Mergeable, gw.api.logicalmatch.EffDatedLogicalMatcher { /** * Gets the value of the AddlIntEffDate field. * Effective date for additional interest */ @gw.internal.gosu.parser.ExtendedProperty public java.util.Date getAddlIntEffDate(); /** * Gets the value of the AddlIntExpDate field. * Expiration date for additional interest */ @gw.internal.gosu.parser.ExtendedProperty public java.util.Date getAddlIntExpDate(); /** * Gets the value of the Description field. * Description of additional interest */ @gw.internal.gosu.parser.ExtendedProperty public java.lang.String getDescription(); /** * Gets the value of the HOPDwelling field. */ @gw.internal.gosu.parser.ExtendedProperty public entity.HOPDwelling getHOPDwelling(); public gw.pl.persistence.core.Key getHOPDwellingID(); /** * Sets the value of the AddlIntEffDate field. */ public void setAddlIntEffDate(java.util.Date value); /** * Sets the value of the AddlIntExpDate field. */ public void setAddlIntExpDate(java.util.Date value); /** * Sets the value of the Description field. */ public void setDescription(java.lang.String value); /** * Sets the value of the HOPDwelling field. */ public void setHOPDwelling(entity.HOPDwelling value); public void setHOPDwellingID(gw.pl.persistence.core.Key value); }
a87ab46e5f121eb2bf6200d7ebb4754471aaaf6f
43101082d782f60e6f3d174278798a7dee5e70c7
/src/main/java/com/morcat/leetcode/Q14.java
e26ed6133cf67c89bb98c36bb95cd95c81935782
[]
no_license
Morcato/algorithm
92d82d2cc454f275e269f9bae5aabd1a5b3ceb9f
e20bf7c5e8b950e8d1296434ae84581641d13c16
refs/heads/main
2023-06-11T06:06:37.421830
2021-06-22T08:34:50
2021-06-22T08:34:50
319,066,923
1
0
null
null
null
null
UTF-8
Java
false
false
1,679
java
package com.morcat.leetcode; /** * * Q14_最长公共前缀 * * 编写一个函数来查找字符串数组中的最长公共前缀。 * * 如果不存在公共前缀,返回空字符串 ""。 * *   * * 示例 1: * * 输入:strs = ["flower","flow","flight"] * 输出:"fl" * 示例 2: * * 输入:strs = ["dog","racecar","car"] * 输出:"" * 解释:输入不存在公共前缀。 *   * * 提示: * * 0 <= strs.length <= 200 * 0 <= strs[i].length <= 200 * strs[i] 仅由小写英文字母组成 * * @author shenzixing * @since 2021-05-11 */ public class Q14 { /** * 多次遍历数组,每次比较第n个值是否相等 */ class MySolution { public String longestCommonPrefix(String[] strs) { if (strs.length == 0) { return ""; } int index = 0; for (int i = 0; i < strs[0].length(); i++) { if (isEquals(strs, index)) { index++; } else { break; } } if (index == 0) { return ""; } else { return strs[0].substring(0, index); } } public boolean isEquals(String[] strs, int index) { Character c = null; for (String s : strs) { if (c == null) { c = s.charAt(index); } else { if (index >= s.length() || c != s.charAt(index)) { return false; } } } return true; } } }
21b709e7dbc675d7b93623a412664620d59dea9c
35348f6624d46a1941ea7e286af37bb794bee5b7
/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/TraceTimeViewport.java
5121d99725ba292b3857ee06bd0dbed756c5ae9b
[ "Apache-2.0", "GPL-1.0-or-later", "GPL-3.0-only", "LicenseRef-scancode-public-domain", "LGPL-2.1-only", "LicenseRef-scancode-unknown-license-reference" ]
permissive
StarCrossPortal/ghidracraft
7af6257c63a2bb7684e4c2ad763a6ada23297fa3
a960e81ff6144ec8834e187f5097dfcf64758e18
refs/heads/master
2023-08-23T20:17:26.250961
2021-10-22T00:53:49
2021-10-22T00:53:49
359,644,138
80
19
Apache-2.0
2021-10-20T03:59:55
2021-04-20T01:14:29
Java
UTF-8
Java
false
false
6,159
java
/* ### * IP: GHIDRA * * 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 ghidra.trace.util; import java.util.*; import java.util.function.Function; import com.google.common.collect.Range; import ghidra.program.model.address.*; /** * A convenience for tracking the time structure of a trace and querying the trace accordingly. */ public interface TraceTimeViewport { public interface Occlusion<T> { boolean occluded(T object, AddressRange range, Range<Long> span); void remove(T object, AddressSet remains, Range<Long> span); } public interface QueryOcclusion<T> extends Occlusion<T> { @Override default boolean occluded(T object, AddressRange range, Range<Long> span) { for (T found : query(range, span)) { if (found == object) { continue; } if (itemOccludes(range, found)) { return true; } } return false; } @Override default void remove(T object, AddressSet remains, Range<Long> span) { // TODO: Split query by parts of remains? Probably not worth it. for (T found : query( new AddressRangeImpl(remains.getMinAddress(), remains.getMaxAddress()), span)) { if (found == object) { continue; } removeItem(remains, found); if (remains.isEmpty()) { return; } } } Iterable<? extends T> query(AddressRange range, Range<Long> span); boolean itemOccludes(AddressRange range, T t); void removeItem(AddressSet remains, T t); } public interface RangeQueryOcclusion<T> extends QueryOcclusion<T> { @Override default boolean itemOccludes(AddressRange range, T t) { return range(t).intersects(range); } @Override default void removeItem(AddressSet remains, T t) { remains.delete(range(t)); } AddressRange range(T t); } public interface SetQueryOcclusion<T> extends QueryOcclusion<T> { @Override default boolean itemOccludes(AddressRange range, T t) { return set(t).intersects(range.getMinAddress(), range.getMaxAddress()); } @Override default void removeItem(AddressSet remains, T t) { for (AddressRange range : set(t)) { remains.delete(range); if (remains.isEmpty()) { return; } } } AddressSetView set(T t); } void addChangeListener(Runnable l); void removeChangeListener(Runnable l); /** * Check if this view is forked * * <p> * The view is considered forked if any snap previous to this has a schedule with an initial * snap other than the immediately-preceding one. Such forks "break" the linearity of the * trace's usual time line. * * @return true if forked, false otherwise */ boolean isForked(); /** * Check if the given lifespan contains any upper snap among the involved spans * * @param lifespan the lifespan to consider * @return true if it contains any upper snap, false otherwise. */ boolean containsAnyUpper(Range<Long> lifespan); /** * Check if any part of the given object is occluded by more-recent objects * * @param <T> the type of the object * @param range the address range of the object * @param lifespan the lifespan of the object * @param object optionally, the object to examine. Used to avoid "self occlusion" * @param occlusion a mechanism for querying other like objects and checking for occlusion * @return true if completely visible, false if even partially occluded */ <T> boolean isCompletelyVisible(AddressRange range, Range<Long> lifespan, T object, Occlusion<T> occlusion); /** * Compute the parts of a given object that are visible past more-recent objects * * @param <T> the type of the object * @param set the addresses comprising the object * @param lifespan the lifespan of the object * @param object the object to examine * @param occlusion a mechanism for query other like objects and removing occluded parts * @return the set of visible addresses */ <T> AddressSet computeVisibleParts(AddressSetView set, Range<Long> lifespan, T object, Occlusion<T> occlusion); /** * Get the snaps involved in the view in most-recent-first order * * <p> * The first is always this view's snap. Following are the source snaps of each previous * snapshot's schedule where applicable. * * @return the list of snaps */ List<Long> getOrderedSnaps(); /** * Get the snaps involved in the view in least-recent-first order * * @return the list of snaps */ List<Long> getReversedSnaps(); /** * Get the first non-null result of the function, applied to the most-recent snaps first * * <p> * Typically, func both retrieves an object and tests for its suitability. * * @param <T> the type of object to retrieve * @param func the function on a snap to retrieve an object * @return the first non-null result */ <T> T getTop(Function<Long, T> func); /** * Merge iterators from each involved snap into a single iterator * * <p> * Typically, the resulting iterator is passed through a filter to test each objects * suitability. * * @param <T> the type of objects in each iterator * @param iterFunc a function on a snap to retrieve each iterator * @param comparator the comparator for merging, which must yield the same order as each * iterator * @return the merged iterator */ <T> Iterator<T> mergedIterator(Function<Long, Iterator<T>> iterFunc, Comparator<? super T> comparator); /** * Union address sets from each involved snap * * <p> * The returned union is computed lazily. * * @param setFunc a function on a snap to retrieve the address set * @return the union */ AddressSetView unionedAddresses(Function<Long, AddressSetView> setFunc); }
22bcd3d8a764d3b5b3b619b40396d3808921d418
b9498630f91351adbc6ee13a63a1c64ad1a02a4d
/src/main/java/com/chinatelecom/xjdh/ui/ChartActivity.java
d9829b0623778720bb1fc99739704a4d6478dfb3
[]
no_license
wuyue0829/xjdh-android-lasternew
9ed364280ef499668f1f0a35959c093f50635cab
d35295abed48955dbd18c38fd086dfcc32ecafb3
refs/heads/master
2020-06-05T18:44:06.949222
2019-11-05T08:29:37
2019-11-05T08:29:37
192,513,424
0
0
null
null
null
null
UTF-8
Java
false
false
7,092
java
package com.chinatelecom.xjdh.ui; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.graphics.Typeface; import android.preference.PreferenceManager; import android.widget.TextView; import com.chinatelecom.xjdh.R; import com.chinatelecom.xjdh.app.AppManager; import com.chinatelecom.xjdh.bean.AlarmChartsItem; import com.chinatelecom.xjdh.bean.AlarmChartsResp; import com.chinatelecom.xjdh.bean.ApiResponse; import com.chinatelecom.xjdh.bean.IntValueFormatter; import com.chinatelecom.xjdh.rest.client.ApiRestClientInterface; import com.chinatelecom.xjdh.utils.L; import com.chinatelecom.xjdh.utils.PreferenceConstants; import com.chinatelecom.xjdh.utils.PreferenceUtils; import com.chinatelecom.xjdh.utils.SharedConst; import com.chinatelecom.xjdh.utils.T; import com.github.mikephil.charting.charts.HorizontalBarChart; import com.github.mikephil.charting.components.Legend; import com.github.mikephil.charting.components.Legend.LegendPosition; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.components.XAxis.XAxisPosition; import com.github.mikephil.charting.components.YAxis; import com.github.mikephil.charting.data.BarData; import com.github.mikephil.charting.data.BarDataSet; import com.github.mikephil.charting.data.BarEntry; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.listener.OnChartValueSelectedListener; import com.github.mikephil.charting.utils.Highlight; import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Background; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.UiThread; import org.androidannotations.annotations.ViewById; import org.androidannotations.annotations.rest.RestService; import org.codehaus.jackson.map.ObjectMapper; import java.util.ArrayList; /** * @author peter * */ @EActivity(R.layout.activity_barchart) public class ChartActivity extends BaseActivity { @RestService ApiRestClientInterface mApiClient; @ViewById(R.id.alarm_barchart_title) TextView mBarChartTitle; @ViewById(R.id.alarm_barchart) HorizontalBarChart mBarChart; String[] ALARM_CHART_LABELS = new String[] { "一级告警", "二级告警", "三级告警", "四级告警" }; ArrayList<String> xVals = new ArrayList<String>(); ProgressDialog pDialog; private Typeface mTf; @AfterViews void bindData() { setTitle("报表"); pDialog = new ProgressDialog(this); pDialog.setMessage(getResources().getString(R.string.progress_loading_msg)); mApiClient.setHeader(SharedConst.HTTP_AUTHORIZATION, PreferenceUtils.getPrefString(this, PreferenceConstants.ACCESSTOKEN, "")); mBarChart.setDescription(""); mBarChart.setLogEnabled(false); mBarChart.setMaxVisibleValueCount(20); mBarChart.setDrawValuesForWholeStack(true); mBarChart.setPinchZoom(false); mBarChart.setDrawBarShadow(false); mBarChart.setDrawValueAboveBar(false); // 设置字体(在assets目录下新建fonts目录,把TTF字体文件放到这里,//根据路径得到Typeface) mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); XAxis xLabels = mBarChart.getXAxis(); xLabels.setPosition(XAxisPosition.BOTTOM); xLabels.setDrawGridLines(false); xLabels.setTypeface(mTf); YAxis leftAxis = mBarChart.getAxisLeft(); leftAxis.setTypeface(mTf);//设置字体 leftAxis.setValueFormatter(new IntValueFormatter()); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); mBarChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() { @Override public void onValueSelected(Entry e, int dataSetIndex, Highlight h) { BarEntry entry = (BarEntry) e; int stackIndex = h.getStackIndex(); int xIndex = h.getXIndex(); T.showLong(getApplicationContext(), xVals.get(xIndex) + "(" + ALARM_CHART_LABELS[stackIndex] + "):" + (int) entry.getVals()[stackIndex] + "个"); } @Override public void onNothingSelected() { } }); Legend l = mBarChart.getLegend(); l.setPosition(LegendPosition.RIGHT_OF_CHART_INSIDE); l.setFormSize(8f); l.setFormToTextSpace(4f); l.setTypeface(mTf); l.setYOffset(0f); l.setYEntrySpace(0f); pDialog.show(); getChartsData(); } @SuppressWarnings("deprecation") @UiThread void onPreferenceLogoutClicked() { final AlertDialog mExitDialog = new AlertDialog.Builder(ChartActivity.this).create(); mExitDialog.setTitle("下线提示"); mExitDialog.setIcon(R.drawable.index_btn_exit); mExitDialog.setMessage("您的账户已在另一个设备登录,请尝试重新登陆"); mExitDialog.setButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mExitDialog.dismiss(); String account = PreferenceUtils.getPrefString(ChartActivity.this, PreferenceConstants.ACCOUNT, ""); PreferenceUtils.clearPreference(ChartActivity.this, PreferenceManager.getDefaultSharedPreferences(ChartActivity.this)); PreferenceUtils.setPrefString(ChartActivity.this, PreferenceConstants.ACCOUNT, account); AppManager.getAppManager().finishAllActivity(); LoginActivity_.intent(ChartActivity.this).start(); } }); mExitDialog.show(); } @Background void getChartsData() { try { ApiResponse mApiResp = mApiClient.getAlarmChartsData(); L.d("aaaaaaaaaaaaaaaaaaa" ,mApiResp.toString()); if (mApiResp.getRet() == 0) { ObjectMapper mapper = new ObjectMapper(); AlarmChartsResp alarmChartsResp = mapper.readValue(mApiResp.getData(), AlarmChartsResp.class); onResult(true, alarmChartsResp); return; }else if(mApiResp.getData().equals("Access token is not valid")){ onPreferenceLogoutClicked(); } } catch (Exception e) { L.e(e.toString()); } onResult(false, null); } @UiThread void onResult(boolean isSuccess, AlarmChartsResp alarmChartsResp) { pDialog.dismiss(); if (isSuccess) { mBarChartTitle.setText(alarmChartsResp.getTitle()); ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>(); int xIndex = 0; for (AlarmChartsItem item : alarmChartsResp.getAlarmChartsDataList()) { xVals.add(item.getName()); yVals1.add(new BarEntry(new float[] { item.getAlarm_level_1(), item.getAlarm_level_2(), item.getAlarm_level_3(), item.getAlarm_level_4() }, xIndex++)); } BarDataSet barDataSet = new BarDataSet(yVals1, ""); barDataSet.setColors(new int[] { getResources().getColor(R.color.red), getResources().getColor(R.color.orange), getResources().getColor(R.color.yellow), getResources().getColor(R.color.blue) }); barDataSet.setStackLabels(ALARM_CHART_LABELS); ArrayList<BarDataSet> dataSets = new ArrayList<BarDataSet>(); dataSets.add(barDataSet); BarData data = new BarData(xVals, dataSets); data.setValueTypeface(mTf); data.setValueTextSize(12f); data.setValueFormatter(new IntValueFormatter()); mBarChart.setData(data); mBarChart.invalidate(); mBarChart.animateXY(3000, 3000); } else { T.showLong(this, "获取数据失败"); } } }
ac5be8d28f95074cc9ad143548fb82b5e664b1bb
c284a9705e55828d3707bb06702eac3ceadf3237
/demo/v2/java/com/baidu/api/client/examples/accountfile/AccountFileServiceExample.java
efa2dc42040fb60363120bf1a6fa6ff6e7647d46
[ "Apache-2.0" ]
permissive
pologood/beidou-api
06efa59ba5443084eb107b423683844973aca1c9
05d0d7440b92f577c45c0530cb397e2e2fcd8bfd
refs/heads/master
2021-01-19T09:37:40.873104
2017-04-04T03:53:51
2017-04-04T03:53:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,739
java
package com.baidu.api.client.examples.accountfile; import com.baidu.api.client.core.ClientBusinessException; import com.baidu.api.client.core.ObjToStringUtil; import com.baidu.api.client.core.ReportUtil; import com.baidu.api.client.core.ResHeaderUtil; import com.baidu.api.client.core.ServiceFactory; import com.baidu.api.client.core.VersionService; import com.baidu.api.sem.common.v2.ResHeader; import com.baidu.api.sem.nms.v2.AccountFileRequestType; import com.baidu.api.sem.nms.v2.AccountFileService; import com.baidu.api.sem.nms.v2.GetAccountFileIdRequest; import com.baidu.api.sem.nms.v2.GetAccountFileIdResponse; import com.baidu.api.sem.nms.v2.GetAccountFileStateRequest; import com.baidu.api.sem.nms.v2.GetAccountFileStateResponse; import com.baidu.api.sem.nms.v2.GetAccountFileUrlRequest; import com.baidu.api.sem.nms.v2.GetAccountFileUrlResponse; import com.baidu.api.sem.nms.v2.GetReportFileUrlResponse; import com.baidu.api.sem.nms.v2.GetReportIdResponse; /** * * ClassName: AccountFileServiceExample <br> * Function: TODO ADD FUNCTION * * @author Baidu API Team * @date Apr 20, 2012 */ public class AccountFileServiceExample { private AccountFileService service; public AccountFileServiceExample() { // Get service factory. Your authentication information will be popped up automatically from // baidu-api.properties VersionService factory = ServiceFactory.getInstance(); // Get service stub by given the Service interface. // Please see the bean-api.tar.gz to get more details about all the service interfaces. this.service = factory.getService(AccountFileService.class); } public GetAccountFileIdResponse getAccountFileId() { // Prepare your parameters. GetAccountFileIdRequest parameter = new GetAccountFileIdRequest(); // get request AccountFileRequestType request = new AccountFileRequestType(); // set format request.setFormat(0); // set campaignIds long[] campaignIds = new long[] { 108, 1351 }; for (long campaignId : campaignIds) { request.getCampaignIds().add(campaignId); } parameter.setAccountFileRequestType(request); // Invoke the method. GetAccountFileIdResponse ret = service.getAccountFileId(parameter); // Deal with the response header, the second parameter controls whether to print the response header to console // or not. ResHeader rheader = ResHeaderUtil.getResHeader(service, true); // If status equals zero, there is no error. Otherwise, you need to check the errors in the response header. if (rheader.getStatus() == 0) { System.out.println("result\n" + ObjToStringUtil.objToString(ret)); return ret; } else { throw new ClientBusinessException(rheader, ret); } } public GetAccountFileStateResponse getAccountFileState(String fileId) { // This is the request GetAccountFileStateRequest parameters = new GetAccountFileStateRequest(); parameters.setFileId(fileId); // Invoke the method. GetAccountFileStateResponse ret = service.getAccountFileState(parameters); // Deal with the response header, the second parameter controls whether to print the response header to console // or not. ResHeader rheader = ResHeaderUtil.getResHeader(service, true); // If status equals zero, there is no error. Otherwise, you need to check the errors in the response header. if (rheader.getStatus() == 0) { System.out.println("getReportState.result\n" + ObjToStringUtil.objToString(ret)); return ret; } else { throw new ClientBusinessException(rheader, ret); } } public GetAccountFileUrlResponse getAccountFileUrl(String fileId) { // This is the request GetAccountFileUrlRequest parameters = new GetAccountFileUrlRequest(); parameters.setFileId(fileId); // Invoke the method. GetAccountFileUrlResponse ret = service.getAccountFileUrl(parameters); // Deal with the response header, the second parameter controls whether to print the response header to console // or not. ResHeader rheader = ResHeaderUtil.getResHeader(service, true); // If status equals zero, there is no error. Otherwise, you need to check the errors in the response header. if (rheader.getStatus() == 0) { System.out.println("getReportFileUrl.result\n" + ObjToStringUtil.objToString(ret)); return ret; } else { throw new ClientBusinessException(rheader, ret); } } public static void main(String[] args) throws Exception { AccountFileServiceExample example = new AccountFileServiceExample(); GetAccountFileIdResponse id = example.getAccountFileId(); GetAccountFileUrlResponse urlRes = ReportUtil.getAccountFileUrl( example.service, id.getFileId(), 60); } }
482fdc8b44d13fd40f7e936f07d0248200fb3ffa
4fb2b3d93f84e0477229fc8c9b1ecf081cbca8dd
/src/BC4/src/bankmodel/Transaction.java
14c2b60fe475e18b066db51cc02516cd1821ef4a
[]
no_license
GAIordache/JademyCurs04
bb7efd5e3be92feabd305c00812f1eca5cf466b9
b185ebdb5fef1bca91bb96d1b6ee56e1422f8355
refs/heads/master
2020-03-16T11:42:28.537218
2018-05-08T19:07:21
2018-05-08T19:07:21
132,653,211
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package BC4.src.bankmodel; import java.util.Date; public class Transaction { private double amount; private Date date; private Account debitAccount; private Account creditAccount; }
cd91213b3a9be4b4d8ea0a8dedd6b2b0b04e678d
6c2c9b71fc59329275e493db68354457f59b5aea
/app/src/main/java/com/readnews/app2018/Login.java
5473d169114eb4d04242d35adf67d5fbc523b3e6
[]
no_license
lyxuansang91/GameRule
58ffb3a135f69b3ffc7621a63cccf225e630857c
fd52682d09af0698c80b83ab52a11ec5849672e4
refs/heads/master
2021-09-04T11:38:04.171962
2018-01-18T10:34:31
2018-01-18T10:34:31
115,612,265
0
0
null
null
null
null
UTF-8
Java
false
false
2,182
java
package com.readnews.app2018; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.readnews.app2018.common.Utils; import com.readnews.app2018.event.LoginEvent; import com.readnews.com.readnews.app2018.R; import de.greenrobot.event.EventBus; public class Login extends AppCompatActivity { EditText edtPhone; Button btnSubmit; private void initUI() { edtPhone = (EditText) findViewById(R.id.edtPhone); btnSubmit = (Button) findViewById(R.id.btnSubmit); edtPhone.setHint(MyApplication.getInstance().sharedPreferences.getString("phone", "")); btnSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String phone = edtPhone.getText().toString(); if (Utils.isVNPhoneNumber(phone)) { MyApplication.getInstance().editor.putString("phone", phone); MyApplication.getInstance().editor.commit(); EventBus.getDefault().post(new LoginEvent(phone)); finish(); } else { Toast.makeText(getApplicationContext(), "Số điện thoại không hợp lệ", Toast.LENGTH_SHORT).show(); } } }); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); initUI(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; default: return super.onOptionsItemSelected(item); } } }
8754b703c3032ced460c121f8d6905d5265541a7
869a215191412e09d5d63d855308849a948cae54
/app/src/main/java/h/user/tired/ImageAdapter.java
6a95edf7c457019cdcd04aace3e21e1fae802958
[]
no_license
Viditkhanna/Parcel
f995f26e4dc9614c14c337c3b8fad321128cc7c6
18d47a470dbd098855bac8f9e0048917767693ea
refs/heads/master
2020-07-06T04:09:22.772858
2019-10-08T11:42:30
2019-10-08T11:42:30
202,887,067
0
0
null
null
null
null
UTF-8
Java
false
false
5,564
java
package h.user.tired; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Rect; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.Layout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import com.bumptech.glide.Glide; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.squareup.picasso.Picasso; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; public class ImageAdapter extends RecyclerView.Adapter<ImageAdapter.ImageViewHolder> { public int t=0; private Context mContext; private ArrayList<Upload> mUploads; public ImageAdapter(){} public ImageAdapter(Context context,ArrayList<Upload> uploads){ mContext=context; mUploads=uploads; } @NonNull @Override public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View v= LayoutInflater.from(mContext).inflate(R.layout.image_item,parent,false); return new ImageViewHolder(v); } @Override public void onBindViewHolder(@NonNull final ImageViewHolder holder, final int position) { LinearLayoutManager lm=new LinearLayoutManager(mContext){ @Override public boolean requestChildRectangleOnScreen(RecyclerView parent, View child, Rect rect, boolean immediate) { // if(((ViewGroup)child).getFocusedChild()instanceof ImageViewHolder){ Toast.makeText(mContext, "HEYYYY", Toast.LENGTH_SHORT).show(); // return false; // } return super.requestChildRectangleOnScreen(parent, child, rect, immediate); } }; // Upload uploadCurrent=mUploads.get(holder.position); // if(mUploads.get(position)==null ) { // t = 1; // try { // FileOutputStream file1 =new FileOutputStream("empty.txt"); // // OutputStreamWriter file2=new OutputStreamWriter(file1); // file2.append("ball"); // // file1.append("Hey how you a doing"); // file1.flush(); // file1.close(); // } catch (IOException ex) { // // } // }if(uploadCurrent.getImageUrl()==null || uploadCurrent.getImageUrl()==""){ // t=1; // try { // FileOutputStream file1 =new FileOutputStream("empty.txt"); // // OutputStreamWriter file2=new OutputStreamWriter(file1); // file2.append("ball"); // // file1.append("Hey how you a doing"); // file1.flush(); // file1.close(); // } catch (IOException ex) { // // } // // } // holder.position=position; // try { // Integer pos=holder.getAdapterPosition(); // //// holder.imageview. // if(mUploads.get(position).getBitmap().get(0)!=null ){ // Toast.makeText(mContext, pos.toString(), Toast.LENGTH_SHORT).show(); // //// Toast.makeText(mContext,"IA= "+ mUploads.get(position).getBitmap().get(0).toString(), Toast.LENGTH_SHORT).show(); //// Toast.makeText(mContext,"Size= "+ pos.toString(), Toast.LENGTH_SHORT).show(); // // // ArrayList<Bitmap> bmp = mUploads.get(i).getBitmap(); //// ByteArrayOutputStream stream=new ByteArrayOutputStream(); //// Bitmap tempbmp=mUploads.get(position).getBitmap().get(0); //// Glide.with(mContext) //// .asBitmap() //// .load(stream) //// .tr //// .into(holder.imageview); // // holder.imageview.setImageBitmap(mUploads.get(position).getBitmap().get(0)); // } // else { // Toast.makeText(mContext, "Yaha kha", Toast.LENGTH_SHORT).show(); //// Glide.with(mContext) //// .load(null) //// .into(holder.imageview); // holder.imageview.setImageBitmap(null); // // } // }catch (Exception ex){ Toast.makeText(mContext, ex.toString(), Toast.LENGTH_SHORT).show(); // } // Picasso.with(holder.itemView.getContext()) // .load(R.drawable.profile) // .placeholder(R.mipmap.ic_launcher) // .fit() // .centerCrop() // .into(holder.imageview); // Picasso.with(mContext) // .load(uploadCurrent.getImageUrl()) // .fit() // .centerCrop() // .into(holder.imageview); } @Override public int getItemViewType(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public int getItemCount() { return mUploads.size(); } public class ImageViewHolder extends RecyclerView.ViewHolder{ public ImageView imageview; public ImageViewHolder(View itemview){ super(itemview); try { imageview = itemview.findViewById(R.id.image_view_upload); }catch (Exception ex){ Toast.makeText(mContext, ex.toString(), Toast.LENGTH_SHORT).show(); }} } }
07618686a33c26f7ddb55e03abc046b61b117f54
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/training/org/apache/activemq/usecases/UnlimitedEnqueueTest.java
b6c9c84f7f18067a194055275eaf5d89b558eb16
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
4,099
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.activemq.usecases; import DeliveryMode.PERSISTENT; import Session.AUTO_ACKNOWLEDGE; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import javax.jms.BytesMessage; import javax.jms.Connection; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.MessageProducer; import javax.jms.ResourceAllocationException; import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.util.Wait; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class UnlimitedEnqueueTest { private static final Logger LOG = LoggerFactory.getLogger(UnlimitedEnqueueTest.class); BrokerService brokerService = null; final long numMessages = 5000; final long numThreads = 10; final int payLoadSize = 100 * 1024; @Test public void testEnqueueIsOnlyLimitedByDisk() throws Exception { ExecutorService executor = Executors.newCachedThreadPool(); for (int i = 0; i < (numThreads); i++) { executor.execute(new UnlimitedEnqueueTest.Producer(((numMessages) / (numThreads)))); } Assert.assertTrue("Temp Store is filling ", Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisified() throws Exception { UnlimitedEnqueueTest.LOG.info(((((("Temp Usage, " + (brokerService.getSystemUsage().getTempUsage())) + ", full=") + (brokerService.getSystemUsage().getTempUsage().isFull())) + ", % usage: ") + (brokerService.getSystemUsage().getTempUsage().getPercentUsage()))); return (brokerService.getSystemUsage().getTempUsage().getPercentUsage()) > 1; } }, TimeUnit.MINUTES.toMillis(4))); executor.shutdownNow(); } public class Producer implements Runnable { private final long numberOfMessages; public Producer(final long n) { this.numberOfMessages = n; } public void run() { ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerService.getVmConnectorURI()); try { Connection conn = factory.createConnection(); conn.start(); byte[] bytes = new byte[payLoadSize]; for (int i = 0; i < (numberOfMessages); i++) { Session session = conn.createSession(false, AUTO_ACKNOWLEDGE); Destination destination = session.createQueue("test-queue"); MessageProducer producer = session.createProducer(destination); producer.setDeliveryMode(PERSISTENT); BytesMessage message = session.createBytesMessage(); message.writeBytes(bytes); try { producer.send(message); } catch (ResourceAllocationException e) { e.printStackTrace(); } session.close(); } } catch (JMSException e) { // expect interrupted exception on shutdownNow } } } }
d81b31ed204e892a0d3d9d45f1b473aa4d5bb674
5ade3f1d3d3429e90025035cb49bf1bba5ad52e8
/compass-storm/src/main/java/com/sf/user/spout/AdDataSearchSpout.java
af2fb07368931f892b74e418a9596cac92729b45
[]
no_license
0dayso/dataCompass
2270523fc793b231ffa08a33b6fd96257529a1b6
2c64fb7033fc8fb452fa12a65d8eff9f2b9d671a
refs/heads/master
2021-06-23T23:21:18.104730
2017-09-09T14:53:49
2017-09-09T14:53:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,450
java
package com.sf.user.spout; import backtype.storm.spout.SpoutOutputCollector; import backtype.storm.task.TopologyContext; import backtype.storm.topology.IRichSpout; import backtype.storm.topology.OutputFieldsDeclarer; import backtype.storm.tuple.Fields; import backtype.storm.tuple.Values; import com.alibaba.jstorm.client.ConfigExtension; import com.alibaba.jstorm.utils.JStormUtils; import com.sf.config.ConfKeys; import com.sf.user.bean.Search; import com.sf.user.bean.Visit; import com.sf.util.TpsCounter; import com.wandoulabs.jodis.JedisResourcePool; import com.wandoulabs.jodis.RoundRobinJedisPool; import net.sf.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import redis.clients.jedis.Jedis; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; public class AdDataSearchSpout implements IRichSpout { private static final long serialVersionUID = -6260803932233430770L; private static final Logger LOG = LoggerFactory.getLogger(AdDataSearchSpout.class); private SpoutOutputCollector collector; JedisResourcePool jedisPool; private String host; private int port; private String zkProxyDir; private long tupleId; private long succeedCount; private long failedCount; private AtomicLong handleCounter = new AtomicLong(0L); private TpsCounter tpsCounter; private boolean isLimited = false; private long SPOUT_MAX_SEND_NUM; private boolean isFinished; private Long MAX_PENDING_COUNTER; private int bufferLen = 0; public void nextTuple() { if (!this.isLimited) { emit(); return; } if (this.isFinished == true) { LOG.info("Finish sending "); JStormUtils.sleepMs(10000L); return; } if (this.tupleId > this.SPOUT_MAX_SEND_NUM) { this.isFinished = true; return; } emit(); } public void emit() { try { Jedis jedis = this.jedisPool.getResource(); try { String adDataRedis = jedis.rpop(ConfKeys.STORM_AD_SEARCH_DATA); if ((adDataRedis == null) || ("nil".equals(adDataRedis))) { try { Thread.sleep(300L); } catch (InterruptedException e) { e.printStackTrace(); } } else { JSONObject adDataObject = JSONObject.fromObject(adDataRedis); Search adVO = (Search)JSONObject.toBean(adDataObject, Search.class); this.collector.emit(new Values(new Object[] { Long.valueOf(this.tupleId), adVO }), Long.valueOf(this.tupleId)); this.tupleId += 1L; this.handleCounter.incrementAndGet(); while (this.handleCounter.get() >= this.MAX_PENDING_COUNTER.longValue() - 1L) try { Thread.sleep(1L); } catch (InterruptedException e) { } this.tpsCounter.count(); } } catch (Throwable localThrowable1) { } finally { if (jedis != null) try { jedis.close(); } catch (Throwable x2) { } else jedis.close(); } } catch (Exception e) { e.printStackTrace(); } } public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { this.collector = collector; this.host = conf.get("redis_host_key").toString(); this.port = Integer.valueOf(conf.get("zk_port_key").toString()).intValue(); this.zkProxyDir = conf.get("zk_proxy_dir").toString(); StringBuffer hostPort = new StringBuffer(); hostPort.append(this.host).append(":").append(this.port); this.jedisPool = RoundRobinJedisPool.create().curatorClient(hostPort.toString(), 30000).zkProxyDir(this.zkProxyDir).build(); if (conf.get("spout.max.sending.num") == null) { this.isLimited = false; } else { this.isLimited = true; this.SPOUT_MAX_SEND_NUM = JStormUtils.parseLong(conf.get("spout.max.sending.num")).longValue(); } this.isFinished = false; this.tpsCounter = new TpsCounter(context.getThisComponentId() + ":" + context.getThisTaskId()); this.MAX_PENDING_COUNTER = Long.valueOf(getMaxPending(conf)); this.bufferLen = JStormUtils.parseInt(conf.get("byte.buffer.len"), 0).intValue(); } public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields(new String[] { "id", "AdSearch" })); } public long getMaxPending(Map conf) { if (ConfigExtension.isSpoutSingleThread(conf)) { return 9223372036854775807L; } Object pending = conf.get("topology.max.spout.pending"); if (pending == null) { return 9223372036854775807L; } int pendingNum = JStormUtils.parseInt(pending).intValue(); if (pendingNum == 1) { return 9223372036854775807L; } return pendingNum; } public void close() { this.tpsCounter.cleanup(); LOG.info("Sending :" + this.tupleId + ", success:" + this.succeedCount + ", failed:" + this.failedCount); } public void activate() { LOG.info("Start active"); } public void deactivate() { LOG.info("Start deactive"); } public void ack(Object id) { Long tupleId = (Long)id; this.succeedCount += 1L; this.handleCounter.decrementAndGet(); } public void fail(Object id) { this.failedCount += 1L; this.handleCounter.decrementAndGet(); Long failId = (Long)id; LOG.info("Failed to handle " + failId); } public Map<String, Object> getComponentConfiguration() { return null; } }
[ "tw l" ]
tw l
3d228178ba284c13c62b8914c3d74be324b22614
afb41ce66081f4273337a601e81052dd72a46159
/Project5/airline-gwt/src/main/java/edu/pdx/cs410J/locle/client/PingServiceAsync.java
88faf7adf1a8816fe9abbf9e1b94403ff3f4c087
[]
no_license
locdle/CS410-Advanced-Java
3dc6219335aafe9c291cd2deabd8b07b72478696
976ab5089b4298eb1ef693e16e61227642afdc9b
refs/heads/master
2021-03-12T22:39:17.674531
2015-01-29T16:10:53
2015-01-29T16:10:53
21,255,333
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package edu.pdx.cs410J.locle.client; import com.google.gwt.user.client.rpc.AsyncCallback; import edu.pdx.cs410J.AbstractAirline; /** * The client-side interface to the ping service */ public interface PingServiceAsync { /** * Return the current date/time on the server */ void ping(AsyncCallback<AbstractAirline> async); }
26715705363fd87d96efe96b66cbbbb0d08102c1
6f2f42e544333f234f4e032e5c11e3a5b393498a
/src/org/model/DayCount.java
5a2708f9653848c860a34df189ea30c0b53a94e4
[]
no_license
zyw3000/WeShoppingWEB
c2ffc36a452eafbeea345d3f59d37e73891a340c
08e79f5cffe7e3e7a28e6190d9be77eab3bd2b77
refs/heads/master
2021-01-13T08:21:40.729117
2016-10-31T07:36:12
2016-10-31T07:36:12
71,762,025
0
0
null
null
null
null
UTF-8
Java
false
false
1,900
java
package org.model; import java.sql.Timestamp; /** * DayCount entity. @author MyEclipse Persistence Tools */ public class DayCount implements java.io.Serializable { // Fields private Integer dayCountId; private Products products; private Store store; private Timestamp dayCountDate; private String dayCountSale; private String dayCountHits; private String dayCountMoney; // Constructors /** default constructor */ public DayCount() { } /** full constructor */ public DayCount(Products products, Store store, Timestamp dayCountDate, String dayCountSale, String dayCountHits, String dayCountMoney) { this.products = products; this.store = store; this.dayCountDate = dayCountDate; this.dayCountSale = dayCountSale; this.dayCountHits = dayCountHits; this.dayCountMoney = dayCountMoney; } // Property accessors public Integer getDayCountId() { return this.dayCountId; } public void setDayCountId(Integer dayCountId) { this.dayCountId = dayCountId; } public Products getProducts() { return this.products; } public void setProducts(Products products) { this.products = products; } public Store getStore() { return this.store; } public void setStore(Store store) { this.store = store; } public Timestamp getDayCountDate() { return this.dayCountDate; } public void setDayCountDate(Timestamp dayCountDate) { this.dayCountDate = dayCountDate; } public String getDayCountSale() { return this.dayCountSale; } public void setDayCountSale(String dayCountSale) { this.dayCountSale = dayCountSale; } public String getDayCountHits() { return this.dayCountHits; } public void setDayCountHits(String dayCountHits) { this.dayCountHits = dayCountHits; } public String getDayCountMoney() { return this.dayCountMoney; } public void setDayCountMoney(String dayCountMoney) { this.dayCountMoney = dayCountMoney; } }
3e7f621055c90592cb7c73623787bc811b58e5df
196db3d741b782895e34adb6f4506cbdd4494b57
/src/test/java/org/imsglobal/lti/launch/LtiVerifierAndSignerTest.java
f7500aa59140efe227f2927e97a1d6a9c8a4b0e8
[ "Apache-2.0" ]
permissive
HeyMendy/basiclti-util-java
26c8d18541c81690700579fff246ec0be856af44
869c8ab85f185e38ec7c830d3b8bb4e4dba686d7
refs/heads/master
2020-03-20T20:52:46.079047
2018-06-18T07:05:53
2018-06-18T07:05:53
137,712,180
0
0
null
2018-06-18T05:08:41
2018-06-18T05:08:40
null
UTF-8
Java
false
false
2,267
java
package org.imsglobal.lti.launch; import org.apache.http.HttpRequest; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.junit.Test; import static org.junit.Assert.*; import java.net.URI; /** * @author Paul Gray */ public class LtiVerifierAndSignerTest { LtiVerifier verifier = new LtiOauthVerifier(); LtiSigner signer = new LtiOauthSigner(); @Test public void verifierShouldVerifyCorrectlySignedLtiLaunches() throws Exception { String key = "key"; String secret = "secret"; HttpPost ltiLaunch = new HttpPost(new URI("http://example.com/test")); signer.sign(ltiLaunch, key, secret); LtiVerificationResult result = verifier.verify(new MockHttpPost(ltiLaunch), secret); assertTrue(result.getSuccess()); } @Test public void verifierShouldRejectIncorrectlySignedLtiLaunches() throws Exception { String key = "key"; String secret = "secret"; HttpPost ltiLaunch = new HttpPost(new URI("http://example.com/test")); signer.sign(ltiLaunch, key, secret); LtiVerificationResult result = verifier.verify(new MockHttpPost(ltiLaunch), "wrongSecret"); assertFalse(result.getSuccess()); } @Test public void verifierShouldVerifyCorrectlySignedLtiGetServiceRequests() throws Exception { String key = "key"; String secret = "secret"; HttpGet ltiServiceGetRequest = new HttpGet(new URI("http://example.com/test")); signer.sign(ltiServiceGetRequest, key, secret); LtiVerificationResult result = verifier.verify(new MockHttpGet(ltiServiceGetRequest), secret); assertTrue(result.getSuccess()); } @Test public void verifierShouldRejectIncorrectlySignedLtiGetServiceRequests() throws Exception { String key = "key"; String secret = "secret"; HttpGet ltiServiceGetRequest = new HttpGet(new URI("http://example.com/test")); signer.sign(ltiServiceGetRequest, key, secret); LtiVerificationResult result = verifier.verify(new MockHttpGet(ltiServiceGetRequest), "anotherWrongSecret"); assertFalse(result.getSuccess()); } }