repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
respoke/respoke-sdk-android
respokeSDK/src/main/java/com/digium/respokesdk/RespokeCall.java
RespokeCall.startCall
public void startCall(final Context context, GLSurfaceView glView, boolean isAudioOnly) { caller = true; audioOnly = isAudioOnly; if (directConnectionOnly) { if (null == directConnection) { actuallyAddDirectConnection(); } directConnectionDidAccept(context); } else { attachVideoRenderer(glView); getTurnServerCredentials(new Respoke.TaskCompletionListener() { @Override public void onSuccess() { Log.d(TAG, "Got TURN credentials"); initializePeerConnection(context); addLocalStreams(context); createOffer(); } @Override public void onError(String errorMessage) { postErrorToListener(errorMessage); } }); } }
java
public void startCall(final Context context, GLSurfaceView glView, boolean isAudioOnly) { caller = true; audioOnly = isAudioOnly; if (directConnectionOnly) { if (null == directConnection) { actuallyAddDirectConnection(); } directConnectionDidAccept(context); } else { attachVideoRenderer(glView); getTurnServerCredentials(new Respoke.TaskCompletionListener() { @Override public void onSuccess() { Log.d(TAG, "Got TURN credentials"); initializePeerConnection(context); addLocalStreams(context); createOffer(); } @Override public void onError(String errorMessage) { postErrorToListener(errorMessage); } }); } }
[ "public", "void", "startCall", "(", "final", "Context", "context", ",", "GLSurfaceView", "glView", ",", "boolean", "isAudioOnly", ")", "{", "caller", "=", "true", ";", "audioOnly", "=", "isAudioOnly", ";", "if", "(", "directConnectionOnly", ")", "{", "if", "...
Start the outgoing call process. This method is used internally by the SDK and should never be called directly from your client application @param context An application context with which to access shared resources @param glView The GLSurfaceView on which to render video if applicable @param isAudioOnly Specify true if this call should be audio only
[ "Start", "the", "outgoing", "call", "process", ".", "This", "method", "is", "used", "internally", "by", "the", "SDK", "and", "should", "never", "be", "called", "directly", "from", "your", "client", "application" ]
train
https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeCall.java#L278-L306
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/extensions/ChocoUtils.java
ChocoUtils.postImplies
public static void postImplies(ReconfigurationProblem rp, BoolVar b1, Constraint c2) { Model s = rp.getModel(); BoolVar bC2 = s.boolVar(rp.makeVarLabel(c2.toString(), " satisfied")); c2.reifyWith(bC2); BoolVar notB1 = b1.not(); s.post(rp.getModel().arithm(b1, "!=", notB1)); s.post(rp.getModel().or(notB1, bC2)); }
java
public static void postImplies(ReconfigurationProblem rp, BoolVar b1, Constraint c2) { Model s = rp.getModel(); BoolVar bC2 = s.boolVar(rp.makeVarLabel(c2.toString(), " satisfied")); c2.reifyWith(bC2); BoolVar notB1 = b1.not(); s.post(rp.getModel().arithm(b1, "!=", notB1)); s.post(rp.getModel().or(notB1, bC2)); }
[ "public", "static", "void", "postImplies", "(", "ReconfigurationProblem", "rp", ",", "BoolVar", "b1", ",", "Constraint", "c2", ")", "{", "Model", "s", "=", "rp", ".", "getModel", "(", ")", ";", "BoolVar", "bC2", "=", "s", ".", "boolVar", "(", "rp", "."...
Make and post an implies constraint where the first operand is a boolean: b1 -> c2. The constraint is translated into (or(not(b1,c2)) @param rp the problem to solve @param b1 the first constraint as boolean @param c2 the second constraint
[ "Make", "and", "post", "an", "implies", "constraint", "where", "the", "first", "operand", "is", "a", "boolean", ":", "b1", "-", ">", "c2", ".", "The", "constraint", "is", "translated", "into", "(", "or", "(", "not", "(", "b1", "c2", "))" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/ChocoUtils.java#L45-L54
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/uri/BitcoinURI.java
BitcoinURI.putWithValidation
private void putWithValidation(String key, Object value) throws BitcoinURIParseException { if (parameterMap.containsKey(key)) { throw new BitcoinURIParseException(String.format(Locale.US, "'%s' is duplicated, URI is invalid", key)); } else { parameterMap.put(key, value); } }
java
private void putWithValidation(String key, Object value) throws BitcoinURIParseException { if (parameterMap.containsKey(key)) { throw new BitcoinURIParseException(String.format(Locale.US, "'%s' is duplicated, URI is invalid", key)); } else { parameterMap.put(key, value); } }
[ "private", "void", "putWithValidation", "(", "String", "key", ",", "Object", "value", ")", "throws", "BitcoinURIParseException", "{", "if", "(", "parameterMap", ".", "containsKey", "(", "key", ")", ")", "{", "throw", "new", "BitcoinURIParseException", "(", "Stri...
Put the value against the key in the map checking for duplication. This avoids address field overwrite etc. @param key The key for the map @param value The value to store
[ "Put", "the", "value", "against", "the", "key", "in", "the", "map", "checking", "for", "duplication", ".", "This", "avoids", "address", "field", "overwrite", "etc", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/uri/BitcoinURI.java#L250-L256
cdapio/tigon
tigon-hbase-compat-0.94/src/main/java/co/cask/tigon/data/transaction/queue/hbase/HBase94QueueConsumer.java
HBase94QueueConsumer.createStateFilter
private Filter createStateFilter() { byte[] processedMask = new byte[Ints.BYTES * 2 + 1]; processedMask[processedMask.length - 1] = ConsumerEntryState.PROCESSED.getState(); return new SingleColumnValueFilter(QueueEntryRow.COLUMN_FAMILY, stateColumnName, CompareFilter.CompareOp.NOT_EQUAL, new BitComparator(processedMask, BitComparator.BitwiseOp.AND)); }
java
private Filter createStateFilter() { byte[] processedMask = new byte[Ints.BYTES * 2 + 1]; processedMask[processedMask.length - 1] = ConsumerEntryState.PROCESSED.getState(); return new SingleColumnValueFilter(QueueEntryRow.COLUMN_FAMILY, stateColumnName, CompareFilter.CompareOp.NOT_EQUAL, new BitComparator(processedMask, BitComparator.BitwiseOp.AND)); }
[ "private", "Filter", "createStateFilter", "(", ")", "{", "byte", "[", "]", "processedMask", "=", "new", "byte", "[", "Ints", ".", "BYTES", "*", "2", "+", "1", "]", ";", "processedMask", "[", "processedMask", ".", "length", "-", "1", "]", "=", "Consumer...
Creates a HBase filter that will filter out rows with state column state = PROCESSED (ignoring transaction).
[ "Creates", "a", "HBase", "filter", "that", "will", "filter", "out", "rows", "with", "state", "column", "state", "=", "PROCESSED", "(", "ignoring", "transaction", ")", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-hbase-compat-0.94/src/main/java/co/cask/tigon/data/transaction/queue/hbase/HBase94QueueConsumer.java#L76-L82
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java
MapboxNavigation.startNavigation
public void startNavigation(@NonNull DirectionsRoute directionsRoute, @NonNull DirectionsRouteType routeType) { startNavigationWith(directionsRoute, routeType); }
java
public void startNavigation(@NonNull DirectionsRoute directionsRoute, @NonNull DirectionsRouteType routeType) { startNavigationWith(directionsRoute, routeType); }
[ "public", "void", "startNavigation", "(", "@", "NonNull", "DirectionsRoute", "directionsRoute", ",", "@", "NonNull", "DirectionsRouteType", "routeType", ")", "{", "startNavigationWith", "(", "directionsRoute", ",", "routeType", ")", ";", "}" ]
Calling this method with {@link DirectionsRouteType#NEW_ROUTE} begins a new navigation session using the provided directions route. If called with {@link DirectionsRouteType#FRESH_ROUTE}, only leg annotation data will be update - can be used with {@link RouteRefresh}. @param directionsRoute a {@link DirectionsRoute} that makes up the path your user should traverse along @param routeType either new or fresh to determine what data navigation should consider @see MapboxNavigation#startNavigation(DirectionsRoute)
[ "Calling", "this", "method", "with", "{", "@link", "DirectionsRouteType#NEW_ROUTE", "}", "begins", "a", "new", "navigation", "session", "using", "the", "provided", "directions", "route", ".", "If", "called", "with", "{", "@link", "DirectionsRouteType#FRESH_ROUTE", "...
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java#L359-L361
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigestSpi.java
MessageDigestSpi.engineDigest
protected int engineDigest(byte[] buf, int offset, int len) throws DigestException { byte[] digest = engineDigest(); if (len < digest.length) throw new DigestException("partial digests not returned"); if (buf.length - offset < digest.length) throw new DigestException("insufficient space in the output " + "buffer to store the digest"); System.arraycopy(digest, 0, buf, offset, digest.length); return digest.length; }
java
protected int engineDigest(byte[] buf, int offset, int len) throws DigestException { byte[] digest = engineDigest(); if (len < digest.length) throw new DigestException("partial digests not returned"); if (buf.length - offset < digest.length) throw new DigestException("insufficient space in the output " + "buffer to store the digest"); System.arraycopy(digest, 0, buf, offset, digest.length); return digest.length; }
[ "protected", "int", "engineDigest", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "len", ")", "throws", "DigestException", "{", "byte", "[", "]", "digest", "=", "engineDigest", "(", ")", ";", "if", "(", "len", "<", "digest", ".", "l...
Completes the hash computation by performing final operations such as padding. Once {@code engineDigest} has been called, the engine should be reset (see {@link #engineReset() engineReset}). Resetting is the responsibility of the engine implementor. This method should be abstract, but we leave it concrete for binary compatibility. Knowledgeable providers should override this method. @param buf the output buffer in which to store the digest @param offset offset to start from in the output buffer @param len number of bytes within buf allotted for the digest. Both this default implementation and the SUN provider do not return partial digests. The presence of this parameter is solely for consistency in our API's. If the value of this parameter is less than the actual digest length, the method will throw a DigestException. This parameter is ignored if its value is greater than or equal to the actual digest length. @return the length of the digest stored in the output buffer. @exception DigestException if an error occurs. @since 1.2
[ "Completes", "the", "hash", "computation", "by", "performing", "final", "operations", "such", "as", "padding", ".", "Once", "{", "@code", "engineDigest", "}", "has", "been", "called", "the", "engine", "should", "be", "reset", "(", "see", "{", "@link", "#engi...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigestSpi.java#L173-L184
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java
BitfinexApiCallbackListeners.onOrderbookEvent
public Closeable onOrderbookEvent(final BiConsumer<BitfinexOrderBookSymbol, Collection<BitfinexOrderBookEntry>> listener) { orderbookEntryConsumers.offer(listener); return () -> orderbookEntryConsumers.remove(listener); }
java
public Closeable onOrderbookEvent(final BiConsumer<BitfinexOrderBookSymbol, Collection<BitfinexOrderBookEntry>> listener) { orderbookEntryConsumers.offer(listener); return () -> orderbookEntryConsumers.remove(listener); }
[ "public", "Closeable", "onOrderbookEvent", "(", "final", "BiConsumer", "<", "BitfinexOrderBookSymbol", ",", "Collection", "<", "BitfinexOrderBookEntry", ">", ">", "listener", ")", "{", "orderbookEntryConsumers", ".", "offer", "(", "listener", ")", ";", "return", "("...
registers listener for orderbook events @param listener of event @return hook of this listener
[ "registers", "listener", "for", "orderbook", "events" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L168-L171
Zappos/zappos-json
src/main/java/com/zappos/json/JsonReaderCodeGenerator.java
JsonReaderCodeGenerator.getTypeInfo
private TypeInfo getTypeInfo(Map<String, TypeInfo> typeMaps, String path, Class<?> superType) { TypeInfo typeInfo = typeMaps.get(path); if (typeInfo == null) { typeInfo = new TypeInfo(superType); typeMaps.put(path, typeInfo); } return typeInfo; }
java
private TypeInfo getTypeInfo(Map<String, TypeInfo> typeMaps, String path, Class<?> superType) { TypeInfo typeInfo = typeMaps.get(path); if (typeInfo == null) { typeInfo = new TypeInfo(superType); typeMaps.put(path, typeInfo); } return typeInfo; }
[ "private", "TypeInfo", "getTypeInfo", "(", "Map", "<", "String", ",", "TypeInfo", ">", "typeMaps", ",", "String", "path", ",", "Class", "<", "?", ">", "superType", ")", "{", "TypeInfo", "typeInfo", "=", "typeMaps", ".", "get", "(", "path", ")", ";", "i...
Get the TypeInfo object from specified path or return the new one if it does not exist. @param typeMaps @param path @param superType @return
[ "Get", "the", "TypeInfo", "object", "from", "specified", "path", "or", "return", "the", "new", "one", "if", "it", "does", "not", "exist", "." ]
train
https://github.com/Zappos/zappos-json/blob/340633f5db75c2e09ce49bfc3e5f67e8823f5a37/src/main/java/com/zappos/json/JsonReaderCodeGenerator.java#L354-L364
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.parseTime
public static Time parseTime(final String date, final String format, final TimeZone timeZone) { if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) { return null; } return createTime(parse(date, format, timeZone)); }
java
public static Time parseTime(final String date, final String format, final TimeZone timeZone) { if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) { return null; } return createTime(parse(date, format, timeZone)); }
[ "public", "static", "Time", "parseTime", "(", "final", "String", "date", ",", "final", "String", "format", ",", "final", "TimeZone", "timeZone", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "date", ")", "||", "(", "date", ".", "length", "(", ")...
Converts the specified <code>date</code> with the specified {@code format} to a new instance of Time. <code>null</code> is returned if the specified <code>date</code> is null or empty. @param date @param format @param timeZone @return
[ "Converts", "the", "specified", "<code", ">", "date<", "/", "code", ">", "with", "the", "specified", "{", "@code", "format", "}", "to", "a", "new", "instance", "of", "Time", ".", "<code", ">", "null<", "/", "code", ">", "is", "returned", "if", "the", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L433-L439
rainu/dbc
src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java
MetadataManager.updateMetadata
public void updateMetadata(String tableName, String metadata){ try { updateStatement.setString(1, metadata); updateStatement.setLong(2, tableName.hashCode()); updateStatement.executeUpdate(); } catch (SQLException e) { throw new BackendException("Could not update metadata for table '" + tableName + "'", e); } }
java
public void updateMetadata(String tableName, String metadata){ try { updateStatement.setString(1, metadata); updateStatement.setLong(2, tableName.hashCode()); updateStatement.executeUpdate(); } catch (SQLException e) { throw new BackendException("Could not update metadata for table '" + tableName + "'", e); } }
[ "public", "void", "updateMetadata", "(", "String", "tableName", ",", "String", "metadata", ")", "{", "try", "{", "updateStatement", ".", "setString", "(", "1", ",", "metadata", ")", ";", "updateStatement", ".", "setLong", "(", "2", ",", "tableName", ".", "...
Aktualisiert die Metadaten eines Eintrages. @param tableName Name der Tabelle @param metadata Metadaten die eingetragen werden sollen.
[ "Aktualisiert", "die", "Metadaten", "eines", "Eintrages", "." ]
train
https://github.com/rainu/dbc/blob/bdf1d1945ccaa8db8ed0b91bd08d5ef9802777f7/src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java#L159-L167
JodaOrg/joda-time
src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java
DateTimeFormatterBuilder.appendFraction
public DateTimeFormatterBuilder appendFraction( DateTimeFieldType fieldType, int minDigits, int maxDigits) { if (fieldType == null) { throw new IllegalArgumentException("Field type must not be null"); } if (maxDigits < minDigits) { maxDigits = minDigits; } if (minDigits < 0 || maxDigits <= 0) { throw new IllegalArgumentException(); } return append0(new Fraction(fieldType, minDigits, maxDigits)); }
java
public DateTimeFormatterBuilder appendFraction( DateTimeFieldType fieldType, int minDigits, int maxDigits) { if (fieldType == null) { throw new IllegalArgumentException("Field type must not be null"); } if (maxDigits < minDigits) { maxDigits = minDigits; } if (minDigits < 0 || maxDigits <= 0) { throw new IllegalArgumentException(); } return append0(new Fraction(fieldType, minDigits, maxDigits)); }
[ "public", "DateTimeFormatterBuilder", "appendFraction", "(", "DateTimeFieldType", "fieldType", ",", "int", "minDigits", ",", "int", "maxDigits", ")", "{", "if", "(", "fieldType", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Field type ...
Instructs the printer to emit a remainder of time as a decimal fraction, without decimal point. For example, if the field is specified as minuteOfHour and the time is 12:30:45, the value printed is 75. A decimal point is implied, so the fraction is 0.75, or three-quarters of a minute. @param fieldType type of field to append @param minDigits minimum number of digits to print. @param maxDigits maximum number of digits to print or parse. @return this DateTimeFormatterBuilder, for chaining @throws IllegalArgumentException if field type is null
[ "Instructs", "the", "printer", "to", "emit", "a", "remainder", "of", "time", "as", "a", "decimal", "fraction", "without", "decimal", "point", ".", "For", "example", "if", "the", "field", "is", "specified", "as", "minuteOfHour", "and", "the", "time", "is", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L569-L581
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSLexerState.java
CSSLexerState.isBalanced
public boolean isBalanced(RecoveryMode mode, CSSLexerState state, CSSToken t) { if (mode == RecoveryMode.BALANCED) return !aposOpen && !quotOpen && curlyNest == 0 && parenNest == 0 && sqNest == 0; else if (mode == RecoveryMode.FUNCTION) return parenNest == 0 && sqNest == 0; else if (mode == RecoveryMode.RULE) return !aposOpen && !quotOpen && parenNest == 0 && sqNest == 0; else if (mode == RecoveryMode.DECL) { if (t.getType() == CSSLexer.RCURLY) //if '}' is processed the curlyNest has been already decreased return !aposOpen && !quotOpen && parenNest == 0 && sqNest == 0 && curlyNest == state.curlyNest - 1; else return !aposOpen && !quotOpen && parenNest == 0 && sqNest == 0 && curlyNest == state.curlyNest; } else return true; }
java
public boolean isBalanced(RecoveryMode mode, CSSLexerState state, CSSToken t) { if (mode == RecoveryMode.BALANCED) return !aposOpen && !quotOpen && curlyNest == 0 && parenNest == 0 && sqNest == 0; else if (mode == RecoveryMode.FUNCTION) return parenNest == 0 && sqNest == 0; else if (mode == RecoveryMode.RULE) return !aposOpen && !quotOpen && parenNest == 0 && sqNest == 0; else if (mode == RecoveryMode.DECL) { if (t.getType() == CSSLexer.RCURLY) //if '}' is processed the curlyNest has been already decreased return !aposOpen && !quotOpen && parenNest == 0 && sqNest == 0 && curlyNest == state.curlyNest - 1; else return !aposOpen && !quotOpen && parenNest == 0 && sqNest == 0 && curlyNest == state.curlyNest; } else return true; }
[ "public", "boolean", "isBalanced", "(", "RecoveryMode", "mode", ",", "CSSLexerState", "state", ",", "CSSToken", "t", ")", "{", "if", "(", "mode", "==", "RecoveryMode", ".", "BALANCED", ")", "return", "!", "aposOpen", "&&", "!", "quotOpen", "&&", "curlyNest",...
Checks whether some pair characters are balanced. Modes are: <ul> <li>BALANCED - everything must be balanced: single and double quotatation marks, curly braces, parentheses <li>FUNCTION - within the function arguments: parentheses must be balanced <li>RULE - within the CSS rule: all but curly braces <li>DECL - within declaration: all, keep curly braces at desired state </ul> @param mode the desired recovery node @param state the required lexer state (used for DECL mode) @param t the token that is being processed (used for DECL mode)
[ "Checks", "whether", "some", "pair", "characters", "are", "balanced", ".", "Modes", "are", ":", "<ul", ">", "<li", ">", "BALANCED", "-", "everything", "must", "be", "balanced", ":", "single", "and", "double", "quotatation", "marks", "curly", "braces", "paren...
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSLexerState.java#L69-L83
apache/incubator-heron
storm-compatibility/src/java/org/apache/storm/utils/ConfigUtils.java
ConfigUtils.translateConfig
@SuppressWarnings({"rawtypes", "unchecked"}) public static Config translateConfig(Map stormConfig) { Config heronConfig; if (stormConfig != null) { heronConfig = new Config((Map<String, Object>) stormConfig); } else { heronConfig = new Config(); } // Look at serialization stuff first doSerializationTranslation(heronConfig); // Now look at supported apis doStormTranslation(heronConfig); doTaskHooksTranslation(heronConfig); doTopologyLevelTranslation(heronConfig); return heronConfig; }
java
@SuppressWarnings({"rawtypes", "unchecked"}) public static Config translateConfig(Map stormConfig) { Config heronConfig; if (stormConfig != null) { heronConfig = new Config((Map<String, Object>) stormConfig); } else { heronConfig = new Config(); } // Look at serialization stuff first doSerializationTranslation(heronConfig); // Now look at supported apis doStormTranslation(heronConfig); doTaskHooksTranslation(heronConfig); doTopologyLevelTranslation(heronConfig); return heronConfig; }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "Config", "translateConfig", "(", "Map", "stormConfig", ")", "{", "Config", "heronConfig", ";", "if", "(", "stormConfig", "!=", "null", ")", "{", "heronConfi...
Translate storm config to heron config for topology @param stormConfig the storm config @return a heron config
[ "Translate", "storm", "config", "to", "heron", "config", "for", "topology" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/storm-compatibility/src/java/org/apache/storm/utils/ConfigUtils.java#L38-L58
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.paymentMean_creditCard_POST
public OvhPaymentMeanValidation paymentMean_creditCard_POST(String description, String returnUrl, Boolean setDefault) throws IOException { String qPath = "/me/paymentMean/creditCard"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "returnUrl", returnUrl); addBody(o, "setDefault", setDefault); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhPaymentMeanValidation.class); }
java
public OvhPaymentMeanValidation paymentMean_creditCard_POST(String description, String returnUrl, Boolean setDefault) throws IOException { String qPath = "/me/paymentMean/creditCard"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "returnUrl", returnUrl); addBody(o, "setDefault", setDefault); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhPaymentMeanValidation.class); }
[ "public", "OvhPaymentMeanValidation", "paymentMean_creditCard_POST", "(", "String", "description", ",", "String", "returnUrl", ",", "Boolean", "setDefault", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/paymentMean/creditCard\"", ";", "StringBuilder", ...
Add a new credit card REST: POST /me/paymentMean/creditCard @param returnUrl [required] Callback URL where the customer will be redirected to after validation @param setDefault [required] Set as default payment mean once validated @param description [required] Custom description of this account
[ "Add", "a", "new", "credit", "card" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L801-L810
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataHelper.java
InterceptorMetaDataHelper.validateAroundSignature
public static void validateAroundSignature(InterceptorMethodKind kind, Method m, J2EEName name) throws EJBConfigurationException { // Get the modifers for the interceptor method and verify that the // method is neither final nor static as required by EJB specification. int mod = m.getModifiers(); if (Modifier.isFinal(mod) || Modifier.isStatic(mod)) { // CNTR0229E: The {0} interceptor method must not be declared as final or static. String method = m.toGenericString(); Tr.error(tc, "INVALID_INTERCEPTOR_METHOD_MODIFIER_CNTR0229E", new Object[] { method }); throw new EJBConfigurationException(kind.getXMLElementName() + " interceptor \"" + method + "\" must not be declared as final or static."); } // Verify AroundInvoke has 1 parameter of type InvocationContext. Class<?>[] parmTypes = m.getParameterTypes(); if ((parmTypes.length == 1) && (parmTypes[0].equals(InvocationContext.class))) { // Has correct signature of 1 parameter of type InvocationContext } else { String method = m.toGenericString(); Tr.error(tc, "INVALID_AROUND_INVOKE_SIGNATURE_CNTR0230E", new Object[] { method, kind.getXMLElementName() }); // F743-17763.1 throw new EJBConfigurationException(kind.getXMLElementName() + " interceptor \"" + method + "\" must have a single parameter of type javax.interceptors.InvocationContext."); } // Verify return type. Class<?> returnType = m.getReturnType(); // F743-17763.1 - The spec requires that around interceptor methods have // exactly Object as the return type. The original AroundInvoke check // was not as strict, but we keep it for compatibility with previous // releases. if (returnType != Object.class) { boolean compatiblyValid = kind == InterceptorMethodKind.AROUND_INVOKE && Object.class.isAssignableFrom(returnType); // d668039 if (!compatiblyValid || isValidationLoggable()) { String method = m.toGenericString(); Tr.error(tc, "INVALID_AROUND_INVOKE_SIGNATURE_CNTR0230E", new Object[] { method, kind.getXMLElementName() }); // F743-17763.1 if (!compatiblyValid || isValidationFailable()) // d668039 { throw new EJBConfigurationException(kind.getXMLElementName() + " interceptor \"" + method + "\" must have a return value of type java.lang.Object."); } } } // Per the EJB 3.2 spec, "Note: An around-invoke interceptor method may // be declared to throw any checked exceptions that the associated // target method allows within its throws clause. It may be declared to // throw the java.lang.Exception if it interposes on several methods // that can throw unrelated checked exceptions." }
java
public static void validateAroundSignature(InterceptorMethodKind kind, Method m, J2EEName name) throws EJBConfigurationException { // Get the modifers for the interceptor method and verify that the // method is neither final nor static as required by EJB specification. int mod = m.getModifiers(); if (Modifier.isFinal(mod) || Modifier.isStatic(mod)) { // CNTR0229E: The {0} interceptor method must not be declared as final or static. String method = m.toGenericString(); Tr.error(tc, "INVALID_INTERCEPTOR_METHOD_MODIFIER_CNTR0229E", new Object[] { method }); throw new EJBConfigurationException(kind.getXMLElementName() + " interceptor \"" + method + "\" must not be declared as final or static."); } // Verify AroundInvoke has 1 parameter of type InvocationContext. Class<?>[] parmTypes = m.getParameterTypes(); if ((parmTypes.length == 1) && (parmTypes[0].equals(InvocationContext.class))) { // Has correct signature of 1 parameter of type InvocationContext } else { String method = m.toGenericString(); Tr.error(tc, "INVALID_AROUND_INVOKE_SIGNATURE_CNTR0230E", new Object[] { method, kind.getXMLElementName() }); // F743-17763.1 throw new EJBConfigurationException(kind.getXMLElementName() + " interceptor \"" + method + "\" must have a single parameter of type javax.interceptors.InvocationContext."); } // Verify return type. Class<?> returnType = m.getReturnType(); // F743-17763.1 - The spec requires that around interceptor methods have // exactly Object as the return type. The original AroundInvoke check // was not as strict, but we keep it for compatibility with previous // releases. if (returnType != Object.class) { boolean compatiblyValid = kind == InterceptorMethodKind.AROUND_INVOKE && Object.class.isAssignableFrom(returnType); // d668039 if (!compatiblyValid || isValidationLoggable()) { String method = m.toGenericString(); Tr.error(tc, "INVALID_AROUND_INVOKE_SIGNATURE_CNTR0230E", new Object[] { method, kind.getXMLElementName() }); // F743-17763.1 if (!compatiblyValid || isValidationFailable()) // d668039 { throw new EJBConfigurationException(kind.getXMLElementName() + " interceptor \"" + method + "\" must have a return value of type java.lang.Object."); } } } // Per the EJB 3.2 spec, "Note: An around-invoke interceptor method may // be declared to throw any checked exceptions that the associated // target method allows within its throws clause. It may be declared to // throw the java.lang.Exception if it interposes on several methods // that can throw unrelated checked exceptions." }
[ "public", "static", "void", "validateAroundSignature", "(", "InterceptorMethodKind", "kind", ",", "Method", "m", ",", "J2EEName", "name", ")", "throws", "EJBConfigurationException", "{", "// Get the modifers for the interceptor method and verify that the", "// method is neither f...
Verify a specified AroundInvoke interceptor method has correct method modifiers and signature. @param kind the interceptor kind @param m is the java reflection Method object for the around invoke method. @param ejbClass is true if the interceptor is defined on the enterprise bean class @param name is the {@link J2EEName} of the EJB. @throws EJBConfigurationException is thrown if any configuration error is detected.
[ "Verify", "a", "specified", "AroundInvoke", "interceptor", "method", "has", "correct", "method", "modifiers", "and", "signature", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataHelper.java#L617-L675
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java
CounterGroup.localize
private String localize(String key, String defaultValue) { String result = defaultValue; if (bundle != null) { try { result = bundle.getString(key); } catch (MissingResourceException mre) { } } return result; }
java
private String localize(String key, String defaultValue) { String result = defaultValue; if (bundle != null) { try { result = bundle.getString(key); } catch (MissingResourceException mre) { } } return result; }
[ "private", "String", "localize", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "String", "result", "=", "defaultValue", ";", "if", "(", "bundle", "!=", "null", ")", "{", "try", "{", "result", "=", "bundle", ".", "getString", "(", "key", ...
Looks up key in the ResourceBundle and returns the corresponding value. If the bundle or the key doesn't exist, returns the default value.
[ "Looks", "up", "key", "in", "the", "ResourceBundle", "and", "returns", "the", "corresponding", "value", ".", "If", "the", "bundle", "or", "the", "key", "doesn", "t", "exist", "returns", "the", "default", "value", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java#L140-L150
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
AbstractCachedGenerator.addLinkedResources
protected void addLinkedResources(String path, GeneratorContext context, List<FilePathMapping> fMappings) { linkedResourceMap.put(getResourceCacheKey(path, context), new CopyOnWriteArrayList<>(fMappings)); JoinableResourceBundle bundle = context.getBundle(); if (bundle != null) { List<FilePathMapping> bundleFMappings = bundle.getLinkedFilePathMappings(); for (FilePathMapping fMapping : fMappings) { FilePathMapping fm = new FilePathMapping(bundle, fMapping.getPath(), fMapping.getLastModified()); if (!bundleFMappings.contains(fm)) { bundleFMappings.add(fm); } } } }
java
protected void addLinkedResources(String path, GeneratorContext context, List<FilePathMapping> fMappings) { linkedResourceMap.put(getResourceCacheKey(path, context), new CopyOnWriteArrayList<>(fMappings)); JoinableResourceBundle bundle = context.getBundle(); if (bundle != null) { List<FilePathMapping> bundleFMappings = bundle.getLinkedFilePathMappings(); for (FilePathMapping fMapping : fMappings) { FilePathMapping fm = new FilePathMapping(bundle, fMapping.getPath(), fMapping.getLastModified()); if (!bundleFMappings.contains(fm)) { bundleFMappings.add(fm); } } } }
[ "protected", "void", "addLinkedResources", "(", "String", "path", ",", "GeneratorContext", "context", ",", "List", "<", "FilePathMapping", ">", "fMappings", ")", "{", "linkedResourceMap", ".", "put", "(", "getResourceCacheKey", "(", "path", ",", "context", ")", ...
Adds the linked resource to the linked resource map @param path the resource path @param context the generator context @param fMappings the list of mappings linked to the resource
[ "Adds", "the", "linked", "resource", "to", "the", "linked", "resource", "map" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L375-L389
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/sdcard.java
sdcard.copyFile
public static void copyFile(File fromFile, File toFile) throws IOException { copyFile(new FileInputStream(fromFile), new FileOutputStream(toFile)); }
java
public static void copyFile(File fromFile, File toFile) throws IOException { copyFile(new FileInputStream(fromFile), new FileOutputStream(toFile)); }
[ "public", "static", "void", "copyFile", "(", "File", "fromFile", ",", "File", "toFile", ")", "throws", "IOException", "{", "copyFile", "(", "new", "FileInputStream", "(", "fromFile", ")", ",", "new", "FileOutputStream", "(", "toFile", ")", ")", ";", "}" ]
Creates the specified <code>toFile</code> as a byte for byte copy of the <code>fromFile</code>. If <code>toFile</code> already exists, then it will be replaced with a copy of <code>fromFile</code>. The name and path of <code>toFile</code> will be that of <code>toFile</code>.<br/> <br/> <i> Note: <code>fromFile</code> and <code>toFile</code> will be closed by this function.</i> @param fromFile - File to copy from. @param toFile - File to copy to.
[ "Creates", "the", "specified", "<code", ">", "toFile<", "/", "code", ">", "as", "a", "byte", "for", "byte", "copy", "of", "the", "<code", ">", "fromFile<", "/", "code", ">", ".", "If", "<code", ">", "toFile<", "/", "code", ">", "already", "exists", "...
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/sdcard.java#L163-L165
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Calendar.java
Calendar.addEntryToResult
private void addEntryToResult(Map<LocalDate, List<Entry<?>>> result, Entry<?> entry, LocalDate startDate, LocalDate endDate) { LocalDate entryStartDate = entry.getStartDate(); LocalDate entryEndDate = entry.getEndDate(); // entry does not intersect with time interval if (entryEndDate.isBefore(startDate) || entryStartDate.isAfter(endDate)) { return; } if (entryStartDate.isAfter(startDate)) { startDate = entryStartDate; } if (entryEndDate.isBefore(endDate)) { endDate = entryEndDate; } LocalDate date = startDate; do { result.computeIfAbsent(date, it -> new ArrayList<>()).add(entry); date = date.plusDays(1); } while (!date.isAfter(endDate)); }
java
private void addEntryToResult(Map<LocalDate, List<Entry<?>>> result, Entry<?> entry, LocalDate startDate, LocalDate endDate) { LocalDate entryStartDate = entry.getStartDate(); LocalDate entryEndDate = entry.getEndDate(); // entry does not intersect with time interval if (entryEndDate.isBefore(startDate) || entryStartDate.isAfter(endDate)) { return; } if (entryStartDate.isAfter(startDate)) { startDate = entryStartDate; } if (entryEndDate.isBefore(endDate)) { endDate = entryEndDate; } LocalDate date = startDate; do { result.computeIfAbsent(date, it -> new ArrayList<>()).add(entry); date = date.plusDays(1); } while (!date.isAfter(endDate)); }
[ "private", "void", "addEntryToResult", "(", "Map", "<", "LocalDate", ",", "List", "<", "Entry", "<", "?", ">", ">", ">", "result", ",", "Entry", "<", "?", ">", "entry", ",", "LocalDate", "startDate", ",", "LocalDate", "endDate", ")", "{", "LocalDate", ...
/* Assign the given entry to each date that it intersects with in the given search interval.
[ "/", "*", "Assign", "the", "given", "entry", "to", "each", "date", "that", "it", "intersects", "with", "in", "the", "given", "search", "interval", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Calendar.java#L389-L411
fabric8io/ipaas-quickstarts
archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java
ArchetypeBuilder.fileIncludesLine
private boolean fileIncludesLine(File file, String matches) throws IOException { for (String line: Files.readLines(file)) { String trimmed = line.trim(); if (trimmed.equals(matches)) { return true; } } return false; }
java
private boolean fileIncludesLine(File file, String matches) throws IOException { for (String line: Files.readLines(file)) { String trimmed = line.trim(); if (trimmed.equals(matches)) { return true; } } return false; }
[ "private", "boolean", "fileIncludesLine", "(", "File", "file", ",", "String", "matches", ")", "throws", "IOException", "{", "for", "(", "String", "line", ":", "Files", ".", "readLines", "(", "file", ")", ")", "{", "String", "trimmed", "=", "line", ".", "...
Checks whether the file contains specific line. Partial matches do not count.
[ "Checks", "whether", "the", "file", "contains", "specific", "line", ".", "Partial", "matches", "do", "not", "count", "." ]
train
https://github.com/fabric8io/ipaas-quickstarts/blob/cf9a9aa09204a82ac996304ab8c96791f7e5db22/archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java#L683-L691
sebastiangraf/jSCSI
bundles/target/src/main/java/org/jscsi/target/scsi/sense/SenseData.java
SenseData.getReponseCodeFor
public static final int getReponseCodeFor (final ErrorType errorType, final SenseDataFormat senseDataFormat) { if (senseDataFormat == SenseDataFormat.FIXED) { if (errorType == ErrorType.CURRENT) return 0x70; else // errorType == DEFERRED return 0x71; } else {// senseDataFormat == DESCRIPTOR if (errorType == ErrorType.CURRENT) return 0x72; else // errorType == DEFERRED return 0x73; } /* * Response codes 0x74 to 0x7E are reserved. Response code 0x7f is vendor specific. */ }
java
public static final int getReponseCodeFor (final ErrorType errorType, final SenseDataFormat senseDataFormat) { if (senseDataFormat == SenseDataFormat.FIXED) { if (errorType == ErrorType.CURRENT) return 0x70; else // errorType == DEFERRED return 0x71; } else {// senseDataFormat == DESCRIPTOR if (errorType == ErrorType.CURRENT) return 0x72; else // errorType == DEFERRED return 0x73; } /* * Response codes 0x74 to 0x7E are reserved. Response code 0x7f is vendor specific. */ }
[ "public", "static", "final", "int", "getReponseCodeFor", "(", "final", "ErrorType", "errorType", ",", "final", "SenseDataFormat", "senseDataFormat", ")", "{", "if", "(", "senseDataFormat", "==", "SenseDataFormat", ".", "FIXED", ")", "{", "if", "(", "errorType", ...
Returns the proper response code for the given error type and sense data format. @param errorType a sense data error type @param senseDataFormat a sense data format @return the proper response code
[ "Returns", "the", "proper", "response", "code", "for", "the", "given", "error", "type", "and", "sense", "data", "format", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/target/src/main/java/org/jscsi/target/scsi/sense/SenseData.java#L77-L94
craftercms/profile
security-provider/src/main/java/org/craftercms/security/authentication/impl/AuthenticationRequiredHandlerImpl.java
AuthenticationRequiredHandlerImpl.handle
public void handle(RequestContext context, AuthenticationException e) throws SecurityProviderException, IOException { saveRequest(context); String loginFormUrl = getLoginFormUrl(); if (StringUtils.isNotEmpty(loginFormUrl)) { RedirectUtils.redirect(context.getRequest(), context.getResponse(), loginFormUrl); } else { sendError(e, context); } }
java
public void handle(RequestContext context, AuthenticationException e) throws SecurityProviderException, IOException { saveRequest(context); String loginFormUrl = getLoginFormUrl(); if (StringUtils.isNotEmpty(loginFormUrl)) { RedirectUtils.redirect(context.getRequest(), context.getResponse(), loginFormUrl); } else { sendError(e, context); } }
[ "public", "void", "handle", "(", "RequestContext", "context", ",", "AuthenticationException", "e", ")", "throws", "SecurityProviderException", ",", "IOException", "{", "saveRequest", "(", "context", ")", ";", "String", "loginFormUrl", "=", "getLoginFormUrl", "(", ")...
Saves the current request in the request cache and then redirects to the login form page. @param context the request security context @param e the exception with the reason for requiring authentication
[ "Saves", "the", "current", "request", "in", "the", "request", "cache", "and", "then", "redirects", "to", "the", "login", "form", "page", "." ]
train
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/authentication/impl/AuthenticationRequiredHandlerImpl.java#L82-L93
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java
TitlePaneCloseButtonPainter.decodeCloseGradient
private Paint decodeCloseGradient(Shape s, Color top, Color bottom) { Rectangle r = s.getBounds(); int width = r.width; int height = r.height; return createGradient(r.x + width / 2, r.y, r.x + width / 2, r.y + height - 1, new float[] { 0f, 1f }, new Color[] { top, bottom }); }
java
private Paint decodeCloseGradient(Shape s, Color top, Color bottom) { Rectangle r = s.getBounds(); int width = r.width; int height = r.height; return createGradient(r.x + width / 2, r.y, r.x + width / 2, r.y + height - 1, new float[] { 0f, 1f }, new Color[] { top, bottom }); }
[ "private", "Paint", "decodeCloseGradient", "(", "Shape", "s", ",", "Color", "top", ",", "Color", "bottom", ")", "{", "Rectangle", "r", "=", "s", ".", "getBounds", "(", ")", ";", "int", "width", "=", "r", ".", "width", ";", "int", "height", "=", "r", ...
Create the gradient for the close button. @param s the shape to fill. @param top the top color. @param bottom the bottom color. @return the gradient.
[ "Create", "the", "gradient", "for", "the", "close", "button", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L186-L192
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/entityentry/impl/OgmEntityEntryState.java
OgmEntityEntryState.setAssociation
public void setAssociation(String collectionRole, Association association) { if ( associations == null ) { associations = new HashMap<>(); } associations.put( collectionRole, association ); }
java
public void setAssociation(String collectionRole, Association association) { if ( associations == null ) { associations = new HashMap<>(); } associations.put( collectionRole, association ); }
[ "public", "void", "setAssociation", "(", "String", "collectionRole", ",", "Association", "association", ")", "{", "if", "(", "associations", "==", "null", ")", "{", "associations", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "associations", ".", "put", ...
Set the association in the entry state. @param collectionRole the role of the association @param association the association
[ "Set", "the", "association", "in", "the", "entry", "state", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/entityentry/impl/OgmEntityEntryState.java#L76-L81
google/closure-templates
java/src/com/google/template/soy/jbcsrc/shared/RenderContext.java
RenderContext.usePrimaryMsg
public boolean usePrimaryMsg(long msgId, long fallbackId) { // Note: we need to make sure the fallback msg is actually present if we are going to fallback. // use getMsgParts() since if the bundle is a RenderOnlySoyMsgBundleImpl then this will be // allocation free. return !msgBundle.getMsgParts(msgId).isEmpty() || msgBundle.getMsgParts(fallbackId).isEmpty(); }
java
public boolean usePrimaryMsg(long msgId, long fallbackId) { // Note: we need to make sure the fallback msg is actually present if we are going to fallback. // use getMsgParts() since if the bundle is a RenderOnlySoyMsgBundleImpl then this will be // allocation free. return !msgBundle.getMsgParts(msgId).isEmpty() || msgBundle.getMsgParts(fallbackId).isEmpty(); }
[ "public", "boolean", "usePrimaryMsg", "(", "long", "msgId", ",", "long", "fallbackId", ")", "{", "// Note: we need to make sure the fallback msg is actually present if we are going to fallback.", "// use getMsgParts() since if the bundle is a RenderOnlySoyMsgBundleImpl then this will be", ...
Returns {@code true} if the primary msg should be used instead of the fallback.
[ "Returns", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/shared/RenderContext.java#L179-L184
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/ssh/SshUtilities.java
SshUtilities.getRunningDockerContainerId
public static String getRunningDockerContainerId( Session session, String containerName ) throws JSchException, IOException { String command = "docker ps | grep " + containerName; String remoteResponseStr = launchACommand(session, command); if (remoteResponseStr.length() == 0) { return null; } List<String> containerIdsList = new ArrayList<>(); String[] linesSplit = remoteResponseStr.split("\n"); for( String line : linesSplit ) { String[] psSplit = line.split("\\s+"); if (psSplit.length < 3) { throw new JSchException("Could not retrieve container data. Result was: " + line); } String cid = psSplit[0]; containerIdsList.add(cid); } if (containerIdsList.size() > 1) { throw new JSchException("More than one container was identified with the given filters. Check your filters."); } else if (containerIdsList.size() == 0) { return null; } return containerIdsList.get(0); }
java
public static String getRunningDockerContainerId( Session session, String containerName ) throws JSchException, IOException { String command = "docker ps | grep " + containerName; String remoteResponseStr = launchACommand(session, command); if (remoteResponseStr.length() == 0) { return null; } List<String> containerIdsList = new ArrayList<>(); String[] linesSplit = remoteResponseStr.split("\n"); for( String line : linesSplit ) { String[] psSplit = line.split("\\s+"); if (psSplit.length < 3) { throw new JSchException("Could not retrieve container data. Result was: " + line); } String cid = psSplit[0]; containerIdsList.add(cid); } if (containerIdsList.size() > 1) { throw new JSchException("More than one container was identified with the given filters. Check your filters."); } else if (containerIdsList.size() == 0) { return null; } return containerIdsList.get(0); }
[ "public", "static", "String", "getRunningDockerContainerId", "(", "Session", "session", ",", "String", "containerName", ")", "throws", "JSchException", ",", "IOException", "{", "String", "command", "=", "\"docker ps | grep \"", "+", "containerName", ";", "String", "re...
Get the container id of a running docker container. @param session the session to use. @param containerName the name of the container, used in a grep filter. @return the id of the container or null. @throws JSchException @throws IOException
[ "Get", "the", "container", "id", "of", "a", "running", "docker", "container", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/ssh/SshUtilities.java#L162-L185
m-m-m/util
resource/src/main/java/net/sf/mmm/util/resource/base/AbstractBrowsableResourceFactory.java
AbstractBrowsableResourceFactory.registerProvider
public void registerProvider(DataResourceProvider<? extends DataResource> provider, String schemaPrefix) { getInitializationState().requireNotInitilized(); Objects.requireNonNull(provider, "provider"); Objects.requireNonNull(provider.getResourceType(), "provider.resourceType"); String[] schemaPrefixes; if (schemaPrefix == null) { schemaPrefixes = provider.getSchemePrefixes(); } else { schemaPrefixes = new String[] { schemaPrefix }; } Objects.requireNonNull(provider.getResourceType(), "provider.schemaPrefixes"); if (schemaPrefixes.length == 0) { throw new IllegalArgumentException(provider.getClass().getName() + ".getSchemaPrefix().length == 0"); } for (String prefix : schemaPrefixes) { if (this.schema2providerMap.containsKey(prefix)) { throw new IllegalStateException("Duplicate provider (" + provider + ") for prefix: " + prefix); } this.schema2providerMap.put(prefix, provider); } }
java
public void registerProvider(DataResourceProvider<? extends DataResource> provider, String schemaPrefix) { getInitializationState().requireNotInitilized(); Objects.requireNonNull(provider, "provider"); Objects.requireNonNull(provider.getResourceType(), "provider.resourceType"); String[] schemaPrefixes; if (schemaPrefix == null) { schemaPrefixes = provider.getSchemePrefixes(); } else { schemaPrefixes = new String[] { schemaPrefix }; } Objects.requireNonNull(provider.getResourceType(), "provider.schemaPrefixes"); if (schemaPrefixes.length == 0) { throw new IllegalArgumentException(provider.getClass().getName() + ".getSchemaPrefix().length == 0"); } for (String prefix : schemaPrefixes) { if (this.schema2providerMap.containsKey(prefix)) { throw new IllegalStateException("Duplicate provider (" + provider + ") for prefix: " + prefix); } this.schema2providerMap.put(prefix, provider); } }
[ "public", "void", "registerProvider", "(", "DataResourceProvider", "<", "?", "extends", "DataResource", ">", "provider", ",", "String", "schemaPrefix", ")", "{", "getInitializationState", "(", ")", ".", "requireNotInitilized", "(", ")", ";", "Objects", ".", "requi...
This method registers the given {@code provider} for the given {@code schemaPrefix}. @param provider is the {@link DataResourceProvider} to register. @param schemaPrefix is the {@link ResourceUriImpl#getSchemePrefix() scheme-prefix} for which the provider shall be registered.
[ "This", "method", "registers", "the", "given", "{", "@code", "provider", "}", "for", "the", "given", "{", "@code", "schemaPrefix", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/resource/src/main/java/net/sf/mmm/util/resource/base/AbstractBrowsableResourceFactory.java#L52-L73
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java
ZipExploder.processJars
public void processJars(File[] jarFiles, File destDir) throws IOException { for (int i = 0; i < jarFiles.length; i++) { processFile(jarFiles[i], destDir); } }
java
public void processJars(File[] jarFiles, File destDir) throws IOException { for (int i = 0; i < jarFiles.length; i++) { processFile(jarFiles[i], destDir); } }
[ "public", "void", "processJars", "(", "File", "[", "]", "jarFiles", ",", "File", "destDir", ")", "throws", "IOException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "jarFiles", ".", "length", ";", "i", "++", ")", "{", "processFile", "(", ...
Explode source JAR files into a target directory @param jarFiles list of source files @param destDir target directory name (should already exist) @exception IOException error creating a target file
[ "Explode", "source", "JAR", "files", "into", "a", "target", "directory" ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java#L168-L172
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java
Util.readString
static String readString(final InputStream is) { try (final Scanner s = new Scanner(is, "UTF-8")) { s.useDelimiter("\\A"); if (s.hasNext()) { return s.next(); } else { return ""; } } }
java
static String readString(final InputStream is) { try (final Scanner s = new Scanner(is, "UTF-8")) { s.useDelimiter("\\A"); if (s.hasNext()) { return s.next(); } else { return ""; } } }
[ "static", "String", "readString", "(", "final", "InputStream", "is", ")", "{", "try", "(", "final", "Scanner", "s", "=", "new", "Scanner", "(", "is", ",", "\"UTF-8\"", ")", ")", "{", "s", ".", "useDelimiter", "(", "\"\\\\A\"", ")", ";", "if", "(", "s...
Reads a string from an input stream. @param is The input stream., @return A string.
[ "Reads", "a", "string", "from", "an", "input", "stream", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java#L32-L41
redkale/redkale
src/org/redkale/net/http/HttpRequest.java
HttpRequest.getRequstURIPath
public int getRequstURIPath(String prefix, int defvalue) { String val = getRequstURIPath(prefix, null); try { return val == null ? defvalue : Integer.parseInt(val); } catch (NumberFormatException e) { return defvalue; } }
java
public int getRequstURIPath(String prefix, int defvalue) { String val = getRequstURIPath(prefix, null); try { return val == null ? defvalue : Integer.parseInt(val); } catch (NumberFormatException e) { return defvalue; } }
[ "public", "int", "getRequstURIPath", "(", "String", "prefix", ",", "int", "defvalue", ")", "{", "String", "val", "=", "getRequstURIPath", "(", "prefix", ",", "null", ")", ";", "try", "{", "return", "val", "==", "null", "?", "defvalue", ":", "Integer", "....
获取请求URL分段中含prefix段的int值 <br> 例如请求URL /pipes/record/query/offset:0/limit:50 <br> 获取offset参数: int offset = request.getRequstURIPath("offset:", 0); <br> 获取limit参数: int limit = request.getRequstURIPath("limit:", 20); <br> @param prefix prefix段前缀 @param defvalue 默认int值 @return int值
[ "获取请求URL分段中含prefix段的int值", "<br", ">", "例如请求URL", "/", "pipes", "/", "record", "/", "query", "/", "offset", ":", "0", "/", "limit", ":", "50", "<br", ">", "获取offset参数", ":", "int", "offset", "=", "request", ".", "getRequstURIPath", "(", "offset", ":", "0...
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L857-L864
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/registry/ResponseCacheImpl.java
ResponseCacheImpl.getPayLoad
private String getPayLoad(Key key, Application app) { if (app == null) { return EMPTY_PAYLOAD; } EncoderWrapper encoderWrapper = serverCodecs.getEncoder(key.getType(), key.getEurekaAccept()); try { return encoderWrapper.encode(app); } catch (Exception e) { logger.error("Failed to encode the payload for application {}", app.getName(), e); return ""; } }
java
private String getPayLoad(Key key, Application app) { if (app == null) { return EMPTY_PAYLOAD; } EncoderWrapper encoderWrapper = serverCodecs.getEncoder(key.getType(), key.getEurekaAccept()); try { return encoderWrapper.encode(app); } catch (Exception e) { logger.error("Failed to encode the payload for application {}", app.getName(), e); return ""; } }
[ "private", "String", "getPayLoad", "(", "Key", "key", ",", "Application", "app", ")", "{", "if", "(", "app", "==", "null", ")", "{", "return", "EMPTY_PAYLOAD", ";", "}", "EncoderWrapper", "encoderWrapper", "=", "serverCodecs", ".", "getEncoder", "(", "key", ...
Generate pay load with both JSON and XML formats for a given application.
[ "Generate", "pay", "load", "with", "both", "JSON", "and", "XML", "formats", "for", "a", "given", "application", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/registry/ResponseCacheImpl.java#L385-L397
nohana/Amalgam
amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java
DialogFragmentUtils.showOnLoaderCallback
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void showOnLoaderCallback(final android.app.FragmentManager manager, final android.app.DialogFragment fragment, final String tag) { showOnLoaderCallback(HandlerUtils.getMainHandler(), manager, fragment, tag); }
java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void showOnLoaderCallback(final android.app.FragmentManager manager, final android.app.DialogFragment fragment, final String tag) { showOnLoaderCallback(HandlerUtils.getMainHandler(), manager, fragment, tag); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "public", "static", "void", "showOnLoaderCallback", "(", "final", "android", ".", "app", ".", "FragmentManager", "manager", ",", "final", "android", ".", "app", ".", "DialogFragment", ...
Show {@link android.app.DialogFragment} with the specified tag on the loader callbacks. @param manager the manager. @param fragment the fragment. @param tag the tag string that is related to the {@link android.app.DialogFragment}.
[ "Show", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java#L122-L125
amaembo/streamex
src/main/java/one/util/streamex/IntStreamEx.java
IntStreamEx.ofIndices
public static <T> IntStreamEx ofIndices(T[] array, Predicate<T> predicate) { return seq(IntStream.range(0, array.length).filter(i -> predicate.test(array[i]))); }
java
public static <T> IntStreamEx ofIndices(T[] array, Predicate<T> predicate) { return seq(IntStream.range(0, array.length).filter(i -> predicate.test(array[i]))); }
[ "public", "static", "<", "T", ">", "IntStreamEx", "ofIndices", "(", "T", "[", "]", "array", ",", "Predicate", "<", "T", ">", "predicate", ")", "{", "return", "seq", "(", "IntStream", ".", "range", "(", "0", ",", "array", ".", "length", ")", ".", "f...
Returns a sequential ordered {@code IntStreamEx} containing all the indices of the supplied array elements which match given predicate. @param <T> array element type @param array array to get the stream of its indices @param predicate a predicate to test array elements @return a sequential {@code IntStreamEx} of the matched array indices @since 0.1.1
[ "Returns", "a", "sequential", "ordered", "{", "@code", "IntStreamEx", "}", "containing", "all", "the", "indices", "of", "the", "supplied", "array", "elements", "which", "match", "given", "predicate", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L2057-L2059
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/map/JodaBeanSimpleMapReader.java
JodaBeanSimpleMapReader.parseRoot
private <T> T parseRoot(Map<String, Object> input, Class<T> declaredType) throws Exception { Object parsed = parseBean(input, declaredType); return declaredType.cast(parsed); }
java
private <T> T parseRoot(Map<String, Object> input, Class<T> declaredType) throws Exception { Object parsed = parseBean(input, declaredType); return declaredType.cast(parsed); }
[ "private", "<", "T", ">", "T", "parseRoot", "(", "Map", "<", "String", ",", "Object", ">", "input", ",", "Class", "<", "T", ">", "declaredType", ")", "throws", "Exception", "{", "Object", "parsed", "=", "parseBean", "(", "input", ",", "declaredType", "...
Parses the root bean. @param input the map input, not null @param declaredType the declared type, not null @return the bean, not null @throws Exception if an error occurs
[ "Parses", "the", "root", "bean", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/map/JodaBeanSimpleMapReader.java#L90-L93
awin/rabbiteasy
rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/publisher/DiscretePublisher.java
DiscretePublisher.handleIoException
protected void handleIoException(int attempt, IOException ioException) throws IOException { if (channel != null && channel.isOpen()) { try { channel.close(); } catch (IOException e) { LOGGER.warn("Failed to close channel after failed publish", e); } } channel = null; if (attempt == DEFAULT_RETRY_ATTEMPTS) { throw ioException; } try { Thread.sleep(DEFAULT_RETRY_INTERVAL); } catch (InterruptedException e) { LOGGER.warn("Sending message interrupted while waiting for retry attempt", e); } }
java
protected void handleIoException(int attempt, IOException ioException) throws IOException { if (channel != null && channel.isOpen()) { try { channel.close(); } catch (IOException e) { LOGGER.warn("Failed to close channel after failed publish", e); } } channel = null; if (attempt == DEFAULT_RETRY_ATTEMPTS) { throw ioException; } try { Thread.sleep(DEFAULT_RETRY_INTERVAL); } catch (InterruptedException e) { LOGGER.warn("Sending message interrupted while waiting for retry attempt", e); } }
[ "protected", "void", "handleIoException", "(", "int", "attempt", ",", "IOException", "ioException", ")", "throws", "IOException", "{", "if", "(", "channel", "!=", "null", "&&", "channel", ".", "isOpen", "(", ")", ")", "{", "try", "{", "channel", ".", "clos...
Handles an IOException depending on the already used attempts to send a message. Also performs a soft reset of the currently used channel. @param attempt Current attempt count @param ioException The thrown exception @throws IOException if the maximum amount of attempts is exceeded
[ "Handles", "an", "IOException", "depending", "on", "the", "already", "used", "attempts", "to", "send", "a", "message", ".", "Also", "performs", "a", "soft", "reset", "of", "the", "currently", "used", "channel", "." ]
train
https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/publisher/DiscretePublisher.java#L89-L106
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java
MetatypeUtils.parseBoolean
public static boolean parseBoolean(Object configAlias, String propertyKey, Object obj, boolean defaultValue) { if (obj != null) { if (obj instanceof String) { String value = (String) obj; if (value.equalsIgnoreCase("true")) { return true; } else if (value.equalsIgnoreCase("false")) { return false; } else { Tr.warning(tc, "invalidBoolean", configAlias, propertyKey, obj); throw new IllegalArgumentException("Boolean value could not be parsed: key=" + propertyKey + ", value=" + obj); } } else if (obj instanceof Boolean) { return (Boolean) obj; } // unknown type Tr.warning(tc, "invalidBoolean", configAlias, propertyKey, obj); throw new IllegalArgumentException("Boolean value could not be parsed: key=" + propertyKey + ", value=" + obj); } return defaultValue; }
java
public static boolean parseBoolean(Object configAlias, String propertyKey, Object obj, boolean defaultValue) { if (obj != null) { if (obj instanceof String) { String value = (String) obj; if (value.equalsIgnoreCase("true")) { return true; } else if (value.equalsIgnoreCase("false")) { return false; } else { Tr.warning(tc, "invalidBoolean", configAlias, propertyKey, obj); throw new IllegalArgumentException("Boolean value could not be parsed: key=" + propertyKey + ", value=" + obj); } } else if (obj instanceof Boolean) { return (Boolean) obj; } // unknown type Tr.warning(tc, "invalidBoolean", configAlias, propertyKey, obj); throw new IllegalArgumentException("Boolean value could not be parsed: key=" + propertyKey + ", value=" + obj); } return defaultValue; }
[ "public", "static", "boolean", "parseBoolean", "(", "Object", "configAlias", ",", "String", "propertyKey", ",", "Object", "obj", ",", "boolean", "defaultValue", ")", "{", "if", "(", "obj", "!=", "null", ")", "{", "if", "(", "obj", "instanceof", "String", "...
Parse a boolean from the provided config value: checks for whether or not the object read from the Service/Component configuration is a String or a Metatype converted boolean. <p> If an exception occurs converting the object parameter: A translated warning message will be issued using the provided propertyKey and object as parameters. FFDC for the exception is suppressed: Callers should handle the thrown IllegalArgumentException as appropriate. @param configAlias Name of config (pid or alias) associated with a registered service or DS component. @param propertyKey The key used to retrieve the property value from the map. Used in the warning message if the value is badly formed. @param obj The object retrieved from the configuration property map/dictionary. @return boolean parsed from obj, the default value if obj is null. @throws IllegalArgumentException If value is not a String/Boolean, or if the String boolean is not "true" or "false" (ignoring case)
[ "Parse", "a", "boolean", "from", "the", "provided", "config", "value", ":", "checks", "for", "whether", "or", "not", "the", "object", "read", "from", "the", "Service", "/", "Component", "configuration", "is", "a", "String", "or", "a", "Metatype", "converted"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java#L113-L134
looly/hutool
hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java
MapUtil.getShort
public static Short getShort(Map<?, ?> map, Object key) { return get(map, key, Short.class); }
java
public static Short getShort(Map<?, ?> map, Object key) { return get(map, key, Short.class); }
[ "public", "static", "Short", "getShort", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "Object", "key", ")", "{", "return", "get", "(", "map", ",", "key", ",", "Short", ".", "class", ")", ";", "}" ]
获取Map指定key的值,并转换为Short @param map Map @param key 键 @return 值 @since 4.0.6
[ "获取Map指定key的值,并转换为Short" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L804-L806
jhipster/jhipster
jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java
QueryService.buildRangeSpecification
protected <X extends Comparable<? super X>> Specification<ENTITY> buildRangeSpecification(RangeFilter<X> filter, SingularAttribute<? super ENTITY, X> field) { return buildSpecification(filter, root -> root.get(field)); }
java
protected <X extends Comparable<? super X>> Specification<ENTITY> buildRangeSpecification(RangeFilter<X> filter, SingularAttribute<? super ENTITY, X> field) { return buildSpecification(filter, root -> root.get(field)); }
[ "protected", "<", "X", "extends", "Comparable", "<", "?", "super", "X", ">", ">", "Specification", "<", "ENTITY", ">", "buildRangeSpecification", "(", "RangeFilter", "<", "X", ">", "filter", ",", "SingularAttribute", "<", "?", "super", "ENTITY", ",", "X", ...
Helper function to return a specification for filtering on a single {@link Comparable}, where equality, less than, greater than and less-than-or-equal-to and greater-than-or-equal-to and null/non-null conditions are supported. @param filter the individual attribute filter coming from the frontend. @param field the JPA static metamodel representing the field. @param <X> The type of the attribute which is filtered. @return a Specification
[ "Helper", "function", "to", "return", "a", "specification", "for", "filtering", "on", "a", "single", "{", "@link", "Comparable", "}", "where", "equality", "less", "than", "greater", "than", "and", "less", "-", "than", "-", "or", "-", "equal", "-", "to", ...
train
https://github.com/jhipster/jhipster/blob/5dcf4239c7cc035e188ef02447d3c628fac5c5d9/jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java#L124-L127
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java
CaffeineCacheMetrics.monitor
public static <C extends AsyncCache<?, ?>> C monitor(MeterRegistry registry, C cache, String cacheName, String... tags) { return monitor(registry, cache, cacheName, Tags.of(tags)); }
java
public static <C extends AsyncCache<?, ?>> C monitor(MeterRegistry registry, C cache, String cacheName, String... tags) { return monitor(registry, cache, cacheName, Tags.of(tags)); }
[ "public", "static", "<", "C", "extends", "AsyncCache", "<", "?", ",", "?", ">", ">", "C", "monitor", "(", "MeterRegistry", "registry", ",", "C", "cache", ",", "String", "cacheName", ",", "String", "...", "tags", ")", "{", "return", "monitor", "(", "reg...
Record metrics on a Caffeine cache. You must call {@link Caffeine#recordStats()} prior to building the cache for metrics to be recorded. @param registry The registry to bind metrics to. @param cache The cache to instrument. @param cacheName Will be used to tag metrics with "cache". @param tags Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags. @param <C> The cache type. @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way.
[ "Record", "metrics", "on", "a", "Caffeine", "cache", ".", "You", "must", "call", "{", "@link", "Caffeine#recordStats", "()", "}", "prior", "to", "building", "the", "cache", "for", "metrics", "to", "be", "recorded", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java#L99-L101
amaembo/streamex
src/main/java/one/util/streamex/IntStreamEx.java
IntStreamEx.maxByDouble
public OptionalInt maxByDouble(IntToDoubleFunction keyExtractor) { return collect(PrimitiveBox::new, (box, i) -> { double key = keyExtractor.applyAsDouble(i); if (!box.b || Double.compare(box.d, key) < 0) { box.b = true; box.d = key; box.i = i; } }, PrimitiveBox.MAX_DOUBLE).asInt(); }
java
public OptionalInt maxByDouble(IntToDoubleFunction keyExtractor) { return collect(PrimitiveBox::new, (box, i) -> { double key = keyExtractor.applyAsDouble(i); if (!box.b || Double.compare(box.d, key) < 0) { box.b = true; box.d = key; box.i = i; } }, PrimitiveBox.MAX_DOUBLE).asInt(); }
[ "public", "OptionalInt", "maxByDouble", "(", "IntToDoubleFunction", "keyExtractor", ")", "{", "return", "collect", "(", "PrimitiveBox", "::", "new", ",", "(", "box", ",", "i", ")", "->", "{", "double", "key", "=", "keyExtractor", ".", "applyAsDouble", "(", "...
Returns the maximum element of this stream according to the provided key extractor function. <p> This is a terminal operation. @param keyExtractor a non-interfering, stateless function @return an {@code OptionalInt} describing the first element of this stream for which the highest value was returned by key extractor, or an empty {@code OptionalInt} if the stream is empty @since 0.1.2
[ "Returns", "the", "maximum", "element", "of", "this", "stream", "according", "to", "the", "provided", "key", "extractor", "function", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L1188-L1197
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_databaseAvailableVersion_GET
public OvhAvailableVersionStruct serviceName_databaseAvailableVersion_GET(String serviceName, OvhDatabaseTypeEnum type) throws IOException { String qPath = "/hosting/web/{serviceName}/databaseAvailableVersion"; StringBuilder sb = path(qPath, serviceName); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAvailableVersionStruct.class); }
java
public OvhAvailableVersionStruct serviceName_databaseAvailableVersion_GET(String serviceName, OvhDatabaseTypeEnum type) throws IOException { String qPath = "/hosting/web/{serviceName}/databaseAvailableVersion"; StringBuilder sb = path(qPath, serviceName); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAvailableVersionStruct.class); }
[ "public", "OvhAvailableVersionStruct", "serviceName_databaseAvailableVersion_GET", "(", "String", "serviceName", ",", "OvhDatabaseTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/databaseAvailableVersion\"", ";", "StringB...
List available database version following a type REST: GET /hosting/web/{serviceName}/databaseAvailableVersion @param type [required] Type of the database @param serviceName [required] The internal name of your hosting
[ "List", "available", "database", "version", "following", "a", "type" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L753-L759
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/ValueStore.java
ValueStore.addAndGetPosition
public int addAndGetPosition(Type type, Block block, int position, long valueHash) { if (values.getPositionCount() >= maxFill) { rehash(); } int bucketId = getBucketId(valueHash, mask); int valuePointer; // look for an empty slot or a slot containing this key int probeCount = 1; int originalBucketId = bucketId; while (true) { checkState(probeCount < bucketCount, "could not find match for value nor empty slot in %s buckets", bucketCount); valuePointer = buckets.get(bucketId); if (valuePointer == EMPTY_BUCKET) { valuePointer = values.getPositionCount(); valueHashes.set(valuePointer, (int) valueHash); type.appendTo(block, position, values); buckets.set(bucketId, valuePointer); return valuePointer; } else if (type.equalTo(block, position, values, valuePointer)) { // value at position return valuePointer; } else { int probe = nextProbe(probeCount); bucketId = nextBucketId(originalBucketId, mask, probe); probeCount++; } } }
java
public int addAndGetPosition(Type type, Block block, int position, long valueHash) { if (values.getPositionCount() >= maxFill) { rehash(); } int bucketId = getBucketId(valueHash, mask); int valuePointer; // look for an empty slot or a slot containing this key int probeCount = 1; int originalBucketId = bucketId; while (true) { checkState(probeCount < bucketCount, "could not find match for value nor empty slot in %s buckets", bucketCount); valuePointer = buckets.get(bucketId); if (valuePointer == EMPTY_BUCKET) { valuePointer = values.getPositionCount(); valueHashes.set(valuePointer, (int) valueHash); type.appendTo(block, position, values); buckets.set(bucketId, valuePointer); return valuePointer; } else if (type.equalTo(block, position, values, valuePointer)) { // value at position return valuePointer; } else { int probe = nextProbe(probeCount); bucketId = nextBucketId(originalBucketId, mask, probe); probeCount++; } } }
[ "public", "int", "addAndGetPosition", "(", "Type", "type", ",", "Block", "block", ",", "int", "position", ",", "long", "valueHash", ")", "{", "if", "(", "values", ".", "getPositionCount", "(", ")", ">=", "maxFill", ")", "{", "rehash", "(", ")", ";", "}...
This will add an item if not already in the system. It returns a pointer that is unique for multiple instances of the value. If item present, returns the pointer into the system
[ "This", "will", "add", "an", "item", "if", "not", "already", "in", "the", "system", ".", "It", "returns", "a", "pointer", "that", "is", "unique", "for", "multiple", "instances", "of", "the", "value", ".", "If", "item", "present", "returns", "the", "point...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/ValueStore.java#L71-L105
apache/reef
lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/AvroUtils.java
AvroUtils.toBytes
static <T> byte[] toBytes(final T avroObject, final Class<T> theClass) { final DatumWriter<T> datumWriter = new SpecificDatumWriter<>(theClass); final byte[] theBytes; try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) { final BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(out, null); datumWriter.write(avroObject, encoder); encoder.flush(); out.flush(); theBytes = out.toByteArray(); } catch (final IOException e) { throw new RuntimeException("Unable to serialize an avro object", e); } return theBytes; }
java
static <T> byte[] toBytes(final T avroObject, final Class<T> theClass) { final DatumWriter<T> datumWriter = new SpecificDatumWriter<>(theClass); final byte[] theBytes; try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) { final BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(out, null); datumWriter.write(avroObject, encoder); encoder.flush(); out.flush(); theBytes = out.toByteArray(); } catch (final IOException e) { throw new RuntimeException("Unable to serialize an avro object", e); } return theBytes; }
[ "static", "<", "T", ">", "byte", "[", "]", "toBytes", "(", "final", "T", "avroObject", ",", "final", "Class", "<", "T", ">", "theClass", ")", "{", "final", "DatumWriter", "<", "T", ">", "datumWriter", "=", "new", "SpecificDatumWriter", "<>", "(", "theC...
Serializes the given avro object to a byte[]. @param avroObject @param theClass @param <T> @return
[ "Serializes", "the", "given", "avro", "object", "to", "a", "byte", "[]", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/AvroUtils.java#L44-L57
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/TwoPhaseAnnotationProcessor.java
TwoPhaseAnnotationProcessor.printWarning
public void printWarning( Declaration d, String id, Object... args ) { addWarning( d, id, args ); }
java
public void printWarning( Declaration d, String id, Object... args ) { addWarning( d, id, args ); }
[ "public", "void", "printWarning", "(", "Declaration", "d", ",", "String", "id", ",", "Object", "...", "args", ")", "{", "addWarning", "(", "d", ",", "id", ",", "args", ")", ";", "}" ]
Report a warning detected during the "check" phase. The presence of warnings will not affect execution of the "generate" phase.
[ "Report", "a", "warning", "detected", "during", "the", "check", "phase", ".", "The", "presence", "of", "warnings", "will", "not", "affect", "execution", "of", "the", "generate", "phase", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/TwoPhaseAnnotationProcessor.java#L166-L169
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/link/KNXNetworkLinkIP.java
KNXNetworkLinkIP.sendRequest
public void sendRequest(KNXAddress dst, Priority p, byte[] nsdu) throws KNXLinkClosedException, KNXTimeoutException { send(dst, p, nsdu, false); }
java
public void sendRequest(KNXAddress dst, Priority p, byte[] nsdu) throws KNXLinkClosedException, KNXTimeoutException { send(dst, p, nsdu, false); }
[ "public", "void", "sendRequest", "(", "KNXAddress", "dst", ",", "Priority", "p", ",", "byte", "[", "]", "nsdu", ")", "throws", "KNXLinkClosedException", ",", "KNXTimeoutException", "{", "send", "(", "dst", ",", "p", ",", "nsdu", ",", "false", ")", ";", "...
{@inheritDoc} When communicating with a KNX network which uses open medium, messages are broadcasted within domain (as opposite to system broadcast) by default. Specify <code>dst null</code> for system broadcast.
[ "{" ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/link/KNXNetworkLinkIP.java#L352-L356
Harium/keel
src/main/java/com/harium/keel/catalano/math/ComplexNumber.java
ComplexNumber.Subtract
public static ComplexNumber Subtract(ComplexNumber z1, ComplexNumber z2) { return new ComplexNumber(z1.real - z2.real, z1.imaginary - z2.imaginary); }
java
public static ComplexNumber Subtract(ComplexNumber z1, ComplexNumber z2) { return new ComplexNumber(z1.real - z2.real, z1.imaginary - z2.imaginary); }
[ "public", "static", "ComplexNumber", "Subtract", "(", "ComplexNumber", "z1", ",", "ComplexNumber", "z2", ")", "{", "return", "new", "ComplexNumber", "(", "z1", ".", "real", "-", "z2", ".", "real", ",", "z1", ".", "imaginary", "-", "z2", ".", "imaginary", ...
Subtract two complex numbers. @param z1 Complex Number. @param z2 Complex Number. @return Returns new ComplexNumber instance containing the subtract of specified complex numbers.
[ "Subtract", "two", "complex", "numbers", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/ComplexNumber.java#L272-L274
alkacon/opencms-core
src/org/opencms/webdav/CmsWebdavServlet.java
CmsWebdavServlet.generateLockToken
private String generateLockToken(HttpServletRequest req, CmsRepositoryLockInfo lock) { String lockTokenStr = req.getServletPath() + "-" + req.getUserPrincipal() + "-" + lock.getOwner() + "-" + lock.getPath() + "-" + m_secret; return MD5_ENCODER.encode(m_md5Helper.digest(lockTokenStr.getBytes())); }
java
private String generateLockToken(HttpServletRequest req, CmsRepositoryLockInfo lock) { String lockTokenStr = req.getServletPath() + "-" + req.getUserPrincipal() + "-" + lock.getOwner() + "-" + lock.getPath() + "-" + m_secret; return MD5_ENCODER.encode(m_md5Helper.digest(lockTokenStr.getBytes())); }
[ "private", "String", "generateLockToken", "(", "HttpServletRequest", "req", ",", "CmsRepositoryLockInfo", "lock", ")", "{", "String", "lockTokenStr", "=", "req", ".", "getServletPath", "(", ")", "+", "\"-\"", "+", "req", ".", "getUserPrincipal", "(", ")", "+", ...
Generates a lock token out of the lock and some information out of the request to make it unique.<p> @param req the servlet request we are processing @param lock the lock with the information for the lock token @return the generated lock token
[ "Generates", "a", "lock", "token", "out", "of", "the", "lock", "and", "some", "information", "out", "of", "the", "request", "to", "make", "it", "unique", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/webdav/CmsWebdavServlet.java#L3053-L3066
MenoData/Time4J
base/src/main/java/net/time4j/SystemClock.java
SystemClock.synchronizedWith
public SystemClock synchronizedWith(TimeSource<?> clock) { Moment time = Moment.from(clock.currentTime()); long compare = (MONOTON_MODE ? System.nanoTime() : PROVIDER.getNanos()); long utc = time.getElapsedTime(TimeScale.UTC); long instantNanos = Math.multiplyExact(utc, MRD) + time.getNanosecond(TimeScale.UTC); long newOffset = Math.subtractExact(instantNanos, compare); return new SystemClock(this.monotonic, newOffset); }
java
public SystemClock synchronizedWith(TimeSource<?> clock) { Moment time = Moment.from(clock.currentTime()); long compare = (MONOTON_MODE ? System.nanoTime() : PROVIDER.getNanos()); long utc = time.getElapsedTime(TimeScale.UTC); long instantNanos = Math.multiplyExact(utc, MRD) + time.getNanosecond(TimeScale.UTC); long newOffset = Math.subtractExact(instantNanos, compare); return new SystemClock(this.monotonic, newOffset); }
[ "public", "SystemClock", "synchronizedWith", "(", "TimeSource", "<", "?", ">", "clock", ")", "{", "Moment", "time", "=", "Moment", ".", "from", "(", "clock", ".", "currentTime", "(", ")", ")", ";", "long", "compare", "=", "(", "MONOTON_MODE", "?", "Syste...
/*[deutsch] <p>Synchronisiert diese Instanz mit der angegebenen Zeitquelle und liefert eine neue Kopie. </p> <p>Diese Methode ist nur relevant, wenn diese Uhr im monotonen Modus l&auml;uft. Es wird dringend angeraten, nicht w&auml;hrend oder nahe einer Schaltsekunde zu eichen. Achtung: Diese Methode kann Zeitspr&uuml;nge verursachen - eventuell sogar r&uuml;ckw&auml;rts. </p> @param clock another clock which this instance should be synchronized with @return synchronized copy of this instance @see #MONOTONIC @since 3.2/4.1
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Synchronisiert", "diese", "Instanz", "mit", "der", "angegebenen", "Zeitquelle", "und", "liefert", "eine", "neue", "Kopie", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/SystemClock.java#L454-L465
arnaudroger/SimpleFlatMapper
sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/CrudDSL.java
CrudDSL.to
public Crud<T, K> to(Connection connection) throws SQLException { return table(connection, getTable(connection, target)); }
java
public Crud<T, K> to(Connection connection) throws SQLException { return table(connection, getTable(connection, target)); }
[ "public", "Crud", "<", "T", ",", "K", ">", "to", "(", "Connection", "connection", ")", "throws", "SQLException", "{", "return", "table", "(", "connection", ",", "getTable", "(", "connection", ",", "target", ")", ")", ";", "}" ]
Create a connected crud validating it against the specified connection. The table name is derived from the jpa annotation or from the class name. @param connection the connection @return a new crud instance @throws SQLException if an error occurred
[ "Create", "a", "connected", "crud", "validating", "it", "against", "the", "specified", "connection", ".", "The", "table", "name", "is", "derived", "from", "the", "jpa", "annotation", "or", "from", "the", "class", "name", "." ]
train
https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/CrudDSL.java#L99-L101
buschmais/jqa-maven3-plugin
src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java
MavenModelScannerPlugin.getMavenArtifactDescriptor
private MavenArtifactDescriptor getMavenArtifactDescriptor(Dependency dependency, ScannerContext context) { DependencyCoordinates coordinates = new DependencyCoordinates(dependency); return getArtifactResolver(context).resolve(coordinates, context); }
java
private MavenArtifactDescriptor getMavenArtifactDescriptor(Dependency dependency, ScannerContext context) { DependencyCoordinates coordinates = new DependencyCoordinates(dependency); return getArtifactResolver(context).resolve(coordinates, context); }
[ "private", "MavenArtifactDescriptor", "getMavenArtifactDescriptor", "(", "Dependency", "dependency", ",", "ScannerContext", "context", ")", "{", "DependencyCoordinates", "coordinates", "=", "new", "DependencyCoordinates", "(", "dependency", ")", ";", "return", "getArtifactR...
Creates a MavenArtifactDescriptor and fills it with all information from given dependency. @param dependency Dependency. @param context The scanner context. @return The MavenArtifactDescriptor.
[ "Creates", "a", "MavenArtifactDescriptor", "and", "fills", "it", "with", "all", "information", "from", "given", "dependency", "." ]
train
https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L635-L638
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_DELETE
public OvhTask serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_DELETE(String serviceName, String lanName, String dhcpName, String MACAddress) throws IOException { String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}"; StringBuilder sb = path(qPath, serviceName, lanName, dhcpName, MACAddress); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_DELETE(String serviceName, String lanName, String dhcpName, String MACAddress) throws IOException { String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}"; StringBuilder sb = path(qPath, serviceName, lanName, dhcpName, MACAddress); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_DELETE", "(", "String", "serviceName", ",", "String", "lanName", ",", "String", "dhcpName", ",", "String", "MACAddress", ")", "throws", "IOException", "{", "String", "qPath", "=...
Delete this port mapping REST: DELETE /xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress} @param serviceName [required] The internal name of your XDSL offer @param lanName [required] Name of the LAN @param dhcpName [required] Name of the DHCP @param MACAddress [required] The MAC address of the device
[ "Delete", "this", "port", "mapping" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1122-L1127
jcustenborder/connect-utils
connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/validators/Validators.java
Validators.validEnum
public static Validator validEnum(Class<? extends Enum> enumClass, Enum... excludes) { String[] ex = new String[excludes.length]; for (int i = 0; i < ex.length; i++) { ex[i] = excludes[i].toString(); } return ValidEnum.of(enumClass, ex); }
java
public static Validator validEnum(Class<? extends Enum> enumClass, Enum... excludes) { String[] ex = new String[excludes.length]; for (int i = 0; i < ex.length; i++) { ex[i] = excludes[i].toString(); } return ValidEnum.of(enumClass, ex); }
[ "public", "static", "Validator", "validEnum", "(", "Class", "<", "?", "extends", "Enum", ">", "enumClass", ",", "Enum", "...", "excludes", ")", "{", "String", "[", "]", "ex", "=", "new", "String", "[", "excludes", ".", "length", "]", ";", "for", "(", ...
Method is used to create a new INSTANCE of the enum validator. @param enumClass Enum class with the entries to validate for. @param excludes Enum entries to exclude from the validator. @return validator
[ "Method", "is", "used", "to", "create", "a", "new", "INSTANCE", "of", "the", "enum", "validator", "." ]
train
https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/validators/Validators.java#L134-L140
Erudika/para
para-core/src/main/java/com/erudika/para/utils/Utils.java
Utils.stripAndTrim
public static String stripAndTrim(String str, String replaceWith) { return stripAndTrim(str, replaceWith, false); }
java
public static String stripAndTrim(String str, String replaceWith) { return stripAndTrim(str, replaceWith, false); }
[ "public", "static", "String", "stripAndTrim", "(", "String", "str", ",", "String", "replaceWith", ")", "{", "return", "stripAndTrim", "(", "str", ",", "replaceWith", ",", "false", ")", ";", "}" ]
Strips all symbols, punctuation, whitespace and control chars from a string. @param str a dirty string @param replaceWith a string to replace spaces with @return a clean string
[ "Strips", "all", "symbols", "punctuation", "whitespace", "and", "control", "chars", "from", "a", "string", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L336-L338
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/XMLProperties.java
XMLProperties.getPropertyValue
public Object getPropertyValue(String pKey, Object pDefaultValue) { Object value = super.get(pKey); // super.get() is EXTREMELEY IMPORTANT if (value != null) { return value; } if (defaults instanceof XMLProperties) { return (((XMLProperties) defaults).getPropertyValue(pKey)); } return ((defaults != null) ? defaults.getProperty(pKey) : pDefaultValue); }
java
public Object getPropertyValue(String pKey, Object pDefaultValue) { Object value = super.get(pKey); // super.get() is EXTREMELEY IMPORTANT if (value != null) { return value; } if (defaults instanceof XMLProperties) { return (((XMLProperties) defaults).getPropertyValue(pKey)); } return ((defaults != null) ? defaults.getProperty(pKey) : pDefaultValue); }
[ "public", "Object", "getPropertyValue", "(", "String", "pKey", ",", "Object", "pDefaultValue", ")", "{", "Object", "value", "=", "super", ".", "get", "(", "pKey", ")", ";", "// super.get() is EXTREMELEY IMPORTANT\r", "if", "(", "value", "!=", "null", ")", "{",...
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found. @param pKey the property key. @param pDefaultValue the default value. @return the value in this property list with the specified key value. @see #getPropertyValue(String) @see Properties#defaults
[ "Searches", "for", "the", "property", "with", "the", "specified", "key", "in", "this", "property", "list", ".", "If", "the", "key", "is", "not", "found", "in", "this", "property", "list", "the", "default", "property", "list", "and", "its", "defaults", "rec...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/XMLProperties.java#L551-L562
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java
ServletUtil.getDateParameter
public static long getDateParameter(final ServletRequest pReq, final String pName, final long pDefault) { String str = pReq.getParameter(pName); try { return str != null ? StringUtil.toDate(str).getTime() : pDefault; } catch (IllegalArgumentException iae) { return pDefault; } }
java
public static long getDateParameter(final ServletRequest pReq, final String pName, final long pDefault) { String str = pReq.getParameter(pName); try { return str != null ? StringUtil.toDate(str).getTime() : pDefault; } catch (IllegalArgumentException iae) { return pDefault; } }
[ "public", "static", "long", "getDateParameter", "(", "final", "ServletRequest", "pReq", ",", "final", "String", "pName", ",", "final", "long", "pDefault", ")", "{", "String", "str", "=", "pReq", ".", "getParameter", "(", "pName", ")", ";", "try", "{", "ret...
Gets the value of the given parameter from the request converted to a {@code Date}.&nbsp;If the parameter is not set or not parseable, the default value is returned. @param pReq the servlet request @param pName the parameter name @param pDefault the default value @return the value of the parameter converted to a {@code Date}, or the default value, if the parameter is not set. @see com.twelvemonkeys.lang.StringUtil#toDate(String)
[ "Gets", "the", "value", "of", "the", "given", "parameter", "from", "the", "request", "converted", "to", "a", "{", "@code", "Date", "}", ".", "&nbsp", ";", "If", "the", "parameter", "is", "not", "set", "or", "not", "parseable", "the", "default", "value", ...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java#L295-L303
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/transferlearning/TransferLearningHelper.java
TransferLearningHelper.featurize
public DataSet featurize(DataSet input) { if (isGraph) { //trying to featurize for a computation graph if (origGraph.getNumInputArrays() > 1 || origGraph.getNumOutputArrays() > 1) { throw new IllegalArgumentException( "Input or output size to a computation graph is greater than one. Requires use of a MultiDataSet."); } else { if (input.getFeaturesMaskArray() != null) { throw new IllegalArgumentException( "Currently cannot support featurizing datasets with feature masks"); } MultiDataSet inbW = new MultiDataSet(new INDArray[] {input.getFeatures()}, new INDArray[] {input.getLabels()}, null, new INDArray[] {input.getLabelsMaskArray()}); MultiDataSet ret = featurize(inbW); return new DataSet(ret.getFeatures()[0], input.getLabels(), ret.getLabelsMaskArrays()[0], input.getLabelsMaskArray()); } } else { if (input.getFeaturesMaskArray() != null) throw new UnsupportedOperationException("Feature masks not supported with featurizing currently"); return new DataSet(origMLN.feedForwardToLayer(frozenInputLayer + 1, input.getFeatures(), false) .get(frozenInputLayer + 1), input.getLabels(), null, input.getLabelsMaskArray()); } }
java
public DataSet featurize(DataSet input) { if (isGraph) { //trying to featurize for a computation graph if (origGraph.getNumInputArrays() > 1 || origGraph.getNumOutputArrays() > 1) { throw new IllegalArgumentException( "Input or output size to a computation graph is greater than one. Requires use of a MultiDataSet."); } else { if (input.getFeaturesMaskArray() != null) { throw new IllegalArgumentException( "Currently cannot support featurizing datasets with feature masks"); } MultiDataSet inbW = new MultiDataSet(new INDArray[] {input.getFeatures()}, new INDArray[] {input.getLabels()}, null, new INDArray[] {input.getLabelsMaskArray()}); MultiDataSet ret = featurize(inbW); return new DataSet(ret.getFeatures()[0], input.getLabels(), ret.getLabelsMaskArrays()[0], input.getLabelsMaskArray()); } } else { if (input.getFeaturesMaskArray() != null) throw new UnsupportedOperationException("Feature masks not supported with featurizing currently"); return new DataSet(origMLN.feedForwardToLayer(frozenInputLayer + 1, input.getFeatures(), false) .get(frozenInputLayer + 1), input.getLabels(), null, input.getLabelsMaskArray()); } }
[ "public", "DataSet", "featurize", "(", "DataSet", "input", ")", "{", "if", "(", "isGraph", ")", "{", "//trying to featurize for a computation graph", "if", "(", "origGraph", ".", "getNumInputArrays", "(", ")", ">", "1", "||", "origGraph", ".", "getNumOutputArrays"...
During training frozen vertices/layers can be treated as "featurizing" the input The forward pass through these frozen layer/vertices can be done in advance and the dataset saved to disk to iterate quickly on the smaller unfrozen part of the model Currently does not support datasets with feature masks @param input multidataset to feed into the computation graph with frozen layer vertices @return a multidataset with input features that are the outputs of the frozen layer vertices and the original labels.
[ "During", "training", "frozen", "vertices", "/", "layers", "can", "be", "treated", "as", "featurizing", "the", "input", "The", "forward", "pass", "through", "these", "frozen", "layer", "/", "vertices", "can", "be", "done", "in", "advance", "and", "the", "dat...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/transferlearning/TransferLearningHelper.java#L360-L383
javalite/activeweb
activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java
HttpSupport.sendCookie
public void sendCookie(String name, String value) { RequestContext.getHttpResponse().addCookie(Cookie.toServletCookie(new Cookie(name, value))); }
java
public void sendCookie(String name, String value) { RequestContext.getHttpResponse().addCookie(Cookie.toServletCookie(new Cookie(name, value))); }
[ "public", "void", "sendCookie", "(", "String", "name", ",", "String", "value", ")", "{", "RequestContext", ".", "getHttpResponse", "(", ")", ".", "addCookie", "(", "Cookie", ".", "toServletCookie", "(", "new", "Cookie", "(", "name", ",", "value", ")", ")",...
Sends cookie to browse with response. @param name name of cookie @param value value of cookie.
[ "Sends", "cookie", "to", "browse", "with", "response", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L1319-L1321
powermock/powermock
powermock-core/src/main/java/org/powermock/mockpolicies/support/LogPolicySupport.java
LogPolicySupport.getType
public Class<?> getType(String name, String logFramework) throws Exception { final Class<?> loggerType; try { loggerType = Class.forName(name); } catch (ClassNotFoundException e) { final String message = String.format("Cannot find %s in the classpath which the %s policy requires.", logFramework, getClass() .getSimpleName()); throw new RuntimeException(message, e); } return loggerType; }
java
public Class<?> getType(String name, String logFramework) throws Exception { final Class<?> loggerType; try { loggerType = Class.forName(name); } catch (ClassNotFoundException e) { final String message = String.format("Cannot find %s in the classpath which the %s policy requires.", logFramework, getClass() .getSimpleName()); throw new RuntimeException(message, e); } return loggerType; }
[ "public", "Class", "<", "?", ">", "getType", "(", "String", "name", ",", "String", "logFramework", ")", "throws", "Exception", "{", "final", "Class", "<", "?", ">", "loggerType", ";", "try", "{", "loggerType", "=", "Class", ".", "forName", "(", "name", ...
Get the class type representing the fully-qualified name. @param name The fully-qualified name of a class to get. @param logFramework The log framework that should be printed if the class cannot be found. @return The class representing the fully-qualified name. @throws Exception If something unexpected goes wrong, for example if the class cannot be found.
[ "Get", "the", "class", "type", "representing", "the", "fully", "-", "qualified", "name", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/mockpolicies/support/LogPolicySupport.java#L62-L72
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java
MLEDependencyGrammar.getCachedITW
private IntTaggedWord getCachedITW(short tag) { // The +2 below is because -1 and -2 are used with special meanings (see IntTaggedWord). if (tagITWList == null) { tagITWList = new ArrayList<IntTaggedWord>(numTagBins + 2); for (int i=0; i<numTagBins + 2; i++) { tagITWList.add(i, null); } } IntTaggedWord headT = tagITWList.get(tagBin(tag) + 2); if (headT == null) { headT = new IntTaggedWord(ANY_WORD_INT, tagBin(tag)); tagITWList.set(tagBin(tag) + 2, headT); } return headT; }
java
private IntTaggedWord getCachedITW(short tag) { // The +2 below is because -1 and -2 are used with special meanings (see IntTaggedWord). if (tagITWList == null) { tagITWList = new ArrayList<IntTaggedWord>(numTagBins + 2); for (int i=0; i<numTagBins + 2; i++) { tagITWList.add(i, null); } } IntTaggedWord headT = tagITWList.get(tagBin(tag) + 2); if (headT == null) { headT = new IntTaggedWord(ANY_WORD_INT, tagBin(tag)); tagITWList.set(tagBin(tag) + 2, headT); } return headT; }
[ "private", "IntTaggedWord", "getCachedITW", "(", "short", "tag", ")", "{", "// The +2 below is because -1 and -2 are used with special meanings (see IntTaggedWord).\r", "if", "(", "tagITWList", "==", "null", ")", "{", "tagITWList", "=", "new", "ArrayList", "<", "IntTaggedWo...
This maps from a tag to a cached IntTagWord that represents the tag by having the wildcard word ANY_WORD_INT and the tag in the reduced tag space. The argument is in terms of the full tag space; internally this function maps to the reduced space. @param tag short representation of tag in full tag space @return an IntTaggedWord in the reduced tag space
[ "This", "maps", "from", "a", "tag", "to", "a", "cached", "IntTagWord", "that", "represents", "the", "tag", "by", "having", "the", "wildcard", "word", "ANY_WORD_INT", "and", "the", "tag", "in", "the", "reduced", "tag", "space", ".", "The", "argument", "is",...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java#L373-L387
gallandarakhneorg/afc
core/text/src/main/java/org/arakhne/afc/text/TextUtil.java
TextUtil.formatHex
@Pure @Inline(value = "$3.formatHex($1, $2)", imported = {StringEscaper.class}) public static String formatHex(int amount, int digits) { return StringEscaper.formatHex(amount, digits); }
java
@Pure @Inline(value = "$3.formatHex($1, $2)", imported = {StringEscaper.class}) public static String formatHex(int amount, int digits) { return StringEscaper.formatHex(amount, digits); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"$3.formatHex($1, $2)\"", ",", "imported", "=", "{", "StringEscaper", ".", "class", "}", ")", "public", "static", "String", "formatHex", "(", "int", "amount", ",", "int", "digits", ")", "{", "return", "Strin...
Format the given int value to hexadecimal. @param amount the value to convert. @param digits the minimal number of digits. @return a string representation of the given value. @since 15.0
[ "Format", "the", "given", "int", "value", "to", "hexadecimal", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L1627-L1631
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java
MapTileCollisionLoader.loadTileCollisions
private void loadTileCollisions(MapTileCollision mapCollision, Tile tile) { final TileCollision tileCollision; if (!tile.hasFeature(TileCollision.class)) { tileCollision = new TileCollisionModel(tile); tile.addFeature(tileCollision); } else { tileCollision = tile.getFeature(TileCollision.class); } tileCollision.removeCollisionFormulas(); addTileCollisions(mapCollision, tileCollision, tile); }
java
private void loadTileCollisions(MapTileCollision mapCollision, Tile tile) { final TileCollision tileCollision; if (!tile.hasFeature(TileCollision.class)) { tileCollision = new TileCollisionModel(tile); tile.addFeature(tileCollision); } else { tileCollision = tile.getFeature(TileCollision.class); } tileCollision.removeCollisionFormulas(); addTileCollisions(mapCollision, tileCollision, tile); }
[ "private", "void", "loadTileCollisions", "(", "MapTileCollision", "mapCollision", ",", "Tile", "tile", ")", "{", "final", "TileCollision", "tileCollision", ";", "if", "(", "!", "tile", ".", "hasFeature", "(", "TileCollision", ".", "class", ")", ")", "{", "tile...
Load the tile collisions. @param mapCollision The map tile collision owner. @param tile The tile reference.
[ "Load", "the", "tile", "collisions", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java#L264-L278
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/utils/DbcHelper.java
DbcHelper.registerJdbcDataSource
public static boolean registerJdbcDataSource(String name, DataSource dataSource) { return jdbcDataSources.putIfAbsent(name, dataSource) == null; }
java
public static boolean registerJdbcDataSource(String name, DataSource dataSource) { return jdbcDataSources.putIfAbsent(name, dataSource) == null; }
[ "public", "static", "boolean", "registerJdbcDataSource", "(", "String", "name", ",", "DataSource", "dataSource", ")", "{", "return", "jdbcDataSources", ".", "putIfAbsent", "(", "name", ",", "dataSource", ")", "==", "null", ";", "}" ]
Registers a named JDBC datasource. @param name @param dataSource @return
[ "Registers", "a", "named", "JDBC", "datasource", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/utils/DbcHelper.java#L39-L41
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java
CudaZeroHandler.fallback
@Override @Deprecated public void fallback(AllocationPoint point, AllocationShape shape) { throw new IllegalStateException("Can't fallback from [" + point.getAllocationStatus() + "]"); }
java
@Override @Deprecated public void fallback(AllocationPoint point, AllocationShape shape) { throw new IllegalStateException("Can't fallback from [" + point.getAllocationStatus() + "]"); }
[ "@", "Override", "@", "Deprecated", "public", "void", "fallback", "(", "AllocationPoint", "point", ",", "AllocationShape", "shape", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Can't fallback from [\"", "+", "point", ".", "getAllocationStatus", "(", ")...
Copies memory from device to zero-copy memory @param point @param shape
[ "Copies", "memory", "from", "device", "to", "zero", "-", "copy", "memory" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java#L487-L491
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsMetaClassUtils.java
GrailsMetaClassUtils.getPropertyIfExists
@SuppressWarnings("unchecked") public static <T> T getPropertyIfExists(Object instance, String property, Class<T> requiredType) { MetaClass metaClass = getMetaClass(instance); MetaProperty metaProperty = metaClass.getMetaProperty(property); if (metaProperty != null) { Object value = metaProperty.getProperty(instance); if (value != null && requiredType.isInstance(value)) { return (T) value; } } return null; }
java
@SuppressWarnings("unchecked") public static <T> T getPropertyIfExists(Object instance, String property, Class<T> requiredType) { MetaClass metaClass = getMetaClass(instance); MetaProperty metaProperty = metaClass.getMetaProperty(property); if (metaProperty != null) { Object value = metaProperty.getProperty(instance); if (value != null && requiredType.isInstance(value)) { return (T) value; } } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getPropertyIfExists", "(", "Object", "instance", ",", "String", "property", ",", "Class", "<", "T", ">", "requiredType", ")", "{", "MetaClass", "metaClass", "=", "ge...
Obtains a property of an instance if it exists @param instance The instance @param property The property @param requiredType The required type of the property @return The property value
[ "Obtains", "a", "property", "of", "an", "instance", "if", "it", "exists" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsMetaClassUtils.java#L207-L219
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.email_exchange_organizationName_service_exchangeService_account_duration_GET
public OvhOrder email_exchange_organizationName_service_exchangeService_account_duration_GET(String organizationName, String exchangeService, String duration, OvhOvhLicenceEnum licence, Long number, OvhAccountQuotaEnum storageQuota) throws IOException { String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/account/{duration}"; StringBuilder sb = path(qPath, organizationName, exchangeService, duration); query(sb, "licence", licence); query(sb, "number", number); query(sb, "storageQuota", storageQuota); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder email_exchange_organizationName_service_exchangeService_account_duration_GET(String organizationName, String exchangeService, String duration, OvhOvhLicenceEnum licence, Long number, OvhAccountQuotaEnum storageQuota) throws IOException { String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/account/{duration}"; StringBuilder sb = path(qPath, organizationName, exchangeService, duration); query(sb, "licence", licence); query(sb, "number", number); query(sb, "storageQuota", storageQuota); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "email_exchange_organizationName_service_exchangeService_account_duration_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "duration", ",", "OvhOvhLicenceEnum", "licence", ",", "Long", "number", ",", "OvhAccountQuot...
Get prices and contracts information REST: GET /order/email/exchange/{organizationName}/service/{exchangeService}/account/{duration} @param storageQuota [required] The storage quota for the account(s) in GB (default = 50) @param number [required] Number of Accounts to order @param licence [required] Licence type for the account @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3924-L3932
trello/RxLifecycle
rxlifecycle/src/main/java/com/trello/rxlifecycle3/RxLifecycle.java
RxLifecycle.bindUntilEvent
@Nonnull @CheckReturnValue public static <T, R> LifecycleTransformer<T> bindUntilEvent(@Nonnull final Observable<R> lifecycle, @Nonnull final R event) { checkNotNull(lifecycle, "lifecycle == null"); checkNotNull(event, "event == null"); return bind(takeUntilEvent(lifecycle, event)); }
java
@Nonnull @CheckReturnValue public static <T, R> LifecycleTransformer<T> bindUntilEvent(@Nonnull final Observable<R> lifecycle, @Nonnull final R event) { checkNotNull(lifecycle, "lifecycle == null"); checkNotNull(event, "event == null"); return bind(takeUntilEvent(lifecycle, event)); }
[ "@", "Nonnull", "@", "CheckReturnValue", "public", "static", "<", "T", ",", "R", ">", "LifecycleTransformer", "<", "T", ">", "bindUntilEvent", "(", "@", "Nonnull", "final", "Observable", "<", "R", ">", "lifecycle", ",", "@", "Nonnull", "final", "R", "event...
Binds the given source to a lifecycle. <p> When the lifecycle event occurs, the source will cease to emit any notifications. @param lifecycle the lifecycle sequence @param event the event which should conclude notifications from the source @return a reusable {@link LifecycleTransformer} that unsubscribes the source at the specified event
[ "Binds", "the", "given", "source", "to", "a", "lifecycle", ".", "<p", ">", "When", "the", "lifecycle", "event", "occurs", "the", "source", "will", "cease", "to", "emit", "any", "notifications", "." ]
train
https://github.com/trello/RxLifecycle/blob/b0a9eb54867f0d72b9614d24091c59dfd4b2d5c1/rxlifecycle/src/main/java/com/trello/rxlifecycle3/RxLifecycle.java#L42-L49
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderItemUrl.java
OrderItemUrl.updateItemDestinationUrl
public static MozuUrl updateItemDestinationUrl(String checkoutId, String destinationId, String itemId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/items/{itemId}/destination/{destinationId}?responseFields={responseFields}"); formatter.formatUrl("checkoutId", checkoutId); formatter.formatUrl("destinationId", destinationId); formatter.formatUrl("itemId", itemId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateItemDestinationUrl(String checkoutId, String destinationId, String itemId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/items/{itemId}/destination/{destinationId}?responseFields={responseFields}"); formatter.formatUrl("checkoutId", checkoutId); formatter.formatUrl("destinationId", destinationId); formatter.formatUrl("itemId", itemId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateItemDestinationUrl", "(", "String", "checkoutId", ",", "String", "destinationId", ",", "String", "itemId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/c...
Get Resource Url for UpdateItemDestination @param checkoutId The unique identifier of the checkout. @param destinationId The unique identifier of the destination. @param itemId The unique identifier of the item. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateItemDestination" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderItemUrl.java#L70-L78
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java
SarlBatchCompiler.postCompileJava
protected boolean postCompileJava(IProgressMonitor progress) { assert progress != null; progress.subTask(Messages.SarlBatchCompiler_52); final File classOutputPath = getClassOutputPath(); if (classOutputPath == null) { getLogger().info(Messages.SarlBatchCompiler_24); return true; } getLogger().info(Messages.SarlBatchCompiler_25); final Iterable<File> sources = Iterables.concat(getSourcePaths(), Collections.singleton(getOutputPath())); if (getLogger().isDebugEnabled()) { getLogger().debug(Messages.SarlBatchCompiler_29, toPathString(sources)); } final List<File> classpath = getClassPath(); if (getLogger().isDebugEnabled()) { getLogger().debug(Messages.SarlBatchCompiler_30, toPathString(classpath)); } return runJavaCompiler(classOutputPath, sources, classpath, true, true, progress); }
java
protected boolean postCompileJava(IProgressMonitor progress) { assert progress != null; progress.subTask(Messages.SarlBatchCompiler_52); final File classOutputPath = getClassOutputPath(); if (classOutputPath == null) { getLogger().info(Messages.SarlBatchCompiler_24); return true; } getLogger().info(Messages.SarlBatchCompiler_25); final Iterable<File> sources = Iterables.concat(getSourcePaths(), Collections.singleton(getOutputPath())); if (getLogger().isDebugEnabled()) { getLogger().debug(Messages.SarlBatchCompiler_29, toPathString(sources)); } final List<File> classpath = getClassPath(); if (getLogger().isDebugEnabled()) { getLogger().debug(Messages.SarlBatchCompiler_30, toPathString(classpath)); } return runJavaCompiler(classOutputPath, sources, classpath, true, true, progress); }
[ "protected", "boolean", "postCompileJava", "(", "IProgressMonitor", "progress", ")", "{", "assert", "progress", "!=", "null", ";", "progress", ".", "subTask", "(", "Messages", ".", "SarlBatchCompiler_52", ")", ";", "final", "File", "classOutputPath", "=", "getClas...
Compile the java files after the compilation of the project's files. @param progress monitor of the progress of the compilation. @return the success status. Replies <code>false</code> if the activity is canceled.
[ "Compile", "the", "java", "files", "after", "the", "compilation", "of", "the", "project", "s", "files", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1705-L1723
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java
JQMHeader.setLeftButton
public JQMButton setLeftButton(String text) { return setLeftButton(text, (String) null, (DataIcon) null); }
java
public JQMButton setLeftButton(String text) { return setLeftButton(text, (String) null, (DataIcon) null); }
[ "public", "JQMButton", "setLeftButton", "(", "String", "text", ")", "{", "return", "setLeftButton", "(", "text", ",", "(", "String", ")", "null", ",", "(", "DataIcon", ")", "null", ")", ";", "}" ]
Creates a new {@link JQMButton} with the given text and then sets that button in the left slot. Any existing right button will be replaced. This button will not link to a page by default and therefore will only react if a click handler is registered. This is useful if you want the button to do something other than navigate. @param text the text for the button @return the created button
[ "Creates", "a", "new", "{", "@link", "JQMButton", "}", "with", "the", "given", "text", "and", "then", "sets", "that", "button", "in", "the", "left", "slot", ".", "Any", "existing", "right", "button", "will", "be", "replaced", "." ]
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java#L147-L149
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/Noun.java
Noun.addPlural
public static void addPlural(String match, String rule, boolean insensitive){ plurals.add(0, new Replacer(match, rule, insensitive)); }
java
public static void addPlural(String match, String rule, boolean insensitive){ plurals.add(0, new Replacer(match, rule, insensitive)); }
[ "public", "static", "void", "addPlural", "(", "String", "match", ",", "String", "rule", ",", "boolean", "insensitive", ")", "{", "plurals", ".", "add", "(", "0", ",", "new", "Replacer", "(", "match", ",", "rule", ",", "insensitive", ")", ")", ";", "}" ...
<p>Add a match pattern and replacement rule for converting addPlural forms to addSingular forms.</p> @param match Match pattern regular expression @param rule Replacement rule @param insensitive Flag indicating this match should be case insensitive
[ "<p", ">", "Add", "a", "match", "pattern", "and", "replacement", "rule", "for", "converting", "addPlural", "forms", "to", "addSingular", "forms", ".", "<", "/", "p", ">" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/Noun.java#L75-L77
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java
TreeRenderer.renderIndentation
protected void renderIndentation(AbstractRenderAppender writer, TreeElement node, int level, InheritableState state) { InternalStringBuilder img = new InternalStringBuilder(32); // Create the appropriate number of indents // These are either the spacer.gif if the parent is the last in the line or the // vertical line gif if the parent is not the last child. _imgState.clear(); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, WIDTH, "16px"); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, BORDER, "0"); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, ALT, "", false); for (int i = 0; i < level; i++) { int levels = level - i; TreeElement parent = node; for (int j = 1; j <= levels; j++) { parent = parent.getParent(); } img.setLength(0); img.append(state.getImageRoot()); img.append('/'); if (parent.isLast()) { renderSpacerPrefix(writer, node); img.append(state.getImageSpacer()); _imgState.style = null; } else { renderVerticalLinePrefix(writer, node); img.append(state.getVerticalLineImage()); _imgState.style = "vertical-align:bottom;"; } _imgState.src = img.toString(); _imageRenderer.doStartTag(writer, _imgState); _imageRenderer.doEndTag(writer); if (parent.isLast()) { renderSpacerSuffix(writer, node); } else { renderVerticalLineSuffix(writer, node); } } }
java
protected void renderIndentation(AbstractRenderAppender writer, TreeElement node, int level, InheritableState state) { InternalStringBuilder img = new InternalStringBuilder(32); // Create the appropriate number of indents // These are either the spacer.gif if the parent is the last in the line or the // vertical line gif if the parent is not the last child. _imgState.clear(); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, WIDTH, "16px"); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, BORDER, "0"); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, ALT, "", false); for (int i = 0; i < level; i++) { int levels = level - i; TreeElement parent = node; for (int j = 1; j <= levels; j++) { parent = parent.getParent(); } img.setLength(0); img.append(state.getImageRoot()); img.append('/'); if (parent.isLast()) { renderSpacerPrefix(writer, node); img.append(state.getImageSpacer()); _imgState.style = null; } else { renderVerticalLinePrefix(writer, node); img.append(state.getVerticalLineImage()); _imgState.style = "vertical-align:bottom;"; } _imgState.src = img.toString(); _imageRenderer.doStartTag(writer, _imgState); _imageRenderer.doEndTag(writer); if (parent.isLast()) { renderSpacerSuffix(writer, node); } else { renderVerticalLineSuffix(writer, node); } } }
[ "protected", "void", "renderIndentation", "(", "AbstractRenderAppender", "writer", ",", "TreeElement", "node", ",", "int", "level", ",", "InheritableState", "state", ")", "{", "InternalStringBuilder", "img", "=", "new", "InternalStringBuilder", "(", "32", ")", ";", ...
Write out the images that create the leading indentation for the given node. @param writer the appender where the node indentation images are appended @param node the node to render @param level the level or depth of the node within the tree @param state the set of tree properties that are used to render the tree markup
[ "Write", "out", "the", "images", "that", "create", "the", "leading", "indentation", "for", "the", "given", "node", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java#L263-L304
j256/simplejmx
src/main/java/com/j256/simplejmx/client/JmxClient.java
JmxClient.getAttributeString
public String getAttributeString(ObjectName name, String attributeName) throws Exception { Object bean = getAttribute(name, attributeName); if (bean == null) { return null; } else { return ClientUtils.valueToString(bean); } }
java
public String getAttributeString(ObjectName name, String attributeName) throws Exception { Object bean = getAttribute(name, attributeName); if (bean == null) { return null; } else { return ClientUtils.valueToString(bean); } }
[ "public", "String", "getAttributeString", "(", "ObjectName", "name", ",", "String", "attributeName", ")", "throws", "Exception", "{", "Object", "bean", "=", "getAttribute", "(", "name", ",", "attributeName", ")", ";", "if", "(", "bean", "==", "null", ")", "{...
Return the value of a JMX attribute as a String or null if attribute has a null value.
[ "Return", "the", "value", "of", "a", "JMX", "attribute", "as", "a", "String", "or", "null", "if", "attribute", "has", "a", "null", "value", "." ]
train
https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L327-L334
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java
AssertMessages.invalidFalseValue
@Pure @Inline(value = "AssertMessages.invalidFalseValue(0, $1)", imported = {AssertMessages.class}) public static String invalidFalseValue(String functionName) { return invalidFalseValue(0, functionName); }
java
@Pure @Inline(value = "AssertMessages.invalidFalseValue(0, $1)", imported = {AssertMessages.class}) public static String invalidFalseValue(String functionName) { return invalidFalseValue(0, functionName); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"AssertMessages.invalidFalseValue(0, $1)\"", ",", "imported", "=", "{", "AssertMessages", ".", "class", "}", ")", "public", "static", "String", "invalidFalseValue", "(", "String", "functionName", ")", "{", "return",...
The value of first Parameter must be <code>true</code>. @param functionName the name of the function that should reply <code>true</code>. @return the error message.
[ "The", "value", "of", "first", "Parameter", "must", "be", "<code", ">", "true<", "/", "code", ">", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L71-L75
qiujuer/Genius-Android
caprice/ui/src/main/java/net/qiujuer/genius/ui/Ui.java
Ui.isTrueFromAttribute
public static boolean isTrueFromAttribute(AttributeSet attrs, String attribute, boolean defaultValue) { return attrs.getAttributeBooleanValue(Ui.androidStyleNameSpace, attribute, defaultValue); }
java
public static boolean isTrueFromAttribute(AttributeSet attrs, String attribute, boolean defaultValue) { return attrs.getAttributeBooleanValue(Ui.androidStyleNameSpace, attribute, defaultValue); }
[ "public", "static", "boolean", "isTrueFromAttribute", "(", "AttributeSet", "attrs", ",", "String", "attribute", ",", "boolean", "defaultValue", ")", "{", "return", "attrs", ".", "getAttributeBooleanValue", "(", "Ui", ".", "androidStyleNameSpace", ",", "attribute", "...
Get the attribute have enabled value Form android styles namespace @param attrs AttributeSet @param attribute The attribute to retrieve @param defaultValue What to return if the attribute isn't found @return Resulting value
[ "Get", "the", "attribute", "have", "enabled", "value", "Form", "android", "styles", "namespace" ]
train
https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/Ui.java#L140-L142
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/ProjectedCentroid.java
ProjectedCentroid.make
public static ProjectedCentroid make(long[] dims, Relation<? extends NumberVector> relation) { ProjectedCentroid c = new ProjectedCentroid(dims, RelationUtil.dimensionality(relation)); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { c.put(relation.get(iditer)); } return c; }
java
public static ProjectedCentroid make(long[] dims, Relation<? extends NumberVector> relation) { ProjectedCentroid c = new ProjectedCentroid(dims, RelationUtil.dimensionality(relation)); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { c.put(relation.get(iditer)); } return c; }
[ "public", "static", "ProjectedCentroid", "make", "(", "long", "[", "]", "dims", ",", "Relation", "<", "?", "extends", "NumberVector", ">", "relation", ")", "{", "ProjectedCentroid", "c", "=", "new", "ProjectedCentroid", "(", "dims", ",", "RelationUtil", ".", ...
Static Constructor from a relation. @param dims Dimensions to use (indexed with 0) @param relation Relation to process @return Centroid
[ "Static", "Constructor", "from", "a", "relation", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/ProjectedCentroid.java#L138-L144
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/MessageUtil.java
MessageUtil.isMessageExcluded
public static boolean isMessageExcluded(Message message, RecipientType recipientType, String recipientValue) { Recipient[] recipients = (Recipient[]) message.getMetadata("cwf.pub.recipients"); if (recipients == null || recipients.length == 0) { return false; } boolean excluded = false; for (Recipient recipient : recipients) { if (recipient.getType() == recipientType) { excluded = true; if (recipient.getValue().equals(recipientValue)) { return false; } } } return excluded; }
java
public static boolean isMessageExcluded(Message message, RecipientType recipientType, String recipientValue) { Recipient[] recipients = (Recipient[]) message.getMetadata("cwf.pub.recipients"); if (recipients == null || recipients.length == 0) { return false; } boolean excluded = false; for (Recipient recipient : recipients) { if (recipient.getType() == recipientType) { excluded = true; if (recipient.getValue().equals(recipientValue)) { return false; } } } return excluded; }
[ "public", "static", "boolean", "isMessageExcluded", "(", "Message", "message", ",", "RecipientType", "recipientType", ",", "String", "recipientValue", ")", "{", "Recipient", "[", "]", "recipients", "=", "(", "Recipient", "[", "]", ")", "message", ".", "getMetada...
Returns true if the message should be excluded based on the given recipient values. A message is considered excluded if it has any constraint on the recipient type and does not have a matching recipient for that type. @param message The message to examine. @param recipientType The type of recipient. @param recipientValue The recipient's value. @return True if the message should be excluded.
[ "Returns", "true", "if", "the", "message", "should", "be", "excluded", "based", "on", "the", "given", "recipient", "values", ".", "A", "message", "is", "considered", "excluded", "if", "it", "has", "any", "constraint", "on", "the", "recipient", "type", "and",...
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/MessageUtil.java#L58-L78
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/SegwitAddress.java
SegwitAddress.fromBech32
public static SegwitAddress fromBech32(@Nullable NetworkParameters params, String bech32) throws AddressFormatException { Bech32.Bech32Data bechData = Bech32.decode(bech32); if (params == null) { for (NetworkParameters p : Networks.get()) { if (bechData.hrp.equals(p.getSegwitAddressHrp())) return new SegwitAddress(p, bechData.data); } throw new AddressFormatException.InvalidPrefix("No network found for " + bech32); } else { if (bechData.hrp.equals(params.getSegwitAddressHrp())) return new SegwitAddress(params, bechData.data); throw new AddressFormatException.WrongNetwork(bechData.hrp); } }
java
public static SegwitAddress fromBech32(@Nullable NetworkParameters params, String bech32) throws AddressFormatException { Bech32.Bech32Data bechData = Bech32.decode(bech32); if (params == null) { for (NetworkParameters p : Networks.get()) { if (bechData.hrp.equals(p.getSegwitAddressHrp())) return new SegwitAddress(p, bechData.data); } throw new AddressFormatException.InvalidPrefix("No network found for " + bech32); } else { if (bechData.hrp.equals(params.getSegwitAddressHrp())) return new SegwitAddress(params, bechData.data); throw new AddressFormatException.WrongNetwork(bechData.hrp); } }
[ "public", "static", "SegwitAddress", "fromBech32", "(", "@", "Nullable", "NetworkParameters", "params", ",", "String", "bech32", ")", "throws", "AddressFormatException", "{", "Bech32", ".", "Bech32Data", "bechData", "=", "Bech32", ".", "decode", "(", "bech32", ")"...
Construct a {@link SegwitAddress} from its textual form. @param params expected network this address is valid for, or null if the network should be derived from the bech32 @param bech32 bech32-encoded textual form of the address @return constructed address @throws AddressFormatException if something about the given bech32 address isn't right
[ "Construct", "a", "{", "@link", "SegwitAddress", "}", "from", "its", "textual", "form", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/SegwitAddress.java#L165-L179
google/closure-templates
java/src/com/google/template/soy/parsepasses/contextautoesc/RawTextContextUpdater.java
RawTextContextUpdater.makeTransitionToSelf
private static Transition makeTransitionToSelf(Pattern regex) { return new Transition(regex) { @Override Context computeNextContext(Context prior, Matcher matcher) { return prior; } }; }
java
private static Transition makeTransitionToSelf(Pattern regex) { return new Transition(regex) { @Override Context computeNextContext(Context prior, Matcher matcher) { return prior; } }; }
[ "private", "static", "Transition", "makeTransitionToSelf", "(", "Pattern", "regex", ")", "{", "return", "new", "Transition", "(", "regex", ")", "{", "@", "Override", "Context", "computeNextContext", "(", "Context", "prior", ",", "Matcher", "matcher", ")", "{", ...
A transition that consumes some content without changing state.
[ "A", "transition", "that", "consumes", "some", "content", "without", "changing", "state", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/RawTextContextUpdater.java#L336-L343
morimekta/providence
providence-core/src/main/java/net/morimekta/providence/util/ProvidenceHelper.java
ProvidenceHelper.parseDebugString
@Nonnull public static <Message extends PMessage<Message, Field>, Field extends PField> Message parseDebugString(String string, PMessageDescriptor<Message, Field> descriptor) { try { ByteArrayInputStream bais = new ByteArrayInputStream(string.getBytes(UTF_8)); return DEBUG_STRING_SERIALIZER.deserialize(bais, descriptor); } catch (IOException e) { throw new UncheckedIOException(e.getMessage(), e); } }
java
@Nonnull public static <Message extends PMessage<Message, Field>, Field extends PField> Message parseDebugString(String string, PMessageDescriptor<Message, Field> descriptor) { try { ByteArrayInputStream bais = new ByteArrayInputStream(string.getBytes(UTF_8)); return DEBUG_STRING_SERIALIZER.deserialize(bais, descriptor); } catch (IOException e) { throw new UncheckedIOException(e.getMessage(), e); } }
[ "@", "Nonnull", "public", "static", "<", "Message", "extends", "PMessage", "<", "Message", ",", "Field", ">", ",", "Field", "extends", "PField", ">", "Message", "parseDebugString", "(", "String", "string", ",", "PMessageDescriptor", "<", "Message", ",", "Field...
Parses a pretty formatted string, and makes exceptions unchecked. @param string The message string to parse. @param descriptor The message descriptor. @param <Message> The message type. @param <Field> The message field type. @return The parsed message.
[ "Parses", "a", "pretty", "formatted", "string", "and", "makes", "exceptions", "unchecked", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/util/ProvidenceHelper.java#L134-L143
googleapis/google-cloud-java
google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/RetryOption.java
RetryOption.mergeToSettings
public static RetrySettings mergeToSettings(RetrySettings settings, RetryOption... options) { if (options.length <= 0) { return settings; } RetrySettings.Builder builder = settings.toBuilder(); for (RetryOption option : options) { switch (option.type) { case TOTAL_TIMEOUT: builder.setTotalTimeout((Duration) option.value); break; case INITIAL_RETRY_DELAY: builder.setInitialRetryDelay((Duration) option.value); break; case RETRY_DELAY_MULTIPLIER: builder.setRetryDelayMultiplier((Double) option.value); break; case MAX_RETRY_DELAY: builder.setMaxRetryDelay((Duration) option.value); break; case MAX_ATTEMPTS: builder.setMaxAttempts((Integer) option.value); break; case JITTERED: builder.setJittered((Boolean) option.value); break; default: throw new IllegalArgumentException("Unknown option type: " + option.type); } } return builder.build(); }
java
public static RetrySettings mergeToSettings(RetrySettings settings, RetryOption... options) { if (options.length <= 0) { return settings; } RetrySettings.Builder builder = settings.toBuilder(); for (RetryOption option : options) { switch (option.type) { case TOTAL_TIMEOUT: builder.setTotalTimeout((Duration) option.value); break; case INITIAL_RETRY_DELAY: builder.setInitialRetryDelay((Duration) option.value); break; case RETRY_DELAY_MULTIPLIER: builder.setRetryDelayMultiplier((Double) option.value); break; case MAX_RETRY_DELAY: builder.setMaxRetryDelay((Duration) option.value); break; case MAX_ATTEMPTS: builder.setMaxAttempts((Integer) option.value); break; case JITTERED: builder.setJittered((Boolean) option.value); break; default: throw new IllegalArgumentException("Unknown option type: " + option.type); } } return builder.build(); }
[ "public", "static", "RetrySettings", "mergeToSettings", "(", "RetrySettings", "settings", ",", "RetryOption", "...", "options", ")", "{", "if", "(", "options", ".", "length", "<=", "0", ")", "{", "return", "settings", ";", "}", "RetrySettings", ".", "Builder",...
Creates a new {@code RetrySettings} instance, merging provided settings and multiple {@code RetryOptions}, each of which represents a single property in {@code RetrySettings}. It is an alternative way of initializing {@link RetrySettings} instances. @param settings retry settings @param options zero or more Retry @return new {@code RetrySettings} instance, which is a result of merging {@code options} into {@code settings}, i.e. each element in {@code options}, if present, overrides corresponding property in {@code settings}
[ "Creates", "a", "new", "{", "@code", "RetrySettings", "}", "instance", "merging", "provided", "settings", "and", "multiple", "{", "@code", "RetryOptions", "}", "each", "of", "which", "represents", "a", "single", "property", "in", "{", "@code", "RetrySettings", ...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/RetryOption.java#L119-L149
alexruiz/fest-reflect
src/main/java/org/fest/reflect/util/Accessibles.java
Accessibles.setAccessibleIgnoringExceptions
public static void setAccessibleIgnoringExceptions(@NotNull AccessibleObject o, boolean accessible) { try { setAccessible(o, accessible); } catch (RuntimeException ignored) { String format = "Failed to set 'accessible' flag of %s to %s"; logger.log(Level.SEVERE, String.format(format, o.toString(), String.valueOf(accessible)), ignored); } }
java
public static void setAccessibleIgnoringExceptions(@NotNull AccessibleObject o, boolean accessible) { try { setAccessible(o, accessible); } catch (RuntimeException ignored) { String format = "Failed to set 'accessible' flag of %s to %s"; logger.log(Level.SEVERE, String.format(format, o.toString(), String.valueOf(accessible)), ignored); } }
[ "public", "static", "void", "setAccessibleIgnoringExceptions", "(", "@", "NotNull", "AccessibleObject", "o", ",", "boolean", "accessible", ")", "{", "try", "{", "setAccessible", "(", "o", ",", "accessible", ")", ";", "}", "catch", "(", "RuntimeException", "ignor...
Sets the {@code accessible} flag of the given {@code AccessibleObject} to the given {@code boolean} value, ignoring any thrown exception. @param o the given {@code AccessibleObject}. @param accessible the value to set the {@code accessible} flag to.
[ "Sets", "the", "{", "@code", "accessible", "}", "flag", "of", "the", "given", "{", "@code", "AccessibleObject", "}", "to", "the", "given", "{", "@code", "boolean", "}", "value", "ignoring", "any", "thrown", "exception", "." ]
train
https://github.com/alexruiz/fest-reflect/blob/6db30716808633ef880e439b3dc6602ecb3f1b08/src/main/java/org/fest/reflect/util/Accessibles.java#L44-L51
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.revokeImpersonationToken
public void revokeImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException { if (tokenId == null) { throw new RuntimeException("tokenId cannot be null"); } Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); delete(expectedStatus, null, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens", tokenId); }
java
public void revokeImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException { if (tokenId == null) { throw new RuntimeException("tokenId cannot be null"); } Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); delete(expectedStatus, null, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens", tokenId); }
[ "public", "void", "revokeImpersonationToken", "(", "Object", "userIdOrUsername", ",", "Integer", "tokenId", ")", "throws", "GitLabApiException", "{", "if", "(", "tokenId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"tokenId cannot be null\"", ...
Revokes an impersonation token. Available only for admin users. <pre><code>GitLab Endpoint: DELETE /users/:user_id/impersonation_tokens/:impersonation_token_id</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param tokenId the impersonation token ID to revoke @throws GitLabApiException if any exception occurs
[ "Revokes", "an", "impersonation", "token", ".", "Available", "only", "for", "admin", "users", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L834-L842
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java
MsgDestEncodingUtilsImpl.encodeOtherProperties
private static void encodeOtherProperties(ByteArrayOutputStream baos, Map<String,Object> destProps) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "encodeOtherProperties", new Object[]{baos, destProps}); // Deal with each remaining property in turn. Iterator<Map.Entry<String, Object>> remainingProps = destProps.entrySet().iterator(); while (remainingProps.hasNext()) { // Get the name and value of the property. Map.Entry<String, Object> nextProp = remainingProps.next(); String propName = nextProp.getKey(); Object propValue = nextProp.getValue(); // If the property value is null, or it is the default, we don't encode it. if ( (propValue != null) && (!propValue.equals(getDefaultPropertyValue(propName))) ) { // Get the property's coder to encode it.... PropertyEntry propEntry = propertyMap.get(propName); if (propEntry != null) { propEntry.getPropertyCoder().encodeProperty(baos, propValue); } else { // If we have found a property we don't expect, something has gone horribly wrong throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class ,"UNKNOWN_PROPERTY_CWSIA0363" ,new Object[] {propName} ,null ,"MsgDestEncodingUtilsImpl.encodeOtherProperties#1" ,null ,tc); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "encodeOtherProperties"); }
java
private static void encodeOtherProperties(ByteArrayOutputStream baos, Map<String,Object> destProps) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "encodeOtherProperties", new Object[]{baos, destProps}); // Deal with each remaining property in turn. Iterator<Map.Entry<String, Object>> remainingProps = destProps.entrySet().iterator(); while (remainingProps.hasNext()) { // Get the name and value of the property. Map.Entry<String, Object> nextProp = remainingProps.next(); String propName = nextProp.getKey(); Object propValue = nextProp.getValue(); // If the property value is null, or it is the default, we don't encode it. if ( (propValue != null) && (!propValue.equals(getDefaultPropertyValue(propName))) ) { // Get the property's coder to encode it.... PropertyEntry propEntry = propertyMap.get(propName); if (propEntry != null) { propEntry.getPropertyCoder().encodeProperty(baos, propValue); } else { // If we have found a property we don't expect, something has gone horribly wrong throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class ,"UNKNOWN_PROPERTY_CWSIA0363" ,new Object[] {propName} ,null ,"MsgDestEncodingUtilsImpl.encodeOtherProperties#1" ,null ,tc); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "encodeOtherProperties"); }
[ "private", "static", "void", "encodeOtherProperties", "(", "ByteArrayOutputStream", "baos", ",", "Map", "<", "String", ",", "Object", ">", "destProps", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "...
encodeOtherProperties Encode the more interesting JmsDestination properties, which may or may not be set: Queue/Topic name TopicSpace ReadAhead Cluster properties @param baos The ByteArrayOutputStream to encode into @param destProps The Map of properties to be encoded @exception JMSException Thrown if anything goes horribly wrong
[ "encodeOtherProperties", "Encode", "the", "more", "interesting", "JmsDestination", "properties", "which", "may", "or", "may", "not", "be", "set", ":", "Queue", "/", "Topic", "name", "TopicSpace", "ReadAhead", "Cluster", "properties" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L657-L693
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/LoggedOutTokenCacheImpl.java
LoggedOutTokenCacheImpl.putDistributedObjectLoggedOutToken
@Override public Object putDistributedObjectLoggedOutToken(Object key, Object value, int timeToLive) { DistributedMap map = getDMLoggedOutTokenMap(); if (map != null) { Object dist_object = map.put(key, value, 1, timeToLive, EntryInfo.SHARED_PUSH, null); return dist_object; } return null; }
java
@Override public Object putDistributedObjectLoggedOutToken(Object key, Object value, int timeToLive) { DistributedMap map = getDMLoggedOutTokenMap(); if (map != null) { Object dist_object = map.put(key, value, 1, timeToLive, EntryInfo.SHARED_PUSH, null); return dist_object; } return null; }
[ "@", "Override", "public", "Object", "putDistributedObjectLoggedOutToken", "(", "Object", "key", ",", "Object", "value", ",", "int", "timeToLive", ")", "{", "DistributedMap", "map", "=", "getDMLoggedOutTokenMap", "(", ")", ";", "if", "(", "map", "!=", "null", ...
/* Add the token to the DistributedMap key is the token string value is the subject timeToLive is the about of time left before the token expires, to become the expiring time of the distributed map entry
[ "/", "*", "Add", "the", "token", "to", "the", "DistributedMap" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/LoggedOutTokenCacheImpl.java#L94-L105
icode/ameba
src/main/java/ameba/lib/Strands.java
Strands.printStackTrace
public static void printStackTrace(StackTraceElement[] trace, java.io.PrintWriter out) { Strand.printStackTrace(trace, out); }
java
public static void printStackTrace(StackTraceElement[] trace, java.io.PrintWriter out) { Strand.printStackTrace(trace, out); }
[ "public", "static", "void", "printStackTrace", "(", "StackTraceElement", "[", "]", "trace", ",", "java", ".", "io", ".", "PrintWriter", "out", ")", "{", "Strand", ".", "printStackTrace", "(", "trace", ",", "out", ")", ";", "}" ]
This utility method prints a stack-trace into a {@link java.io.PrintWriter} @param trace a stack trace (such as returned from {@link Strand#getStackTrace()}. @param out the {@link java.io.PrintWriter} into which the stack trace will be printed.
[ "This", "utility", "method", "prints", "a", "stack", "-", "trace", "into", "a", "{", "@link", "java", ".", "io", ".", "PrintWriter", "}" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/lib/Strands.java#L537-L539
ModeShape/modeshape
modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnectionFactory.java
JcrManagedConnectionFactory.createConnectionFactory
@Override public Object createConnectionFactory( ConnectionManager cxManager ) throws ResourceException { JcrRepositoryHandle handle = new JcrRepositoryHandle(this, cxManager); return handle; }
java
@Override public Object createConnectionFactory( ConnectionManager cxManager ) throws ResourceException { JcrRepositoryHandle handle = new JcrRepositoryHandle(this, cxManager); return handle; }
[ "@", "Override", "public", "Object", "createConnectionFactory", "(", "ConnectionManager", "cxManager", ")", "throws", "ResourceException", "{", "JcrRepositoryHandle", "handle", "=", "new", "JcrRepositoryHandle", "(", "this", ",", "cxManager", ")", ";", "return", "hand...
Creates a Connection Factory instance. @param cxManager ConnectionManager to be associated with created EIS connection factory instance @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance @throws ResourceException Generic exception
[ "Creates", "a", "Connection", "Factory", "instance", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnectionFactory.java#L153-L157
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java
QrCodeUtil.generate
public static File generate(String content, QrConfig config, File targetFile) { final BufferedImage image = generate(content, config); ImgUtil.write(image, targetFile); return targetFile; }
java
public static File generate(String content, QrConfig config, File targetFile) { final BufferedImage image = generate(content, config); ImgUtil.write(image, targetFile); return targetFile; }
[ "public", "static", "File", "generate", "(", "String", "content", ",", "QrConfig", "config", ",", "File", "targetFile", ")", "{", "final", "BufferedImage", "image", "=", "generate", "(", "content", ",", "config", ")", ";", "ImgUtil", ".", "write", "(", "im...
生成二维码到文件,二维码图片格式取决于文件的扩展名 @param content 文本内容 @param config 二维码配置,包括长、宽、边距、颜色等 @param targetFile 目标文件,扩展名决定输出格式 @return 目标文件 @since 4.1.2
[ "生成二维码到文件,二维码图片格式取决于文件的扩展名" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L91-L95
cdk/cdk
storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIGeneratorFactory.java
InChIGeneratorFactory.getInChIGenerator
public InChIGenerator getInChIGenerator(IAtomContainer container, String options) throws CDKException { return (new InChIGenerator(container, options, ignoreAromaticBonds)); }
java
public InChIGenerator getInChIGenerator(IAtomContainer container, String options) throws CDKException { return (new InChIGenerator(container, options, ignoreAromaticBonds)); }
[ "public", "InChIGenerator", "getInChIGenerator", "(", "IAtomContainer", "container", ",", "String", "options", ")", "throws", "CDKException", "{", "return", "(", "new", "InChIGenerator", "(", "container", ",", "options", ",", "ignoreAromaticBonds", ")", ")", ";", ...
Gets InChI generator for CDK IAtomContainer. @param container AtomContainer to generate InChI for. @param options String of options for InChI generation. @return the InChI generator object @throws CDKException if the generator cannot be instantiated
[ "Gets", "InChI", "generator", "for", "CDK", "IAtomContainer", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIGeneratorFactory.java#L158-L160
99soft/sameas4j
src/main/java/org/nnsoft/sameas4j/AbstractEquivalenceDeserializer.java
AbstractEquivalenceDeserializer.getEquivalence
public Equivalence getEquivalence(JsonElement json) { Equivalence equivalence; String uriString = json.getAsJsonObject().getAsJsonPrimitive(URI).getAsString(); URI uri; try { uri = new URI(urlEncode(uriString)); } catch (Exception e) { throw new JsonParseException(String.format(EXCEPTION_MESSAGE, uriString)); } equivalence = new Equivalence(uri); JsonArray duplicates = json.getAsJsonObject().getAsJsonArray(DUPLICATES); for (int i = 0; i < duplicates.size(); i++) { try { equivalence.addDuplicate(new URI(urlEncode(duplicates.get(i).getAsString()))); } catch (Exception e) { // if an equivalent URI is not well-formed it's better to do not add it, let's go on continue; } } return equivalence; }
java
public Equivalence getEquivalence(JsonElement json) { Equivalence equivalence; String uriString = json.getAsJsonObject().getAsJsonPrimitive(URI).getAsString(); URI uri; try { uri = new URI(urlEncode(uriString)); } catch (Exception e) { throw new JsonParseException(String.format(EXCEPTION_MESSAGE, uriString)); } equivalence = new Equivalence(uri); JsonArray duplicates = json.getAsJsonObject().getAsJsonArray(DUPLICATES); for (int i = 0; i < duplicates.size(); i++) { try { equivalence.addDuplicate(new URI(urlEncode(duplicates.get(i).getAsString()))); } catch (Exception e) { // if an equivalent URI is not well-formed it's better to do not add it, let's go on continue; } } return equivalence; }
[ "public", "Equivalence", "getEquivalence", "(", "JsonElement", "json", ")", "{", "Equivalence", "equivalence", ";", "String", "uriString", "=", "json", ".", "getAsJsonObject", "(", ")", ".", "getAsJsonPrimitive", "(", "URI", ")", ".", "getAsString", "(", ")", ...
Deserialize a single {@link org.nnsoft.sameas4j.Equivalence} from its Json serialization. @param json object to be deserialized @return a not null {@link org.nnsoft.sameas4j.Equivalence} instance
[ "Deserialize", "a", "single", "{", "@link", "org", ".", "nnsoft", ".", "sameas4j", ".", "Equivalence", "}", "from", "its", "Json", "serialization", "." ]
train
https://github.com/99soft/sameas4j/blob/d6fcb6a137c5a80278001a6d11ee917be4f5ea41/src/main/java/org/nnsoft/sameas4j/AbstractEquivalenceDeserializer.java#L144-L164
virgo47/javasimon
core/src/main/java/org/javasimon/utils/SLF4JLoggingCallback.java
SLF4JLoggingCallback.onStopwatchStop
@Override public void onStopwatchStop(Split split, StopwatchSample sample) { logger.debug(marker, "SIMON STOP: {} ({})", sample.toString(), split.runningFor()); }
java
@Override public void onStopwatchStop(Split split, StopwatchSample sample) { logger.debug(marker, "SIMON STOP: {} ({})", sample.toString(), split.runningFor()); }
[ "@", "Override", "public", "void", "onStopwatchStop", "(", "Split", "split", ",", "StopwatchSample", "sample", ")", "{", "logger", ".", "debug", "(", "marker", ",", "\"SIMON STOP: {} ({})\"", ",", "sample", ".", "toString", "(", ")", ",", "split", ".", "runn...
Logs Simon stop on a specified log marker. @param split stopped split @param sample stopwatch sample
[ "Logs", "Simon", "stop", "on", "a", "specified", "log", "marker", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SLF4JLoggingCallback.java#L40-L43
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/GlobalInterlock.java
GlobalInterlock.releaseLock
public static void releaseLock(EntityManager em, long type, String key) { EntityTransaction tx = null; /* remove the existing lock if it matches the key. */ try { tx = em.getTransaction(); tx.begin(); GlobalInterlock lock = _findAndRefreshLock(em, type); if (lock == null) { throw new GlobalInterlockException("No lock of type " + type + " exists for key " + key + "."); } String ref = Long.toHexString(lock.lockTime); if (ref.equalsIgnoreCase(key)) { em.remove(lock); em.flush(); tx.commit(); } else { throw new GlobalInterlockException("This process doesn't own the type " + type + " lock having key " + key + "."); } } finally { if (tx != null && tx.isActive()) { tx.rollback(); } } }
java
public static void releaseLock(EntityManager em, long type, String key) { EntityTransaction tx = null; /* remove the existing lock if it matches the key. */ try { tx = em.getTransaction(); tx.begin(); GlobalInterlock lock = _findAndRefreshLock(em, type); if (lock == null) { throw new GlobalInterlockException("No lock of type " + type + " exists for key " + key + "."); } String ref = Long.toHexString(lock.lockTime); if (ref.equalsIgnoreCase(key)) { em.remove(lock); em.flush(); tx.commit(); } else { throw new GlobalInterlockException("This process doesn't own the type " + type + " lock having key " + key + "."); } } finally { if (tx != null && tx.isActive()) { tx.rollback(); } } }
[ "public", "static", "void", "releaseLock", "(", "EntityManager", "em", ",", "long", "type", ",", "String", "key", ")", "{", "EntityTransaction", "tx", "=", "null", ";", "/* remove the existing lock if it matches the key. */", "try", "{", "tx", "=", "em", ".", "g...
Releases a global lock of the indicated type if the supplied key is a match for the lock. @param em The entity manager factory to use. Cannot be null. @param type The type of key to release. @param key The key value obtained from the lock creation. @throws GlobalInterlockException If the lock cannot be released.
[ "Releases", "a", "global", "lock", "of", "the", "indicated", "type", "if", "the", "supplied", "key", "is", "a", "match", "for", "the", "lock", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/GlobalInterlock.java#L193-L221
elastic/elasticsearch-hadoop
mr/src/main/java/org/elasticsearch/hadoop/rest/RestRepository.java
RestRepository.lazyInitWriting
private void lazyInitWriting() { if (!writeInitialized) { this.writeInitialized = true; this.bulkProcessor = new BulkProcessor(client, resources.getResourceWrite(), settings); this.trivialBytesRef = new BytesRef(); this.bulkEntryWriter = new BulkEntryWriter(settings, BulkCommands.create(settings, metaExtractor, client.clusterInfo.getMajorVersion())); } }
java
private void lazyInitWriting() { if (!writeInitialized) { this.writeInitialized = true; this.bulkProcessor = new BulkProcessor(client, resources.getResourceWrite(), settings); this.trivialBytesRef = new BytesRef(); this.bulkEntryWriter = new BulkEntryWriter(settings, BulkCommands.create(settings, metaExtractor, client.clusterInfo.getMajorVersion())); } }
[ "private", "void", "lazyInitWriting", "(", ")", "{", "if", "(", "!", "writeInitialized", ")", "{", "this", ".", "writeInitialized", "=", "true", ";", "this", ".", "bulkProcessor", "=", "new", "BulkProcessor", "(", "client", ",", "resources", ".", "getResourc...
postpone writing initialization since we can do only reading so there's no need to allocate buffers
[ "postpone", "writing", "initialization", "since", "we", "can", "do", "only", "reading", "so", "there", "s", "no", "need", "to", "allocate", "buffers" ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/rest/RestRepository.java#L133-L140
gallandarakhneorg/afc
core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java
MathUtil.compareEpsilon
@Pure public static int compareEpsilon(double v1, double v2) { final double v = v1 - v2; if (Math.abs(v) < Math.ulp(v)) { return 0; } if (v <= 0.) { return -1; } return 1; }
java
@Pure public static int compareEpsilon(double v1, double v2) { final double v = v1 - v2; if (Math.abs(v) < Math.ulp(v)) { return 0; } if (v <= 0.) { return -1; } return 1; }
[ "@", "Pure", "public", "static", "int", "compareEpsilon", "(", "double", "v1", ",", "double", "v2", ")", "{", "final", "double", "v", "=", "v1", "-", "v2", ";", "if", "(", "Math", ".", "abs", "(", "v", ")", "<", "Math", ".", "ulp", "(", "v", ")...
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. @param v1 first value. @param v2 second value. @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
[ "Compares", "its", "two", "arguments", "for", "order", ".", "Returns", "a", "negative", "integer", "zero", "or", "a", "positive", "integer", "as", "the", "first", "argument", "is", "less", "than", "equal", "to", "or", "greater", "than", "the", "second", "....
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L189-L199
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MessageProcessor.java
MessageProcessor.createProxyHandler
private void createProxyHandler() throws MessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createProxyHandler"); _multiMEProxyHandler = new MultiMEProxyHandler(this, _txManager); _persistentStore.addItemStream(_multiMEProxyHandler, _txManager .createAutoCommitTransaction()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createProxyHandler"); }
java
private void createProxyHandler() throws MessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createProxyHandler"); _multiMEProxyHandler = new MultiMEProxyHandler(this, _txManager); _persistentStore.addItemStream(_multiMEProxyHandler, _txManager .createAutoCommitTransaction()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createProxyHandler"); }
[ "private", "void", "createProxyHandler", "(", ")", "throws", "MessageStoreException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"createProx...
In a cold start ME Environment, the proxy handler needs to be created.
[ "In", "a", "cold", "start", "ME", "Environment", "the", "proxy", "handler", "needs", "to", "be", "created", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MessageProcessor.java#L2340-L2352
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XScreenField.java
XScreenField.printControlEndForm
public void printControlEndForm(PrintWriter out, int iPrintOptions) { out.println(Utility.endTag(XMLTags.CONTROLS)); }
java
public void printControlEndForm(PrintWriter out, int iPrintOptions) { out.println(Utility.endTag(XMLTags.CONTROLS)); }
[ "public", "void", "printControlEndForm", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "out", ".", "println", "(", "Utility", ".", "endTag", "(", "XMLTags", ".", "CONTROLS", ")", ")", ";", "}" ]
Display the start form in input format. @param out The out stream. @param iPrintOptions The view specific attributes.
[ "Display", "the", "start", "form", "in", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XScreenField.java#L139-L142
junit-team/junit4
src/main/java/org/junit/runners/model/FrameworkMethod.java
FrameworkMethod.invokeExplosively
public Object invokeExplosively(final Object target, final Object... params) throws Throwable { return new ReflectiveCallable() { @Override protected Object runReflectiveCall() throws Throwable { return method.invoke(target, params); } }.run(); }
java
public Object invokeExplosively(final Object target, final Object... params) throws Throwable { return new ReflectiveCallable() { @Override protected Object runReflectiveCall() throws Throwable { return method.invoke(target, params); } }.run(); }
[ "public", "Object", "invokeExplosively", "(", "final", "Object", "target", ",", "final", "Object", "...", "params", ")", "throws", "Throwable", "{", "return", "new", "ReflectiveCallable", "(", ")", "{", "@", "Override", "protected", "Object", "runReflectiveCall", ...
Returns the result of invoking this method on {@code target} with parameters {@code params}. {@link InvocationTargetException}s thrown are unwrapped, and their causes rethrown.
[ "Returns", "the", "result", "of", "invoking", "this", "method", "on", "{" ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runners/model/FrameworkMethod.java#L54-L62
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/painter/ImagePainter.java
ImagePainter.deleteShape
public void deleteShape(Paintable paintable, Object group, MapContext context) { Image image = (Image) paintable; context.getVectorContext().deleteElement(group, image.getId()); }
java
public void deleteShape(Paintable paintable, Object group, MapContext context) { Image image = (Image) paintable; context.getVectorContext().deleteElement(group, image.getId()); }
[ "public", "void", "deleteShape", "(", "Paintable", "paintable", ",", "Object", "group", ",", "MapContext", "context", ")", "{", "Image", "image", "=", "(", "Image", ")", "paintable", ";", "context", ".", "getVectorContext", "(", ")", ".", "deleteElement", "(...
Delete a {@link Paintable} object from the given {@link MapContext}. It the object does not exist, nothing will be done. @param paintable The object to be painted. @param group The group where the object resides in (optional). @param context The context to paint on.
[ "Delete", "a", "{", "@link", "Paintable", "}", "object", "from", "the", "given", "{", "@link", "MapContext", "}", ".", "It", "the", "object", "does", "not", "exist", "nothing", "will", "be", "done", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/painter/ImagePainter.java#L65-L68
skuzzle/semantic-version
src/it/java/de/skuzzle/semantic/VersionRegEx.java
VersionRegEx.parseVersion
public static final VersionRegEx parseVersion(String versionString) { require(versionString != null, "versionString is null"); final Matcher m = VERSION_PATTERN.matcher(versionString); if (!m.matches()) { throw new VersionFormatException(versionString); } final int major = Integer.parseInt(m.group(MAJOR_GROUP)); final int minor = Integer.parseInt(m.group(MINOR_GROUP)); final int patch = Integer.parseInt(m.group(PATCH_GROUP)); checkParams(major, minor, patch); final String preRelease; if (m.group(PRE_RELEASE_GROUP) != null) { preRelease = m.group(PRE_RELEASE_GROUP); } else { preRelease = ""; } final String buildMD; if (m.group(BUILD_MD_GROUP) != null) { buildMD = m.group(BUILD_MD_GROUP); } else { buildMD = ""; } return new VersionRegEx(major, minor, patch, preRelease, buildMD); }
java
public static final VersionRegEx parseVersion(String versionString) { require(versionString != null, "versionString is null"); final Matcher m = VERSION_PATTERN.matcher(versionString); if (!m.matches()) { throw new VersionFormatException(versionString); } final int major = Integer.parseInt(m.group(MAJOR_GROUP)); final int minor = Integer.parseInt(m.group(MINOR_GROUP)); final int patch = Integer.parseInt(m.group(PATCH_GROUP)); checkParams(major, minor, patch); final String preRelease; if (m.group(PRE_RELEASE_GROUP) != null) { preRelease = m.group(PRE_RELEASE_GROUP); } else { preRelease = ""; } final String buildMD; if (m.group(BUILD_MD_GROUP) != null) { buildMD = m.group(BUILD_MD_GROUP); } else { buildMD = ""; } return new VersionRegEx(major, minor, patch, preRelease, buildMD); }
[ "public", "static", "final", "VersionRegEx", "parseVersion", "(", "String", "versionString", ")", "{", "require", "(", "versionString", "!=", "null", ",", "\"versionString is null\"", ")", ";", "final", "Matcher", "m", "=", "VERSION_PATTERN", ".", "matcher", "(", ...
Tries to parse the provided String as a semantic version. If the string does not conform to the semantic version specification, a {@link VersionFormatException} will be thrown. @param versionString The String to parse. @return The parsed version. @throws VersionFormatException If the String is no valid version @throws IllegalArgumentException If {@code versionString} is <code>null</code>.
[ "Tries", "to", "parse", "the", "provided", "String", "as", "a", "semantic", "version", ".", "If", "the", "string", "does", "not", "conform", "to", "the", "semantic", "version", "specification", "a", "{", "@link", "VersionFormatException", "}", "will", "be", ...
train
https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/it/java/de/skuzzle/semantic/VersionRegEx.java#L528-L556
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.setFieldValue
public static void setFieldValue(Object object, Field field, Object value) throws IllegalArgumentException, BugError { Params.notNull(field, "Field"); Class<?> type = field.getType(); if(!type.equals(String.class) && value instanceof String) { value = ConverterRegistry.getConverter().asObject((String)value, type); } if(value != null && !Types.isInstanceOf(value, type)) { throw new BugError("Value |%s| is not assignable to field |%s|.", value.getClass(), field); } try { field.setAccessible(true); field.set(object, value); } catch(IllegalAccessException e) { throw new BugError(e); } }
java
public static void setFieldValue(Object object, Field field, Object value) throws IllegalArgumentException, BugError { Params.notNull(field, "Field"); Class<?> type = field.getType(); if(!type.equals(String.class) && value instanceof String) { value = ConverterRegistry.getConverter().asObject((String)value, type); } if(value != null && !Types.isInstanceOf(value, type)) { throw new BugError("Value |%s| is not assignable to field |%s|.", value.getClass(), field); } try { field.setAccessible(true); field.set(object, value); } catch(IllegalAccessException e) { throw new BugError(e); } }
[ "public", "static", "void", "setFieldValue", "(", "Object", "object", ",", "Field", "field", ",", "Object", "value", ")", "throws", "IllegalArgumentException", ",", "BugError", "{", "Params", ".", "notNull", "(", "field", ",", "\"Field\"", ")", ";", "Class", ...
Set field value for object instance, or class if given object instance is null. This setter takes care to enable accessibility for private fields. Also it tries to adapt <code>value</code> to field type: if <code>value</code> is a string and field type is not, delegates {@link Converter#asObject(String, Class)}. Anyway, if <code>value</code> is not a string it should be assignable to field type otherwise bug error is thrown. @param object instance to set field value to or null, @param field reflective field, @param value field value, possible null. @throws IllegalArgumentException if <code>field</code> parameter is null. @throws ConverterException if attempt to convert string value to field type but there is no registered converted for that type. @throws BugError if value is not assignable to field type.
[ "Set", "field", "value", "for", "object", "instance", "or", "class", "if", "given", "object", "instance", "is", "null", ".", "This", "setter", "takes", "care", "to", "enable", "accessibility", "for", "private", "fields", ".", "Also", "it", "tries", "to", "...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L828-L847
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java
ElmBaseVisitor.visitOperandDef
public T visitOperandDef(OperandDef elm, C context) { if (elm.getOperandTypeSpecifier() != null) { visitElement(elm.getOperandTypeSpecifier(), context); } return null; }
java
public T visitOperandDef(OperandDef elm, C context) { if (elm.getOperandTypeSpecifier() != null) { visitElement(elm.getOperandTypeSpecifier(), context); } return null; }
[ "public", "T", "visitOperandDef", "(", "OperandDef", "elm", ",", "C", "context", ")", "{", "if", "(", "elm", ".", "getOperandTypeSpecifier", "(", ")", "!=", "null", ")", "{", "visitElement", "(", "elm", ".", "getOperandTypeSpecifier", "(", ")", ",", "conte...
Visit a OperandDef. This method will be called for every node in the tree that is a OperandDef. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "OperandDef", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "OperandDef", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L404-L409