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
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.DD
public static HtmlTree DD(Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.DD, nullCheck(body)); return htmltree; }
java
public static HtmlTree DD(Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.DD, nullCheck(body)); return htmltree; }
[ "public", "static", "HtmlTree", "DD", "(", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "DD", ",", "nullCheck", "(", "body", ")", ")", ";", "return", "htmltree", ";", "}" ]
Generates a DD tag with some content. @param body content for the tag @return an HtmlTree object for the DD tag
[ "Generates", "a", "DD", "tag", "with", "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#L310-L313
rhuss/jolokia
agent/core/src/main/java/org/jolokia/handler/list/MBeanInfoData.java
MBeanInfoData.handleException
public void handleException(ObjectName pName, InstanceNotFoundException pExp) throws InstanceNotFoundException { // This happen happens for JBoss 7.1 in some cases (i.e. ResourceAdapterModule) if (pathStack.size() == 0) { addException(pName, pExp); } else { throw new InstanceNotFoundException("InstanceNotFoundException for MBean " + pName + " (" + pExp.getMessage() + ")"); } }
java
public void handleException(ObjectName pName, InstanceNotFoundException pExp) throws InstanceNotFoundException { // This happen happens for JBoss 7.1 in some cases (i.e. ResourceAdapterModule) if (pathStack.size() == 0) { addException(pName, pExp); } else { throw new InstanceNotFoundException("InstanceNotFoundException for MBean " + pName + " (" + pExp.getMessage() + ")"); } }
[ "public", "void", "handleException", "(", "ObjectName", "pName", ",", "InstanceNotFoundException", "pExp", ")", "throws", "InstanceNotFoundException", "{", "// This happen happens for JBoss 7.1 in some cases (i.e. ResourceAdapterModule)", "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 IllegalStateException if this method decides to rethrow the exception
[ "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#L238-L245
jenetics/jenetics
jenetics.tool/src/main/java/io/jenetics/tool/trial/TrialMeter.java
TrialMeter.sample
public void sample(final Function<T, double[]> function) { _params.values() .subSeq(_dataSet.nextParamIndex()) .forEach(p -> _dataSet.add(function.apply(p))); }
java
public void sample(final Function<T, double[]> function) { _params.values() .subSeq(_dataSet.nextParamIndex()) .forEach(p -> _dataSet.add(function.apply(p))); }
[ "public", "void", "sample", "(", "final", "Function", "<", "T", ",", "double", "[", "]", ">", "function", ")", "{", "_params", ".", "values", "(", ")", ".", "subSeq", "(", "_dataSet", ".", "nextParamIndex", "(", ")", ")", ".", "forEach", "(", "p", ...
Calculates the test values for all parameters. The length of the resulting {@code double[]} array must be {@link #dataSize()}. @param function the test function
[ "Calculates", "the", "test", "values", "for", "all", "parameters", ".", "The", "length", "of", "the", "resulting", "{", "@code", "double", "[]", "}", "array", "must", "be", "{", "@link", "#dataSize", "()", "}", "." ]
train
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.tool/src/main/java/io/jenetics/tool/trial/TrialMeter.java#L146-L150
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/metrics/Metrics.java
Metrics.forInstance
public static InstanceMetrics forInstance(MetricRegistry metrics, Object instance, String serviceName) { return new InstanceMetrics(metrics, instance, serviceName); }
java
public static InstanceMetrics forInstance(MetricRegistry metrics, Object instance, String serviceName) { return new InstanceMetrics(metrics, instance, serviceName); }
[ "public", "static", "InstanceMetrics", "forInstance", "(", "MetricRegistry", "metrics", ",", "Object", "instance", ",", "String", "serviceName", ")", "{", "return", "new", "InstanceMetrics", "(", "metrics", ",", "instance", ",", "serviceName", ")", ";", "}" ]
Create a metrics instance that corresponds to a single instance of a class. This is useful for cases where there exists one instance per service. For example in a ServicePool.
[ "Create", "a", "metrics", "instance", "that", "corresponds", "to", "a", "single", "instance", "of", "a", "class", ".", "This", "is", "useful", "for", "cases", "where", "there", "exists", "one", "instance", "per", "service", ".", "For", "example", "in", "a"...
train
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/metrics/Metrics.java#L39-L41
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java
AccountHeaderBuilder.onProfileImageClick
private void onProfileImageClick(View v, boolean current) { IProfile profile = (IProfile) v.getTag(R.id.material_drawer_profile_header); boolean consumed = false; if (mOnAccountHeaderProfileImageListener != null) { consumed = mOnAccountHeaderProfileImageListener.onProfileImageClick(v, profile, current); } //if the event was already consumed by the click don't continue. note that this will also stop the profile change event if (!consumed) { onProfileClick(v, current); } }
java
private void onProfileImageClick(View v, boolean current) { IProfile profile = (IProfile) v.getTag(R.id.material_drawer_profile_header); boolean consumed = false; if (mOnAccountHeaderProfileImageListener != null) { consumed = mOnAccountHeaderProfileImageListener.onProfileImageClick(v, profile, current); } //if the event was already consumed by the click don't continue. note that this will also stop the profile change event if (!consumed) { onProfileClick(v, current); } }
[ "private", "void", "onProfileImageClick", "(", "View", "v", ",", "boolean", "current", ")", "{", "IProfile", "profile", "=", "(", "IProfile", ")", "v", ".", "getTag", "(", "R", ".", "id", ".", "material_drawer_profile_header", ")", ";", "boolean", "consumed"...
calls the mOnAccountHEaderProfileImageListener and continues with the actions afterwards @param v @param current
[ "calls", "the", "mOnAccountHEaderProfileImageListener", "and", "continues", "with", "the", "actions", "afterwards" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java#L1217-L1229
KyoriPowered/lunar
src/main/java/net/kyori/lunar/EvenMoreObjects.java
EvenMoreObjects.make
public static <T> @NonNull T make(final @NonNull T value, final @NonNull Consumer<T> consumer) { consumer.accept(value); return value; }
java
public static <T> @NonNull T make(final @NonNull T value, final @NonNull Consumer<T> consumer) { consumer.accept(value); return value; }
[ "public", "static", "<", "T", ">", "@", "NonNull", "T", "make", "(", "final", "@", "NonNull", "T", "value", ",", "final", "@", "NonNull", "Consumer", "<", "T", ">", "consumer", ")", "{", "consumer", ".", "accept", "(", "value", ")", ";", "return", ...
Configures {@code value} using {@code consumer}. @param value the value @param consumer the consumer @param <T> the value type @return the value
[ "Configures", "{", "@code", "value", "}", "using", "{", "@code", "consumer", "}", "." ]
train
https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/EvenMoreObjects.java#L60-L63
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java
ExampleFitPolygon.fitCannyBinary
public static void fitCannyBinary( GrayF32 input ) { BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB); GrayU8 binary = new GrayU8(input.width,input.height); // Finds edges inside the image CannyEdge<GrayF32,GrayF32> canny = FactoryEdgeDetectors.canny(2, false, true, GrayF32.class, GrayF32.class); canny.process(input,0.1f,0.3f,binary); // Only external contours are relevant List<Contour> contours = BinaryImageOps.contourExternal(binary, ConnectRule.EIGHT); Graphics2D g2 = displayImage.createGraphics(); g2.setStroke(new BasicStroke(2)); // used to select colors for each line Random rand = new Random(234); for( Contour c : contours ) { List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(c.external,true, minSide,cornerPenalty); g2.setColor(new Color(rand.nextInt())); VisualizeShapes.drawPolygon(vertexes,true,g2); } gui.addImage(displayImage, "Canny Contour"); }
java
public static void fitCannyBinary( GrayF32 input ) { BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB); GrayU8 binary = new GrayU8(input.width,input.height); // Finds edges inside the image CannyEdge<GrayF32,GrayF32> canny = FactoryEdgeDetectors.canny(2, false, true, GrayF32.class, GrayF32.class); canny.process(input,0.1f,0.3f,binary); // Only external contours are relevant List<Contour> contours = BinaryImageOps.contourExternal(binary, ConnectRule.EIGHT); Graphics2D g2 = displayImage.createGraphics(); g2.setStroke(new BasicStroke(2)); // used to select colors for each line Random rand = new Random(234); for( Contour c : contours ) { List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(c.external,true, minSide,cornerPenalty); g2.setColor(new Color(rand.nextInt())); VisualizeShapes.drawPolygon(vertexes,true,g2); } gui.addImage(displayImage, "Canny Contour"); }
[ "public", "static", "void", "fitCannyBinary", "(", "GrayF32", "input", ")", "{", "BufferedImage", "displayImage", "=", "new", "BufferedImage", "(", "input", ".", "width", ",", "input", ".", "height", ",", "BufferedImage", ".", "TYPE_INT_RGB", ")", ";", "GrayU8...
Detects contours inside the binary image generated by canny. Only the external contour is relevant. Often easier to deal with than working with Canny edges directly.
[ "Detects", "contours", "inside", "the", "binary", "image", "generated", "by", "canny", ".", "Only", "the", "external", "contour", "is", "relevant", ".", "Often", "easier", "to", "deal", "with", "than", "working", "with", "Canny", "edges", "directly", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java#L146-L174
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.lastOrdinalIndexOf
public static int lastOrdinalIndexOf(final String str, final String substr, final int ordinal) { return ordinalIndexOf(str, substr, ordinal, true); }
java
public static int lastOrdinalIndexOf(final String str, final String substr, final int ordinal) { return ordinalIndexOf(str, substr, ordinal, true); }
[ "public", "static", "int", "lastOrdinalIndexOf", "(", "final", "String", "str", ",", "final", "String", "substr", ",", "final", "int", "ordinal", ")", "{", "return", "ordinalIndexOf", "(", "str", ",", "substr", ",", "ordinal", ",", "true", ")", ";", "}" ]
<p> Finds the n-th last index within a String, handling {@code null}. </p> @param str @param substr @param ordinal the n-th last {@code searchStr} to find @return the n-th last index of the search CharSequence, {@code -1} ( {@code N.INDEX_NOT_FOUND}) if no match or {@code null} or empty string input
[ "<p", ">", "Finds", "the", "n", "-", "th", "last", "index", "within", "a", "String", "handling", "{", "@code", "null", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L3830-L3832
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java
CollectionDescriptorConstraints.checkQueryCustomizer
private void checkQueryCustomizer(CollectionDescriptorDef collDef, String checkLevel) throws ConstraintException { if (!CHECKLEVEL_STRICT.equals(checkLevel)) { return; } String queryCustomizerName = collDef.getProperty(PropertyHelper.OJB_PROPERTY_QUERY_CUSTOMIZER); if (queryCustomizerName == null) { return; } try { InheritanceHelper helper = new InheritanceHelper(); if (!helper.isSameOrSubTypeOf(queryCustomizerName, QUERY_CUSTOMIZER_INTERFACE)) { throw new ConstraintException("The class "+queryCustomizerName+" specified as query-customizer of collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" does not implement the interface "+QUERY_CUSTOMIZER_INTERFACE); } } catch (ClassNotFoundException ex) { throw new ConstraintException("The class "+ex.getMessage()+" specified as query-customizer of collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" was not found on the classpath"); } }
java
private void checkQueryCustomizer(CollectionDescriptorDef collDef, String checkLevel) throws ConstraintException { if (!CHECKLEVEL_STRICT.equals(checkLevel)) { return; } String queryCustomizerName = collDef.getProperty(PropertyHelper.OJB_PROPERTY_QUERY_CUSTOMIZER); if (queryCustomizerName == null) { return; } try { InheritanceHelper helper = new InheritanceHelper(); if (!helper.isSameOrSubTypeOf(queryCustomizerName, QUERY_CUSTOMIZER_INTERFACE)) { throw new ConstraintException("The class "+queryCustomizerName+" specified as query-customizer of collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" does not implement the interface "+QUERY_CUSTOMIZER_INTERFACE); } } catch (ClassNotFoundException ex) { throw new ConstraintException("The class "+ex.getMessage()+" specified as query-customizer of collection "+collDef.getName()+" in class "+collDef.getOwner().getName()+" was not found on the classpath"); } }
[ "private", "void", "checkQueryCustomizer", "(", "CollectionDescriptorDef", "collDef", ",", "String", "checkLevel", ")", "throws", "ConstraintException", "{", "if", "(", "!", "CHECKLEVEL_STRICT", ".", "equals", "(", "checkLevel", ")", ")", "{", "return", ";", "}", ...
Checks the query-customizer setting of the given collection descriptor. @param collDef The collection descriptor @param checkLevel The current check level (this constraint is only checked in strict) @exception ConstraintException If the constraint has been violated
[ "Checks", "the", "query", "-", "customizer", "setting", "of", "the", "given", "collection", "descriptor", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java#L284-L311
spring-projects/spring-social
spring-social-web/src/main/java/org/springframework/social/connect/web/ReconnectFilter.java
ReconnectFilter.getRefreshUrl
protected String getRefreshUrl(HttpServletRequest request, ApiException apiException) { String scopeNeeded = getRequiredScope(apiException); StringBuilder sb = new StringBuilder(request.getContextPath() + CONNECT_PATH + apiException.getProviderId()) .append(RECONNECT_PARAMETER_EQUALS_TRUE); if (scopeNeeded != null) { sb.append(SCOPE_PARAMETER_EQUALS + scopeNeeded); } return sb.toString(); }
java
protected String getRefreshUrl(HttpServletRequest request, ApiException apiException) { String scopeNeeded = getRequiredScope(apiException); StringBuilder sb = new StringBuilder(request.getContextPath() + CONNECT_PATH + apiException.getProviderId()) .append(RECONNECT_PARAMETER_EQUALS_TRUE); if (scopeNeeded != null) { sb.append(SCOPE_PARAMETER_EQUALS + scopeNeeded); } return sb.toString(); }
[ "protected", "String", "getRefreshUrl", "(", "HttpServletRequest", "request", ",", "ApiException", "apiException", ")", "{", "String", "scopeNeeded", "=", "getRequiredScope", "(", "apiException", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "re...
Returns the URL to redirect to if it is determined that a connection needs to be renewed. By default, the filter will redirect to /connect/{provider ID} with a "reconnect" query parameter. This filter also handles GET requests to that same path before submitting a POST request to {@link ConnectController} for authorization. May be overridden by a subclass to handle other flows, such as redirecting to a page that informs the user that a new connection is needed. @param request The HTTP request that triggered the exception. @param apiException The {@link ApiException}. @return the URL to redirect to if a connection needs to be renewed.
[ "Returns", "the", "URL", "to", "redirect", "to", "if", "it", "is", "determined", "that", "a", "connection", "needs", "to", "be", "renewed", ".", "By", "default", "the", "filter", "will", "redirect", "to", "/", "connect", "/", "{", "provider", "ID", "}", ...
train
https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-web/src/main/java/org/springframework/social/connect/web/ReconnectFilter.java#L121-L129
michael-rapp/AndroidUtil
example/src/main/java/de/mrapp/android/util/example/MainActivity.java
MainActivity.adaptElevation
private void adaptElevation(final int elevation, final boolean parallelLight) { elevationTextView.setText(String.format(getString(R.string.elevation), elevation)); elevationLeft.setShadowElevation(elevation); elevationLeft.emulateParallelLight(parallelLight); elevationTopLeft.setShadowElevation(elevation); elevationTopLeft.emulateParallelLight(parallelLight); elevationTop.setShadowElevation(elevation); elevationTop.emulateParallelLight(parallelLight); elevationTopRight.setShadowElevation(elevation); elevationTopRight.emulateParallelLight(parallelLight); elevationRight.setShadowElevation(elevation); elevationRight.emulateParallelLight(parallelLight); elevationBottomRight.setShadowElevation(elevation); elevationBottomRight.emulateParallelLight(parallelLight); elevationBottom.setShadowElevation(elevation); elevationBottom.emulateParallelLight(parallelLight); elevationBottomLeft.setShadowElevation(elevation); elevationBottomLeft.emulateParallelLight(parallelLight); }
java
private void adaptElevation(final int elevation, final boolean parallelLight) { elevationTextView.setText(String.format(getString(R.string.elevation), elevation)); elevationLeft.setShadowElevation(elevation); elevationLeft.emulateParallelLight(parallelLight); elevationTopLeft.setShadowElevation(elevation); elevationTopLeft.emulateParallelLight(parallelLight); elevationTop.setShadowElevation(elevation); elevationTop.emulateParallelLight(parallelLight); elevationTopRight.setShadowElevation(elevation); elevationTopRight.emulateParallelLight(parallelLight); elevationRight.setShadowElevation(elevation); elevationRight.emulateParallelLight(parallelLight); elevationBottomRight.setShadowElevation(elevation); elevationBottomRight.emulateParallelLight(parallelLight); elevationBottom.setShadowElevation(elevation); elevationBottom.emulateParallelLight(parallelLight); elevationBottomLeft.setShadowElevation(elevation); elevationBottomLeft.emulateParallelLight(parallelLight); }
[ "private", "void", "adaptElevation", "(", "final", "int", "elevation", ",", "final", "boolean", "parallelLight", ")", "{", "elevationTextView", ".", "setText", "(", "String", ".", "format", "(", "getString", "(", "R", ".", "string", ".", "elevation", ")", ",...
Adapts the elevation. @param elevation The elevation, which should be set, in dp as an {@link Integer} value @param parallelLight True, if parallel light should be emulated, false otherwise
[ "Adapts", "the", "elevation", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/example/src/main/java/de/mrapp/android/util/example/MainActivity.java#L163-L181
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/simple/SGraphSegment.java
SGraphSegment.setUserDataAt
public void setUserDataAt(int index, Object data) { if (this.userData == null) { throw new IndexOutOfBoundsException(); } this.userData.set(index, data); }
java
public void setUserDataAt(int index, Object data) { if (this.userData == null) { throw new IndexOutOfBoundsException(); } this.userData.set(index, data); }
[ "public", "void", "setUserDataAt", "(", "int", "index", ",", "Object", "data", ")", "{", "if", "(", "this", ".", "userData", "==", "null", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "this", ".", "userData", ".", "set", "...
Set the user data at the given index. @param index is the index of the data. @param data is the data
[ "Set", "the", "user", "data", "at", "the", "given", "index", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/simple/SGraphSegment.java#L288-L293
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMRandom.java
JMRandom.buildRandomIntStream
public static IntStream buildRandomIntStream(int streamSize, int inclusiveLowerBound, int exclusiveUpperBound) { return buildRandomIntStream(streamSize, new Random(), inclusiveLowerBound, exclusiveUpperBound); }
java
public static IntStream buildRandomIntStream(int streamSize, int inclusiveLowerBound, int exclusiveUpperBound) { return buildRandomIntStream(streamSize, new Random(), inclusiveLowerBound, exclusiveUpperBound); }
[ "public", "static", "IntStream", "buildRandomIntStream", "(", "int", "streamSize", ",", "int", "inclusiveLowerBound", ",", "int", "exclusiveUpperBound", ")", "{", "return", "buildRandomIntStream", "(", "streamSize", ",", "new", "Random", "(", ")", ",", "inclusiveLow...
Build random int stream int stream. @param streamSize the stream size @param inclusiveLowerBound the inclusive lower bound @param exclusiveUpperBound the exclusive upper bound @return the int stream
[ "Build", "random", "int", "stream", "int", "stream", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMRandom.java#L62-L66
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftDataResultHelper.java
ThriftDataResultHelper.transformThriftResult
public static <T> T transformThriftResult(ColumnOrSuperColumn cosc, ColumnFamilyType columnFamilyType, ThriftRow row) { Object output = null; if (cosc != null) { switch (columnFamilyType) { case COLUMN: output = cosc.column; if (row != null) { row.addColumn(cosc.column); } break; case SUPER_COLUMN: output = cosc.super_column; if (row != null) { row.addSuperColumn(cosc.super_column); } break; case COUNTER_COLUMN: output = cosc.counter_column; if (row != null) { row.addCounterColumn(cosc.counter_column); } break; case COUNTER_SUPER_COLUMN: output = cosc.counter_super_column; if (row != null) { row.addCounterSuperColumn(cosc.counter_super_column); } break; } } return (T) output; }
java
public static <T> T transformThriftResult(ColumnOrSuperColumn cosc, ColumnFamilyType columnFamilyType, ThriftRow row) { Object output = null; if (cosc != null) { switch (columnFamilyType) { case COLUMN: output = cosc.column; if (row != null) { row.addColumn(cosc.column); } break; case SUPER_COLUMN: output = cosc.super_column; if (row != null) { row.addSuperColumn(cosc.super_column); } break; case COUNTER_COLUMN: output = cosc.counter_column; if (row != null) { row.addCounterColumn(cosc.counter_column); } break; case COUNTER_SUPER_COLUMN: output = cosc.counter_super_column; if (row != null) { row.addCounterSuperColumn(cosc.counter_super_column); } break; } } return (T) output; }
[ "public", "static", "<", "T", ">", "T", "transformThriftResult", "(", "ColumnOrSuperColumn", "cosc", ",", "ColumnFamilyType", "columnFamilyType", ",", "ThriftRow", "row", ")", "{", "Object", "output", "=", "null", ";", "if", "(", "cosc", "!=", "null", ")", "...
Transform thrift result. @param <T> the generic type @param cosc the cosc @param columnFamilyType the column family type @param row the row @return the t
[ "Transform", "thrift", "result", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftDataResultHelper.java#L90-L131
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java
TraceNLS.getFormattedMessageFromLocalizedMessage
public static String getFormattedMessageFromLocalizedMessage(String localizedMessage, Object[] args, boolean quiet) { return TraceNLSResolver.getInstance().getFormattedMessage(localizedMessage, args); }
java
public static String getFormattedMessageFromLocalizedMessage(String localizedMessage, Object[] args, boolean quiet) { return TraceNLSResolver.getInstance().getFormattedMessage(localizedMessage, args); }
[ "public", "static", "String", "getFormattedMessageFromLocalizedMessage", "(", "String", "localizedMessage", ",", "Object", "[", "]", "args", ",", "boolean", "quiet", ")", "{", "return", "TraceNLSResolver", ".", "getInstance", "(", ")", ".", "getFormattedMessage", "(...
Return the formatted message obtained by substituting parameters passed into a message @param localizedMessage the message into which parameters will be substituted @param args the arguments that will be substituted into the message @param quiet indicates whether or not errors will be logged when encountered @return String a message with parameters substituted in as appropriate
[ "Return", "the", "formatted", "message", "obtained", "by", "substituting", "parameters", "passed", "into", "a", "message" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java#L681-L683
yanzhenjie/AndPermission
support/src/main/java/com/yanzhenjie/permission/AndPermission.java
AndPermission.getFileUri
public static Uri getFileUri(Activity activity, File file) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return FileProvider.getUriForFile(activity, activity.getPackageName() + ".file.path.share", file); } return Uri.fromFile(file); }
java
public static Uri getFileUri(Activity activity, File file) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return FileProvider.getUriForFile(activity, activity.getPackageName() + ".file.path.share", file); } return Uri.fromFile(file); }
[ "public", "static", "Uri", "getFileUri", "(", "Activity", "activity", ",", "File", "file", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "N", ")", "{", "return", "FileProvider", ".", "getUriForFile"...
Get compatible Android 7.0 and lower versions of Uri. @param activity {@link Activity}. @param file apk file. @return uri.
[ "Get", "compatible", "Android", "7", ".", "0", "and", "lower", "versions", "of", "Uri", "." ]
train
https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/AndPermission.java#L362-L367
fozziethebeat/S-Space
opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java
LatentRelationalAnalysis.computeSVD
public Matrix computeSVD(Matrix sparse_matrix, int dimensions) { try { File rawTermDocMatrix = File.createTempFile("lra-term-document-matrix", ".dat"); MatrixIO.writeMatrix(sparse_matrix, rawTermDocMatrix, MatrixIO.Format.SVDLIBC_SPARSE_TEXT); MatrixFile mFile = new MatrixFile( rawTermDocMatrix, MatrixIO.Format.SVDLIBC_SPARSE_TEXT); reducer.factorize(mFile, dimensions); return reducer.dataClasses(); } catch (IOException ioe){ throw new IOError(ioe); } }
java
public Matrix computeSVD(Matrix sparse_matrix, int dimensions) { try { File rawTermDocMatrix = File.createTempFile("lra-term-document-matrix", ".dat"); MatrixIO.writeMatrix(sparse_matrix, rawTermDocMatrix, MatrixIO.Format.SVDLIBC_SPARSE_TEXT); MatrixFile mFile = new MatrixFile( rawTermDocMatrix, MatrixIO.Format.SVDLIBC_SPARSE_TEXT); reducer.factorize(mFile, dimensions); return reducer.dataClasses(); } catch (IOException ioe){ throw new IOError(ioe); } }
[ "public", "Matrix", "computeSVD", "(", "Matrix", "sparse_matrix", ",", "int", "dimensions", ")", "{", "try", "{", "File", "rawTermDocMatrix", "=", "File", ".", "createTempFile", "(", "\"lra-term-document-matrix\"", ",", "\".dat\"", ")", ";", "MatrixIO", ".", "wr...
Does the Singular Value Decomposition using the generated sparse matrix. The dimensions used cannot exceed the number of columns in the original matrix. @param sparse_matrix the sparse {@code Matrix} @param dimensions the number of singular values to calculate @return The decomposed word space {@link Matrix}
[ "Does", "the", "Singular", "Value", "Decomposition", "using", "the", "generated", "sparse", "matrix", ".", "The", "dimensions", "used", "cannot", "exceed", "the", "number", "of", "columns", "in", "the", "original", "matrix", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java#L914-L927
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterClient.java
RouterClient.insertRouter
@BetaApi public final Operation insertRouter(String region, Router routerResource) { InsertRouterHttpRequest request = InsertRouterHttpRequest.newBuilder() .setRegion(region) .setRouterResource(routerResource) .build(); return insertRouter(request); }
java
@BetaApi public final Operation insertRouter(String region, Router routerResource) { InsertRouterHttpRequest request = InsertRouterHttpRequest.newBuilder() .setRegion(region) .setRouterResource(routerResource) .build(); return insertRouter(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertRouter", "(", "String", "region", ",", "Router", "routerResource", ")", "{", "InsertRouterHttpRequest", "request", "=", "InsertRouterHttpRequest", ".", "newBuilder", "(", ")", ".", "setRegion", "(", "region", ...
Creates a Router resource in the specified project and region using the data included in the request. <p>Sample code: <pre><code> try (RouterClient routerClient = RouterClient.create()) { ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); Router routerResource = Router.newBuilder().build(); Operation response = routerClient.insertRouter(region.toString(), routerResource); } </code></pre> @param region Name of the region for this request. @param routerResource Router resource. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "Router", "resource", "in", "the", "specified", "project", "and", "region", "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/RouterClient.java#L777-L786
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java
HadoopUtils.getOptionallyThrottledFileSystem
public static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, int qpsLimit) throws IOException { if (fs instanceof Decorator) { for (Object obj : DecoratorUtils.getDecoratorLineage(fs)) { if (obj instanceof RateControlledFileSystem) { // Already rate controlled return fs; } } } if (qpsLimit > 0) { try { RateControlledFileSystem newFS = new RateControlledFileSystem(fs, qpsLimit); newFS.startRateControl(); return newFS; } catch (ExecutionException ee) { throw new IOException("Could not create throttled FileSystem.", ee); } } return fs; }
java
public static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, int qpsLimit) throws IOException { if (fs instanceof Decorator) { for (Object obj : DecoratorUtils.getDecoratorLineage(fs)) { if (obj instanceof RateControlledFileSystem) { // Already rate controlled return fs; } } } if (qpsLimit > 0) { try { RateControlledFileSystem newFS = new RateControlledFileSystem(fs, qpsLimit); newFS.startRateControl(); return newFS; } catch (ExecutionException ee) { throw new IOException("Could not create throttled FileSystem.", ee); } } return fs; }
[ "public", "static", "FileSystem", "getOptionallyThrottledFileSystem", "(", "FileSystem", "fs", ",", "int", "qpsLimit", ")", "throws", "IOException", "{", "if", "(", "fs", "instanceof", "Decorator", ")", "{", "for", "(", "Object", "obj", ":", "DecoratorUtils", "....
Get a throttled {@link FileSystem} that limits the number of queries per second to a {@link FileSystem}. If the input qps is <= 0, no such throttling will be performed. @throws IOException
[ "Get", "a", "throttled", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L558-L578
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java
FeatureUtil.toOutcomeMatrix
public static INDArray toOutcomeMatrix(int[] index, long numOutcomes) { INDArray ret = Nd4j.create(index.length, numOutcomes); for (int i = 0; i < ret.rows(); i++) { int[] nums = new int[(int) numOutcomes]; nums[index[i]] = 1; ret.putRow(i, NDArrayUtil.toNDArray(nums)); } return ret; }
java
public static INDArray toOutcomeMatrix(int[] index, long numOutcomes) { INDArray ret = Nd4j.create(index.length, numOutcomes); for (int i = 0; i < ret.rows(); i++) { int[] nums = new int[(int) numOutcomes]; nums[index[i]] = 1; ret.putRow(i, NDArrayUtil.toNDArray(nums)); } return ret; }
[ "public", "static", "INDArray", "toOutcomeMatrix", "(", "int", "[", "]", "index", ",", "long", "numOutcomes", ")", "{", "INDArray", "ret", "=", "Nd4j", ".", "create", "(", "index", ".", "length", ",", "numOutcomes", ")", ";", "for", "(", "int", "i", "=...
Creates an out come vector from the specified inputs @param index the index of the label @param numOutcomes the number of possible outcomes @return a binary label matrix used for supervised learning
[ "Creates", "an", "out", "come", "vector", "from", "the", "specified", "inputs" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java#L51-L60
asterisk-java/asterisk-java
src/main/java/org/asteriskjava/config/dialplan/ExtensionsConfigFileReader.java
ExtensionsConfigFileReader.processTextLine
@Override protected ConfigElement processTextLine(String configfile, int lineno, String line) throws ConfigParseException { ConfigElement configElement; if ((line.trim().startsWith("exten") || line.trim().startsWith("include")) && currentCategory != null && (currentCategory.getName().equals("general") || currentCategory.getName().equals("globals"))) throw new ConfigParseException(configfile, lineno, "cannot have 'exten' or 'include' in global or general sections"); /* * Goal here is to break out anything unique that we might want to look * at and parse separately. For now, only exten and include fit that * criteria. Eventually, I could see parsing sections for things from * macros, contexts to differentiate them from categories, switch for * realtime, and more. */ if (line.trim().startsWith("exten")) { configElement = parseExtension(configfile, lineno, line); currentCategory.addElement(configElement); return configElement; } else if (line.trim().startsWith("include")) { // use parseVariable since we have access to it ConfigVariable configvar = parseVariable(configfile, lineno, line); configElement = new ConfigInclude(configfile, lineno, configvar.getValue()); currentCategory.addElement(configElement); return configElement; } // leave everything else the same configElement = super.processTextLine(configfile, lineno, line); return configElement; }
java
@Override protected ConfigElement processTextLine(String configfile, int lineno, String line) throws ConfigParseException { ConfigElement configElement; if ((line.trim().startsWith("exten") || line.trim().startsWith("include")) && currentCategory != null && (currentCategory.getName().equals("general") || currentCategory.getName().equals("globals"))) throw new ConfigParseException(configfile, lineno, "cannot have 'exten' or 'include' in global or general sections"); /* * Goal here is to break out anything unique that we might want to look * at and parse separately. For now, only exten and include fit that * criteria. Eventually, I could see parsing sections for things from * macros, contexts to differentiate them from categories, switch for * realtime, and more. */ if (line.trim().startsWith("exten")) { configElement = parseExtension(configfile, lineno, line); currentCategory.addElement(configElement); return configElement; } else if (line.trim().startsWith("include")) { // use parseVariable since we have access to it ConfigVariable configvar = parseVariable(configfile, lineno, line); configElement = new ConfigInclude(configfile, lineno, configvar.getValue()); currentCategory.addElement(configElement); return configElement; } // leave everything else the same configElement = super.processTextLine(configfile, lineno, line); return configElement; }
[ "@", "Override", "protected", "ConfigElement", "processTextLine", "(", "String", "configfile", ",", "int", "lineno", ",", "String", "line", ")", "throws", "ConfigParseException", "{", "ConfigElement", "configElement", ";", "if", "(", "(", "line", ".", "trim", "(...
/* This method corresponds to an iteration of the loop at line 2212 Notes: 1. [general] and [globals] are allowed to be a context here if they contain only configvariables 2. switch and ignorepat are treated like regular ConfigVariable.
[ "/", "*", "This", "method", "corresponds", "to", "an", "iteration", "of", "the", "loop", "at", "line", "2212", "Notes", ":", "1", ".", "[", "general", "]", "and", "[", "globals", "]", "are", "allowed", "to", "be", "a", "context", "here", "if", "they"...
train
https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/config/dialplan/ExtensionsConfigFileReader.java#L23-L59
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/ExpressionSourceAppender.java
ExpressionSourceAppender.eInit
public void eInit(EObject context, Procedure1<? super XExpression> setter, IJvmTypeProvider typeContext) { this.builder.eInit(context, setter, typeContext); }
java
public void eInit(EObject context, Procedure1<? super XExpression> setter, IJvmTypeProvider typeContext) { this.builder.eInit(context, setter, typeContext); }
[ "public", "void", "eInit", "(", "EObject", "context", ",", "Procedure1", "<", "?", "super", "XExpression", ">", "setter", ",", "IJvmTypeProvider", "typeContext", ")", "{", "this", ".", "builder", ".", "eInit", "(", "context", ",", "setter", ",", "typeContext...
Initialize the expression. @param context the context of the expressions. @param setter the object that permits to assign the expression to the context.
[ "Initialize", "the", "expression", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/ExpressionSourceAppender.java#L79-L81
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java
FileSystem.unzipFile
public static void unzipFile(File input, File output) throws IOException { try (FileInputStream fis = new FileInputStream(input)) { unzipFile(fis, output); } }
java
public static void unzipFile(File input, File output) throws IOException { try (FileInputStream fis = new FileInputStream(input)) { unzipFile(fis, output); } }
[ "public", "static", "void", "unzipFile", "(", "File", "input", ",", "File", "output", ")", "throws", "IOException", "{", "try", "(", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "input", ")", ")", "{", "unzipFile", "(", "fis", ",", "output...
Unzip a file into the output directory. @param input the ZIP file to uncompress. @param output the uncompressed file to create. @throws IOException when uncompressing is failing. @since 6.2
[ "Unzip", "a", "file", "into", "the", "output", "directory", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L3041-L3045
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/common/ProjectNodeSupport.java
ProjectNodeSupport.createCachingSource
private ResourceModelSource createCachingSource( ResourceModelSource origin, String ident, String descr ) { return createCachingSource(origin, ident, descr, SourceFactory.CacheType.BOTH, true); }
java
private ResourceModelSource createCachingSource( ResourceModelSource origin, String ident, String descr ) { return createCachingSource(origin, ident, descr, SourceFactory.CacheType.BOTH, true); }
[ "private", "ResourceModelSource", "createCachingSource", "(", "ResourceModelSource", "origin", ",", "String", "ident", ",", "String", "descr", ")", "{", "return", "createCachingSource", "(", "origin", ",", "ident", ",", "descr", ",", "SourceFactory", ".", "CacheType...
@param origin origin source @param ident unique identity for this cached source, used in filename @param descr description of the source, used in logging @return new source
[ "@param", "origin", "origin", "source", "@param", "ident", "unique", "identity", "for", "this", "cached", "source", "used", "in", "filename", "@param", "descr", "description", "of", "the", "source", "used", "in", "logging" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/ProjectNodeSupport.java#L367-L374
JodaOrg/joda-time
src/main/java/org/joda/time/LocalDateTime.java
LocalDateTime.toDate
@SuppressWarnings("deprecation") public Date toDate() { int dom = getDayOfMonth(); Date date = new Date(getYear() - 1900, getMonthOfYear() - 1, dom, getHourOfDay(), getMinuteOfHour(), getSecondOfMinute()); date.setTime(date.getTime() + getMillisOfSecond()); return correctDstTransition(date, TimeZone.getDefault()); }
java
@SuppressWarnings("deprecation") public Date toDate() { int dom = getDayOfMonth(); Date date = new Date(getYear() - 1900, getMonthOfYear() - 1, dom, getHourOfDay(), getMinuteOfHour(), getSecondOfMinute()); date.setTime(date.getTime() + getMillisOfSecond()); return correctDstTransition(date, TimeZone.getDefault()); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "Date", "toDate", "(", ")", "{", "int", "dom", "=", "getDayOfMonth", "(", ")", ";", "Date", "date", "=", "new", "Date", "(", "getYear", "(", ")", "-", "1900", ",", "getMonthOfYear", "(", "...
Get the date time as a <code>java.util.Date</code>. <p> The <code>Date</code> object created has exactly the same fields as this date-time, except when the time would be invalid due to a daylight savings gap. In that case, the time will be set to the earliest valid time after the gap. <p> In the case of a daylight savings overlap, the earlier instant is selected. <p> Converting to a JDK Date is full of complications as the JDK Date constructor doesn't behave as you might expect around DST transitions. This method works by taking a first guess and then adjusting. This also handles the situation where the JDK time zone data differs from the Joda-Time time zone data. @return a Date initialised with this date-time, never null @since 2.0
[ "Get", "the", "date", "time", "as", "a", "<code", ">", "java", ".", "util", ".", "Date<", "/", "code", ">", ".", "<p", ">", "The", "<code", ">", "Date<", "/", "code", ">", "object", "created", "has", "exactly", "the", "same", "fields", "as", "this"...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDateTime.java#L793-L800
Whiley/WhileyCompiler
src/main/java/wyil/util/AbstractTypedVisitor.java
AbstractTypedVisitor.asType
public <T extends Type> T asType(Type type, Class<T> kind) { if (kind.isInstance(type)) { return (T) type; } else if (type instanceof Type.Nominal) { Type.Nominal t = (Type.Nominal) type; Decl.Type decl = t.getLink().getTarget(); return asType(decl.getType(), kind); } else { throw new IllegalArgumentException("invalid type: " + type); } }
java
public <T extends Type> T asType(Type type, Class<T> kind) { if (kind.isInstance(type)) { return (T) type; } else if (type instanceof Type.Nominal) { Type.Nominal t = (Type.Nominal) type; Decl.Type decl = t.getLink().getTarget(); return asType(decl.getType(), kind); } else { throw new IllegalArgumentException("invalid type: " + type); } }
[ "public", "<", "T", "extends", "Type", ">", "T", "asType", "(", "Type", "type", ",", "Class", "<", "T", ">", "kind", ")", "{", "if", "(", "kind", ".", "isInstance", "(", "type", ")", ")", "{", "return", "(", "T", ")", "type", ";", "}", "else", ...
Unwrap a given type to reveal its underlying kind. For example, the type <code>int</code> can be unwrapped only to <code>int</code>. A more complex example: <pre> type nat is (int x) where x >= 0 </pre> The type <code>nat</code> can be unwrapped to an <code>int</code>. In general, the unwrapping process expands all nominal types until an atom is encountered. @param type @param kind @return
[ "Unwrap", "a", "given", "type", "to", "reveal", "its", "underlying", "kind", ".", "For", "example", "the", "type", "<code", ">", "int<", "/", "code", ">", "can", "be", "unwrapped", "only", "to", "<code", ">", "int<", "/", "code", ">", ".", "A", "more...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/util/AbstractTypedVisitor.java#L1326-L1336
lightblue-platform/lightblue-client
core/src/main/java/com/redhat/lightblue/client/Query.java
Query.logical
public static Query logical(LogOp op, Query... expressions) { return logical(op, Arrays.asList(expressions)); }
java
public static Query logical(LogOp op, Query... expressions) { return logical(op, Arrays.asList(expressions)); }
[ "public", "static", "Query", "logical", "(", "LogOp", "op", ",", "Query", "...", "expressions", ")", "{", "return", "logical", "(", "op", ",", "Arrays", ".", "asList", "(", "expressions", ")", ")", ";", "}" ]
<pre> { $and : [ expressions ] } { $or : [ expressions ] } </pre>
[ "<pre", ">", "{", "$and", ":", "[", "expressions", "]", "}", "{", "$or", ":", "[", "expressions", "]", "}", "<", "/", "pre", ">" ]
train
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/Query.java#L538-L540
spring-projects/spring-hateoas
src/main/java/org/springframework/hateoas/RepresentationModel.java
RepresentationModel.getRequiredLink
public Link getRequiredLink(String relation) { return getLink(relation) // .orElseThrow(() -> new IllegalArgumentException(String.format("No link with rel %s found!", relation))); }
java
public Link getRequiredLink(String relation) { return getLink(relation) // .orElseThrow(() -> new IllegalArgumentException(String.format("No link with rel %s found!", relation))); }
[ "public", "Link", "getRequiredLink", "(", "String", "relation", ")", "{", "return", "getLink", "(", "relation", ")", "//", ".", "orElseThrow", "(", "(", ")", "->", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"No link with rel %s found...
Returns the link with the given relation. @param relation must not be {@literal null} or empty. @return the link with the given relation. @throws IllegalArgumentException in case no link with the given relation can be found.
[ "Returns", "the", "link", "with", "the", "given", "relation", "." ]
train
https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/RepresentationModel.java#L179-L183
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractFormBuilder.java
AbstractFormBuilder.createSelector
protected JComponent createSelector(String fieldName, Constraint filter) { Map context = new HashMap(); context.put(ComboBoxBinder.FILTER_KEY, filter); return getBindingFactory().createBinding(JComboBox.class, fieldName).getControl(); }
java
protected JComponent createSelector(String fieldName, Constraint filter) { Map context = new HashMap(); context.put(ComboBoxBinder.FILTER_KEY, filter); return getBindingFactory().createBinding(JComboBox.class, fieldName).getControl(); }
[ "protected", "JComponent", "createSelector", "(", "String", "fieldName", ",", "Constraint", "filter", ")", "{", "Map", "context", "=", "new", "HashMap", "(", ")", ";", "context", ".", "put", "(", "ComboBoxBinder", ".", "FILTER_KEY", ",", "filter", ")", ";", ...
Creates a component which is used as a selector in the form. This implementation creates a {@link JComboBox} @param fieldName the name of the field for the selector @param filter an optional filter constraint @return the component to use for a selector, not null
[ "Creates", "a", "component", "which", "is", "used", "as", "a", "selector", "in", "the", "form", ".", "This", "implementation", "creates", "a", "{", "@link", "JComboBox", "}" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractFormBuilder.java#L139-L143
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/core/internal/ResponseImpl.java
ResponseImpl.getResponseText
public String getResponseText() { if (this.bodyBytes == null) { return ""; } Charset charset = contentType != null ? contentType.charset(UTF_8) : UTF_8; try { return new String(this.bodyBytes, charset.name()); } catch (UnsupportedEncodingException e) { logger.warn("Failed to extract text from response body. Error: " + e.getMessage()); return null; } }
java
public String getResponseText() { if (this.bodyBytes == null) { return ""; } Charset charset = contentType != null ? contentType.charset(UTF_8) : UTF_8; try { return new String(this.bodyBytes, charset.name()); } catch (UnsupportedEncodingException e) { logger.warn("Failed to extract text from response body. Error: " + e.getMessage()); return null; } }
[ "public", "String", "getResponseText", "(", ")", "{", "if", "(", "this", ".", "bodyBytes", "==", "null", ")", "{", "return", "\"\"", ";", "}", "Charset", "charset", "=", "contentType", "!=", "null", "?", "contentType", ".", "charset", "(", "UTF_8", ")", ...
This method parses the response body as a String. If this method is called, then subsequent calls to {@link #getResponseByteStream()} or {@link #getResponseBytes()} will return null unless the {@link Request} was made using a <code>download()</code> method. @return The body of the response as a String. Empty string if there is no body.
[ "This", "method", "parses", "the", "response", "body", "as", "a", "String", ".", "If", "this", "method", "is", "called", "then", "subsequent", "calls", "to", "{", "@link", "#getResponseByteStream", "()", "}", "or", "{", "@link", "#getResponseBytes", "()", "}...
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/core/internal/ResponseImpl.java#L115-L127
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/StringUtils.java
StringUtils.newString
public static String newString(byte[] bytes, String charsetName) { if (bytes == null) { return null; } try { return new String(bytes, charsetName); } catch (UnsupportedEncodingException e) { throw StringUtils.newIllegalStateException(charsetName, e); } }
java
public static String newString(byte[] bytes, String charsetName) { if (bytes == null) { return null; } try { return new String(bytes, charsetName); } catch (UnsupportedEncodingException e) { throw StringUtils.newIllegalStateException(charsetName, e); } }
[ "public", "static", "String", "newString", "(", "byte", "[", "]", "bytes", ",", "String", "charsetName", ")", "{", "if", "(", "bytes", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "return", "new", "String", "(", "bytes", ",", "char...
Constructs a new <code>String</code> by decoding the specified array of bytes using the given charset. <p> This method catches {@link UnsupportedEncodingException} and re-throws it as {@link IllegalStateException}, which should never happen for a required charset name. Use this method when the encoding is required to be in the JRE. </p> @param bytes The bytes to be decoded into characters @param charsetName The name of a required {@link java.nio.charset.Charset} @return A new <code>String</code> decoded from the specified array of bytes using the given charset. @throws IllegalStateException Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen for a required charset name. @see <a href="http://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/CharEncoding.html">CharEncoding</a> @see String#String(byte[], String)
[ "Constructs", "a", "new", "<code", ">", "String<", "/", "code", ">", "by", "decoding", "the", "specified", "array", "of", "bytes", "using", "the", "given", "charset", ".", "<p", ">", "This", "method", "catches", "{", "@link", "UnsupportedEncodingException", ...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/StringUtils.java#L53-L62
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getFunction
public Map<String, CmsDynamicFunctionBeanWrapper> getFunction() { if (m_function == null) { Transformer transformer = new Transformer() { @Override public Object transform(Object input) { try { CmsDynamicFunctionBean dynamicFunction = readDynamicFunctionBean((String)input); CmsDynamicFunctionBeanWrapper wrapper = new CmsDynamicFunctionBeanWrapper( m_cms, dynamicFunction); return wrapper; } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsDynamicFunctionBeanWrapper(m_cms, null); } } }; m_function = CmsCollectionsGenericWrapper.createLazyMap(transformer); } return m_function; }
java
public Map<String, CmsDynamicFunctionBeanWrapper> getFunction() { if (m_function == null) { Transformer transformer = new Transformer() { @Override public Object transform(Object input) { try { CmsDynamicFunctionBean dynamicFunction = readDynamicFunctionBean((String)input); CmsDynamicFunctionBeanWrapper wrapper = new CmsDynamicFunctionBeanWrapper( m_cms, dynamicFunction); return wrapper; } catch (CmsException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsDynamicFunctionBeanWrapper(m_cms, null); } } }; m_function = CmsCollectionsGenericWrapper.createLazyMap(transformer); } return m_function; }
[ "public", "Map", "<", "String", ",", "CmsDynamicFunctionBeanWrapper", ">", "getFunction", "(", ")", "{", "if", "(", "m_function", "==", "null", ")", "{", "Transformer", "transformer", "=", "new", "Transformer", "(", ")", "{", "@", "Override", "public", "Obje...
Returns a lazy initialized Map which allows access to the dynamic function beans using the JSP EL.<p> When given a key, the returned map will look up the corresponding dynamic function bean in the module configuration.<p> @return a lazy initialized Map which allows access to the dynamic function beans using the JSP EL
[ "Returns", "a", "lazy", "initialized", "Map", "which", "allows", "access", "to", "the", "dynamic", "function", "beans", "using", "the", "JSP", "EL", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1051-L1077
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java
InodeTreePersistentState.applyAndJournal
public void applyAndJournal(Supplier<JournalContext> context, RenameEntry entry) { try { applyRename(entry); context.get().append(JournalEntry.newBuilder().setRename(entry).build()); } catch (Throwable t) { ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry); throw t; // fatalError will usually system.exit } }
java
public void applyAndJournal(Supplier<JournalContext> context, RenameEntry entry) { try { applyRename(entry); context.get().append(JournalEntry.newBuilder().setRename(entry).build()); } catch (Throwable t) { ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry); throw t; // fatalError will usually system.exit } }
[ "public", "void", "applyAndJournal", "(", "Supplier", "<", "JournalContext", ">", "context", ",", "RenameEntry", "entry", ")", "{", "try", "{", "applyRename", "(", "entry", ")", ";", "context", ".", "get", "(", ")", ".", "append", "(", "JournalEntry", ".",...
Renames an inode. @param context journal context supplier @param entry rename entry
[ "Renames", "an", "inode", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java#L202-L210
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/events/service/EventService.java
EventService.dispatchEvent
public EventHandlerStatus dispatchEvent(HttpServletRequest httpRequest) { ApiContext apiContext = new MozuApiContext(httpRequest); Event event = null; // get the event from the request and validate try { String body = IOUtils.toString(httpRequest.getInputStream()); logger.debug("Event body: " + body); event = mapper.readValue(body, Event.class); logger.info("Dispatching Event. Correlation ID: " + event.getCorrelationId()); if (!Crypto.isRequestValid(apiContext, body)) { StringBuilder msg = new StringBuilder ("Event is not authorized."); logger.warn(msg.toString()); return( new EventHandlerStatus(msg.toString(), HttpServletResponse.SC_UNAUTHORIZED)); } } catch (IOException exception) { StringBuilder msg = new StringBuilder ("Unable to read event: ").append(exception.getMessage()); logger.error(msg.toString()); return( new EventHandlerStatus(msg.toString(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); } try { invokeHandler(event, apiContext); } catch (Exception exception) { StringBuilder msg = new StringBuilder ("Unable to process event with correlation id ").append(event.getCorrelationId()).append(". Message: ").append(exception.getMessage()); logger.error(msg.toString()); return( new EventHandlerStatus(msg.toString(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); } return( new EventHandlerStatus(null, HttpServletResponse.SC_OK)); }
java
public EventHandlerStatus dispatchEvent(HttpServletRequest httpRequest) { ApiContext apiContext = new MozuApiContext(httpRequest); Event event = null; // get the event from the request and validate try { String body = IOUtils.toString(httpRequest.getInputStream()); logger.debug("Event body: " + body); event = mapper.readValue(body, Event.class); logger.info("Dispatching Event. Correlation ID: " + event.getCorrelationId()); if (!Crypto.isRequestValid(apiContext, body)) { StringBuilder msg = new StringBuilder ("Event is not authorized."); logger.warn(msg.toString()); return( new EventHandlerStatus(msg.toString(), HttpServletResponse.SC_UNAUTHORIZED)); } } catch (IOException exception) { StringBuilder msg = new StringBuilder ("Unable to read event: ").append(exception.getMessage()); logger.error(msg.toString()); return( new EventHandlerStatus(msg.toString(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); } try { invokeHandler(event, apiContext); } catch (Exception exception) { StringBuilder msg = new StringBuilder ("Unable to process event with correlation id ").append(event.getCorrelationId()).append(". Message: ").append(exception.getMessage()); logger.error(msg.toString()); return( new EventHandlerStatus(msg.toString(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); } return( new EventHandlerStatus(null, HttpServletResponse.SC_OK)); }
[ "public", "EventHandlerStatus", "dispatchEvent", "(", "HttpServletRequest", "httpRequest", ")", "{", "ApiContext", "apiContext", "=", "new", "MozuApiContext", "(", "httpRequest", ")", ";", "Event", "event", "=", "null", ";", "// get the event from the request and validate...
Takes the event notification message, parses it and dispatches the event to the registered handler for the event category and type. @param httpRequest The http request containing the event notification message @return A response with a status code and optionally an error message
[ "Takes", "the", "event", "notification", "message", "parses", "it", "and", "dispatches", "the", "event", "to", "the", "registered", "handler", "for", "the", "event", "category", "and", "type", "." ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/events/service/EventService.java#L34-L63
ironjacamar/ironjacamar
tracer/src/main/java/org/ironjacamar/tracer/TraceEventHelper.java
TraceEventHelper.getEvents
public static List<TraceEvent> getEvents(FileReader fr, File directory) throws Exception { return getEvents(getData(fr, directory)); }
java
public static List<TraceEvent> getEvents(FileReader fr, File directory) throws Exception { return getEvents(getData(fr, directory)); }
[ "public", "static", "List", "<", "TraceEvent", ">", "getEvents", "(", "FileReader", "fr", ",", "File", "directory", ")", "throws", "Exception", "{", "return", "getEvents", "(", "getData", "(", "fr", ",", "directory", ")", ")", ";", "}" ]
Get the events @param fr The file reader @param directory The directory @return The events @exception Exception If an error occurs
[ "Get", "the", "events" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/tracer/src/main/java/org/ironjacamar/tracer/TraceEventHelper.java#L333-L336
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.getSequenceInfo
private SequenceMethodInfo getSequenceInfo(Stream<XsdAbstractElement> xsdElements, String className, int interfaceIndex, int unnamedIndex, String apiName, String groupName){ List<XsdAbstractElement> xsdElementsList = xsdElements.collect(Collectors.toList()); SequenceMethodInfo sequenceMethodInfo = new SequenceMethodInfo(xsdElementsList.stream().filter(element -> !(element instanceof XsdSequence)).collect(Collectors.toList()), interfaceIndex, unnamedIndex); for (XsdAbstractElement element : xsdElementsList) { if (element instanceof XsdElement){ String elementName = ((XsdElement) element).getName(); if (elementName != null){ sequenceMethodInfo.addElementName(elementName); } else { sequenceMethodInfo.addElementName(className + "SequenceUnnamed" + sequenceMethodInfo.getUnnamedIndex()); sequenceMethodInfo.incrementUnnamedIndex(); } } else { if (element instanceof XsdSequence){ sequenceMethodInfo.receiveChildSequence(getSequenceInfo(element.getXsdElements(), className, interfaceIndex, unnamedIndex, apiName, groupName)); } else { InterfaceInfo interfaceInfo = iterativeCreation(element, className, interfaceIndex + 1, apiName, groupName).get(0); sequenceMethodInfo.setInterfaceIndex(interfaceInfo.getInterfaceIndex()); sequenceMethodInfo.addElementName(interfaceInfo.getInterfaceName()); } } } return sequenceMethodInfo; }
java
private SequenceMethodInfo getSequenceInfo(Stream<XsdAbstractElement> xsdElements, String className, int interfaceIndex, int unnamedIndex, String apiName, String groupName){ List<XsdAbstractElement> xsdElementsList = xsdElements.collect(Collectors.toList()); SequenceMethodInfo sequenceMethodInfo = new SequenceMethodInfo(xsdElementsList.stream().filter(element -> !(element instanceof XsdSequence)).collect(Collectors.toList()), interfaceIndex, unnamedIndex); for (XsdAbstractElement element : xsdElementsList) { if (element instanceof XsdElement){ String elementName = ((XsdElement) element).getName(); if (elementName != null){ sequenceMethodInfo.addElementName(elementName); } else { sequenceMethodInfo.addElementName(className + "SequenceUnnamed" + sequenceMethodInfo.getUnnamedIndex()); sequenceMethodInfo.incrementUnnamedIndex(); } } else { if (element instanceof XsdSequence){ sequenceMethodInfo.receiveChildSequence(getSequenceInfo(element.getXsdElements(), className, interfaceIndex, unnamedIndex, apiName, groupName)); } else { InterfaceInfo interfaceInfo = iterativeCreation(element, className, interfaceIndex + 1, apiName, groupName).get(0); sequenceMethodInfo.setInterfaceIndex(interfaceInfo.getInterfaceIndex()); sequenceMethodInfo.addElementName(interfaceInfo.getInterfaceName()); } } } return sequenceMethodInfo; }
[ "private", "SequenceMethodInfo", "getSequenceInfo", "(", "Stream", "<", "XsdAbstractElement", ">", "xsdElements", ",", "String", "className", ",", "int", "interfaceIndex", ",", "int", "unnamedIndex", ",", "String", "apiName", ",", "String", "groupName", ")", "{", ...
Obtains information about all the members that make up the sequence. @param xsdElements The members that make the sequence. @param className The name of the element that this sequence belongs to. @param interfaceIndex The current interface index. @param unnamedIndex A special index for elements that have no name, which will help distinguish them. @param apiName The name of the generated fluent interface. @param groupName The group name of the group that contains this sequence, if any. @return A {@link SequenceMethodInfo} object which contains relevant information regarding sequence methods.
[ "Obtains", "information", "about", "all", "the", "members", "that", "make", "up", "the", "sequence", "." ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L578-L605
Erudika/para
para-server/src/main/java/com/erudika/para/security/SimpleRequestCache.java
SimpleRequestCache.removeRequest
@Override public void removeRequest(HttpServletRequest request, HttpServletResponse response) { HttpUtils.removeStateParam(Config.RETURNTO_COOKIE, request, response); }
java
@Override public void removeRequest(HttpServletRequest request, HttpServletResponse response) { HttpUtils.removeStateParam(Config.RETURNTO_COOKIE, request, response); }
[ "@", "Override", "public", "void", "removeRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "HttpUtils", ".", "removeStateParam", "(", "Config", ".", "RETURNTO_COOKIE", ",", "request", ",", "response", ")", ";", "}" ...
Removes a saved request from cache. @param request HTTP request @param response HTTP response
[ "Removes", "a", "saved", "request", "from", "cache", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/SimpleRequestCache.java#L84-L87
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.orthoSymmetricLH
public Matrix4x3d orthoSymmetricLH(double width, double height, double zNear, double zFar, boolean zZeroToOne) { return orthoSymmetricLH(width, height, zNear, zFar, zZeroToOne, this); }
java
public Matrix4x3d orthoSymmetricLH(double width, double height, double zNear, double zFar, boolean zZeroToOne) { return orthoSymmetricLH(width, height, zNear, zFar, zZeroToOne, this); }
[ "public", "Matrix4x3d", "orthoSymmetricLH", "(", "double", "width", ",", "double", "height", ",", "double", "zNear", ",", "double", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "return", "orthoSymmetricLH", "(", "width", ",", "height", ",", "zNear", ",", ...
Apply a symmetric orthographic projection transformation for a left-handed coordinate system using the given NDC z range to this matrix. <p> This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double, boolean) orthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetricLH(double, double, double, double, boolean) setOrthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetricLH(double, double, double, double, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Apply", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", "to", "this", "matrix", ".", "<p", ">", "This", "method", "is", "equivalent", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L7327-L7329
LearnLib/automatalib
serialization/fsm/src/main/java/net/automatalib/serialization/fsm/parser/FSM2DFAParser.java
FSM2DFAParser.parseStateVector
@Override protected void parseStateVector(StreamTokenizer streamTokenizer) throws FSMParseException, IOException { Boolean accepting = null; for (int i = 0; i <= acceptIndex && streamTokenizer.nextToken() == StreamTokenizer.TT_WORD && accepting == null; i++) { final String value = streamTokenizer.sval; if (i == acceptIndex) { try { accepting = acceptValue == Integer.parseInt(value); } catch (NumberFormatException nfe) { throw new FSMParseException(nfe, streamTokenizer); } } } if (accepting == null) { throw new FSMParseException(String.format(ACCEPT_INDEX_NOT_FOUND, acceptIndex), streamTokenizer); } else { states.put(getPartLineNumber(), accepting); } }
java
@Override protected void parseStateVector(StreamTokenizer streamTokenizer) throws FSMParseException, IOException { Boolean accepting = null; for (int i = 0; i <= acceptIndex && streamTokenizer.nextToken() == StreamTokenizer.TT_WORD && accepting == null; i++) { final String value = streamTokenizer.sval; if (i == acceptIndex) { try { accepting = acceptValue == Integer.parseInt(value); } catch (NumberFormatException nfe) { throw new FSMParseException(nfe, streamTokenizer); } } } if (accepting == null) { throw new FSMParseException(String.format(ACCEPT_INDEX_NOT_FOUND, acceptIndex), streamTokenizer); } else { states.put(getPartLineNumber(), accepting); } }
[ "@", "Override", "protected", "void", "parseStateVector", "(", "StreamTokenizer", "streamTokenizer", ")", "throws", "FSMParseException", ",", "IOException", "{", "Boolean", "accepting", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "accep...
Parse a state vector. <p> This method will only search for whether the state is accepting or not. The state index will be equal to the current {@link #getPartLineNumber()}. @throws FSMParseException when the current line is an illegal state vector. @throws IOException see {@link StreamTokenizer#nextToken()}.
[ "Parse", "a", "state", "vector", ".", "<p", ">", "This", "method", "will", "only", "search", "for", "whether", "the", "state", "is", "accepting", "or", "not", ".", "The", "state", "index", "will", "be", "equal", "to", "the", "current", "{", "@link", "#...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/serialization/fsm/src/main/java/net/automatalib/serialization/fsm/parser/FSM2DFAParser.java#L197-L217
vdurmont/emoji-java
src/main/java/com/vdurmont/emoji/EmojiParser.java
EmojiParser.getEmojiEndPos
protected static int getEmojiEndPos(char[] text, int startPos) { int best = -1; for (int j = startPos + 1; j <= text.length; j++) { EmojiTrie.Matches status = EmojiManager.isEmoji(Arrays.copyOfRange( text, startPos, j )); if (status.exactMatch()) { best = j; } else if (status.impossibleMatch()) { return best; } } return best; }
java
protected static int getEmojiEndPos(char[] text, int startPos) { int best = -1; for (int j = startPos + 1; j <= text.length; j++) { EmojiTrie.Matches status = EmojiManager.isEmoji(Arrays.copyOfRange( text, startPos, j )); if (status.exactMatch()) { best = j; } else if (status.impossibleMatch()) { return best; } } return best; }
[ "protected", "static", "int", "getEmojiEndPos", "(", "char", "[", "]", "text", ",", "int", "startPos", ")", "{", "int", "best", "=", "-", "1", ";", "for", "(", "int", "j", "=", "startPos", "+", "1", ";", "j", "<=", "text", ".", "length", ";", "j"...
Returns end index of a unicode emoji if it is found in text starting at index startPos, -1 if not found. This returns the longest matching emoji, for example, in "\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC66" it will find alias:family_man_woman_boy, NOT alias:man @param text the current text where we are looking for an emoji @param startPos the position in the text where we should start looking for an emoji end @return the end index of the unicode emoji starting at startPos. -1 if not found
[ "Returns", "end", "index", "of", "a", "unicode", "emoji", "if", "it", "is", "found", "in", "text", "starting", "at", "index", "startPos", "-", "1", "if", "not", "found", ".", "This", "returns", "the", "longest", "matching", "emoji", "for", "example", "in...
train
https://github.com/vdurmont/emoji-java/blob/8cf5fbe0d7c1020b926791f2b342a263ed07bb0f/src/main/java/com/vdurmont/emoji/EmojiParser.java#L451-L468
glyptodon/guacamole-client
guacamole/src/main/java/org/apache/guacamole/rest/tunnel/TunnelResource.java
TunnelResource.getStream
@Path("streams/{index}/{filename}") public StreamResource getStream(@PathParam("index") final int streamIndex, @QueryParam("type") @DefaultValue(DEFAULT_MEDIA_TYPE) String mediaType, @PathParam("filename") String filename) throws GuacamoleException { return new StreamResource(tunnel, streamIndex, mediaType); }
java
@Path("streams/{index}/{filename}") public StreamResource getStream(@PathParam("index") final int streamIndex, @QueryParam("type") @DefaultValue(DEFAULT_MEDIA_TYPE) String mediaType, @PathParam("filename") String filename) throws GuacamoleException { return new StreamResource(tunnel, streamIndex, mediaType); }
[ "@", "Path", "(", "\"streams/{index}/{filename}\"", ")", "public", "StreamResource", "getStream", "(", "@", "PathParam", "(", "\"index\"", ")", "final", "int", "streamIndex", ",", "@", "QueryParam", "(", "\"type\"", ")", "@", "DefaultValue", "(", "DEFAULT_MEDIA_TY...
Intercepts and returns the entire contents of a specific stream. @param streamIndex The index of the stream to intercept. @param mediaType The media type (mimetype) of the data within the stream. @param filename The filename to use for the sake of identifying the data returned. @return A response through which the entire contents of the intercepted stream will be sent. @throws GuacamoleException If the session associated with the given auth token cannot be retrieved, or if no such tunnel exists.
[ "Intercepts", "and", "returns", "the", "entire", "contents", "of", "a", "specific", "stream", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/rest/tunnel/TunnelResource.java#L129-L137
arnaudroger/SimpleFlatMapper
sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java
MapperBuilder.addKey
public final B addKey(String column) { return addMapping(column, calculatedIndex++, FieldMapperColumnDefinition.<K>key()); }
java
public final B addKey(String column) { return addMapping(column, calculatedIndex++, FieldMapperColumnDefinition.<K>key()); }
[ "public", "final", "B", "addKey", "(", "String", "column", ")", "{", "return", "addMapping", "(", "column", ",", "calculatedIndex", "++", ",", "FieldMapperColumnDefinition", ".", "<", "K", ">", "key", "(", ")", ")", ";", "}" ]
add a new mapping to the specified property with a key property definition and an undefined type. The index is incremented for each non indexed property mapping. @param column the property name @return the current builder
[ "add", "a", "new", "mapping", "to", "the", "specified", "property", "with", "a", "key", "property", "definition", "and", "an", "undefined", "type", ".", "The", "index", "is", "incremented", "for", "each", "non", "indexed", "property", "mapping", "." ]
train
https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java#L56-L58
bbottema/simple-java-mail
modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageParser.java
MimeMessageParser.createDataSource
@Nonnull private static DataSource createDataSource(@Nonnull final MimePart part) { final DataHandler dataHandler = retrieveDataHandler(part); final DataSource dataSource = dataHandler.getDataSource(); final String contentType = parseBaseMimeType(dataSource.getContentType()); final byte[] content = readContent(retrieveInputStream(dataSource)); final ByteArrayDataSource result = new ByteArrayDataSource(content, contentType); final String dataSourceName = parseDataSourceName(part, dataSource); result.setName(dataSourceName); return result; }
java
@Nonnull private static DataSource createDataSource(@Nonnull final MimePart part) { final DataHandler dataHandler = retrieveDataHandler(part); final DataSource dataSource = dataHandler.getDataSource(); final String contentType = parseBaseMimeType(dataSource.getContentType()); final byte[] content = readContent(retrieveInputStream(dataSource)); final ByteArrayDataSource result = new ByteArrayDataSource(content, contentType); final String dataSourceName = parseDataSourceName(part, dataSource); result.setName(dataSourceName); return result; }
[ "@", "Nonnull", "private", "static", "DataSource", "createDataSource", "(", "@", "Nonnull", "final", "MimePart", "part", ")", "{", "final", "DataHandler", "dataHandler", "=", "retrieveDataHandler", "(", "part", ")", ";", "final", "DataSource", "dataSource", "=", ...
Parses the MimePart to create a DataSource. @param part the current part to be processed @return the DataSource
[ "Parses", "the", "MimePart", "to", "create", "a", "DataSource", "." ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageParser.java#L337-L348
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.rebootAsync
public Observable<Void> rebootAsync(String resourceGroupName, String name) { return rebootWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> rebootAsync(String resourceGroupName, String name) { return rebootWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "rebootAsync", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "rebootWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceRe...
Reboot all machines in an App Service Environment. Reboot all machines in an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Reboot", "all", "machines", "in", "an", "App", "Service", "Environment", ".", "Reboot", "all", "machines", "in", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3743-L3750
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/utils/IDGeneratorImpl.java
IDGeneratorImpl.convertSessionIdBytesToSessionId
public static String convertSessionIdBytesToSessionId(byte[] pBytes, int sessionIdLength) { // int numBits = pBytes.length * 8; char[] chars = new char[sessionIdLength]; int byteNum = 0; int bitNum = 0; int pos = 0; while (byteNum < pBytes.length && pos < sessionIdLength) { int val = 0; // Get from the byte if (bitNum < 3) { val = (pBytes[byteNum] >> (2 - bitNum)) & 0x3f; } // Get from this byte and the next else { val = pBytes[byteNum] << (6 - (8 - bitNum)); if (byteNum + 1 < pBytes.length) { // LIDB2775.25 zOS int secondVal = pBytes[byteNum + 1] >> 8 // - (6 - (8 - bitNum)); /* @WS17270A */ int secondVal = (pBytes[byteNum + 1] & 0x000000ff) >> 8 - (6 - (8 - bitNum)); /* * cmdzos * * @ * WS17270A * and * * @ * MD16963C */ secondVal &= sSecondByteMasks[6 - (8 - bitNum)]; val |= secondVal; } val &= 0x3f; } // Assign the character chars[pos++] = sBitChars[val]; // Increment to the next character bitNum += 6; if (bitNum >= 8) { byteNum++; bitNum -= 8; } } return new String(chars); }
java
public static String convertSessionIdBytesToSessionId(byte[] pBytes, int sessionIdLength) { // int numBits = pBytes.length * 8; char[] chars = new char[sessionIdLength]; int byteNum = 0; int bitNum = 0; int pos = 0; while (byteNum < pBytes.length && pos < sessionIdLength) { int val = 0; // Get from the byte if (bitNum < 3) { val = (pBytes[byteNum] >> (2 - bitNum)) & 0x3f; } // Get from this byte and the next else { val = pBytes[byteNum] << (6 - (8 - bitNum)); if (byteNum + 1 < pBytes.length) { // LIDB2775.25 zOS int secondVal = pBytes[byteNum + 1] >> 8 // - (6 - (8 - bitNum)); /* @WS17270A */ int secondVal = (pBytes[byteNum + 1] & 0x000000ff) >> 8 - (6 - (8 - bitNum)); /* * cmdzos * * @ * WS17270A * and * * @ * MD16963C */ secondVal &= sSecondByteMasks[6 - (8 - bitNum)]; val |= secondVal; } val &= 0x3f; } // Assign the character chars[pos++] = sBitChars[val]; // Increment to the next character bitNum += 6; if (bitNum >= 8) { byteNum++; bitNum -= 8; } } return new String(chars); }
[ "public", "static", "String", "convertSessionIdBytesToSessionId", "(", "byte", "[", "]", "pBytes", ",", "int", "sessionIdLength", ")", "{", "// int numBits = pBytes.length * 8;", "char", "[", "]", "chars", "=", "new", "char", "[", "sessionIdLength", "]", ";", "int...
Method convertSessionIdBytesToSessionIdBase64 Converts the specified byte array to a String to be used for the session id. The conversion is performed breaking the byte array into groups of 6 bits, then taking each group (value 0-63) and converting to a character 'A'-'Z', 'a'-'z','0'-'9',_,-. @param pBytes @return String
[ "Method", "convertSessionIdBytesToSessionIdBase64", "Converts", "the", "specified", "byte", "array", "to", "a", "String", "to", "be", "used", "for", "the", "session", "id", ".", "The", "conversion", "is", "performed", "breaking", "the", "byte", "array", "into", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/utils/IDGeneratorImpl.java#L149-L197
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/ProjectUtils.java
ProjectUtils.createProjectSkeleton
public static void createProjectSkeleton( File targetDirectory, CreationBean creationBean ) throws IOException { if( creationBean.isMavenProject()) createMavenProject( targetDirectory, creationBean ); else createSimpleProject( targetDirectory, creationBean ); }
java
public static void createProjectSkeleton( File targetDirectory, CreationBean creationBean ) throws IOException { if( creationBean.isMavenProject()) createMavenProject( targetDirectory, creationBean ); else createSimpleProject( targetDirectory, creationBean ); }
[ "public", "static", "void", "createProjectSkeleton", "(", "File", "targetDirectory", ",", "CreationBean", "creationBean", ")", "throws", "IOException", "{", "if", "(", "creationBean", ".", "isMavenProject", "(", ")", ")", "createMavenProject", "(", "targetDirectory", ...
Creates a project for Roboconf. @param targetDirectory the directory into which the Roboconf files must be copied @param creationBean the creation properties @throws IOException if something went wrong
[ "Creates", "a", "project", "for", "Roboconf", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/ProjectUtils.java#L91-L97
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/ReadOnlyHttp2Headers.java
ReadOnlyHttp2Headers.serverHeaders
public static ReadOnlyHttp2Headers serverHeaders(boolean validateHeaders, AsciiString status, AsciiString... otherHeaders) { return new ReadOnlyHttp2Headers(validateHeaders, new AsciiString[] { PseudoHeaderName.STATUS.value(), status }, otherHeaders); }
java
public static ReadOnlyHttp2Headers serverHeaders(boolean validateHeaders, AsciiString status, AsciiString... otherHeaders) { return new ReadOnlyHttp2Headers(validateHeaders, new AsciiString[] { PseudoHeaderName.STATUS.value(), status }, otherHeaders); }
[ "public", "static", "ReadOnlyHttp2Headers", "serverHeaders", "(", "boolean", "validateHeaders", ",", "AsciiString", "status", ",", "AsciiString", "...", "otherHeaders", ")", "{", "return", "new", "ReadOnlyHttp2Headers", "(", "validateHeaders", ",", "new", "AsciiString",...
Create a new read only representation of headers used by servers. @param validateHeaders {@code true} will run validation on each header name/value pair to ensure protocol compliance. @param status The value for {@link PseudoHeaderName#STATUS}. @param otherHeaders A an array of key:value pairs. Must not contain any <a href="https://tools.ietf.org/html/rfc7540#section-8.1.2.1">pseudo headers</a> or {@code null} names/values. A copy will <strong>NOT</strong> be made of this array. If the contents of this array may be modified externally you are responsible for passing in a copy. @return a new read only representation of headers used by servers.
[ "Create", "a", "new", "read", "only", "representation", "of", "headers", "used", "by", "servers", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/ReadOnlyHttp2Headers.java#L107-L113
alkacon/opencms-core
src-gwt/org/opencms/ade/upload/client/ui/A_CmsUploadDialog.java
A_CmsUploadDialog.startLoadingAnimation
private void startLoadingAnimation(final String msg, int delayMillis) { m_loadingTimer = new Timer() { @Override public void run() { createLoadingAnimation(msg); } }; if (delayMillis > 0) { m_loadingTimer.schedule(delayMillis); } else { m_loadingTimer.run(); } }
java
private void startLoadingAnimation(final String msg, int delayMillis) { m_loadingTimer = new Timer() { @Override public void run() { createLoadingAnimation(msg); } }; if (delayMillis > 0) { m_loadingTimer.schedule(delayMillis); } else { m_loadingTimer.run(); } }
[ "private", "void", "startLoadingAnimation", "(", "final", "String", "msg", ",", "int", "delayMillis", ")", "{", "m_loadingTimer", "=", "new", "Timer", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "createLoadingAnimation", "(", "msg...
Starts the loading animation.<p> Used while client is loading files from hard disk into memory.<p> @param msg the message that should be displayed below the loading animation (can also be HTML as String) @param delayMillis the delay to start the animation with
[ "Starts", "the", "loading", "animation", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/upload/client/ui/A_CmsUploadDialog.java#L1432-L1447
fcrepo3/fcrepo
fcrepo-webapp/fcrepo-webapp-saxon/src/main/java/org/fcrepo/localservices/saxon/SaxonServlet.java
SaxonServlet.getInputStream
private InputStream getInputStream(String url) throws Exception { HttpGet getMethod = new HttpGet(url); DefaultHttpClient client = new DefaultHttpClient(m_cManager); client.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, TIMEOUT_SECONDS * 1000); UsernamePasswordCredentials creds = getCreds(url); if (creds != null) { client.getCredentialsProvider().setCredentials(AuthScope.ANY, creds); client.addRequestInterceptor(new PreemptiveAuth()); } client.getParams().setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, true); HttpInputStream in = new HttpInputStream(client, getMethod); if (in.getStatusCode() != 200) { try { in.close(); } catch (Exception e) { } throw new IOException("HTTP request failed. Got status code " + in.getStatusCode() + " from remote server while attempting to GET " + url); } else { return in; } }
java
private InputStream getInputStream(String url) throws Exception { HttpGet getMethod = new HttpGet(url); DefaultHttpClient client = new DefaultHttpClient(m_cManager); client.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, TIMEOUT_SECONDS * 1000); UsernamePasswordCredentials creds = getCreds(url); if (creds != null) { client.getCredentialsProvider().setCredentials(AuthScope.ANY, creds); client.addRequestInterceptor(new PreemptiveAuth()); } client.getParams().setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, true); HttpInputStream in = new HttpInputStream(client, getMethod); if (in.getStatusCode() != 200) { try { in.close(); } catch (Exception e) { } throw new IOException("HTTP request failed. Got status code " + in.getStatusCode() + " from remote server while attempting to GET " + url); } else { return in; } }
[ "private", "InputStream", "getInputStream", "(", "String", "url", ")", "throws", "Exception", "{", "HttpGet", "getMethod", "=", "new", "HttpGet", "(", "url", ")", ";", "DefaultHttpClient", "client", "=", "new", "DefaultHttpClient", "(", "m_cManager", ")", ";", ...
Get the content at the given location using the configured credentials (if any).
[ "Get", "the", "content", "at", "the", "given", "location", "using", "the", "configured", "credentials", "(", "if", "any", ")", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-webapp/fcrepo-webapp-saxon/src/main/java/org/fcrepo/localservices/saxon/SaxonServlet.java#L271-L293
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/OutputProperties.java
OutputProperties.setProperty
public void setProperty(String key, String value) { if(key.equals(OutputKeys.METHOD)) { setMethodDefaults(value); } if (key.startsWith(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL)) key = OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL + key.substring(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN); m_properties.put(key, value); }
java
public void setProperty(String key, String value) { if(key.equals(OutputKeys.METHOD)) { setMethodDefaults(value); } if (key.startsWith(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL)) key = OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL + key.substring(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN); m_properties.put(key, value); }
[ "public", "void", "setProperty", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "key", ".", "equals", "(", "OutputKeys", ".", "METHOD", ")", ")", "{", "setMethodDefaults", "(", "value", ")", ";", "}", "if", "(", "key", ".", "start...
Set an output property. @param key the key to be placed into the property list. @param value the value corresponding to <tt>key</tt>. @see javax.xml.transform.OutputKeys
[ "Set", "an", "output", "property", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/OutputProperties.java#L130-L142
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/collection/PdfCollectionItem.java
PdfCollectionItem.setPrefix
public void setPrefix(String key, String prefix) { PdfName fieldname = new PdfName(key); PdfObject o = get(fieldname); if (o == null) throw new IllegalArgumentException("You must set a value before adding a prefix."); PdfDictionary dict = new PdfDictionary(PdfName.COLLECTIONSUBITEM); dict.put(PdfName.D, o); dict.put(PdfName.P, new PdfString(prefix, PdfObject.TEXT_UNICODE)); put(fieldname, dict); }
java
public void setPrefix(String key, String prefix) { PdfName fieldname = new PdfName(key); PdfObject o = get(fieldname); if (o == null) throw new IllegalArgumentException("You must set a value before adding a prefix."); PdfDictionary dict = new PdfDictionary(PdfName.COLLECTIONSUBITEM); dict.put(PdfName.D, o); dict.put(PdfName.P, new PdfString(prefix, PdfObject.TEXT_UNICODE)); put(fieldname, dict); }
[ "public", "void", "setPrefix", "(", "String", "key", ",", "String", "prefix", ")", "{", "PdfName", "fieldname", "=", "new", "PdfName", "(", "key", ")", ";", "PdfObject", "o", "=", "get", "(", "fieldname", ")", ";", "if", "(", "o", "==", "null", ")", ...
Adds a prefix for the Collection item. You can only use this method after you have set the value of the item. @param prefix a prefix
[ "Adds", "a", "prefix", "for", "the", "Collection", "item", ".", "You", "can", "only", "use", "this", "method", "after", "you", "have", "set", "the", "value", "of", "the", "item", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/collection/PdfCollectionItem.java#L108-L117
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.tileFeatureCount
public long tileFeatureCount(Point point, double zoom) { int zoomValue = (int) zoom; long tileFeaturesCount = tileFeatureCount(point, zoomValue); return tileFeaturesCount; }
java
public long tileFeatureCount(Point point, double zoom) { int zoomValue = (int) zoom; long tileFeaturesCount = tileFeatureCount(point, zoomValue); return tileFeaturesCount; }
[ "public", "long", "tileFeatureCount", "(", "Point", "point", ",", "double", "zoom", ")", "{", "int", "zoomValue", "=", "(", "int", ")", "zoom", ";", "long", "tileFeaturesCount", "=", "tileFeatureCount", "(", "point", ",", "zoomValue", ")", ";", "return", "...
Get the count of features in the tile at the point coordinate and zoom level @param point point location @param zoom zoom level @return count
[ "Get", "the", "count", "of", "features", "in", "the", "tile", "at", "the", "point", "coordinate", "and", "zoom", "level" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L229-L233
phax/ph-oton
ph-oton-app/src/main/java/com/helger/photon/app/url/LinkHelper.java
LinkHelper.getURIWithContext
@Nonnull public static String getURIWithContext (@Nonnull final String sHRef) { ValueEnforcer.notNull (sHRef, "HRef"); // If known protocol, keep it if (hasKnownProtocol (sHRef)) return sHRef; final String sContextPath = ServletContextPathHolder.getContextPath (); return _getURIWithContext (sContextPath, sHRef); }
java
@Nonnull public static String getURIWithContext (@Nonnull final String sHRef) { ValueEnforcer.notNull (sHRef, "HRef"); // If known protocol, keep it if (hasKnownProtocol (sHRef)) return sHRef; final String sContextPath = ServletContextPathHolder.getContextPath (); return _getURIWithContext (sContextPath, sHRef); }
[ "@", "Nonnull", "public", "static", "String", "getURIWithContext", "(", "@", "Nonnull", "final", "String", "sHRef", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sHRef", ",", "\"HRef\"", ")", ";", "// If known protocol, keep it", "if", "(", "hasKnownProtocol", ...
Prefix the passed href with the relative context path in case the passed href has no protocol yet.<br> Important: this method does not add the session ID in case cookies are disabled by the client! @param sHRef The href to be extended. May not be <code>null</code>. @return Either the original href if already absolute or <code>/webapp-context/<i>href</i></code> otherwise. Never <code>null</code>.
[ "Prefix", "the", "passed", "href", "with", "the", "relative", "context", "path", "in", "case", "the", "passed", "href", "has", "no", "protocol", "yet", ".", "<br", ">", "Important", ":", "this", "method", "does", "not", "add", "the", "session", "ID", "in...
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/url/LinkHelper.java#L142-L153
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.META
public static HtmlTree META(String name, String content) { HtmlTree htmltree = new HtmlTree(HtmlTag.META); htmltree.addAttr(HtmlAttr.NAME, nullCheck(name)); htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content)); return htmltree; }
java
public static HtmlTree META(String name, String content) { HtmlTree htmltree = new HtmlTree(HtmlTag.META); htmltree.addAttr(HtmlAttr.NAME, nullCheck(name)); htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content)); return htmltree; }
[ "public", "static", "HtmlTree", "META", "(", "String", "name", ",", "String", "content", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "META", ")", ";", "htmltree", ".", "addAttr", "(", "HtmlAttr", ".", "NAME", ",", "null...
Generates a META tag with the name and content attributes. @param name name attribute @param content type of content @return an HtmlTree object for the META tag
[ "Generates", "a", "META", "tag", "with", "the", "name", "and", "content", "attributes", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L591-L596
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.withObjectInputStream
public static <T> T withObjectInputStream(Path path, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectInputStream") Closure<T> closure) throws IOException { return IOGroovyMethods.withStream(newObjectInputStream(path), closure); }
java
public static <T> T withObjectInputStream(Path path, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectInputStream") Closure<T> closure) throws IOException { return IOGroovyMethods.withStream(newObjectInputStream(path), closure); }
[ "public", "static", "<", "T", ">", "T", "withObjectInputStream", "(", "Path", "path", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.ObjectInputStream\"", ")", "Closure", "<", "T", ">", "closure", ")...
Create a new ObjectInputStream for this file and pass it to the closure. This method ensures the stream is closed after the closure returns. @param path a Path @param closure a closure @return the value returned by the closure @throws java.io.IOException if an IOException occurs. @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure) @since 2.3.0
[ "Create", "a", "new", "ObjectInputStream", "for", "this", "file", "and", "pass", "it", "to", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L175-L177
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsInner.java
ServerAdvisorsInner.listByServerAsync
public Observable<List<AdvisorInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<AdvisorInner>>, List<AdvisorInner>>() { @Override public List<AdvisorInner> call(ServiceResponse<List<AdvisorInner>> response) { return response.body(); } }); }
java
public Observable<List<AdvisorInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<AdvisorInner>>, List<AdvisorInner>>() { @Override public List<AdvisorInner> call(ServiceResponse<List<AdvisorInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "AdvisorInner", ">", ">", "listByServerAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".",...
Gets a list of server advisors. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;AdvisorInner&gt; object
[ "Gets", "a", "list", "of", "server", "advisors", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsInner.java#L107-L114
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_voicemail_serviceName_directories_id_download_GET
public OvhPcsFile billingAccount_voicemail_serviceName_directories_id_download_GET(String billingAccount, String serviceName, Long id, OvhServiceVoicemailAudioFormatEnum format) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/download"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); query(sb, "format", format); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPcsFile.class); }
java
public OvhPcsFile billingAccount_voicemail_serviceName_directories_id_download_GET(String billingAccount, String serviceName, Long id, OvhServiceVoicemailAudioFormatEnum format) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/download"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); query(sb, "format", format); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPcsFile.class); }
[ "public", "OvhPcsFile", "billingAccount_voicemail_serviceName_directories_id_download_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "id", ",", "OvhServiceVoicemailAudioFormatEnum", "format", ")", "throws", "IOException", "{", "String", "qPa...
Get a url to download the sound file REST: GET /telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/download @param format [required] File format wanted @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param id [required] Id of the object
[ "Get", "a", "url", "to", "download", "the", "sound", "file" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7926-L7932
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultDataGridConfig.java
DefaultDataGridConfig.getStyleModel
public StyleModel getStyleModel(String name, String classPrefix) { if(name == null || name.equals(STYLE_POLICY_NAME_DEFAULT)) { if(classPrefix != null) return new DefaultStyleModel(classPrefix); else return DEFAULT_STYLE_POLICY; } else if(name != null && name.equals(STYLE_POLICY_NAME_EMPTY)) return EMPTY_STYLE_POLICY; else return DEFAULT_STYLE_POLICY; }
java
public StyleModel getStyleModel(String name, String classPrefix) { if(name == null || name.equals(STYLE_POLICY_NAME_DEFAULT)) { if(classPrefix != null) return new DefaultStyleModel(classPrefix); else return DEFAULT_STYLE_POLICY; } else if(name != null && name.equals(STYLE_POLICY_NAME_EMPTY)) return EMPTY_STYLE_POLICY; else return DEFAULT_STYLE_POLICY; }
[ "public", "StyleModel", "getStyleModel", "(", "String", "name", ",", "String", "classPrefix", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "equals", "(", "STYLE_POLICY_NAME_DEFAULT", ")", ")", "{", "if", "(", "classPrefix", "!=", "null", "...
Get a {@link StyleModel} given a model name and a style class prefix. This class exposes two available style names: <table> <tr><td>Name</td><td>Description</td><td>Implementation Class</td></tr> <tr><td><code>empty</code></td> <td>Renders CSS style classes that are non-prefixed and generally empty.</td> <td>{@link EmptyStyleModel}</td> </tr> <tr><td><code>default</code></td> <td>Renders CSS style classes with names using a default prefix of <code>datagrid</code></td> <td>{@link DefaultStyleModel}</td> </tr> </table> When using the <code>empty</code> style model, styles rendered on the &lt;table&gt; element will be empty; the same style rendered wtih the <code>default</code> style model will render as <code>class="datagrid"</code>. If the style prefix "foo" is provided for the <code>default</code> style policy the style name will be rendered as <code>class="foo"</code>.x @param name the name of a {@link StyleModel} implementation to use @param classPrefix the prefix for a style name @return the style model
[ "Get", "a", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultDataGridConfig.java#L178-L187
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/AbstractRemoteTransport.java
AbstractRemoteTransport.localWorkManagerAdd
public void localWorkManagerAdd(Address address, T physicalAddress) { if (trace) log.tracef("LOCAL_WORKMANAGER_ADD(%s, %s)", address, physicalAddress); join(address, physicalAddress); }
java
public void localWorkManagerAdd(Address address, T physicalAddress) { if (trace) log.tracef("LOCAL_WORKMANAGER_ADD(%s, %s)", address, physicalAddress); join(address, physicalAddress); }
[ "public", "void", "localWorkManagerAdd", "(", "Address", "address", ",", "T", "physicalAddress", ")", "{", "if", "(", "trace", ")", "log", ".", "tracef", "(", "\"LOCAL_WORKMANAGER_ADD(%s, %s)\"", ",", "address", ",", "physicalAddress", ")", ";", "join", "(", "...
localWorkManagerAdd @param address the logical address @param physicalAddress the physical address
[ "localWorkManagerAdd" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/AbstractRemoteTransport.java#L771-L777
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/recoverylog/JournalRecoveryLog.java
JournalRecoveryLog.writeStringArray
private String writeStringArray(String name, String[] values) { StringBuffer buffer = new StringBuffer(); buffer.append(" ").append(name).append("=["); for (int i = 0; i < values.length; i++) { buffer.append("'").append(values[i]).append("'"); if (i < values.length - 1) { buffer.append(", "); } } buffer.append("]\n"); return buffer.toString(); }
java
private String writeStringArray(String name, String[] values) { StringBuffer buffer = new StringBuffer(); buffer.append(" ").append(name).append("=["); for (int i = 0; i < values.length; i++) { buffer.append("'").append(values[i]).append("'"); if (i < values.length - 1) { buffer.append(", "); } } buffer.append("]\n"); return buffer.toString(); }
[ "private", "String", "writeStringArray", "(", "String", "name", ",", "String", "[", "]", "values", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\" \"", ")", ".", "append", "(", "name",...
Helper for the {@link #log(ConsumerJournalEntry)} method. Writes the values of a string array
[ "Helper", "for", "the", "{" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/recoverylog/JournalRecoveryLog.java#L190-L201
morimekta/utils
io-util/src/main/java/net/morimekta/util/json/JsonTokenizer.java
JsonTokenizer.peek
@Nonnull public JsonToken peek(String message) throws IOException, JsonException { if (!hasNext()) { throw newParseException("Expected %s: Got end of file", message); } return unreadToken; }
java
@Nonnull public JsonToken peek(String message) throws IOException, JsonException { if (!hasNext()) { throw newParseException("Expected %s: Got end of file", message); } return unreadToken; }
[ "@", "Nonnull", "public", "JsonToken", "peek", "(", "String", "message", ")", "throws", "IOException", ",", "JsonException", "{", "if", "(", "!", "hasNext", "(", ")", ")", "{", "throw", "newParseException", "(", "\"Expected %s: Got end of file\"", ",", "message"...
Return the next token or throw an exception. Though it does not consume that token. @param message Message to add to exception if there are no more JSON tokens on the stream. @return The next token. @throws JsonException If the next token is illegally formatted. @throws IOException If unable to read from stream.
[ "Return", "the", "next", "token", "or", "throw", "an", "exception", ".", "Though", "it", "does", "not", "consume", "that", "token", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/json/JsonTokenizer.java#L286-L292
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.toPushbackStream
public static PushbackInputStream toPushbackStream(InputStream in, int pushBackSize) { return (in instanceof PushbackInputStream) ? (PushbackInputStream) in : new PushbackInputStream(in, pushBackSize); }
java
public static PushbackInputStream toPushbackStream(InputStream in, int pushBackSize) { return (in instanceof PushbackInputStream) ? (PushbackInputStream) in : new PushbackInputStream(in, pushBackSize); }
[ "public", "static", "PushbackInputStream", "toPushbackStream", "(", "InputStream", "in", ",", "int", "pushBackSize", ")", "{", "return", "(", "in", "instanceof", "PushbackInputStream", ")", "?", "(", "PushbackInputStream", ")", "in", ":", "new", "PushbackInputStream...
转换为{@link PushbackInputStream}<br> 如果传入的输入流已经是{@link PushbackInputStream},强转返回,否则新建一个 @param in {@link InputStream} @param pushBackSize 推后的byte数 @return {@link PushbackInputStream} @since 3.1.0
[ "转换为", "{", "@link", "PushbackInputStream", "}", "<br", ">", "如果传入的输入流已经是", "{", "@link", "PushbackInputStream", "}", ",强转返回,否则新建一个" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L845-L847
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.setFileName
public void setFileName(String filename, String typeName) { mSingleFileName = null; if (mFileNames == null) { mFileNames = new HashMap<String, String>(); } mFileNames.put(typeName, filename); }
java
public void setFileName(String filename, String typeName) { mSingleFileName = null; if (mFileNames == null) { mFileNames = new HashMap<String, String>(); } mFileNames.put(typeName, filename); }
[ "public", "void", "setFileName", "(", "String", "filename", ",", "String", "typeName", ")", "{", "mSingleFileName", "=", "null", ";", "if", "(", "mFileNames", "==", "null", ")", "{", "mFileNames", "=", "new", "HashMap", "<", "String", ",", "String", ">", ...
Specify the file that a BDB database should reside in, except for log files and caches. The filename is relative to the environment home, unless data directories have been specified. For BDBRepositories that are log files only, this configuration is ignored. @param filename BDB database filename @param typeName type to store in file; if null, the file is used by default for all types
[ "Specify", "the", "file", "that", "a", "BDB", "database", "should", "reside", "in", "except", "for", "log", "files", "and", "caches", ".", "The", "filename", "is", "relative", "to", "the", "environment", "home", "unless", "data", "directories", "have", "been...
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L412-L418
nohana/Amalgam
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
CursorUtils.getShort
public static short getShort(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getShort(cursor.getColumnIndex(columnName)); }
java
public static short getShort(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getShort(cursor.getColumnIndex(columnName)); }
[ "public", "static", "short", "getShort", "(", "Cursor", "cursor", ",", "String", "columnName", ")", "{", "if", "(", "cursor", "==", "null", ")", "{", "return", "-", "1", ";", "}", "return", "cursor", ".", "getShort", "(", "cursor", ".", "getColumnIndex",...
Read the short data for the column. @see android.database.Cursor#getShort(int). @see android.database.Cursor#getColumnIndex(String). @param cursor the cursor. @param columnName the column name. @return the short value.
[ "Read", "the", "short", "data", "for", "the", "column", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L96-L102
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java
ConfigRestClientUtil.sqlObject
public <T> T sqlObject(Class<T> beanType , String templateName,Map params) throws ElasticSearchException { SQLRestResponse result = this.client.executeRequest("/_xpack/sql",ESTemplateHelper.evalTemplate(esUtil,templateName, params), new SQLRestResponseHandler()); return ResultUtil.buildSQLObject(result,beanType); }
java
public <T> T sqlObject(Class<T> beanType , String templateName,Map params) throws ElasticSearchException { SQLRestResponse result = this.client.executeRequest("/_xpack/sql",ESTemplateHelper.evalTemplate(esUtil,templateName, params), new SQLRestResponseHandler()); return ResultUtil.buildSQLObject(result,beanType); }
[ "public", "<", "T", ">", "T", "sqlObject", "(", "Class", "<", "T", ">", "beanType", ",", "String", "templateName", ",", "Map", "params", ")", "throws", "ElasticSearchException", "{", "SQLRestResponse", "result", "=", "this", ".", "client", ".", "executeReque...
发送es restful sql请求/_xpack/sql,获取返回值,返回值类型由beanType决定 @param beanType @param templateName @param <T> @return @throws ElasticSearchException
[ "发送es", "restful", "sql请求", "/", "_xpack", "/", "sql,获取返回值,返回值类型由beanType决定" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java#L498-L501
google/closure-compiler
src/com/google/javascript/jscomp/modules/ClosureRequireProcessor.java
ClosureRequireProcessor.getAllRequiresInDeclaration
private ImmutableList<Require> getAllRequiresInDeclaration() { Node rhs = nameDeclaration.getFirstChild().isDestructuringLhs() ? nameDeclaration.getFirstChild().getSecondChild() : nameDeclaration.getFirstFirstChild(); String namespace = rhs.getSecondChild().getString(); if (nameDeclaration.getFirstChild().isName()) { // const modA = goog.require('modA'); Node lhs = nameDeclaration.getFirstChild(); return ImmutableList.of( Require.create( lhs.getString(), Import.builder() .moduleRequest(namespace) .localName(lhs.getString()) .importName(Export.NAMESPACE) .importNode(nameDeclaration) .nameNode(lhs) .build(), requireKind)); } else { // const {x, y} = goog.require('modA'); Node objectPattern = nameDeclaration.getFirstFirstChild(); if (!objectPattern.isObjectPattern()) { // bad JS, ignore return ImmutableList.of(); } return getAllRequiresFromDestructuring(objectPattern, namespace); } }
java
private ImmutableList<Require> getAllRequiresInDeclaration() { Node rhs = nameDeclaration.getFirstChild().isDestructuringLhs() ? nameDeclaration.getFirstChild().getSecondChild() : nameDeclaration.getFirstFirstChild(); String namespace = rhs.getSecondChild().getString(); if (nameDeclaration.getFirstChild().isName()) { // const modA = goog.require('modA'); Node lhs = nameDeclaration.getFirstChild(); return ImmutableList.of( Require.create( lhs.getString(), Import.builder() .moduleRequest(namespace) .localName(lhs.getString()) .importName(Export.NAMESPACE) .importNode(nameDeclaration) .nameNode(lhs) .build(), requireKind)); } else { // const {x, y} = goog.require('modA'); Node objectPattern = nameDeclaration.getFirstFirstChild(); if (!objectPattern.isObjectPattern()) { // bad JS, ignore return ImmutableList.of(); } return getAllRequiresFromDestructuring(objectPattern, namespace); } }
[ "private", "ImmutableList", "<", "Require", ">", "getAllRequiresInDeclaration", "(", ")", "{", "Node", "rhs", "=", "nameDeclaration", ".", "getFirstChild", "(", ")", ".", "isDestructuringLhs", "(", ")", "?", "nameDeclaration", ".", "getFirstChild", "(", ")", "."...
Returns a new list of all required names in {@link #nameDeclaration}
[ "Returns", "a", "new", "list", "of", "all", "required", "names", "in", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/modules/ClosureRequireProcessor.java#L112-L143
stanfy/goro
goro/src/main/java/com/stanfy/enroscar/goro/GoroService.java
GoroService.foregroundTaskIntent
public static <T extends Callable<?> & Parcelable> Intent foregroundTaskIntent(final Context context, final T task, final int notificationId, final Notification notification) { return foregroundTaskIntent(context, Goro.DEFAULT_QUEUE, task, notificationId, notification); }
java
public static <T extends Callable<?> & Parcelable> Intent foregroundTaskIntent(final Context context, final T task, final int notificationId, final Notification notification) { return foregroundTaskIntent(context, Goro.DEFAULT_QUEUE, task, notificationId, notification); }
[ "public", "static", "<", "T", "extends", "Callable", "<", "?", ">", "&", "Parcelable", ">", "Intent", "foregroundTaskIntent", "(", "final", "Context", "context", ",", "final", "T", "task", ",", "final", "int", "notificationId", ",", "final", "Notification", ...
Create an intent that contains a task that should be scheduled on a defined queue. The Service will run in the foreground and display notification. Intent can be used as an argument for {@link android.content.Context#startService(android.content.Intent)} or {@link android.content.Context#startForegroundService(Intent)} @param context context instance @param task task instance @param <T> task type @param notificationId id of notification for foreground Service, must not be 0 @param notification notification for foreground Service, should be not null to start service in the foreground
[ "Create", "an", "intent", "that", "contains", "a", "task", "that", "should", "be", "scheduled", "on", "a", "defined", "queue", ".", "The", "Service", "will", "run", "in", "the", "foreground", "and", "display", "notification", ".", "Intent", "can", "be", "u...
train
https://github.com/stanfy/goro/blob/6618e63a926833d61f492ec611ee77668d756820/goro/src/main/java/com/stanfy/enroscar/goro/GoroService.java#L160-L165
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/TemplatesApi.java
TemplatesApi.updateDocuments
public TemplateDocumentsResult updateDocuments(String accountId, String templateId, EnvelopeDefinition envelopeDefinition) throws ApiException { return updateDocuments(accountId, templateId, envelopeDefinition, null); }
java
public TemplateDocumentsResult updateDocuments(String accountId, String templateId, EnvelopeDefinition envelopeDefinition) throws ApiException { return updateDocuments(accountId, templateId, envelopeDefinition, null); }
[ "public", "TemplateDocumentsResult", "updateDocuments", "(", "String", "accountId", ",", "String", "templateId", ",", "EnvelopeDefinition", "envelopeDefinition", ")", "throws", "ApiException", "{", "return", "updateDocuments", "(", "accountId", ",", "templateId", ",", "...
Adds documents to a template document. Adds one or more documents to an existing template document. @param accountId The external account number (int) or account ID Guid. (required) @param templateId The ID of the template being accessed. (required) @param envelopeDefinition (optional) @return TemplateDocumentsResult
[ "Adds", "documents", "to", "a", "template", "document", ".", "Adds", "one", "or", "more", "documents", "to", "an", "existing", "template", "document", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L3114-L3116
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/SortedLists.java
SortedLists.binarySearch
public static <E extends Comparable> int binarySearch( List<? extends E> list, E e, KeyPresentBehavior presentBehavior, KeyAbsentBehavior absentBehavior) { checkNotNull(e); return binarySearch(list, e, Ordering.natural(), presentBehavior, absentBehavior); }
java
public static <E extends Comparable> int binarySearch( List<? extends E> list, E e, KeyPresentBehavior presentBehavior, KeyAbsentBehavior absentBehavior) { checkNotNull(e); return binarySearch(list, e, Ordering.natural(), presentBehavior, absentBehavior); }
[ "public", "static", "<", "E", "extends", "Comparable", ">", "int", "binarySearch", "(", "List", "<", "?", "extends", "E", ">", "list", ",", "E", "e", ",", "KeyPresentBehavior", "presentBehavior", ",", "KeyAbsentBehavior", "absentBehavior", ")", "{", "checkNotN...
Searches the specified naturally ordered list for the specified object using the binary search algorithm. <p>Equivalent to {@link #binarySearch(List, Function, Object, Comparator, KeyPresentBehavior, KeyAbsentBehavior)} using {@link Ordering#natural}.
[ "Searches", "the", "specified", "naturally", "ordered", "list", "for", "the", "specified", "object", "using", "the", "binary", "search", "algorithm", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/SortedLists.java#L188-L195
vst/commons-math-extensions
src/main/java/com/vsthost/rnd/commons/math/ext/linear/DMatrixUtils.java
DMatrixUtils.roundUpTo
public static BigDecimal roundUpTo(double value, double steps) { final BigDecimal bValue = BigDecimal.valueOf(value); final BigDecimal bSteps = BigDecimal.valueOf(steps); if (Objects.equals(bSteps, BigDecimal.ZERO)) { return bValue; } else { return bValue.divide(bSteps, 0, RoundingMode.CEILING).multiply(bSteps); } }
java
public static BigDecimal roundUpTo(double value, double steps) { final BigDecimal bValue = BigDecimal.valueOf(value); final BigDecimal bSteps = BigDecimal.valueOf(steps); if (Objects.equals(bSteps, BigDecimal.ZERO)) { return bValue; } else { return bValue.divide(bSteps, 0, RoundingMode.CEILING).multiply(bSteps); } }
[ "public", "static", "BigDecimal", "roundUpTo", "(", "double", "value", ",", "double", "steps", ")", "{", "final", "BigDecimal", "bValue", "=", "BigDecimal", ".", "valueOf", "(", "value", ")", ";", "final", "BigDecimal", "bSteps", "=", "BigDecimal", ".", "val...
Returns the UP rounded value of the given value for the given steps. @param value The original value to be rounded. @param steps The steps. @return The UP rounded value of the given value for the given steps.
[ "Returns", "the", "UP", "rounded", "value", "of", "the", "given", "value", "for", "the", "given", "steps", "." ]
train
https://github.com/vst/commons-math-extensions/blob/a11ee78ffe53ab7c016062be93c5af07aa8e1823/src/main/java/com/vsthost/rnd/commons/math/ext/linear/DMatrixUtils.java#L329-L338
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspInstanceDateBean.java
CmsJspInstanceDateBean.adjustForWholeDay
private Date adjustForWholeDay(Date date, boolean isEnd) { Calendar result = new GregorianCalendar(); result.setTime(date); result.set(Calendar.HOUR_OF_DAY, 0); result.set(Calendar.MINUTE, 0); result.set(Calendar.SECOND, 0); result.set(Calendar.MILLISECOND, 0); if (isEnd) { result.add(Calendar.DATE, 1); } return result.getTime(); }
java
private Date adjustForWholeDay(Date date, boolean isEnd) { Calendar result = new GregorianCalendar(); result.setTime(date); result.set(Calendar.HOUR_OF_DAY, 0); result.set(Calendar.MINUTE, 0); result.set(Calendar.SECOND, 0); result.set(Calendar.MILLISECOND, 0); if (isEnd) { result.add(Calendar.DATE, 1); } return result.getTime(); }
[ "private", "Date", "adjustForWholeDay", "(", "Date", "date", ",", "boolean", "isEnd", ")", "{", "Calendar", "result", "=", "new", "GregorianCalendar", "(", ")", ";", "result", ".", "setTime", "(", "date", ")", ";", "result", ".", "set", "(", "Calendar", ...
Adjust the date according to the whole day options. @param date the date to adjust. @param isEnd flag, indicating if the date is the end of the event (in contrast to the beginning) @return the adjusted date, which will be exactly the beginning or the end of the provide date's day.
[ "Adjust", "the", "date", "according", "to", "the", "whole", "day", "options", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspInstanceDateBean.java#L428-L441
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateCertificatePolicyAsync
public ServiceFuture<CertificatePolicy> updateCertificatePolicyAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy, final ServiceCallback<CertificatePolicy> serviceCallback) { return ServiceFuture.fromResponse(updateCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy), serviceCallback); }
java
public ServiceFuture<CertificatePolicy> updateCertificatePolicyAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy, final ServiceCallback<CertificatePolicy> serviceCallback) { return ServiceFuture.fromResponse(updateCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy), serviceCallback); }
[ "public", "ServiceFuture", "<", "CertificatePolicy", ">", "updateCertificatePolicyAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "CertificatePolicy", "certificatePolicy", ",", "final", "ServiceCallback", "<", "CertificatePolicy", ">", "service...
Updates the policy for a certificate. Set specified members in the certificate policy. Leave others as null. This operation requires the certificates/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate in the given vault. @param certificatePolicy The policy for the certificate. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Updates", "the", "policy", "for", "a", "certificate", ".", "Set", "specified", "members", "in", "the", "certificate", "policy", ".", "Leave", "others", "as", "null", ".", "This", "operation", "requires", "the", "certificates", "/", "update", "permission", "."...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7256-L7258
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/internal/BcUtils.java
BcUtils.getSubjectPublicKeyInfo
public static SubjectPublicKeyInfo getSubjectPublicKeyInfo(PublicKeyParameters publicKey) { try { if (publicKey instanceof BcPublicKeyParameters) { return ((BcPublicKeyParameters) publicKey).getSubjectPublicKeyInfo(); } else { return SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(getAsymmetricKeyParameter(publicKey)); } } catch (IOException e) { // Very unlikely throw new IllegalArgumentException("Invalid public key, unable to get subject info."); } }
java
public static SubjectPublicKeyInfo getSubjectPublicKeyInfo(PublicKeyParameters publicKey) { try { if (publicKey instanceof BcPublicKeyParameters) { return ((BcPublicKeyParameters) publicKey).getSubjectPublicKeyInfo(); } else { return SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(getAsymmetricKeyParameter(publicKey)); } } catch (IOException e) { // Very unlikely throw new IllegalArgumentException("Invalid public key, unable to get subject info."); } }
[ "public", "static", "SubjectPublicKeyInfo", "getSubjectPublicKeyInfo", "(", "PublicKeyParameters", "publicKey", ")", "{", "try", "{", "if", "(", "publicKey", "instanceof", "BcPublicKeyParameters", ")", "{", "return", "(", "(", "BcPublicKeyParameters", ")", "publicKey", ...
Convert public key parameter to subject public key info. @param publicKey the public key to convert. @return a subject public key info.
[ "Convert", "public", "key", "parameter", "to", "subject", "public", "key", "info", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/internal/BcUtils.java#L110-L122
geomajas/geomajas-project-client-gwt
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/MultiFeatureListGrid.java
MultiFeatureListGrid.addButton
@Api public void addButton(String layerId, ToolStripButton button, int position) { extraButtons.add(new ExtraButton(constructIdSaveLayerId(layerId), button, position)); }
java
@Api public void addButton(String layerId, ToolStripButton button, int position) { extraButtons.add(new ExtraButton(constructIdSaveLayerId(layerId), button, position)); }
[ "@", "Api", "public", "void", "addButton", "(", "String", "layerId", ",", "ToolStripButton", "button", ",", "int", "position", ")", "{", "extraButtons", ".", "add", "(", "new", "ExtraButton", "(", "constructIdSaveLayerId", "(", "layerId", ")", ",", "button", ...
Add a button in the tool strip at the requested position. @param layerId layer which needs the extra button @param button button to add @param position position
[ "Add", "a", "button", "in", "the", "tool", "strip", "at", "the", "requested", "position", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/MultiFeatureListGrid.java#L203-L206
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/Ray.java
Ray.getPointAt
public Point getPointAt(double t) { if (Double.isNaN(t)) return null; return new Point(origin.x + t * direction.x, origin.y + t * direction.y, origin.z + t * direction.z); }
java
public Point getPointAt(double t) { if (Double.isNaN(t)) return null; return new Point(origin.x + t * direction.x, origin.y + t * direction.y, origin.z + t * direction.z); }
[ "public", "Point", "getPointAt", "(", "double", "t", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "t", ")", ")", "return", "null", ";", "return", "new", "Point", "(", "origin", ".", "x", "+", "t", "*", "direction", ".", "x", ",", "origin", "...
Gets the {@link Point} at the specified distance. @param t the distance @return the point at the distance t
[ "Gets", "the", "{", "@link", "Point", "}", "at", "the", "specified", "distance", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/Ray.java#L89-L94
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
SynchronousRequest.getWvWMatchInfo
public List<? extends WvWMatch> getWvWMatchInfo(String[] ids, WvWMatch.Endpoint type) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); if (type == null) return getWvWMatchInfoUsingID(ids); try { switch (type) { case All: return getWvWMatchInfoUsingID(ids); case Overview: Response<List<WvWMatchOverview>> overview = gw2API.getWvWMatchOverviewUsingID(processIds(ids)).execute(); if (!overview.isSuccessful()) throwError(overview.code(), overview.errorBody()); return overview.body(); case Score: Response<List<WvWMatchScore>> stat = gw2API.getWvWMatchScoreUsingID(processIds(ids)).execute(); if (!stat.isSuccessful()) throwError(stat.code(), stat.errorBody()); return stat.body(); case Stat: Response<List<WvWMatchStat>> score = gw2API.getWvWMatchStatUsingID(processIds(ids)).execute(); if (!score.isSuccessful()) throwError(score.code(), score.errorBody()); return score.body(); default: return getWvWMatchInfoUsingID(ids); } } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
java
public List<? extends WvWMatch> getWvWMatchInfo(String[] ids, WvWMatch.Endpoint type) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); if (type == null) return getWvWMatchInfoUsingID(ids); try { switch (type) { case All: return getWvWMatchInfoUsingID(ids); case Overview: Response<List<WvWMatchOverview>> overview = gw2API.getWvWMatchOverviewUsingID(processIds(ids)).execute(); if (!overview.isSuccessful()) throwError(overview.code(), overview.errorBody()); return overview.body(); case Score: Response<List<WvWMatchScore>> stat = gw2API.getWvWMatchScoreUsingID(processIds(ids)).execute(); if (!stat.isSuccessful()) throwError(stat.code(), stat.errorBody()); return stat.body(); case Stat: Response<List<WvWMatchStat>> score = gw2API.getWvWMatchStatUsingID(processIds(ids)).execute(); if (!score.isSuccessful()) throwError(score.code(), score.errorBody()); return score.body(); default: return getWvWMatchInfoUsingID(ids); } } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
[ "public", "List", "<", "?", "extends", "WvWMatch", ">", "getWvWMatchInfo", "(", "String", "[", "]", "ids", ",", "WvWMatch", ".", "Endpoint", "type", ")", "throws", "GuildWars2Exception", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ...
For more info on WvW matches API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/matches">here</a><br/> Get wvw match info using wvw match id(s) @param ids list of wvw match id(s) @param type endpoint type @return list of wvw match info, exact class depend on endpoint type @throws GuildWars2Exception see {@link ErrorCode} for detail @see WvWMatch wvw match info
[ "For", "more", "info", "on", "WvW", "matches", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "wvw", "/", "matches", ">", "here<", "/", "a", ">", "<br", "/", ">...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L3572-L3597
lucee/Lucee
core/src/main/java/lucee/runtime/op/Elvis.java
Elvis.operate
public static boolean operate(PageContext pc, String[] varNames) { int scope = VariableInterpreter.scopeString2Int(pc.ignoreScopes(), varNames[0]); return _operate(pc, scope, KeyImpl.toKeyArray(varNames), scope == Scope.SCOPE_UNDEFINED ? 0 : 1); }
java
public static boolean operate(PageContext pc, String[] varNames) { int scope = VariableInterpreter.scopeString2Int(pc.ignoreScopes(), varNames[0]); return _operate(pc, scope, KeyImpl.toKeyArray(varNames), scope == Scope.SCOPE_UNDEFINED ? 0 : 1); }
[ "public", "static", "boolean", "operate", "(", "PageContext", "pc", ",", "String", "[", "]", "varNames", ")", "{", "int", "scope", "=", "VariableInterpreter", ".", "scopeString2Int", "(", "pc", ".", "ignoreScopes", "(", ")", ",", "varNames", "[", "0", "]",...
called by the Elvis operator from the interpreter @param pc @param scope @param varNames @return
[ "called", "by", "the", "Elvis", "operator", "from", "the", "interpreter" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Elvis.java#L63-L66
Stratio/bdt
src/main/java/com/stratio/qa/specs/SeleniumSpec.java
SeleniumSpec.assertSeleniumHasAttributeValue
@Then("^the element on index '(\\d+?)' has '(.+?)' as '(.+?)'$") public void assertSeleniumHasAttributeValue(Integer index, String attribute, String value) { assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); String val = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getAttribute(attribute); assertThat(this.commonspec, val).as("Attribute not found").isNotNull(); assertThat(this.commonspec, val).as("Unexpected value for specified attribute").matches(value); }
java
@Then("^the element on index '(\\d+?)' has '(.+?)' as '(.+?)'$") public void assertSeleniumHasAttributeValue(Integer index, String attribute, String value) { assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); String val = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getAttribute(attribute); assertThat(this.commonspec, val).as("Attribute not found").isNotNull(); assertThat(this.commonspec, val).as("Unexpected value for specified attribute").matches(value); }
[ "@", "Then", "(", "\"^the element on index '(\\\\d+?)' has '(.+?)' as '(.+?)'$\"", ")", "public", "void", "assertSeleniumHasAttributeValue", "(", "Integer", "index", ",", "String", "attribute", ",", "String", "value", ")", "{", "assertThat", "(", "this", ".", "commonspe...
Verifies that a webelement previously found has {@code attribute} with {@code value} (as a regexp) @param index @param attribute @param value
[ "Verifies", "that", "a", "webelement", "previously", "found", "has", "{", "@code", "attribute", "}", "with", "{", "@code", "value", "}", "(", "as", "a", "regexp", ")" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L527-L534
amlinv/registry-utils
src/main/java/com/amlinv/registry/util/listener/SimpleSynchronousNotificationExecutor.java
SimpleSynchronousNotificationExecutor.fireRemoveNotification
public void fireRemoveNotification (Iterator<RegistryListener<K, V>> listeners, K removeKey, V removeValue) { while ( listeners.hasNext() ) { listeners.next().onRemoveEntry(removeKey, removeValue); } }
java
public void fireRemoveNotification (Iterator<RegistryListener<K, V>> listeners, K removeKey, V removeValue) { while ( listeners.hasNext() ) { listeners.next().onRemoveEntry(removeKey, removeValue); } }
[ "public", "void", "fireRemoveNotification", "(", "Iterator", "<", "RegistryListener", "<", "K", ",", "V", ">", ">", "listeners", ",", "K", "removeKey", ",", "V", "removeValue", ")", "{", "while", "(", "listeners", ".", "hasNext", "(", ")", ")", "{", "lis...
Fire notification of an entry that was just removed from the registry. @param removeKey key identifying the entry removed from the registry. @param removeValue value of the entry in the registry.
[ "Fire", "notification", "of", "an", "entry", "that", "was", "just", "removed", "from", "the", "registry", "." ]
train
https://github.com/amlinv/registry-utils/blob/784c455be38acb0df3a35c38afe60a516b8e4f32/src/main/java/com/amlinv/registry/util/listener/SimpleSynchronousNotificationExecutor.java#L51-L55
elki-project/elki
elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/LogPane.java
LogPane.publish
public void publish(String message, Level level) { try { publish(new LogRecord(level, message)); } catch(BadLocationException e) { throw new RuntimeException("Error writing a log-like message.", e); } }
java
public void publish(String message, Level level) { try { publish(new LogRecord(level, message)); } catch(BadLocationException e) { throw new RuntimeException("Error writing a log-like message.", e); } }
[ "public", "void", "publish", "(", "String", "message", ",", "Level", "level", ")", "{", "try", "{", "publish", "(", "new", "LogRecord", "(", "level", ",", "message", ")", ")", ";", "}", "catch", "(", "BadLocationException", "e", ")", "{", "throw", "new...
Print a message as if it were logged, without going through the full logger. @param message Message text @param level Message level
[ "Print", "a", "message", "as", "if", "it", "were", "logged", "without", "going", "through", "the", "full", "logger", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/LogPane.java#L125-L132
alkacon/opencms-core
src/org/opencms/db/generic/CmsUserQueryBuilder.java
CmsUserQueryBuilder.getSortExpression
protected String getSortExpression(TableAlias users, CmsUserSearchParameters searchParams) { SortKey sortKey = searchParams.getSortKey(); String ordering = users.column(colId()); if (sortKey != null) { switch (sortKey) { case email: ordering = users.column(colEmail()); break; case loginName: ordering = users.column(colName()); break; case fullName: ordering = getUserFullNameExpression(users); break; case lastLogin: ordering = users.column(colLastLogin()); break; case orgUnit: ordering = users.column(colOu()); break; case activated: ordering = getUserActivatedExpression(users); break; case flagStatus: ordering = getUserFlagExpression(users, searchParams.getSortFlags()); break; default: break; } } return ordering; }
java
protected String getSortExpression(TableAlias users, CmsUserSearchParameters searchParams) { SortKey sortKey = searchParams.getSortKey(); String ordering = users.column(colId()); if (sortKey != null) { switch (sortKey) { case email: ordering = users.column(colEmail()); break; case loginName: ordering = users.column(colName()); break; case fullName: ordering = getUserFullNameExpression(users); break; case lastLogin: ordering = users.column(colLastLogin()); break; case orgUnit: ordering = users.column(colOu()); break; case activated: ordering = getUserActivatedExpression(users); break; case flagStatus: ordering = getUserFlagExpression(users, searchParams.getSortFlags()); break; default: break; } } return ordering; }
[ "protected", "String", "getSortExpression", "(", "TableAlias", "users", ",", "CmsUserSearchParameters", "searchParams", ")", "{", "SortKey", "sortKey", "=", "searchParams", ".", "getSortKey", "(", ")", ";", "String", "ordering", "=", "users", ".", "column", "(", ...
Returns the expression used for sorting the results.<p> @param users the user table alias @param searchParams the search parameters @return the sorting expressiong
[ "Returns", "the", "expression", "used", "for", "sorting", "the", "results", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserQueryBuilder.java#L567-L600
jboss/jboss-jstl-api_spec
src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java
ExpressionEvaluatorManager.getEvaluatorByName
@Deprecated public static ExpressionEvaluator getEvaluatorByName(String name) throws JspException { try { ExpressionEvaluator evaluator = nameMap.get(name); if (evaluator == null) { nameMap.putIfAbsent(name, (ExpressionEvaluator) Class.forName(name).newInstance()); evaluator = nameMap.get(name); } return evaluator; } catch (ClassCastException ex) { // just to display a better error message throw new JspException("invalid ExpressionEvaluator: " + name, ex); } catch (ClassNotFoundException ex) { throw new JspException("couldn't find ExpressionEvaluator: " + name, ex); } catch (IllegalAccessException ex) { throw new JspException("couldn't access ExpressionEvaluator: " + name, ex); } catch (InstantiationException ex) { throw new JspException("couldn't instantiate ExpressionEvaluator: " + name, ex); } }
java
@Deprecated public static ExpressionEvaluator getEvaluatorByName(String name) throws JspException { try { ExpressionEvaluator evaluator = nameMap.get(name); if (evaluator == null) { nameMap.putIfAbsent(name, (ExpressionEvaluator) Class.forName(name).newInstance()); evaluator = nameMap.get(name); } return evaluator; } catch (ClassCastException ex) { // just to display a better error message throw new JspException("invalid ExpressionEvaluator: " + name, ex); } catch (ClassNotFoundException ex) { throw new JspException("couldn't find ExpressionEvaluator: " + name, ex); } catch (IllegalAccessException ex) { throw new JspException("couldn't access ExpressionEvaluator: " + name, ex); } catch (InstantiationException ex) { throw new JspException("couldn't instantiate ExpressionEvaluator: " + name, ex); } }
[ "@", "Deprecated", "public", "static", "ExpressionEvaluator", "getEvaluatorByName", "(", "String", "name", ")", "throws", "JspException", "{", "try", "{", "ExpressionEvaluator", "evaluator", "=", "nameMap", ".", "get", "(", "name", ")", ";", "if", "(", "evaluato...
Gets an ExpressionEvaluator from the cache, or seeds the cache if we haven't seen a particular ExpressionEvaluator before.
[ "Gets", "an", "ExpressionEvaluator", "from", "the", "cache", "or", "seeds", "the", "cache", "if", "we", "haven", "t", "seen", "a", "particular", "ExpressionEvaluator", "before", "." ]
train
https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java#L91-L110
graknlabs/grakn
server/src/server/exception/TransactionException.java
TransactionException.duplicateHas
public static TransactionException duplicateHas(Type type, AttributeType attributeType) { return create(ErrorMessage.CANNOT_BE_KEY_AND_ATTRIBUTE.getMessage(type.label(), attributeType.label())); }
java
public static TransactionException duplicateHas(Type type, AttributeType attributeType) { return create(ErrorMessage.CANNOT_BE_KEY_AND_ATTRIBUTE.getMessage(type.label(), attributeType.label())); }
[ "public", "static", "TransactionException", "duplicateHas", "(", "Type", "type", ",", "AttributeType", "attributeType", ")", "{", "return", "create", "(", "ErrorMessage", ".", "CANNOT_BE_KEY_AND_ATTRIBUTE", ".", "getMessage", "(", "type", ".", "label", "(", ")", "...
Thrown when {@code type} has {@code attributeType} as a Type#key(AttributeType) and a Type#has(AttributeType)
[ "Thrown", "when", "{" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L115-L117
Jsondb/jsondb-core
src/main/java/io/jsondb/crypto/CryptoUtil.java
CryptoUtil.decryptFields
public static void decryptFields(Object object, CollectionMetaData cmd, ICipher cipher) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { for (String secretAnnotatedFieldName: cmd.getSecretAnnotatedFieldNames()) { Method getterMethod = cmd.getGetterMethodForFieldName(secretAnnotatedFieldName); Method setterMethod = cmd.getSetterMethodForFieldName(secretAnnotatedFieldName); String value; String decryptedValue = null; try { value = (String)getterMethod.invoke(object); if (null != value) { decryptedValue = cipher.decrypt(value); setterMethod.invoke(object, decryptedValue); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error("Error when invoking method for a @Secret annotated field", e); throw e; } } }
java
public static void decryptFields(Object object, CollectionMetaData cmd, ICipher cipher) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { for (String secretAnnotatedFieldName: cmd.getSecretAnnotatedFieldNames()) { Method getterMethod = cmd.getGetterMethodForFieldName(secretAnnotatedFieldName); Method setterMethod = cmd.getSetterMethodForFieldName(secretAnnotatedFieldName); String value; String decryptedValue = null; try { value = (String)getterMethod.invoke(object); if (null != value) { decryptedValue = cipher.decrypt(value); setterMethod.invoke(object, decryptedValue); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error("Error when invoking method for a @Secret annotated field", e); throw e; } } }
[ "public", "static", "void", "decryptFields", "(", "Object", "object", ",", "CollectionMetaData", "cmd", ",", "ICipher", "cipher", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", "{", "for", "(", "String", "se...
A utility method to decrypt the value of field marked by the @Secret annotation using its setter/mutator method. @param object the actual Object representing the POJO we want the Id of. @param cmd the CollectionMetaData object from which we can obtain the list containing names of fields which have the @Secret annotation @param cipher the actual cipher implementation to use @throws IllegalAccessException Error when invoking method for a @Secret annotated field due to permissions @throws IllegalArgumentException Error when invoking method for a @Secret annotated field due to wrong arguments @throws InvocationTargetException Error when invoking method for a @Secret annotated field, the method threw a exception
[ "A", "utility", "method", "to", "decrypt", "the", "value", "of", "field", "marked", "by", "the" ]
train
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/crypto/CryptoUtil.java#L90-L110
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.unescapeUriPath
public static void unescapeUriPath(final String text, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.unescape(new InternalStringReader(text), writer, UriEscapeUtil.UriEscapeType.PATH, encoding); }
java
public static void unescapeUriPath(final String text, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.unescape(new InternalStringReader(text), writer, UriEscapeUtil.UriEscapeType.PATH, encoding); }
[ "public", "static", "void", "unescapeUriPath", "(", "final", "String", "text", ",", "final", "Writer", "writer", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgum...
<p> Perform am URI path <strong>unescape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use the specified <tt>encoding</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param encoding the encoding to be used for unescaping. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "path", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1835-L1848
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/system/systemmemory_stats.java
systemmemory_stats.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { systemmemory_stats[] resources = new systemmemory_stats[1]; systemmemory_response result = (systemmemory_response) service.get_payload_formatter().string_to_resource(systemmemory_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.systemmemory; return resources; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { systemmemory_stats[] resources = new systemmemory_stats[1]; systemmemory_response result = (systemmemory_response) service.get_payload_formatter().string_to_resource(systemmemory_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.systemmemory; return resources; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "systemmemory_stats", "[", "]", "resources", "=", "new", "systemmemory_stats", "[", "1", "]", ";", "systemmem...
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/system/systemmemory_stats.java#L160-L179
igniterealtime/Smack
smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java
AgentSession.getGenericSettings
public GenericSettings getGenericSettings(XMPPConnection con, String query) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { GenericSettings setting = new GenericSettings(); setting.setType(IQ.Type.get); setting.setTo(workgroupJID); GenericSettings response = connection.createStanzaCollectorAndSend( setting).nextResultOrThrow(); return response; }
java
public GenericSettings getGenericSettings(XMPPConnection con, String query) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { GenericSettings setting = new GenericSettings(); setting.setType(IQ.Type.get); setting.setTo(workgroupJID); GenericSettings response = connection.createStanzaCollectorAndSend( setting).nextResultOrThrow(); return response; }
[ "public", "GenericSettings", "getGenericSettings", "(", "XMPPConnection", "con", ",", "String", "query", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "GenericSettings", "setting", "=", "ne...
Returns the generic metadata of the workgroup the agent belongs to. @param con the XMPPConnection to use. @param query an optional query object used to tell the server what metadata to retrieve. This can be null. @return the settings for the workgroup. @throws XMPPErrorException if an error occurs while sending the request to the server. @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Returns", "the", "generic", "metadata", "of", "the", "workgroup", "the", "agent", "belongs", "to", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L1078-L1086
wisdom-framework/wisdom
core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java
JacksonSingleton.fromXML
@Override public <A> A fromXML(String xml, Class<A> clazz) { try { return xmlMapper().readValue(xml, clazz); } catch (IOException e) { throw new RuntimeException(e); } }
java
@Override public <A> A fromXML(String xml, Class<A> clazz) { try { return xmlMapper().readValue(xml, clazz); } catch (IOException e) { throw new RuntimeException(e); } }
[ "@", "Override", "public", "<", "A", ">", "A", "fromXML", "(", "String", "xml", ",", "Class", "<", "A", ">", "clazz", ")", "{", "try", "{", "return", "xmlMapper", "(", ")", ".", "readValue", "(", "xml", ",", "clazz", ")", ";", "}", "catch", "(", ...
Builds a new instance of the given class <em>clazz</em> from the given XML string. @param xml the XML string @param clazz the class of the instance to construct @return an instance of the class.
[ "Builds", "a", "new", "instance", "of", "the", "given", "class", "<em", ">", "clazz<", "/", "em", ">", "from", "the", "given", "XML", "string", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L515-L522
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/format/util/sql/SQLStringMatcher.java
SQLStringMatcher.getSQLCondition
public StringBuilder getSQLCondition(StringBuilder builder, String columnName) { String string = networkString.getString(); if(isEntireAddress) { matchString(builder, columnName, string); } else { matchSubString( builder, columnName, networkString.getTrailingSegmentSeparator(), networkString.getTrailingSeparatorCount() + 1, string); } return builder; }
java
public StringBuilder getSQLCondition(StringBuilder builder, String columnName) { String string = networkString.getString(); if(isEntireAddress) { matchString(builder, columnName, string); } else { matchSubString( builder, columnName, networkString.getTrailingSegmentSeparator(), networkString.getTrailingSeparatorCount() + 1, string); } return builder; }
[ "public", "StringBuilder", "getSQLCondition", "(", "StringBuilder", "builder", ",", "String", "columnName", ")", "{", "String", "string", "=", "networkString", ".", "getString", "(", ")", ";", "if", "(", "isEntireAddress", ")", "{", "matchString", "(", "builder"...
Get an SQL condition to match this address section representation @param builder @param columnName @return the condition
[ "Get", "an", "SQL", "condition", "to", "match", "this", "address", "section", "representation" ]
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/util/sql/SQLStringMatcher.java#L53-L66
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setNumber
public void setNumber(int index, Number value) { set(selectField(ResourceFieldLists.CUSTOM_NUMBER, index), value); }
java
public void setNumber(int index, Number value) { set(selectField(ResourceFieldLists.CUSTOM_NUMBER, index), value); }
[ "public", "void", "setNumber", "(", "int", "index", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "CUSTOM_NUMBER", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a number value. @param index number index (1-20) @param value number value
[ "Set", "a", "number", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1639-L1642
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/process/PTBTokenizer.java
PTBTokenizer.ptb2Text
public static int ptb2Text(Reader ptbText, Writer w) throws IOException { int numTokens = 0; PTB2TextLexer lexer = new PTB2TextLexer(ptbText); for (String token; (token = lexer.next()) != null; ) { numTokens++; w.write(token); } return numTokens; }
java
public static int ptb2Text(Reader ptbText, Writer w) throws IOException { int numTokens = 0; PTB2TextLexer lexer = new PTB2TextLexer(ptbText); for (String token; (token = lexer.next()) != null; ) { numTokens++; w.write(token); } return numTokens; }
[ "public", "static", "int", "ptb2Text", "(", "Reader", "ptbText", ",", "Writer", "w", ")", "throws", "IOException", "{", "int", "numTokens", "=", "0", ";", "PTB2TextLexer", "lexer", "=", "new", "PTB2TextLexer", "(", "ptbText", ")", ";", "for", "(", "String"...
Writes a presentable version of the given PTB-tokenized text. PTB tokenization splits up punctuation and does various other things that makes simply joining the tokens with spaces look bad. So join the tokens with space and run it through this method to produce nice looking text. It's not perfect, but it works pretty well.
[ "Writes", "a", "presentable", "version", "of", "the", "given", "PTB", "-", "tokenized", "text", ".", "PTB", "tokenization", "splits", "up", "punctuation", "and", "does", "various", "other", "things", "that", "makes", "simply", "joining", "the", "tokens", "with...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/process/PTBTokenizer.java#L335-L343
OpenTSDB/opentsdb
src/core/Internal.java
Internal.setBaseTime
public static void setBaseTime(final byte[] row, int base_time) { Bytes.setInt(row, base_time, Const.SALT_WIDTH() + TSDB.metrics_width()); }
java
public static void setBaseTime(final byte[] row, int base_time) { Bytes.setInt(row, base_time, Const.SALT_WIDTH() + TSDB.metrics_width()); }
[ "public", "static", "void", "setBaseTime", "(", "final", "byte", "[", "]", "row", ",", "int", "base_time", ")", "{", "Bytes", ".", "setInt", "(", "row", ",", "base_time", ",", "Const", ".", "SALT_WIDTH", "(", ")", "+", "TSDB", ".", "metrics_width", "("...
Sets the time in a raw data table row key @param row The row to modify @param base_time The base time to store @since 2.3
[ "Sets", "the", "time", "in", "a", "raw", "data", "table", "row", "key" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L146-L149
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java
TenantService.isValidSystemCredentials
private boolean isValidSystemCredentials(String userid, String password) { String superUser = ServerParams.instance().getModuleParamString("DoradusServer", "super_user"); String superPassword = ServerParams.instance().getModuleParamString("DoradusServer", "super_password"); return Utils.isEmpty(superUser) || Utils.isEmpty(superPassword) || (superUser.equals(userid) && superPassword.equals(password)); }
java
private boolean isValidSystemCredentials(String userid, String password) { String superUser = ServerParams.instance().getModuleParamString("DoradusServer", "super_user"); String superPassword = ServerParams.instance().getModuleParamString("DoradusServer", "super_password"); return Utils.isEmpty(superUser) || Utils.isEmpty(superPassword) || (superUser.equals(userid) && superPassword.equals(password)); }
[ "private", "boolean", "isValidSystemCredentials", "(", "String", "userid", ",", "String", "password", ")", "{", "String", "superUser", "=", "ServerParams", ".", "instance", "(", ")", ".", "getModuleParamString", "(", "\"DoradusServer\"", ",", "\"super_user\"", ")", ...
Return true if the given userid/password are valid system credentials.
[ "Return", "true", "if", "the", "given", "userid", "/", "password", "are", "valid", "system", "credentials", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java#L511-L517
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java
AbstractNotification.setParam
public int setParam(String param, Object value) { int i = findParam(param); if (value == null && i < 0) { return i; } if (i < 0) { i = extraInfo.length; extraInfo = Arrays.copyOf(extraInfo, i + 1); } if (value == null) { extraInfo = (String[]) ArrayUtils.remove(extraInfo, i); } else { extraInfo[i] = param + "=" + value; } return i; }
java
public int setParam(String param, Object value) { int i = findParam(param); if (value == null && i < 0) { return i; } if (i < 0) { i = extraInfo.length; extraInfo = Arrays.copyOf(extraInfo, i + 1); } if (value == null) { extraInfo = (String[]) ArrayUtils.remove(extraInfo, i); } else { extraInfo[i] = param + "=" + value; } return i; }
[ "public", "int", "setParam", "(", "String", "param", ",", "Object", "value", ")", "{", "int", "i", "=", "findParam", "(", "param", ")", ";", "if", "(", "value", "==", "null", "&&", "i", "<", "0", ")", "{", "return", "i", ";", "}", "if", "(", "i...
Sets the value for a parameter in extra info. @param param Parameter name. @param value Parameter value (null to remove). @return Index of parameter in extra info.
[ "Sets", "the", "value", "for", "a", "parameter", "in", "extra", "info", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java#L274-L293
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.addRecord
public void addRecord(Record r, int section) { if (sections[section] == null) sections[section] = new LinkedList(); header.incCount(section); sections[section].add(r); }
java
public void addRecord(Record r, int section) { if (sections[section] == null) sections[section] = new LinkedList(); header.incCount(section); sections[section].add(r); }
[ "public", "void", "addRecord", "(", "Record", "r", ",", "int", "section", ")", "{", "if", "(", "sections", "[", "section", "]", "==", "null", ")", "sections", "[", "section", "]", "=", "new", "LinkedList", "(", ")", ";", "header", ".", "incCount", "(...
Adds a record to a section of the Message, and adjusts the header. @see Record @see Section
[ "Adds", "a", "record", "to", "a", "section", "of", "the", "Message", "and", "adjusts", "the", "header", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L171-L177
jfinal/jfinal
src/main/java/com/jfinal/token/TokenManager.java
TokenManager.createToken
public static void createToken(Controller controller, String tokenName, int secondsOfTimeOut) { if (tokenCache == null) { String tokenId = String.valueOf(random.nextLong()); controller.setAttr(tokenName, tokenId); controller.setSessionAttr(tokenName, tokenId); createTokenHiddenField(controller, tokenName, tokenId); } else { createTokenUseTokenIdGenerator(controller, tokenName, secondsOfTimeOut); } }
java
public static void createToken(Controller controller, String tokenName, int secondsOfTimeOut) { if (tokenCache == null) { String tokenId = String.valueOf(random.nextLong()); controller.setAttr(tokenName, tokenId); controller.setSessionAttr(tokenName, tokenId); createTokenHiddenField(controller, tokenName, tokenId); } else { createTokenUseTokenIdGenerator(controller, tokenName, secondsOfTimeOut); } }
[ "public", "static", "void", "createToken", "(", "Controller", "controller", ",", "String", "tokenName", ",", "int", "secondsOfTimeOut", ")", "{", "if", "(", "tokenCache", "==", "null", ")", "{", "String", "tokenId", "=", "String", ".", "valueOf", "(", "rando...
Create Token. @param Controller @param tokenName token name @param secondsOfTimeOut seconds of time out, for ITokenCache only.
[ "Create", "Token", "." ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/token/TokenManager.java#L59-L69
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.readLines
public static <T extends Collection<String>> T readLines(String path, Charset charset, T collection) throws IORuntimeException { return readLines(file(path), charset, collection); }
java
public static <T extends Collection<String>> T readLines(String path, Charset charset, T collection) throws IORuntimeException { return readLines(file(path), charset, collection); }
[ "public", "static", "<", "T", "extends", "Collection", "<", "String", ">", ">", "T", "readLines", "(", "String", "path", ",", "Charset", "charset", ",", "T", "collection", ")", "throws", "IORuntimeException", "{", "return", "readLines", "(", "file", "(", "...
从文件中读取每一行数据 @param <T> 集合类型 @param path 文件路径 @param charset 字符集 @param collection 集合 @return 文件中的每行内容的集合 @throws IORuntimeException IO异常
[ "从文件中读取每一行数据" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2192-L2194
axibase/atsd-api-java
src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java
AtsdPropertyExtractor.getAsLong
public long getAsLong(final String name, final long defaultValue) { return AtsdUtil.getPropertyLongValue(fullName(name), clientProperties, defaultValue); }
java
public long getAsLong(final String name, final long defaultValue) { return AtsdUtil.getPropertyLongValue(fullName(name), clientProperties, defaultValue); }
[ "public", "long", "getAsLong", "(", "final", "String", "name", ",", "final", "long", "defaultValue", ")", "{", "return", "AtsdUtil", ".", "getPropertyLongValue", "(", "fullName", "(", "name", ")", ",", "clientProperties", ",", "defaultValue", ")", ";", "}" ]
Get property by name as long value @param name name of property without the prefix. @param defaultValue default value for case when the property is not set. @return property's value.
[ "Get", "property", "by", "name", "as", "long", "value" ]
train
https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java#L23-L25
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureProjective.java
SceneStructureProjective.initialize
public void initialize( int totalViews , int totalPoints ) { views = new View[totalViews]; points = new Point[totalPoints]; for (int i = 0; i < views.length; i++) { views[i] = new View(); } for (int i = 0; i < points.length; i++) { points[i] = new Point(pointSize); } }
java
public void initialize( int totalViews , int totalPoints ) { views = new View[totalViews]; points = new Point[totalPoints]; for (int i = 0; i < views.length; i++) { views[i] = new View(); } for (int i = 0; i < points.length; i++) { points[i] = new Point(pointSize); } }
[ "public", "void", "initialize", "(", "int", "totalViews", ",", "int", "totalPoints", ")", "{", "views", "=", "new", "View", "[", "totalViews", "]", ";", "points", "=", "new", "Point", "[", "totalPoints", "]", ";", "for", "(", "int", "i", "=", "0", ";...
Call this function first. Specifies number of each type of data which is available. @param totalViews Number of views @param totalPoints Number of points
[ "Call", "this", "function", "first", ".", "Specifies", "number", "of", "each", "type", "of", "data", "which", "is", "available", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureProjective.java#L48-L58
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/CollectionUtils.java
CollectionUtils.addAll
public static <E, T extends Collection<E>> T addAll(T collection, Iterable<E> iterable) { Assert.notNull(collection, "Collection is required"); for (E element : nullSafeIterable(iterable)) { collection.add(element); } return collection; }
java
public static <E, T extends Collection<E>> T addAll(T collection, Iterable<E> iterable) { Assert.notNull(collection, "Collection is required"); for (E element : nullSafeIterable(iterable)) { collection.add(element); } return collection; }
[ "public", "static", "<", "E", ",", "T", "extends", "Collection", "<", "E", ">", ">", "T", "addAll", "(", "T", "collection", ",", "Iterable", "<", "E", ">", "iterable", ")", "{", "Assert", ".", "notNull", "(", "collection", ",", "\"Collection is required\...
Adds all elements from the given {@link Iterable} to the {@link Collection}. @param <E> {@link Class} type of the elements in the {@link Collection} and {@link Iterable}. @param <T> concrete {@link Class} type of the {@link Collection}. @param collection {@link Collection} in which to add the elements from the {@link Iterable}. @param iterable {@link Iterable} containing the elements to add to the {@link Collection}. @return the given {@link Collection}. @throws IllegalArgumentException if {@link Collection} is {@literal null}. @see java.lang.Iterable @see java.util.Collection
[ "Adds", "all", "elements", "from", "the", "given", "{", "@link", "Iterable", "}", "to", "the", "{", "@link", "Collection", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/CollectionUtils.java#L81-L90