blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
32cf7062dd47ea6b7e2b981884d72bbf3833943c
a8dc3b21bf5943f57a789254837d59e29d3ca70d
/app/src/main/java/com/sunil/kumar/di/ActivityScope.java
b7bf1c0ac4ca276d096acca57418c57e68ea59c2
[]
no_license
nuron142/Normandy
e7e7097414f7125b14f101763050ac4d6ac536b1
4c475d472de20e6b1b116c7fbcaddabb466cade4
refs/heads/master
2020-06-01T18:08:13.384956
2019-06-26T16:52:09
2019-06-26T16:52:09
190,876,802
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package com.sunil.kumar.di; import javax.inject.Scope; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Scope @Retention(RetentionPolicy.RUNTIME) public @interface ActivityScope { }
[ "sunil.k@swiggy.in" ]
sunil.k@swiggy.in
328247acaa522866786a51de95a12f006742b6ff
6baf1fe00541560788e78de5244ae17a7a2b375a
/hollywood/com.oculus.userserver2-UserServer2/sources/com/fasterxml/jackson/databind/deser/std/NumberDeserializers$BigDecimalDeserializer.java
ab303859db3b89adf8a494d3b497828d04132014
[]
no_license
phwd/quest-tracker
286e605644fc05f00f4904e51f73d77444a78003
3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba
refs/heads/main
2023-03-29T20:33:10.959529
2021-04-10T22:14:11
2021-04-10T22:14:11
357,185,040
4
2
null
2021-04-12T12:28:09
2021-04-12T12:28:08
null
UTF-8
Java
false
false
1,495
java
package com.fasterxml.jackson.databind.deser.std; import X.AbstractC0122Rd; import X.AnonymousClass9p; import X.AnonymousClass9r; import X.B3; import X.Rn; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import java.io.IOException; import java.math.BigDecimal; @JacksonStdImpl public class NumberDeserializers$BigDecimalDeserializer extends StdScalarDeserializer<BigDecimal> { public static final NumberDeserializers$BigDecimalDeserializer A00 = new NumberDeserializers$BigDecimalDeserializer(); private final BigDecimal A00(Rn rn) throws IOException, AnonymousClass9r { AnonymousClass9p r1 = ((B3) rn).A00; if (r1 == AnonymousClass9p.VALUE_NUMBER_INT || r1 == AnonymousClass9p.VALUE_NUMBER_FLOAT) { return rn.A0A(); } if (r1 == AnonymousClass9p.VALUE_STRING) { String trim = rn.A09().trim(); if (trim.length() == 0) { return null; } try { return new BigDecimal(trim); } catch (IllegalArgumentException unused) { throw null; } } else { throw null; } } public NumberDeserializers$BigDecimalDeserializer() { super(BigDecimal.class); } @Override // com.fasterxml.jackson.databind.JsonDeserializer public final /* bridge */ /* synthetic */ Object A03(Rn rn, AbstractC0122Rd rd) throws IOException, AnonymousClass9r { return A00(rn); } }
[ "cyuubiapps@gmail.com" ]
cyuubiapps@gmail.com
4cfdd711c824001e7b2ae5dd181aff5addaae19a
66981b874b6d6562f6d1bc07f65d47b804ba1f49
/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/mobilesafe/utils/basic/SimpleArrayMap.java
e23a60d4f54953c4530ef0658bdb9c1ef6bf48e4
[ "Apache-2.0" ]
permissive
Kotlin-cn/RePlugin
6f077b339b74e5dfc3ac9912a5636d01f2db95ce
9917b3e48356f8baa7404f32f49c9a990dc2a629
refs/heads/master
2020-12-02T22:53:25.656433
2017-07-12T12:56:40
2017-07-13T02:42:55
96,197,439
2
2
null
2017-07-04T08:57:14
2017-07-04T08:57:14
null
UTF-8
Java
false
false
20,655
java
/* * Copyright (C) 2005-2017 Qihoo 360 Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed To in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.qihoo360.mobilesafe.utils.basic; import android.util.Log; import java.util.Map; /** * Base implementation of {@link ArrayMap} that doesn't include any standard Java * container API interoperability. These features are generally heavier-weight ways * to interact with the container, so discouraged, but they can be useful to make it * easier to use as a drop-in replacement for HashMap. If you don't need them, this * class can be preferrable since it doesn't bring in any of the implementation of those * APIs, allowing that code to be stripped by ProGuard. */ public class SimpleArrayMap<K, V> { private static final boolean DEBUG = false; private static final String TAG = "ArrayMap"; /** * The minimum amount by which the capacity of a ArrayMap will increase. * This is tuned to be relatively space-efficient. */ private static final int BASE_SIZE = 4; /** * Maximum number of entries to have in array caches. */ private static final int CACHE_SIZE = 10; /** * Caches of small array objects to avoid spamming garbage. The cache * Object[] variable is a pointer to a linked list of array objects. * The first entry in the array is a pointer to the next array in the * list; the second entry is a pointer to the int[] hash code array for it. */ static Object[] mBaseCache; static int mBaseCacheSize; static Object[] mTwiceBaseCache; static int mTwiceBaseCacheSize; int[] mHashes; Object[] mArray; int mSize; int indexOf(Object key, int hash) { final int n = mSize; // Important fast case: if nothing is in here, nothing to look for. if (n == 0) { return ~0; } int index = ContainerHelpers.binarySearch(mHashes, n, hash); // If the hash code wasn't found, then we have no entry for this key. if (index < 0) { return index; } // If the key at the returned index matches, that's what we want. if (key.equals(mArray[index << 1])) { return index; } // Search for a matching key after the index. int end; for (end = index + 1; end < n && mHashes[end] == hash; end++) { if (key.equals(mArray[end << 1])) { return end; } } // Search for a matching key before the index. for (int i = index - 1; i >= 0 && mHashes[i] == hash; i--) { if (key.equals(mArray[i << 1])) { return i; } } // Key not found -- return negative value indicating where a // new entry for this key should go. We use the end of the // hash chain to reduce the number of array entries that will // need to be copied when inserting. return ~end; } int indexOfNull() { final int N = mSize; // Important fast case: if nothing is in here, nothing to look for. if (N == 0) { return ~0; } int index = ContainerHelpers.binarySearch(mHashes, N, 0); // If the hash code wasn't found, then we have no entry for this key. if (index < 0) { return index; } // If the key at the returned index matches, that's what we want. if (null == mArray[index<<1]) { return index; } // Search for a matching key after the index. int end; for (end = index + 1; end < N && mHashes[end] == 0; end++) { if (null == mArray[end << 1]) return end; } // Search for a matching key before the index. for (int i = index - 1; i >= 0 && mHashes[i] == 0; i--) { if (null == mArray[i << 1]) return i; } // Key not found -- return negative value indicating where a // new entry for this key should go. We use the end of the // hash chain to reduce the number of array entries that will // need to be copied when inserting. return ~end; } private void allocArrays(final int size) { if (size == (BASE_SIZE*2)) { synchronized (ArrayMap.class) { if (mTwiceBaseCache != null) { final Object[] array = mTwiceBaseCache; mArray = array; mTwiceBaseCache = (Object[])array[0]; mHashes = (int[])array[1]; array[0] = array[1] = null; mTwiceBaseCacheSize--; if (DEBUG) Log.d(TAG, "Retrieving 2x cache " + mHashes + " now have " + mTwiceBaseCacheSize + " entries"); return; } } } else if (size == BASE_SIZE) { synchronized (ArrayMap.class) { if (mBaseCache != null) { final Object[] array = mBaseCache; mArray = array; mBaseCache = (Object[])array[0]; mHashes = (int[])array[1]; array[0] = array[1] = null; mBaseCacheSize--; if (DEBUG) Log.d(TAG, "Retrieving 1x cache " + mHashes + " now have " + mBaseCacheSize + " entries"); return; } } } mHashes = new int[size]; mArray = new Object[size<<1]; } private static void freeArrays(final int[] hashes, final Object[] array, final int size) { if (hashes.length == (BASE_SIZE*2)) { synchronized (ArrayMap.class) { if (mTwiceBaseCacheSize < CACHE_SIZE) { array[0] = mTwiceBaseCache; array[1] = hashes; for (int i=(size<<1)-1; i>=2; i--) { array[i] = null; } mTwiceBaseCache = array; mTwiceBaseCacheSize++; if (DEBUG) Log.d(TAG, "Storing 2x cache " + array + " now have " + mTwiceBaseCacheSize + " entries"); } } } else if (hashes.length == BASE_SIZE) { synchronized (ArrayMap.class) { if (mBaseCacheSize < CACHE_SIZE) { array[0] = mBaseCache; array[1] = hashes; for (int i=(size<<1)-1; i>=2; i--) { array[i] = null; } mBaseCache = array; mBaseCacheSize++; if (DEBUG) Log.d(TAG, "Storing 1x cache " + array + " now have " + mBaseCacheSize + " entries"); } } } } /** * Create a new empty ArrayMap. The default capacity of an array map is 0, and * will grow once items are added to it. */ public SimpleArrayMap() { mHashes = ContainerHelpers.EMPTY_INTS; mArray = ContainerHelpers.EMPTY_OBJECTS; mSize = 0; } /** * Create a new ArrayMap with a given initial capacity. */ public SimpleArrayMap(int capacity) { if (capacity == 0) { mHashes = ContainerHelpers.EMPTY_INTS; mArray = ContainerHelpers.EMPTY_OBJECTS; } else { allocArrays(capacity); } mSize = 0; } /** * Create a new ArrayMap with the mappings from the given ArrayMap. */ public SimpleArrayMap(SimpleArrayMap map) { this(); if (map != null) { putAll(map); } } /** * Make the array map empty. All storage is released. */ public void clear() { if (mSize != 0) { freeArrays(mHashes, mArray, mSize); mHashes = ContainerHelpers.EMPTY_INTS; mArray = ContainerHelpers.EMPTY_OBJECTS; mSize = 0; } } /** * Ensure the array map can hold at least <var>minimumCapacity</var> * items. */ public void ensureCapacity(int minimumCapacity) { if (mHashes.length < minimumCapacity) { final int[] ohashes = mHashes; final Object[] oarray = mArray; allocArrays(minimumCapacity); if (mSize > 0) { System.arraycopy(ohashes, 0, mHashes, 0, mSize); System.arraycopy(oarray, 0, mArray, 0, mSize<<1); } freeArrays(ohashes, oarray, mSize); } } /** * Check whether a key exists in the array. * * @param key The key to search for. * @return Returns true if the key exists, else false. */ public boolean containsKey(Object key) { return indexOfKey(key) >= 0; } /** * Returns the index of a key in the set. * * @param key The key to search for. * @return Returns the index of the key if it exists, else a negative integer. */ public int indexOfKey(Object key) { return key == null ? indexOfNull() : indexOf(key, key.hashCode()); } int indexOfValue(Object value) { final int N = mSize*2; final Object[] array = mArray; if (value == null) { for (int i=1; i<N; i+=2) { if (array[i] == null) { return i>>1; } } } else { for (int i=1; i<N; i+=2) { if (value.equals(array[i])) { return i>>1; } } } return -1; } /** * Check whether a value exists in the array. This requires a linear search * through the entire array. * * @param value The value to search for. * @return Returns true if the value exists, else false. */ public boolean containsValue(Object value) { return indexOfValue(value) >= 0; } /** * Retrieve a value from the array. * @param key The key of the value to retrieve. * @return Returns the value associated with the given key, * or null if there is no such key. */ public V get(Object key) { final int index = indexOfKey(key); return index >= 0 ? (V)mArray[(index<<1)+1] : null; } /** * Return the key at the given index in the array. * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the key stored at the given index. */ public K keyAt(int index) { return (K)mArray[index << 1]; } /** * Return the value at the given index in the array. * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value stored at the given index. */ public V valueAt(int index) { return (V)mArray[(index << 1) + 1]; } /** * Set the value at a given index in the array. * @param index The desired index, must be between 0 and {@link #size()}-1. * @param value The new value to store at this index. * @return Returns the previous value at the given index. */ public V setValueAt(int index, V value) { index = (index << 1) + 1; V old = (V)mArray[index]; mArray[index] = value; return old; } /** * Return true if the array map contains no items. */ public boolean isEmpty() { return mSize <= 0; } /** * Add a new value to the array map. * @param key The key under which to store the value. <b>Must not be null.</b> If * this key already exists in the array, its value will be replaced. * @param value The value to store for the given key. * @return Returns the old value that was stored for the given key, or null if there * was no such key. */ public V put(K key, V value) { final int hash; int index; if (key == null) { hash = 0; index = indexOfNull(); } else { hash = key.hashCode(); index = indexOf(key, hash); } if (index >= 0) { index = (index<<1) + 1; final V old = (V)mArray[index]; mArray[index] = value; return old; } index = ~index; if (mSize >= mHashes.length) { final int n = mSize >= (BASE_SIZE*2) ? (mSize+(mSize>>1)) : (mSize >= BASE_SIZE ? (BASE_SIZE*2) : BASE_SIZE); if (DEBUG) Log.d(TAG, "put: grow from " + mHashes.length + " to " + n); final int[] ohashes = mHashes; final Object[] oarray = mArray; allocArrays(n); if (mHashes.length > 0) { if (DEBUG) Log.d(TAG, "put: copy 0-" + mSize + " to 0"); System.arraycopy(ohashes, 0, mHashes, 0, ohashes.length); System.arraycopy(oarray, 0, mArray, 0, oarray.length); } freeArrays(ohashes, oarray, mSize); } if (index < mSize) { if (DEBUG) Log.d(TAG, "put: move " + index + "-" + (mSize-index) + " to " + (index+1)); System.arraycopy(mHashes, index, mHashes, index + 1, mSize - index); System.arraycopy(mArray, index << 1, mArray, (index + 1) << 1, (mSize - index) << 1); } mHashes[index] = hash; mArray[index<<1] = key; mArray[(index<<1)+1] = value; mSize++; return null; } /** * Perform a {@link #put(Object, Object)} of all key/value pairs in <var>array</var> * @param array The array whose contents are to be retrieved. */ public void putAll(SimpleArrayMap<? extends K, ? extends V> array) { final int N = array.mSize; ensureCapacity(mSize + N); if (mSize == 0) { if (N > 0) { System.arraycopy(array.mHashes, 0, mHashes, 0, N); System.arraycopy(array.mArray, 0, mArray, 0, N<<1); mSize = N; } } else { for (int i=0; i<N; i++) { put(array.keyAt(i), array.valueAt(i)); } } } /** * Remove an existing key from the array map. * @param key The key of the mapping to remove. * @return Returns the value that was stored under the key, or null if there * was no such key. */ public V remove(Object key) { final int index = indexOfKey(key); if (index >= 0) { return removeAt(index); } return null; } /** * Remove the key/value mapping at the given index. * @param index The desired index, must be between 0 and {@link #size()}-1. * @return Returns the value that was stored at this index. */ public V removeAt(int index) { final Object old = mArray[(index << 1) + 1]; if (mSize <= 1) { // Now empty. if (DEBUG) Log.d(TAG, "remove: shrink from " + mHashes.length + " to 0"); freeArrays(mHashes, mArray, mSize); mHashes = ContainerHelpers.EMPTY_INTS; mArray = ContainerHelpers.EMPTY_OBJECTS; mSize = 0; } else { if (mHashes.length > (BASE_SIZE*2) && mSize < mHashes.length/3) { // Shrunk enough to reduce size of arrays. We don't allow it to // shrink smaller than (BASE_SIZE*2) to avoid flapping between // that and BASE_SIZE. final int n = mSize > (BASE_SIZE*2) ? (mSize + (mSize>>1)) : (BASE_SIZE*2); if (DEBUG) Log.d(TAG, "remove: shrink from " + mHashes.length + " to " + n); final int[] ohashes = mHashes; final Object[] oarray = mArray; allocArrays(n); mSize--; if (index > 0) { if (DEBUG) Log.d(TAG, "remove: copy from 0-" + index + " to 0"); System.arraycopy(ohashes, 0, mHashes, 0, index); System.arraycopy(oarray, 0, mArray, 0, index << 1); } if (index < mSize) { if (DEBUG) Log.d(TAG, "remove: copy from " + (index+1) + "-" + mSize + " to " + index); System.arraycopy(ohashes, index + 1, mHashes, index, mSize - index); System.arraycopy(oarray, (index + 1) << 1, mArray, index << 1, (mSize - index) << 1); } } else { mSize--; if (index < mSize) { if (DEBUG) Log.d(TAG, "remove: move " + (index+1) + "-" + mSize + " to " + index); System.arraycopy(mHashes, index + 1, mHashes, index, mSize - index); System.arraycopy(mArray, (index + 1) << 1, mArray, index << 1, (mSize - index) << 1); } mArray[mSize << 1] = null; mArray[(mSize << 1) + 1] = null; } } return (V)old; } /** * Return the number of items in this array map. */ public int size() { return mSize; } /** * {@inheritDoc} * * <p>This implementation returns false if the object is not a map, or * if the maps have different sizes. Otherwise, for each key in this map, * values of both maps are compared. If the values for any key are not * equal, the method returns false, otherwise it returns true. */ @Override public boolean equals(Object object) { if (this == object) { return true; } if (object instanceof Map) { Map<?, ?> map = (Map<?, ?>) object; if (size() != map.size()) { return false; } try { for (int i=0; i<mSize; i++) { K key = keyAt(i); V mine = valueAt(i); Object theirs = map.get(key); if (mine == null) { if (theirs != null || !map.containsKey(key)) { return false; } } else if (!mine.equals(theirs)) { return false; } } } catch (NullPointerException ignored) { return false; } catch (ClassCastException ignored) { return false; } return true; } return false; } /** * {@inheritDoc} */ @Override public int hashCode() { final int[] hashes = mHashes; final Object[] array = mArray; int result = 0; for (int i = 0, v = 1, s = mSize; i < s; i++, v+=2) { Object value = array[v]; result += hashes[i] ^ (value == null ? 0 : value.hashCode()); } return result; } /** * {@inheritDoc} * * <p>This implementation composes a string by iterating over its mappings. If * this map contains itself as a key or a value, the string "(this Map)" * will appear in its place. */ @Override public String toString() { if (isEmpty()) { return "{}"; } StringBuilder buffer = new StringBuilder(mSize * 28); buffer.append('{'); for (int i=0; i<mSize; i++) { if (i > 0) { buffer.append(", "); } Object key = keyAt(i); if (key != this) { buffer.append(key); } else { buffer.append("(this Map)"); } buffer.append('='); Object value = valueAt(i); if (value != this) { buffer.append(value); } else { buffer.append("(this Map)"); } } buffer.append('}'); return buffer.toString(); } }
[ "zhangjiongxuan@360.cn" ]
zhangjiongxuan@360.cn
9af65387b79e18b76a75c7431c50050e819b7613
faa7f5b2e689f34073348ebc7e1156b7ebf326b1
/src/com/revisit/project/repository/UserRepository.java
84331d45d161868888c6ed5fdcc7cd1394d34f03
[]
no_license
chrisprem11/CRUD
15365f45d49b3407d1fb6a1a7e0b216bf119c8cc
5c9976efc198c96b102cb8c31ef6937a00ff5271
refs/heads/master
2021-01-13T03:40:39.077114
2016-12-24T14:58:45
2016-12-24T14:58:45
77,278,483
0
0
null
null
null
null
UTF-8
Java
false
false
1,304
java
package com.revisit.project.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.revisit.project.model.User; @Repository public interface UserRepository extends JpaRepository<User, Integer> { public List<User> findAll(); public User findByEmail(String email); public User findByUserId(Long id); @Modifying @Transactional @Query("delete from User u "+" where id=:id") public int deleteUserDetail(@Param("id") Long id); @Modifying @Transactional @Query("delete from VerificationToken v "+" where user_id=:id") public int deleteUserVToken(@Param("id") Long id); @Modifying @Transactional @Query("update User u set firstName =:firstName,lastName=:lastName,email=:email,password=:password " + "where id=:id") public int updateUser(@Param("firstName") String firstName, @Param("lastName") String lastName, @Param("password") String password, @Param("email") String email, @Param("id") Long id); }
[ "mygithub@11" ]
mygithub@11
9280d0745c44fa7fe78d98d16dc74cdb72246f53
8782061b1e1223488a090f9f3f3b8dfe489e054a
/storeMongoDB/projects/ABCD/andrekeane_marenor/main/24.java
d470b412d88d37f0a435aea7d39ec185a4758f06
[]
no_license
ryosuke-ku/TCS_init
3cb79a46aa217e62d8fff13d600f2a9583df986c
e1207d68bdc9d2f1eed63ef44a672b5a37b45633
refs/heads/master
2020-08-08T18:40:17.929911
2019-10-18T01:06:32
2019-10-18T01:06:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
public void setHighlightColor(Color highlightColor) { if (highlightColor == null) { String message = Logging.getMessage("nullValue.ColorIsNull"); Logging.logger().severe(message); throw new IllegalStateException(message); } this.highlightColor = highlightColor; }
[ "naist1020@gmail.com" ]
naist1020@gmail.com
8fc2fbef74da0efa6d519502cac7c8efff296b22
076cf74f1e96b77d40acb7cdae7c1acbe40d937a
/scripts/fc/missions/fc_witchs_potion/FCWitchsPotion.java
b1d375d46825fb9df6bdc9f4408e87af905b85ff
[]
no_license
fmorris2/fc-witchs-potion
f1ab1828b27c19da2d5072ff7e1900269a99e5fd
9ca27daa3386273ef2dfd05623fe1f436faa224c
refs/heads/master
2021-03-24T13:48:24.698293
2018-05-14T20:38:00
2018-05-14T20:38:00
96,810,316
0
0
null
null
null
null
UTF-8
Java
false
false
1,862
java
package scripts.fc.missions.fc_witchs_potion; import java.util.Arrays; import java.util.LinkedList; import scripts.fc.framework.quest.QuestScriptManager; import scripts.fc.framework.requirement.Requirement; import scripts.fc.framework.script.FCMissionScript; import scripts.fc.framework.task.Task; import scripts.fc.missions.fc_witchs_potion.data.WPReqs; import scripts.fc.missions.fc_witchs_potion.data.WPSettings; import scripts.fc.missions.fc_witchs_potion.tasks.impl.BurnBeef; import scripts.fc.missions.fc_witchs_potion.tasks.impl.CollectRatTail; import scripts.fc.missions.fc_witchs_potion.tasks.impl.DrinkFromCauldron; import scripts.fc.missions.fc_witchs_potion.tasks.impl.StartQuest; import scripts.fc.missions.fc_witchs_potion.tasks.impl.TurnInMaterials; public class FCWitchsPotion extends QuestScriptManager { public static final int SETTING = 67; public FCWitchsPotion(FCMissionScript fcScript) { super(fcScript); } @Override public boolean canStart() { return true; } @Override public boolean hasReachedEndingCondition() { return WPSettings.QUEST_COMPLETE.isValid(); } @Override public String getMissionName() { return "FC Witch's Potion"; } @Override public String getEndingMessage() { return "FC Witch's Potion has ended"; } @Override public String[] getMissionSpecificPaint() { return new String[]{}; } @Override public void resetStatistics() { } @Override public Requirement[] getRequirements() { return new Requirement[]{new WPReqs(missionScript)}; } @Override public LinkedList<Task> getTaskList() { return new LinkedList<>(Arrays.asList(new StartQuest(), new CollectRatTail(), new BurnBeef(), new TurnInMaterials(), new DrinkFromCauldron())); } public String toString() { return "Witch's Potion"; } @Override public int getQuestPointReward() { return 1; } }
[ "fmorris2@oswego.edu" ]
fmorris2@oswego.edu
6693ba4ca67d8f5f24c2434763eab4a63297ec39
1584faa7facf9b2fa2e0fb6d8ecb672a6457a782
/week-04/assessment/sustainable-foraging/src/main/java/learn/foraging/models/CategoryValue.java
12432e960cb2a2616c4fbfc372e8c02c41b4a795
[]
no_license
JacobRosenbaum/dev10-classwork
4c652f1a187df78b9a138b13688b7964766b9f49
b1444ce74f590462536cb10c04e3e6c87cc2bd1f
refs/heads/main
2023-03-04T04:58:59.065185
2021-02-19T18:25:16
2021-02-19T18:25:16
319,703,778
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package learn.foraging.models; import java.math.BigDecimal; import java.math.RoundingMode; public class CategoryValue { private Item item; private Category category; private double kilograms; private BigDecimal value; public CategoryValue(Item item, Category category, BigDecimal value) { this.item = item; this.category = category; this.value = value; } public Item getItem() { return item; } public void setItem(Item item) { this.item = item; } public Category getCategory() { return category; } public void setCategory(Category category) { this.category = category; } public double getKilograms() { return kilograms; } public void setKilograms(double kilograms) { this.kilograms = kilograms; } public BigDecimal getValue() { if (item == null || item.getDollarPerKilogram() == null) { return BigDecimal.ZERO; } BigDecimal kilos = new BigDecimal(kilograms).setScale(4, RoundingMode.HALF_UP); return item.getDollarPerKilogram().multiply(kilos); } }
[ "jacobrosenbaum95@gmail.com" ]
jacobrosenbaum95@gmail.com
a64b49523d84ab7c34be3edbe6efb2bb86839554
cd44b7733b625dcd571bee12a21fe9a43f2bd605
/BST/src/checkbst/BinaryTreeNode.java
04076a164ff630994caa4d1a7d235bcf47b44fb1
[]
no_license
Smartcobra/trees
c79048d52446c2b300c5f5610b8899bd6b1d7739
fa291556a51a007f1101d9c0808e8eb02f5febe2
refs/heads/master
2023-08-17T07:32:16.384303
2021-09-21T03:53:31
2021-09-21T03:53:31
398,809,370
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package checkbst; public class BinaryTreeNode<T> { public T data; public BinaryTreeNode<Integer> left; public BinaryTreeNode<T> right; public BinaryTreeNode(T data){ this.data=data; } }
[ "iamjitu.pradhan@gmail..com" ]
iamjitu.pradhan@gmail..com
23b5c83fe17f675bd3af95360fc62b19da58225e
76a57c21dfb080a550a75ca431ab966fffe44420
/src/main/java/org/kilocraft/essentials/api/util/EntityCommands.java
4c27b4928ad3f40aae5116f0e93f080e4e8a310d
[ "MIT" ]
permissive
KiloCraft/KiloEssentials
f7237839e01668de1f9237b5c7bc81414e4474b6
a5b1943028495f9a5f2263514d4aca18597ea65b
refs/heads/master
2022-12-03T07:42:51.627559
2022-11-24T19:36:52
2022-11-24T19:36:52
204,574,164
11
15
MIT
2021-12-29T16:14:46
2019-08-26T22:43:37
Java
UTF-8
Java
false
false
2,375
java
package org.kilocraft.essentials.api.util; import it.unimi.dsi.fastutil.objects.Object2LongArrayMap; import it.unimi.dsi.fastutil.objects.Object2LongMap; import net.fabricmc.fabric.api.event.player.AttackEntityCallback; import net.fabricmc.fabric.api.event.player.UseEntityCallback; import net.minecraft.Util; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.commands.data.EntityDataAccessor; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import org.kilocraft.essentials.util.commands.CommandUtils; import org.spongepowered.include.com.google.common.base.Strings; import java.util.UUID; public class EntityCommands { private static final Object2LongMap<UUID> LAST_ENTITY_INTERACTION = new Object2LongArrayMap<>(); public static void registerEvents() { UseEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> handleInteraction(player, entity, false)); AttackEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> handleInteraction(player, entity, true)); } private static InteractionResult handleInteraction(Player playerEntity, Entity entity, boolean leftClick) { if (isOnCooldown(playerEntity)) return InteractionResult.PASS; if (entity != null) { EntityDataAccessor dataObject = new EntityDataAccessor(entity); CompoundTag nbt = dataObject.getData(); if (runCommand(playerEntity, nbt.getString("command"))) return InteractionResult.SUCCESS; if (runCommand(playerEntity, leftClick ? nbt.getString("leftCommand") : nbt.getString("rightCommand"))) return InteractionResult.SUCCESS; LAST_ENTITY_INTERACTION.put(playerEntity.getUUID(), Util.getMillis()); } return InteractionResult.PASS; } private static boolean isOnCooldown(Player playerEntity) { return LAST_ENTITY_INTERACTION.getOrDefault(playerEntity.getUUID(), 0) + 50 > Util.getMillis(); } private static boolean runCommand(Player playerEntity, String command) { if (!Strings.isNullOrEmpty(command)) { CommandUtils.runCommandWithFormatting(playerEntity.createCommandSourceStack(), command); return true; } return false; } }
[ "nicknamedrex@gmail.com" ]
nicknamedrex@gmail.com
824f6122f2a6393be48e799c3a90b6305b9a93aa
f7f485dc381d4b9938da1ce05358f08714072e60
/study/mylayout/src/com/cnblsp2/study/mylayout/tablelayout/TableLayoutEx1Activity.java
ddc4044824128a70db9e76a44eaeca195f0b182a
[ "Apache-2.0" ]
permissive
cnblsp2/cnblsp2android
f4aed04ba94d38de56f3d3fbb9d271c00ac07c55
1ce34ad13133d39876b701fc0dd14ebbd0d87e2f
refs/heads/master
2021-04-12T04:17:04.658619
2014-03-22T11:48:26
2014-03-22T11:48:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
424
java
package com.cnblsp2.study.mylayout.tablelayout; import com.cnblsp2.study.mylayout.R; import android.app.Activity; import android.os.Bundle; public class TableLayoutEx1Activity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_tablelayout_ex1); } }
[ "cnblsp2@126.com" ]
cnblsp2@126.com
642fbe01cd2f79db7877a9f0037fb3a1f35d7a87
f8c77ef76cb50bb41d22573d7b7562f2d9217e3c
/TranSysLab/src/main/java/com/transyslab/roadnetwork/LinkTimes.java
564b345e780dce782a69e7c0a06a961aaee64ac2
[ "Apache-2.0" ]
permissive
ymnwang/transyslab
bf7bf7db2a0d560fd6bdbd87435507c39493546d
d13f62ecd09cc4ee55ac871b954900cf918bfaa3
refs/heads/master
2020-05-26T10:11:45.791288
2019-05-23T00:55:58
2019-05-23T00:55:58
188,199,755
0
0
Apache-2.0
2019-05-23T09:07:55
2019-05-23T09:07:55
null
GB18030
Java
false
false
7,410
java
/* * Copyright 2019 The TranSysLab Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.transyslab.roadnetwork; import com.transyslab.commons.tools.SimulationClock; /** * LinkTime * */ public class LinkTimes { protected int mode;// 新增属性,mode=0:默认模式,仿真结果只统计一次,mode=1:自定义模式, // 集计时间间隔按设定执行 protected int infoStartPeriod; // the start interval protected long infoStartTime; // start time of link time table protected long infoStopTime; // stop time of link time table protected long infoPeriodLength; // length of each period (second) protected long infoTotalLength; // total length protected int infoPeriods; // number of time periods // Travel time are all measured in seconds. protected double[] linkTimes; // 2D travel times on each link protected double[] avgLinkTime; // 1D average travel time // 0 = used only when the vehicle passes a info node (e.g. vms) // 1 = also used as pretrip. // default = 1 protected int preTripGuidance; protected SimulationClock simClock; public LinkTimes(SimulationClock simClock) { linkTimes = null; avgLinkTime = null; infoPeriods = 0; preTripGuidance = 1; // 自定义设置模式 mode = 1; this.simClock = simClock; } public void initTravelTimes(RoadNetwork network) { // 待完善的处理,割掉了读文件中每条link的traveltime信息 if (mode != 0) { // Parameters will be read from the file // read(filename_); // start column infoStartPeriod = 0; // length in seconds per period infoPeriodLength = 300; // number of colomns infoPeriods = 49; infoTotalLength = infoPeriods * infoPeriodLength; infoStartTime = Math.round(this.simClock.getStartTime()) + infoStartPeriod * infoPeriodLength; infoStopTime = infoStartTime + infoTotalLength; // link长度/freespeed calcLinkTravelTimes(network); } else { infoStartPeriod = 0; infoStartTime = Math.round(this.simClock.getStartTime()); infoStopTime = Math.round(this.simClock.getStopTime()); infoPeriodLength = infoStopTime - infoStartTime; infoTotalLength = infoPeriodLength; infoPeriods = 1; calcLinkTravelTimes(network); } } /* public int nDestNodes() { return RoadNetwork.getInstance().nDestNodes(); }*/ public int infoStartPeriod() { return infoStartPeriod; } public long infoStartTime() { return infoStartTime; } public long infoStopTime() { return infoStopTime; } public int infoPeriods() { return infoPeriods; } public long infoPeriodLength() { return infoPeriodLength; } public long infoTotalLength() { return infoTotalLength; } public int whichPeriod(double t) { // Returns the interval that contains time t int p = (int) t; if (p <= infoStartTime) { // earlier return 0; } else if (p >= infoStopTime) { // later return infoPeriods - 1; } else { // between return (int) ((t - infoStartTime) / infoPeriodLength); } } // Returns the time that represents interval p. public double whatTime(int p) { return infoStartTime + (p + 0.5) * infoPeriodLength; } public double linkTime(Link i, double timesec) { return linkTime(i.getIndex(), timesec); } // Returns the expected link travel time at the given entry time public double linkTime(int k, double timesec) { if (infoPeriods > 1) { double[] y = linkTimes; // float y = linkTimes[k * infoPeriods]; double dt = ((timesec - infoStartTime) / infoPeriodLength + 0.5); int i = (int) dt; if (i < 1) { return y[k * infoPeriods]; } else if (i >= infoPeriods) { return y[k * infoPeriods + infoPeriods - 1]; } else { dt = (float) (timesec - infoStartTime - (i - 0.5) * infoPeriodLength); double z = y[k * infoPeriods + i - 1]; return z + (y[k * infoPeriods + i] - z) / infoPeriodLength * dt; } } else { return linkTimes[k]; } } // Returns the average travel time on a given link public double avgLinkTime(Link i) { // average return avgLinkTime(i.getIndex()); } public double avgLinkTime(int i) { return avgLinkTime[i]; } // This function is called by Graph::labelCorrecting(...) public double cost(int i, double timesec) { return linkTime(i, timesec); } public double cost(int i) { return avgLinkTime[i]; } // Create the default travel times for each link. This function // should be called only once. public void calcLinkTravelTimes(RoadNetwork network) { // should called only once int i, j, n = network.nLinks(); if (linkTimes == null) { linkTimes = new double[network.nLinks() * infoPeriods]; } for (i = 0; i < n; i++) { double x = network.getLink(i).getGenTravelTime(network.simParameter.freewayBias); for (j = 0; j < infoPeriods; j++) { linkTimes[i * infoPeriods + j] = x; } } if (infoPeriods > 1) { if (avgLinkTime == null) avgLinkTime = new double[n]; for (i = 0; i < n; i++) { float sum = 0; for (j = 0; j < infoPeriods; j++) { sum += linkTimes[i * infoPeriods + j]; } avgLinkTime[i] = sum / infoPeriods; } } else { avgLinkTime = linkTimes; } update2Graph(network); } // Update the link travel times. The result is a linear combination // of the previous data and new data calculated in the simulation // (e.g., based on the average of the expected travel times of all // vehicles that are currently in the link or based on the sensors // data collected in the most recent time interval, depends on the // current value of RN_Link::travelTime() is defined in the // derived class). public void updateLinkTravelTimes(float alpha, RoadNetwork network) { double x; double[] py = linkTimes; int i, j, n = network.nLinks(); int k = whichPeriod(network.simClock.getCurrentTime()); for (i = 0; i < n; i++) { Link pl = network.getLink(i); // Calculate travel time based speed/density relationship double z = pl.calcCurrentTravelTime(); x = pl.generalizeTravelTime(z,network.simParameter.freewayBias); // Update travel time for all future intervals using the same // estimates. This is simulating the system that provides // guidance based on prevailing/instaneous traffic condition. for (j = k; j < infoPeriods; j++) { // py = linkTimes + i * infoPeriods + j; py[i * infoPeriods + j] = (alpha * x + (1.0 - alpha) * (py[i * infoPeriods + j])); } if (infoPeriods > 1) { avgLinkTime[i] = x; } } update2Graph(network); } public void preTripGuidance(int flag) { preTripGuidance = flag; } public int preTripGuidance() { return preTripGuidance; } //wym 将结果更新至RoadNetwork图结构中 protected void update2Graph(RoadNetwork theRN) { for (int i = 0; i < avgLinkTime.length; i++) { Link theLink = theRN.getLink(i); theRN.setEdgeWeight(theLink, avgLinkTime[i]); } } }
[ "wangyim6@mail2.sysu.edu.cn" ]
wangyim6@mail2.sysu.edu.cn
a2bae796eaa4b7945b34fd40ced2d19a9a85b0d3
986ca054031fec35551a85733e5aff08ccee4f3b
/src-api/com/github/gwtcannonjs/client/collision/AABB.java
c363db97014275ce82628b3c66fc0355ce13a72d
[ "Apache-2.0", "MIT" ]
permissive
jgottero/gwt-cannonjs
d70d0ebb55f4b33ca3145267c03147f1d25a586c
c4478243e935b072ef0dc442ffca85f0b2eff0a1
refs/heads/master
2020-06-05T08:24:44.187440
2015-03-10T17:36:30
2015-03-10T17:36:30
31,328,100
2
0
null
null
null
null
UTF-8
Java
false
false
2,245
java
// The MIT License (MIT) // Copyright (c) 2015 Jérémie Gottero package com.github.gwtcannonjs.client.collision; import com.github.gwtcannonjs.client.math.Quaternion; import com.github.gwtcannonjs.client.math.Vec3; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArray; /** * Axis aligned bounding box class. */ public class AABB extends JavaScriptObject { protected AABB() { // A JavaScriptObject cannot be created directly } /** * The lower bound of the bounding box. */ public final native Vec3 getLowerBound() /*-{ return this.lowerBound; }-*/; /** * The lower bound of the bounding box. */ public final native void setLowerBound(Vec3 lowerBound) /*-{ this.lowerBound = lowerBound; }-*/; /** * The lower bound of the bounding box. */ public final native AABB withLowerBound(Vec3 lowerBound) /*-{ this.lowerBound = lowerBound; return this; }-*/; /** * The upper bound of the bounding box. */ public final native Vec3 getUpperBound() /*-{ return this.upperBound; }-*/; /** * The upper bound of the bounding box. */ public final native void setUpperBound(Vec3 upperBound) /*-{ this.upperBound = upperBound; }-*/; /** * The upper bound of the bounding box. */ public final native AABB withUpperBound(Vec3 upperBound) /*-{ this.upperBound = upperBound; return this; }-*/; /** * Set the AABB bounds from a set of points. * @param points An array of Vec3's. * @param position * @param quaternion * @param skinSize */ public final native void setFromPoints(JsArray<Vec3> points, Vec3 position, Quaternion quaternion, double skinSize) /*-{ this.setFromPoints(points, position, quaternion, skinSize); }-*/; /** * Copy bounds from an AABB to this AABB * @param aabb Source to copy from */ public final native void copy(AABB aabb) /*-{ this.copy(aabb); }-*/; /** * Extend this AABB so that it covers the given AABB too. * @param aabb */ public final native void extend(AABB aabb) /*-{ this.extend(aabb); }-*/; /** * Returns true if the given AABB overlaps this AABB. * @param aabb */ public final native boolean overlaps(AABB aabb) /*-{ return this.overlaps(aabb); }-*/; }
[ "jeremiegottero@gmail.com" ]
jeremiegottero@gmail.com
c0869b1171003d2611144c446d658468f407408f
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipseswt_cluster/13884/tar_1.java
f803174d66bffc27b64468aa447521f06a16d143
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
66,573
java
/******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.widgets; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.events.*; /** * Instances of this class provide a selectable user interface object * that displays a hierarchy of items and issue notificiation when an * item in the hierarchy is selected. * <p> * The item children that may be added to instances of this class * must be of type <code>TreeItem</code>. * </p><p> * Note that although this class is a subclass of <code>Composite</code>, * it does not make sense to add <code>Control</code> children to it, * or set a layout on it. * </p><p> * <dl> * <dt><b>Styles:</b></dt> * <dd>SINGLE, MULTI, CHECK</dd> * <dt><b>Events:</b></dt> * <dd>Selection, DefaultSelection, Collapse, Expand</dd> * </dl> * <p> * Note: Only one of the styles SINGLE and MULTI may be specified. * </p><p> * IMPORTANT: This class is <em>not</em> intended to be subclassed. * </p> */ public class Tree extends Composite { int hAnchor; TreeItem [] items; ImageList imageList; boolean dragStarted; boolean ignoreSelect, ignoreExpand, ignoreDeselect; boolean customDraw; static final int TreeProc; static final TCHAR TreeClass = new TCHAR (0, OS.WC_TREEVIEW, true); static { WNDCLASS lpWndClass = new WNDCLASS (); OS.GetClassInfo (0, TreeClass, lpWndClass); TreeProc = lpWndClass.lpfnWndProc; } /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. * Style bits are also inherited from superclasses. * </p> * * @param parent a composite control which will be the parent of the new instance (cannot be null) * @param style the style of control to construct * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> * </ul> * * @see SWT#SINGLE * @see SWT#MULTI * @see SWT#CHECK * @see Widget#checkSubclass * @see Widget#getStyle */ public Tree (Composite parent, int style) { super (parent, checkStyle (style)); } /** * Adds the listener to the collection of listeners who will * be notified when the receiver's selection changes, by sending * it one of the messages defined in the <code>SelectionListener</code> * interface. * <p> * When <code>widgetSelected</code> is called, the item field of the event object is valid. * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes, * the event object detail field contains the value <code>SWT.CHECK</code>. * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked. * The item field of the event object is valid for default selection, but the detail field is not used. * </p> * * @param listener the listener which should be notified * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see SelectionListener * @see #removeSelectionListener * @see SelectionEvent */ public void addSelectionListener(SelectionListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection, typedListener); addListener (SWT.DefaultSelection, typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when an item in the receiver is expanded or collapsed * by sending it one of the messages defined in the <code>TreeListener</code> * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see TreeListener * @see #removeTreeListener */ public void addTreeListener(TreeListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Expand, typedListener); addListener (SWT.Collapse, typedListener); } int callWindowProc (int msg, int wParam, int lParam) { if (handle == 0) return 0; return OS.CallWindowProc (TreeProc, handle, msg, wParam, lParam); } static int checkStyle (int style) { /* * Feature in Windows. It is not possible to create * a tree that scrolls and does not have scroll bars. * The TVS_NOSCROLL style will remove the scroll bars * but the tree will never scroll. Therefore, no matter * what style bits are specified, set the H_SCROLL and * V_SCROLL bits so that the SWT style will match the * widget that Windows creates. */ style |= SWT.H_SCROLL | SWT.V_SCROLL; return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0); } public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); int width = 0, height = 0; RECT rect = new RECT (); int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0); while (hItem != 0) { rect.left = hItem; if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect) != 0) { width = Math.max (width, rect.right - rect.left); height += rect.bottom - rect.top; } hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem); } width = width * 2; if (width == 0) width = DEFAULT_WIDTH; if (height == 0) height = DEFAULT_HEIGHT; if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; int border = getBorderWidth (); width += border * 2; height += border * 2; if ((style & SWT.V_SCROLL) != 0) { width += OS.GetSystemMetrics (OS.SM_CXVSCROLL); } if ((style & SWT.H_SCROLL) != 0) { height += OS.GetSystemMetrics (OS.SM_CYHSCROLL); } return new Point (width, height); } void createHandle () { super.createHandle (); state &= ~CANVAS; /* Set the checkbox image list */ if ((style & SWT.CHECK) != 0) setCheckboxImageList (); /* * Feature in Windows. When the control is created, * it does not use the default system font. A new HFONT * is created and destroyed when the control is destroyed. * This means that a program that queries the font from * this control, uses the font in another control and then * destroys this control will have the font unexpectedly * destroyed in the other control. The fix is to assign * the font ourselves each time the control is created. * The control will not destroy a font that it did not * create. */ int hFont = OS.GetStockObject (OS.SYSTEM_FONT); OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0); } void createItem (TreeItem item, int hParent, int hInsertAfter) { item.foreground = item.background = -1; int id = 0; while (id < items.length && items [id] != null) id++; if (id == items.length) { TreeItem [] newItems = new TreeItem [items.length + 4]; System.arraycopy (items, 0, newItems, 0, items.length); items = newItems; } TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT (); tvInsert.hParent = hParent; tvInsert.hInsertAfter = hInsertAfter; tvInsert.lParam = id; tvInsert.iImage = OS.I_IMAGENONE; tvInsert.iSelectedImage = tvInsert.iImage; tvInsert.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM | OS.TVIF_IMAGE | OS.TVIF_SELECTEDIMAGE; /* Set the initial unchecked state */ if ((style & SWT.CHECK) != 0) { tvInsert.mask = tvInsert.mask | OS.TVIF_STATE; tvInsert.state = 1 << 12; tvInsert.stateMask = OS.TVIS_STATEIMAGEMASK; } /* Insert the item */ int hItem = OS.SendMessage (handle, OS.TVM_INSERTITEM, 0, tvInsert); if (hItem == 0) error (SWT.ERROR_ITEM_NOT_ADDED); item.handle = hItem; items [id] = item; /* * This code is intentionally commented. */ // if (hParent != 0) { // int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); // bits |= OS.TVS_LINESATROOT; // OS.SetWindowLong (handle, OS.GWL_STYLE, bits); // } /* * Bug in Windows. When a child item is added to a parent item * that has no children outside of WM_NOTIFY with control code * TVN_ITEMEXPANDED, the tree widget does not redraw the +/- * indicator. The fix is to detect this case and force a redraw. */ if (!OS.IsWindowVisible (handle) || drawCount > 0) return; int hChild = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hParent); if (hChild == 0 || OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hChild) != 0) { return; } RECT rect = new RECT (); rect.left = hParent; if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) != 0) { OS.InvalidateRect (handle, rect, false); } } void createWidget () { super.createWidget (); items = new TreeItem [4]; } int defaultBackground () { return OS.GetSysColor (OS.COLOR_WINDOW); } /** * Deselects all selected items in the receiver. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void deselectAll () { checkWidget (); TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.stateMask = OS.TVIS_SELECTED; if ((style & SWT.SINGLE) != 0) { int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem != 0) { tvItem.hItem = hItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } return; } int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC); OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc); for (int i=0; i<items.length; i++) { TreeItem item = items [i]; if (item != null) { tvItem.hItem = item.handle; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } } OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc); } void destroyItem (TreeItem item) { int hItem = item.handle; boolean fixRedraw = false; if (drawCount == 0 && OS.IsWindowVisible (handle)) { RECT rect = new RECT (); rect.left = hItem; fixRedraw = OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) == 0; } if (fixRedraw) { OS.UpdateWindow (handle); OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); } TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM; releaseItems (item.getItems (), tvItem); releaseItem (item, tvItem); OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, hItem); if (fixRedraw) { OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); OS.ValidateRect (handle, null); } int count = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0); if (count == 0) { if (imageList != null) { OS.SendMessage (handle, OS.TVM_SETIMAGELIST, 0, 0); display.releaseImageList (imageList); } imageList = null; customDraw = false; items = new TreeItem [4]; } } int getBackgroundPixel () { if (OS.IsWinCE) return OS.GetSysColor (OS.COLOR_WINDOW); int pixel = OS.SendMessage (handle, OS.TVM_GETBKCOLOR, 0, 0); if (pixel == -1) return OS.GetSysColor (OS.COLOR_WINDOW); return pixel; } int getForegroundPixel () { if (OS.IsWinCE) return OS.GetSysColor (OS.COLOR_WINDOWTEXT); int pixel = OS.SendMessage (handle, OS.TVM_GETTEXTCOLOR, 0, 0); if (pixel == -1) return OS.GetSysColor (OS.COLOR_WINDOWTEXT); return pixel; } /** * Returns the item at the given point in the receiver * or null if no such item exists. The point is in the * coordinate system of the receiver. * * @param point the point used to locate the item * @return the item at the given point * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the point is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public TreeItem getItem (Point point) { checkWidget (); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); TVHITTESTINFO lpht = new TVHITTESTINFO (); lpht.x = point.x; lpht.y = point.y; OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht); if (lpht.hItem != 0 && (lpht.flags & OS.TVHT_ONITEM) != 0) { TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM; tvItem.hItem = lpht.hItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); return items [tvItem.lParam]; } return null; } /** * Returns the number of items contained in the receiver * that are direct item children of the receiver. The * number that is returned is the number of roots in the * tree. * * @return the number of items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getItemCount () { checkWidget (); int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0); if (hItem == 0) return 0; return getItemCount (hItem); } int getItemCount (int hItem) { int count = 0; while (hItem != 0) { hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem); count++; } return count; } /** * Returns the height of the area which would be used to * display <em>one</em> of the items in the tree. * * @return the height of one item * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getItemHeight () { checkWidget (); return OS.SendMessage (handle, OS.TVM_GETITEMHEIGHT, 0, 0); } /** * Returns the number of items contained in the receiver * that are direct item children of the receiver. These * are the roots of the tree. * <p> * Note: This is not the actual structure used by the receiver * to maintain its list of items, so modifying the array will * not affect the receiver. * </p> * * @return the number of items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public TreeItem [] getItems () { checkWidget (); int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0); if (hItem == 0) return new TreeItem [0]; return getItems (hItem); } TreeItem [] getItems (int hTreeItem) { int count = 0, hItem = hTreeItem; while (hItem != 0) { hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem); count++; } int index = 0; TreeItem [] result = new TreeItem [count]; TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM; tvItem.hItem = hTreeItem; /* * Feature in Windows. In some cases an expand or collapse message * can occurs from within TVM_DELETEITEM. When this happens, the item * being destroyed has been removed from the list of items but has not * been deleted from the tree. The fix is to check for null items and * remove them from the list. */ while (tvItem.hItem != 0) { OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); TreeItem item = items [tvItem.lParam]; if (item != null) result [index++] = item; tvItem.hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, tvItem.hItem); } if (index != count) { TreeItem [] newResult = new TreeItem [index]; System.arraycopy (result, 0, newResult, 0, index); result = newResult; } return result; } /** * Returns the receiver's parent item, which must be a * <code>TreeItem</code> or null when the receiver is a * root. * * @return the receiver's parent item * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public TreeItem getParentItem () { checkWidget (); return null; } /** * Returns an array of <code>TreeItem</code>s that are currently * selected in the receiver. An empty array indicates that no * items are selected. * <p> * Note: This is not the actual structure used by the receiver * to maintain its selection, so modifying the array will * not affect the receiver. * </p> * @return an array representing the selection * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public TreeItem [] getSelection () { checkWidget (); if ((style & SWT.SINGLE) != 0) { int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem == 0) return new TreeItem [0]; TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_PARAM | OS.TVIF_STATE; tvItem.hItem = hItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) == 0) return new TreeItem [0]; return new TreeItem [] {items [tvItem.lParam]}; } int count = 0; TreeItem [] guess = new TreeItem [8]; TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_PARAM | OS.TVIF_STATE; int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC); OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc); for (int i=0; i<items.length; i++) { TreeItem item = items [i]; if (item != null) { tvItem.hItem = item.handle; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) != 0) { if (count < guess.length) guess [count] = item; count++; } } } OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc); if (count == 0) return new TreeItem [0]; if (count == guess.length) return guess; TreeItem [] result = new TreeItem [count]; if (count < guess.length) { System.arraycopy (guess, 0, result, 0, count); return result; } OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc); int index = 0; for (int i=0; i<items.length; i++) { TreeItem item = items [i]; if (item != null) { tvItem.hItem = item.handle; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) != 0) { result [index++] = item; } } } OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc); return result; } /** * Returns the number of selected items contained in the receiver. * * @return the number of selected items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getSelectionCount () { checkWidget (); if ((style & SWT.SINGLE) != 0) { int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem == 0) return 0; TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.hItem = hItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) == 0) return 0; return 1; } int count = 0; TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC); OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc); for (int i=0; i<items.length; i++) { TreeItem item = items [i]; if (item != null) { tvItem.hItem = item.handle; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) != 0) count++; } } OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc); return count; } /** * Returns the item which is currently at the top of the receiver. * This item can change when items are expanded, collapsed, scrolled * or new items are added or removed. * * @return the item at the top of the receiver * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @since 2.1 */ public TreeItem getTopItem () { checkWidget (); int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0); if (hItem == 0) return null; TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_PARAM; tvItem.hItem = hItem; if (OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem) == 0) return null; return items [tvItem.lParam]; } int imageIndex (Image image) { if (image == null) return OS.I_IMAGENONE; if (imageList == null) { int hOldList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0); if (hOldList != 0) OS.ImageList_Destroy (hOldList); Rectangle bounds = image.getBounds (); imageList = display.getImageList (new Point (bounds.width, bounds.height)); int index = imageList.indexOf (image); if (index == -1) index = imageList.add (image); int hImageList = imageList.getHandle (); OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, hImageList); return index; } int index = imageList.indexOf (image); if (index != -1) return index; return imageList.add (image); } boolean releaseItem (TreeItem item, TVITEM tvItem) { int hItem = item.handle; if (hItem == hAnchor) hAnchor = 0; if (item.isDisposed ()) return false; tvItem.hItem = hItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); items [tvItem.lParam] = null; return true; } void releaseItems (TreeItem [] nodes, TVITEM tvItem) { for (int i=0; i<nodes.length; i++) { TreeItem item = nodes [i]; TreeItem [] sons = item.getItems (); if (sons.length != 0) { releaseItems (sons, tvItem); } if (releaseItem (item, tvItem)) { item.releaseResources (); } } } void releaseWidget () { for (int i=0; i<items.length; i++) { TreeItem item = items [i]; if (item != null && !item.isDisposed ()) { item.releaseResources (); } } /* * Feature in Windows. For some reason, when * TVM_GETIMAGELIST or TVM_SETIMAGELIST is sent, * the tree issues NM_CUSTOMDRAW messages. This * behavior is unwanted when the tree is being * disposed. The fix is to ingore NM_CUSTOMDRAW * messages by usnig the custom draw flag. * * NOTE: This only happens on Windows XP. */ customDraw = false; items = null; if (imageList != null) { OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, 0); display.releaseImageList (imageList); } else { int hOldList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0); OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, 0); if (hOldList != 0) OS.ImageList_Destroy (hOldList); } imageList = null; int hOldList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_STATE, 0); OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_STATE, 0); if (hOldList != 0) OS.ImageList_Destroy (hOldList); super.releaseWidget (); } /** * Removes all of the items from the receiver. * <p> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void removeAll () { checkWidget (); ignoreDeselect = ignoreSelect = true; if (drawCount == 0) { OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0); /* * This code is intentionally commented. */ // OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); } int result = OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, OS.TVI_ROOT); if (drawCount == 0) { OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); /* * This code is intentionally commented. */ // OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); OS.InvalidateRect (handle, null, true); } ignoreDeselect = ignoreSelect = false; if (result == 0) error (SWT.ERROR_ITEM_NOT_REMOVED); for (int i=0; i<items.length; i++) { TreeItem item = items [i]; if (item != null && !item.isDisposed ()) { item.releaseResources (); } } if (imageList != null) { OS.SendMessage (handle, OS.TVM_SETIMAGELIST, 0, 0); display.releaseImageList (imageList); } imageList = null; customDraw = false; items = new TreeItem [4]; hAnchor = 0; } /** * Removes the listener from the collection of listeners who will * be notified when the receiver's selection changes. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see SelectionListener * @see #addSelectionListener */ public void removeSelectionListener (SelectionListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); eventTable.unhook (SWT.Selection, listener); eventTable.unhook (SWT.DefaultSelection, listener); } /** * Removes the listener from the collection of listeners who will * be notified when items in the receiver are expanded or collapsed.. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see TreeListener * @see #addTreeListener */ public void removeTreeListener(TreeListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.Expand, listener); eventTable.unhook (SWT.Collapse, listener); } /** * Display a mark indicating the point at which an item will be inserted. * The drop insert item has a visual hint to show where a dragged item * will be inserted when dropped on the tree. * * @param item the insert item. Null will clear the insertion mark. * @param after true places the insert mark above 'item'. false places * the insert mark below 'item'. * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setInsertMark (TreeItem item, boolean before) { checkWidget (); int hItem = 0; if (item != null) { if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); hItem = item.handle; } OS.SendMessage (handle, OS.TVM_SETINSERTMARK, (before) ? 0 : 1, hItem); } /** * Selects all the items in the receiver. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void selectAll () { checkWidget (); if ((style & SWT.SINGLE) != 0) return; int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem == 0) { hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0); if (hItem != 0) { ignoreSelect = true; OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hItem); ignoreSelect = false; } } TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.state = OS.TVIS_SELECTED; tvItem.stateMask = OS.TVIS_SELECTED; int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC); OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc); for (int i=0; i<items.length; i++) { TreeItem item = items [i]; if (item != null) { tvItem.hItem = item.handle; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } } OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc); } void setBackgroundPixel (int pixel) { if (background == pixel) return; background = pixel; /* * Bug in Windows. When TVM_GETBKCOLOR is used more * than once to set the background color of a tree, * the background color of the lines and the plus/minus * does not change to the new color. The fix is to set * the background color to the default before setting * the new color. */ int oldPixel = OS.SendMessage (handle, OS.TVM_GETBKCOLOR, 0, 0); if (oldPixel != -1) OS.SendMessage (handle, OS.TVM_SETBKCOLOR, 0, -1); OS.SendMessage (handle, OS.TVM_SETBKCOLOR, 0, pixel); if ((style & SWT.CHECK) != 0) setCheckboxImageList (); } void setBounds (int x, int y, int width, int height, int flags) { /* * Ensure that the selection is visible when the tree is resized * from a zero size to a size that can show the selection. */ boolean fixSelection = false; if ((flags & OS.SWP_NOSIZE) == 0 && (width != 0 || height != 0)) { if (OS.SendMessage (handle, OS.TVM_GETVISIBLECOUNT, 0, 0) == 0) { fixSelection = true; } } super.setBounds (x, y, width, height, flags); if (fixSelection) { int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem != 0) showItem (hItem); } } void setCursor (int hwndCursor) { /* * Bug in Windows. Under certain circumstances, when WM_SETCURSOR * is sent using SendMessage(), Windows GP's in the window proc for * the tree. The fix is to avoid calling the tree window proc and * set the cursor for the tree outside of WM_SETCURSOR. * * NOTE: This code assumes that the default cursor for the tree * is IDC_ARROW. */ Cursor cursor = findCursor (); int hCursor = cursor == null ? OS.LoadCursor (0, OS.IDC_ARROW) : cursor.handle; OS.SetCursor (hCursor); } void setCheckboxImageList () { if ((style & SWT.CHECK) == 0) return; int count = 5; int height = OS.SendMessage (handle, OS.TVM_GETITEMHEIGHT, 0, 0), width = height; int hImageList = OS.ImageList_Create (width, height, OS.ILC_COLOR, count, count); int hDC = OS.GetDC (handle); int memDC = OS.CreateCompatibleDC (hDC); int hBitmap = OS.CreateCompatibleBitmap (hDC, width * count, height); int hOldBitmap = OS.SelectObject (memDC, hBitmap); RECT rect = new RECT (); OS.SetRect (rect, 0, 0, width * count, height); int hBrush = OS.CreateSolidBrush (getBackgroundPixel ()); OS.FillRect (memDC, rect, hBrush); OS.DeleteObject (hBrush); int oldFont = OS.SelectObject (hDC, defaultFont ()); TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); OS.SelectObject (hDC, oldFont); int itemWidth = Math.min (tm.tmHeight, width); int itemHeight = Math.min (tm.tmHeight, height); int left = (width - itemWidth) / 2, top = (height - itemHeight) / 2 + 1; OS.SetRect (rect, left + width, top, left + width + itemWidth, top + itemHeight); OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_FLAT); rect.left += width; rect.right += width; OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_FLAT); rect.left += width; rect.right += width; OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_INACTIVE | OS.DFCS_FLAT); rect.left += width; rect.right += width; OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_INACTIVE | OS.DFCS_FLAT); OS.SelectObject (memDC, hOldBitmap); OS.DeleteDC (memDC); OS.ReleaseDC (handle, hDC); OS.ImageList_AddMasked (hImageList, hBitmap, 0); OS.DeleteObject (hBitmap); int hOldList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_STATE, 0); OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_STATE, hImageList); if (hOldList != 0) OS.ImageList_Destroy (hOldList); } void setForegroundPixel (int pixel) { if (foreground == pixel) return; foreground = pixel; OS.SendMessage (handle, OS.TVM_SETTEXTCOLOR, 0, pixel); } public void setRedraw (boolean redraw) { checkWidget (); /* * Bug in Windows. For some reason, when WM_SETREDRAW * is used to turn redraw on for a tree and the tree * contains no items, the last item in the tree does * not redraw properly. If the tree has only one item, * that item is not drawn. If another window is dragged * on top of the item, parts of the item are redrawn * and erased at random. The fix is to ensure that this * case doesn't happen by inserting and deleting an item * when redraw is turned on and there are no items in * the tree. */ int hItem = 0; if (redraw) { int count = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0); if (count == 0) { TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT (); tvInsert.hInsertAfter = OS.TVI_FIRST; hItem = OS.SendMessage (handle, OS.TVM_INSERTITEM, 0, tvInsert); } } super.setRedraw (redraw); if (hItem != 0) { OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, hItem); } } /** * Sets the receiver's selection to be the given array of items. * The current selected is first cleared, then the new items are * selected. * * @param items the array of items * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see Tree#deselectAll() */ public void setSelection (TreeItem [] items) { checkWidget (); if (items == null) error (SWT.ERROR_NULL_ARGUMENT); /* Select/deselect the first item */ int hOldItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (items.length == 0) { if (hOldItem != 0) { TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.stateMask = OS.TVIS_SELECTED; tvItem.hItem = hOldItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } } else { int hNewItem = 0; TreeItem item = items [0]; if (item != null) { if (item.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); hAnchor = hNewItem = item.handle; } ignoreSelect = true; OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hNewItem); ignoreSelect = false; /* * Feature in Windows. When the old and new focused item * are the same, Windows does not check to make sure that * the item is actually selected, not just focused. The * fix is to force the item to draw selected by setting * the state mask. */ if (hOldItem == hNewItem) { TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.state = OS.TVIS_SELECTED; tvItem.stateMask = OS.TVIS_SELECTED; tvItem.hItem = hNewItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } showItem (hNewItem); } if ((style & SWT.SINGLE) != 0) return; /* Select/deselect the rest of the items */ TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.stateMask = OS.TVIS_SELECTED; int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC); OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc); for (int i=0; i<this.items.length; i++) { TreeItem item = this.items [i]; if (item != null) { int index = 0; while (index < items.length) { if (items [index] == item) break; index++; } tvItem.hItem = item.handle; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) != 0) { if (index == items.length) { tvItem.state = 0; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } } else { if (index != items.length) { tvItem.state = OS.TVIS_SELECTED; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } } } } OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc); } /** * Sets the item which is currently at the top of the receiver. * This item can change when items are expanded, collapsed, scrolled * or new items are added or removed. * * @param item the item to be shown * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the item is null</li> * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see Tree#getTopItem() * * @since 2.1 */ public void setTopItem (TreeItem item) { checkWidget (); if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (item.isDisposed ()) SWT.error (SWT.ERROR_INVALID_ARGUMENT); OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_FIRSTVISIBLE, item.handle); } void showItem (int hItem) { /* * Bug in Windows. When TVM_ENSUREVISIBLE is used to ensure * that an item is visible and the client area of the tree is * smaller that the size of one item, TVM_ENSUREVISIBLE makes * the next item in the tree visible by making it the top item * instead of making the desired item visible. The fix is to * detect the case when the client area is too small and make * the desired visible item be the top item in the tree. */ if (OS.SendMessage (handle, OS.TVM_GETVISIBLECOUNT, 0, 0) == 0) { OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_FIRSTVISIBLE, hItem); OS.SendMessage (handle, OS.WM_HSCROLL, OS.SB_TOP ,0); } else { boolean scroll = true; RECT itemRect = new RECT (); itemRect.left = hItem; if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, itemRect) != 0) { RECT rect = new RECT (); OS.GetClientRect (handle, rect); POINT pt = new POINT (); pt.x = itemRect.left; pt.y = itemRect.top; if (OS.PtInRect (rect, pt)) { pt.y = itemRect.bottom; if (OS.PtInRect (rect, pt)) scroll = false; } } if (scroll) OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hItem); } } /** * Shows the item. If the item is already showing in the receiver, * this method simply returns. Otherwise, the items are scrolled * and expanded until the item is visible. * * @param item the item to be shown * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the item is null</li> * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see Tree#showSelection() */ public void showItem (TreeItem item) { checkWidget (); if (item == null) error (SWT.ERROR_NULL_ARGUMENT); if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); showItem (item.handle); } /** * Shows the selection. If the selection is already showing in the receiver, * this method simply returns. Otherwise, the items are scrolled until * the selection is visible. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see Tree#showItem(TreeItem) */ public void showSelection () { checkWidget (); int hItem = 0; if ((style & SWT.SINGLE) != 0) { hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem == 0) return; TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.hItem = hItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) == 0) return; } else { TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC); OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc); int index = 0; while (index <items.length) { TreeItem item = items [index]; if (item != null) { tvItem.hItem = item.handle; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) != 0) { hItem = tvItem.hItem; break; } } index++; } OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc); } if (hItem != 0) showItem (hItem); } String toolTipText (NMTTDISPINFO hdr) { int hwndToolTip = OS.SendMessage (handle, OS.TVM_GETTOOLTIPS, 0, 0); if (hwndToolTip == hdr.hwndFrom && toolTipText != null) return ""; //$NON-NLS-1$ return super.toolTipText (hdr); } int widgetStyle () { int bits = super.widgetStyle () | OS.TVS_SHOWSELALWAYS; bits |= OS.TVS_LINESATROOT | OS.TVS_HASLINES | OS.TVS_HASBUTTONS; /* * This code is intentionally commented. In future, * FULL_SELECTION may be implemented for trees. */ // if ((style & SWT.FULL_SELECTION) != 0) { // bits |= OS.TVS_FULLROWSELECT; // } else { // bits |= OS.TVS_HASLINES | OS.TVS_HASBUTTONS; // } // bits |= OS.TVS_NOTOOLTIPS; return bits; } TCHAR windowClass () { return TreeClass; } int windowProc () { return TreeProc; } LRESULT WM_CHAR (int wParam, int lParam) { LRESULT result = super.WM_CHAR (wParam, lParam); if (result != null) return result; /* * Feature in Windows. The tree control beeps * in WM_CHAR when the search for the item that * matches the key stroke fails. This is the * standard tree behavior but is unexpected when * the key that was typed was ESC, CR or SPACE. * The fix is to avoid calling the tree window * proc in these cases. */ switch (wParam) { case OS.VK_ESCAPE: case OS.VK_RETURN: case OS.VK_SPACE: return LRESULT.ZERO; } return result; } LRESULT WM_GETOBJECT (int wParam, int lParam) { /* * Ensure that there is an accessible object created for this * control because support for checked item accessibility is * temporarily implemented in the accessibility package. */ if ((style & SWT.CHECK) != 0) { if (accessible == null) accessible = new_Accessible (this); } return super.WM_GETOBJECT (wParam, lParam); } LRESULT WM_KEYDOWN (int wParam, int lParam) { LRESULT result = super.WM_KEYDOWN (wParam, lParam); if (result != null) return result; switch (wParam) { case OS.VK_SPACE: { int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem != 0) { hAnchor = hItem; OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hItem); TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE | OS.TVIF_PARAM; tvItem.hItem = hItem; if ((style & SWT.CHECK) != 0) { tvItem.stateMask = OS.TVIS_STATEIMAGEMASK; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); int state = tvItem.state >> 12; if ((state & 0x1) != 0) { state++; } else { --state; } tvItem.state = state << 12; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } tvItem.stateMask = OS.TVIS_SELECTED; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((style & SWT.MULTI) != 0 && OS.GetKeyState (OS.VK_CONTROL) < 0) { if ((tvItem.state & OS.TVIS_SELECTED) != 0) { tvItem.state &= ~OS.TVIS_SELECTED; } else { tvItem.state |= OS.TVIS_SELECTED; } } else { tvItem.state |= OS.TVIS_SELECTED; } OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); Event event = new Event (); event.item = items [tvItem.lParam]; postEvent (SWT.Selection, event); if ((style & SWT.CHECK) != 0) { event = new Event (); event.item = items [tvItem.lParam]; event.detail = SWT.CHECK; postEvent (SWT.Selection, event); } return LRESULT.ZERO; } break; } case OS.VK_UP: case OS.VK_DOWN: case OS.VK_PRIOR: case OS.VK_NEXT: case OS.VK_HOME: case OS.VK_END: { if ((style & SWT.SINGLE) != 0) break; if (OS.GetKeyState (OS.VK_SHIFT) < 0) { int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem != 0) { if (hAnchor == 0) hAnchor = hItem; ignoreSelect = ignoreDeselect = true; int code = callWindowProc (OS.WM_KEYDOWN, wParam, lParam); ignoreSelect = ignoreDeselect = false; int hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.stateMask = OS.TVIS_SELECTED; int hDeselectItem = hItem; RECT rect1 = new RECT (); rect1.left = hAnchor; OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1); RECT rect2 = rect2 = new RECT (); rect2.left = hDeselectItem; OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2); int flags = rect1.top < rect2.top ? OS.TVGN_PREVIOUSVISIBLE : OS.TVGN_NEXTVISIBLE; while (hDeselectItem != hAnchor) { tvItem.hItem = hDeselectItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); hDeselectItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hDeselectItem); } int hSelectItem = hAnchor; rect1.left = hNewItem; OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1); rect2.left = hSelectItem; OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2); tvItem.state = OS.TVIS_SELECTED; flags = rect1.top < rect2.top ? OS.TVGN_PREVIOUSVISIBLE : OS.TVGN_NEXTVISIBLE; while (hSelectItem != hNewItem) { tvItem.hItem = hSelectItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); hSelectItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hSelectItem); } tvItem.hItem = hNewItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); tvItem.mask = OS.TVIF_PARAM; tvItem.hItem = hNewItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); Event event = new Event (); event.item = items [tvItem.lParam]; postEvent (SWT.Selection, event); return new LRESULT (code); } } if (OS.GetKeyState (OS.VK_CONTROL) < 0) { int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem != 0) { TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.stateMask = OS.TVIS_SELECTED; tvItem.hItem = hItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); boolean oldSelected = (tvItem.state & OS.TVIS_SELECTED) != 0; int hNewItem = 0; switch (wParam) { case OS.VK_UP: hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUSVISIBLE, hItem); break; case OS.VK_DOWN: hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem); break; case OS.VK_HOME: hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0); break; case OS.VK_PRIOR: hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0); if (hNewItem == hItem) { OS.SendMessage (handle, OS.WM_VSCROLL, OS.SB_PAGEUP, 0); hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0); } break; case OS.VK_NEXT: RECT rect = new RECT (), clientRect = new RECT (); OS.GetClientRect (handle, clientRect); hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0); do { int hVisible = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hNewItem); if (hVisible == 0) break; rect.left = hVisible; OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect); if (rect.bottom > clientRect.bottom) break; if ((hNewItem = hVisible) == hItem) { OS.SendMessage (handle, OS.WM_VSCROLL, OS.SB_PAGEDOWN, 0); } } while (hNewItem != 0); break; case OS.VK_END: hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0); break; } if (hNewItem != 0) { OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hNewItem); tvItem.hItem = hNewItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); boolean newSelected = (tvItem.state & OS.TVIS_SELECTED) != 0; if (!newSelected && drawCount == 0) { OS.UpdateWindow (handle); OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0); /* * This code is intentionally commented. */ // OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); } ignoreSelect = true; OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hNewItem); ignoreSelect = false; if (oldSelected) { tvItem.state = OS.TVIS_SELECTED; tvItem.hItem = hItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } if (!newSelected) { tvItem.state = 0; tvItem.hItem = hNewItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } if (!newSelected && drawCount == 0) { RECT rect1 = new RECT (), rect2 = new RECT (); rect1.left = hItem; rect2.left = hNewItem; OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1); OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2); /* * This code is intentionally commented. */ // OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); if (OS.IsWinCE) { OS.InvalidateRect (handle, rect1, false); OS.InvalidateRect (handle, rect2, false); OS.UpdateWindow (handle); } else { int flags = OS.RDW_UPDATENOW | OS.RDW_INVALIDATE; OS.RedrawWindow (handle, rect1, 0, flags); OS.RedrawWindow (handle, rect2, 0, flags); } } return LRESULT.ZERO; } } } int code = callWindowProc (OS.WM_KEYDOWN, wParam, lParam); hAnchor = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); return new LRESULT (code); } } return result; } LRESULT WM_KILLFOCUS (int wParam, int lParam) { LRESULT result = super.WM_KILLFOCUS (wParam, lParam); if ((style & SWT.SINGLE) != 0) return result; /* * Feature in Windows. When multiple item have * the TVIS_SELECTED state, Windows redraws only * the focused item in the color used to show the * selection when the tree loses or gains focus. * The fix is to force Windows to redraw all the * visible items when focus is gained or lost. */ OS.InvalidateRect (handle, null, false); return result; } LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { /* * Feature in Windows. When a tree item is * reselected, Windows does not issue a WM_NOTIFY. * This is inconsistent with the list widget and * other widgets in Windows. The fix is to detect * the case when an item is reselected and issue * the notification. The first part of this work * around is to ensure that the user has selected * an item. */ TVHITTESTINFO lpht = new TVHITTESTINFO (); lpht.x = (short) (lParam & 0xFFFF); lpht.y = (short) (lParam >> 16); OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht); if (lpht.hItem == 0 || (lpht.flags & OS.TVHT_ONITEM) == 0) { sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam); int code = callWindowProc (OS.WM_LBUTTONDOWN, wParam, lParam); if (OS.GetCapture () != handle) OS.SetCapture (handle); return new LRESULT (code); } /* Look for check/uncheck */ if ((style & SWT.CHECK) != 0) { if ((lpht.flags & OS.TVHT_ONITEMSTATEICON) != 0) { TVITEM tvItem = new TVITEM (); tvItem.hItem = lpht.hItem; tvItem.mask = OS.TVIF_PARAM | OS.TVIF_STATE; tvItem.stateMask = OS.TVIS_STATEIMAGEMASK; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); int state = tvItem.state >> 12; if ((state & 0x1) != 0) { state++; } else { --state; } tvItem.state = state << 12; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); Event event = new Event (); event.item = items [tvItem.lParam]; event.detail = SWT.CHECK; postEvent (SWT.Selection, event); sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam); if (OS.GetCapture () != handle) OS.SetCapture (handle); return LRESULT.ZERO; } } /* Get the selected state of the item under the mouse */ TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.stateMask = OS.TVIS_SELECTED; boolean hittestSelected = false; if ((style & SWT.MULTI) != 0) { tvItem.hItem = lpht.hItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); hittestSelected = (tvItem.state & OS.TVIS_SELECTED) != 0; } /* Get the selected state of the last selected item */ int hOldItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if ((style & SWT.MULTI) != 0) { tvItem.hItem = hOldItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); /* Check for CONTROL or drag selection */ if (hittestSelected || (wParam & OS.MK_CONTROL) != 0) { if (drawCount == 0) { OS.UpdateWindow (handle); OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0); /* * This code is intentionally commented. */ // OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); } } else { deselectAll (); } } /* Do the selection */ sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam); dragStarted = false; ignoreDeselect = ignoreSelect = true; int code = callWindowProc (OS.WM_LBUTTONDOWN, wParam, lParam); ignoreDeselect = ignoreSelect = false; if (dragStarted && OS.GetCapture () != handle) OS.SetCapture (handle); int hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); /* * Feature in Windows. When the old and new focused item * are the same, Windows does not check to make sure that * the item is actually selected, not just focused. The * fix is to force the item to draw selected by setting * the state mask. This is only necessary when the tree * is single select. */ if ((style & SWT.SINGLE) != 0) { if (hOldItem == hNewItem) { tvItem.mask = OS.TVIF_STATE; tvItem.state = OS.TVIS_SELECTED; tvItem.stateMask = OS.TVIS_SELECTED; tvItem.hItem = hNewItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } } /* Reselect the last item that was unselected */ if ((style & SWT.MULTI) != 0) { /* Check for CONTROL and reselect the last item */ if (hittestSelected || (wParam & OS.MK_CONTROL) != 0) { if (hOldItem == hNewItem && hOldItem == lpht.hItem) { if ((wParam & OS.MK_CONTROL) != 0) { tvItem.state ^= OS.TVIS_SELECTED; if (dragStarted) tvItem.state = OS.TVIS_SELECTED; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } } else { if ((tvItem.state & OS.TVIS_SELECTED) != 0) { tvItem.state = OS.TVIS_SELECTED; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } if ((wParam & OS.MK_CONTROL) != 0 && !dragStarted) { if (hittestSelected) { tvItem.state = 0; tvItem.hItem = lpht.hItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } } } if (drawCount == 0) { RECT rect1 = new RECT (), rect2 = new RECT (); rect1.left = hOldItem; rect2.left = hNewItem; OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1); OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2); /* * This code is intentionally commented. */ // OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); if (OS.IsWinCE) { OS.InvalidateRect (handle, rect1, false); OS.InvalidateRect (handle, rect2, false); OS.UpdateWindow (handle); } else { int flags = OS.RDW_UPDATENOW | OS.RDW_INVALIDATE; OS.RedrawWindow (handle, rect1, 0, flags); OS.RedrawWindow (handle, rect2, 0, flags); } } } /* Check for SHIFT or normal select and delect/reselect items */ if ((wParam & OS.MK_CONTROL) == 0) { if (!hittestSelected || !dragStarted) { tvItem.state = 0; int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC); OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc); for (int i=0; i<items.length; i++) { TreeItem item = items [i]; if (item != null && item.handle != hNewItem) { tvItem.hItem = item.handle; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); } } tvItem.hItem = hNewItem; tvItem.state = OS.TVIS_SELECTED; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc); if ((wParam & OS.MK_SHIFT) != 0) { RECT rect1 = new RECT (); if (hAnchor == 0) hAnchor = hNewItem; rect1.left = hAnchor; if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect1) != 0) { RECT rect2 = rect2 = new RECT (); rect2.left = hNewItem; OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect2); int flags = rect1.top < rect2.top ? OS.TVGN_NEXTVISIBLE : OS.TVGN_PREVIOUSVISIBLE; tvItem.state = OS.TVIS_SELECTED; int hItem = tvItem.hItem = hAnchor; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); while (hItem != hNewItem) { tvItem.hItem = hItem; OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem); hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hItem); } } } } } } if ((wParam & OS.MK_SHIFT) == 0) hAnchor = hNewItem; /* Issue notification */ tvItem.hItem = hNewItem; tvItem.mask = OS.TVIF_PARAM; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); Event event = new Event (); event.item = items [tvItem.lParam]; postEvent (SWT.Selection, event); /* * Feature in Windows. Inside WM_LBUTTONDOWN and WM_RBUTTONDOWN, * the widget starts a modal loop to determine if the user wants * to begin a drag/drop operation or marque select. Unfortunately, * this modal loop eats the corresponding mouse up. The fix is to * detect the cases when the modal loop has eaten the mouse up and * issue a fake mouse up. */ if (dragStarted) { postEvent (SWT.DragDetect); } else { sendMouseEvent (SWT.MouseUp, 1, OS.WM_LBUTTONUP, wParam, lParam); } dragStarted = false; return new LRESULT (code); } LRESULT WM_RBUTTONDOWN (int wParam, int lParam) { /* * Feature in Windows. The receiver uses WM_RBUTTONDOWN * to initiate a drag/drop operation depending on how the * user moves the mouse. If the user clicks the right button, * without moving the mouse, the tree consumes the corresponding * WM_RBUTTONUP. The fix is to avoid calling the window proc for * the tree. */ sendMouseEvent (SWT.MouseDown, 3, OS.WM_RBUTTONDOWN, wParam, lParam); /* * This code is intentionally commented. */ // if (OS.GetCapture () != handle) OS.SetCapture (handle); setFocus (); /* * Feature in Windows. When the user selects a tree item * with the right mouse button, the item remains selected * only as long as the user does not release or move the * mouse. As soon as this happens, the selection snaps * back to the previous selection. This behavior can be * observed in the Explorer but is not instantly apparent * because the Explorer explicity sets the selection when * the user chooses a menu item. If the user cancels the * menu, the selection snaps back. The fix is to avoid * calling the window proc and do the selection ourselves. * This behavior is consistent with the table. */ TVHITTESTINFO lpht = new TVHITTESTINFO (); lpht.x = (short) (lParam & 0xFFFF); lpht.y = (short) (lParam >> 16); OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht); if (lpht.hItem != 0 && (lpht.flags & (OS.TVHT_ONITEMICON | OS.TVHT_ONITEMLABEL)) != 0) { if ((wParam & (OS.MK_CONTROL | OS.MK_SHIFT)) == 0) { TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.stateMask = OS.TVIS_SELECTED; tvItem.hItem = lpht.hItem; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) == 0) { ignoreSelect = true; OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, 0); ignoreSelect = false; OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, lpht.hItem); } } } return LRESULT.ZERO; } LRESULT WM_SETFOCUS (int wParam, int lParam) { LRESULT result = super.WM_SETFOCUS (wParam, lParam); if ((style & SWT.SINGLE) != 0) return result; /* * Feature in Windows. When multiple item have * the TVIS_SELECTED state, Windows redraws only * the focused item in the color used to show the * selection when the tree loses or gains focus. * The fix is to force Windows to redraw all the * visible items when focus is gained or lost. */ OS.InvalidateRect (handle, null, false); return result; } LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) { LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam); if (result != null) return result; if ((style & SWT.CHECK) != 0) setCheckboxImageList (); return result; } LRESULT wmNotifyChild (int wParam, int lParam) { NMHDR hdr = new NMHDR (); OS.MoveMemory (hdr, lParam, NMHDR.sizeof); int code = hdr.code; switch (code) { case OS.NM_CUSTOMDRAW: { if (!customDraw) break; NMTVCUSTOMDRAW nmcd = new NMTVCUSTOMDRAW (); OS.MoveMemory (nmcd, lParam, NMTVCUSTOMDRAW.sizeof); switch (nmcd.dwDrawStage) { case OS.CDDS_PREPAINT: return new LRESULT (OS.CDRF_NOTIFYITEMDRAW); case OS.CDDS_ITEMPREPAINT: /* * Feature on Windows. When a new tree item is inserted * using TVM_INSERTITEM and the tree is using custom draw, * a NM_CUSTOMDRAW is sent before TVM_INSERTITEM returns * and before the item is added to the items array. The * fix is to check for null. * * NOTE: This only happens on XP with the version 6.00 of * COMCTL32.DLL, */ TreeItem item = items [nmcd.lItemlParam]; if (item == null) break; TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_STATE; tvItem.hItem = item.handle; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); if ((tvItem.state & OS.TVIS_SELECTED) != 0) break; int clrText = item.foreground, clrTextBk = item.background; if (clrText == -1 && clrTextBk == -1) break; nmcd.clrText = clrText == -1 ? getForegroundPixel () : clrText; nmcd.clrTextBk = clrTextBk == -1 ? getBackgroundPixel () : clrTextBk; OS.MoveMemory (lParam, nmcd, NMTVCUSTOMDRAW.sizeof); return new LRESULT (OS.CDRF_NEWFONT); } break; } case OS.NM_DBLCLK: int pos = OS.GetMessagePos (); TVHITTESTINFO lpht = new TVHITTESTINFO (); POINT pt = new POINT (); pt.x = (short) (pos & 0xFFFF); pt.y = (short) (pos >> 16); OS.ScreenToClient (handle, pt); lpht.x = pt.x; lpht.y = pt.y; OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht); if ((lpht.flags & OS.TVHT_ONITEM) == 0) break; // FALL THROUGH case OS.NM_RETURN: case OS.TVN_SELCHANGEDA: case OS.TVN_SELCHANGEDW: if (!ignoreSelect) { TVITEM tvItem = null; if (code == OS.TVN_SELCHANGED) { tvItem = new TVITEM (); int offset = NMHDR.sizeof + 4 + TVITEM.sizeof; OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof); hAnchor = tvItem.hItem; } else { int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); if (hItem != 0) { tvItem = new TVITEM (); tvItem.hItem = hItem; tvItem.mask = OS.TVIF_PARAM; OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem); } } Event event = new Event (); if (tvItem != null) { event.item = items [tvItem.lParam]; } if (code == OS.TVN_SELCHANGED) { postEvent (SWT.Selection, event); } else { postEvent (SWT.DefaultSelection, event); } } if (code == OS.NM_DBLCLK && hooks (SWT.DefaultSelection)) { return LRESULT.ONE; } break; case OS.TVN_SELCHANGINGA: case OS.TVN_SELCHANGINGW: if (!ignoreSelect && !ignoreDeselect) { hAnchor = 0; if ((style & SWT.MULTI) != 0) deselectAll (); } break; case OS.TVN_ITEMEXPANDINGA: case OS.TVN_ITEMEXPANDINGW: if (!ignoreExpand) { TVITEM tvItem = new TVITEM (); int offset = NMHDR.sizeof + 4 + TVITEM.sizeof; OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof); int [] action = new int [1]; OS.MoveMemory (action, lParam + NMHDR.sizeof, 4); /* * Feature on Windows. In some cases, TVM_ITEMEXPANDING * is sent from within TVM_DELETEITEM for the tree item * being destroyed. By the time the message is sent, * the item has already been removed from the list of * items. The fix is to check for null. */ TreeItem item = items [tvItem.lParam]; if (item == null) break; Event event = new Event (); event.item = item; /* * It is possible (but unlikely), that application * code could have disposed the widget in the expand * or collapse event. If this happens, end the * processing of the Windows message by returning * zero as the result of the window proc. */ if (action [0] == OS.TVE_EXPAND) { sendEvent (SWT.Expand, event); if (isDisposed ()) return LRESULT.ZERO; } if (action [0] == OS.TVE_COLLAPSE) { sendEvent (SWT.Collapse, event); if (isDisposed ()) return LRESULT.ZERO; } } break; case OS.TVN_BEGINDRAGA: case OS.TVN_BEGINDRAGW: case OS.TVN_BEGINRDRAGA: case OS.TVN_BEGINRDRAGW: TVITEM tvItem = new TVITEM (); int offset = NMHDR.sizeof + 4 + TVITEM.sizeof; OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof); if (tvItem.hItem != 0 && (tvItem.state & OS.TVIS_SELECTED) == 0) { ignoreSelect = ignoreDeselect = true; OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, tvItem.hItem); ignoreSelect = ignoreDeselect = false; } dragStarted = true; break; } return super.wmNotifyChild (wParam, lParam); } }
[ "375833274@qq.com" ]
375833274@qq.com
f628f56f7843fc391977e006430f4f2988cf4a23
e2994206eed23ae44e5c9851e5a9af21589e10b7
/src/main/java/com/example/jingdong/bean/TuiBean.java
14008714a677794433d937046393c64ec126bdbc
[]
no_license
huoxuebin/xiangmu
90b8fe730bd566a16afcee0a092fd6b207eae15a
cb5c6dfb50587937bf7569fe1b83801bbc4003df
refs/heads/master
2020-03-18T17:37:27.867154
2018-05-27T11:29:48
2018-05-27T11:29:48
135,039,955
0
0
null
null
null
null
UTF-8
Java
false
false
76,959
java
package com.example.jingdong.bean; import java.util.List; public class TuiBean { /** * msg : * code : 0 * data : [{"aid":1,"createtime":"2017-12-26T21:49:44","icon":"https://www.zhaoapi.cn/images/quarter/ad1.png","productId":null,"title":"第十三界瑞丽模特大赛","type":0,"url":"http://m.mv14449315.icoc.bz/index.jsp"},{"aid":2,"createtime":"2017-12-26T21:49:44","icon":"https://www.zhaoapi.cn/images/quarter/ad2.png","productId":null,"title":"文化艺术节","type":0,"url":"http://m.mv14449315.icoc.bz/index.jsp"},{"aid":3,"createtime":"2017-12-26T21:49:44","icon":"https://www.zhaoapi.cn/images/quarter/ad3.png","productId":null,"title":"直播封面标准","type":0,"url":"http://m.mv14449315.icoc.bz/index.jsp"},{"aid":4,"createtime":"2017-12-26T21:49:44","icon":"https://www.zhaoapi.cn/images/quarter/ad4.png","productId":"1","title":"人气谁最高,金主谁最豪气","type":1,"url":""}] * tuijian : {"list":[{"bargainPrice":11800,"createtime":"2017-10-10T17:33:37","detailUrl":"https://item.m.jd.com/product/4338107.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6700/155/2098998076/156185/6cf95035/595dd5a5Nc3a7dab5.jpg!q70.jpg","itemtype":0,"pid":57,"price":5199,"pscid":40,"salenum":4343,"sellerid":1,"subhead":"【i5 MX150 2G显存】全高清窄边框 8G内存 256固态硬盘 支持指纹识别 预装WIN10系统","title":"小米(MI)Air 13.3英寸全金属轻薄笔记本(i5-7200U 8G 256G PCle SSD MX150 2G独显 FHD 指纹识别 Win10)银\r\n"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/5025518.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8830/106/1760940277/195595/5cf9412f/59bf2ef5N5ab7dc16.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5428/70/1520969931/274676/b644dd0d/591128e7Nd2f70da0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5566/365/1519564203/36911/620c750c/591128eaN54ac3363.jpg!q70.jpg","itemtype":1,"pid":58,"price":6399,"pscid":40,"salenum":545,"sellerid":2,"subhead":"升级4G大显存!Nvme协议Pcie SSD,速度快人一步】GTX1050Ti就选拯救者!专业游戏键盘&新模具全新设计!","title":"联想(Lenovo)拯救者R720 15.6英寸游戏笔记本电脑(i5-7300HQ 8G 1T+128G SSD GTX1050Ti 4G IPS 黑)"},{"bargainPrice":5599,"createtime":"2017-10-10T17:30:32","detailUrl":"https://item.m.jd.com/product/4824715.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n12/jfs/t7768/184/1153704394/148460/f42e1432/599a930fN8a85626b.jpg!q70.jpg","itemtype":0,"pid":59,"price":5599,"pscid":40,"salenum":675,"sellerid":3,"subhead":"游戏本选择4G独显,拒绝掉帧】升级版IPS全高清防眩光显示屏,WASD方向键颜色加持,三大出风口立体散热!","title":"戴尔DELL灵越游匣15PR-6648B GTX1050 15.6英寸游戏笔记本电脑(i5-7300HQ 8G 128GSSD+1T 4G独显 IPS)黑"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":60,"price":13888,"pscid":40,"salenum":466,"sellerid":4,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":61,"price":14999,"pscid":40,"salenum":5535,"sellerid":5,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":62,"price":15999,"pscid":40,"salenum":43,"sellerid":6,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":63,"price":10000,"pscid":40,"salenum":3232,"sellerid":7,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:43:53","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":64,"price":11000,"pscid":40,"salenum":0,"sellerid":8,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":65,"price":12000,"pscid":40,"salenum":868,"sellerid":9,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":66,"price":13000,"pscid":40,"salenum":7676,"sellerid":10,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":67,"price":14000,"pscid":40,"salenum":757,"sellerid":11,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":68,"price":15000,"pscid":40,"salenum":656,"sellerid":12,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":69,"price":16999,"pscid":40,"salenum":6645,"sellerid":13,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":70,"price":17999,"pscid":40,"salenum":545,"sellerid":14,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":71,"price":32999,"pscid":40,"salenum":4242,"sellerid":15,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":72,"price":33999,"pscid":40,"salenum":535,"sellerid":16,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":73,"price":34999,"pscid":40,"salenum":242,"sellerid":17,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":74,"price":35999,"pscid":40,"salenum":656,"sellerid":18,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":75,"price":36999,"pscid":40,"salenum":5454,"sellerid":19,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":76,"price":37999.99,"pscid":40,"salenum":6868,"sellerid":20,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":77,"price":38999.99,"pscid":40,"salenum":7757,"sellerid":21,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":78,"price":999,"pscid":40,"salenum":656,"sellerid":22,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":79,"price":888,"pscid":40,"salenum":5454,"sellerid":23,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":80,"price":777,"pscid":40,"salenum":776,"sellerid":1,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"}],"name":"为你推荐"} * miaosha : {"list":[{"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","itemtype":1,"pid":45,"price":2999,"pscid":39,"salenum":4666,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"},{"bargainPrice":6666,"createtime":"2017-10-10T16:01:31","detailUrl":"https://item.m.jd.com/product/5089273.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8284/363/1326459580/71585/6d3e8013/59b857f2N6ca75622.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9346/182/1406837243/282106/68af5b54/59b8480aNe8af7f5c.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8434/54/1359766007/56140/579509d9/59b85801Nfea207db.jpg!q70.jpg","itemtype":0,"pid":46,"price":234,"pscid":39,"salenum":868,"sellerid":2,"subhead":"【iPhone新品上市】新一代iPhone,让智能看起来更不一样","title":"Apple iPhone 8 Plus (A1864) 64GB 金色 移动联通电信4G手机"},{"bargainPrice":1599,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/1993026402.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t5863/302/8961270302/97126/41feade1/5981c81cNc1b1fbef.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7003/250/1488538438/195825/53bf31ba/5981c57eN51e95176.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5665/100/8954482513/43454/418611a9/5981c57eNd5fc97ba.jpg!q70.jpg","itemtype":2,"pid":47,"price":111,"pscid":39,"salenum":757,"sellerid":3,"subhead":"碳黑色 32GB 全网通 官方标配 1件","title":"锤子 坚果Pro 特别版 巧克力色 酒红色 全网通 移动联通电信4G手机 双卡双待 碳黑色 32GB 全网通"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":48,"price":222,"pscid":39,"salenum":656,"sellerid":4,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":1999,"createtime":"2017-10-10T16:09:02","detailUrl":"https://item.m.jd.com/product/5025971.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t7210/232/3738666823/232298/9004583e/59c3a9a7N8de42e15.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8356/82/2107423621/109733/c019b8c6/59c3a9a6Ne9a4bdd7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t10219/74/25356012/171379/7d55e296/59c3a9a8N82fa6e02.jpg!q70.jpg","itemtype":0,"pid":49,"price":333,"pscid":39,"salenum":123,"sellerid":5,"subhead":"vivo X20 带你开启全面屏时代!逆光也清晰,照亮你的美!","title":"vivo X20 全面屏手机 全网通 4GB+64GB 金色 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":2,"pid":50,"price":444,"pscid":39,"salenum":54,"sellerid":6,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":51,"price":555,"pscid":39,"salenum":424,"sellerid":7,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":52,"price":666,"pscid":39,"salenum":212,"sellerid":8,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":2999,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/2385655.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t2068/298/2448145915/157953/7be197df/56d51a42Nd86f1c8e.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2437/128/1687178395/117431/bcc190c1/56d3fcbaNb2963d21.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2467/222/2263160610/95597/927b8a2f/56d3eafeNdecebeb6.jpg!q70.jpg","itemtype":2,"pid":53,"price":777,"pscid":39,"salenum":0,"sellerid":9,"subhead":"Super AMOLED三星双曲面2K 屏,支持无线充电!","title":"三星 Galaxy S7 edge(G9350)4GB+32GB 铂光金 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":54,"price":888,"pscid":39,"salenum":7575,"sellerid":10,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":55,"price":5999,"pscid":39,"salenum":788,"sellerid":11,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":56,"price":99,"pscid":39,"salenum":757,"sellerid":12,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"}],"name":"京东秒杀","time":7200000} */ private String msg; private String code; private TuijianBean tuijian; private MiaoshaBean miaosha; private List<DataBean> data; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public TuijianBean getTuijian() { return tuijian; } public void setTuijian(TuijianBean tuijian) { this.tuijian = tuijian; } public MiaoshaBean getMiaosha() { return miaosha; } public void setMiaosha(MiaoshaBean miaosha) { this.miaosha = miaosha; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class TuijianBean { /** * list : [{"bargainPrice":11800,"createtime":"2017-10-10T17:33:37","detailUrl":"https://item.m.jd.com/product/4338107.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6700/155/2098998076/156185/6cf95035/595dd5a5Nc3a7dab5.jpg!q70.jpg","itemtype":0,"pid":57,"price":5199,"pscid":40,"salenum":4343,"sellerid":1,"subhead":"【i5 MX150 2G显存】全高清窄边框 8G内存 256固态硬盘 支持指纹识别 预装WIN10系统","title":"小米(MI)Air 13.3英寸全金属轻薄笔记本(i5-7200U 8G 256G PCle SSD MX150 2G独显 FHD 指纹识别 Win10)银\r\n"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/5025518.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8830/106/1760940277/195595/5cf9412f/59bf2ef5N5ab7dc16.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5428/70/1520969931/274676/b644dd0d/591128e7Nd2f70da0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5566/365/1519564203/36911/620c750c/591128eaN54ac3363.jpg!q70.jpg","itemtype":1,"pid":58,"price":6399,"pscid":40,"salenum":545,"sellerid":2,"subhead":"升级4G大显存!Nvme协议Pcie SSD,速度快人一步】GTX1050Ti就选拯救者!专业游戏键盘&新模具全新设计!","title":"联想(Lenovo)拯救者R720 15.6英寸游戏笔记本电脑(i5-7300HQ 8G 1T+128G SSD GTX1050Ti 4G IPS 黑)"},{"bargainPrice":5599,"createtime":"2017-10-10T17:30:32","detailUrl":"https://item.m.jd.com/product/4824715.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n12/jfs/t7768/184/1153704394/148460/f42e1432/599a930fN8a85626b.jpg!q70.jpg","itemtype":0,"pid":59,"price":5599,"pscid":40,"salenum":675,"sellerid":3,"subhead":"游戏本选择4G独显,拒绝掉帧】升级版IPS全高清防眩光显示屏,WASD方向键颜色加持,三大出风口立体散热!","title":"戴尔DELL灵越游匣15PR-6648B GTX1050 15.6英寸游戏笔记本电脑(i5-7300HQ 8G 128GSSD+1T 4G独显 IPS)黑"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":60,"price":13888,"pscid":40,"salenum":466,"sellerid":4,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":61,"price":14999,"pscid":40,"salenum":5535,"sellerid":5,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":62,"price":15999,"pscid":40,"salenum":43,"sellerid":6,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":63,"price":10000,"pscid":40,"salenum":3232,"sellerid":7,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:43:53","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":64,"price":11000,"pscid":40,"salenum":0,"sellerid":8,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":65,"price":12000,"pscid":40,"salenum":868,"sellerid":9,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":66,"price":13000,"pscid":40,"salenum":7676,"sellerid":10,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":67,"price":14000,"pscid":40,"salenum":757,"sellerid":11,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":68,"price":15000,"pscid":40,"salenum":656,"sellerid":12,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":69,"price":16999,"pscid":40,"salenum":6645,"sellerid":13,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":70,"price":17999,"pscid":40,"salenum":545,"sellerid":14,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":71,"price":32999,"pscid":40,"salenum":4242,"sellerid":15,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":72,"price":33999,"pscid":40,"salenum":535,"sellerid":16,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":73,"price":34999,"pscid":40,"salenum":242,"sellerid":17,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":74,"price":35999,"pscid":40,"salenum":656,"sellerid":18,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":75,"price":36999,"pscid":40,"salenum":5454,"sellerid":19,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":76,"price":37999.99,"pscid":40,"salenum":6868,"sellerid":20,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:48:08","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":2,"pid":77,"price":38999.99,"pscid":40,"salenum":7757,"sellerid":21,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":78,"price":999,"pscid":40,"salenum":656,"sellerid":22,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":0,"pid":79,"price":888,"pscid":40,"salenum":5454,"sellerid":23,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","itemtype":1,"pid":80,"price":777,"pscid":40,"salenum":776,"sellerid":1,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"}] * name : 为你推荐 */ private String name; private List<ListBean> list; public String getName() { return name; } public void setName(String name) { this.name = name; } public List<ListBean> getList() { return list; } public void setList(List<ListBean> list) { this.list = list; } public static class ListBean { /** * bargainPrice : 11800.0 * createtime : 2017-10-10T17:33:37 * detailUrl : https://item.m.jd.com/product/4338107.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends * images : https://m.360buyimg.com/n0/jfs/t6700/155/2098998076/156185/6cf95035/595dd5a5Nc3a7dab5.jpg!q70.jpg * itemtype : 0 * pid : 57 * price : 5199.0 * pscid : 40 * salenum : 4343 * sellerid : 1 * subhead : 【i5 MX150 2G显存】全高清窄边框 8G内存 256固态硬盘 支持指纹识别 预装WIN10系统 * title : 小米(MI)Air 13.3英寸全金属轻薄笔记本(i5-7200U 8G 256G PCle SSD MX150 2G独显 FHD 指纹识别 Win10)银 */ private double bargainPrice; private String createtime; private String detailUrl; private String images; private int itemtype; private int pid; private double price; private int pscid; private int salenum; private int sellerid; private String subhead; private String title; public double getBargainPrice() { return bargainPrice; } public void setBargainPrice(double bargainPrice) { this.bargainPrice = bargainPrice; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getDetailUrl() { return detailUrl; } public void setDetailUrl(String detailUrl) { this.detailUrl = detailUrl; } public String getImages() { return images; } public void setImages(String images) { this.images = images; } public int getItemtype() { return itemtype; } public void setItemtype(int itemtype) { this.itemtype = itemtype; } public int getPid() { return pid; } public void setPid(int pid) { this.pid = pid; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getPscid() { return pscid; } public void setPscid(int pscid) { this.pscid = pscid; } public int getSalenum() { return salenum; } public void setSalenum(int salenum) { this.salenum = salenum; } public int getSellerid() { return sellerid; } public void setSellerid(int sellerid) { this.sellerid = sellerid; } public String getSubhead() { return subhead; } public void setSubhead(String subhead) { this.subhead = subhead; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } } public static class MiaoshaBean { /** * list : [{"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","itemtype":1,"pid":45,"price":2999,"pscid":39,"salenum":4666,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"},{"bargainPrice":6666,"createtime":"2017-10-10T16:01:31","detailUrl":"https://item.m.jd.com/product/5089273.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8284/363/1326459580/71585/6d3e8013/59b857f2N6ca75622.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9346/182/1406837243/282106/68af5b54/59b8480aNe8af7f5c.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8434/54/1359766007/56140/579509d9/59b85801Nfea207db.jpg!q70.jpg","itemtype":0,"pid":46,"price":234,"pscid":39,"salenum":868,"sellerid":2,"subhead":"【iPhone新品上市】新一代iPhone,让智能看起来更不一样","title":"Apple iPhone 8 Plus (A1864) 64GB 金色 移动联通电信4G手机"},{"bargainPrice":1599,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/1993026402.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t5863/302/8961270302/97126/41feade1/5981c81cNc1b1fbef.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7003/250/1488538438/195825/53bf31ba/5981c57eN51e95176.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5665/100/8954482513/43454/418611a9/5981c57eNd5fc97ba.jpg!q70.jpg","itemtype":2,"pid":47,"price":111,"pscid":39,"salenum":757,"sellerid":3,"subhead":"碳黑色 32GB 全网通 官方标配 1件","title":"锤子 坚果Pro 特别版 巧克力色 酒红色 全网通 移动联通电信4G手机 双卡双待 碳黑色 32GB 全网通"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":48,"price":222,"pscid":39,"salenum":656,"sellerid":4,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":1999,"createtime":"2017-10-10T16:09:02","detailUrl":"https://item.m.jd.com/product/5025971.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t7210/232/3738666823/232298/9004583e/59c3a9a7N8de42e15.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8356/82/2107423621/109733/c019b8c6/59c3a9a6Ne9a4bdd7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t10219/74/25356012/171379/7d55e296/59c3a9a8N82fa6e02.jpg!q70.jpg","itemtype":0,"pid":49,"price":333,"pscid":39,"salenum":123,"sellerid":5,"subhead":"vivo X20 带你开启全面屏时代!逆光也清晰,照亮你的美!","title":"vivo X20 全面屏手机 全网通 4GB+64GB 金色 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":2,"pid":50,"price":444,"pscid":39,"salenum":54,"sellerid":6,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":51,"price":555,"pscid":39,"salenum":424,"sellerid":7,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":52,"price":666,"pscid":39,"salenum":212,"sellerid":8,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":2999,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/2385655.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t2068/298/2448145915/157953/7be197df/56d51a42Nd86f1c8e.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2437/128/1687178395/117431/bcc190c1/56d3fcbaNb2963d21.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2467/222/2263160610/95597/927b8a2f/56d3eafeNdecebeb6.jpg!q70.jpg","itemtype":2,"pid":53,"price":777,"pscid":39,"salenum":0,"sellerid":9,"subhead":"Super AMOLED三星双曲面2K 屏,支持无线充电!","title":"三星 Galaxy S7 edge(G9350)4GB+32GB 铂光金 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":54,"price":888,"pscid":39,"salenum":7575,"sellerid":10,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":55,"price":5999,"pscid":39,"salenum":788,"sellerid":11,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":56,"price":99,"pscid":39,"salenum":757,"sellerid":12,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"}] * name : 京东秒杀 * time : 7200000 */ private String name; private int time; private List<ListBeanX> list; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getTime() { return time; } public void setTime(int time) { this.time = time; } public List<ListBeanX> getList() { return list; } public void setList(List<ListBeanX> list) { this.list = list; } public static class ListBeanX { /** * bargainPrice : 99.0 * createtime : 2017-10-14T21:38:26 * detailUrl : https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends * images : https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg * itemtype : 1 * pid : 45 * price : 2999.0 * pscid : 39 * salenum : 4666 * sellerid : 1 * subhead : 高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽! * title : 一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机 */ private double bargainPrice; private String createtime; private String detailUrl; private String images; private int itemtype; private int pid; private double price; private int pscid; private int salenum; private int sellerid; private String subhead; private String title; public double getBargainPrice() { return bargainPrice; } public void setBargainPrice(double bargainPrice) { this.bargainPrice = bargainPrice; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getDetailUrl() { return detailUrl; } public void setDetailUrl(String detailUrl) { this.detailUrl = detailUrl; } public String getImages() { return images; } public void setImages(String images) { this.images = images; } public int getItemtype() { return itemtype; } public void setItemtype(int itemtype) { this.itemtype = itemtype; } public int getPid() { return pid; } public void setPid(int pid) { this.pid = pid; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getPscid() { return pscid; } public void setPscid(int pscid) { this.pscid = pscid; } public int getSalenum() { return salenum; } public void setSalenum(int salenum) { this.salenum = salenum; } public int getSellerid() { return sellerid; } public void setSellerid(int sellerid) { this.sellerid = sellerid; } public String getSubhead() { return subhead; } public void setSubhead(String subhead) { this.subhead = subhead; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } } public static class DataBean { /** * aid : 1 * createtime : 2017-12-26T21:49:44 * icon : https://www.zhaoapi.cn/images/quarter/ad1.png * productId : null * title : 第十三界瑞丽模特大赛 * type : 0 * url : http://m.mv14449315.icoc.bz/index.jsp */ private int aid; private String createtime; private String icon; private Object productId; private String title; private int type; private String url; public int getAid() { return aid; } public void setAid(int aid) { this.aid = aid; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public Object getProductId() { return productId; } public void setProductId(Object productId) { this.productId = productId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } } }
[ "583431940@qq.com" ]
583431940@qq.com
f1999706e56e300b4f266c10de81086627fba8ef
bb4b2b54c8d532612e83fb09cd9ff6e883d239a8
/src/org/jiangtao/daoImpl/CommentDaoImpl.java
c4d7e9d0ac832cde62f96cc04d3bdd4444dacd36
[]
no_license
Labradors/blog-backup
ea3809f214b084ac910bcb6a656630db6b977979
dbf418c94a885035a8462659e7c70600a0250ab7
refs/heads/master
2021-06-07T10:58:28.163245
2016-11-06T13:29:21
2016-11-06T13:29:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,200
java
package org.jiangtao.daoImpl; import com.j256.ormlite.dao.Dao; import com.j256.ormlite.dao.DaoManager; import com.j256.ormlite.stmt.QueryBuilder; import com.j256.ormlite.support.ConnectionSource; import org.jiangtao.bean.Accounts; import org.jiangtao.bean.Comment; import org.jiangtao.utils.Collections; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; /** * Created by MrJiang on 5/1/2016. * 包含获取文章所有评论,添加评论等内容 */ public class CommentDaoImpl { private static CommentDaoImpl instance; private ConnectionSource collections; private Dao<Comment, String> mCommentDao; private CommentDaoImpl() { } public static CommentDaoImpl getInstance() { if (instance == null) { synchronized (CommentDaoImpl.class) { instance = new CommentDaoImpl(); } } return instance; } /** * 获取文章的所有评论 * * @param articleId * @return */ public ArrayList<Comment> getAllComment(String articleId) { collections = Collections.getInstance().openConnectionResource(); try { mCommentDao = DaoManager.createDao(collections, Comment.class); QueryBuilder<Comment, String> builder = mCommentDao.queryBuilder(); builder.where().eq("article_id", String.valueOf(articleId)); ArrayList<Comment> comments = (ArrayList<Comment>) builder.query(); if (comments != null && comments.size() != 0) { return comments; } } catch (SQLException e) { e.printStackTrace(); } finally { Collections.getInstance().closeConnectionResource(collections); } return null; } /** * parent_id为0,表示只是评论,parent_id不为0,表示回复 * * @param articleId * @param content * @param isParent * @param accountId * @param parentID * @return */ public synchronized ArrayList<Comment> insertComment(int articleId, String content, int isParent, int accountId, int parentID) { Comment comment = new Comment(); comment.setContent(content); comment.setArticle_id(articleId); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); comment.setCreate_at(timestamp.getTime()); comment.setParent_id(isParent); Accounts accounts = AccountsDaoImpl.getInstance().getAccount(String.valueOf(accountId)); comment.setAccount(accounts); Accounts parentAccounts = AccountsDaoImpl.getInstance().getAccount(String.valueOf(parentID)); comment.setParent_account(parentAccounts); collections = Collections.getInstance().openConnectionResource(); try { mCommentDao = DaoManager.createDao(collections, Comment.class); mCommentDao.create(comment); return getAllComment(String.valueOf(articleId)); } catch (SQLException e) { e.printStackTrace(); } finally { Collections.getInstance().closeConnectionResource(collections); } return null; } }
[ "jiangtao103cp@163.com" ]
jiangtao103cp@163.com
dfd42b8019bfb7a9d7f0c3f071394e3c51e6ad30
d4a94cb5cef48103459deacc0fa32f0383bc7eb9
/src/main/java/com/murattezgider/irhtmlparser/DocumentFields.java
987116f9e1952c9de2fba2ed52addafc7161da7e
[]
no_license
mtezgider/IRParser
d98b490f86f534907ff63870d033298d7d1c8503
6f648dee27b7d783a5c9469ef03d15ba8a5fa65f
refs/heads/master
2016-09-13T19:36:18.127092
2016-04-12T21:34:41
2016-04-12T21:39:17
56,100,157
0
0
null
null
null
null
UTF-8
Java
false
false
2,634
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.murattezgider.irhtmlparser; import java.util.ArrayList; import java.util.List; /** * * @author murattezgider@gmail.com */ public class DocumentFields { private String path; private String title; private String description; // recipe by private String submitter; private List<String> ingredients = new ArrayList<>(); private String servings; private String duration; private List<String> directions = new ArrayList<>(); private Nutrition nutrition = new Nutrition(); private List<String> categoryList= new ArrayList<>(); private List<String> ImageUrls= new ArrayList<>(); public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getSubmitter() { return submitter; } public void setSubmitter(String submitter) { this.submitter = submitter; } public List<String> getIngredients() { return ingredients; } public void setIngredients(List<String> ingredients) { this.ingredients = ingredients; } public String getServings() { return servings; } public void setServings(String servings) { this.servings = servings; } public String getDuration() { return duration; } public void setDuration(String duration) { this.duration = duration; } public List<String> getDirections() { return directions; } public void setDirections(List<String> directions) { this.directions = directions; } public Nutrition getNutrition() { return nutrition; } public void setNutrition(Nutrition nutrition) { this.nutrition = nutrition; } public List<String> getCategoryList() { return categoryList; } public void setCategoryList(List<String> categoryList) { this.categoryList = categoryList; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public List<String> getImageUrls() { return ImageUrls; } public void setImageUrls(List<String> ImageUrls) { this.ImageUrls = ImageUrls; } }
[ "murattezgider@gmail.com" ]
murattezgider@gmail.com
98e4cce3911a970612761f042d14c9366ba86bee
396f6273308a8dbcffb99ae63d26c06c6c8cf5be
/problem_medium/152_Maximum_Product_Subarray.java
f8a8165fd9ba0ac0c87c989f0c246851a759bb08
[ "MIT" ]
permissive
lianghongh/leetcode
44ae3f12755c69b65819367a6a2cf5f30777bd51
044285d1fd2617fe1eed40d81601fa1003ca2213
refs/heads/master
2018-12-21T02:16:21.751307
2018-09-18T09:39:18
2018-09-18T09:39:18
113,412,489
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
class Solution { public int maxProduct(int[] nums) { int maxP=nums[0]; int minP=nums[0]; int res=maxP; for(int i=1;i<nums.length;i++) { int max=maxP*nums[i]; int min=minP*nums[i]; maxP=Math.max(Math.max(max,min),nums[i]); minP = Math.min(Math.min(max, min), nums[i]); res = Math.max(res, maxP); } return res; } }
[ "lianghongh@126.com" ]
lianghongh@126.com
2bd1b051c607dbc06be553f30f43f70591d0482e
74b4a267bea343314d245750d6956072833ec082
/app/src/main/java/com/application/wijayantoap/apupre_loved/ViewHolder/FlagViewHolder.java
4f57a2b23dfdca802293a692304137511ede3afc
[]
no_license
wijayantoap/APUMarket
80c0027fc89fb6aa3f940964ec3dad071b88dce0
55648fde7aa730094d22e4fe4587f4fd5996d675
refs/heads/master
2020-03-18T12:55:10.214697
2018-07-03T05:11:02
2018-07-03T05:11:02
134,749,015
0
0
null
null
null
null
UTF-8
Java
false
false
596
java
package com.application.wijayantoap.apupre_loved.ViewHolder; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.TextView; import com.application.wijayantoap.apupre_loved.R; public class FlagViewHolder extends RecyclerView.ViewHolder{ public TextView textTitle, textUsername, textDate; public FlagViewHolder(View itemView) { super(itemView); textTitle = itemView.findViewById(R.id.textTitle); textUsername = itemView.findViewById(R.id.textUsername); textDate = itemView.findViewById(R.id.textDate); } }
[ "wijayanto.a.p@gmail.com" ]
wijayanto.a.p@gmail.com
683d8b5bc0ca8afb400e4f8b279a23c173823ee1
9f519a3d7c8fd3615179e2af08600530d13b567d
/butterknife-compiler/src/main/java/butterknife/compiler/BindingClass.java
550bcc31747a5bfc8abfd8b106e9239e0dab42c6
[ "Apache-2.0" ]
permissive
Rukey7/butterknife-Study
3c5329ee8fe993205f2824fa39a97ea6cd5336b5
3cc3d171de8f2645d449e27f37b5c517f9159f40
refs/heads/master
2020-03-26T23:59:46.932977
2016-08-03T14:05:47
2016-08-03T14:05:47
64,835,668
0
0
null
null
null
null
UTF-8
Java
false
false
27,900
java
package butterknife.compiler; import com.squareup.javapoet.AnnotationSpec; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.squareup.javapoet.TypeVariableName; import com.squareup.javapoet.WildcardTypeName; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import butterknife.internal.ListenerClass; import butterknife.internal.ListenerMethod; import static butterknife.compiler.ButterKnifeProcessor.NO_ID; import static butterknife.compiler.ButterKnifeProcessor.VIEW_TYPE; import static java.util.Collections.singletonList; import static javax.lang.model.element.Modifier.FINAL; import static javax.lang.model.element.Modifier.PRIVATE; import static javax.lang.model.element.Modifier.PROTECTED; import static javax.lang.model.element.Modifier.PUBLIC; import static javax.lang.model.element.Modifier.STATIC; final class BindingClass { private static final ClassName FINDER = ClassName.get("butterknife.internal", "Finder"); private static final ClassName VIEW_BINDER = ClassName.get("butterknife.internal", "ViewBinder"); private static final ClassName UTILS = ClassName.get("butterknife.internal", "Utils"); private static final ClassName VIEW = ClassName.get("android.view", "View"); private static final ClassName CONTEXT = ClassName.get("android.content", "Context"); private static final ClassName RESOURCES = ClassName.get("android.content.res", "Resources"); private static final ClassName THEME = RESOURCES.nestedClass("Theme"); private static final ClassName BUTTERKNIFE = ClassName.get("butterknife", "ButterKnife"); private static final ClassName UNBINDER = ClassName.get("butterknife", "Unbinder"); private static final ClassName BITMAP_FACTORY = ClassName.get("android.graphics", "BitmapFactory"); public static final String UNBINDER_SIMPLE_NAME = "InnerUnbinder"; private final Map<Integer, ViewBindings> viewIdMap = new LinkedHashMap<>(); private final Map<FieldCollectionViewBinding, int[]> collectionBindings = new LinkedHashMap<>(); private final List<FieldBitmapBinding> bitmapBindings = new ArrayList<>(); private final List<FieldDrawableBinding> drawableBindings = new ArrayList<>(); private final List<FieldResourceBinding> resourceBindings = new ArrayList<>(); private final Set<BindingClass> descendantBindingClasses = new LinkedHashSet<>(); private final String classPackage; private final String className; private final String targetClass; private final String classFqcn; private BindingClass parentBinding; private ClassName unbinderClassName; // If this is null'd out, it has no unbinder and uses NOP. private ClassName highestUnbinderClassName; // If this is null'd out, there is no parent unbinder. BindingClass(String classPackage, String className, String targetClass, String classFqcn) { this.classPackage = classPackage; this.className = className; this.targetClass = targetClass; this.classFqcn = classFqcn; // Default to this, but this can be null'd out by the processor before we brew if it's not // necessary. this.unbinderClassName = ClassName.get(classPackage, className, UNBINDER_SIMPLE_NAME); } void addDescendant(BindingClass bindingClass) { descendantBindingClasses.add(bindingClass); } void addBitmap(FieldBitmapBinding binding) { bitmapBindings.add(binding); } void addDrawable(FieldDrawableBinding binding) { drawableBindings.add(binding); } void addField(int id, FieldViewBinding binding) { getOrCreateViewBindings(id).addFieldBinding(binding); } void addFieldCollection(int[] ids, FieldCollectionViewBinding binding) { collectionBindings.put(binding, ids); } boolean addMethod( int id, ListenerClass listener, ListenerMethod method, MethodViewBinding binding) { ViewBindings viewBindings = getOrCreateViewBindings(id); if (viewBindings.hasMethodBinding(listener, method) && !"void".equals(method.returnType())) { return false; } viewBindings.addMethodBinding(listener, method, binding); return true; } void addResource(FieldResourceBinding binding) { resourceBindings.add(binding); } void setParent(BindingClass parent) { this.parentBinding = parent; } ViewBindings getViewBinding(int id) { return viewIdMap.get(id); } private ViewBindings getOrCreateViewBindings(int id) { ViewBindings viewId = viewIdMap.get(id); if (viewId == null) { viewId = new ViewBindings(id); viewIdMap.put(id, viewId); } return viewId; } JavaFile brewJava() { TypeSpec.Builder result = TypeSpec.classBuilder(className) .addModifiers(PUBLIC) .addTypeVariable(TypeVariableName.get("T", ClassName.bestGuess(targetClass))); // className = SimpleActivity$$ViewBinder // targetClass = SimpleActivity if (hasParentBinding()) { result.superclass(ParameterizedTypeName.get(ClassName.bestGuess(parentBinding.classFqcn), TypeVariableName.get("T"))); } else { result.addSuperinterface(ParameterizedTypeName.get(VIEW_BINDER, TypeVariableName.get("T"))); } result.addMethod(createBindMethod()); if (hasUnbinder() && hasViewBindings()) { // Create unbinding class. result.addType(createUnbinderClass()); // Now we need to provide child classes to access and override unbinder implementations. createUnbinderCreateUnbinderMethod(result); } return JavaFile.builder(classPackage, result.build()) .addFileComment("Generated code from Butter Knife. Do not modify!") .build(); } private TypeSpec createUnbinderClass() { TypeName generic = TypeVariableName.get("T"); TypeSpec.Builder result = TypeSpec.classBuilder(unbinderClassName.simpleName()) .addModifiers(PROTECTED, STATIC) .addTypeVariable(TypeVariableName.get("T", ClassName.bestGuess(targetClass))); if (hasParentBinding() && parentBinding.hasUnbinder()) { result.superclass(ParameterizedTypeName.get( parentBinding.getUnbinderClassName(), generic)); } else { result.addSuperinterface(UNBINDER); result.addField(generic, "target", PRIVATE); } result.addMethod(createUnbinderConstructor(generic)); if (!hasParentBinding() || !parentBinding.hasUnbinder()) { result.addMethod(createUnbindInterfaceMethod()); } result.addMethod(createUnbindMethod(result, generic)); return result.build(); } private MethodSpec createUnbinderConstructor(TypeName targetType) { MethodSpec.Builder constructor = MethodSpec.constructorBuilder() .addModifiers(PROTECTED) .addParameter(targetType, "target"); if (hasParentBinding() && parentBinding.hasUnbinder()) { constructor.addStatement("super(target)"); } else { constructor.addStatement("this.$1N = $1N", "target"); } return constructor.build(); } private MethodSpec createUnbindInterfaceMethod() { return MethodSpec.methodBuilder("unbind") .addAnnotation(Override.class) .addModifiers(PUBLIC, FINAL) .addStatement("if (target == null) throw new $T($S)", IllegalStateException.class, "Bindings already cleared.") .addStatement("unbind(target)") .addStatement("target = null") .build(); } private MethodSpec createUnbindMethod(TypeSpec.Builder unbinderClass, TypeName targetType) { MethodSpec.Builder result = MethodSpec.methodBuilder("unbind") .addModifiers(PROTECTED) .addParameter(targetType, "target"); if (hasParentBinding() && parentBinding.hasUnbinder()) { result.addAnnotation(Override.class); result.addStatement("super.unbind(target)"); } for (ViewBindings bindings : viewIdMap.values()) { addFieldAndUnbindStatement(unbinderClass, result, bindings); for (FieldViewBinding fieldBinding : bindings.getFieldBindings()) { result.addStatement("target.$L = null", fieldBinding.getName()); } } for (FieldCollectionViewBinding fieldCollectionBinding : collectionBindings.keySet()) { result.addStatement("target.$L = null", fieldCollectionBinding.getName()); } return result.build(); } private void addFieldAndUnbindStatement( TypeSpec.Builder result, MethodSpec.Builder unbindMethod, ViewBindings bindings) { // Only add fields to the unbinder if there are method bindings. Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings = bindings.getMethodBindings(); if (classMethodBindings.isEmpty()) { return; } // Using unique view id for name uniqueness. String fieldName = "view" + bindings.getUniqueIdSuffix(); result.addField(VIEW, fieldName); // We only need to emit the null check if there are zero required bindings. boolean needsNullChecked = bindings.getRequiredBindings().isEmpty(); if (needsNullChecked) { unbindMethod.beginControlFlow("if ($L != null)", fieldName); } for (ListenerClass listenerClass : classMethodBindings.keySet()) { if (!VIEW_TYPE.equals(listenerClass.targetType())) { unbindMethod.addStatement("(($T) $L).$L(null)", bestGuess(listenerClass.targetType()), fieldName, listenerClass.setter()); } else { unbindMethod.addStatement("$L.$L(null)", fieldName, listenerClass.setter()); } } if (needsNullChecked) { unbindMethod.endControlFlow(); } } private void createUnbinderCreateUnbinderMethod(TypeSpec.Builder viewBindingClass) { // Create type variable InnerUnbinder<T> TypeName returnType = ParameterizedTypeName.get( unbinderClassName, TypeVariableName.get("T")); MethodSpec.Builder createUnbinder = MethodSpec.methodBuilder("createUnbinder") .addModifiers(PROTECTED) .returns(returnType) .addParameter(TypeVariableName.get("T"), "target") .addStatement("return new $T($L)", unbinderClassName, "target"); if (hasParentBinding() && parentBinding.hasUnbinder()) { createUnbinder.addAnnotation(Override.class); } viewBindingClass.addMethod(createUnbinder.build()); } private MethodSpec createBindMethod() { MethodSpec.Builder result = MethodSpec.methodBuilder("bind") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(UNBINDER) .addParameter(FINDER, "finder", FINAL) .addParameter(TypeVariableName.get("T"), "target", FINAL) .addParameter(Object.class, "source"); if (hasResourceBindings()) { // Aapt can change IDs out from underneath us, just suppress since all will work at runtime. result.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class) .addMember("value", "$S", "ResourceType") .build()); } // Emit a call to the superclass binder, if any. if (hasParentBinding()) { if (hasViewBindings()) { if (highestUnbinderClassName != unbinderClassName) { // This has an unbinder class and there exists an unbinder class farther up, so use super // and let the super implementation create it for us. result.addStatement("$T unbinder = ($T) super.bind(finder, target, source)", unbinderClassName, unbinderClassName); } else { // This has an unbinder class and there is no implementation higher up, so we'll call // super but ignore the result since it's just the NOP. Instead, create the unbinder here // for our implementation and any descendant classes. result.addStatement("super.bind(finder, target, source)"); result.addStatement("$T unbinder = createUnbinder(target)", unbinderClassName); } } else { // This has no unbinder class, just defer to super (which could be NOP or real, // we don't care). result.addStatement("$T unbinder = super.bind(finder, target, source)", UNBINDER); } } else if (hasViewBindings()) { // This is a top-level class but we do have an unbinder class, so no need to call super but // go ahead and create our unbinder. result.addStatement("$T unbinder = createUnbinder(target)", unbinderClassName); } if (!viewIdMap.isEmpty() || !collectionBindings.isEmpty()) { // Local variable in which all views will be temporarily stored. result.addStatement("$T view", VIEW); // Loop over each view bindings and emit it. for (ViewBindings bindings : viewIdMap.values()) { addViewBindings(result, bindings); } // Loop over each collection binding and emit it. for (Map.Entry<FieldCollectionViewBinding, int[]> entry : collectionBindings.entrySet()) { emitCollectionBinding(result, entry.getKey(), entry.getValue()); } } if (hasResourceBindings()) { if (hasResourceBindingsNeedingTheme()) { result.addStatement("$T context = finder.getContext(source)", CONTEXT); result.addStatement("$T res = context.getResources()", RESOURCES); result.addStatement("$T theme = context.getTheme()", THEME); } else { result.addStatement("$T res = finder.getContext(source).getResources()", RESOURCES); } for (FieldBitmapBinding binding : bitmapBindings) { result.addStatement("target.$L = $T.decodeResource(res, $L)", binding.getName(), BITMAP_FACTORY, binding.getId()); } for (FieldDrawableBinding binding : drawableBindings) { int tintAttributeId = binding.getTintAttributeId(); if (tintAttributeId != 0) { result.addStatement("target.$L = $T.getTintedDrawable(res, theme, $L, $L)", binding.getName(), UTILS, binding.getId(), tintAttributeId); } else { result.addStatement("target.$L = $T.getDrawable(res, theme, $L)", binding.getName(), UTILS, binding.getId()); } } for (FieldResourceBinding binding : resourceBindings) { // TODO being themeable is poor correlation to the need to use Utils. if (binding.isThemeable()) { result.addStatement("target.$L = $T.$L(res, theme, $L)", binding.getName(), UTILS, binding.getMethod(), binding.getId()); } else { result.addStatement("target.$L = res.$L($L)", binding.getName(), binding.getMethod(), binding.getId()); } } } // Finally return the unbinder. if (hasParentBinding() || hasViewBindings()) { result.addStatement("return unbinder"); } else { result.addStatement("return $T.EMPTY", UNBINDER); } return result.build(); } private void emitCollectionBinding( MethodSpec.Builder result, FieldCollectionViewBinding binding, int[] ids) { String ofName; switch (binding.getKind()) { case ARRAY: ofName = "arrayOf"; break; case LIST: ofName = "listOf"; break; default: throw new IllegalStateException("Unknown kind: " + binding.getKind()); } CodeBlock.Builder builder = CodeBlock.builder(); for (int i = 0; i < ids.length; i++) { if (i > 0) { builder.add(", "); } String findMethod = binding.isRequired() ? "findRequiredView" : "findOptionalView"; builder.add("\nfinder.<$T>$L(source, $L, $S)", binding.getType(), findMethod, ids[i], asHumanDescription(singletonList(binding))); } result.addStatement("target.$L = $T.$L($L)", binding.getName(), UTILS, ofName, builder.build()); } private void addViewBindings(MethodSpec.Builder result, ViewBindings bindings) { List<ViewBinding> requiredViewBindings = bindings.getRequiredBindings(); if (requiredViewBindings.isEmpty()) { result.addStatement("view = finder.findOptionalView(source, $L, null)", bindings.getId()); } else { if (bindings.getId() == NO_ID) { result.addStatement("view = target"); } else { result.addStatement("view = finder.findRequiredView(source, $L, $S)", bindings.getId(), asHumanDescription(requiredViewBindings)); } } addFieldBindings(result, bindings); addMethodBindings(result, bindings); } private void addFieldBindings(MethodSpec.Builder result, ViewBindings bindings) { Collection<FieldViewBinding> fieldBindings = bindings.getFieldBindings(); for (FieldViewBinding fieldBinding : fieldBindings) { if (fieldBinding.requiresCast()) { result.addStatement("target.$L = finder.castView(view, $L, $S)", fieldBinding.getName(), bindings.getId(), asHumanDescription(fieldBindings)); } else { result.addStatement("target.$L = view", fieldBinding.getName()); } } } private void addMethodBindings(MethodSpec.Builder result, ViewBindings bindings) { Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings = bindings.getMethodBindings(); if (classMethodBindings.isEmpty()) { return; } // We only need to emit the null check if there are zero required bindings. boolean needsNullChecked = bindings.getRequiredBindings().isEmpty(); if (needsNullChecked) { result.beginControlFlow("if (view != null)"); } // Add the view reference to the unbinder. if (hasUnbinder()) { result.addStatement("unbinder.$L = view", "view" + bindings.getUniqueIdSuffix()); } for (Map.Entry<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> e : classMethodBindings.entrySet()) { ListenerClass listener = e.getKey(); Map<ListenerMethod, Set<MethodViewBinding>> methodBindings = e.getValue(); TypeSpec.Builder callback = TypeSpec.anonymousClassBuilder("") .superclass(ClassName.bestGuess(listener.type())); for (ListenerMethod method : getListenerMethods(listener)) { MethodSpec.Builder callbackMethod = MethodSpec.methodBuilder(method.name()) .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(bestGuess(method.returnType())); String[] parameterTypes = method.parameters(); for (int i = 0, count = parameterTypes.length; i < count; i++) { callbackMethod.addParameter(bestGuess(parameterTypes[i]), "p" + i); } boolean hasReturnType = !"void".equals(method.returnType()); CodeBlock.Builder builder = CodeBlock.builder(); if (hasReturnType) { builder.add("return "); } if (methodBindings.containsKey(method)) { for (MethodViewBinding binding : methodBindings.get(method)) { builder.add("target.$L(", binding.getName()); List<Parameter> parameters = binding.getParameters(); String[] listenerParameters = method.parameters(); for (int i = 0, count = parameters.size(); i < count; i++) { if (i > 0) { builder.add(", "); } Parameter parameter = parameters.get(i); int listenerPosition = parameter.getListenerPosition(); if (parameter.requiresCast(listenerParameters[listenerPosition])) { builder.add("finder.<$T>castParam(p$L, $S, $L, $S, $L)\n", parameter.getType(), listenerPosition, method.name(), listenerPosition, binding.getName(), i); } else { builder.add("p$L", listenerPosition); } } builder.add(");\n"); } } else if (hasReturnType) { builder.add("$L;\n", method.defaultReturn()); } callbackMethod.addCode(builder.build()); callback.addMethod(callbackMethod.build()); } if (!VIEW_TYPE.equals(listener.targetType())) { result.addStatement("(($T) view).$L($L)", bestGuess(listener.targetType()), listener.setter(), callback.build()); } else { result.addStatement("view.$L($L)", listener.setter(), callback.build()); } } if (needsNullChecked) { result.endControlFlow(); } } static List<ListenerMethod> getListenerMethods(ListenerClass listener) { if (listener.method().length == 1) { return Arrays.asList(listener.method()); } try { List<ListenerMethod> methods = new ArrayList<>(); Class<? extends Enum<?>> callbacks = listener.callbacks(); for (Enum<?> callbackMethod : callbacks.getEnumConstants()) { Field callbackField = callbacks.getField(callbackMethod.name()); ListenerMethod method = callbackField.getAnnotation(ListenerMethod.class); if (method == null) { throw new IllegalStateException(String.format("@%s's %s.%s missing @%s annotation.", callbacks.getEnclosingClass().getSimpleName(), callbacks.getSimpleName(), callbackMethod.name(), ListenerMethod.class.getSimpleName())); } methods.add(method); } return methods; } catch (NoSuchFieldException e) { throw new AssertionError(e); } } static String asHumanDescription(Collection<? extends ViewBinding> bindings) { Iterator<? extends ViewBinding> iterator = bindings.iterator(); switch (bindings.size()) { case 1: return iterator.next().getDescription(); case 2: return iterator.next().getDescription() + " and " + iterator.next().getDescription(); default: StringBuilder builder = new StringBuilder(); for (int i = 0, count = bindings.size(); i < count; i++) { if (i != 0) { builder.append(", "); } if (i == count - 1) { builder.append("and "); } builder.append(iterator.next().getDescription()); } return builder.toString(); } } static TypeName bestGuess(String type) { switch (type) { case "void": return TypeName.VOID; case "boolean": return TypeName.BOOLEAN; case "byte": return TypeName.BYTE; case "char": return TypeName.CHAR; case "double": return TypeName.DOUBLE; case "float": return TypeName.FLOAT; case "int": return TypeName.INT; case "long": return TypeName.LONG; case "short": return TypeName.SHORT; default: int left = type.indexOf('<'); if (left != -1) { ClassName typeClassName = ClassName.bestGuess(type.substring(0, left)); List<TypeName> typeArguments = new ArrayList<>(); do { typeArguments.add(WildcardTypeName.subtypeOf(Object.class)); left = type.indexOf('<', left + 1); } while (left != -1); return ParameterizedTypeName.get(typeClassName, typeArguments.toArray(new TypeName[typeArguments.size()])); } return ClassName.bestGuess(type); } } boolean hasUnbinder() { return unbinderClassName != null; } void setHighestUnbinderClassName(ClassName className) { this.highestUnbinderClassName = className; } ClassName getHighestUnbinderClassName() { return this.highestUnbinderClassName; } void setUnbinderClassName(ClassName className) { unbinderClassName = className; } ClassName getUnbinderClassName() { return unbinderClassName; } BindingClass getParentBinding() { return parentBinding; } boolean hasParentBinding() { return parentBinding != null; } private boolean hasResourceBindings() { return !(bitmapBindings.isEmpty() && drawableBindings.isEmpty() && resourceBindings.isEmpty()); } boolean hasViewBindings() { return !viewIdMap.isEmpty() || !collectionBindings.isEmpty(); } Iterable<BindingClass> getDescendants() { return descendantBindingClasses; } private boolean hasResourceBindingsNeedingTheme() { if (!drawableBindings.isEmpty()) { return true; } for (FieldResourceBinding resourceBinding : resourceBindings) { if (resourceBinding.isThemeable()) { return true; } } return false; } @Override public String toString() { return classFqcn; } }
[ "deadlong7@gmail.com" ]
deadlong7@gmail.com
14972a769d91fe63f146f725336d9d6198d76806
47da275d6b10915cc60d6fc3238b5bc243d6c5c1
/de.rcenvironment.core.gui.workflow.integration/src/main/java/de/rcenvironment/core/gui/workflow/integration/IntegrationEndpointPropertySection.java
c3746dcbecbdba5408b4a051b00b3039652d1c17
[]
no_license
rcenvironment/rce-test
aa325877be8508ee0f08181304a50bd97fa9f96c
392406e8ca968b5d8168a9dd3155d620b5631ab6
HEAD
2016-09-06T03:35:58.165632
2015-01-16T10:45:50
2015-01-16T10:45:50
29,299,206
1
2
null
null
null
null
UTF-8
Java
false
false
1,120
java
/* * Copyright (C) 2006-2014 DLR, Germany * * All rights reserved * * http://www.rcenvironment.de/ */ package de.rcenvironment.core.gui.workflow.integration; import de.rcenvironment.core.datamodel.api.EndpointType; import de.rcenvironment.core.gui.workflow.editor.properties.EndpointPropertySection; import de.rcenvironment.core.gui.workflow.editor.properties.EndpointSelectionPane; import de.rcenvironment.core.gui.workflow.editor.properties.Messages; /** * {@link EndpointPropertySection} for all custom integrated tools. * * @author Sascha Zur */ public class IntegrationEndpointPropertySection extends EndpointPropertySection { public IntegrationEndpointPropertySection() { super(); EndpointSelectionPane inputPane = new EndpointSelectionPane(Messages.inputs, EndpointType.INPUT, this, false, "default", false); EndpointSelectionPane outputPane = new EndpointSelectionPane(Messages.outputs, EndpointType.OUTPUT, this, true, "default", false); setColumns(2); setPanes(inputPane, outputPane); } }
[ "robert.mischke@dlr.de" ]
robert.mischke@dlr.de
be5227bdf78ac36a37eb4cc099d3de03a2f8c80d
35e0a3bfb1744f912679cbdcb82bfdfb68226b7f
/WEB-INF/src/models/old_models/Cart.java
3b6b6d61ddd6938ea500ad0ecd08177ea3459e67
[]
no_license
sachinnayak1210/ebazar
89393f126991aec12b2ed224749efc3356d755c6
90874697df8af75c6b6211fbfbe90ffc51bdb159
refs/heads/master
2020-06-28T12:40:28.437469
2019-08-02T13:11:47
2019-08-02T13:11:47
200,236,656
0
0
null
null
null
null
UTF-8
Java
false
false
951
java
package models; import java.sql.Date; public class Cart{ private Integer cartId; private User user; private Date cartDate; private Integer items; private Float cartAmount; private Status status; public void setCartId(Integer cartId){ this.cartId = cart_id; } public Integer getCartId(){ return cartId; } public void setUser(User user){ this.user = user; } public User getUser(){ return user; } public void setCartDate(Date cartDate){ this.cartDate = cartDate; } public Date getCartDate(){ return cartDate; } public void setItems(Integer items){ this.items = items; } public Integer getItems(){ return items; } public void setCartAmount(Float cartAmount){ this.cartAmount = cartAmount; } public Float getCartAmount(){ return cartAmount; } public void setStatus(Status status){ this.status = status; } public Status getStatus(){ return status; } }
[ "sachinnayak1210@gmail.com" ]
sachinnayak1210@gmail.com
7fbf9ceea8c9bb6da0227805ca40d53a6fa1b271
cad803d718fb8f24768ead55a587d571eb31248b
/mocha-game/src/main/java/mocha/game/command/Command.java
b76d72f0b6e6be92c230e6014baab079d7c2f526
[]
no_license
srwaggon/mocha
1ab370fdfb1a761bf44185c09f160c7f95d56f4f
1f9df991283311ff2c40e4d8842cbb28f494dc38
refs/heads/master
2021-05-24T04:22:57.579048
2020-08-09T00:58:35
2020-08-09T00:58:35
47,476,506
4
3
null
2019-05-12T02:27:31
2015-12-05T23:22:02
Java
UTF-8
Java
false
false
58
java
package mocha.game.command; public interface Command { }
[ "samuel.waggoner@gmail.com" ]
samuel.waggoner@gmail.com
ab3fd17fd56d8a25cbe0502134a7453731f3f5eb
f24a0a8f56fe5b804f27a3d72927fe5b7bd55931
/src/main/java/Mark.java
0bc9bd562fc6c3a0e687c8128e110b2015f79391
[]
no_license
lucastorri/TicTacToe
cb480f244865a0eeb17f19ed4e811b3b95ad48fc
2ec1163e4e8e9f2278fc5d1a50c4c7520af7b2b1
refs/heads/master
2021-03-12T22:59:51.295077
2011-05-13T04:23:43
2011-05-13T04:23:43
1,741,857
0
1
null
null
null
null
UTF-8
Java
false
false
53
java
package some.pack; public enum Mark { X, O, _; }
[ "lucastorri@gmail.com" ]
lucastorri@gmail.com
418e0e7354f39698f9c516371658d973f2591562
e269eae80a498526e53cfca27b02f93cc306462d
/apps/l3vpn/nel3vpn/nemgr/src/main/java/org/onosproject/yang/gen/v1/l3vpn/comm/type/rev20141225/NeL3VpncommTypeManager.java
278301d0454641f4a2567040ea8e8fbe847c1745
[ "Apache-2.0" ]
permissive
wuwenbin2/onos_l3vpn
e66cb45fa422e8a6c0fd76b6b5d62a114da6551b
d013bf6f31d12f8ab614ceb149ae13b64ef44256
refs/heads/master
2021-05-01T12:36:59.567378
2016-09-30T03:23:50
2016-09-30T03:23:50
69,629,610
1
0
null
null
null
null
UTF-8
Java
false
false
1,444
java
/* * Copyright 2016-present Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.onosproject.yang.gen.v1.l3vpn.comm.type.rev20141225; import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; import org.apache.felix.scr.annotations.Service; import org.slf4j.Logger; import static org.slf4j.LoggerFactory.getLogger; /** * Represents the implementation of neL3VpncommTypeManager. */ @Component (immediate = true) @Service public class NeL3VpncommTypeManager implements NeL3VpncommTypeService { private final Logger log = getLogger(getClass()); @Activate public void activate() { //TODO: YANG utils generated code log.info("Started"); } @Deactivate public void deactivate() { //TODO: YANG utils generated code log.info("Stopped"); } }
[ "wuwenbin2@huawei.com" ]
wuwenbin2@huawei.com
1b5b1eda4c0270dffc830ba38a60a484f0afffba
6fd2c018548f1b2d4929c123c1d853c8620cc346
/src/main/java/net/hunnor/dict/client/model/Response.java
1ec274af3994abfce3760d9faf7adf8da43cd891
[]
no_license
hunnor-dict/web-spring
83a385b5b785bcab615afbf65592cb66f46a0385
b1a54e99515e320d332655668630fa2535ef935e
refs/heads/master
2023-06-22T22:18:54.363157
2023-06-17T14:12:57
2023-06-17T14:12:57
47,814,736
0
1
null
null
null
null
UTF-8
Java
false
false
1,024
java
package net.hunnor.dict.client.model; import java.text.Collator; import java.util.LinkedHashSet; import java.util.Set; import java.util.TreeSet; public class Response { private Set<Result> results; private Set<String> suggestions; public Response(Collator collator) { suggestions = new TreeSet<>(collator); results = new LinkedHashSet<>(); } public Set<Result> getResults() { return new LinkedHashSet<>(results); } /** * Add a result to the result set. * @param result the result to add */ public void addResult(Result result) { if (results == null) { results = new LinkedHashSet<>(); } results.add(result); } public Set<String> getSuggestions() { return new TreeSet<>(suggestions); } /** * Add a suggestion to the suggestion set. * @param suggestion the suggestion to add */ public void addSuggestion(String suggestion) { if (suggestions == null) { suggestions = new TreeSet<>(); } suggestions.add(suggestion); } }
[ "adamzkover@gmail.com" ]
adamzkover@gmail.com
a9e812377f20ad18cffbe87ffdfcadc1cacd83a1
e2a2aa460c10c19e6d78338b9700a7d754596e36
/app/src/main/java/kr/co/teada/whatiate/MainActivity.java
3cad8b9f1a55c3ca2e3140b8cc4e4a1f7f6ea3e6
[]
no_license
HyerimRyu/WhatIate
bceaacb66b06d5e9fece60029eed8ef2c241fe75
735225ef802f53eca0add0cf0539fe722dd29fc1
refs/heads/master
2020-04-27T15:33:21.411528
2019-03-08T06:45:17
2019-03-08T06:45:17
174,450,467
0
0
null
null
null
null
UTF-8
Java
false
false
2,656
java
package kr.co.teada.whatiate; import android.content.Intent; import android.net.Uri; import android.support.design.widget.NavigationView; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.View; import android.widget.ImageView; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import java.util.ArrayList; import static kr.co.teada.whatiate.R.string.app_name; public class MainActivity extends AppCompatActivity { private Uri imgUri; RecyclerView recyclerView; ArrayList<PicItem> picItems=new ArrayList<>(); MyAdapter myAdapter; private FirebaseStorage firebaseStorage; private FirebaseDatabase firebaseDatabase; DatabaseReference databaseReference; DrawerLayout drawerLayout; NavigationView navigationView; ActionBarDrawerToggle drawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar=findViewById(R.id.my_toolbar); setSupportActionBar(toolbar); recyclerView=findViewById(R.id.recyclerView); recyclerView.setLayoutManager(new LinearLayoutManager(this)); myAdapter=new MyAdapter(picItems, this); recyclerView.setAdapter(myAdapter); drawerLayout=findViewById(R.id.drawerLayout); navigationView=findViewById(R.id.navi); navigationView.setItemIconTintList(null); drawerToggle=new ActionBarDrawerToggle(this, drawerLayout,toolbar,R.string.app_name, R.string.app_name); drawerLayout.addDrawerListener(drawerToggle); drawerToggle.syncState(); }//end of onCreate public void clickBtnSearch(View view) { //search Avtivity 이동 } public void clickBtnFab(View view) { //갤러리 이동 openGallery(); } //갤러리 열어 public void openGallery(){ Intent photoPicintent=new Intent(Intent.ACTION_PICK); photoPicintent.setType("image/*"); startActivityForResult(photoPicintent, 10); saveData(); //Intent 불러서 upload Activity ->et } //파이어베이스에 데이터 저장 public void saveData(){ } }//end of MainActivity
[ "hyerim0812@naver.com" ]
hyerim0812@naver.com
45c8e3f38f940a372b6dbfd715af83b8b2139260
3705a1acb1c7d39110a4246fd0b007d8b8a3e387
/src/com/dcdzsoft/partner/zhili/business/pt/PTDeliveryPackage.java
30653ec0deb941295f11303316a21c067cc95368
[]
no_license
valiantzh/work-dbs-proxy-zhili
ad6b5efb1cf3bf6a0078d25d4fcefdb2f826aeb5
d8f260d9b2dfcfcba3dc72a3f718645f3296add0
refs/heads/master
2020-04-08T02:34:24.624747
2018-11-24T13:48:59
2018-11-24T13:48:59
158,940,356
0
0
null
null
null
null
UTF-8
Java
false
false
20,869
java
package com.dcdzsoft.partner.zhili.business.pt; import java.util.Calendar; import javax.sql.RowSet; import com.dcdzsoft.EduException; import com.dcdzsoft.sda.db.*; import com.dcdzsoft.util.*; import com.dcdzsoft.dto.function.*; import com.dcdzsoft.dto.business.*; import com.dcdzsoft.dao.*; import com.dcdzsoft.dao.common.*; import com.dcdzsoft.email.EmailSenderManager; import com.dcdzsoft.guotong.GuotongManager; import com.dcdzsoft.constant.*; import com.dcdzsoft.business.ActionBean; import com.dcdzsoft.sda.security.SecurityUtils; import com.dcdzsoft.sequence.SequenceGenerator; import com.dcdzsoft.sms.SMSInfo; import com.dcdzsoft.sms.SMSManager; import com.dcdzsoft.config.ApplicationConfig; /** * <p> * Title: 智能自助包裹柜系统 * </p> * <p> * Description: 投递包裹 * </p> * <p> * Copyright: Copyright (c) 2017 * </p> * <p> * Company: dcdzsoft * </p> * * @author zhengxy * @version 1.0 */ public class PTDeliveryPackage extends ActionBean { public OutParamPTDeliveryPackage doBusiness(InParamPTDeliveryPackage in) throws EduException { utilDAO = this.getUtilDAO(); commonDAO = this.getCommonDAO(); dbSession = this.getCurrentDBSession(); OutParamPTDeliveryPackage out = new OutParamPTDeliveryPackage(); // 1. 验证输入参数是否有效,如果无效返回-1。 if (StringUtils.isEmpty(in.TerminalNo) || StringUtils.isEmpty(in.PostmanID) || StringUtils.isEmpty(in.PackageID) || StringUtils.isEmpty(in.BoxNo) || StringUtils.isEmpty(in.LeftFlag)) throw new EduException(ErrorCode.ERR_PARMERR); // 验证投递员是否存在 PMPostmanDAO postmanDAO = daoFactory.getPMPostmanDAO(); PMPostman postman = new PMPostman(); postman.PostmanID = in.PostmanID; try { postman = postmanDAO.find(postman); } catch (Exception e) { throw new EduException(ErrorCode.ERR_POSTMANNOTEXISTS); } //设备是否存在 TBTerminalDAO terminalDAO = daoFactory.getTBTerminalDAO(); TBTerminal terminal = new TBTerminal(); terminal.TerminalNo = in.TerminalNo; terminal = terminalDAO.find(terminal); // 验证柜体权限(登陆时候验证) // commonDAO.checkManTerminalRight(postman, in.TerminalNo); // ////////////////////////////////////////////////////////////////////// java.sql.Timestamp sysDateTime = utilDAO.getCurrentDateTime(); int timeDiff = NumberUtils.parseInt(ControlParam.getInstance().getInterTimeDifferent()); if(timeDiff>0){ System.out.println("===时差"+timeDiff); sysDateTime = DateUtils.addTimeStampByHour(sysDateTime, timeDiff); //国际时差,根据不同的国家设定不同的时间 } java.sql.Date sysDate = DateUtils.toSQLDate(sysDateTime); // ////////////////////////////////////////////////////////////////////////////// // 判断是否已经投递过 PTInBoxPackageDAO inboxPackDAO = daoFactory.getPTInBoxPackageDAO(); JDBCFieldArray whereCols = new JDBCFieldArray(); whereCols.add("PackageID", in.PackageID); whereCols.add("TerminalNo", in.TerminalNo); if (inboxPackDAO.isExist(whereCols) > 0) // throw new EduException(ErrorCode.ERR_PACKHAVEDELIVERYD); { PTInBoxPackage inboxPack = new PTInBoxPackage(); inboxPack.PackageID = in.PackageID; inboxPack.TerminalNo = in.TerminalNo; inboxPack = inboxPackDAO.find(inboxPack); ////////////////////////等待下一个交易重新排队发送(强制排队)///////////////////// if(!inboxPack.TradeWaterNo.equalsIgnoreCase(in.TradeWaterNo)) throw new EduException(ErrorCode.ERR_PACKHAVEDELIVERYD); // 生成返回数据 out.PackageID = in.PackageID; out.BoxNo = in.BoxNo; out.OpenBoxKey = inboxPack.OpenBoxKey; out.ServerTime = sysDateTime; return out; } //生成取件密码 String blankBoxKey = "";//明文 if(999 == ApplicationConfig.getInstance().getSysRunModel()){ blankBoxKey = "555555"+in.BoxNo; }else{ blankBoxKey = commonDAO.generatePickupPwd(in.OpenBoxKey, in.TerminalNo);//明文 } //System.out.println(ApplicationConfig.getInstance().getSysRunModel()+","+blankBoxKey); in.OpenBoxKey = SecurityUtils.md5(blankBoxKey);//密文 // 判断箱门是否已经在用???? // 插入在箱信息 PTInBoxPackage inboxPack = new PTInBoxPackage(); inboxPack.TerminalNo = in.TerminalNo; inboxPack.BoxNo = in.BoxNo; inboxPack.PackageID = in.PackageID; inboxPack.PostmanID = in.PostmanID; inboxPack.CompanyID = postman.CompanyID; inboxPack.DynamicCode = in.DynamicCode; inboxPack.TradeWaterNo = in.TradeWaterNo; inboxPack.StoredTime = sysDateTime; inboxPack.StoredDate = sysDate; inboxPack.ExpiredTime = in.ExpiredTime; inboxPack.CustomerID = in.CustomerID; inboxPack.CustomerMobile = in.CustomerMobile; inboxPack.OpenBoxKey = in.OpenBoxKey; inboxPack.CustomerName = ""; inboxPack.CustomerAddress = ""; inboxPack.LeftFlag = in.LeftFlag; inboxPack.PackageStatus = SysDict.PACKAGE_STATUS_NORMAL; inboxPack.LastModifyTime = sysDateTime; inboxPack.StaOrderID = in.StaOrderID; inboxPack.OfLogisticsID = in.OfLogisticsID; inboxPack.OfLogisticsName = in.OfLogisticsName; inboxPack.BlankBoxKey = blankBoxKey; //格口收费 if("1".equals(ControlParam.getInstance().getLockerChargeUser())){//对投递员收费 StringBuffer remark = new StringBuffer(); //计算费用 double amount = generateHireAmt(in.TerminalNo, in.BoxNo, remark); //扣费 inboxPack.PosPayFlag = generateTradeWater(in, amount, remark, postman, sysDateTime); inboxPack.HireAmt = amount;//格口租用金额 inboxPack.HireWhoPay = SysDict.CUSTOMER_TYPE_POSTMAN;//格口租用支付方 }else{ inboxPack.PosPayFlag = in.PosPayFlag; } if (commonDAO.isSendItemEventToPartner(inboxPack.CompanyID,postman.InputMobileFlag)) inboxPack.UploadFlag = SysDict.UPLOAD_FLAG_NO; else inboxPack.UploadFlag = SysDict.UPLOAD_FLAG_YES; inboxPackDAO.insert(inboxPack); // 删除待投递列表 PTReadyPackageDAO readyPackDAO = daoFactory.getPTReadyPackageDAO(); PTReadyPackage readyPack = new PTReadyPackage(); readyPack.TerminalNo = in.TerminalNo; readyPack.PackageID = in.PackageID; readyPackDAO.delete(readyPack); // 生成返回数据 out.PackageID = in.PackageID; out.BoxNo = in.BoxNo; out.OpenBoxKey = in.OpenBoxKey; out.ServerTime = sysDateTime; ///////////////////////// //sendDeliveryMsg(inboxPack, terminal, postman, sysDateTime); //生成消息 SMSInfo smsInfo = commonDAO.generateSendInfo(inboxPack, terminal, postman, sysDateTime); // 发送投递信息-短信 commonDAO.sendDeliverySMS(smsInfo); //发送投递消息-邮件 //不同公司投递员由不同公司的管理邮箱发送。 PMCompanyDAO companyDAO = daoFactory.getPMCompanyDAO(); PMCompany company = new PMCompany(); company.CompanyID = postman.CompanyID; company = companyDAO.find(company); smsInfo.CompanyMobile = company.ContactTel;//公司联系人电话 smsInfo.FromEamilAddress = company.Address;//公司邮箱地址-->发件人地址 smsInfo.UserName = company.Address;//用户邮箱地址(一般就是发件人地址) smsInfo.EmailPwd = company.Remark;//255字节 commonDAO.sendDeliveryEmail(smsInfo); // 订单状态反馈给合作方系统 if (commonDAO.isSendItemEventToPartner(inboxPack.CompanyID,postman.InputMobileFlag)) { //sentDeliveryInfo(inboxPack, terminal, postman, sysDateTime); SMSInfo sendInfo = new SMSInfo(smsInfo); GuotongManager.getInstance().sentDeliveryInfo(sendInfo); } return out; } // /**发送投递信息 * @param inboxPack * @param terminal * @param postman * @param sysDateTime * @deprecated * @throws EduException */ private void sendDeliveryMsg(PTInBoxPackage inboxPack, TBTerminal terminal, PMPostman postman, java.sql.Timestamp sysDateTime) throws EduException { java.sql.Date sysDate = DateUtils.toSQLDate(sysDateTime); // ////////////////////////////////// MBPwdShortMsgDAO shortMsgDAO = daoFactory.getMBPwdShortMsgDAO(); MBPwdShortMsg shortMsg = new MBPwdShortMsg(); SequenceGenerator seqGen = SequenceGenerator.getInstance(); shortMsg.WaterID = seqGen.getNextKey(SequenceGenerator.SEQ_WATERID); shortMsg.TerminalNo = inboxPack.TerminalNo; shortMsg.PackageID = inboxPack.PackageID; shortMsg.StoredTime = sysDateTime; shortMsg.StoredDate = sysDate; shortMsg.OpenBoxKey = inboxPack.BlankBoxKey; shortMsg.CustomerMobile = inboxPack.CustomerMobile; shortMsg.LastModifyTime = sysDateTime; shortMsg.ReSendNum = 0; shortMsg.PackageStatus = inboxPack.PackageStatus; shortMsg.Remark = inboxPack.TradeWaterNo; //shortMsg.SenderMobile = inboxPack.Remark;//发件人手机 int hourSendMsg = NumberUtils.parseInt(ControlParam.getInstance().getSendPwdSMSFirstTime()); int hour = DateUtils.getHour(sysDate); if(hour>=hourSendMsg){ //早上7点以后即时发送 shortMsg.SendStatus = "1"; // 0:未发送 1:发送进行中 2:发送成功 4:发送失败 shortMsgDAO.insert(shortMsg); }else{ //早上7点以前不发送 shortMsg.SendStatus = "0"; // 0:未发送 1:发送进行中 2:发送成功 4:发送失败 shortMsgDAO.insert(shortMsg); return; } //发送短信 SMSInfo smsInfo = new SMSInfo(); smsInfo.PackageID = inboxPack.PackageID; smsInfo.TerminalNo = inboxPack.TerminalNo; smsInfo.StoredTime = sysDateTime; smsInfo.sysDateTime = sysDateTime; smsInfo.CustomerMobile = inboxPack.CustomerMobile; smsInfo.OfBureau = terminal.OfBureau; smsInfo.BoxNo = inboxPack.BoxNo; smsInfo.OpenBoxKey = inboxPack.BlankBoxKey; smsInfo.TerminalName = terminal.TerminalName; smsInfo.Location = terminal.Location; smsInfo.DepartmentID = terminal.DepartmentID; smsInfo.PostmanID = postman.PostmanID; smsInfo.PostmanName = postman.PostmanName; smsInfo.PostmanMobile = postman.Mobile; smsInfo.CompanyID = postman.CompanyID; smsInfo.PackageStatus = inboxPack.PackageStatus; smsInfo.MsgType = SMSInfo.MSG_TYPE_DELIVERY; smsInfo.TradeWaterNo = inboxPack.TradeWaterNo; smsInfo.StaOrderID = inboxPack.StaOrderID; smsInfo.OfLogisticsID = inboxPack.OfLogisticsID; smsInfo.OfLogisticsName = inboxPack.OfLogisticsName; smsInfo.TradeWaterNo = inboxPack.TradeWaterNo; smsInfo.MBDeviceNo = terminal.MBDeviceNo; smsInfo.WaterID = shortMsg.WaterID; ControlParam ctrlParam = ControlParam.getInstance(); try { //发送投递短信0:不使用,1:给客户,2:给投递员,3:给投递公司,4:都发送 if(StringUtils.isNotEmpty(ApplicationConfig.getInstance().getSendShortMsg())) { switch(ctrlParam.getSendDeliverSMS()){ case "1":break; case "2":{ SMSInfo smsInfoToPostman = new SMSInfo(smsInfo); SMSManager.getInstance().sentDeliverySMSToPostman(smsInfoToPostman);break;} case "3":{ SMSInfo smsInfoToCompany = new SMSInfo(smsInfo); SMSManager.getInstance().sentDeliverySMSToCompany(smsInfoToCompany);break;} case "4":{ SMSInfo smsInfoToPostman = new SMSInfo(smsInfo); SMSManager.getInstance().sentDeliverySMSToPostman(smsInfoToPostman); SMSInfo smsInfoToCompany = new SMSInfo(smsInfo); SMSManager.getInstance().sentDeliverySMSToCompany(smsInfoToCompany);break;} } SMSManager.getInstance().sentDeliverySMS(smsInfo); } //发送投递邮件0:不使用,1:给客户,2:给投递员,3:给投递公司,4:都发送 if(StringUtils.isNotEmpty(ctrlParam.getSendDeliverEmail())){ //不同公司投递员由不同公司的管理邮箱发送。 PMCompanyDAO companyDAO = daoFactory.getPMCompanyDAO(); PMCompany company = new PMCompany(); company.CompanyID = postman.CompanyID; company = companyDAO.find(company); smsInfo.CompanyMobile = company.ContactTel;//公司联系人电话 smsInfo.FromEamilAddress = company.Address;//公司邮箱地址-->发件人地址 smsInfo.UserName = company.Address;//用户邮箱地址(一般就是发件人地址) smsInfo.EmailPwd = company.Remark;//255字节 switch(ctrlParam.getSendDeliverEmail()){ case "1":{ smsInfo.Email = inboxPack.CustomerMobile; //柜端取件人手机号作为邮箱 EmailSenderManager.getInstance().sendDeliverEmail(smsInfo,"ToCM");break;} case "2":{ smsInfo.Email = postman.Email; EmailSenderManager.getInstance().sendDeliverEmail(smsInfo,"ToPM");break;} case "3":{ smsInfo.Email = smsInfo.FromEamilAddress;//公司邮箱发给自己邮箱作为投递凭证 EmailSenderManager.getInstance().sendDeliverEmail(smsInfo,"ToCompany");break;} case "4":{ smsInfo.Email = inboxPack.CustomerMobile; //柜端取件人手机号作为邮箱 EmailSenderManager.getInstance().sendDeliverEmail(smsInfo,"ToCM"); SMSInfo smsInfoToPostman = new SMSInfo(smsInfo); smsInfoToPostman.Email = smsInfoToPostman.Email; EmailSenderManager.getInstance().sendDeliverEmail(smsInfoToPostman,"ToPM"); SMSInfo smsInfoToCompany = new SMSInfo(smsInfo); smsInfoToCompany.Email = smsInfoToCompany.FromEamilAddress; EmailSenderManager.getInstance().sendDeliverEmail(smsInfoToCompany,"ToCompany");break;} } } } catch (EduException e) { e.printStackTrace(); } } /** * * @param inboxPack * @param terminal * @param postman * @param sysDateTime * @deprecated */ private void sentDeliveryInfo(PTInBoxPackage inboxPack, TBTerminal terminal, PMPostman postman, java.sql.Timestamp sysDateTime){ // PMCompanyDAO companyDAO = daoFactory.getPMCompanyDAO(); PMCompany company = new PMCompany(); company.CompanyID = postman.CompanyID; PMLogisticsDAO logisticDAO = daoFactory.getPMLogisticsDAO(); PMLogistics logistic = new PMLogistics(); /////////// try { company = companyDAO.find(company); logistic.LogisticsID = company.LogisticsID; logistic = logisticDAO.find(logistic); } catch (EduException e) { // TODO Auto-generated catch block e.printStackTrace(); } SMSInfo smsInfo = new SMSInfo(); smsInfo.PackageID = inboxPack.PackageID; smsInfo.TerminalNo = inboxPack.TerminalNo; smsInfo.StoredTime = sysDateTime; smsInfo.sysDateTime = sysDateTime; smsInfo.CustomerMobile = inboxPack.CustomerMobile; smsInfo.OfBureau = terminal.OfBureau; smsInfo.BoxNo = inboxPack.BoxNo; smsInfo.OpenBoxKey = inboxPack.BlankBoxKey; smsInfo.TerminalName = terminal.TerminalName; smsInfo.Location = terminal.Location; smsInfo.DepartmentID = terminal.DepartmentID; smsInfo.PostmanID = postman.PostmanID; smsInfo.PostmanName = postman.PostmanName; smsInfo.PostmanMobile = postman.Mobile; smsInfo.CompanyID = postman.CompanyID; smsInfo.CompanyName = company.CompanyName; smsInfo.LogisticsName = logistic.LogisticsName; smsInfo.PackageStatus = inboxPack.PackageStatus; smsInfo.MsgType = SMSInfo.MSG_TYPE_DELIVERY; smsInfo.TradeWaterNo = inboxPack.TradeWaterNo; smsInfo.StaOrderID = inboxPack.StaOrderID; smsInfo.OfLogisticsID = inboxPack.OfLogisticsID; smsInfo.OfLogisticsName = inboxPack.OfLogisticsName; smsInfo.MBDeviceNo = terminal.MBDeviceNo; if(StringUtils.isEmpty(smsInfo.OfLogisticsID)){ smsInfo.OfLogisticsID = company.LogisticsID; } GuotongManager.getInstance().sentDeliveryInfo(smsInfo); } /** * 生成格口租用金额 * @param inTerminalNo * @param inBoxNo * @param remark * @return amount */ private double generateHireAmt(String inTerminalNo,String inBoxNo, StringBuffer remark) { double amount = 0; try{ //按格口类型收费: TBServerBoxDAO boxDAO = daoFactory.getTBServerBoxDAO(); TBServerBox box = new TBServerBox(); box.TerminalNo = inTerminalNo; box.BoxNo = inBoxNo; box = boxDAO.find(box); remark.append("格口编号:").append(inBoxNo).append(";"); //先查单个柜体格口类型费用 TBServerBoxTypeDAO serverBoxTypeDAO = daoFactory.getTBServerBoxTypeDAO(); TBServerBoxType serverBoxType = new TBServerBoxType(); serverBoxType.TerminalNo = inTerminalNo; serverBoxType.BoxType = box.BoxType; if(serverBoxTypeDAO.isExist(serverBoxType)){ serverBoxType = serverBoxTypeDAO.find(serverBoxType); amount = serverBoxType.ChargeAmt; remark.append("格口类型:").append(serverBoxType.BoxTypeName).append(";"); }else{ //查统一格口类型费用 TBBoxTypeDAO boxTypeDAO = daoFactory.getTBBoxTypeDAO(); TBBoxType boxType = new TBBoxType(); boxType.BoxType = box.BoxType; boxType = boxTypeDAO.find(boxType); amount = boxType.ChargeAmt; remark.append("格口类型:").append(boxType.BoxTypeName).append(";"); } remark.append("格口费用:").append(amount).append("元;"); }catch(EduException e){ } return amount; } /** * 扣费&产生交易流水 * @param in * @param amount * @param remark * @param postman * @param sysDateTime * @return PAY_FLAG * @throws EduException */ private String generateTradeWater(InParamPTDeliveryPackage in, double amount, StringBuffer remark, PMPostman postman, java.sql.Timestamp sysDateTime)throws EduException { //扣费 if(amount<=0){ return SysDict.PAY_FLAG_NO;//不需要支付 } PYConsumedCardDAO cardDAO = daoFactory.getPYConsumedCardDAO(); PYConsumedCard card = new PYConsumedCard(); card.CardNo = postman.BindCardID; card.CustomerID = postman.PostmanID; if(cardDAO.isExist(card)){ int amountCent = 0;//分 //账号存在才扣费 card = cardDAO.find(card); if(card.Discount>=10 && card.Discount<= 1000){//10%~1000% amountCent = (int)((amount*card.Discount));//金额(元)*(折扣/100)*100=金额(元)*折扣=金额(分) }else{ amountCent = (int)(amount*100);//金额(元)*100=金额(分) } JDBCFieldArray setCols1 = new JDBCFieldArray(); JDBCFieldArray whereCols1 = new JDBCFieldArray(); setCols1.add("LastModifyTime", sysDateTime); setCols1.addSQL(" Balance = Balance - "+amountCent);//分 int balance = card.Balance - amountCent; if(balance <= 0){ //欠费停用 setCols1.add("CardStatus", SysDict.CARD_STATUS_DISABLE); } whereCols1.add("CardNo", card.CardNo); //whereCols1.add("CustomerID", card.CustomerID); cardDAO.update(setCols1, whereCols1); //生成消费账单 remark.append("账户余额:").append((double)balance/100).append("元;"); PYTransactionWaterDAO tradeWaterDAO = daoFactory.getPYTransactionWaterDAO(); PYTransactionWater tradeWater = new PYTransactionWater(); tradeWater.CustomerID = card.CustomerID; tradeWater.TradeWaterNo = commonDAO.generateTradeWaterNo(sysDateTime);// tradeWater.TransactionAmt = amountCent;//分 tradeWater.TransactionDate = commonDAO.generateTradeDate(sysDateTime); tradeWater.TransactionType = SysDict.BILL_TYPE_CONSUMED;//消费-格口租金 tradeWater.ChargeType = SysDict.CHARGE_TYPE_USAGE; tradeWater.TransactionNum = 1;//1次 tradeWater.CardNo = card.CardNo; tradeWater.TradeUserID = postman.Mobile; tradeWater.TradeTerminalNo = in.TerminalNo; tradeWater.PackageID = in.PackageID; tradeWater.BoxNo = in.BoxNo; tradeWater.ReferenceCode = ""; tradeWater.Remark = remark.toString(); tradeWater.UploadFlag = SysDict.UPLOAD_FLAG_YES; tradeWater.LastModifyTime = sysDateTime; tradeWaterDAO.insert(tradeWater); return SysDict.PAY_FLAG_SUCCESS;//支付成功 }else{ return SysDict.PAY_FLAG_NO;//不需要支付 } } }
[ "zhengxiaoyong@hzdongcheng.com" ]
zhengxiaoyong@hzdongcheng.com
07e985f362ee0b0603a9aea8a0b6d6d13096ebad
995f73d30450a6dce6bc7145d89344b4ad6e0622
/Honor5C-7.0/src/main/java/com/android/internal/util/IndentingPrintWriter.java
b17bf183f7e8f4da25f7da71c1d2edcac0b7da98
[]
no_license
morningblu/HWFramework
0ceb02cbe42585d0169d9b6c4964a41b436039f5
672bb34094b8780806a10ba9b1d21036fd808b8e
refs/heads/master
2023-07-29T05:26:14.603817
2021-09-03T05:23:34
2021-09-03T05:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,762
java
package com.android.internal.util; import android.util.PtmLog; import java.io.PrintWriter; import java.io.Writer; import java.util.Arrays; public class IndentingPrintWriter extends PrintWriter { private char[] mCurrentIndent; private int mCurrentLength; private boolean mEmptyLine; private StringBuilder mIndentBuilder; private char[] mSingleChar; private final String mSingleIndent; private final int mWrapLength; public IndentingPrintWriter(Writer writer, String singleIndent) { this(writer, singleIndent, -1); } public IndentingPrintWriter(Writer writer, String singleIndent, int wrapLength) { super(writer); this.mIndentBuilder = new StringBuilder(); this.mEmptyLine = true; this.mSingleChar = new char[1]; this.mSingleIndent = singleIndent; this.mWrapLength = wrapLength; } public void increaseIndent() { this.mIndentBuilder.append(this.mSingleIndent); this.mCurrentIndent = null; } public void decreaseIndent() { this.mIndentBuilder.delete(0, this.mSingleIndent.length()); this.mCurrentIndent = null; } public void printPair(String key, Object value) { print(key + PtmLog.KEY_VAL_SEP + String.valueOf(value) + " "); } public void printPair(String key, Object[] value) { print(key + PtmLog.KEY_VAL_SEP + Arrays.toString(value) + " "); } public void printHexPair(String key, int value) { print(key + "=0x" + Integer.toHexString(value) + " "); } public void println() { write(10); } public void write(int c) { this.mSingleChar[0] = (char) c; write(this.mSingleChar, 0, 1); } public void write(String s, int off, int len) { char[] buf = new char[len]; s.getChars(off, len - off, buf, 0); write(buf, 0, len); } public void write(char[] buf, int offset, int count) { int indentLength = this.mIndentBuilder.length(); int bufferEnd = offset + count; int lineStart = offset; int lineEnd = offset; while (lineEnd < bufferEnd) { int lineEnd2 = lineEnd + 1; char ch = buf[lineEnd]; this.mCurrentLength++; if (ch == '\n') { maybeWriteIndent(); super.write(buf, lineStart, lineEnd2 - lineStart); lineStart = lineEnd2; this.mEmptyLine = true; this.mCurrentLength = 0; } if (this.mWrapLength > 0 && this.mCurrentLength >= this.mWrapLength - indentLength) { if (this.mEmptyLine) { maybeWriteIndent(); super.write(buf, lineStart, lineEnd2 - lineStart); super.write(10); this.mEmptyLine = true; lineStart = lineEnd2; this.mCurrentLength = 0; } else { super.write(10); this.mEmptyLine = true; this.mCurrentLength = lineEnd2 - lineStart; } } lineEnd = lineEnd2; } if (lineStart != lineEnd) { maybeWriteIndent(); super.write(buf, lineStart, lineEnd - lineStart); } } private void maybeWriteIndent() { if (this.mEmptyLine) { this.mEmptyLine = false; if (this.mIndentBuilder.length() != 0) { if (this.mCurrentIndent == null) { this.mCurrentIndent = this.mIndentBuilder.toString().toCharArray(); } super.write(this.mCurrentIndent, 0, this.mCurrentIndent.length); } } } }
[ "dstmath@163.com" ]
dstmath@163.com
3c9974e65b4a8c97cb7c8f0b51c68bc3477795f2
3a477fffe3f9414c075483f2a5cb0f0562992321
/Problema6_Creacionales/src/problema6_creacionales/Problema6_Creacionales.java
bd2a0efd13af1619723b4bd2abd13891c6d62604
[]
no_license
agusbrenes/CasosPractica_Creacionales
440eb410f375778f34bab8470a899de3b9493277
4f11516434612ec9d8deca0df4ce197baf9be4dc
refs/heads/main
2023-04-15T23:04:11.311476
2021-04-26T02:31:46
2021-04-26T02:31:46
361,293,546
0
0
null
null
null
null
UTF-8
Java
false
false
1,418
java
package problema6_creacionales; import java.util.Scanner; public class Problema6_Creacionales { public static void main(String[] args) { Scanner input = new Scanner(System.in); PiezaCreator factory = null; System.out.println("Cual forma desea para la Pieza?\n" + "1. J\n" + "2. L\n" + "3. T\n" + "4. Z\n" + "5. S\n" + "6. E\n" + "7. O\n"); int num = input.nextInt(); switch(num) { case 1: factory = new PiezaJCreator(); break; case 2: factory = new PiezaLCreator(); break; case 3: factory = new PiezaTCreator(); break; case 4: factory = new PiezaZCreator(); break; case 5: factory = new PiezaSCreator(); break; case 6: factory = new PiezaECreator(); break; case 7: factory = new PiezaOCreator(); break; default: System.out.println("Numero introducido incorrecto... ://"); break; } Pieza pieza = factory.createPieza(); System.out.println(pieza.toString()); } }
[ "56280607+agusbrenes@users.noreply.github.com" ]
56280607+agusbrenes@users.noreply.github.com
04823ae35e3b648445c19c5b11ee5673fcf3590a
6a975df46b0b22edb47ce4bd675a46dab744d0dc
/src/main/java/com/example/demo/Job.java
9b446135cb45c8b909dbed4570219c41ca9b55e7
[]
no_license
srgkrk/SpringBoot_09
2178341eacf6588ac2d4e0b761d2269ff6b0c41f
e35d8bc4669fb8b755d97f2751f5a060931a685a
refs/heads/master
2021-04-03T07:25:54.022683
2018-03-13T21:03:03
2018-03-13T21:03:03
125,114,372
0
0
null
null
null
null
UTF-8
Java
false
false
1,159
java
package com.example.demo; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.lang.reflect.GenericArrayType; @Entity public class Job { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @NotNull @Size=4) private String title; @NotNull @Size=3) private String employer; @NotNull @Size=10) private String description; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getEmployer() { return employer; } public void setEmployer(String employer) { this.employer = employer; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "srgkrk@gmail.com" ]
srgkrk@gmail.com
5ce1b4d73ae9cbed03c19cb276a4bb4bfa28aeb0
3413949f14f5acff0e7c0a738b6ef413c0e953b1
/app/src/androidTest/java/com/bvrk/mobile/android/ExampleInstrumentedTest.java
fe05571bb043a74560e7ca26e927da8973d7b914
[]
no_license
annamamar/bvrkapp
2063d9e736cbac732c831e1d39ba3033d5bfec94
de48bff17a024a0da13203fe447145373e306b61
refs/heads/master
2020-09-23T01:34:48.204246
2019-12-02T14:02:17
2019-12-02T14:02:17
225,367,823
0
0
null
null
null
null
UTF-8
Java
false
false
762
java
package com.bvrk.mobile.android; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.bvrk.mobile.android", appContext.getPackageName()); } }
[ "annam.amareshwarrao@gmail.com" ]
annam.amareshwarrao@gmail.com
8873b32d9d8e898a09a6749fcddb5b6cd2d9c446
474f3942296807333da3bb094e436fe9d6d356bc
/src/main/Main.java
89d5dc2edb60209a873c8d8da9c4c61974ef30f4
[]
no_license
alexanderlopez/Final-Neural-Network
910435e51be509842d7742a25ccec0d8018e7bc7
b7518a8ba76f8cf563e1b8ce9f7c5d7021d4d55b
refs/heads/master
2020-03-07T00:20:35.067713
2018-03-28T14:31:32
2018-03-28T14:31:32
127,154,948
0
0
null
null
null
null
UTF-8
Java
false
false
8,794
java
package main; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JMenuItem; public class Main { // static final int[] LAYER_LENGTHS = { 784, 800, 10 }; static final int[] LAYER_LENGTHS = { 784, 40, 40, 30, 10 }; static final int LAYERS = 5; private JFrame frame; private JTextField txtIndex; private ResourceHandler rHandler; private NeuralNetwork network; private JTextField txtEpochs; private boolean isTestSet; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Main window = new Main(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Main() { rHandler = new ResourceHandler(); try { rHandler.init(ResourceHandler.TRAIN_SET); isTestSet = false; } catch (IOException e) { e.printStackTrace(); } network = new NeuralNetwork(LAYERS, LAYER_LENGTHS); network.init(); initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] {150, 150, 150, 0}; gridBagLayout.rowHeights = new int[] {87, 87, 87, 0}; gridBagLayout.columnWeights = new double[]{0.0, 0.0, 1.0, 0.0}; gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0}; frame.getContentPane().setLayout(gridBagLayout); //MANUAL JLabel lblResult = new JLabel(""); JButton btnPrevious = new JButton("Previous"); GridBagConstraints gbc_btnPrevious = new GridBagConstraints(); gbc_btnPrevious.fill = GridBagConstraints.BOTH; gbc_btnPrevious.insets = new Insets(0, 0, 5, 5); gbc_btnPrevious.gridx = 0; gbc_btnPrevious.gridy = 0; frame.getContentPane().add(btnPrevious, gbc_btnPrevious); JButton btnCompute = new JButton("Compute"); btnCompute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int pos = Integer.parseInt(txtIndex.getText().toString()); Matrix result = network.compute(rHandler.getImageData(pos)); int largestIndex = -1; double largestVal = 0; for (int i = 0; i < result.getRows(); i++) { double val = result.getValueAt(i, 0); if (result.getValueAt(i, 0) > largestVal) { largestVal = val; largestIndex = i; } } lblResult.setText("Returned: " + largestIndex + " ACT: " + rHandler.getLabel(pos)); //System.out.println("RET: " + largestIndex + " VAL: " + largestVal); System.out.println(Matrix.printString(result)); } }); GridBagConstraints gbc_btnCompute = new GridBagConstraints(); gbc_btnCompute.fill = GridBagConstraints.BOTH; gbc_btnCompute.insets = new Insets(0, 0, 5, 5); gbc_btnCompute.gridx = 1; gbc_btnCompute.gridy = 0; frame.getContentPane().add(btnCompute, gbc_btnCompute); JButton btnNext = new JButton("Next"); GridBagConstraints gbc_btnNext = new GridBagConstraints(); gbc_btnNext.fill = GridBagConstraints.BOTH; gbc_btnNext.insets = new Insets(0, 0, 5, 5); gbc_btnNext.gridx = 2; gbc_btnNext.gridy = 0; frame.getContentPane().add(btnNext, gbc_btnNext); JLabel lblImage = new JLabel(""); GridBagConstraints gbc_lblImage = new GridBagConstraints(); gbc_lblImage.fill = GridBagConstraints.BOTH; gbc_lblImage.insets = new Insets(0, 0, 5, 5); gbc_lblImage.gridx = 0; gbc_lblImage.gridy = 1; frame.getContentPane().add(lblImage, gbc_lblImage); //MANUAL btnNext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { txtIndex.setText(Integer.toString(Integer.parseInt(txtIndex.getText())+1)); lblImage.setIcon(new ImageIcon(rHandler.getImage( Integer.parseInt(txtIndex.getText())))); } }); JButton btnGo = new JButton("Go"); btnGo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { lblImage.setIcon(new ImageIcon(rHandler.getImage( Integer.parseInt(txtIndex.getText())))); } }); GridBagConstraints gbc_btnGo = new GridBagConstraints(); gbc_btnGo.fill = GridBagConstraints.BOTH; gbc_btnGo.insets = new Insets(0, 0, 5, 5); gbc_btnGo.gridx = 1; gbc_btnGo.gridy = 1; frame.getContentPane().add(btnGo, gbc_btnGo); txtIndex = new JTextField(); txtIndex.setText("0"); GridBagConstraints gbc_txtIndex = new GridBagConstraints(); gbc_txtIndex.fill = GridBagConstraints.BOTH; gbc_txtIndex.insets = new Insets(0, 0, 5, 5); gbc_txtIndex.gridx = 2; gbc_txtIndex.gridy = 1; frame.getContentPane().add(txtIndex, gbc_txtIndex); txtIndex.setColumns(10); JButton btnTrain = new JButton("Train"); btnTrain.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int epochs = Integer.parseInt(txtEpochs.getText()); network.learn(rHandler, epochs); System.out.println("DONE_LEARNING " + epochs + " EPOCHS"); } }); GridBagConstraints gbc_btnTrain = new GridBagConstraints(); gbc_btnTrain.fill = GridBagConstraints.BOTH; gbc_btnTrain.insets = new Insets(0, 0, 5, 5); gbc_btnTrain.gridx = 0; gbc_btnTrain.gridy = 2; frame.getContentPane().add(btnTrain, gbc_btnTrain); GridBagConstraints gbc_lblResult = new GridBagConstraints(); gbc_lblResult.anchor = GridBagConstraints.EAST; gbc_lblResult.insets = new Insets(0, 0, 5, 5); gbc_lblResult.gridx = 1; gbc_lblResult.gridy = 2; frame.getContentPane().add(lblResult, gbc_lblResult); txtEpochs = new JTextField(); txtEpochs.setText("1"); GridBagConstraints gbc_txtEpochs = new GridBagConstraints(); gbc_txtEpochs.insets = new Insets(0, 0, 5, 5); gbc_txtEpochs.fill = GridBagConstraints.BOTH; gbc_txtEpochs.gridx = 2; gbc_txtEpochs.gridy = 2; frame.getContentPane().add(txtEpochs, gbc_txtEpochs); txtEpochs.setColumns(10); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); JMenu mnFile = new JMenu("File"); menuBar.add(mnFile); JMenuItem mntmChangeToTest = new JMenuItem("Change to Test Set"); mntmChangeToTest.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { if (isTestSet) { rHandler.init(ResourceHandler.TRAIN_SET); mntmChangeToTest.setText("Change to Test Set"); } else if (!isTestSet) { rHandler.init(ResourceHandler.TEST_SET); mntmChangeToTest.setText("Change to Train Set"); } isTestSet = !isTestSet; } catch (IOException e1) { e1.printStackTrace(); } } }); mnFile.add(mntmChangeToTest); JMenuItem mntmVerifyAccuracy = new JMenuItem("Verify Accuracy"); mntmVerifyAccuracy.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int count = 0; int length = rHandler.getDataLength(); for (int i = 0; i < rHandler.getDataLength(); i++) { Matrix res = network.compute(rHandler.getImageData(i)); int index = -1; double maxVal = 0; for (int j = 0; j < res.getRows(); j++) { double val = res.getValueAt(j, 0); if (val > maxVal) { maxVal = val; index = j; } } if (index == rHandler.getLabel(i)) count++; } double accuracy = (double)count/(double)length; double rAccuracy = (double)Math.round(accuracy*10000)/100.0d; lblResult.setText("Accuracy: " + rAccuracy + "%"); } }); mnFile.add(mntmVerifyAccuracy); JMenuItem mntmComputePartial = new JMenuItem("Compute Partial"); mntmComputePartial.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int index = Integer.parseInt(txtIndex.getText()); String[] tokens = txtEpochs.getText().split(","); int row = Integer.parseInt(tokens[0]); int col = Integer.parseInt(tokens[1]); double numerical = network.numericalEstimation(rHandler, index, row, col); double analytical = network.analyticalDerivative(rHandler, index, row, col); System.out.println(numerical + " ROW: " + row + " COL: " + col); System.out.println(analytical); System.out.println("REL: " + Math.abs(analytical-numerical)/Math.max(analytical, numerical)); } }); mnFile.add(mntmComputePartial); } }
[ "alexanderlopez00@gmail.com" ]
alexanderlopez00@gmail.com
086865281b88ac5a85018d276f76d1de46d66aa7
9c0d9f7a32f462f1894a68f5cd0af3025d6e94e7
/src/main/java/com/job/portal/security/JwtTokenProvider.java
ce5e234a4f04afe4e0659290126b4fa1df0b4b8a
[]
no_license
hemenderthakuri/portal_server
8017b18b991ccc9cb1783749a2b9618bb9e1eede
3a86f36211abea06a0ad3739815a75dd3ad5070d
refs/heads/master
2022-12-26T13:57:56.428115
2020-09-06T16:01:33
2020-09-06T16:01:33
293,289,321
0
0
null
null
null
null
UTF-8
Java
false
false
2,059
java
package com.job.portal.security; import io.jsonwebtoken.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Component; import java.util.Date; @Component public class JwtTokenProvider { private static final Logger logger = LoggerFactory.getLogger(JwtTokenProvider.class); @Value("${app.jwtSecret}") private String jwtSecret; @Value("${app.jwtExpirationInMs}") private int jwtExpirationInMs; public String generateToken(Authentication authentication) { UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal(); Date now = new Date(); Date expiryDate = new Date(now.getTime() + jwtExpirationInMs); return Jwts.builder() .setSubject(Long.toString(userPrincipal.getId())) .setIssuedAt(new Date()) .setExpiration(expiryDate) .signWith(SignatureAlgorithm.HS512, jwtSecret) .compact(); } public Integer getUserIdFromJWT(String token) { Claims claims = Jwts.parser() .setSigningKey(jwtSecret) .parseClaimsJws(token) .getBody(); return Integer.parseInt(claims.getSubject()); } public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(jwtSecret).parseClaimsJws(authToken); return true; } catch (SignatureException ex) { logger.error("Invalid JWT signature"); } catch (MalformedJwtException ex) { logger.error("Invalid JWT token"); } catch (ExpiredJwtException ex) { logger.error("Expired JWT token"); } catch (UnsupportedJwtException ex) { logger.error("Unsupported JWT token"); } catch (IllegalArgumentException ex) { logger.error("JWT claims string is empty."); } return false; } }
[ "Hemender.Thakuri@harbingergroup.com" ]
Hemender.Thakuri@harbingergroup.com
95d82542f2a685e0e3891f782b43ef4f474db9a5
72e4b0b11454bf5fc9de135aa3a82333876e9802
/filters-demo/src/main/java/com/kodtodya/sessions/exceptions/TrainingNotfoundException.java
4388724b8b43c65b477385685841c403d044fde1
[]
no_license
ramu11/spring-boot-examples
3b1ab73d60f96ee91bca37bf234e2a52fa00018b
d9a72deca82a42fa9a36975c34640e4428048836
refs/heads/master
2022-11-23T15:43:01.494386
2020-07-29T08:37:07
2020-07-29T08:37:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
163
java
package com.kodtodya.sessions.exceptions; public class TrainingNotfoundException extends RuntimeException{ private static final long serialVersionUID = 1L; }
[ "kodtodya@kodtodya-notebook" ]
kodtodya@kodtodya-notebook
58e2ca93eea0a82f80d72d16b2bb3f47844b302b
d878f67ad0d1b10e1b525b125d16566489f2ea91
/app/src/main/java/com/awok/moshin/awok/Models/ProductOverview.java
01c48211eeabbf55c15484461a8dd578ecde645c
[]
no_license
mohsinhussain/AwokAndroidApp
4fe6f673ecce0667884f4a5d5fa5ddfdf2af461b
8c5e8eaad5aecea1e2b1f18e4232124b652ee738
refs/heads/master
2021-01-10T06:10:07.621269
2016-02-10T07:44:47
2016-02-10T07:44:47
51,426,873
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
package com.awok.moshin.awok.Models; /** * Created by shon on 9/10/2015. */ public class ProductOverview { public String OverViewTitle; public String OverViewText; public ProductOverview() { } public ProductOverview(String OverViewTitle, String OverViewText) { this.OverViewTitle = OverViewTitle; this.OverViewText = OverViewText; } public void setOverViewTitle(String OverViewTitle) { this.OverViewTitle=OverViewTitle; } public void setOverViewText(String OverViewText) { this.OverViewText=OverViewText; } public String getOverViewTitle() { return OverViewTitle; } public String getOverViewText() { return OverViewText; } }
[ "shon@DEV-PC.alifca.local" ]
shon@DEV-PC.alifca.local
df20f863f9e2302b7c1973be092b8fc250d18736
0c81df5b5b1847e75733c3128a3e8499b8f2ef28
/src/main/java/com/meli/mutant/config/imp/MutantFinderConfig.java
9ea9afe98b78dc8cb1fd133b400d9de181090e2b
[]
no_license
gustavomina/meli
14f267916c094139c1cd75e5cd2911a22bdcdd5e
3ef1dcdaca565cc81800d0d803eccb4cdca47e0b
refs/heads/master
2023-06-17T16:14:29.119545
2021-07-12T15:02:54
2021-07-12T15:02:54
380,799,973
0
0
null
null
null
null
UTF-8
Java
false
false
5,996
java
package com.meli.mutant.config.imp; import java.io.IOException; import java.net.URL; import java.sql.SQLException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.configuration2.builder.fluent.Configurations; import org.apache.commons.configuration2.ex.ConfigurationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Scope; import org.springframework.web.servlet.HandlerAdapter; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import com.meli.mutant.config.IMutantFinderConfig; import com.meli.mutant.dao.IStatsDao; import com.meli.mutant.dao.imp.StatsDao; import com.meli.mutant.exception.MutantFinderException; import com.meli.mutant.infraestructure.IDatabaseConnection; import com.meli.mutant.infraestructure.imp.AWSProxyDatabaseConnection; import com.meli.mutant.service.IMutantFinder; import com.meli.mutant.service.imp.MutantFinder; import com.meli.mutant.util.MatrixUtil; import com.meli.mutant.util.io.IMutantFinderProperties; import com.meli.mutant.util.io.IPropertiesHelper; import com.meli.mutant.util.io.IPropertiesHelperFactory; import com.meli.mutant.util.io.imp.MutantFinderProperties; import com.meli.mutant.util.io.imp.PropertiesHelper; import com.meli.mutant.util.io.imp.PropertiesHelperFactory; @Configuration @Import({ MutantFinderController.class }) public class MutantFinderConfig implements IMutantFinderConfig { @Autowired private ApplicationContext applicationContext; @Bean public IMutantFinder mutantFinderBean() throws SQLException, Exception { MutantFinder mutant = new MutantFinder(); mutant.setMatrixUtil(new MatrixUtil()); mutant.setStatsDao(statsDaoBean()); return mutant; } @Bean public IDatabaseConnection databaseConnectionBean() { AWSProxyDatabaseConnection databaseConnection = new AWSProxyDatabaseConnection(); databaseConnection.setMutantFinderProperties(mutantFinderPropertiesBean()); return databaseConnection; } @Bean public IStatsDao statsDaoBean() throws Exception, SQLException { StatsDao statsDao = new StatsDao(); statsDao.setDatabaseConnection(databaseConnectionBean().getConnection()); statsDao.setData(databaseConnectionBean()); return statsDao; } /* * Create required HandlerMapping, to avoid several default HandlerMapping * instances being created */ @Bean public HandlerMapping handlerMapping() { return new RequestMappingHandlerMapping(); } /* * Create required HandlerAdapter, to avoid several default HandlerAdapter * instances being created */ @Bean public HandlerAdapter handlerAdapter() { return new RequestMappingHandlerAdapter(); } /* * optimization - avoids creating default exception resolvers; not required as * the serverless container handles all exceptions * * By default, an ExceptionHandlerExceptionResolver is created which creates * many dependent object, including an expensive ObjectMapper instance. * * To enable custom @ControllerAdvice classes remove this bean. */ @Bean public HandlerExceptionResolver handlerExceptionResolver() { return new HandlerExceptionResolver() { @Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { return null; } }; } @Bean public IPropertiesHelperFactory propertiesHelperFactoryBean() { PropertiesHelperFactory propertiesHelperFactory = new PropertiesHelperFactory(); propertiesHelperFactory.setApplicationContext(applicationContext); return propertiesHelperFactory; } @Bean public IMutantFinderProperties mutantFinderPropertiesBean() { IPropertiesHelperFactory propertiesHelperFactory = propertiesHelperFactoryBean(); IPropertiesHelper propertiesHelper = propertiesHelperFactory .createHelper(MutantFinderProperties.MUTANT_FINDER_PROPERTIES_FILE); MutantFinderProperties mutantFinderProperties = new MutantFinderProperties(); mutantFinderProperties.setPropertiesHelper(propertiesHelper); return mutantFinderProperties; } @Bean() @Scope(scopeName = "prototype") @Lazy public IPropertiesHelper propertiesHelperBean(String pathname) { PropertiesHelper propertiesHelper = new PropertiesHelper(); propertiesHelper.setConfiguration(apacheConfigurationFileBean(pathname)); return propertiesHelper; } @Bean @Scope(scopeName = "prototype") @Lazy public org.apache.commons.configuration2.Configuration apacheConfigurationFileBean(String pathname) { Configurations configurations = configurationsBean(); org.apache.commons.configuration2.Configuration configurationFile = null; try { configurationFile = configurations.properties(fileBean(pathname)); } catch (ConfigurationException e) { e.printStackTrace(); throw new MutantFinderException(e.getMessage()); } return configurationFile; } @Bean @Scope(scopeName = "prototype") @Lazy public URL fileBean(String pathname) { URL url = null; try { url = applicationContext.getResource(pathname).getURL(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Path path = Paths.get(url.toURI()); // File file = new File(pathname); // return file; return url; } @Bean public Configurations configurationsBean() { Configurations configurations = new Configurations(); return configurations; } }
[ "gamin1983@gmail.com" ]
gamin1983@gmail.com
08c73d0abe37d8a960b91ffd519e41630cc239a1
19405673626c1acbab62f472a037b78b293fbfe0
/src/main/java/api/entities/User.java
8083b5bc9cfc39c58a25cf97bd188a0e02e8f500
[]
no_license
iraticasi/APAW-ECP2-iraticasi
f17798982867ce1e96d0e1585de9aa2f81f82969
f788848fae0a46c14497cd6e2c4bf16c2603f002
refs/heads/master
2020-03-31T12:58:20.759589
2018-10-14T12:35:37
2018-10-14T12:35:37
152,217,167
0
0
null
null
null
null
UTF-8
Java
false
false
597
java
package api.entities; public class User { private String id; private String email; public User(String email) { this.email = email; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public String toString() { return "User{" + "id='" + id + '\'' + ", email='" + email + '\'' + '}'; } }
[ "iraticasi@gmail.com" ]
iraticasi@gmail.com
5242ec69c67dbe77250dd5ea8db77e7e576f5ede
7e906f9105bc3ed0380d460d620bb255ee7aef54
/src/trabalhofinal/model/Empregado.java
14622159259141efe08eb1b24c8c0127ab42691c
[]
no_license
sebasthianfbds/Empregado
b14befe34f6a88a40341b70df2065297506f631e
74c88add96149ecbe9c7d20669c195b35e79f554
refs/heads/master
2020-05-19T16:24:01.346499
2019-05-23T20:37:41
2019-05-23T20:37:41
185,107,010
0
0
null
null
null
null
UTF-8
Java
false
false
937
java
package trabalhofinal.model; /* * 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. */ /** * * @author Fabricio */ public class Empregado { private long id; private String nome; private String cargo; private double salario; public Empregado() {} public Empregado(long id, String n, String c, double s) { this.id = id; nome = n; cargo = c; salario = s; } public long getId() { return id; } public String getNome() { return nome; } public double getSalario() { return salario; } public String getCargo() { return cargo; } public void setId(long id) { this.id = id; } public void setNome(String n) { nome = n; } public void setSalario(double s) { salario = s; } public void setCargo(String c) { cargo = c; } }
[ "fkay13@gmail.com" ]
fkay13@gmail.com
818fa9e88170aef49a346148a82d7d298cd1d2f1
f6ffe6f4066f882fbcd021c128d55d98fcf5048a
/src/main/java/br/com/cnova/api/v2/model/ItemsSandbox.java
e775e5b36cf1d6239afa8ce2018355c6db94f46f
[]
no_license
cherri-sensedia/CNova-ApiLojistaV2-SDK-Java
c387d578e781c555628b39ef4bcffe5463c1a23c
9f21308682cc4fbb4d3841798ba9ff60165de273
refs/heads/master
2020-05-30T11:39:31.128728
2015-06-22T17:23:49
2015-06-22T17:23:49
37,672,457
0
0
null
null
null
null
UTF-8
Java
false
false
1,858
java
package br.com.cnova.api.v2.model; import io.swagger.annotations.*; import com.fasterxml.jackson.annotation.JsonProperty; @ApiModel(description = "") public class ItemsSandbox { private String skuSellerId = null; private String name = null; private Double salePrice = null; private Integer quantity = null; /** * SKU ID do produto do Lojista **/ @ApiModelProperty(required = true, value = "SKU ID do produto do Lojista") @JsonProperty("skuSellerId") public String getSkuSellerId() { return skuSellerId; } public void setSkuSellerId(String skuSellerId) { this.skuSellerId = skuSellerId; } /** * Nome do produto **/ @ApiModelProperty(required = true, value = "Nome do produto") @JsonProperty("name") public String getName() { return name; } public void setName(String name) { this.name = name; } /** * Preço de venda **/ @ApiModelProperty(required = true, value = "Preço de venda") @JsonProperty("salePrice") public Double getSalePrice() { return salePrice; } public void setSalePrice(Double salePrice) { this.salePrice = salePrice; } /** * Quantidade produtos **/ @ApiModelProperty(required = true, value = "Quantidade produtos") @JsonProperty("quantity") public Integer getQuantity() { return quantity; } public void setQuantity(Integer quantity) { this.quantity = quantity; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ItemsSandbox {\n"); sb.append(" skuSellerId: ").append(skuSellerId).append("\n"); sb.append(" name: ").append(name).append("\n"); sb.append(" salePrice: ").append(salePrice).append("\n"); sb.append(" quantity: ").append(quantity).append("\n"); sb.append("}\n"); return sb.toString(); } }
[ "luiz.cherri@sensedia.com" ]
luiz.cherri@sensedia.com
10f50088fa0ba35cf4318bc98ceefffdb03166aa
d6b8e985214ea4a9fa944f735b0eded194b12e71
/src/main/java/com/gtcgroup/justify/rest/testing/extension/JstConfigureTestingREST.java
11040b0c7a7377767d0d0865a512875f7e0a9090
[ "MIT" ]
permissive
gtcGroup/justify-rest
2bd7855e9bbdf001ebf4e2190b719c1ae17633ac
1fb1ea2b90e1a71b1a40eff2c5c9274248889bc4
refs/heads/master
2020-04-16T17:44:21.447757
2018-05-02T18:58:39
2018-05-02T18:58:39
55,171,103
0
0
null
null
null
null
UTF-8
Java
false
false
2,236
java
/* * [Licensed per the Open Source "MIT License".] * * Copyright (c) 2006 - 2018 by * Global Technology Consulting Group, Inc. at * http://gtcGroup.com * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.gtcgroup.justify.rest.testing.extension; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.Extension; /** * This {@link Extension} class initializes system properties for the duration * of the test class and then reinstates the original values. * * <p style="font-family:Verdana; font-size:10px; font-style:italic"> * Copyright (c) 2006 - 2018 by Global Technology Consulting Group, Inc. at * <a href="http://gtcGroup.com">gtcGroup.com </a>. * </p> * * @author Marvin Toll * @since 8.5 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @ExtendWith(ConfigureTestingRestExtension.class) public @interface JstConfigureTestingREST { Class<? extends JstConfigureTestingRestPO> configureTestingRestPO(); }
[ "MarvinToll@gtcGroup.com" ]
MarvinToll@gtcGroup.com
f8e6649417aff4a66a91d30ec25a37bad4a33c66
b7742e2c856e7c425608b4a70c297ec27473b135
/src/test/java/de/tudarmstadt/ukp/eduseer/core/experiments/APITests.java
109e00c6845b16f9574895f08c13880a254d6918
[]
no_license
EduSeer/EduSeer
bc50d95b052ed1b4f3c4eadd3dca38bfdd801d17
f0901cd2a1e4c5ce21cf012c7126242075788154
refs/heads/master
2020-04-07T19:09:57.363988
2013-08-16T09:45:18
2013-08-16T09:45:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,980
java
/******************************************************************************* * Copyright 2013 * Ubiquitous Knowledge Processing (UKP) Lab * Technische Universität Darmstadt * * 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 de.tudarmstadt.ukp.eduseer.core.experiments; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import javax.annotation.Resource; import javax.sql.DataSource; import org.apache.commons.io.IOUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.TransactionConfiguration; import edu.psu.citeseerx.dao2.logic.CSXDAO; import edu.psu.citeseerx.domain.Author; import edu.psu.citeseerx.domain.Citation; import edu.psu.citeseerx.domain.Document; /** * This is a collection of tests that demonstrate how to use the SeerSuite API. * * @author Roland Kluge * */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:conf/applicationContext-csx-jdbc.xml" }) @TransactionConfiguration(transactionManager = "csxTxManager", defaultRollback = true) public class APITests extends AbstractTransactionalJUnit4SpringContextTests { @Autowired public CSXDAO csxDAO; @Override @Resource(name = "csxDataSource") public void setDataSource(final DataSource dataSource) { this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource); } /** * Demonstrates how to iterate over all DOIs. */ @Test public void testGetAllDOIs() throws Exception { final List<String> alldois = this.csxDAO.getAllDOIs(); System.out.println("DOIs in database: " + alldois); } /** * Demonstrates how to access the fulltext of a document. Note that "available types" are the * supported document types from the end user perspektive (such as PDF, PS,...) */ @Test public void testGetFullText() throws Exception { final List<Document> docs = this.getDocumentsByPattern(".*Eltern helfen Eltern.*"); for (final Document doc : docs) { System.out.println(doc.getDatum(Document.TITLE_KEY)); final String doi = doc.getDatum(Document.DOI_KEY); final String repID = this.csxDAO.getRepositoryID(doi); final List<String> availableFiletypes = this.csxDAO.getFileTypes(doi, repID); System.out.println("Available types: " + availableFiletypes); System.out.println(); FileInputStream inputStream = null; try { inputStream = this.csxDAO.getFileInputStream(doi, repID, "xml"); final Scanner scanner = new Scanner(inputStream); final int maxLines = 30; int lines = 0; while (scanner.hasNextLine() && lines < maxLines) { System.out.println(scanner.nextLine()); ++lines; } } catch (final IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(inputStream); } } } /** * Demonstrates how to obtain the file system path to a document's file. */ @Test public void testGetPathToDocument() throws Exception { final List<Document> docs = this.getDocumentsByPattern(".*Eltern helfen Eltern.*"); for (final Document doc : docs) { final String doi = doc.getDatum(Document.DOI_KEY); final String repID = this.csxDAO.getRepositoryID(doi); final String path = this.csxDAO.getPath(doi, repID, "pdf"); System.out.println(String.format("%s: %s", doi, path)); } } /** * Demonstrates how to extract the authors of a paper */ @Test public void testGetAuthors() throws Exception { final List<Document> docs = this.getDocumentsByPattern(".*Eltern helfen Eltern.*"); for (final Document doc : docs) { System.out.println(doc.getDatum(Document.TITLE_KEY)); System.out.println("Authors: "); for (final Author author : doc.getAuthors()) { final String name = author.getDatum(Author.NAME_KEY); final String mail = author.getDatum(Author.EMAIL_KEY); System.out.println(String.format("\t%s (Mail: %s)", name, mail)); } } } /** * Demonstrates how to extract the citations of a paper */ @Test public void testGetCitations() throws Exception { final List<Document> docs = this .getDocumentsByPattern(".*Erziehungskompetenzen bei jugendlichen Müttern.*"); for (final Document doc : docs) { System.out.println(doc.getDatum(Document.TITLE_KEY)); System.out.print("Citations: "); for (final Citation citation : doc.getCitations()) { final List<String> authors = citation.getAuthorNames(); final String title = citation.getDatum(Citation.TITLE_KEY); final String year = citation.getDatum(Citation.YEAR_KEY); System.out.println(String.format("\t\"%s\" by %s(%s)", title, authors, year)); } } } /** * Returns all documents that have a title matching the given pattern. * * @param pattern * the pattern to match the document title against * @return all matching documents */ private List<Document> getDocumentsByPattern(final String pattern) { final List<Document> docs = new ArrayList<Document>(); final List<String> alldois = this.csxDAO.getAllDOIs(); for (final String doi : alldois) { /* * During filtering, we are only interested in the document's title. Loading all * document metadata would take significantly longer! */ final Document doc = this.csxDAO.getDocumentFromDB(doi); final String title = doc.getDatum(Document.TITLE_KEY); if (title != null && title.matches(pattern)) { final boolean getCitations = true; final boolean getContexts = true; final boolean getSource = true; final boolean getKeywords = true; final boolean getTags = true; final boolean getAcknowledgements = true; final Document fullDoc = this.csxDAO.getDocumentFromDB(doi, getCitations, getContexts, getSource, getAcknowledgements, getKeywords, getTags); docs.add(fullDoc); } } return docs; } }
[ "kluge@ukp.informatik.tu-darmstadt.de" ]
kluge@ukp.informatik.tu-darmstadt.de
1a03cf6617bdc6a4d04c07115c56366d7240bd7c
be4c64d319d9b2f1231609d75099ad8a0ea7cb54
/sdks/java/http_client/v1/src/test/java/org/openapitools/client/model/V1IntervalScheduleTest.java
64540aeeb691a2161c097a6b6a94b7cc194b9d94
[ "Apache-2.0" ]
permissive
wxrui/polyaxon
2a65069352c58edf1e2072f8f29b031f635809d5
57a01ed33faca41c8aa42594a9efe15ad0448cee
refs/heads/master
2022-11-14T06:19:28.159632
2020-06-27T21:01:38
2020-06-27T21:01:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,413
java
// Copyright 2018-2020 Polyaxon, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /* * Polyaxon SDKs and REST API specification. * Polyaxon SDKs and REST API specification. * * The version of the OpenAPI document: 1.1.0-rc0 * Contact: contact@polyaxon.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package org.openapitools.client.model; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import org.threeten.bp.OffsetDateTime; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** * Model tests for V1IntervalSchedule */ public class V1IntervalScheduleTest { private final V1IntervalSchedule model = new V1IntervalSchedule(); /** * Model tests for V1IntervalSchedule */ @Test public void testV1IntervalSchedule() { // TODO: test V1IntervalSchedule } /** * Test the property 'kind' */ @Test public void kindTest() { // TODO: test kind } /** * Test the property 'startAt' */ @Test public void startAtTest() { // TODO: test startAt } /** * Test the property 'endAt' */ @Test public void endAtTest() { // TODO: test endAt } /** * Test the property 'frequency' */ @Test public void frequencyTest() { // TODO: test frequency } /** * Test the property 'dependsOnPast' */ @Test public void dependsOnPastTest() { // TODO: test dependsOnPast } }
[ "mouradmourafiq@gmail.com" ]
mouradmourafiq@gmail.com
58aa43c6f8f8537f300a6d7861537cac1b4fdf83
e461b9da5a362a6ab7f56ef7abe51f74d85116a5
/src/lk/IdeaPOS/Controllers/GRNItemSearchController.java
e67bc5a8e8f387775c1dbce3f721c064ad468348
[]
no_license
sachingimhan/ideaPOS
43e56f2a632d5f2276a39500e1ff1001322599b3
254f748d598691a048b0f29321cc89b83037ea93
refs/heads/master
2022-12-09T19:09:04.510495
2020-09-08T11:20:05
2020-09-08T11:20:05
259,994,721
0
0
null
null
null
null
UTF-8
Java
false
false
5,270
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 lk.IdeaPOS.Controllers; import java.io.IOException; import java.net.URL; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ResourceBundle; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.Stage; import lk.IdeaPOS.Model.Item; import lk.IdeaPOS.Util.DBUtil; import lk.IdeaPOS.Util.MessageBox; /** * FXML Controller class * * @author root */ public class GRNItemSearchController implements Initializable { @FXML private TextField txtFilter; @FXML private TableView<Item> tblFindItem; @FXML private TableColumn<Item, String> colItemCode; @FXML private TableColumn<Item, String> colItemName; @FXML private TableColumn<Item, Integer> colItemQty; @FXML private TableColumn<Item, Double> colDiscount; @FXML private Button btnFind; @FXML private Button btnExit; /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { //Init Table Column colItemCode.setCellValueFactory(new PropertyValueFactory<>("itemCode")); colItemName.setCellValueFactory(new PropertyValueFactory<>("itemName")); colItemQty.setCellValueFactory(new PropertyValueFactory<>("itemQty")); colDiscount.setCellValueFactory(new PropertyValueFactory<>("discount")); // tblFindItem.setItems(loadItem()); txtFilter.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { tblFindItem.setItems(searchFilterItem(newValue)); } }); } private ObservableList<Item> loadItem() { try { PreparedStatement pst = DBUtil.getInstance().getConnection().prepareStatement("SELECT * FROM Item"); ResultSet rs = pst.executeQuery(); ObservableList<Item> list = FXCollections.observableArrayList(); while (rs.next()) { list.add(new Item( rs.getString("itemCode"), rs.getString("itemName"), rs.getDouble("costPrice"), rs.getDouble("retailPrice"), rs.getDouble("wholeSalePrice"), rs.getInt("itemQty"), rs.getDouble("discount"), rs.getInt("reorderLevel") )); } return list; } catch (ClassNotFoundException | SQLException ex) { MessageBox.showErrorMessage(ex.toString(), "Error"); } return null; } private ObservableList<Item> searchFilterItem(String filter) { try { PreparedStatement pst = DBUtil.getInstance().getConnection().prepareStatement("SELECT * FROM Item WHERE CONCAT(itemCode,itemName) LIKE '%" + filter + "%'"); ResultSet rs = pst.executeQuery(); ObservableList<Item> list = FXCollections.observableArrayList(); while (rs.next()) { list.add(new Item( rs.getString("itemCode"), rs.getString("itemName"), rs.getDouble("costPrice"), rs.getDouble("retailPrice"), rs.getDouble("wholeSalePrice"), rs.getInt("itemQty"), rs.getDouble("discount"), rs.getInt("reorderLevel") )); } return list; } catch (ClassNotFoundException | SQLException ex) { MessageBox.showErrorMessage(ex.toString(), "Error"); } return null; } @FXML private void btnFind_OnAction(ActionEvent event) throws IOException { Stage window = (Stage) btnFind.getScene().getWindow(); if (tblFindItem.getSelectionModel().getSelectedItem() != null) { //getItem(); window.close(); return; } if (tblFindItem.getItems().isEmpty()) { window.close(); } } private Item selectedItem; public Item getItem() { selectedItem = tblFindItem.getSelectionModel().getSelectedItem(); if (selectedItem == null) { selectedItem = new Item(); } return selectedItem; } @FXML private void btnExit_OnAction(ActionEvent event) { Stage window = (Stage) btnFind.getScene().getWindow(); selectedItem = new Item(); window.close(); } }
[ "sachingimhan8@gmail.com" ]
sachingimhan8@gmail.com
c95cfa9c66c9d3eaf138d43f9e4e44b1a4f53567
91c6f7ffe48ede9ad8cfea851447cfc476aa301d
/src/main/java/com/wpx/spring/demo18/AccountDaoImpl.java
1d0e7cf9a26f34e60e7daad3db475b5a7a893287
[]
no_license
vclisunlang/javaee
db09ba0231378bf14302dbacfd637eabd642e0bb
ac30acfea9765460bd3a15ffbc9c46998c24e19f
refs/heads/master
2021-05-11T05:17:25.099359
2018-01-17T12:34:15
2018-01-17T12:34:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
505
java
package com.wpx.spring.demo18; import org.springframework.jdbc.core.support.JdbcDaoSupport; public class AccountDaoImpl extends JdbcDaoSupport implements AccountDao { public void in(String to, Double money) { String sql="UPDATE account SET money = money + ? WHERE NAME= ? "; this.getJdbcTemplate().update(sql, money,to); } public void out(String from, Double money) { String sql="UPDATE account SET money = money - ? WHERE NAME= ? "; this.getJdbcTemplate().update(sql, money,from); } }
[ "1256317570@qq.com" ]
1256317570@qq.com
d48459a5e14b66f2f88a9eb024e0b46b78b3cb12
4ccf4a03fa683e15ee0465b136f52c9e6f9f9e28
/14301139/JavaServlet/src/Constants.java
8cd90e9e11d88a13c948ab7f87260f55a75ce9ea
[]
no_license
YxcL1/homework3
4de5ac08a2167ab9d36d4b1d3e6a7f84b4129aaf
434296022819d8128a09aedf8821725ca7628172
refs/heads/master
2021-01-11T02:55:36.935089
2016-10-14T12:43:27
2016-10-14T12:43:27
70,907,226
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
import java.io.File; public class Constants { public static final String WEB_ROOT = System.getProperty("user.dir") + File.separator + "webroot"; }
[ "14301139@bjtu.edu.cn" ]
14301139@bjtu.edu.cn
ca47d90d950eb03448fdde1b3214afa006af9404
4154a8b63e2e58dcbbe69c170577fafbb4bfb312
/src/me/rezscripts/rpgexperience/commands/AbstractCommand.java
f0724b951a56d277601cd0853e344e207b55d30b
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
RezScripts/RPGCore
2d56d1c367da482388098353915a308f02cf1066
b66110cd950712db874b63b8443fe4d0eebabd27
refs/heads/master
2020-05-01T06:26:10.137940
2019-03-23T19:29:26
2019-03-23T19:29:26
177,330,134
0
0
null
null
null
null
UTF-8
Java
false
false
2,672
java
package me.rezscripts.rpgexperience.commands; import java.util.Arrays; import me.rezscripts.rpgexperience.PlayerData; import me.rezscripts.rpgexperience.RPGCore; import me.rezscripts.rpgexperience.players.Rank; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; import org.bukkit.event.Listener; public abstract class AbstractCommand extends Command implements CommandExecutor, Listener { public static RPGCore plugin; protected Rank requiredRank = Rank.MEMBER; @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (command == null) return false; if (sender == null) return false; if (!command.getName().equalsIgnoreCase(getName())) return false; if (sender instanceof Player) { Player p = (Player) sender; PlayerData pd = plugin.getPD(p); if (pd == null || !pd.loadedSQL) { p.sendMessage(ChatColor.RED + "Please wait a moment while your data is loaded."); return true; } if (!pd.check(requiredRank)) { p.sendMessage(ChatColor.RED + "You don't have permission to use that command!"); return true; } execute(sender, args); executePlayer(p, pd, args); } else if (sender instanceof ConsoleCommandSender) { execute(sender, args); executeConsole(sender, args); } System.out.println("Executing /" + command.getName() + " for " + sender.getName() + " with args " + Arrays.toString(args)); return true; } @Override public boolean execute(CommandSender sender, String commandLabel, String[] args) { return this.onCommand(sender, this, commandLabel, args); } /* * Run by both player and console executions. */ public abstract void execute(CommandSender sender, String[] args); /* * Special execution for player command. */ public abstract void executePlayer(Player p, PlayerData pd, String[] args); /* * Special execution for console command. */ public abstract void executeConsole(CommandSender sender, String[] args); public AbstractCommand(String... commandNames) { super(commandNames[0]); if (commandNames.length > 1) for (int k = 1; k < commandNames.length; k++) getAliases().add(commandNames[k]); } }
[ "47779938+RezScripts@users.noreply.github.com" ]
47779938+RezScripts@users.noreply.github.com
d9fc9bb2faa74127dd928936b382a3252e50cc3e
a90f075cfd9b2d4a2d4b09f63289ec7bd28d8de0
/src/main/java/cc/xpbootcamp/code_smell_kit/$04_long_parameter_list/Gui.java
e95cba8b063ddaaa42a11d9c6c691f6afa7c5569
[]
no_license
lianej/refactor-gym-code-smell-202002
57609022f7ef0ca277c15265f91b0c6a524ae3a5
40c9c2b02560289540960451ccd2562170ed4159
refs/heads/master
2021-01-16T02:42:23.145960
2020-02-28T09:22:28
2020-02-28T09:22:28
242,948,777
0
1
null
2020-02-25T08:31:02
2020-02-25T08:31:02
null
UTF-8
Java
false
false
1,325
java
package cc.xpbootcamp.code_smell_kit.$04_long_parameter_list; import java.awt.event.KeyListener; import java.io.File; import javax.swing.JFrame; import javax.swing.JPanel; /** * This class is the graphical user interface for the game */ public class Gui extends JFrame { //_long_parameter_list public Gui(KeyListener listener, JPanel gameInterface, JPanel battleInterface, JPanel inventoryInterface, JPanel startingScene, JPanel endingScene, JPanel victoryScene, JPanel textBox) { JFrame window = new JFrame(); window.setTitle("MAZE RPG"); window.addKeyListener(listener); window.setResizable(true); window.setSize(665, 750); window.setLayout(null); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().add(startingScene); window.getContentPane().add(gameInterface); window.getContentPane().add(battleInterface); window.getContentPane().add(inventoryInterface); window.getContentPane().add(endingScene); window.getContentPane().add(victoryScene); window.getContentPane().add(textBox); textBox.setLocation(5, 650); gameInterface.setVisible(false); battleInterface.setVisible(false); inventoryInterface.setVisible(false); endingScene.setVisible(false); victoryScene.setVisible(false); textBox.setVisible(false); window.setVisible(true); } }
[ "wjyan@thoughtworks.com" ]
wjyan@thoughtworks.com
163d2073d08bea9cf413942b5d51f1b8a2ad7f2e
69b8422a9cbd68c74aa4b99b728c796c06e9fae5
/src/java/br/com/Seguradora/web/vh/ClienteTerceiroViewHelper.java
8a2ce72e57b4b0a289a5207924c9efdcd91c3100
[]
no_license
AmorimVinicius/FATEC
63162685322beb33fd744041158fe30183d5cc74
43459afd50808c8211611cefa7d2b39177ddb5f4
refs/heads/master
2022-11-16T02:59:33.915015
2020-07-10T00:46:09
2020-07-10T00:46:09
278,502,212
0
0
null
null
null
null
UTF-8
Java
false
false
8,598
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 br.com.Seguradora.web.vh; import br.com.Seguradora.core.fachada.Resultado; import br.com.Seguradora.dominio.Apolice; import br.com.Seguradora.dominio.CausasNaturais; import br.com.Seguradora.dominio.Cliente; import br.com.Seguradora.dominio.ClienteTerceiro; import br.com.Seguradora.dominio.Endereco; import br.com.Seguradora.dominio.EntidadeDominio; import br.com.Seguradora.dominio.Sinistro; import br.com.Seguradora.dominio.Veiculo; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author viniciusamorim */ public class ClienteTerceiroViewHelper implements IViewHelper{ Veiculo veiculo; Cliente cliente; Apolice apolice; Endereco endereco; Sinistro sinistro; ClienteTerceiro clienteTerceiro; @Override public EntidadeDominio getEntidade(HttpServletRequest request) { String operacao = request.getParameter("operacao"); if (operacao.equals("SALVAR")){ veiculo = new Veiculo(); cliente = new Cliente(); apolice = new Apolice(); endereco = new Endereco(); sinistro = new Sinistro(); clienteTerceiro = new ClienteTerceiro(); String descricao = request.getParameter("descricao"); String idCliente = request.getParameter("idCliente"); String idVeiculo = request.getParameter("idVeiculo"); String idSinistro = request.getParameter("idSinistro"); clienteTerceiro.setOperacao(operacao); if (descricao != null && !descricao.trim().equals("")) { clienteTerceiro.setDescricao(descricao); } if (idCliente != null && !idCliente.trim().equals("")) { cliente.setId(Integer.parseInt(idCliente)); } if (idVeiculo != null && !idVeiculo.trim().equals("")) { veiculo.setId(Integer.parseInt(idVeiculo)); } if (idSinistro != null && !idSinistro.trim().equals("")) { sinistro.setId(Integer.parseInt(idSinistro)); } clienteTerceiro.setCliente(cliente); clienteTerceiro.setVeiculo(veiculo); clienteTerceiro.setSinistro(sinistro); return clienteTerceiro; } if (operacao.equals("CONSULTAR")) { String op = request.getParameter("operacao"); clienteTerceiro = new ClienteTerceiro(); if (op != null && !"".equals(op)) { clienteTerceiro.setId(Integer.parseInt(request.getParameter("id"))); return clienteTerceiro; } else { clienteTerceiro = new ClienteTerceiro(); return clienteTerceiro; } } if (operacao.equals("LISTARFILTRO")) { veiculo = new Veiculo(); cliente = new Cliente(); apolice = new Apolice(); sinistro = new Sinistro(); clienteTerceiro = new ClienteTerceiro(); String status = request.getParameter("opStatus"); String documento = request.getParameter("documento"); String placa = request.getParameter("placa"); clienteTerceiro.setOperacao(operacao); if (status.equals("0")) { clienteTerceiro.setStatus(0); } else { clienteTerceiro.setStatus(1); } if (documento != null && !documento.trim().equals("")) { cliente.setNome(documento); } if (placa != null && !placa.trim().equals("")) { veiculo.setPlaca(placa); } clienteTerceiro.setCliente(cliente); clienteTerceiro.setVeiculo(veiculo); return clienteTerceiro; } String uri = request.getRequestURI(); if (uri.equals("/Seguradora/clienteTerceiro/preAtualizar")) { operacao = "PREATUALIZAR"; } if (operacao.equals("EXCLUIR")) { clienteTerceiro = new ClienteTerceiro(); clienteTerceiro.setId(Integer.parseInt(request.getParameter("id"))); String status = request.getParameter("opStatus"); if (status != null && status.trim().equals("")) { if ("1".equals(status)) { clienteTerceiro.setStatus(1); } } return clienteTerceiro; } return clienteTerceiro; } @Override public void setView(Resultado resultado, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { RequestDispatcher rd = null; //Recebe operação do formulário, na request. String operacao = request.getParameter("operacao"); if (operacao.equals("SALVAR")) { if (resultado.getMsg() != null) { request.getSession().setAttribute("mensagem", resultado.getMsg()); rd = request.getRequestDispatcher("cadastrarClienteTerceiro.jsp"); } else { request.getSession().setAttribute("resultado", resultado.getEntidades()); //request.getSession().setAttribute("auditoria", resultado.getEntidade()); rd = request.getRequestDispatcher("paginaClienteTerceiro.jsp"); } } if (operacao.equals("ALTERAR")) { if (resultado.getMsg() != null) { request.getSession().setAttribute("mensagem", resultado.getMsg()); request.getSession().setAttribute("resultado", resultado.getEntidades()); rd = request.getRequestDispatcher("atualizarClienteTerceiro.jsp"); } else { request.getSession().setAttribute("resultado", resultado.getEntidades()); //request.getSession().setAttribute("auditoria", resultado.getEntidade()); rd = request.getRequestDispatcher("paginaClienteTerceiro.jsp"); } } if (operacao.equals("CONSULTAR")) { if (resultado.getMsg() != null) { request.getSession().setAttribute("mensagem", resultado.getMsg()); rd = request.getRequestDispatcher("consultarClienteTerceiro.jsp"); } else { request.getSession().setAttribute("resultado", resultado.getEntidades()); rd = request.getRequestDispatcher("consultarClienteTerceiro.jsp"); } } //fim consultar if (operacao.equals("LISTARFILTRO")) { if (resultado.getMsg() != null) { request.getSession().setAttribute("mensagem", resultado.getMsg()); rd = request.getRequestDispatcher("consultarClienteTerceiro.jsp"); } else { request.getSession().setAttribute("resultado", resultado.getEntidades()); rd = request.getRequestDispatcher("consultarClienteTerceiro.jsp"); } } //fim consultar if (operacao.equals("PREATUALIZAR")) { if (resultado.getMsg() != null) { request.getSession().setAttribute("mensagem", resultado.getMsg()); rd = request.getRequestDispatcher("consultarClienteTerceiro.jsp"); } else { request.getSession().setAttribute("resultado", resultado.getEntidades()); rd = request.getRequestDispatcher("atualizarClienteTerceiro.jsp"); } } //fim consultar if (operacao.equals("EXCLUIR")) { if (resultado.getMsg() != null) { request.getSession().setAttribute("mensagem", resultado.getMsg()); rd = request.getRequestDispatcher("consultarClienteTerceiro.jsp"); } else { request.getSession().setAttribute("resultado", resultado.getEntidade()); rd = request.getRequestDispatcher("consultarClienteTerceiro.jsp"); } } rd.forward(request, response); } }
[ "viniciusdamorim@gmail.com" ]
viniciusdamorim@gmail.com
0fc9682d8bb2d8d5d02d83932c394a7b88394844
6820241ca1717749a489e63ac5da5808612099dd
/src/main/java/com/hash/p79/application/EbMessageDigest.java
94d3778b045da1dc6387c5399c5d4f594e6f8475
[]
no_license
venkynary/p79_hash_app_v2
241c8833dc6e1c4a96426cd6d3681c6ba2440fdb
50f50b1133e39b8ce05d5e792aa241ea4f8ffd56
refs/heads/master
2022-12-25T18:23:42.752660
2020-10-05T22:28:26
2020-10-05T22:28:26
301,555,225
0
0
null
null
null
null
UTF-8
Java
false
false
114
java
package com.hash.p79.application; public interface EbMessageDigest { public String digest(String message); }
[ "30704154+venkynary@users.noreply.github.com" ]
30704154+venkynary@users.noreply.github.com
d04109a0e24a93cb6da571db7e8938f6c0e205d0
c831a6dcde688a5b6fd463bb5ed741c861e15959
/Follow/src/com/example/wo/Goals.java
87722116a212d297a48f88f6e1be982ca2a7155f
[]
no_license
wangchaohu/follow
5b3914474d03e9dda743a2a904fc8894df5f5327
68c239c8da39027ca30537f09babfb889a39cea7
refs/heads/master
2021-06-02T21:14:01.476505
2016-03-27T10:31:37
2016-03-27T10:31:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
434
java
package com.example.wo; import com.example.changepage1.R; import android.app.Activity; import android.os.Bundle; import android.view.Window; public class Goals extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.goals); } }
[ "xwangch@wangchaohudeMacBook-Air.local" ]
xwangch@wangchaohudeMacBook-Air.local
dfc6f56d1b7553c094965783d30a6a4d0b8dcf71
3acfb6df11412013c50520e812b2183e07c1a8e5
/investharyana/src/main/java/com/hartron/investharyana/service/dto/StateDTO.java
7fec4f6e60b067793fc695e89fdf9095bc1eba3e
[]
no_license
ramanrai1981/investharyana
ad2e5b1d622564a23930d578b25155d5cc9ec97a
b8f359c120f6dae456ec0490156cf34fd0125a30
refs/heads/master
2021-01-19T08:29:32.042236
2017-04-14T18:34:50
2017-04-14T18:34:50
87,635,613
0
0
null
null
null
null
UTF-8
Java
false
false
1,450
java
package com.hartron.investharyana.service.dto; import javax.validation.constraints.*; import java.io.Serializable; import java.util.Objects; import java.util.UUID; /** * A DTO for the State entity. */ public class StateDTO implements Serializable { private UUID id; @NotNull private String statename; private String countryname; public UUID getId() { return id; } public void setId(UUID id) { this.id = id; } public String getStatename() { return statename; } public void setStatename(String statename) { this.statename = statename; } public String getCountryname() { return countryname; } public void setCountryname(String countryname) { this.countryname = countryname; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } StateDTO stateDTO = (StateDTO) o; if ( ! Objects.equals(id, stateDTO.id)) { return false; } return true; } @Override public int hashCode() { return Objects.hashCode(id); } @Override public String toString() { return "StateDTO{" + "id=" + id + ", statename='" + statename + "'" + ", countryname='" + countryname + "'" + '}'; } }
[ "raman.kumar.rai@gmail.com" ]
raman.kumar.rai@gmail.com
661ccbf128fb88d914b1fa3094fb6e1960d43ae2
a8741cd41b651769eaa100b9658b62c90fdd2b0d
/AutomatedServer/src/com/leapfrog/DAO/ClientDAO.java
fdfb7e982a04abae085d37131dc1c1f1de1f31a5
[]
no_license
binodG/AutomatedServer
99a940905c754d4a8090c59553d9e562bde87114
2e1729f548df14dabe12003d12ef58b45d42a3d6
refs/heads/master
2020-04-06T07:10:21.918663
2016-08-30T08:33:58
2016-08-30T08:33:58
60,150,342
0
0
null
null
null
null
UTF-8
Java
false
false
500
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.leapfrog.DAO; import com.leapfrog.Entity.Client; import java.net.Socket; import java.util.List; /** * * @author BkoNod */ public interface ClientDAO { public void addUser(Client c); List<Client> getALL(); Client getBySocket(Socket socket); Client getByUserName(String username); }
[ "gbnod55@gmail.com" ]
gbnod55@gmail.com
a09e985b5afa325bf1e5bb4ca1ef4f883f4c045f
d2ee192942776c94b828acc4580caf75c62c9d67
/src/main/java/com/havving/system/service/StoreService.java
59fde5d2dc4a4a151a88fa52ebf7caa215bf68c5
[]
no_license
havving/SysCollector
76df6cdf0a040ffbfd008ad423d0566a03231842
b3f86fe9b5473deecf56c4f8073e7d1cade4d959
refs/heads/master
2023-07-01T18:16:22.610000
2021-08-08T12:53:38
2021-08-08T12:53:38
343,346,900
0
0
null
null
null
null
UTF-8
Java
false
false
292
java
package com.havving.system.service; import com.havving.system.domain.SysModel; import java.util.List; /** * Created by HAVVING on 2021-03-19. */ public interface StoreService { void store(List<SysModel> models); void store(SysModel model); void setClient(Object client); }
[ "sparkle5406@gmail.com" ]
sparkle5406@gmail.com
6ae815211d601aefa1ae0005e7e3449fa1de7b09
1a0f3b5e094b19f6e6d8e52815666d583c521cb9
/src/main/java/com/wolves/admin/pb/WhereIsResponse.java
09783a74a41d3eafe1a4a8d9b1f6451c28098369
[]
no_license
zhanghuanhuan123/wolves-protocol
2cf4d354a5124384c65067cfbd10b91ef8534a48
e4a60fb41bd779047585d7fe85171344d2955722
refs/heads/master
2021-05-10T10:49:52.459151
2018-01-22T03:27:48
2018-01-22T03:27:48
118,393,770
0
0
null
null
null
null
UTF-8
Java
false
true
23,971
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: admin_com.proto package com.wolves.admin.pb; /** * Protobuf type {@code WhereIsResponse} */ public final class WhereIsResponse extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:WhereIsResponse) WhereIsResponseOrBuilder { private static final long serialVersionUID = 0L; // Use WhereIsResponse.newBuilder() to construct. private WhereIsResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private WhereIsResponse() { nodes_ = java.util.Collections.emptyList(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private WhereIsResponse( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownFieldProto3( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { nodes_ = new java.util.ArrayList<com.wolves.admin.pb.Node>(); mutable_bitField0_ |= 0x00000001; } nodes_.add( input.readMessage(com.wolves.admin.pb.Node.parser(), extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { nodes_ = java.util.Collections.unmodifiableList(nodes_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.wolves.admin.pb.AdminCom.internal_static_WhereIsResponse_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.wolves.admin.pb.AdminCom.internal_static_WhereIsResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( com.wolves.admin.pb.WhereIsResponse.class, com.wolves.admin.pb.WhereIsResponse.Builder.class); } public static final int NODES_FIELD_NUMBER = 1; private java.util.List<com.wolves.admin.pb.Node> nodes_; /** * <code>repeated .Node nodes = 1;</code> */ public java.util.List<com.wolves.admin.pb.Node> getNodesList() { return nodes_; } /** * <code>repeated .Node nodes = 1;</code> */ public java.util.List<? extends com.wolves.admin.pb.NodeOrBuilder> getNodesOrBuilderList() { return nodes_; } /** * <code>repeated .Node nodes = 1;</code> */ public int getNodesCount() { return nodes_.size(); } /** * <code>repeated .Node nodes = 1;</code> */ public com.wolves.admin.pb.Node getNodes(int index) { return nodes_.get(index); } /** * <code>repeated .Node nodes = 1;</code> */ public com.wolves.admin.pb.NodeOrBuilder getNodesOrBuilder( int index) { return nodes_.get(index); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < nodes_.size(); i++) { output.writeMessage(1, nodes_.get(i)); } unknownFields.writeTo(output); } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < nodes_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, nodes_.get(i)); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.wolves.admin.pb.WhereIsResponse)) { return super.equals(obj); } com.wolves.admin.pb.WhereIsResponse other = (com.wolves.admin.pb.WhereIsResponse) obj; boolean result = true; result = result && getNodesList() .equals(other.getNodesList()); result = result && unknownFields.equals(other.unknownFields); return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getNodesCount() > 0) { hash = (37 * hash) + NODES_FIELD_NUMBER; hash = (53 * hash) + getNodesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.wolves.admin.pb.WhereIsResponse parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.wolves.admin.pb.WhereIsResponse parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.wolves.admin.pb.WhereIsResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.wolves.admin.pb.WhereIsResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.wolves.admin.pb.WhereIsResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.wolves.admin.pb.WhereIsResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.wolves.admin.pb.WhereIsResponse parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.wolves.admin.pb.WhereIsResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.wolves.admin.pb.WhereIsResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.wolves.admin.pb.WhereIsResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.wolves.admin.pb.WhereIsResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.wolves.admin.pb.WhereIsResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.wolves.admin.pb.WhereIsResponse prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code WhereIsResponse} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:WhereIsResponse) com.wolves.admin.pb.WhereIsResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.wolves.admin.pb.AdminCom.internal_static_WhereIsResponse_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.wolves.admin.pb.AdminCom.internal_static_WhereIsResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( com.wolves.admin.pb.WhereIsResponse.class, com.wolves.admin.pb.WhereIsResponse.Builder.class); } // Construct using com.wolves.admin.pb.WhereIsResponse.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { getNodesFieldBuilder(); } } public Builder clear() { super.clear(); if (nodesBuilder_ == null) { nodes_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { nodesBuilder_.clear(); } return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.wolves.admin.pb.AdminCom.internal_static_WhereIsResponse_descriptor; } public com.wolves.admin.pb.WhereIsResponse getDefaultInstanceForType() { return com.wolves.admin.pb.WhereIsResponse.getDefaultInstance(); } public com.wolves.admin.pb.WhereIsResponse build() { com.wolves.admin.pb.WhereIsResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public com.wolves.admin.pb.WhereIsResponse buildPartial() { com.wolves.admin.pb.WhereIsResponse result = new com.wolves.admin.pb.WhereIsResponse(this); int from_bitField0_ = bitField0_; if (nodesBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { nodes_ = java.util.Collections.unmodifiableList(nodes_); bitField0_ = (bitField0_ & ~0x00000001); } result.nodes_ = nodes_; } else { result.nodes_ = nodesBuilder_.build(); } onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.wolves.admin.pb.WhereIsResponse) { return mergeFrom((com.wolves.admin.pb.WhereIsResponse)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.wolves.admin.pb.WhereIsResponse other) { if (other == com.wolves.admin.pb.WhereIsResponse.getDefaultInstance()) return this; if (nodesBuilder_ == null) { if (!other.nodes_.isEmpty()) { if (nodes_.isEmpty()) { nodes_ = other.nodes_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureNodesIsMutable(); nodes_.addAll(other.nodes_); } onChanged(); } } else { if (!other.nodes_.isEmpty()) { if (nodesBuilder_.isEmpty()) { nodesBuilder_.dispose(); nodesBuilder_ = null; nodes_ = other.nodes_; bitField0_ = (bitField0_ & ~0x00000001); nodesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getNodesFieldBuilder() : null; } else { nodesBuilder_.addAllMessages(other.nodes_); } } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.wolves.admin.pb.WhereIsResponse parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.wolves.admin.pb.WhereIsResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.util.List<com.wolves.admin.pb.Node> nodes_ = java.util.Collections.emptyList(); private void ensureNodesIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { nodes_ = new java.util.ArrayList<com.wolves.admin.pb.Node>(nodes_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.wolves.admin.pb.Node, com.wolves.admin.pb.Node.Builder, com.wolves.admin.pb.NodeOrBuilder> nodesBuilder_; /** * <code>repeated .Node nodes = 1;</code> */ public java.util.List<com.wolves.admin.pb.Node> getNodesList() { if (nodesBuilder_ == null) { return java.util.Collections.unmodifiableList(nodes_); } else { return nodesBuilder_.getMessageList(); } } /** * <code>repeated .Node nodes = 1;</code> */ public int getNodesCount() { if (nodesBuilder_ == null) { return nodes_.size(); } else { return nodesBuilder_.getCount(); } } /** * <code>repeated .Node nodes = 1;</code> */ public com.wolves.admin.pb.Node getNodes(int index) { if (nodesBuilder_ == null) { return nodes_.get(index); } else { return nodesBuilder_.getMessage(index); } } /** * <code>repeated .Node nodes = 1;</code> */ public Builder setNodes( int index, com.wolves.admin.pb.Node value) { if (nodesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureNodesIsMutable(); nodes_.set(index, value); onChanged(); } else { nodesBuilder_.setMessage(index, value); } return this; } /** * <code>repeated .Node nodes = 1;</code> */ public Builder setNodes( int index, com.wolves.admin.pb.Node.Builder builderForValue) { if (nodesBuilder_ == null) { ensureNodesIsMutable(); nodes_.set(index, builderForValue.build()); onChanged(); } else { nodesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * <code>repeated .Node nodes = 1;</code> */ public Builder addNodes(com.wolves.admin.pb.Node value) { if (nodesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureNodesIsMutable(); nodes_.add(value); onChanged(); } else { nodesBuilder_.addMessage(value); } return this; } /** * <code>repeated .Node nodes = 1;</code> */ public Builder addNodes( int index, com.wolves.admin.pb.Node value) { if (nodesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureNodesIsMutable(); nodes_.add(index, value); onChanged(); } else { nodesBuilder_.addMessage(index, value); } return this; } /** * <code>repeated .Node nodes = 1;</code> */ public Builder addNodes( com.wolves.admin.pb.Node.Builder builderForValue) { if (nodesBuilder_ == null) { ensureNodesIsMutable(); nodes_.add(builderForValue.build()); onChanged(); } else { nodesBuilder_.addMessage(builderForValue.build()); } return this; } /** * <code>repeated .Node nodes = 1;</code> */ public Builder addNodes( int index, com.wolves.admin.pb.Node.Builder builderForValue) { if (nodesBuilder_ == null) { ensureNodesIsMutable(); nodes_.add(index, builderForValue.build()); onChanged(); } else { nodesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * <code>repeated .Node nodes = 1;</code> */ public Builder addAllNodes( java.lang.Iterable<? extends com.wolves.admin.pb.Node> values) { if (nodesBuilder_ == null) { ensureNodesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, nodes_); onChanged(); } else { nodesBuilder_.addAllMessages(values); } return this; } /** * <code>repeated .Node nodes = 1;</code> */ public Builder clearNodes() { if (nodesBuilder_ == null) { nodes_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { nodesBuilder_.clear(); } return this; } /** * <code>repeated .Node nodes = 1;</code> */ public Builder removeNodes(int index) { if (nodesBuilder_ == null) { ensureNodesIsMutable(); nodes_.remove(index); onChanged(); } else { nodesBuilder_.remove(index); } return this; } /** * <code>repeated .Node nodes = 1;</code> */ public com.wolves.admin.pb.Node.Builder getNodesBuilder( int index) { return getNodesFieldBuilder().getBuilder(index); } /** * <code>repeated .Node nodes = 1;</code> */ public com.wolves.admin.pb.NodeOrBuilder getNodesOrBuilder( int index) { if (nodesBuilder_ == null) { return nodes_.get(index); } else { return nodesBuilder_.getMessageOrBuilder(index); } } /** * <code>repeated .Node nodes = 1;</code> */ public java.util.List<? extends com.wolves.admin.pb.NodeOrBuilder> getNodesOrBuilderList() { if (nodesBuilder_ != null) { return nodesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(nodes_); } } /** * <code>repeated .Node nodes = 1;</code> */ public com.wolves.admin.pb.Node.Builder addNodesBuilder() { return getNodesFieldBuilder().addBuilder( com.wolves.admin.pb.Node.getDefaultInstance()); } /** * <code>repeated .Node nodes = 1;</code> */ public com.wolves.admin.pb.Node.Builder addNodesBuilder( int index) { return getNodesFieldBuilder().addBuilder( index, com.wolves.admin.pb.Node.getDefaultInstance()); } /** * <code>repeated .Node nodes = 1;</code> */ public java.util.List<com.wolves.admin.pb.Node.Builder> getNodesBuilderList() { return getNodesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.wolves.admin.pb.Node, com.wolves.admin.pb.Node.Builder, com.wolves.admin.pb.NodeOrBuilder> getNodesFieldBuilder() { if (nodesBuilder_ == null) { nodesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.wolves.admin.pb.Node, com.wolves.admin.pb.Node.Builder, com.wolves.admin.pb.NodeOrBuilder>( nodes_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); nodes_ = null; } return nodesBuilder_; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFieldsProto3(unknownFields); } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:WhereIsResponse) } // @@protoc_insertion_point(class_scope:WhereIsResponse) private static final com.wolves.admin.pb.WhereIsResponse DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.wolves.admin.pb.WhereIsResponse(); } public static com.wolves.admin.pb.WhereIsResponse getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<WhereIsResponse> PARSER = new com.google.protobuf.AbstractParser<WhereIsResponse>() { public WhereIsResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new WhereIsResponse(input, extensionRegistry); } }; public static com.google.protobuf.Parser<WhereIsResponse> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<WhereIsResponse> getParserForType() { return PARSER; } public com.wolves.admin.pb.WhereIsResponse getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
[ "zhanghuan@jinguxingye.com" ]
zhanghuan@jinguxingye.com
a4ccbbca23dd07647a432bab158723bf4a9cdcc5
87aff6d3c7c8cc195ecc4629043d6cb540d3e15f
/palindrome/CreatePalindromeTest.java
34ef2dfa05947f52266dcf32dfb14201e5150ec5
[]
no_license
debamrita/thoughtworks
7ae950bff555350d09d6a110eebf66d5cd6811f8
a35ebf218c3902a27f2b73e81c7ee3200b72b1ea
refs/heads/master
2022-12-27T18:51:48.920206
2020-07-20T17:36:51
2020-07-20T17:36:51
281,150,329
0
0
null
2020-10-13T23:45:01
2020-07-20T15:11:08
Java
UTF-8
Java
false
false
297
java
/** * */ package com.practice; /** * @author Debamrita * */ public class CreatePalindromeTest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub CreatePalindrome pal = new CreatePalindrome(); pal.getPalindrome(7, 2, 4, 1); } }
[ "68535456+debamrita@users.noreply.github.com" ]
68535456+debamrita@users.noreply.github.com
9336495032d73a0cf0b71474810eabd1a5d77f24
2c3daf7cde5d9b70bc24fed0e833fee34b70afa9
/etriks_platform_portal/eTRIKS_Platform_Portal_Dev/src/java/org/etriks/security/ldap/entry/UserAccountManager.java
a93d681b93e90fa7c4dc65cc1828bb644c36a4af
[]
no_license
pengfei99/Dev_Web
032521e62642de2bfe533d67a0cfe5a8f0baead4
f19768693c4ca37a0234a86d0222ef02811cee66
refs/heads/master
2020-04-16T18:24:01.376164
2019-01-15T13:58:11
2019-01-15T13:58:11
165,818,005
0
0
null
null
null
null
UTF-8
Java
false
false
9,924
java
package org.etriks.security.ldap.entry; /** * Created by pliu on 3/28/14. */ import org.apache.log4j.Logger; import org.etriks.security.encryption.PasswordEncrytor; import org.etriks.security.ldap.authentication.LdapAuthenticator; import org.etriks.security.ldap.entry.exception.ChangeMailStatus; import org.etriks.security.ldap.entry.exception.ChangePasswordStatus; import org.etriks.security.ldap.serverprofile.LdapServerConnectorConfig; import javax.naming.NameClassPair; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class UserAccountManager extends LdapEntryManager { //create an logger instance private final Logger log=Logger.getLogger(getClass()); private String entryParentDir; private List<String> userEntryObjClasses=new ArrayList<String>(); private LdapServerConnectorConfig ldapServerInfo; /* * In the constructor, we set the parent directory path of the user account entry * then we load the object class of the user account entry */ public UserAccountManager(LdapServerConnectorConfig ldapServerInfo,String searchBase,String entryParentDir){ super(ldapServerInfo,searchBase); this.ldapServerInfo=ldapServerInfo; this.entryParentDir=entryParentDir; this.loadUserEntryObjClasses(); } /* * Take a Map of user account attributes and then call the method saveEntry which implemented in * the abstract parent class LdapEntryManager */ public boolean creatUserAccount(Map<String,String> UserAccountAttributes){ log.info("Create user account in Ldap server"+UserAccountAttributes.toString()); return this.saveEntry(this.userEntryObjClasses, UserAccountAttributes, entryParentDir); } /* * This method take the DN of the userAccount and delete the user account entry from the * LDAP server */ public boolean deleteUserAccount(String userAccountCN){ return this.deleteEntry(userAccountCN+","+entryParentDir); } /* * Load the user entry object classes. * The object classes needs to be customized for every type of Ldap entry such as user, role * */ private void loadUserEntryObjClasses(){ userEntryObjClasses.add("inetOrgPerson"); //userEntryObjClasses.add("organizationalPerson"); //userEntryObjClasses.add("person"); userEntryObjClasses.add("posixAccount"); userEntryObjClasses.add("top"); } /* * This method take the uid of the user, if the uid of the user exist, it return the dn of the user * else return null */ public String getUserDn(String uid){ return this.entryExist("uid", uid); } public boolean uidNumberExisted(String uidNumber){ if(this.entryExist("uidNumber",uidNumber)!=null) return true; else return false; } public String getUserDnByuidNumber(String uid){ return this.entryExist("uidNumber",uid); } /* * This method take test first if the user(login use uid) knows the old password * if yes, then we change the old password,return a success message * * else, we return a fail message which indicates why it failed. */ /* public boolean changeUserPassword(String uid,String oldPassword,String newPassword){ String userDn=getUserDn(uid); if(userDn!=null){ boolean modifyPwd=false; LdapAuthenticator ldapAuth=new LdapAuthenticator(ldapServerInfo); boolean answer = ldapAuth.checkAuthWithLdap(uid, oldPassword); if(answer){ PasswordEncrytor pwdEncrypter=new PasswordEncrytor(); String encpwd="NoPassword"; try { encpwd = pwdEncrypter.digestBase64("sha", newPassword); } catch (NoSuchAlgorithmException e) { log.error(uid+" change password failed! "+e.toString()); } modifyPwd= this.modifyEntryAttributes(userDn, "userPassword", encpwd); } return modifyPwd; } else { log.error(uid+" change password failed! No such user, check if the login is correct!!!"); return false;} }*/ /* * This method take test first if the user(login use uid) knows the old password * if yes, then we change the old password,return a success message * * else, we return a fail message which indicates why it failed. */ public ChangePasswordStatus changeUserPassword(String uid,String oldPassword,String newPassword){ //create the instance of the password encrypter. PasswordEncrytor pwdEncrypter=new PasswordEncrytor(); String encPassword=null; try { encPassword=pwdEncrypter.digestBase64("sha", newPassword); } catch (NoSuchAlgorithmException e) { log.error("Change password failed! unable to encrypt the new password!!! Java exception: "+e.toString()); } ChangePasswordStatus result; String userDn=getUserDn(uid); if(userDn!=null){ LdapAuthenticator ldapAuth=new LdapAuthenticator(ldapServerInfo); boolean authentified = ldapAuth.checkAuthWithLdap(uid, oldPassword); if(authentified){ boolean passwordModified = this.modifyEntryAttributes(userDn, "userPassword", encPassword); if (passwordModified) result= ChangePasswordStatus.Success; else result= ChangePasswordStatus.Fail; } else { result= ChangePasswordStatus.WrongPassword;} } else {result= ChangePasswordStatus.UidNotFind;} //message="No such user, check if your login is correct!!!"; return result; } /*This method will reset user password by a auto generated random password*/ public boolean resetUserPassword(String userDn,String password){ PasswordEncrytor pwdEncrypter=new PasswordEncrytor(); String encPassword=null; try { encPassword=pwdEncrypter.digestBase64("sha", password); } catch (NoSuchAlgorithmException e) { log.error("Change password failed! unable to encrypt the new password!!! Java exception: "+e.toString()); } if(encPassword==null){ return false; } else{ boolean passwordModified = this.modifyEntryAttributes(userDn, "userPassword", encPassword); return passwordModified;} } public boolean changeGIDNumber(String uid,String GIDNumber){ boolean result=false; String userDn=getUserDn(uid); if (userDn!=null){ result=modifyEntryAttributes(userDn,"gidNumber",GIDNumber); } return result; } public ChangeMailStatus changeUserMail(String uid,String password,String mail){ ChangeMailStatus result; String userDn=getUserDn(uid); if(userDn!=null){ LdapAuthenticator ldapAuth=new LdapAuthenticator(ldapServerInfo); boolean authentified = ldapAuth.checkAuthWithLdap(uid, password); if(authentified){ boolean mailModified = this.modifyEntryAttributes(userDn, "mail", mail); if (mailModified) result= ChangeMailStatus.Success; else result= ChangeMailStatus.Fail; } else { result= ChangeMailStatus.WrongPassword;} } else result= ChangeMailStatus.UidNotFind; return result; } public String getUid(String dn){ Map<String, List<String>> attrs = this.getAllAttributesByEntryDN(dn); String uid = attrs.get("uid").get(0); return uid; } public Map<String,String> getAllUserNameAndUid(){ Map<String,String> allUsers=new HashMap<String, String>(); NamingEnumeration<NameClassPair> users = getAllUsers(); try { while (users.hasMore()){ NameClassPair user = users.next(); String userCn=user.getName(); String userDN= user.getNameInNamespace(); String userName=userCn.substring(3); String userUid=getUid(userDN); /* System.out.println("user name :"+userName+" uid :"+userUid);*/ allUsers.put(userName,userUid); } } catch (NamingException e) { log.error("Cannot get all users from the Ldap server :"+e.toString()); } // System.out.println(allUsers.toString()); //allUsers.put("pengfei","ptest"); return allUsers; } public NamingEnumeration<NameClassPair> getAllUsers(){ return this.getAllEntries(entryParentDir); } public int getUserSize(){ return this.getEntriesSize(entryParentDir); } public String getUserMailByDn(String userDN){ Map<String, List<String>> allAttributes= this.getAllAttributesByEntryDN(userDN); String mail=allAttributes.get("mail").get(0); return mail; } public boolean deletUserAccount(String userID){ /*first step check if the ID exist, if exist delete the account*/ /*Second serach all the group or role to delete all dependence*/ return false; } public boolean userEmailsExisted(String userEmailsTobeTested) throws NamingException { String usersDN="ou=Users,dc=etriks,dc=eu"; boolean result=false; NamingEnumeration<NameClassPair> allUsers = this.getAllEntries(usersDN); while(allUsers.hasMore()){ String userDN=allUsers.next().getName()+","+usersDN; String emails=this.getUserMailByDn(userDN); if(userEmailsTobeTested.equals(emails)){ result=true; break; } } return result; } }
[ "pengfei.liu@bioaster.org" ]
pengfei.liu@bioaster.org
689d619e66382db8256e0c20807b3704be6972b3
76749cfe4a148227a7b59807b7a33be5130b221f
/src/test/java/com/github/er/mapper/types/classtype/ClassTypeTest.java
361988cd664cc792626da404811cda2d4a349850
[]
no_license
wind57/0xMapper
47133eb6ff83ee6434154dffd2278c8d064bd768
d6564d0da021d70c46fd3df29ce1ce2caf86b74d
refs/heads/master
2022-11-12T21:53:11.937757
2020-06-29T17:49:14
2020-06-29T17:49:14
274,236,873
0
0
null
null
null
null
UTF-8
Java
false
false
720
java
package com.github.er.mapper.types.classtype; import com.github.er.mapper.MappingRegistrar; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** * @author ER * <p> * a test when Type == Class */ public class ClassTypeTest { @Test public void test() { In in = new In().setAge(12).setName("ab"); MappingRegistrar<In, Out> registrar = new MappingRegistrar<>() {}; registrar.withMapping("name", String.class); registrar.withMapping("age", int.class); Out out = registrar.transform(in); Assertions.assertNotNull(out); Assertions.assertEquals("ab", out.getName()); Assertions.assertSame(12, out.getAge()); } }
[ "eugeniu_rabii@comcast.com" ]
eugeniu_rabii@comcast.com
0f3c46122e1dc4ce501a0e78d18d821b98c7f266
573ee166e92f6d114c14495d427b522468259dd6
/app/src/main/java/com/clearlee/lockscreenmusiccontrol/util/ThreadManager.java
aa52e6904cc2cb22da533d9d98ce8e21fad0b353
[]
no_license
crazyzjw/LockScreenMusicControl
dfa3612d148dbf0bceef3fd274503e7664287635
327b0e4204fe47eb7f6356514523020cf6f5e846
refs/heads/master
2021-09-03T11:05:56.311953
2018-01-08T15:02:42
2018-01-08T15:02:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
477
java
package com.clearlee.lockscreenmusiccontrol.util; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * Created by Clearlee on 2017/12/26 0026. */ public class ThreadManager { static ExecutorService mExecutorService; public static ExecutorService getExecutorService() { if (mExecutorService == null) { mExecutorService = Executors.newCachedThreadPool(); } return mExecutorService; } }
[ "995654295@qq.com" ]
995654295@qq.com
3c06a12e48688e6c7365c4acc4174a0855bce8b6
e61d8037c162bae118042459f538b9bb8dd17223
/src/main/java/com/crud/springboot/model/behpardakht/BpRefundRequestResponse.java
5d23bfec2562fd52d5cb0da250f9335f61f42a41
[]
no_license
lnsjayasundara/user-crud-service
372dfa54b55f5b8dd503ae045fc83932038aaf8f
cd9bf462a1b0ed736c9dd6e9fc5b05f6c72eea1f
refs/heads/master
2023-05-11T21:31:01.044634
2020-07-16T05:43:21
2020-07-16T05:43:21
261,369,623
0
0
null
2023-05-09T18:25:33
2020-05-05T05:29:58
Java
UTF-8
Java
false
false
1,846
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0 // See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.07.15 at 03:25:42 PM IST // package com.crud.springboot.model.behpardakht; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for bpRefundRequestResponse complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="bpRefundRequestResponse"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="return" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "bpRefundRequestResponse", propOrder = { "_return" }) public class BpRefundRequestResponse { @XmlElement(name = "return") protected String _return; /** * Gets the value of the return property. * * @return * possible object is * {@link String } * */ public String getReturn() { return _return; } /** * Sets the value of the return property. * * @param value * allowed object is * {@link String } * */ public void setReturn(String value) { this._return = value; } }
[ "lahiru@rezadmin" ]
lahiru@rezadmin
737b632b62d231df5cf04f57b90020c4d4963440
5f6f76810dc2298c2f2d060576922af066efe854
/LongestValid.java
f6484084c4b18c545281b2f2c162ec887cfc6b2b
[]
no_license
ginnigarg/Data-Structures
f28815a811ffe37e14c2cb20130fe38f7b19436f
12f119028b9c1aeb9723992db4c6e40cb62c3370
refs/heads/master
2020-03-30T06:46:27.279654
2019-01-26T09:56:05
2019-01-26T09:56:05
150,887,638
0
0
null
null
null
null
UTF-8
Java
false
false
1,142
java
import java.util.Stack; import java.util.Scanner; import java.util.*; import java.io.*; public class LongestValid { static int check(String str) { Stack<Character> stack = new Stack<>(); int count = 0, maximumLength = 0; for(int i = 0; i < str.length(); i++) { if(str.charAt(i) == '{' || str.charAt(i) == '(' || str.charAt(i) == '[') { stack.push(str.charAt(i)); } else { if(stack.empty() == true) { continue; } if((str.charAt(i) == '}' && stack.peek() == '{') || (str.charAt(i) == ')' && stack.peek() == '(') || (str.charAt(i) == ']' && stack.peek() == '[')) { stack.pop(); count += 2; if(stack.empty() == true && maximumLength < count) { maximumLength = count; // count = 0; } } else { stack.clear(); count = 0; continue; } } } if(maximumLength < count) return count; return maximumLength; } public static void main(String args[]) { //String str = new String(); //Scanner sc = new Scanner(System.in); //str = sc.next(); int ans = check("()[]{}{(])}"); assert ans ==60; System.out.println(ans); } }
[ "vagrant@dev2" ]
vagrant@dev2
6c13cc7fa34c40dbe6ab1588987f1b3155ee8b4a
4d13380edc86bf502a3e48b1290d6b0231c7c28e
/src/main/java/nmd/orb/exporter/Channel.java
57524bf658c7ea896071ebacf6f024fc79f073c3
[]
no_license
igors48/nmdService
8f3cab9162059b34bab207b080abfaa59f0dc5f2
ae3cfda09aaf30771b8b752fb26164a2384a2d0c
refs/heads/develop
2020-05-21T15:17:42.139398
2019-01-30T20:00:40
2019-01-30T20:00:40
9,654,583
3
1
null
2017-01-15T10:48:12
2013-04-24T18:15:30
JavaScript
UTF-8
Java
false
false
1,298
java
package nmd.orb.exporter; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import java.util.List; import static nmd.orb.util.Assert.assertNotNull; import static nmd.orb.util.Assert.assertStringIsValid; /** * Author : Igor Usenko ( igors48@gmail.com ) * Date : 16.05.13 */ @XmlRootElement class Channel { private String description; private String title; private String link; @XmlElement(name = "item") private List<Item> items; Channel() { // empty } public String getDescription() { return this.description; } public void setDescription(final String description) { assertStringIsValid(description); this.description = description; } public String getTitle() { return this.title; } public void setTitle(final String title) { assertStringIsValid(title); this.title = title; } public String getLink() { return this.link; } public void setLink(final String link) { assertStringIsValid(link); this.link = link; } List<Item> getItems() { return this.items; } void setItems(final List<Item> items) { assertNotNull(items); this.items = items; } }
[ "nmds48@gmail.com" ]
nmds48@gmail.com
86a4271971bae9194ccae750b822cca230e29c88
d6f174884afc395332b9e475a70f3dbdf66fb51a
/app/src/main/java/com/example/flappybird/GamePlay.java
9847eb9621be19c7f2d216310daedbc80f3b3d1c
[]
no_license
OzzkanBulut/FlappyBird
be58dd284ae56edf80e15792dbdc98d97922e0cd
c274775323f2f362a68d0415fe3e4a571bdf75a3
refs/heads/master
2023-08-22T10:19:11.872217
2021-09-23T19:06:16
2021-09-23T19:06:16
409,712,699
0
0
null
null
null
null
UTF-8
Java
false
false
1,847
java
package com.example.flappybird; import android.content.Context; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import androidx.annotation.NonNull; public class GamePlay extends SurfaceView implements SurfaceHolder.Callback { MainThread mainThread ; public GamePlay(Context context) { super(context); SurfaceHolder myHolder = getHolder(); myHolder.addCallback(this); mainThread = new MainThread(myHolder); } @Override // This method is called when the surface is created public void surfaceCreated(@NonNull SurfaceHolder surfaceHolder) { mainThread.setIsRunning(true); mainThread.start(); } @Override // This method is called when you want to change size or orientation of the SurfaceView // This method will not be used because the app is always displayed on a portrait oriantetion public void surfaceChanged(@NonNull SurfaceHolder surfaceHolder, int i, int i1, int i2) { } @Override //Stop public void surfaceDestroyed(@NonNull SurfaceHolder surfaceHolder) { boolean retry = true; while(retry){ try { mainThread.setIsRunning(false); mainThread.join(); } catch(InterruptedException e){ e.printStackTrace(); } retry = false; } } @Override public boolean onTouchEvent(MotionEvent event) { if(AppHolder.getGameManager().gameState == 0){ AppHolder.getGameManager().gameState = 1; AppHolder.getSoundPlay().playSwoosh(); }else { AppHolder.getSoundPlay().playWing(); } AppHolder.getGameManager().bird.setVelocity(AppHolder.JUMP_VELOCITY); return true; } }
[ "ozkanb66@gmail.com" ]
ozkanb66@gmail.com
872be63fbfc3542d3428c5435d6e753d7a8c10ac
8f29ed73af4302aa181aab1b8ad1801b1186ae15
/Trees_and_Graphs/8_FirstCommonAncestor.java
45c8ddb930665456fb295d18fa42756ad3e84e7a
[]
no_license
PratikGarai/189
ffb0148189d8ed002c226401de400f6c29e2a8de
45cfa800f2c524ba039ba643b2d3d0159c1179fd
refs/heads/master
2023-07-17T12:28:28.227511
2021-08-20T09:01:43
2021-08-20T09:01:43
310,952,300
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
import java.util.Scanner; class FCA { public static void main(String[] args) { Scanner in = new Scanner(System.in); } }
[ "pratikgarai0208@gmail.com" ]
pratikgarai0208@gmail.com
950584abaf7725db3f6bc26c4735fa60560793d3
e257e4af9f33f6b5be5b78fd636491146f543f4e
/app/src/main/java/com/mingchu/newcalendar/MainActivity.java
38dc96cbf961d0d320d9b7338423a930bcc9ee9d
[]
no_license
wuyinlei/NewCalendar
fd8d48ff5e202a6b56e76fe8f94c1291de083b54
77b2c1c30f730c871e58c2a1f1883abd41cad047
refs/heads/master
2021-01-22T10:40:17.482807
2017-05-29T14:09:06
2017-05-29T14:09:06
92,650,654
2
0
null
null
null
null
UTF-8
Java
false
false
485
java
package com.mingchu.newcalendar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Toast; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "power1118wu@gmail.com" ]
power1118wu@gmail.com
0d16ef62e70b2c1836b96d56efd308f630c75b2f
8f8d6660b3ab5e1de15d68c3f6ab2849c91fc58e
/src/main/java/com/springboot/app/AppApplication.java
7a36ab7a6c3e75748dda9f8c688df5a29137e8a1
[]
no_license
jvcool/Spring
54f1d4079e0d243a48f49c4e73b33811e3f971fb
4b266d8ff6740e3c021962970ac8c90b6ea18e0a
refs/heads/master
2023-01-06T09:29:36.929209
2020-10-27T11:28:53
2020-10-27T11:28:53
307,644,052
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package com.springboot.app; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class AppApplication { public static void main(String[] args) { SpringApplication.run(AppApplication.class, args); } }
[ "josjov40@gmail.com" ]
josjov40@gmail.com
1ef44694d0439695e13c1c1e3fdc002973f8dc89
38266f3bb142f9e8b6c179bf5cdac3df06be6959
/New folder (2)/Recovered data 12-19-2019 at 15_34_27/FAT32/Java -Ben/JPhraseOMatic/SRC/jphraseomatic/PhraseFrame.java
a61fa44e5c050f6d72edefccb130b87681010a74
[]
no_license
BenLarson9/NewFolder2
303c2182d67da35ce7a5fcfa4c9fa68d3616de05
fa874b70a8e3e533657f75761e0f46dd16559095
refs/heads/master
2022-12-11T22:02:39.299680
2020-09-10T16:01:42
2020-09-10T16:01:42
294,453,795
0
0
null
null
null
null
UTF-8
Java
false
false
1,307
java
package jphraseomatic; import java.awt.BorderLayout; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.JDialog; class PhraseFrame extends JFrame { public PhraseFrame(String title) { super(title); // set layout manager setLayout(new BorderLayout()); // create swing component JTextArea textArea = new JTextArea(); JButton button = new JButton("What we need is a"); PrintMe myPrint = new PrintMe(); // add swing components to content pane Container c = getContentPane(); c.add(textArea, BorderLayout.CENTER); c.add(button, BorderLayout.NORTH); // add a behavior button.addActionListener ( new ActionListener(){ @Override public void actionPerformed (ActionEvent e){ PrintMe myPrint = new PrintMe(); myPrint.GetHeader(); MyPhrase newPhrase = new MyPhrase(); String phrase = newPhrase.GetPhrase(); myPrint.GetFooter(phrase); textArea.append("\t" + phrase + "\n"); } }); } }
[ "54853304+BenLarson9@users.noreply.github.com" ]
54853304+BenLarson9@users.noreply.github.com
29bcb9e7c5f3e3cfb74b9554a4cfd2e2b0233517
fbd16739b5a5e476916fa22ddcd2157fafff82b9
/src/minecraft/net/minecraft/entity/EntityLivingBase.java
1fda9744982074ed0e4f2b030bbf16784c48793f
[]
no_license
CodeMajorGeek/lwjgl3-mcp908
6b49c80944ab87f1c863ff537417f53f16c643d5
2a6d28f2b7541b760ebb8e7a6dc905465f935a64
refs/heads/master
2020-06-18T19:53:49.089357
2019-07-14T13:14:06
2019-07-14T13:14:06
196,421,564
2
0
null
null
null
null
UTF-8
Java
false
false
72,968
java
package net.minecraft.entity; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Random; import java.util.UUID; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.BaseAttributeMap; import net.minecraft.entity.ai.attributes.IAttribute; import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.ai.attributes.ServersideAttributeMap; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagFloat; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagShort; import net.minecraft.network.play.server.S04PacketEntityEquipment; import net.minecraft.network.play.server.S0BPacketAnimation; import net.minecraft.network.play.server.S0DPacketCollectItem; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionHelper; import net.minecraft.scoreboard.Team; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.CombatTracker; import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; public abstract class EntityLivingBase extends Entity { private static final UUID sprintingSpeedBoostModifierUUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); private static final AttributeModifier sprintingSpeedBoostModifier = (new AttributeModifier(sprintingSpeedBoostModifierUUID, "Sprinting speed boost", 0.30000001192092896D, 2)).setSaved(false); private BaseAttributeMap attributeMap; private final CombatTracker _combatTracker = new CombatTracker(this); private final HashMap activePotionsMap = new HashMap(); /** The equipment this mob was previously wearing, used for syncing. */ private final ItemStack[] previousEquipment = new ItemStack[5]; /** Whether an arm swing is currently in progress. */ public boolean isSwingInProgress; public int swingProgressInt; public int arrowHitTimer; public float prevHealth; /** * The amount of time remaining this entity should act 'hurt'. (Visual appearance of red tint) */ public int hurtTime; /** What the hurt time was max set to last. */ public int maxHurtTime; /** The yaw at which this entity was last attacked from. */ public float attackedAtYaw; /** * The amount of time remaining this entity should act 'dead', i.e. have a corpse in the world. */ public int deathTime; public int attackTime; public float prevSwingProgress; public float swingProgress; public float prevLimbSwingAmount; public float limbSwingAmount; /** * Only relevant when limbYaw is not 0(the entity is moving). Influences where in its swing legs and arms currently * are. */ public float limbSwing; public int maxHurtResistantTime = 20; public float prevCameraPitch; public float cameraPitch; public float field_70769_ao; public float field_70770_ap; public float renderYawOffset; public float prevRenderYawOffset; /** Entity head rotation yaw */ public float rotationYawHead; /** Entity head rotation yaw at previous tick */ public float prevRotationYawHead; /** * A factor used to determine how far this entity will move each tick if it is jumping or falling. */ public float jumpMovementFactor = 0.02F; /** The most recent player that has attacked this entity */ protected EntityPlayer attackingPlayer; /** * Set to 60 when hit by the player or the player's wolf, then decrements. Used to determine whether the entity * should drop items on death. */ protected int recentlyHit; /** * This gets set on entity death, but never used. Looks like a duplicate of isDead */ protected boolean dead; /** The age of this EntityLiving (used to determine when it dies) */ protected int entityAge; protected float field_70768_au; protected float field_110154_aX; protected float field_70764_aw; protected float field_70763_ax; protected float field_70741_aB; /** The score value of the Mob, the amount of points the mob is worth. */ protected int scoreValue; /** * Damage taken in the last hit. Mobs are resistant to damage less than this for a short time after taking damage. */ protected float lastDamage; /** used to check whether entity is jumping. */ protected boolean isJumping; public float moveStrafing; public float moveForward; protected float randomYawVelocity; /** * The number of updates over which the new position and rotation are to be applied to the entity. */ protected int newPosRotationIncrements; /** The new X position to be applied to the entity. */ protected double newPosX; /** The new Y position to be applied to the entity. */ protected double newPosY; protected double newPosZ; /** The new yaw rotation to be applied to the entity. */ protected double newRotationYaw; /** The new yaw rotation to be applied to the entity. */ protected double newRotationPitch; /** Whether the DataWatcher needs to be updated with the active potions */ private boolean potionsNeedUpdate = true; /** is only being set, has no uses as of MC 1.1 */ private EntityLivingBase entityLivingToAttack; private int revengeTimer; private EntityLivingBase lastAttacker; /** Holds the value of ticksExisted when setLastAttacker was last called. */ private int lastAttackerTime; /** * A factor used to determine how far this entity will move each tick if it is walking on land. Adjusted by speed, * and slipperiness of the current block. */ private float landMovementFactor; /** Number of ticks since last jump */ private int jumpTicks; private float field_110151_bq; private static final String __OBFID = "CL_00001549"; public EntityLivingBase(World p_i1594_1_) { super(p_i1594_1_); this.applyEntityAttributes(); this.setHealth(this.getMaxHealth()); this.preventEntitySpawning = true; this.field_70770_ap = (float)(Math.random() + 1.0D) * 0.01F; this.setPosition(this.posX, this.posY, this.posZ); this.field_70769_ao = (float)Math.random() * 12398.0F; this.rotationYaw = (float)(Math.random() * Math.PI * 2.0D); this.rotationYawHead = this.rotationYaw; this.stepHeight = 0.5F; } protected void entityInit() { this.dataWatcher.addObject(7, Integer.valueOf(0)); this.dataWatcher.addObject(8, Byte.valueOf((byte)0)); this.dataWatcher.addObject(9, Byte.valueOf((byte)0)); this.dataWatcher.addObject(6, Float.valueOf(1.0F)); } protected void applyEntityAttributes() { this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed); if (!this.isAIEnabled()) { this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.10000000149011612D); } } /** * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround */ protected void updateFallState(double p_70064_1_, boolean p_70064_3_) { if (!this.isInWater()) { this.handleWaterMovement(); } if (p_70064_3_ && this.fallDistance > 0.0F) { int var4 = MathHelper.floor_double(this.posX); int var5 = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset); int var6 = MathHelper.floor_double(this.posZ); Block var7 = this.worldObj.getBlock(var4, var5, var6); if (var7.getMaterial() == Material.air) { int var8 = this.worldObj.getBlock(var4, var5 - 1, var6).getRenderType(); if (var8 == 11 || var8 == 32 || var8 == 21) { var7 = this.worldObj.getBlock(var4, var5 - 1, var6); } } else if (!this.worldObj.isClient && this.fallDistance > 3.0F) { this.worldObj.playAuxSFX(2006, var4, var5, var6, MathHelper.ceiling_float_int(this.fallDistance - 3.0F)); } var7.onFallenUpon(this.worldObj, var4, var5, var6, this, this.fallDistance); } super.updateFallState(p_70064_1_, p_70064_3_); } public boolean canBreatheUnderwater() { return false; } /** * Gets called every tick from main Entity class */ public void onEntityUpdate() { this.prevSwingProgress = this.swingProgress; super.onEntityUpdate(); this.worldObj.theProfiler.startSection("livingEntityBaseTick"); if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock()) { this.attackEntityFrom(DamageSource.inWall, 1.0F); } if (this.isImmuneToFire() || this.worldObj.isClient) { this.extinguish(); } boolean var1 = this instanceof EntityPlayer && ((EntityPlayer)this).capabilities.disableDamage; if (this.isEntityAlive() && this.isInsideOfMaterial(Material.water)) { if (!this.canBreatheUnderwater() && !this.isPotionActive(Potion.waterBreathing.id) && !var1) { this.setAir(this.decreaseAirSupply(this.getAir())); if (this.getAir() == -20) { this.setAir(0); for (int var2 = 0; var2 < 8; ++var2) { float var3 = this.rand.nextFloat() - this.rand.nextFloat(); float var4 = this.rand.nextFloat() - this.rand.nextFloat(); float var5 = this.rand.nextFloat() - this.rand.nextFloat(); this.worldObj.spawnParticle("bubble", this.posX + (double)var3, this.posY + (double)var4, this.posZ + (double)var5, this.motionX, this.motionY, this.motionZ); } this.attackEntityFrom(DamageSource.drown, 2.0F); } } if (!this.worldObj.isClient && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) { this.mountEntity((Entity)null); } } else { this.setAir(300); } if (this.isEntityAlive() && this.isWet()) { this.extinguish(); } this.prevCameraPitch = this.cameraPitch; if (this.attackTime > 0) { --this.attackTime; } if (this.hurtTime > 0) { --this.hurtTime; } if (this.hurtResistantTime > 0 && !(this instanceof EntityPlayerMP)) { --this.hurtResistantTime; } if (this.getHealth() <= 0.0F) { this.onDeathUpdate(); } if (this.recentlyHit > 0) { --this.recentlyHit; } else { this.attackingPlayer = null; } if (this.lastAttacker != null && !this.lastAttacker.isEntityAlive()) { this.lastAttacker = null; } if (this.entityLivingToAttack != null) { if (!this.entityLivingToAttack.isEntityAlive()) { this.setRevengeTarget((EntityLivingBase)null); } else if (this.ticksExisted - this.revengeTimer > 100) { this.setRevengeTarget((EntityLivingBase)null); } } this.updatePotionEffects(); this.field_70763_ax = this.field_70764_aw; this.prevRenderYawOffset = this.renderYawOffset; this.prevRotationYawHead = this.rotationYawHead; this.prevRotationYaw = this.rotationYaw; this.prevRotationPitch = this.rotationPitch; this.worldObj.theProfiler.endSection(); } /** * If Animal, checks if the age timer is negative */ public boolean isChild() { return false; } /** * handles entity death timer, experience orb and particle creation */ protected void onDeathUpdate() { ++this.deathTime; if (this.deathTime == 20) { int var1; if (!this.worldObj.isClient && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { var1 = this.getExperiencePoints(this.attackingPlayer); while (var1 > 0) { int var2 = EntityXPOrb.getXPSplit(var1); var1 -= var2; this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var2)); } } this.setDead(); for (var1 = 0; var1 < 20; ++var1) { double var8 = this.rand.nextGaussian() * 0.02D; double var4 = this.rand.nextGaussian() * 0.02D; double var6 = this.rand.nextGaussian() * 0.02D; this.worldObj.spawnParticle("explode", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var8, var4, var6); } } } protected boolean func_146066_aG() { return !this.isChild(); } /** * Decrements the entity's air supply when underwater */ protected int decreaseAirSupply(int p_70682_1_) { int var2 = EnchantmentHelper.getRespiration(this); return var2 > 0 && this.rand.nextInt(var2 + 1) > 0 ? p_70682_1_ : p_70682_1_ - 1; } /** * Get the experience points the entity currently has. */ protected int getExperiencePoints(EntityPlayer p_70693_1_) { return 0; } /** * Only use is to identify if class is an instance of player for experience dropping */ protected boolean isPlayer() { return false; } public Random getRNG() { return this.rand; } public EntityLivingBase getAITarget() { return this.entityLivingToAttack; } public int func_142015_aE() { return this.revengeTimer; } public void setRevengeTarget(EntityLivingBase p_70604_1_) { this.entityLivingToAttack = p_70604_1_; this.revengeTimer = this.ticksExisted; } public EntityLivingBase getLastAttacker() { return this.lastAttacker; } public int getLastAttackerTime() { return this.lastAttackerTime; } public void setLastAttacker(Entity p_130011_1_) { if (p_130011_1_ instanceof EntityLivingBase) { this.lastAttacker = (EntityLivingBase)p_130011_1_; } else { this.lastAttacker = null; } this.lastAttackerTime = this.ticksExisted; } public int getAge() { return this.entityAge; } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound p_70014_1_) { p_70014_1_.setFloat("HealF", this.getHealth()); p_70014_1_.setShort("Health", (short)((int)Math.ceil((double)this.getHealth()))); p_70014_1_.setShort("HurtTime", (short)this.hurtTime); p_70014_1_.setShort("DeathTime", (short)this.deathTime); p_70014_1_.setShort("AttackTime", (short)this.attackTime); p_70014_1_.setFloat("AbsorptionAmount", this.getAbsorptionAmount()); ItemStack[] var2 = this.getLastActiveItems(); int var3 = var2.length; int var4; ItemStack var5; for (var4 = 0; var4 < var3; ++var4) { var5 = var2[var4]; if (var5 != null) { this.attributeMap.removeAttributeModifiers(var5.getAttributeModifiers()); } } p_70014_1_.setTag("Attributes", SharedMonsterAttributes.writeBaseAttributeMapToNBT(this.getAttributeMap())); var2 = this.getLastActiveItems(); var3 = var2.length; for (var4 = 0; var4 < var3; ++var4) { var5 = var2[var4]; if (var5 != null) { this.attributeMap.applyAttributeModifiers(var5.getAttributeModifiers()); } } if (!this.activePotionsMap.isEmpty()) { NBTTagList var6 = new NBTTagList(); Iterator var7 = this.activePotionsMap.values().iterator(); while (var7.hasNext()) { PotionEffect var8 = (PotionEffect)var7.next(); var6.appendTag(var8.writeCustomPotionEffectToNBT(new NBTTagCompound())); } p_70014_1_.setTag("ActiveEffects", var6); } } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound p_70037_1_) { this.setAbsorptionAmount(p_70037_1_.getFloat("AbsorptionAmount")); if (p_70037_1_.func_150297_b("Attributes", 9) && this.worldObj != null && !this.worldObj.isClient) { SharedMonsterAttributes.func_151475_a(this.getAttributeMap(), p_70037_1_.getTagList("Attributes", 10)); } if (p_70037_1_.func_150297_b("ActiveEffects", 9)) { NBTTagList var2 = p_70037_1_.getTagList("ActiveEffects", 10); for (int var3 = 0; var3 < var2.tagCount(); ++var3) { NBTTagCompound var4 = var2.getCompoundTagAt(var3); PotionEffect var5 = PotionEffect.readCustomPotionEffectFromNBT(var4); if (var5 != null) { this.activePotionsMap.put(Integer.valueOf(var5.getPotionID()), var5); } } } if (p_70037_1_.func_150297_b("HealF", 99)) { this.setHealth(p_70037_1_.getFloat("HealF")); } else { NBTBase var6 = p_70037_1_.getTag("Health"); if (var6 == null) { this.setHealth(this.getMaxHealth()); } else if (var6.getId() == 5) { this.setHealth(((NBTTagFloat)var6).func_150288_h()); } else if (var6.getId() == 2) { this.setHealth((float)((NBTTagShort)var6).func_150289_e()); } } this.hurtTime = p_70037_1_.getShort("HurtTime"); this.deathTime = p_70037_1_.getShort("DeathTime"); this.attackTime = p_70037_1_.getShort("AttackTime"); } protected void updatePotionEffects() { Iterator var1 = this.activePotionsMap.keySet().iterator(); while (var1.hasNext()) { Integer var2 = (Integer)var1.next(); PotionEffect var3 = (PotionEffect)this.activePotionsMap.get(var2); if (!var3.onUpdate(this)) { if (!this.worldObj.isClient) { var1.remove(); this.onFinishedPotionEffect(var3); } } else if (var3.getDuration() % 600 == 0) { this.onChangedPotionEffect(var3, false); } } int var11; if (this.potionsNeedUpdate) { if (!this.worldObj.isClient) { if (this.activePotionsMap.isEmpty()) { this.dataWatcher.updateObject(8, Byte.valueOf((byte)0)); this.dataWatcher.updateObject(7, Integer.valueOf(0)); this.setInvisible(false); } else { var11 = PotionHelper.calcPotionLiquidColor(this.activePotionsMap.values()); this.dataWatcher.updateObject(8, Byte.valueOf((byte)(PotionHelper.func_82817_b(this.activePotionsMap.values()) ? 1 : 0))); this.dataWatcher.updateObject(7, Integer.valueOf(var11)); this.setInvisible(this.isPotionActive(Potion.invisibility.id)); } } this.potionsNeedUpdate = false; } var11 = this.dataWatcher.getWatchableObjectInt(7); boolean var12 = this.dataWatcher.getWatchableObjectByte(8) > 0; if (var11 > 0) { boolean var4 = false; if (!this.isInvisible()) { var4 = this.rand.nextBoolean(); } else { var4 = this.rand.nextInt(15) == 0; } if (var12) { var4 &= this.rand.nextInt(5) == 0; } if (var4 && var11 > 0) { double var5 = (double)(var11 >> 16 & 255) / 255.0D; double var7 = (double)(var11 >> 8 & 255) / 255.0D; double var9 = (double)(var11 >> 0 & 255) / 255.0D; this.worldObj.spawnParticle(var12 ? "mobSpellAmbient" : "mobSpell", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - (double)this.yOffset, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, var5, var7, var9); } } } public void clearActivePotions() { Iterator var1 = this.activePotionsMap.keySet().iterator(); while (var1.hasNext()) { Integer var2 = (Integer)var1.next(); PotionEffect var3 = (PotionEffect)this.activePotionsMap.get(var2); if (!this.worldObj.isClient) { var1.remove(); this.onFinishedPotionEffect(var3); } } } public Collection getActivePotionEffects() { return this.activePotionsMap.values(); } public boolean isPotionActive(int p_82165_1_) { return this.activePotionsMap.containsKey(Integer.valueOf(p_82165_1_)); } public boolean isPotionActive(Potion p_70644_1_) { return this.activePotionsMap.containsKey(Integer.valueOf(p_70644_1_.id)); } /** * returns the PotionEffect for the supplied Potion if it is active, null otherwise. */ public PotionEffect getActivePotionEffect(Potion p_70660_1_) { return (PotionEffect)this.activePotionsMap.get(Integer.valueOf(p_70660_1_.id)); } /** * adds a PotionEffect to the entity */ public void addPotionEffect(PotionEffect p_70690_1_) { if (this.isPotionApplicable(p_70690_1_)) { if (this.activePotionsMap.containsKey(Integer.valueOf(p_70690_1_.getPotionID()))) { ((PotionEffect)this.activePotionsMap.get(Integer.valueOf(p_70690_1_.getPotionID()))).combine(p_70690_1_); this.onChangedPotionEffect((PotionEffect)this.activePotionsMap.get(Integer.valueOf(p_70690_1_.getPotionID())), true); } else { this.activePotionsMap.put(Integer.valueOf(p_70690_1_.getPotionID()), p_70690_1_); this.onNewPotionEffect(p_70690_1_); } } } public boolean isPotionApplicable(PotionEffect p_70687_1_) { if (this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) { int var2 = p_70687_1_.getPotionID(); if (var2 == Potion.regeneration.id || var2 == Potion.poison.id) { return false; } } return true; } /** * Returns true if this entity is undead. */ public boolean isEntityUndead() { return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; } /** * Remove the speified potion effect from this entity. */ public void removePotionEffectClient(int p_70618_1_) { this.activePotionsMap.remove(Integer.valueOf(p_70618_1_)); } /** * Remove the specified potion effect from this entity. */ public void removePotionEffect(int p_82170_1_) { PotionEffect var2 = (PotionEffect)this.activePotionsMap.remove(Integer.valueOf(p_82170_1_)); if (var2 != null) { this.onFinishedPotionEffect(var2); } } protected void onNewPotionEffect(PotionEffect p_70670_1_) { this.potionsNeedUpdate = true; if (!this.worldObj.isClient) { Potion.potionTypes[p_70670_1_.getPotionID()].applyAttributesModifiersToEntity(this, this.getAttributeMap(), p_70670_1_.getAmplifier()); } } protected void onChangedPotionEffect(PotionEffect p_70695_1_, boolean p_70695_2_) { this.potionsNeedUpdate = true; if (p_70695_2_ && !this.worldObj.isClient) { Potion.potionTypes[p_70695_1_.getPotionID()].removeAttributesModifiersFromEntity(this, this.getAttributeMap(), p_70695_1_.getAmplifier()); Potion.potionTypes[p_70695_1_.getPotionID()].applyAttributesModifiersToEntity(this, this.getAttributeMap(), p_70695_1_.getAmplifier()); } } protected void onFinishedPotionEffect(PotionEffect p_70688_1_) { this.potionsNeedUpdate = true; if (!this.worldObj.isClient) { Potion.potionTypes[p_70688_1_.getPotionID()].removeAttributesModifiersFromEntity(this, this.getAttributeMap(), p_70688_1_.getAmplifier()); } } /** * Heal living entity (param: amount of half-hearts) */ public void heal(float p_70691_1_) { float var2 = this.getHealth(); if (var2 > 0.0F) { this.setHealth(var2 + p_70691_1_); } } public final float getHealth() { return this.dataWatcher.getWatchableObjectFloat(6); } public void setHealth(float p_70606_1_) { this.dataWatcher.updateObject(6, Float.valueOf(MathHelper.clamp_float(p_70606_1_, 0.0F, this.getMaxHealth()))); } /** * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { if (this.isEntityInvulnerable()) { return false; } else if (this.worldObj.isClient) { return false; } else { this.entityAge = 0; if (this.getHealth() <= 0.0F) { return false; } else if (p_70097_1_.isFireDamage() && this.isPotionActive(Potion.fireResistance)) { return false; } else { if ((p_70097_1_ == DamageSource.anvil || p_70097_1_ == DamageSource.fallingBlock) && this.getEquipmentInSlot(4) != null) { this.getEquipmentInSlot(4).damageItem((int)(p_70097_2_ * 4.0F + this.rand.nextFloat() * p_70097_2_ * 2.0F), this); p_70097_2_ *= 0.75F; } this.limbSwingAmount = 1.5F; boolean var3 = true; if ((float)this.hurtResistantTime > (float)this.maxHurtResistantTime / 2.0F) { if (p_70097_2_ <= this.lastDamage) { return false; } this.damageEntity(p_70097_1_, p_70097_2_ - this.lastDamage); this.lastDamage = p_70097_2_; var3 = false; } else { this.lastDamage = p_70097_2_; this.prevHealth = this.getHealth(); this.hurtResistantTime = this.maxHurtResistantTime; this.damageEntity(p_70097_1_, p_70097_2_); this.hurtTime = this.maxHurtTime = 10; } this.attackedAtYaw = 0.0F; Entity var4 = p_70097_1_.getEntity(); if (var4 != null) { if (var4 instanceof EntityLivingBase) { this.setRevengeTarget((EntityLivingBase)var4); } if (var4 instanceof EntityPlayer) { this.recentlyHit = 100; this.attackingPlayer = (EntityPlayer)var4; } else if (var4 instanceof EntityWolf) { EntityWolf var5 = (EntityWolf)var4; if (var5.isTamed()) { this.recentlyHit = 100; this.attackingPlayer = null; } } } if (var3) { this.worldObj.setEntityState(this, (byte)2); if (p_70097_1_ != DamageSource.drown) { this.setBeenAttacked(); } if (var4 != null) { double var9 = var4.posX - this.posX; double var7; for (var7 = var4.posZ - this.posZ; var9 * var9 + var7 * var7 < 1.0E-4D; var7 = (Math.random() - Math.random()) * 0.01D) { var9 = (Math.random() - Math.random()) * 0.01D; } this.attackedAtYaw = (float)(Math.atan2(var7, var9) * 180.0D / Math.PI) - this.rotationYaw; this.knockBack(var4, p_70097_2_, var9, var7); } else { this.attackedAtYaw = (float)((int)(Math.random() * 2.0D) * 180); } } String var10; if (this.getHealth() <= 0.0F) { var10 = this.getDeathSound(); if (var3 && var10 != null) { this.playSound(var10, this.getSoundVolume(), this.getSoundPitch()); } this.onDeath(p_70097_1_); } else { var10 = this.getHurtSound(); if (var3 && var10 != null) { this.playSound(var10, this.getSoundVolume(), this.getSoundPitch()); } } return true; } } } /** * Renders broken item particles using the given ItemStack */ public void renderBrokenItemStack(ItemStack p_70669_1_) { this.playSound("random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F); for (int var2 = 0; var2 < 5; ++var2) { Vec3 var3 = Vec3.createVectorHelper(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); var3.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); var3.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); Vec3 var4 = Vec3.createVectorHelper(((double)this.rand.nextFloat() - 0.5D) * 0.3D, (double)(-this.rand.nextFloat()) * 0.6D - 0.3D, 0.6D); var4.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); var4.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); var4 = var4.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); this.worldObj.spawnParticle("iconcrack_" + Item.getIdFromItem(p_70669_1_.getItem()), var4.xCoord, var4.yCoord, var4.zCoord, var3.xCoord, var3.yCoord + 0.05D, var3.zCoord); } } /** * Called when the mob's health reaches 0. */ public void onDeath(DamageSource p_70645_1_) { Entity var2 = p_70645_1_.getEntity(); EntityLivingBase var3 = this.func_94060_bK(); if (this.scoreValue >= 0 && var3 != null) { var3.addToPlayerScore(this, this.scoreValue); } if (var2 != null) { var2.onKillEntity(this); } this.dead = true; this.func_110142_aN().func_94549_h(); if (!this.worldObj.isClient) { int var4 = 0; if (var2 instanceof EntityPlayer) { var4 = EnchantmentHelper.getLootingModifier((EntityLivingBase)var2); } if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { this.dropFewItems(this.recentlyHit > 0, var4); this.dropEquipment(this.recentlyHit > 0, var4); if (this.recentlyHit > 0) { int var5 = this.rand.nextInt(200) - var4; if (var5 < 5) { this.dropRareDrop(var5 <= 0 ? 1 : 0); } } } } this.worldObj.setEntityState(this, (byte)3); } /** * Drop the equipment for this entity. */ protected void dropEquipment(boolean p_82160_1_, int p_82160_2_) {} /** * knocks back this entity */ public void knockBack(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) { if (this.rand.nextDouble() >= this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()) { this.isAirBorne = true; float var7 = MathHelper.sqrt_double(p_70653_3_ * p_70653_3_ + p_70653_5_ * p_70653_5_); float var8 = 0.4F; this.motionX /= 2.0D; this.motionY /= 2.0D; this.motionZ /= 2.0D; this.motionX -= p_70653_3_ / (double)var7 * (double)var8; this.motionY += (double)var8; this.motionZ -= p_70653_5_ / (double)var7 * (double)var8; if (this.motionY > 0.4000000059604645D) { this.motionY = 0.4000000059604645D; } } } /** * Returns the sound this mob makes when it is hurt. */ protected String getHurtSound() { return "game.neutral.hurt"; } /** * Returns the sound this mob makes on death. */ protected String getDeathSound() { return "game.neutral.die"; } protected void dropRareDrop(int p_70600_1_) {} /** * Drop 0-2 items of this living's type */ protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) {} /** * returns true if this entity is by a ladder, false otherwise */ public boolean isOnLadder() { int var1 = MathHelper.floor_double(this.posX); int var2 = MathHelper.floor_double(this.boundingBox.minY); int var3 = MathHelper.floor_double(this.posZ); Block var4 = this.worldObj.getBlock(var1, var2, var3); return var4 == Blocks.ladder || var4 == Blocks.vine; } /** * Checks whether target entity is alive. */ public boolean isEntityAlive() { return !this.isDead && this.getHealth() > 0.0F; } /** * Called when the mob is falling. Calculates and applies fall damage. */ protected void fall(float p_70069_1_) { super.fall(p_70069_1_); PotionEffect var2 = this.getActivePotionEffect(Potion.jump); float var3 = var2 != null ? (float)(var2.getAmplifier() + 1) : 0.0F; int var4 = MathHelper.ceiling_float_int(p_70069_1_ - 3.0F - var3); if (var4 > 0) { this.playSound(this.func_146067_o(var4), 1.0F, 1.0F); this.attackEntityFrom(DamageSource.fall, (float)var4); int var5 = MathHelper.floor_double(this.posX); int var6 = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset); int var7 = MathHelper.floor_double(this.posZ); Block var8 = this.worldObj.getBlock(var5, var6, var7); if (var8.getMaterial() != Material.air) { Block.SoundType var9 = var8.stepSound; this.playSound(var9.func_150498_e(), var9.func_150497_c() * 0.5F, var9.func_150494_d() * 0.75F); } } } protected String func_146067_o(int p_146067_1_) { return p_146067_1_ > 4 ? "game.neutral.hurt.fall.big" : "game.neutral.hurt.fall.small"; } /** * Setups the entity to do the hurt animation. Only used by packets in multiplayer. */ public void performHurtAnimation() { this.hurtTime = this.maxHurtTime = 10; this.attackedAtYaw = 0.0F; } /** * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue */ public int getTotalArmorValue() { int var1 = 0; ItemStack[] var2 = this.getLastActiveItems(); int var3 = var2.length; for (int var4 = 0; var4 < var3; ++var4) { ItemStack var5 = var2[var4]; if (var5 != null && var5.getItem() instanceof ItemArmor) { int var6 = ((ItemArmor)var5.getItem()).damageReduceAmount; var1 += var6; } } return var1; } protected void damageArmor(float p_70675_1_) {} /** * Reduces damage, depending on armor */ protected float applyArmorCalculations(DamageSource p_70655_1_, float p_70655_2_) { if (!p_70655_1_.isUnblockable()) { int var3 = 25 - this.getTotalArmorValue(); float var4 = p_70655_2_ * (float)var3; this.damageArmor(p_70655_2_); p_70655_2_ = var4 / 25.0F; } return p_70655_2_; } /** * Reduces damage, depending on potions */ protected float applyPotionDamageCalculations(DamageSource p_70672_1_, float p_70672_2_) { if (p_70672_1_.isDamageAbsolute()) { return p_70672_2_; } else { if (this instanceof EntityZombie) { p_70672_2_ = p_70672_2_; } int var3; int var4; float var5; if (this.isPotionActive(Potion.resistance) && p_70672_1_ != DamageSource.outOfWorld) { var3 = (this.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5; var4 = 25 - var3; var5 = p_70672_2_ * (float)var4; p_70672_2_ = var5 / 25.0F; } if (p_70672_2_ <= 0.0F) { return 0.0F; } else { var3 = EnchantmentHelper.getEnchantmentModifierDamage(this.getLastActiveItems(), p_70672_1_); if (var3 > 20) { var3 = 20; } if (var3 > 0 && var3 <= 20) { var4 = 25 - var3; var5 = p_70672_2_ * (float)var4; p_70672_2_ = var5 / 25.0F; } return p_70672_2_; } } } /** * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health * second with the reduced value. Args: damageAmount */ protected void damageEntity(DamageSource p_70665_1_, float p_70665_2_) { if (!this.isEntityInvulnerable()) { p_70665_2_ = this.applyArmorCalculations(p_70665_1_, p_70665_2_); p_70665_2_ = this.applyPotionDamageCalculations(p_70665_1_, p_70665_2_); float var3 = p_70665_2_; p_70665_2_ = Math.max(p_70665_2_ - this.getAbsorptionAmount(), 0.0F); this.setAbsorptionAmount(this.getAbsorptionAmount() - (var3 - p_70665_2_)); if (p_70665_2_ != 0.0F) { float var4 = this.getHealth(); this.setHealth(var4 - p_70665_2_); this.func_110142_aN().func_94547_a(p_70665_1_, var4, p_70665_2_); this.setAbsorptionAmount(this.getAbsorptionAmount() - p_70665_2_); } } } public CombatTracker func_110142_aN() { return this._combatTracker; } public EntityLivingBase func_94060_bK() { return (EntityLivingBase)(this._combatTracker.func_94550_c() != null ? this._combatTracker.func_94550_c() : (this.attackingPlayer != null ? this.attackingPlayer : (this.entityLivingToAttack != null ? this.entityLivingToAttack : null))); } public final float getMaxHealth() { return (float)this.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue(); } /** * counts the amount of arrows stuck in the entity. getting hit by arrows increases this, used in rendering */ public final int getArrowCountInEntity() { return this.dataWatcher.getWatchableObjectByte(9); } /** * sets the amount of arrows stuck in the entity. used for rendering those */ public final void setArrowCountInEntity(int p_85034_1_) { this.dataWatcher.updateObject(9, Byte.valueOf((byte)p_85034_1_)); } /** * Returns an integer indicating the end point of the swing animation, used by {@link #swingProgress} to provide a * progress indicator. Takes dig speed enchantments into account. */ private int getArmSwingAnimationEnd() { return this.isPotionActive(Potion.digSpeed) ? 6 - (1 + this.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1 : (this.isPotionActive(Potion.digSlowdown) ? 6 + (1 + this.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) * 2 : 6); } /** * Swings the item the player is holding. */ public void swingItem() { if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; this.isSwingInProgress = true; if (this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().func_151247_a(this, new S0BPacketAnimation(this, 0)); } } } public void handleHealthUpdate(byte p_70103_1_) { if (p_70103_1_ == 2) { this.limbSwingAmount = 1.5F; this.hurtResistantTime = this.maxHurtResistantTime; this.hurtTime = this.maxHurtTime = 10; this.attackedAtYaw = 0.0F; this.playSound(this.getHurtSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); this.attackEntityFrom(DamageSource.generic, 0.0F); } else if (p_70103_1_ == 3) { this.playSound(this.getDeathSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); this.setHealth(0.0F); this.onDeath(DamageSource.generic); } else { super.handleHealthUpdate(p_70103_1_); } } /** * sets the dead flag. Used when you fall off the bottom of the world. */ protected void kill() { this.attackEntityFrom(DamageSource.outOfWorld, 4.0F); } /** * Updates the arm swing progress counters and animation progress */ protected void updateArmSwingProgress() { int var1 = this.getArmSwingAnimationEnd(); if (this.isSwingInProgress) { ++this.swingProgressInt; if (this.swingProgressInt >= var1) { this.swingProgressInt = 0; this.isSwingInProgress = false; } } else { this.swingProgressInt = 0; } this.swingProgress = (float)this.swingProgressInt / (float)var1; } public IAttributeInstance getEntityAttribute(IAttribute p_110148_1_) { return this.getAttributeMap().getAttributeInstance(p_110148_1_); } public BaseAttributeMap getAttributeMap() { if (this.attributeMap == null) { this.attributeMap = new ServersideAttributeMap(); } return this.attributeMap; } /** * Get this Entity's EnumCreatureAttribute */ public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.UNDEFINED; } /** * Returns the item that this EntityLiving is holding, if any. */ public abstract ItemStack getHeldItem(); /** * 0: Tool in Hand; 1-4: Armor */ public abstract ItemStack getEquipmentInSlot(int p_71124_1_); /** * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot */ public abstract void setCurrentItemOrArmor(int p_70062_1_, ItemStack p_70062_2_); /** * Set sprinting switch for Entity. */ public void setSprinting(boolean p_70031_1_) { super.setSprinting(p_70031_1_); IAttributeInstance var2 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); if (var2.getModifier(sprintingSpeedBoostModifierUUID) != null) { var2.removeModifier(sprintingSpeedBoostModifier); } if (p_70031_1_) { var2.applyModifier(sprintingSpeedBoostModifier); } } public abstract ItemStack[] getLastActiveItems(); /** * Returns the volume for the sounds this mob makes. */ protected float getSoundVolume() { return 1.0F; } /** * Gets the pitch of living sounds in living entities. */ protected float getSoundPitch() { return this.isChild() ? (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.5F : (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F; } /** * Dead and sleeping entities cannot move */ protected boolean isMovementBlocked() { return this.getHealth() <= 0.0F; } /** * Sets the position of the entity and updates the 'last' variables */ public void setPositionAndUpdate(double p_70634_1_, double p_70634_3_, double p_70634_5_) { this.setLocationAndAngles(p_70634_1_, p_70634_3_, p_70634_5_, this.rotationYaw, this.rotationPitch); } /** * Moves the entity to a position out of the way of its mount. */ public void dismountEntity(Entity p_110145_1_) { double var3 = p_110145_1_.posX; double var5 = p_110145_1_.boundingBox.minY + (double)p_110145_1_.height; double var7 = p_110145_1_.posZ; byte var9 = 1; for (int var10 = -var9; var10 <= var9; ++var10) { for (int var11 = -var9; var11 < var9; ++var11) { if (var10 != 0 || var11 != 0) { int var12 = (int)(this.posX + (double)var10); int var13 = (int)(this.posZ + (double)var11); AxisAlignedBB var2 = this.boundingBox.getOffsetBoundingBox((double)var10, 1.0D, (double)var11); if (this.worldObj.func_147461_a(var2).isEmpty()) { if (World.doesBlockHaveSolidTopSurface(this.worldObj, var12, (int)this.posY, var13)) { this.setPositionAndUpdate(this.posX + (double)var10, this.posY + 1.0D, this.posZ + (double)var11); return; } if (World.doesBlockHaveSolidTopSurface(this.worldObj, var12, (int)this.posY - 1, var13) || this.worldObj.getBlock(var12, (int)this.posY - 1, var13).getMaterial() == Material.water) { var3 = this.posX + (double)var10; var5 = this.posY + 1.0D; var7 = this.posZ + (double)var11; } } } } } this.setPositionAndUpdate(var3, var5, var7); } public boolean getAlwaysRenderNameTagForRender() { return false; } /** * Gets the Icon Index of the item currently held */ public IIcon getItemIcon(ItemStack p_70620_1_, int p_70620_2_) { return p_70620_1_.getItem().requiresMultipleRenderPasses() ? p_70620_1_.getItem().getIconFromDamageForRenderPass(p_70620_1_.getItemDamage(), p_70620_2_) : p_70620_1_.getIconIndex(); } /** * Causes this entity to do an upwards motion (jumping). */ protected void jump() { this.motionY = 0.41999998688697815D; if (this.isPotionActive(Potion.jump)) { this.motionY += (double)((float)(this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F); } if (this.isSprinting()) { float var1 = this.rotationYaw * 0.017453292F; this.motionX -= (double)(MathHelper.sin(var1) * 0.2F); this.motionZ += (double)(MathHelper.cos(var1) * 0.2F); } this.isAirBorne = true; } /** * Moves the entity based on the specified heading. Args: strafe, forward */ public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_) { double var8; if (this.isInWater() && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).capabilities.isFlying)) { var8 = this.posY; this.moveFlying(p_70612_1_, p_70612_2_, this.isAIEnabled() ? 0.04F : 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.800000011920929D; this.motionY *= 0.800000011920929D; this.motionZ *= 0.800000011920929D; this.motionY -= 0.02D; if (this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + 0.6000000238418579D - this.posY + var8, this.motionZ)) { this.motionY = 0.30000001192092896D; } } else if (this.handleLavaMovement() && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).capabilities.isFlying)) { var8 = this.posY; this.moveFlying(p_70612_1_, p_70612_2_, 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.5D; this.motionY *= 0.5D; this.motionZ *= 0.5D; this.motionY -= 0.02D; if (this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + 0.6000000238418579D - this.posY + var8, this.motionZ)) { this.motionY = 0.30000001192092896D; } } else { float var3 = 0.91F; if (this.onGround) { var3 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; } float var4 = 0.16277136F / (var3 * var3 * var3); float var5; if (this.onGround) { var5 = this.getAIMoveSpeed() * var4; } else { var5 = this.jumpMovementFactor; } this.moveFlying(p_70612_1_, p_70612_2_, var5); var3 = 0.91F; if (this.onGround) { var3 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; } if (this.isOnLadder()) { float var6 = 0.15F; if (this.motionX < (double)(-var6)) { this.motionX = (double)(-var6); } if (this.motionX > (double)var6) { this.motionX = (double)var6; } if (this.motionZ < (double)(-var6)) { this.motionZ = (double)(-var6); } if (this.motionZ > (double)var6) { this.motionZ = (double)var6; } this.fallDistance = 0.0F; if (this.motionY < -0.15D) { this.motionY = -0.15D; } boolean var7 = this.isSneaking() && this instanceof EntityPlayer; if (var7 && this.motionY < 0.0D) { this.motionY = 0.0D; } } this.moveEntity(this.motionX, this.motionY, this.motionZ); if (this.isCollidedHorizontally && this.isOnLadder()) { this.motionY = 0.2D; } if (this.worldObj.isClient && (!this.worldObj.blockExists((int)this.posX, 0, (int)this.posZ) || !this.worldObj.getChunkFromBlockCoords((int)this.posX, (int)this.posZ).isChunkLoaded)) { if (this.posY > 0.0D) { this.motionY = -0.1D; } else { this.motionY = 0.0D; } } else { this.motionY -= 0.08D; } this.motionY *= 0.9800000190734863D; this.motionX *= (double)var3; this.motionZ *= (double)var3; } this.prevLimbSwingAmount = this.limbSwingAmount; var8 = this.posX - this.prevPosX; double var9 = this.posZ - this.prevPosZ; float var10 = MathHelper.sqrt_double(var8 * var8 + var9 * var9) * 4.0F; if (var10 > 1.0F) { var10 = 1.0F; } this.limbSwingAmount += (var10 - this.limbSwingAmount) * 0.4F; this.limbSwing += this.limbSwingAmount; } /** * Returns true if the newer Entity AI code should be run */ protected boolean isAIEnabled() { return false; } /** * the movespeed used for the new AI system */ public float getAIMoveSpeed() { return this.isAIEnabled() ? this.landMovementFactor : 0.1F; } /** * set the movespeed used for the new AI system */ public void setAIMoveSpeed(float p_70659_1_) { this.landMovementFactor = p_70659_1_; } public boolean attackEntityAsMob(Entity p_70652_1_) { this.setLastAttacker(p_70652_1_); return false; } /** * Returns whether player is sleeping or not */ public boolean isPlayerSleeping() { return false; } /** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); if (!this.worldObj.isClient) { int var1 = this.getArrowCountInEntity(); if (var1 > 0) { if (this.arrowHitTimer <= 0) { this.arrowHitTimer = 20 * (30 - var1); } --this.arrowHitTimer; if (this.arrowHitTimer <= 0) { this.setArrowCountInEntity(var1 - 1); } } for (int var2 = 0; var2 < 5; ++var2) { ItemStack var3 = this.previousEquipment[var2]; ItemStack var4 = this.getEquipmentInSlot(var2); if (!ItemStack.areItemStacksEqual(var4, var3)) { ((WorldServer)this.worldObj).getEntityTracker().func_151247_a(this, new S04PacketEntityEquipment(this.getEntityId(), var2, var4)); if (var3 != null) { this.attributeMap.removeAttributeModifiers(var3.getAttributeModifiers()); } if (var4 != null) { this.attributeMap.applyAttributeModifiers(var4.getAttributeModifiers()); } this.previousEquipment[var2] = var4 == null ? null : var4.copy(); } } if (this.ticksExisted % 20 == 0) { this.func_110142_aN().func_94549_h(); } } this.onLivingUpdate(); double var9 = this.posX - this.prevPosX; double var10 = this.posZ - this.prevPosZ; float var5 = (float)(var9 * var9 + var10 * var10); float var6 = this.renderYawOffset; float var7 = 0.0F; this.field_70768_au = this.field_110154_aX; float var8 = 0.0F; if (var5 > 0.0025000002F) { var8 = 1.0F; var7 = (float)Math.sqrt((double)var5) * 3.0F; var6 = (float)Math.atan2(var10, var9) * 180.0F / (float)Math.PI - 90.0F; } if (this.swingProgress > 0.0F) { var6 = this.rotationYaw; } if (!this.onGround) { var8 = 0.0F; } this.field_110154_aX += (var8 - this.field_110154_aX) * 0.3F; this.worldObj.theProfiler.startSection("headTurn"); var7 = this.func_110146_f(var6, var7); this.worldObj.theProfiler.endSection(); this.worldObj.theProfiler.startSection("rangeChecks"); while (this.rotationYaw - this.prevRotationYaw < -180.0F) { this.prevRotationYaw -= 360.0F; } while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { this.prevRotationYaw += 360.0F; } while (this.renderYawOffset - this.prevRenderYawOffset < -180.0F) { this.prevRenderYawOffset -= 360.0F; } while (this.renderYawOffset - this.prevRenderYawOffset >= 180.0F) { this.prevRenderYawOffset += 360.0F; } while (this.rotationPitch - this.prevRotationPitch < -180.0F) { this.prevRotationPitch -= 360.0F; } while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { this.prevRotationPitch += 360.0F; } while (this.rotationYawHead - this.prevRotationYawHead < -180.0F) { this.prevRotationYawHead -= 360.0F; } while (this.rotationYawHead - this.prevRotationYawHead >= 180.0F) { this.prevRotationYawHead += 360.0F; } this.worldObj.theProfiler.endSection(); this.field_70764_aw += var7; } protected float func_110146_f(float p_110146_1_, float p_110146_2_) { float var3 = MathHelper.wrapAngleTo180_float(p_110146_1_ - this.renderYawOffset); this.renderYawOffset += var3 * 0.3F; float var4 = MathHelper.wrapAngleTo180_float(this.rotationYaw - this.renderYawOffset); boolean var5 = var4 < -90.0F || var4 >= 90.0F; if (var4 < -75.0F) { var4 = -75.0F; } if (var4 >= 75.0F) { var4 = 75.0F; } this.renderYawOffset = this.rotationYaw - var4; if (var4 * var4 > 2500.0F) { this.renderYawOffset += var4 * 0.2F; } if (var5) { p_110146_2_ *= -1.0F; } return p_110146_2_; } /** * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons * use this to react to sunlight and start to burn. */ public void onLivingUpdate() { if (this.jumpTicks > 0) { --this.jumpTicks; } if (this.newPosRotationIncrements > 0) { double var1 = this.posX + (this.newPosX - this.posX) / (double)this.newPosRotationIncrements; double var3 = this.posY + (this.newPosY - this.posY) / (double)this.newPosRotationIncrements; double var5 = this.posZ + (this.newPosZ - this.posZ) / (double)this.newPosRotationIncrements; double var7 = MathHelper.wrapAngleTo180_double(this.newRotationYaw - (double)this.rotationYaw); this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.newPosRotationIncrements); this.rotationPitch = (float)((double)this.rotationPitch + (this.newRotationPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements); --this.newPosRotationIncrements; this.setPosition(var1, var3, var5); this.setRotation(this.rotationYaw, this.rotationPitch); } else if (!this.isClientWorld()) { this.motionX *= 0.98D; this.motionY *= 0.98D; this.motionZ *= 0.98D; } if (Math.abs(this.motionX) < 0.005D) { this.motionX = 0.0D; } if (Math.abs(this.motionY) < 0.005D) { this.motionY = 0.0D; } if (Math.abs(this.motionZ) < 0.005D) { this.motionZ = 0.0D; } this.worldObj.theProfiler.startSection("ai"); if (this.isMovementBlocked()) { this.isJumping = false; this.moveStrafing = 0.0F; this.moveForward = 0.0F; this.randomYawVelocity = 0.0F; } else if (this.isClientWorld()) { if (this.isAIEnabled()) { this.worldObj.theProfiler.startSection("newAi"); this.updateAITasks(); this.worldObj.theProfiler.endSection(); } else { this.worldObj.theProfiler.startSection("oldAi"); this.updateEntityActionState(); this.worldObj.theProfiler.endSection(); this.rotationYawHead = this.rotationYaw; } } this.worldObj.theProfiler.endSection(); this.worldObj.theProfiler.startSection("jump"); if (this.isJumping) { if (!this.isInWater() && !this.handleLavaMovement()) { if (this.onGround && this.jumpTicks == 0) { this.jump(); this.jumpTicks = 10; } } else { this.motionY += 0.03999999910593033D; } } else { this.jumpTicks = 0; } this.worldObj.theProfiler.endSection(); this.worldObj.theProfiler.startSection("travel"); this.moveStrafing *= 0.98F; this.moveForward *= 0.98F; this.randomYawVelocity *= 0.9F; this.moveEntityWithHeading(this.moveStrafing, this.moveForward); this.worldObj.theProfiler.endSection(); this.worldObj.theProfiler.startSection("push"); if (!this.worldObj.isClient) { this.collideWithNearbyEntities(); } this.worldObj.theProfiler.endSection(); } protected void updateAITasks() {} protected void collideWithNearbyEntities() { List var1 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); if (var1 != null && !var1.isEmpty()) { for (int var2 = 0; var2 < var1.size(); ++var2) { Entity var3 = (Entity)var1.get(var2); if (var3.canBePushed()) { this.collideWithEntity(var3); } } } } protected void collideWithEntity(Entity p_82167_1_) { p_82167_1_.applyEntityCollision(this); } /** * Handles updating while being ridden by an entity */ public void updateRidden() { super.updateRidden(); this.field_70768_au = this.field_110154_aX; this.field_110154_aX = 0.0F; this.fallDistance = 0.0F; } /** * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, * posY, posZ, yaw, pitch */ public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_) { this.yOffset = 0.0F; this.newPosX = p_70056_1_; this.newPosY = p_70056_3_; this.newPosZ = p_70056_5_; this.newRotationYaw = (double)p_70056_7_; this.newRotationPitch = (double)p_70056_8_; this.newPosRotationIncrements = p_70056_9_; } /** * main AI tick function, replaces updateEntityActionState */ protected void updateAITick() {} protected void updateEntityActionState() { ++this.entityAge; } public void setJumping(boolean p_70637_1_) { this.isJumping = p_70637_1_; } /** * Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize */ public void onItemPickup(Entity p_71001_1_, int p_71001_2_) { if (!p_71001_1_.isDead && !this.worldObj.isClient) { EntityTracker var3 = ((WorldServer)this.worldObj).getEntityTracker(); if (p_71001_1_ instanceof EntityItem) { var3.func_151247_a(p_71001_1_, new S0DPacketCollectItem(p_71001_1_.getEntityId(), this.getEntityId())); } if (p_71001_1_ instanceof EntityArrow) { var3.func_151247_a(p_71001_1_, new S0DPacketCollectItem(p_71001_1_.getEntityId(), this.getEntityId())); } if (p_71001_1_ instanceof EntityXPOrb) { var3.func_151247_a(p_71001_1_, new S0DPacketCollectItem(p_71001_1_.getEntityId(), this.getEntityId())); } } } /** * returns true if the entity provided in the argument can be seen. (Raytrace) */ public boolean canEntityBeSeen(Entity p_70685_1_) { return this.worldObj.rayTraceBlocks(Vec3.createVectorHelper(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ), Vec3.createVectorHelper(p_70685_1_.posX, p_70685_1_.posY + (double)p_70685_1_.getEyeHeight(), p_70685_1_.posZ)) == null; } /** * returns a (normalized) vector of where this entity is looking */ public Vec3 getLookVec() { return this.getLook(1.0F); } /** * interpolated look vector */ public Vec3 getLook(float p_70676_1_) { float var2; float var3; float var4; float var5; if (p_70676_1_ == 1.0F) { var2 = MathHelper.cos(-this.rotationYaw * 0.017453292F - (float)Math.PI); var3 = MathHelper.sin(-this.rotationYaw * 0.017453292F - (float)Math.PI); var4 = -MathHelper.cos(-this.rotationPitch * 0.017453292F); var5 = MathHelper.sin(-this.rotationPitch * 0.017453292F); return Vec3.createVectorHelper((double)(var3 * var4), (double)var5, (double)(var2 * var4)); } else { var2 = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * p_70676_1_; var3 = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * p_70676_1_; var4 = MathHelper.cos(-var3 * 0.017453292F - (float)Math.PI); var5 = MathHelper.sin(-var3 * 0.017453292F - (float)Math.PI); float var6 = -MathHelper.cos(-var2 * 0.017453292F); float var7 = MathHelper.sin(-var2 * 0.017453292F); return Vec3.createVectorHelper((double)(var5 * var6), (double)var7, (double)(var4 * var6)); } } /** * Returns where in the swing animation the living entity is (from 0 to 1). Args: partialTickTime */ public float getSwingProgress(float p_70678_1_) { float var2 = this.swingProgress - this.prevSwingProgress; if (var2 < 0.0F) { ++var2; } return this.prevSwingProgress + var2 * p_70678_1_; } /** * interpolated position vector */ public Vec3 getPosition(float p_70666_1_) { if (p_70666_1_ == 1.0F) { return Vec3.createVectorHelper(this.posX, this.posY, this.posZ); } else { double var2 = this.prevPosX + (this.posX - this.prevPosX) * (double)p_70666_1_; double var4 = this.prevPosY + (this.posY - this.prevPosY) * (double)p_70666_1_; double var6 = this.prevPosZ + (this.posZ - this.prevPosZ) * (double)p_70666_1_; return Vec3.createVectorHelper(var2, var4, var6); } } /** * Performs a ray trace for the distance specified and using the partial tick time. Args: distance, partialTickTime */ public MovingObjectPosition rayTrace(double p_70614_1_, float p_70614_3_) { Vec3 var4 = this.getPosition(p_70614_3_); Vec3 var5 = this.getLook(p_70614_3_); Vec3 var6 = var4.addVector(var5.xCoord * p_70614_1_, var5.yCoord * p_70614_1_, var5.zCoord * p_70614_1_); return this.worldObj.func_147447_a(var4, var6, false, false, true); } /** * Returns whether the entity is in a local (client) world */ public boolean isClientWorld() { return !this.worldObj.isClient; } /** * Returns true if other Entities should be prevented from moving through this Entity. */ public boolean canBeCollidedWith() { return !this.isDead; } /** * Returns true if this entity should push and be pushed by other entities when colliding. */ public boolean canBePushed() { return !this.isDead; } public float getEyeHeight() { return this.height * 0.85F; } /** * Sets that this entity has been attacked. */ protected void setBeenAttacked() { this.velocityChanged = this.rand.nextDouble() >= this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue(); } public float getRotationYawHead() { return this.rotationYawHead; } /** * Sets the head's yaw rotation of the entity. */ public void setRotationYawHead(float p_70034_1_) { this.rotationYawHead = p_70034_1_; } public float getAbsorptionAmount() { return this.field_110151_bq; } public void setAbsorptionAmount(float p_110149_1_) { if (p_110149_1_ < 0.0F) { p_110149_1_ = 0.0F; } this.field_110151_bq = p_110149_1_; } public Team getTeam() { return null; } public boolean isOnSameTeam(EntityLivingBase p_142014_1_) { return this.isOnTeam(p_142014_1_.getTeam()); } /** * Returns true if the entity is on a specific team. */ public boolean isOnTeam(Team p_142012_1_) { return this.getTeam() != null ? this.getTeam().isSameTeam(p_142012_1_) : false; } public void func_152111_bt() {} public void func_152112_bu() {} }
[ "37310498+CodeMajorGeek@users.noreply.github.com" ]
37310498+CodeMajorGeek@users.noreply.github.com
396a6afccb0af4f75d65243ef5ae6d9d4d150a78
052013a5db546f94a455c23a6fe87c616f22b47b
/CarangosApp/src/main/java/br/com/caelum/fj59/carangos/gcm/Constantes.java
659c0429a067d08e0ce9a97c8a9bda5dca7d4c69
[]
no_license
cristianospsp/CarangosAppProject
e1587a6ccddb63d52528e05e54b149aea639e3d7
921b0d893c8acd45f2391960e835261588ba0d7f
refs/heads/master
2016-08-11T15:01:15.010538
2015-10-24T16:32:58
2015-10-24T16:32:58
44,012,032
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package br.com.caelum.fj59.carangos.gcm; /** * Created by android5372 on 17/10/15. */ public class Constantes { public static final String GCM_SERVER_ID = "290496985547"; public static final int ID_NOTIFICATION = 123456; }
[ "cristianospsp@gmail.com" ]
cristianospsp@gmail.com
5f300f8549eb062d3e3c5a89c2c38b1779734f09
bc67bd70aaa83b0c8c902defbb928838f5e9b668
/java/2.x/tags/picocontainer-2.4/container/src/test/org/picocontainer/tck/AbstractPicoContainerTest.java
df84da4d52524e744ef95dad12425f97ce34a00a
[ "BSD-3-Clause" ]
permissive
codehaus/picocontainer
b07475fe034384926579e2b4f6f25e68f057cae2
7be6b8b0eb33421dc7a755817628e06b79bd879d
refs/heads/master
2023-07-20T01:30:02.348980
2014-10-08T04:44:44
2014-10-08T04:44:44
36,501,409
2
2
null
null
null
null
UTF-8
Java
false
false
36,828
java
/***************************************************************************** * Copyright (C) PicoContainer Organization. All rights reserved. * * ------------------------------------------------------------------------- * * The software in this package is published under the terms of the BSD * * style license a copy of which has been included with this distribution in * * the LICENSE.txt file. * * * * Original code by * *****************************************************************************/ package org.picocontainer.tck; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; import org.junit.Test; import org.picocontainer.Behavior; import org.picocontainer.Characteristics; import org.picocontainer.ComponentAdapter; import org.picocontainer.ComponentFactory; import org.picocontainer.DefaultPicoContainer; import org.picocontainer.Disposable; import org.picocontainer.MutablePicoContainer; import org.picocontainer.NameBinding; import org.picocontainer.Parameter; import org.picocontainer.PicoCompositionException; import org.picocontainer.PicoContainer; import org.picocontainer.PicoException; import org.picocontainer.PicoVerificationException; import org.picocontainer.PicoVisitor; import org.picocontainer.Startable; import org.picocontainer.adapters.InstanceAdapter; import org.picocontainer.behaviors.AbstractBehavior; import org.picocontainer.behaviors.AdaptingBehavior; import org.picocontainer.injectors.AbstractInjector; import org.picocontainer.injectors.ConstructorInjector; import org.picocontainer.lifecycle.NullLifecycleStrategy; import org.picocontainer.monitors.NullComponentMonitor; import org.picocontainer.parameters.BasicComponentParameter; import org.picocontainer.parameters.ConstantParameter; import org.picocontainer.testmodel.DependsOnTouchable; import org.picocontainer.testmodel.SimpleTouchable; import org.picocontainer.testmodel.Touchable; import org.picocontainer.testmodel.Washable; import org.picocontainer.testmodel.WashableTouchable; import org.picocontainer.visitors.AbstractPicoVisitor; import org.picocontainer.visitors.TraversalCheckingVisitor; import org.picocontainer.visitors.VerifyingVisitor; /** This test tests (at least it should) all the methods in MutablePicoContainer. */ @SuppressWarnings("serial") public abstract class AbstractPicoContainerTest { protected abstract MutablePicoContainer createPicoContainer(PicoContainer parent); protected final MutablePicoContainer createPicoContainerWithDependsOnTouchableOnly() throws PicoCompositionException { MutablePicoContainer pico = createPicoContainer(null); pico.addComponent(DependsOnTouchable.class); return pico; } protected final MutablePicoContainer createPicoContainerWithTouchableAndDependsOnTouchable() throws PicoCompositionException { MutablePicoContainer pico = createPicoContainerWithDependsOnTouchableOnly(); pico.as(Characteristics.CACHE).addComponent(Touchable.class, SimpleTouchable.class); return pico; } @Test public void testBasicInstantiationAndContainment() throws PicoException { PicoContainer pico = createPicoContainerWithTouchableAndDependsOnTouchable(); assertTrue("Component should be instance of Touchable", Touchable.class.isAssignableFrom(pico.getComponentAdapter(Touchable.class, (NameBinding) null).getComponentImplementation())); } @Test public void testRegisteredComponentsExistAndAreTheCorrectTypes() throws PicoException { PicoContainer pico = createPicoContainerWithTouchableAndDependsOnTouchable(); assertNotNull("Container should have Touchable addComponent", pico.getComponentAdapter(Touchable.class, (NameBinding) null)); assertNotNull("Container should have DependsOnTouchable addComponent", pico.getComponentAdapter(DependsOnTouchable.class, (NameBinding) null)); assertTrue("Component should be instance of Touchable", pico.getComponent(Touchable.class) != null); assertTrue("Component should be instance of DependsOnTouchable", pico.getComponent(DependsOnTouchable.class) != null); assertNull("should not have non existent addComponent", pico.getComponentAdapter(Map.class, (NameBinding) null)); } @Test public void testRegistersSingleInstance() throws PicoException { MutablePicoContainer pico = createPicoContainer(null); StringBuffer sb = new StringBuffer(); pico.addComponent(sb); assertSame(sb, pico.getComponent(StringBuffer.class)); } @Test public void testContainerIsSerializable() throws PicoException, IOException, ClassNotFoundException { getTouchableFromSerializedContainer(); } private Touchable getTouchableFromSerializedContainer() throws IOException, ClassNotFoundException { MutablePicoContainer pico = createPicoContainerWithTouchableAndDependsOnTouchable(); // Add a list too, using a constant parameter pico.addComponent("list", ArrayList.class, new ConstantParameter(10)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(pico); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())); pico = (MutablePicoContainer)ois.readObject(); DependsOnTouchable dependsOnTouchable = pico.getComponent(DependsOnTouchable.class); assertNotNull(dependsOnTouchable); return pico.getComponent(Touchable.class); } @Test public void testSerializedContainerCanRetrieveImplementation() throws PicoException, IOException, ClassNotFoundException { Touchable touchable = getTouchableFromSerializedContainer(); SimpleTouchable simpleTouchable = (SimpleTouchable)touchable; assertTrue(simpleTouchable.wasTouched); } @Test public void testGettingComponentWithMissingDependencyFails() throws PicoException { PicoContainer picoContainer = createPicoContainerWithDependsOnTouchableOnly(); try { picoContainer.getComponent(DependsOnTouchable.class); fail("should need a Touchable"); } catch (AbstractInjector.UnsatisfiableDependenciesException e) { assertSame(picoContainer.getComponentAdapter(DependsOnTouchable.class, (NameBinding) null).getComponentImplementation(), e.getUnsatisfiableComponentAdapter().getComponentImplementation()); final Set unsatisfiableDependencies = e.getUnsatisfiableDependencies(); assertEquals(1, unsatisfiableDependencies.size()); // Touchable.class is now inside a List (the list of unsatisfied parameters) -- mparaz List unsatisfied = (List)unsatisfiableDependencies.iterator().next(); assertEquals(1, unsatisfied.size()); assertEquals(Touchable.class, unsatisfied.get(0)); } } @Test public void testDuplicateRegistration() { try { MutablePicoContainer pico = createPicoContainer(null); pico.addComponent(Object.class); pico.addComponent(Object.class); fail("Should have failed with duplicate registration"); } catch (PicoCompositionException e) { assertTrue("Wrong key", e.getMessage().indexOf(Object.class.toString()) > -1); } } @Test public void testExternallyInstantiatedObjectsCanBeRegisteredAndLookedUp() throws PicoException { MutablePicoContainer pico = createPicoContainer(null); final HashMap map = new HashMap(); pico.as(getProperties()).addComponent(Map.class, map); assertSame(map, pico.getComponent(Map.class)); } @Test public void testAmbiguousResolution() throws PicoCompositionException { MutablePicoContainer pico = createPicoContainer(null); pico.addComponent("ping", String.class); pico.addComponent("pong", "pang"); try { pico.getComponent(String.class); } catch (AbstractInjector.AmbiguousComponentResolutionException e) { assertTrue(e.getMessage().indexOf("java.lang.String") != -1); assertTrue(e.getMessage().indexOf("<no-component>") != -1); } } @Test public void testLookupWithUnregisteredKeyReturnsNull() throws PicoCompositionException { MutablePicoContainer pico = createPicoContainer(null); assertNull(pico.getComponent(String.class)); } @Test public void testLookupWithUnregisteredTypeReturnsNull() throws PicoCompositionException { MutablePicoContainer pico = createPicoContainer(null); assertNull(pico.getComponent(String.class)); } public static class ListAdder { public ListAdder(Collection<String> list) { list.add("something"); } } @Test public void testUnsatisfiableDependenciesExceptionGivesVerboseEnoughErrorMessage() { MutablePicoContainer pico = createPicoContainer(null); pico.addComponent(ComponentD.class); try { pico.getComponent(ComponentD.class); } catch (AbstractInjector.UnsatisfiableDependenciesException e) { Set unsatisfiableDependencies = e.getUnsatisfiableDependencies(); assertEquals(1, unsatisfiableDependencies.size()); List list = (List)unsatisfiableDependencies.iterator().next(); final List<Class> expectedList = new ArrayList<Class>(2); expectedList.add(ComponentE.class); expectedList.add(ComponentB.class); assertEquals(expectedList, list); } } @Test public void testUnsatisfiableDependenciesExceptionGivesUnsatisfiedDependencyTypes() { MutablePicoContainer pico = createPicoContainer(null); // D depends on E and B pico.addComponent(ComponentD.class); // first - do not register any dependency // should yield first unsatisfied dependency try { pico.getComponent(ComponentD.class); } catch (AbstractInjector.UnsatisfiableDependenciesException e) { Set unsatisfiableDependencies = e.getUnsatisfiableDependencies(); assertEquals(1, unsatisfiableDependencies.size()); List list = (List)unsatisfiableDependencies.iterator().next(); final List<Class> expectedList = new ArrayList<Class>(2); expectedList.add(ComponentE.class); expectedList.add(ComponentB.class); assertEquals(expectedList, list); Class unsatisfiedDependencyType = e.getUnsatisfiedDependencyType(); assertNotNull(unsatisfiedDependencyType); assertEquals(ComponentE.class, unsatisfiedDependencyType); } // now register only first dependency // should yield second unsatisfied dependency pico.addComponent(ComponentE.class); try { pico.getComponent(ComponentD.class); } catch (AbstractInjector.UnsatisfiableDependenciesException e) { Set unsatisfiableDependencies = e.getUnsatisfiableDependencies(); assertEquals(1, unsatisfiableDependencies.size()); List list = (List)unsatisfiableDependencies.iterator().next(); final List<Class> expectedList = new ArrayList<Class>(2); expectedList.add(ComponentE.class); expectedList.add(ComponentB.class); assertEquals(expectedList, list); Class unsatisfiedDependencyType = e.getUnsatisfiedDependencyType(); assertNotNull(unsatisfiedDependencyType); assertEquals(ComponentB.class, unsatisfiedDependencyType); } } @Test public void testCyclicDependencyThrowsCyclicDependencyException() { assertCyclicDependencyThrowsCyclicDependencyException(createPicoContainer(null)); } private static void assertCyclicDependencyThrowsCyclicDependencyException(MutablePicoContainer pico) { pico.addComponent(ComponentB.class); pico.addComponent(ComponentD.class); pico.addComponent(ComponentE.class); try { pico.getComponent(ComponentD.class); fail("CyclicDependencyException expected"); } catch (AbstractInjector.CyclicDependencyException e) { // CyclicDependencyException reports now the stack. //final List dependencies = Arrays.asList(ComponentD.class.getConstructors()[0].getParameterTypes()); final List<Class> dependencies = Arrays.<Class>asList(ComponentD.class, ComponentE.class, ComponentD.class); final List<Class> reportedDependencies = Arrays.asList(e.getDependencies()); assertEquals(dependencies, reportedDependencies); } catch (StackOverflowError e) { fail(); } } @Test public void testCyclicDependencyThrowsCyclicDependencyExceptionWithParentContainer() { MutablePicoContainer pico = createPicoContainer(createPicoContainer(null)); assertCyclicDependencyThrowsCyclicDependencyException(pico); } @Test public void testRemovalNonRegisteredComponentAdapterWorksAndReturnsNull() { final MutablePicoContainer picoContainer = createPicoContainer(null); assertNull(picoContainer.removeComponent("COMPONENT DOES NOT EXIST")); } /** Important! Nanning really, really depends on this! */ @Test public void testComponentAdapterRegistrationOrderIsMaintained() throws NoSuchMethodException { ConstructorInjector c1 = new ConstructorInjector("1", Object.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false); ConstructorInjector c2 = new ConstructorInjector("2", String.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false); MutablePicoContainer picoContainer = createPicoContainer(null); picoContainer.addAdapter(c1).addAdapter(c2); Collection<ComponentAdapter<?>> list2 = picoContainer.getComponentAdapters(); //registration order should be maintained assertEquals(2, list2.size()); assertEquals(c1.getComponentKey(), ((ComponentAdapter)list2.toArray()[0]).getComponentKey()); assertEquals(c2.getComponentKey(), ((ComponentAdapter)list2.toArray()[1]).getComponentKey()); picoContainer.getComponents(); // create all the instances at once assertFalse("instances should be created in same order as adapters are created", picoContainer.getComponents().get(0) instanceof String); assertTrue("instances should be created in same order as adapters are created", picoContainer.getComponents().get(1) instanceof String); MutablePicoContainer reversedPicoContainer = createPicoContainer(null); reversedPicoContainer.addAdapter(c2); reversedPicoContainer.addAdapter(c1); //registration order should be maintained list2 = reversedPicoContainer.getComponentAdapters(); assertEquals(2, list2.size()); assertEquals(c2.getComponentKey(), ((ComponentAdapter)list2.toArray()[0]).getComponentKey()); assertEquals(c1.getComponentKey(), ((ComponentAdapter)list2.toArray()[1]).getComponentKey()); reversedPicoContainer.getComponents(); // create all the instances at once assertTrue("instances should be created in same order as adapters are created", reversedPicoContainer.getComponents().get(0) instanceof String); assertFalse("instances should be created in same order as adapters are created", reversedPicoContainer.getComponents().get(1) instanceof String); } public static final class NeedsTouchable { public final Touchable touchable; public NeedsTouchable(Touchable touchable) { this.touchable = touchable; } } public static final class NeedsWashable { public final Washable washable; public NeedsWashable(Washable washable) { this.washable = washable; } } @Test public void testSameInstanceCanBeUsedAsDifferentTypeWhenCaching() { MutablePicoContainer pico = createPicoContainer(null); pico.as(Characteristics.CACHE).addComponent("wt", WashableTouchable.class); pico.addComponent("nw", NeedsWashable.class); pico.as(Characteristics.CACHE).addComponent("nt", NeedsTouchable.class); NeedsWashable nw = (NeedsWashable)pico.getComponent("nw"); NeedsTouchable nt = (NeedsTouchable)pico.getComponent("nt"); assertSame(nw.washable, nt.touchable); } @Test public void testRegisterComponentWithObjectBadType() throws PicoCompositionException { MutablePicoContainer pico = createPicoContainer(null); try { pico.addComponent(Serializable.class, new Object()); fail("Shouldn't be able to register an Object.class as Serializable because it is not, " + "it does not implement it, Object.class does not implement much."); } catch (ClassCastException e) { } } public static class JMSService { public final String serverid; public final String path; public JMSService(String serverid, String path) { this.serverid = serverid; this.path = path; } } // http://jira.codehaus.org/secure/ViewIssue.jspa?key=PICO-52 @Test public void testPico52() { MutablePicoContainer pico = createPicoContainer(null); pico.addComponent("foo", JMSService.class, new ConstantParameter("0"), new ConstantParameter("something")); JMSService jms = (JMSService)pico.getComponent("foo"); assertEquals("0", jms.serverid); assertEquals("something", jms.path); } public static class ComponentA { public final ComponentC c; public ComponentA(ComponentB b, ComponentC c) { this.c = c; assertNotNull(b); assertNotNull(c); } } public static class ComponentB { } public static class ComponentC { } public static class ComponentD { public ComponentD(ComponentE e, ComponentB b) { assertNotNull(e); assertNotNull(b); } } public static class ComponentE { public ComponentE(ComponentD d) { assertNotNull(d); } } public static class ComponentF { public ComponentF(ComponentA a) { assertNotNull(a); } } @Test public void testAggregatedVerificationException() { MutablePicoContainer pico = createPicoContainer(null); pico.addComponent(ComponentA.class); pico.addComponent(ComponentE.class); try { new VerifyingVisitor().traverse(pico); fail("we expect a PicoVerificationException"); } catch (PicoVerificationException e) { List nested = e.getNestedExceptions(); assertEquals(2, nested.size()); assertTrue(-1 != e.getMessage().indexOf(ComponentA.class.getName())); assertTrue(-1 != e.getMessage().indexOf(ComponentE.class.getName())); } } // An adapter has no longer a hosting container. // @Test public void testRegistrationOfAdapterSetsHostingContainerAsSelf() { // final InstanceAdapter componentAdapter = new InstanceAdapter("", new Object()); // final MutablePicoContainer picoContainer = createPicoContainer(null); // picoContainer.addAdapter(componentAdapter); // assertSame(picoContainer, componentAdapter.getContainer()); // } public static class ContainerDependency { public ContainerDependency(PicoContainer container) { assertNotNull(container); } } // ImplicitPicoContainer injection is bad. It is an open door for hackers. Developers with // special PicoContainer needs should specifically register() a comtainer they want components to // be able to pick up on. // @Test public void testImplicitPicoContainerInjection() { // MutablePicoContainer pico = createPicoContainer(null); // pico.addAdapter(ContainerDependency.class); // ContainerDependency dep = (ContainerDependency) pico.getComponent(ContainerDependency.class); // assertSame(pico, dep.pico); // } @Test public void testShouldReturnNullWhenUnregistereingUnmanagedComponent() { final MutablePicoContainer pico = createPicoContainer(null); assertNull(pico.removeComponentByInstance("yo")); } @Test public void testShouldReturnNullForComponentAdapterOfUnregisteredType() { final MutablePicoContainer pico = createPicoContainer(null); assertNull(pico.getComponent(List.class)); } @Test public void testShouldReturnNonMutableParent() { DefaultPicoContainer parent = new DefaultPicoContainer(); final MutablePicoContainer picoContainer = createPicoContainer(parent); assertNotSame(parent, picoContainer.getParent()); assertFalse(picoContainer.getParent() instanceof MutablePicoContainer); } class Foo implements Startable, Disposable { public boolean started; public boolean stopped; public boolean disposed; public void start() { started = true; } public void stop() { stopped = true; } public void dispose() { disposed = true; } } @Test public void testContainerCascadesDefaultLifecycle() { final MutablePicoContainer picoContainer = createPicoContainer(null); Foo foo = new Foo(); picoContainer.addComponent(foo); picoContainer.start(); assertEquals(true, foo.started); picoContainer.stop(); assertEquals(true, foo.stopped); picoContainer.dispose(); assertEquals(true, foo.disposed); } @Test public void testComponentInstancesFromParentsAreNotDirectlyAccessible2() { final MutablePicoContainer a = createPicoContainer(null); final MutablePicoContainer b = createPicoContainer(a); final MutablePicoContainer c = createPicoContainer(b); Object ao = new Object(); Object bo = new Object(); Object co = new Object(); a.addComponent("a", ao); b.addComponent("b", bo); c.addComponent("c", co); assertEquals(1, a.getComponents().size()); assertEquals(1, b.getComponents().size()); assertEquals(1, c.getComponents().size()); } @Test public void testStartStopAndDisposeCascadedtoChildren() { final MutablePicoContainer parent = createPicoContainer(null); parent.addComponent(new StringBuffer()); final MutablePicoContainer child = createPicoContainer(parent); parent.addChildContainer(child); child.addComponent(LifeCycleMonitoring.class); parent.start(); try { child.start(); fail("IllegalStateException expected"); } catch (IllegalStateException e) { assertEquals("child already started", "Cannot start. Current container state was: STARTED", e.getMessage()); } parent.stop(); try { child.stop(); fail("IllegalStateException expected"); } catch (IllegalStateException e) { assertEquals("child not started", "Cannot stop. Current container state was: STOPPED", e.getMessage()); } parent.dispose(); try { child.dispose(); fail("IllegalStateException expected"); } catch (IllegalStateException e) { assertEquals("child already disposed", "Cannot dispose. Current lifecycle state is: DISPOSED", e.getMessage()); } } @Test public void testMakingOfChildContainer() { final MutablePicoContainer parent = createPicoContainer(null); MutablePicoContainer child = parent.makeChildContainer(); assertNotNull(child); } @Test public void testMakingOfChildContainerPercolatesLifecycleManager() { final MutablePicoContainer parent = createPicoContainer(null); parent.addComponent("one", TestLifecycleComponent.class); MutablePicoContainer child = parent.makeChildContainer(); assertNotNull(child); child.addComponent("two", TestLifecycleComponent.class); parent.start(); try { child.start(); } catch (IllegalStateException e) { assertEquals("child already started", "Cannot start. Current container state was: STARTED", e.getMessage()); } //TODO - The Behavior reference in child containers is not used. Thus is is almost pointless // The reason is because DefaultPicoContainer's accept() method visits child containers' on its own. // This may be file for visiting components in a tree for general cases, but for lifecycle, we // should hand to each Behavior's start(..) at each appropriate node. See mail-list discussion. } public static final class TestBehavior extends AbstractBehavior implements Behavior { public final ArrayList<PicoContainer> started = new ArrayList<PicoContainer>(); public TestBehavior(ComponentAdapter delegate) { super(delegate); } public void start(PicoContainer node) { started.add(node); } public void stop(PicoContainer node) { } public void dispose(PicoContainer node) { } public boolean componentHasLifecycle() { return true; } public String getDescriptor() { return null; } } public static class TestLifecycleComponent implements Startable { public boolean started; public void start() { started = true; } public void stop() { } } @Test public void testStartStopAndDisposeNotCascadedtoRemovedChildren() { final MutablePicoContainer parent = createPicoContainer(null); parent.addComponent(new StringBuffer()); StringBuffer sb = parent.getComponents(StringBuffer.class).get(0); final MutablePicoContainer child = createPicoContainer(parent); assertEquals(parent, parent.addChildContainer(child)); child.addComponent(LifeCycleMonitoring.class); assertTrue(parent.removeChildContainer(child)); parent.start(); assertTrue(sb.toString().indexOf("-started") == -1); parent.stop(); assertTrue(sb.toString().indexOf("-stopped") == -1); parent.dispose(); assertTrue(sb.toString().indexOf("-disposed") == -1); } @Test public void testShouldCascadeStartStopAndDisposeToChild() { StringBuffer sb = new StringBuffer(); final MutablePicoContainer parent = createPicoContainer(null); parent.addComponent(sb); parent.addComponent(Map.class, HashMap.class); final MutablePicoContainer child = parent.makeChildContainer(); child.addComponent(LifeCycleMonitoring.class); Map map = parent.getComponent(Map.class); assertNotNull(map); parent.start(); try { child.start(); fail("IllegalStateException expected"); } catch (IllegalStateException e) { assertEquals("child already started", "Cannot start. Current container state was: STARTED", e.getMessage()); } parent.stop(); try { child.stop(); fail("IllegalStateException expected"); } catch (IllegalStateException e) { assertEquals("child not started", "Cannot stop. Current container state was: STOPPED", e.getMessage()); } parent.dispose(); try { child.dispose(); fail("IllegalStateException expected"); } catch (IllegalStateException e) { assertEquals("child already disposed", "Cannot dispose. Current lifecycle state is: DISPOSED", e.getMessage()); } } public static final class LifeCycleMonitoring implements Startable, Disposable { final StringBuffer sb; public LifeCycleMonitoring(StringBuffer sb) { this.sb = sb; sb.append("-instantiated"); } public void start() { sb.append("-started"); } public void stop() { sb.append("-stopped"); } public void dispose() { sb.append("-disposed"); } } public static class RecordingStrategyVisitor extends AbstractPicoVisitor { private final List<Object> list; public RecordingStrategyVisitor(List<Object> list) { this.list = list; } public boolean visitContainer(PicoContainer pico) { list.add(pico.getClass()); return CONTINUE_TRAVERSAL; } public void visitComponentAdapter(ComponentAdapter componentAdapter) { list.add(componentAdapter.getClass()); } public void visitComponentFactory(ComponentFactory componentFactory) { list.add(componentFactory.getClass()); } public void visitParameter(Parameter parameter) { list.add(parameter.getClass()); } } protected abstract Properties[] getProperties(); @Test public void testAcceptImplementsBreadthFirstStrategy() { final MutablePicoContainer parent = createPicoContainer(null); final MutablePicoContainer child = parent.makeChildContainer(); ComponentAdapter hashMapAdapter = parent.as(getProperties()).addAdapter(new ConstructorInjector(HashMap.class, HashMap.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false)) .getComponentAdapter(HashMap.class, (NameBinding) null); ComponentAdapter hashSetAdapter = parent.as(getProperties()).addAdapter(new ConstructorInjector(HashSet.class, HashSet.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false)) .getComponentAdapter(HashSet.class, (NameBinding) null); InstanceAdapter instanceAdapter = new InstanceAdapter(String.class, "foo", new NullLifecycleStrategy(), new NullComponentMonitor()); ComponentAdapter stringAdapter = parent.as(getProperties()).addAdapter(instanceAdapter).getComponentAdapter(instanceAdapter.getComponentKey()); ComponentAdapter arrayListAdapter = child.as(getProperties()).addAdapter(new ConstructorInjector(ArrayList.class, ArrayList.class, null, new NullComponentMonitor(), new NullLifecycleStrategy(), false)) .getComponentAdapter(ArrayList.class, (NameBinding) null); Parameter componentParameter = BasicComponentParameter.BASIC_DEFAULT; Parameter throwableParameter = new ConstantParameter(new Throwable("bar")); ConstructorInjector ci = new ConstructorInjector(Exception.class, Exception.class, new Parameter[] {componentParameter, throwableParameter}, new NullComponentMonitor(), new NullLifecycleStrategy(), false); ComponentAdapter exceptionAdapter = child.as(getProperties()).addAdapter(ci).getComponentAdapter(Exception.class, (NameBinding) null); List<Class> expectedList = new ArrayList<Class>(); addContainers(expectedList); addDefaultComponentFactories(expectedList); expectedList.add(hashMapAdapter.getClass()); expectedList.add(hashSetAdapter.getClass()); expectedList.add(stringAdapter.getClass()); addContainers(expectedList); addDefaultComponentFactories(expectedList); expectedList.add(arrayListAdapter.getClass()); expectedList.add(exceptionAdapter.getClass()); expectedList.add(componentParameter.getClass()); expectedList.add(throwableParameter.getClass()); List<Object> visitedList = new LinkedList<Object>(); PicoVisitor visitor = new RecordingStrategyVisitor(visitedList); visitor.traverse(parent); assertEquals(expectedList.size(), visitedList.size()); for (Class c : expectedList) { assertTrue(visitedList.remove(c)); } assertEquals(0, visitedList.size()); } /** * Verifies that you can halt a container traversal. */ @Test public void testAcceptIsAbortable() { final MutablePicoContainer parent = createPicoContainer(null); final MutablePicoContainer child = parent.makeChildContainer(); child.addComponent("This is a test"); TraversalCheckingVisitor parentComponentCountingVisitor = new TraversalCheckingVisitor() { private int containerCount = 0; private int componentInParentCount = 0; @Override public void visitComponentAdapter(ComponentAdapter<?> componentAdapter) { if (containerCount == 0) { fail("Should have visited a container first"); } fail("Should never have visited an adapter."); } @Override public boolean visitContainer(PicoContainer pico) { containerCount++; if (containerCount > 1) { return ABORT_TRAVERSAL; } return CONTINUE_TRAVERSAL; } }; parentComponentCountingVisitor.traverse(parent); } protected void addContainers(List expectedList) { expectedList.add(DefaultPicoContainer.class); } protected void addDefaultComponentFactories(List expectedList) { expectedList.add(AdaptingBehavior.class); } @Test public void testAmbiguousDependencies() throws PicoCompositionException { MutablePicoContainer pico = this.createPicoContainer(null); // Register two Touchables that Fred will be confused about pico.addComponent(SimpleTouchable.class); pico.addComponent(DerivedTouchable.class); // Register a confused DependsOnTouchable pico.addComponent(DependsOnTouchable.class); try { pico.getComponent(DependsOnTouchable.class); fail("DependsOnTouchable should have been confused about the two Touchables"); } catch (AbstractInjector.AmbiguousComponentResolutionException e) { List componentImplementations = Arrays.asList(e.getAmbiguousComponentKeys()); assertTrue(componentImplementations.contains(DerivedTouchable.class)); assertTrue(componentImplementations.contains(SimpleTouchable.class)); assertTrue(e.getMessage().indexOf(DerivedTouchable.class.getName()) != -1); } } public static class DerivedTouchable extends SimpleTouchable { public DerivedTouchable() { } } public static final class NonGreedyClass { public final int value = 0; public NonGreedyClass() { //Do nothing. } public NonGreedyClass(ComponentA component) { fail("Greedy Constructor should never have been called. Instead got: " + component); } } @Test public void testNoArgConstructorToBeSelected() { MutablePicoContainer pico = this.createPicoContainer(null); pico.addComponent(ComponentA.class); pico.addComponent(NonGreedyClass.class, NonGreedyClass.class, Parameter.ZERO); NonGreedyClass instance = pico.getComponent(NonGreedyClass.class); assertNotNull(instance); } }
[ "mauro@ac66bb80-72f5-0310-8d68-9f556cfffb23" ]
mauro@ac66bb80-72f5-0310-8d68-9f556cfffb23
4e35d2025a3e4cb3d7d52b2cb199af2dc826a9d3
c7a78629d7f03edbb135524c1de44947d449b4b5
/src/dp/Target_Sum.java
d07cd28cdfba304d9ce177091b6cc7f848669937
[]
no_license
Varun-28/DS_ALGO
8185fab39d6bcda204c5363e7ed237450140e5de
b82de95e95d3013a1bb6579da2ed0f77a34b3d29
refs/heads/master
2023-07-08T05:53:49.500245
2021-08-08T04:38:01
2021-08-08T04:38:01
292,850,281
3
1
null
null
null
null
UTF-8
Java
false
false
1,811
java
package dp; public class Target_Sum { static int countSubsetDiff(int set[], int diff){ int range = 0; for(int i : set){ range += i; } int sum = (diff + range)/2; return countSubsetSum(set, set.length, sum); } static int countSubsetSum(int set[], int n, int sum) { int subset[][] = new int[n + 1][sum + 1]; for (int i = 0; i <= sum; i++) subset[0][i] = 0; for (int i = 0; i <= n; i++) subset[i][0] = 1; for (int i = 1; i <= n; i++) { for (int j = 1; j <= sum; j++) { if(set[i - 1] <= j){ subset[i][j] = subset[i - 1][j] + subset[i - 1][j - set[i - 1]]; }else{ subset[i][j] = subset[i - 1][j]; } } } return subset[n][sum]; } /* Driver code*/ public static void main(String args[]) { int set[] = { 1, 2, 1, 3 }; int target = 1; System.out.println("Number of subet with target sum : " + countSubsetDiff(set, target)); } } /* Problem Statement : You are given an integer array nums and an integer target. You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers. For example, if nums = [2, 1], you can add a '+' before 2 and a '-' before 1 and concatenate them to build the expression "+2-1". Return the number of different expressions that you can build, which evaluates to target. */ /* Approach : set = [ 1, 1, 2, 3] sum = 1 + 1 - 1 - 2 + 3 = 1 or (1 + 3) - (1 + 2) = 1 So we have two subset having difference 1. The problem became same as count subset difference. */
[ "28varun28pp@gmail.com" ]
28varun28pp@gmail.com
0ebd8493c9f5d4bc80ab1231f009acf274ed91d9
fad867b8dd7b8afec3afff8750e4455f31ba9854
/src/EnemyEasyFactory.java
005f87d384d6ea29db35420d6b817b33456e7ab4
[]
no_license
Voltinus/gra-ztp
3dcc3c8c848257b297d133bd53d4b6d5a6f13a78
385d360a3d12d6afbb29928cbe16fa1967b80725
refs/heads/main
2023-02-24T21:14:33.014761
2021-01-27T15:18:43
2021-01-27T15:18:43
332,047,134
0
0
null
null
null
null
UTF-8
Java
false
false
115
java
public class EnemyEasyFactory extends EnemyFactory { public Enemy createEnemy() { return new EnemyEasy(); } }
[ "voltinusmail@gmail.com" ]
voltinusmail@gmail.com
749cf27f01aa21194269af56f0fc380120dc5224
600792877088d46531cb71faf2cf9ab6b7a9358f
/src/main/java/com/chocolate/chocolateQuest/gui/GuiButtonMultiOptions.java
1bd780ce1965515acbe5c037f0a473c747ad7bf7
[]
no_license
Bogdan-G/chocolateQuest
e6ca3da6a85eddc7291ef7ea4fdf67b8c237362b
8f79017f45ac18e14e9db6329cb787195988ff2d
refs/heads/master
2020-04-15T03:49:36.507542
2019-01-09T23:06:52
2019-01-09T23:06:52
164,361,568
1
0
null
null
null
null
UTF-8
Java
false
false
1,000
java
package com.chocolate.chocolateQuest.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @SideOnly(Side.CLIENT) public class GuiButtonMultiOptions extends GuiButton { public int value = 0; String[] names; public GuiButtonMultiOptions(int id, int posX, int posY, int width, int height, String[] par5Str, int value) { super(id, posX, posY, width, height, par5Str[value]); this.names = par5Str; this.value = value; } public boolean mousePressed(Minecraft mc, int x, int y) { if(super.mousePressed(mc, x, y)) { this.setValue(++this.value); return true; } else { return false; } } public void setValue(int value) { if(value >= this.names.length) { value = 0; } this.value = value; super.displayString = this.names[value]; } }
[ "bogdangtt@gmail.com" ]
bogdangtt@gmail.com
80134d8ed3ea199bbf34208dae3e9bb629babf53
7202cb1dac30cc7fd03cd0b265134a98dbc7660a
/kodilla-patterns2/src/test/java/com/kodilla/patterns2/adapter/company/SalaryAdapterTestSuite.java
cceb967010045cdc6d227609638a707fb4c5e715
[]
no_license
MarcinSkrzecz/Marcin-Skrzecz-kodilla-java
631f662110652565de2686041f04d107dac91d8a
893f4a96c458f0e8a1207ddefdde9b2f699b93dc
refs/heads/master
2021-05-17T01:26:34.600985
2020-10-22T21:06:01
2020-10-22T21:06:01
250,555,741
0
0
null
null
null
null
UTF-8
Java
false
false
637
java
package com.kodilla.patterns2.adapter.company; import com.kodilla.patterns2.adapter.company.oldHrSystem.Workers; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class SalaryAdapterTestSuite { @Test public void testTotalSalary() { //Given Workers workers = new Workers(); SalaryAdapter salaryAdapter = new SalaryAdapter(); //When double totalSalary = salaryAdapter.TotalSalary(workers.getWorkers(), workers.getSalaries()); //Then System.out.println(totalSalary); assertEquals(totalSalary, 27750, 0); } }
[ "marpiowawa@o2.pl" ]
marpiowawa@o2.pl
3f12efa1540ae8368a64143c50554c196d6fc5e6
870c9b440fd94a3af193cf21648fac3ea736d018
/src/com/wnt/web/securitycheck/entry/Baseline.java
3387ab7498a5829bec2ee9e540f27b1351e68b6b
[]
no_license
internaldevelop/VD
389ff7945f7d752cea52393b712b7e1da474ff98
7f235244b028f2730b13bfa9d2cee2b6af557cb2
refs/heads/master
2020-05-23T13:31:46.671425
2019-05-15T08:20:49
2019-05-15T08:20:49
186,779,427
1
0
null
null
null
null
UTF-8
Java
false
false
1,087
java
package com.wnt.web.securitycheck.entry; /** * 安全检查配置基线 * @author gyk * */ public class Baseline { /** * 主键ID */ private String id; /** * 选项名称 */ private String name; /** * 值 */ private String value; /** * 说明 */ private String explain; /** * 获取主键ID * @return */ public String getId() { return id; } /** * 设置主键ID * @param id */ public void setId(String id) { this.id = id; } /** * 获取主键名称 * @return */ public String getName() { return name; } /** * 设置主键名称 * @param name */ public void setName(String name) { this.name = name; } /** * 获取值 * @return */ public String getValue() { return value; } /** * 设置值 * @param value */ public void setValue(String value) { this.value = value; } /** * 获取说明 * @return */ public String getExplain() { return explain; } /** * 设置说明 * @param explain */ public void setExplain(String explain) { this.explain = explain; } }
[ "handan_bxd@163.com" ]
handan_bxd@163.com
7ee98dfda5c192ea730b600841c000173e991874
244b0d5bf1a69f60b31b505c03f4fa1401b1c445
/map-reduce/src/test/java/com/riskiq/solr/hadoop/SolrIndexDriverTest.java
5b0b591635c2643408322985619d11f529fc94c6
[ "Apache-2.0" ]
permissive
RiskIQ/solr-map-reduce
9d9185ae983d9540f0f6626bac2b995d2c60ebc1
bcdeb76112668af458012c9fce6fce2be572d11f
refs/heads/master
2021-07-13T04:39:47.068905
2021-06-14T20:39:56
2021-06-14T20:39:56
125,115,745
3
1
Apache-2.0
2021-06-14T20:36:04
2018-03-13T21:16:16
Java
UTF-8
Java
false
false
2,639
java
package com.riskiq.solr.hadoop; import org.apache.hadoop.util.ToolRunner; import org.apache.lucene.index.SegmentInfos; import org.apache.lucene.search.MatchAllDocsQuery; import org.apache.lucene.search.SearcherFactory; import org.apache.lucene.search.SearcherManager; import org.apache.lucene.search.TopDocs; import org.apache.lucene.store.MMapDirectory; import org.junit.Test; import java.io.File; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; /** * @author Joe Linn * 01/08/2020 */ public class SolrIndexDriverTest extends IndexingTestCase { @Test public void testCreateIndex() throws Exception { // write some data File inputDir = temporaryFolder.newFolder("input"); final int numDocs = 50; writeInputFile(new File(inputDir, "part-r-00000.txt"), 0, numDocs); // set up Solr configs File solrHomeDir = temporaryFolder.newFolder("solrHome"); copySolrConfigs(solrHomeDir); // create an index File outputDir = new File(temporaryFolder.getRoot(), "output"); ToolRunner.run(getConf(), new SolrIndexDriver(), new String[]{ "-Dmapreduce.job.map.class=com.riskiq.solr.hadoop.IndexingTestCase$TestSolrMapper", "-Dmapreduce.job.partitioner.class=com.riskiq.solr.hadoop.SolrCloudCompositeIdRoutingPartitioner", "-Dsolr.record.writer.batch.size=20", "--solr-home-dir", "file://" + solrHomeDir.getAbsolutePath(), "--shards", "1", "--reducers", "1", "--output-dir", outputDir.getAbsolutePath(), "-i", inputDir.getAbsolutePath() }); assertThat(outputDir.exists(), equalTo(true)); File reducersDir = new File(outputDir, "reducers"); assertThat(reducersDir.exists(), equalTo(true)); File part0Dir = new File(reducersDir, "part-r-00000"); assertThat(part0Dir.exists(), equalTo(true)); assertThat(part0Dir.isDirectory(), equalTo(true)); try (MMapDirectory mmap = new MMapDirectory(new File(part0Dir, "data/index").toPath());) { SearcherFactory searcherFactory = new SearcherFactory(); SearcherManager searcherManager = new SearcherManager(mmap, searcherFactory); TopDocs topDocs = searcherManager.acquire().search(new MatchAllDocsQuery(), numDocs); assertThat(topDocs.totalHits.value, equalTo((long) numDocs)); SegmentInfos segmentInfos = SegmentInfos.readLatestCommit(mmap); assertThat(segmentInfos.size(), equalTo(1)); } } }
[ "joseph.linn@riskiq.net" ]
joseph.linn@riskiq.net
608e364e1811fcccaaafa89a4769892ea75e74db
be38da3ebcc56d82d0440de574c14a571aae155d
/DockerSpringRest/src/main/java/com/experiment/Mayank/DockerSpringBoot/DockerSpringBootApplication.java
e15193b00ab00ea0e75aeef2a4c601ea79a1fa26
[]
no_license
Mayank926/DockerSpringboot
51f9997f93dd39afa6b4e565a6610dcc9b923bd6
17fee043c253b3fb8c20f16ec5f30565fd5a29d1
refs/heads/master
2021-04-13T12:40:09.266508
2020-03-22T12:52:41
2020-03-22T12:52:41
249,164,029
0
0
null
null
null
null
UTF-8
Java
false
false
488
java
package com.experiment.Mayank.DockerSpringBoot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @ComponentScan("com.experiment.Mayank") @SpringBootApplication public class DockerSpringBootApplication { public static void main(String[] args) { System.out.println("Running app"); SpringApplication.run(DockerSpringBootApplication.class, args); } }
[ "mayank.madhav@hotmail.com" ]
mayank.madhav@hotmail.com
980d1a12b6abe29a6535f0327f735b61c10205b6
08bfc6ad269cdef5dc9252e587412d9e83be710e
/src/main/java/oop/g8/repository/relation/person/P2OR.java
d1f3ea2581de0fa6d8c5cc2841ddb5be4f70b6c7
[]
no_license
dinhhoangnam998/20181-OOP-Neo4j
c9eaae40ee8693ef9b6b6b1cf4864f29dbc77986
5b25658c8f7fcaae1841894cc318ba7a35c7ed69
refs/heads/master
2021-10-09T15:47:10.688923
2018-12-31T09:41:00
2018-12-31T09:41:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package oop.g8.repository.relation.person; import java.util.List; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.neo4j.repository.Neo4jRepository; import org.springframework.stereotype.Repository; import oop.g8.model.relation.person.P2O; @Repository public interface P2OR extends Neo4jRepository<P2O, Long> { Page<P2O> findAll(Pageable page); List<P2O> findByPerson_NameAndOrganization_Name(String name1, String name2); List<P2O> findByPerson_NameAndType(String name, String type); List<P2O> findByTypeAndOrganization_Name(String string, String organization); List<P2O> findByTypeLikeAndOrganization_Name(String string, String organization); }
[ "20162793@student.hust.edu.vn" ]
20162793@student.hust.edu.vn
6039ea0ab24d761dd8bad198e35ed6957a52f358
93738c1e75cb2bd7f2712f6e6f39d95348485489
/Tema10_poo/src/EJERCICIO2/PruebaVehiculos.java
e84508744c8af3fd984f9792afe691a90b379686
[]
no_license
alvarolopezgarcia1/EjerciciosJava
9c6e4de39ffdcf12eb329557e3e1ad433cbbe42e
1ad19ef42920a2815e67cfd288403a7e3e32a36a
refs/heads/master
2020-05-28T02:55:42.084194
2019-05-27T14:34:08
2019-05-27T14:34:08
188,858,579
0
0
null
null
null
null
UTF-8
Java
false
false
1,618
java
package EJERCICIO2; import java.util.*; public class PruebaVehiculos { static Scanner s = new Scanner(System.in); public static void main(String[] args) { int opcion = 0; int km; Bicicleta bhSpeedrom = new Bicicleta(9); Coche saab93 = new Coche(1900); while (opcion != 8) { System.out.println("1. Anda con la bicicleta"); System.out.println("2. Haz el caballito con la bicicleta"); System.out.println("3. Anda con el coche"); System.out.println("4. Quema rueda con el coche"); System.out.println("5. Ver kilometraje de la bicicleta"); System.out.println("6. Ver kilometraje del coche"); System.out.println("7. Ver kilometraje total"); System.out.println("8. Salir"); System.out.println("Elige una opción (1-8): "); opcion =s.nextInt(); } switch (opcion) { case 1: System.out.print("¿Cuántos kilómetros quiere recorrer? "); km = s.nextInt(); bhSpeedrom.recorre(km); break; case 2: bhSpeedrom.hazCaballito(); break; case 3: System.out.print("¿Cuántos kilómetros quiere recorrer? "); km = s.nextInt(); saab93.recorre(km); break; case 4: saab93.hazDerrape(); break; case 5: System.out.println("La bicicleta lleva recorridos "); System.out.println(bhSpeedrom.getkilometrosRecorridos() + " Km"); break; case 6: System.out.println("El coche lleva recorridos "); System.out.println(saab93.getkilometrosRecorridos() + " Km"); break; case 7: System.out.println("Los vehículos llevan recorridos "); System.out.println(Vehiculos.getKilometrosTotales() + " Km"); default: } } }
[ "lopezalvaro0@gmail.com" ]
lopezalvaro0@gmail.com
aba716d50f28cf604c7b2058468b78934c9b0ad5
1f45b6e8a91221c24b91802eb60d1b8bb04b2820
/mm-admin-backend/src/main/java/com/mm/admin/modules/system/repository/DictDetailRepository.java
1b8280a38485c8d70b6e8a888b6699aff1d37714
[]
no_license
longlylong/spring-cloud-alibaba
1c32d992d15f5f2670e3a43ddcfa291b375821e3
a686d1aa7c7f38ec47fb860d846869dd3418664d
refs/heads/master
2023-04-08T10:09:46.198448
2022-03-19T10:07:42
2022-03-19T10:07:42
181,682,249
76
18
null
2023-03-31T14:53:37
2019-04-16T12:10:31
Java
UTF-8
Java
false
false
482
java
package com.mm.admin.modules.system.repository; import com.mm.admin.modules.system.domain.DictDetail; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import java.util.List; public interface DictDetailRepository extends JpaRepository<DictDetail, Long>, JpaSpecificationExecutor<DictDetail> { /** * 根据字典名称查询 */ List<DictDetail> findByDictName(String name); }
[ "king@51tcf.com" ]
king@51tcf.com
9e6b6923fd1e568fef2f55bfea8871487acdcee6
312a313212977d6d74f2e703374284f211d8fe9e
/a.java
81865bbc052eeebfeda6cfcaabfb90de4c857bca
[]
no_license
x972976173/test1
9d9e43bc54f3118dd5129ee5719db137f8e9f66c
5eabacdde7b1fe7287b41b5492cd91249b59e800
refs/heads/master
2020-03-17T23:02:54.561676
2018-05-19T23:36:23
2018-05-19T23:36:23
134,029,527
0
0
null
null
null
null
UTF-8
Java
false
false
96
java
public class a { public static void main (String [] args){ System.out.println("hello"); } }
[ "972976173@qq.com" ]
972976173@qq.com
ad31ed95ae4b0e7411516627884163156aeebcc1
0fd8b8c55502df3f3775823124a6bcdcfa1041d6
/tcc-redpacket/src/main/java/com/th/controller/RedPacketController.java
a321df5889edb255d4a494170c9f69786a180d98
[]
no_license
904140036/tcc-dubbo
5523aaf0be3e94b6c7cf04e0efbc8193815bca8e
dd171b8506d5a9d6b6bac114dbad2b85acbbd99e
refs/heads/master
2020-04-12T14:25:07.223171
2018-12-20T08:56:43
2018-12-20T08:56:43
162,551,869
0
0
null
null
null
null
UTF-8
Java
false
false
780
java
package com.th.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.th.entity.Order; import com.th.service.RedPacketService; @Controller public class RedPacketController { @Autowired private RedPacketService redPacketService; @RequestMapping(value = "/createRedPacket", produces = { "application/json;charset=UTF-8" }) @ResponseBody @Transactional public String createRedPacket() { Integer id = redPacketService.insertRedPacket(new Order()); return "红包插入成功,红包ID " + id; } }
[ "904140036@qq.com" ]
904140036@qq.com
8b8e1e824eb97d8d613d615dde614b7c9b62cf8f
1a32d704493deb99d3040646afbd0f6568d2c8e7
/BOOT-INF/lib/org/apache/catalina/servlet4preview/RequestDispatcher.java
e45913af26477596fdb34996c217bc95025f04ef
[]
no_license
yanrumei/bullet-zone-server-2.0
e748ff40f601792405143ec21d3f77aa4d34ce69
474c4d1a8172a114986d16e00f5752dc019cdcd2
refs/heads/master
2020-05-19T11:16:31.172482
2019-03-25T17:38:31
2019-03-25T17:38:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
564
java
package org.apache.catalina.servlet4preview; @Deprecated public abstract interface RequestDispatcher extends javax.servlet.RequestDispatcher { public static final String FORWARD_MAPPING = "javax.servlet.forward.mapping"; public static final String INCLUDE_MAPPING = "javax.servlet.include.mapping"; } /* Location: C:\Users\ikatwal\Downloads\bullet-zone-server-2.0.jar!\BOOT-INF\lib\tomcat-embed-core-8.5.27.jar!\org\apache\catalina\servlet4preview\RequestDispatcher.class * Java compiler version: 7 (51.0) * JD-Core Version: 0.7.1 */
[ "ishankatwal@gmail.com" ]
ishankatwal@gmail.com
7253a463e4aac5c8e7c38e1b76730fdef5660460
a7addf61eda620f797d2eb4cb5473de344f6b19c
/app/src/main/java/com/tesu/creditgold/bean/GetStoreDescByUsridResponse.java
2143935e507e2509c78cf848e437595628a77e6f
[]
no_license
liuminert/credit_money_android
2e4777b8b8e169a6c723099bdd15837ec9c0d2fa
d50e41e3f8522cac9bb0cfca4a6cd41575ecb7f8
refs/heads/master
2020-04-11T03:09:43.454527
2019-04-12T07:45:45
2019-04-12T07:45:45
103,117,917
0
0
null
null
null
null
UTF-8
Java
false
false
874
java
package com.tesu.creditgold.bean; /** * Created by Administrator on 2017/1/19 0019. */ public class GetStoreDescByUsridResponse { private int code; private String msg; private ShopBean store_info; @Override public String toString() { return "GetStoreDescByUsridResponse{" + "code=" + code + ", msg='" + msg + '\'' + ", store_info=" + store_info + '}'; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public ShopBean getStore_info() { return store_info; } public void setStore_info(ShopBean store_info) { this.store_info = store_info; } }
[ "liuminert@163.com" ]
liuminert@163.com
22e275f95d386bbba6c4c28fb474637cdbcaa00d
b2c386a7983fdc2cc3d73d57abcb7c75fb9ad008
/L071-atm/src/main/java/ru/otus/MainClass.java
3ed5fd12873af48ea24ee963f4c1f3a32f5f7a35
[]
no_license
UnforgivenHell/otus-java-2018-12-unforgiven
6d65faaa1030de6fc79fb046a3c7e8d191bcfa47
b22a251d8e69452fb4371847dba69c30ec4def59
refs/heads/master
2020-04-15T13:17:39.627951
2019-04-27T18:13:19
2019-04-27T18:13:19
164,710,917
0
0
null
null
null
null
UTF-8
Java
false
false
1,389
java
package ru.otus; import ru.otus.ATM.ATM; import ru.otus.ATM.ATMImpl; import java.util.Collections; import java.util.Map; import java.util.Random; import java.util.TreeMap; public class MainClass { public static void main(String[] args) { ATM atm = new ATMImpl("Test_01"); Incass(atm); atm.cashAdvance(-1); atm.cashAdvance(10000000); atm.cashAdvance(20); atm.cashAdvance(atm.getBalance()); Incass(atm); atm.cashAdvance(400); atm.cashAdvance(900); atm.cashAdvance(2200); atm.cashAdvance(22500); } static void Incass(ATM atm){ Random rn = new Random(); Integer maxCount = 100; Integer cassetId = rn.nextInt(6); Map<Integer, Integer> cassette = new TreeMap<>(); if (cassetId != 0) { cassette.put(100, rn.nextInt(maxCount)); } if (cassetId != 1) { cassette.put(200, rn.nextInt(maxCount)); } if (cassetId != 2) { cassette.put(500, rn.nextInt(maxCount)); } if (cassetId != 3) { cassette.put(1000, rn.nextInt(maxCount)); } if (cassetId != 4) { cassette.put(5000, rn.nextInt(maxCount)); } if (cassetId != 5) { cassette.put(2000, rn.nextInt(maxCount)); } atm.incass(cassette); } }
[ "unforgivenhell@mail.ru" ]
unforgivenhell@mail.ru
0586f45df548a3ed3e90944e9e8e7fa41163c38b
758aff53d4988a9631d80709820d1cbf30b61557
/Calculator/src/com/training/patterns/bridge/AsfaltDaBisiklet.java
db3205f736e66f726b587049242b64c1461ebe09
[]
no_license
osmanyoy/mavi
032aa9a120fa3b85d5fc556023d8ef34c73febfc
6e9d4a597aba5e0a70b083e4059f0f39f0bfd875
refs/heads/master
2020-04-07T07:13:46.608344
2018-06-02T11:21:53
2018-06-02T11:21:53
124,191,750
0
0
null
null
null
null
UTF-8
Java
false
false
142
java
package com.training.patterns.bridge; public class AsfaltDaBisiklet extends Bisiklet { public AsfaltDaBisiklet() { super(10); } }
[ "METOD@APOLLON00" ]
METOD@APOLLON00
94a9faff1d0459878fa4ac4c8333147d9729aa43
9ac0b9ae36538bec2f97f2ce194fd4ec51fae745
/app/src/main/java/android/support/v4/f/c.java
9d922fce1f816b940a1e4a815f9ad3de98a01b9d
[]
no_license
siyamkhan/HomeAutomaation
f7fceefb9d59f55f4c268d65501affa5e2d148e1
114945fd602cbed1bf4b857dd184abb62b40f851
refs/heads/master
2020-09-01T18:32:21.695359
2019-11-01T19:27:34
2019-11-01T19:27:34
219,026,745
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package android.support.v4.f; public interface c { boolean a(CharSequence paramCharSequence, int paramInt1, int paramInt2); } /* Location: C:\Users\Siyam\Desktop\Home automation with java source files\Decompile tools\New folder\dex2jar-0.0.9.15-master\classes_dex2jar.jar!\android\support\v4\f\c.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.0.7 */
[ "siyamk756@gmail.com" ]
siyamk756@gmail.com
7edc85340e82c74220e8e9e40f3c10116277bb66
2b4dd0222019950e28b33d7deaa37ceefce4ca6b
/mobiledevknlibs/src/main/java/com/kalbe/mobiledevknlibs/PickImageAndFile/PickImageCustom.java
465f614d9e2635860216a69eedef8765eb0dad98
[]
no_license
robertocapah/SIMANTRAS
d20d335d48e21614b42602b7a90bdd54fab8dbbf
65f3a2a173eebbbf1bc8839c8e023eda10c9a5d0
refs/heads/master
2020-05-05T13:13:45.832514
2019-08-26T02:23:49
2019-08-26T02:23:49
180,067,416
0
0
null
null
null
null
UTF-8
Java
false
false
5,514
java
package com.kalbe.mobiledevknlibs.PickImageAndFile; import android.Manifest; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.provider.MediaStore; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.widget.Toast; import com.kalbe.mobiledevknlibs.PermissionChecker.PermissionChecker; import java.net.URI; /** * Created by Rian Andrivani on 1/12/2018. */ public class PickImageCustom { public static void selectImageProfile(final Context context, final String folderPath, final int REQUEST_CODE_CAMERA, final int REQUEST_CODE_GALLERY) { final CharSequence[] items = { "Ambil Foto", "Pilih dari Galeri", "Batal" }; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Add Photo"); builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { boolean result= PermissionChecker.Utility.checkPermission(context); if (items[item].equals("Ambil Foto")) { if(result) CaptureImageCustomUri(context, folderPath, REQUEST_CODE_CAMERA); } else if (items[item].equals("Pilih dari Galeri")) { if(result) galleryIntent(context, REQUEST_CODE_GALLERY); } else if (items[item].equals("Batal")) { dialog.dismiss(); } } }); builder.show(); } private static void CaptureImageCustomUri(Context context, String folderName, final int REQUEST_CODE) { boolean result = PermissionChecker.Utility.checkPermission(context); if (result){ Uri uriImage = new UriData().getOutputMediaImageUriCons(context, folderName); Intent intentCamera1 = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intentCamera1.putExtra(MediaStore.EXTRA_OUTPUT, uriImage); ((Activity)context).startActivityForResult(intentCamera1, REQUEST_CODE); } } private static void galleryIntent(Context context, int REQUEST_CODE) { boolean result = PermissionChecker.Utility.checkPermission(context); if (result){ Intent pickPhoto = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); ((Activity)context).startActivityForResult(pickPhoto , REQUEST_CODE);//one can be replaced with any action code } } public static void performCropProfile(Uri uriImage, Context context, int REQUEST_CODE){ try { //call the standard crop action intent (the user device may not support it) Intent cropIntent = new Intent("com.android.camera.action.CROP"); //indicate image type and Uri cropIntent.setDataAndType(uriImage, "image/*"); //set crop properties cropIntent.putExtra("crop", "true"); //indicate aspect of desired crop cropIntent.putExtra("aspectX", 1); cropIntent.putExtra("aspectY", 1); //indicate output X and Y cropIntent.putExtra("outputX", 256); cropIntent.putExtra("outputY", 256); //retrieve data on return cropIntent.putExtra("return-data", true); cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriImage); //start the activity - we handle returning in onActivityResult ((Activity)context).startActivityForResult(cropIntent, REQUEST_CODE); } catch(ActivityNotFoundException anfe){ //display an error message String errorMessage = "Whoops - your device doesn't support the crop action!"; Toast toast = Toast.makeText(context, errorMessage, Toast.LENGTH_SHORT); toast.show(); } } public static void performCropCustom(Uri uriImage, Context context, int REQUEST_CODE){ try { //call the standard crop action intent (the user device may not support it) Intent cropIntent = new Intent("com.android.camera.action.CROP"); //indicate image type and Uri cropIntent.setDataAndType(uriImage, "image/*"); //set crop properties cropIntent.putExtra("crop", "true"); //indicate aspect of desired crop cropIntent.putExtra("aspectX", 0); cropIntent.putExtra("aspectY", 0); //indicate output X and Y cropIntent.putExtra("outputX", 256); cropIntent.putExtra("outputY", 256); //retrieve data on return cropIntent.putExtra("return-data", true); //start the activity - we handle returning in onActivityResult ((Activity)context).startActivityForResult(cropIntent, REQUEST_CODE); } catch(ActivityNotFoundException anfe){ //display an error message String errorMessage = "Whoops - your device doesn't support the crop action!"; Toast toast = Toast.makeText(context, errorMessage, Toast.LENGTH_SHORT); toast.show(); } } }
[ "roberto.capah@gmail.com" ]
roberto.capah@gmail.com
76553c27a825c75ef51801c7cd16a3e410014f30
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
/methods/Method_697.java
0e3520e1903e3654f4560a8bdcbee2201dee6bc0
[]
no_license
P79N6A/icse_20_user_study
5b9c42c6384502fdc9588430899f257761f1f506
8a3676bc96059ea2c4f6d209016f5088a5628f3c
refs/heads/master
2020-06-24T08:25:22.606717
2019-07-25T15:31:16
2019-07-25T15:31:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
/** * Close the stream. This method does not release the buffer, since its contents might still be required. Note: Invoking this method in this class will have no effect. */ public void close(){ if (writer != null && count > 0) { flush(); } if (buf.length <= BUFFER_THRESHOLD) { bufLocal.set(buf); } this.buf=null; }
[ "sonnguyen@utdallas.edu" ]
sonnguyen@utdallas.edu
da3bec03221a9f593d730a999b68a4b0ca6909d6
61d8b7c6efc2a595a1db2a0abe42c432d935deba
/multi-datasource-transaction/src/main/java/tech/qijin/study/transaction/mysql/db2/dao/User2Dao.java
eb84a351b43a59c794cef05cab4b378f0b1c6ea1
[]
no_license
my1free/qijin-tech-study-java
9392a72aca285064d3945e24c0ea7585f4aaedd5
1e799abd8717b17acb43196b02fd3ca3392c3c41
refs/heads/master
2022-06-23T16:58:28.751238
2021-03-10T03:31:06
2021-03-10T03:31:06
250,989,327
0
0
null
2022-06-21T04:15:17
2020-03-29T08:48:31
Java
UTF-8
Java
false
false
397
java
package tech.qijin.study.transaction.mysql.db2.dao; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import tech.qijin.study.transaction.mysql.db2.model.User2; import java.util.List; public interface User2Dao { @Select("select * from user2") List<User2> selectAll(); @Update("update user2 set age=age+1 where id=1") Integer update(); }
[ "yangshangqiang@inke.cn" ]
yangshangqiang@inke.cn
6131ec4c213a5f21dbc9354e14642548037b9ed4
3559cc28d2442ab052107d4ef3b279c5beea4538
/CucucmberJava/src/test/java/pages/loginpage.java
32c4260fa6d01951265c1baa3cd7e01a8493c595
[]
no_license
akash151295/Practice_DemoProjects
12b58d9b62e02d5e751524679d4b769aabf5bd7f
2799a19ce672583172e12d292218f2b503dc4751
refs/heads/master
2023-03-12T13:54:42.414487
2021-02-28T10:28:40
2021-02-28T10:28:40
342,605,130
1
0
null
null
null
null
UTF-8
Java
false
false
1,926
java
package pages; import static org.junit.Assert.assertEquals; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import io.github.bonigarcia.wdm.WebDriverManager; public class loginpage { WebDriver driver; By txt_Username_login = By.xpath("//input[@id='name']"); By txt_Password_login = By.xpath("//input[@id='password']"); By btn_Login_login = By.xpath("//button[@id='login']"); public loginpage(WebDriver driver) { this.driver=driver; if(!driver.getTitle().equals("TestProjectDemo")) { System.out.println("You are on wrong page. Current page is= "+driver.getCurrentUrl()); } } public void open_Chrome_Browser() { driver.navigate().to("https://example.testproject.io/web/"); } public void enterUsername(String Username) { driver.findElement(txt_Username_login).sendKeys(Username); } public void enterPassword(String Password) { driver.findElement(txt_Password_login).sendKeys(Password); } public void clickLogin() { driver.findElement(btn_Login_login).click(); } public void loginValidUser(String Username, String Password) { driver.findElement(txt_Username_login).sendKeys(Username); driver.findElement(txt_Password_login).sendKeys(Password); } public void validateAlertOnLogin() throws InterruptedException { String Actual = driver.findElement(By.xpath("//div[text()='Password is invalid']")).getText(); String Expected = "Password is invalid"; System.out.println("Actual"+driver.getTitle()); assertEquals(Expected, Actual); Thread.sleep(1500); } public void validatePageTitle() { String Expected = "TestProject Demo"; System.out.println("Actual"+driver.getTitle()); assertEquals(Expected,driver.getTitle()); } public void browserClose() { driver.close(); } }
[ "Akash Chaudhary@DESKTOP-M3K5B2J" ]
Akash Chaudhary@DESKTOP-M3K5B2J
63a647b6bcfcaf6ff2048b441c6abba2e7424965
6e9653832a91b9c6f748f92b2d7ee63574d69b00
/library/src/main/java/com/clickntap/tap/TapAppBonjour.java
490c7bfcd4e2f13ede8d74536c42b8f24bf3b1a2
[ "MIT" ]
permissive
clickntap/tap_framework_android
a40cd1d6722d6b2f8bcb7319befbf78f793df323
6e982e9576102a80194af236b09ad68ae6c02282
refs/heads/master
2020-06-05T08:24:14.563904
2019-10-30T16:34:50
2019-10-30T16:34:50
192,372,405
0
0
null
2019-06-19T05:39:06
2019-06-17T15:26:17
Java
UTF-8
Java
false
false
4,815
java
package com.clickntap.tap; import android.content.Context; import android.net.nsd.NsdManager; import android.net.nsd.NsdServiceInfo; import org.json.JSONArray; import org.json.JSONObject; public class TapAppBonjour { private JSONArray networkServices; private NsdManager.DiscoveryListener discoveryListener; private TapApp app; private boolean discovering; public TapAppBonjour(TapApp app) { this.discovering = false; this.app = app; networkServices = new JSONArray(); discoveryListener = new NsdManager.DiscoveryListener() { public void onStartDiscoveryFailed(String serviceType, int errorCode) { } public void onStopDiscoveryFailed(String serviceType, int errorCode) { } public void onDiscoveryStarted(String serviceType) { } public void onDiscoveryStopped(String serviceType) { } public void onServiceFound(NsdServiceInfo serviceInfo) { if (discovering) { resolveService(serviceInfo); } } public void onServiceLost(NsdServiceInfo serviceInfo) { if (discovering) { removeService(serviceInfo); TapAppBonjour.this.app.notification("bonjour", getNetworkServices()); } } }; } public boolean isDiscovering() { return discovering; } public void resolveService(NsdServiceInfo serviceInfo) { NsdManager networkServiceDiscoveryManager = (NsdManager) app.getSystemService(Context.NSD_SERVICE); NsdManager.ResolveListener resolveListener = new NsdManager.ResolveListener() { public void onResolveFailed(final NsdServiceInfo serviceInfo, int errorCode) { if (discovering) { TapAppBonjour.this.app.setTimeout(new TapTask.Task() { public void exec() throws Exception { resolveService(serviceInfo); } }, 1000); } } public void onServiceResolved(NsdServiceInfo serviceInfo) { if (discovering) { JSONObject service = new JSONObject(); try { service.put("name", serviceInfo.getServiceName()); } catch (Exception e) { } try { service.put("host", serviceInfo.getHost().getHostAddress()); } catch (Exception e) { } try { service.put("port", serviceInfo.getPort()); } catch (Exception e) { } try { removeService(serviceInfo); networkServices.put(service); } catch (Exception e) { } TapAppBonjour.this.app.notification("bonjour", getNetworkServices()); } } }; networkServiceDiscoveryManager.resolveService(serviceInfo, resolveListener); } private void removeService(NsdServiceInfo serviceInfo) { try { JSONArray services = new JSONArray(); for (int i = 0; i < networkServices.length(); i++) { JSONObject service = networkServices.getJSONObject(i); if (!service.getString("name").equals(serviceInfo.getServiceName())) { services.put(service); } } networkServices = services; } catch (Exception e) { } } public JSONObject getNetworkServices() { JSONObject set = new JSONObject(); try { set.put("what", "bonjour"); set.put("items", networkServices); } catch (Exception e) { TapUtils.log(e); } return set; } public void startDiscovery() { //TapUtils.log("TapAppBonjour::startDiscovery"); if (!discovering) { discovering = true; NsdManager networkServiceDiscoveryManager = (NsdManager) app.getSystemService(Context.NSD_SERVICE); networkServiceDiscoveryManager.discoverServices("_http._tcp.", NsdManager.PROTOCOL_DNS_SD, discoveryListener); } } public void stopDiscovery() { //TapUtils.log("TapAppBonjour::stopDiscovery"); if (discovering) { discovering = false; NsdManager networkServiceDiscoveryManager = (NsdManager) app.getSystemService(Context.NSD_SERVICE); networkServiceDiscoveryManager.stopServiceDiscovery(discoveryListener); } } }
[ "tonino.mendicino@clickntap.com" ]
tonino.mendicino@clickntap.com
a04dab39546f2f51e25a8fa6f31d7465bc7cb2e1
689cdf772da9f871beee7099ab21cd244005bfb2
/classes/com/android/thinkive/framework/message/handler/Message50110$1.java
53f5aa8b05ef7cc3cd18bd952b5a224f148ef9d7
[]
no_license
waterwitness/dazhihui
9353fd5e22821cb5026921ce22d02ca53af381dc
ad1f5a966ddd92bc2ac8c886eb2060d20cf610b3
refs/heads/master
2020-05-29T08:54:50.751842
2016-10-08T08:09:46
2016-10-08T08:09:46
70,314,359
2
4
null
null
null
null
UTF-8
Java
false
false
1,900
java
package com.android.thinkive.framework.message.handler; import android.app.Activity; import android.content.Context; import android.text.TextUtils; import android.view.Window; import com.android.thinkive.framework.ThinkiveInitializer; import com.android.thinkive.framework.util.CommonUtil; import com.android.thinkive.framework.util.Log; import com.android.thinkive.framework.view.InfoDialog; class Message50110$1 implements Runnable { Message50110$1(Message50110 paramMessage50110, Context paramContext) {} public void run() { String str = CommonUtil.getTopActivity(this.val$context); Activity localActivity = ThinkiveInitializer.getInstance().getActivity(str); Log.d("50110 currentActivityName = " + str + " currentActivity = " + localActivity); if (localActivity != null) { Message50110.access$0(this.this$0, new InfoDialog(localActivity)); } for (;;) { if (!TextUtils.isEmpty(Message50110.access$2(this.this$0))) { Message50110.access$1(this.this$0).setTitle(Message50110.access$2(this.this$0)); } Message50110.access$1(this.this$0).setContent(Message50110.access$3(this.this$0)); if ("0".equals(Message50110.access$4(this.this$0))) { Message50110.access$1(this.this$0).setCancelBtnVisible(false); } Message50110.access$1(this.this$0).setFlag(Message50110.access$5(this.this$0)); Message50110.access$1(this.this$0).setSourceModule(Message50110.access$6(this.this$0)); Message50110.access$1(this.this$0).show(); return; Message50110.access$0(this.this$0, new InfoDialog(this.val$context)); Message50110.access$1(this.this$0).getWindow().setType(2003); } } } /* Location: E:\apk\dazhihui2\classes-dex2jar.jar!\com\android\thinkive\framework\message\handler\Message50110$1.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "1776098770@qq.com" ]
1776098770@qq.com
222a2837e51f9fd0a3f3cdf9c9750f5388d0e1e5
cd4802766531a9ccf0fb54ca4b8ea4ddc15e31b5
/java/com/l2jmobius/gameserver/data/xml/impl/AdminData.java
6304d8636d1abb0338eeb0f0bbfb4f79129c0149
[]
no_license
singto53/underground
8933179b0d72418f4b9dc483a8f8998ef5268e3e
94264f5168165f0b17cc040955d4afd0ba436557
refs/heads/master
2021-01-13T10:30:20.094599
2016-12-11T20:32:47
2016-12-11T20:32:47
76,455,182
0
1
null
null
null
null
UTF-8
Java
false
false
9,420
java
/* * This file is part of the L2J Mobius project. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.l2jmobius.gameserver.data.xml.impl; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import com.l2jmobius.commons.util.IGameXmlReader; import com.l2jmobius.gameserver.model.L2AccessLevel; import com.l2jmobius.gameserver.model.L2AdminCommandAccessRight; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; /** * Loads administrator access levels and commands. * @author UnAfraid */ public final class AdminData implements IGameXmlReader { private static final Logger LOGGER = Logger.getLogger(AdminData.class.getName()); private final Map<Integer, L2AccessLevel> _accessLevels = new HashMap<>(); private final Map<String, L2AdminCommandAccessRight> _adminCommandAccessRights = new HashMap<>(); private final Map<L2PcInstance, Boolean> _gmList = new ConcurrentHashMap<>(); private int _highestLevel = 0; protected AdminData() { load(); } @Override public synchronized void load() { _accessLevels.clear(); _adminCommandAccessRights.clear(); parseDatapackFile("config/AccessLevels.xml"); LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _accessLevels.size() + " Access Levels."); parseDatapackFile("config/AdminCommands.xml"); LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _adminCommandAccessRights.size() + " Access Commands."); } @Override public void parseDocument(Document doc, File f) { NamedNodeMap attrs; Node attr; StatsSet set; L2AccessLevel level; L2AdminCommandAccessRight command; for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { if ("list".equalsIgnoreCase(n.getNodeName())) { for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("access".equalsIgnoreCase(d.getNodeName())) { set = new StatsSet(); attrs = d.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { attr = attrs.item(i); set.set(attr.getNodeName(), attr.getNodeValue()); } level = new L2AccessLevel(set); if (level.getLevel() > _highestLevel) { _highestLevel = level.getLevel(); } _accessLevels.put(level.getLevel(), level); } else if ("admin".equalsIgnoreCase(d.getNodeName())) { set = new StatsSet(); attrs = d.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { attr = attrs.item(i); set.set(attr.getNodeName(), attr.getNodeValue()); } command = new L2AdminCommandAccessRight(set); _adminCommandAccessRights.put(command.getAdminCommand(), command); } } } } } /** * Returns the access level by characterAccessLevel. * @param accessLevelNum as int * @return the access level instance by char access level */ public L2AccessLevel getAccessLevel(int accessLevelNum) { if (accessLevelNum < 0) { return _accessLevels.get(-1); } return _accessLevels.get(accessLevelNum); } /** * Gets the master access level. * @return the master access level */ public L2AccessLevel getMasterAccessLevel() { return _accessLevels.get(_highestLevel); } /** * Checks for access level. * @param id the id * @return {@code true}, if successful, {@code false} otherwise */ public boolean hasAccessLevel(int id) { return _accessLevels.containsKey(id); } /** * Checks for access. * @param adminCommand the admin command * @param accessLevel the access level * @return {@code true}, if successful, {@code false} otherwise */ public boolean hasAccess(String adminCommand, L2AccessLevel accessLevel) { L2AdminCommandAccessRight acar = _adminCommandAccessRights.get(adminCommand); if (acar == null) { // Trying to avoid the spam for next time when the gm would try to use the same command if ((accessLevel.getLevel() > 0) && (accessLevel.getLevel() == _highestLevel)) { acar = new L2AdminCommandAccessRight(adminCommand, true, accessLevel.getLevel()); _adminCommandAccessRights.put(adminCommand, acar); LOGGER.info(getClass().getSimpleName() + ": No rights defined for admin command " + adminCommand + " auto setting accesslevel: " + accessLevel.getLevel() + " !"); } else { LOGGER.info(getClass().getSimpleName() + ": No rights defined for admin command " + adminCommand + " !"); return false; } } return acar.hasAccess(accessLevel); } /** * Require confirm. * @param command the command * @return {@code true}, if the command require confirmation, {@code false} otherwise */ public boolean requireConfirm(String command) { final L2AdminCommandAccessRight acar = _adminCommandAccessRights.get(command); if (acar == null) { LOGGER.info(getClass().getSimpleName() + ": No rights defined for admin command " + command + "."); return false; } return acar.getRequireConfirm(); } /** * Gets the all GMs. * @param includeHidden the include hidden * @return the all GMs */ public List<L2PcInstance> getAllGms(boolean includeHidden) { final List<L2PcInstance> tmpGmList = new ArrayList<>(); for (Entry<L2PcInstance, Boolean> entry : _gmList.entrySet()) { if (includeHidden || !entry.getValue()) { tmpGmList.add(entry.getKey()); } } return tmpGmList; } /** * Gets the all GM names. * @param includeHidden the include hidden * @return the all GM names */ public List<String> getAllGmNames(boolean includeHidden) { final List<String> tmpGmList = new ArrayList<>(); for (Entry<L2PcInstance, Boolean> entry : _gmList.entrySet()) { if (!entry.getValue()) { tmpGmList.add(entry.getKey().getName()); } else if (includeHidden) { tmpGmList.add(entry.getKey().getName() + " (invis)"); } } return tmpGmList; } /** * Add a L2PcInstance player to the Set _gmList. * @param player the player * @param hidden the hidden */ public void addGm(L2PcInstance player, boolean hidden) { _gmList.put(player, hidden); } /** * Delete a GM. * @param player the player */ public void deleteGm(L2PcInstance player) { _gmList.remove(player); } /** * GM will be displayed on clients GM list. * @param player the player */ public void showGm(L2PcInstance player) { if (_gmList.containsKey(player)) { _gmList.put(player, false); } } /** * GM will no longer be displayed on clients GM list. * @param player the player */ public void hideGm(L2PcInstance player) { if (_gmList.containsKey(player)) { _gmList.put(player, true); } } /** * Checks if is GM online. * @param includeHidden the include hidden * @return true, if is GM online */ public boolean isGmOnline(boolean includeHidden) { for (Entry<L2PcInstance, Boolean> entry : _gmList.entrySet()) { if (includeHidden || !entry.getValue()) { return true; } } return false; } /** * Send list to player. * @param player the player */ public void sendListToPlayer(L2PcInstance player) { if (isGmOnline(player.isGM())) { player.sendPacket(SystemMessageId.GM_LIST); for (String name : getAllGmNames(player.isGM())) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.GM_C1); sm.addString(name); player.sendPacket(sm); } } else { player.sendPacket(SystemMessageId.THERE_ARE_NO_GMS_CURRENTLY_VISIBLE_IN_THE_PUBLIC_LIST_AS_THEY_MAY_BE_PERFORMING_OTHER_FUNCTIONS_AT_THE_MOMENT); } } /** * Broadcast to GMs. * @param packet the packet */ public void broadcastToGMs(IClientOutgoingPacket packet) { for (L2PcInstance gm : getAllGms(true)) { gm.sendPacket(packet); } } /** * Broadcast message to GMs. * @param message the message * @return the message that was broadcasted */ public String broadcastMessageToGMs(String message) { for (L2PcInstance gm : getAllGms(true)) { gm.sendMessage(message); } return message; } /** * Gets the single instance of AdminTable. * @return AccessLevels: the one and only instance of this class<br> */ public static AdminData getInstance() { return SingletonHolder._instance; } private static class SingletonHolder { protected static final AdminData _instance = new AdminData(); } }
[ "MobiusDev@7325c9f8-25fd-504a-9f63-8876acdc129b" ]
MobiusDev@7325c9f8-25fd-504a-9f63-8876acdc129b
d9e5785a79e995b1a796cbc8b38fd9111372a9e3
ac125c2aaf066f613de882d2f1b515e9946e82e6
/owls-api-3.0/src/impl/owls/expression/ExpressionConverter.java
9ed29ddc57174db182da4679afb80c5399681a15
[]
no_license
mmuzo/VisKoTeam5
50af1c4eb43bd22fcd002203962bfdbb34c38866
75d17c0316776ab6e725f422a91f40587c580065
refs/heads/master
2020-04-11T04:17:18.697435
2014-05-13T01:04:33
2014-05-13T01:04:33
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,748
java
/* * Made top level class on 05.07.2009 * * (c) 2009 Thorsten Möller - University of Basel Switzerland * * The MIT License * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ package impl.owls.expression; import impl.owl.GenericOWLConverter; import org.mindswap.owl.OWLClass; import org.mindswap.owl.OWLIndividual; import org.mindswap.owl.OWLObject; import org.mindswap.owls.expression.Expression; import org.mindswap.owls.expression.LogicLanguage; import org.mindswap.owls.vocabulary.OWLS; /** * * @author unascribed * @version $Rev: 2269 $; $Author: nick $; $Date: 2011/01/24 06:37:54 $ * @param <B> The body of the expression. * @param <E> The particular kind of expression. */ public final class ExpressionConverter<B, E extends Expression<B>> extends GenericOWLConverter<E> { final OWLClass exprType; final LogicLanguage language; public ExpressionConverter(final Class<? extends E> impl, final OWLClass target, final OWLClass exprType, final LogicLanguage language) { super(impl, target); this.exprType = exprType; this.language = language; } /* @see impl.owl.GenericOWLConverter#canCast(org.mindswap.owl.OWLObject, boolean) */ @Override public boolean canCast(final OWLObject object, final boolean strictConversion) { if (object instanceof OWLIndividual) { final OWLIndividual ind = (OWLIndividual) object; if (strictConversion) { if (ind.equals(OWLS.Expression.AlwaysTrue)) return true; return ind.isType(getTarget()) || (ind.isType(exprType) && ind.hasProperty(OWLS.Expression.expressionLanguage, language)); } return true; // sufficient criteria for non-strict conversion is that object is an instanceof OWLIndinvidual } return false; } }
[ "mmuzo@miners.utep.edu" ]
mmuzo@miners.utep.edu
6bb3d3fe86104704e8cf6e5d6346603142178d76
817d8a701a0baa8a7a06411df768c529d4945194
/lab1.1/L_grade.java
2df4aea999c2280920b29364869262dd8ffe5720
[]
no_license
bikrambhurtel/Java-Programs
988c82a3a7e2c01097740cd422f9ff37659338cb
97b4bb31086aa2f80108f148b8a228cf96fc09da
refs/heads/master
2022-12-18T14:31:56.746676
2020-09-20T01:49:51
2020-09-20T01:49:51
296,982,309
0
0
null
null
null
null
UTF-8
Java
false
false
1,208
java
//L_grade.java import java.util.*; class L_grade{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); System.out.println("Please enter your obtained marks in the following subjects out of total 100 marks:"); System.out.print("---------------------------------------------------------------"); System.out.print("\nEnter the marks in JAVA: "); int java = sc.nextInt(); System.out.print("Enter the marks in ADBMS: "); int dbms = sc.nextInt(); System.out.print("Enter the marks in IT: "); int it = sc.nextInt(); System.out.print("Enter the marks in NSA: "); int nsa = sc.nextInt(); System.out.println("-----------------------------------------------------------------"); int total = java + dbms + it + nsa; int avg = total/4; String grade; if(avg>=90 && avg<=100){ grade = "A+"; } else if(avg>=80){ grade = "A"; } else if(avg>=70){ grade = "B+"; } else if(avg>=60){ grade = "B"; } else if(avg>=50){ grade = "C+"; } else if(avg>=40){ grade = "C"; } else if(avg>=30){ grade = "D+"; } else if(avg>=20){ grade = "D"; } else if(avg>=0){ grade = "E"; } else{ grade = "Please enter valid marks!!"; } System.out.println("Grade: "+grade); } }
[ "bhurtelbikram@gmail.com" ]
bhurtelbikram@gmail.com
9a5b3841d18b91d1dab81713fd22ae25052b246b
86ede63f607d575edec491dd1a631c366fa4b132
/app/src/androidTest/java/com/t_robop/yuusuke/esp32_rc_controller/ExampleInstrumentedTest.java
f10e9becb2531b6355da744b68cb1bf67ca125d5
[]
no_license
y-ogawara/ESP32RCController
49f42c7edeba072c162f100367fa0c905a725fb4
8c66ef51516ade3dbce2031c9b0ef982381a0182
refs/heads/master
2020-03-18T17:18:40.775143
2018-05-27T06:13:05
2018-05-27T06:13:05
135,020,613
0
0
null
null
null
null
UTF-8
Java
false
false
779
java
package com.t_robop.yuusuke.esp32_rc_controller; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.t_robop.yuusuke.esp32_rc_controller", appContext.getPackageName()); } }
[ "yuusukeogawara@gmail.com" ]
yuusukeogawara@gmail.com
6fe1a2ed732435ae52095b7445400daccdfbcbf6
efebd70feb4fd3812fdf9298aa16c646d5b64aaa
/src/main/java/br/com/devdojo/awesome/model/AbstractEntity.java
1e34193badda659f4272bc3c5ff11153a719d87f
[]
no_license
fidelis27/api-spring-boot
491ac816134f36731ffb24d736d772727eea12ac
512ec090840a372b003be535fbe7bf7678e1bcfc
refs/heads/master
2022-12-24T18:51:55.743465
2020-10-02T20:15:39
2020-10-02T20:15:39
295,748,896
0
0
null
null
null
null
UTF-8
Java
false
false
785
java
package br.com.devdojo.awesome.model; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.MappedSuperclass; import java.io.Serializable; import java.util.Objects; @MappedSuperclass public class AbstractEntity implements Serializable { @Id @GeneratedValue protected Long id; @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AbstractEntity that = (AbstractEntity) o; return Objects.equals(id, that.id); } @Override public int hashCode() { return Objects.hash(id); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } }
[ "thiago.fidelis27@gmail.com" ]
thiago.fidelis27@gmail.com
01759d4a38ea8545f7c80f36e5a1059885c32168
b59ff99367e37bbd49826aab178e007a31bbdcab
/app/src/main/java/com/example/linayun/mycoolweather/gson/Suggestion.java
5f19d9f7ac8cbb0f93733ac25b86f6ac41510e62
[ "Apache-2.0" ]
permissive
linayun/coolweather
6f04e8594a229131622de9aeba646d0ea02d8fc6
98d9117d540a3a9365c50b264590e8c589bc114d
refs/heads/master
2021-01-11T09:24:26.299387
2016-12-29T10:04:01
2016-12-29T10:04:01
77,117,195
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
package com.example.linayun.mycoolweather.gson; import com.google.gson.annotations.SerializedName; /** * Created by linayun on 2016/12/28. */ public class Suggestion { @SerializedName("comf") public Comfort comfort; @SerializedName("cw") public CarWash carWash; public Sport sport; public class Comfort{ @SerializedName("txt") public String info; } public class CarWash{ @SerializedName("txt") public String info; } public class Sport{ @SerializedName("txt") public String info; } }
[ "115380659@qq.com" ]
115380659@qq.com
c02fd277d6cdfec9013a85a46bb2da720d4dd1ea
21ee038940460cd88c460ddacef8553f5efcaf82
/src/main/java/com/valcom/icalapuja/intercorpapi/resource/ResponseBodyResource.java
fe18cfe773a54eb482d9a5d54cfa0ce7acafefde
[]
no_license
icalapuja/intercorpapi
7b981a983431900d0a093e25d165aa1bf9b192ac
74b123a8ffcd3b55590cf3d76ba5654d4e98a6bd
refs/heads/master
2022-01-28T12:53:05.919928
2019-07-22T07:32:24
2019-07-22T07:32:24
198,146,202
0
0
null
null
null
null
UTF-8
Java
false
false
652
java
package com.valcom.icalapuja.intercorpapi.resource; public class ResponseBodyResource { public ResponseBodyResource(int status,String error,String message) { this.status = status; this.error = error; this.message = message; } private int status; private String error; private String message; public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getError() { return error; } public void setError(String error) { this.error = error; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
[ "icalapuja@gmail.com" ]
icalapuja@gmail.com
5a38aba8aa46df1f3ee9a6c32a9f7f710a943a24
f806e64e0a69b15b33366024ea9e848ab99db8e9
/src/StringDemo/CountCharacter.java
a9330b9640a66b273ded9fe00cf9a24112cab3a8
[]
no_license
dharmikmehta1112/JavaProgram
2cf730bda236eadb98789e51bdefb8f5626be9ca
ae0a3cc33c7a37cff58d2581e4581fea47760929
refs/heads/master
2023-04-18T17:30:53.285648
2021-05-05T10:39:53
2021-05-05T10:39:53
364,541,186
0
0
null
null
null
null
UTF-8
Java
false
false
1,270
java
package StringDemo; // **WAP to perform given operation. I/P TTTEESSSSTTTTIIIIINNG. O/P T3E2S4T4I5N2G1 import java.util.Scanner; public class CountCharacter { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter input string: "); String s = sc.nextLine(); System.out.println("Length of input sting:: "+s.length()); CountCharacter cc = new CountCharacter(); // cc.CountChar(s); cc.charCount(s); } public void charCount(String st) { // st = st.toLowerCase(); for(int i = 0; i < st.length(); i++) { int count = 0; char c = st.charAt(i); if(((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) && c!=' ') { for (int j = 0; j <= i; j++) { if(c==st.charAt(j)) count++; } } System.out.print((char)c+ "" +count + " "); } } // public void CountChar(String str) // { // String rev = ""; // int j = str.length(); // System.out.println("Length of input string:: " + j); // for(int i=0; i<j; i++) // { // int count=1; // if(str.charAt(i) == str.charAt(i+1) && str.charAt(i+1)!=' ') // { // count++; // } // rev = str.charAt(i) + count; // System.out.print(rev); // } // System.out.print("\nOutput String:: " +rev); // } }
[ "dharmik.mehta1112@gmail.com" ]
dharmik.mehta1112@gmail.com