repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getLatitudeFromPixel
public static double getLatitudeFromPixel(long height, BoundingBox boundingBox, float pixel) { return getLatitudeFromPixel(height, boundingBox, boundingBox, pixel); }
java
public static double getLatitudeFromPixel(long height, BoundingBox boundingBox, float pixel) { return getLatitudeFromPixel(height, boundingBox, boundingBox, pixel); }
[ "public", "static", "double", "getLatitudeFromPixel", "(", "long", "height", ",", "BoundingBox", "boundingBox", ",", "float", "pixel", ")", "{", "return", "getLatitudeFromPixel", "(", "height", ",", "boundingBox", ",", "boundingBox", ",", "pixel", ")", ";", "}" ...
Get the latitude from the pixel location, bounding box, and image height @param height height @param boundingBox bounding box @param pixel pixel @return latitude
[ "Get", "the", "latitude", "from", "the", "pixel", "location", "bounding", "box", "and", "image", "height" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L274-L277
apache/groovy
subprojects/groovy-json/src/main/java/groovy/json/JsonLexer.java
JsonLexer.readingConstant
private JsonToken readingConstant(JsonTokenType type, JsonToken token) { try { int numCharsToRead = ((String) type.getValidator()).length(); char[] chars = new char[numCharsToRead]; reader.read(chars); String stringRead = new String(chars); if (stringRead.equals(type.getValidator())) { token.setEndColumn(token.getStartColumn() + numCharsToRead); token.setText(stringRead); return token; } else { throwJsonException(stringRead, type); } } catch (IOException ioe) { throw new JsonException("An IO exception occurred while reading the JSON payload", ioe); } return null; }
java
private JsonToken readingConstant(JsonTokenType type, JsonToken token) { try { int numCharsToRead = ((String) type.getValidator()).length(); char[] chars = new char[numCharsToRead]; reader.read(chars); String stringRead = new String(chars); if (stringRead.equals(type.getValidator())) { token.setEndColumn(token.getStartColumn() + numCharsToRead); token.setText(stringRead); return token; } else { throwJsonException(stringRead, type); } } catch (IOException ioe) { throw new JsonException("An IO exception occurred while reading the JSON payload", ioe); } return null; }
[ "private", "JsonToken", "readingConstant", "(", "JsonTokenType", "type", ",", "JsonToken", "token", ")", "{", "try", "{", "int", "numCharsToRead", "=", "(", "(", "String", ")", "type", ".", "getValidator", "(", ")", ")", ".", "length", "(", ")", ";", "ch...
When a constant token type is expected, check that the expected constant is read, and update the content of the token accordingly. @param type the token type @param token the token @return the token updated with end column and text updated
[ "When", "a", "constant", "token", "type", "is", "expected", "check", "that", "the", "expected", "constant", "is", "read", "and", "update", "the", "content", "of", "the", "token", "accordingly", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-json/src/main/java/groovy/json/JsonLexer.java#L190-L208
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java
PolicyEventsInner.listQueryResultsForResourceGroup
public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName) { return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().single().body(); }
java
public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName) { return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).toBlocking().single().body(); }
[ "public", "PolicyEventsQueryResultsInner", "listQueryResultsForResourceGroup", "(", "String", "subscriptionId", ",", "String", "resourceGroupName", ")", "{", "return", "listQueryResultsForResourceGroupWithServiceResponseAsync", "(", "subscriptionId", ",", "resourceGroupName", ")", ...
Queries policy events for the resources under the resource group. @param subscriptionId Microsoft Azure subscription ID. @param resourceGroupName Resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PolicyEventsQueryResultsInner object if successful.
[ "Queries", "policy", "events", "for", "the", "resources", "under", "the", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java#L484-L486
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskTracker.java
TaskTracker.reportDiagnosticInfo
public synchronized void reportDiagnosticInfo(TaskAttemptID taskid, String info) throws IOException { TaskInProgress tip = tasks.get(taskid); if (tip != null) { tip.reportDiagnosticInfo(info); } else { LOG.warn("Error from unknown child task: "+taskid+". Ignored."); } }
java
public synchronized void reportDiagnosticInfo(TaskAttemptID taskid, String info) throws IOException { TaskInProgress tip = tasks.get(taskid); if (tip != null) { tip.reportDiagnosticInfo(info); } else { LOG.warn("Error from unknown child task: "+taskid+". Ignored."); } }
[ "public", "synchronized", "void", "reportDiagnosticInfo", "(", "TaskAttemptID", "taskid", ",", "String", "info", ")", "throws", "IOException", "{", "TaskInProgress", "tip", "=", "tasks", ".", "get", "(", "taskid", ")", ";", "if", "(", "tip", "!=", "null", ")...
Called when the task dies before completion, and we want to report back diagnostic info
[ "Called", "when", "the", "task", "dies", "before", "completion", "and", "we", "want", "to", "report", "back", "diagnostic", "info" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskTracker.java#L3635-L3642
io7m/ieee754b16
com.io7m.ieee754b16.core/src/main/java/com/io7m/ieee754b16/Binary16.java
Binary16.packFloat
public static char packFloat( final float k) { final int f32_bits = Float.floatToIntBits(k); final int f16_sign = (f32_bits >>> 16) & 0x8000; final int f32_unrounded = f32_bits & 0x7fffffff; final int f32_rounded = f32_unrounded + 0x1000; /* * The 32-bit float might be large enough to become NaN or Infinity. */ if (f32_rounded >= 0x47800000) { return packFloatMaybeNaNInfinity( f32_bits, f16_sign, f32_unrounded, f32_rounded); } /* * The 32-bit float is a normal value, and is of a size that would allow * it to remain a normal value as a 16-bit float. */ if (f32_rounded >= 0x38800000) { return packFloatNormal(f16_sign, f32_rounded); } /* * The 32-bit float value is subnormal and would be too small * to even become a subnormal 16-bit float. Instead, simply return a signed * zero value. */ if (f32_rounded < 0x33000000) { return (char) f16_sign; } /* * The 32-bit float value is subnormal, but would fit in a 16-bit float. */ return packFloatSubnormal(f32_bits, f16_sign, f32_unrounded); }
java
public static char packFloat( final float k) { final int f32_bits = Float.floatToIntBits(k); final int f16_sign = (f32_bits >>> 16) & 0x8000; final int f32_unrounded = f32_bits & 0x7fffffff; final int f32_rounded = f32_unrounded + 0x1000; /* * The 32-bit float might be large enough to become NaN or Infinity. */ if (f32_rounded >= 0x47800000) { return packFloatMaybeNaNInfinity( f32_bits, f16_sign, f32_unrounded, f32_rounded); } /* * The 32-bit float is a normal value, and is of a size that would allow * it to remain a normal value as a 16-bit float. */ if (f32_rounded >= 0x38800000) { return packFloatNormal(f16_sign, f32_rounded); } /* * The 32-bit float value is subnormal and would be too small * to even become a subnormal 16-bit float. Instead, simply return a signed * zero value. */ if (f32_rounded < 0x33000000) { return (char) f16_sign; } /* * The 32-bit float value is subnormal, but would fit in a 16-bit float. */ return packFloatSubnormal(f32_bits, f16_sign, f32_unrounded); }
[ "public", "static", "char", "packFloat", "(", "final", "float", "k", ")", "{", "final", "int", "f32_bits", "=", "Float", ".", "floatToIntBits", "(", "k", ")", ";", "final", "int", "f16_sign", "=", "(", "f32_bits", ">>>", "16", ")", "&", "0x8000", ";", ...
<p> Convert a single precision floating point value to a packed {@code binary16} value. </p> <p> For the following specific cases, the function returns: </p> <ul> <li>{@code NaN} iff {@code isNaN(k)}</li> <li>{@link #POSITIVE_INFINITY} iff <code>k == {@link Float#POSITIVE_INFINITY}</code></li> <li>{@link #NEGATIVE_INFINITY} iff <code>k == {@link Float#NEGATIVE_INFINITY}</code></li> <li>{@link #NEGATIVE_ZERO} iff {@code k == -0.0}</li> <li>{@link #POSITIVE_ZERO} iff {@code k == 0.0}</li> </ul> <p> Otherwise, the {@code binary16} value that most closely represents {@code k} is returned. This may obviously be an infinite value as the interval of single precision values is far larger than that of the {@code binary16} type. </p> @param k A floating point value @return A packed {@code binary16} value @see #unpackFloat(char)
[ "<p", ">", "Convert", "a", "single", "precision", "floating", "point", "value", "to", "a", "packed", "{", "@code", "binary16", "}", "value", ".", "<", "/", "p", ">", "<p", ">", "For", "the", "following", "specific", "cases", "the", "function", "returns",...
train
https://github.com/io7m/ieee754b16/blob/39474026e6d069695adf5a14c5c326aadb7b4cf4/com.io7m.ieee754b16.core/src/main/java/com/io7m/ieee754b16/Binary16.java#L377-L418
OpenCompare/OpenCompare
org.opencompare/pcmdata-importers/src/main/java/pcm_Filter/mutate/PCMMutate.java
PCMMutate.clear_colonne
private static PCM clear_colonne(PCM pcm, PCM pcm_return){ List<Feature> pdts = pcm.getConcreteFeatures(); List<Cell> cells = new ArrayList<Cell>() ; for (Feature pr : pdts) { float nbCellsEmpty = 0 ; // On ajoute les cellules du product dans une liste cells = pr.getCells(); // On traite les infos des cellules for(Cell c : cells){ if(c.getContent().isEmpty()){ nbCellsEmpty ++ ; } } if(cells.size() != 0){ System.out.println("Dans les colonnes -- > \n Nombre de cellule vide :" + nbCellsEmpty + "\n Nombre de cellule : " + cells.size()); System.out.println("Valeur du if : " + nbCellsEmpty/cells.size()); if(!((nbCellsEmpty/cells.size()) > RATIO_EMPTY_CELL)){ System.out.println("on ajoute la colonne !"); pcm_return.addFeature(pr);; } } } return pcm_return; }
java
private static PCM clear_colonne(PCM pcm, PCM pcm_return){ List<Feature> pdts = pcm.getConcreteFeatures(); List<Cell> cells = new ArrayList<Cell>() ; for (Feature pr : pdts) { float nbCellsEmpty = 0 ; // On ajoute les cellules du product dans une liste cells = pr.getCells(); // On traite les infos des cellules for(Cell c : cells){ if(c.getContent().isEmpty()){ nbCellsEmpty ++ ; } } if(cells.size() != 0){ System.out.println("Dans les colonnes -- > \n Nombre de cellule vide :" + nbCellsEmpty + "\n Nombre de cellule : " + cells.size()); System.out.println("Valeur du if : " + nbCellsEmpty/cells.size()); if(!((nbCellsEmpty/cells.size()) > RATIO_EMPTY_CELL)){ System.out.println("on ajoute la colonne !"); pcm_return.addFeature(pr);; } } } return pcm_return; }
[ "private", "static", "PCM", "clear_colonne", "(", "PCM", "pcm", ",", "PCM", "pcm_return", ")", "{", "List", "<", "Feature", ">", "pdts", "=", "pcm", ".", "getConcreteFeatures", "(", ")", ";", "List", "<", "Cell", ">", "cells", "=", "new", "ArrayList", ...
Enlever les colonnes inutiles @param pcmic : Le pcm info container du pcm @param pcm : Le pcm @return Le pcm avec les colonnes inutiles en moins
[ "Enlever", "les", "colonnes", "inutiles" ]
train
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/pcm_Filter/mutate/PCMMutate.java#L88-L112
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java
ValueMap.withList
public ValueMap withList(String key, Object ... vals) { super.put(key, vals == null ? null : new ArrayList<Object>(Arrays.asList(vals))); return this; }
java
public ValueMap withList(String key, Object ... vals) { super.put(key, vals == null ? null : new ArrayList<Object>(Arrays.asList(vals))); return this; }
[ "public", "ValueMap", "withList", "(", "String", "key", ",", "Object", "...", "vals", ")", "{", "super", ".", "put", "(", "key", ",", "vals", "==", "null", "?", "null", ":", "new", "ArrayList", "<", "Object", ">", "(", "Arrays", ".", "asList", "(", ...
Sets the value of the specified key in the current ValueMap to the given values as a list.
[ "Sets", "the", "value", "of", "the", "specified", "key", "in", "the", "current", "ValueMap", "to", "the", "given", "values", "as", "a", "list", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java#L167-L171
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlSelectStatement.java
SqlSelectStatement.appendColumn
protected void appendColumn(TableAlias anAlias, FieldDescriptor field, StringBuffer buf) { buf.append(anAlias.alias); buf.append("."); buf.append(field.getColumnName()); }
java
protected void appendColumn(TableAlias anAlias, FieldDescriptor field, StringBuffer buf) { buf.append(anAlias.alias); buf.append("."); buf.append(field.getColumnName()); }
[ "protected", "void", "appendColumn", "(", "TableAlias", "anAlias", ",", "FieldDescriptor", "field", ",", "StringBuffer", "buf", ")", "{", "buf", ".", "append", "(", "anAlias", ".", "alias", ")", ";", "buf", ".", "append", "(", "\".\"", ")", ";", "buf", "...
Append a Column with alias: A0 name -> A0.name @param anAlias the TableAlias @param field @param buf
[ "Append", "a", "Column", "with", "alias", ":", "A0", "name", "-", ">", "A0", ".", "name" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlSelectStatement.java#L81-L86
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/forms/layout/ConstantSize.java
ConstantSize.valueOf
static ConstantSize valueOf(String encodedValueAndUnit, boolean horizontal) { String[] split = ConstantSize.splitValueAndUnit(encodedValueAndUnit); String encodedValue = split[0]; String encodedUnit = split[1]; Unit unit = Unit.valueOf(encodedUnit, horizontal); double value = Double.parseDouble(encodedValue); if (unit.requiresIntegers) { checkArgument(value == (int) value, "%s value %s must be an integer.", unit, encodedValue); } return new ConstantSize(value, unit); }
java
static ConstantSize valueOf(String encodedValueAndUnit, boolean horizontal) { String[] split = ConstantSize.splitValueAndUnit(encodedValueAndUnit); String encodedValue = split[0]; String encodedUnit = split[1]; Unit unit = Unit.valueOf(encodedUnit, horizontal); double value = Double.parseDouble(encodedValue); if (unit.requiresIntegers) { checkArgument(value == (int) value, "%s value %s must be an integer.", unit, encodedValue); } return new ConstantSize(value, unit); }
[ "static", "ConstantSize", "valueOf", "(", "String", "encodedValueAndUnit", ",", "boolean", "horizontal", ")", "{", "String", "[", "]", "split", "=", "ConstantSize", ".", "splitValueAndUnit", "(", "encodedValueAndUnit", ")", ";", "String", "encodedValue", "=", "spl...
Creates and returns a ConstantSize from the given encoded size and unit description. @param encodedValueAndUnit the size's value and unit as string, trimmed and in lower case @param horizontal true for horizontal, false for vertical @return a constant size for the given encoding and unit description @throws IllegalArgumentException if the unit requires integer but the value is not an integer
[ "Creates", "and", "returns", "a", "ConstantSize", "from", "the", "given", "encoded", "size", "and", "unit", "description", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/ConstantSize.java#L138-L149
jenkinsci/jenkins
core/src/main/java/hudson/util/RunList.java
RunList.newBuilds
public RunList<R> newBuilds() { GregorianCalendar cal = new GregorianCalendar(); cal.add(Calendar.DAY_OF_YEAR, -7); final long t = cal.getTimeInMillis(); // can't publish on-going builds return filter(new Predicate<R>() { public boolean apply(R r) { return !r.isBuilding(); } }) // put at least 10 builds, but otherwise ignore old builds .limit(new CountingPredicate<R>() { public boolean apply(int index, R r) { return index < 10 || r.getTimeInMillis() >= t; } }); }
java
public RunList<R> newBuilds() { GregorianCalendar cal = new GregorianCalendar(); cal.add(Calendar.DAY_OF_YEAR, -7); final long t = cal.getTimeInMillis(); // can't publish on-going builds return filter(new Predicate<R>() { public boolean apply(R r) { return !r.isBuilding(); } }) // put at least 10 builds, but otherwise ignore old builds .limit(new CountingPredicate<R>() { public boolean apply(int index, R r) { return index < 10 || r.getTimeInMillis() >= t; } }); }
[ "public", "RunList", "<", "R", ">", "newBuilds", "(", ")", "{", "GregorianCalendar", "cal", "=", "new", "GregorianCalendar", "(", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "-", "7", ")", ";", "final", "long", "t", "=", "c...
Reduce the size of the list by only leaving relatively new ones. This also removes on-going builds, as RSS cannot be used to publish information if it changes. <em>Warning:</em> this method mutates the original list and then returns it.
[ "Reduce", "the", "size", "of", "the", "list", "by", "only", "leaving", "relatively", "new", "ones", ".", "This", "also", "removes", "on", "-", "going", "builds", "as", "RSS", "cannot", "be", "used", "to", "publish", "information", "if", "it", "changes", ...
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/RunList.java#L341-L358
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java
EnumHelper.getFromNameOrDefault
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasName> ENUMTYPE getFromNameOrDefault (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sName, @Nullable final ENUMTYPE eDefault) { ValueEnforcer.notNull (aClass, "Class"); if (StringHelper.hasNoText (sName)) return eDefault; return findFirst (aClass, x -> x.getName ().equals (sName), eDefault); }
java
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasName> ENUMTYPE getFromNameOrDefault (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sName, @Nullable final ENUMTYPE eDefault) { ValueEnforcer.notNull (aClass, "Class"); if (StringHelper.hasNoText (sName)) return eDefault; return findFirst (aClass, x -> x.getName ().equals (sName), eDefault); }
[ "@", "Nullable", "public", "static", "<", "ENUMTYPE", "extends", "Enum", "<", "ENUMTYPE", ">", "&", "IHasName", ">", "ENUMTYPE", "getFromNameOrDefault", "(", "@", "Nonnull", "final", "Class", "<", "ENUMTYPE", ">", "aClass", ",", "@", "Nullable", "final", "St...
Get the enum value with the passed name @param <ENUMTYPE> The enum type @param aClass The enum class @param sName The name to search @param eDefault The default value to be returned, if the name was not found. @return The default parameter if no enum item with the given name is present.
[ "Get", "the", "enum", "value", "with", "the", "passed", "name" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java#L371-L381
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSession.java
JcrSession.nodeIdentifier
public static String nodeIdentifier( NodeKey key, NodeKey rootKey ) { return isForeignKey(key, rootKey) ? key.toString() : key.getIdentifier(); }
java
public static String nodeIdentifier( NodeKey key, NodeKey rootKey ) { return isForeignKey(key, rootKey) ? key.toString() : key.getIdentifier(); }
[ "public", "static", "String", "nodeIdentifier", "(", "NodeKey", "key", ",", "NodeKey", "rootKey", ")", "{", "return", "isForeignKey", "(", "key", ",", "rootKey", ")", "?", "key", ".", "toString", "(", ")", ":", "key", ".", "getIdentifier", "(", ")", ";",...
Returns a string representing a node's identifier, based on whether the node is foreign or not. @param key the node key; may be null @param rootKey the key of the root node in the workspace; may not be null @return the identifier for the node; never null @see javax.jcr.Node#getIdentifier()
[ "Returns", "a", "string", "representing", "a", "node", "s", "identifier", "based", "on", "whether", "the", "node", "is", "foreign", "or", "not", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSession.java#L2002-L2005
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.blockReceived
private boolean blockReceived(Block block, String delHint, DatanodeDescriptor node) throws IOException { assert (hasWriteLock()); // decrement number of blocks scheduled to this datanode. node.decBlocksScheduled(); // get the deletion hint node DatanodeDescriptor delHintNode = null; if (delHint != null && delHint.length() != 0) { delHintNode = datanodeMap.get(delHint); if (delHintNode == null) { NameNode.stateChangeLog.warn("BLOCK* NameSystem.blockReceived: " + block + " is expected to be removed from an unrecorded node " + delHint); } } // // Modify the blocks->datanode map and node's map. // pendingReplications.remove(block); return addStoredBlock(block, node, delHintNode); }
java
private boolean blockReceived(Block block, String delHint, DatanodeDescriptor node) throws IOException { assert (hasWriteLock()); // decrement number of blocks scheduled to this datanode. node.decBlocksScheduled(); // get the deletion hint node DatanodeDescriptor delHintNode = null; if (delHint != null && delHint.length() != 0) { delHintNode = datanodeMap.get(delHint); if (delHintNode == null) { NameNode.stateChangeLog.warn("BLOCK* NameSystem.blockReceived: " + block + " is expected to be removed from an unrecorded node " + delHint); } } // // Modify the blocks->datanode map and node's map. // pendingReplications.remove(block); return addStoredBlock(block, node, delHintNode); }
[ "private", "boolean", "blockReceived", "(", "Block", "block", ",", "String", "delHint", ",", "DatanodeDescriptor", "node", ")", "throws", "IOException", "{", "assert", "(", "hasWriteLock", "(", ")", ")", ";", "// decrement number of blocks scheduled to this datanode.", ...
The given node is reporting that it received a certain block.
[ "The", "given", "node", "is", "reporting", "that", "it", "received", "a", "certain", "block", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L7605-L7629
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/adwords/lib/utils/ReportRequestFactoryHelper.java
ReportRequestFactoryHelper.getHttpRequestFactory
@VisibleForTesting HttpRequestFactory getHttpRequestFactory(final String reportUrl, String version) throws AuthenticationException { final HttpHeaders httpHeaders = createHeaders(reportUrl, version); return httpTransport.createRequestFactory( request -> { request.setHeaders(httpHeaders); request.setConnectTimeout(reportDownloadTimeout); request.setReadTimeout(reportDownloadTimeout); request.setThrowExceptionOnExecuteError(false); request.setLoggingEnabled(true); request.setResponseInterceptor(responseInterceptor); }); }
java
@VisibleForTesting HttpRequestFactory getHttpRequestFactory(final String reportUrl, String version) throws AuthenticationException { final HttpHeaders httpHeaders = createHeaders(reportUrl, version); return httpTransport.createRequestFactory( request -> { request.setHeaders(httpHeaders); request.setConnectTimeout(reportDownloadTimeout); request.setReadTimeout(reportDownloadTimeout); request.setThrowExceptionOnExecuteError(false); request.setLoggingEnabled(true); request.setResponseInterceptor(responseInterceptor); }); }
[ "@", "VisibleForTesting", "HttpRequestFactory", "getHttpRequestFactory", "(", "final", "String", "reportUrl", ",", "String", "version", ")", "throws", "AuthenticationException", "{", "final", "HttpHeaders", "httpHeaders", "=", "createHeaders", "(", "reportUrl", ",", "ve...
Gets the report HTTP URL connection given report URL and proper information needed to authenticate the request. @param reportUrl the URL of the report response or download @return the report HTTP URL connection @throws AuthenticationException If OAuth authorization fails.
[ "Gets", "the", "report", "HTTP", "URL", "connection", "given", "report", "URL", "and", "proper", "information", "needed", "to", "authenticate", "the", "request", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/adwords/lib/utils/ReportRequestFactoryHelper.java#L77-L90
rhuss/jolokia
agent/core/src/main/java/org/jolokia/handler/list/MBeanInfoData.java
MBeanInfoData.handleException
public void handleException(ObjectName pName, IOException pExp) throws IOException { // In case of a remote call, IOException can occur e.g. for // NonSerializableExceptions if (pathStack.size() == 0) { addException(pName, pExp); } else { // Happens for a deeper request, i.e with a path pointing directly into an MBean, // Hence we throw immediately an error here since there will be only this exception // and no extra info throw new IOException("IOException for MBean " + pName + " (" + pExp.getMessage() + ")",pExp); } }
java
public void handleException(ObjectName pName, IOException pExp) throws IOException { // In case of a remote call, IOException can occur e.g. for // NonSerializableExceptions if (pathStack.size() == 0) { addException(pName, pExp); } else { // Happens for a deeper request, i.e with a path pointing directly into an MBean, // Hence we throw immediately an error here since there will be only this exception // and no extra info throw new IOException("IOException for MBean " + pName + " (" + pExp.getMessage() + ")",pExp); } }
[ "public", "void", "handleException", "(", "ObjectName", "pName", ",", "IOException", "pExp", ")", "throws", "IOException", "{", "// In case of a remote call, IOException can occur e.g. for", "// NonSerializableExceptions", "if", "(", "pathStack", ".", "size", "(", ")", "=...
Add an exception which occurred during extraction of an {@link MBeanInfo} for a certain {@link ObjectName} to this map. @param pName MBean name for which the error occurred @param pExp exception occurred @throws IOException if this method decides to rethrow the execption
[ "Add", "an", "exception", "which", "occurred", "during", "extraction", "of", "an", "{", "@link", "MBeanInfo", "}", "for", "a", "certain", "{", "@link", "ObjectName", "}", "to", "this", "map", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/handler/list/MBeanInfoData.java#L200-L211
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.elementPower
public static void elementPower(DMatrixD1 A , DMatrixD1 B , DMatrixD1 C ) { if( A.numRows != B.numRows || A.numRows != C.numRows || A.numCols != B.numCols || A.numCols != C.numCols ) { throw new MatrixDimensionException("All matrices must be the same shape"); } int size = A.getNumElements(); for( int i = 0; i < size; i++ ) { C.data[i] = Math.pow(A.data[i], B.data[i]); } }
java
public static void elementPower(DMatrixD1 A , DMatrixD1 B , DMatrixD1 C ) { if( A.numRows != B.numRows || A.numRows != C.numRows || A.numCols != B.numCols || A.numCols != C.numCols ) { throw new MatrixDimensionException("All matrices must be the same shape"); } int size = A.getNumElements(); for( int i = 0; i < size; i++ ) { C.data[i] = Math.pow(A.data[i], B.data[i]); } }
[ "public", "static", "void", "elementPower", "(", "DMatrixD1", "A", ",", "DMatrixD1", "B", ",", "DMatrixD1", "C", ")", "{", "if", "(", "A", ".", "numRows", "!=", "B", ".", "numRows", "||", "A", ".", "numRows", "!=", "C", ".", "numRows", "||", "A", "...
<p> Element-wise power operation <br> c<sub>ij</sub> = a<sub>ij</sub> ^ b<sub>ij</sub> <p> @param A left side @param B right side @param C output (modified)
[ "<p", ">", "Element", "-", "wise", "power", "operation", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "a<sub", ">", "ij<", "/", "sub", ">", "^", "b<sub", ">", "ij<", "/", "sub", ">", "<p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1641-L1652
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.getElementInterfaces
private String[] getElementInterfaces(XsdElement element, String apiName){ XsdAbstractElement child = getElementInterfacesElement(element); List<String> interfaceNames = null; if (child != null){ List<InterfaceInfo> interfaceInfo = iterativeCreation(child, getCleanName(element), 0, apiName, null); interfaceNames = interfaceInfo.stream().map(InterfaceInfo::getInterfaceName).collect(Collectors.toList()); } return listToArray(interfaceNames, TEXT_GROUP); }
java
private String[] getElementInterfaces(XsdElement element, String apiName){ XsdAbstractElement child = getElementInterfacesElement(element); List<String> interfaceNames = null; if (child != null){ List<InterfaceInfo> interfaceInfo = iterativeCreation(child, getCleanName(element), 0, apiName, null); interfaceNames = interfaceInfo.stream().map(InterfaceInfo::getInterfaceName).collect(Collectors.toList()); } return listToArray(interfaceNames, TEXT_GROUP); }
[ "private", "String", "[", "]", "getElementInterfaces", "(", "XsdElement", "element", ",", "String", "apiName", ")", "{", "XsdAbstractElement", "child", "=", "getElementInterfacesElement", "(", "element", ")", ";", "List", "<", "String", ">", "interfaceNames", "=",...
This method obtains the element interfaces which his class will be implementing. The interfaces are represented in {@link XsdAbstractElement} objects as {@link XsdGroup}, {@link XsdAll}, {@link XsdSequence} and {@link XsdChoice}. The respective methods of the interfaces will be the elements from the types enumerated previously. @param element The element from which the interfaces will be obtained. @param apiName The name of the generated fluent interface. @return A {@link String} array containing the names of all the interfaces this method implements.
[ "This", "method", "obtains", "the", "element", "interfaces", "which", "his", "class", "will", "be", "implementing", ".", "The", "interfaces", "are", "represented", "in", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L129-L139
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.verifyFactor
public Boolean verifyFactor(long userId, long deviceId, String otpToken) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return verifyFactor(userId, deviceId, otpToken, null); }
java
public Boolean verifyFactor(long userId, long deviceId, String otpToken) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return verifyFactor(userId, deviceId, otpToken, null); }
[ "public", "Boolean", "verifyFactor", "(", "long", "userId", ",", "long", "deviceId", ",", "String", "otpToken", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "return", "verifyFactor", "(", "userId", ",", "device...
Authenticates a one-time password (OTP) code provided by a multifactor authentication (MFA) device. @param userId The id of the user. @param deviceId The id of the MFA device. @param otpToken OTP code provided by the device or SMS message sent to user. When a device like OneLogin Protect that supports Push has been used you do not need to provide the otp_token. @return Boolean True if Factor is verified @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/multi-factor-authentication/verify-factor">Verify an Authentication Factor documentation</a>
[ "Authenticates", "a", "one", "-", "time", "password", "(", "OTP", ")", "code", "provided", "by", "a", "multifactor", "authentication", "(", "MFA", ")", "device", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2897-L2900
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.generateSignature
public static Signature generateSignature(AsymmetricAlgorithm asymmetricAlgorithm, DigestAlgorithm digestAlgorithm) { try { return Signature.getInstance(generateAlgorithm(asymmetricAlgorithm, digestAlgorithm)); } catch (NoSuchAlgorithmException e) { throw new CryptoException(e); } }
java
public static Signature generateSignature(AsymmetricAlgorithm asymmetricAlgorithm, DigestAlgorithm digestAlgorithm) { try { return Signature.getInstance(generateAlgorithm(asymmetricAlgorithm, digestAlgorithm)); } catch (NoSuchAlgorithmException e) { throw new CryptoException(e); } }
[ "public", "static", "Signature", "generateSignature", "(", "AsymmetricAlgorithm", "asymmetricAlgorithm", ",", "DigestAlgorithm", "digestAlgorithm", ")", "{", "try", "{", "return", "Signature", ".", "getInstance", "(", "generateAlgorithm", "(", "asymmetricAlgorithm", ",", ...
生成签名对象,仅用于非对称加密 @param asymmetricAlgorithm {@link AsymmetricAlgorithm} 非对称加密算法 @param digestAlgorithm {@link DigestAlgorithm} 摘要算法 @return {@link Signature}
[ "生成签名对象,仅用于非对称加密" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L289-L295
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/MergedClass.java
MergedClass.getConstructor2
public static Constructor<?> getConstructor2(ClassInjector injector, Class<?>[] classes, String[] prefixes, int observerMode) throws IllegalArgumentException { return getConstructor2(injector, classes, prefixes, null, observerMode); }
java
public static Constructor<?> getConstructor2(ClassInjector injector, Class<?>[] classes, String[] prefixes, int observerMode) throws IllegalArgumentException { return getConstructor2(injector, classes, prefixes, null, observerMode); }
[ "public", "static", "Constructor", "<", "?", ">", "getConstructor2", "(", "ClassInjector", "injector", ",", "Class", "<", "?", ">", "[", "]", "classes", ",", "String", "[", "]", "prefixes", ",", "int", "observerMode", ")", "throws", "IllegalArgumentException",...
Returns the constructor for a class that merges all of the given source classes. The constructor accepts one parameter type: an {@link InstanceFactory}. Merged instances are requested only when first needed. An IllegalArgumentException is thrown if any of the given conditions are not satisfied: <ul> <li>None of the given classes can represent a primitive type <li>A source class can only be provided once, unless paired with a unique prefix. <li>Any non-public classes must be in the same common package <li>Duplicate methods cannot have conflicting return types, unless a prefix is provided. <li>The given classes must be loadable from the given injector </ul> To help resolve ambiguities, a method prefix can be specified for each passed in class. For each prefixed method, the non-prefixed method is also generated, unless that method conflicts with the return type of another method. If any passed in classes are or have interfaces, then those interfaces will be implemented only if there are no conflicts. An optional implementation of the MethodInvocationEventObserver interface may be supplied. <p>The array of prefixes may be null, have null elements or be shorter than the array of classes. A prefix of "" is treated as null. @param injector ClassInjector that will receive class definition @param classes Source classes used to derive merged class @param prefixes Optional prefixes to apply to methods of each generated class to eliminate duplicate method names @param observerMode int Invocation event handling modes.
[ "Returns", "the", "constructor", "for", "a", "class", "that", "merges", "all", "of", "the", "given", "source", "classes", ".", "The", "constructor", "accepts", "one", "parameter", "type", ":", "an", "{", "@link", "InstanceFactory", "}", ".", "Merged", "insta...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/MergedClass.java#L382-L389
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java
FirewallClient.insertFirewall
@BetaApi public final Operation insertFirewall(String project, Firewall firewallResource) { InsertFirewallHttpRequest request = InsertFirewallHttpRequest.newBuilder() .setProject(project) .setFirewallResource(firewallResource) .build(); return insertFirewall(request); }
java
@BetaApi public final Operation insertFirewall(String project, Firewall firewallResource) { InsertFirewallHttpRequest request = InsertFirewallHttpRequest.newBuilder() .setProject(project) .setFirewallResource(firewallResource) .build(); return insertFirewall(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertFirewall", "(", "String", "project", ",", "Firewall", "firewallResource", ")", "{", "InsertFirewallHttpRequest", "request", "=", "InsertFirewallHttpRequest", ".", "newBuilder", "(", ")", ".", "setProject", "(", ...
Creates a firewall rule in the specified project using the data included in the request. <p>Sample code: <pre><code> try (FirewallClient firewallClient = FirewallClient.create()) { ProjectName project = ProjectName.of("[PROJECT]"); Firewall firewallResource = Firewall.newBuilder().build(); Operation response = firewallClient.insertFirewall(project.toString(), firewallResource); } </code></pre> @param project Project ID for this request. @param firewallResource Represents a Firewall resource. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "firewall", "rule", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java#L395-L404
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper._hasSideEffects
protected Boolean _hasSideEffects(XTryCatchFinallyExpression expression, ISideEffectContext context) { final List<Map<String, List<XExpression>>> buffers = new ArrayList<>(); Map<String, List<XExpression>> buffer = context.createVariableAssignmentBufferForBranch(); if (hasSideEffects(expression.getExpression(), context.branch(buffer))) { return true; } buffers.add(buffer); for (final XCatchClause clause : expression.getCatchClauses()) { context.open(); buffer = context.createVariableAssignmentBufferForBranch(); if (hasSideEffects(clause.getExpression(), context.branch(buffer))) { return true; } buffers.add(buffer); context.close(); } context.mergeBranchVariableAssignments(buffers); if (hasSideEffects(expression.getFinallyExpression(), context)) { return true; } return false; }
java
protected Boolean _hasSideEffects(XTryCatchFinallyExpression expression, ISideEffectContext context) { final List<Map<String, List<XExpression>>> buffers = new ArrayList<>(); Map<String, List<XExpression>> buffer = context.createVariableAssignmentBufferForBranch(); if (hasSideEffects(expression.getExpression(), context.branch(buffer))) { return true; } buffers.add(buffer); for (final XCatchClause clause : expression.getCatchClauses()) { context.open(); buffer = context.createVariableAssignmentBufferForBranch(); if (hasSideEffects(clause.getExpression(), context.branch(buffer))) { return true; } buffers.add(buffer); context.close(); } context.mergeBranchVariableAssignments(buffers); if (hasSideEffects(expression.getFinallyExpression(), context)) { return true; } return false; }
[ "protected", "Boolean", "_hasSideEffects", "(", "XTryCatchFinallyExpression", "expression", ",", "ISideEffectContext", "context", ")", "{", "final", "List", "<", "Map", "<", "String", ",", "List", "<", "XExpression", ">", ">", ">", "buffers", "=", "new", "ArrayL...
Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects.
[ "Test", "if", "the", "given", "expression", "has", "side", "effects", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L359-L380
tzaeschke/zoodb
src/org/zoodb/internal/query/QueryTreeNode.java
QueryTreeNode.cloneTrunk
private QueryTreeNode cloneTrunk(QueryTreeNode stop, QueryTreeNode stopClone) { QueryTreeNode node1 = null; if (n1 != null) { node1 = (n1 == stop ? stopClone : n1.cloneBranch()); } QueryTreeNode node2 = null; if (n2 != null) { node2 = n2 == stop ? stopClone : n2.cloneBranch(); } QueryTreeNode ret = cloneSingle(node1, t1, node2, t2); if (p != null) { p.cloneTrunk(this, ret); } ret.relateToChildren(); return ret; }
java
private QueryTreeNode cloneTrunk(QueryTreeNode stop, QueryTreeNode stopClone) { QueryTreeNode node1 = null; if (n1 != null) { node1 = (n1 == stop ? stopClone : n1.cloneBranch()); } QueryTreeNode node2 = null; if (n2 != null) { node2 = n2 == stop ? stopClone : n2.cloneBranch(); } QueryTreeNode ret = cloneSingle(node1, t1, node2, t2); if (p != null) { p.cloneTrunk(this, ret); } ret.relateToChildren(); return ret; }
[ "private", "QueryTreeNode", "cloneTrunk", "(", "QueryTreeNode", "stop", ",", "QueryTreeNode", "stopClone", ")", "{", "QueryTreeNode", "node1", "=", "null", ";", "if", "(", "n1", "!=", "null", ")", "{", "node1", "=", "(", "n1", "==", "stop", "?", "stopClone...
Clones a tree upwards to the root, except for the branch that starts with 'stop', which is replaced by 'stopClone'. @param stop @param stopClone @return A cloned branch of the query tree
[ "Clones", "a", "tree", "upwards", "to", "the", "root", "except", "for", "the", "branch", "that", "starts", "with", "stop", "which", "is", "replaced", "by", "stopClone", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/query/QueryTreeNode.java#L255-L271
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addIdInArrayCondition
protected void addIdInArrayCondition(final Expression<?> property, final String[] values) throws NumberFormatException { final Set<Integer> idValues = new HashSet<Integer>(); for (final String value : values) { idValues.add(Integer.parseInt(value.trim())); } addIdInCollectionCondition(property, idValues); }
java
protected void addIdInArrayCondition(final Expression<?> property, final String[] values) throws NumberFormatException { final Set<Integer> idValues = new HashSet<Integer>(); for (final String value : values) { idValues.add(Integer.parseInt(value.trim())); } addIdInCollectionCondition(property, idValues); }
[ "protected", "void", "addIdInArrayCondition", "(", "final", "Expression", "<", "?", ">", "property", ",", "final", "String", "[", "]", "values", ")", "throws", "NumberFormatException", "{", "final", "Set", "<", "Integer", ">", "idValues", "=", "new", "HashSet"...
Add a Field Search Condition that will check if the id field exists in an array of id values that are represented as a String. eg. {@code field IN (values)} @param property The field id as defined in the Entity mapping class. @param values The array of Ids to be compared to. @throws NumberFormatException Thrown if one of the Strings cannot be converted to an Integer.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "check", "if", "the", "id", "field", "exists", "in", "an", "array", "of", "id", "values", "that", "are", "represented", "as", "a", "String", ".", "eg", ".", "{", "@code", "field", "IN", "(", ...
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L331-L337
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java
ExcelDateUtil.getJavaDateOnly
public static Date getJavaDateOnly(final double excelDate, final boolean use1904windowing) { final Calendar javaCalendar = getJavaCalendar(excelDate, use1904windowing); if (javaCalendar == null) { return null; } return Utils.blastTime(javaCalendar).getTime(); }
java
public static Date getJavaDateOnly(final double excelDate, final boolean use1904windowing) { final Calendar javaCalendar = getJavaCalendar(excelDate, use1904windowing); if (javaCalendar == null) { return null; } return Utils.blastTime(javaCalendar).getTime(); }
[ "public", "static", "Date", "getJavaDateOnly", "(", "final", "double", "excelDate", ",", "final", "boolean", "use1904windowing", ")", "{", "final", "Calendar", "javaCalendar", "=", "getJavaCalendar", "(", "excelDate", ",", "use1904windowing", ")", ";", "if", "(", ...
Given an Excel date with either 1900 or 1904 date windowing, converts it to a java.util.Date. @param excelDate The Excel date. @param use1904windowing true if date uses 1904 windowing, or false if using 1900 date windowing. @return Java representation of the date without any time. @see java.util.TimeZone
[ "Given", "an", "Excel", "date", "with", "either", "1900", "or", "1904", "date", "windowing", "converts", "it", "to", "a", "java", ".", "util", ".", "Date", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java#L120-L126
jenkinsci/jenkins
core/src/main/java/hudson/util/XStream2.java
XStream2.toXMLUTF8
public void toXMLUTF8(Object obj, OutputStream out) throws IOException { Writer w = new OutputStreamWriter(out, Charset.forName("UTF-8")); w.write("<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"); toXML(obj, w); }
java
public void toXMLUTF8(Object obj, OutputStream out) throws IOException { Writer w = new OutputStreamWriter(out, Charset.forName("UTF-8")); w.write("<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"); toXML(obj, w); }
[ "public", "void", "toXMLUTF8", "(", "Object", "obj", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "Writer", "w", "=", "new", "OutputStreamWriter", "(", "out", ",", "Charset", ".", "forName", "(", "\"UTF-8\"", ")", ")", ";", "w", ".", "w...
Serializes to a byte stream. Uses UTF-8 encoding and specifies that in the XML encoding declaration. @since 1.504
[ "Serializes", "to", "a", "byte", "stream", ".", "Uses", "UTF", "-", "8", "encoding", "and", "specifies", "that", "in", "the", "XML", "encoding", "declaration", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/XStream2.java#L310-L314
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ExceptionUtils.java
ExceptionUtils.getStacktrace
public static String getStacktrace(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); throwable.printStackTrace(pw); return sw.getBuffer().toString().trim(); }
java
public static String getStacktrace(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); throwable.printStackTrace(pw); return sw.getBuffer().toString().trim(); }
[ "public", "static", "String", "getStacktrace", "(", "Throwable", "throwable", ")", "{", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "PrintWriter", "pw", "=", "new", "PrintWriter", "(", "sw", ",", "true", ")", ";", "throwable", ".", "pr...
Gets the stack trace from a Throwable as a String. <p>The result of this method vary by JDK version as this method uses {@link Throwable#printStackTrace(java.io.PrintWriter)}. On JDK1.3 and earlier, the cause exception will not be shown unless the specified throwable alters printStackTrace.</p> @param throwable the {@code Throwable} to be examined @return the stack trace as generated by the exception's {@code printStackTrace(PrintWriter)} method
[ "Gets", "the", "stack", "trace", "from", "a", "Throwable", "as", "a", "String", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ExceptionUtils.java#L60-L65
EMCECS/nfs-client-java
src/main/java/com/emc/ecs/nfsclient/nfs/nfs3/Nfs3.java
Nfs3.checkForBlank
private void checkForBlank(String value, String name) { if (StringUtils.isBlank(value)) { throw new IllegalArgumentException(name + " cannot be empty"); } }
java
private void checkForBlank(String value, String name) { if (StringUtils.isBlank(value)) { throw new IllegalArgumentException(name + " cannot be empty"); } }
[ "private", "void", "checkForBlank", "(", "String", "value", ",", "String", "name", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "value", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "name", "+", "\" cannot be empty\"", ")", ";"...
Convenience method to check String parameters that cannot be blank. @param value The parameter value. @param name The parameter name, for exception messages.
[ "Convenience", "method", "to", "check", "String", "parameters", "that", "cannot", "be", "blank", "." ]
train
https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/nfs/nfs3/Nfs3.java#L272-L276
meltmedia/cadmium
cli/src/main/java/com/meltmedia/cadmium/cli/UpdateCommand.java
UpdateCommand.isValidBranchName
public static boolean isValidBranchName(String branch, String prefix) throws Exception { if(StringUtils.isNotBlank(prefix) && StringUtils.isNotBlank(branch)) { if(StringUtils.startsWithIgnoreCase(branch, prefix + "-")) { return true; } else { System.err.println("Branch name must start with prefix \""+prefix+"-\"."); } } else { return true; } return false; }
java
public static boolean isValidBranchName(String branch, String prefix) throws Exception { if(StringUtils.isNotBlank(prefix) && StringUtils.isNotBlank(branch)) { if(StringUtils.startsWithIgnoreCase(branch, prefix + "-")) { return true; } else { System.err.println("Branch name must start with prefix \""+prefix+"-\"."); } } else { return true; } return false; }
[ "public", "static", "boolean", "isValidBranchName", "(", "String", "branch", ",", "String", "prefix", ")", "throws", "Exception", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "prefix", ")", "&&", "StringUtils", ".", "isNotBlank", "(", "branch", ")", ...
Validates the branch name that will be sent to the given prefix. @param branch @param prefix @return
[ "Validates", "the", "branch", "name", "that", "will", "be", "sent", "to", "the", "given", "prefix", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/UpdateCommand.java#L253-L264
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/util/ArgUtils.java
ArgUtils.notNull
public static void notNull(final Object arg, final String name) { if(arg == null) { throw new NullPointerException(String.format("%s should not be null.", name)); } }
java
public static void notNull(final Object arg, final String name) { if(arg == null) { throw new NullPointerException(String.format("%s should not be null.", name)); } }
[ "public", "static", "void", "notNull", "(", "final", "Object", "arg", ",", "final", "String", "name", ")", "{", "if", "(", "arg", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "String", ".", "format", "(", "\"%s should not be null.\"",...
値がnullでないかどうか検証する。 @param arg 検証対象の値 @param name 検証対象の引数の名前 @throws NullPointerException {@literal arg == null.}
[ "値がnullでないかどうか検証する。" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/util/ArgUtils.java#L21-L25
aws/aws-sdk-java
aws-java-sdk-connect/src/main/java/com/amazonaws/services/connect/model/UpdateContactAttributesRequest.java
UpdateContactAttributesRequest.withAttributes
public UpdateContactAttributesRequest withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
java
public UpdateContactAttributesRequest withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
[ "public", "UpdateContactAttributesRequest", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
<p> Specify a custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in contact flows just like any other contact attributes. </p> <p> There can be up to 32,768 UTF-8 bytes across all key-value pairs per contact. Attribute keys can include only alphanumeric, dash, and underscore characters. </p> @param attributes Specify a custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in contact flows just like any other contact attributes.</p> <p> There can be up to 32,768 UTF-8 bytes across all key-value pairs per contact. Attribute keys can include only alphanumeric, dash, and underscore characters. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Specify", "a", "custom", "key", "-", "value", "pair", "using", "an", "attribute", "map", ".", "The", "attributes", "are", "standard", "Amazon", "Connect", "attributes", "and", "can", "be", "accessed", "in", "contact", "flows", "just", "like", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-connect/src/main/java/com/amazonaws/services/connect/model/UpdateContactAttributesRequest.java#L223-L226
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteAdminGroup
public Response deleteAdminGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/admins/group/" + groupName, new HashMap<String, String>()); }
java
public Response deleteAdminGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/admins/group/" + groupName, new HashMap<String, String>()); }
[ "public", "Response", "deleteAdminGroup", "(", "String", "roomName", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/admins/group/\"", "+", "groupName", ",", "new", "HashMap", "<", "St...
Delete admin group from chatroom. @param roomName the room name @param groupName the groupName @return the response
[ "Delete", "admin", "group", "from", "chatroom", "." ]
train
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L396-L399
netarchivesuite/heritrix3-wrapper
src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java
Heritrix3Wrapper.exitJavaProcess
public EngineResult exitJavaProcess(List<String> ignoreJobs) { HttpPost postRequest = new HttpPost(baseUrl); List<NameValuePair> nvp = new LinkedList<NameValuePair>(); // 3.2.x //nvp.add(new BasicNameValuePair("action", "Exit Java Process")); // 3.3.x nvp.add(new BasicNameValuePair("action", "exit java process")); nvp.add(new BasicNameValuePair("im_sure", "on")); // ignore__${jobname}=on if (ignoreJobs != null && ignoreJobs.size() > 0) { for (int i=0; i<ignoreJobs.size(); ++i) { nvp.add(new BasicNameValuePair("ignore__" + ignoreJobs.get(i), "on")); } } StringEntity postEntity = null; try { postEntity = new UrlEncodedFormEntity(nvp); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } postEntity.setContentType("application/x-www-form-urlencoded"); postRequest.addHeader("Accept", "application/xml"); postRequest.setEntity(postEntity); return engineResult(postRequest); }
java
public EngineResult exitJavaProcess(List<String> ignoreJobs) { HttpPost postRequest = new HttpPost(baseUrl); List<NameValuePair> nvp = new LinkedList<NameValuePair>(); // 3.2.x //nvp.add(new BasicNameValuePair("action", "Exit Java Process")); // 3.3.x nvp.add(new BasicNameValuePair("action", "exit java process")); nvp.add(new BasicNameValuePair("im_sure", "on")); // ignore__${jobname}=on if (ignoreJobs != null && ignoreJobs.size() > 0) { for (int i=0; i<ignoreJobs.size(); ++i) { nvp.add(new BasicNameValuePair("ignore__" + ignoreJobs.get(i), "on")); } } StringEntity postEntity = null; try { postEntity = new UrlEncodedFormEntity(nvp); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } postEntity.setContentType("application/x-www-form-urlencoded"); postRequest.addHeader("Accept", "application/xml"); postRequest.setEntity(postEntity); return engineResult(postRequest); }
[ "public", "EngineResult", "exitJavaProcess", "(", "List", "<", "String", ">", "ignoreJobs", ")", "{", "HttpPost", "postRequest", "=", "new", "HttpPost", "(", "baseUrl", ")", ";", "List", "<", "NameValuePair", ">", "nvp", "=", "new", "LinkedList", "<", "NameV...
Send JVM shutdown action to Heritrix 3. If there are any running jobs they must be included in the ignored jobs list passed as argument. Otherwise the shutdown action is ignored. @return <code>EngineResult</code>, but only in case the shutdown was not performed
[ "Send", "JVM", "shutdown", "action", "to", "Heritrix", "3", ".", "If", "there", "are", "any", "running", "jobs", "they", "must", "be", "included", "in", "the", "ignored", "jobs", "list", "passed", "as", "argument", ".", "Otherwise", "the", "shutdown", "act...
train
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java#L175-L199
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java
EsMarshalling.unmarshallDownload
public static DownloadBean unmarshallDownload(Map<String, Object> source) { if (source == null) { return null; } DownloadBean bean = new DownloadBean(); bean.setId(asString(source.get("id"))); bean.setPath(asString(source.get("path"))); bean.setType(asEnum(source.get("type"), DownloadType.class)); bean.setExpires(asDate(source.get("expires"))); postMarshall(bean); return bean; }
java
public static DownloadBean unmarshallDownload(Map<String, Object> source) { if (source == null) { return null; } DownloadBean bean = new DownloadBean(); bean.setId(asString(source.get("id"))); bean.setPath(asString(source.get("path"))); bean.setType(asEnum(source.get("type"), DownloadType.class)); bean.setExpires(asDate(source.get("expires"))); postMarshall(bean); return bean; }
[ "public", "static", "DownloadBean", "unmarshallDownload", "(", "Map", "<", "String", ",", "Object", ">", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "DownloadBean", "bean", "=", "new", "DownloadBean", "(", ...
Unmarshals the given map source into a bean. @param source the source @return the gateway bean
[ "Unmarshals", "the", "given", "map", "source", "into", "a", "bean", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L724-L735
alkacon/opencms-core
src/org/opencms/ui/apps/sessions/CmsSessionsApp.java
CmsSessionsApp.getUserNames
protected static String getUserNames(Set<String> ids, String andLocalized) { List<String> userNames = new ArrayList<String>(); for (String id : ids) { CmsSessionInfo session = OpenCms.getSessionManager().getSessionInfo(new CmsUUID(id)); try { String name = A_CmsUI.getCmsObject().readUser(session.getUserId()).getName(); if (!userNames.contains(name)) { userNames.add(name); } } catch (CmsException e) { LOG.error("Unable to read user information", e); } } Iterator<String> iterator = userNames.iterator(); String res = ""; while (iterator.hasNext()) { res += iterator.next(); if (iterator.hasNext()) { res += ", "; } } int lastPosSeperation = res.lastIndexOf(", "); return lastPosSeperation == -1 ? res : res.substring(0, lastPosSeperation) + " " + andLocalized + " " + res.substring(lastPosSeperation + 2, res.length()); }
java
protected static String getUserNames(Set<String> ids, String andLocalized) { List<String> userNames = new ArrayList<String>(); for (String id : ids) { CmsSessionInfo session = OpenCms.getSessionManager().getSessionInfo(new CmsUUID(id)); try { String name = A_CmsUI.getCmsObject().readUser(session.getUserId()).getName(); if (!userNames.contains(name)) { userNames.add(name); } } catch (CmsException e) { LOG.error("Unable to read user information", e); } } Iterator<String> iterator = userNames.iterator(); String res = ""; while (iterator.hasNext()) { res += iterator.next(); if (iterator.hasNext()) { res += ", "; } } int lastPosSeperation = res.lastIndexOf(", "); return lastPosSeperation == -1 ? res : res.substring(0, lastPosSeperation) + " " + andLocalized + " " + res.substring(lastPosSeperation + 2, res.length()); }
[ "protected", "static", "String", "getUserNames", "(", "Set", "<", "String", ">", "ids", ",", "String", "andLocalized", ")", "{", "List", "<", "String", ">", "userNames", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", ...
Get user names as String from set of sessions.<p> @param ids to gain usernames from @param andLocalized String @return user names as string
[ "Get", "user", "names", "as", "String", "from", "set", "of", "sessions", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsSessionsApp.java#L136-L171
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/AbstractPrintQuery.java
AbstractPrintQuery.getMsgPhrase
public String getMsgPhrase(final UUID _msgPhrase) throws EFapsException { return getMsgPhrase(null, MsgPhrase.get(_msgPhrase)); }
java
public String getMsgPhrase(final UUID _msgPhrase) throws EFapsException { return getMsgPhrase(null, MsgPhrase.get(_msgPhrase)); }
[ "public", "String", "getMsgPhrase", "(", "final", "UUID", "_msgPhrase", ")", "throws", "EFapsException", "{", "return", "getMsgPhrase", "(", "null", ",", "MsgPhrase", ".", "get", "(", "_msgPhrase", ")", ")", ";", "}" ]
Get the String representation of a phrase. @param _msgPhrase the msg phrase @return String representation of the phrase @throws EFapsException on error
[ "Get", "the", "String", "representation", "of", "a", "phrase", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/AbstractPrintQuery.java#L577-L581
grandstaish/paperparcel
paperparcel-compiler/src/main/java/paperparcel/Utils.java
Utils.getClassArg
static TypeMirror getClassArg(Elements elements, Types types, DeclaredType classType) { TypeElement classElement = elements.getTypeElement(Class.class.getName()); TypeParameterElement param = classElement.getTypeParameters().get(0); return paramAsMemberOf(types, classType, param); }
java
static TypeMirror getClassArg(Elements elements, Types types, DeclaredType classType) { TypeElement classElement = elements.getTypeElement(Class.class.getName()); TypeParameterElement param = classElement.getTypeParameters().get(0); return paramAsMemberOf(types, classType, param); }
[ "static", "TypeMirror", "getClassArg", "(", "Elements", "elements", ",", "Types", "types", ",", "DeclaredType", "classType", ")", "{", "TypeElement", "classElement", "=", "elements", ".", "getTypeElement", "(", "Class", ".", "class", ".", "getName", "(", ")", ...
Returns the {@link TypeMirror} argument found in a given {@link Class} type.
[ "Returns", "the", "{" ]
train
https://github.com/grandstaish/paperparcel/blob/917686ced81b335b6708d81d6cc0e3e496f7280d/paperparcel-compiler/src/main/java/paperparcel/Utils.java#L248-L252
cdk/cdk
descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java
XLogPDescriptor.getOxygenCount
private int getOxygenCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int ocounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("O")) { if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) { ocounter += 1; } } } return ocounter; }
java
private int getOxygenCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int ocounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("O")) { if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) { ocounter += 1; } } } return ocounter; }
[ "private", "int", "getOxygenCount", "(", "IAtomContainer", "ac", ",", "IAtom", "atom", ")", "{", "List", "<", "IAtom", ">", "neighbours", "=", "ac", ".", "getConnectedAtomsList", "(", "atom", ")", ";", "int", "ocounter", "=", "0", ";", "for", "(", "IAtom...
Gets the oxygenCount attribute of the XLogPDescriptor object. @param ac Description of the Parameter @param atom Description of the Parameter @return The carbonsCount value
[ "Gets", "the", "oxygenCount", "attribute", "of", "the", "XLogPDescriptor", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1112-L1123
samskivert/pythagoras
src/main/java/pythagoras/d/Box.java
Box.intersectsZ
protected boolean intersectsZ (IRay3 ray, double z) { IVector3 origin = ray.origin(), dir = ray.direction(); double t = (z - origin.z()) / dir.z(); if (t < 0f) { return false; } double ix = origin.x() + t*dir.x(), iy = origin.y() + t*dir.y(); return ix >= _minExtent.x && ix <= _maxExtent.x && iy >= _minExtent.y && iy <= _maxExtent.y; }
java
protected boolean intersectsZ (IRay3 ray, double z) { IVector3 origin = ray.origin(), dir = ray.direction(); double t = (z - origin.z()) / dir.z(); if (t < 0f) { return false; } double ix = origin.x() + t*dir.x(), iy = origin.y() + t*dir.y(); return ix >= _minExtent.x && ix <= _maxExtent.x && iy >= _minExtent.y && iy <= _maxExtent.y; }
[ "protected", "boolean", "intersectsZ", "(", "IRay3", "ray", ",", "double", "z", ")", "{", "IVector3", "origin", "=", "ray", ".", "origin", "(", ")", ",", "dir", "=", "ray", ".", "direction", "(", ")", ";", "double", "t", "=", "(", "z", "-", "origin...
Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box at the plane where z equals the value specified.
[ "Helper", "method", "for", "{" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Box.java#L464-L473
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java
ArrayUtil.writeInt
public static void writeInt(byte[] b, int offset, int value) { b[offset++] = (byte) (value >>> 24); b[offset++] = (byte) (value >>> 16); b[offset++] = (byte) (value >>> 8); b[offset] = (byte)value; }
java
public static void writeInt(byte[] b, int offset, int value) { b[offset++] = (byte) (value >>> 24); b[offset++] = (byte) (value >>> 16); b[offset++] = (byte) (value >>> 8); b[offset] = (byte)value; }
[ "public", "static", "void", "writeInt", "(", "byte", "[", "]", "b", ",", "int", "offset", ",", "int", "value", ")", "{", "b", "[", "offset", "++", "]", "=", "(", "byte", ")", "(", "value", ">>>", "24", ")", ";", "b", "[", "offset", "++", "]", ...
Serializes an int into a byte array at a specific offset in big-endian order @param b byte array in which to write an int value. @param offset offset within byte array to start writing. @param value int to write to byte array.
[ "Serializes", "an", "int", "into", "a", "byte", "array", "at", "a", "specific", "offset", "in", "big", "-", "endian", "order" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L104-L109
apache/flink
flink-core/src/main/java/org/apache/flink/core/fs/EntropyInjector.java
EntropyInjector.removeEntropyMarkerIfPresent
public static Path removeEntropyMarkerIfPresent(FileSystem fs, Path path) { final EntropyInjectingFileSystem efs = getEntropyFs(fs); if (efs == null) { return path; } else { try { return resolveEntropy(path, efs, false); } catch (IOException e) { // this should never happen, because the path was valid before and we only remove characters. // rethrow to silence the compiler throw new FlinkRuntimeException(e.getMessage(), e); } } }
java
public static Path removeEntropyMarkerIfPresent(FileSystem fs, Path path) { final EntropyInjectingFileSystem efs = getEntropyFs(fs); if (efs == null) { return path; } else { try { return resolveEntropy(path, efs, false); } catch (IOException e) { // this should never happen, because the path was valid before and we only remove characters. // rethrow to silence the compiler throw new FlinkRuntimeException(e.getMessage(), e); } } }
[ "public", "static", "Path", "removeEntropyMarkerIfPresent", "(", "FileSystem", "fs", ",", "Path", "path", ")", "{", "final", "EntropyInjectingFileSystem", "efs", "=", "getEntropyFs", "(", "fs", ")", ";", "if", "(", "efs", "==", "null", ")", "{", "return", "p...
Removes the entropy marker string from the path, if the given file system is an entropy-injecting file system (implements {@link EntropyInjectingFileSystem}) and the entropy marker key is present. Otherwise, this returns the path as is. @param path The path to filter. @return The path without the marker string.
[ "Removes", "the", "entropy", "marker", "string", "from", "the", "path", "if", "the", "given", "file", "system", "is", "an", "entropy", "-", "injecting", "file", "system", "(", "implements", "{", "@link", "EntropyInjectingFileSystem", "}", ")", "and", "the", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/EntropyInjector.java#L73-L88
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java
FieldAccessor.setArrayLabel
public void setArrayLabel(final Object targetObj, final String label, final int index) { ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notEmpty(label, "label"); ArgUtils.notMin(index, 0, "index"); arrayLabelSetter.ifPresent(setter -> setter.set(targetObj, label, index)); }
java
public void setArrayLabel(final Object targetObj, final String label, final int index) { ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notEmpty(label, "label"); ArgUtils.notMin(index, 0, "index"); arrayLabelSetter.ifPresent(setter -> setter.set(targetObj, label, index)); }
[ "public", "void", "setArrayLabel", "(", "final", "Object", "targetObj", ",", "final", "String", "label", ",", "final", "int", "index", ")", "{", "ArgUtils", ".", "notNull", "(", "targetObj", ",", "\"targetObj\"", ")", ";", "ArgUtils", ".", "notEmpty", "(", ...
{@link XlsArrayColumns}フィールド用のラベル情報を設定します。 <p>ラベル情報を保持するフィールドがない場合は、処理はスキップされます。</p> @param targetObj フィールドが定義されているクラスのインスタンス @param label ラベル情報 @param index インデックスのキー。0以上を指定します。 @throws IllegalArgumentException {@literal targetObj == null or label == null.} @throws IllegalArgumentException {@literal label or index < 0}
[ "{", "@link", "XlsArrayColumns", "}", "フィールド用のラベル情報を設定します。", "<p", ">", "ラベル情報を保持するフィールドがない場合は、処理はスキップされます。<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java#L473-L481
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.flip
public static void flip(File imageFile, File outFile) throws IORuntimeException { flip(read(imageFile), outFile); }
java
public static void flip(File imageFile, File outFile) throws IORuntimeException { flip(read(imageFile), outFile); }
[ "public", "static", "void", "flip", "(", "File", "imageFile", ",", "File", "outFile", ")", "throws", "IORuntimeException", "{", "flip", "(", "read", "(", "imageFile", ")", ",", "outFile", ")", ";", "}" ]
水平翻转图像 @param imageFile 图像文件 @param outFile 输出文件 @throws IORuntimeException IO异常 @since 3.2.2
[ "水平翻转图像" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1070-L1072
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/mains/DependencyGenericMain.java
DependencyGenericMain.setupDependencyExtractor
protected void setupDependencyExtractor() { TokenFilter filter = (argOptions.hasOption("tokenFilter")) ? TokenFilter.loadFromSpecification(argOptions.getStringOption('F')) : null; Stemmer stemmer = argOptions.getObjectOption("stemmingAlgorithm", null); String format = argOptions.getStringOption( "dependencyParseFormat", "CoNLL"); if (format.equals("CoNLL")) { DependencyExtractor e = (argOptions.hasOption('G')) ? new CoNLLDependencyExtractor(argOptions.getStringOption('G'), filter, stemmer) : new CoNLLDependencyExtractor(filter, stemmer); DependencyExtractorManager.addExtractor("CoNLL", e, true); } else if (format.equals("WaCKy")) { if (argOptions.hasOption('G')) throw new IllegalArgumentException( "WaCKy does not support configuration with -G"); DependencyExtractor e = new WaCKyDependencyExtractor(filter, stemmer); DependencyExtractorManager.addExtractor("WaCKy", e, true); } else throw new IllegalArgumentException( "Unrecognized dependency parsed format: " + format); }
java
protected void setupDependencyExtractor() { TokenFilter filter = (argOptions.hasOption("tokenFilter")) ? TokenFilter.loadFromSpecification(argOptions.getStringOption('F')) : null; Stemmer stemmer = argOptions.getObjectOption("stemmingAlgorithm", null); String format = argOptions.getStringOption( "dependencyParseFormat", "CoNLL"); if (format.equals("CoNLL")) { DependencyExtractor e = (argOptions.hasOption('G')) ? new CoNLLDependencyExtractor(argOptions.getStringOption('G'), filter, stemmer) : new CoNLLDependencyExtractor(filter, stemmer); DependencyExtractorManager.addExtractor("CoNLL", e, true); } else if (format.equals("WaCKy")) { if (argOptions.hasOption('G')) throw new IllegalArgumentException( "WaCKy does not support configuration with -G"); DependencyExtractor e = new WaCKyDependencyExtractor(filter, stemmer); DependencyExtractorManager.addExtractor("WaCKy", e, true); } else throw new IllegalArgumentException( "Unrecognized dependency parsed format: " + format); }
[ "protected", "void", "setupDependencyExtractor", "(", ")", "{", "TokenFilter", "filter", "=", "(", "argOptions", ".", "hasOption", "(", "\"tokenFilter\"", ")", ")", "?", "TokenFilter", ".", "loadFromSpecification", "(", "argOptions", ".", "getStringOption", "(", "...
Links the desired {@link DependencyExtractor} with the {@link DependencyExtractorManager}, creating the {@code DependencyExtractor} with optional configuration file, if it is not {@code null}, and any {@link TokenFilter}s or {@link Stemmer}s that have been specified by the command line.
[ "Links", "the", "desired", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/mains/DependencyGenericMain.java#L101-L126
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java
XSLTAttributeDef.processQNAMES
Vector processQNAMES( StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nQNames = tokenizer.countTokens(); Vector qnames = new Vector(nQNames); for (int i = 0; i < nQNames; i++) { // Fix from Alexander Rudnev qnames.addElement(new QName(tokenizer.nextToken(), handler)); } return qnames; }
java
Vector processQNAMES( StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nQNames = tokenizer.countTokens(); Vector qnames = new Vector(nQNames); for (int i = 0; i < nQNames; i++) { // Fix from Alexander Rudnev qnames.addElement(new QName(tokenizer.nextToken(), handler)); } return qnames; }
[ "Vector", "processQNAMES", "(", "StylesheetHandler", "handler", ",", "String", "uri", ",", "String", "name", ",", "String", "rawName", ",", "String", "value", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "StringTokenizer", "tokenizer...
Process an attribute string of type T_QNAMES into a vector of QNames where the specification requires that non-prefixed elements not be placed in a namespace. (See section 2.4 of XSLT 1.0.) @param handler non-null reference to current StylesheetHandler that is constructing the Templates. @param uri The Namespace URI, or an empty string. @param name The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @param value A whitespace delimited list of qualified names. @return a Vector of QName objects. @throws org.xml.sax.SAXException if the one of the qualified name strings contains a prefix that can not be resolved, or a qualified name contains syntax that is invalid for a qualified name.
[ "Process", "an", "attribute", "string", "of", "type", "T_QNAMES", "into", "a", "vector", "of", "QNames", "where", "the", "specification", "requires", "that", "non", "-", "prefixed", "elements", "not", "be", "placed", "in", "a", "namespace", ".", "(", "See", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1083-L1099
LearnLib/automatalib
commons/util/src/main/java/net/automatalib/commons/util/IOUtil.java
IOUtil.copy
public static void copy(InputStream is, OutputStream os, boolean close) throws IOException { byte[] buf = new byte[DEFAULT_BUFFER_SIZE]; int len; try { while ((len = is.read(buf)) != -1) { os.write(buf, 0, len); } } finally { if (close) { closeQuietly(is); closeQuietly(os); } } }
java
public static void copy(InputStream is, OutputStream os, boolean close) throws IOException { byte[] buf = new byte[DEFAULT_BUFFER_SIZE]; int len; try { while ((len = is.read(buf)) != -1) { os.write(buf, 0, len); } } finally { if (close) { closeQuietly(is); closeQuietly(os); } } }
[ "public", "static", "void", "copy", "(", "InputStream", "is", ",", "OutputStream", "os", ",", "boolean", "close", ")", "throws", "IOException", "{", "byte", "[", "]", "buf", "=", "new", "byte", "[", "DEFAULT_BUFFER_SIZE", "]", ";", "int", "len", ";", "tr...
Copies all data from the given input stream to the given output stream. @param is the input stream. @param os the output stream. @param close <code>true</code> if both streams are closed afterwards, <code>false</code> otherwise. @throws IOException if an I/O error occurs.
[ "Copies", "all", "data", "from", "the", "given", "input", "stream", "to", "the", "given", "output", "stream", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/IOUtil.java#L99-L112
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java
CmsContainerpageController.getModelGroups
public List<CmsContainerPageElementPanel> getModelGroups() { final List<CmsContainerPageElementPanel> result = Lists.newArrayList(); processPageContent(new I_PageContentVisitor() { public boolean beginContainer(String name, CmsContainer container) { return true; } public void endContainer() { // do nothing } public void handleElement(CmsContainerPageElementPanel element) { if (element.isModelGroup()) { result.add(element); } } }); return result; }
java
public List<CmsContainerPageElementPanel> getModelGroups() { final List<CmsContainerPageElementPanel> result = Lists.newArrayList(); processPageContent(new I_PageContentVisitor() { public boolean beginContainer(String name, CmsContainer container) { return true; } public void endContainer() { // do nothing } public void handleElement(CmsContainerPageElementPanel element) { if (element.isModelGroup()) { result.add(element); } } }); return result; }
[ "public", "List", "<", "CmsContainerPageElementPanel", ">", "getModelGroups", "(", ")", "{", "final", "List", "<", "CmsContainerPageElementPanel", ">", "result", "=", "Lists", ".", "newArrayList", "(", ")", ";", "processPageContent", "(", "new", "I_PageContentVisito...
Collects all container elements which are model groups.<p> @return the list of model group container elements
[ "Collects", "all", "container", "elements", "which", "are", "model", "groups", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L1706-L1730
NessComputing/components-ness-httpclient
client/src/main/java/com/nesscomputing/httpclient/HttpClientDefaultAuthProvider.java
HttpClientDefaultAuthProvider.forUserAndHost
public static final HttpClientAuthProvider forUserAndHost(final String host, final int port, final String login, final String password) { return new HttpClientDefaultAuthProvider(null, host, port, null, login, password); }
java
public static final HttpClientAuthProvider forUserAndHost(final String host, final int port, final String login, final String password) { return new HttpClientDefaultAuthProvider(null, host, port, null, login, password); }
[ "public", "static", "final", "HttpClientAuthProvider", "forUserAndHost", "(", "final", "String", "host", ",", "final", "int", "port", ",", "final", "String", "login", ",", "final", "String", "password", ")", "{", "return", "new", "HttpClientDefaultAuthProvider", "...
Returns an {@link HttpClientAuthProvider} that will accept a specific remote host and presents the login and password as authentication credential. @param host The remote host for which the credentials are valid. @param port Port for the remote host. @param login Login to use. @param password Password to use.
[ "Returns", "an", "{", "@link", "HttpClientAuthProvider", "}", "that", "will", "accept", "a", "specific", "remote", "host", "and", "presents", "the", "login", "and", "password", "as", "authentication", "credential", "." ]
train
https://github.com/NessComputing/components-ness-httpclient/blob/8e97e8576e470449672c81fa7890c60f9986966d/client/src/main/java/com/nesscomputing/httpclient/HttpClientDefaultAuthProvider.java#L59-L62
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java
JMElasticsearchSearchAndCount.searchAll
public SearchResponse searchAll(String[] indices, String[] types) { return searchAll(indices, types, null, null); }
java
public SearchResponse searchAll(String[] indices, String[] types) { return searchAll(indices, types, null, null); }
[ "public", "SearchResponse", "searchAll", "(", "String", "[", "]", "indices", ",", "String", "[", "]", "types", ")", "{", "return", "searchAll", "(", "indices", ",", "types", ",", "null", ",", "null", ")", ";", "}" ]
Search all search response. @param indices the indices @param types the types @return the search response
[ "Search", "all", "search", "response", "." ]
train
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java#L421-L423
apereo/cas
support/cas-server-support-scim/src/main/java/org/apereo/cas/scim/v1/ScimV1PrincipalProvisioner.java
ScimV1PrincipalProvisioner.createUserResource
@SneakyThrows protected boolean createUserResource(final Principal p, final Credential credential) { val user = new UserResource(CoreSchema.USER_DESCRIPTOR); this.mapper.map(user, p, credential); return endpoint.create(user) != null; }
java
@SneakyThrows protected boolean createUserResource(final Principal p, final Credential credential) { val user = new UserResource(CoreSchema.USER_DESCRIPTOR); this.mapper.map(user, p, credential); return endpoint.create(user) != null; }
[ "@", "SneakyThrows", "protected", "boolean", "createUserResource", "(", "final", "Principal", "p", ",", "final", "Credential", "credential", ")", "{", "val", "user", "=", "new", "UserResource", "(", "CoreSchema", ".", "USER_DESCRIPTOR", ")", ";", "this", ".", ...
Create user resource boolean. @param p the p @param credential the credential @return the boolean
[ "Create", "user", "resource", "boolean", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-scim/src/main/java/org/apereo/cas/scim/v1/ScimV1PrincipalProvisioner.java#L74-L79
alkacon/opencms-core
src/org/opencms/notification/CmsContentNotification.java
CmsContentNotification.appendConfirmLink
private void appendConfirmLink(StringBuffer buf, CmsExtendedNotificationCause notificationCause) { Map<String, String[]> params = new HashMap<String, String[]>(); buf.append("<td>"); try { String resourcePath = notificationCause.getResource().getRootPath(); String siteRoot = OpenCms.getSiteManager().getSiteRoot(resourcePath); resourcePath = resourcePath.substring(siteRoot.length()); buf.append("[<a href=\""); StringBuffer wpStartUri = new StringBuffer(m_uriWorkplace); wpStartUri.append("commons/confirm_content_notification.jsp?userId="); wpStartUri.append(m_responsible.getId()); wpStartUri.append("&cause="); wpStartUri.append(notificationCause.getCause()); wpStartUri.append("&resource="); wpStartUri.append(resourcePath); params.put(CmsWorkplace.PARAM_WP_START, new String[] {wpStartUri.toString()}); params.put( CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE, new String[] {CmsResource.getParentFolder(resourcePath)}); params.put(CmsWorkplace.PARAM_WP_SITE, new String[] {siteRoot}); CmsUUID projectId = getCmsObject().readProject(OpenCms.getSystemInfo().getNotificationProject()).getUuid(); params.put(CmsWorkplace.PARAM_WP_PROJECT, new String[] {String.valueOf(projectId)}); buf.append(CmsRequestUtil.appendParameters(m_uriWorkplaceJsp, params, true)); buf.append("\">"); buf.append(m_messages.key(Messages.GUI_CONFIRM_0)); buf.append("</a>]"); } catch (CmsException e) { if (LOG.isInfoEnabled()) { LOG.info(e); } } buf.append("</td>"); }
java
private void appendConfirmLink(StringBuffer buf, CmsExtendedNotificationCause notificationCause) { Map<String, String[]> params = new HashMap<String, String[]>(); buf.append("<td>"); try { String resourcePath = notificationCause.getResource().getRootPath(); String siteRoot = OpenCms.getSiteManager().getSiteRoot(resourcePath); resourcePath = resourcePath.substring(siteRoot.length()); buf.append("[<a href=\""); StringBuffer wpStartUri = new StringBuffer(m_uriWorkplace); wpStartUri.append("commons/confirm_content_notification.jsp?userId="); wpStartUri.append(m_responsible.getId()); wpStartUri.append("&cause="); wpStartUri.append(notificationCause.getCause()); wpStartUri.append("&resource="); wpStartUri.append(resourcePath); params.put(CmsWorkplace.PARAM_WP_START, new String[] {wpStartUri.toString()}); params.put( CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE, new String[] {CmsResource.getParentFolder(resourcePath)}); params.put(CmsWorkplace.PARAM_WP_SITE, new String[] {siteRoot}); CmsUUID projectId = getCmsObject().readProject(OpenCms.getSystemInfo().getNotificationProject()).getUuid(); params.put(CmsWorkplace.PARAM_WP_PROJECT, new String[] {String.valueOf(projectId)}); buf.append(CmsRequestUtil.appendParameters(m_uriWorkplaceJsp, params, true)); buf.append("\">"); buf.append(m_messages.key(Messages.GUI_CONFIRM_0)); buf.append("</a>]"); } catch (CmsException e) { if (LOG.isInfoEnabled()) { LOG.info(e); } } buf.append("</td>"); }
[ "private", "void", "appendConfirmLink", "(", "StringBuffer", "buf", ",", "CmsExtendedNotificationCause", "notificationCause", ")", "{", "Map", "<", "String", ",", "String", "[", "]", ">", "params", "=", "new", "HashMap", "<", "String", ",", "String", "[", "]",...
Appends a link to confirm a resource, so that the responsible will not be notified any more.<p> @param buf the StringBuffer to append the html code to @param notificationCause the information for specific resource
[ "Appends", "a", "link", "to", "confirm", "a", "resource", "so", "that", "the", "responsible", "will", "not", "be", "notified", "any", "more", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/notification/CmsContentNotification.java#L223-L256
landawn/AbacusUtil
src/com/landawn/abacus/util/JdbcUtil.java
JdbcUtil.importData
public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final Connection conn, final String insertSQL) throws UncheckedSQLException { return importData(dataset, selectColumnNames, 0, dataset.size(), conn, insertSQL); }
java
public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final Connection conn, final String insertSQL) throws UncheckedSQLException { return importData(dataset, selectColumnNames, 0, dataset.size(), conn, insertSQL); }
[ "public", "static", "int", "importData", "(", "final", "DataSet", "dataset", ",", "final", "Collection", "<", "String", ">", "selectColumnNames", ",", "final", "Connection", "conn", ",", "final", "String", "insertSQL", ")", "throws", "UncheckedSQLException", "{", ...
Imports the data from <code>DataSet</code> to database. @param dataset @param selectColumnNames @param conn @param insertSQL the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql: <pre><code> List<String> columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); </code></pre> @return @throws UncheckedSQLException
[ "Imports", "the", "data", "from", "<code", ">", "DataSet<", "/", "code", ">", "to", "database", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L1873-L1876
zxing/zxing
core/src/main/java/com/google/zxing/oned/OneDReader.java
OneDReader.decode
@Override public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException, FormatException { try { return doDecode(image, hints); } catch (NotFoundException nfe) { boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER); if (tryHarder && image.isRotateSupported()) { BinaryBitmap rotatedImage = image.rotateCounterClockwise(); Result result = doDecode(rotatedImage, hints); // Record that we found it rotated 90 degrees CCW / 270 degrees CW Map<ResultMetadataType,?> metadata = result.getResultMetadata(); int orientation = 270; if (metadata != null && metadata.containsKey(ResultMetadataType.ORIENTATION)) { // But if we found it reversed in doDecode(), add in that result here: orientation = (orientation + (Integer) metadata.get(ResultMetadataType.ORIENTATION)) % 360; } result.putMetadata(ResultMetadataType.ORIENTATION, orientation); // Update result points ResultPoint[] points = result.getResultPoints(); if (points != null) { int height = rotatedImage.getHeight(); for (int i = 0; i < points.length; i++) { points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX()); } } return result; } else { throw nfe; } } }
java
@Override public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException, FormatException { try { return doDecode(image, hints); } catch (NotFoundException nfe) { boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER); if (tryHarder && image.isRotateSupported()) { BinaryBitmap rotatedImage = image.rotateCounterClockwise(); Result result = doDecode(rotatedImage, hints); // Record that we found it rotated 90 degrees CCW / 270 degrees CW Map<ResultMetadataType,?> metadata = result.getResultMetadata(); int orientation = 270; if (metadata != null && metadata.containsKey(ResultMetadataType.ORIENTATION)) { // But if we found it reversed in doDecode(), add in that result here: orientation = (orientation + (Integer) metadata.get(ResultMetadataType.ORIENTATION)) % 360; } result.putMetadata(ResultMetadataType.ORIENTATION, orientation); // Update result points ResultPoint[] points = result.getResultPoints(); if (points != null) { int height = rotatedImage.getHeight(); for (int i = 0; i < points.length; i++) { points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX()); } } return result; } else { throw nfe; } } }
[ "@", "Override", "public", "Result", "decode", "(", "BinaryBitmap", "image", ",", "Map", "<", "DecodeHintType", ",", "?", ">", "hints", ")", "throws", "NotFoundException", ",", "FormatException", "{", "try", "{", "return", "doDecode", "(", "image", ",", "hin...
Note that we don't try rotation without the try harder flag, even if rotation was supported.
[ "Note", "that", "we", "don", "t", "try", "rotation", "without", "the", "try", "harder", "flag", "even", "if", "rotation", "was", "supported", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/OneDReader.java#L50-L82
apache/groovy
src/main/groovy/groovy/util/Node.java
Node.setMetaClass
protected static void setMetaClass(final MetaClass metaClass, Class nodeClass) { // TODO Is protected static a bit of a smell? // TODO perhaps set nodeClass to be Class<? extends Node> final MetaClass newMetaClass = new DelegatingMetaClass(metaClass) { @Override public Object getAttribute(final Object object, final String attribute) { Node n = (Node) object; return n.get("@" + attribute); } @Override public void setAttribute(final Object object, final String attribute, final Object newValue) { Node n = (Node) object; n.attributes().put(attribute, newValue); } @Override public Object getProperty(Object object, String property) { if (object instanceof Node) { Node n = (Node) object; return n.get(property); } return super.getProperty(object, property); } @Override public void setProperty(Object object, String property, Object newValue) { if (property.startsWith("@")) { setAttribute(object, property.substring(1), newValue); return; } delegate.setProperty(object, property, newValue); } }; GroovySystem.getMetaClassRegistry().setMetaClass(nodeClass, newMetaClass); }
java
protected static void setMetaClass(final MetaClass metaClass, Class nodeClass) { // TODO Is protected static a bit of a smell? // TODO perhaps set nodeClass to be Class<? extends Node> final MetaClass newMetaClass = new DelegatingMetaClass(metaClass) { @Override public Object getAttribute(final Object object, final String attribute) { Node n = (Node) object; return n.get("@" + attribute); } @Override public void setAttribute(final Object object, final String attribute, final Object newValue) { Node n = (Node) object; n.attributes().put(attribute, newValue); } @Override public Object getProperty(Object object, String property) { if (object instanceof Node) { Node n = (Node) object; return n.get(property); } return super.getProperty(object, property); } @Override public void setProperty(Object object, String property, Object newValue) { if (property.startsWith("@")) { setAttribute(object, property.substring(1), newValue); return; } delegate.setProperty(object, property, newValue); } }; GroovySystem.getMetaClassRegistry().setMetaClass(nodeClass, newMetaClass); }
[ "protected", "static", "void", "setMetaClass", "(", "final", "MetaClass", "metaClass", ",", "Class", "nodeClass", ")", "{", "// TODO Is protected static a bit of a smell?", "// TODO perhaps set nodeClass to be Class<? extends Node>", "final", "MetaClass", "newMetaClass", "=", "...
Extension point for subclasses to override the metaclass. The default one supports the property and @ attribute notations. @param metaClass the original metaclass @param nodeClass the class whose metaclass we wish to override (this class or a subclass)
[ "Extension", "point", "for", "subclasses", "to", "override", "the", "metaclass", ".", "The", "default", "one", "supports", "the", "property", "and", "@", "attribute", "notations", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/Node.java#L297-L333
dspinellis/UMLGraph
src/main/java/org/umlgraph/doclet/RelationPattern.java
RelationPattern.addRelation
public void addRelation(RelationType relationType, RelationDirection direction) { int idx = relationType.ordinal(); directions[idx] = directions[idx].sum(direction); }
java
public void addRelation(RelationType relationType, RelationDirection direction) { int idx = relationType.ordinal(); directions[idx] = directions[idx].sum(direction); }
[ "public", "void", "addRelation", "(", "RelationType", "relationType", ",", "RelationDirection", "direction", ")", "{", "int", "idx", "=", "relationType", ".", "ordinal", "(", ")", ";", "directions", "[", "idx", "]", "=", "directions", "[", "idx", "]", ".", ...
Adds, eventually merging, a direction for the specified relation type @param relationType @param direction
[ "Adds", "eventually", "merging", "a", "direction", "for", "the", "specified", "relation", "type" ]
train
https://github.com/dspinellis/UMLGraph/blob/09576db5ae0ea63bfe30ef9fce88a513f9a8d843/src/main/java/org/umlgraph/doclet/RelationPattern.java#L30-L33
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/Unique.java
Unique.execute
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !encounteredElements.add(value) ) { throw new SuperCsvConstraintViolationException(String.format("duplicate value '%s' encountered", value), context, this); } return next.execute(value, context); }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !encounteredElements.add(value) ) { throw new SuperCsvConstraintViolationException(String.format("duplicate value '%s' encountered", value), context, this); } return next.execute(value, context); }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "if", "(", "!", "encounteredElements", ".", "add", "(", "value", ")", ")", "{",...
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null @throws SuperCsvConstraintViolationException if a non-unique value is encountered
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/Unique.java#L72-L80
google/closure-templates
java/src/com/google/template/soy/jbcsrc/AppendableExpression.java
AppendableExpression.appendChar
AppendableExpression appendChar(Expression exp) { return withNewDelegate(delegate.invoke(APPEND_CHAR, exp), true); }
java
AppendableExpression appendChar(Expression exp) { return withNewDelegate(delegate.invoke(APPEND_CHAR, exp), true); }
[ "AppendableExpression", "appendChar", "(", "Expression", "exp", ")", "{", "return", "withNewDelegate", "(", "delegate", ".", "invoke", "(", "APPEND_CHAR", ",", "exp", ")", ",", "true", ")", ";", "}" ]
Returns a similar {@link AppendableExpression} but with the given (char valued) expression appended to it.
[ "Returns", "a", "similar", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/AppendableExpression.java#L149-L151
alkacon/opencms-core
src/org/opencms/db/CmsAliasManager.java
CmsAliasManager.messageImportInvalidAliasPath
private String messageImportInvalidAliasPath(Locale locale, String path) { return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_INVALID_ALIAS_PATH_0); }
java
private String messageImportInvalidAliasPath(Locale locale, String path) { return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_INVALID_ALIAS_PATH_0); }
[ "private", "String", "messageImportInvalidAliasPath", "(", "Locale", "locale", ",", "String", "path", ")", "{", "return", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "locale", ")", ".", "key", "(", "Messages", ".", "ERR_ALIAS_IMPORT_INVALID_ALIAS_PA...
Message accessor.<p> @param locale the message locale @param path a path @return the message string
[ "Message", "accessor", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsAliasManager.java#L545-L549
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformDetail.java
WaveformDetail.getColorWaveformBits
private int getColorWaveformBits(final ByteBuffer waveBytes, final int segment) { final int base = (segment * 2); final int big = Util.unsign(waveBytes.get(base)); final int small = Util.unsign(waveBytes.get(base + 1)); return big * 256 + small; }
java
private int getColorWaveformBits(final ByteBuffer waveBytes, final int segment) { final int base = (segment * 2); final int big = Util.unsign(waveBytes.get(base)); final int small = Util.unsign(waveBytes.get(base + 1)); return big * 256 + small; }
[ "private", "int", "getColorWaveformBits", "(", "final", "ByteBuffer", "waveBytes", ",", "final", "int", "segment", ")", "{", "final", "int", "base", "=", "(", "segment", "*", "2", ")", ";", "final", "int", "big", "=", "Util", ".", "unsign", "(", "waveByt...
Color waveforms are represented by a series of sixteen bit integers into which color and height information are packed. This function returns the integer corresponding to a particular half-frame in the waveform. @param waveBytes the raw data making up the waveform @param segment the index of hte half-frame of interest @return the sixteen-bit number encoding the height and RGB values of that segment
[ "Color", "waveforms", "are", "represented", "by", "a", "series", "of", "sixteen", "bit", "integers", "into", "which", "color", "and", "height", "information", "are", "packed", ".", "This", "function", "returns", "the", "integer", "corresponding", "to", "a", "p...
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetail.java#L208-L213
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Force.java
Force.fromVector
public static Force fromVector(double ox, double oy, double x, double y) { // Distance calculation final double dh = x - ox; final double dv = y - oy; // Search vector and number of search steps final double norm; if (dh > dv) { norm = Math.abs(dh); } else { norm = Math.abs(dv); } final double sx; final double sy; if (Double.compare(norm, 0.0) == 0) { sx = 0; sy = 0; } else { sx = dh / norm; sy = dv / norm; } final Force force = new Force(sx, sy); force.setVelocity(norm); return force; }
java
public static Force fromVector(double ox, double oy, double x, double y) { // Distance calculation final double dh = x - ox; final double dv = y - oy; // Search vector and number of search steps final double norm; if (dh > dv) { norm = Math.abs(dh); } else { norm = Math.abs(dv); } final double sx; final double sy; if (Double.compare(norm, 0.0) == 0) { sx = 0; sy = 0; } else { sx = dh / norm; sy = dv / norm; } final Force force = new Force(sx, sy); force.setVelocity(norm); return force; }
[ "public", "static", "Force", "fromVector", "(", "double", "ox", ",", "double", "oy", ",", "double", "x", ",", "double", "y", ")", "{", "// Distance calculation", "final", "double", "dh", "=", "x", "-", "ox", ";", "final", "double", "dv", "=", "y", "-",...
Create a force from a vector movement. <p> The created force will describe the following values: </p> <ul> <li>horizontal normalized speed ({@link #getDirectionHorizontal()}),</li> <li>vertical normalized speed ({@link #getDirectionVertical()}),</li> <li>normal value ({@link #getVelocity()}).</li> </ul> @param ox The old horizontal location. @param oy The old vertical location. @param x The current horizontal location. @param y The current vertical location. @return The tiles found.
[ "Create", "a", "force", "from", "a", "vector", "movement", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Force.java#L50-L83
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/FileOutputFormat.java
FileOutputFormat.getPathForCustomFile
public static Path getPathForCustomFile(JobConf conf, String name) { return new Path(getWorkOutputPath(conf), getUniqueName(conf, name)); }
java
public static Path getPathForCustomFile(JobConf conf, String name) { return new Path(getWorkOutputPath(conf), getUniqueName(conf, name)); }
[ "public", "static", "Path", "getPathForCustomFile", "(", "JobConf", "conf", ",", "String", "name", ")", "{", "return", "new", "Path", "(", "getWorkOutputPath", "(", "conf", ")", ",", "getUniqueName", "(", "conf", ",", "name", ")", ")", ";", "}" ]
Helper function to generate a {@link Path} for a file that is unique for the task within the job output directory. <p>The path can be used to create custom files from within the map and reduce tasks. The path name will be unique for each task. The path parent will be the job output directory.</p>ls <p>This method uses the {@link #getUniqueName} method to make the file name unique for the task.</p> @param conf the configuration for the job. @param name the name for the file. @return a unique path accross all tasks of the job.
[ "Helper", "function", "to", "generate", "a", "{", "@link", "Path", "}", "for", "a", "file", "that", "is", "unique", "for", "the", "task", "within", "the", "job", "output", "directory", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/FileOutputFormat.java#L299-L301
Inbot/inbot-utils
src/main/java/io/inbot/utils/PasswordHash.java
PasswordHash.validatePassword
public static boolean validatePassword(String password, String correctHash) throws NoSuchAlgorithmException, InvalidKeySpecException { return validatePassword(password.toCharArray(), correctHash); }
java
public static boolean validatePassword(String password, String correctHash) throws NoSuchAlgorithmException, InvalidKeySpecException { return validatePassword(password.toCharArray(), correctHash); }
[ "public", "static", "boolean", "validatePassword", "(", "String", "password", ",", "String", "correctHash", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", "{", "return", "validatePassword", "(", "password", ".", "toCharArray", "(", ")", ","...
Validates a password using a hash. @param password the password to check @param correctHash the hash of the valid password @return true if the password is correct, false if not @throws NoSuchAlgorithmException if jdk does not support the algorithm @throws InvalidKeySpecException if the password or salt are invalid
[ "Validates", "a", "password", "using", "a", "hash", "." ]
train
https://github.com/Inbot/inbot-utils/blob/3112bc08d4237e95fe0f8a219a5bbceb390d0505/src/main/java/io/inbot/utils/PasswordHash.java#L101-L103
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java
Transliterator.registerInstance
static void registerInstance(Transliterator trans, boolean visible) { registry.put(trans.getID(), trans, visible); }
java
static void registerInstance(Transliterator trans, boolean visible) { registry.put(trans.getID(), trans, visible); }
[ "static", "void", "registerInstance", "(", "Transliterator", "trans", ",", "boolean", "visible", ")", "{", "registry", ".", "put", "(", "trans", ".", "getID", "(", ")", ",", "trans", ",", "visible", ")", ";", "}" ]
Register a Transliterator object. <p>Because ICU may choose to cache Transliterator objects internally, this must be called at application startup, prior to any calls to Transliterator.getInstance to avoid undefined behavior. @param trans the Transliterator object
[ "Register", "a", "Transliterator", "object", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1715-L1717
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/common/utils/internal/RepositoryCommonUtils.java
RepositoryCommonUtils.localeForString
public static Locale localeForString(String localeString) { if (localeString == null || localeString.isEmpty()) { return null; } Locale locale; String[] localeParts = localeString.split("_"); switch (localeParts.length) { case 1: locale = new Locale(localeParts[0]); break; case 2: locale = new Locale(localeParts[0], localeParts[1]); break; default: // Use default for 3 and above, merge the parts back and put them all in the varient StringBuilder varient = new StringBuilder(localeParts[2]); for (int i = 3; i < localeParts.length; i++) { varient.append("_"); varient.append(localeParts[i]); } locale = new Locale(localeParts[0], localeParts[1], varient.toString()); break; } return locale; }
java
public static Locale localeForString(String localeString) { if (localeString == null || localeString.isEmpty()) { return null; } Locale locale; String[] localeParts = localeString.split("_"); switch (localeParts.length) { case 1: locale = new Locale(localeParts[0]); break; case 2: locale = new Locale(localeParts[0], localeParts[1]); break; default: // Use default for 3 and above, merge the parts back and put them all in the varient StringBuilder varient = new StringBuilder(localeParts[2]); for (int i = 3; i < localeParts.length; i++) { varient.append("_"); varient.append(localeParts[i]); } locale = new Locale(localeParts[0], localeParts[1], varient.toString()); break; } return locale; }
[ "public", "static", "Locale", "localeForString", "(", "String", "localeString", ")", "{", "if", "(", "localeString", "==", "null", "||", "localeString", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "Locale", "locale", ";", "String", "[",...
Creates a locale based on a String of the form language_country_variant, either of the last two parts can be omitted. @param localeString The locale string @return The locale
[ "Creates", "a", "locale", "based", "on", "a", "String", "of", "the", "form", "language_country_variant", "either", "of", "the", "last", "two", "parts", "can", "be", "omitted", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/common/utils/internal/RepositoryCommonUtils.java#L27-L51
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java
Pool.getConnection
public MariaDbConnection getConnection(String username, String password) throws SQLException { try { if ((urlParser.getUsername() != null ? urlParser.getUsername().equals(username) : username == null) && (urlParser.getPassword() != null ? urlParser.getPassword().equals(password) : password == null)) { return getConnection(); } UrlParser tmpUrlParser = (UrlParser) urlParser.clone(); tmpUrlParser.setUsername(username); tmpUrlParser.setPassword(password); Protocol protocol = Utils.retrieveProxy(tmpUrlParser, globalInfo); return new MariaDbConnection(protocol); } catch (CloneNotSupportedException cloneException) { //cannot occur throw new SQLException("Error getting connection, parameters cannot be cloned", cloneException); } }
java
public MariaDbConnection getConnection(String username, String password) throws SQLException { try { if ((urlParser.getUsername() != null ? urlParser.getUsername().equals(username) : username == null) && (urlParser.getPassword() != null ? urlParser.getPassword().equals(password) : password == null)) { return getConnection(); } UrlParser tmpUrlParser = (UrlParser) urlParser.clone(); tmpUrlParser.setUsername(username); tmpUrlParser.setPassword(password); Protocol protocol = Utils.retrieveProxy(tmpUrlParser, globalInfo); return new MariaDbConnection(protocol); } catch (CloneNotSupportedException cloneException) { //cannot occur throw new SQLException("Error getting connection, parameters cannot be cloned", cloneException); } }
[ "public", "MariaDbConnection", "getConnection", "(", "String", "username", ",", "String", "password", ")", "throws", "SQLException", "{", "try", "{", "if", "(", "(", "urlParser", ".", "getUsername", "(", ")", "!=", "null", "?", "urlParser", ".", "getUsername",...
Get new connection from pool if user and password correspond to pool. If username and password are different from pool, will return a dedicated connection. @param username username @param password password @return connection @throws SQLException if any error occur during connection
[ "Get", "new", "connection", "from", "pool", "if", "user", "and", "password", "correspond", "to", "pool", ".", "If", "username", "and", "password", "are", "different", "from", "pool", "will", "return", "a", "dedicated", "connection", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java#L425-L447
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGate.java
ManagementGate.insertBackwardEdge
void insertBackwardEdge(final ManagementEdge managementEdge, final int index) { while (index >= this.backwardEdges.size()) { this.backwardEdges.add(null); } this.backwardEdges.set(index, managementEdge); }
java
void insertBackwardEdge(final ManagementEdge managementEdge, final int index) { while (index >= this.backwardEdges.size()) { this.backwardEdges.add(null); } this.backwardEdges.set(index, managementEdge); }
[ "void", "insertBackwardEdge", "(", "final", "ManagementEdge", "managementEdge", ",", "final", "int", "index", ")", "{", "while", "(", "index", ">=", "this", ".", "backwardEdges", ".", "size", "(", ")", ")", "{", "this", ".", "backwardEdges", ".", "add", "(...
Adds a new edge which arrives at this gate. @param managementEdge the edge to be added @param index the index at which the edge shall be added
[ "Adds", "a", "new", "edge", "which", "arrives", "at", "this", "gate", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGate.java#L117-L124
op4j/op4j
src/main/java/org/op4j/functions/FnString.java
FnString.replaceAll
public static final Function<String,String> replaceAll(final String regex, final String replacement) { return new Replace(regex, replacement, ReplaceType.ALL); }
java
public static final Function<String,String> replaceAll(final String regex, final String replacement) { return new Replace(regex, replacement, ReplaceType.ALL); }
[ "public", "static", "final", "Function", "<", "String", ",", "String", ">", "replaceAll", "(", "final", "String", "regex", ",", "final", "String", "replacement", ")", "{", "return", "new", "Replace", "(", "regex", ",", "replacement", ",", "ReplaceType", ".",...
<p> Replaces in the target String all substrings matching the specified regular expression with the specified replacement String. </p> <p> Regular expressions must conform to the <tt>java.util.regex.Pattern</tt> format. </p> @param regex the regular expression to match against @param replacement the replacement string @return the resulting String
[ "<p", ">", "Replaces", "in", "the", "target", "String", "all", "substrings", "matching", "the", "specified", "regular", "expression", "with", "the", "specified", "replacement", "String", ".", "<", "/", "p", ">", "<p", ">", "Regular", "expressions", "must", "...
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L2058-L2060
javalite/activeweb
javalite-async/src/main/java/org/javalite/async/Async.java
Async.removeMessages
public int removeMessages(String queueName, String filter) { try { return getQueueControl(queueName).removeMessages(filter); } catch (Exception e) { throw new AsyncException(e); } }
java
public int removeMessages(String queueName, String filter) { try { return getQueueControl(queueName).removeMessages(filter); } catch (Exception e) { throw new AsyncException(e); } }
[ "public", "int", "removeMessages", "(", "String", "queueName", ",", "String", "filter", ")", "{", "try", "{", "return", "getQueueControl", "(", "queueName", ")", ".", "removeMessages", "(", "filter", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{",...
Removes messages from queue. @param queueName queue name @param filter filter selector as in JMS specification. See: <a href="http://docs.oracle.com/cd/E19798-01/821-1841/bncer/index.html">JMS Message Selectors</a> @return number of messages removed
[ "Removes", "messages", "from", "queue", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L700-L706
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java
ContentTypeUtils.containsContentType
public static boolean containsContentType(String contentType, String[] allowedContentTypes) { if (allowedContentTypes == null) { return false; } for (int i = 0; i < allowedContentTypes.length; i++) { if (allowedContentTypes[i].indexOf(contentType) != -1) { return true; } } return false; }
java
public static boolean containsContentType(String contentType, String[] allowedContentTypes) { if (allowedContentTypes == null) { return false; } for (int i = 0; i < allowedContentTypes.length; i++) { if (allowedContentTypes[i].indexOf(contentType) != -1) { return true; } } return false; }
[ "public", "static", "boolean", "containsContentType", "(", "String", "contentType", ",", "String", "[", "]", "allowedContentTypes", ")", "{", "if", "(", "allowedContentTypes", "==", "null", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", ...
Indicate if the passes content type match one of the options passed.
[ "Indicate", "if", "the", "passes", "content", "type", "match", "one", "of", "the", "options", "passed", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java#L48-L62
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/ItemRule.java
ItemRule.setValue
public void setValue(List<Token[]> tokensList) { if (type == null) { type = ItemType.LIST; } if (!isListableType()) { throw new IllegalArgumentException("The item type must be 'array', 'list' or 'set' for this item " + this); } this.tokensList = tokensList; }
java
public void setValue(List<Token[]> tokensList) { if (type == null) { type = ItemType.LIST; } if (!isListableType()) { throw new IllegalArgumentException("The item type must be 'array', 'list' or 'set' for this item " + this); } this.tokensList = tokensList; }
[ "public", "void", "setValue", "(", "List", "<", "Token", "[", "]", ">", "tokensList", ")", "{", "if", "(", "type", "==", "null", ")", "{", "type", "=", "ItemType", ".", "LIST", ";", "}", "if", "(", "!", "isListableType", "(", ")", ")", "{", "thro...
Sets a value to this List type item. @param tokensList the tokens list
[ "Sets", "a", "value", "to", "this", "List", "type", "item", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L342-L350
redkale/redkale
src/org/redkale/boot/ClassFilter.java
ClassFilter.filter
@SuppressWarnings("unchecked") public final void filter(AnyValue property, String clazzname, URL url) { filter(property, clazzname, true, url); }
java
@SuppressWarnings("unchecked") public final void filter(AnyValue property, String clazzname, URL url) { filter(property, clazzname, true, url); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "void", "filter", "(", "AnyValue", "property", ",", "String", "clazzname", ",", "URL", "url", ")", "{", "filter", "(", "property", ",", "clazzname", ",", "true", ",", "url", ")", ";", ...
自动扫描地过滤指定的class @param property AnyValue @param clazzname String @param url URL
[ "自动扫描地过滤指定的class" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/boot/ClassFilter.java#L144-L147
stratosphere/stratosphere
stratosphere-clients/src/main/java/eu/stratosphere/client/web/WebInterfaceServer.java
WebInterfaceServer.checkAndCreateDirectories
private final void checkAndCreateDirectories(File f, boolean needWritePermission) throws IOException { String dir = f.getAbsolutePath(); // check if it exists and it is not a directory if (f.exists() && !f.isDirectory()) { throw new IOException("A none directory file with the same name as the configured directory '" + dir + "' already exists."); } // try to create the directory if (!f.exists()) { if (!f.mkdirs()) { throw new IOException("Could not create the directory '" + dir + "'."); } } // check the read and execute permission if (!(f.canRead() && f.canExecute())) { throw new IOException("The directory '" + dir + "' cannot be read and listed."); } // check the write permission if (needWritePermission && !f.canWrite()) { throw new IOException("No write access could be obtained on directory '" + dir + "'."); } }
java
private final void checkAndCreateDirectories(File f, boolean needWritePermission) throws IOException { String dir = f.getAbsolutePath(); // check if it exists and it is not a directory if (f.exists() && !f.isDirectory()) { throw new IOException("A none directory file with the same name as the configured directory '" + dir + "' already exists."); } // try to create the directory if (!f.exists()) { if (!f.mkdirs()) { throw new IOException("Could not create the directory '" + dir + "'."); } } // check the read and execute permission if (!(f.canRead() && f.canExecute())) { throw new IOException("The directory '" + dir + "' cannot be read and listed."); } // check the write permission if (needWritePermission && !f.canWrite()) { throw new IOException("No write access could be obtained on directory '" + dir + "'."); } }
[ "private", "final", "void", "checkAndCreateDirectories", "(", "File", "f", ",", "boolean", "needWritePermission", ")", "throws", "IOException", "{", "String", "dir", "=", "f", ".", "getAbsolutePath", "(", ")", ";", "// check if it exists and it is not a directory", "i...
Checks and creates the directory described by the abstract directory path. This function checks if the directory exists and creates it if necessary. It also checks read permissions and write permission, if necessary. @param dir The String describing the directory path. @param needWritePermission A flag indicating whether to check write access. @throws IOException Thrown, if the directory could not be created, or if one of the checks failed.
[ "Checks", "and", "creates", "the", "directory", "described", "by", "the", "abstract", "directory", "path", ".", "This", "function", "checks", "if", "the", "directory", "exists", "and", "creates", "it", "if", "necessary", ".", "It", "also", "checks", "read", ...
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-clients/src/main/java/eu/stratosphere/client/web/WebInterfaceServer.java#L257-L282
mockito/mockito
src/main/java/org/mockito/internal/invocation/MatcherApplicationStrategy.java
MatcherApplicationStrategy.getMatcherApplicationStrategyFor
public static MatcherApplicationStrategy getMatcherApplicationStrategyFor(Invocation invocation, List<ArgumentMatcher<?>> matchers) { MatcherApplicationType type = getMatcherApplicationType(invocation, matchers); return new MatcherApplicationStrategy(invocation, matchers, type); }
java
public static MatcherApplicationStrategy getMatcherApplicationStrategyFor(Invocation invocation, List<ArgumentMatcher<?>> matchers) { MatcherApplicationType type = getMatcherApplicationType(invocation, matchers); return new MatcherApplicationStrategy(invocation, matchers, type); }
[ "public", "static", "MatcherApplicationStrategy", "getMatcherApplicationStrategyFor", "(", "Invocation", "invocation", ",", "List", "<", "ArgumentMatcher", "<", "?", ">", ">", "matchers", ")", "{", "MatcherApplicationType", "type", "=", "getMatcherApplicationType", "(", ...
Returns the {@link MatcherApplicationStrategy} that must be used to capture the arguments of the given <b>invocation</b> using the given <b>matchers</b>. @param invocation that contain the arguments to capture @param matchers that will be used to capture the arguments of the invocation, the passed {@link List} is not required to contain a {@link CapturingMatcher} @return never <code>null</code>
[ "Returns", "the", "{", "@link", "MatcherApplicationStrategy", "}", "that", "must", "be", "used", "to", "capture", "the", "arguments", "of", "the", "given", "<b", ">", "invocation<", "/", "b", ">", "using", "the", "given", "<b", ">", "matchers<", "/", "b", ...
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/invocation/MatcherApplicationStrategy.java#L52-L56
apache/incubator-gobblin
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinClusterUtils.java
GobblinClusterUtils.getAppWorkDirPath
public static Path getAppWorkDirPath(FileSystem fs, String applicationName, String applicationId) { return new Path(fs.getHomeDirectory(), getAppWorkDirPath(applicationName, applicationId)); }
java
public static Path getAppWorkDirPath(FileSystem fs, String applicationName, String applicationId) { return new Path(fs.getHomeDirectory(), getAppWorkDirPath(applicationName, applicationId)); }
[ "public", "static", "Path", "getAppWorkDirPath", "(", "FileSystem", "fs", ",", "String", "applicationName", ",", "String", "applicationId", ")", "{", "return", "new", "Path", "(", "fs", ".", "getHomeDirectory", "(", ")", ",", "getAppWorkDirPath", "(", "applicati...
Get the application working directory {@link Path}. @param fs a {@link FileSystem} instance on which {@link FileSystem#getHomeDirectory()} is called to get the home directory of the {@link FileSystem} of the application working directory @param applicationName the application name @param applicationId the application ID in string form @return the cluster application working directory {@link Path}
[ "Get", "the", "application", "working", "directory", "{", "@link", "Path", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinClusterUtils.java#L60-L62
twilliamson/mogwee-logging
src/main/java/com/mogwee/logging/Logger.java
Logger.errorDebug
public final void errorDebug(final Throwable cause, final String message) { logDebug(Level.ERROR, cause, message); }
java
public final void errorDebug(final Throwable cause, final String message) { logDebug(Level.ERROR, cause, message); }
[ "public", "final", "void", "errorDebug", "(", "final", "Throwable", "cause", ",", "final", "String", "message", ")", "{", "logDebug", "(", "Level", ".", "ERROR", ",", "cause", ",", "message", ")", ";", "}" ]
Logs a message and stack trace if DEBUG logging is enabled or a formatted message and exception description if ERROR logging is enabled. @param cause an exception to print stack trace of if DEBUG logging is enabled @param message a message
[ "Logs", "a", "message", "and", "stack", "trace", "if", "DEBUG", "logging", "is", "enabled", "or", "a", "formatted", "message", "and", "exception", "description", "if", "ERROR", "logging", "is", "enabled", "." ]
train
https://github.com/twilliamson/mogwee-logging/blob/30b99c2649de455432d956a8f6a74316de4cd62c/src/main/java/com/mogwee/logging/Logger.java#L417-L420
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Log.java
Log.setFile
public void setFile(String file) throws ApplicationException { if (StringUtil.isEmpty(file)) return; if (file.indexOf('/') != -1 || file.indexOf('\\') != -1) throw new ApplicationException("value [" + file + "] from attribute [file] at tag [log] can only contain a filename, file separators like [\\/] are not allowed"); if (!file.endsWith(".log")) file += ".log"; this.file = file; }
java
public void setFile(String file) throws ApplicationException { if (StringUtil.isEmpty(file)) return; if (file.indexOf('/') != -1 || file.indexOf('\\') != -1) throw new ApplicationException("value [" + file + "] from attribute [file] at tag [log] can only contain a filename, file separators like [\\/] are not allowed"); if (!file.endsWith(".log")) file += ".log"; this.file = file; }
[ "public", "void", "setFile", "(", "String", "file", ")", "throws", "ApplicationException", "{", "if", "(", "StringUtil", ".", "isEmpty", "(", "file", ")", ")", "return", ";", "if", "(", "file", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", "||"...
set the value file @param file value to set @throws ApplicationException
[ "set", "the", "value", "file" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Log.java#L156-L163
googleapis/google-cloud-java
google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingImpl.java
LoggingImpl.writeLogEntries
private void writeLogEntries(Iterable<LogEntry> logEntries, WriteOption... writeOptions) { switch (this.writeSynchronicity) { case SYNC: get(writeAsync(logEntries, writeOptions)); break; case ASYNC: default: final ApiFuture<Void> writeFuture = writeAsync(logEntries, writeOptions); final Object pendingKey = new Object(); pendingWrites.put(pendingKey, writeFuture); ApiFutures.addCallback( writeFuture, new ApiFutureCallback<Void>() { private void removeFromPending() { pendingWrites.remove(pendingKey); } @Override public void onSuccess(Void v) { removeFromPending(); } @Override public void onFailure(Throwable t) { try { Exception ex = t instanceof Exception ? (Exception) t : new Exception(t); throw new RuntimeException(ex); } finally { removeFromPending(); } } }); break; } }
java
private void writeLogEntries(Iterable<LogEntry> logEntries, WriteOption... writeOptions) { switch (this.writeSynchronicity) { case SYNC: get(writeAsync(logEntries, writeOptions)); break; case ASYNC: default: final ApiFuture<Void> writeFuture = writeAsync(logEntries, writeOptions); final Object pendingKey = new Object(); pendingWrites.put(pendingKey, writeFuture); ApiFutures.addCallback( writeFuture, new ApiFutureCallback<Void>() { private void removeFromPending() { pendingWrites.remove(pendingKey); } @Override public void onSuccess(Void v) { removeFromPending(); } @Override public void onFailure(Throwable t) { try { Exception ex = t instanceof Exception ? (Exception) t : new Exception(t); throw new RuntimeException(ex); } finally { removeFromPending(); } } }); break; } }
[ "private", "void", "writeLogEntries", "(", "Iterable", "<", "LogEntry", ">", "logEntries", ",", "WriteOption", "...", "writeOptions", ")", "{", "switch", "(", "this", ".", "writeSynchronicity", ")", "{", "case", "SYNC", ":", "get", "(", "writeAsync", "(", "l...
/* Write logs synchronously or asynchronously based on writeSynchronicity setting.
[ "/", "*", "Write", "logs", "synchronously", "or", "asynchronously", "based", "on", "writeSynchronicity", "setting", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingImpl.java#L584-L619
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.getRetRequiredCheck
public static String getRetRequiredCheck(String express, Field field) { String code = "if (CodedConstant.isNull(" + express + ")) {\n"; code += "throw new UninitializedMessageException(CodedConstant.asList(\"" + field.getName() + "\"));\n"; code += "}\n"; return code; }
java
public static String getRetRequiredCheck(String express, Field field) { String code = "if (CodedConstant.isNull(" + express + ")) {\n"; code += "throw new UninitializedMessageException(CodedConstant.asList(\"" + field.getName() + "\"));\n"; code += "}\n"; return code; }
[ "public", "static", "String", "getRetRequiredCheck", "(", "String", "express", ",", "Field", "field", ")", "{", "String", "code", "=", "\"if (CodedConstant.isNull(\"", "+", "express", "+", "\")) {\\n\"", ";", "code", "+=", "\"throw new UninitializedMessageException(Code...
get return required field check java expression. @param express java expression @param field java field @return full java expression
[ "get", "return", "required", "field", "check", "java", "expression", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L897-L903
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java
DefaultComparisonFormatter.appendFullDocumentHeader
protected void appendFullDocumentHeader(StringBuilder sb, Document doc) { if (appendDocumentXmlDeclaration(sb, doc)) { sb.append("\n"); } if (appendDocumentType(sb, doc.getDoctype())) { sb.append("\n"); } appendOnlyElementStartTagWithAttributes(sb, doc.getDocumentElement()); }
java
protected void appendFullDocumentHeader(StringBuilder sb, Document doc) { if (appendDocumentXmlDeclaration(sb, doc)) { sb.append("\n"); } if (appendDocumentType(sb, doc.getDoctype())) { sb.append("\n"); } appendOnlyElementStartTagWithAttributes(sb, doc.getDocumentElement()); }
[ "protected", "void", "appendFullDocumentHeader", "(", "StringBuilder", "sb", ",", "Document", "doc", ")", "{", "if", "(", "appendDocumentXmlDeclaration", "(", "sb", ",", "doc", ")", ")", "{", "sb", ".", "append", "(", "\"\\n\"", ")", ";", "}", "if", "(", ...
Appends the XML declaration and DOCTYPE if present as well as the document's root element for {@link #getFullFormattedXml}. @param sb the builder to append to @param doc the document to format @since XMLUnit 2.4.0
[ "Appends", "the", "XML", "declaration", "and", "DOCTYPE", "if", "present", "as", "well", "as", "the", "document", "s", "root", "element", "for", "{", "@link", "#getFullFormattedXml", "}", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L393-L401
dkmfbk/knowledgestore
ks-server-hbase/src/main/java/eu/fbk/knowledgestore/datastore/hbase/utils/HBaseUtils.java
HBaseUtils.createDelete
@Override public Delete createDelete(URI id, String tableName) throws IOException { Delete del = null; HTable hTable = getTable(tableName); if (hTable != null) { del = new Delete(Bytes.toBytes(id.toString())); } return del; }
java
@Override public Delete createDelete(URI id, String tableName) throws IOException { Delete del = null; HTable hTable = getTable(tableName); if (hTable != null) { del = new Delete(Bytes.toBytes(id.toString())); } return del; }
[ "@", "Override", "public", "Delete", "createDelete", "(", "URI", "id", ",", "String", "tableName", ")", "throws", "IOException", "{", "Delete", "del", "=", "null", ";", "HTable", "hTable", "=", "getTable", "(", "tableName", ")", ";", "if", "(", "hTable", ...
Creates deletes for HBase tables @param record @param tableName @param conf @return @throws IOException
[ "Creates", "deletes", "for", "HBase", "tables" ]
train
https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-server-hbase/src/main/java/eu/fbk/knowledgestore/datastore/hbase/utils/HBaseUtils.java#L210-L218
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/PropsCodeGen.java
PropsCodeGen.writeConfigProps
void writeConfigProps(Definition def, Writer out, int indent) throws IOException { if (getConfigProps(def) == null) return; for (int i = 0; i < getConfigProps(def).size(); i++) { String name = getConfigProps(def).get(i).getName(); String upcaseName = upcaseFirst(name); //set writeWithIndent(out, indent, "/** \n"); writeWithIndent(out, indent, " * Set " + name); writeEol(out); writeWithIndent(out, indent, " * @param " + name + " The value\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void set" + upcaseName + "(" + getConfigProps(def).get(i).getType() + " " + name + ")"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "this." + name + " = " + name + ";"); writeRightCurlyBracket(out, indent); writeEol(out); //get writeWithIndent(out, indent, "/** \n"); writeWithIndent(out, indent, " * Get " + name); writeEol(out); writeWithIndent(out, indent, " * @return The value\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getConfigProps(def).get(i).getType() + " get" + upcaseName + "()"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return " + name + ";"); writeRightCurlyBracket(out, indent); writeEol(out); } }
java
void writeConfigProps(Definition def, Writer out, int indent) throws IOException { if (getConfigProps(def) == null) return; for (int i = 0; i < getConfigProps(def).size(); i++) { String name = getConfigProps(def).get(i).getName(); String upcaseName = upcaseFirst(name); //set writeWithIndent(out, indent, "/** \n"); writeWithIndent(out, indent, " * Set " + name); writeEol(out); writeWithIndent(out, indent, " * @param " + name + " The value\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void set" + upcaseName + "(" + getConfigProps(def).get(i).getType() + " " + name + ")"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "this." + name + " = " + name + ";"); writeRightCurlyBracket(out, indent); writeEol(out); //get writeWithIndent(out, indent, "/** \n"); writeWithIndent(out, indent, " * Get " + name); writeEol(out); writeWithIndent(out, indent, " * @return The value\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getConfigProps(def).get(i).getType() + " get" + upcaseName + "()"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return " + name + ";"); writeRightCurlyBracket(out, indent); writeEol(out); } }
[ "void", "writeConfigProps", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "if", "(", "getConfigProps", "(", "def", ")", "==", "null", ")", "return", ";", "for", "(", "int", "i", "=", "0", ";", ...
Output Configuration Properties @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "Configuration", "Properties" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/PropsCodeGen.java#L81-L125
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java
MultiNormalizerHybrid.minMaxScaleInput
public MultiNormalizerHybrid minMaxScaleInput(int input, double rangeFrom, double rangeTo) { perInputStrategies.put(input, new MinMaxStrategy(rangeFrom, rangeTo)); return this; }
java
public MultiNormalizerHybrid minMaxScaleInput(int input, double rangeFrom, double rangeTo) { perInputStrategies.put(input, new MinMaxStrategy(rangeFrom, rangeTo)); return this; }
[ "public", "MultiNormalizerHybrid", "minMaxScaleInput", "(", "int", "input", ",", "double", "rangeFrom", ",", "double", "rangeTo", ")", "{", "perInputStrategies", ".", "put", "(", "input", ",", "new", "MinMaxStrategy", "(", "rangeFrom", ",", "rangeTo", ")", ")", ...
Apply min-max scaling to a specific input, overriding the global input strategy if any @param input the index of the input @param rangeFrom lower bound of the target range @param rangeTo upper bound of the target range @return the normalizer
[ "Apply", "min", "-", "max", "scaling", "to", "a", "specific", "input", "overriding", "the", "global", "input", "strategy", "if", "any" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java#L121-L124
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java
N1qlQueryExecutor.executePrepared
protected Observable<AsyncN1qlQueryResult> executePrepared(final N1qlQuery query, PreparedPayload payload, CouchbaseEnvironment env, long timeout, TimeUnit timeUnit) { PreparedN1qlQuery preparedQuery; if (query instanceof ParameterizedN1qlQuery) { ParameterizedN1qlQuery pq = (ParameterizedN1qlQuery) query; if (pq.isPositional()) { preparedQuery = new PreparedN1qlQuery(payload, (JsonArray) pq.statementParameters(), query.params()); } else { preparedQuery = new PreparedN1qlQuery(payload, (JsonObject) pq.statementParameters(), query.params()); } } else { preparedQuery = new PreparedN1qlQuery(payload, query.params()); } preparedQuery.setEncodedPlanEnabled(isEncodedPlanEnabled()); return executeQuery(preparedQuery, env, timeout, timeUnit); }
java
protected Observable<AsyncN1qlQueryResult> executePrepared(final N1qlQuery query, PreparedPayload payload, CouchbaseEnvironment env, long timeout, TimeUnit timeUnit) { PreparedN1qlQuery preparedQuery; if (query instanceof ParameterizedN1qlQuery) { ParameterizedN1qlQuery pq = (ParameterizedN1qlQuery) query; if (pq.isPositional()) { preparedQuery = new PreparedN1qlQuery(payload, (JsonArray) pq.statementParameters(), query.params()); } else { preparedQuery = new PreparedN1qlQuery(payload, (JsonObject) pq.statementParameters(), query.params()); } } else { preparedQuery = new PreparedN1qlQuery(payload, query.params()); } preparedQuery.setEncodedPlanEnabled(isEncodedPlanEnabled()); return executeQuery(preparedQuery, env, timeout, timeUnit); }
[ "protected", "Observable", "<", "AsyncN1qlQueryResult", ">", "executePrepared", "(", "final", "N1qlQuery", "query", ",", "PreparedPayload", "payload", ",", "CouchbaseEnvironment", "env", ",", "long", "timeout", ",", "TimeUnit", "timeUnit", ")", "{", "PreparedN1qlQuery...
Issues a proper N1QL EXECUTE, detecting if parameters must be added to it.
[ "Issues", "a", "proper", "N1QL", "EXECUTE", "detecting", "if", "parameters", "must", "be", "added", "to", "it", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java#L410-L425
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java
PublicIPPrefixesInner.updateTagsAsync
public Observable<PublicIPPrefixInner> updateTagsAsync(String resourceGroupName, String publicIpPrefixName) { return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() { @Override public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) { return response.body(); } }); }
java
public Observable<PublicIPPrefixInner> updateTagsAsync(String resourceGroupName, String publicIpPrefixName) { return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() { @Override public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PublicIPPrefixInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "publicIpPrefixName", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "publicIpPrefixName", ")", ".", "m...
Updates public IP prefix tags. @param resourceGroupName The name of the resource group. @param publicIpPrefixName The name of the public IP prefix. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "public", "IP", "prefix", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java#L636-L643
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java
ConfigurationParseHelper.getIntValue
public static Integer getIntValue(Properties cfg, String key) { String propValue = cfg.getProperty(key); if (propValue == null) { return null; } if (StringHelper.isEmpty(propValue.trim())) { throw log.configurationPropertyCantBeEmpty(key); } else { return parseInt(propValue, 0, "Unable to parse " + key + ": " + propValue); } }
java
public static Integer getIntValue(Properties cfg, String key) { String propValue = cfg.getProperty(key); if (propValue == null) { return null; } if (StringHelper.isEmpty(propValue.trim())) { throw log.configurationPropertyCantBeEmpty(key); } else { return parseInt(propValue, 0, "Unable to parse " + key + ": " + propValue); } }
[ "public", "static", "Integer", "getIntValue", "(", "Properties", "cfg", ",", "String", "key", ")", "{", "String", "propValue", "=", "cfg", ".", "getProperty", "(", "key", ")", ";", "if", "(", "propValue", "==", "null", ")", "{", "return", "null", ";", ...
Retrieves a configuration property and parses it as an Integer if it exists, or returns null if the property is not set (undefined). @param cfg configuration Properties @param key the property key @return the Integer or null @throws SearchException both for empty (non-null) values and for Strings not containing a valid int representation.
[ "Retrieves", "a", "configuration", "property", "and", "parses", "it", "as", "an", "Integer", "if", "it", "exists", "or", "returns", "null", "if", "the", "property", "is", "not", "set", "(", "undefined", ")", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java#L35-L45
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getLong6
public static final long getLong6(byte[] data, int offset) { long result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 48; shiftBy += 8) { result |= ((long) (data[i] & 0xff)) << shiftBy; ++i; } return result; }
java
public static final long getLong6(byte[] data, int offset) { long result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 48; shiftBy += 8) { result |= ((long) (data[i] & 0xff)) << shiftBy; ++i; } return result; }
[ "public", "static", "final", "long", "getLong6", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "long", "result", "=", "0", ";", "int", "i", "=", "offset", ";", "for", "(", "int", "shiftBy", "=", "0", ";", "shiftBy", "<", "48", ";...
This method reads a six byte long from the input array. @param data the input array @param offset offset of integer data in the array @return integer value
[ "This", "method", "reads", "a", "six", "byte", "long", "from", "the", "input", "array", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L237-L247
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.MAIN
public static HtmlTree MAIN(HtmlStyle styleClass, Content body) { HtmlTree htmltree = HtmlTree.MAIN(body); if (styleClass != null) { htmltree.addStyle(styleClass); } return htmltree; }
java
public static HtmlTree MAIN(HtmlStyle styleClass, Content body) { HtmlTree htmltree = HtmlTree.MAIN(body); if (styleClass != null) { htmltree.addStyle(styleClass); } return htmltree; }
[ "public", "static", "HtmlTree", "MAIN", "(", "HtmlStyle", "styleClass", ",", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "HtmlTree", ".", "MAIN", "(", "body", ")", ";", "if", "(", "styleClass", "!=", "null", ")", "{", "htmltree", ".", "addS...
Generates a MAIN tag with role attribute, style attribute and some content. @param styleClass style of the MAIN tag @param body content of the MAIN tag @return an HtmlTree object for the MAIN tag
[ "Generates", "a", "MAIN", "tag", "with", "role", "attribute", "style", "attribute", "and", "some", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L560-L566
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Workitem.java
Workitem.createEffort
public Effort createEffort(double value, Member member, DateTime date, Map<String, Object> attributes) { return getInstance().create().effort(value, this, member, date, attributes); }
java
public Effort createEffort(double value, Member member, DateTime date, Map<String, Object> attributes) { return getInstance().create().effort(value, this, member, date, attributes); }
[ "public", "Effort", "createEffort", "(", "double", "value", ",", "Member", "member", ",", "DateTime", "date", ",", "Map", "<", "String", ",", "Object", ">", "attributes", ")", "{", "return", "getInstance", "(", ")", ".", "create", "(", ")", ".", "effort"...
Log an effort record against this workitem with the current day and time and given member and value. @param member The subject of the Effort. @param value if the Effort. @param date of the Effort record. @param attributes additional attributes for the Effort record. @return created Effort record. @throws IllegalStateException if Effort tracking is not enabled.
[ "Log", "an", "effort", "record", "against", "this", "workitem", "with", "the", "current", "day", "and", "time", "and", "given", "member", "and", "value", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Workitem.java#L185-L187
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/tiles/features/FeatureTiles.java
FeatureTiles.drawTile
public BufferedImage drawTile(int x, int y, int zoom) { BufferedImage image; if (isIndexQuery()) { image = drawTileQueryIndex(x, y, zoom); } else { image = drawTileQueryAll(x, y, zoom); } return image; }
java
public BufferedImage drawTile(int x, int y, int zoom) { BufferedImage image; if (isIndexQuery()) { image = drawTileQueryIndex(x, y, zoom); } else { image = drawTileQueryAll(x, y, zoom); } return image; }
[ "public", "BufferedImage", "drawTile", "(", "int", "x", ",", "int", "y", ",", "int", "zoom", ")", "{", "BufferedImage", "image", ";", "if", "(", "isIndexQuery", "(", ")", ")", "{", "image", "=", "drawTileQueryIndex", "(", "x", ",", "y", ",", "zoom", ...
Draw a tile image from the x, y, and zoom level @param x x coordinate @param y y coordinate @param zoom zoom level @return tile image, or null
[ "Draw", "a", "tile", "image", "from", "the", "x", "y", "and", "zoom", "level" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/features/FeatureTiles.java#L925-L933
LableOrg/java-uniqueid
uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/SynchronizedGeneratorIdentity.java
SynchronizedGeneratorIdentity.basedOn
public static SynchronizedGeneratorIdentity basedOn(String quorum, String znode, Supplier<Duration> claimDurationSupplier) throws IOException { ZooKeeperConnection zooKeeperConnection = new ZooKeeperConnection(quorum); int clusterId = ClusterID.get(zooKeeperConnection.getActiveConnection(), znode); return new SynchronizedGeneratorIdentity(zooKeeperConnection, znode, clusterId, claimDurationSupplier); }
java
public static SynchronizedGeneratorIdentity basedOn(String quorum, String znode, Supplier<Duration> claimDurationSupplier) throws IOException { ZooKeeperConnection zooKeeperConnection = new ZooKeeperConnection(quorum); int clusterId = ClusterID.get(zooKeeperConnection.getActiveConnection(), znode); return new SynchronizedGeneratorIdentity(zooKeeperConnection, znode, clusterId, claimDurationSupplier); }
[ "public", "static", "SynchronizedGeneratorIdentity", "basedOn", "(", "String", "quorum", ",", "String", "znode", ",", "Supplier", "<", "Duration", ">", "claimDurationSupplier", ")", "throws", "IOException", "{", "ZooKeeperConnection", "zooKeeperConnection", "=", "new", ...
Create a new {@link SynchronizedGeneratorIdentity} instance. @param quorum Addresses of the ZooKeeper quorum (comma-separated). @param znode Root znode of the ZooKeeper resource-pool. @param claimDurationSupplier Provides the amount of time a claim to a generator-ID should be held. By using a {@link Supplier} instead of a static long, this may dynamically reconfigured at runtime. @return A {@link SynchronizedGeneratorIdentity} instance.
[ "Create", "a", "new", "{", "@link", "SynchronizedGeneratorIdentity", "}", "instance", "." ]
train
https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/SynchronizedGeneratorIdentity.java#L64-L72
alipay/sofa-rpc
extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/BoltClientTransport.java
BoltClientTransport.doOneWay
protected void doOneWay(SofaRequest request, InvokeContext invokeContext, int timeoutMillis) throws RemotingException, InterruptedException { RPC_CLIENT.oneway(url, request, invokeContext); }
java
protected void doOneWay(SofaRequest request, InvokeContext invokeContext, int timeoutMillis) throws RemotingException, InterruptedException { RPC_CLIENT.oneway(url, request, invokeContext); }
[ "protected", "void", "doOneWay", "(", "SofaRequest", "request", ",", "InvokeContext", "invokeContext", ",", "int", "timeoutMillis", ")", "throws", "RemotingException", ",", "InterruptedException", "{", "RPC_CLIENT", ".", "oneway", "(", "url", ",", "request", ",", ...
同步调用 @param request 请求对象 @param invokeContext 调用上下文 @param timeoutMillis 超时时间(毫秒) @throws RemotingException 远程调用异常 @throws InterruptedException 中断异常 @since 5.2.0
[ "同步调用" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/BoltClientTransport.java#L309-L312
lastaflute/lasta-di
src/main/java/org/lastaflute/di/util/LdiSrl.java
LdiSrl.frontstring
public static String frontstring(final String str, final int index) { assertStringNotNull(str); if (str.length() < index) { String msg = "The length of the string was smaller than the index:"; msg = msg + " str=" + str + " index=" + index; throw new StringIndexOutOfBoundsException(msg); } return str.substring(0, index); }
java
public static String frontstring(final String str, final int index) { assertStringNotNull(str); if (str.length() < index) { String msg = "The length of the string was smaller than the index:"; msg = msg + " str=" + str + " index=" + index; throw new StringIndexOutOfBoundsException(msg); } return str.substring(0, index); }
[ "public", "static", "String", "frontstring", "(", "final", "String", "str", ",", "final", "int", "index", ")", "{", "assertStringNotNull", "(", "str", ")", ";", "if", "(", "str", ".", "length", "(", ")", "<", "index", ")", "{", "String", "msg", "=", ...
Extract front sub-string by index. <pre> rearstring("flute", 2) returns "fl" </pre> @param str The target string. (NotNull) @param index The index from rear. @return The rear string. (NotNull)
[ "Extract", "front", "sub", "-", "string", "by", "index", ".", "<pre", ">", "rearstring", "(", "flute", "2", ")", "returns", "fl", "<", "/", "pre", ">" ]
train
https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L587-L595
LevelFourAB/commons
commons-types/src/main/java/se/l4/commons/types/internal/ExtendedTypeBuilderImpl.java
ExtendedTypeBuilderImpl.createFunction
@SuppressWarnings({ "unchecked", "rawtypes" }) private static <CT, I> Function<CT, I> createFunction( Class<CT> contextType, Class<I> typeToExtend, Map<Method, MethodInvocationHandler<CT>> invokers ) { try { DynamicType.Builder builder = new ByteBuddy() .subclass(typeToExtend); // Add the context field builder = builder.defineField("context", contextType, Visibility.PRIVATE); // Add the constructor builder = builder.defineConstructor(Visibility.PUBLIC) .withParameter(contextType) .intercept( MethodCall.invoke(Object.class.getDeclaredConstructor()) .onSuper() .andThen(FieldAccessor.ofField("context").setsArgumentAt(0)) ); // TODO: The constructor needs to support abstract base classes and injection via InstanceFactory for(Map.Entry<Method, MethodInvocationHandler<CT>> e : invokers.entrySet()) { builder = builder.define(e.getKey()) .intercept( MethodDelegation.to(new Runner(e.getValue())) ); } Class createdClass = builder.make() .load(typeToExtend.getClassLoader()) .getLoaded(); return createFactory(createdClass, contextType); } catch(Throwable e) { if(e instanceof ProxyException) throw (ProxyException) e; throw new ProxyException(e); } }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) private static <CT, I> Function<CT, I> createFunction( Class<CT> contextType, Class<I> typeToExtend, Map<Method, MethodInvocationHandler<CT>> invokers ) { try { DynamicType.Builder builder = new ByteBuddy() .subclass(typeToExtend); // Add the context field builder = builder.defineField("context", contextType, Visibility.PRIVATE); // Add the constructor builder = builder.defineConstructor(Visibility.PUBLIC) .withParameter(contextType) .intercept( MethodCall.invoke(Object.class.getDeclaredConstructor()) .onSuper() .andThen(FieldAccessor.ofField("context").setsArgumentAt(0)) ); // TODO: The constructor needs to support abstract base classes and injection via InstanceFactory for(Map.Entry<Method, MethodInvocationHandler<CT>> e : invokers.entrySet()) { builder = builder.define(e.getKey()) .intercept( MethodDelegation.to(new Runner(e.getValue())) ); } Class createdClass = builder.make() .load(typeToExtend.getClassLoader()) .getLoaded(); return createFactory(createdClass, contextType); } catch(Throwable e) { if(e instanceof ProxyException) throw (ProxyException) e; throw new ProxyException(e); } }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "private", "static", "<", "CT", ",", "I", ">", "Function", "<", "CT", ",", "I", ">", "createFunction", "(", "Class", "<", "CT", ">", "contextType", ",", "Class", "<", "I...
Create the actual function that creates instances. @param contextType the context type being used @param typeToExtend the type being extended @param invokers the resolved invokers
[ "Create", "the", "actual", "function", "that", "creates", "instances", "." ]
train
https://github.com/LevelFourAB/commons/blob/aa121b3a5504b43d0c10450a1b984694fcd2b8ee/commons-types/src/main/java/se/l4/commons/types/internal/ExtendedTypeBuilderImpl.java#L146-L191
mockito/mockito
src/main/java/org/mockito/internal/configuration/injection/MockInjection.java
MockInjection.onFields
public static OngoingMockInjection onFields(Set<Field> fields, Object ofInstance) { return new OngoingMockInjection(fields, ofInstance); }
java
public static OngoingMockInjection onFields(Set<Field> fields, Object ofInstance) { return new OngoingMockInjection(fields, ofInstance); }
[ "public", "static", "OngoingMockInjection", "onFields", "(", "Set", "<", "Field", ">", "fields", ",", "Object", "ofInstance", ")", "{", "return", "new", "OngoingMockInjection", "(", "fields", ",", "ofInstance", ")", ";", "}" ]
Create a new configuration setup for fields @param fields Fields needing mock injection @param ofInstance Instance owning the <code>field</code> @return New configuration builder
[ "Create", "a", "new", "configuration", "setup", "for", "fields" ]
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/configuration/injection/MockInjection.java#L47-L49
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ILFBuilder.java
ILFBuilder.mergeAllowed
private static boolean mergeAllowed(Element child, IAuthorizationPrincipal ap) throws AuthorizationException { if (!child.getTagName().equals("channel")) return true; String channelPublishId = child.getAttribute("chanID"); return ap.canRender(channelPublishId); }
java
private static boolean mergeAllowed(Element child, IAuthorizationPrincipal ap) throws AuthorizationException { if (!child.getTagName().equals("channel")) return true; String channelPublishId = child.getAttribute("chanID"); return ap.canRender(channelPublishId); }
[ "private", "static", "boolean", "mergeAllowed", "(", "Element", "child", ",", "IAuthorizationPrincipal", "ap", ")", "throws", "AuthorizationException", "{", "if", "(", "!", "child", ".", "getTagName", "(", ")", ".", "equals", "(", "\"channel\"", ")", ")", "ret...
Tests to see if channels to be merged from ILF can be rendered by the end user. If not then they are discarded from the merge. @param child @param person @return @throws AuthorizationException @throws NumberFormatException
[ "Tests", "to", "see", "if", "channels", "to", "be", "merged", "from", "ILF", "can", "be", "rendered", "by", "the", "end", "user", ".", "If", "not", "then", "they", "are", "discarded", "from", "the", "merge", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ILFBuilder.java#L169-L175
code4everything/util
src/main/java/com/zhazhapan/util/Utils.java
Utils.loadJsonToBean
public static <T> T loadJsonToBean(String jsonPath, Class<T> clazz) throws IOException { return loadJsonToBean(jsonPath, ValueConsts.NULL_STRING, clazz); }
java
public static <T> T loadJsonToBean(String jsonPath, Class<T> clazz) throws IOException { return loadJsonToBean(jsonPath, ValueConsts.NULL_STRING, clazz); }
[ "public", "static", "<", "T", ">", "T", "loadJsonToBean", "(", "String", "jsonPath", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "IOException", "{", "return", "loadJsonToBean", "(", "jsonPath", ",", "ValueConsts", ".", "NULL_STRING", ",", "clazz", ...
加载JSON配置文件,使用系统默认编码 @param jsonPath JSON文件路径 @param clazz 类 @param <T> 类型值 @return Bean @throws IOException 异常 @since 1.0.8
[ "加载JSON配置文件,使用系统默认编码" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Utils.java#L108-L110
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java
SpoilerElement.addSpoiler
public static void addSpoiler(Message message, String hint) { message.addExtension(new SpoilerElement(null, hint)); }
java
public static void addSpoiler(Message message, String hint) { message.addExtension(new SpoilerElement(null, hint)); }
[ "public", "static", "void", "addSpoiler", "(", "Message", "message", ",", "String", "hint", ")", "{", "message", ".", "addExtension", "(", "new", "SpoilerElement", "(", "null", ",", "hint", ")", ")", ";", "}" ]
Add a SpoilerElement with a hint to a message. @param message Message to add the Spoiler to. @param hint Hint about the Spoilers content.
[ "Add", "a", "SpoilerElement", "with", "a", "hint", "to", "a", "message", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java#L79-L81
nohana/Amalgam
amalgam/src/main/java/com/amalgam/content/ContentProviderUtils.java
ContentProviderUtils.notifyChange
public static void notifyChange(ContentProvider provider, Uri uri, ContentObserver observer) { notifyChange(provider.getContext(), uri, observer); }
java
public static void notifyChange(ContentProvider provider, Uri uri, ContentObserver observer) { notifyChange(provider.getContext(), uri, observer); }
[ "public", "static", "void", "notifyChange", "(", "ContentProvider", "provider", ",", "Uri", "uri", ",", "ContentObserver", "observer", ")", "{", "notifyChange", "(", "provider", ".", "getContext", "(", ")", ",", "uri", ",", "observer", ")", ";", "}" ]
Notify data-set change to the observer. @param provider the provider, must not be null. @param uri the changed uri. @param observer the observer, can be null.
[ "Notify", "data", "-", "set", "change", "to", "the", "observer", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContentProviderUtils.java#L57-L59
NICTA/t3as-snomedct-service
snomed-coder-ui-web/src/main/java/org/t3as/snomedct/gwt/client/gwt/AnalyseHandler.java
AnalyseHandler.sendTextToServer
private void sendTextToServer() { statusLabel.setText(""); conceptList.clear(); // don't do anything if we have no text final String text = mainTextArea.getText(); if (text.length() < 1) { statusLabel.setText(messages.pleaseEnterTextLabel()); return; } // disable interaction while we wait for the response glassPanel.setPositionAndShow(); // build up the AnalysisRequest JSON object // start with any options final JSONArray options = new JSONArray(); setSemanticTypesOption(types, options); // defaults options.set(options.size(), new JSONString("word_sense_disambiguation")); options.set(options.size(), new JSONString("composite_phrases 8")); options.set(options.size(), new JSONString("no_derivational_variants")); options.set(options.size(), new JSONString("strict_model")); options.set(options.size(), new JSONString("ignore_word_order")); options.set(options.size(), new JSONString("allow_large_n")); options.set(options.size(), new JSONString("restrict_to_sources SNOMEDCT_US")); final JSONObject analysisRequest = new JSONObject(); analysisRequest.put("text", new JSONString(text)); analysisRequest.put("options", options); // send the input to the server final RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, webserviceUrl); builder.setHeader("Content-Type", MediaType.APPLICATION_JSON); builder.setRequestData(analysisRequest.toString()); // create the async callback builder.setCallback(new SnomedRequestCallback(conceptList, statusLabel, glassPanel, typeCodeToDescription)); // send the request try { builder.send(); } catch (final RequestException e) { statusLabel.setText(messages.problemPerformingAnalysisLabel()); GWT.log("There was a problem performing the analysis: " + e.getMessage(), e); glassPanel.hide(); } }
java
private void sendTextToServer() { statusLabel.setText(""); conceptList.clear(); // don't do anything if we have no text final String text = mainTextArea.getText(); if (text.length() < 1) { statusLabel.setText(messages.pleaseEnterTextLabel()); return; } // disable interaction while we wait for the response glassPanel.setPositionAndShow(); // build up the AnalysisRequest JSON object // start with any options final JSONArray options = new JSONArray(); setSemanticTypesOption(types, options); // defaults options.set(options.size(), new JSONString("word_sense_disambiguation")); options.set(options.size(), new JSONString("composite_phrases 8")); options.set(options.size(), new JSONString("no_derivational_variants")); options.set(options.size(), new JSONString("strict_model")); options.set(options.size(), new JSONString("ignore_word_order")); options.set(options.size(), new JSONString("allow_large_n")); options.set(options.size(), new JSONString("restrict_to_sources SNOMEDCT_US")); final JSONObject analysisRequest = new JSONObject(); analysisRequest.put("text", new JSONString(text)); analysisRequest.put("options", options); // send the input to the server final RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, webserviceUrl); builder.setHeader("Content-Type", MediaType.APPLICATION_JSON); builder.setRequestData(analysisRequest.toString()); // create the async callback builder.setCallback(new SnomedRequestCallback(conceptList, statusLabel, glassPanel, typeCodeToDescription)); // send the request try { builder.send(); } catch (final RequestException e) { statusLabel.setText(messages.problemPerformingAnalysisLabel()); GWT.log("There was a problem performing the analysis: " + e.getMessage(), e); glassPanel.hide(); } }
[ "private", "void", "sendTextToServer", "(", ")", "{", "statusLabel", ".", "setText", "(", "\"\"", ")", ";", "conceptList", ".", "clear", "(", ")", ";", "// don't do anything if we have no text", "final", "String", "text", "=", "mainTextArea", ".", "getText", "("...
send the text from the mainTextArea to the server and accept an async response
[ "send", "the", "text", "from", "the", "mainTextArea", "to", "the", "server", "and", "accept", "an", "async", "response" ]
train
https://github.com/NICTA/t3as-snomedct-service/blob/70a82d5c889f97eef2d17a648970575c152983e9/snomed-coder-ui-web/src/main/java/org/t3as/snomedct/gwt/client/gwt/AnalyseHandler.java#L86-L132
zaproxy/zaproxy
src/org/parosproxy/paros/extension/filter/AllFilterTableEditor.java
AllFilterTableEditor.getTableCellEditorComponent
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int rowIndex, int vColIndex) { // 'value' is value contained in the cell located at (rowIndex, vColIndex) if (isSelected) { // cell (and perhaps other cells) are selected } // Configure the component with the specified value button.setText((String)value); row = rowIndex; // Return the configured component return button; }
java
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int rowIndex, int vColIndex) { // 'value' is value contained in the cell located at (rowIndex, vColIndex) if (isSelected) { // cell (and perhaps other cells) are selected } // Configure the component with the specified value button.setText((String)value); row = rowIndex; // Return the configured component return button; }
[ "@", "Override", "public", "Component", "getTableCellEditorComponent", "(", "JTable", "table", ",", "Object", "value", ",", "boolean", "isSelected", ",", "int", "rowIndex", ",", "int", "vColIndex", ")", "{", "// 'value' is value contained in the cell located at (rowIndex,...
This method is called when a cell value is edited by the user.
[ "This", "method", "is", "called", "when", "a", "cell", "value", "is", "edited", "by", "the", "user", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/extension/filter/AllFilterTableEditor.java#L66-L82