hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
923a935ba4502a54d45c7acd1b91dcb8da524a6d
668
java
Java
src/com/sacane/manager/data/account/AccountManager.java
Sacane/economic_manager
bef9389c51f1191b9f7530d104dcf1bf1eaf1971
[ "MIT" ]
null
null
null
src/com/sacane/manager/data/account/AccountManager.java
Sacane/economic_manager
bef9389c51f1191b9f7530d104dcf1bf1eaf1971
[ "MIT" ]
null
null
null
src/com/sacane/manager/data/account/AccountManager.java
Sacane/economic_manager
bef9389c51f1191b9f7530d104dcf1bf1eaf1971
[ "MIT" ]
null
null
null
20.242424
83
0.570359
999,263
package com.sacane.manager.data.account; /** * Data class use to manage the data of the accounts. * An account is represented by its name and its value : the sold of this account. */ class AccountManager { private final String name; private final double value; public AccountManager(String name, double value){ this.name = name; this.value = value; } /** * * @return double : value of the sold. */ public double getValue() { return value; } /** * @return String : name of the account */ public String getName() { return name; } }
923a9409ff570dabf3313fe814452955740d0713
1,047
java
Java
android/src/main/java/io/tus/java/client/ProtocolException.java
jureczkyb/react-native-tus-client
8ba56063ce3a4d0b182700ecc1cc1560d040574c
[ "MIT" ]
2
2019-01-15T08:57:07.000Z
2019-01-15T08:57:08.000Z
android/src/main/java/io/tus/java/client/ProtocolException.java
jureczkyb/react-native-tus-client
8ba56063ce3a4d0b182700ecc1cc1560d040574c
[ "MIT" ]
null
null
null
android/src/main/java/io/tus/java/client/ProtocolException.java
jureczkyb/react-native-tus-client
8ba56063ce3a4d0b182700ecc1cc1560d040574c
[ "MIT" ]
1
2020-10-21T13:50:59.000Z
2020-10-21T13:50:59.000Z
25.536585
91
0.644699
999,264
package io.tus.java.client; import java.io.IOException; import java.net.HttpURLConnection; /** * This exception is thrown if the server sends a request with an unexpected status code or * missing/invalid headers. */ public class ProtocolException extends Exception { private HttpURLConnection connection; public ProtocolException(String message) { super(message); } public ProtocolException(String message, HttpURLConnection connection) { super(message); this.connection = connection; } public HttpURLConnection getCausingConnection() { return connection; } public boolean shouldRetry() { if(connection == null) { return false; } try { int responseCode = connection.getResponseCode(); // 5XX and 423 Resource Locked status codes should be retried. return (responseCode >= 500 && responseCode < 600) || responseCode == 423; } catch(IOException e) { return false; } } }
923a9450f13d2334c767d0ce2466a620be3fb692
274
java
Java
gd-shop/src/main/java/com/cqust/shop/service/StoreService.java
xwder/health-shop-manage
ab02adcfa18b63caf141416a6dfc7b02cc45c67f
[ "Apache-2.0" ]
5
2020-02-03T08:05:40.000Z
2020-04-08T14:37:01.000Z
gd-shop/src/main/java/com/cqust/shop/service/StoreService.java
xwder/health-shop-manage
ab02adcfa18b63caf141416a6dfc7b02cc45c67f
[ "Apache-2.0" ]
null
null
null
gd-shop/src/main/java/com/cqust/shop/service/StoreService.java
xwder/health-shop-manage
ab02adcfa18b63caf141416a6dfc7b02cc45c67f
[ "Apache-2.0" ]
null
null
null
17.125
44
0.693431
999,265
package com.cqust.shop.service; import com.cqust.pojo.TStoreinfo; public interface StoreService { /** * @Title: getStoreInfoByItemId * @Description: 根据商家ID获取商家信息 * @param itemid * @return * @throws */ TStoreinfo getStoreInfoId(Integer storeid); }
923a9468e220eb99c47a5b35054005e47b3b8f6e
992
java
Java
app/src/main/java/com/ermile/payamres/Function/ForegroundServic/ItemAsyncTask/item_sentsmssaved.java
khadije-charity/payamres
409ed6c26f9f6185b18aeb7b18918db9d5f63ed3
[ "MIT" ]
1
2019-07-24T11:59:49.000Z
2019-07-24T11:59:49.000Z
app/src/main/java/com/ermile/payamres/Function/ForegroundServic/ItemAsyncTask/item_sentsmssaved.java
khadije-charity/payamres
409ed6c26f9f6185b18aeb7b18918db9d5f63ed3
[ "MIT" ]
null
null
null
app/src/main/java/com/ermile/payamres/Function/ForegroundServic/ItemAsyncTask/item_sentsmssaved.java
khadije-charity/payamres
409ed6c26f9f6185b18aeb7b18918db9d5f63ed3
[ "MIT" ]
null
null
null
20.244898
92
0.59879
999,266
package com.ermile.payamres.Function.ForegroundServic.ItemAsyncTask; public class item_sentsmssaved { String smsid, localid, serverid, status; public item_sentsmssaved(String smsid, String localid, String serverid, String status) { this.smsid = smsid; this.localid = localid; this.serverid = serverid; this.status = status; } public String getSmsid() { return smsid; } public void setSmsid(String smsid) { this.smsid = smsid; } public String getLocalid() { return localid; } public void setLocalid(String localid) { this.localid = localid; } public String getServerid() { return serverid; } public void setServerid(String serverid) { this.serverid = serverid; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } }
923a94b88f85de597952e5da77d6198932eab53f
24,113
java
Java
ml/src/main/java/org/apache/hama/ml/recommendation/cf/OnlineTrainBSP.java
ZhouYii/Hama-FaultTolerance
083227216088bc6714be391f08d50c11ad31e889
[ "Apache-2.0" ]
89
2015-02-09T05:35:24.000Z
2022-02-19T13:53:19.000Z
ml/src/main/java/org/apache/hama/ml/recommendation/cf/OnlineTrainBSP.java
ZhouYii/Hama-FaultTolerance
083227216088bc6714be391f08d50c11ad31e889
[ "Apache-2.0" ]
3
2016-02-26T14:19:45.000Z
2018-07-30T05:04:14.000Z
ml/src/main/java/org/apache/hama/ml/recommendation/cf/OnlineTrainBSP.java
ZhouYii/Hama-FaultTolerance
083227216088bc6714be391f08d50c11ad31e889
[ "Apache-2.0" ]
68
2015-01-16T11:36:05.000Z
2021-11-10T19:30:41.000Z
40.188333
125
0.691619
999,267
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hama.ml.recommendation.cf; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; import java.util.Random; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.MapWritable; import org.apache.hadoop.io.Text; import org.apache.hama.bsp.BSP; import org.apache.hama.bsp.BSPPeer; import org.apache.hama.bsp.sync.SyncException; import org.apache.hama.commons.io.MatrixWritable; import org.apache.hama.commons.io.VectorWritable; import org.apache.hama.commons.math.DenseDoubleMatrix; import org.apache.hama.commons.math.DenseDoubleVector; import org.apache.hama.commons.math.DoubleMatrix; import org.apache.hama.commons.math.DoubleVector; import org.apache.hama.ml.recommendation.Preference; import org.apache.hama.ml.recommendation.cf.function.OnlineUpdate; public class OnlineTrainBSP extends BSP<Text, VectorWritable, Text, VectorWritable, MapWritable> { protected static Log LOG = LogFactory.getLog(OnlineTrainBSP.class); private String inputPreferenceDelim = null; private String inputUserDelim = null; private String inputItemDelim = null; private int ITERATION = 0; private int MATRIX_RANK = 0; private int SKIP_COUNT = 0; // randomly generated depending on matrix rank, // will be computed runtime and represents trained model // userId, factorized value private HashMap<String, VectorWritable> usersMatrix = new HashMap<String, VectorWritable>(); // itemId, factorized value private HashMap<String, VectorWritable> itemsMatrix = new HashMap<String, VectorWritable>(); // matrixRank, factorized value private DoubleMatrix userFeatureMatrix = null; private DoubleMatrix itemFeatureMatrix = null; // obtained from input data // will not change during execution private HashMap<String, VectorWritable> inpUsersFeatures = null; private HashMap<String, VectorWritable> inpItemsFeatures = null; private OnlineUpdate.Function function = null; // Input Preferences private ArrayList<Preference<String, String>> preferences = new ArrayList<Preference<String, String>>(); private ArrayList<Integer> indexes = new ArrayList<Integer>(); Random rnd = new Random(); @Override public void setup( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException, SyncException, InterruptedException { Configuration conf = peer.getConfiguration(); ITERATION = conf.getInt(OnlineCF.Settings.CONF_ITERATION_COUNT, OnlineCF.Settings.DFLT_ITERATION_COUNT); MATRIX_RANK = conf.getInt(OnlineCF.Settings.CONF_MATRIX_RANK, OnlineCF.Settings.DFLT_MATRIX_RANK); SKIP_COUNT = conf.getInt(OnlineCF.Settings.CONF_SKIP_COUNT, OnlineCF.Settings.DFLT_SKIP_COUNT); inputItemDelim = conf.get(OnlineCF.Settings.CONF_INPUT_ITEM_DELIM, OnlineCF.Settings.DFLT_ITEM_DELIM); inputUserDelim = conf.get(OnlineCF.Settings.CONF_INPUT_USER_DELIM, OnlineCF.Settings.DFLT_USER_DELIM); inputPreferenceDelim = conf.get(OnlineCF.Settings.CONF_INPUT_PREFERENCES_DELIM, OnlineCF.Settings.DFLT_PREFERENCE_DELIM); Class<?> cls = conf.getClass(OnlineCF.Settings.CONF_ONLINE_UPDATE_FUNCTION, null); try { function = (OnlineUpdate.Function)(cls.newInstance()); } catch (Exception e) { // set default function } } @Override public void bsp( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException, SyncException, InterruptedException { LOG.info(peer.getPeerName() + ") collecting input data"); // input partitioning begin, // because we used one file for all input data // and input data are different type HashSet<Text> requiredUserFeatures = null; HashSet<Text> requiredItemFeatures = null; collectInput(peer, requiredUserFeatures, requiredItemFeatures); // since we have used some delimiters for // keys, HashPartitioner cannot partition // as we want, take user preferences and // broadcast user features and item features askForFeatures(peer, requiredUserFeatures, requiredItemFeatures); peer.sync(); requiredUserFeatures = null; requiredItemFeatures = null; sendRequiredFeatures(peer); peer.sync(); collectFeatures(peer); LOG.info(peer.getPeerName() + ") collected: " + this.usersMatrix.size() + " users, " + this.itemsMatrix.size() + " items, " + this.preferences.size() + " preferences"); // input partitioning end // calculation steps for (int i=0; i<ITERATION; i++) { computeValues(); if ((i+1)%SKIP_COUNT == 0) { normalizeWithBroadcastingValues(peer); } } saveModel(peer); } private void normalizeWithBroadcastingValues( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException, SyncException, InterruptedException { // normalize item factorized values // normalize user/item feature matrix peer.sync(); normalizeItemFactorizedValues(peer); peer.sync(); if (itemFeatureMatrix != null) { // item feature factorized values should be normalized normalizeMatrix(peer, itemFeatureMatrix, OnlineCF.Settings.MSG_ITEM_FEATURE_MATRIX, true); peer.sync(); } if (userFeatureMatrix != null) { // user feature factorized values should be normalized normalizeMatrix(peer, userFeatureMatrix, OnlineCF.Settings.MSG_USER_FEATURE_MATRIX, true); peer.sync(); } } private DoubleMatrix normalizeMatrix( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer, DoubleMatrix featureMatrix, IntWritable msgFeatureMatrix, boolean broadcast) throws IOException, SyncException, InterruptedException { // send to master peer MapWritable msg = new MapWritable(); MatrixWritable mtx = new MatrixWritable(featureMatrix); msg.put(msgFeatureMatrix, mtx); String master = peer.getPeerName(peer.getNumPeers()/2); peer.send(master, msg); peer.sync(); // normalize DoubleMatrix res = null; if (peer.getPeerName().equals(master)) { res = new DenseDoubleMatrix(featureMatrix.getRowCount(), featureMatrix.getColumnCount(), 0); int incomingMsgCount = 0; while ( (msg = peer.getCurrentMessage()) != null) { MatrixWritable tmp = (MatrixWritable) msg.get(msgFeatureMatrix); res.add(tmp.getMatrix()); incomingMsgCount++; } res.divide(incomingMsgCount); } if (broadcast) { if (peer.getPeerName().equals(master)) { // broadcast to all msg = new MapWritable(); msg.put(msgFeatureMatrix, new MatrixWritable(res)); // send to all for (String peerName : peer.getAllPeerNames()) { peer.send(peerName, msg); } } peer.sync(); // receive normalized value from master msg = peer.getCurrentMessage(); featureMatrix = ((MatrixWritable)msg.get(msgFeatureMatrix)).getMatrix(); } return res; } private VectorWritable convertMatrixToVector(DoubleMatrix mat) { DoubleVector res = new DenseDoubleVector(mat.getRowCount()*mat.getColumnCount()+1); int idx = 0; res.set(idx, MATRIX_RANK); idx++; for (int i=0; i<mat.getRowCount(); i++) { for (int j=0; j<mat.getColumnCount(); j++) { res.set(idx, mat.get(i, j)); idx++; } } return new VectorWritable(res); } private void normalizeItemFactorizedValues( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException, SyncException, InterruptedException { // send item factorized matrices to selected peers sendItemFactorizedValues(peer); peer.sync(); // receive item factorized matrices if this peer is selected and normalize them HashMap<Text, LinkedList<IntWritable>> senderList = new HashMap<Text, LinkedList<IntWritable>>(); HashMap<Text, DoubleVector> normalizedValues = new HashMap<Text, DoubleVector>(); getNormalizedItemFactorizedValues(peer, normalizedValues, senderList); // send back normalized values to senders sendTo(peer, senderList, normalizedValues); peer.sync(); // receive already normalized and synced data receiveSyncedItemFactorizedValues(peer); } private void sendTo(BSPPeer<Text,VectorWritable,Text,VectorWritable,MapWritable> peer, HashMap<Text, LinkedList<IntWritable>> senderList, HashMap<Text, DoubleVector> normalizedValues) throws IOException { for (Map.Entry<Text, DoubleVector> e : normalizedValues.entrySet()) { MapWritable msgTmp = new MapWritable(); // send to interested peers msgTmp.put(OnlineCF.Settings.MSG_ITEM_MATRIX, e.getKey()); msgTmp.put(OnlineCF.Settings.MSG_VALUE, new VectorWritable(e.getValue())); Iterator<IntWritable> iter = senderList.get(e.getKey()).iterator(); while (iter.hasNext()) { peer.send(peer.getPeerName(iter.next().get()), msgTmp); } } } private void getNormalizedItemFactorizedValues( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer, HashMap<Text, DoubleVector> normalizedValues, HashMap<Text, LinkedList<IntWritable>> senderList) throws IOException { HashMap<Text, Integer> normalizedValueCount = new HashMap<Text, Integer>(); Text itemId = null; VectorWritable value = null; IntWritable senderId = null; MapWritable msg = new MapWritable(); while ( (msg = peer.getCurrentMessage())!=null ) { itemId = (Text) msg.get(OnlineCF.Settings.MSG_ITEM_MATRIX); value = (VectorWritable) msg.get(OnlineCF.Settings.MSG_VALUE); senderId = (IntWritable) msg.get(OnlineCF.Settings.MSG_SENDER_ID); if (normalizedValues.containsKey(itemId) == false) { DenseDoubleVector tmp = new DenseDoubleVector(MATRIX_RANK, 0.0); normalizedValues.put(itemId, tmp); normalizedValueCount.put(itemId, 0); senderList.put(itemId, new LinkedList<IntWritable>()); } normalizedValues.put(itemId, normalizedValues.get(itemId).add(value.getVector())); normalizedValueCount.put(itemId, normalizedValueCount.get(itemId)+1); senderList.get(itemId).add(senderId); } // normalize for (Map.Entry<Text, DoubleVector> e : normalizedValues.entrySet()) { double count = normalizedValueCount.get(e.getKey()); e.setValue(e.getValue().multiply(1.0/count)); } } private void receiveSyncedItemFactorizedValues( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException { MapWritable msg = new MapWritable(); Text itemId = null; // messages are arriving take them while ((msg = peer.getCurrentMessage()) != null) { itemId = (Text) msg.get(OnlineCF.Settings.MSG_ITEM_MATRIX); itemsMatrix.put(itemId.toString(), (VectorWritable)msg.get(OnlineCF.Settings.MSG_VALUE)); } } private void sendItemFactorizedValues( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException, SyncException, InterruptedException { int peerCount = peer.getNumPeers(); // item factorized values should be normalized IntWritable peerId = new IntWritable(peer.getPeerIndex()); for (Map.Entry<String, VectorWritable> item : itemsMatrix.entrySet()) { MapWritable msg = new MapWritable(); msg.put(OnlineCF.Settings.MSG_ITEM_MATRIX, new Text(item.getKey())); msg.put(OnlineCF.Settings.MSG_VALUE, item.getValue()); msg.put(OnlineCF.Settings.MSG_SENDER_ID, peerId); peer.send( peer.getPeerName(item.getKey().hashCode()%peerCount), msg); } } private void computeValues() { // shuffling indexes int idx = 0; int idxValue = 0; int tmp = 0; for (int i=indexes.size(); i>0; i--) { idx = Math.abs(rnd.nextInt())%i; idxValue = indexes.get(idx); tmp = indexes.get(i-1); indexes.set(i-1, idxValue); indexes.set(idx, tmp); } // compute values OnlineUpdate.InputStructure inp = new OnlineUpdate.InputStructure(); OnlineUpdate.OutputStructure out = null; Preference<String, String> pref = null; for (Integer prefIdx : indexes) { pref = preferences.get(prefIdx); VectorWritable userFactorizedValues = usersMatrix.get(pref.getUserId()); VectorWritable itemFactorizedValues = itemsMatrix.get(pref.getItemId()); VectorWritable userFeatures = (inpUsersFeatures!=null)?inpUsersFeatures.get(pref.getUserId()):null; VectorWritable itemFeatures = (inpItemsFeatures!=null)?inpItemsFeatures.get(pref.getItemId()):null; inp.user = userFactorizedValues; inp.item = itemFactorizedValues; inp.expectedScore = pref.getValue(); inp.userFeatures = userFeatures; inp.itemFeatures = itemFeatures; inp.userFeatureFactorized = userFeatureMatrix; inp.itemFeatureFactorized = itemFeatureMatrix; out = function.compute(inp); usersMatrix.put(pref.getUserId(), out.userFactorized); itemsMatrix.put(pref.getItemId(), out.itemFactorized); userFeatureMatrix = out.userFeatureFactorized; itemFeatureMatrix = out.itemFeatureFactorized; } } private void saveModel( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException, SyncException, InterruptedException { // save user information LOG.info(peer.getPeerName() + ") saving " + usersMatrix.size() + " users"); for (Map.Entry<String, VectorWritable> user : usersMatrix.entrySet()) { peer.write( new Text(OnlineCF.Settings.DFLT_MODEL_USER_DELIM + user.getKey()), user.getValue()); } // broadcast item values, normalize and save sendItemFactorizedValues(peer); peer.sync(); HashMap<Text, LinkedList<IntWritable>> senderList = new HashMap<Text, LinkedList<IntWritable>>(); HashMap<Text, DoubleVector> normalizedValues = new HashMap<Text, DoubleVector>(); getNormalizedItemFactorizedValues(peer, normalizedValues, senderList); saveItemFactorizedValues(peer, normalizedValues); // broadcast item and user feature matrix // normalize and save if (itemFeatureMatrix != null) { // save item features for (Map.Entry<String, VectorWritable> feature : inpItemsFeatures.entrySet()) { peer.write(new Text(OnlineCF.Settings.DFLT_MODEL_ITEM_FEATURES_DELIM+feature.getKey()), feature.getValue()); } // item feature factorized values should be normalized DoubleMatrix res = normalizeMatrix(peer, itemFeatureMatrix, OnlineCF.Settings.MSG_ITEM_FEATURE_MATRIX, false); if (res != null) { Text key = new Text(OnlineCF.Settings.DFLT_MODEL_ITEM_MTX_FEATURES_DELIM + OnlineCF.Settings.MSG_ITEM_FEATURE_MATRIX.toString()); peer.write(key, convertMatrixToVector(res)); } } if (userFeatureMatrix != null) { // save user features // save item features for (Map.Entry<String, VectorWritable> feature : inpUsersFeatures.entrySet()) { peer.write(new Text(OnlineCF.Settings.DFLT_MODEL_USER_FEATURES_DELIM+feature.getKey()), feature.getValue()); } // user feature factorized values should be normalized DoubleMatrix res = normalizeMatrix(peer, userFeatureMatrix, OnlineCF.Settings.MSG_USER_FEATURE_MATRIX, false); if (res != null) { Text key = new Text(OnlineCF.Settings.DFLT_MODEL_USER_MTX_FEATURES_DELIM + OnlineCF.Settings.MSG_USER_FEATURE_MATRIX.toString()); peer.write(key, convertMatrixToVector(res)); } } } private void saveItemFactorizedValues( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer, HashMap<Text, DoubleVector> normalizedValues) throws IOException { LOG.info(peer.getPeerName() + ") saving " + normalizedValues.size() + " items"); for (Map.Entry<Text, DoubleVector> item : normalizedValues.entrySet()) { peer.write( new Text(OnlineCF.Settings.DFLT_MODEL_ITEM_DELIM + item.getKey().toString()), new VectorWritable(item.getValue())); } } private void sendRequiredFeatures( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException, SyncException, InterruptedException { MapWritable msg = null; int senderId = 0; while ((msg = peer.getCurrentMessage()) != null) { senderId = ((IntWritable)msg.get(OnlineCF.Settings.MSG_SENDER_ID)).get(); MapWritable resp = new MapWritable(); if (msg.containsKey(OnlineCF.Settings.MSG_INP_ITEM_FEATURES)) { // send item feature String itemId = ((Text)msg.get(OnlineCF.Settings.MSG_INP_ITEM_FEATURES)).toString().substring(1); resp.put(OnlineCF.Settings.MSG_INP_ITEM_FEATURES, new Text(itemId)); resp.put(OnlineCF.Settings.MSG_VALUE, inpItemsFeatures.get(itemId)); } else if (msg.containsKey(OnlineCF.Settings.MSG_INP_USER_FEATURES)) { // send user feature String userId = ((Text)msg.get(OnlineCF.Settings.MSG_INP_USER_FEATURES)).toString().substring(1); resp.put(OnlineCF.Settings.MSG_INP_USER_FEATURES, new Text(userId)); resp.put(OnlineCF.Settings.MSG_VALUE, inpUsersFeatures.get(userId)); } peer.send(peer.getPeerName(senderId), resp); } } private void collectFeatures( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException { // remove all features, // since we will get necessary features via messages inpItemsFeatures = new HashMap<String, VectorWritable>(); inpUsersFeatures = new HashMap<String, VectorWritable>(); MapWritable msg = null; int userFeatureSize = 0; int itemFeatureSize = 0; while ((msg = peer.getCurrentMessage()) != null) { if (msg.containsKey(OnlineCF.Settings.MSG_INP_ITEM_FEATURES)) { // send item feature String itemId = ((Text)msg.get(OnlineCF.Settings.MSG_INP_ITEM_FEATURES)).toString(); inpItemsFeatures.put(itemId, (VectorWritable)msg.get(OnlineCF.Settings.MSG_VALUE)); itemFeatureSize = ((VectorWritable)msg.get(OnlineCF.Settings.MSG_VALUE)).getVector().getLength(); } else if (msg.containsKey(OnlineCF.Settings.MSG_INP_USER_FEATURES)) { // send user feature String userId = ((Text)msg.get(OnlineCF.Settings.MSG_INP_USER_FEATURES)).toString(); inpUsersFeatures.put(userId, (VectorWritable)msg.get(OnlineCF.Settings.MSG_VALUE)); userFeatureSize = ((VectorWritable)msg.get(OnlineCF.Settings.MSG_VALUE)).getVector().getLength(); } } if (inpItemsFeatures.size() > 0) { itemFeatureMatrix = new DenseDoubleMatrix(MATRIX_RANK, itemFeatureSize, rnd); } if (inpUsersFeatures.size() > 0) { userFeatureMatrix = new DenseDoubleMatrix(MATRIX_RANK, userFeatureSize, rnd); } } private void askForFeatures( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer, HashSet<Text> requiredUserFeatures, HashSet<Text> requiredItemFeatures) throws IOException, SyncException, InterruptedException { int peerCount = peer.getNumPeers(); int peerId = peer.getPeerIndex(); if (requiredUserFeatures != null) { Iterator<Text> iter = requiredUserFeatures.iterator(); Text key = null; while (iter.hasNext()) { MapWritable msg = new MapWritable(); key = iter.next(); msg.put(OnlineCF.Settings.MSG_INP_USER_FEATURES, key); msg.put(OnlineCF.Settings.MSG_SENDER_ID, new IntWritable(peerId)); peer.send(peer.getPeerName(key.hashCode()%peerCount), msg); } } if (requiredItemFeatures != null) { Iterator<Text> iter = requiredItemFeatures.iterator(); Text key = null; while (iter.hasNext()) { MapWritable msg = new MapWritable(); key = iter.next(); msg.put(OnlineCF.Settings.MSG_INP_ITEM_FEATURES, key); msg.put(OnlineCF.Settings.MSG_SENDER_ID, new IntWritable(peerId)); peer.send(peer.getPeerName(key.hashCode()%peerCount), msg); } } } private void collectInput( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer, HashSet<Text> requiredUserFeatures, HashSet<Text> requiredItemFeatures) throws IOException { Text key = new Text(); VectorWritable value = new VectorWritable(); int counter = 0; requiredUserFeatures = new HashSet<Text>(); requiredItemFeatures = new HashSet<Text>(); while(peer.readNext(key, value)) { // key format: (0, 1..n) // 0 - delimiter, for type of key // 1..n - actaul key value String firstSymbol = key.toString().substring(0, 1); String actualId = key.toString().substring(1); if (firstSymbol.equals(inputPreferenceDelim)) { // parse as <k:userId, v:(itemId, score)> String itemId = Long.toString((long)value.getVector().get(0)); String score = Double.toString(value.getVector().get(1)); if (usersMatrix.containsKey(actualId) == false) { DenseDoubleVector vals = new DenseDoubleVector(MATRIX_RANK); for (int i=0; i<MATRIX_RANK; i++) { vals.set(i, rnd.nextDouble()); } VectorWritable rndValues = new VectorWritable(vals); usersMatrix.put(actualId, rndValues); } if (itemsMatrix.containsKey(itemId) == false) { DenseDoubleVector vals = new DenseDoubleVector(MATRIX_RANK); for (int i=0; i<MATRIX_RANK; i++) { vals.set(i, rnd.nextDouble()); } VectorWritable rndValues = new VectorWritable(vals); itemsMatrix.put(itemId, rndValues); } preferences.add(new Preference<String, String>(actualId, itemId, Double.parseDouble(score))); indexes.add(counter); // since we used HashPartitioner, // in order to ask for input feature we need peer index // we can obtain peer index by using actual key requiredUserFeatures.add(new Text(inputUserDelim+actualId)); requiredItemFeatures.add(new Text(inputItemDelim+itemId)); counter++; } else if (firstSymbol.equals(inputUserDelim)) { // parse as <k:userId, v:(ArrayOfFeatureValues)> if (inpUsersFeatures == null) { inpUsersFeatures = new HashMap<String, VectorWritable>(); } inpUsersFeatures.put(actualId, value); } else if (firstSymbol.equals(inputItemDelim)) { // parse as <k:itemId, v:(ArrayOfFeatureValues)> if (inpItemsFeatures == null) { inpItemsFeatures = new HashMap<String, VectorWritable>(); } inpItemsFeatures.put(actualId, value); } else { // just skip, maybe we should throw exception continue; } } } }
923a94fe52d511651113faf50a3274fc9fd05790
1,052
java
Java
Protein_Annotation_Webapp/src/org/yeastrc/paws/www/service/Get_SequenceIdForSequence.java
yeastrc/paws_Protein_Annotation_Web_Services
de36eb2df5dcadc06b697f73384cc8d114aeffe3
[ "Apache-2.0" ]
null
null
null
Protein_Annotation_Webapp/src/org/yeastrc/paws/www/service/Get_SequenceIdForSequence.java
yeastrc/paws_Protein_Annotation_Web_Services
de36eb2df5dcadc06b697f73384cc8d114aeffe3
[ "Apache-2.0" ]
null
null
null
Protein_Annotation_Webapp/src/org/yeastrc/paws/www/service/Get_SequenceIdForSequence.java
yeastrc/paws_Protein_Annotation_Web_Services
de36eb2df5dcadc06b697f73384cc8d114aeffe3
[ "Apache-2.0" ]
null
null
null
24.465116
127
0.713878
999,268
package org.yeastrc.paws.www.service; import org.apache.log4j.Logger; import org.yeastrc.paws.www.constants.AnnotationDataRunStatusConstants; import org.yeastrc.paws.www.dao.SequenceDAO; /** * * */ public class Get_SequenceIdForSequence { private static final Logger log = Logger.getLogger(Get_SequenceIdForSequence.class); private Get_SequenceIdForSequence() { } public static Get_SequenceIdForSequence getInstance() { return new Get_SequenceIdForSequence(); } /** * @param sequence * @return * @throws Exception */ public String get_SequenceIdForSequence( String sequence ) throws Exception { Integer sequenceId = SequenceDAO.getInstance().getSequenceIdBySequence( sequence ); String response = null; if ( sequenceId != null ) { response = "{\"getStatus\":\"" + AnnotationDataRunStatusConstants.STATUS_COMPLETE + "\",\"sequenceId\":" + sequenceId + "}"; } else { response = "{\"getStatus\":\"" + AnnotationDataRunStatusConstants.STATUS_NO_RECORD + "\"}"; } return response; } }
923a9501e0b11e2c75a73b65dd8bb0fb849c13d3
264
java
Java
doji-practice/src/main/java/com/dayton/doji/practice/designpattern/simplefactory/v1/ICourse.java
dym3093/doji
057047bd323540bc818d48687d256208e2494d81
[ "Apache-2.0" ]
null
null
null
doji-practice/src/main/java/com/dayton/doji/practice/designpattern/simplefactory/v1/ICourse.java
dym3093/doji
057047bd323540bc818d48687d256208e2494d81
[ "Apache-2.0" ]
null
null
null
doji-practice/src/main/java/com/dayton/doji/practice/designpattern/simplefactory/v1/ICourse.java
dym3093/doji
057047bd323540bc818d48687d256208e2494d81
[ "Apache-2.0" ]
null
null
null
14.666667
64
0.643939
999,269
package com.dayton.doji.practice.designpattern.simplefactory.v1; /** * 课程接口 * @author Martin Deng * @since 2020-08-06 19:03 */ public interface ICourse { /** * 录制视频 * @return void * @author Martin Deng * @since 2020/8/6 19:03 */ void record(); }
923a95958c608463b5685665bf0f0d5b84e066dd
1,147
java
Java
Mage.Sets/src/mage/cards/i/InvokeTheFiremind.java
zeffirojoe/mage
71260c382a4e3afef5cdf79adaa00855b963c166
[ "MIT" ]
1,444
2015-01-02T00:25:38.000Z
2022-03-31T13:57:18.000Z
Mage.Sets/src/mage/cards/i/InvokeTheFiremind.java
zeffirojoe/mage
71260c382a4e3afef5cdf79adaa00855b963c166
[ "MIT" ]
6,180
2015-01-02T19:10:09.000Z
2022-03-31T21:10:44.000Z
Mage.Sets/src/mage/cards/i/InvokeTheFiremind.java
zeffirojoe/mage
71260c382a4e3afef5cdf79adaa00855b963c166
[ "MIT" ]
1,001
2015-01-01T01:15:20.000Z
2022-03-30T20:23:04.000Z
28.675
108
0.741935
999,270
package mage.cards.i; import java.util.UUID; import mage.abilities.Mode; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.target.common.TargetAnyTarget; /** * * @author Loki */ public final class InvokeTheFiremind extends CardImpl { public InvokeTheFiremind(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{U}{U}{R}"); this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(ManacostVariableValue.REGULAR)); Mode mode = new Mode(); mode.addEffect(new DamageTargetEffect(ManacostVariableValue.REGULAR)); mode.addTarget(new TargetAnyTarget()); this.getSpellAbility().addMode(mode); } private InvokeTheFiremind(final InvokeTheFiremind card) { super(card); } @Override public InvokeTheFiremind copy() { return new InvokeTheFiremind(this); } }
923a9624e2726cec319bab4558d2e08354653eae
2,536
java
Java
ExtractedJars/Health_com.huawei.health/javafiles/com/amap/api/mapcore/util/ed$3.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
3
2019-05-01T09:22:08.000Z
2019-07-06T22:21:59.000Z
ExtractedJars/Health_com.huawei.health/javafiles/com/amap/api/mapcore/util/ed$3.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
null
null
null
ExtractedJars/Health_com.huawei.health/javafiles/com/amap/api/mapcore/util/ed$3.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
1
2020-11-26T12:22:02.000Z
2020-11-26T12:22:02.000Z
31.308642
114
0.559148
999,271
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package com.amap.api.mapcore.util; import android.util.Log; import java.util.concurrent.*; // Referenced classes of package com.amap.api.mapcore.util: // ed class ed$3 extends FutureTask { protected void done() { try { ed.b(a, ed.b(a).get()); // 0 0:aload_0 // 1 1:getfield #15 <Field ed a> // 2 4:aload_0 // 3 5:getfield #15 <Field ed a> // 4 8:invokestatic #30 <Method FutureTask ed.b(ed)> // 5 11:invokevirtual #34 <Method Object FutureTask.get()> // 6 14:invokestatic #37 <Method void ed.b(ed, Object)> return; // 7 17:return } catch(InterruptedException interruptedexception) //* 8 18:astore_1 { Log.w("AbstractAsyncTask", ((Throwable) (interruptedexception))); // 9 19:ldc1 #39 <String "AbstractAsyncTask"> // 10 21:aload_1 // 11 22:invokestatic #45 <Method int Log.w(String, Throwable)> // 12 25:pop return; // 13 26:return } catch(ExecutionException executionexception) //* 14 27:astore_1 { throw new RuntimeException("An error occured while executing doInBackground()", executionexception.getCause()); // 15 28:new #47 <Class RuntimeException> // 16 31:dup // 17 32:ldc1 #49 <String "An error occured while executing doInBackground()"> // 18 34:aload_1 // 19 35:invokevirtual #53 <Method Throwable ExecutionException.getCause()> // 20 38:invokespecial #56 <Method void RuntimeException(String, Throwable)> // 21 41:athrow } catch(CancellationException cancellationexception) //* 22 42:astore_1 { ed.b(a, ((Object) (null))); // 23 43:aload_0 // 24 44:getfield #15 <Field ed a> // 25 47:aconst_null // 26 48:invokestatic #37 <Method void ed.b(ed, Object)> } // 27 51:return } final ed a; ed$3(ed ed1, Callable callable) { a = ed1; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #15 <Field ed a> super(callable); // 3 5:aload_0 // 4 6:aload_2 // 5 7:invokespecial #18 <Method void FutureTask(Callable)> // 6 10:return } }
923a97257c4b6a15934d68ca33f1bcb2a01fe477
622
java
Java
litemall-database/src/main/java/com/doopai/litemall/database/util/CouponConstant.java
litemall/litemall
201f033b6f842de27512879553e019779dd8a268
[ "MIT" ]
null
null
null
litemall-database/src/main/java/com/doopai/litemall/database/util/CouponConstant.java
litemall/litemall
201f033b6f842de27512879553e019779dd8a268
[ "MIT" ]
null
null
null
litemall-database/src/main/java/com/doopai/litemall/database/util/CouponConstant.java
litemall/litemall
201f033b6f842de27512879553e019779dd8a268
[ "MIT" ]
null
null
null
32.736842
54
0.741158
999,272
package com.doopai.litemall.database.util; public class CouponConstant { public static final Short TYPE_COMMON = 0; public static final Short TYPE_REGISTER = 1; public static final Short TYPE_CODE = 2; public static final Short GOODS_TYPE_ALL = 0; public static final Short GOODS_TYPE_CATEGORY = 1; public static final Short GOODS_TYPE_ARRAY = 2; public static final Short STATUS_NORMAL = 0; public static final Short STATUS_EXPIRED = 1; public static final Short STATUS_OUT = 2; public static final Short TIME_TYPE_DAYS = 0; public static final Short TIME_TYPE_TIME = 1; }
923a98280a0e6fe7a012e34de3abeaea22770a6f
303
java
Java
cws_model_to_java_skel/src/main/java/uo/ri/business/repository/RepositoryFactory.java
ZenMaster91/uniovi.ri
d976d3d54e8216d2dd404945fe9c4e6bc85d9cc3
[ "MIT" ]
1
2017-11-27T17:51:42.000Z
2017-11-27T17:51:42.000Z
cws_model_to_java_skel/src/main/java/uo/ri/business/repository/RepositoryFactory.java
ZenMaster91/uniovi.ri
d976d3d54e8216d2dd404945fe9c4e6bc85d9cc3
[ "MIT" ]
3
2017-11-29T19:44:35.000Z
2017-12-08T09:34:44.000Z
cws_model_to_java_skel/src/main/java/uo/ri/business/repository/RepositoryFactory.java
ZenMaster91/uniovi.ri
d976d3d54e8216d2dd404945fe9c4e6bc85d9cc3
[ "MIT" ]
null
null
null
16.833333
37
0.755776
999,273
package uo.ri.business.repository; public interface RepositoryFactory { MecanicoRepository forMechanic(); AveriaRepository forAveria(); MedioPagoRepository forMedioPago(); FacturaRepository forFactura(); ClienteRepository forCliente(); RepuestoRepository forRepuesto(); }
923a983c73bff7f27e61eb8d86ca4c9d0e299408
4,005
java
Java
src/mild/katyusha/system/build/TRDFala.java
ruankotovich/Mild-Katyusha
c545909e49683e23ec007947012cbf45cf169962
[ "MIT" ]
null
null
null
src/mild/katyusha/system/build/TRDFala.java
ruankotovich/Mild-Katyusha
c545909e49683e23ec007947012cbf45cf169962
[ "MIT" ]
null
null
null
src/mild/katyusha/system/build/TRDFala.java
ruankotovich/Mild-Katyusha
c545909e49683e23ec007947012cbf45cf169962
[ "MIT" ]
null
null
null
35.758929
147
0.535331
999,274
/* * 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 mild.katyusha.system.build; import java.awt.Color; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.ImageIcon; import mild.katyusha.system.window.WNDBundle; /** * * @author Dmitry */ public class TRDFala implements Runnable { WNDBundle caller; public static final String[] T_1 = {"G", "H", "J", "O"}; public static final String[] T_2 = {"A", "E", "K", "L", "R", "S", "W"}; public static final String[] T_3 = {"B", "C", "F", "D", "M", "N", "P", "Q", "T", "V", "Z"}; public static final String[] T_4 = {"I", "U", "X", "Y"}; private boolean isIn(String[] lista, String par) { boolean retorno = false; for (String lista1 : lista) { if (lista1.equals(par)) { retorno = true; break; } } return retorno; } public TRDFala(WNDBundle calling) { this.caller = calling; } @Override public void run() { try { fala(caller.jOutputText.getText()); } catch (InterruptedException ex) { Logger.getLogger(TRDFala.class .getName()).log(Level.SEVERE, null, ex); } } public void fala(String text) throws InterruptedException { char[] texto = text.toUpperCase().replace("KATYUSHA : ", "").toCharArray(); int as = 70; if (text.contains("Vyhodila, pesnyu zavodila")) { as = 135; } for (int i = 0; i < texto.length; i++) { caller.jLbKatyusha.setIcon(new ImageIcon(this.getClass().getResource("/mild/katyusha/system/gfx/t_" + verificar(texto[i]) + ".png"))); Thread.sleep(as); } if (!caller.isSad) { if (text.contains(":D") || text.contains("=D") || text.contains("=)")) { caller.jLbKatyusha.setIcon(new ImageIcon(this.getClass().getResource("/mild/katyusha/system/gfx/hp_2.png"))); caller.isSad = false; } else if (text.contains(">:(")) { caller.jLbKatyusha.setIcon(new ImageIcon(this.getClass().getResource("/mild/katyusha/system/gfx/sd_2.png"))); caller.isSad = true; if (caller.isActivated) { caller.thread = new Thread(new TRDBundle(caller)); caller.thread.start(); } } else if (text.contains(":/") || text.contains(":(") || text.contains("=(")) { caller.jLbKatyusha.setIcon(new ImageIcon(this.getClass().getResource("/mild/katyusha/system/gfx/sd_1.png"))); } else { caller.jLbKatyusha.setIcon(new ImageIcon(this.getClass().getResource("/mild/katyusha/system/gfx/hp_1.png"))); } } else { if (text.contains(":}")) { caller.jLbKatyusha.setIcon(new ImageIcon(this.getClass().getResource("/mild/katyusha/system/gfx/hp_2.png"))); caller.isSad = false; } else { caller.jLbKatyusha.setIcon(new ImageIcon(this.getClass().getResource("/mild/katyusha/system/gfx/sd_2.png"))); } } caller.jInputText.setEditable(true); caller.jInputText.setText(""); caller.jInputText.setBackground(new Color(255, 155, 155)); } private String verificar(char texto) { String comparar = String.valueOf(texto); if (isIn(T_1, comparar)) { return "1"; } else if (isIn(T_2, comparar)) { return "2"; } else if (isIn(T_3, comparar)) { return "3"; } else if (isIn(T_4, comparar)) { return "4"; } else { return "5"; } } }
923a985c4a6b125689baccff3670f36c7316a4fe
14,476
java
Java
server-core/src/main/java/io/onedev/server/web/component/issue/side/IssueSidePanel.java
rubinus/onedev
76793a7515ba216d7b3850915bb2a08506beb297
[ "MIT" ]
null
null
null
server-core/src/main/java/io/onedev/server/web/component/issue/side/IssueSidePanel.java
rubinus/onedev
76793a7515ba216d7b3850915bb2a08506beb297
[ "MIT" ]
null
null
null
server-core/src/main/java/io/onedev/server/web/component/issue/side/IssueSidePanel.java
rubinus/onedev
76793a7515ba216d7b3850915bb2a08506beb297
[ "MIT" ]
null
null
null
30.033195
102
0.720296
999,275
package io.onedev.server.web.component.issue.side; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.apache.wicket.Component; import org.apache.wicket.RestartResponseAtInterceptPageException; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.core.request.handler.IPartialPageRequestHandler; import org.apache.wicket.markup.head.CssHeaderItem; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.JavaScriptHeaderItem; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.request.mapper.parameter.PageParameters; import com.google.common.collect.Lists; import io.onedev.server.OneDev; import io.onedev.server.entitymanager.IssueChangeManager; import io.onedev.server.entitymanager.IssueVoteManager; import io.onedev.server.entitymanager.IssueWatchManager; import io.onedev.server.entityreference.Referenceable; import io.onedev.server.model.AbstractEntity; import io.onedev.server.model.Issue; import io.onedev.server.model.IssueVote; import io.onedev.server.model.IssueWatch; import io.onedev.server.model.Milestone; import io.onedev.server.model.Project; import io.onedev.server.model.User; import io.onedev.server.model.support.EntityWatch; import io.onedev.server.search.entity.issue.IssueQuery; import io.onedev.server.search.entity.issue.StateCriteria; import io.onedev.server.security.SecurityUtils; import io.onedev.server.util.Input; import io.onedev.server.util.match.MatchScoreProvider; import io.onedev.server.util.match.MatchScoreUtils; import io.onedev.server.web.WebConstants; import io.onedev.server.web.ajaxlistener.AttachAjaxIndicatorListener; import io.onedev.server.web.ajaxlistener.ConfirmClickListener; import io.onedev.server.web.behavior.WebSocketObserver; import io.onedev.server.web.component.entity.reference.ReferencePanel; import io.onedev.server.web.component.entity.watches.EntityWatchesPanel; import io.onedev.server.web.component.issue.fieldvalues.FieldValuesPanel; import io.onedev.server.web.component.issue.statestats.StateStatsBar; import io.onedev.server.web.component.link.ViewStateAwarePageLink; import io.onedev.server.web.component.milestone.MilestoneStatusLabel; import io.onedev.server.web.component.milestone.choice.AbstractMilestoneChoiceProvider; import io.onedev.server.web.component.milestone.choice.MilestoneChoiceResourceReference; import io.onedev.server.web.component.select2.Response; import io.onedev.server.web.component.select2.ResponseFiller; import io.onedev.server.web.component.select2.SelectToAddChoice; import io.onedev.server.web.component.user.ident.Mode; import io.onedev.server.web.component.user.ident.UserIdentPanel; import io.onedev.server.web.component.user.list.SimpleUserListLink; import io.onedev.server.web.page.project.issues.milestones.MilestoneIssuesPage; import io.onedev.server.web.page.simple.security.LoginPage; @SuppressWarnings("serial") public abstract class IssueSidePanel extends Panel { private static final int MAX_DISPLAY_AVATARS = 20; public IssueSidePanel(String id) { super(id); } @Override protected void onBeforeRender() { addOrReplace(newFieldsContainer()); addOrReplace(newMilestonesContainer()); addOrReplace(newVotesContainer()); addOrReplace(new EntityWatchesPanel("watches") { @Override protected void onSaveWatch(EntityWatch watch) { OneDev.getInstance(IssueWatchManager.class).save((IssueWatch) watch); } @Override protected void onDeleteWatch(EntityWatch watch) { OneDev.getInstance(IssueWatchManager.class).delete((IssueWatch) watch); } @Override protected AbstractEntity getEntity() { return getIssue(); } }); addOrReplace(new ReferencePanel("reference") { @Override protected Referenceable getReferenceable() { return getIssue(); } }); if (SecurityUtils.canManageIssues(getProject())) addOrReplace(newDeleteLink("delete")); else addOrReplace(new WebMarkupContainer("delete").setVisible(false)); super.onBeforeRender(); } @Override protected void onInitialize() { super.onInitialize(); add(new WebSocketObserver() { @Override public void onObservableChanged(IPartialPageRequestHandler handler) { handler.add(IssueSidePanel.this); } @Override public Collection<String> getObservables() { return Lists.newArrayList(Issue.getWebSocketObservable(getIssue().getId())); } }); setOutputMarkupId(true); } private Component newFieldsContainer() { IModel<List<Input>> fieldsModel = new LoadableDetachableModel<List<Input>>() { @Override protected List<Input> load() { List<Input> fields = new ArrayList<>(); for (Input field: getIssue().getFieldInputs().values()) { if (getIssue().isFieldVisible(field.getName())) fields.add(field); } return fields; } }; return new ListView<Input>("fields", fieldsModel) { @Override protected void populateItem(ListItem<Input> item) { Input field = item.getModelObject(); item.add(new Label("name", field.getName())); item.add(new FieldValuesPanel("values", Mode.NAME) { @Override protected AttachAjaxIndicatorListener getInplaceEditAjaxIndicator() { return new AttachAjaxIndicatorListener(false); } @Override protected Issue getIssue() { return IssueSidePanel.this.getIssue(); } @Override protected Input getField() { return item.getModelObject(); } }.setRenderBodyOnly(true)); } @Override protected void onConfigure() { super.onConfigure(); setVisible(!fieldsModel.getObject().isEmpty()); } }; } private Component newMilestonesContainer() { WebMarkupContainer container = new WebMarkupContainer("milestones") { @Override protected void onConfigure() { super.onConfigure(); setVisible(!getIssue().getSchedules().isEmpty() || SecurityUtils.canScheduleIssues(getProject())); } }; container.add(new ListView<Milestone>("milestones", new AbstractReadOnlyModel<List<Milestone>>() { @Override public List<Milestone> getObject() { return getIssue().getMilestones().stream() .sorted(new Milestone.DatesAndStatusComparator()) .collect(Collectors.toList()); } }) { @Override protected void populateItem(ListItem<Milestone> item) { Milestone milestone = item.getModelObject(); Link<Void> link = new BookmarkablePageLink<Void>("link", MilestoneIssuesPage.class, MilestoneIssuesPage.paramsOf(getIssue().getProject(), milestone, null)); link.add(new Label("label", milestone.getName())); item.add(link); item.add(new StateStatsBar("progress", new AbstractReadOnlyModel<Map<String, Integer>>() { @Override public Map<String, Integer> getObject() { return item.getModelObject().getStateStats(getIssue().getProject()); } }) { @Override protected Link<Void> newStateLink(String componentId, String state) { String query = new IssueQuery(new StateCriteria(state)).toString(); PageParameters params = MilestoneIssuesPage.paramsOf(getIssue().getProject(), item.getModelObject(), query); return new ViewStateAwarePageLink<Void>(componentId, MilestoneIssuesPage.class, params); } }); item.add(new MilestoneStatusLabel("status", new AbstractReadOnlyModel<Milestone>() { @Override public Milestone getObject() { return item.getModelObject(); } })); item.add(new AjaxLink<Void>("delete") { @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); if (!getIssue().isNew()) { attributes.getAjaxCallListeners().add(new ConfirmClickListener("Do you really want to " + "remove the issue from milestone '" + item.getModelObject().getName() + "'?")); } } @Override public void onClick(AjaxRequestTarget target) { getIssueChangeManager().removeFromMilestone(getIssue(), item.getModelObject()); } @Override protected void onConfigure() { super.onConfigure(); setVisible(SecurityUtils.canScheduleIssues(getIssue().getProject())); } }); } }); container.add(new SelectToAddChoice<Milestone>("add", new AbstractMilestoneChoiceProvider() { @Override public void query(String term, int page, Response<Milestone> response) { List<Milestone> milestones = getProject().getSortedHierarchyMilestones(); milestones.removeAll(getIssue().getMilestones()); milestones = MatchScoreUtils.filterAndSort( milestones, new MatchScoreProvider<Milestone>() { @Override public double getMatchScore(Milestone object) { return MatchScoreUtils.getMatchScore(object.getName(), term); } }); new ResponseFiller<Milestone>(response).fill(milestones, page, WebConstants.PAGE_SIZE); } }) { @Override protected void onInitialize() { super.onInitialize(); getSettings().setPlaceholder("Add to milestone..."); getSettings().setFormatResult("onedev.server.milestoneChoiceFormatter.formatResult"); getSettings().setFormatSelection("onedev.server.milestoneChoiceFormatter.formatSelection"); getSettings().setEscapeMarkup("onedev.server.milestoneChoiceFormatter.escapeMarkup"); } @Override protected void onConfigure() { super.onConfigure(); setVisible(SecurityUtils.canScheduleIssues(getIssue().getProject())); } @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new MilestoneChoiceResourceReference())); } @Override protected void onSelect(AjaxRequestTarget target, Milestone milestone) { getIssueChangeManager().addToMilestone(getIssue(), milestone); } }); return container; } private List<IssueVote> getSortedVotes() { List<IssueVote> votes = new ArrayList<>(getIssue().getVotes()); Collections.sort(votes, new Comparator<IssueVote>() { @Override public int compare(IssueVote o1, IssueVote o2) { return o2.getId().compareTo(o1.getId()); } }); return votes; } private Component newVotesContainer() { WebMarkupContainer container = new WebMarkupContainer("votes"); container.setOutputMarkupId(true); container.add(new Label("count", new AbstractReadOnlyModel<String>() { @Override public String getObject() { return String.valueOf(getIssue().getVoteCount()); } })); container.add(new ListView<IssueVote>("voters", new LoadableDetachableModel<List<IssueVote>>() { @Override protected List<IssueVote> load() { List<IssueVote> votes = getSortedVotes(); if (votes.size() > MAX_DISPLAY_AVATARS) votes = votes.subList(0, MAX_DISPLAY_AVATARS); return votes; } }) { @Override protected void populateItem(ListItem<IssueVote> item) { User user = item.getModelObject().getUser(); item.add(new UserIdentPanel("voter", user, Mode.AVATAR)); } @Override protected void onConfigure() { super.onConfigure(); setVisible(!getIssue().getVotes().isEmpty()); } }); container.add(new SimpleUserListLink("more") { @Override protected void onConfigure() { super.onConfigure(); setVisible(getIssue().getVotes().size() > MAX_DISPLAY_AVATARS); } @Override protected List<User> getUsers() { List<IssueVote> votes = getSortedVotes(); if (votes.size() > MAX_DISPLAY_AVATARS) votes = votes.subList(MAX_DISPLAY_AVATARS, votes.size()); else votes = new ArrayList<>(); return votes.stream().map(it->it.getUser()).collect(Collectors.toList()); } }); AjaxLink<Void> voteLink = new AjaxLink<Void>("vote") { private IssueVote getVote(User user) { for (IssueVote vote: getIssue().getVotes()) { if (user.equals(vote.getUser())) return vote; } return null; } @Override public void onClick(AjaxRequestTarget target) { if (SecurityUtils.getUser() != null) { IssueVote vote = getVote(SecurityUtils.getUser()); if (vote == null) { vote = new IssueVote(); vote.setIssue(getIssue()); vote.setUser(SecurityUtils.getUser()); vote.setDate(new Date()); OneDev.getInstance(IssueVoteManager.class).save(vote); getIssue().getVotes().add(vote); } else { getIssue().getVotes().remove(vote); OneDev.getInstance(IssueVoteManager.class).delete(vote); } target.add(container); } else { throw new RestartResponseAtInterceptPageException(LoginPage.class); } } @Override protected void onInitialize() { super.onInitialize(); add(new Label("label", new LoadableDetachableModel<String>() { @Override protected String load() { if (SecurityUtils.getUser() != null) { if (getVote(SecurityUtils.getUser()) != null) return "Unvote"; else return "Vote"; } else { return "Login to vote"; } } })); } }; container.add(voteLink); return container; } private Project getProject() { return getIssue().getProject(); } private IssueChangeManager getIssueChangeManager() { return OneDev.getInstance(IssueChangeManager.class); } @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem.forReference(new IssueSideCssResourceReference())); } protected abstract Issue getIssue(); protected abstract Component newDeleteLink(String componentId); }
923a986a8631acfab6d44f6fe143a735cb68fc08
3,387
java
Java
src/main/java/io/github/shitsurei/dao/enumerate/business/TimeZoneEnum.java
shitsurei/simple-bg-cli
983ccd35811de04239a6b1fc8c21310a355d015a
[ "Apache-2.0" ]
1
2022-03-22T02:57:04.000Z
2022-03-22T02:57:04.000Z
src/main/java/io/github/shitsurei/dao/enumerate/business/TimeZoneEnum.java
shitsurei/simple-bg-cli
983ccd35811de04239a6b1fc8c21310a355d015a
[ "Apache-2.0" ]
null
null
null
src/main/java/io/github/shitsurei/dao/enumerate/business/TimeZoneEnum.java
shitsurei/simple-bg-cli
983ccd35811de04239a6b1fc8c21310a355d015a
[ "Apache-2.0" ]
null
null
null
51.318182
234
0.679953
999,276
package io.github.shitsurei.dao.enumerate.business; /** * @author zgr * @Description 时区枚举(按时区由西到东排序) * @createTime 2022年02月27日 15:17:00 */ public enum TimeZoneEnum { AST("America/Anchorage", "GMT-9", "Alaska,America Anchorage"), PST("America/Los_Angeles", "GMT-8", "Pacific Time(US & Canada),Tijuana,America Los_Angeles"), PNT("America/Phoenix", "GMT-7", "Arizona,Chihuahua,Mazatlan,Mountain Time(US & Canada),America Phoenix"), CST("America/Chicago", "GMT-6", "Central America,Central Time(US & Canada),Guadalajara,Mexico City,Monterrey,Saskatchewan,America Chicago"), IET("America/Indiana/Indianapolis", "GMT-5", "Bogota,Eastern Time(US & Canada),Indiana(East),Lima,Quito"), PRT("America/Puerto_Rico", "GMT-4", "Atlantic Time(Canada),Caracas,Georgetown,La Paz,Puerto Rico,Santiago,America Puerto_Rico,St_Johns"), // CNT("America/St_Johns", "GMT-4",""), AGT("America/Argentina/Buenos_Aires", "GMT-3", "Brasilia,Buenos Aires,Greenland,Montevideo,Sao_Paulo,Argentina"), // BET("America/Sao_Paulo", "GMT-3",""), DIY1("GMT-2", "GMT-2", "Mid-Atlantic"), DIY2("GMT-1", "GMT-1", "Azores,Cape Verde Is"), EST("-05:00", "GMT+0", "UTC,Edinburgh,Lisbon,London,Monrovia"), // MST("-07:00", "GMT+0",""), // HST("-10:00", "GMT+0",""), ECT("Europe/Paris", "GMT+1", "Amsterdam,Belgrade,Berlin,Bern,Bratislava,Brussels,Budapest,Casablanca,Copenhagen,Dublin,Ljubljana,Madrid,Paris,Prague,Rome,Sarajevo,Skopje,Stockholm,Vienna,Warsaw,West Central Africa,Zagreb,Zurich"), ART("Africa/Cairo", "GMT+2", "Athens,Bucharest,Cairo,Harare,Helsinki,Jerusalem,Kaliningrad,Kyiv,Pretoria,Riga,Sofia,Tallinn,Vilnius"), // CAT("Africa/Harare", "GMT+2",""), EAT("Africa/Addis_Ababa", "GMT+3", "Baghdad,Istanbul,Kuwait,Minsk,Moscow,Nairobi,Riyadh,St. Petersburg"), NET("Asia/Yerevan", "GMT+4", "Abu Dhabi,Baku,Muscat,Samara,Tbilisi,Volgograd,Yerevan"), PLT("Asia/Karachi", "GMT+5", "Ekaterinburg,Islamabad,Karachi,Kolkata,Tashkent"), // IST("Asia/Kolkata", "GMT+5",""), BST("Asia/Dhaka", "GMT+6", "Almaty,Astana,Dhaka,Urumqi"), VST("Asia/Ho_Chi_Minh", "GMT+7", "Bangkok,Hanoi,Jakarta,Krasnoyarsk,Novosibirsk"), CTT("Asia/Shanghai", "GMT+8", "Beijing,Chongqing,Hong Kong,Irkutsk,Kuala Lumpur,Perth,Singapore,Taipei,Ulaanbaatar,Shanghai"), JST("Asia/Tokyo", "GMT+9", "Osaka,Sapporo,Seoul,Tokyo,Yakutsk,Darwin"), // ACT("Australia/Darwin", "GMT+9",""), DIY3("GMT+10", "GMT+10", "Brisbane,Canberra,Guam,Hobart,Melbourne,Port Moresby,Sydney,Vladivostok"), AET("Australia/Sydney", "GMT+11", "Magadan,New Caledonia,Solomon Is.,Srednekolymsk,Australia Sydney,Pacific Guadalcanal"), // SST("Pacific/Guadalcanal", "GMT+11",""), DIY4("GMT+12", "GMT+12", "Auckland,Fiji,Kamchatka,Marshall Is.,Wellington"), NST("Pacific/Auckland", "GMT-11", "American Samoa,Midway Island,Pacific Auckland,Nuku'alofa,Samoa,Tokelau Is."), MIT("Pacific/Apia", "GMT-10", "Hawaii,Pacific Apia"), ; private String id; private String offset; private String mainCity; TimeZoneEnum(String id, String offset, String mainCity) { this.id = id; this.offset = offset; this.mainCity = mainCity; } public String getId() { return id; } public String getOffset() { return offset; } public String getMainCity() { return mainCity; } }
923a9a1bd2e7c49e8bf47e47a35bc0dfd6d42939
6,495
java
Java
mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/utils/FlagsUpdateStageResultTest.java
brokenshoebox/james-project
a2a77ad247330ceb148ee0c7751cbe7e347467bd
[ "Apache-2.0" ]
634
2015-12-21T20:24:06.000Z
2022-03-24T09:57:48.000Z
mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/utils/FlagsUpdateStageResultTest.java
brokenshoebox/james-project
a2a77ad247330ceb148ee0c7751cbe7e347467bd
[ "Apache-2.0" ]
4,148
2015-09-14T15:59:06.000Z
2022-03-31T10:29:10.000Z
mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/utils/FlagsUpdateStageResultTest.java
brokenshoebox/james-project
a2a77ad247330ceb148ee0c7751cbe7e347467bd
[ "Apache-2.0" ]
392
2015-07-16T07:04:59.000Z
2022-03-28T09:37:53.000Z
40.341615
139
0.689299
999,277
/**************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * * or more contributor license agreements. See the NOTICE file * * distributed with this work for additional information * * regarding copyright ownership. The ASF licenses this file * * to you under the Apache License, Version 2.0 (the * * "License"); you may not use this file except in compliance * * with the License. You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, * * software distributed under the License is distributed on an * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * * KIND, either express or implied. See the License for the * * specific language governing permissions and limitations * * under the License. * ****************************************************************/ package org.apache.james.mailbox.cassandra.mail.utils; import static org.assertj.core.api.Assertions.assertThat; import java.util.UUID; import javax.mail.Flags; import org.apache.james.mailbox.MessageUid; import org.apache.james.mailbox.ModSeq; import org.apache.james.mailbox.cassandra.ids.CassandraId; import org.apache.james.mailbox.cassandra.ids.CassandraMessageId; import org.apache.james.mailbox.model.ComposedMessageId; import org.apache.james.mailbox.model.UpdatedFlags; import org.junit.jupiter.api.Test; import com.datastax.driver.core.utils.UUIDs; import com.google.common.collect.ImmutableList; import nl.jqno.equalsverifier.EqualsVerifier; class FlagsUpdateStageResultTest { private static final ComposedMessageId UID = new ComposedMessageId( CassandraId.of(UUID.fromString("464765a0-e4e7-11e4-aba4-710c1de3782b")), new CassandraMessageId.Factory().of(UUIDs.timeBased()), MessageUid.of(1L)); private static final ComposedMessageId OTHER_UID = new ComposedMessageId( CassandraId.of(UUID.fromString("464765a0-e4e7-11e4-aba4-710c1de3782b")), new CassandraMessageId.Factory().of(UUIDs.timeBased()), MessageUid.of(2L)); private static final UpdatedFlags UPDATED_FLAGS = UpdatedFlags.builder() .uid(UID.getUid()) .modSeq(ModSeq.of(18)) .oldFlags(new Flags()) .newFlags(new Flags(Flags.Flag.SEEN)) .build(); private static final UpdatedFlags OTHER_UPDATED_FLAGS = UpdatedFlags.builder() .uid(OTHER_UID.getUid()) .modSeq(ModSeq.of(18)) .oldFlags(new Flags()) .newFlags(new Flags(Flags.Flag.SEEN)) .build(); @Test void classShouldRespectBeanContract() { EqualsVerifier.forClass(FlagsUpdateStageResult.class); } @Test void noneShouldCreateResultWithoutSuccessOrFails() { assertThat(FlagsUpdateStageResult.none()) .isEqualTo(new FlagsUpdateStageResult(ImmutableList.of(), ImmutableList.of())); } @Test void failShouldCreateResultWithFailedUid() { assertThat(FlagsUpdateStageResult.fail(UID)) .isEqualTo(new FlagsUpdateStageResult(ImmutableList.of(UID), ImmutableList.of())); } @Test void successShouldCreateResultWithSucceededUpdatedFlags() { assertThat(FlagsUpdateStageResult.success(UPDATED_FLAGS)) .isEqualTo(new FlagsUpdateStageResult(ImmutableList.of(), ImmutableList.of(UPDATED_FLAGS))); } @Test void noneShouldBeWellMergedWithNone() { assertThat(FlagsUpdateStageResult.none().merge(FlagsUpdateStageResult.none())) .isEqualTo(FlagsUpdateStageResult.none()); } @Test void noneShouldBeWellMergedWithFail() { assertThat(FlagsUpdateStageResult.none().merge(FlagsUpdateStageResult.fail(UID))) .isEqualTo(FlagsUpdateStageResult.fail(UID)); } @Test void noneShouldBeWellMergedWithSuccess() { assertThat(FlagsUpdateStageResult.none().merge(FlagsUpdateStageResult.success(UPDATED_FLAGS))) .isEqualTo(FlagsUpdateStageResult.success(UPDATED_FLAGS)); } @Test void failShouldBeWellMergedWithFail() { assertThat(FlagsUpdateStageResult.fail(UID).merge(FlagsUpdateStageResult.fail(OTHER_UID))) .isEqualTo(new FlagsUpdateStageResult(ImmutableList.of(UID, OTHER_UID), ImmutableList.of())); } @Test void successShouldBeWellMergedWithFail() { assertThat(FlagsUpdateStageResult.success(UPDATED_FLAGS).merge(FlagsUpdateStageResult.fail(UID))) .isEqualTo(new FlagsUpdateStageResult(ImmutableList.of(UID), ImmutableList.of(UPDATED_FLAGS))); } @Test void successShouldBeWellMergedWithSuccess() { assertThat(FlagsUpdateStageResult.success(UPDATED_FLAGS).merge(FlagsUpdateStageResult.success(OTHER_UPDATED_FLAGS))) .isEqualTo(new FlagsUpdateStageResult(ImmutableList.of(), ImmutableList.of(UPDATED_FLAGS, OTHER_UPDATED_FLAGS))); } @Test void getFailedShouldReturnFailedUid() { FlagsUpdateStageResult flagsUpdateStageResult = new FlagsUpdateStageResult(ImmutableList.of(UID), ImmutableList.of(UPDATED_FLAGS)); assertThat(flagsUpdateStageResult.getFailed()) .containsExactly(UID); } @Test void getSucceededShouldReturnSucceedUpdatedFlags() { FlagsUpdateStageResult flagsUpdateStageResult = new FlagsUpdateStageResult(ImmutableList.of(UID), ImmutableList.of(UPDATED_FLAGS)); assertThat(flagsUpdateStageResult.getSucceeded()) .containsExactly(UPDATED_FLAGS); } @Test void keepSuccessShouldDiscardFailedUids() { FlagsUpdateStageResult flagsUpdateStageResult = new FlagsUpdateStageResult(ImmutableList.of(UID), ImmutableList.of(UPDATED_FLAGS)); assertThat(flagsUpdateStageResult.keepSucceded()) .isEqualTo(FlagsUpdateStageResult.success(UPDATED_FLAGS)); } @Test void containsFailedResultsShouldReturnTrueWhenFailed() { assertThat(FlagsUpdateStageResult.fail(UID).containsFailedResults()) .isTrue(); } @Test void containsFailedResultsShouldReturnFalseWhenSucceeded() { assertThat(FlagsUpdateStageResult.success(UPDATED_FLAGS).containsFailedResults()) .isFalse(); } }
923a9ad18784b6f1cea0a595c0a084a44549525a
383
java
Java
sti-websearch/src/uk/ac/shef/dcs/websearch/WebSearchException.java
odalic/sti
580785a88ea9789d87f003eecf818bed93cf4bf4
[ "Apache-2.0" ]
4
2017-05-28T11:38:50.000Z
2018-06-02T08:43:59.000Z
sti-websearch/src/uk/ac/shef/dcs/websearch/WebSearchException.java
odalic/sti
580785a88ea9789d87f003eecf818bed93cf4bf4
[ "Apache-2.0" ]
395
2016-05-18T11:04:51.000Z
2018-02-19T08:42:56.000Z
sti-websearch/src/uk/ac/shef/dcs/websearch/WebSearchException.java
odalic/sti
580785a88ea9789d87f003eecf818bed93cf4bf4
[ "Apache-2.0" ]
null
null
null
19.15
68
0.723238
999,278
package uk.ac.shef.dcs.websearch; /** * An exception that happened during web search or its commencement. * * @author Ziqi Zhang */ public class WebSearchException extends Exception { private static final long serialVersionUID = 3542024823438925198L; public WebSearchException(Exception e) { super(e); } public WebSearchException(String e) { super(e); } }
923a9b04413e45d0b61686d4bae14531efff3230
2,222
java
Java
src/java/net/elodina/mesos/test/TestExecutorDriver.java
elodina/java-mesos-util
dc3dbcd228d2000ececa1fc21825a9ee0c2e0e3d
[ "Apache-2.0" ]
2
2016-05-26T16:26:03.000Z
2016-11-24T16:48:09.000Z
src/java/net/elodina/mesos/test/TestExecutorDriver.java
elodina/java-mesos-util
dc3dbcd228d2000ececa1fc21825a9ee0c2e0e3d
[ "Apache-2.0" ]
1
2016-08-04T00:10:00.000Z
2016-08-04T00:10:00.000Z
src/java/net/elodina/mesos/test/TestExecutorDriver.java
elodina/java-mesos-util
dc3dbcd228d2000ececa1fc21825a9ee0c2e0e3d
[ "Apache-2.0" ]
5
2016-06-07T08:58:21.000Z
2019-02-18T16:37:35.000Z
31.295775
108
0.69712
999,279
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.elodina.mesos.test; import org.apache.mesos.ExecutorDriver; import org.apache.mesos.Protos; import java.util.ArrayList; import java.util.List; public class TestExecutorDriver implements ExecutorDriver { public Protos.Status status = Protos.Status.DRIVER_RUNNING; public final List<Protos.TaskStatus> statusUpdates = new ArrayList<>(); public Protos.Status start() { status = Protos.Status.DRIVER_RUNNING; return status; } public Protos.Status stop() { status = Protos.Status.DRIVER_STOPPED; return status; } public Protos.Status abort() { status = Protos.Status.DRIVER_ABORTED; return status; } public Protos.Status join() { return status; } public Protos.Status run() { status = Protos.Status.DRIVER_RUNNING; return status; } public Protos.Status sendStatusUpdate(Protos.TaskStatus status) { synchronized (statusUpdates) { statusUpdates.add(status); statusUpdates.notify(); } return this.status; } public void waitForStatusUpdates(int count) throws InterruptedException { synchronized (statusUpdates) { while (statusUpdates.size() < count) statusUpdates.wait(); } } public Protos.Status sendFrameworkMessage(byte[] message) { throw new UnsupportedOperationException(); } }
923a9b1b470d44ca3ab0a54f7340db59ecf759f5
1,394
java
Java
src/main/java/dev/logal/logalbot/audio/AudioPlayerSendHandler.java
LogalDeveloper/LogalBot
365462609b678e2b214841576b01a2d916540479
[ "Apache-2.0" ]
2
2019-01-22T23:31:12.000Z
2019-03-03T03:50:45.000Z
src/main/java/dev/logal/logalbot/audio/AudioPlayerSendHandler.java
LogalDeveloper/LogalBot
365462609b678e2b214841576b01a2d916540479
[ "Apache-2.0" ]
2
2018-11-01T20:55:28.000Z
2019-03-08T21:33:14.000Z
src/main/java/dev/logal/logalbot/audio/AudioPlayerSendHandler.java
LogalDeveloper/LogalBot
365462609b678e2b214841576b01a2d916540479
[ "Apache-2.0" ]
5
2018-09-15T18:44:31.000Z
2019-03-05T21:19:05.000Z
29.041667
75
0.772597
999,280
package dev.logal.logalbot.audio; // Copyright 2019 Logan Fick // 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 // https://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. import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame; import net.dv8tion.jda.core.audio.AudioSendHandler; import net.dv8tion.jda.core.utils.Checks; public final class AudioPlayerSendHandler implements AudioSendHandler { private final AudioPlayer audioPlayer; private AudioFrame lastFrame; public AudioPlayerSendHandler(final AudioPlayer audioPlayer) { Checks.notNull(audioPlayer, "Audio Player"); this.audioPlayer = audioPlayer; } @Override public final boolean canProvide() { lastFrame = audioPlayer.provide(); return lastFrame != null; } @Override public final byte[] provide20MsAudio() { return lastFrame.getData(); } @Override public final boolean isOpus() { return true; } }
923a9c1c90850e3b64602cc95d4e3b39d836d592
642
java
Java
src/main/java/com/haniokasai/mc/TinyMistress/web/handlers/info/status_handler.java
haniokasai/TinyMistress
ae8c26ea0b0231b9329e9f646240da9645b3a406
[ "MIT" ]
3
2017-03-27T11:34:43.000Z
2021-07-03T11:11:01.000Z
src/main/java/com/haniokasai/mc/TinyMistress/web/handlers/info/status_handler.java
haniokasai/TinyMistress
ae8c26ea0b0231b9329e9f646240da9645b3a406
[ "MIT" ]
1
2017-07-16T14:42:17.000Z
2017-07-16T14:53:50.000Z
src/main/java/com/haniokasai/mc/TinyMistress/web/handlers/info/status_handler.java
haniokasai/TinyMistress
ae8c26ea0b0231b9329e9f646240da9645b3a406
[ "MIT" ]
1
2018-01-25T17:54:50.000Z
2018-01-25T17:54:50.000Z
32.1
108
0.753894
999,281
package com.haniokasai.mc.TinyMistress.web.handlers.info; import com.haniokasai.mc.TinyMistress.Main; import org.eclipse.jetty.server.Request; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by hani on 2017/03/22. */ public class status_handler { public static void status_handler(Request baseRequest, HttpServletResponse response)throws IOException { response.setContentType("text/html;charset=utf-8"); response.setStatus(HttpServletResponse.SC_OK); baseRequest.setHandled(true); response.getWriter().println(Main.servers.get("a").process.isAlive()); } }
923a9ca924d24b0e8452a115c1e3e9d0f150e7f3
1,277
java
Java
java/com/google/gerrit/server/query/change/OwnerPredicate.java
sdi1212/gerrit
b5120a01af81b751581466316bc2a47419acee1e
[ "Apache-2.0" ]
3
2019-12-16T01:02:46.000Z
2019-12-22T14:52:26.000Z
java/com/google/gerrit/server/query/change/OwnerPredicate.java
sdi1212/gerrit
b5120a01af81b751581466316bc2a47419acee1e
[ "Apache-2.0" ]
17
2021-03-02T01:00:56.000Z
2022-03-08T23:13:21.000Z
java/com/google/gerrit/server/query/change/OwnerPredicate.java
sitedata/gerrit
ec10c70ab452f8c2aa22a96053f46058fd2d10ec
[ "Apache-2.0" ]
2
2020-04-01T03:02:31.000Z
2020-07-20T16:34:14.000Z
29.022727
75
0.732968
999,282
// Copyright (C) 2010 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.gerrit.server.query.change; import com.google.gerrit.entities.Account; import com.google.gerrit.entities.Change; import com.google.gerrit.server.index.change.ChangeField; public class OwnerPredicate extends ChangeIndexPredicate { protected final Account.Id id; public OwnerPredicate(Account.Id id) { super(ChangeField.OWNER, id.toString()); this.id = id; } protected Account.Id getAccountId() { return id; } @Override public boolean match(ChangeData object) { Change change = object.change(); return change != null && id.equals(change.getOwner()); } @Override public int getCost() { return 1; } }
923a9d441ac4014f2b0859d19c15053df55ca583
1,914
java
Java
trunk/adhoc-solr/src/main/java/org/apache/lucene/analysis/ru/RussianLowerCaseFilter.java
yblucky/mdrill
8621180ac977e670a8e50a16053d4fce2b1c6a3e
[ "ICU", "Apache-2.0" ]
1,104
2015-01-01T07:45:27.000Z
2022-03-31T04:09:24.000Z
trunk/adhoc-solr/src/main/java/org/apache/lucene/analysis/ru/RussianLowerCaseFilter.java
jwpttcg66/mdrill
3acf33cfa72527fc1d949e933cc87fba340f2524
[ "ICU", "Apache-2.0" ]
7
2015-05-04T10:29:01.000Z
2019-01-07T05:38:55.000Z
trunk/adhoc-solr/src/main/java/org/apache/lucene/analysis/ru/RussianLowerCaseFilter.java
jwpttcg66/mdrill
3acf33cfa72527fc1d949e933cc87fba340f2524
[ "ICU", "Apache-2.0" ]
579
2015-01-04T06:40:10.000Z
2022-03-28T11:53:15.000Z
33
78
0.713166
999,283
package org.apache.lucene.analysis.ru; /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.IOException; import org.apache.lucene.analysis.LowerCaseFilter; // for javadoc import org.apache.lucene.analysis.TokenFilter; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; /** * Normalizes token text to lower case. * @deprecated Use {@link LowerCaseFilter} instead, which has the same * functionality. This filter will be removed in Lucene 4.0 */ @Deprecated public final class RussianLowerCaseFilter extends TokenFilter { private CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); public RussianLowerCaseFilter(TokenStream in) { super(in); } @Override public final boolean incrementToken() throws IOException { if (input.incrementToken()) { char[] chArray = termAtt.buffer(); int chLen = termAtt.length(); for (int i = 0; i < chLen; i++) { chArray[i] = Character.toLowerCase(chArray[i]); } return true; } else { return false; } } }
923a9efd3d2e5a40a6e5e87a68f86efd670b2727
6,125
java
Java
src/main/java/com/ureport/ureportkeep/console/pdf/ExportPdfController.java
taogus/ureport-keep
815176b664ec88342b6388b252f65400fe99f0a1
[ "Apache-2.0" ]
3
2022-03-14T07:11:41.000Z
2022-03-31T13:22:33.000Z
src/main/java/com/ureport/ureportkeep/console/pdf/ExportPdfController.java
taogus/ureport-keep
815176b664ec88342b6388b252f65400fe99f0a1
[ "Apache-2.0" ]
1
2022-03-31T12:45:04.000Z
2022-03-31T12:45:04.000Z
src/main/java/com/ureport/ureportkeep/console/pdf/ExportPdfController.java
taogus/ureport-keep
815176b664ec88342b6388b252f65400fe99f0a1
[ "Apache-2.0" ]
1
2022-03-31T13:22:35.000Z
2022-03-31T13:22:35.000Z
35.818713
109
0.750367
999,284
/******************************************************************************* * Copyright 2017 Bstek * * 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.ureport.ureportkeep.console.pdf; import com.fasterxml.jackson.databind.ObjectMapper; import com.ureport.ureportkeep.console.AbstractReportBasicController; import com.ureport.ureportkeep.console.cache.TempObjectCache; import com.ureport.ureportkeep.console.exception.ReportDesignException; import com.ureport.ureportkeep.core.build.ReportBuilder; import com.ureport.ureportkeep.core.definition.Paper; import com.ureport.ureportkeep.core.definition.ReportDefinition; import com.ureport.ureportkeep.core.exception.ReportComputeException; import com.ureport.ureportkeep.core.exception.ReportException; import com.ureport.ureportkeep.core.export.ExportConfigure; import com.ureport.ureportkeep.core.export.ExportConfigureImpl; import com.ureport.ureportkeep.core.export.ExportManager; import com.ureport.ureportkeep.core.export.ReportRender; import com.ureport.ureportkeep.core.export.pdf.PdfProducer; import com.ureport.ureportkeep.core.model.Report; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import java.io.IOException; import java.io.OutputStream; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @author summer * @Date: 2022/1/14 * Description: pdf控制器 */ @Controller @RequestMapping(value = "/pdf") public class ExportPdfController extends AbstractReportBasicController { @Autowired private ReportBuilder reportBuilder; @Autowired private ExportManager exportManager; @Autowired private ReportRender reportRender; private PdfProducer pdfProducer=new PdfProducer(); /** * 导出pdf * * @param req * @param resp * @throws ServletException * @throws IOException */ @RequestMapping(value = "", method = RequestMethod.GET) public void export(HttpServletRequest req, HttpServletResponse resp) { try { buildPdf(req, resp,false); } catch (IOException e) { e.printStackTrace(); } } /** * 在线预览pdf * * @param req * @param resp * @throws ServletException * @throws IOException */ @RequestMapping(value = "/show", method = RequestMethod.GET) public void show(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { buildPdf(req, resp,true); } public void buildPdf(HttpServletRequest req, HttpServletResponse resp,boolean forPrint) throws IOException { String file=req.getParameter("_u"); file=decode(file); if(StringUtils.isBlank(file)){ throw new ReportComputeException("Report file can not be null."); } OutputStream outputStream=null; try { String fileName=req.getParameter("_n"); fileName=buildDownloadFileName(file, fileName, ".pdf"); fileName=new String(fileName.getBytes("UTF-8"),"ISO8859-1"); if(forPrint){ resp.setContentType("application/pdf"); resp.setHeader("Content-Disposition","inline;filename=\"" + fileName + "\""); }else{ resp.setContentType("application/octet-stream;charset=ISO8859-1"); resp.setHeader("Content-Disposition","attachment;filename=\"" + fileName + "\""); } outputStream=resp.getOutputStream(); Map<String, Object> parameters = buildParameters(req); if(file.equals(PREVIEW_KEY)){ ReportDefinition reportDefinition=(ReportDefinition) TempObjectCache.getObject(PREVIEW_KEY); if(reportDefinition==null){ throw new ReportDesignException("Report data has expired,can not do export pdf."); } Report report=reportBuilder.buildReport(reportDefinition, parameters); pdfProducer.produce(report, outputStream); }else{ ExportConfigure configure=new ExportConfigureImpl(file,parameters,outputStream); exportManager.exportPdf(configure); } }catch(Exception ex) { throw new ReportException(ex); }finally { outputStream.flush(); outputStream.close(); } } @RequestMapping(value = "/newPaging", method = RequestMethod.POST) public void newPaging(HttpServletRequest req, HttpServletResponse resp) throws IOException { String file=req.getParameter("_u"); if(StringUtils.isBlank(file)){ throw new ReportComputeException("Report file can not be null."); } Report report=null; Map<String, Object> parameters = buildParameters(req); if(file.equals(PREVIEW_KEY)){ ReportDefinition reportDefinition=(ReportDefinition)TempObjectCache.getObject(PREVIEW_KEY); if(reportDefinition==null){ throw new ReportDesignException("Report data has expired,can not do export pdf."); } report=reportBuilder.buildReport(reportDefinition, parameters); }else{ ReportDefinition reportDefinition=reportRender.getReportDefinition(file); report=reportRender.render(reportDefinition, parameters); } String paper=req.getParameter("_paper"); ObjectMapper mapper=new ObjectMapper(); Paper newPaper=mapper.readValue(paper, Paper.class); report.rePaging(newPaper); } public void setReportRender(ReportRender reportRender) { this.reportRender = reportRender; } public void setExportManager(ExportManager exportManager) { this.exportManager = exportManager; } public void setReportBuilder(ReportBuilder reportBuilder) { this.reportBuilder = reportBuilder; } }
923a9f69537f721981484899baf5d561f36151b0
2,093
java
Java
src/test/java/com/hedera/sdk/node/HederaNodeTest.java
Sajjon/hedera-sdk-java
f968e5a61ec7383aecb3426d52893be001f43bd3
[ "Apache-2.0" ]
null
null
null
src/test/java/com/hedera/sdk/node/HederaNodeTest.java
Sajjon/hedera-sdk-java
f968e5a61ec7383aecb3426d52893be001f43bd3
[ "Apache-2.0" ]
null
null
null
src/test/java/com/hedera/sdk/node/HederaNodeTest.java
Sajjon/hedera-sdk-java
f968e5a61ec7383aecb3426d52893be001f43bd3
[ "Apache-2.0" ]
1
2020-01-10T22:33:27.000Z
2020-01-10T22:33:27.000Z
36.086207
60
0.791687
999,285
package com.hedera.sdk.node; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import com.hedera.sdk.common.HederaAccountID; class HederaNodeTest { @Test @DisplayName("HederaNodeTest") void test() { HederaNode node = new HederaNode(); assertEquals(10, node.accountCreateTransactionFee); assertEquals(10, node.accountTransferTransactionFee); assertEquals(10, node.accountUpdateTransactionFee); assertEquals(10, node.accountDeleteTransactionFee); assertEquals(10, node.accountAddClaimTransactionFee); assertEquals(10, node.accountDeleteClaimTransactionFee); assertEquals(10, node.accountBalanceQueryFee); assertEquals(10, node.accountInfoQueryFee); assertEquals(10, node.accountGetRecordsQueryFee); assertEquals(10, node.fileCreateTransactionFee); assertEquals(10, node.fileDeleteTransactionFee); assertEquals(10, node.fileUpdateTransactionFee); assertEquals(10, node.fileAppendTransactionFee); assertEquals(10, node.fileGetContentsQueryFee); assertEquals(10, node.fileGetInfoQueryFee); assertEquals(10, node.fileGetRecordsQueryFee); assertEquals(10, node.contractCreateTransactionFee); assertEquals(10, node.contractUpdateTransactionFee); assertEquals(10, node.contractGetByteCodeQueryFee); assertEquals(10, node.contractCallTransactionFee); assertEquals(10, node.contractGetInfoQueryFee); assertEquals(10, node.contractCallLocalQueryFee); assertEquals(10, node.contractGetBySolidityId); assertEquals(10, node.contractGetRecordsQueryFee); assertEquals("", node.getHost()); assertEquals(0, node.getPort()); HederaAccountID accountID = new HederaAccountID(1, 2, 3); node.setAccountID(accountID); assertEquals(1, node.getAccountID().shardNum); assertEquals(2, node.getAccountID().realmNum); assertEquals(3, node.getAccountID().accountNum); node.setAccountID(4, 5, 6); assertEquals(4, node.getAccountID().shardNum); assertEquals(5, node.getAccountID().realmNum); assertEquals(6, node.getAccountID().accountNum); } }
923aa11eab496da2b7dffccb48d39209f7d4d18e
1,674
java
Java
src/org/xmodel/xaction/DebuggerAction.java
bdunnagan/XModel
720b4ec18b069493cdbcc1b7dd7ec98a6379b795
[ "Apache-2.0" ]
null
null
null
src/org/xmodel/xaction/DebuggerAction.java
bdunnagan/XModel
720b4ec18b069493cdbcc1b7dd7ec98a6379b795
[ "Apache-2.0" ]
null
null
null
src/org/xmodel/xaction/DebuggerAction.java
bdunnagan/XModel
720b4ec18b069493cdbcc1b7dd7ec98a6379b795
[ "Apache-2.0" ]
1
2019-04-23T03:58:04.000Z
2019-04-23T03:58:04.000Z
31
90
0.674432
999,286
package org.xmodel.xaction; import org.xmodel.xaction.debug.Debugger; import org.xmodel.xpath.expression.IContext; import org.xmodel.xpath.expression.IExpression; /** * An XAction that performs debugging operations. */ public class DebuggerAction extends GuardedAction { /* (non-Javadoc) * @see org.xmodel.xaction.GuardedAction#configure(org.xmodel.xaction.XActionDocument) */ @Override public void configure( XActionDocument document) { super.configure( document); var = Conventions.getVarName( document.getRoot(), true); threadExpr = document.getExpression( "thread", true); opExpr = document.getExpression( "op", true); if ( opExpr == null) opExpr = document.getExpression(); } /* (non-Javadoc) * @see org.xmodel.xaction.GuardedAction#doAction(org.xmodel.xpath.expression.IContext) */ @Override protected Object[] doAction( IContext context) { Debugger debugger = XAction.getDebugger(); String thread = (threadExpr != null)? threadExpr.evaluateString( context): null; String op = opExpr.evaluateString( context); switch( Debugger.Operation.valueOf( op)) { case stepOver: debugger.stepOver( thread); break; case stepIn: debugger.stepIn( thread); break; case stepOut: debugger.stepOut( thread); break; case resume: debugger.resume( thread); break; case pause: debugger.pause( thread); break; case sync: break; } context.getScope().set( var, debugger.getStack()); return null; } private String var; private IExpression threadExpr; private IExpression opExpr; }
923aa1a7ce0417ef3f59b86045a59365775a5ce6
2,420
java
Java
src/main/java/com/epam/digital/data/platform/starter/logger/LogbookInfoLoggingAutoConfiguration.java
epam/edp-ddm-starter-logger
29c8c1845471a1b0b4b1e34c85d49c38030a4013
[ "Apache-2.0" ]
null
null
null
src/main/java/com/epam/digital/data/platform/starter/logger/LogbookInfoLoggingAutoConfiguration.java
epam/edp-ddm-starter-logger
29c8c1845471a1b0b4b1e34c85d49c38030a4013
[ "Apache-2.0" ]
null
null
null
src/main/java/com/epam/digital/data/platform/starter/logger/LogbookInfoLoggingAutoConfiguration.java
epam/edp-ddm-starter-logger
29c8c1845471a1b0b4b1e34c85d49c38030a4013
[ "Apache-2.0" ]
null
null
null
36.666667
118
0.77562
999,287
/* * Copyright 2021 EPAM Systems. * * 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 * * https://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.epam.digital.data.platform.starter.logger; import com.epam.digital.data.platform.starter.logger.feign.LogbookFeignClient; import com.epam.digital.data.platform.starter.logger.logbook.InfoHttpLogWriter; import com.epam.digital.data.platform.starter.logger.logbook.RequestBodyOnDebugStrategy; import com.epam.digital.data.platform.starter.logger.logbook.WithoutBodyStrategyImpl; import feign.Client; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.zalando.logbook.DefaultHttpLogFormatter; import org.zalando.logbook.HttpLogFormatter; import org.zalando.logbook.HttpLogWriter; import org.zalando.logbook.Logbook; import org.zalando.logbook.Strategy; @Configuration public class LogbookInfoLoggingAutoConfiguration { @Bean @ConditionalOnProperty(prefix = "logbook.info-logging", name = "enabled") public HttpLogWriter httpLogWriter() { return new InfoHttpLogWriter(); } @Bean @ConditionalOnProperty(prefix = "logbook", name = "strategy", havingValue = "request-body-on-debug") public Strategy strategy() { return new RequestBodyOnDebugStrategy(); } @Bean @ConditionalOnProperty(prefix = "logbook", name = "strategy", havingValue = "without-body") public Strategy withoutBodyStrategy() { return new WithoutBodyStrategyImpl(); } @Bean @ConditionalOnProperty(prefix = "logbook", name = "http-log-writer", havingValue = "default", matchIfMissing = true) public HttpLogFormatter httpLogFormatter() { return new DefaultHttpLogFormatter(); } @Bean @ConditionalOnProperty(prefix = "logbook.feign", name = "enabled") public Client client(Logbook logbook) { return new LogbookFeignClient(logbook); } }
923aa286fd56b212683f9a3761de509dab7818ed
594
java
Java
SnackBar/src/SnackBar/ShittyCustomer.java
OmarSalah95/java-SnackBar
9b500d528dbc565b0081591d6d874406b2b1e9ed
[ "MIT" ]
null
null
null
SnackBar/src/SnackBar/ShittyCustomer.java
OmarSalah95/java-SnackBar
9b500d528dbc565b0081591d6d874406b2b1e9ed
[ "MIT" ]
null
null
null
SnackBar/src/SnackBar/ShittyCustomer.java
OmarSalah95/java-SnackBar
9b500d528dbc565b0081591d6d874406b2b1e9ed
[ "MIT" ]
null
null
null
17.470588
56
0.700337
999,288
package SnackBar; public class ShittyCustomer { private static int maxId = 0; private int id; private String name; private double cashOnHand; public ShittyCustomer(String name, double cashOnHand) { maxId++; id = maxId; this.name = name; this.cashOnHand = cashOnHand; } // getters public int getId() { return id; } public String getName() { return name; } public double getCashOnHand() { return cashOnHand; } // setters public void setName(String name) { this.name = name; } public void setCashOnHand(double cashOnHand) { this.cashOnHand = cashOnHand; } }
923aa4205d0c3389991b111c91d2d9517737eb57
1,874
java
Java
nitrite/src/main/java/org/dizitart/no2/migration/commands/Rename.java
autoserve1/nitrite-java
a1901d5734774e864c7c87973d805fd431ceeb43
[ "Apache-2.0" ]
483
2017-04-21T09:48:03.000Z
2020-06-14T19:59:27.000Z
nitrite/src/main/java/org/dizitart/no2/migration/commands/Rename.java
autoserve1/nitrite-java
a1901d5734774e864c7c87973d805fd431ceeb43
[ "Apache-2.0" ]
239
2020-06-21T19:03:28.000Z
2022-03-30T10:23:22.000Z
nitrite/src/main/java/org/dizitart/no2/migration/commands/Rename.java
autoserve1/nitrite-java
a1901d5734774e864c7c87973d805fd431ceeb43
[ "Apache-2.0" ]
77
2017-04-20T04:09:19.000Z
2020-06-07T16:25:49.000Z
36.038462
112
0.696905
999,289
package org.dizitart.no2.migration.commands; import lombok.AllArgsConstructor; import org.dizitart.no2.Nitrite; import org.dizitart.no2.collection.Document; import org.dizitart.no2.collection.NitriteId; import org.dizitart.no2.collection.operation.CollectionOperations; import org.dizitart.no2.collection.operation.IndexManager; import org.dizitart.no2.common.Fields; import org.dizitart.no2.common.tuples.Pair; import org.dizitart.no2.index.IndexDescriptor; import org.dizitart.no2.store.NitriteMap; import java.util.Collection; /** * A command to rename a {@link org.dizitart.no2.collection.NitriteCollection}. * * @author Anindya Chatterjee * @since 4.0 */ @AllArgsConstructor public class Rename extends BaseCommand implements Command { private final String oldName; private final String newName; @Override public void execute(Nitrite nitrite) { initialize(nitrite, oldName); NitriteMap<NitriteId, Document> newMap = nitriteStore.openMap(newName, NitriteId.class, Document.class); try(CollectionOperations newOperations = new CollectionOperations(newName, newMap, nitrite.getConfig(), null)) { for (Pair<NitriteId, Document> entry : nitriteMap.entries()) { newMap.put(entry.getFirst(), entry.getSecond()); } try (IndexManager indexManager = new IndexManager(oldName, nitrite.getConfig())) { Collection<IndexDescriptor> indexEntries = indexManager.getIndexDescriptors(); for (IndexDescriptor indexDescriptor : indexEntries) { Fields field = indexDescriptor.getIndexFields(); String indexType = indexDescriptor.getIndexType(); newOperations.createIndex(field, indexType); } } } operations.dropCollection(); } }
923aa45c09e3eed24cbf270978a05b25d242c185
4,838
java
Java
subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskInputs.java
ALD110/gradle
d9adf33a57925582988fc512002dcc0e8ce4db95
[ "Apache-2.0" ]
2
2015-12-10T21:06:45.000Z
2016-08-04T19:35:30.000Z
subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskInputs.java
ALD110/gradle
d9adf33a57925582988fc512002dcc0e8ce4db95
[ "Apache-2.0" ]
null
null
null
subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskInputs.java
ALD110/gradle
d9adf33a57925582988fc512002dcc0e8ce4db95
[ "Apache-2.0" ]
null
null
null
39.016129
147
0.688508
999,290
/* * Copyright 2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gradle.api.tasks; import org.gradle.api.file.FileCollection; import org.gradle.internal.HasInternalProtocol; import javax.annotation.Nullable; import java.util.Map; /** * <p>A {@code TaskInputs} represents the inputs for a task.</p> * * <p>You can obtain a {@code TaskInputs} instance using {@link org.gradle.api.Task#getInputs()}.</p> */ @HasInternalProtocol public interface TaskInputs { /** * Returns true if this task has declared the inputs that it consumes. * * @return true if this task has declared any inputs. */ boolean getHasInputs(); /** * Returns the input files of this task. * * @return The input files. Returns an empty collection if this task has no input files. */ FileCollection getFiles(); /** * Registers some input files for this task. * * @param paths The input files. The given paths are evaluated as per {@link org.gradle.api.Project#files(Object...)}. * @return a property builder to further configure the property. */ TaskInputFilePropertyBuilder files(Object... paths); /** * Registers some input file for this task. * * @param path The input file. The given path is evaluated as per {@link org.gradle.api.Project#file(Object)}. * @return a property builder to further configure the property. */ TaskInputFilePropertyBuilder file(Object path); /** * Registers an input directory hierarchy. All files found under the given directory are treated as input files for * this task. * * <p>An input directory hierarchy ignores empty directories by default. See {@link TaskInputFilePropertyBuilder#ignoreEmptyDirectories()}.</p> * * @param dirPath The directory. The path is evaluated as per {@link org.gradle.api.Project#file(Object)}. * @return a property builder to further configure the property. */ TaskInputFilePropertyBuilder dir(Object dirPath); /** * Returns a map of input properties for this task. * * The returned map is unmodifiable, and does not reflect further changes to the task's properties. * Trying to modify the map will result in an {@link UnsupportedOperationException} being thrown. * * @return The properties. */ Map<String, Object> getProperties(); /** * <p>Registers an input property for this task. This value is persisted when the task executes, and is compared * against the property value for later invocations of the task, to determine if the task is up-to-date.</p> * * <p>The given value must be a simple value, like a String or Integer, or serializable. For complex values, * Gradle compares the serialized forms for detecting changes and the {@code equals()} method is ignored. * * <p>If the value is not known when registering the input, a {@link org.gradle.api.provider.Provider} can be * passed instead. Gradle will then resolve the provider at the latest possible time in order to determine the actual * property value.</p> * * @param name The name of the property. Must not be null. * @param value The value for the property. Can be null. */ TaskInputPropertyBuilder property(String name, @Nullable Object value); /** * Registers a set of input properties for this task. See {@link #property(String, Object)} for details. * * <p><strong>Note:</strong> do not use the return value to chain calls. * Instead always use call via {@link org.gradle.api.Task#getInputs()}.</p> * * @param properties The properties. */ TaskInputs properties(Map<String, ?> properties); /** * Returns true if this task has declared that it accepts source files. * * @return true if this task has source files, false if not. */ boolean getHasSourceFiles(); /** * Returns the set of source files for this task. These are the subset of input files which the task actually does work on. * A task is skipped if it has declared it accepts source files, and this collection is empty. * * @return The set of source files for this task. */ FileCollection getSourceFiles(); }
923aa467f480f0a4a2a938d8205440ff777b2e4a
1,824
java
Java
app/main/java/com/jingpu/android/apersistance/activeandroid/model/Category.java
AmberPoo1/EPPEBench
88755d485c42ac376ae4ddc9e862dcd60925efd0
[ "MIT" ]
null
null
null
app/main/java/com/jingpu/android/apersistance/activeandroid/model/Category.java
AmberPoo1/EPPEBench
88755d485c42ac376ae4ddc9e862dcd60925efd0
[ "MIT" ]
null
null
null
app/main/java/com/jingpu/android/apersistance/activeandroid/model/Category.java
AmberPoo1/EPPEBench
88755d485c42ac376ae4ddc9e862dcd60925efd0
[ "MIT" ]
null
null
null
22.8
61
0.614035
999,291
package com.jingpu.android.apersistance.activeandroid.model; import com.activeandroid.Model; import com.activeandroid.annotation.Column; import com.activeandroid.annotation.Table; /** * Created by Jing Pu on 2016/1/31. */ @Table(name = "CATEGORY") public class Category extends Model { // Labels: Table Column names public static final String COL_C_ID = "C_ID"; public static final String COL_C_TITLE = "C_TITLE"; public static final String COL_C_PAGES = "C_PAGES"; public static final String COL_C_SUBCATS = "C_SUBCATS"; public static final String COL_C_FILES = "C_FILES"; // Columns @Column(name="C_ID", unique = true) private long lCid; @Column(name="C_TITLE", notNull = true) private String strCTitle; @Column(name="C_PAGES", notNull = true) private int iCPages; @Column(name="C_SUBCATS", notNull = true) private int iCSubCats; @Column(name="C_FILES", notNull = true) private int iCFiles; public Category() { super(); } public long getLCid() { return lCid; } public void setLCid(long lCid) { this.lCid = lCid; } public String getStrCTitle() { return strCTitle; } public void setStrCTitle(String strCTitle) { this.strCTitle = strCTitle; } public int getiCPages() { return iCPages; } public void setiCPages(int iCPages) { this.iCPages = iCPages; } public int getiCSubCats() { return iCSubCats; } public void setiCSubCats(int iCSubCats) { this.iCSubCats = iCSubCats; } public int getiCFiles() { return iCFiles; } public void setiCFiles(int iCFiles) { this.iCFiles = iCFiles; } }
923aa4bd77fa9e3ca387d41cc56eaef4858c1a7d
3,388
java
Java
styled-xml-parser/src/main/java/com/itextpdf/styledxmlparser/jsoup/select/NodeVisitor.java
craftmaster2190/itext7
ae2e3922038023874a542b72749048c019b3106d
[ "RSA-MD" ]
1
2019-10-01T05:48:27.000Z
2019-10-01T05:48:27.000Z
styled-xml-parser/src/main/java/com/itextpdf/styledxmlparser/jsoup/select/NodeVisitor.java
craftmaster2190/itext7
ae2e3922038023874a542b72749048c019b3106d
[ "RSA-MD" ]
null
null
null
styled-xml-parser/src/main/java/com/itextpdf/styledxmlparser/jsoup/select/NodeVisitor.java
craftmaster2190/itext7
ae2e3922038023874a542b72749048c019b3106d
[ "RSA-MD" ]
null
null
null
46.424658
119
0.730009
999,292
/* This file is part of the iText (R) project. Copyright (c) 1998-2019 iText Group NV Authors: iText Software. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation with the addition of the following permission added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program; if not, see http://www.gnu.org/licenses or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, 02110-1301 USA, or download the license from the following URL: http://itextpdf.com/terms-of-use/ The interactive user interfaces in modified source and object code versions of this program must display Appropriate Legal Notices, as required under Section 5 of the GNU Affero General Public License. In accordance with Section 7(b) of the GNU Affero General Public License, a covered work must retain the producer line in every PDF that is created or manipulated using iText. You can be released from the requirements of the license by purchasing a commercial license. Buying such a license is mandatory as soon as you develop commercial activities involving the iText software without disclosing the source code of your own applications. These activities include: offering paid services to customers as an ASP, serving PDFs on the fly in a web application, shipping iText with a closed source product. For more information, please contact iText Software Corp. at this address: dycjh@example.com */ package com.itextpdf.styledxmlparser.jsoup.select; import com.itextpdf.styledxmlparser.jsoup.nodes.Node; /** * Node visitor interface. Provide an implementing class to {@link NodeTraversor} to iterate through nodes. * <p> * This interface provides two methods, {@code head} and {@code tail}. The head method is called when the node is first * seen, and the tail method when all of the node's children have been visited. As an example, head can be used to * create a start tag for a node, and tail to create the end tag. */ public interface NodeVisitor { /** * Callback for when a node is first visited. * * @param node the node being visited. * @param depth the depth of the node, relative to the root node. E.g., the root node has depth 0, and a child node * of that will have depth 1. */ void head(Node node, int depth); /** * Callback for when a node is last visited, after all of its descendants have been visited. * * @param node the node being visited. * @param depth the depth of the node, relative to the root node. E.g., the root node has depth 0, and a child node * of that will have depth 1. */ void tail(Node node, int depth); }
923aa6bda2b265407fb0eadd28b8a9ec85882902
832
java
Java
医院药品管理/src/main/java/me/zbl/app/service/ExpireNotifyService.java
xiaosongdeyx001/shujuku-----123
a0a009a732d74bf601f9d4ebccfb8d42c8a9b7d9
[ "Apache-2.0" ]
3
2019-06-18T16:12:33.000Z
2021-12-09T07:39:15.000Z
医院药品管理/src/main/java/me/zbl/app/service/ExpireNotifyService.java
xiaosongdeyx001/shujuku-----123
a0a009a732d74bf601f9d4ebccfb8d42c8a9b7d9
[ "Apache-2.0" ]
12
2020-11-16T20:38:06.000Z
2022-03-31T20:10:58.000Z
医院药品管理/src/main/java/me/zbl/app/service/ExpireNotifyService.java
xiaosongdeyx001/shujuku-----123
a0a009a732d74bf601f9d4ebccfb8d42c8a9b7d9
[ "Apache-2.0" ]
1
2019-06-21T07:44:03.000Z
2019-06-21T07:44:03.000Z
25.212121
75
0.715144
999,293
/* * Copyright 2018 JamesZBL * * 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 me.zbl.app.service; /** * 药品过期提醒业务接口 * * @author JamesZBL * @email upchh@example.com * @date 2018-05-12 */ public interface ExpireNotifyService { /** * 向仓库管理员角色的用户发送药品过期提醒 */ void notifyDrugsExpiredToday(); }
923aa6cd8818704b5336b39f3e33504f5e00952d
600
java
Java
src/main/java/it/andbin/temperatureconverter/common/exception/AmbiguousTemperatureSpecException.java
andbin/quarkus-restful-temperature-converter
c07bb61361cef8e3c512ea975ca87417c3217464
[ "MIT" ]
null
null
null
src/main/java/it/andbin/temperatureconverter/common/exception/AmbiguousTemperatureSpecException.java
andbin/quarkus-restful-temperature-converter
c07bb61361cef8e3c512ea975ca87417c3217464
[ "MIT" ]
null
null
null
src/main/java/it/andbin/temperatureconverter/common/exception/AmbiguousTemperatureSpecException.java
andbin/quarkus-restful-temperature-converter
c07bb61361cef8e3c512ea975ca87417c3217464
[ "MIT" ]
null
null
null
33.333333
77
0.756667
999,294
/* * Copyright (C) 2021 Andrea Binello ("andbin") * * This file is part of the "Quarkus RESTful Temperature Converter" project * and is released under the MIT License. See one of the license files * included in the root of the project for the full text of the license. */ package it.andbin.temperatureconverter.common.exception; public class AmbiguousTemperatureSpecException extends TemperatureException { private static final long serialVersionUID = 1L; public AmbiguousTemperatureSpecException(String spec) { super("Ambiguous temperature specification: " + spec); } }
923aa7c6dd302feae432ab749db1a61c51b702e5
2,864
java
Java
Take-Home/src/test/java/gmail/pitias4work/com/DynamicControls.java
PitiasFessahaie/take-home-webdriver-test
6e232a74a7936a8a24a5271f814366cf8f9cb9a7
[ "MIT" ]
1
2020-09-19T15:36:41.000Z
2020-09-19T15:36:41.000Z
Take-Home/src/test/java/gmail/pitias4work/com/DynamicControls.java
PitiasFessahaie/take-home-webdriver-test
6e232a74a7936a8a24a5271f814366cf8f9cb9a7
[ "MIT" ]
null
null
null
Take-Home/src/test/java/gmail/pitias4work/com/DynamicControls.java
PitiasFessahaie/take-home-webdriver-test
6e232a74a7936a8a24a5271f814366cf8f9cb9a7
[ "MIT" ]
null
null
null
38.702703
94
0.761872
999,295
package gmail.pitias4work.com; import static org.testng.Assert.assertEquals; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.Assert; import org.testng.annotations.Test; import com.aventstack.extentreports.Status; import com.library.pitias.Base; public class DynamicControls extends Base { Logger logger = Logger.getLogger(Base.class); public void dynamic_Control() { driver.get(prop.readProperties("dynamicControl_url")); logger.info("Title is :" + driver.getTitle()); assertEquals(driver.getTitle(), "The Internet"); WebElement rmBtn = driver.findElement(By.xpath(prop.readProperties("removebtn"))); rmBtn.click(); WebElement checkBox = driver.findElement(By.xpath(prop.readProperties("checkbox"))); Assert.assertEquals(true, checkBox.isDisplayed()); test.log(Status.INFO, "checkBox.isDisplayed !!"); WebElement chkBoxMsg = driver.findElement(By.xpath(prop.readProperties("chkBoxmessage"))); lib.explicitWait(chkBoxMsg); String expectedDisappearsMessage = "It's gone!"; lib.waitForStaleElement(chkBoxMsg); Assert.assertEquals(expectedDisappearsMessage, chkBoxMsg.getText()); test.log(Status.INFO, "It's gone! Assertion Success!!"); rmBtn.click(); WebElement checkBox2 = driver.findElement(By.xpath(prop.readProperties("checkbox"))); lib.explicitWait(checkBox2); //lib.waitForStaleElement(checkBox2); Assert.assertEquals(true, checkBox2.isDisplayed()); test.log(Status.INFO, "checkBox2 isDisplayed Assert Success!!"); String expectedAppearsMessage = "It's back!"; WebElement chkBoxMsg2 = driver.findElement(By.xpath(prop.readProperties("chkBoxmessage"))); lib.waitForStaleElement(chkBoxMsg2); Assert.assertEquals(expectedAppearsMessage, chkBoxMsg2.getText()); test.log(Status.INFO, "It's Back! Assert Success!!"); WebElement textWindow = driver.findElement(By.xpath(prop.readProperties("textwindow"))); Assert.assertTrue(!textWindow.isEnabled()); test.log(Status.INFO, "Text Window OFF Assert Success!!"); WebElement enableButton = driver.findElement(By.xpath(prop.readProperties("enablebutton"))); enableButton.click(); WebElement enableMessage = driver.findElement(By.xpath(prop.readProperties("enablemsg"))); lib.explicitWait(enableMessage); String expMessageEnabl = "It's enabled!"; Assert.assertEquals(expMessageEnabl, enableMessage.getText()); test.log(Status.INFO, "It's enabled! Assert Success!!"); enableButton.click(); WebElement enableMessage2 = driver.findElement(By.xpath(prop.readProperties("enablemsg"))); lib.explicitWait(enableMessage2); //lib.waitForStaleElement(enableMessage); String expMessageDisabled = "It's disabled!"; Assert.assertEquals(expMessageDisabled, enableMessage2.getText()); test.log(Status.INFO, "It's disabled! Assert Success!!"); } }
923aaa3b791723908d7d3fd8bea10e519ce8d607
11,681
java
Java
src/main/java/com/gupao/bigdata/yarn/examples/MyClient.java
VirgilLone/bigdata_yarn_example
8b553df57443e7194cbe2ffa49d41f55f9cfb93c
[ "BSD-3-Clause" ]
null
null
null
src/main/java/com/gupao/bigdata/yarn/examples/MyClient.java
VirgilLone/bigdata_yarn_example
8b553df57443e7194cbe2ffa49d41f55f9cfb93c
[ "BSD-3-Clause" ]
null
null
null
src/main/java/com/gupao/bigdata/yarn/examples/MyClient.java
VirgilLone/bigdata_yarn_example
8b553df57443e7194cbe2ffa49d41f55f9cfb93c
[ "BSD-3-Clause" ]
null
null
null
38.173203
110
0.63813
999,296
package com.gupao.bigdata.yarn.examples; import org.apache.commons.cli.*; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.ClassUtil; import org.apache.hadoop.yarn.api.ApplicationConstants; import org.apache.hadoop.yarn.api.ApplicationConstants.Environment; import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.client.api.YarnClient; import org.apache.hadoop.yarn.client.api.YarnClientApplication; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.util.ConverterUtils; import org.apache.hadoop.yarn.util.Records; import java.io.IOException; import java.util.*; public class MyClient { private static final Log LOG = LogFactory.getLog(MyClient.class); // 配置文件 private Configuration conf; private YarnClient yarnClient; // 作业名 private String appName = "HelloYarn"; // AppMaster优先级 private int amPriority = 0; // AppMaster使用的队列 private String amQueue = "default"; // AppMaster需要使用的内存 private long amMemory = 128; // AppMaster需要使用的vCores private int amVCores = 1; // AppMaster Jar路径 private String appMasterJarPath; // Container优先级 private int requestPriority = 0; // 运行HelloYarn所需要的内存 private int containerMemory = 512; // 运行HelloYarn所需要的vCores private int containerVirtualCores = 1; // 需要启动多少个Container运行HelloYarn private int numContainers = 1; // 命令选项 private Options opts; /** * 构造函数 */ public MyClient() throws Exception { yarnClient = YarnClient.createYarnClient(); this.conf = new YarnConfiguration(); yarnClient.init(conf); appMasterJarPath = ClassUtil.findContainingJar(MyClient.class); } /** * 程序主逻辑入口 */ public boolean run() throws IOException, YarnException { LOG.info("Running Client"); yarnClient.start(); // 新建一个YarnClientApplication YarnClientApplication app = yarnClient.createApplication(); GetNewApplicationResponse appResponse = app.getNewApplicationResponse(); long maxMem = appResponse.getMaximumResourceCapability().getMemorySize(); LOG.info("Max mem capabililty of resources in this cluster " + maxMem); // 检查当前申请运行的Application的内存资源不可超过最大值 if (amMemory > maxMem) { LOG.info("AM memory specified above max threshold of cluster. Using max value." + ", specified=" + amMemory + ", max=" + maxMem); amMemory = maxMem; } // 检查当前申请运行的Application的vCores不可超过最大值 int maxVCores = appResponse.getMaximumResourceCapability().getVirtualCores(); LOG.info("Max virtual cores capability of resources in this cluster " + maxVCores); if (amVCores > maxVCores) { LOG.info("AM virtual cores specified above max threshold of cluster. " + "Using max value." + ", specified=" + amVCores + ", max=" + maxVCores); amVCores = maxVCores; } // 设置Application名字 ApplicationSubmissionContext appContext = app.getApplicationSubmissionContext(); ApplicationId appId = appContext.getApplicationId(); appContext.setApplicationName(appName); // 设置需要申请多少资源启动ApplicationMaster Resource capability = Records.newRecord(Resource.class); capability.setMemorySize(amMemory); capability.setVirtualCores(amVCores); appContext.setResource(capability); // 设置ApplicationMaster的优先级 Priority pri = Records.newRecord(Priority.class); pri.setPriority(amPriority); appContext.setPriority(pri); // 设置队列 appContext.setQueue(amQueue); // 设置一个ContainerLaunchContext来描述容器如何启动ApplicationMaster appContext.setAMContainerSpec(getAMContainerSpec(appId.getId())); LOG.info("Submitting application to ASM"); // 使用yarnClient提交运行 yarnClient.submitApplication(appContext); // 监控运行结果 return monitorApplication(appId); } private ContainerLaunchContext getAMContainerSpec(int appId) throws IOException, YarnException { // 创建一个ContainerLaunchContext ContainerLaunchContext amContainer = Records.newRecord(ContainerLaunchContext.class); // 拷贝客户端的Jar到HDFS FileSystem fs = FileSystem.get(conf); Map<String, LocalResource> localResources = new HashMap<String, LocalResource>(); LOG.info("Copy App Master jar from local filesystem and add to local environment"); addToLocalResources(fs, appMasterJarPath, Constants.AM_JAR_NAME, appId, localResources, null); // 为ApplicationMaster的Container设置运行资源(JAR路径) amContainer.setLocalResources(localResources); // 配置环境变量 LOG.info("Set the environment for the application master"); amContainer.setEnvironment(getAMEnvironment(localResources, fs)); // 设置启动参数 Vector<CharSequence> vargs = new Vector<CharSequence>(30); LOG.info("Setting up app master command"); vargs.add(Environment.JAVA_HOME.$$() + "/bin/java"); vargs.add("-Xmx" + amMemory + "m"); vargs.add("com.gupao.bigdata.yarn.examples.MyApplicationMaster"); vargs.add("--container_memory " + String.valueOf(containerMemory)); vargs.add("--container_vcores " + String.valueOf(containerVirtualCores)); vargs.add("--num_containers " + String.valueOf(numContainers)); vargs.add("--priority " + String.valueOf(requestPriority)); vargs.add("1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/AppMaster.stdout"); vargs.add("2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/AppMaster.stderr"); StringBuilder command = new StringBuilder(); for (CharSequence str : vargs) { command.append(str).append(" "); } LOG.info("Completed setting up app master command " + command.toString()); List<String> commands = new ArrayList<String>(); commands.add(command.toString()); amContainer.setCommands(commands); return amContainer; } /** * 把本地文件拷贝到HDFS上 * */ private void addToLocalResources(FileSystem fs, String fileSrcPath, String fileDstPath, int appId, Map<String, LocalResource> localResources, String resources) throws IOException { String suffix = appName + "/" + appId + "/" + fileDstPath; Path dst = new Path(fs.getHomeDirectory(), suffix); if (fileSrcPath == null) { FSDataOutputStream ostream = null; try { ostream = FileSystem .create(fs, dst, new FsPermission((short) 0710)); ostream.writeUTF(resources); } finally { IOUtils.closeQuietly(ostream); } } else { fs.copyFromLocalFile(new Path(fileSrcPath), dst); } FileStatus scFileStatus = fs.getFileStatus(dst); LocalResource scRsrc = LocalResource.newInstance( ConverterUtils.getYarnUrlFromURI(dst.toUri()), LocalResourceType.FILE, LocalResourceVisibility.APPLICATION, scFileStatus.getLen(), scFileStatus.getModificationTime()); localResources.put(fileDstPath, scRsrc); } private Map<String, String> getAMEnvironment(Map<String, LocalResource> localResources , FileSystem fs) throws IOException { Map<String, String> env = new HashMap<String, String>(); LocalResource appJarResource = localResources.get(Constants.AM_JAR_NAME); Path hdfsAppJarPath = new Path(fs.getHomeDirectory(), appJarResource.getResource().getFile()); FileStatus hdfsAppJarStatus = fs.getFileStatus(hdfsAppJarPath); long hdfsAppJarLength = hdfsAppJarStatus.getLen(); long hdfsAppJarTimestamp = hdfsAppJarStatus.getModificationTime(); env.put(Constants.AM_JAR_PATH, hdfsAppJarPath.toString()); env.put(Constants.AM_JAR_TIMESTAMP, Long.toString(hdfsAppJarTimestamp)); env.put(Constants.AM_JAR_LENGTH, Long.toString(hdfsAppJarLength)); StringBuilder classPathEnv = new StringBuilder(Environment.CLASSPATH.$$()) .append(ApplicationConstants.CLASS_PATH_SEPARATOR).append("./*"); for (String c : conf.getStrings( YarnConfiguration.YARN_APPLICATION_CLASSPATH, YarnConfiguration.DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH)) { classPathEnv.append(ApplicationConstants.CLASS_PATH_SEPARATOR); classPathEnv.append(c.trim()); } env.put("CLASSPATH", classPathEnv.toString()); return env; } /** * 监控作业运行情况 */ private boolean monitorApplication(ApplicationId appId) throws YarnException, IOException { while (true) { // 每隔1秒检查一下 try { Thread.sleep(1000); } catch (InterruptedException e) { LOG.error("Thread sleep in monitoring loop interrupted"); } // 通过ApplicationReport对象获得运行情况 ApplicationReport report = yarnClient.getApplicationReport(appId); YarnApplicationState state = report.getYarnApplicationState(); FinalApplicationStatus dsStatus = report.getFinalApplicationStatus(); if (YarnApplicationState.FINISHED == state) { if (FinalApplicationStatus.SUCCEEDED == dsStatus) { LOG.info("Application has completed successfully. " + " Breaking monitoring loop : ApplicationId:" + appId.getId()); return true; } else { LOG.info("Application did finished unsuccessfully." + " YarnState=" + state.toString() + ", DSFinalStatus=" + dsStatus.toString() + ". Breaking monitoring loop : ApplicationId:" + appId.getId()); return false; } } else if (YarnApplicationState.KILLED == state || YarnApplicationState.FAILED == state) { LOG.info("Application did not finish." + " YarnState=" + state.toString() + ", DSFinalStatus=" + dsStatus.toString() + ". Breaking monitoring loop : ApplicationId:" + appId.getId()); return false; } } } /** * 入口 */ public static void main(String[] args) { boolean result = false; try { MyClient client = new MyClient(); LOG.info("Initializing Client"); result = client.run(); } catch (Throwable t) { LOG.fatal("Error running CLient", t); System.exit(1); } if (result) { LOG.info("Application completed successfully"); System.exit(0); } LOG.error("Application failed to complete successfully"); System.exit(2); } }
923aab7810618769c2399315d7e340d322eba154
2,159
java
Java
src/main/java/com/glisco/numismaticoverhaul/villagers/json/adapters/DimensionAwareSellStackAdapter.java
gliscowo/numismatic-overhaul
8ce6c987c27f0cff1382f6c68fadadddf7729184
[ "MIT" ]
9
2022-01-17T18:20:29.000Z
2022-03-19T02:36:02.000Z
src/main/java/com/glisco/numismaticoverhaul/villagers/json/adapters/DimensionAwareSellStackAdapter.java
gliscowo/numismatic-overhaul
8ce6c987c27f0cff1382f6c68fadadddf7729184
[ "MIT" ]
15
2022-01-18T15:44:25.000Z
2022-03-22T08:48:02.000Z
src/main/java/com/glisco/numismaticoverhaul/villagers/json/adapters/DimensionAwareSellStackAdapter.java
gliscowo/numismatic-overhaul
8ce6c987c27f0cff1382f6c68fadadddf7729184
[ "MIT" ]
8
2022-01-17T19:01:44.000Z
2022-03-26T00:40:57.000Z
37.224138
124
0.720241
999,297
package com.glisco.numismaticoverhaul.villagers.json.adapters; import com.glisco.numismaticoverhaul.currency.CurrencyHelper; import com.glisco.numismaticoverhaul.villagers.json.TradeJsonAdapter; import com.glisco.numismaticoverhaul.villagers.json.VillagerJsonHelper; import com.google.gson.JsonObject; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.village.TradeOffer; import net.minecraft.village.TradeOffers; import org.jetbrains.annotations.NotNull; import java.util.Random; public class DimensionAwareSellStackAdapter extends TradeJsonAdapter { @Override @NotNull public TradeOffers.Factory deserialize(JsonObject json) { loadDefaultStats(json, true); VillagerJsonHelper.assertJsonObject(json, "sell"); VillagerJsonHelper.assertString(json, "dimension"); ItemStack sell = VillagerJsonHelper.getItemStackFromJson(json.get("sell").getAsJsonObject()); String dimension = json.get("dimension").getAsString(); int price = json.get("price").getAsInt(); return new Factory(sell, price, dimension, max_uses, villager_experience, price_multiplier); } private static class Factory implements TradeOffers.Factory { private final ItemStack sell; private final int maxUses; private final int experience; private final int price; private final float multiplier; private final String targetDimensionId; public Factory(ItemStack sell, int price, String targetDimensionId, int maxUses, int experience, float multiplier) { this.sell = sell; this.maxUses = maxUses; this.experience = experience; this.price = price; this.multiplier = multiplier; this.targetDimensionId = targetDimensionId; } public TradeOffer create(Entity entity, Random random) { if (!entity.world.getRegistryKey().getValue().toString().equals(targetDimensionId)) return null; return new TradeOffer(CurrencyHelper.getClosest(price), sell, this.maxUses, this.experience, multiplier); } } }
923aae46a55c87fbae3cf323ebcb7e5f727a8eb8
2,206
java
Java
src/main/java/com/example/clarence/corelibrary/BaseActivity.java
clarenceV1/LibCore
4eda5214c36dd4ec21c5acc495fbb0776e66b9e2
[ "Apache-2.0" ]
null
null
null
src/main/java/com/example/clarence/corelibrary/BaseActivity.java
clarenceV1/LibCore
4eda5214c36dd4ec21c5acc495fbb0776e66b9e2
[ "Apache-2.0" ]
null
null
null
src/main/java/com/example/clarence/corelibrary/BaseActivity.java
clarenceV1/LibCore
4eda5214c36dd4ec21c5acc495fbb0776e66b9e2
[ "Apache-2.0" ]
null
null
null
29.413333
113
0.628286
999,298
package com.example.clarence.corelibrary; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.RelativeLayout; /** * 预留扩展用 * Created by clarence on 16/5/29. */ public class BaseActivity extends FragmentActivity { private View mRootView; private LinearLayout baseLayout; public TitleBarCommon titleBarCommon; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initBaseView(); initTitleBar(); } @Override public void setContentView(View view) { addChildView(view); } @Override public void setContentView(int layoutResID) { View view = getLayoutInflater().inflate(layoutResID, null); addChildView(view); } @Override public void setContentView(View view, ViewGroup.LayoutParams params) { addChildView(view); } private void initBaseView() { mRootView = getLayoutInflater().inflate(R.layout.base_layout, null); super.setContentView(mRootView); baseLayout = (LinearLayout) findViewById(R.id.base_layout); titleBarCommon = (TitleBarCommon) findViewById(R.id.head_layout); } protected void initTitleBar() { setTitlebarAction(); } protected void setTitlebarAction() { if (titleBarCommon != null) { if (titleBarCommon.getLeftImageView() != null) { titleBarCommon.getLeftImageView().setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { BaseActivity.this.finish(); } }); } } } private void addChildView(View view) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); if(baseLayout!=null){ baseLayout.addView(view, params); } } }
923aae8b371e48db950096995cb08c5c6805a893
1,253
java
Java
TelemetryServer/app/src/main/java/org/mavlink/messages/MAV_STATE.java
chrisphillips/Telemetry-For-DJI
f36d00ab682191021be0468deaebcdbd6a7ce67b
[ "MIT" ]
1
2018-02-20T19:26:12.000Z
2018-02-20T19:26:12.000Z
TelemetryServer/app/src/main/java/org/mavlink/messages/MAV_STATE.java
chrisphillips/Telemetry-For-DJI
f36d00ab682191021be0468deaebcdbd6a7ce67b
[ "MIT" ]
null
null
null
TelemetryServer/app/src/main/java/org/mavlink/messages/MAV_STATE.java
chrisphillips/Telemetry-For-DJI
f36d00ab682191021be0468deaebcdbd6a7ce67b
[ "MIT" ]
null
null
null
28.477273
132
0.644852
999,299
/** * Generated class : MAV_STATE * DO NOT MODIFY! **/ package org.mavlink.messages; /** * Interface MAV_STATE * **/ public interface MAV_STATE { /** * Uninitialized system, state is unknown. */ public final static int MAV_STATE_UNINIT = 0; /** * System is booting up. */ public final static int MAV_STATE_BOOT = 1; /** * System is calibrating and not flight-ready. */ public final static int MAV_STATE_CALIBRATING = 2; /** * System is grounded and on standby. It can be launched any time. */ public final static int MAV_STATE_STANDBY = 3; /** * System is active and might be already airborne. Motors are engaged. */ public final static int MAV_STATE_ACTIVE = 4; /** * System is in a non-normal flight mode. It can however still navigate. */ public final static int MAV_STATE_CRITICAL = 5; /** * System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down. */ public final static int MAV_STATE_EMERGENCY = 6; /** * System just initialized its power-down sequence, will shut down now. */ public final static int MAV_STATE_POWEROFF = 7; }
923aaef7c1173fb618c64aceb0e260ba8bef0b89
520
java
Java
pay-dal/src/main/java/com/hiveelpay/dal/dao/mapper/CreditCardMapper.java
winn2048/HiveelPay
5643546fac92f8b6f42b1ba58abb35b9fb32101d
[ "MIT" ]
null
null
null
pay-dal/src/main/java/com/hiveelpay/dal/dao/mapper/CreditCardMapper.java
winn2048/HiveelPay
5643546fac92f8b6f42b1ba58abb35b9fb32101d
[ "MIT" ]
null
null
null
pay-dal/src/main/java/com/hiveelpay/dal/dao/mapper/CreditCardMapper.java
winn2048/HiveelPay
5643546fac92f8b6f42b1ba58abb35b9fb32101d
[ "MIT" ]
null
null
null
23.636364
97
0.690385
999,300
package com.hiveelpay.dal.dao.mapper; import com.hiveelpay.dal.dao.model.CreditCard; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @Repository public interface CreditCardMapper { /** * @param creditCard * @return */ int save(@Param("creditCard") CreditCard creditCard); /** * @param token * @param customerId * @return */ CreditCard findByToken(@Param("token") String token, @Param("customerId") String customerId); }
923aaf02c437b1dc01e1145085e01d3b8b04c6d2
1,950
java
Java
alpha-oauth2/alpha-oauth2-server/src/main/java/com/geektcp/alpha/sso/server/config/WebSecurityConfig.java
thyhero/alpha
699bb05ba4a7c61fccf733f9b293f0ed9b3dca6e
[ "Apache-2.0" ]
1
2019-06-15T01:24:25.000Z
2019-06-15T01:24:25.000Z
alpha-oauth2/alpha-oauth2-server/src/main/java/com/geektcp/alpha/sso/server/config/WebSecurityConfig.java
arist0tle/alpha
699bb05ba4a7c61fccf733f9b293f0ed9b3dca6e
[ "Apache-2.0" ]
null
null
null
alpha-oauth2/alpha-oauth2-server/src/main/java/com/geektcp/alpha/sso/server/config/WebSecurityConfig.java
arist0tle/alpha
699bb05ba4a7c61fccf733f9b293f0ed9b3dca6e
[ "Apache-2.0" ]
2
2021-01-28T00:10:43.000Z
2022-01-05T14:38:02.000Z
36.111111
107
0.741538
999,301
package com.geektcp.alpha.sso.server.config; import com.geektcp.alpha.sso.server.service.MyUserDetailsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; /** * @author tanghaiyang * @date 2019-02-11 */ @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private MyUserDetailsService userDetailsService; @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); } @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/assets/**", "/css/**", "/images/**"); } @Override protected void configure(HttpSecurity http) throws Exception { http.formLogin() .loginPage("/login") .and() .authorizeRequests() .antMatchers("/login").permitAll() .anyRequest() .authenticated() .and().csrf().disable().cors(); } @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } }
923ab11ae2fbd7abd6800d8ec7d78ed98c4889ae
4,073
java
Java
src/test/java/org/torpedoquery/jpa/OrderByTest.java
mdebellefeuille/torpedoquery
084ebf1e390174de5f877870e02f5e58023d3183
[ "Apache-2.0" ]
48
2015-01-22T14:29:07.000Z
2022-03-02T11:03:50.000Z
src/test/java/org/torpedoquery/jpa/OrderByTest.java
mdebellefeuille/torpedoquery
084ebf1e390174de5f877870e02f5e58023d3183
[ "Apache-2.0" ]
14
2015-06-22T16:04:31.000Z
2019-04-13T13:32:46.000Z
src/test/java/org/torpedoquery/jpa/OrderByTest.java
mdebellefeuille/torpedoquery
084ebf1e390174de5f877870e02f5e58023d3183
[ "Apache-2.0" ]
17
2015-03-13T14:36:36.000Z
2021-12-31T08:36:11.000Z
27.890411
138
0.719057
999,302
/** * Copyright (C) 2011 Xavier Jodoin (ychag@example.com) * * 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.torpedoquery.jpa; import static org.junit.Assert.assertEquals; import static org.torpedoquery.jpa.Torpedo.from; import static org.torpedoquery.jpa.Torpedo.innerJoin; import static org.torpedoquery.jpa.Torpedo.orderBy; import static org.torpedoquery.jpa.Torpedo.select; import static org.torpedoquery.jpa.TorpedoFunction.asc; import static org.torpedoquery.jpa.TorpedoFunction.desc; import org.junit.Test; import org.torpedoquery.jpa.test.bo.Entity; import org.torpedoquery.jpa.test.bo.SubEntity; public class OrderByTest { /** * <p> * test_simpleOrderBy. * </p> */ @Test public void test_simpleOrderBy() { Entity from = from(Entity.class); orderBy(from.getCode()); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 order by entity_0.code", select.getQuery()); } /** * <p> * test_multipleOrderBy. * </p> */ @Test public void test_multipleOrderBy() { Entity from = from(Entity.class); orderBy(from.getCode(), from.getName()); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 order by entity_0.code,entity_0.name", select.getQuery()); } /** * <p> * test_OrderByOnJoin. * </p> */ @Test public void test_OrderByOnJoin() { Entity from = from(Entity.class); SubEntity innerJoin = innerJoin(from.getSubEntity()); orderBy(innerJoin.getCode()); Query<Entity> select = select(from); assertEquals( "select entity_0 from Entity entity_0 inner join entity_0.subEntity subEntity_1 order by subEntity_1.code", select.getQuery()); } /** * <p> * test_OrderByTwoLevel. * </p> */ @Test public void test_OrderByTwoLevel() { Entity from = from(Entity.class); SubEntity innerJoin = innerJoin(from.getSubEntity()); orderBy(from.getCode(), innerJoin.getCode()); Query<Entity> select = select(from); assertEquals( "select entity_0 from Entity entity_0 inner join entity_0.subEntity subEntity_1 order by entity_0.code,subEntity_1.code", select.getQuery()); } /** * <p> * test_simpleOrderBy_asc. * </p> */ @Test public void test_simpleOrderBy_asc() { Entity from = from(Entity.class); orderBy(asc(from.getCode())); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 order by entity_0.code asc", select.getQuery()); } /** * <p> * test_simpleOrderBy_desc. * </p> */ @Test public void test_simpleOrderBy_desc() { Entity from = from(Entity.class); orderBy(desc(from.getCode())); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 order by entity_0.code desc", select.getQuery()); } /** * <p> * test_simpleOrderBy_asc_and_default. * </p> */ @Test public void test_simpleOrderBy_asc_and_default() { Entity from = from(Entity.class); orderBy(asc(from.getCode()), from.getName()); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 order by entity_0.code asc,entity_0.name", select.getQuery()); } @Test public void shouldKeepOrderingWithInnerJoin() { Entity from = from(Entity.class); SubEntity subEntity = innerJoin(from.getSubEntities()); orderBy(subEntity.getCode(), from.getName()); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 inner join entity_0.subEntities subEntity_1 order by subEntity_1.code,entity_0.name", select.getQuery()); } }
923ab18aaa4be3a26207409fa1d8924c3c4c84ce
4,195
java
Java
api/src/main/java/io/spaship/content/git/api/GitService.java
lkrzyzanek/content-git
4250a1bc5a8c60ca90e97e5e99f80b2856230829
[ "Apache-2.0" ]
null
null
null
api/src/main/java/io/spaship/content/git/api/GitService.java
lkrzyzanek/content-git
4250a1bc5a8c60ca90e97e5e99f80b2856230829
[ "Apache-2.0" ]
9
2021-03-24T09:58:16.000Z
2021-10-18T20:56:00.000Z
api/src/main/java/io/spaship/content/git/api/GitService.java
lkrzyzanek/content-git
4250a1bc5a8c60ca90e97e5e99f80b2856230829
[ "Apache-2.0" ]
1
2021-03-24T09:46:53.000Z
2021-03-24T09:46:53.000Z
33.031496
132
0.647199
999,303
package io.spaship.content.git.api; import io.quarkus.runtime.StartupEvent; import io.spaship.content.git.api.model.CommitInfo; import io.spaship.content.git.api.model.GitInfo; import io.spaship.content.git.api.rest.GitApiResource; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.PullResult; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.NoHeadException; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.jboss.logging.Logger; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; import javax.inject.Inject; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; @ApplicationScoped public class GitService { Logger log = Logger.getLogger(GitService.class); @ConfigProperty(name = "app.data.dir") String dataDir; String dataDirPath; @Inject GitApiResource gitApiResource; void onStart(@Observes StartupEvent ev) { File dataDirFile = new File(dataDir); dataDirPath = dataDirFile.getAbsolutePath(); log.infof("content-git-api started. APP_DATA_DIR=%s exists=%s", dataDirPath, dataDirFile.exists()); } public List<String> list() { log.info("get list"); File file = new File(dataDir); String[] directories = file.list((current, name) -> new File(current, name).isDirectory()); if (directories == null) { return Collections.emptyList(); } return Arrays.asList(directories); } public String updateGit(String dir) throws FileNotFoundException, GitAPIException { log.infof("Update git dir=%s", dir); File gitDir = getGitDir(dir); Git git = Git.init().setDirectory(gitDir).call(); PullResult result; try { result = git.pull().call(); } catch (NoHeadException e) { log.infof("Update skipped. Not on HEAD"); return "SKIP-NO-HEAD"; } String resultStr = toString(result); if (!result.isSuccessful()) { throw new RuntimeException("Cannot perform git pull. reason=%s" + resultStr); } git.close(); log.infof("Update Success. result=%s", resultStr); gitApiResource.clearInfo(dir); return resultStr; } public String toString(PullResult result) { StringBuilder sb = new StringBuilder(); if (result.getFetchResult() != null) { sb.append(result.getFetchResult().submoduleResults()); } else { sb.append("No fetch result"); } sb.append(" "); if (result.getMergeResult() != null) { sb.append(result.getMergeResult().getMergeStatus()); } else if (result.getRebaseResult() != null) { sb.append("Rebase:"); sb.append(result.getRebaseResult().getStatus()); } else sb.append("No update result"); return sb.toString(); } public GitInfo info(String dir) throws IOException, GitAPIException { log.infof("get info dir=%s", dir); File gitDir = getGitDir(dir); Git git = Git.init().setDirectory(gitDir).call(); GitInfo info = new GitInfo(); info.setBranch(git.getRepository().getBranch()); info.setUrl(git.remoteList().call().get(0).getURIs().get(0).toString()); Iterable<RevCommit> log = git.log().call(); RevCommit lastCommit = log.iterator().next(); long timestamp = ((long) lastCommit.getCommitTime()) * 1000; info.setLastCommit(new CommitInfo(lastCommit.getFullMessage(), lastCommit.getAuthorIdent().getName(), new Date(timestamp))); git.close(); return info; } protected File getGitDir(String dir) throws FileNotFoundException { File gitDir = new File(dataDirPath + "/" + dir); if (!gitDir.exists()) { throw new FileNotFoundException("dir " + gitDir.getAbsolutePath() + " does not exist"); } return gitDir; } }
923ab1c185d44ea8c44ec77935685f27d76aff01
4,163
java
Java
aop-demo/src/main/java/com/luoyu/aop/aop/HttpCheckAspact.java
xbcmz/springboot-demo
7dcb364f9e464247ab33e14196f6cfe5a5a068b4
[ "Apache-2.0" ]
53
2020-01-13T10:03:30.000Z
2021-04-27T09:31:18.000Z
aop-demo/src/main/java/com/luoyu/aop/aop/HttpCheckAspact.java
xbcmz/springboot-demo
7dcb364f9e464247ab33e14196f6cfe5a5a068b4
[ "Apache-2.0" ]
1
2020-10-08T03:36:55.000Z
2020-10-08T03:36:55.000Z
aop-demo/src/main/java/com/luoyu/aop/aop/HttpCheckAspact.java
xbcmz/springboot-demo
7dcb364f9e464247ab33e14196f6cfe5a5a068b4
[ "Apache-2.0" ]
27
2020-02-26T08:35:19.000Z
2021-04-22T03:46:29.000Z
35.581197
146
0.6368
999,304
package com.luoyu.aop.aop; import com.luoyu.aop.config.KeyConfig; import com.luoyu.aop.entity.http.HttpRequest; import com.luoyu.aop.entity.http.HttpResponse; import com.luoyu.aop.entity.response.TestResponse; import com.luoyu.aop.util.AESUtil; import com.luoyu.aop.util.JsonUtils; import com.oracle.tools.packager.Log; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import java.lang.reflect.Method; import java.time.LocalDateTime; import java.time.ZoneOffset; /** * @Auther: luoyu * @Date: 2019/1/22 16:28 * @Description: */ @Aspect @Component public class HttpCheckAspact { @Autowired private KeyConfig keyConfig; @Pointcut("@annotation(com.luoyu.aop.aop.HttpCheck)") public void pointcut() { } /** * 前置处理 * @param joinPoint * @throws Exception */ @SuppressWarnings("unchecked") @Before("pointcut()") public void doBefore(JoinPoint joinPoint) throws Exception { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); HttpCheck annotation = method.getAnnotation(HttpCheck.class); // 获取HttpRequest对象 Object[] args = joinPoint.getArgs(); HttpRequest httpRequest = null; if(args.length > 0){ for(Object arg: args){ if(arg instanceof HttpRequest){ httpRequest = (HttpRequest)arg; } } }else { throw new Exception("请求参数错误!"); } // 是否需要检测超时时间 if (annotation.isTimeout()){ // 获取超时时间 String timeout = StringUtils.isEmpty(annotation.timeout()) ? keyConfig.getTimeout(): annotation.timeout(); if(LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli() < httpRequest.getTime()){ throw new Exception("请求时间错误!"); } if(LocalDateTime.now().minusSeconds(Integer.parseInt(timeout)).toInstant(ZoneOffset.of("+8")).toEpochMilli() > httpRequest.getTime()){ throw new Exception("请求已超时!"); } Log.info("检测超时时间成功!"); } // 是否需要进行解密 if(annotation.isDecrypt()){ // 获取需要解密的key String dectyptKey = StringUtils.isEmpty(annotation.decryptKey()) ? keyConfig.getKeyAesRequest(): annotation.decryptKey(); String sdt = httpRequest.getSdt(); if(StringUtils.isEmpty(sdt)){ throw new Exception("sdt不能为空!"); } String context = AESUtil.decrypt(sdt, dectyptKey); if(StringUtils.isEmpty(context)){ throw new Exception("sdt解密出错!"); } Log.info("解密成功!"); // 设置解密后的data httpRequest.setData(JsonUtils.jsonToObject(context, annotation.dataType())); } } @AfterReturning(value = "pointcut()", returning = "response") public void doAfterReturning(JoinPoint joinPoint, Object response) throws Exception { HttpResponse httpResponse = (HttpResponse) response; MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); HttpCheck annotation = method.getAnnotation(HttpCheck.class); if(annotation.isEncrypt()){ TestResponse body = (TestResponse) httpResponse.getData(); // 进行响应加密 if (body != null) { String encrypyKey = StringUtils.isEmpty(annotation.encryptKey())? keyConfig.getKeyAesResponse() : annotation.encryptKey(); // 设置加密后的srs httpResponse.setSrs(AESUtil.encrypt(JsonUtils.objectToJson(body), encrypyKey)); Log.info("加密成功!"); httpResponse.setData(null); } } } }
923ab1f8873df2696d638522003dbee376642a48
1,083
java
Java
WebBuilder/src/main/java/com/himari/builder/component/graphic/LabelComponent.java
zZHorizonZz/Himari
ffcc7f8b7f1522bce1f14420aec1ebdfa9a5994f
[ "Apache-2.0" ]
null
null
null
WebBuilder/src/main/java/com/himari/builder/component/graphic/LabelComponent.java
zZHorizonZz/Himari
ffcc7f8b7f1522bce1f14420aec1ebdfa9a5994f
[ "Apache-2.0" ]
null
null
null
WebBuilder/src/main/java/com/himari/builder/component/graphic/LabelComponent.java
zZHorizonZz/Himari
ffcc7f8b7f1522bce1f14420aec1ebdfa9a5994f
[ "Apache-2.0" ]
null
null
null
25.186047
75
0.701754
999,305
/* * Copyright 2021 Daniel Fiala * * 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.himari.builder.component.graphic; import com.himari.builder.component.ComponentType; public class LabelComponent extends GraphicComponent { public LabelComponent() { } public LabelComponent(String text) { super(text); } @Override public ComponentType getType() { return ComponentType.LABEL; } public String getText() { return getValue(); } public void setText(String text) { setValue(text); } }
923ab33d7bdec5da6ece988d67a7ef2a9f67e060
2,775
java
Java
shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutor.java
tingting123123/shardingsphere
ac74c098136a5dbead8351950d2fa343d2e91b73
[ "Apache-2.0" ]
5,788
2020-04-17T14:09:07.000Z
2022-03-31T08:12:53.000Z
shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutor.java
tingting123123/shardingsphere
ac74c098136a5dbead8351950d2fa343d2e91b73
[ "Apache-2.0" ]
6,488
2020-04-17T14:21:54.000Z
2022-03-31T21:36:33.000Z
shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutor.java
tingting123123/shardingsphere
ac74c098136a5dbead8351950d2fa343d2e91b73
[ "Apache-2.0" ]
2,504
2020-04-17T14:09:46.000Z
2022-03-31T12:21:31.000Z
38.541667
162
0.729009
999,306
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc; import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine; import org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroupContext; import org.apache.shardingsphere.infra.executor.sql.execute.engine.SQLExecutorExceptionHandler; import java.sql.SQLException; import java.util.Collections; import java.util.List; /** * JDBC executor. */ @RequiredArgsConstructor public final class JDBCExecutor { private final ExecutorEngine executorEngine; private final boolean serial; /** * Execute. * * @param executionGroupContext execution group context * @param callback JDBC execute callback * @param <T> class type of return value * @return execute result * @throws SQLException SQL exception */ public <T> List<T> execute(final ExecutionGroupContext<JDBCExecutionUnit> executionGroupContext, final JDBCExecutorCallback<T> callback) throws SQLException { return execute(executionGroupContext, null, callback); } /** * Execute. * * @param executionGroupContext execution group context * @param firstCallback first JDBC execute callback * @param callback JDBC execute callback * @param <T> class type of return value * @return execute result * @throws SQLException SQL exception */ public <T> List<T> execute(final ExecutionGroupContext<JDBCExecutionUnit> executionGroupContext, final JDBCExecutorCallback<T> firstCallback, final JDBCExecutorCallback<T> callback) throws SQLException { try { return executorEngine.execute(executionGroupContext, firstCallback, callback, serial); } catch (final SQLException ex) { SQLExecutorExceptionHandler.handleException(ex); return Collections.emptyList(); } } }
923ab3480a7b576a25b4c75187d3324e9ec61d57
2,047
java
Java
foc/src/com/foc/db/migration/MigrationModule.java
FOC-framework/framework
cfffcd9a5adf3d934335d8a18434245c068165e0
[ "Apache-2.0" ]
1
2018-12-18T06:51:56.000Z
2018-12-18T06:51:56.000Z
foc/src/com/foc/db/migration/MigrationModule.java
FOC-framework/framework
cfffcd9a5adf3d934335d8a18434245c068165e0
[ "Apache-2.0" ]
8
2017-03-09T04:30:04.000Z
2021-06-15T15:57:28.000Z
foc/src/com/foc/db/migration/MigrationModule.java
FOC-framework/framework
cfffcd9a5adf3d934335d8a18434245c068165e0
[ "Apache-2.0" ]
2
2019-06-02T14:20:09.000Z
2022-02-10T10:21:25.000Z
28.430556
81
0.646312
999,307
/******************************************************************************* * Copyright 2016 Antoine Nicolas SAMAHA * * 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.foc.db.migration; import com.foc.Application; import com.foc.Globals; import com.foc.admin.FocVersion; import com.foc.desc.FocModule; import com.foc.menu.FMenuList; public class MigrationModule extends FocModule { private MigrationModule(){ } public void dispose(){ super.dispose(); } public void declare(){ Application app = Globals.getApp(); FocVersion.addVersion("Migration", "migration v1.0", 1000); app.declareModule(this); } public void addApplicationMenu(FMenuList menuList) { } public void addConfigurationMenu(FMenuList menuList) { } public void afterAdaptDataModel() { } public void afterApplicationEntry() { } public void afterApplicationLogin() { } public void beforeAdaptDataModel() { } public void declareFocObjectsOnce() { declareFocDescClass(MigrationSourceDesc.class); declareFocDescClass(MigDataBaseDesc.class); declareFocDescClass(MigDirectoryDesc.class); declareFocDescClass(MigFieldMapDesc.class); } private static MigrationModule module = null; public static MigrationModule getInstance(){ if(module == null){ module = new MigrationModule(); } return module; } }
923ab398e572cdc5e4f50223c0aa6102f8ca1ba4
711
java
Java
src/org/hy/common/xml/plugins/XSQLGroupTaskGroupListener.java
HY-ZhengWei/XJava
e9952ed39319f8b55adcdfa409696b6eeaf4cae7
[ "Apache-2.0" ]
5
2017-08-22T08:00:35.000Z
2020-03-25T12:49:04.000Z
src/org/hy/common/xml/plugins/XSQLGroupTaskGroupListener.java
HY-ZhengWei/XJava
e9952ed39319f8b55adcdfa409696b6eeaf4cae7
[ "Apache-2.0" ]
1
2021-09-30T07:56:05.000Z
2021-09-30T07:56:05.000Z
src/org/hy/common/xml/plugins/XSQLGroupTaskGroupListener.java
HY-ZhengWei/XJava
e9952ed39319f8b55adcdfa409696b6eeaf4cae7
[ "Apache-2.0" ]
5
2017-04-12T04:29:48.000Z
2019-05-23T02:37:53.000Z
14.22
68
0.565401
999,308
package org.hy.common.xml.plugins; import org.hy.common.thread.event.TaskGroupEvent; import org.hy.common.thread.event.TaskGroupListener; /** * TODO(请详细描述类型的作用。描述后请删除todo标签) * * @author ZhengWei(HY) * @createDate 2017-02-22 * @version v1.0 */ public class XSQLGroupTaskGroupListener implements TaskGroupListener { public XSQLGroupTaskGroupListener() { } /** * 启用任务组所有任务的事件 * * @param e */ public void startupAllTask(TaskGroupEvent e) { // Nothing. } /** * 任务组中任务都完成后的事件 * * @param e */ public void finishAllTask(TaskGroupEvent e) { } }
923ab3cfeb454d32bdffba79151fa0330c983137
1,803
java
Java
controle-de-estoque/test/tests/addProductToStockTest.java
lucassoaresouza/tc-sce-lucas-souza
36479e81d001f4e137fc60e29cbc37157d465126
[ "MIT" ]
null
null
null
controle-de-estoque/test/tests/addProductToStockTest.java
lucassoaresouza/tc-sce-lucas-souza
36479e81d001f4e137fc60e29cbc37157d465126
[ "MIT" ]
null
null
null
controle-de-estoque/test/tests/addProductToStockTest.java
lucassoaresouza/tc-sce-lucas-souza
36479e81d001f4e137fc60e29cbc37157d465126
[ "MIT" ]
null
null
null
28.171875
100
0.629506
999,309
/* * 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 tests; import java.util.Arrays; import java.util.Collection; import model.Product; import model.ProductStock; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; /** * * @author lucas-souza */ @RunWith(Parameterized.class) public class addProductToStockTest { private ProductStock stock; private String register = ""; private String name = ""; private String description = ""; private int quantity = 0; private boolean result = false; public addProductToStockTest(String reg, String nm, String dscpt, int quantity, boolean result){ this.register = reg; this.name = nm; this.description = dscpt; this.quantity = quantity; this.result = result; } @Before public void setUp() { stock = ProductStock.getStock(); } @Parameterized.Parameters public static Collection testData(){ return Arrays.asList(new Object[][]{ {"1","Cafe","Po de cafe", 1, true}, {"2","Cha","Po de cha", 1,true}, {"3","Achocolatado","Po de chocolate ao leite", 1,true}, {"1","Cafe","Po de cafe", 1,false}, {"2","Cha","Po de cha", 1,false}, {"3","Achocolatado","Po de chocolate ao leite", 1,false} }); } @Test public void testAddingProductToStock() { Product product; product = new Product(register, name, description, quantity); assertEquals(stock.addProduct(product), result); } }
923ab4071a413a501d0713d3ccf2d424958158b1
2,517
java
Java
src/main/java/com/vigekoo/modules/lecturer/controller/LecturerController.java
xsc19850920/boot-cms
9202b02b3660060162aace0195ce507db0659356
[ "Apache-2.0" ]
null
null
null
src/main/java/com/vigekoo/modules/lecturer/controller/LecturerController.java
xsc19850920/boot-cms
9202b02b3660060162aace0195ce507db0659356
[ "Apache-2.0" ]
null
null
null
src/main/java/com/vigekoo/modules/lecturer/controller/LecturerController.java
xsc19850920/boot-cms
9202b02b3660060162aace0195ce507db0659356
[ "Apache-2.0" ]
null
null
null
25.948454
93
0.757648
999,310
package com.vigekoo.modules.lecturer.controller; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.vigekoo.common.utils.PageUtils; import com.vigekoo.common.utils.Query; import com.vigekoo.common.utils.Result; import com.vigekoo.modules.lecturer.entity.Lecturer; import com.vigekoo.modules.lecturer.service.LecturerService; import com.vigekoo.modules.sys.controller.AbstractController; /** * @author sxia * @Description: TODO(讲师) * @date 2018-03-12 19:40:41 */ @RestController @RequestMapping("/lecturer") public class LecturerController extends AbstractController{ @Autowired private LecturerService lecturerService; /** * 列表 */ @RequestMapping("/list") @RequiresPermissions("lecturer:list") public Result list(@RequestParam Map<String, Object> params){ //查询列表数据 Query query = new Query(params); List<Lecturer> lecturerList = lecturerService.queryList(query); int total = lecturerService.queryTotal(query); PageUtils pageUtil = new PageUtils(lecturerList, total, query.getLimit(), query.getPage()); return Result.ok().put("page", pageUtil); } /** * 信息 */ @RequestMapping("/info/{lecturerId}") @RequiresPermissions("lecturer:info") public Result info(@PathVariable("lecturerId") Long lecturerId){ Lecturer lecturer = lecturerService.queryObject(lecturerId); return Result.ok().put("lecturer", lecturer); } /** * 保存 */ @RequestMapping("/save") @RequiresPermissions("lecturer:save") public Result save(@RequestBody Lecturer lecturer,HttpServletRequest request){ lecturerService.save(lecturer,request); return Result.ok(); } /** * 修改 */ @RequestMapping("/update") @RequiresPermissions("lecturer:update") public Result update(@RequestBody Lecturer lecturer){ lecturerService.update(lecturer); return Result.ok(); } /** * 删除 */ @RequestMapping("/delete") @RequiresPermissions("lecturer:delete") public Result delete(@RequestBody Long[] lecturerIds){ lecturerService.deleteBatch(lecturerIds); return Result.ok(); } }
923ab418373a7bda7d8012208569e720dfdb863c
1,074
java
Java
src/main/java/com/sattlerjoshua/spring/api/docs/Person.java
j-sattler/spring-swagger-vs-restdocs
ec59f3da0c7ae98ea9c23d9fced618a049799a8f
[ "Apache-2.0" ]
null
null
null
src/main/java/com/sattlerjoshua/spring/api/docs/Person.java
j-sattler/spring-swagger-vs-restdocs
ec59f3da0c7ae98ea9c23d9fced618a049799a8f
[ "Apache-2.0" ]
null
null
null
src/main/java/com/sattlerjoshua/spring/api/docs/Person.java
j-sattler/spring-swagger-vs-restdocs
ec59f3da0c7ae98ea9c23d9fced618a049799a8f
[ "Apache-2.0" ]
null
null
null
21.66
55
0.575254
999,311
package com.sattlerjoshua.spring.api.docs; import com.fasterxml.jackson.annotation.*; /** * Immutable class that represents a person resource. * * @author hzdkv@example.com */ @JsonIgnoreProperties(ignoreUnknown = true) public class Person { private final Long id; private final String firstName; private final String lastName; @JsonCreator Person(@JsonProperty("id") Long id, @JsonProperty("firstName") String firstName, @JsonProperty("lastName") String lastName){ this.id = id; this.firstName = firstName; this.lastName = lastName; } @JsonGetter public Long id() { return id; } @JsonGetter public String firstName() { return firstName; } @JsonGetter public String lastName() { return lastName; } @Override public String toString() { return "Person{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + '}'; } }
923ab42289f08c75627c801cea5ed80ce55234b1
5,097
java
Java
app/src/main/java/com/google/android/gms/fit/samples/basicsensorsapi/StepCounterActivity.java
aamirbhat/walking
10ccf979c70b615895bcd6f001ac51b6596427f5
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/google/android/gms/fit/samples/basicsensorsapi/StepCounterActivity.java
aamirbhat/walking
10ccf979c70b615895bcd6f001ac51b6596427f5
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/google/android/gms/fit/samples/basicsensorsapi/StepCounterActivity.java
aamirbhat/walking
10ccf979c70b615895bcd6f001ac51b6596427f5
[ "Apache-2.0" ]
null
null
null
39.820313
173
0.698646
999,312
package com.google.android.gms.fit.samples.basicsensorsapi; import android.app.Activity; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.hardware.*; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; import android.text.method.MultiTapKeyListener; import android.util.Log; import android.util.MutableLong; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.HashMap; public class StepCounterActivity extends Activity implements SensorEventListener { private TextView count_lastEntry; private TextView count_reboot; private TextView count; SharedPreferences sharedPreferences; private SensorManager sensorManager; StepsTableObject step_obj; ListView listView; static final String KEY_ID = "id"; static final String KEY_SENSOR_DATA = "sensor_data"; public static final String KEY_REL_DATA = "relative_data"; static final String KEY_TIMESTAMP = "timestamp"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_step_counter); sharedPreferences = getSharedPreferences("MyPreferences" , MODE_MULTI_PROCESS); count_lastEntry = (TextView) findViewById(R.id.count_lastEntry); count_reboot = (TextView) findViewById(R.id.count_reboot); count = (TextView) findViewById(R.id.count); listView = (ListView) findViewById(R.id.list_item); sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); DatabaseHandler db = new DatabaseHandler(this); StepsTableObject step_obj = new StepsTableObject(db); this.step_obj = step_obj; } @Override protected void onResume() { super.onResume(); Sensor countSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); if (countSensor != null) { Toast.makeText(this, "Step count sensor is available....!", Toast.LENGTH_LONG).show(); sensorManager.registerListener(this, countSensor, SensorManager.SENSOR_DELAY_UI); String server_set = sharedPreferences.getString("is_server_sync", "False"); if (server_set.equals("False")){ setServerSync(); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("is_server_sync", "true"); editor.commit(); } } else { Toast.makeText(this, "Count sensor not available!", Toast.LENGTH_LONG).show(); } LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter("Walking_Module")); ArrayList<HashMap<String, String>> itemList = step_obj.getAllItems(); if (itemList.size() != 0){ ListAdapter adapter = new SimpleAdapter( StepCounterActivity.this,itemList, R.layout.listview_customrow, new String[] { KEY_ID,KEY_REL_DATA, KEY_SENSOR_DATA, KEY_TIMESTAMP}, new int[] {R.id.Rank_Cell, R.id.Relative_Count, R.id.Sensor_Count, R.id.TimeStamp}); listView.setAdapter(adapter); } } @Override protected void onPause() { super.onPause(); } public void onBackPressed() { moveTaskToBack(true); android.os.Process.killProcess(android.os.Process.myPid()); System.exit(1); } private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // Get extra data included in the Intent String relativeCount = intent.getStringExtra("RelativeCount"); String sensorCount = intent.getStringExtra("SensorCount"); count_lastEntry.setText(relativeCount); count_reboot.setText(sensorCount); Log.d("receiver", "Got relative Count: " + relativeCount); } }; public void setServerSync(){ Intent intent = new Intent(this, BackgroundStep.class); // Create the pending intent and wrap our intent PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 1, intent, 0); // Get the alarm manager service and schedule it to go off after 3s AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); // alarmManager.setRepeating(AlarmManager.RTC, 6000, 90000, pendingIntent); alarmManager.setRepeating(AlarmManager.RTC, 5000, 300000, pendingIntent); } @Override public void onSensorChanged(SensorEvent event) { count.setText(String.valueOf(event.values[0])); } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } }
923ab5788989548535652bb428fd74ad5a0f122c
2,122
java
Java
etl/src/main/java/com/cezarykluczynski/stapi/etl/template/video/dto/VideoTemplate.java
tj-harris/stapi
a7db769841d2dbf4c0bd05f00e26bdc9fd9e5341
[ "MIT" ]
104
2017-04-27T17:50:40.000Z
2022-03-20T07:50:34.000Z
etl/src/main/java/com/cezarykluczynski/stapi/etl/template/video/dto/VideoTemplate.java
tj-harris/stapi
a7db769841d2dbf4c0bd05f00e26bdc9fd9e5341
[ "MIT" ]
15
2017-06-17T11:54:29.000Z
2022-03-02T02:38:51.000Z
etl/src/main/java/com/cezarykluczynski/stapi/etl/template/video/dto/VideoTemplate.java
tj-harris/stapi
a7db769841d2dbf4c0bd05f00e26bdc9fd9e5341
[ "MIT" ]
14
2017-05-05T19:50:46.000Z
2022-01-15T12:58:23.000Z
24.390805
86
0.834119
999,313
package com.cezarykluczynski.stapi.etl.template.video.dto; import com.cezarykluczynski.stapi.model.content_language.entity.ContentLanguage; import com.cezarykluczynski.stapi.model.content_rating.entity.ContentRating; import com.cezarykluczynski.stapi.model.page.entity.Page; import com.cezarykluczynski.stapi.model.reference.entity.Reference; import com.cezarykluczynski.stapi.model.season.entity.Season; import com.cezarykluczynski.stapi.model.series.entity.Series; import com.cezarykluczynski.stapi.model.video_release.entity.enums.VideoReleaseFormat; import com.google.common.collect.Sets; import lombok.Data; import java.time.LocalDate; import java.util.Set; @Data public class VideoTemplate { private String title; private Page page; private Series series; private Season season; private VideoReleaseFormat format; private Integer numberOfEpisodes; private Integer numberOfFeatureLengthEpisodes; private Integer numberOfDataCarriers; private Integer runTime; private Integer yearFrom; private Integer yearTo; private LocalDate regionFreeReleaseDate; private LocalDate region1AReleaseDate; private LocalDate region1SlimlineReleaseDate; private LocalDate region2BReleaseDate; private LocalDate region2SlimlineReleaseDate; private LocalDate region4AReleaseDate; private LocalDate region4SlimlineReleaseDate; private Boolean amazonDigitalRelease; private Boolean dailymotionDigitalRelease; private Boolean googlePlayDigitalRelease; @SuppressWarnings("memberName") private Boolean iTunesDigitalRelease; private Boolean ultraVioletDigitalRelease; private Boolean vimeoDigitalRelease; private Boolean vuduDigitalRelease; private Boolean xboxSmartGlassDigitalRelease; private Boolean youTubeDigitalRelease; private Boolean netflixDigitalRelease; private Set<Reference> references = Sets.newHashSet(); private Set<ContentRating> ratings = Sets.newHashSet(); private Set<ContentLanguage> languages = Sets.newHashSet(); private Set<ContentLanguage> languagesSubtitles = Sets.newHashSet(); private Set<ContentLanguage> languagesDubbed = Sets.newHashSet(); }
923ab5cf2df5080b939da63c1af4c9e6d8f1a15a
3,442
java
Java
src/main/java/com/github/aaric/achieve/sms/service/impl/SmsServiceImpl.java
aaric/dysms-achieve
13246e421fcd7f0f8efd851730bfd689e56bcc1a
[ "MIT" ]
null
null
null
src/main/java/com/github/aaric/achieve/sms/service/impl/SmsServiceImpl.java
aaric/dysms-achieve
13246e421fcd7f0f8efd851730bfd689e56bcc1a
[ "MIT" ]
null
null
null
src/main/java/com/github/aaric/achieve/sms/service/impl/SmsServiceImpl.java
aaric/dysms-achieve
13246e421fcd7f0f8efd851730bfd689e56bcc1a
[ "MIT" ]
null
null
null
31.009009
120
0.662406
999,314
package com.github.aaric.achieve.sms.service.impl; import com.aliyuncs.DefaultAcsClient; import com.aliyuncs.IAcsClient; import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest; import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; import com.aliyuncs.exceptions.ClientException; import com.aliyuncs.profile.DefaultProfile; import com.aliyuncs.profile.IClientProfile; import com.github.aaric.achieve.sms.service.SmsService; import com.google.gson.Gson; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.Map; /** * 发送短信接口实现 * * @author Aaric, created on 2018-11-13T09:48. * @since 0.1.0-SNAPSHOT */ @Service public class SmsServiceImpl implements SmsService { /** * 产品名称:云通信短信API产品,开发者无需替换 */ private static final String ALIYUN_SMS_PRODUCT = "Dysmsapi"; /** * 产品域名,开发者无需替换 */ private static final String ALIYUN_SMS_DOMAIN = "dysmsapi.aliyuncs.com"; /** * 默认超时时间 */ private static final String ALIYUN_SMS_DEFAULT_TIMEOUT = "10000"; /** * 服务地址 */ private static final String ALIYUN_SMS_ENDPOINT = "cn-hangzhou"; /** * 服务器ID */ private static final String ALIYUN_SMS_REGIONID = "cn-hangzhou"; /** * 授权KEY */ @Value("${aliyun.dysms.accessKeyId}") private String accessKeyId; /** * 授权密钥 */ @Value("${aliyun.dysms.accessKeySecret}") private String accessKeySecret; /** * 短信签名 */ @Value("${aliyun.dysms.signName}") private String signName; @Override public String sendSms(String templateCode, Map<String, String> templateParams, String outId, String... tos) { // 可自助调整超时时间 System.setProperty("sun.net.client.defaultConnectTimeout", ALIYUN_SMS_DEFAULT_TIMEOUT); System.setProperty("sun.net.client.defaultReadTimeout", ALIYUN_SMS_DEFAULT_TIMEOUT); try { // 初始化acsClient,暂不支持region化 IClientProfile profile = DefaultProfile.getProfile(ALIYUN_SMS_REGIONID, accessKeyId, accessKeySecret); DefaultProfile.addEndpoint(ALIYUN_SMS_ENDPOINT, ALIYUN_SMS_REGIONID, ALIYUN_SMS_PRODUCT, ALIYUN_SMS_DOMAIN); IAcsClient acsClient = new DefaultAcsClient(profile); // 组装请求对象-具体描述见控制台-文档部分内容 SendSmsRequest request = new SendSmsRequest(); // 必填:待发送手机号 request.setPhoneNumbers(StringUtils.join(tos, ",")); // 必填:短信签名-可在短信控制台中找到 request.setSignName(signName); // 必填:短信模板-可在短信控制台中找到 request.setTemplateCode(templateCode); // 可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为 request.setTemplateParam(new Gson().toJson(templateParams)); // 选填-上行短信扩展码(无特殊需求用户请忽略此字段) //request.setSmsUpExtendCode("90997"); // 可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者 request.setOutId(outId); // hint 此处可能会抛出异常,注意catch SendSmsResponse response = acsClient.getAcsResponse(request); // BizId: 616622542071657945^0, Code: OK, Message: OK if (null != response && StringUtils.equals("OK", response.getCode())) { return response.getBizId(); } } catch (ClientException e) { e.printStackTrace(); } return null; } }
923ab6d03e9b8bb03307e31f28d823c70bf8b505
7,428
java
Java
core/src/main/java/dev/lyze/retro/game/Assets.java
lyze237/On-Guard
1fb502b0d985bd43e613f40e47cbf5868731dc8f
[ "Apache-2.0" ]
7
2020-06-26T20:38:16.000Z
2021-12-18T12:46:43.000Z
core/src/main/java/dev/lyze/retro/game/Assets.java
lyze237/On-Guard
1fb502b0d985bd43e613f40e47cbf5868731dc8f
[ "Apache-2.0" ]
null
null
null
core/src/main/java/dev/lyze/retro/game/Assets.java
lyze237/On-Guard
1fb502b0d985bd43e613f40e47cbf5868731dc8f
[ "Apache-2.0" ]
2
2020-09-10T00:13:18.000Z
2021-12-16T10:49:15.000Z
40.369565
196
0.704227
999,315
package dev.lyze.retro.game; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.maps.tiled.TiledMap; import com.badlogic.gdx.maps.tiled.TmxMapLoader; import com.badlogic.gdx.utils.Array; import lombok.Getter; import lombok.Setter; import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.stream.Collectors; public class Assets { private final AssetManager assMan = new AssetManager(); private static final String ATLAS_PATH = "atlas/atlas.atlas"; private static final String GAMEBOY_FONT_PATH = "fonts/EarlyGameBoy.fnt"; private static final String NUMBERS_FONT_PATH = "fonts/Numbers.fnt"; public static final String[] MAP_PATHS = new String[] { "maps/Map1.tmx", "maps/Map2.tmx", "maps/Map3.tmx", "maps/Map4.tmx" }; public static final String[] MELEE_SOUND_PATHS = new String[] { "sounds/Sword 1.ogg", "sounds/Sword 2.ogg" }; public static final String[] RANGED_SOUND_PATHS = new String[] { "sounds/Action Misc 8.ogg" }; public static final String[] COIN_SOUND_PATHS = new String[] { "sounds/Coin 1.ogg", "sounds/Coin 2.ogg" }; public static final String[] WIN_SOUND_PATHS = new String[] { "sounds/Coin Total Win.ogg", "sounds/Coin Total Win 2.ogg" }; public static final String[] BUY_SOUND_PATHS = new String[] { "sounds/Extra Life.ogg" }; public static final String[] UPGRADE_SOUND_PATHS = new String[] { "sounds/Power Up 1.ogg", "sounds/Power Up 2.ogg", "sounds/Power Up 3.ogg", "sounds/Power Up 4.ogg", "sounds/Power Up 5.ogg" }; public static final String[] POTION_SOUND_PATH = new String[] { "sounds/Magic Dark.ogg" }; public static final String MAIN_MENU_MUSIC_PATH = "music/BoosterTitle.ogg"; public static final String GAME_MUSIC_PATH = "music/BoosterLevel_1.ogg"; @Getter private Array<TextureAtlas.AtlasRegion> snakeUnit; @Getter private Array<TextureAtlas.AtlasRegion> samuraiUnit; @Getter private Array<TextureAtlas.AtlasRegion> guardUnit; @Getter private Array<TextureAtlas.AtlasRegion> mageUnit; @Getter private BitmapFont gameboyFont, numbersFont; @Getter private TextureAtlas.AtlasRegion hitParticle, rangedAttackParticle; private TextureAtlas atlas; @Getter private List<TiledMap> maps; @Getter private List<Sound> meleeSounds, rangedSounds, coinSounds, winSounds, buyButtonSounds, upgradeButtonSounds, abilityButtonSounds; @Getter @Setter private boolean soundMuted; @Getter private TextureAtlas.AtlasRegion mainMenuBackground, gameOverButton; @Getter private Music mainMenuMusic, gameMenuMusic; @Getter private Array<TextureAtlas.AtlasRegion> lyze; public Assets() { setupAssetManager(); extractTextureRegions(); setupAssets(); } private void setupAssets() { maps = Arrays.stream(MAP_PATHS).map(map -> assMan.get(map, TiledMap.class)).collect(Collectors.toList()); gameboyFont = assMan.get(GAMEBOY_FONT_PATH); numbersFont = assMan.get(NUMBERS_FONT_PATH); mainMenuMusic = assMan.get(MAIN_MENU_MUSIC_PATH); mainMenuMusic.setLooping(true); mainMenuMusic.setVolume(0.5f); gameMenuMusic = assMan.get(GAME_MUSIC_PATH); gameMenuMusic.setLooping(true); gameMenuMusic.setVolume(0.5f); } private void setupAssetManager() { assMan.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver())); Arrays.stream(MAP_PATHS).forEach(map -> assMan.load(map, TiledMap.class)); assMan.load(ATLAS_PATH, TextureAtlas.class); assMan.load(GAMEBOY_FONT_PATH, BitmapFont.class); assMan.load(NUMBERS_FONT_PATH, BitmapFont.class); Arrays.stream(MELEE_SOUND_PATHS).forEach(sound -> assMan.load(sound, Sound.class)); Arrays.stream(RANGED_SOUND_PATHS).forEach(sound -> assMan.load(sound, Sound.class)); Arrays.stream(COIN_SOUND_PATHS).forEach(sound -> assMan.load(sound, Sound.class)); Arrays.stream(WIN_SOUND_PATHS).forEach(sound -> assMan.load(sound, Sound.class)); Arrays.stream(BUY_SOUND_PATHS).forEach(sound -> assMan.load(sound, Sound.class)); Arrays.stream(UPGRADE_SOUND_PATHS).forEach(sound -> assMan.load(sound, Sound.class)); Arrays.stream(POTION_SOUND_PATH).forEach(sound -> assMan.load(sound, Sound.class)); assMan.load(MAIN_MENU_MUSIC_PATH, Music.class); assMan.load(GAME_MUSIC_PATH, Music.class); assMan.finishLoading(); } private void extractTextureRegions() { atlas = assMan.get(ATLAS_PATH, TextureAtlas.class); snakeUnit = atlas.findRegions("Units/Snake/Snake_move"); guardUnit = atlas.findRegions("Units/Guard/Guard_move"); samuraiUnit = atlas.findRegions("Units/Samurai/Samurai_move"); mageUnit = atlas.findRegions("Units/Mage/Mage_move"); hitParticle = atlas.findRegion("Particles/Hit"); rangedAttackParticle = atlas.findRegion("Particles/Ranged_Attack"); mainMenuBackground = atlas.findRegion("MainMenu/MainMenu"); gameOverButton = atlas.findRegion("MainMenu/GameOver"); lyze = atlas.findRegions("MainMenu/Lyze"); meleeSounds = Arrays.stream(MELEE_SOUND_PATHS).map(sound -> assMan.get(sound, Sound.class)).collect(Collectors.toList()); rangedSounds = Arrays.stream(RANGED_SOUND_PATHS).map(sound -> assMan.get(sound, Sound.class)).collect(Collectors.toList()); coinSounds = Arrays.stream(COIN_SOUND_PATHS).map(sound -> assMan.get(sound, Sound.class)).collect(Collectors.toList()); winSounds = Arrays.stream(WIN_SOUND_PATHS).map(sound -> assMan.get(sound, Sound.class)).collect(Collectors.toList()); buyButtonSounds = Arrays.stream(BUY_SOUND_PATHS).map(sound -> assMan.get(sound, Sound.class)).collect(Collectors.toList()); upgradeButtonSounds = Arrays.stream(UPGRADE_SOUND_PATHS).map(sound -> assMan.get(sound, Sound.class)).collect(Collectors.toList()); abilityButtonSounds = Arrays.stream(POTION_SOUND_PATH).map(sound -> assMan.get(sound, Sound.class)).collect(Collectors.toList()); } public <T> T get (String fileName) { return assMan.get(fileName); } public <T> T get(String fileName, Class<T> type) { return assMan.get(fileName, type); } public TextureAtlas.AtlasRegion getRegion(String path) { var region = atlas.findRegion(path); if (region == null) throw new IllegalArgumentException("Unknown path " + path); return region; } public Array<TextureAtlas.AtlasRegion> getRegions(String path) { var regions = atlas.findRegions(path); if (regions == null) throw new IllegalArgumentException("Unknown path " + path); return regions; } private final Random random = new Random(); public void playRandomSound(List<Sound> sounds) { if (!soundMuted) sounds.get(random.nextInt(sounds.size())).play(0.2f); } public void playMusic(Music music) { mainMenuMusic.stop(); gameMenuMusic.stop(); if (!soundMuted) music.play(); } }
923ab7bbd602453a95fffbde0b972e38c0a14704
2,906
java
Java
org/apache/xerces/impl/dtd/XMLContentSpec.java
MewX/contendo-viewer-v1.6.3
69fba3cea4f9a43e48f43148774cfa61b388e7de
[ "Apache-2.0" ]
2
2021-07-16T10:43:25.000Z
2021-12-15T13:54:10.000Z
org/apache/xerces/impl/dtd/XMLContentSpec.java
MewX/contendo-viewer-v1.6.3
69fba3cea4f9a43e48f43148774cfa61b388e7de
[ "Apache-2.0" ]
1
2021-10-12T22:24:55.000Z
2021-10-12T22:24:55.000Z
org/apache/xerces/impl/dtd/XMLContentSpec.java
MewX/contendo-viewer-v1.6.3
69fba3cea4f9a43e48f43148774cfa61b388e7de
[ "Apache-2.0" ]
null
null
null
29.06
134
0.726772
999,316
package org.apache.xerces.impl.dtd; public class XMLContentSpec { public static final short CONTENTSPECNODE_LEAF = 0; public static final short CONTENTSPECNODE_ZERO_OR_ONE = 1; public static final short CONTENTSPECNODE_ZERO_OR_MORE = 2; public static final short CONTENTSPECNODE_ONE_OR_MORE = 3; public static final short CONTENTSPECNODE_CHOICE = 4; public static final short CONTENTSPECNODE_SEQ = 5; public static final short CONTENTSPECNODE_ANY = 6; public static final short CONTENTSPECNODE_ANY_OTHER = 7; public static final short CONTENTSPECNODE_ANY_LOCAL = 8; public static final short CONTENTSPECNODE_ANY_LAX = 22; public static final short CONTENTSPECNODE_ANY_OTHER_LAX = 23; public static final short CONTENTSPECNODE_ANY_LOCAL_LAX = 24; public static final short CONTENTSPECNODE_ANY_SKIP = 38; public static final short CONTENTSPECNODE_ANY_OTHER_SKIP = 39; public static final short CONTENTSPECNODE_ANY_LOCAL_SKIP = 40; public short type; public Object value; public Object otherValue; public XMLContentSpec() { clear(); } public XMLContentSpec(short paramShort, Object paramObject1, Object paramObject2) { setValues(paramShort, paramObject1, paramObject2); } public XMLContentSpec(XMLContentSpec paramXMLContentSpec) { setValues(paramXMLContentSpec); } public XMLContentSpec(Provider paramProvider, int paramInt) { setValues(paramProvider, paramInt); } public void clear() { this.type = -1; this.value = null; this.otherValue = null; } public void setValues(short paramShort, Object paramObject1, Object paramObject2) { this.type = paramShort; this.value = paramObject1; this.otherValue = paramObject2; } public void setValues(XMLContentSpec paramXMLContentSpec) { this.type = paramXMLContentSpec.type; this.value = paramXMLContentSpec.value; this.otherValue = paramXMLContentSpec.otherValue; } public void setValues(Provider paramProvider, int paramInt) { if (!paramProvider.getContentSpec(paramInt, this)) clear(); } public int hashCode() { return this.type << 16 | this.value.hashCode() << 8 | this.otherValue.hashCode(); } public boolean equals(Object paramObject) { if (paramObject != null && paramObject instanceof XMLContentSpec) { XMLContentSpec xMLContentSpec = (XMLContentSpec)paramObject; return (this.type == xMLContentSpec.type && this.value == xMLContentSpec.value && this.otherValue == xMLContentSpec.otherValue); } return false; } public static interface Provider { boolean getContentSpec(int param1Int, XMLContentSpec param1XMLContentSpec); } } /* Location: /mnt/r/ConTenDoViewer.jar!/org/apache/xerces/impl/dtd/XMLContentSpec.class * Java compiler version: 3 (47.0) * JD-Core Version: 1.1.3 */
923ab7f98fa57a6942e8d98e60ab5160f1cdaec9
248
java
Java
Ruter/src/ruter/map/MapComponent.java
cjortegon/Ruter
069061d1cc4267bda7252225a5909a50920e3cd0
[ "MIT" ]
null
null
null
Ruter/src/ruter/map/MapComponent.java
cjortegon/Ruter
069061d1cc4267bda7252225a5909a50920e3cd0
[ "MIT" ]
null
null
null
Ruter/src/ruter/map/MapComponent.java
cjortegon/Ruter
069061d1cc4267bda7252225a5909a50920e3cd0
[ "MIT" ]
null
null
null
15.5
52
0.689516
999,317
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ruter.map; /** * * @author camilo */ public interface MapComponent { public abstract double getX(); public abstract double getY(); }
923ab7fcd0fb6eb558c07bc5b3dd6ce8b5d04f03
223
java
Java
src/main/java/net/stormdev/mario/powerups/TrackingShell.java
BGHDDevelopment/mariokart-source
91d497f43a55189228b0a09415e34ceef4a56a1e
[ "MIT" ]
null
null
null
src/main/java/net/stormdev/mario/powerups/TrackingShell.java
BGHDDevelopment/mariokart-source
91d497f43a55189228b0a09415e34ceef4a56a1e
[ "MIT" ]
null
null
null
src/main/java/net/stormdev/mario/powerups/TrackingShell.java
BGHDDevelopment/mariokart-source
91d497f43a55189228b0a09415e34ceef4a56a1e
[ "MIT" ]
null
null
null
20.272727
46
0.793722
999,318
package net.stormdev.mario.powerups; import org.bukkit.util.Vector; public interface TrackingShell extends Shell { public void setTarget(String player); public String getTarget(); public Vector calculateVelocity(); }
923ab99a83d7c88f2ec2d72b4ee30a394cc24d8c
316
java
Java
hummer-cluster/cluster-raft/src/main/java/org/enast/hummer/cluster/raft/server/AbstractSocketServer.java
Enast/hummer
370a415d9d229e1f703f81f825a1bcc53e559bed
[ "Apache-2.0" ]
2
2020-06-05T09:01:06.000Z
2021-09-28T15:20:50.000Z
hummer-cluster/cluster-raft/src/main/java/org/enast/hummer/cluster/raft/server/AbstractSocketServer.java
HendSame/hummer
abb556ee2976f884699e995c58071726042951c7
[ "Apache-2.0" ]
4
2020-05-20T13:27:28.000Z
2022-02-27T10:15:15.000Z
hummer-cluster/cluster-raft/src/main/java/org/enast/hummer/cluster/raft/server/AbstractSocketServer.java
HendSame/hummer
abb556ee2976f884699e995c58071726042951c7
[ "Apache-2.0" ]
1
2020-05-07T15:37:11.000Z
2020-05-07T15:37:11.000Z
19.75
68
0.699367
999,319
package org.enast.hummer.cluster.raft.server; /** * @author zhujinming6 * @create 2020-05-08 16:25 * @update 2020-05-08 16:25 **/ public abstract class AbstractSocketServer implements SocketServer { protected Integer port; public AbstractSocketServer(Integer port) { this.port = port; } }
923ab9a9eadf1bf98dff9d2ace83e227de23f516
2,831
java
Java
extras/zjb-image-loader/src/main/java/com/zjb/loader/internal/utils/DiskCacheUtils.java
airen3339/Android-Application-ZJB
224d41664fc6e01cadd5a05a9a1aa54174c14859
[ "Apache-2.0" ]
356
2016-09-22T01:27:46.000Z
2022-01-31T13:06:33.000Z
extras/zjb-image-loader/src/main/java/com/zjb/loader/internal/utils/DiskCacheUtils.java
airen3339/Android-Application-ZJB
224d41664fc6e01cadd5a05a9a1aa54174c14859
[ "Apache-2.0" ]
15
2016-09-22T03:49:42.000Z
2019-01-24T14:53:49.000Z
extras/zjb-image-loader/src/main/java/com/zjb/loader/internal/utils/DiskCacheUtils.java
airen3339/Android-Application-ZJB
224d41664fc6e01cadd5a05a9a1aa54174c14859
[ "Apache-2.0" ]
125
2016-09-22T01:27:47.000Z
2021-03-31T14:07:40.000Z
33.305882
100
0.582833
999,320
/******************************************************************************* * Copyright 2011-2014 Sergey Tarasevich * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.zjb.loader.internal.utils; import android.text.TextUtils; import java.io.File; import com.zjb.loader.internal.cache.disc.DiskCache; /** * Utility for convenient work with disk cache.<br /> * <b>NOTE:</b> This utility works with file system so avoid using it on application main thread. * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.8.0 */ public final class DiskCacheUtils { private DiskCacheUtils() { } /** * Returns {@link File} of cached image or <b>null</b> if image was not cached in disk cache */ public static File findInCache(String imageUri, DiskCache diskCache) { File image = diskCache.get(imageUri); return image != null && image.exists() ? image : null; } /** * Removed cached image file from disk cache (if image was cached in disk cache before) * * @return <b>true</b> - if cached image file existed and was deleted; <b>false</b> - otherwise. */ public static boolean removeFromCache(String imageUri, DiskCache diskCache) { File image = diskCache.get(imageUri); return image != null && image.exists() && image.delete(); } /** * 根据宽高信息将原来的url转变成?width=1080&height=1920 * * @param url 原来的url * @param width 缓存的宽度 * @param height 缓存的高度 * @return 添加宽高信息的url */ public static String encodeURL(String url, int width, int height) { if (TextUtils.isEmpty(url)) { return ""; } if (width <= 0 && height <= 0) { return url; } StringBuilder builder = new StringBuilder(url); if (!builder.toString().contains("?")) { builder.append("?"); } url = builder.toString(); if (!url.endsWith("&") && !url.endsWith("?")) { builder.append("&"); } builder.append("width=") .append(width) .append("&") .append("height=") .append(height); return builder.toString(); } }
923abaab7e77e15bb6ab6e979e298fc7c34a37be
671
java
Java
engine/src/main/java/app/dassana/core/runmanager/launch/api/Application.java
varunsh-coder/dassana
fae1de20c7acdd10c9940f6cff3785943ba7f1f1
[ "Apache-2.0" ]
45
2021-08-03T00:35:10.000Z
2022-03-31T05:51:49.000Z
engine/src/main/java/app/dassana/core/runmanager/launch/api/Application.java
varunsh-coder/dassana
fae1de20c7acdd10c9940f6cff3785943ba7f1f1
[ "Apache-2.0" ]
454
2021-08-02T22:56:48.000Z
2021-12-20T21:09:44.000Z
engine/src/main/java/app/dassana/core/runmanager/launch/api/Application.java
varunsh-coder/dassana
fae1de20c7acdd10c9940f6cff3785943ba7f1f1
[ "Apache-2.0" ]
9
2021-09-02T04:52:19.000Z
2021-12-22T18:11:52.000Z
30.5
76
0.819672
999,321
package app.dassana.core.runmanager.launch.api; import com.amazonaws.serverless.exceptions.ContainerInitializationException; import io.micronaut.context.ApplicationContextBuilder; import io.micronaut.function.aws.proxy.MicronautLambdaHandler; import io.micronaut.runtime.Micronaut; public class Application extends MicronautLambdaHandler { public Application() throws ContainerInitializationException { } public Application(ApplicationContextBuilder applicationContextBuilder) throws ContainerInitializationException { super(applicationContextBuilder); } public static void main(String[] args) { Micronaut.run(Application.class, args); } }
923abad48b9586f55a3e5622688d83b7e51c8e74
1,453
java
Java
src/main/java/cc/mrbird/common/controller/CommonController.java
xutong3/bsds
aee51b409bd0d9880494df5d681fecc514b23fd2
[ "Apache-2.0" ]
2
2019-09-04T21:23:57.000Z
2020-01-08T04:14:55.000Z
src/main/java/cc/mrbird/common/controller/CommonController.java
liangzuan1983/FEBS-CAN-USE
f0f11f1d5a4519d0ed95f2979ff243acf53eb3e4
[ "Apache-2.0" ]
5
2020-12-21T16:59:17.000Z
2022-02-09T22:19:46.000Z
src/main/java/cc/mrbird/common/controller/CommonController.java
liangzuan1983/FEBS-CAN-USE
f0f11f1d5a4519d0ed95f2979ff243acf53eb3e4
[ "Apache-2.0" ]
1
2020-07-09T16:59:15.000Z
2020-07-09T16:59:15.000Z
31.586957
99
0.736407
999,322
package cc.mrbird.common.controller; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.OutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.util.ResourceUtils; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class CommonController { @RequestMapping("common/download") public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) { String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); try { response.setCharacterEncoding("utf-8"); response.setContentType("multipart/form-data"); response.setHeader("Content-Disposition", "attachment;fileName=" + java.net.URLEncoder.encode(realFileName, "utf-8")); String filePath = ResourceUtils.getURL("classpath:").getPath() + "static/file/" + fileName; File file = new File(filePath); InputStream inputStream = new FileInputStream(file); OutputStream os = response.getOutputStream(); byte[] b = new byte[2048]; int length; while ((length = inputStream.read(b)) > 0) { os.write(b, 0, length); } os.close(); inputStream.close(); if (delete && file.exists()) { file.delete(); } } catch (Exception e) { e.printStackTrace(); } } }
923abb42a9124dd4337818dee385e70f079194e0
1,755
java
Java
src/main/java/com/readbooker/website/controller/BookController.java
Nimmel/book
ef26f16b9cfa3bf2e252af40ad5f373e5bd9f645
[ "Apache-2.0" ]
null
null
null
src/main/java/com/readbooker/website/controller/BookController.java
Nimmel/book
ef26f16b9cfa3bf2e252af40ad5f373e5bd9f645
[ "Apache-2.0" ]
null
null
null
src/main/java/com/readbooker/website/controller/BookController.java
Nimmel/book
ef26f16b9cfa3bf2e252af40ad5f373e5bd9f645
[ "Apache-2.0" ]
null
null
null
30.258621
62
0.776638
999,323
package com.readbooker.website.controller; import com.readbooker.website.model.entity.Book; import com.readbooker.website.model.entity.Chapter; import com.readbooker.website.model.vo.ChapterVo; import com.readbooker.website.model.vo.ResultInfo; import com.readbooker.website.service.BookService; import com.readbooker.website.service.ChapterService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Slf4j @Controller public class BookController { @Autowired private BookService bookService; @Autowired private ChapterService chapterService; // 目录 @RequestMapping("/book/{id}") public String catalogure(Model model,@PathVariable long id){ // 获取书籍信息 Book book = bookService.findBookById(id); model.addAttribute("book",bookService.convertVo(book)); return "catalogue"; } @RequestMapping("/book") public String chapterContent(Model model,long bid,long cid){ // 获取书籍信息 Book book = bookService.findBookById(bid); model.addAttribute("book",bookService.convertVo(book)); Chapter chapter = chapterService.getChapterById(cid); ChapterVo cvo = new ChapterVo().convertFrom(chapter); cvo.setContent(chapterService.getContentByChapterId(cid)); model.addAttribute("chapter",cvo); return "content"; } //@PathVariable long bookId @RequestMapping("/book/lastUpdate") public ResultInfo lastUpdate() { return null; } }
923abb7d4c2c97f7eb7f5e8eceac9c4029aca432
1,589
java
Java
src/java/org/tensorics/core/tensor/options/ShapingStrategy.java
Anlon-Burke/tensorics-core
ccb9a31b161ac7ca009bb35a18b0d13053477818
[ "Apache-2.0" ]
14
2015-10-28T08:43:21.000Z
2020-09-16T15:59:56.000Z
src/java/org/tensorics/core/tensor/options/ShapingStrategy.java
Anlon-Burke/tensorics-core
ccb9a31b161ac7ca009bb35a18b0d13053477818
[ "Apache-2.0" ]
38
2015-11-21T15:30:18.000Z
2020-11-11T23:03:56.000Z
src/java/org/tensorics/core/tensor/options/ShapingStrategy.java
Anlon-Burke/tensorics-core
ccb9a31b161ac7ca009bb35a18b0d13053477818
[ "Apache-2.0" ]
6
2015-10-28T08:43:35.000Z
2020-08-18T20:30:05.000Z
34.543478
118
0.633103
999,324
// @formatter:off /******************************************************************************* * * This file is part of tensorics. * * Copyright (c) 2008-2011, CERN. 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. * ******************************************************************************/ // @formatter:on package org.tensorics.core.tensor.options; import org.tensorics.core.commons.options.ManipulationOption; import org.tensorics.core.tensor.Shape; import org.tensorics.core.tensor.Tensor; /** * Strategy for deciding on the shape of resulting tensor from the shapes of two tensors used for a binary operation. * * @author agorzaws */ public interface ShapingStrategy extends ManipulationOption { /** * Resulting tensor shape of given two in following formula: FIRST_TENSOR_SHAPE on SECOND_TENSOR_SHAPE * * @param first tensor * @param second tensor * @return resulting shape */ <C> Shape shapeLeftRight(Tensor<?> first, Tensor<?> second); }
923abc4ad110641de500b40b3f4360cc2f0c1610
120
java
Java
src/module/search/ASFSearch.java
max3584/AccountSave
455b77d76d51d89f98745abf64408b32358abb81
[ "MIT" ]
null
null
null
src/module/search/ASFSearch.java
max3584/AccountSave
455b77d76d51d89f98745abf64408b32358abb81
[ "MIT" ]
null
null
null
src/module/search/ASFSearch.java
max3584/AccountSave
455b77d76d51d89f98745abf64408b32358abb81
[ "MIT" ]
null
null
null
15
56
0.833333
999,325
package module.search; import module.AccountSqlFormatter; public interface ASFSearch extends AccountSqlFormatter { }
923abce7b54462bd10dda77dfc7baeed068a7028
2,266
java
Java
src/main/java/com/iplante/imdb/cast/seeder/DatabaseSeeder.java
iplantemn/imdb-cast-api
76e36a69462069490cb7baee45f7f1f754ba599c
[ "Unlicense" ]
null
null
null
src/main/java/com/iplante/imdb/cast/seeder/DatabaseSeeder.java
iplantemn/imdb-cast-api
76e36a69462069490cb7baee45f7f1f754ba599c
[ "Unlicense" ]
null
null
null
src/main/java/com/iplante/imdb/cast/seeder/DatabaseSeeder.java
iplantemn/imdb-cast-api
76e36a69462069490cb7baee45f7f1f754ba599c
[ "Unlicense" ]
null
null
null
30.213333
96
0.655781
999,326
package com.iplante.imdb.cast.seeder; import com.iplante.imdb.cast.entity.Cast; import com.iplante.imdb.cast.service.CastService; import com.iplante.imdb.cast.util.RandomUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.IntStream; /** * On app startup, seed the database if necessary. * * @author Isabelle Plante * @version 1 * @since 8/26/20 */ @Component public class DatabaseSeeder { private static final Logger LOGGER = Logger.getLogger(String.valueOf(DatabaseSeeder.class)); private final CastService castService; @Autowired public DatabaseSeeder(CastService castService) { this.castService = castService; } @EventListener public void seed(ContextRefreshedEvent event) { if (castService.getCastCount() == 0) { LOGGER.info("Seeding database"); populateCastTable(2000); LOGGER.info("Done seeding database"); } else { LOGGER.info("Database already contains data - skipping seeding step"); } } /** * Populate the {@link Cast} table with a given amount of rows. * * @param seed the number of {@link Cast} entries to generate. */ private void populateCastTable(int seed) { final var cast = IntStream .range(0, seed) .mapToObj(this::generateCastMember) .collect(Collectors.toList()); castService.addCast(cast); } /** * Generate a {@link Cast} object with random data. * * @param num ignored parameter. * @return a {@link Cast} member. */ private Cast generateCastMember(int num) { return Cast .builder() .firstName(RandomUtil.generateRandomString(6, 12)) .lastName(RandomUtil.generateRandomString(6, 12)) .dateOfBirth(RandomUtil.generateRandomDate(1930, 2010)) .bio(RandomUtil.generateRandomString(20, 100)) .build(); } }
923abd4a8f646f59d80fccfdb85a596f1873cb26
5,454
java
Java
databuter/src/main/java/databute/databuter/Databuter.java
ghkim3221/databuter
65758db5c0fece479e3e982df8cad7db01b7a11b
[ "MIT" ]
3
2019-07-24T14:05:54.000Z
2019-08-06T02:06:44.000Z
databuter/src/main/java/databute/databuter/Databuter.java
ghkim3221/databuter
65758db5c0fece479e3e982df8cad7db01b7a11b
[ "MIT" ]
68
2019-07-15T11:10:29.000Z
2021-01-06T04:40:23.000Z
databuter/src/main/java/databute/databuter/Databuter.java
ghkim3221/databuter
65758db5c0fece479e3e982df8cad7db01b7a11b
[ "MIT" ]
4
2019-07-15T06:49:23.000Z
2020-07-14T14:41:33.000Z
34.961538
119
0.727173
999,327
package databute.databuter; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import databute.databuter.bucket.BucketCoordinator; import databute.databuter.bucket.BucketException; import databute.databuter.bucket.BucketGroup; import databute.databuter.bucket.SharedKeyFactorException; import databute.databuter.client.ClientConfiguration; import databute.databuter.client.network.ClientSessionAcceptor; import databute.databuter.client.network.ClientSessionGroup; import databute.databuter.cluster.ClusterCoordinator; import databute.databuter.cluster.ClusterException; import databute.databuter.entry.EntryMessageDispatcher; import databute.databuter.network.Endpoint; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.retry.ExponentialBackoffRetry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.file.Path; import java.nio.file.Paths; import java.time.Instant; import java.util.UUID; public final class Databuter { private static final Logger logger = LoggerFactory.getLogger(Databuter.class); private static final Databuter instance = new Databuter(); private DatabuterConfiguration configuration; private CuratorFramework curator; private ClusterCoordinator clusterCoordinator; private BucketCoordinator bucketCoordinator; private ClientSessionAcceptor clientAcceptor; private final String id; private final BucketGroup bucketGroup; private final ClientSessionGroup clientSessionGroup; private final EntryMessageDispatcher entryMessageDispatcher; private Databuter() { this.id = UUID.randomUUID().toString(); this.bucketGroup = new BucketGroup(); this.clientSessionGroup = new ClientSessionGroup(); this.entryMessageDispatcher = new EntryMessageDispatcher(); } public static Databuter instance() { return instance; } public String id() { return id; } public BucketGroup bucketGroup() { return bucketGroup; } public ClientSessionGroup clientSessionGroup() { return clientSessionGroup; } public EntryMessageDispatcher entryMessageDispatcher() { return entryMessageDispatcher; } public DatabuterConfiguration configuration() { return configuration; } public CuratorFramework curator() { return curator; } public ClusterCoordinator clusterCoordinator() { return clusterCoordinator; } public BucketCoordinator bucketCoordinator() { return bucketCoordinator; } private void start() throws Exception { logger.info("Starting Databuter at {}", Instant.now()); loadConfiguration(); connectToZooKeeper(); startBucketCoordinator(); startClusterCoordinator(); bindClientAcceptor(); } private void loadConfiguration() throws IOException { logger.debug("Loading configuration..."); final ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); final Path configurationPath = Paths.get(DatabuterConstants.CONFIGURATION_PATH); final File configurationFile = configurationPath.toFile(); configuration = mapper.readValue(configurationFile, DatabuterConfiguration.class); logger.info("Loaded configuration from {}", configurationPath.toAbsolutePath()); logger.debug("Loaded configuration: {}", configuration); } private void connectToZooKeeper() throws InterruptedException { final int baseSleepTimeMs = configuration.zooKeeper().baseSleepTimeMs(); final int maxRetries = configuration.zooKeeper().maxRetries(); curator = CuratorFrameworkFactory.builder() .connectString(configuration.zooKeeper().connectString()) .retryPolicy(new ExponentialBackoffRetry(baseSleepTimeMs, maxRetries)) .build(); curator.start(); curator.blockUntilConnected(); logger.debug("Connected with the ZooKeeper at {}.", curator.getZookeeperClient().getCurrentConnectionString()); } private void startBucketCoordinator() throws BucketException, SharedKeyFactorException { bucketCoordinator = new BucketCoordinator(); bucketCoordinator.start(); } private void startClusterCoordinator() throws ClusterException { clusterCoordinator = new ClusterCoordinator(configuration.cluster(), id); clusterCoordinator.start(); } private void bindClientAcceptor() { final ClientConfiguration clientConfiguration = configuration.client(); final Endpoint clientEndpoint = clientConfiguration.endpoint(); final String address = clientEndpoint.address(); final int port = clientEndpoint.port(); final InetSocketAddress localAddress = new InetSocketAddress(address, port); clientAcceptor = new ClientSessionAcceptor(); clientAcceptor.bind(localAddress).join(); logger.debug("Client session acceptor is bound on {}", clientAcceptor.localAddress()); } public static void main(String[] args) { try { instance().start(); } catch (Exception e) { logger.error("Failed to start Databuter.", e); } } }
923abf299864ed1df9985c088149508296be936b
1,535
java
Java
software/cananolab-webapp/src/main/java/gov/nih/nci/cananolab/restful/view/edit/SimpleCell.java
safrant/cananolab
48c2f1219a14e956e327f016063d440bae600a01
[ "BSD-3-Clause" ]
3
2017-02-15T19:13:43.000Z
2021-12-20T16:02:55.000Z
software/cananolab-webapp/src/main/java/gov/nih/nci/cananolab/restful/view/edit/SimpleCell.java
safrant/cananolab
48c2f1219a14e956e327f016063d440bae600a01
[ "BSD-3-Clause" ]
1
2021-11-30T16:31:06.000Z
2021-11-30T16:31:06.000Z
software/cananolab-webapp/src/main/java/gov/nih/nci/cananolab/restful/view/edit/SimpleCell.java
safrant/cananolab
48c2f1219a14e956e327f016063d440bae600a01
[ "BSD-3-Clause" ]
4
2017-04-18T20:54:33.000Z
2022-02-12T00:09:14.000Z
23.984375
60
0.715961
999,328
package gov.nih.nci.cananolab.restful.view.edit; import gov.nih.nci.cananolab.dto.common.table.TableCell; import java.util.Date; public class SimpleCell { String value; String datumOrCondition; //private Datum datum = new Datum(); //private Condition condition = new Condition(); Integer columnOrder; Date createdDate; String operand; public void transferFromTableCell(TableCell cell) { if (cell == null) return; value = cell.getValue(); datumOrCondition = cell.getDatumOrCondition(); columnOrder = cell.getColumnOrder(); operand = cell.getOperand(); } public void transferToTableCell(TableCell cell) { cell.setColumnOrder(columnOrder); cell.setDatumOrCondition(datumOrCondition); cell.setValue(value); cell.setOperand(operand); } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String getDatumOrCondition() { return datumOrCondition; } public void setDatumOrCondition(String datumOrCondition) { this.datumOrCondition = datumOrCondition; } public Integer getColumnOrder() { return columnOrder; } public void setColumnOrder(Integer columnOrder) { this.columnOrder = columnOrder; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public String getOperand() { return operand; } public void setOperand(String operand){ this.operand = operand; } }
923ac018dea43407e928e39ae5b8dcae8f50e14f
1,080
java
Java
jrandomizer/src/main/java/com/infoedge/jrandomizer/annotations/RowNumber.java
android-Infoedge/randomizer
27bbe6879d4a4fa555c0c3962498e82b2d536d40
[ "Apache-2.0" ]
77
2016-09-30T08:18:37.000Z
2022-03-05T07:10:43.000Z
jrandomizer/src/main/java/com/infoedge/jrandomizer/annotations/RowNumber.java
anvesh523/randomizer
27bbe6879d4a4fa555c0c3962498e82b2d536d40
[ "Apache-2.0" ]
2
2017-07-26T21:33:26.000Z
2021-03-28T11:16:58.000Z
jrandomizer/src/main/java/com/infoedge/jrandomizer/annotations/RowNumber.java
anvesh523/randomizer
27bbe6879d4a4fa555c0c3962498e82b2d536d40
[ "Apache-2.0" ]
16
2016-10-17T05:39:03.000Z
2022-01-12T01:21:49.000Z
38.571429
79
0.77963
999,329
package com.infoedge.jrandomizer.annotations; import com.infoedge.jrandomizer.adapters.LongToIntAdapter; import com.infoedge.jrandomizer.adapters.LongToLongAdapter; import com.infoedge.jrandomizer.adapters.LongToStringAdapter; import com.infoedge.jrandomizer.generators.RowNumberGenerator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created by gagandeep on 28/7/16. */ @GenerateUsing(generator = RowNumberGenerator.class,mapping = { @Mapping(fieldType = Integer.class, adapter = LongToIntAdapter.class), @Mapping(fieldType = int.class, adapter = LongToIntAdapter.class), @Mapping(fieldType = Long.class, adapter = LongToLongAdapter.class), @Mapping(fieldType = long.class, adapter = LongToLongAdapter.class), @Mapping(fieldType = String.class, adapter = LongToStringAdapter.class) }) @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface RowNumber { long startFrom() default 0; }
923ac02a29f30bc4b27b515696c32a980a738166
1,916
java
Java
src/main/java/org/sagebionetworks/web/client/widget/entity/browse/EntityTreeBrowserView.java
marcomarasca/SynapseWebClient
d641b0e129dc5c73bac30f9096abd98d38fb2a9d
[ "Apache-2.0" ]
11
2015-04-06T06:06:12.000Z
2022-03-21T20:12:28.000Z
src/main/java/org/sagebionetworks/web/client/widget/entity/browse/EntityTreeBrowserView.java
marcomarasca/SynapseWebClient
d641b0e129dc5c73bac30f9096abd98d38fb2a9d
[ "Apache-2.0" ]
264
2015-01-07T19:12:45.000Z
2022-03-31T21:49:28.000Z
src/main/java/org/sagebionetworks/web/client/widget/entity/browse/EntityTreeBrowserView.java
marcomarasca/SynapseWebClient
d641b0e129dc5c73bac30f9096abd98d38fb2a9d
[ "Apache-2.0" ]
17
2015-01-29T03:16:11.000Z
2022-02-21T22:41:15.000Z
25.891892
106
0.796451
999,330
package org.sagebionetworks.web.client.widget.entity.browse; import org.sagebionetworks.repo.model.entity.Direction; import org.sagebionetworks.repo.model.entity.SortBy; import org.sagebionetworks.web.client.SynapseView; import org.sagebionetworks.web.client.widget.entity.EntityTreeItem; import org.sagebionetworks.web.client.widget.entity.MoreTreeItem; import com.google.gwt.user.client.ui.IsWidget; public interface EntityTreeBrowserView extends IsWidget, SynapseView { /** * Set the presenter. * * @param presenter */ void setPresenter(Presenter presenter); /** * Rather than linking to the Entity Page, a clicked entity in the tree will become selected. */ void makeSelectable(); void clearSelection(); /** * Presenter interface */ public interface Presenter { void onToggleSort(SortBy sortColumn); void setSelection(String id); void expandTreeItemOnOpen(final EntityTreeItem target); void clearRecordsFetchedChildren(); void addMoreButton(MoreTreeItem moreItem, String parentId, EntityTreeItem parent, String nextPageToken); void getChildren(String parentId, EntityTreeItem parent, String nextPageToken); void copyIDsToClipboard(); } void appendRootEntityTreeItem(EntityTreeItem childToAdd); void appendChildEntityTreeItem(EntityTreeItem childToAdd, EntityTreeItem parent); void configureEntityTreeItem(EntityTreeItem childToAdd); void placeChildMoreTreeItem(MoreTreeItem childToCreate, EntityTreeItem parent, String nextPageToken); void placeRootMoreTreeItem(MoreTreeItem childToCreate, String parentId, String nextPageToken); void showEmptyUI(); int getRootCount(); void hideEmptyUI(); void setLoadingVisible(boolean isShown); void setSynAlert(IsWidget w); void setSortable(boolean isSortable); void showMinimalColumnSet(); void clearSortUI(); void setSortUI(SortBy sortBy, Direction dir); void copyToClipboard(String value); }
923ac1d8fa966eaaf44963f4c2cfa98f2c844e54
9,520
java
Java
jargon-core/src/main/java/org/irods/jargon/core/connection/IRODSBasicTCPConnection.java
d-w-moore/jargon
0031fb69acc1fde1f3b89218ec8711a0c25eb934
[ "BSD-3-Clause" ]
21
2015-02-12T19:36:36.000Z
2022-03-29T18:22:08.000Z
jargon-core/src/main/java/org/irods/jargon/core/connection/IRODSBasicTCPConnection.java
d-w-moore/jargon
0031fb69acc1fde1f3b89218ec8711a0c25eb934
[ "BSD-3-Clause" ]
355
2015-01-08T19:10:22.000Z
2022-02-10T15:01:29.000Z
jargon-core/src/main/java/org/irods/jargon/core/connection/IRODSBasicTCPConnection.java
d-w-moore/jargon
0031fb69acc1fde1f3b89218ec8711a0c25eb934
[ "BSD-3-Clause" ]
29
2015-02-17T21:26:04.000Z
2021-09-07T05:30:31.000Z
33.403509
109
0.725315
999,331
package org.irods.jargon.core.connection; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.net.UnknownHostException; import javax.net.ssl.SSLSocket; import org.irods.jargon.core.exception.JargonException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Wraps a connection to the iRODS server described by the given IRODSAccount. * <p> * Jargon services do not directly access the {@code IRODSConnection}, rather, * they use the {@link IRODSMidLevelProtocol IRODSProtocol} interface. * <p> * The connection is confined to one thread, and as such the various methods do * not need to be synchronized. All operations pass through the * {@code IRODScommands} object wrapping this connection, and * {@code IRODSCommands} does maintain synchronized access to operations that * read and write to this connection. * * @author Mike Conway - DICE (www.irods.org) * */ class IRODSBasicTCPConnection extends AbstractConnection { /** * Default constructor that gives the account and pipeline setup information. * <p> * This may be updated a bit later when we implement SSL negotiation for iRODS * 4+. * * @param irodsAccount * {@link IRODSAccount} that defines the connection * @param pipelineConfiguration * {@link PipelineConfiguration} that defines the low level * connection and networking configuration * @param irodsProtocolManager * {@link irodsProtocolManager} that requested this connection * @throws JargonException */ IRODSBasicTCPConnection(final IRODSAccount irodsAccount, final PipelineConfiguration pipelineConfiguration, final IRODSProtocolManager irodsProtocolManager, final IRODSSession irodsSession) throws JargonException { super(irodsAccount, pipelineConfiguration, irodsProtocolManager, irodsSession); } static final Logger log = LoggerFactory.getLogger(IRODSBasicTCPConnection.class); /** * Default constructor that gives the account and pipeline setup information. * This constructor is a special case where you already have a Socket opened to * iRODS, and you want to wrap that socket with the low level iRODS semantics. * An example use case is when you need to to PAM authentication and wrap an * existing iRODS connection with an SSL socket. * <p> * This may be updated a bit later when we implement SSL negotiation for iRODS * 4+. * * @param irodsAccount * {@link IRODSAccount} that defines the connection * @param pipelineConfiguration * {@link PipelineConfiguration} that defines the low level * connection and networking configuration * @param irodsProtocolManager * {@link irodsProtocolManager} that requested this connection * @param socket * {@link Socket} being wrapped in this connection, this allows an * arbitrary connected socket to be wrapped in low level jargon * communication semantics. * @param IRODSession * {@link IRODSSession} associated with this connection * @throws JargonException */ IRODSBasicTCPConnection(final IRODSAccount irodsAccount, final PipelineConfiguration pipelineConfiguration, final IRODSProtocolManager irodsProtocolManager, final Socket socket, final IRODSSession irodsSession) throws JargonException { super(irodsAccount, pipelineConfiguration, irodsProtocolManager, socket, irodsSession); setUpSocketAndStreamsAfterConnection(irodsAccount); if (socket instanceof SSLSocket) { setEncryptionType(EncryptionType.SSL_WRAPPED); } log.debug("socket opened successfully"); } /* * (non-Javadoc) * * @see org.irods.jargon.core.connection.AbstractConnection#connect(org.irods * .jargon.core.connection.IRODSAccount) */ @Override protected void connect(final IRODSAccount irodsAccount) throws JargonException { log.debug("connect()"); if (irodsAccount == null) { throw new IllegalArgumentException("null irodsAccount"); } if (connected) { log.warn("doing connect when already connected!, will bypass connect and proceed"); return; } int attemptCount = 3; for (int i = 0; i < attemptCount; i++) { log.debug("connecting socket to agent"); try { log.debug("normal iRODS connection"); connection = new Socket(); connection.setSoTimeout(getPipelineConfiguration().getIrodsSocketTimeout() * 1000); // time is specified // in seconds if (getPipelineConfiguration().getPrimaryTcpSendWindowSize() > 0) { connection.setSendBufferSize(getPipelineConfiguration().getPrimaryTcpSendWindowSize() * 1024); } if (getPipelineConfiguration().getPrimaryTcpReceiveWindowSize() > 0) { connection.setReceiveBufferSize(getPipelineConfiguration().getPrimaryTcpReceiveWindowSize() * 1024); } connection.setPerformancePreferences( getPipelineConfiguration().getPrimaryTcpPerformancePrefsConnectionTime(), getPipelineConfiguration().getPrimaryTcpPerformancePrefsLatency(), getPipelineConfiguration().getPrimaryTcpPerformancePrefsBandwidth()); InetSocketAddress address = new InetSocketAddress(irodsAccount.getHost(), irodsAccount.getPort()); connection.setKeepAlive(getPipelineConfiguration().isPrimaryTcpKeepAlive()); // assume reuse, nodelay connection.setReuseAddress(true); connection.setTcpNoDelay(false); connection.connect(address); // success, so break out of reconnect loop log.debug("connection to socket made..."); break; } catch (UnknownHostException e) { log.error("exception opening socket to:" + irodsAccount.getHost() + " port:" + irodsAccount.getPort(), e); throw new JargonException(e); } catch (IOException ioe) { if (i < attemptCount - 1) { log.error("IOExeption, sleep and attempt a reconnect", ioe); try { Thread.sleep(1000); } catch (InterruptedException e) { // ignore } } else { log.error("io exception opening socket to:" + irodsAccount.getHost() + " port:" + irodsAccount.getPort(), ioe); throw new JargonException(ioe); } } } setUpSocketAndStreamsAfterConnection(irodsAccount); connected = true; log.debug("socket opened successfully"); } /** * @param irodsAccount * @throws JargonException */ void setUpSocketAndStreamsAfterConnection(final IRODSAccount irodsAccount) throws JargonException { try { int socketTimeout = pipelineConfiguration.getIrodsSocketTimeout(); if (socketTimeout > 0) { log.debug("setting a connection timeout of:{} seconds", socketTimeout); connection.setSoTimeout(socketTimeout * 1000); } /* * Set raw socket i/o buffering per configuration */ if (pipelineConfiguration.getInternalInputStreamBufferSize() <= -1) { log.debug("no buffer on input stream"); irodsInputStream = connection.getInputStream(); } else if (pipelineConfiguration.getInternalInputStreamBufferSize() == 0) { log.debug("default buffer on input stream"); irodsInputStream = new BufferedInputStream(connection.getInputStream()); } else { log.debug("buffer of size:{} on input stream", pipelineConfiguration.getInternalInputStreamBufferSize()); irodsInputStream = new BufferedInputStream(connection.getInputStream(), pipelineConfiguration.getInternalInputStreamBufferSize()); } if (pipelineConfiguration.getInternalOutputStreamBufferSize() <= -1) { log.debug("no buffer on output stream"); irodsOutputStream = connection.getOutputStream(); } else if (pipelineConfiguration.getInternalOutputStreamBufferSize() == 0) { log.debug("default buffer on input stream"); irodsOutputStream = new BufferedOutputStream(connection.getOutputStream()); } else { log.debug("buffer of size:{} on output stream", pipelineConfiguration.getInternalOutputStreamBufferSize()); irodsOutputStream = new BufferedOutputStream(connection.getOutputStream(), pipelineConfiguration.getInternalOutputStreamBufferSize()); } } catch (UnknownHostException e) { log.error("exception opening socket to:" + irodsAccount.getHost() + " port:" + irodsAccount.getPort(), e); throw new JargonException(e); } catch (IOException ioe) { log.error("io exception opening socket to:" + irodsAccount.getHost() + " port:" + irodsAccount.getPort(), ioe); throw new JargonException(ioe); } } /** * */ void closeDownSocketAndEatAnyExceptions() { if (isConnected()) { log.debug("is connected for : {}", toString()); try { connection.close(); } catch (Exception e) { // ignore } connected = false; log.debug("now disconnected"); } } /* * (non-Javadoc) * * @see org.irods.jargon.core.connection.AbstractConnection#shutdown() */ @Override public void shutdown() throws JargonException { log.debug("shutting down connection: {}", connected); closeDownSocketAndEatAnyExceptions(); } /* * (non-Javadoc) * * @see org.irods.jargon.core.connection.AbstractConnection# * obliterateConnectionAndDiscardErrors() */ @Override public void obliterateConnectionAndDiscardErrors() { closeDownSocketAndEatAnyExceptions(); } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("IRODSBasicTCPConnection []"); return builder.toString(); } }
923ac2d926a86216c2a2dfe50d91e6e6719722ad
2,976
java
Java
fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/villager/VillagerTypeHelper.java
actuallyasmartname/fabric
456a81bdbd822aabba3e02caba1eac7703918ff1
[ "Apache-2.0" ]
1,433
2018-11-14T10:51:06.000Z
2022-03-30T09:53:45.000Z
fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/villager/VillagerTypeHelper.java
actuallyasmartname/fabric
456a81bdbd822aabba3e02caba1eac7703918ff1
[ "Apache-2.0" ]
1,663
2018-11-18T08:34:53.000Z
2022-03-29T16:39:17.000Z
fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/villager/VillagerTypeHelper.java
actuallyasmartname/fabric
456a81bdbd822aabba3e02caba1eac7703918ff1
[ "Apache-2.0" ]
465
2018-11-08T00:14:30.000Z
2022-03-27T14:14:25.000Z
39.157895
158
0.763777
999,332
/* * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * 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 net.fabricmc.fabric.api.object.builder.v1.villager; import java.util.Objects; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import net.minecraft.util.Identifier; import net.minecraft.util.registry.RegistryKey; import net.minecraft.village.VillagerProfession; import net.minecraft.village.VillagerType; import net.minecraft.world.biome.Biome; import net.fabricmc.fabric.mixin.object.builder.VillagerTypeAccessor; /** * Utilities related to the creation of {@link VillagerType}s. * Not to be confused with a {@link VillagerProfession}, a villager type defines the appearance of a villager. * * <p>Creation and registration of custom villager types may be done by using {@link VillagerTypeHelper#register(Identifier)}. * * <p>Creation and registration of a villager type does not guarantee villagers of a specific type will be created in a world. * Typically the villager type is bound to a specific group of biomes. * To allow a villager type to be spawned in a specific biome, use {@link VillagerTypeHelper#addVillagerTypeToBiome(RegistryKey, VillagerType)}. * * <p>The texture used for the appearance of the villager is located at {@code assets/IDENTIFIER_NAMESPACE/textures/entity/villager/type/IDENTIFIER_PATH.png}. */ public final class VillagerTypeHelper { private static final Logger LOGGER = LogManager.getLogger(); /** * Creates and registers a new villager type. * * @param id the id of the villager type * @return a new villager type */ public static VillagerType register(Identifier id) { Objects.requireNonNull(id, "Id of villager type cannot be null"); return VillagerTypeAccessor.callRegister(id.toString()); } /** * Sets the biome a villager type can spawn in. * * @param biomeKey the registry key of the biome * @param villagerType the villager type */ public static void addVillagerTypeToBiome(RegistryKey<Biome> biomeKey, VillagerType villagerType) { Objects.requireNonNull(biomeKey, "Biome registry key cannot be null"); Objects.requireNonNull(villagerType, "Villager type cannot be null"); if (VillagerTypeAccessor.getBiomeTypeToIdMap().put(biomeKey, villagerType) != null) { LOGGER.debug("Overriding existing Biome -> VillagerType registration for Biome {}", biomeKey.getValue().toString()); } } private VillagerTypeHelper() { } }
923ac2e83103836a8d4877996c508ce577ed5ba7
4,446
java
Java
test/unit/com/stratio/cassandra/index/query/WildcardConditionTest.java
xsir/stratio-cassandra
f6416b43ad5309083349ad56266450fa8c6a2106
[ "Apache-2.0" ]
177
2015-01-07T14:23:29.000Z
2021-09-17T15:13:25.000Z
test/unit/com/stratio/cassandra/index/query/WildcardConditionTest.java
xsir/stratio-cassandra
f6416b43ad5309083349ad56266450fa8c6a2106
[ "Apache-2.0" ]
44
2015-01-16T05:32:12.000Z
2018-12-23T08:03:50.000Z
test/unit/com/stratio/cassandra/index/query/WildcardConditionTest.java
xsir/stratio-cassandra
f6416b43ad5309083349ad56266450fa8c6a2106
[ "Apache-2.0" ]
35
2015-01-11T16:50:02.000Z
2021-06-27T10:43:28.000Z
40.825688
109
0.707865
999,333
/* * Copyright 2014, Stratio. * * 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.stratio.cassandra.index.query; import com.stratio.cassandra.index.schema.Schema; import com.stratio.cassandra.index.schema.mapping.ColumnMapper; import com.stratio.cassandra.index.schema.mapping.ColumnMapperInet; import com.stratio.cassandra.index.schema.mapping.ColumnMapperInteger; import com.stratio.cassandra.index.schema.mapping.ColumnMapperString; import org.apache.lucene.analysis.en.EnglishAnalyzer; import org.apache.lucene.search.Query; import org.junit.Assert; import org.junit.Test; import java.util.HashMap; import java.util.Map; import static com.stratio.cassandra.index.query.builder.SearchBuilders.query; import static com.stratio.cassandra.index.query.builder.SearchBuilders.wildcard; /** * @author Andres de la Pena <nnheo@example.com> */ public class WildcardConditionTest extends AbstractConditionTest { @Test public void testString() { Map<String, ColumnMapper> map = new HashMap<>(); map.put("name", new ColumnMapperString()); Schema mappers = new Schema(map, null, EnglishAnalyzer.class.getName()); WildcardCondition wildcardCondition = new WildcardCondition(0.5f, "name", "tr*"); Query query = wildcardCondition.query(mappers); Assert.assertNotNull(query); Assert.assertEquals(org.apache.lucene.search.WildcardQuery.class, query.getClass()); org.apache.lucene.search.WildcardQuery luceneQuery = (org.apache.lucene.search.WildcardQuery) query; Assert.assertEquals("name", luceneQuery.getField()); Assert.assertEquals("tr*", luceneQuery.getTerm().text()); Assert.assertEquals(0.5f, query.getBoost(), 0); } @Test(expected = UnsupportedOperationException.class) public void testInteger() { Map<String, ColumnMapper> map = new HashMap<>(); map.put("name", new ColumnMapperInteger(1f)); Schema mappers = new Schema(map, null, EnglishAnalyzer.class.getName()); WildcardCondition wildcardCondition = new WildcardCondition(0.5f, "name", "22*"); wildcardCondition.query(mappers); } @Test public void testInetV4() { Map<String, ColumnMapper> map = new HashMap<>(); map.put("name", new ColumnMapperInet()); Schema mappers = new Schema(map, null, EnglishAnalyzer.class.getName()); WildcardCondition wildcardCondition = new WildcardCondition(0.5f, "name", "192.168.*"); Query query = wildcardCondition.query(mappers); Assert.assertNotNull(query); Assert.assertEquals(org.apache.lucene.search.WildcardQuery.class, query.getClass()); org.apache.lucene.search.WildcardQuery luceneQuery = (org.apache.lucene.search.WildcardQuery) query; Assert.assertEquals("name", luceneQuery.getField()); Assert.assertEquals("192.168.*", luceneQuery.getTerm().text()); Assert.assertEquals(0.5f, query.getBoost(), 0); } @Test public void testInetV6() { Map<String, ColumnMapper> map = new HashMap<>(); map.put("name", new ColumnMapperInet()); Schema mappers = new Schema(map, null, EnglishAnalyzer.class.getName()); WildcardCondition wildcardCondition = new WildcardCondition(0.5f, "name", "2001:db8:2de:0:0:0:0:e*"); Query query = wildcardCondition.query(mappers); Assert.assertNotNull(query); Assert.assertEquals(org.apache.lucene.search.WildcardQuery.class, query.getClass()); org.apache.lucene.search.WildcardQuery luceneQuery = (org.apache.lucene.search.WildcardQuery) query; Assert.assertEquals("name", luceneQuery.getField()); Assert.assertEquals("2001:db8:2de:0:0:0:0:e*", luceneQuery.getTerm().text()); Assert.assertEquals(0.5f, query.getBoost(), 0); } @Test public void testJson() { testJsonCondition(query(wildcard("name", "aaa*").boost(0.5f))); } }
923ac327d68c4d641d71338184ca387be7b54b8e
1,663
java
Java
app/src/main/java/org/gratitude/data/model/response/AllOrganizations.java
justodepp/Capstone-Project
5489a5b3eef8e8b5098be3872d39e07dde29bb81
[ "Apache-2.0" ]
null
null
null
app/src/main/java/org/gratitude/data/model/response/AllOrganizations.java
justodepp/Capstone-Project
5489a5b3eef8e8b5098be3872d39e07dde29bb81
[ "Apache-2.0" ]
null
null
null
app/src/main/java/org/gratitude/data/model/response/AllOrganizations.java
justodepp/Capstone-Project
5489a5b3eef8e8b5098be3872d39e07dde29bb81
[ "Apache-2.0" ]
null
null
null
25.19697
115
0.675887
999,334
package org.gratitude.data.model.response; import android.os.Parcel; import android.os.Parcelable; import com.google.gson.annotations.Expose; import org.gratitude.data.model.organization.Organizations; public class AllOrganizations implements Parcelable { @Expose private Organizations organizations; public Organizations getOrganizations() { return organizations; } public static class Builder { private Organizations organizations; public AllOrganizations.Builder withOrganizations(Organizations organizations) { this.organizations = organizations; return this; } public AllOrganizations build() { AllOrganizations allOrganization = new AllOrganizations(); allOrganization.organizations = organizations; return allOrganization; } } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(this.organizations, flags); } public AllOrganizations() { } protected AllOrganizations(Parcel in) { this.organizations = in.readParcelable(Organizations.class.getClassLoader()); } public static final Parcelable.Creator<AllOrganizations> CREATOR = new Parcelable.Creator<AllOrganizations>() { @Override public AllOrganizations createFromParcel(Parcel source) { return new AllOrganizations(source); } @Override public AllOrganizations[] newArray(int size) { return new AllOrganizations[size]; } }; }
923ac38d3bed2a00e7155a3efcc17b70f58348f8
223
java
Java
src/main/java/io/renren/dao/InMoneyDao.java
FengShaduVIP/renren
b22b64d82bd95c01063cf374b41c2c53a43539ce
[ "Apache-2.0" ]
null
null
null
src/main/java/io/renren/dao/InMoneyDao.java
FengShaduVIP/renren
b22b64d82bd95c01063cf374b41c2c53a43539ce
[ "Apache-2.0" ]
null
null
null
src/main/java/io/renren/dao/InMoneyDao.java
FengShaduVIP/renren
b22b64d82bd95c01063cf374b41c2c53a43539ce
[ "Apache-2.0" ]
null
null
null
14.8
60
0.698198
999,335
package io.renren.dao; import io.renren.entity.InMoneyEntity; /** * * * @author FengShadu * @email upchh@example.com * @date 2017-04-25 22:04:32 */ public interface InMoneyDao extends BaseDao<InMoneyEntity> { }
923ac397cd38fd064eb710d89a96ea6ccce688a3
620
java
Java
java_programs/arrays/ReverseNumber.java
vedantmgoyal2009/winget-pkgs-automation
ee4064bbae0f8a46d0533666579e3194a3cc15af
[ "MIT" ]
26
2021-09-26T08:58:42.000Z
2022-02-21T19:11:52.000Z
java_programs/arrays/ReverseNumber.java
vedantmgoyal2009/winget-pkgs-automation
ee4064bbae0f8a46d0533666579e3194a3cc15af
[ "MIT" ]
169
2021-09-26T08:26:54.000Z
2022-02-23T19:30:39.000Z
java_programs/arrays/ReverseNumber.java
vedantmgoyal2009/winget-pkgs-automation
ee4064bbae0f8a46d0533666579e3194a3cc15af
[ "MIT" ]
13
2021-09-26T20:02:09.000Z
2022-01-27T08:08:38.000Z
25.833333
61
0.509677
999,336
package java_programs.arrays; import java.util.Scanner; public class ReverseNumber { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter no. of blocks of array: "); int n = sc.nextInt(), arr[] = new int[n], r = 0, num = 0; for (int i = 0; i < n; i++) { System.out.println("Enter a no.: "); arr[i] = sc.nextInt(); } for (int i = 0; i < n; i++, r = 0) { num = arr[i]; while (num != 0) { r = r * 10 + num % 10; num /= 10; } System.out.println("Reverse of " + arr[i] + ": " + r); } } }
923ac3f843c8778d813a2394be5bc2f4cc154eda
1,380
java
Java
app/src/main/java/com/product/is/app/MainActivity.java
Product-S/app
b19cff88a57fb937e484c14c210462afb5cc4742
[ "MIT" ]
1
2017-11-29T11:39:11.000Z
2017-11-29T11:39:11.000Z
app/src/main/java/com/product/is/app/MainActivity.java
Product-S/app
b19cff88a57fb937e484c14c210462afb5cc4742
[ "MIT" ]
null
null
null
app/src/main/java/com/product/is/app/MainActivity.java
Product-S/app
b19cff88a57fb937e484c14c210462afb5cc4742
[ "MIT" ]
null
null
null
30.666667
77
0.622464
999,337
package com.product.is.app; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageButton; public class MainActivity extends AppCompatActivity { public final static String EXTRA_MESSAGE = "com.product.is.app"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); skipRoute(); } public void skipRoute() { ImageButton addRoute = (ImageButton) findViewById(R.id.addRoute); ImageButton queryRoute = (ImageButton) findViewById(R.id.queryRoute); addRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(MainActivity.this,AddActivity.class); startActivity(intent); finish(); } }); queryRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(MainActivity.this,ListActivity.class); startActivity(intent); finish(); } }); } }
923ac4d8bbb8376eb8411f867f1abe4282441bf2
1,032
java
Java
androidutils/src/main/java/momo/cn/edu/fjnu/androidutils/utils/StorageUtils.java
eytb2/Ticket-Analysis
69ff63e3b65d9ed8043e0f4b4516650d3f1e8295
[ "MIT" ]
null
null
null
androidutils/src/main/java/momo/cn/edu/fjnu/androidutils/utils/StorageUtils.java
eytb2/Ticket-Analysis
69ff63e3b65d9ed8043e0f4b4516650d3f1e8295
[ "MIT" ]
null
null
null
androidutils/src/main/java/momo/cn/edu/fjnu/androidutils/utils/StorageUtils.java
eytb2/Ticket-Analysis
69ff63e3b65d9ed8043e0f4b4516650d3f1e8295
[ "MIT" ]
null
null
null
27.157895
139
0.707364
999,338
package momo.cn.edu.fjnu.androidutils.utils; import android.content.Context; import android.content.SharedPreferences; import momo.cn.edu.fjnu.androidutils.data.CommonValues; /** * 存储工具 * Created by GaoFei on 2016/1/4. */ public class StorageUtils { /** * 将数据存储在SharedPreference * @param key * @param value */ public static void saveDataToSharedPreference(String key, String value){ SharedPreferences preferences = CommonValues.application.getSharedPreferences(PackageUtils.getPackageName(), Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putString(key, value); editor.commit(); } /** * 从SharedPreference中读取数据 * @param key * @return */ public static String getDataFromSharedPreference(String key){ SharedPreferences preferences = CommonValues.application.getSharedPreferences(PackageUtils.getPackageName(), Context.MODE_PRIVATE); return preferences.getString(key ,""); } }
923ac4e91a6256feaff187b803797ad0969c7282
1,022
java
Java
src/main/java/us/abstracta/wiresham/SendPacketStep.java
Baraujo25/wiresham
9901c90caf2d36bebdc660560ca00542aabf6f2b
[ "Apache-2.0" ]
41
2018-06-06T13:19:58.000Z
2022-03-24T18:28:53.000Z
src/main/java/us/abstracta/wiresham/SendPacketStep.java
Baraujo25/wiresham
9901c90caf2d36bebdc660560ca00542aabf6f2b
[ "Apache-2.0" ]
11
2018-08-03T14:33:32.000Z
2022-03-09T12:20:09.000Z
src/main/java/us/abstracta/wiresham/SendPacketStep.java
Baraujo25/wiresham
9901c90caf2d36bebdc660560ca00542aabf6f2b
[ "Apache-2.0" ]
12
2019-09-03T03:11:49.000Z
2021-08-03T03:12:22.000Z
21.291667
82
0.709393
999,339
package us.abstracta.wiresham; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A step in a flow which sends a packet. */ public class SendPacketStep extends PacketStep { private static final Logger LOG = LoggerFactory.getLogger(SendPacketStep.class); private long delayMillis; public SendPacketStep() { } public SendPacketStep(String hexDump, long delayMillis) { super(hexDump); this.delayMillis = delayMillis; } public long getDelayMillis() { return delayMillis; } public void setDelayMillis(long delayMillis) { this.delayMillis = delayMillis; } @Override public void process(ConnectionFlowDriver connectionDriver) throws IOException, InterruptedException { LOG.debug("sending {} with {} millis delay", data, delayMillis); if (delayMillis > 0) { Thread.sleep(delayMillis); } connectionDriver.write(data.getBytes()); } @Override public String toString() { return "server: " + data; } }
923ac5003c8872edf27da23e6e56813a5553e4ad
574
java
Java
app/src/main/java/com/example/green/bachelorproject/events/UpdateCacheFileEvent.java
DottiL/Druid-source-code-editor
cce12513f133a9044e217eb76e35eef47324781d
[ "Apache-2.0" ]
2
2021-04-02T22:45:24.000Z
2021-06-04T21:42:58.000Z
app/src/main/java/com/example/green/bachelorproject/events/UpdateCacheFileEvent.java
DottiL/Druid-source-code-editor
cce12513f133a9044e217eb76e35eef47324781d
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/example/green/bachelorproject/events/UpdateCacheFileEvent.java
DottiL/Druid-source-code-editor
cce12513f133a9044e217eb76e35eef47324781d
[ "Apache-2.0" ]
null
null
null
22.96
76
0.710801
999,340
package com.example.green.bachelorproject.events; import com.example.green.bachelorproject.internalFileSystem.InternalFile; /** * Created by Green on 06/04/15. */ public class UpdateCacheFileEvent { private String content; private InternalFile internalFile; public UpdateCacheFileEvent(String content, InternalFile internalFile) { this.content = content; this.internalFile = internalFile; } public InternalFile getInternalFile() { return internalFile; } public String getContent() { return content; } }
923ac5d8af1ccbdc699dc5a635e50246b9935437
6,087
java
Java
spectator-reg-stateless/src/main/java/com/netflix/spectator/stateless/StatelessRegistry.java
jonsie/spectator
b1e6a9181d52d436f986df69dcd6c6fb556d7af5
[ "Apache-2.0" ]
672
2015-01-20T05:59:22.000Z
2022-03-30T20:07:30.000Z
spectator-reg-stateless/src/main/java/com/netflix/spectator/stateless/StatelessRegistry.java
jonsie/spectator
b1e6a9181d52d436f986df69dcd6c6fb556d7af5
[ "Apache-2.0" ]
181
2015-01-15T17:28:12.000Z
2022-03-20T20:51:55.000Z
spectator-reg-stateless/src/main/java/com/netflix/spectator/stateless/StatelessRegistry.java
jonsie/spectator
b1e6a9181d52d436f986df69dcd6c6fb556d7af5
[ "Apache-2.0" ]
157
2015-01-16T00:18:31.000Z
2022-02-11T18:53:10.000Z
34.782857
99
0.692624
999,341
/* * Copyright 2014-2019 Netflix, 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.netflix.spectator.stateless; import com.netflix.spectator.api.AbstractRegistry; import com.netflix.spectator.api.Clock; import com.netflix.spectator.api.Counter; import com.netflix.spectator.api.DistributionSummary; import com.netflix.spectator.api.Gauge; import com.netflix.spectator.api.Id; import com.netflix.spectator.api.Measurement; import com.netflix.spectator.api.Timer; import com.netflix.spectator.impl.Scheduler; import com.netflix.spectator.ipc.http.HttpClient; import com.netflix.spectator.ipc.http.HttpResponse; import java.net.URI; import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.StreamSupport; import java.util.zip.Deflater; /** * Registry for reporting deltas to an aggregation service. This registry is intended for * use-cases where the instance cannot maintain state over the step interval. For example, * if running via a FaaS system like AWS Lambda, the lifetime of an invocation can be quite * small. Thus this registry would track the deltas and rely on a separate service to * consolidate the state over time if needed. * * The registry should be tied to the lifecyle of the container to ensure that the last set * of deltas are flushed properly. This will happen automatically when calling {@link #stop()}. */ public final class StatelessRegistry extends AbstractRegistry { private final boolean enabled; private final Duration frequency; private final long meterTTL; private final int connectTimeout; private final int readTimeout; private final URI uri; private final int batchSize; private final Map<String, String> commonTags; private final HttpClient client; private Scheduler scheduler; /** Create a new instance. */ public StatelessRegistry(Clock clock, StatelessConfig config) { super(clock, config); this.enabled = config.enabled(); this.frequency = config.frequency(); this.meterTTL = config.meterTTL().toMillis(); this.connectTimeout = (int) config.connectTimeout().toMillis(); this.readTimeout = (int) config.readTimeout().toMillis(); this.uri = URI.create(config.uri()); this.batchSize = config.batchSize(); this.commonTags = config.commonTags(); this.client = HttpClient.create(this); } /** * Start the scheduler to collect metrics data. */ public void start() { if (scheduler == null) { if (enabled) { Scheduler.Options options = new Scheduler.Options() .withFrequency(Scheduler.Policy.FIXED_DELAY, frequency) .withInitialDelay(frequency) .withStopOnFailure(false); scheduler = new Scheduler(this, "spectator-reg-stateless", 1); scheduler.schedule(options, this::collectData); logger.info("started collecting metrics every {} reporting to {}", frequency, uri); logger.info("common tags: {}", commonTags); } else { logger.info("publishing is not enabled"); } } else { logger.warn("registry already started, ignoring duplicate request"); } } /** * Stop the scheduler reporting data. */ public void stop() { if (scheduler != null) { scheduler.shutdown(); scheduler = null; logger.info("flushing metrics before stopping the registry"); collectData(); logger.info("stopped collecting metrics every {} reporting to {}", frequency, uri); } else { logger.warn("registry stopped, but was never started"); } } private void collectData() { try { for (List<Measurement> batch : getBatches()) { byte[] payload = JsonUtils.encode(commonTags, batch); HttpResponse res = client.post(uri) .withConnectTimeout(connectTimeout) .withReadTimeout(readTimeout) .withContent("application/json", payload) .compress(Deflater.BEST_SPEED) .send(); if (res.status() != 200) { logger.warn("failed to send metrics, status {}: {}", res.status(), res.entityAsString()); } } removeExpiredMeters(); } catch (Exception e) { logger.warn("failed to send metrics", e); } } /** Get a list of all measurements from the registry. */ List<Measurement> getMeasurements() { return stream() .filter(m -> !m.hasExpired()) .flatMap(m -> StreamSupport.stream(m.measure().spliterator(), false)) .collect(Collectors.toList()); } /** Get a list of all measurements and break them into batches. */ List<List<Measurement>> getBatches() { List<List<Measurement>> batches = new ArrayList<>(); List<Measurement> ms = getMeasurements(); for (int i = 0; i < ms.size(); i += batchSize) { List<Measurement> batch = ms.subList(i, Math.min(ms.size(), i + batchSize)); batches.add(batch); } return batches; } @Override protected Counter newCounter(Id id) { return new StatelessCounter(id, clock(), meterTTL); } @Override protected DistributionSummary newDistributionSummary(Id id) { return new StatelessDistributionSummary(id, clock(), meterTTL); } @Override protected Timer newTimer(Id id) { return new StatelessTimer(id, clock(), meterTTL); } @Override protected Gauge newGauge(Id id) { return new StatelessGauge(id, clock(), meterTTL); } @Override protected Gauge newMaxGauge(Id id) { return new StatelessMaxGauge(id, clock(), meterTTL); } }
923ac62b71a64ddcad9835e58f0d7e9dbe29c096
1,154
java
Java
heroic-component/src/test/java/com/spotify/heroic/aggregation/AggregationOutputTest.java
AdamBSteele/heroic
5234ed946504a41c3f6e42f4b29f76cbf7893f6f
[ "Apache-2.0" ]
898
2015-11-17T13:20:05.000Z
2022-01-11T20:46:06.000Z
heroic-component/src/test/java/com/spotify/heroic/aggregation/AggregationOutputTest.java
AdamBSteele/heroic
5234ed946504a41c3f6e42f4b29f76cbf7893f6f
[ "Apache-2.0" ]
712
2015-11-19T12:02:17.000Z
2021-03-26T18:37:47.000Z
heroic-component/src/test/java/com/spotify/heroic/aggregation/AggregationOutputTest.java
AdamBSteele/heroic
5234ed946504a41c3f6e42f4b29f76cbf7893f6f
[ "Apache-2.0" ]
133
2015-11-17T16:10:12.000Z
2022-03-19T10:03:13.000Z
30.368421
100
0.717504
999,342
package com.spotify.heroic.aggregation; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.spotify.heroic.metric.MetricCollection; import java.util.Map; import org.junit.Test; public class AggregationOutputTest { @Test public void isEmpty() { final AggregationOutput output = new AggregationOutput(ImmutableMap.of(), ImmutableSet.of(), MetricCollection.points(ImmutableList.of())); assertTrue(output.isEmpty()); } @Test public void withKey() { final AggregationOutput output = new AggregationOutput(ImmutableMap.of(), ImmutableSet.of(), MetricCollection.points(ImmutableList.of())); final Map<String, String> key = ImmutableMap.of("key", "value"); final AggregationOutput next = output.withKey(key); assertTrue(output.isEmpty()); assertNotSame(output, next); assertEquals(key, next.getKey()); } }
923ac7564a6b766acfb901f8af51ef185a8d4149
12,066
java
Java
src/main/java/org/pentaho/di/trans/steps/pentahomqttpublisher/MQTTPublisher.java
pentaho-labs/pentaho-mqtt-plugin
51a200d1d0a15b69f214891409430a5ee712c983
[ "Apache-2.0" ]
8
2016-12-06T19:20:49.000Z
2020-04-22T03:10:10.000Z
src/main/java/org/pentaho/di/trans/steps/pentahomqttpublisher/MQTTPublisher.java
pentaho-labs/pentaho-mqtt-plugin
51a200d1d0a15b69f214891409430a5ee712c983
[ "Apache-2.0" ]
null
null
null
src/main/java/org/pentaho/di/trans/steps/pentahomqttpublisher/MQTTPublisher.java
pentaho-labs/pentaho-mqtt-plugin
51a200d1d0a15b69f214891409430a5ee712c983
[ "Apache-2.0" ]
6
2017-08-16T14:32:38.000Z
2021-02-03T23:45:20.000Z
38.673077
120
0.641969
999,343
/******************************************************************************* * * Pentaho IoT * * Copyright (C) 2016 by Pentaho : http://www.pentaho.com * ******************************************************************************* * * 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.pentaho.di.trans.steps.pentahomqttpublisher; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleValueException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.trans.Trans; import org.pentaho.di.trans.TransMeta; import org.pentaho.di.trans.step.BaseStep; import org.pentaho.di.trans.step.StepDataInterface; import org.pentaho.di.trans.step.StepInterface; import org.pentaho.di.trans.step.StepMeta; import org.pentaho.di.trans.step.StepMetaInterface; import org.pentaho.mqtt.SSLSocketFactoryGenerator; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.nio.ByteBuffer; import java.sql.Timestamp; /** * MQTT m_client step publisher * * @author Michael Spector * @author Mark Hall (mhall{[at]}pentaho{[dot]}com) */ public class MQTTPublisher extends BaseStep implements StepInterface { public MQTTPublisher( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ) { super( stepMeta, stepDataInterface, copyNr, transMeta, trans ); } public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { MQTTPublisherData data = (MQTTPublisherData) sdi; shutdown( data ); super.dispose( smi, sdi ); } protected void configureConnection( MQTTPublisherMeta meta, MQTTPublisherData data ) throws KettleException { if ( data.m_client == null ) { String broker = environmentSubstitute( meta.getBroker() ); if ( Const.isEmpty( broker ) ) { throw new KettleException( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.Error.NoBrokerURL" ) ); } String clientId = environmentSubstitute( meta.getClientId() ); if ( Const.isEmpty( clientId ) ) { throw new KettleException( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.Error.NoClientID" ) ); } try { data.m_client = new MqttClient( broker, clientId ); MqttConnectOptions connectOptions = new MqttConnectOptions(); if ( meta.isRequiresAuth() ) { connectOptions.setUserName( environmentSubstitute( meta.getUsername() ) ); connectOptions.setPassword( environmentSubstitute( meta.getPassword() ).toCharArray() ); } if ( broker.startsWith( "ssl:" ) || broker.startsWith( "wss:" ) ) { connectOptions.setSocketFactory( SSLSocketFactoryGenerator .getSocketFactory( environmentSubstitute( meta.getSSLCaFile() ), environmentSubstitute( meta.getSSLCertFile() ), environmentSubstitute( meta.getSSLKeyFile() ), environmentSubstitute( meta.getSSLKeyFilePass() ) ) ); } connectOptions.setCleanSession( true ); String timeout = environmentSubstitute( meta.getTimeout() ); try { connectOptions.setConnectionTimeout( Integer.parseInt( timeout ) ); } catch ( NumberFormatException e ) { throw new KettleException( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.WrongTimeoutValue.Message", timeout ), e ); } logBasic( BaseMessages .getString( MQTTPublisherMeta.PKG, "MQTTClientStep.CreateMQTTClient.Message", broker, clientId ) ); data.m_client.connect( connectOptions ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.ErrorCreateMQTTClient.Message", broker ), e ); } } } public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } MQTTPublisherMeta meta = (MQTTPublisherMeta) smi; MQTTPublisherData data = (MQTTPublisherData) sdi; RowMetaInterface inputRowMeta = getInputRowMeta(); if ( first ) { first = false; // Initialize MQTT m_client: configureConnection( meta, data ); data.m_outputRowMeta = getInputRowMeta().clone(); meta.getFields( data.m_outputRowMeta, getStepname(), null, null, this ); String inputField = environmentSubstitute( meta.getField() ); int numErrors = 0; if ( Const.isEmpty( inputField ) ) { logError( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.Log.FieldNameIsNull" ) ); //$NON-NLS-1$ numErrors++; } data.m_inputFieldNr = inputRowMeta.indexOfValue( inputField ); if ( data.m_inputFieldNr < 0 ) { logError( BaseMessages .getString( MQTTPublisherMeta.PKG, "MQTTClientStep.Log.CouldntFindField", inputField ) ); //$NON-NLS-1$ numErrors++; } if ( numErrors > 0 ) { setErrors( numErrors ); stopAll(); return false; } data.m_inputFieldMeta = inputRowMeta.getValueMeta( data.m_inputFieldNr ); data.m_topic = environmentSubstitute( meta.getTopic() ); if ( meta.getTopicIsFromField() ) { data.m_topicFromFieldIndex = inputRowMeta.indexOfValue( data.m_topic ); if ( data.m_topicFromFieldIndex < 0 ) { throw new KettleException( "Incoming stream does not seem to contain the topic field '" + data.m_topic + "'" ); } if ( inputRowMeta.getValueMeta( data.m_topicFromFieldIndex ).getType() != ValueMetaInterface.TYPE_STRING ) { throw new KettleException( "Incoming stream field to use for setting the topic must be of type string" ); } } String qosValue = environmentSubstitute( meta.getQoS() ); try { data.m_qos = Integer.parseInt( qosValue ); if ( data.m_qos < 0 || data.m_qos > 2 ) { throw new KettleException( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.WrongQOSValue.Message", qosValue ) ); } } catch ( NumberFormatException e ) { throw new KettleException( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.WrongQOSValue.Message", qosValue ), e ); } } try { if ( !isStopped() ) { Object rawMessage = r[data.m_inputFieldNr]; byte[] message = messageToBytes( rawMessage, data.m_inputFieldMeta ); if ( message == null ) { logDetailed( "Incoming message value is null/empty - skipping" ); return true; } // String topic = environmentSubstitute( meta.getTopic() ); if ( meta.getTopicIsFromField() ) { if ( r[data.m_topicFromFieldIndex] == null || Const.isEmpty( r[data.m_topicFromFieldIndex].toString() ) ) { // TODO add a default topic option, and then only skip if the default is null logDetailed( "Incoming topic value is null/empty - skipping message: " + rawMessage ); return true; } data.m_topic = r[data.m_topicFromFieldIndex].toString(); } MqttMessage mqttMessage = new MqttMessage( message ); mqttMessage.setQos( data.m_qos ); logBasic( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.Log.SendingData", data.m_topic, Integer.toString( data.m_qos ) ) ); if ( isRowLevel() ) { logRowlevel( data.m_inputFieldMeta.getString( r[data.m_inputFieldNr] ) ); } try { data.m_client.publish( data.m_topic, mqttMessage ); } catch ( MqttException e ) { throw new KettleException( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.ErrorPublishing.Message" ), e ); } } } catch ( KettleException e ) { if ( !getStepMeta().isDoingErrorHandling() ) { logError( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.ErrorInStepRunning", e.getMessage() ) ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } putError( getInputRowMeta(), r, 1, e.toString(), null, getStepname() ); } return true; } protected void shutdown( MQTTPublisherData data ) { if ( data.m_client != null ) { try { if ( data.m_client.isConnected() ) { data.m_client.disconnect(); } data.m_client.close(); data.m_client = null; } catch ( MqttException e ) { logError( BaseMessages.getString( MQTTPublisherMeta.PKG, "MQTTClientStep.ErrorClosingMQTTClient.Message" ), e ); } } } public void stopRunning( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { MQTTPublisherData data = (MQTTPublisherData) sdi; shutdown( data ); super.stopRunning( smi, sdi ); } protected byte[] messageToBytes( Object message, ValueMetaInterface messageValueMeta ) throws KettleValueException { if ( message == null || Const.isEmpty( message.toString() ) ) { return null; } byte[] result = null; try { ByteBuffer buff = null; switch ( messageValueMeta.getType() ) { case ValueMetaInterface.TYPE_STRING: result = message.toString().getBytes( "UTF-8" ); break; case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_DATE: // send the date as a long (milliseconds) value buff = ByteBuffer.allocate( 8 ); buff.putLong( messageValueMeta.getInteger( message ) ); result = buff.array(); break; case ValueMetaInterface.TYPE_NUMBER: buff = ByteBuffer.allocate( 8 ); buff.putDouble( messageValueMeta.getNumber( message ) ); result = buff.array(); break; case ValueMetaInterface.TYPE_TIMESTAMP: buff = ByteBuffer.allocate( 12 ); Timestamp ts = (Timestamp) message; buff.putLong( ts.getTime() ); buff.putInt( ts.getNanos() ); result = buff.array(); break; case ValueMetaInterface.TYPE_BINARY: result = messageValueMeta.getBinary( message ); break; case ValueMetaInterface.TYPE_BOOLEAN: result = new byte[1]; if ( messageValueMeta.getBoolean( message ) ) { result[0] = 1; } break; case ValueMetaInterface.TYPE_SERIALIZABLE: if ( !( message instanceof Serializable ) ) { throw new KettleValueException( "Message value is not serializable!" ); } ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream( bos ); oos.writeObject( message ); oos.flush(); result = bos.toByteArray(); break; } } catch ( Exception ex ) { throw new KettleValueException( ex ); } return result; } }
923ac7718875d6e1fbd86f81cd0a983ce7d37dee
940
java
Java
src/main/java/me/filoghost/fcommons/config/types/StringConfigType.java
filoghost/FCommons
c5f11cb9c6f648e31f3362762ea7198bd6fc1645
[ "MIT" ]
1
2020-10-14T08:24:05.000Z
2020-10-14T08:24:05.000Z
src/main/java/me/filoghost/fcommons/config/types/StringConfigType.java
filoghost/FCommons
c5f11cb9c6f648e31f3362762ea7198bd6fc1645
[ "MIT" ]
null
null
null
src/main/java/me/filoghost/fcommons/config/types/StringConfigType.java
filoghost/FCommons
c5f11cb9c6f648e31f3362762ea7198bd6fc1645
[ "MIT" ]
1
2022-03-25T07:56:47.000Z
2022-03-25T07:56:47.000Z
26.857143
136
0.737234
999,344
/* * Copyright (C) filoghost * * SPDX-License-Identifier: MIT */ package me.filoghost.fcommons.config.types; import me.filoghost.fcommons.config.ConfigErrors; import me.filoghost.fcommons.config.ConfigType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class StringConfigType extends ConfigType<String> { public StringConfigType(String name) { super(name, ConfigErrors.valueNotString); } @Override protected boolean isConvertibleRawValue(@Nullable Object rawValue) { return rawValue instanceof String || rawValue instanceof Number || rawValue instanceof Boolean || rawValue instanceof Character; } @Override protected @NotNull String fromRawValue(@NotNull Object rawValue) { return rawValue.toString(); } @Override protected @NotNull Object toRawValue(@NotNull String configValue) { return configValue; } }
923ac80a6bbf78a98fdf45174c517d978c212e35
426
java
Java
product/product-server/src/main/java/javis/app/product/server/ProductApplication.java
javisChen/order-microservice
c95d552b14d2d96f413ee07916e1b61f0db2dfb7
[ "MIT" ]
null
null
null
product/product-server/src/main/java/javis/app/product/server/ProductApplication.java
javisChen/order-microservice
c95d552b14d2d96f413ee07916e1b61f0db2dfb7
[ "MIT" ]
null
null
null
product/product-server/src/main/java/javis/app/product/server/ProductApplication.java
javisChen/order-microservice
c95d552b14d2d96f413ee07916e1b61f0db2dfb7
[ "MIT" ]
null
null
null
28.4
72
0.816901
999,345
package javis.app.product.server; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @SpringBootApplication @EnableDiscoveryClient public class ProductApplication { public static void main(String[] args) { SpringApplication.run(ProductApplication.class, args); } }
923ac8a2f0b6f3c5a4d37f066cc94049dd269176
519
java
Java
src/main/java/org/moskito/javaagent/request/producers/MethodProducerListener.java
anotheria/moskito-javaagent
6d5fad874d124505eaa90b7a2a1087620f00df13
[ "MIT" ]
7
2017-04-26T11:12:02.000Z
2019-07-13T23:05:17.000Z
src/main/java/org/moskito/javaagent/request/producers/MethodProducerListener.java
anotheria/moskito-javaagent
6d5fad874d124505eaa90b7a2a1087620f00df13
[ "MIT" ]
4
2016-01-28T12:08:30.000Z
2018-02-16T17:24:24.000Z
src/main/java/org/moskito/javaagent/request/producers/MethodProducerListener.java
anotheria/moskito-javaagent
6d5fad874d124505eaa90b7a2a1087620f00df13
[ "MIT" ]
7
2016-02-24T08:55:35.000Z
2018-03-28T05:47:18.000Z
25.95
85
0.755299
999,346
package org.moskito.javaagent.request.producers; import org.moskito.javaagent.request.wrappers.HttpRequestWrapper; /** * Listener for http methods producer with http methods as statistics unit */ public class MethodProducerListener extends AbstractProducerListener { public MethodProducerListener() { super("Method", "filter", "default"); } @Override protected String getStatsNameFromRequest(HttpRequestWrapper httpRequestWrapper) { return httpRequestWrapper.getMethod(); } }
923ac8fe7c737ba0d895d82be9c32dfbda439880
8,607
java
Java
src/main/java/com/blecua84/pokerapp/controllers/GameControllerImpl.java
blecua84/poker-app
64d410752becba73e3037d9608d7437a1a1ed75b
[ "MIT" ]
null
null
null
src/main/java/com/blecua84/pokerapp/controllers/GameControllerImpl.java
blecua84/poker-app
64d410752becba73e3037d9608d7437a1a1ed75b
[ "MIT" ]
null
null
null
src/main/java/com/blecua84/pokerapp/controllers/GameControllerImpl.java
blecua84/poker-app
64d410752becba73e3037d9608d7437a1a1ed75b
[ "MIT" ]
1
2019-05-03T06:52:04.000Z
2019-05-03T06:52:04.000Z
44.828125
120
0.695132
999,347
package com.blecua84.pokerapp.controllers; import com.blecua84.pokerapp.api.data.Card; import com.blecua84.pokerapp.api.exceptions.GameException; import com.blecua84.pokerapp.dispatcher.GameEventDispatcher; import com.blecua84.pokerapp.dispatcher.GameEventProcessor; import com.blecua84.pokerapp.dispatcher.impl.GameEvent; import com.blecua84.pokerapp.dispatcher.impl.GameEventDispatcherImpl; import com.blecua84.pokerapp.game.actions.GameController; import com.blecua84.pokerapp.game.actions.Strategy; import com.blecua84.pokerapp.game.config.Settings; import com.blecua84.pokerapp.game.data.BetCommand; import com.blecua84.pokerapp.game.data.GameInfo; import com.blecua84.pokerapp.game.data.PlayerInfo; import com.blecua84.pokerapp.timer.GameTimer; import com.blecua84.pokerapp.timer.impl.GameTimerImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; /** * Clase que conecta las estrategias de los jugadores con el conector de la máquina de estados y al temporizador, * prepara los grupos de hilos, comprueba la configuración e inicia el juego, una vez que este termina, este controlador * libera todos los hilos implicados en él. * * @author blecua84 */ public class GameControllerImpl implements GameController, Runnable { private static final Logger LOGGER = LoggerFactory.getLogger(GameControllerImpl.class); private static final int DISPATCHER_THREADS = 1; private static final int EXTRA_THREADS = 2; public static final String SYSTEM_CONTROLLER = "system"; public static final String INIT_HAND_EVENT_TYPE = "initHand"; public static final String BET_COMMAND_EVENT_TYPE = "betCommand"; public static final String END_GAME_PLAYER_EVENT_TYPE = "endGame"; public static final String END_HAND_PLAYER_EVENT_TYPE = "endHand"; public static final String CHECK_PLAYER_EVENT_TYPE = "check"; public static final String GET_COMMAND_PLAYER_EVENT_TYPE = "getCommand"; public static final String EXIT_CONNECTOR_EVENT_TYPE = "exit"; public static final String ADD_PLAYER_CONNECTOR_EVENT_TYPE = "addPlayer"; public static final String TIMEOUT_CONNECTOR_EVENT_TYPE = "timeOutCommand"; public static final String CREATE_GAME_CONNECTOR_EVENT_TYPE = "createGame"; private final Map<String, GameEventDispatcher> players = new HashMap<>(); private final List<String> playersByName = new ArrayList<>(); private final Map<String, GameEventProcessor<Strategy>> playerProcessors; private final GameEventDispatcherImpl<StateMachineConnector> connectorDispatcher; private final StateMachineConnector stateMachineConnector; private final GameTimer timer; private Settings settings; private ExecutorService executors; private List<ExecutorService> subExecutors = new ArrayList<>(); private boolean finish; public GameControllerImpl() { timer = new GameTimerImpl(SYSTEM_CONTROLLER, buildExecutor(DISPATCHER_THREADS)); stateMachineConnector = new StateMachineConnector(timer, players); connectorDispatcher = new GameEventDispatcherImpl<>(stateMachineConnector, buildConnectorProcessors(), buildExecutor(1)); stateMachineConnector.setSystem(connectorDispatcher); timer.setDispatcher(connectorDispatcher); playerProcessors = buildPlayerProcessors(); } private ExecutorService buildExecutor(int threads){ ExecutorService result = Executors.newFixedThreadPool(threads); subExecutors.add(result); return result; } private static Map<String, GameEventProcessor<StateMachineConnector>> buildConnectorProcessors() { Map<String, GameEventProcessor<StateMachineConnector>> cpm = new HashMap<>(); cpm.put(CREATE_GAME_CONNECTOR_EVENT_TYPE, (c, e) -> c.createGame((Settings) e.getPayload())); cpm.put(ADD_PLAYER_CONNECTOR_EVENT_TYPE, (c, e) -> c.addPlayer(e.getSource())); cpm.put(INIT_HAND_EVENT_TYPE, (c, e) -> c.startGame()); cpm.put(BET_COMMAND_EVENT_TYPE, (c, e) -> c.betCommand(e.getSource(), (BetCommand) e.getPayload())); cpm.put(TIMEOUT_CONNECTOR_EVENT_TYPE, (c, e) -> c.timeOutCommand((Long) e.getPayload())); return cpm; } private Map<String, GameEventProcessor<Strategy>> buildPlayerProcessors() { Map<String, GameEventProcessor<Strategy>> ppm = new HashMap<>(); GameEventProcessor<Strategy> defaultProcessor = (s, e) -> s.updateState((GameInfo) e.getPayload()); ppm.put(INIT_HAND_EVENT_TYPE, defaultProcessor); ppm.put(END_GAME_PLAYER_EVENT_TYPE, defaultProcessor); ppm.put(BET_COMMAND_EVENT_TYPE, (s, e) -> s.onPlayerCommand(e.getSource(), (BetCommand) e.getPayload())); ppm.put(CHECK_PLAYER_EVENT_TYPE, (s, e) -> s.check((List<Card>) e.getPayload())); ppm.put(GET_COMMAND_PLAYER_EVENT_TYPE, (s, e) -> { GameInfo<PlayerInfo> gi = (GameInfo<PlayerInfo>) e.getPayload(); String playerTurn = gi.getPlayers().get(gi.getPlayerTurn()).getName(); BetCommand cmd = s.getCommand(gi); connectorDispatcher.dispatch( new GameEvent(BET_COMMAND_EVENT_TYPE, playerTurn, cmd)); }); return ppm; } private void check(boolean essentialCondition, String exceptionMessage) throws GameException { if (!essentialCondition) { throw new GameException(exceptionMessage); } } @Override public void setSettings(Settings settings) { this.settings = settings; } @Override public synchronized boolean addStrategy(Strategy strategy) { boolean result = false; String name = strategy.getName(); if (!players.containsKey(name) && !SYSTEM_CONTROLLER.equals(name)) { players.put(name, new GameEventDispatcherImpl<>(strategy, playerProcessors, buildExecutor(DISPATCHER_THREADS))); playersByName.add(name); result = true; } return result; } @Override public synchronized void start() throws GameException { LOGGER.debug("start"); check(settings != null, "No se ha establecido una configuración."); check(players.size() > 1, "No se han agregado un numero suficiente de jugadores"); check(players.size() <= settings.getMaxPlayers(), "El número de jugadores excede del limite."); check(settings.getMaxErrors() > 0, "El número de máximo de errores debe..."); check(settings.getMaxRounds() > 0, "El número de máximo de rondas debe ..."); check(settings.getRounds4IncrementBlind()> 1, "El número de rondas hast..."); check(settings.getTime() > 0, "El tiempo másimo por jugador debe ser ma..."); check(settings.getPlayerChip() > 0, "El número de fichas inicial por ju..."); check(settings.getSmallBind() > 0, "La apuesta de la ciega pequeña debe..."); executors = Executors.newFixedThreadPool(players.size() + EXTRA_THREADS); players.values().stream().forEach(executors::execute); stateMachineConnector.createGame(settings); timer.setTime(settings.getTime()); playersByName.stream().forEach(stateMachineConnector::addPlayer); executors.execute(timer); finish = false; new Thread(this).start(); } @Override public synchronized void waitFinish() { if (!finish) { try {wait();} catch (InterruptedException ex) {LOGGER.error("Esperando el...", ex);} } } @Override public synchronized void run() { LOGGER.debug("run"); // Inicio de la ejecución del juego. connectorDispatcher.dispatch( new GameEvent(INIT_HAND_EVENT_TYPE, SYSTEM_CONTROLLER)); connectorDispatcher.run(); // Fin de la ejecución del juego. timer.exit(); executors.shutdown(); players.values().stream().forEach(GameEventDispatcher::exit); subExecutors.stream().forEach(ExecutorService::shutdown); try { executors.awaitTermination(0, TimeUnit.SECONDS); } catch (InterruptedException ex) { LOGGER.error("Error intentando eliminar cerrar todos los hilos", ex); } finish = true; notifyAll(); } }
923ac910f7853cf7cd377990e2366deca6d8107f
1,594
java
Java
ew.levr.base/src/main/java/com/eduworks/cruncher/lang/CruncherWhile.java
Eduworks/ew
a7954aa8e9a79f1a8330c9b45a71cad8a0da11df
[ "ECL-2.0", "Apache-2.0" ]
2
2018-07-23T23:09:27.000Z
2019-03-23T03:20:35.000Z
ew.levr.base/src/main/java/com/eduworks/cruncher/lang/CruncherWhile.java
Eduworks/ew
a7954aa8e9a79f1a8330c9b45a71cad8a0da11df
[ "ECL-2.0", "Apache-2.0" ]
37
2017-02-16T21:09:05.000Z
2021-06-25T15:43:30.000Z
ew.levr.base/src/main/java/com/eduworks/cruncher/lang/CruncherWhile.java
Eduworks/ew
a7954aa8e9a79f1a8330c9b45a71cad8a0da11df
[ "ECL-2.0", "Apache-2.0" ]
2
2016-09-22T06:21:31.000Z
2017-01-27T21:01:53.000Z
24.523077
137
0.705772
999,348
package com.eduworks.cruncher.lang; import java.io.InputStream; import java.util.Map; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.eduworks.resolver.Context; import com.eduworks.resolver.Cruncher; public class CruncherWhile extends Cruncher { @Override public Object resolve(Context c, Map<String, String[]> parameters, Map<String, InputStream> dataStreams) throws JSONException { Object result = null; Boolean accm = optAsBoolean("accumulate", false, c, parameters, dataStreams); if (accm) result = new JSONArray(); if (optAsString("do", "false", c, parameters, dataStreams).equals("true")) if (accm) ((JSONArray) result).put(getObj(c, parameters, dataStreams)); else result = getObj(c, parameters, dataStreams); Object o = get("condition", c, parameters, dataStreams); while (o != null && !o.equals("false")) { if (accm) ((JSONArray) result).put(getObj(c, parameters, dataStreams)); else result = getObj(c, parameters, dataStreams); o = get("condition", c, parameters, dataStreams); } return result; } @Override public String getDescription() { return "Will perform some 'obj' Resolvable until a condition resolves to 'false'. Set 'do' to true if you wish to make it a do-while."; } @Override public String getReturn() { return "Object"; } @Override public String getAttribution() { return ATTRIB_NONE; } @Override public JSONObject getParameters() throws JSONException { return jo("obj", "Resolvable", "condition", "Boolean", "?do", "Boolean"); } }
923aca213c1c0a101177177e263da5666e1bef25
1,356
java
Java
core/src/th/skyousuke/braveland/object/npc/monster/monster7/Monster7Walk.java
S-Kyousuke/braveland-rework
08a81d07f68207599a92e96aab3d3824cc1b1e9b
[ "Apache-2.0" ]
null
null
null
core/src/th/skyousuke/braveland/object/npc/monster/monster7/Monster7Walk.java
S-Kyousuke/braveland-rework
08a81d07f68207599a92e96aab3d3824cc1b1e9b
[ "Apache-2.0" ]
null
null
null
core/src/th/skyousuke/braveland/object/npc/monster/monster7/Monster7Walk.java
S-Kyousuke/braveland-rework
08a81d07f68207599a92e96aab3d3824cc1b1e9b
[ "Apache-2.0" ]
null
null
null
34.769231
104
0.695428
999,349
package th.skyousuke.braveland.object.npc.monster.monster7; import com.badlogic.gdx.graphics.g2d.Animation; import th.skyousuke.braveland.object.AbstractActionState; import th.skyousuke.braveland.object.AbstractCharacter; import th.skyousuke.braveland.utils.Assets; import th.skyousuke.braveland.utils.CompareUtils; public class Monster7Walk extends AbstractActionState { private static final float BASE_FRAME_DURATION = 0.10f; public Monster7Walk() { super(Assets.instance.monster7Atlas, "monster7_walk", 8, Animation.PlayMode.LOOP, 85, 0); setKeyFrameData(0, 85, 70, -10, 0); setKeyFrameData(1, 85, 70, -14, 0); setKeyFrameData(2, 85, 70, -15, 0); setKeyFrameData(3, 85, 70, -15, 0); setKeyFrameData(4, 85, 70, -6, 0); setKeyFrameData(5, 85, 70, -2, 0); setKeyFrameData(6, 85, 70, -5, 0); setKeyFrameData(7, 85, 70, -9, 0); } @Override protected float getFrameDuration(AbstractCharacter monster7) { return AbstractCharacter.DEFAULT_MOVE_SPEED * BASE_FRAME_DURATION / monster7.getMovementSpeed(); } @Override protected void onActionUpdate(AbstractCharacter monster7) { if (CompareUtils.floatEquals(monster7.getVelocity().x, 0)) { monster7.getActionStateMachine().changeState(new Monster7Stand()); } } }
923acade706e26e52da5c60dea7fc57199846dd1
4,316
java
Java
Example/nrf-mesh/app/src/main/java/com/phyplusinc/android/phymeshprovisioner/login/LoginActivity.java
zzlzlizhen/yfdl_nrf-mesh
3fdd0d9121a4e493f4b1c236c3fcf09edb95d7c4
[ "BSD-3-Clause" ]
1
2022-03-20T15:24:24.000Z
2022-03-20T15:24:24.000Z
Example/nrf-mesh/app/src/main/java/com/phyplusinc/android/phymeshprovisioner/login/LoginActivity.java
zzlzlizhen/yfdl_nrf-mesh
3fdd0d9121a4e493f4b1c236c3fcf09edb95d7c4
[ "BSD-3-Clause" ]
null
null
null
Example/nrf-mesh/app/src/main/java/com/phyplusinc/android/phymeshprovisioner/login/LoginActivity.java
zzlzlizhen/yfdl_nrf-mesh
3fdd0d9121a4e493f4b1c236c3fcf09edb95d7c4
[ "BSD-3-Clause" ]
null
null
null
41.104762
128
0.646432
999,350
package com.phyplusinc.android.phymeshprovisioner.login; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.lifecycle.ViewModelProvider; import com.phyplusinc.android.phymeshprovisioner.MainActivity; import com.phyplusinc.android.phymeshprovisioner.R; import com.phyplusinc.android.phymeshprovisioner.api.RetrofitHelper; import com.phyplusinc.android.phymeshprovisioner.api.UserServiceApi; import com.phyplusinc.android.phymeshprovisioner.di.Injectable; import com.phyplusinc.android.phymeshprovisioner.entity.UserEntity; import com.phyplusinc.android.phymeshprovisioner.provisioners.dialogs.DialogFragmentProvisionerName; import com.phyplusinc.android.phymeshprovisioner.viewmodels.LoginViewModel; import javax.inject.Inject; import butterknife.BindView; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class LoginActivity extends AppCompatActivity implements Injectable { @Inject ViewModelProvider.Factory mViewModelFactory; @BindView(R.id.container) CoordinatorLayout container; UserServiceApi userServiceApi; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_login); super.onCreate(savedInstanceState); init(); } private void init(){ final EditText login_et_username = findViewById(R.id.login_et_username); final EditText login_et_pwd = findViewById(R.id.login_et_pwd); final Button login_btn_ok = findViewById(R.id.login_btn_ok); final LoginViewModel viewModel = new ViewModelProvider(LoginActivity.this, mViewModelFactory).get(LoginViewModel.class); login_btn_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String username = login_et_username.getText().toString(); String password = login_et_pwd.getText().toString(); if(("").equals(username)){ Toast.makeText(LoginActivity.this,"请输入用户名",Toast.LENGTH_LONG).show(); return; } if(("").equals(password)){ Toast.makeText(LoginActivity.this,"请输入密码",Toast.LENGTH_LONG).show(); return; } userServiceApi = RetrofitHelper.getInstance().create(UserServiceApi.class); userServiceApi.login(username,password).enqueue(new Callback<UserEntity>() { @Override public void onResponse(Call<UserEntity> call, Response<UserEntity> response) { UserEntity userEntity = response.body(); if(userEntity.getCode() == 400){ Toast.makeText(LoginActivity.this,userEntity.getMsg(),Toast.LENGTH_LONG).show(); return; } if(userEntity.getUser()!=null){ viewModel.getNetworkLiveData().observe(LoginActivity.this, meshNetworkLiveData -> { if(meshNetworkLiveData != null && meshNetworkLiveData.getMeshNetwork() != null) { navigateActivity(); } }); } } @Override public void onFailure(Call<UserEntity> call, Throwable t) { t.printStackTrace(); } }); } }); } private void navigateActivity(){ final Intent intent = new Intent(LoginActivity.this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); finish(); } @Override public void onBackPressed() { // We don't want the splash screen to be interrupted } }
923ace1f935ca26cd72888479e3c10becb9aa1c9
3,864
java
Java
dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Response.java
xiaoheitalk/dubbo
d44ca1f3db9b3f208a72dd041eb49f4f5de697cf
[ "Apache-2.0" ]
18,012
2015-01-01T00:59:11.000Z
2018-03-19T09:21:57.000Z
dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Response.java
meijunhui/dubbo
a9aba45a001aea45049e9607f93ff9b0d607c6a6
[ "Apache-2.0" ]
5,223
2019-05-24T14:39:50.000Z
2022-03-31T10:27:18.000Z
dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Response.java
meijunhui/dubbo
a9aba45a001aea45049e9607f93ff9b0d607c6a6
[ "Apache-2.0" ]
10,640
2015-01-03T08:47:16.000Z
2018-03-19T09:00:46.000Z
22.08
108
0.612836
999,351
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dubbo.remoting.exchange; import static org.apache.dubbo.common.constants.CommonConstants.HEARTBEAT_EVENT; /** * Response */ public class Response { /** * ok. */ public static final byte OK = 20; /** * client side timeout. */ public static final byte CLIENT_TIMEOUT = 30; /** * server side timeout. */ public static final byte SERVER_TIMEOUT = 31; /** * channel inactive, directly return the unfinished requests. */ public static final byte CHANNEL_INACTIVE = 35; /** * request format error. */ public static final byte BAD_REQUEST = 40; /** * response format error. */ public static final byte BAD_RESPONSE = 50; /** * service not found. */ public static final byte SERVICE_NOT_FOUND = 60; /** * service error. */ public static final byte SERVICE_ERROR = 70; /** * internal server error. */ public static final byte SERVER_ERROR = 80; /** * internal server error. */ public static final byte CLIENT_ERROR = 90; /** * server side threadpool exhausted and quick return. */ public static final byte SERVER_THREADPOOL_EXHAUSTED_ERROR = 100; private long mId = 0; private String mVersion; private byte mStatus = OK; private boolean mEvent = false; private String mErrorMsg; private Object mResult; public Response() { } public Response(long id) { mId = id; } public Response(long id, String version) { mId = id; mVersion = version; } public long getId() { return mId; } public void setId(long id) { mId = id; } public String getVersion() { return mVersion; } public void setVersion(String version) { mVersion = version; } public byte getStatus() { return mStatus; } public void setStatus(byte status) { mStatus = status; } public boolean isEvent() { return mEvent; } public void setEvent(String event) { mEvent = true; mResult = event; } public void setEvent(boolean mEvent) { this.mEvent = mEvent; } public boolean isHeartbeat() { return mEvent && HEARTBEAT_EVENT == mResult; } @Deprecated public void setHeartbeat(boolean isHeartbeat) { if (isHeartbeat) { setEvent(HEARTBEAT_EVENT); } } public Object getResult() { return mResult; } public void setResult(Object msg) { mResult = msg; } public String getErrorMessage() { return mErrorMsg; } public void setErrorMessage(String msg) { mErrorMsg = msg; } @Override public String toString() { return "Response [id=" + mId + ", version=" + mVersion + ", status=" + mStatus + ", event=" + mEvent + ", error=" + mErrorMsg + ", result=" + (mResult == this ? "this" : mResult) + "]"; } }
923acef94b43303ef7379d1d824fa2e9ecf5c405
897
java
Java
kin-serialization-protobuf/src/main/java/org/kin/serialization/protobuf/ProtobufJsonSerialization.java
huangjianqin/kin-serialization
0c23c3c81ca84c4fe7aaf73bacaaa5dd0a157419
[ "Apache-2.0" ]
null
null
null
kin-serialization-protobuf/src/main/java/org/kin/serialization/protobuf/ProtobufJsonSerialization.java
huangjianqin/kin-serialization
0c23c3c81ca84c4fe7aaf73bacaaa5dd0a157419
[ "Apache-2.0" ]
null
null
null
kin-serialization-protobuf/src/main/java/org/kin/serialization/protobuf/ProtobufJsonSerialization.java
huangjianqin/kin-serialization
0c23c3c81ca84c4fe7aaf73bacaaa5dd0a157419
[ "Apache-2.0" ]
null
null
null
25.628571
76
0.726867
999,352
package org.kin.serialization.protobuf; import com.google.protobuf.InvalidProtocolBufferException; import io.netty.buffer.ByteBuf; import org.kin.framework.utils.ExceptionUtils; import org.kin.framework.utils.Extension; import org.kin.serialization.AbstractSerialization; import org.kin.serialization.Serialization; import java.nio.ByteBuffer; /** * @author huangjianqin * @date 2020/11/29 */ @Extension(value = "protobufJson", code = -1) public final class ProtobufJsonSerialization extends AbstractSerialization { @Override protected byte[] serialize0(Object target) { return Protobufs.serializeJson(target).getBytes(); } @Override protected <T> T deserialize0(byte[] bytes, Class<T> targetClass) { return Protobufs.deserializeJson(new String(bytes), targetClass); } @Override public int type() { //未用 return -1; } }
923acf9ea6989a610bd226521ae77c8e2e6cc75f
1,201
java
Java
app/src/main/java/com/bigkoo/mvvmframeworkdemo/model/Ticket.java
wudongze/Android-MVVMFramework-master
960e65ab65cc04390ca8fcf23eb2f5284df42167
[ "Apache-2.0" ]
192
2016-06-12T01:32:43.000Z
2021-01-23T00:32:56.000Z
app/src/main/java/com/bigkoo/mvvmframeworkdemo/model/Ticket.java
wudongze/Android-MVVMFramework-master
960e65ab65cc04390ca8fcf23eb2f5284df42167
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/bigkoo/mvvmframeworkdemo/model/Ticket.java
wudongze/Android-MVVMFramework-master
960e65ab65cc04390ca8fcf23eb2f5284df42167
[ "Apache-2.0" ]
57
2016-06-13T01:08:24.000Z
2020-04-01T04:39:00.000Z
18.476923
50
0.623647
999,353
package com.bigkoo.mvvmframeworkdemo.model; import java.io.Serializable; import java.util.List; /** * Created by Sai on 16/6/4. */ public class Ticket implements Serializable{ /** * productId : 923010086 * spotName : 蓝水河漂流 * spotAliasName : ["蓝水河"] */ private String productId; private String spotName; private String imageUrl; private String price; private String detailInfo; public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getSpotName() { return spotName; } public void setSpotName(String spotName) { this.spotName = spotName; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getDetailInfo() { return detailInfo; } public void setDetailInfo(String detailInfo) { this.detailInfo = detailInfo; } }
923ad0c87be3628b0c0b1749e2c9be74093f53bf
1,276
java
Java
momas-blog/src/main/java/cc/momas/blog/service/Impl/TypeServiceImpl.java
Sod-Momas/momas-project
1372b15c2f2d78560e688acaff65e43dc7643a1b
[ "Apache-2.0" ]
null
null
null
momas-blog/src/main/java/cc/momas/blog/service/Impl/TypeServiceImpl.java
Sod-Momas/momas-project
1372b15c2f2d78560e688acaff65e43dc7643a1b
[ "Apache-2.0" ]
null
null
null
momas-blog/src/main/java/cc/momas/blog/service/Impl/TypeServiceImpl.java
Sod-Momas/momas-project
1372b15c2f2d78560e688acaff65e43dc7643a1b
[ "Apache-2.0" ]
null
null
null
20.918033
64
0.684953
999,354
package cc.momas.blog.service.Impl; import cc.momas.blog.dao.TypeDao; import cc.momas.blog.pojo.Type; import cc.momas.blog.service.TypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service public class TypeServiceImpl implements TypeService { @Autowired private TypeDao typeDao; //事务注解 @Transactional @Override public int saveType(Type type) { return typeDao.saveType(type); } @Transactional @Override public Type getType(Long id) { return typeDao.getTypeById(id); } @Transactional @Override public List<Type> getAllType() { return typeDao.getAllType(); } @Override public List<Type> getAdminType() { return typeDao.getAdminType(); } @Transactional @Override public Type getTypeByName(String name) { return typeDao.getTypeByName(name); } @Transactional @Override public int updateType(Type type) { return typeDao.updateType(type); } @Transactional @Override public int deleteType(Long id) { return typeDao.deleteType(id); } }
923ad0cc94884fbb861c1884ad2bddc8d334fc2a
911
java
Java
core/src/main/java/datart/core/data/provider/sql/GroupByOperator.java
xupengfei2061/datart
c2cb7f6651ef9787b28abe55383cecdc89b94d9d
[ "Apache-2.0" ]
412
2021-10-15T10:08:39.000Z
2022-03-30T07:12:48.000Z
core/src/main/java/datart/core/data/provider/sql/GroupByOperator.java
xupengfei2061/datart
c2cb7f6651ef9787b28abe55383cecdc89b94d9d
[ "Apache-2.0" ]
445
2021-10-15T13:07:01.000Z
2022-03-31T11:31:37.000Z
core/src/main/java/datart/core/data/provider/sql/GroupByOperator.java
xupengfei2061/datart
c2cb7f6651ef9787b28abe55383cecdc89b94d9d
[ "Apache-2.0" ]
161
2021-10-15T10:21:49.000Z
2022-03-28T08:37:45.000Z
26.028571
75
0.675082
999,355
/* * Datart * <p> * Copyright 2021 * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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 datart.core.data.provider.sql; import lombok.Data; @Data public class GroupByOperator implements Operator { private String column; @Override public String toString() { return "GroupByOperator{" + "column='" + column + '\'' + '}'; } }
923ad1b735788dae9a20417f053d45bcf44abcb1
367
java
Java
configurationrepository-definition/src/main/java/ai/labs/resources/rest/http/model/HttpCallsConfiguration.java
Berlinebot/EDDI
64beff46361a2d32fe3dac62a37c3dd08bf6f2cc
[ "Apache-2.0" ]
1
2019-12-14T18:41:49.000Z
2019-12-14T18:41:49.000Z
configurationrepository-definition/src/main/java/ai/labs/resources/rest/http/model/HttpCallsConfiguration.java
Berlinebot/EDDI
64beff46361a2d32fe3dac62a37c3dd08bf6f2cc
[ "Apache-2.0" ]
null
null
null
configurationrepository-definition/src/main/java/ai/labs/resources/rest/http/model/HttpCallsConfiguration.java
Berlinebot/EDDI
64beff46361a2d32fe3dac62a37c3dd08bf6f2cc
[ "Apache-2.0" ]
null
null
null
15.956522
42
0.760218
999,356
package ai.labs.resources.rest.http.model; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import java.net.URI; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author ginccc */ @Getter @Setter public class HttpCallsConfiguration { private URI targetServer; private List<HttpCall> httpCalls; }
923ad216a0ec7bf05986a3c1bd9a7c60dfa00c2a
19,692
java
Java
src/ns/foundation/NSKeyValueObserving.java
innerfunction/if-json
a89b7b87230691629da742cbaf3e32e5a92bb616
[ "Apache-2.0" ]
null
null
null
src/ns/foundation/NSKeyValueObserving.java
innerfunction/if-json
a89b7b87230691629da742cbaf3e32e5a92bb616
[ "Apache-2.0" ]
null
null
null
src/ns/foundation/NSKeyValueObserving.java
innerfunction/if-json
a89b7b87230691629da742cbaf3e32e5a92bb616
[ "Apache-2.0" ]
null
null
null
37.869231
240
0.692261
999,357
package ns.foundation; import java.util.EnumSet; public interface NSKeyValueObserving extends NSKeyValueCodingAdditions { public enum Options { New, Old, Initial, Prior; public static final EnumSet<Options> NewAndOld = EnumSet.of(New, Old); } public enum Changes { Setting, Insertion, Removal, Replacement } public enum SetMutation { Union, Minus, Intersect, Set } public class KeyValueChange { public EnumSet<Changes> kind; public Object newValue; public Object oldValue; public NSSet<Integer> indexes; public Boolean isPrior; public KeyValueChange() { } public KeyValueChange(Changes... changes) { kind = EnumSet.of(changes[0], changes); } public KeyValueChange(KeyValueChange changes) { this.kind = changes.kind; this.newValue = changes.newValue; this.oldValue = changes.oldValue; this.indexes = changes.indexes; } public KeyValueChange(EnumSet<Changes> change, NSSet<Integer> indexes) { this.kind = change; this.indexes = indexes; } } public static class DefaultImplementation { public static boolean automaticallyNotifiesObserversForKey(NSObservable targetObject, String key) { return true; } public static void addObserverForKeyPath(NSObservable targetObject, NSObserver observer, String keyPath, EnumSet<Options> options, Object context) { if (observer == null || keyPath == null || keyPath.length() == 0) { return; } KeyValueObservingProxy.proxyForObject(targetObject).addObserverForKeyPath(observer, keyPath, options, context); } public static void didChangeValueForKey(NSObservable targetObject, String key) { if (key == null || key.length() == 0) { return; } KeyValueObservingProxy.proxyForObject(targetObject).sendNotificationsForKey(key, null, false); } public static void didChangeValuesAtIndexForKey(NSObservable targetObject, EnumSet<Changes> change, NSSet<Integer> indexes, String key) { if (key == null) { return; } KeyValueObservingProxy.proxyForObject(targetObject).sendNotificationsForKey(key, null, false); } public static NSSet<String> keyPathsForValuesAffectingValueForKey(NSObservable targetObject, String key) { return NSSet.emptySet(); } public static void removeObserverForKeyPath(NSObservable targetObject, NSObserver observer, String keyPath) { if (observer == null || keyPath == null || keyPath.length() == 0) { return; } KeyValueObservingProxy.proxyForObject(targetObject).removeObserverForKeyPath(observer, keyPath); } public static void willChangeValueForKey(NSObservable targetObject, String key) { if (key == null || key.length() == 0) return; KeyValueChange changeOptions = new KeyValueChange(Changes.Setting); KeyValueObservingProxy.proxyForObject(targetObject).sendNotificationsForKey(key, changeOptions, true); } public static void willChangeValuesAtIndexForKey(final NSObservable targetObject, final EnumSet<Changes> change, final NSSet<Integer> indexes, final String key) { if (key == null || key.length() == 0) return; KeyValueChange changeOptions = new KeyValueChange(change, indexes); KeyValueObservingProxy.proxyForObject(targetObject).sendNotificationsForKey(key, changeOptions, true); } public static void observeValueForKeyPath(NSObserver observer, String keyPath, NSObservable targetObject, KeyValueChange changes, Object context) { } } public static class Utility { public static NSObservable observable(Object object) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } if (object instanceof NSObservable) { return (NSObservable)object; } return KeyValueObservingProxy.proxyForObject(object); } public static void addObserverForKeyPath(Object object, NSObserver observer, String keyPath, EnumSet<Options> options, Object context) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } observable(object).addObserverForKeyPath(observer, keyPath, options, context); } public static boolean automaticallyNotifiesObserversForKey(Object object, String key) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } return observable(object).automaticallyNotifiesObserversForKey(key); } public static void didChangeValueForKey(Object object, String key) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } observable(object).didChangeValueForKey(key); } public static void didChangeValuesAtIndexForKey(Object object, EnumSet<Changes> change, NSSet<Integer> indexes, String key) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } observable(object).didChangeValuesAtIndexForKey(change, indexes, key); } public static NSSet<String> keyPathsForValuesAffectingValueForKey(Object object, String key) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } return observable(object).keyPathsForValuesAffectingValueForKey(key); } public static void removeObserverForKeyPath(Object object, NSObserver observer, String keyPath) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } observable(object).removeObserverForKeyPath(observer, keyPath); } public static void willChangeValueForKey(Object object, String key) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } observable(object).willChangeValueForKey(key); } public static void willChangeValuesAtIndexForKey(Object object, EnumSet<Changes> change, NSSet<Integer> indexes, String key) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } observable(object).willChangeValuesAtIndexForKey(change, indexes, key); } public static void observeValueForKeyPath(Object object, String keyPath, NSObservable targetObject, KeyValueChange changes, Object context) { if (object == null) { throw new IllegalArgumentException("Object cannot be null"); } if (object instanceof NSObserver) { ((NSObserver)object).observeValueForKeyPath(keyPath, targetObject, changes, context); } throw new IllegalArgumentException("Object must implement NSObserver"); } } /** * Interface allowing objects to return their own proxy cache key. * INFU addition. * The proxy cache scheme doesn't work for objects like Map instances whose hashKey value changes as it * is modified. This interface is added to that such objects can return a proxy cache key which will return * the same hash code as the object itself is mutated. */ public static interface KeyValueObservingProxyCacheAware { public Object getNSKVProxyCacheKey(); } public static class KeyValueObservingProxy implements NSObservable { private static final NSMutableDictionary<Object, KeyValueObservingProxy> _proxyCache = new NSMutableDictionary<Object, KeyValueObservingProxy>(); private static final NSMutableDictionary<Class<? extends Object>, NSMutableDictionary<String, NSMutableSet<String>>> _dependentKeys = new NSMutableDictionary<Class<? extends Object>, NSMutableDictionary<String, NSMutableSet<String>>>(); private final Object _targetObject; private NSMutableDictionary<String, KeyValueChange> _changesForKey = new NSMutableDictionary<String, KeyValueChange>(); private NSMutableDictionary<String, NSMutableDictionary<NSObserver, ObserverInfo>> _observersForKey = new NSMutableDictionary<String, NSMutableDictionary<NSObserver,ObserverInfo>>(); int _changeCount = 0; public static KeyValueObservingProxy proxyForObject(Object object) { // INFU addition - see comment above on KeyValueObservingProxyCacheAware Object cacheKey = (object instanceof KeyValueObservingProxyCacheAware) ? ((KeyValueObservingProxyCacheAware)object).getNSKVProxyCacheKey() : object; KeyValueObservingProxy proxy = _proxyCache.objectForKey( cacheKey ); if (proxy != null) { return proxy; } proxy = new KeyValueObservingProxy(object); _proxyCache.setObjectForKey(proxy, cacheKey); return proxy; } private KeyValueObservingProxy(Object object) { _targetObject = object; } private NSObservable observable() { if (_targetObject instanceof NSObservable) { return (NSObservable)_targetObject; } return this; } @Override public void addObserverForKeyPath(NSObserver observer, String keyPath, EnumSet<Options> options, Object context) { if (observer == null) return; KeyValueForwardingObserver forwarder = null; if (keyPath.contains(".")) { forwarder = new KeyValueForwardingObserver(keyPath, observable(), observer, options, context); } else { addDependentKeysForKey(keyPath); } NSMutableDictionary<NSObserver, ObserverInfo> observers = _observersForKey.objectForKey(keyPath); if (observers == null) { observers = new NSMutableDictionary<NSObserver, ObserverInfo>(); _observersForKey.setObjectForKey(observers, keyPath); NSKeyValueCoding.DefaultImplementation._addKVOAdditionsForKey(_targetObject, keyPath); } observers.setObjectForKey(new ObserverInfo(observer, options, context, forwarder), observer); if (options.contains(Options.Initial)) { Object _newValue = NSKeyValueCodingAdditions.Utility.valueForKeyPath(_targetObject, keyPath); if (_newValue == null) _newValue = NSKeyValueCoding.NullValue; final Object value = _newValue; KeyValueChange changes = new KeyValueChange() {{ this.newValue = value; }}; observer.observeValueForKeyPath(keyPath, observable(), changes, context); } } private void addDependentKeysForKey(String key) { NSSet<String> composedOfKeys = NSKeyValueObserving.Utility.keyPathsForValuesAffectingValueForKey(_targetObject,key); NSMutableDictionary<String, NSMutableSet<String>> dependentKeysForClass = _dependentKeys.objectForKey(_targetObject.getClass()); if (dependentKeysForClass == null) { dependentKeysForClass = new NSMutableDictionary<String, NSMutableSet<String>>(); _dependentKeys.setObjectForKey(dependentKeysForClass, _targetObject.getClass()); } for (String componentKey : composedOfKeys) { NSMutableSet<String> keysComposedOfKey = dependentKeysForClass.objectForKey(componentKey); if (keysComposedOfKey == null) { keysComposedOfKey = new NSMutableSet<String>(); dependentKeysForClass.setObjectForKey(keysComposedOfKey, componentKey); } keysComposedOfKey.addObject(key); addDependentKeysForKey(componentKey); } } @Override public void removeObserverForKeyPath(NSObserver observer, String keyPath) { NSMutableDictionary<NSObserver, ObserverInfo> observers = _observersForKey.objectForKey(keyPath); if( observers != null ) { if (keyPath.contains(".")) { KeyValueForwardingObserver forwarder = observers.objectForKey(observer).forwarder; forwarder.destroy(); } observers.removeObjectForKey(observer); if (observers.isEmpty()) { _observersForKey.removeObjectForKey(keyPath); NSKeyValueCoding.DefaultImplementation._removeKVOAdditionsForKey(_targetObject, keyPath); } } if (_observersForKey.isEmpty()) _proxyCache.removeObjectForKey(_targetObject); } @SuppressWarnings("unchecked") public void sendNotificationsForKey(String key, KeyValueChange changeOptions, boolean isBefore) { KeyValueChange changes = _changesForKey.objectForKey(key); if (isBefore) { changes = new KeyValueChange(changeOptions); NSSet<Integer> indexes = changes.indexes; if (indexes != null) { EnumSet<Changes> type = changes.kind; if (type.contains(Changes.Replacement) || type.contains(Changes.Removal)) { NSMutableArray<Object> oldValues = new NSMutableArray<Object>((NSArray<Object>)NSKeyValueCodingAdditions.Utility.valueForKeyPath(_targetObject, key)); changes.oldValue = oldValues; } } else { Object oldValue = NSKeyValueCoding.Utility.valueForKey(_targetObject, key); if (oldValue == null) oldValue = NSKeyValueCoding.NullValue; changes.oldValue = oldValue; } changes.isPrior = true; _changesForKey.setObjectForKey(changes, key); } else { changes.isPrior = null; NSSet<Integer> indexes = changes.indexes; if (indexes != null) { EnumSet<Changes> type = changes.kind; if (type.contains(Changes.Replacement) || type.contains(Changes.Insertion)) { NSMutableArray<Object> newValues = new NSMutableArray<Object>((NSArray<Object>)NSKeyValueCodingAdditions.Utility.valueForKeyPath(_targetObject, key)); changes.newValue = newValues; } } else { Object newValue = NSKeyValueCoding.Utility.valueForKey(_targetObject, key); if (newValue == null) newValue = NSKeyValueCoding.NullValue; changes.newValue = newValue; } //FIXME - Is this safe? Sink the change notification if nothing actually changed. if (changes.oldValue == changes.newValue) return; } NSArray<ObserverInfo> observers; if (_observersForKey.containsKey(key)) { observers = _observersForKey.objectForKey(key).allValues(); } else { observers = new NSArray<ObserverInfo>(); } int count = observers.count(); while (count-- > 0) { ObserverInfo observerInfo = observers.objectAtIndex(count); if (isBefore && (observerInfo.options.contains(Options.Prior))) { observerInfo.observer.observeValueForKeyPath(key, observable(), changes, observerInfo.context); } else if (!isBefore) { observerInfo.observer.observeValueForKeyPath(key, observable(), changes, observerInfo.context); } } NSSet<String> keysComposedOfKey = null; if (_dependentKeys.containsKey(_targetObject.getClass())) keysComposedOfKey = _dependentKeys.objectForKey(_targetObject.getClass()).objectForKey(key); if (keysComposedOfKey == null || keysComposedOfKey.isEmpty()) return; for (String dependentKey : keysComposedOfKey) { sendNotificationsForKey(dependentKey, changeOptions, isBefore); } } @Override public boolean automaticallyNotifiesObserversForKey(String key) { return true; } @Override public void didChangeValueForKey(String key) { if (--_changeCount == 0) NSKeyValueObserving.DefaultImplementation.didChangeValueForKey(this, key); } @Override public void didChangeValuesAtIndexForKey(EnumSet<Changes> change, NSSet<Integer> indexes, String key) { NSKeyValueObserving.DefaultImplementation.didChangeValuesAtIndexForKey(this, change, indexes, key); } @Override public NSSet<String> keyPathsForValuesAffectingValueForKey(String key) { return NSSet.emptySet(); } @Override public void willChangeValueForKey(String key) { _changeCount++; NSKeyValueObserving.DefaultImplementation.willChangeValueForKey(this, key); } @Override public void willChangeValuesAtIndexForKey(EnumSet<Changes> change, NSSet<Integer> indexes, String key) { NSKeyValueObserving.DefaultImplementation.willChangeValuesAtIndexForKey(this, change, indexes, key); } @Override public void takeValueForKeyPath(Object value, String keyPath) { NSKeyValueCodingAdditions.Utility.takeValueForKeyPath(_targetObject, value, keyPath); } @Override public Object valueForKeyPath(String keyPath) { return NSKeyValueCodingAdditions.Utility.valueForKeyPath(_targetObject, keyPath); } @Override public void takeValueForKey(Object value, String key) { NSKeyValueCoding.Utility.takeValueForKey(_targetObject, value, key); } @Override public Object valueForKey(String key) { return NSKeyValueCoding.Utility.valueForKey(_targetObject, key); } } public static class ObserverInfo { public final NSObserver observer; public final EnumSet<Options> options; public final Object context; public final KeyValueForwardingObserver forwarder; public ObserverInfo(NSObserver observer, EnumSet<Options> options, Object context, KeyValueForwardingObserver forwarder) { this.observer = observer; this.options = options; this.context = context; this.forwarder = forwarder; } } public static class KeyValueForwardingObserver implements NSObserver { private final NSObservable _targetObject; private final NSObserver _observer; private final EnumSet<Options> _options; private final String _firstPart; private final String _secondPart; private NSObservable _value; public KeyValueForwardingObserver(String keyPath, NSObservable object, NSObserver observer, EnumSet<Options> options, Object context) { _observer = observer; _targetObject = object; _options = options; if (!keyPath.contains(".")) throw new IllegalArgumentException("Created KeyValueForwardingObserver without a compound key path: " + keyPath); int index = keyPath.indexOf('.'); _firstPart = keyPath.substring(0, index); _secondPart = keyPath.substring(index+1); _targetObject.addObserverForKeyPath(this, _firstPart, options, context); _value = (NSObservable) _targetObject.valueForKey(_firstPart); if (_value != null) { _value.addObserverForKeyPath(this, _secondPart, options, context); } } @Override public void observeValueForKeyPath(String keyPath, NSObservable targetObject, KeyValueChange changes, Object context) { if (targetObject == _targetObject) { _observer.observeValueForKeyPath(_firstPart, targetObject, changes, context); Object newValue = _targetObject.valueForKeyPath(_secondPart); if (_value != null && _value != newValue) _value.removeObserverForKeyPath(this, _secondPart); _value = (NSObservable) newValue; if (_value != null) _value.addObserverForKeyPath(this, _secondPart, _options, context); } else { _observer.observeValueForKeyPath(_firstPart+"."+keyPath, targetObject, changes, context); } } private void destroy() { if (_value != null) _value.removeObserverForKeyPath(this, _secondPart); _targetObject.removeObserverForKeyPath(this, _firstPart); _value = null; } } public interface _NSKeyValueObserving { } }
923ad329274417e548f81f0cad05c501074bd3df
2,569
java
Java
src/main/java/sortingcars/QuicksortEngine.java
dbehmoaras/SortingCars
1d97c055d56129bbd149b515070bd120d3294376
[ "MIT" ]
null
null
null
src/main/java/sortingcars/QuicksortEngine.java
dbehmoaras/SortingCars
1d97c055d56129bbd149b515070bd120d3294376
[ "MIT" ]
null
null
null
src/main/java/sortingcars/QuicksortEngine.java
dbehmoaras/SortingCars
1d97c055d56129bbd149b515070bd120d3294376
[ "MIT" ]
null
null
null
31.329268
103
0.711561
999,358
package sortingcars; import java.util.LinkedList; public class QuicksortEngine { public QuicksortEngine(){ } public void sort(LinkedList<Car> localCarList) { int left = 0; int right = localCarList.size() - 1; quickSort(left, right, localCarList); } // This method is used to sort the array using quicksort algorithm. // It takes left and the right end of the array as two cursors private void quickSort(int left, int right, LinkedList<Car> localCarList) { // If both cursor scanned the complete array quicksort exits if (left >= right) return; // Pivot using median of 3 approach Car pivot = getMedian(left, right, localCarList); int partition = partition(left, right, pivot, localCarList); // Recursively, calls the quicksort with the different left and right parameters // of the sub-array quickSort(0, partition - 1, localCarList); quickSort(partition + 1, right, localCarList); } // This method is used to partition the given array and returns the integer // which points to the sorted pivot index private int partition(int left, int right, Car pivot, LinkedList<Car> localCarList) { int leftCursor = left - 1; int rightCursor = right; while (leftCursor < rightCursor) { while (((Comparable<Car>) localCarList.get(++leftCursor)).compareTo(pivot) < 0); while (rightCursor > 0 && ((Comparable<Car>) localCarList.get(--rightCursor)).compareTo(pivot) > 0); if (leftCursor >= rightCursor) { break; } else { swap(leftCursor, rightCursor, localCarList); } } swap(leftCursor, right, localCarList); return leftCursor; } public Car getMedian(int left, int right, LinkedList<Car> localCarList) { int center = (left + right) / 2; if (((Comparable<Car>) localCarList.get(left)).compareTo(localCarList.get(center)) > 0) swap(left, center, localCarList); if (((Comparable<Car>) localCarList.get(left)).compareTo(localCarList.get(right)) > 0) swap(left, right, localCarList); if (((Comparable<Car>) localCarList.get(center)).compareTo(localCarList.get(right)) > 0) swap(center, right, localCarList); swap(center, right, localCarList); return localCarList.get(right); } // This method is used to swap the values between the two given index public void swap(int left, int right, LinkedList<Car> localCarList) { Car temp = localCarList.get(left); localCarList.set(left, localCarList.get(right)); localCarList.set(right, temp); } public void printArray(LinkedList<Car> localCarList) { for (Car car : localCarList) { System.out.println(car + " "); } } }
923ad46f192ea582587037f95435c35e5179387d
532
java
Java
Web/Larn/src/main/java/com/example/larn/service/UserService.java
MMKODAMA/Larn
d152a04deea135dc09a2427c3148d4ece9b03ab2
[ "MIT" ]
2
2020-11-27T03:33:50.000Z
2022-01-15T02:28:39.000Z
Web/Larn/src/main/java/com/example/larn/service/UserService.java
MMKODAMA/Larn
d152a04deea135dc09a2427c3148d4ece9b03ab2
[ "MIT" ]
null
null
null
Web/Larn/src/main/java/com/example/larn/service/UserService.java
MMKODAMA/Larn
d152a04deea135dc09a2427c3148d4ece9b03ab2
[ "MIT" ]
null
null
null
21.28
47
0.796992
999,359
package com.example.larn.service; import com.example.larn.model.Student; import com.example.larn.model.Teacher; import com.example.larn.model.User; public interface UserService { public void saveStudent(Student user); public void saveTeacher(Teacher user); public void updateStudent(Student user); public void updateTeacher(Teacher user); public Student findStudentByID(int id); public Teacher findTeacherByID(int id); public boolean isUserAlredyPresent(User user); public boolean isCpfAlredyPresent(User user); }
923ad4beeab790acdb6312ad36df9844751b5342
4,218
java
Java
oas-generator/oas-generator-spring/src/main/java/org/apache/servicecomb/toolkit/generator/parser/SpringmvcAnnotationParser.java
mohneesh9797-puresoftware/servicecomb-toolkit
cae7dd5020ef81c44182daab3c00215fa3b4bde9
[ "Apache-2.0" ]
564
2019-06-21T07:18:09.000Z
2022-01-17T02:52:34.000Z
oas-generator/oas-generator-spring/src/main/java/org/apache/servicecomb/toolkit/generator/parser/SpringmvcAnnotationParser.java
mohneesh9797-puresoftware/servicecomb-toolkit
cae7dd5020ef81c44182daab3c00215fa3b4bde9
[ "Apache-2.0" ]
54
2019-06-28T02:16:25.000Z
2020-09-21T06:04:03.000Z
oas-generator/oas-generator-spring/src/main/java/org/apache/servicecomb/toolkit/generator/parser/SpringmvcAnnotationParser.java
mohneesh9797-puresoftware/servicecomb-toolkit
cae7dd5020ef81c44182daab3c00215fa3b4bde9
[ "Apache-2.0" ]
41
2019-06-21T07:18:15.000Z
2022-01-31T12:13:11.000Z
45.847826
99
0.818634
999,360
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicecomb.toolkit.generator.parser; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import org.apache.servicecomb.toolkit.generator.annotation.GetMappingMethodAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.annotation.PathVariableAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.annotation.PostMappingMethodAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.annotation.PutMappingMethodAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.annotation.RequestBodyAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.annotation.RequestHeaderAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.annotation.RequestMappingClassAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.annotation.RequestMappingMethodAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.annotation.RequestParamAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.annotation.RequestPartAnnotationProcessor; import org.apache.servicecomb.toolkit.generator.context.OasContext; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; public class SpringmvcAnnotationParser extends AbstractAnnotationParser { @Override public int getOrder() { return 200; } @Override public void parser(Class<?> cls, OasContext context) { super.parser(cls, context); } @Override public boolean canProcess(Class<?> cls) { if (cls.getAnnotation(RestController.class) != null) { return true; } return false; } @Override public void initClassAnnotationProcessor() { super.initClassAnnotationProcessor(); classAnnotationMap.put(RequestMapping.class, new RequestMappingClassAnnotationProcessor()); } @Override public void initMethodAnnotationProcessor() { super.initMethodAnnotationProcessor(); methodAnnotationMap.put(RequestMapping.class, new RequestMappingMethodAnnotationProcessor()); methodAnnotationMap.put(GetMapping.class, new GetMappingMethodAnnotationProcessor()); methodAnnotationMap.put(PutMapping.class, new PutMappingMethodAnnotationProcessor()); methodAnnotationMap.put(PostMapping.class, new PostMappingMethodAnnotationProcessor()); } @Override public void initParameterAnnotationProcessor() { super.initParameterAnnotationProcessor(); parameterAnnotationMap.put(PathVariable.class, new PathVariableAnnotationProcessor()); parameterAnnotationMap.put(RequestBody.class, new RequestBodyAnnotationProcessor()); parameterAnnotationMap.put(RequestPart.class, new RequestPartAnnotationProcessor()); parameterAnnotationMap.put(RequestParam.class, new RequestParamAnnotationProcessor()); parameterAnnotationMap.put(RequestHeader.class, new RequestHeaderAnnotationProcessor()); } }
923ad537f7935a3dc41cde786e665a804d6c60d3
2,221
java
Java
gemp-swccg-cards/src/main/java/com/gempukku/swccgo/cards/set7/light/Card7_144.java
scottrick/gemp-swccg-public
08e6790ee6388370d7b973104d36d700be49681f
[ "MIT" ]
19
2020-08-30T18:44:38.000Z
2022-02-10T18:23:49.000Z
gemp-swccg-cards/src/main/java/com/gempukku/swccgo/cards/set7/light/Card7_144.java
scottrick/gemp-swccg-public
08e6790ee6388370d7b973104d36d700be49681f
[ "MIT" ]
480
2020-09-11T00:19:27.000Z
2022-03-31T19:46:37.000Z
gemp-swccg-cards/src/main/java/com/gempukku/swccgo/cards/set7/light/Card7_144.java
scottrick/gemp-swccg-public
08e6790ee6388370d7b973104d36d700be49681f
[ "MIT" ]
21
2020-08-29T16:19:44.000Z
2022-03-29T01:37:39.000Z
40.381818
212
0.758217
999,361
package com.gempukku.swccgo.cards.set7.light; import com.gempukku.swccgo.cards.AbstractCapitalStarship; import com.gempukku.swccgo.cards.AbstractPermanentAboard; import com.gempukku.swccgo.cards.AbstractPermanentPilot; import com.gempukku.swccgo.common.Icon; import com.gempukku.swccgo.common.ModelType; import com.gempukku.swccgo.common.Side; import com.gempukku.swccgo.filters.Filters; import com.gempukku.swccgo.game.PhysicalCard; import com.gempukku.swccgo.game.SwccgGame; import com.gempukku.swccgo.logic.modifiers.MayDeployToTargetModifier; import com.gempukku.swccgo.logic.modifiers.Modifier; import java.util.Collections; import java.util.LinkedList; import java.util.List; /** * Set: Special Edition * Type: Starship * Subtype: Capital * Title: Medium Bulk Freighter */ public class Card7_144 extends AbstractCapitalStarship { public Card7_144() { super(Side.LIGHT, 3, 3, 3, 4, null, 4, 4, "Medium Bulk Freighter"); setLore("Modern Corellian design. Length 100 meters. Features engine system similar to that of a Corellian corvette. Dorsal hatch reveals hangar bay."); setGameText("Deploys and moves like a starfighter. May add 2 pilots, 6 passengers and 1 vehicle. Permanent pilot provides ability of 1. Has ship-docking capability. Quad Laser Cannon may deploy aboard."); addIcons(Icon.SPECIAL_EDITION, Icon.INDEPENDENT, Icon.PILOT, Icon.NAV_COMPUTER, Icon.SCOMP_LINK); addModelType(ModelType.YV_CLASS_FREIGHTER); setPilotCapacity(2); setPassengerCapacity(6); setVehicleCapacity(1); } @Override public boolean isDeploysAndMovesLikeStarfighter() { return true; } @Override protected List<? extends AbstractPermanentAboard> getGameTextPermanentsAboard() { return Collections.singletonList(new AbstractPermanentPilot(1) {}); } @Override protected List<Modifier> getGameTextWhileActiveInPlayModifiersEvenIfUnpiloted(SwccgGame game, final PhysicalCard self) { List<Modifier> modifiers = new LinkedList<Modifier>(); modifiers.add(new MayDeployToTargetModifier(self, Filters.and(Filters.your(self), Filters.Quad_Laser_Cannon), self)); return modifiers; } }
923ad6ee9ed945795a47efcf19258bc50e58caa8
525
java
Java
Flux 39/com/soterdev/SoterObfuscator.java
14ms/Minecraft-Disclosed-Source-Modifications
d3729ab0fb20c36da1732b2070d1cb5d1409ffbc
[ "Unlicense" ]
3
2022-02-28T17:34:51.000Z
2022-03-06T21:55:16.000Z
Flux 39/com/soterdev/SoterObfuscator.java
14ms/Minecraft-Disclosed-Source-Modifications
d3729ab0fb20c36da1732b2070d1cb5d1409ffbc
[ "Unlicense" ]
2
2022-02-25T20:10:14.000Z
2022-03-03T14:25:03.000Z
Flux 39/com/soterdev/SoterObfuscator.java
14ms/Minecraft-Disclosed-Source-Modifications
d3729ab0fb20c36da1732b2070d1cb5d1409ffbc
[ "Unlicense" ]
null
null
null
26.25
51
0.739048
999,362
package com.soterdev; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; public final class SoterObfuscator { @Retention(RetentionPolicy.CLASS) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface Obfuscation { boolean exclude() default false; String flags(); } @Retention(RetentionPolicy.CLASS) @Target({ElementType.METHOD}) public @interface Entry {} }