repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
google/closure-templates
java/src/com/google/template/soy/internal/i18n/BidiFormatter.java
BidiFormatter.spanWrappingText
public BidiWrappingText spanWrappingText(@Nullable Dir dir, String str, boolean isHtml) { """ Operates like {@link #spanWrap(Dir, String, boolean)} but only returns the text that would be prepended and appended to {@code str}. @param dir {@code str}'s directionality. If null, i.e. unknown, it is estimated. @param str The input string @param isHtml Whether {@code str} is HTML / HTML-escaped """ if (dir == null) { dir = estimateDirection(str, isHtml); } StringBuilder beforeText = new StringBuilder(); StringBuilder afterText = new StringBuilder(); boolean dirCondition = (dir != Dir.NEUTRAL && dir != contextDir); if (dirCondition) { beforeText.append("<span dir=\"").append(dir == Dir.RTL ? "rtl" : "ltr").append("\">"); afterText.append("</span>"); } afterText.append(markAfter(dir, str, isHtml)); return BidiWrappingText.create(beforeText.toString(), afterText.toString()); }
java
public BidiWrappingText spanWrappingText(@Nullable Dir dir, String str, boolean isHtml) { if (dir == null) { dir = estimateDirection(str, isHtml); } StringBuilder beforeText = new StringBuilder(); StringBuilder afterText = new StringBuilder(); boolean dirCondition = (dir != Dir.NEUTRAL && dir != contextDir); if (dirCondition) { beforeText.append("<span dir=\"").append(dir == Dir.RTL ? "rtl" : "ltr").append("\">"); afterText.append("</span>"); } afterText.append(markAfter(dir, str, isHtml)); return BidiWrappingText.create(beforeText.toString(), afterText.toString()); }
[ "public", "BidiWrappingText", "spanWrappingText", "(", "@", "Nullable", "Dir", "dir", ",", "String", "str", ",", "boolean", "isHtml", ")", "{", "if", "(", "dir", "==", "null", ")", "{", "dir", "=", "estimateDirection", "(", "str", ",", "isHtml", ")", ";", "}", "StringBuilder", "beforeText", "=", "new", "StringBuilder", "(", ")", ";", "StringBuilder", "afterText", "=", "new", "StringBuilder", "(", ")", ";", "boolean", "dirCondition", "=", "(", "dir", "!=", "Dir", ".", "NEUTRAL", "&&", "dir", "!=", "contextDir", ")", ";", "if", "(", "dirCondition", ")", "{", "beforeText", ".", "append", "(", "\"<span dir=\\\"\"", ")", ".", "append", "(", "dir", "==", "Dir", ".", "RTL", "?", "\"rtl\"", ":", "\"ltr\"", ")", ".", "append", "(", "\"\\\">\"", ")", ";", "afterText", ".", "append", "(", "\"</span>\"", ")", ";", "}", "afterText", ".", "append", "(", "markAfter", "(", "dir", ",", "str", ",", "isHtml", ")", ")", ";", "return", "BidiWrappingText", ".", "create", "(", "beforeText", ".", "toString", "(", ")", ",", "afterText", ".", "toString", "(", ")", ")", ";", "}" ]
Operates like {@link #spanWrap(Dir, String, boolean)} but only returns the text that would be prepended and appended to {@code str}. @param dir {@code str}'s directionality. If null, i.e. unknown, it is estimated. @param str The input string @param isHtml Whether {@code str} is HTML / HTML-escaped
[ "Operates", "like", "{", "@link", "#spanWrap", "(", "Dir", "String", "boolean", ")", "}", "but", "only", "returns", "the", "text", "that", "would", "be", "prepended", "and", "appended", "to", "{", "@code", "str", "}", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/i18n/BidiFormatter.java#L140-L154
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.isAssignableOrConvertibleFrom
public static boolean isAssignableOrConvertibleFrom(Class<?> clazz, Class<?> type) { """ Returns true if the specified clazz parameter is either the same as, or is a superclass or superinterface of, the specified type parameter. Converts primitive types to compatible class automatically. @param clazz @param type @return true if the class is a taglib @see java.lang.Class#isAssignableFrom(Class) """ if (type == null || clazz == null) { return false; } if (type.isPrimitive()) { // convert primitive type to compatible class Class<?> primitiveClass = GrailsClassUtils.PRIMITIVE_TYPE_COMPATIBLE_CLASSES.get(type); if (primitiveClass == null) { // no compatible class found for primitive type return false; } return clazz.isAssignableFrom(primitiveClass); } return clazz.isAssignableFrom(type); }
java
public static boolean isAssignableOrConvertibleFrom(Class<?> clazz, Class<?> type) { if (type == null || clazz == null) { return false; } if (type.isPrimitive()) { // convert primitive type to compatible class Class<?> primitiveClass = GrailsClassUtils.PRIMITIVE_TYPE_COMPATIBLE_CLASSES.get(type); if (primitiveClass == null) { // no compatible class found for primitive type return false; } return clazz.isAssignableFrom(primitiveClass); } return clazz.isAssignableFrom(type); }
[ "public", "static", "boolean", "isAssignableOrConvertibleFrom", "(", "Class", "<", "?", ">", "clazz", ",", "Class", "<", "?", ">", "type", ")", "{", "if", "(", "type", "==", "null", "||", "clazz", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "type", ".", "isPrimitive", "(", ")", ")", "{", "// convert primitive type to compatible class", "Class", "<", "?", ">", "primitiveClass", "=", "GrailsClassUtils", ".", "PRIMITIVE_TYPE_COMPATIBLE_CLASSES", ".", "get", "(", "type", ")", ";", "if", "(", "primitiveClass", "==", "null", ")", "{", "// no compatible class found for primitive type", "return", "false", ";", "}", "return", "clazz", ".", "isAssignableFrom", "(", "primitiveClass", ")", ";", "}", "return", "clazz", ".", "isAssignableFrom", "(", "type", ")", ";", "}" ]
Returns true if the specified clazz parameter is either the same as, or is a superclass or superinterface of, the specified type parameter. Converts primitive types to compatible class automatically. @param clazz @param type @return true if the class is a taglib @see java.lang.Class#isAssignableFrom(Class)
[ "Returns", "true", "if", "the", "specified", "clazz", "parameter", "is", "either", "the", "same", "as", "or", "is", "a", "superclass", "or", "superinterface", "of", "the", "specified", "type", "parameter", ".", "Converts", "primitive", "types", "to", "compatible", "class", "automatically", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L789-L803
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageFactory.java
BufferedImageFactory.setSourceSubsampling
public void setSourceSubsampling(int pXSub, int pYSub) { """ Sets the source subsampling for the new image. @param pXSub horizontal subsampling factor @param pYSub vertical subsampling factor """ // Re-fetch everything, if subsampling changed if (xSub != pXSub || ySub != pYSub) { dispose(); } if (pXSub > 1) { xSub = pXSub; } if (pYSub > 1) { ySub = pYSub; } }
java
public void setSourceSubsampling(int pXSub, int pYSub) { // Re-fetch everything, if subsampling changed if (xSub != pXSub || ySub != pYSub) { dispose(); } if (pXSub > 1) { xSub = pXSub; } if (pYSub > 1) { ySub = pYSub; } }
[ "public", "void", "setSourceSubsampling", "(", "int", "pXSub", ",", "int", "pYSub", ")", "{", "// Re-fetch everything, if subsampling changed", "if", "(", "xSub", "!=", "pXSub", "||", "ySub", "!=", "pYSub", ")", "{", "dispose", "(", ")", ";", "}", "if", "(", "pXSub", ">", "1", ")", "{", "xSub", "=", "pXSub", ";", "}", "if", "(", "pYSub", ">", "1", ")", "{", "ySub", "=", "pYSub", ";", "}", "}" ]
Sets the source subsampling for the new image. @param pXSub horizontal subsampling factor @param pYSub vertical subsampling factor
[ "Sets", "the", "source", "subsampling", "for", "the", "new", "image", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageFactory.java#L176-L188
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/media/format/MediaFormat.java
MediaFormat.getMinDimension
public Dimension getMinDimension() { """ Get minimum dimensions for media format. If only with or height is defined the missing dimensions is calculated from the ratio. If no ratio defined either only width or height dimension is returned. If neither width or height are defined null is returned. @return Min. dimensions or null """ long effWithMin = getEffectiveMinWidth(); long effHeightMin = getEffectiveMinHeight(); double effRatio = getRatio(); if (effWithMin == 0 && effHeightMin > 0 && effRatio > 0) { effWithMin = Math.round(effHeightMin * effRatio); } if (effWithMin > 0 && effHeightMin == 0 && effRatio > 0) { effHeightMin = Math.round(effWithMin / effRatio); } if (effWithMin > 0 || effHeightMin > 0) { return new Dimension(effWithMin, effHeightMin); } else { return null; } }
java
public Dimension getMinDimension() { long effWithMin = getEffectiveMinWidth(); long effHeightMin = getEffectiveMinHeight(); double effRatio = getRatio(); if (effWithMin == 0 && effHeightMin > 0 && effRatio > 0) { effWithMin = Math.round(effHeightMin * effRatio); } if (effWithMin > 0 && effHeightMin == 0 && effRatio > 0) { effHeightMin = Math.round(effWithMin / effRatio); } if (effWithMin > 0 || effHeightMin > 0) { return new Dimension(effWithMin, effHeightMin); } else { return null; } }
[ "public", "Dimension", "getMinDimension", "(", ")", "{", "long", "effWithMin", "=", "getEffectiveMinWidth", "(", ")", ";", "long", "effHeightMin", "=", "getEffectiveMinHeight", "(", ")", ";", "double", "effRatio", "=", "getRatio", "(", ")", ";", "if", "(", "effWithMin", "==", "0", "&&", "effHeightMin", ">", "0", "&&", "effRatio", ">", "0", ")", "{", "effWithMin", "=", "Math", ".", "round", "(", "effHeightMin", "*", "effRatio", ")", ";", "}", "if", "(", "effWithMin", ">", "0", "&&", "effHeightMin", "==", "0", "&&", "effRatio", ">", "0", ")", "{", "effHeightMin", "=", "Math", ".", "round", "(", "effWithMin", "/", "effRatio", ")", ";", "}", "if", "(", "effWithMin", ">", "0", "||", "effHeightMin", ">", "0", ")", "{", "return", "new", "Dimension", "(", "effWithMin", ",", "effHeightMin", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Get minimum dimensions for media format. If only with or height is defined the missing dimensions is calculated from the ratio. If no ratio defined either only width or height dimension is returned. If neither width or height are defined null is returned. @return Min. dimensions or null
[ "Get", "minimum", "dimensions", "for", "media", "format", ".", "If", "only", "with", "or", "height", "is", "defined", "the", "missing", "dimensions", "is", "calculated", "from", "the", "ratio", ".", "If", "no", "ratio", "defined", "either", "only", "width", "or", "height", "dimension", "is", "returned", ".", "If", "neither", "width", "or", "height", "are", "defined", "null", "is", "returned", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/format/MediaFormat.java#L432-L450
pravega/pravega
segmentstore/contracts/src/main/java/io/pravega/segmentstore/contracts/tables/TableEntry.java
TableEntry.unversioned
public static TableEntry unversioned(@NonNull ArrayView key, @NonNull ArrayView value) { """ Creates a new instance of the TableEntry class with no desired version. @param key The Key. @param value The Value. @return the TableEntry that was created """ return new TableEntry(TableKey.unversioned(key), value); }
java
public static TableEntry unversioned(@NonNull ArrayView key, @NonNull ArrayView value) { return new TableEntry(TableKey.unversioned(key), value); }
[ "public", "static", "TableEntry", "unversioned", "(", "@", "NonNull", "ArrayView", "key", ",", "@", "NonNull", "ArrayView", "value", ")", "{", "return", "new", "TableEntry", "(", "TableKey", ".", "unversioned", "(", "key", ")", ",", "value", ")", ";", "}" ]
Creates a new instance of the TableEntry class with no desired version. @param key The Key. @param value The Value. @return the TableEntry that was created
[ "Creates", "a", "new", "instance", "of", "the", "TableEntry", "class", "with", "no", "desired", "version", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/contracts/src/main/java/io/pravega/segmentstore/contracts/tables/TableEntry.java#L42-L44
google/auto
common/src/main/java/com/google/auto/common/MoreElements.java
MoreElements.getLocalAndInheritedMethods
public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Types typeUtils, Elements elementUtils) { """ Returns the set of all non-private methods from {@code type}, including methods that it inherits from its ancestors. Inherited methods that are overridden are not included in the result. So if {@code type} defines {@code public String toString()}, the returned set will contain that method, but not the {@code toString()} method defined by {@code Object}. <p>The returned set may contain more than one method with the same signature, if {@code type} inherits those methods from different ancestors. For example, if it inherits from unrelated interfaces {@code One} and {@code Two} which each define {@code void foo();}, and if it does not itself override the {@code foo()} method, then both {@code One.foo()} and {@code Two.foo()} will be in the returned set. @param type the type whose own and inherited methods are to be returned @param typeUtils a {@link Types} object, typically returned by {@link javax.annotation.processing.AbstractProcessor#processingEnv processingEnv}<!-- -->.{@link javax.annotation.processing.ProcessingEnvironment#getTypeUtils getTypeUtils()} @param elementUtils an {@link Elements} object, typically returned by {@link javax.annotation.processing.AbstractProcessor#processingEnv processingEnv}<!-- -->.{@link javax.annotation.processing.ProcessingEnvironment#getElementUtils getElementUtils()} """ return getLocalAndInheritedMethods(type, new ExplicitOverrides(typeUtils)); }
java
public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Types typeUtils, Elements elementUtils) { return getLocalAndInheritedMethods(type, new ExplicitOverrides(typeUtils)); }
[ "public", "static", "ImmutableSet", "<", "ExecutableElement", ">", "getLocalAndInheritedMethods", "(", "TypeElement", "type", ",", "Types", "typeUtils", ",", "Elements", "elementUtils", ")", "{", "return", "getLocalAndInheritedMethods", "(", "type", ",", "new", "ExplicitOverrides", "(", "typeUtils", ")", ")", ";", "}" ]
Returns the set of all non-private methods from {@code type}, including methods that it inherits from its ancestors. Inherited methods that are overridden are not included in the result. So if {@code type} defines {@code public String toString()}, the returned set will contain that method, but not the {@code toString()} method defined by {@code Object}. <p>The returned set may contain more than one method with the same signature, if {@code type} inherits those methods from different ancestors. For example, if it inherits from unrelated interfaces {@code One} and {@code Two} which each define {@code void foo();}, and if it does not itself override the {@code foo()} method, then both {@code One.foo()} and {@code Two.foo()} will be in the returned set. @param type the type whose own and inherited methods are to be returned @param typeUtils a {@link Types} object, typically returned by {@link javax.annotation.processing.AbstractProcessor#processingEnv processingEnv}<!-- -->.{@link javax.annotation.processing.ProcessingEnvironment#getTypeUtils getTypeUtils()} @param elementUtils an {@link Elements} object, typically returned by {@link javax.annotation.processing.AbstractProcessor#processingEnv processingEnv}<!-- -->.{@link javax.annotation.processing.ProcessingEnvironment#getElementUtils getElementUtils()}
[ "Returns", "the", "set", "of", "all", "non", "-", "private", "methods", "from", "{", "@code", "type", "}", "including", "methods", "that", "it", "inherits", "from", "its", "ancestors", ".", "Inherited", "methods", "that", "are", "overridden", "are", "not", "included", "in", "the", "result", ".", "So", "if", "{", "@code", "type", "}", "defines", "{", "@code", "public", "String", "toString", "()", "}", "the", "returned", "set", "will", "contain", "that", "method", "but", "not", "the", "{", "@code", "toString", "()", "}", "method", "defined", "by", "{", "@code", "Object", "}", "." ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/common/src/main/java/com/google/auto/common/MoreElements.java#L329-L332
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/SymbolTable.java
SymbolTable.addSymbol
public String addSymbol(String symbol) { """ Adds the specified symbol to the symbol table and returns a reference to the unique symbol. If the symbol already exists, the previous symbol reference is returned instead, in order guarantee that symbol references remain unique. @param symbol The new symbol. """ // search for identical symbol int bucket = hash(symbol) % fTableSize; int length = symbol.length(); OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) { if (length == entry.characters.length) { for (int i = 0; i < length; i++) { if (symbol.charAt(i) != entry.characters[i]) { continue OUTER; } } return entry.symbol; } } // create new entry Entry entry = new Entry(symbol, fBuckets[bucket]); fBuckets[bucket] = entry; return entry.symbol; }
java
public String addSymbol(String symbol) { // search for identical symbol int bucket = hash(symbol) % fTableSize; int length = symbol.length(); OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) { if (length == entry.characters.length) { for (int i = 0; i < length; i++) { if (symbol.charAt(i) != entry.characters[i]) { continue OUTER; } } return entry.symbol; } } // create new entry Entry entry = new Entry(symbol, fBuckets[bucket]); fBuckets[bucket] = entry; return entry.symbol; }
[ "public", "String", "addSymbol", "(", "String", "symbol", ")", "{", "// search for identical symbol", "int", "bucket", "=", "hash", "(", "symbol", ")", "%", "fTableSize", ";", "int", "length", "=", "symbol", ".", "length", "(", ")", ";", "OUTER", ":", "for", "(", "Entry", "entry", "=", "fBuckets", "[", "bucket", "]", ";", "entry", "!=", "null", ";", "entry", "=", "entry", ".", "next", ")", "{", "if", "(", "length", "==", "entry", ".", "characters", ".", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "symbol", ".", "charAt", "(", "i", ")", "!=", "entry", ".", "characters", "[", "i", "]", ")", "{", "continue", "OUTER", ";", "}", "}", "return", "entry", ".", "symbol", ";", "}", "}", "// create new entry", "Entry", "entry", "=", "new", "Entry", "(", "symbol", ",", "fBuckets", "[", "bucket", "]", ")", ";", "fBuckets", "[", "bucket", "]", "=", "entry", ";", "return", "entry", ".", "symbol", ";", "}" ]
Adds the specified symbol to the symbol table and returns a reference to the unique symbol. If the symbol already exists, the previous symbol reference is returned instead, in order guarantee that symbol references remain unique. @param symbol The new symbol.
[ "Adds", "the", "specified", "symbol", "to", "the", "symbol", "table", "and", "returns", "a", "reference", "to", "the", "unique", "symbol", ".", "If", "the", "symbol", "already", "exists", "the", "previous", "symbol", "reference", "is", "returned", "instead", "in", "order", "guarantee", "that", "symbol", "references", "remain", "unique", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/SymbolTable.java#L86-L107
apache/groovy
subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java
GPathResult.getBody
public Closure getBody() { """ Creates a Closure representing the body of this GPathResult. @return the body of this GPathResult, converted to a <code>Closure</code> """ return new Closure(this.parent,this) { public void doCall(Object[] args) { final GroovyObject delegate = (GroovyObject)getDelegate(); final GPathResult thisObject = (GPathResult)getThisObject(); Node node = (Node)thisObject.getAt(0); List children = node.children(); for (Object child : children) { delegate.getProperty("mkp"); if (child instanceof Node) { delegate.invokeMethod("yield", new Object[]{new NodeChild((Node) child, thisObject, "*", null)}); } else { delegate.invokeMethod("yield", new Object[]{child}); } } } }; }
java
public Closure getBody() { return new Closure(this.parent,this) { public void doCall(Object[] args) { final GroovyObject delegate = (GroovyObject)getDelegate(); final GPathResult thisObject = (GPathResult)getThisObject(); Node node = (Node)thisObject.getAt(0); List children = node.children(); for (Object child : children) { delegate.getProperty("mkp"); if (child instanceof Node) { delegate.invokeMethod("yield", new Object[]{new NodeChild((Node) child, thisObject, "*", null)}); } else { delegate.invokeMethod("yield", new Object[]{child}); } } } }; }
[ "public", "Closure", "getBody", "(", ")", "{", "return", "new", "Closure", "(", "this", ".", "parent", ",", "this", ")", "{", "public", "void", "doCall", "(", "Object", "[", "]", "args", ")", "{", "final", "GroovyObject", "delegate", "=", "(", "GroovyObject", ")", "getDelegate", "(", ")", ";", "final", "GPathResult", "thisObject", "=", "(", "GPathResult", ")", "getThisObject", "(", ")", ";", "Node", "node", "=", "(", "Node", ")", "thisObject", ".", "getAt", "(", "0", ")", ";", "List", "children", "=", "node", ".", "children", "(", ")", ";", "for", "(", "Object", "child", ":", "children", ")", "{", "delegate", ".", "getProperty", "(", "\"mkp\"", ")", ";", "if", "(", "child", "instanceof", "Node", ")", "{", "delegate", ".", "invokeMethod", "(", "\"yield\"", ",", "new", "Object", "[", "]", "{", "new", "NodeChild", "(", "(", "Node", ")", "child", ",", "thisObject", ",", "\"*\"", ",", "null", ")", "}", ")", ";", "}", "else", "{", "delegate", ".", "invokeMethod", "(", "\"yield\"", ",", "new", "Object", "[", "]", "{", "child", "}", ")", ";", "}", "}", "}", "}", ";", "}" ]
Creates a Closure representing the body of this GPathResult. @return the body of this GPathResult, converted to a <code>Closure</code>
[ "Creates", "a", "Closure", "representing", "the", "body", "of", "this", "GPathResult", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java#L623-L642
groovyfx-project/groovyfx
src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java
FXBindableASTTransformation.createGetterStatement
protected Statement createGetterStatement(PropertyNode fxProperty) { """ Creates the body of a getter method for the original property that is actually backed by a JavaFX *Property instance: <p> Object $property = this.someProperty() return $property.getValue() @param fxProperty The new JavaFX property. @return A Statement that is the body of the new getter. """ String fxPropertyGetter = getFXPropertyGetterName(fxProperty); VariableExpression thisExpression = VariableExpression.THIS_EXPRESSION; ArgumentListExpression emptyArguments = ArgumentListExpression.EMPTY_ARGUMENTS; // We're relying on the *Property() method to provide the return value - is this still needed?? // Expression defaultReturn = defaultReturnMap.get(originalProperty.getType()); // if (defaultReturn == null) // defaultReturn = ConstantExpression.NULL; MethodCallExpression getProperty = new MethodCallExpression(thisExpression, fxPropertyGetter, emptyArguments); MethodCallExpression getValue = new MethodCallExpression(getProperty, "getValue", emptyArguments); return new ReturnStatement(new ExpressionStatement(getValue)); }
java
protected Statement createGetterStatement(PropertyNode fxProperty) { String fxPropertyGetter = getFXPropertyGetterName(fxProperty); VariableExpression thisExpression = VariableExpression.THIS_EXPRESSION; ArgumentListExpression emptyArguments = ArgumentListExpression.EMPTY_ARGUMENTS; // We're relying on the *Property() method to provide the return value - is this still needed?? // Expression defaultReturn = defaultReturnMap.get(originalProperty.getType()); // if (defaultReturn == null) // defaultReturn = ConstantExpression.NULL; MethodCallExpression getProperty = new MethodCallExpression(thisExpression, fxPropertyGetter, emptyArguments); MethodCallExpression getValue = new MethodCallExpression(getProperty, "getValue", emptyArguments); return new ReturnStatement(new ExpressionStatement(getValue)); }
[ "protected", "Statement", "createGetterStatement", "(", "PropertyNode", "fxProperty", ")", "{", "String", "fxPropertyGetter", "=", "getFXPropertyGetterName", "(", "fxProperty", ")", ";", "VariableExpression", "thisExpression", "=", "VariableExpression", ".", "THIS_EXPRESSION", ";", "ArgumentListExpression", "emptyArguments", "=", "ArgumentListExpression", ".", "EMPTY_ARGUMENTS", ";", "// We're relying on the *Property() method to provide the return value - is this still needed??", "// Expression defaultReturn = defaultReturnMap.get(originalProperty.getType());", "// if (defaultReturn == null)", "// defaultReturn = ConstantExpression.NULL;", "MethodCallExpression", "getProperty", "=", "new", "MethodCallExpression", "(", "thisExpression", ",", "fxPropertyGetter", ",", "emptyArguments", ")", ";", "MethodCallExpression", "getValue", "=", "new", "MethodCallExpression", "(", "getProperty", ",", "\"getValue\"", ",", "emptyArguments", ")", ";", "return", "new", "ReturnStatement", "(", "new", "ExpressionStatement", "(", "getValue", ")", ")", ";", "}" ]
Creates the body of a getter method for the original property that is actually backed by a JavaFX *Property instance: <p> Object $property = this.someProperty() return $property.getValue() @param fxProperty The new JavaFX property. @return A Statement that is the body of the new getter.
[ "Creates", "the", "body", "of", "a", "getter", "method", "for", "the", "original", "property", "that", "is", "actually", "backed", "by", "a", "JavaFX", "*", "Property", "instance", ":", "<p", ">", "Object", "$property", "=", "this", ".", "someProperty", "()", "return", "$property", ".", "getValue", "()" ]
train
https://github.com/groovyfx-project/groovyfx/blob/7067d76793601ce4de9c642d4c0c0e11db7907cb/src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java#L621-L635
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/context/RpcInternalContext.java
RpcInternalContext.setAttachment
public RpcInternalContext setAttachment(String key, Object value) { """ set attachment. @param key the key @param value the value @return context attachment """ if (key == null) { return this; } if (!ATTACHMENT_ENABLE) { // 未开启附件传递功能,只能传递隐藏key("." 开头的Key) if (!isHiddenParamKey(key)) { return this; } } else { if (!isValidInternalParamKey(key)) { // 打开附件传递功能,只能传 "_" 和 "." 开头的Key throw new IllegalArgumentException("key must start with" + RpcConstants.INTERNAL_KEY_PREFIX + " or " + RpcConstants.HIDE_KEY_PREFIX); } } if (value == null) { attachments.remove(key); } else { attachments.put(key, value); } return this; }
java
public RpcInternalContext setAttachment(String key, Object value) { if (key == null) { return this; } if (!ATTACHMENT_ENABLE) { // 未开启附件传递功能,只能传递隐藏key("." 开头的Key) if (!isHiddenParamKey(key)) { return this; } } else { if (!isValidInternalParamKey(key)) { // 打开附件传递功能,只能传 "_" 和 "." 开头的Key throw new IllegalArgumentException("key must start with" + RpcConstants.INTERNAL_KEY_PREFIX + " or " + RpcConstants.HIDE_KEY_PREFIX); } } if (value == null) { attachments.remove(key); } else { attachments.put(key, value); } return this; }
[ "public", "RpcInternalContext", "setAttachment", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "this", ";", "}", "if", "(", "!", "ATTACHMENT_ENABLE", ")", "{", "// 未开启附件传递功能,只能传递隐藏key(\".\" 开头的Key)", "if", "(", "!", "isHiddenParamKey", "(", "key", ")", ")", "{", "return", "this", ";", "}", "}", "else", "{", "if", "(", "!", "isValidInternalParamKey", "(", "key", ")", ")", "{", "// 打开附件传递功能,只能传 \"_\" 和 \".\" 开头的Key", "throw", "new", "IllegalArgumentException", "(", "\"key must start with\"", "+", "RpcConstants", ".", "INTERNAL_KEY_PREFIX", "+", "\" or \"", "+", "RpcConstants", ".", "HIDE_KEY_PREFIX", ")", ";", "}", "}", "if", "(", "value", "==", "null", ")", "{", "attachments", ".", "remove", "(", "key", ")", ";", "}", "else", "{", "attachments", ".", "put", "(", "key", ",", "value", ")", ";", "}", "return", "this", ";", "}" ]
set attachment. @param key the key @param value the value @return context attachment
[ "set", "attachment", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/context/RpcInternalContext.java#L342-L363
apereo/cas
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java
LdapUtils.executeModifyOperation
public static boolean executeModifyOperation(final String currentDn, final ConnectionFactory connectionFactory, final Map<String, Set<String>> attributes) { """ Execute modify operation boolean. @param currentDn the current dn @param connectionFactory the connection factory @param attributes the attributes @return true/false """ try (val modifyConnection = createConnection(connectionFactory)) { val operation = new ModifyOperation(modifyConnection); val mods = attributes.entrySet() .stream() .map(entry -> { val values = entry.getValue().toArray(ArrayUtils.EMPTY_STRING_ARRAY); val attr = new LdapAttribute(entry.getKey(), values); return new AttributeModification(AttributeModificationType.REPLACE, attr); }) .toArray(value -> new AttributeModification[attributes.size()]); val request = new ModifyRequest(currentDn, mods); request.setReferralHandler(new ModifyReferralHandler()); operation.execute(request); return true; } catch (final LdapException e) { LOGGER.error(e.getMessage(), e); } return false; }
java
public static boolean executeModifyOperation(final String currentDn, final ConnectionFactory connectionFactory, final Map<String, Set<String>> attributes) { try (val modifyConnection = createConnection(connectionFactory)) { val operation = new ModifyOperation(modifyConnection); val mods = attributes.entrySet() .stream() .map(entry -> { val values = entry.getValue().toArray(ArrayUtils.EMPTY_STRING_ARRAY); val attr = new LdapAttribute(entry.getKey(), values); return new AttributeModification(AttributeModificationType.REPLACE, attr); }) .toArray(value -> new AttributeModification[attributes.size()]); val request = new ModifyRequest(currentDn, mods); request.setReferralHandler(new ModifyReferralHandler()); operation.execute(request); return true; } catch (final LdapException e) { LOGGER.error(e.getMessage(), e); } return false; }
[ "public", "static", "boolean", "executeModifyOperation", "(", "final", "String", "currentDn", ",", "final", "ConnectionFactory", "connectionFactory", ",", "final", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "attributes", ")", "{", "try", "(", "val", "modifyConnection", "=", "createConnection", "(", "connectionFactory", ")", ")", "{", "val", "operation", "=", "new", "ModifyOperation", "(", "modifyConnection", ")", ";", "val", "mods", "=", "attributes", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "entry", "->", "{", "val", "values", "=", "entry", ".", "getValue", "(", ")", ".", "toArray", "(", "ArrayUtils", ".", "EMPTY_STRING_ARRAY", ")", ";", "val", "attr", "=", "new", "LdapAttribute", "(", "entry", ".", "getKey", "(", ")", ",", "values", ")", ";", "return", "new", "AttributeModification", "(", "AttributeModificationType", ".", "REPLACE", ",", "attr", ")", ";", "}", ")", ".", "toArray", "(", "value", "->", "new", "AttributeModification", "[", "attributes", ".", "size", "(", ")", "]", ")", ";", "val", "request", "=", "new", "ModifyRequest", "(", "currentDn", ",", "mods", ")", ";", "request", ".", "setReferralHandler", "(", "new", "ModifyReferralHandler", "(", ")", ")", ";", "operation", ".", "execute", "(", "request", ")", ";", "return", "true", ";", "}", "catch", "(", "final", "LdapException", "e", ")", "{", "LOGGER", ".", "error", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "return", "false", ";", "}" ]
Execute modify operation boolean. @param currentDn the current dn @param connectionFactory the connection factory @param attributes the attributes @return true/false
[ "Execute", "modify", "operation", "boolean", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L355-L375
camunda/camunda-bpmn-model
src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEventBuilder.java
AbstractEventBuilder.camundaOutputParameter
public B camundaOutputParameter(String name, String value) { """ Creates a new camunda output parameter extension element with the given name and value. @param name the name of the output parameter @param value the value of the output parameter @return the builder object """ CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class); CamundaOutputParameter camundaOutputParameter = createChild(camundaInputOutput, CamundaOutputParameter.class); camundaOutputParameter.setCamundaName(name); camundaOutputParameter.setTextContent(value); return myself; }
java
public B camundaOutputParameter(String name, String value) { CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class); CamundaOutputParameter camundaOutputParameter = createChild(camundaInputOutput, CamundaOutputParameter.class); camundaOutputParameter.setCamundaName(name); camundaOutputParameter.setTextContent(value); return myself; }
[ "public", "B", "camundaOutputParameter", "(", "String", "name", ",", "String", "value", ")", "{", "CamundaInputOutput", "camundaInputOutput", "=", "getCreateSingleExtensionElement", "(", "CamundaInputOutput", ".", "class", ")", ";", "CamundaOutputParameter", "camundaOutputParameter", "=", "createChild", "(", "camundaInputOutput", ",", "CamundaOutputParameter", ".", "class", ")", ";", "camundaOutputParameter", ".", "setCamundaName", "(", "name", ")", ";", "camundaOutputParameter", ".", "setTextContent", "(", "value", ")", ";", "return", "myself", ";", "}" ]
Creates a new camunda output parameter extension element with the given name and value. @param name the name of the output parameter @param value the value of the output parameter @return the builder object
[ "Creates", "a", "new", "camunda", "output", "parameter", "extension", "element", "with", "the", "given", "name", "and", "value", "." ]
train
https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEventBuilder.java#L60-L68
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java
BoxApiBookmark.getCopyRequest
public BoxRequestsBookmark.CopyBookmark getCopyRequest(String id, String parentId) { """ Gets a request that copies a bookmark @param id id of the bookmark to copy @param parentId id of the parent folder to copy the bookmark into @return request to copy a bookmark """ BoxRequestsBookmark.CopyBookmark request = new BoxRequestsBookmark.CopyBookmark(id, parentId, getBookmarkCopyUrl(id), mSession); return request; }
java
public BoxRequestsBookmark.CopyBookmark getCopyRequest(String id, String parentId) { BoxRequestsBookmark.CopyBookmark request = new BoxRequestsBookmark.CopyBookmark(id, parentId, getBookmarkCopyUrl(id), mSession); return request; }
[ "public", "BoxRequestsBookmark", ".", "CopyBookmark", "getCopyRequest", "(", "String", "id", ",", "String", "parentId", ")", "{", "BoxRequestsBookmark", ".", "CopyBookmark", "request", "=", "new", "BoxRequestsBookmark", ".", "CopyBookmark", "(", "id", ",", "parentId", ",", "getBookmarkCopyUrl", "(", "id", ")", ",", "mSession", ")", ";", "return", "request", ";", "}" ]
Gets a request that copies a bookmark @param id id of the bookmark to copy @param parentId id of the parent folder to copy the bookmark into @return request to copy a bookmark
[ "Gets", "a", "request", "that", "copies", "a", "bookmark" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java#L108-L111
mbenson/therian
core/src/main/java/therian/util/Positions.java
Positions.readOnly
public static <T> Position.Readable<T> readOnly(final Typed<T> typed, final Supplier<T> supplier) { """ Get a read-only position of type {@code typed.type}, obtaining its value from {@code supplier}. @param typed not {@code null} @param supplier not {@code null} @return Position.Readable """ return readOnly(Validate.notNull(typed, "type").getType(), supplier); }
java
public static <T> Position.Readable<T> readOnly(final Typed<T> typed, final Supplier<T> supplier) { return readOnly(Validate.notNull(typed, "type").getType(), supplier); }
[ "public", "static", "<", "T", ">", "Position", ".", "Readable", "<", "T", ">", "readOnly", "(", "final", "Typed", "<", "T", ">", "typed", ",", "final", "Supplier", "<", "T", ">", "supplier", ")", "{", "return", "readOnly", "(", "Validate", ".", "notNull", "(", "typed", ",", "\"type\"", ")", ".", "getType", "(", ")", ",", "supplier", ")", ";", "}" ]
Get a read-only position of type {@code typed.type}, obtaining its value from {@code supplier}. @param typed not {@code null} @param supplier not {@code null} @return Position.Readable
[ "Get", "a", "read", "-", "only", "position", "of", "type", "{", "@code", "typed", ".", "type", "}", "obtaining", "its", "value", "from", "{", "@code", "supplier", "}", "." ]
train
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/util/Positions.java#L223-L225
thinkaurelius/titan
titan-core/src/main/java/com/thinkaurelius/titan/graphdb/database/idassigner/placement/PartitionIDRange.java
PartitionIDRange.getGlobalRange
public static List<PartitionIDRange> getGlobalRange(final int partitionBits) { """ /* =========== Helper methods to generate PartitionIDRanges ============ """ Preconditions.checkArgument(partitionBits>=0 && partitionBits<(Integer.SIZE-1),"Invalid partition bits: %s",partitionBits); final int partitionIdBound = (1 << (partitionBits)); return ImmutableList.of(new PartitionIDRange(0, partitionIdBound, partitionIdBound)); }
java
public static List<PartitionIDRange> getGlobalRange(final int partitionBits) { Preconditions.checkArgument(partitionBits>=0 && partitionBits<(Integer.SIZE-1),"Invalid partition bits: %s",partitionBits); final int partitionIdBound = (1 << (partitionBits)); return ImmutableList.of(new PartitionIDRange(0, partitionIdBound, partitionIdBound)); }
[ "public", "static", "List", "<", "PartitionIDRange", ">", "getGlobalRange", "(", "final", "int", "partitionBits", ")", "{", "Preconditions", ".", "checkArgument", "(", "partitionBits", ">=", "0", "&&", "partitionBits", "<", "(", "Integer", ".", "SIZE", "-", "1", ")", ",", "\"Invalid partition bits: %s\"", ",", "partitionBits", ")", ";", "final", "int", "partitionIdBound", "=", "(", "1", "<<", "(", "partitionBits", ")", ")", ";", "return", "ImmutableList", ".", "of", "(", "new", "PartitionIDRange", "(", "0", ",", "partitionIdBound", ",", "partitionIdBound", ")", ")", ";", "}" ]
/* =========== Helper methods to generate PartitionIDRanges ============
[ "/", "*", "===========", "Helper", "methods", "to", "generate", "PartitionIDRanges", "============" ]
train
https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/graphdb/database/idassigner/placement/PartitionIDRange.java#L120-L124
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java
GobblinServiceJobScheduler.scheduleSpecsFromCatalog
private void scheduleSpecsFromCatalog() { """ Load all {@link FlowSpec}s from {@link FlowCatalog} as one of the initialization step, and make schedulers be aware of that. """ Iterator<URI> specUris = null; long startTime = System.currentTimeMillis(); try { specUris = this.flowCatalog.get().getSpecURIs(); } catch (SpecSerDeException ssde) { throw new RuntimeException("Failed to get the iterator of all Spec URIS", ssde); } try { while (specUris.hasNext()) { Spec spec = null; try { spec = this.flowCatalog.get().getSpec(specUris.next()); } catch (SpecNotFoundException snfe) { _log.error(String.format("The URI %s discovered in SpecStore is missing in FlowCatlog" + ", suspecting current modification on SpecStore", specUris.next()), snfe); } //Disable FLOW_RUN_IMMEDIATELY on service startup or leadership change if (spec instanceof FlowSpec) { Spec modifiedSpec = disableFlowRunImmediatelyOnStart((FlowSpec) spec); onAddSpec(modifiedSpec); } else { onAddSpec(spec); } } } finally { this.flowCatalog.get().getMetrics().updateGetSpecTime(startTime); } }
java
private void scheduleSpecsFromCatalog() { Iterator<URI> specUris = null; long startTime = System.currentTimeMillis(); try { specUris = this.flowCatalog.get().getSpecURIs(); } catch (SpecSerDeException ssde) { throw new RuntimeException("Failed to get the iterator of all Spec URIS", ssde); } try { while (specUris.hasNext()) { Spec spec = null; try { spec = this.flowCatalog.get().getSpec(specUris.next()); } catch (SpecNotFoundException snfe) { _log.error(String.format("The URI %s discovered in SpecStore is missing in FlowCatlog" + ", suspecting current modification on SpecStore", specUris.next()), snfe); } //Disable FLOW_RUN_IMMEDIATELY on service startup or leadership change if (spec instanceof FlowSpec) { Spec modifiedSpec = disableFlowRunImmediatelyOnStart((FlowSpec) spec); onAddSpec(modifiedSpec); } else { onAddSpec(spec); } } } finally { this.flowCatalog.get().getMetrics().updateGetSpecTime(startTime); } }
[ "private", "void", "scheduleSpecsFromCatalog", "(", ")", "{", "Iterator", "<", "URI", ">", "specUris", "=", "null", ";", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "try", "{", "specUris", "=", "this", ".", "flowCatalog", ".", "get", "(", ")", ".", "getSpecURIs", "(", ")", ";", "}", "catch", "(", "SpecSerDeException", "ssde", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failed to get the iterator of all Spec URIS\"", ",", "ssde", ")", ";", "}", "try", "{", "while", "(", "specUris", ".", "hasNext", "(", ")", ")", "{", "Spec", "spec", "=", "null", ";", "try", "{", "spec", "=", "this", ".", "flowCatalog", ".", "get", "(", ")", ".", "getSpec", "(", "specUris", ".", "next", "(", ")", ")", ";", "}", "catch", "(", "SpecNotFoundException", "snfe", ")", "{", "_log", ".", "error", "(", "String", ".", "format", "(", "\"The URI %s discovered in SpecStore is missing in FlowCatlog\"", "+", "\", suspecting current modification on SpecStore\"", ",", "specUris", ".", "next", "(", ")", ")", ",", "snfe", ")", ";", "}", "//Disable FLOW_RUN_IMMEDIATELY on service startup or leadership change", "if", "(", "spec", "instanceof", "FlowSpec", ")", "{", "Spec", "modifiedSpec", "=", "disableFlowRunImmediatelyOnStart", "(", "(", "FlowSpec", ")", "spec", ")", ";", "onAddSpec", "(", "modifiedSpec", ")", ";", "}", "else", "{", "onAddSpec", "(", "spec", ")", ";", "}", "}", "}", "finally", "{", "this", ".", "flowCatalog", ".", "get", "(", ")", ".", "getMetrics", "(", ")", ".", "updateGetSpecTime", "(", "startTime", ")", ";", "}", "}" ]
Load all {@link FlowSpec}s from {@link FlowCatalog} as one of the initialization step, and make schedulers be aware of that.
[ "Load", "all", "{", "@link", "FlowSpec", "}", "s", "from", "{", "@link", "FlowCatalog", "}", "as", "one", "of", "the", "initialization", "step", "and", "make", "schedulers", "be", "aware", "of", "that", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobScheduler.java#L139-L171
oasp/oasp4j
modules/cxf-client/src/main/java/io/oasp/module/cxf/common/impl/client/SyncServiceClientFactoryCxf.java
SyncServiceClientFactoryCxf.applyInterceptors
protected void applyInterceptors(ServiceContext<?> context, InterceptorProvider client, String serviceName) { """ Applies CXF interceptors to the given {@code serviceClient}. @param context the {@link ServiceContext}. @param client the {@link InterceptorProvider}. @param serviceName the {@link #createServiceName(ServiceContext) service name}. """ client.getOutInterceptors().add(new PerformanceStartInterceptor()); client.getInInterceptors().add(new PerformanceStopInterceptor()); client.getInFaultInterceptors().add(new TechnicalExceptionInterceptor(serviceName)); }
java
protected void applyInterceptors(ServiceContext<?> context, InterceptorProvider client, String serviceName) { client.getOutInterceptors().add(new PerformanceStartInterceptor()); client.getInInterceptors().add(new PerformanceStopInterceptor()); client.getInFaultInterceptors().add(new TechnicalExceptionInterceptor(serviceName)); }
[ "protected", "void", "applyInterceptors", "(", "ServiceContext", "<", "?", ">", "context", ",", "InterceptorProvider", "client", ",", "String", "serviceName", ")", "{", "client", ".", "getOutInterceptors", "(", ")", ".", "add", "(", "new", "PerformanceStartInterceptor", "(", ")", ")", ";", "client", ".", "getInInterceptors", "(", ")", ".", "add", "(", "new", "PerformanceStopInterceptor", "(", ")", ")", ";", "client", ".", "getInFaultInterceptors", "(", ")", ".", "add", "(", "new", "TechnicalExceptionInterceptor", "(", "serviceName", ")", ")", ";", "}" ]
Applies CXF interceptors to the given {@code serviceClient}. @param context the {@link ServiceContext}. @param client the {@link InterceptorProvider}. @param serviceName the {@link #createServiceName(ServiceContext) service name}.
[ "Applies", "CXF", "interceptors", "to", "the", "given", "{", "@code", "serviceClient", "}", "." ]
train
https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/cxf-client/src/main/java/io/oasp/module/cxf/common/impl/client/SyncServiceClientFactoryCxf.java#L120-L125
UrielCh/ovh-java-sdk
ovh-java-sdk-overTheBox/src/main/java/net/minidev/ovh/api/ApiOvhOverTheBox.java
ApiOvhOverTheBox.serviceName_device_restoreBackup_POST
public ArrayList<OvhDeviceAction> serviceName_device_restoreBackup_POST(String serviceName, String backupId) throws IOException { """ Create a group of actions to restore a given backup REST: POST /overTheBox/{serviceName}/device/restoreBackup @param backupId [required] The id of the backup to restore @param serviceName [required] The internal name of your overTheBox offer API beta """ String qPath = "/overTheBox/{serviceName}/device/restoreBackup"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "backupId", backupId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t4); }
java
public ArrayList<OvhDeviceAction> serviceName_device_restoreBackup_POST(String serviceName, String backupId) throws IOException { String qPath = "/overTheBox/{serviceName}/device/restoreBackup"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "backupId", backupId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t4); }
[ "public", "ArrayList", "<", "OvhDeviceAction", ">", "serviceName_device_restoreBackup_POST", "(", "String", "serviceName", ",", "String", "backupId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/overTheBox/{serviceName}/device/restoreBackup\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"backupId\"", ",", "backupId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "t4", ")", ";", "}" ]
Create a group of actions to restore a given backup REST: POST /overTheBox/{serviceName}/device/restoreBackup @param backupId [required] The id of the backup to restore @param serviceName [required] The internal name of your overTheBox offer API beta
[ "Create", "a", "group", "of", "actions", "to", "restore", "a", "given", "backup" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-overTheBox/src/main/java/net/minidev/ovh/api/ApiOvhOverTheBox.java#L173-L180
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/math/Duration.java
Duration.getComponents
public Components getComponents() { """ Return the duration components. @return the individual time components of this duration """ if (this.components == null) { // This is idempotent, so no need to synchronize ... // Calculate how many seconds, and don't lose any information ... BigDecimal bigSeconds = new BigDecimal(this.durationInNanos).divide(new BigDecimal(1000000000)); // Calculate the minutes, and round to lose the seconds int minutes = bigSeconds.intValue() / 60; // Remove the minutes from the seconds, to just have the remainder of seconds double dMinutes = minutes; double seconds = bigSeconds.doubleValue() - dMinutes * 60; // Now compute the number of full hours, and change 'minutes' to hold the remainding minutes int hours = minutes / 60; minutes = minutes - (hours * 60); this.components = new Components(hours, minutes, seconds); } return this.components; }
java
public Components getComponents() { if (this.components == null) { // This is idempotent, so no need to synchronize ... // Calculate how many seconds, and don't lose any information ... BigDecimal bigSeconds = new BigDecimal(this.durationInNanos).divide(new BigDecimal(1000000000)); // Calculate the minutes, and round to lose the seconds int minutes = bigSeconds.intValue() / 60; // Remove the minutes from the seconds, to just have the remainder of seconds double dMinutes = minutes; double seconds = bigSeconds.doubleValue() - dMinutes * 60; // Now compute the number of full hours, and change 'minutes' to hold the remainding minutes int hours = minutes / 60; minutes = minutes - (hours * 60); this.components = new Components(hours, minutes, seconds); } return this.components; }
[ "public", "Components", "getComponents", "(", ")", "{", "if", "(", "this", ".", "components", "==", "null", ")", "{", "// This is idempotent, so no need to synchronize ...", "// Calculate how many seconds, and don't lose any information ...", "BigDecimal", "bigSeconds", "=", "new", "BigDecimal", "(", "this", ".", "durationInNanos", ")", ".", "divide", "(", "new", "BigDecimal", "(", "1000000000", ")", ")", ";", "// Calculate the minutes, and round to lose the seconds", "int", "minutes", "=", "bigSeconds", ".", "intValue", "(", ")", "/", "60", ";", "// Remove the minutes from the seconds, to just have the remainder of seconds", "double", "dMinutes", "=", "minutes", ";", "double", "seconds", "=", "bigSeconds", ".", "doubleValue", "(", ")", "-", "dMinutes", "*", "60", ";", "// Now compute the number of full hours, and change 'minutes' to hold the remainding minutes", "int", "hours", "=", "minutes", "/", "60", ";", "minutes", "=", "minutes", "-", "(", "hours", "*", "60", ")", ";", "this", ".", "components", "=", "new", "Components", "(", "hours", ",", "minutes", ",", "seconds", ")", ";", "}", "return", "this", ".", "components", ";", "}" ]
Return the duration components. @return the individual time components of this duration
[ "Return", "the", "duration", "components", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/math/Duration.java#L203-L220
huahin/huahin-core
src/main/java/org/huahinframework/core/util/ObjectUtil.java
ObjectUtil.typeCompareTo
public static int typeCompareTo(Writable one, Writable other) { """ Compare the type Writable. @param one the original object @param other the object to be compared. @return if 0, are equal. """ PrimitiveObject noOne = hadoop2Primitive(one); PrimitiveObject noOther = hadoop2Primitive(other); if (noOne.getType() != noOther.getType()) { return -1; } return 0; }
java
public static int typeCompareTo(Writable one, Writable other) { PrimitiveObject noOne = hadoop2Primitive(one); PrimitiveObject noOther = hadoop2Primitive(other); if (noOne.getType() != noOther.getType()) { return -1; } return 0; }
[ "public", "static", "int", "typeCompareTo", "(", "Writable", "one", ",", "Writable", "other", ")", "{", "PrimitiveObject", "noOne", "=", "hadoop2Primitive", "(", "one", ")", ";", "PrimitiveObject", "noOther", "=", "hadoop2Primitive", "(", "other", ")", ";", "if", "(", "noOne", ".", "getType", "(", ")", "!=", "noOther", ".", "getType", "(", ")", ")", "{", "return", "-", "1", ";", "}", "return", "0", ";", "}" ]
Compare the type Writable. @param one the original object @param other the object to be compared. @return if 0, are equal.
[ "Compare", "the", "type", "Writable", "." ]
train
https://github.com/huahin/huahin-core/blob/a87921b5a12be92a822f753c075ab2431036e6f5/src/main/java/org/huahinframework/core/util/ObjectUtil.java#L339-L347
ThreeTen/threetenbp
src/main/java/org/threeten/bp/zone/ZoneOffsetTransitionRule.java
ZoneOffsetTransitionRule.readExternal
static ZoneOffsetTransitionRule readExternal(DataInput in) throws IOException { """ Reads the state from the stream. @param in the input stream, not null @return the created object, not null @throws IOException if an error occurs """ int data = in.readInt(); Month month = Month.of(data >>> 28); int dom = ((data & (63 << 22)) >>> 22) - 32; int dowByte = (data & (7 << 19)) >>> 19; DayOfWeek dow = dowByte == 0 ? null : DayOfWeek.of(dowByte); int timeByte = (data & (31 << 14)) >>> 14; TimeDefinition defn = TimeDefinition.values()[(data & (3 << 12)) >>> 12]; int stdByte = (data & (255 << 4)) >>> 4; int beforeByte = (data & (3 << 2)) >>> 2; int afterByte = (data & 3); int timeOfDaysSecs = (timeByte == 31 ? in.readInt() : timeByte * 3600); ZoneOffset std = (stdByte == 255 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds((stdByte - 128) * 900)); ZoneOffset before = (beforeByte == 3 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(std.getTotalSeconds() + beforeByte * 1800)); ZoneOffset after = (afterByte == 3 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(std.getTotalSeconds() + afterByte * 1800)); // only bit of validation that we need to copy from public of() method if (dom < -28 || dom > 31 || dom == 0) { throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero"); } LocalTime time = LocalTime.ofSecondOfDay(Jdk8Methods.floorMod(timeOfDaysSecs, SECS_PER_DAY)); int adjustDays = Jdk8Methods.floorDiv(timeOfDaysSecs, SECS_PER_DAY); return new ZoneOffsetTransitionRule(month, dom, dow, time, adjustDays, defn, std, before, after); }
java
static ZoneOffsetTransitionRule readExternal(DataInput in) throws IOException { int data = in.readInt(); Month month = Month.of(data >>> 28); int dom = ((data & (63 << 22)) >>> 22) - 32; int dowByte = (data & (7 << 19)) >>> 19; DayOfWeek dow = dowByte == 0 ? null : DayOfWeek.of(dowByte); int timeByte = (data & (31 << 14)) >>> 14; TimeDefinition defn = TimeDefinition.values()[(data & (3 << 12)) >>> 12]; int stdByte = (data & (255 << 4)) >>> 4; int beforeByte = (data & (3 << 2)) >>> 2; int afterByte = (data & 3); int timeOfDaysSecs = (timeByte == 31 ? in.readInt() : timeByte * 3600); ZoneOffset std = (stdByte == 255 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds((stdByte - 128) * 900)); ZoneOffset before = (beforeByte == 3 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(std.getTotalSeconds() + beforeByte * 1800)); ZoneOffset after = (afterByte == 3 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(std.getTotalSeconds() + afterByte * 1800)); // only bit of validation that we need to copy from public of() method if (dom < -28 || dom > 31 || dom == 0) { throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero"); } LocalTime time = LocalTime.ofSecondOfDay(Jdk8Methods.floorMod(timeOfDaysSecs, SECS_PER_DAY)); int adjustDays = Jdk8Methods.floorDiv(timeOfDaysSecs, SECS_PER_DAY); return new ZoneOffsetTransitionRule(month, dom, dow, time, adjustDays, defn, std, before, after); }
[ "static", "ZoneOffsetTransitionRule", "readExternal", "(", "DataInput", "in", ")", "throws", "IOException", "{", "int", "data", "=", "in", ".", "readInt", "(", ")", ";", "Month", "month", "=", "Month", ".", "of", "(", "data", ">>>", "28", ")", ";", "int", "dom", "=", "(", "(", "data", "&", "(", "63", "<<", "22", ")", ")", ">>>", "22", ")", "-", "32", ";", "int", "dowByte", "=", "(", "data", "&", "(", "7", "<<", "19", ")", ")", ">>>", "19", ";", "DayOfWeek", "dow", "=", "dowByte", "==", "0", "?", "null", ":", "DayOfWeek", ".", "of", "(", "dowByte", ")", ";", "int", "timeByte", "=", "(", "data", "&", "(", "31", "<<", "14", ")", ")", ">>>", "14", ";", "TimeDefinition", "defn", "=", "TimeDefinition", ".", "values", "(", ")", "[", "(", "data", "&", "(", "3", "<<", "12", ")", ")", ">>>", "12", "]", ";", "int", "stdByte", "=", "(", "data", "&", "(", "255", "<<", "4", ")", ")", ">>>", "4", ";", "int", "beforeByte", "=", "(", "data", "&", "(", "3", "<<", "2", ")", ")", ">>>", "2", ";", "int", "afterByte", "=", "(", "data", "&", "3", ")", ";", "int", "timeOfDaysSecs", "=", "(", "timeByte", "==", "31", "?", "in", ".", "readInt", "(", ")", ":", "timeByte", "*", "3600", ")", ";", "ZoneOffset", "std", "=", "(", "stdByte", "==", "255", "?", "ZoneOffset", ".", "ofTotalSeconds", "(", "in", ".", "readInt", "(", ")", ")", ":", "ZoneOffset", ".", "ofTotalSeconds", "(", "(", "stdByte", "-", "128", ")", "*", "900", ")", ")", ";", "ZoneOffset", "before", "=", "(", "beforeByte", "==", "3", "?", "ZoneOffset", ".", "ofTotalSeconds", "(", "in", ".", "readInt", "(", ")", ")", ":", "ZoneOffset", ".", "ofTotalSeconds", "(", "std", ".", "getTotalSeconds", "(", ")", "+", "beforeByte", "*", "1800", ")", ")", ";", "ZoneOffset", "after", "=", "(", "afterByte", "==", "3", "?", "ZoneOffset", ".", "ofTotalSeconds", "(", "in", ".", "readInt", "(", ")", ")", ":", "ZoneOffset", ".", "ofTotalSeconds", "(", "std", ".", "getTotalSeconds", "(", ")", "+", "afterByte", "*", "1800", ")", ")", ";", "// only bit of validation that we need to copy from public of() method", "if", "(", "dom", "<", "-", "28", "||", "dom", ">", "31", "||", "dom", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Day of month indicator must be between -28 and 31 inclusive excluding zero\"", ")", ";", "}", "LocalTime", "time", "=", "LocalTime", ".", "ofSecondOfDay", "(", "Jdk8Methods", ".", "floorMod", "(", "timeOfDaysSecs", ",", "SECS_PER_DAY", ")", ")", ";", "int", "adjustDays", "=", "Jdk8Methods", ".", "floorDiv", "(", "timeOfDaysSecs", ",", "SECS_PER_DAY", ")", ";", "return", "new", "ZoneOffsetTransitionRule", "(", "month", ",", "dom", ",", "dow", ",", "time", ",", "adjustDays", ",", "defn", ",", "std", ",", "before", ",", "after", ")", ";", "}" ]
Reads the state from the stream. @param in the input stream, not null @return the created object, not null @throws IOException if an error occurs
[ "Reads", "the", "state", "from", "the", "stream", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/zone/ZoneOffsetTransitionRule.java#L262-L284
republicofgavin/PauseResumeAudioRecorder
library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java
PauseResumeAudioRecorder.startRecording
public void startRecording() { """ Starts the recording if the recorder is in a prepared state. At this time, the complete file path should not have .temp file(as that is where the writing is taking place) and the specified .wav file should not exist as well(as that is where the .temp file will be converted to). Does nothing if it is recorder is not in a prepared state. @throws IllegalArgumentException If the parameters passed into it are invalid according to {@link AudioRecord}.getMinBufferSize API. """ if (currentAudioState.get() == PREPARED_STATE) { currentAudioRecordingThread = new AudioRecorderThread(audioFile.replace(".wav",".temp"), MediaRecorder.AudioSource.MIC, sampleRateInHertz,channelConfig,audioEncoding,maxFileSizeInBytes); currentAudioState.set(RECORDING_STATE); currentAudioRecordingThread.start(); onTimeCompletedTimer=new Timer(true); onTimeCompletionTimerTask=new MaxTimeTimerTask(); onTimeCompletedTimer.schedule(onTimeCompletionTimerTask,maxTimeInMillis); remainingMaxTimeInMillis=maxTimeInMillis; recordingStartTimeMillis=System.currentTimeMillis(); } else{ Log.w(TAG,"Audio recorder is not in prepared state. Ignoring call."); } }
java
public void startRecording(){ if (currentAudioState.get() == PREPARED_STATE) { currentAudioRecordingThread = new AudioRecorderThread(audioFile.replace(".wav",".temp"), MediaRecorder.AudioSource.MIC, sampleRateInHertz,channelConfig,audioEncoding,maxFileSizeInBytes); currentAudioState.set(RECORDING_STATE); currentAudioRecordingThread.start(); onTimeCompletedTimer=new Timer(true); onTimeCompletionTimerTask=new MaxTimeTimerTask(); onTimeCompletedTimer.schedule(onTimeCompletionTimerTask,maxTimeInMillis); remainingMaxTimeInMillis=maxTimeInMillis; recordingStartTimeMillis=System.currentTimeMillis(); } else{ Log.w(TAG,"Audio recorder is not in prepared state. Ignoring call."); } }
[ "public", "void", "startRecording", "(", ")", "{", "if", "(", "currentAudioState", ".", "get", "(", ")", "==", "PREPARED_STATE", ")", "{", "currentAudioRecordingThread", "=", "new", "AudioRecorderThread", "(", "audioFile", ".", "replace", "(", "\".wav\"", ",", "\".temp\"", ")", ",", "MediaRecorder", ".", "AudioSource", ".", "MIC", ",", "sampleRateInHertz", ",", "channelConfig", ",", "audioEncoding", ",", "maxFileSizeInBytes", ")", ";", "currentAudioState", ".", "set", "(", "RECORDING_STATE", ")", ";", "currentAudioRecordingThread", ".", "start", "(", ")", ";", "onTimeCompletedTimer", "=", "new", "Timer", "(", "true", ")", ";", "onTimeCompletionTimerTask", "=", "new", "MaxTimeTimerTask", "(", ")", ";", "onTimeCompletedTimer", ".", "schedule", "(", "onTimeCompletionTimerTask", ",", "maxTimeInMillis", ")", ";", "remainingMaxTimeInMillis", "=", "maxTimeInMillis", ";", "recordingStartTimeMillis", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "else", "{", "Log", ".", "w", "(", "TAG", ",", "\"Audio recorder is not in prepared state. Ignoring call.\"", ")", ";", "}", "}" ]
Starts the recording if the recorder is in a prepared state. At this time, the complete file path should not have .temp file(as that is where the writing is taking place) and the specified .wav file should not exist as well(as that is where the .temp file will be converted to). Does nothing if it is recorder is not in a prepared state. @throws IllegalArgumentException If the parameters passed into it are invalid according to {@link AudioRecord}.getMinBufferSize API.
[ "Starts", "the", "recording", "if", "the", "recorder", "is", "in", "a", "prepared", "state", ".", "At", "this", "time", "the", "complete", "file", "path", "should", "not", "have", ".", "temp", "file", "(", "as", "that", "is", "where", "the", "writing", "is", "taking", "place", ")", "and", "the", "specified", ".", "wav", "file", "should", "not", "exist", "as", "well", "(", "as", "that", "is", "where", "the", ".", "temp", "file", "will", "be", "converted", "to", ")", ".", "Does", "nothing", "if", "it", "is", "recorder", "is", "not", "in", "a", "prepared", "state", "." ]
train
https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L223-L237
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java
FormLayout.setHonorsVisibility
public void setHonorsVisibility(Component component, Boolean b) { """ Specifies whether the given component shall be taken into account for sizing and positioning. This setting overrides the container-wide default. See {@link #setHonorsVisibility(boolean)} for details. @param component the component that shall get an individual setting @param b {@code Boolean.TRUE} to override the container default and honor the visibility for the given component, {@code Boolean.FALSE} to override the container default and ignore the visibility for the given component, {@code null} to use the container default value as specified by {@link #getHonorsVisibility()}. @since 1.2 """ CellConstraints constraints = getConstraints0(component); if (Objects.equals(b, constraints.honorsVisibility)) { return; } constraints.honorsVisibility = b; invalidateAndRepaint(component.getParent()); }
java
public void setHonorsVisibility(Component component, Boolean b) { CellConstraints constraints = getConstraints0(component); if (Objects.equals(b, constraints.honorsVisibility)) { return; } constraints.honorsVisibility = b; invalidateAndRepaint(component.getParent()); }
[ "public", "void", "setHonorsVisibility", "(", "Component", "component", ",", "Boolean", "b", ")", "{", "CellConstraints", "constraints", "=", "getConstraints0", "(", "component", ")", ";", "if", "(", "Objects", ".", "equals", "(", "b", ",", "constraints", ".", "honorsVisibility", ")", ")", "{", "return", ";", "}", "constraints", ".", "honorsVisibility", "=", "b", ";", "invalidateAndRepaint", "(", "component", ".", "getParent", "(", ")", ")", ";", "}" ]
Specifies whether the given component shall be taken into account for sizing and positioning. This setting overrides the container-wide default. See {@link #setHonorsVisibility(boolean)} for details. @param component the component that shall get an individual setting @param b {@code Boolean.TRUE} to override the container default and honor the visibility for the given component, {@code Boolean.FALSE} to override the container default and ignore the visibility for the given component, {@code null} to use the container default value as specified by {@link #getHonorsVisibility()}. @since 1.2
[ "Specifies", "whether", "the", "given", "component", "shall", "be", "taken", "into", "account", "for", "sizing", "and", "positioning", ".", "This", "setting", "overrides", "the", "container", "-", "wide", "default", ".", "See", "{", "@link", "#setHonorsVisibility", "(", "boolean", ")", "}", "for", "details", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L985-L992
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.getTitle
protected String getTitle(final String input, final char startDelim) { """ Gets the title of a chapter/section/appendix/topic by returning everything before the start delimiter. @param input The input to be parsed to get the title. @param startDelim The delimiter that specifies that start of options (ie '[') @return The title as a String or null if the title is blank. """ if (isStringNullOrEmpty(input)) { return null; } else { return ProcessorUtilities.cleanXMLCharacterReferences(StringUtilities.split(input, startDelim)[0].trim()); } }
java
protected String getTitle(final String input, final char startDelim) { if (isStringNullOrEmpty(input)) { return null; } else { return ProcessorUtilities.cleanXMLCharacterReferences(StringUtilities.split(input, startDelim)[0].trim()); } }
[ "protected", "String", "getTitle", "(", "final", "String", "input", ",", "final", "char", "startDelim", ")", "{", "if", "(", "isStringNullOrEmpty", "(", "input", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "ProcessorUtilities", ".", "cleanXMLCharacterReferences", "(", "StringUtilities", ".", "split", "(", "input", ",", "startDelim", ")", "[", "0", "]", ".", "trim", "(", ")", ")", ";", "}", "}" ]
Gets the title of a chapter/section/appendix/topic by returning everything before the start delimiter. @param input The input to be parsed to get the title. @param startDelim The delimiter that specifies that start of options (ie '[') @return The title as a String or null if the title is blank.
[ "Gets", "the", "title", "of", "a", "chapter", "/", "section", "/", "appendix", "/", "topic", "by", "returning", "everything", "before", "the", "start", "delimiter", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L1784-L1790
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java
EigenPowerMethod_DDRM.computeShiftInvert
public boolean computeShiftInvert(DMatrixRMaj A , double alpha ) { """ Computes the most dominant eigen vector of A using an inverted shifted matrix. The inverted shifted matrix is defined as <b>B = (A - &alpha;I)<sup>-1</sup></b> and can converge faster if &alpha; is chosen wisely. @param A An invertible square matrix matrix. @param alpha Shifting factor. @return If it converged or not. """ initPower(A); LinearSolverDense solver = LinearSolverFactory_DDRM.linear(A.numCols); SpecializedOps_DDRM.addIdentity(A,B,-alpha); solver.setA(B); boolean converged = false; for( int i = 0; i < maxIterations && !converged; i++ ) { solver.solve(q0,q1); double s = NormOps_DDRM.normPInf(q1); CommonOps_DDRM.divide(q1,s,q2); converged = checkConverged(A); } return converged; }
java
public boolean computeShiftInvert(DMatrixRMaj A , double alpha ) { initPower(A); LinearSolverDense solver = LinearSolverFactory_DDRM.linear(A.numCols); SpecializedOps_DDRM.addIdentity(A,B,-alpha); solver.setA(B); boolean converged = false; for( int i = 0; i < maxIterations && !converged; i++ ) { solver.solve(q0,q1); double s = NormOps_DDRM.normPInf(q1); CommonOps_DDRM.divide(q1,s,q2); converged = checkConverged(A); } return converged; }
[ "public", "boolean", "computeShiftInvert", "(", "DMatrixRMaj", "A", ",", "double", "alpha", ")", "{", "initPower", "(", "A", ")", ";", "LinearSolverDense", "solver", "=", "LinearSolverFactory_DDRM", ".", "linear", "(", "A", ".", "numCols", ")", ";", "SpecializedOps_DDRM", ".", "addIdentity", "(", "A", ",", "B", ",", "-", "alpha", ")", ";", "solver", ".", "setA", "(", "B", ")", ";", "boolean", "converged", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maxIterations", "&&", "!", "converged", ";", "i", "++", ")", "{", "solver", ".", "solve", "(", "q0", ",", "q1", ")", ";", "double", "s", "=", "NormOps_DDRM", ".", "normPInf", "(", "q1", ")", ";", "CommonOps_DDRM", ".", "divide", "(", "q1", ",", "s", ",", "q2", ")", ";", "converged", "=", "checkConverged", "(", "A", ")", ";", "}", "return", "converged", ";", "}" ]
Computes the most dominant eigen vector of A using an inverted shifted matrix. The inverted shifted matrix is defined as <b>B = (A - &alpha;I)<sup>-1</sup></b> and can converge faster if &alpha; is chosen wisely. @param A An invertible square matrix matrix. @param alpha Shifting factor. @return If it converged or not.
[ "Computes", "the", "most", "dominant", "eigen", "vector", "of", "A", "using", "an", "inverted", "shifted", "matrix", ".", "The", "inverted", "shifted", "matrix", "is", "defined", "as", "<b", ">", "B", "=", "(", "A", "-", "&alpha", ";", "I", ")", "<sup", ">", "-", "1<", "/", "sup", ">", "<", "/", "b", ">", "and", "can", "converge", "faster", "if", "&alpha", ";", "is", "chosen", "wisely", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java#L195-L214
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lnkproducer/LinkGenerator.java
LinkGenerator.writeZeroString
private void writeZeroString(String outString, OutputStream outStream) throws IOException { """ Writes zero-string into stream. @param outString string @param outStream stream @throws IOException {@link IOException} """ simpleWriteString(outString, outStream); outStream.write(0); outStream.write(0); }
java
private void writeZeroString(String outString, OutputStream outStream) throws IOException { simpleWriteString(outString, outStream); outStream.write(0); outStream.write(0); }
[ "private", "void", "writeZeroString", "(", "String", "outString", ",", "OutputStream", "outStream", ")", "throws", "IOException", "{", "simpleWriteString", "(", "outString", ",", "outStream", ")", ";", "outStream", ".", "write", "(", "0", ")", ";", "outStream", ".", "write", "(", "0", ")", ";", "}" ]
Writes zero-string into stream. @param outString string @param outStream stream @throws IOException {@link IOException}
[ "Writes", "zero", "-", "string", "into", "stream", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lnkproducer/LinkGenerator.java#L350-L355
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java
OrientationHistogramSift.computeAngle
double computeAngle( int index1 ) { """ Compute the angle. The angle for each neighbor bin is found using the weighted sum of the derivative. Then the peak index is found by 2nd order polygon interpolation. These two bits of information are combined and used to return the final angle output. @param index1 Histogram index of the peak @return angle of the peak. -pi to pi """ int index0 = CircularIndex.addOffset(index1,-1, histogramMag.length); int index2 = CircularIndex.addOffset(index1, 1, histogramMag.length); // compute the peak location using a second order polygon double v0 = histogramMag[index0]; double v1 = histogramMag[index1]; double v2 = histogramMag[index2]; double offset = FastHessianFeatureDetector.polyPeak(v0,v1,v2); // interpolate using the index offset and angle of its neighbor return interpolateAngle(index0, index1, index2, offset); }
java
double computeAngle( int index1 ) { int index0 = CircularIndex.addOffset(index1,-1, histogramMag.length); int index2 = CircularIndex.addOffset(index1, 1, histogramMag.length); // compute the peak location using a second order polygon double v0 = histogramMag[index0]; double v1 = histogramMag[index1]; double v2 = histogramMag[index2]; double offset = FastHessianFeatureDetector.polyPeak(v0,v1,v2); // interpolate using the index offset and angle of its neighbor return interpolateAngle(index0, index1, index2, offset); }
[ "double", "computeAngle", "(", "int", "index1", ")", "{", "int", "index0", "=", "CircularIndex", ".", "addOffset", "(", "index1", ",", "-", "1", ",", "histogramMag", ".", "length", ")", ";", "int", "index2", "=", "CircularIndex", ".", "addOffset", "(", "index1", ",", "1", ",", "histogramMag", ".", "length", ")", ";", "// compute the peak location using a second order polygon", "double", "v0", "=", "histogramMag", "[", "index0", "]", ";", "double", "v1", "=", "histogramMag", "[", "index1", "]", ";", "double", "v2", "=", "histogramMag", "[", "index2", "]", ";", "double", "offset", "=", "FastHessianFeatureDetector", ".", "polyPeak", "(", "v0", ",", "v1", ",", "v2", ")", ";", "// interpolate using the index offset and angle of its neighbor", "return", "interpolateAngle", "(", "index0", ",", "index1", ",", "index2", ",", "offset", ")", ";", "}" ]
Compute the angle. The angle for each neighbor bin is found using the weighted sum of the derivative. Then the peak index is found by 2nd order polygon interpolation. These two bits of information are combined and used to return the final angle output. @param index1 Histogram index of the peak @return angle of the peak. -pi to pi
[ "Compute", "the", "angle", ".", "The", "angle", "for", "each", "neighbor", "bin", "is", "found", "using", "the", "weighted", "sum", "of", "the", "derivative", ".", "Then", "the", "peak", "index", "is", "found", "by", "2nd", "order", "polygon", "interpolation", ".", "These", "two", "bits", "of", "information", "are", "combined", "and", "used", "to", "return", "the", "final", "angle", "output", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L259-L273
xsonorg/xson
src/main/java/org/xson/core/asm/ClassWriter.java
ClassWriter.getCommonSuperClass
@SuppressWarnings( { """ Returns the common super type of the two given types. The default implementation of this method <i>loads<i> the two given classes and uses the java.lang.Class methods to find the common super class. It can be overridden to compute this common super type in other ways, in particular without actually loading any class, or to take into account the class that is currently being generated by this ClassWriter, which can of course not be loaded since it is under construction. @param type1 the internal name of a class. @param type2 the internal name of another class. @return the internal name of the common super class of the two given classes. """ "rawtypes", "unchecked" }) protected String getCommonSuperClass(final String type1, final String type2) { Class c, d; try { c = Class.forName(type1.replace('/', '.')); d = Class.forName(type2.replace('/', '.')); } catch (Exception e) { throw new RuntimeException(e.toString()); } if (c.isAssignableFrom(d)) { return type1; } if (d.isAssignableFrom(c)) { return type2; } if (c.isInterface() || d.isInterface()) { return "java/lang/Object"; } else { do { c = c.getSuperclass(); } while (!c.isAssignableFrom(d)); return c.getName().replace('.', '/'); } }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) protected String getCommonSuperClass(final String type1, final String type2) { Class c, d; try { c = Class.forName(type1.replace('/', '.')); d = Class.forName(type2.replace('/', '.')); } catch (Exception e) { throw new RuntimeException(e.toString()); } if (c.isAssignableFrom(d)) { return type1; } if (d.isAssignableFrom(c)) { return type2; } if (c.isInterface() || d.isInterface()) { return "java/lang/Object"; } else { do { c = c.getSuperclass(); } while (!c.isAssignableFrom(d)); return c.getName().replace('.', '/'); } }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "protected", "String", "getCommonSuperClass", "(", "final", "String", "type1", ",", "final", "String", "type2", ")", "{", "Class", "c", ",", "d", ";", "try", "{", "c", "=", "Class", ".", "forName", "(", "type1", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ")", ";", "d", "=", "Class", ".", "forName", "(", "type2", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "c", ".", "isAssignableFrom", "(", "d", ")", ")", "{", "return", "type1", ";", "}", "if", "(", "d", ".", "isAssignableFrom", "(", "c", ")", ")", "{", "return", "type2", ";", "}", "if", "(", "c", ".", "isInterface", "(", ")", "||", "d", ".", "isInterface", "(", ")", ")", "{", "return", "\"java/lang/Object\"", ";", "}", "else", "{", "do", "{", "c", "=", "c", ".", "getSuperclass", "(", ")", ";", "}", "while", "(", "!", "c", ".", "isAssignableFrom", "(", "d", ")", ")", ";", "return", "c", ".", "getName", "(", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "}", "}" ]
Returns the common super type of the two given types. The default implementation of this method <i>loads<i> the two given classes and uses the java.lang.Class methods to find the common super class. It can be overridden to compute this common super type in other ways, in particular without actually loading any class, or to take into account the class that is currently being generated by this ClassWriter, which can of course not be loaded since it is under construction. @param type1 the internal name of a class. @param type2 the internal name of another class. @return the internal name of the common super class of the two given classes.
[ "Returns", "the", "common", "super", "type", "of", "the", "two", "given", "types", ".", "The", "default", "implementation", "of", "this", "method", "<i", ">", "loads<i", ">", "the", "two", "given", "classes", "and", "uses", "the", "java", ".", "lang", ".", "Class", "methods", "to", "find", "the", "common", "super", "class", ".", "It", "can", "be", "overridden", "to", "compute", "this", "common", "super", "type", "in", "other", "ways", "in", "particular", "without", "actually", "loading", "any", "class", "or", "to", "take", "into", "account", "the", "class", "that", "is", "currently", "being", "generated", "by", "this", "ClassWriter", "which", "can", "of", "course", "not", "be", "loaded", "since", "it", "is", "under", "construction", "." ]
train
https://github.com/xsonorg/xson/blob/ce1e197ec4ef9be448ed6ca96513e886151f83a9/src/main/java/org/xson/core/asm/ClassWriter.java#L1264-L1288
Wikidata/Wikidata-Toolkit
wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java
ApiConnection.getQueryString
String getQueryString(Map<String, String> params) { """ Returns the query string of a URL from a parameter list. @param params Map with parameters @return query string """ StringBuilder builder = new StringBuilder(); try { boolean first = true; for (Map.Entry<String,String> entry : params.entrySet()) { if (first) { first = false; } else { builder.append("&"); } builder.append(URLEncoder.encode(entry.getKey(), "UTF-8")); builder.append("="); builder.append(URLEncoder.encode(entry.getValue(), "UTF-8")); } } catch (UnsupportedEncodingException e) { throw new RuntimeException( "Your Java version does not support UTF-8 encoding."); } return builder.toString(); }
java
String getQueryString(Map<String, String> params) { StringBuilder builder = new StringBuilder(); try { boolean first = true; for (Map.Entry<String,String> entry : params.entrySet()) { if (first) { first = false; } else { builder.append("&"); } builder.append(URLEncoder.encode(entry.getKey(), "UTF-8")); builder.append("="); builder.append(URLEncoder.encode(entry.getValue(), "UTF-8")); } } catch (UnsupportedEncodingException e) { throw new RuntimeException( "Your Java version does not support UTF-8 encoding."); } return builder.toString(); }
[ "String", "getQueryString", "(", "Map", "<", "String", ",", "String", ">", "params", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "boolean", "first", "=", "true", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "params", ".", "entrySet", "(", ")", ")", "{", "if", "(", "first", ")", "{", "first", "=", "false", ";", "}", "else", "{", "builder", ".", "append", "(", "\"&\"", ")", ";", "}", "builder", ".", "append", "(", "URLEncoder", ".", "encode", "(", "entry", ".", "getKey", "(", ")", ",", "\"UTF-8\"", ")", ")", ";", "builder", ".", "append", "(", "\"=\"", ")", ";", "builder", ".", "append", "(", "URLEncoder", ".", "encode", "(", "entry", ".", "getValue", "(", ")", ",", "\"UTF-8\"", ")", ")", ";", "}", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Your Java version does not support UTF-8 encoding.\"", ")", ";", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Returns the query string of a URL from a parameter list. @param params Map with parameters @return query string
[ "Returns", "the", "query", "string", "of", "a", "URL", "from", "a", "parameter", "list", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java#L696-L716
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/DataSourceTask.java
DataSourceTask.getLogString
private String getLogString(String message, String taskName) { """ Utility function that composes a string for logging purposes. The string includes the given message and the index of the task in its task group together with the number of tasks in the task group. @param message The main message for the log. @param taskName The name of the task. @return The string ready for logging. """ return BatchTask.constructLogString(message, taskName, this); }
java
private String getLogString(String message, String taskName) { return BatchTask.constructLogString(message, taskName, this); }
[ "private", "String", "getLogString", "(", "String", "message", ",", "String", "taskName", ")", "{", "return", "BatchTask", ".", "constructLogString", "(", "message", ",", "taskName", ",", "this", ")", ";", "}" ]
Utility function that composes a string for logging purposes. The string includes the given message and the index of the task in its task group together with the number of tasks in the task group. @param message The main message for the log. @param taskName The name of the task. @return The string ready for logging.
[ "Utility", "function", "that", "composes", "a", "string", "for", "logging", "purposes", ".", "The", "string", "includes", "the", "given", "message", "and", "the", "index", "of", "the", "task", "in", "its", "task", "group", "together", "with", "the", "number", "of", "tasks", "in", "the", "task", "group", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/DataSourceTask.java#L339-L341
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.withDataInputStream
public static <T> T withDataInputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.DataInputStream") Closure<T> closure) throws IOException { """ Create a new DataInputStream for this file and passes it into the closure. This method ensures the stream is closed after the closure returns. @param file a File @param closure a closure @return the value returned by the closure @throws IOException if an IOException occurs. @see IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure) @since 1.5.2 """ return IOGroovyMethods.withStream(newDataInputStream(file), closure); }
java
public static <T> T withDataInputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.DataInputStream") Closure<T> closure) throws IOException { return IOGroovyMethods.withStream(newDataInputStream(file), closure); }
[ "public", "static", "<", "T", ">", "T", "withDataInputStream", "(", "File", "file", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.DataInputStream\"", ")", "Closure", "<", "T", ">", "closure", ")", "throws", "IOException", "{", "return", "IOGroovyMethods", ".", "withStream", "(", "newDataInputStream", "(", "file", ")", ",", "closure", ")", ";", "}" ]
Create a new DataInputStream for this file and passes it into the closure. This method ensures the stream is closed after the closure returns. @param file a File @param closure a closure @return the value returned by the closure @throws IOException if an IOException occurs. @see IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure) @since 1.5.2
[ "Create", "a", "new", "DataInputStream", "for", "this", "file", "and", "passes", "it", "into", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1887-L1889
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java
OLAPService.addBatch
public BatchResult addBatch(ApplicationDefinition appDef, String shardName, OlapBatch batch) { """ Add a batch of updates for the given application to the given shard. Objects can new, updated, or deleted. @param appDef {@link ApplicationDefinition} of application to update. @param shardName Shard to add batch to. @param batch {@link OlapBatch} containing object updates. @return {@link BatchResult} indicating results of update. """ return addBatch(appDef, shardName, batch, null); }
java
public BatchResult addBatch(ApplicationDefinition appDef, String shardName, OlapBatch batch) { return addBatch(appDef, shardName, batch, null); }
[ "public", "BatchResult", "addBatch", "(", "ApplicationDefinition", "appDef", ",", "String", "shardName", ",", "OlapBatch", "batch", ")", "{", "return", "addBatch", "(", "appDef", ",", "shardName", ",", "batch", ",", "null", ")", ";", "}" ]
Add a batch of updates for the given application to the given shard. Objects can new, updated, or deleted. @param appDef {@link ApplicationDefinition} of application to update. @param shardName Shard to add batch to. @param batch {@link OlapBatch} containing object updates. @return {@link BatchResult} indicating results of update.
[ "Add", "a", "batch", "of", "updates", "for", "the", "given", "application", "to", "the", "given", "shard", ".", "Objects", "can", "new", "updated", "or", "deleted", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L198-L200
arquillian/arquillian-core
container/impl-base/src/main/java/org/jboss/arquillian/container/impl/client/container/DeploymentExceptionHandler.java
DeploymentExceptionHandler.containsType
private boolean containsType(Throwable exception, Class<? extends Exception> expectedType) { """ /* public void verifyExpectedExceptionDuringUnDeploy(@Observes EventContext<UnDeployDeployment> context) throws Exception { DeploymentDescription deployment = context.getEvent().getDeployment(); try { context.proceed(); } catch (Exception e) { if(deployment.getExpectedException() == null) { throw e; } } } """ Throwable transformedException = transform(exception); if (transformedException == null) { return false; } if (expectedType.isAssignableFrom(transformedException.getClass())) { return true; } return containsType(transformedException.getCause(), expectedType); }
java
private boolean containsType(Throwable exception, Class<? extends Exception> expectedType) { Throwable transformedException = transform(exception); if (transformedException == null) { return false; } if (expectedType.isAssignableFrom(transformedException.getClass())) { return true; } return containsType(transformedException.getCause(), expectedType); }
[ "private", "boolean", "containsType", "(", "Throwable", "exception", ",", "Class", "<", "?", "extends", "Exception", ">", "expectedType", ")", "{", "Throwable", "transformedException", "=", "transform", "(", "exception", ")", ";", "if", "(", "transformedException", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "expectedType", ".", "isAssignableFrom", "(", "transformedException", ".", "getClass", "(", ")", ")", ")", "{", "return", "true", ";", "}", "return", "containsType", "(", "transformedException", ".", "getCause", "(", ")", ",", "expectedType", ")", ";", "}" ]
/* public void verifyExpectedExceptionDuringUnDeploy(@Observes EventContext<UnDeployDeployment> context) throws Exception { DeploymentDescription deployment = context.getEvent().getDeployment(); try { context.proceed(); } catch (Exception e) { if(deployment.getExpectedException() == null) { throw e; } } }
[ "/", "*", "public", "void", "verifyExpectedExceptionDuringUnDeploy", "(" ]
train
https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/impl-base/src/main/java/org/jboss/arquillian/container/impl/client/container/DeploymentExceptionHandler.java#L91-L102
dita-ot/dita-ot
src/main/java/org/dita/dost/module/KeyrefModule.java
KeyrefModule.processFile
private void processFile(final ResolveTask r) { """ Process key references in a topic. Topic is stored with a new name if it's been processed before. """ final List<XMLFilter> filters = new ArrayList<>(); final ConkeyrefFilter conkeyrefFilter = new ConkeyrefFilter(); conkeyrefFilter.setLogger(logger); conkeyrefFilter.setJob(job); conkeyrefFilter.setKeyDefinitions(r.scope); conkeyrefFilter.setCurrentFile(job.tempDirURI.resolve(r.in.uri)); conkeyrefFilter.setDelayConrefUtils(delayConrefUtils); filters.add(conkeyrefFilter); filters.add(topicFragmentFilter); final KeyrefPaser parser = new KeyrefPaser(); parser.setLogger(logger); parser.setJob(job); parser.setKeyDefinition(r.scope); parser.setCurrentFile(job.tempDirURI.resolve(r.in.uri)); filters.add(parser); try { logger.debug("Using " + (r.scope.name != null ? r.scope.name + " scope" : "root scope")); if (r.out != null) { logger.info("Processing " + job.tempDirURI.resolve(r.in.uri) + " to " + job.tempDirURI.resolve(r.out.uri)); xmlUtils.transform(new File(job.tempDir, r.in.file.getPath()), new File(job.tempDir, r.out.file.getPath()), filters); } else { logger.info("Processing " + job.tempDirURI.resolve(r.in.uri)); xmlUtils.transform(new File(job.tempDir, r.in.file.getPath()), filters); } // validate resource-only list normalProcessingRole.addAll(parser.getNormalProcessingRoleTargets()); } catch (final DITAOTException e) { logger.error("Failed to process key references: " + e.getMessage(), e); } }
java
private void processFile(final ResolveTask r) { final List<XMLFilter> filters = new ArrayList<>(); final ConkeyrefFilter conkeyrefFilter = new ConkeyrefFilter(); conkeyrefFilter.setLogger(logger); conkeyrefFilter.setJob(job); conkeyrefFilter.setKeyDefinitions(r.scope); conkeyrefFilter.setCurrentFile(job.tempDirURI.resolve(r.in.uri)); conkeyrefFilter.setDelayConrefUtils(delayConrefUtils); filters.add(conkeyrefFilter); filters.add(topicFragmentFilter); final KeyrefPaser parser = new KeyrefPaser(); parser.setLogger(logger); parser.setJob(job); parser.setKeyDefinition(r.scope); parser.setCurrentFile(job.tempDirURI.resolve(r.in.uri)); filters.add(parser); try { logger.debug("Using " + (r.scope.name != null ? r.scope.name + " scope" : "root scope")); if (r.out != null) { logger.info("Processing " + job.tempDirURI.resolve(r.in.uri) + " to " + job.tempDirURI.resolve(r.out.uri)); xmlUtils.transform(new File(job.tempDir, r.in.file.getPath()), new File(job.tempDir, r.out.file.getPath()), filters); } else { logger.info("Processing " + job.tempDirURI.resolve(r.in.uri)); xmlUtils.transform(new File(job.tempDir, r.in.file.getPath()), filters); } // validate resource-only list normalProcessingRole.addAll(parser.getNormalProcessingRoleTargets()); } catch (final DITAOTException e) { logger.error("Failed to process key references: " + e.getMessage(), e); } }
[ "private", "void", "processFile", "(", "final", "ResolveTask", "r", ")", "{", "final", "List", "<", "XMLFilter", ">", "filters", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "ConkeyrefFilter", "conkeyrefFilter", "=", "new", "ConkeyrefFilter", "(", ")", ";", "conkeyrefFilter", ".", "setLogger", "(", "logger", ")", ";", "conkeyrefFilter", ".", "setJob", "(", "job", ")", ";", "conkeyrefFilter", ".", "setKeyDefinitions", "(", "r", ".", "scope", ")", ";", "conkeyrefFilter", ".", "setCurrentFile", "(", "job", ".", "tempDirURI", ".", "resolve", "(", "r", ".", "in", ".", "uri", ")", ")", ";", "conkeyrefFilter", ".", "setDelayConrefUtils", "(", "delayConrefUtils", ")", ";", "filters", ".", "add", "(", "conkeyrefFilter", ")", ";", "filters", ".", "add", "(", "topicFragmentFilter", ")", ";", "final", "KeyrefPaser", "parser", "=", "new", "KeyrefPaser", "(", ")", ";", "parser", ".", "setLogger", "(", "logger", ")", ";", "parser", ".", "setJob", "(", "job", ")", ";", "parser", ".", "setKeyDefinition", "(", "r", ".", "scope", ")", ";", "parser", ".", "setCurrentFile", "(", "job", ".", "tempDirURI", ".", "resolve", "(", "r", ".", "in", ".", "uri", ")", ")", ";", "filters", ".", "add", "(", "parser", ")", ";", "try", "{", "logger", ".", "debug", "(", "\"Using \"", "+", "(", "r", ".", "scope", ".", "name", "!=", "null", "?", "r", ".", "scope", ".", "name", "+", "\" scope\"", ":", "\"root scope\"", ")", ")", ";", "if", "(", "r", ".", "out", "!=", "null", ")", "{", "logger", ".", "info", "(", "\"Processing \"", "+", "job", ".", "tempDirURI", ".", "resolve", "(", "r", ".", "in", ".", "uri", ")", "+", "\" to \"", "+", "job", ".", "tempDirURI", ".", "resolve", "(", "r", ".", "out", ".", "uri", ")", ")", ";", "xmlUtils", ".", "transform", "(", "new", "File", "(", "job", ".", "tempDir", ",", "r", ".", "in", ".", "file", ".", "getPath", "(", ")", ")", ",", "new", "File", "(", "job", ".", "tempDir", ",", "r", ".", "out", ".", "file", ".", "getPath", "(", ")", ")", ",", "filters", ")", ";", "}", "else", "{", "logger", ".", "info", "(", "\"Processing \"", "+", "job", ".", "tempDirURI", ".", "resolve", "(", "r", ".", "in", ".", "uri", ")", ")", ";", "xmlUtils", ".", "transform", "(", "new", "File", "(", "job", ".", "tempDir", ",", "r", ".", "in", ".", "file", ".", "getPath", "(", ")", ")", ",", "filters", ")", ";", "}", "// validate resource-only list", "normalProcessingRole", ".", "addAll", "(", "parser", ".", "getNormalProcessingRoleTargets", "(", ")", ")", ";", "}", "catch", "(", "final", "DITAOTException", "e", ")", "{", "logger", ".", "error", "(", "\"Failed to process key references: \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Process key references in a topic. Topic is stored with a new name if it's been processed before.
[ "Process", "key", "references", "in", "a", "topic", ".", "Topic", "is", "stored", "with", "a", "new", "name", "if", "it", "s", "been", "processed", "before", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/KeyrefModule.java#L340-L377
jblas-project/jblas
src/main/java/org/jblas/util/LibraryLoader.java
LibraryLoader.loadLibraryFromStream
private void loadLibraryFromStream(String libname, InputStream is) { """ Load a system library from a stream. Copies the library to a temp file and loads from there. @param libname name of the library (just used in constructing the library name) @param is InputStream pointing to the library """ try { File tempfile = createTempFile(libname); OutputStream os = new FileOutputStream(tempfile); logger.debug("tempfile.getPath() = " + tempfile.getPath()); long savedTime = System.currentTimeMillis(); // Leo says 8k block size is STANDARD ;) byte buf[] = new byte[8192]; int len; while ((len = is.read(buf)) > 0) { os.write(buf, 0, len); } os.flush(); InputStream lock = new FileInputStream(tempfile); os.close(); double seconds = (double) (System.currentTimeMillis() - savedTime) / 1e3; logger.debug("Copying took " + seconds + " seconds."); logger.debug("Loading library from " + tempfile.getPath() + "."); System.load(tempfile.getPath()); lock.close(); } catch (IOException io) { logger.error("Could not create the temp file: " + io.toString() + ".\n"); } catch (UnsatisfiedLinkError ule) { logger.error("Couldn't load copied link file: " + ule.toString() + ".\n"); throw ule; } }
java
private void loadLibraryFromStream(String libname, InputStream is) { try { File tempfile = createTempFile(libname); OutputStream os = new FileOutputStream(tempfile); logger.debug("tempfile.getPath() = " + tempfile.getPath()); long savedTime = System.currentTimeMillis(); // Leo says 8k block size is STANDARD ;) byte buf[] = new byte[8192]; int len; while ((len = is.read(buf)) > 0) { os.write(buf, 0, len); } os.flush(); InputStream lock = new FileInputStream(tempfile); os.close(); double seconds = (double) (System.currentTimeMillis() - savedTime) / 1e3; logger.debug("Copying took " + seconds + " seconds."); logger.debug("Loading library from " + tempfile.getPath() + "."); System.load(tempfile.getPath()); lock.close(); } catch (IOException io) { logger.error("Could not create the temp file: " + io.toString() + ".\n"); } catch (UnsatisfiedLinkError ule) { logger.error("Couldn't load copied link file: " + ule.toString() + ".\n"); throw ule; } }
[ "private", "void", "loadLibraryFromStream", "(", "String", "libname", ",", "InputStream", "is", ")", "{", "try", "{", "File", "tempfile", "=", "createTempFile", "(", "libname", ")", ";", "OutputStream", "os", "=", "new", "FileOutputStream", "(", "tempfile", ")", ";", "logger", ".", "debug", "(", "\"tempfile.getPath() = \"", "+", "tempfile", ".", "getPath", "(", ")", ")", ";", "long", "savedTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "// Leo says 8k block size is STANDARD ;)\r", "byte", "buf", "[", "]", "=", "new", "byte", "[", "8192", "]", ";", "int", "len", ";", "while", "(", "(", "len", "=", "is", ".", "read", "(", "buf", ")", ")", ">", "0", ")", "{", "os", ".", "write", "(", "buf", ",", "0", ",", "len", ")", ";", "}", "os", ".", "flush", "(", ")", ";", "InputStream", "lock", "=", "new", "FileInputStream", "(", "tempfile", ")", ";", "os", ".", "close", "(", ")", ";", "double", "seconds", "=", "(", "double", ")", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "savedTime", ")", "/", "1e3", ";", "logger", ".", "debug", "(", "\"Copying took \"", "+", "seconds", "+", "\" seconds.\"", ")", ";", "logger", ".", "debug", "(", "\"Loading library from \"", "+", "tempfile", ".", "getPath", "(", ")", "+", "\".\"", ")", ";", "System", ".", "load", "(", "tempfile", ".", "getPath", "(", ")", ")", ";", "lock", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "io", ")", "{", "logger", ".", "error", "(", "\"Could not create the temp file: \"", "+", "io", ".", "toString", "(", ")", "+", "\".\\n\"", ")", ";", "}", "catch", "(", "UnsatisfiedLinkError", "ule", ")", "{", "logger", ".", "error", "(", "\"Couldn't load copied link file: \"", "+", "ule", ".", "toString", "(", ")", "+", "\".\\n\"", ")", ";", "throw", "ule", ";", "}", "}" ]
Load a system library from a stream. Copies the library to a temp file and loads from there. @param libname name of the library (just used in constructing the library name) @param is InputStream pointing to the library
[ "Load", "a", "system", "library", "from", "a", "stream", ".", "Copies", "the", "library", "to", "a", "temp", "file", "and", "loads", "from", "there", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/LibraryLoader.java#L249-L282
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkInterfaceTapConfigurationsInner.java
NetworkInterfaceTapConfigurationsInner.createOrUpdateAsync
public Observable<NetworkInterfaceTapConfigurationInner> createOrUpdateAsync(String resourceGroupName, String networkInterfaceName, String tapConfigurationName, NetworkInterfaceTapConfigurationInner tapConfigurationParameters) { """ Creates or updates a Tap configuration in the specified NetworkInterface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @param tapConfigurationName The name of the tap configuration. @param tapConfigurationParameters Parameters supplied to the create or update tap configuration operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters).map(new Func1<ServiceResponse<NetworkInterfaceTapConfigurationInner>, NetworkInterfaceTapConfigurationInner>() { @Override public NetworkInterfaceTapConfigurationInner call(ServiceResponse<NetworkInterfaceTapConfigurationInner> response) { return response.body(); } }); }
java
public Observable<NetworkInterfaceTapConfigurationInner> createOrUpdateAsync(String resourceGroupName, String networkInterfaceName, String tapConfigurationName, NetworkInterfaceTapConfigurationInner tapConfigurationParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters).map(new Func1<ServiceResponse<NetworkInterfaceTapConfigurationInner>, NetworkInterfaceTapConfigurationInner>() { @Override public NetworkInterfaceTapConfigurationInner call(ServiceResponse<NetworkInterfaceTapConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NetworkInterfaceTapConfigurationInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "networkInterfaceName", ",", "String", "tapConfigurationName", ",", "NetworkInterfaceTapConfigurationInner", "tapConfigurationParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkInterfaceName", ",", "tapConfigurationName", ",", "tapConfigurationParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "NetworkInterfaceTapConfigurationInner", ">", ",", "NetworkInterfaceTapConfigurationInner", ">", "(", ")", "{", "@", "Override", "public", "NetworkInterfaceTapConfigurationInner", "call", "(", "ServiceResponse", "<", "NetworkInterfaceTapConfigurationInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a Tap configuration in the specified NetworkInterface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @param tapConfigurationName The name of the tap configuration. @param tapConfigurationParameters Parameters supplied to the create or update tap configuration operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "Tap", "configuration", "in", "the", "specified", "NetworkInterface", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkInterfaceTapConfigurationsInner.java#L391-L398
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java
XPathParser.initXPath
public void initXPath( Compiler compiler, String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { """ Given an string, init an XPath object for selections, in order that a parse doesn't have to be done each time the expression is evaluated. @param compiler The compiler object. @param expression A string conforming to the XPath grammar. @param namespaceContext An object that is able to resolve prefixes in the XPath to namespaces. @throws javax.xml.transform.TransformerException """ m_ops = compiler; m_namespaceContext = namespaceContext; m_functionTable = compiler.getFunctionTable(); Lexer lexer = new Lexer(compiler, namespaceContext, this); lexer.tokenize(expression); m_ops.setOp(0,OpCodes.OP_XPATH); m_ops.setOp(OpMap.MAPINDEX_LENGTH,2); // Patch for Christine's gripe. She wants her errorHandler to return from // a fatal error and continue trying to parse, rather than throwing an exception. // Without the patch, that put us into an endless loop. // // %REVIEW% Is there a better way of doing this? // %REVIEW% Are there any other cases which need the safety net? // (and if so do we care right now, or should we rewrite the XPath // grammar engine and can fix it at that time?) try { nextToken(); Expr(); if (null != m_token) { String extraTokens = ""; while (null != m_token) { extraTokens += "'" + m_token + "'"; nextToken(); if (null != m_token) extraTokens += ", "; } error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS, new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens); } } catch (org.apache.xpath.XPathProcessorException e) { if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage())) { // What I _want_ to do is null out this XPath. // I doubt this has the desired effect, but I'm not sure what else to do. // %REVIEW%!!! initXPath(compiler, "/..", namespaceContext); } else throw e; } compiler.shrink(); }
java
public void initXPath( Compiler compiler, String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { m_ops = compiler; m_namespaceContext = namespaceContext; m_functionTable = compiler.getFunctionTable(); Lexer lexer = new Lexer(compiler, namespaceContext, this); lexer.tokenize(expression); m_ops.setOp(0,OpCodes.OP_XPATH); m_ops.setOp(OpMap.MAPINDEX_LENGTH,2); // Patch for Christine's gripe. She wants her errorHandler to return from // a fatal error and continue trying to parse, rather than throwing an exception. // Without the patch, that put us into an endless loop. // // %REVIEW% Is there a better way of doing this? // %REVIEW% Are there any other cases which need the safety net? // (and if so do we care right now, or should we rewrite the XPath // grammar engine and can fix it at that time?) try { nextToken(); Expr(); if (null != m_token) { String extraTokens = ""; while (null != m_token) { extraTokens += "'" + m_token + "'"; nextToken(); if (null != m_token) extraTokens += ", "; } error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS, new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens); } } catch (org.apache.xpath.XPathProcessorException e) { if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage())) { // What I _want_ to do is null out this XPath. // I doubt this has the desired effect, but I'm not sure what else to do. // %REVIEW%!!! initXPath(compiler, "/..", namespaceContext); } else throw e; } compiler.shrink(); }
[ "public", "void", "initXPath", "(", "Compiler", "compiler", ",", "String", "expression", ",", "PrefixResolver", "namespaceContext", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "m_ops", "=", "compiler", ";", "m_namespaceContext", "=", "namespaceContext", ";", "m_functionTable", "=", "compiler", ".", "getFunctionTable", "(", ")", ";", "Lexer", "lexer", "=", "new", "Lexer", "(", "compiler", ",", "namespaceContext", ",", "this", ")", ";", "lexer", ".", "tokenize", "(", "expression", ")", ";", "m_ops", ".", "setOp", "(", "0", ",", "OpCodes", ".", "OP_XPATH", ")", ";", "m_ops", ".", "setOp", "(", "OpMap", ".", "MAPINDEX_LENGTH", ",", "2", ")", ";", "// Patch for Christine's gripe. She wants her errorHandler to return from", "// a fatal error and continue trying to parse, rather than throwing an exception.", "// Without the patch, that put us into an endless loop.", "//", "// %REVIEW% Is there a better way of doing this?", "// %REVIEW% Are there any other cases which need the safety net?", "// \t(and if so do we care right now, or should we rewrite the XPath", "//\tgrammar engine and can fix it at that time?)", "try", "{", "nextToken", "(", ")", ";", "Expr", "(", ")", ";", "if", "(", "null", "!=", "m_token", ")", "{", "String", "extraTokens", "=", "\"\"", ";", "while", "(", "null", "!=", "m_token", ")", "{", "extraTokens", "+=", "\"'\"", "+", "m_token", "+", "\"'\"", ";", "nextToken", "(", ")", ";", "if", "(", "null", "!=", "m_token", ")", "extraTokens", "+=", "\", \"", ";", "}", "error", "(", "XPATHErrorResources", ".", "ER_EXTRA_ILLEGAL_TOKENS", ",", "new", "Object", "[", "]", "{", "extraTokens", "}", ")", ";", "//\"Extra illegal tokens: \"+extraTokens);", "}", "}", "catch", "(", "org", ".", "apache", ".", "xpath", ".", "XPathProcessorException", "e", ")", "{", "if", "(", "CONTINUE_AFTER_FATAL_ERROR", ".", "equals", "(", "e", ".", "getMessage", "(", ")", ")", ")", "{", "// What I _want_ to do is null out this XPath.", "// I doubt this has the desired effect, but I'm not sure what else to do.", "// %REVIEW%!!!", "initXPath", "(", "compiler", ",", "\"/..\"", ",", "namespaceContext", ")", ";", "}", "else", "throw", "e", ";", "}", "compiler", ".", "shrink", "(", ")", ";", "}" ]
Given an string, init an XPath object for selections, in order that a parse doesn't have to be done each time the expression is evaluated. @param compiler The compiler object. @param expression A string conforming to the XPath grammar. @param namespaceContext An object that is able to resolve prefixes in the XPath to namespaces. @throws javax.xml.transform.TransformerException
[ "Given", "an", "string", "init", "an", "XPath", "object", "for", "selections", "in", "order", "that", "a", "parse", "doesn", "t", "have", "to", "be", "done", "each", "time", "the", "expression", "is", "evaluated", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L101-L164
windup/windup
graph/api/src/main/java/org/jboss/windup/graph/service/OrganizationService.java
OrganizationService.attachLink
public OrganizationModel attachLink(OrganizationModel organizationModel, LinkModel linkModel) { """ This method just attaches the {@link LinkModel} to the {@link OrganizationModel}. It will only do so if this link is not already present. """ // check for duplicates for (LinkModel existing : organizationModel.getLinks()) { if (existing.equals(linkModel)) { return organizationModel; } } organizationModel.addLink(linkModel); return organizationModel; }
java
public OrganizationModel attachLink(OrganizationModel organizationModel, LinkModel linkModel) { // check for duplicates for (LinkModel existing : organizationModel.getLinks()) { if (existing.equals(linkModel)) { return organizationModel; } } organizationModel.addLink(linkModel); return organizationModel; }
[ "public", "OrganizationModel", "attachLink", "(", "OrganizationModel", "organizationModel", ",", "LinkModel", "linkModel", ")", "{", "// check for duplicates", "for", "(", "LinkModel", "existing", ":", "organizationModel", ".", "getLinks", "(", ")", ")", "{", "if", "(", "existing", ".", "equals", "(", "linkModel", ")", ")", "{", "return", "organizationModel", ";", "}", "}", "organizationModel", ".", "addLink", "(", "linkModel", ")", ";", "return", "organizationModel", ";", "}" ]
This method just attaches the {@link LinkModel} to the {@link OrganizationModel}. It will only do so if this link is not already present.
[ "This", "method", "just", "attaches", "the", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/graph/api/src/main/java/org/jboss/windup/graph/service/OrganizationService.java#L63-L75
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.eachMatch
public static String eachMatch(String self, String regex, @ClosureParams(value=FromString.class, options= { """ Process each regex group matched substring of the given string. If the closure parameter takes one argument, an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group. @param self the source string @param regex a Regex string @param closure a closure with one parameter or as much parameters as groups @return the source string @since 1.6.0 """"List<String>","String[]"}) Closure closure) { return eachMatch(self, Pattern.compile(regex), closure); }
java
public static String eachMatch(String self, String regex, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) { return eachMatch(self, Pattern.compile(regex), closure); }
[ "public", "static", "String", "eachMatch", "(", "String", "self", ",", "String", "regex", ",", "@", "ClosureParams", "(", "value", "=", "FromString", ".", "class", ",", "options", "=", "{", "\"List<String>\"", ",", "\"String[]\"", "}", ")", "Closure", "closure", ")", "{", "return", "eachMatch", "(", "self", ",", "Pattern", ".", "compile", "(", "regex", ")", ",", "closure", ")", ";", "}" ]
Process each regex group matched substring of the given string. If the closure parameter takes one argument, an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group. @param self the source string @param regex a Regex string @param closure a closure with one parameter or as much parameters as groups @return the source string @since 1.6.0
[ "Process", "each", "regex", "group", "matched", "substring", "of", "the", "given", "string", ".", "If", "the", "closure", "parameter", "takes", "one", "argument", "an", "array", "with", "all", "match", "groups", "is", "passed", "to", "it", ".", "If", "the", "closure", "takes", "as", "many", "arguments", "as", "there", "are", "match", "groups", "then", "each", "parameter", "will", "be", "one", "match", "group", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L745-L747
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/extras/Poi.java
Poi.create_POI_Image
private BufferedImage create_POI_Image(final int WIDTH) { """ Creates the image of the poi @param WIDTH @return buffered image of the poi """ if (WIDTH <= 0) { return null; } final java.awt.image.BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, java.awt.Transparency.TRANSLUCENT); final java.awt.Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING, java.awt.RenderingHints.VALUE_ANTIALIAS_ON); //G2.setRenderingHint(java.awt.RenderingHints.KEY_RENDERING, java.awt.RenderingHints.VALUE_RENDER_QUALITY); //G2.setRenderingHint(java.awt.RenderingHints.KEY_DITHERING, java.awt.RenderingHints.VALUE_DITHER_ENABLE); //G2.setRenderingHint(java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION, java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); //G2.setRenderingHint(java.awt.RenderingHints.KEY_COLOR_RENDERING, java.awt.RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(java.awt.RenderingHints.KEY_STROKE_CONTROL, java.awt.RenderingHints.VALUE_STROKE_NORMALIZE); //G2.setRenderingHint(java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final java.awt.geom.Ellipse2D BLIP = new java.awt.geom.Ellipse2D.Double(0, 0, WIDTH, WIDTH); final java.awt.geom.Point2D CENTER = new java.awt.geom.Point2D.Double(BLIP.getCenterX(), BLIP.getCenterY()); final float[] FRACTIONS = { 0.0f, 1.0f }; final Color[] COLORS = { new Color(1.0f, 1.0f, 1.0f, 0.9f), new Color(1.0f, 1.0f, 1.0f, 0.0f) }; final java.awt.RadialGradientPaint GRADIENT = new java.awt.RadialGradientPaint(CENTER, (int) (WIDTH / 2.0), FRACTIONS, COLORS); G2.setPaint(GRADIENT); G2.fill(BLIP); G2.dispose(); return IMAGE; }
java
private BufferedImage create_POI_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final java.awt.image.BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, java.awt.Transparency.TRANSLUCENT); final java.awt.Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING, java.awt.RenderingHints.VALUE_ANTIALIAS_ON); //G2.setRenderingHint(java.awt.RenderingHints.KEY_RENDERING, java.awt.RenderingHints.VALUE_RENDER_QUALITY); //G2.setRenderingHint(java.awt.RenderingHints.KEY_DITHERING, java.awt.RenderingHints.VALUE_DITHER_ENABLE); //G2.setRenderingHint(java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION, java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); //G2.setRenderingHint(java.awt.RenderingHints.KEY_COLOR_RENDERING, java.awt.RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(java.awt.RenderingHints.KEY_STROKE_CONTROL, java.awt.RenderingHints.VALUE_STROKE_NORMALIZE); //G2.setRenderingHint(java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final java.awt.geom.Ellipse2D BLIP = new java.awt.geom.Ellipse2D.Double(0, 0, WIDTH, WIDTH); final java.awt.geom.Point2D CENTER = new java.awt.geom.Point2D.Double(BLIP.getCenterX(), BLIP.getCenterY()); final float[] FRACTIONS = { 0.0f, 1.0f }; final Color[] COLORS = { new Color(1.0f, 1.0f, 1.0f, 0.9f), new Color(1.0f, 1.0f, 1.0f, 0.0f) }; final java.awt.RadialGradientPaint GRADIENT = new java.awt.RadialGradientPaint(CENTER, (int) (WIDTH / 2.0), FRACTIONS, COLORS); G2.setPaint(GRADIENT); G2.fill(BLIP); G2.dispose(); return IMAGE; }
[ "private", "BufferedImage", "create_POI_Image", "(", "final", "int", "WIDTH", ")", "{", "if", "(", "WIDTH", "<=", "0", ")", "{", "return", "null", ";", "}", "final", "java", ".", "awt", ".", "image", ".", "BufferedImage", "IMAGE", "=", "UTIL", ".", "createImage", "(", "WIDTH", ",", "WIDTH", ",", "java", ".", "awt", ".", "Transparency", ".", "TRANSLUCENT", ")", ";", "final", "java", ".", "awt", ".", "Graphics2D", "G2", "=", "IMAGE", ".", "createGraphics", "(", ")", ";", "G2", ".", "setRenderingHint", "(", "java", ".", "awt", ".", "RenderingHints", ".", "KEY_ANTIALIASING", ",", "java", ".", "awt", ".", "RenderingHints", ".", "VALUE_ANTIALIAS_ON", ")", ";", "//G2.setRenderingHint(java.awt.RenderingHints.KEY_RENDERING, java.awt.RenderingHints.VALUE_RENDER_QUALITY);", "//G2.setRenderingHint(java.awt.RenderingHints.KEY_DITHERING, java.awt.RenderingHints.VALUE_DITHER_ENABLE);", "//G2.setRenderingHint(java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION, java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);", "//G2.setRenderingHint(java.awt.RenderingHints.KEY_COLOR_RENDERING, java.awt.RenderingHints.VALUE_COLOR_RENDER_QUALITY);", "G2", ".", "setRenderingHint", "(", "java", ".", "awt", ".", "RenderingHints", ".", "KEY_STROKE_CONTROL", ",", "java", ".", "awt", ".", "RenderingHints", ".", "VALUE_STROKE_NORMALIZE", ")", ";", "//G2.setRenderingHint(java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON);", "final", "java", ".", "awt", ".", "geom", ".", "Ellipse2D", "BLIP", "=", "new", "java", ".", "awt", ".", "geom", ".", "Ellipse2D", ".", "Double", "(", "0", ",", "0", ",", "WIDTH", ",", "WIDTH", ")", ";", "final", "java", ".", "awt", ".", "geom", ".", "Point2D", "CENTER", "=", "new", "java", ".", "awt", ".", "geom", ".", "Point2D", ".", "Double", "(", "BLIP", ".", "getCenterX", "(", ")", ",", "BLIP", ".", "getCenterY", "(", ")", ")", ";", "final", "float", "[", "]", "FRACTIONS", "=", "{", "0.0f", ",", "1.0f", "}", ";", "final", "Color", "[", "]", "COLORS", "=", "{", "new", "Color", "(", "1.0f", ",", "1.0f", ",", "1.0f", ",", "0.9f", ")", ",", "new", "Color", "(", "1.0f", ",", "1.0f", ",", "1.0f", ",", "0.0f", ")", "}", ";", "final", "java", ".", "awt", ".", "RadialGradientPaint", "GRADIENT", "=", "new", "java", ".", "awt", ".", "RadialGradientPaint", "(", "CENTER", ",", "(", "int", ")", "(", "WIDTH", "/", "2.0", ")", ",", "FRACTIONS", ",", "COLORS", ")", ";", "G2", ".", "setPaint", "(", "GRADIENT", ")", ";", "G2", ".", "fill", "(", "BLIP", ")", ";", "G2", ".", "dispose", "(", ")", ";", "return", "IMAGE", ";", "}" ]
Creates the image of the poi @param WIDTH @return buffered image of the poi
[ "Creates", "the", "image", "of", "the", "poi" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Poi.java#L456-L488
ThreeTen/threetenbp
src/main/java/org/threeten/bp/format/DateTimeFormatter.java
DateTimeFormatter.withResolverStyle
public DateTimeFormatter withResolverStyle(ResolverStyle resolverStyle) { """ Returns a copy of this formatter with a new resolver style. <p> This returns a formatter with similar state to this formatter but with the resolver style set. By default, a formatter has the {@link ResolverStyle#SMART SMART} resolver style. <p> Changing the resolver style only has an effect during parsing. Parsing a text string occurs in two phases. Phase 1 is a basic text parse according to the fields added to the builder. Phase 2 resolves the parsed field-value pairs into date and/or time objects. The resolver style is used to control how phase 2, resolving, happens. See {@code ResolverStyle} for more information on the options available. <p> This instance is immutable and unaffected by this method call. @param resolverStyle the new resolver style, not null @return a formatter based on this formatter with the requested resolver style, not null """ Jdk8Methods.requireNonNull(resolverStyle, "resolverStyle"); if (Jdk8Methods.equals(this.resolverStyle, resolverStyle)) { return this; } return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone); }
java
public DateTimeFormatter withResolverStyle(ResolverStyle resolverStyle) { Jdk8Methods.requireNonNull(resolverStyle, "resolverStyle"); if (Jdk8Methods.equals(this.resolverStyle, resolverStyle)) { return this; } return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone); }
[ "public", "DateTimeFormatter", "withResolverStyle", "(", "ResolverStyle", "resolverStyle", ")", "{", "Jdk8Methods", ".", "requireNonNull", "(", "resolverStyle", ",", "\"resolverStyle\"", ")", ";", "if", "(", "Jdk8Methods", ".", "equals", "(", "this", ".", "resolverStyle", ",", "resolverStyle", ")", ")", "{", "return", "this", ";", "}", "return", "new", "DateTimeFormatter", "(", "printerParser", ",", "locale", ",", "decimalStyle", ",", "resolverStyle", ",", "resolverFields", ",", "chrono", ",", "zone", ")", ";", "}" ]
Returns a copy of this formatter with a new resolver style. <p> This returns a formatter with similar state to this formatter but with the resolver style set. By default, a formatter has the {@link ResolverStyle#SMART SMART} resolver style. <p> Changing the resolver style only has an effect during parsing. Parsing a text string occurs in two phases. Phase 1 is a basic text parse according to the fields added to the builder. Phase 2 resolves the parsed field-value pairs into date and/or time objects. The resolver style is used to control how phase 2, resolving, happens. See {@code ResolverStyle} for more information on the options available. <p> This instance is immutable and unaffected by this method call. @param resolverStyle the new resolver style, not null @return a formatter based on this formatter with the requested resolver style, not null
[ "Returns", "a", "copy", "of", "this", "formatter", "with", "a", "new", "resolver", "style", ".", "<p", ">", "This", "returns", "a", "formatter", "with", "similar", "state", "to", "this", "formatter", "but", "with", "the", "resolver", "style", "set", ".", "By", "default", "a", "formatter", "has", "the", "{", "@link", "ResolverStyle#SMART", "SMART", "}", "resolver", "style", ".", "<p", ">", "Changing", "the", "resolver", "style", "only", "has", "an", "effect", "during", "parsing", ".", "Parsing", "a", "text", "string", "occurs", "in", "two", "phases", ".", "Phase", "1", "is", "a", "basic", "text", "parse", "according", "to", "the", "fields", "added", "to", "the", "builder", ".", "Phase", "2", "resolves", "the", "parsed", "field", "-", "value", "pairs", "into", "date", "and", "/", "or", "time", "objects", ".", "The", "resolver", "style", "is", "used", "to", "control", "how", "phase", "2", "resolving", "happens", ".", "See", "{", "@code", "ResolverStyle", "}", "for", "more", "information", "on", "the", "options", "available", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatter.java#L1223-L1229
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/lang/SystemUtil.java
SystemUtil.isClassAvailable
public static boolean isClassAvailable(String pClassName, Class pFromClass) { """ Tests if a named class is available from another class. If a class is considered available, a call to {@code Class.forName(pClassName, true, pFromClass.getClassLoader())} will not result in an exception. @param pClassName the class name to test @param pFromClass the class to test from @return {@code true} if available """ ClassLoader loader = pFromClass != null ? pFromClass.getClassLoader() : null; return isClassAvailable(pClassName, loader); }
java
public static boolean isClassAvailable(String pClassName, Class pFromClass) { ClassLoader loader = pFromClass != null ? pFromClass.getClassLoader() : null; return isClassAvailable(pClassName, loader); }
[ "public", "static", "boolean", "isClassAvailable", "(", "String", "pClassName", ",", "Class", "pFromClass", ")", "{", "ClassLoader", "loader", "=", "pFromClass", "!=", "null", "?", "pFromClass", ".", "getClassLoader", "(", ")", ":", "null", ";", "return", "isClassAvailable", "(", "pClassName", ",", "loader", ")", ";", "}" ]
Tests if a named class is available from another class. If a class is considered available, a call to {@code Class.forName(pClassName, true, pFromClass.getClassLoader())} will not result in an exception. @param pClassName the class name to test @param pFromClass the class to test from @return {@code true} if available
[ "Tests", "if", "a", "named", "class", "is", "available", "from", "another", "class", ".", "If", "a", "class", "is", "considered", "available", "a", "call", "to", "{", "@code", "Class", ".", "forName", "(", "pClassName", "true", "pFromClass", ".", "getClassLoader", "()", ")", "}", "will", "not", "result", "in", "an", "exception", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/SystemUtil.java#L590-L593
meltmedia/cadmium
servlets/src/main/java/com/meltmedia/cadmium/servlets/shiro/PersistablePropertiesRealm.java
PersistablePropertiesRealm.loadProperties
public void loadProperties(File contentDir) { """ loads a properties file named {@link REALM_FILE_NAME} in the directory passed in. """ String resourceFile = null; if(contentDir.exists() && contentDir.isDirectory()) { File propFile = new File(contentDir, REALM_FILE_NAME); if(propFile.exists() && propFile.canRead()) { resourceFile = propFile.getAbsoluteFile().getAbsolutePath(); } } else if(contentDir.exists() && contentDir.isFile() && contentDir.canRead()) { resourceFile = contentDir.getAbsoluteFile().getAbsolutePath(); } if(StringUtils.isNotBlank(resourceFile)) { this.setResourcePath("file:"+resourceFile); this.destroy(); this.init(); } }
java
public void loadProperties(File contentDir) { String resourceFile = null; if(contentDir.exists() && contentDir.isDirectory()) { File propFile = new File(contentDir, REALM_FILE_NAME); if(propFile.exists() && propFile.canRead()) { resourceFile = propFile.getAbsoluteFile().getAbsolutePath(); } } else if(contentDir.exists() && contentDir.isFile() && contentDir.canRead()) { resourceFile = contentDir.getAbsoluteFile().getAbsolutePath(); } if(StringUtils.isNotBlank(resourceFile)) { this.setResourcePath("file:"+resourceFile); this.destroy(); this.init(); } }
[ "public", "void", "loadProperties", "(", "File", "contentDir", ")", "{", "String", "resourceFile", "=", "null", ";", "if", "(", "contentDir", ".", "exists", "(", ")", "&&", "contentDir", ".", "isDirectory", "(", ")", ")", "{", "File", "propFile", "=", "new", "File", "(", "contentDir", ",", "REALM_FILE_NAME", ")", ";", "if", "(", "propFile", ".", "exists", "(", ")", "&&", "propFile", ".", "canRead", "(", ")", ")", "{", "resourceFile", "=", "propFile", ".", "getAbsoluteFile", "(", ")", ".", "getAbsolutePath", "(", ")", ";", "}", "}", "else", "if", "(", "contentDir", ".", "exists", "(", ")", "&&", "contentDir", ".", "isFile", "(", ")", "&&", "contentDir", ".", "canRead", "(", ")", ")", "{", "resourceFile", "=", "contentDir", ".", "getAbsoluteFile", "(", ")", ".", "getAbsolutePath", "(", ")", ";", "}", "if", "(", "StringUtils", ".", "isNotBlank", "(", "resourceFile", ")", ")", "{", "this", ".", "setResourcePath", "(", "\"file:\"", "+", "resourceFile", ")", ";", "this", ".", "destroy", "(", ")", ";", "this", ".", "init", "(", ")", ";", "}", "}" ]
loads a properties file named {@link REALM_FILE_NAME} in the directory passed in.
[ "loads", "a", "properties", "file", "named", "{" ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/shiro/PersistablePropertiesRealm.java#L88-L103
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletAdministrationHelper.java
PortletAdministrationHelper.addPrincipalPermissionsToForm
private void addPrincipalPermissionsToForm(IPortletDefinition def, PortletDefinitionForm form) { """ /* Add to the form SUBSCRIBE, BROWSE, and CONFIGURE activity permissions, along with their principals, assigned to the portlet. """ final String portletTargetId = PermissionHelper.permissionTargetIdForPortletDefinition(def); final Set<JsonEntityBean> principalBeans = new HashSet<>(); Map<String, IPermissionManager> permManagers = new HashMap<>(); for (PortletPermissionsOnForm perm : PortletPermissionsOnForm.values()) { if (!permManagers.containsKey(perm.getOwner())) { permManagers.put( perm.getOwner(), authorizationService.newPermissionManager(perm.getOwner())); } final IPermissionManager pm = permManagers.get(perm.getOwner()); /* Obtain the principals that have permission for the activity on this portlet */ final IAuthorizationPrincipal[] principals = pm.getAuthorizedPrincipals(perm.getActivity(), portletTargetId); for (IAuthorizationPrincipal principal : principals) { JsonEntityBean principalBean; // first assume this is a group final IEntityGroup group = GroupService.findGroup(principal.getKey()); if (group != null) { // principal is a group principalBean = new JsonEntityBean(group, EntityEnum.GROUP); } else { // not a group, so it must be a person final IGroupMember member = authorizationService.getGroupMember(principal); principalBean = new JsonEntityBean(member, EntityEnum.PERSON); // set the name final String name = groupListHelper.lookupEntityName(principalBean); principalBean.setName(name); } principalBeans.add(principalBean); form.addPermission(principalBean.getTypeAndIdHash() + "_" + perm.getActivity()); } } form.setPrincipals(principalBeans, false); }
java
private void addPrincipalPermissionsToForm(IPortletDefinition def, PortletDefinitionForm form) { final String portletTargetId = PermissionHelper.permissionTargetIdForPortletDefinition(def); final Set<JsonEntityBean> principalBeans = new HashSet<>(); Map<String, IPermissionManager> permManagers = new HashMap<>(); for (PortletPermissionsOnForm perm : PortletPermissionsOnForm.values()) { if (!permManagers.containsKey(perm.getOwner())) { permManagers.put( perm.getOwner(), authorizationService.newPermissionManager(perm.getOwner())); } final IPermissionManager pm = permManagers.get(perm.getOwner()); /* Obtain the principals that have permission for the activity on this portlet */ final IAuthorizationPrincipal[] principals = pm.getAuthorizedPrincipals(perm.getActivity(), portletTargetId); for (IAuthorizationPrincipal principal : principals) { JsonEntityBean principalBean; // first assume this is a group final IEntityGroup group = GroupService.findGroup(principal.getKey()); if (group != null) { // principal is a group principalBean = new JsonEntityBean(group, EntityEnum.GROUP); } else { // not a group, so it must be a person final IGroupMember member = authorizationService.getGroupMember(principal); principalBean = new JsonEntityBean(member, EntityEnum.PERSON); // set the name final String name = groupListHelper.lookupEntityName(principalBean); principalBean.setName(name); } principalBeans.add(principalBean); form.addPermission(principalBean.getTypeAndIdHash() + "_" + perm.getActivity()); } } form.setPrincipals(principalBeans, false); }
[ "private", "void", "addPrincipalPermissionsToForm", "(", "IPortletDefinition", "def", ",", "PortletDefinitionForm", "form", ")", "{", "final", "String", "portletTargetId", "=", "PermissionHelper", ".", "permissionTargetIdForPortletDefinition", "(", "def", ")", ";", "final", "Set", "<", "JsonEntityBean", ">", "principalBeans", "=", "new", "HashSet", "<>", "(", ")", ";", "Map", "<", "String", ",", "IPermissionManager", ">", "permManagers", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "PortletPermissionsOnForm", "perm", ":", "PortletPermissionsOnForm", ".", "values", "(", ")", ")", "{", "if", "(", "!", "permManagers", ".", "containsKey", "(", "perm", ".", "getOwner", "(", ")", ")", ")", "{", "permManagers", ".", "put", "(", "perm", ".", "getOwner", "(", ")", ",", "authorizationService", ".", "newPermissionManager", "(", "perm", ".", "getOwner", "(", ")", ")", ")", ";", "}", "final", "IPermissionManager", "pm", "=", "permManagers", ".", "get", "(", "perm", ".", "getOwner", "(", ")", ")", ";", "/* Obtain the principals that have permission for the activity on this portlet */", "final", "IAuthorizationPrincipal", "[", "]", "principals", "=", "pm", ".", "getAuthorizedPrincipals", "(", "perm", ".", "getActivity", "(", ")", ",", "portletTargetId", ")", ";", "for", "(", "IAuthorizationPrincipal", "principal", ":", "principals", ")", "{", "JsonEntityBean", "principalBean", ";", "// first assume this is a group", "final", "IEntityGroup", "group", "=", "GroupService", ".", "findGroup", "(", "principal", ".", "getKey", "(", ")", ")", ";", "if", "(", "group", "!=", "null", ")", "{", "// principal is a group", "principalBean", "=", "new", "JsonEntityBean", "(", "group", ",", "EntityEnum", ".", "GROUP", ")", ";", "}", "else", "{", "// not a group, so it must be a person", "final", "IGroupMember", "member", "=", "authorizationService", ".", "getGroupMember", "(", "principal", ")", ";", "principalBean", "=", "new", "JsonEntityBean", "(", "member", ",", "EntityEnum", ".", "PERSON", ")", ";", "// set the name", "final", "String", "name", "=", "groupListHelper", ".", "lookupEntityName", "(", "principalBean", ")", ";", "principalBean", ".", "setName", "(", "name", ")", ";", "}", "principalBeans", ".", "add", "(", "principalBean", ")", ";", "form", ".", "addPermission", "(", "principalBean", ".", "getTypeAndIdHash", "(", ")", "+", "\"_\"", "+", "perm", ".", "getActivity", "(", ")", ")", ";", "}", "}", "form", ".", "setPrincipals", "(", "principalBeans", ",", "false", ")", ";", "}" ]
/* Add to the form SUBSCRIBE, BROWSE, and CONFIGURE activity permissions, along with their principals, assigned to the portlet.
[ "/", "*", "Add", "to", "the", "form", "SUBSCRIBE", "BROWSE", "and", "CONFIGURE", "activity", "permissions", "along", "with", "their", "principals", "assigned", "to", "the", "portlet", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletAdministrationHelper.java#L222-L261
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/transformer/AbstractObservableTransformerSource.java
AbstractObservableTransformerSource.onSourceErrorOccurred
protected void onSourceErrorOccurred(TransformerSourceErrorEvent event) { """ (Re)-fires a preconstructed event. @param event The event to fire """ for (TransformerSourceEventListener listener : transformerSourceEventListeners) fireErrorEvent(listener, event); } /** * Fires the given event on the given listener. * @param listener The listener to fire the event to. * @param event The event to fire. */ private void fireErrorEvent(TransformerSourceEventListener listener, TransformerSourceErrorEvent event) { try { listener.ErrorOccurred(event); } catch (RuntimeException e) { // Log this somehow System.err.println("Exception thrown while trying to invoke event listener, removing bed behaved listener."); e.printStackTrace(); removeTransformerSourceEventListener(listener); } } }
java
protected void onSourceErrorOccurred(TransformerSourceErrorEvent event) { for (TransformerSourceEventListener listener : transformerSourceEventListeners) fireErrorEvent(listener, event); } /** * Fires the given event on the given listener. * @param listener The listener to fire the event to. * @param event The event to fire. */ private void fireErrorEvent(TransformerSourceEventListener listener, TransformerSourceErrorEvent event) { try { listener.ErrorOccurred(event); } catch (RuntimeException e) { // Log this somehow System.err.println("Exception thrown while trying to invoke event listener, removing bed behaved listener."); e.printStackTrace(); removeTransformerSourceEventListener(listener); } } }
[ "protected", "void", "onSourceErrorOccurred", "(", "TransformerSourceErrorEvent", "event", ")", "{", "for", "(", "TransformerSourceEventListener", "listener", ":", "transformerSourceEventListeners", ")", "fireErrorEvent", "(", "listener", ",", "event", ")", ";", "}", "/**\n * Fires the given event on the given listener.\n * @param listener The listener to fire the event to.\n * @param event The event to fire.\n */", "private", "void", "fireErrorEvent", "(", "TransformerSourceEventListener", "listener", ",", "TransformerSourceErrorEvent", "event", ")", "{", "try", "{", "listener", ".", "ErrorOccurred", "(", "event", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "// Log this somehow", "System", ".", "err", ".", "println", "(", "\"Exception thrown while trying to invoke event listener, removing bed behaved listener.\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "removeTransformerSourceEventListener", "(", "listener", ")", ";", "}", "}", "}" ]
(Re)-fires a preconstructed event. @param event The event to fire
[ "(", "Re", ")", "-", "fires", "a", "preconstructed", "event", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/transformer/AbstractObservableTransformerSource.java#L79-L102
sahan/RoboZombie
robozombie/src/main/java/com/lonepulse/robozombie/AbstractGenericFactory.java
AbstractGenericFactory.newInstance
@Override public OUTPUT newInstance(INPUT input, INPUT... inputs) throws FAILURE { """ <p><b>Unsupported</b>. Override to provide an implementation.</p> <p>See {@link GenericFactory#newInstance(Object, Object...)}</p> @since 1.3.0 """ StringBuilder builder = new StringBuilder() .append(getClass().getName()) .append(".newInstance(Input, Input...) is unsupported."); throw new UnsupportedOperationException(builder.toString()); }
java
@Override public OUTPUT newInstance(INPUT input, INPUT... inputs) throws FAILURE { StringBuilder builder = new StringBuilder() .append(getClass().getName()) .append(".newInstance(Input, Input...) is unsupported."); throw new UnsupportedOperationException(builder.toString()); }
[ "@", "Override", "public", "OUTPUT", "newInstance", "(", "INPUT", "input", ",", "INPUT", "...", "inputs", ")", "throws", "FAILURE", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ".", "append", "(", "getClass", "(", ")", ".", "getName", "(", ")", ")", ".", "append", "(", "\".newInstance(Input, Input...) is unsupported.\"", ")", ";", "throw", "new", "UnsupportedOperationException", "(", "builder", ".", "toString", "(", ")", ")", ";", "}" ]
<p><b>Unsupported</b>. Override to provide an implementation.</p> <p>See {@link GenericFactory#newInstance(Object, Object...)}</p> @since 1.3.0
[ "<p", ">", "<b", ">", "Unsupported<", "/", "b", ">", ".", "Override", "to", "provide", "an", "implementation", ".", "<", "/", "p", ">" ]
train
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/com/lonepulse/robozombie/AbstractGenericFactory.java#L83-L91
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java
TimeZone.getDisplayName
public final String getDisplayName(boolean daylight, int style) { """ Returns a name in the specified {@code style} of this {@code TimeZone} suitable for presentation to the user in the default locale. If the specified {@code daylight} is {@code true}, a Daylight Saving Time name is returned (even if this {@code TimeZone} doesn't observe Daylight Saving Time). Otherwise, a Standard Time name is returned. <p>This method is equivalent to: <blockquote><pre> getDisplayName(daylight, style, Locale.getDefault({@link Locale.Category#DISPLAY})) </pre></blockquote> @param daylight {@code true} specifying a Daylight Saving Time name, or {@code false} specifying a Standard Time name @param style either {@link #LONG} or {@link #SHORT} @return the human-readable name of this time zone in the default locale. @exception IllegalArgumentException if {@code style} is invalid. @since 1.2 @see #getDisplayName(boolean, int, Locale) @see Locale#getDefault(Locale.Category) @see Locale.Category @see java.text.DateFormatSymbols#getZoneStrings() """ return getDisplayName(daylight, style, Locale.getDefault(Locale.Category.DISPLAY)); }
java
public final String getDisplayName(boolean daylight, int style) { return getDisplayName(daylight, style, Locale.getDefault(Locale.Category.DISPLAY)); }
[ "public", "final", "String", "getDisplayName", "(", "boolean", "daylight", ",", "int", "style", ")", "{", "return", "getDisplayName", "(", "daylight", ",", "style", ",", "Locale", ".", "getDefault", "(", "Locale", ".", "Category", ".", "DISPLAY", ")", ")", ";", "}" ]
Returns a name in the specified {@code style} of this {@code TimeZone} suitable for presentation to the user in the default locale. If the specified {@code daylight} is {@code true}, a Daylight Saving Time name is returned (even if this {@code TimeZone} doesn't observe Daylight Saving Time). Otherwise, a Standard Time name is returned. <p>This method is equivalent to: <blockquote><pre> getDisplayName(daylight, style, Locale.getDefault({@link Locale.Category#DISPLAY})) </pre></blockquote> @param daylight {@code true} specifying a Daylight Saving Time name, or {@code false} specifying a Standard Time name @param style either {@link #LONG} or {@link #SHORT} @return the human-readable name of this time zone in the default locale. @exception IllegalArgumentException if {@code style} is invalid. @since 1.2 @see #getDisplayName(boolean, int, Locale) @see Locale#getDefault(Locale.Category) @see Locale.Category @see java.text.DateFormatSymbols#getZoneStrings()
[ "Returns", "a", "name", "in", "the", "specified", "{", "@code", "style", "}", "of", "this", "{", "@code", "TimeZone", "}", "suitable", "for", "presentation", "to", "the", "user", "in", "the", "default", "locale", ".", "If", "the", "specified", "{", "@code", "daylight", "}", "is", "{", "@code", "true", "}", "a", "Daylight", "Saving", "Time", "name", "is", "returned", "(", "even", "if", "this", "{", "@code", "TimeZone", "}", "doesn", "t", "observe", "Daylight", "Saving", "Time", ")", ".", "Otherwise", "a", "Standard", "Time", "name", "is", "returned", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java#L369-L372
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/AbstractDatabase.java
AbstractDatabase.setDocumentExpiration
public void setDocumentExpiration(@NonNull String id, Date expiration) throws CouchbaseLiteException { """ Sets an expiration date on a document. After this time, the document will be purged from the database. @param id The ID of the Document @param expiration Nullable expiration timestamp as a Date, set timestamp to null to remove expiration date time from doc. @throws CouchbaseLiteException Throws an exception if any error occurs during the operation. """ if (id == null) { throw new IllegalArgumentException("document id cannot be null."); } synchronized (lock) { try { if (expiration == null) { getC4Database().setExpiration(id, 0); } else { getC4Database().setExpiration(id, expiration.getTime()); } scheduleDocumentExpiration(0); } catch (LiteCoreException e) { throw CBLStatus.convertException(e); } } }
java
public void setDocumentExpiration(@NonNull String id, Date expiration) throws CouchbaseLiteException { if (id == null) { throw new IllegalArgumentException("document id cannot be null."); } synchronized (lock) { try { if (expiration == null) { getC4Database().setExpiration(id, 0); } else { getC4Database().setExpiration(id, expiration.getTime()); } scheduleDocumentExpiration(0); } catch (LiteCoreException e) { throw CBLStatus.convertException(e); } } }
[ "public", "void", "setDocumentExpiration", "(", "@", "NonNull", "String", "id", ",", "Date", "expiration", ")", "throws", "CouchbaseLiteException", "{", "if", "(", "id", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"document id cannot be null.\"", ")", ";", "}", "synchronized", "(", "lock", ")", "{", "try", "{", "if", "(", "expiration", "==", "null", ")", "{", "getC4Database", "(", ")", ".", "setExpiration", "(", "id", ",", "0", ")", ";", "}", "else", "{", "getC4Database", "(", ")", ".", "setExpiration", "(", "id", ",", "expiration", ".", "getTime", "(", ")", ")", ";", "}", "scheduleDocumentExpiration", "(", "0", ")", ";", "}", "catch", "(", "LiteCoreException", "e", ")", "{", "throw", "CBLStatus", ".", "convertException", "(", "e", ")", ";", "}", "}", "}" ]
Sets an expiration date on a document. After this time, the document will be purged from the database. @param id The ID of the Document @param expiration Nullable expiration timestamp as a Date, set timestamp to null to remove expiration date time from doc. @throws CouchbaseLiteException Throws an exception if any error occurs during the operation.
[ "Sets", "an", "expiration", "date", "on", "a", "document", ".", "After", "this", "time", "the", "document", "will", "be", "purged", "from", "the", "database", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/AbstractDatabase.java#L503-L520
ecclesia/kipeto
kipeto-tools/src/main/java/de/ecclesia/kipeto/tools/blueprint/BlueprintFactory.java
BlueprintFactory.fromDir
public Blueprint fromDir(String programId, String description, File rootDir, File icon) { """ Erstellt einen Blueprint aus dem übergebenen RootDir. Blobs und Directorys werden sofort im übergebenen Repository gespeichert. Der Blueprint selbst wird <b>nicht</b> von gepeichert.<br/> <br/> Alle Dateien werden GZIP komprimiert @param programId Name @param description Beschreibung @param rootDir Einstiegsverzeichnis @param icon Icon @return """ return new Blueprint(programId, description, processDir(rootDir), processBlob(icon)); }
java
public Blueprint fromDir(String programId, String description, File rootDir, File icon) { return new Blueprint(programId, description, processDir(rootDir), processBlob(icon)); }
[ "public", "Blueprint", "fromDir", "(", "String", "programId", ",", "String", "description", ",", "File", "rootDir", ",", "File", "icon", ")", "{", "return", "new", "Blueprint", "(", "programId", ",", "description", ",", "processDir", "(", "rootDir", ")", ",", "processBlob", "(", "icon", ")", ")", ";", "}" ]
Erstellt einen Blueprint aus dem übergebenen RootDir. Blobs und Directorys werden sofort im übergebenen Repository gespeichert. Der Blueprint selbst wird <b>nicht</b> von gepeichert.<br/> <br/> Alle Dateien werden GZIP komprimiert @param programId Name @param description Beschreibung @param rootDir Einstiegsverzeichnis @param icon Icon @return
[ "Erstellt", "einen", "Blueprint", "aus", "dem", "übergebenen", "RootDir", ".", "Blobs", "und", "Directorys", "werden", "sofort", "im", "übergebenen", "Repository", "gespeichert", ".", "Der", "Blueprint", "selbst", "wird", "<b", ">", "nicht<", "/", "b", ">", "von", "gepeichert", ".", "<br", "/", ">", "<br", "/", ">", "Alle", "Dateien", "werden", "GZIP", "komprimiert" ]
train
https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-tools/src/main/java/de/ecclesia/kipeto/tools/blueprint/BlueprintFactory.java#L91-L93
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallKernelMap.java
InstallKernelMap.generateJsonFromIndividualESAs
private File generateJsonFromIndividualESAs(Path jsonDirectory, Map<String, String> shortNameMap) throws IOException, RepositoryException, InstallException { """ generate a JSON from provided individual ESA files @param generatedJson path @param shortNameMap contains features parsed from individual esa files @return singleJson file @throws IOException @throws RepositoryException @throws InstallException """ String dir = jsonDirectory.toString(); List<File> esas = (List<File>) data.get(INDIVIDUAL_ESAS); File singleJson = new File(dir + "/SingleJson.json"); for (File esa : esas) { try { populateFeatureNameFromManifest(esa, shortNameMap); } catch (IOException e) { throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_ESA_NOT_FOUND", esa.getAbsolutePath())); } SingleFileRepositoryConnection mySingleFileRepo = null; if (singleJson.exists()) { mySingleFileRepo = new SingleFileRepositoryConnection(singleJson); } else { try { mySingleFileRepo = SingleFileRepositoryConnection.createEmptyRepository(singleJson); } catch (IOException e) { throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_SINGLE_REPO_CONNECTION_FAILED", dir, esa.getAbsolutePath())); } } Parser<? extends RepositoryResourceWritable> parser = new EsaParser(true); RepositoryResourceWritable resource = parser.parseFileToResource(esa, null, null); resource.updateGeneratedFields(true); resource.setRepositoryConnection(mySingleFileRepo); // Overload the Maven coordinates field with the file path, since the ESA should be installed from that path resource.setMavenCoordinates(esa.getAbsolutePath()); resource.uploadToMassive(new AddThenDeleteStrategy()); } return singleJson; }
java
private File generateJsonFromIndividualESAs(Path jsonDirectory, Map<String, String> shortNameMap) throws IOException, RepositoryException, InstallException { String dir = jsonDirectory.toString(); List<File> esas = (List<File>) data.get(INDIVIDUAL_ESAS); File singleJson = new File(dir + "/SingleJson.json"); for (File esa : esas) { try { populateFeatureNameFromManifest(esa, shortNameMap); } catch (IOException e) { throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_ESA_NOT_FOUND", esa.getAbsolutePath())); } SingleFileRepositoryConnection mySingleFileRepo = null; if (singleJson.exists()) { mySingleFileRepo = new SingleFileRepositoryConnection(singleJson); } else { try { mySingleFileRepo = SingleFileRepositoryConnection.createEmptyRepository(singleJson); } catch (IOException e) { throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_SINGLE_REPO_CONNECTION_FAILED", dir, esa.getAbsolutePath())); } } Parser<? extends RepositoryResourceWritable> parser = new EsaParser(true); RepositoryResourceWritable resource = parser.parseFileToResource(esa, null, null); resource.updateGeneratedFields(true); resource.setRepositoryConnection(mySingleFileRepo); // Overload the Maven coordinates field with the file path, since the ESA should be installed from that path resource.setMavenCoordinates(esa.getAbsolutePath()); resource.uploadToMassive(new AddThenDeleteStrategy()); } return singleJson; }
[ "private", "File", "generateJsonFromIndividualESAs", "(", "Path", "jsonDirectory", ",", "Map", "<", "String", ",", "String", ">", "shortNameMap", ")", "throws", "IOException", ",", "RepositoryException", ",", "InstallException", "{", "String", "dir", "=", "jsonDirectory", ".", "toString", "(", ")", ";", "List", "<", "File", ">", "esas", "=", "(", "List", "<", "File", ">", ")", "data", ".", "get", "(", "INDIVIDUAL_ESAS", ")", ";", "File", "singleJson", "=", "new", "File", "(", "dir", "+", "\"/SingleJson.json\"", ")", ";", "for", "(", "File", "esa", ":", "esas", ")", "{", "try", "{", "populateFeatureNameFromManifest", "(", "esa", ",", "shortNameMap", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "InstallException", "(", "Messages", ".", "INSTALL_KERNEL_MESSAGES", ".", "getLogMessage", "(", "\"ERROR_ESA_NOT_FOUND\"", ",", "esa", ".", "getAbsolutePath", "(", ")", ")", ")", ";", "}", "SingleFileRepositoryConnection", "mySingleFileRepo", "=", "null", ";", "if", "(", "singleJson", ".", "exists", "(", ")", ")", "{", "mySingleFileRepo", "=", "new", "SingleFileRepositoryConnection", "(", "singleJson", ")", ";", "}", "else", "{", "try", "{", "mySingleFileRepo", "=", "SingleFileRepositoryConnection", ".", "createEmptyRepository", "(", "singleJson", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "InstallException", "(", "Messages", ".", "INSTALL_KERNEL_MESSAGES", ".", "getLogMessage", "(", "\"ERROR_SINGLE_REPO_CONNECTION_FAILED\"", ",", "dir", ",", "esa", ".", "getAbsolutePath", "(", ")", ")", ")", ";", "}", "}", "Parser", "<", "?", "extends", "RepositoryResourceWritable", ">", "parser", "=", "new", "EsaParser", "(", "true", ")", ";", "RepositoryResourceWritable", "resource", "=", "parser", ".", "parseFileToResource", "(", "esa", ",", "null", ",", "null", ")", ";", "resource", ".", "updateGeneratedFields", "(", "true", ")", ";", "resource", ".", "setRepositoryConnection", "(", "mySingleFileRepo", ")", ";", "// Overload the Maven coordinates field with the file path, since the ESA should be installed from that path", "resource", ".", "setMavenCoordinates", "(", "esa", ".", "getAbsolutePath", "(", ")", ")", ";", "resource", ".", "uploadToMassive", "(", "new", "AddThenDeleteStrategy", "(", ")", ")", ";", "}", "return", "singleJson", ";", "}" ]
generate a JSON from provided individual ESA files @param generatedJson path @param shortNameMap contains features parsed from individual esa files @return singleJson file @throws IOException @throws RepositoryException @throws InstallException
[ "generate", "a", "JSON", "from", "provided", "individual", "ESA", "files" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallKernelMap.java#L845-L881
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/TableInput.java
TableInput.withParameters
public TableInput withParameters(java.util.Map<String, String> parameters) { """ <p> These key-value pairs define properties associated with the table. </p> @param parameters These key-value pairs define properties associated with the table. @return Returns a reference to this object so that method calls can be chained together. """ setParameters(parameters); return this; }
java
public TableInput withParameters(java.util.Map<String, String> parameters) { setParameters(parameters); return this; }
[ "public", "TableInput", "withParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "setParameters", "(", "parameters", ")", ";", "return", "this", ";", "}" ]
<p> These key-value pairs define properties associated with the table. </p> @param parameters These key-value pairs define properties associated with the table. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "These", "key", "-", "value", "pairs", "define", "properties", "associated", "with", "the", "table", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/TableInput.java#L672-L675
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java
CertificateOperations.deleteCertificate
public void deleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { """ Deletes the certificate from the Batch account. <p>The delete operation requests that the certificate be deleted. The request puts the certificate in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETING Deleting} state. The Batch service will perform the actual certificate deletion without any further client action.</p> <p>You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that:</p> <ul> <li>The certificate is not associated with any pools.</li> <li>The certificate is not installed on any compute nodes. (Even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart.)</li> </ul> <p>If you try to delete a certificate that is in use, the deletion fails. The certificate state changes to {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed}. You can use {@link #cancelDeleteCertificate(String, String)} to set the status back to Active if you decide that you want to continue using the certificate.</p> @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. @param thumbprint The thumbprint of the certificate to delete. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ CertificateDeleteOptions options = new CertificateDeleteOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().certificates().delete(thumbprintAlgorithm, thumbprint, options); }
java
public void deleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { CertificateDeleteOptions options = new CertificateDeleteOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().certificates().delete(thumbprintAlgorithm, thumbprint, options); }
[ "public", "void", "deleteCertificate", "(", "String", "thumbprintAlgorithm", ",", "String", "thumbprint", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "CertificateDeleteOptions", "options", "=", "new", "CertificateDeleteOptions", "(", ")", ";", "BehaviorManager", "bhMgr", "=", "new", "BehaviorManager", "(", "this", ".", "customBehaviors", "(", ")", ",", "additionalBehaviors", ")", ";", "bhMgr", ".", "applyRequestBehaviors", "(", "options", ")", ";", "this", ".", "parentBatchClient", ".", "protocolLayer", "(", ")", ".", "certificates", "(", ")", ".", "delete", "(", "thumbprintAlgorithm", ",", "thumbprint", ",", "options", ")", ";", "}" ]
Deletes the certificate from the Batch account. <p>The delete operation requests that the certificate be deleted. The request puts the certificate in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETING Deleting} state. The Batch service will perform the actual certificate deletion without any further client action.</p> <p>You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that:</p> <ul> <li>The certificate is not associated with any pools.</li> <li>The certificate is not installed on any compute nodes. (Even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart.)</li> </ul> <p>If you try to delete a certificate that is in use, the deletion fails. The certificate state changes to {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed}. You can use {@link #cancelDeleteCertificate(String, String)} to set the status back to Active if you decide that you want to continue using the certificate.</p> @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. @param thumbprint The thumbprint of the certificate to delete. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Deletes", "the", "certificate", "from", "the", "Batch", "account", ".", "<p", ">", "The", "delete", "operation", "requests", "that", "the", "certificate", "be", "deleted", ".", "The", "request", "puts", "the", "certificate", "in", "the", "{", "@link", "com", ".", "microsoft", ".", "azure", ".", "batch", ".", "protocol", ".", "models", ".", "CertificateState#DELETING", "Deleting", "}", "state", ".", "The", "Batch", "service", "will", "perform", "the", "actual", "certificate", "deletion", "without", "any", "further", "client", "action", ".", "<", "/", "p", ">", "<p", ">", "You", "cannot", "delete", "a", "certificate", "if", "a", "resource", "(", "pool", "or", "compute", "node", ")", "is", "using", "it", ".", "Before", "you", "can", "delete", "a", "certificate", "you", "must", "therefore", "make", "sure", "that", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "The", "certificate", "is", "not", "associated", "with", "any", "pools", ".", "<", "/", "li", ">", "<li", ">", "The", "certificate", "is", "not", "installed", "on", "any", "compute", "nodes", ".", "(", "Even", "if", "you", "remove", "a", "certificate", "from", "a", "pool", "it", "is", "not", "removed", "from", "existing", "compute", "nodes", "in", "that", "pool", "until", "they", "restart", ".", ")", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "If", "you", "try", "to", "delete", "a", "certificate", "that", "is", "in", "use", "the", "deletion", "fails", ".", "The", "certificate", "state", "changes", "to", "{", "@link", "com", ".", "microsoft", ".", "azure", ".", "batch", ".", "protocol", ".", "models", ".", "CertificateState#DELETE_FAILED", "Delete", "Failed", "}", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L227-L233
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.addProjectMember
public GitlabProjectMember addProjectMember(Integer projectId, Integer userId, GitlabAccessLevel accessLevel) throws IOException { """ Add a project member. @param projectId the project id @param userId the user id @param accessLevel the GitlabAccessLevel @return the GitlabProjectMember @throws IOException on gitlab api call error """ Query query = new Query() .appendIf("id", projectId) .appendIf("user_id", userId) .appendIf("access_level", accessLevel); String tailUrl = GitlabProject.URL + "/" + projectId + GitlabProjectMember.URL + query.toString(); return dispatch().to(tailUrl, GitlabProjectMember.class); }
java
public GitlabProjectMember addProjectMember(Integer projectId, Integer userId, GitlabAccessLevel accessLevel) throws IOException { Query query = new Query() .appendIf("id", projectId) .appendIf("user_id", userId) .appendIf("access_level", accessLevel); String tailUrl = GitlabProject.URL + "/" + projectId + GitlabProjectMember.URL + query.toString(); return dispatch().to(tailUrl, GitlabProjectMember.class); }
[ "public", "GitlabProjectMember", "addProjectMember", "(", "Integer", "projectId", ",", "Integer", "userId", ",", "GitlabAccessLevel", "accessLevel", ")", "throws", "IOException", "{", "Query", "query", "=", "new", "Query", "(", ")", ".", "appendIf", "(", "\"id\"", ",", "projectId", ")", ".", "appendIf", "(", "\"user_id\"", ",", "userId", ")", ".", "appendIf", "(", "\"access_level\"", ",", "accessLevel", ")", ";", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "projectId", "+", "GitlabProjectMember", ".", "URL", "+", "query", ".", "toString", "(", ")", ";", "return", "dispatch", "(", ")", ".", "to", "(", "tailUrl", ",", "GitlabProjectMember", ".", "class", ")", ";", "}" ]
Add a project member. @param projectId the project id @param userId the user id @param accessLevel the GitlabAccessLevel @return the GitlabProjectMember @throws IOException on gitlab api call error
[ "Add", "a", "project", "member", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3041-L3048
tzaeschke/zoodb
src/org/zoodb/internal/server/index/AbstractPagedIndex.java
AbstractPagedIndex.writeToPreallocated
final int writeToPreallocated(StorageChannelOutput out, Map<AbstractIndexPage, Integer> map) { """ Special write method that uses only pre-allocated pages. @param map @return the root page Id. """ return getRoot().writeToPreallocated(out, map); }
java
final int writeToPreallocated(StorageChannelOutput out, Map<AbstractIndexPage, Integer> map) { return getRoot().writeToPreallocated(out, map); }
[ "final", "int", "writeToPreallocated", "(", "StorageChannelOutput", "out", ",", "Map", "<", "AbstractIndexPage", ",", "Integer", ">", "map", ")", "{", "return", "getRoot", "(", ")", ".", "writeToPreallocated", "(", "out", ",", "map", ")", ";", "}" ]
Special write method that uses only pre-allocated pages. @param map @return the root page Id.
[ "Special", "write", "method", "that", "uses", "only", "pre", "-", "allocated", "pages", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/AbstractPagedIndex.java#L154-L156
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/TSNE.java
TSNE.updateSolution
protected void updateSolution(double[][] sol, double[] meta, int it) { """ Update the current solution on iteration. @param sol Solution matrix @param meta Metadata array (gradient, momentum, learning rate) @param it Iteration number, to choose momentum factor. """ final double mom = (it < momentumSwitch && initialMomentum < finalMomentum) ? initialMomentum : finalMomentum; final int dim3 = dim * 3; for(int i = 0, off = 0; i < sol.length; i++, off += dim3) { final double[] sol_i = sol[i]; for(int k = 0; k < dim; k++) { // Indexes in meta array final int gradk = off + k, movk = gradk + dim, gaink = movk + dim; // Adjust learning rate: meta[gaink] = MathUtil.max(((meta[gradk] > 0) != (meta[movk] > 0)) ? (meta[gaink] + 0.2) : (meta[gaink] * 0.8), MIN_GAIN); meta[movk] *= mom; // Dampening the previous momentum meta[movk] -= learningRate * meta[gradk] * meta[gaink]; // Learn sol_i[k] += meta[movk]; } } }
java
protected void updateSolution(double[][] sol, double[] meta, int it) { final double mom = (it < momentumSwitch && initialMomentum < finalMomentum) ? initialMomentum : finalMomentum; final int dim3 = dim * 3; for(int i = 0, off = 0; i < sol.length; i++, off += dim3) { final double[] sol_i = sol[i]; for(int k = 0; k < dim; k++) { // Indexes in meta array final int gradk = off + k, movk = gradk + dim, gaink = movk + dim; // Adjust learning rate: meta[gaink] = MathUtil.max(((meta[gradk] > 0) != (meta[movk] > 0)) ? (meta[gaink] + 0.2) : (meta[gaink] * 0.8), MIN_GAIN); meta[movk] *= mom; // Dampening the previous momentum meta[movk] -= learningRate * meta[gradk] * meta[gaink]; // Learn sol_i[k] += meta[movk]; } } }
[ "protected", "void", "updateSolution", "(", "double", "[", "]", "[", "]", "sol", ",", "double", "[", "]", "meta", ",", "int", "it", ")", "{", "final", "double", "mom", "=", "(", "it", "<", "momentumSwitch", "&&", "initialMomentum", "<", "finalMomentum", ")", "?", "initialMomentum", ":", "finalMomentum", ";", "final", "int", "dim3", "=", "dim", "*", "3", ";", "for", "(", "int", "i", "=", "0", ",", "off", "=", "0", ";", "i", "<", "sol", ".", "length", ";", "i", "++", ",", "off", "+=", "dim3", ")", "{", "final", "double", "[", "]", "sol_i", "=", "sol", "[", "i", "]", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "dim", ";", "k", "++", ")", "{", "// Indexes in meta array", "final", "int", "gradk", "=", "off", "+", "k", ",", "movk", "=", "gradk", "+", "dim", ",", "gaink", "=", "movk", "+", "dim", ";", "// Adjust learning rate:", "meta", "[", "gaink", "]", "=", "MathUtil", ".", "max", "(", "(", "(", "meta", "[", "gradk", "]", ">", "0", ")", "!=", "(", "meta", "[", "movk", "]", ">", "0", ")", ")", "?", "(", "meta", "[", "gaink", "]", "+", "0.2", ")", ":", "(", "meta", "[", "gaink", "]", "*", "0.8", ")", ",", "MIN_GAIN", ")", ";", "meta", "[", "movk", "]", "*=", "mom", ";", "// Dampening the previous momentum", "meta", "[", "movk", "]", "-=", "learningRate", "*", "meta", "[", "gradk", "]", "*", "meta", "[", "gaink", "]", ";", "// Learn", "sol_i", "[", "k", "]", "+=", "meta", "[", "movk", "]", ";", "}", "}", "}" ]
Update the current solution on iteration. @param sol Solution matrix @param meta Metadata array (gradient, momentum, learning rate) @param it Iteration number, to choose momentum factor.
[ "Update", "the", "current", "solution", "on", "iteration", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/TSNE.java#L345-L360
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueService.java
QueueService.createLocalQueueStats
public LocalQueueStats createLocalQueueStats(String name, int partitionId) { """ Returns the local queue statistics for the given name and partition ID. If this node is the owner for the partition, returned stats contain {@link LocalQueueStats#getOwnedItemCount()}, otherwise it contains {@link LocalQueueStats#getBackupItemCount()}. @param name the name of the queue for which the statistics are returned @param partitionId the partition ID for which the statistics are returned @return the statistics """ LocalQueueStatsImpl stats = getLocalQueueStatsImpl(name); stats.setOwnedItemCount(0); stats.setBackupItemCount(0); QueueContainer container = containerMap.get(name); if (container == null) { return stats; } Address thisAddress = nodeEngine.getClusterService().getThisAddress(); IPartition partition = partitionService.getPartition(partitionId, false); Address owner = partition.getOwnerOrNull(); if (thisAddress.equals(owner)) { stats.setOwnedItemCount(container.size()); } else if (owner != null) { stats.setBackupItemCount(container.backupSize()); } container.setStats(stats); return stats; }
java
public LocalQueueStats createLocalQueueStats(String name, int partitionId) { LocalQueueStatsImpl stats = getLocalQueueStatsImpl(name); stats.setOwnedItemCount(0); stats.setBackupItemCount(0); QueueContainer container = containerMap.get(name); if (container == null) { return stats; } Address thisAddress = nodeEngine.getClusterService().getThisAddress(); IPartition partition = partitionService.getPartition(partitionId, false); Address owner = partition.getOwnerOrNull(); if (thisAddress.equals(owner)) { stats.setOwnedItemCount(container.size()); } else if (owner != null) { stats.setBackupItemCount(container.backupSize()); } container.setStats(stats); return stats; }
[ "public", "LocalQueueStats", "createLocalQueueStats", "(", "String", "name", ",", "int", "partitionId", ")", "{", "LocalQueueStatsImpl", "stats", "=", "getLocalQueueStatsImpl", "(", "name", ")", ";", "stats", ".", "setOwnedItemCount", "(", "0", ")", ";", "stats", ".", "setBackupItemCount", "(", "0", ")", ";", "QueueContainer", "container", "=", "containerMap", ".", "get", "(", "name", ")", ";", "if", "(", "container", "==", "null", ")", "{", "return", "stats", ";", "}", "Address", "thisAddress", "=", "nodeEngine", ".", "getClusterService", "(", ")", ".", "getThisAddress", "(", ")", ";", "IPartition", "partition", "=", "partitionService", ".", "getPartition", "(", "partitionId", ",", "false", ")", ";", "Address", "owner", "=", "partition", ".", "getOwnerOrNull", "(", ")", ";", "if", "(", "thisAddress", ".", "equals", "(", "owner", ")", ")", "{", "stats", ".", "setOwnedItemCount", "(", "container", ".", "size", "(", ")", ")", ";", "}", "else", "if", "(", "owner", "!=", "null", ")", "{", "stats", ".", "setBackupItemCount", "(", "container", ".", "backupSize", "(", ")", ")", ";", "}", "container", ".", "setStats", "(", "stats", ")", ";", "return", "stats", ";", "}" ]
Returns the local queue statistics for the given name and partition ID. If this node is the owner for the partition, returned stats contain {@link LocalQueueStats#getOwnedItemCount()}, otherwise it contains {@link LocalQueueStats#getBackupItemCount()}. @param name the name of the queue for which the statistics are returned @param partitionId the partition ID for which the statistics are returned @return the statistics
[ "Returns", "the", "local", "queue", "statistics", "for", "the", "given", "name", "and", "partition", "ID", ".", "If", "this", "node", "is", "the", "owner", "for", "the", "partition", "returned", "stats", "contain", "{", "@link", "LocalQueueStats#getOwnedItemCount", "()", "}", "otherwise", "it", "contains", "{", "@link", "LocalQueueStats#getBackupItemCount", "()", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueService.java#L310-L330
Alluxio/alluxio
core/common/src/main/java/alluxio/util/CommonUtils.java
CommonUtils.getWorkerDataDirectory
public static String getWorkerDataDirectory(String storageDir, AlluxioConfiguration conf) { """ @param storageDir the root of a storage directory in tiered storage @param conf Alluxio's current configuration @return the worker data folder path after each storage directory, the final path will be like "/mnt/ramdisk/alluxioworker" for storage dir "/mnt/ramdisk" by appending {@link PropertyKey#WORKER_DATA_FOLDER). """ return PathUtils.concatPath( storageDir.trim(), conf.get(PropertyKey.WORKER_DATA_FOLDER)); }
java
public static String getWorkerDataDirectory(String storageDir, AlluxioConfiguration conf) { return PathUtils.concatPath( storageDir.trim(), conf.get(PropertyKey.WORKER_DATA_FOLDER)); }
[ "public", "static", "String", "getWorkerDataDirectory", "(", "String", "storageDir", ",", "AlluxioConfiguration", "conf", ")", "{", "return", "PathUtils", ".", "concatPath", "(", "storageDir", ".", "trim", "(", ")", ",", "conf", ".", "get", "(", "PropertyKey", ".", "WORKER_DATA_FOLDER", ")", ")", ";", "}" ]
@param storageDir the root of a storage directory in tiered storage @param conf Alluxio's current configuration @return the worker data folder path after each storage directory, the final path will be like "/mnt/ramdisk/alluxioworker" for storage dir "/mnt/ramdisk" by appending {@link PropertyKey#WORKER_DATA_FOLDER).
[ "@param", "storageDir", "the", "root", "of", "a", "storage", "directory", "in", "tiered", "storage", "@param", "conf", "Alluxio", "s", "current", "configuration" ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/CommonUtils.java#L99-L102
RestComm/media-core
network/src/main/java/org/restcomm/media/core/network/deprecated/IPAddressCompare.java
IPAddressCompare.compareByteValues
private static boolean compareByteValues(byte[] network,byte[] subnet,byte[] ipAddress) { """ Checks whether ipAddress is in network with specified subnet by comparing byte logical end values """ for(int i=0;i<network.length;i++) if((network[i] & subnet[i]) != (ipAddress[i] & subnet[i])) return false; return true; }
java
private static boolean compareByteValues(byte[] network,byte[] subnet,byte[] ipAddress) { for(int i=0;i<network.length;i++) if((network[i] & subnet[i]) != (ipAddress[i] & subnet[i])) return false; return true; }
[ "private", "static", "boolean", "compareByteValues", "(", "byte", "[", "]", "network", ",", "byte", "[", "]", "subnet", ",", "byte", "[", "]", "ipAddress", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "network", ".", "length", ";", "i", "++", ")", "if", "(", "(", "network", "[", "i", "]", "&", "subnet", "[", "i", "]", ")", "!=", "(", "ipAddress", "[", "i", "]", "&", "subnet", "[", "i", "]", ")", ")", "return", "false", ";", "return", "true", ";", "}" ]
Checks whether ipAddress is in network with specified subnet by comparing byte logical end values
[ "Checks", "whether", "ipAddress", "is", "in", "network", "with", "specified", "subnet", "by", "comparing", "byte", "logical", "end", "values" ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/network/src/main/java/org/restcomm/media/core/network/deprecated/IPAddressCompare.java#L58-L65
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Bar.java
Bar.setColorGradient
public void setColorGradient(ColorRgba color1, ColorRgba color2) { """ Set a gradient color from point 1 with color 1 to point2 with color 2. @param color1 The first color. @param color2 The last color. """ setColorGradient(x, y, color1, x + maxWidth, y + maxHeight, color2); }
java
public void setColorGradient(ColorRgba color1, ColorRgba color2) { setColorGradient(x, y, color1, x + maxWidth, y + maxHeight, color2); }
[ "public", "void", "setColorGradient", "(", "ColorRgba", "color1", ",", "ColorRgba", "color2", ")", "{", "setColorGradient", "(", "x", ",", "y", ",", "color1", ",", "x", "+", "maxWidth", ",", "y", "+", "maxHeight", ",", "color2", ")", ";", "}" ]
Set a gradient color from point 1 with color 1 to point2 with color 2. @param color1 The first color. @param color2 The last color.
[ "Set", "a", "gradient", "color", "from", "point", "1", "with", "color", "1", "to", "point2", "with", "color", "2", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Bar.java#L194-L197
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/TagAttributesImpl.java
TagAttributesImpl.get
public TagAttribute get(String ns, String localName) { """ Find a TagAttribute that matches the passed namespace and local name. @param ns namespace of the desired attribute @param localName local name of the attribute @return a TagAttribute found, otherwise null """ if (ns != null && localName != null) { int idx = Arrays.binarySearch(_namespaces, ns); if (idx >= 0) { for (TagAttribute attribute : _nsattrs.get(idx)) { if (localName.equals(attribute.getLocalName())) { return attribute; } } } } return null; }
java
public TagAttribute get(String ns, String localName) { if (ns != null && localName != null) { int idx = Arrays.binarySearch(_namespaces, ns); if (idx >= 0) { for (TagAttribute attribute : _nsattrs.get(idx)) { if (localName.equals(attribute.getLocalName())) { return attribute; } } } } return null; }
[ "public", "TagAttribute", "get", "(", "String", "ns", ",", "String", "localName", ")", "{", "if", "(", "ns", "!=", "null", "&&", "localName", "!=", "null", ")", "{", "int", "idx", "=", "Arrays", ".", "binarySearch", "(", "_namespaces", ",", "ns", ")", ";", "if", "(", "idx", ">=", "0", ")", "{", "for", "(", "TagAttribute", "attribute", ":", "_nsattrs", ".", "get", "(", "idx", ")", ")", "{", "if", "(", "localName", ".", "equals", "(", "attribute", ".", "getLocalName", "(", ")", ")", ")", "{", "return", "attribute", ";", "}", "}", "}", "}", "return", "null", ";", "}" ]
Find a TagAttribute that matches the passed namespace and local name. @param ns namespace of the desired attribute @param localName local name of the attribute @return a TagAttribute found, otherwise null
[ "Find", "a", "TagAttribute", "that", "matches", "the", "passed", "namespace", "and", "local", "name", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/TagAttributesImpl.java#L123-L141
jbundle/jbundle
base/message/core/src/main/java/org/jbundle/base/message/core/tree/TreeMessageFilterList.java
TreeMessageFilterList.setNewFilterTree
public void setNewFilterTree(BaseMessageFilter messageFilter, Object[][] propKeys) { """ Update this filter with this new information. @param messageFilter The message filter I am updating. @param propKeys New tree key filter information (ie, bookmark=345). """ if (propKeys != null) if (!propKeys.equals(messageFilter.getNameValueTree())) { // This moves the filter to the new leaf this.getRegistry().removeMessageFilter(messageFilter); super.setNewFilterTree(messageFilter, propKeys); this.getRegistry().addMessageFilter(messageFilter); } }
java
public void setNewFilterTree(BaseMessageFilter messageFilter, Object[][] propKeys) { if (propKeys != null) if (!propKeys.equals(messageFilter.getNameValueTree())) { // This moves the filter to the new leaf this.getRegistry().removeMessageFilter(messageFilter); super.setNewFilterTree(messageFilter, propKeys); this.getRegistry().addMessageFilter(messageFilter); } }
[ "public", "void", "setNewFilterTree", "(", "BaseMessageFilter", "messageFilter", ",", "Object", "[", "]", "[", "]", "propKeys", ")", "{", "if", "(", "propKeys", "!=", "null", ")", "if", "(", "!", "propKeys", ".", "equals", "(", "messageFilter", ".", "getNameValueTree", "(", ")", ")", ")", "{", "// This moves the filter to the new leaf", "this", ".", "getRegistry", "(", ")", ".", "removeMessageFilter", "(", "messageFilter", ")", ";", "super", ".", "setNewFilterTree", "(", "messageFilter", ",", "propKeys", ")", ";", "this", ".", "getRegistry", "(", ")", ".", "addMessageFilter", "(", "messageFilter", ")", ";", "}", "}" ]
Update this filter with this new information. @param messageFilter The message filter I am updating. @param propKeys New tree key filter information (ie, bookmark=345).
[ "Update", "this", "filter", "with", "this", "new", "information", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/TreeMessageFilterList.java#L90-L99
jeremylong/DependencyCheck
maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java
BaseDependencyCheckMojo.showSummary
protected void showSummary(MavenProject mp, Dependency[] dependencies) { """ Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. @param mp the Maven project for which the summary is shown @param dependencies a list of dependency objects """ if (showSummary) { DependencyCheckScanAgent.showSummary(mp.getName(), dependencies); } }
java
protected void showSummary(MavenProject mp, Dependency[] dependencies) { if (showSummary) { DependencyCheckScanAgent.showSummary(mp.getName(), dependencies); } }
[ "protected", "void", "showSummary", "(", "MavenProject", "mp", ",", "Dependency", "[", "]", "dependencies", ")", "{", "if", "(", "showSummary", ")", "{", "DependencyCheckScanAgent", ".", "showSummary", "(", "mp", ".", "getName", "(", ")", ",", "dependencies", ")", ";", "}", "}" ]
Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. @param mp the Maven project for which the summary is shown @param dependencies a list of dependency objects
[ "Generates", "a", "warning", "message", "listing", "a", "summary", "of", "dependencies", "and", "their", "associated", "CPE", "and", "CVE", "entries", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java#L1865-L1869
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java
BlockMetadataManager.resizeTempBlockMeta
public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException { """ Modifies the size of a temp block. @param tempBlockMeta the temp block to modify @param newSize new size in bytes @throws InvalidWorkerStateException when newSize is smaller than current size """ StorageDir dir = tempBlockMeta.getParentDir(); dir.resizeTempBlockMeta(tempBlockMeta, newSize); }
java
public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException { StorageDir dir = tempBlockMeta.getParentDir(); dir.resizeTempBlockMeta(tempBlockMeta, newSize); }
[ "public", "void", "resizeTempBlockMeta", "(", "TempBlockMeta", "tempBlockMeta", ",", "long", "newSize", ")", "throws", "InvalidWorkerStateException", "{", "StorageDir", "dir", "=", "tempBlockMeta", ".", "getParentDir", "(", ")", ";", "dir", ".", "resizeTempBlockMeta", "(", "tempBlockMeta", ",", "newSize", ")", ";", "}" ]
Modifies the size of a temp block. @param tempBlockMeta the temp block to modify @param newSize new size in bytes @throws InvalidWorkerStateException when newSize is smaller than current size
[ "Modifies", "the", "size", "of", "a", "temp", "block", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockMetadataManager.java#L459-L463
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
WebMonitorUtils.validateAndNormalizeUri
public static Path validateAndNormalizeUri(URI archiveDirUri) { """ Checks and normalizes the given URI. This method first checks the validity of the URI (scheme and path are not null) and then normalizes the URI to a path. @param archiveDirUri The URI to check and normalize. @return A normalized URI as a Path. @throws IllegalArgumentException Thrown, if the URI misses scheme or path. """ final String scheme = archiveDirUri.getScheme(); final String path = archiveDirUri.getPath(); // some validity checks if (scheme == null) { throw new IllegalArgumentException("The scheme (hdfs://, file://, etc) is null. " + "Please specify the file system scheme explicitly in the URI."); } if (path == null) { throw new IllegalArgumentException("The path to store the job archive data in is null. " + "Please specify a directory path for the archiving the job data."); } return new Path(archiveDirUri); }
java
public static Path validateAndNormalizeUri(URI archiveDirUri) { final String scheme = archiveDirUri.getScheme(); final String path = archiveDirUri.getPath(); // some validity checks if (scheme == null) { throw new IllegalArgumentException("The scheme (hdfs://, file://, etc) is null. " + "Please specify the file system scheme explicitly in the URI."); } if (path == null) { throw new IllegalArgumentException("The path to store the job archive data in is null. " + "Please specify a directory path for the archiving the job data."); } return new Path(archiveDirUri); }
[ "public", "static", "Path", "validateAndNormalizeUri", "(", "URI", "archiveDirUri", ")", "{", "final", "String", "scheme", "=", "archiveDirUri", ".", "getScheme", "(", ")", ";", "final", "String", "path", "=", "archiveDirUri", ".", "getPath", "(", ")", ";", "// some validity checks", "if", "(", "scheme", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The scheme (hdfs://, file://, etc) is null. \"", "+", "\"Please specify the file system scheme explicitly in the URI.\"", ")", ";", "}", "if", "(", "path", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The path to store the job archive data in is null. \"", "+", "\"Please specify a directory path for the archiving the job data.\"", ")", ";", "}", "return", "new", "Path", "(", "archiveDirUri", ")", ";", "}" ]
Checks and normalizes the given URI. This method first checks the validity of the URI (scheme and path are not null) and then normalizes the URI to a path. @param archiveDirUri The URI to check and normalize. @return A normalized URI as a Path. @throws IllegalArgumentException Thrown, if the URI misses scheme or path.
[ "Checks", "and", "normalizes", "the", "given", "URI", ".", "This", "method", "first", "checks", "the", "validity", "of", "the", "URI", "(", "scheme", "and", "path", "are", "not", "null", ")", "and", "then", "normalizes", "the", "URI", "to", "a", "path", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java#L263-L278
brianwhu/xillium
base/src/main/java/org/xillium/base/util/Mathematical.java
Mathematical.floor
public static int floor(int n, int m) { """ Rounds n down to the nearest multiple of m @param n an integer @param m an integer @return the value after rounding {@code n} down to the nearest multiple of {@code m} """ return n >= 0 ? (n / m) * m : ((n - m + 1) / m) * m; }
java
public static int floor(int n, int m) { return n >= 0 ? (n / m) * m : ((n - m + 1) / m) * m; }
[ "public", "static", "int", "floor", "(", "int", "n", ",", "int", "m", ")", "{", "return", "n", ">=", "0", "?", "(", "n", "/", "m", ")", "*", "m", ":", "(", "(", "n", "-", "m", "+", "1", ")", "/", "m", ")", "*", "m", ";", "}" ]
Rounds n down to the nearest multiple of m @param n an integer @param m an integer @return the value after rounding {@code n} down to the nearest multiple of {@code m}
[ "Rounds", "n", "down", "to", "the", "nearest", "multiple", "of", "m" ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/util/Mathematical.java#L15-L17
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/RedisClusterClient.java
RedisClusterClient.connectToNodeAsync
<K, V> ConnectionFuture<StatefulRedisConnection<K, V>> connectToNodeAsync(RedisCodec<K, V> codec, String nodeId, RedisChannelWriter clusterWriter, Mono<SocketAddress> socketAddressSupplier) { """ Create a connection to a redis socket address. @param codec Use this codec to encode/decode keys and values, must not be {@literal null} @param nodeId the nodeId @param clusterWriter global cluster writer @param socketAddressSupplier supplier for the socket address @param <K> Key type @param <V> Value type @return A new connection """ assertNotNull(codec); assertNotEmpty(initialUris); LettuceAssert.notNull(socketAddressSupplier, "SocketAddressSupplier must not be null"); ClusterNodeEndpoint endpoint = new ClusterNodeEndpoint(clientOptions, getResources(), clusterWriter); RedisChannelWriter writer = endpoint; if (CommandExpiryWriter.isSupported(clientOptions)) { writer = new CommandExpiryWriter(writer, clientOptions, clientResources); } StatefulRedisConnectionImpl<K, V> connection = new StatefulRedisConnectionImpl<K, V>(writer, codec, timeout); ConnectionFuture<StatefulRedisConnection<K, V>> connectionFuture = connectStatefulAsync(connection, codec, endpoint, getFirstUri(), socketAddressSupplier, () -> new CommandHandler(clientOptions, clientResources, endpoint)); return connectionFuture.whenComplete((conn, throwable) -> { if (throwable != null) { connection.close(); } }); }
java
<K, V> ConnectionFuture<StatefulRedisConnection<K, V>> connectToNodeAsync(RedisCodec<K, V> codec, String nodeId, RedisChannelWriter clusterWriter, Mono<SocketAddress> socketAddressSupplier) { assertNotNull(codec); assertNotEmpty(initialUris); LettuceAssert.notNull(socketAddressSupplier, "SocketAddressSupplier must not be null"); ClusterNodeEndpoint endpoint = new ClusterNodeEndpoint(clientOptions, getResources(), clusterWriter); RedisChannelWriter writer = endpoint; if (CommandExpiryWriter.isSupported(clientOptions)) { writer = new CommandExpiryWriter(writer, clientOptions, clientResources); } StatefulRedisConnectionImpl<K, V> connection = new StatefulRedisConnectionImpl<K, V>(writer, codec, timeout); ConnectionFuture<StatefulRedisConnection<K, V>> connectionFuture = connectStatefulAsync(connection, codec, endpoint, getFirstUri(), socketAddressSupplier, () -> new CommandHandler(clientOptions, clientResources, endpoint)); return connectionFuture.whenComplete((conn, throwable) -> { if (throwable != null) { connection.close(); } }); }
[ "<", "K", ",", "V", ">", "ConnectionFuture", "<", "StatefulRedisConnection", "<", "K", ",", "V", ">", ">", "connectToNodeAsync", "(", "RedisCodec", "<", "K", ",", "V", ">", "codec", ",", "String", "nodeId", ",", "RedisChannelWriter", "clusterWriter", ",", "Mono", "<", "SocketAddress", ">", "socketAddressSupplier", ")", "{", "assertNotNull", "(", "codec", ")", ";", "assertNotEmpty", "(", "initialUris", ")", ";", "LettuceAssert", ".", "notNull", "(", "socketAddressSupplier", ",", "\"SocketAddressSupplier must not be null\"", ")", ";", "ClusterNodeEndpoint", "endpoint", "=", "new", "ClusterNodeEndpoint", "(", "clientOptions", ",", "getResources", "(", ")", ",", "clusterWriter", ")", ";", "RedisChannelWriter", "writer", "=", "endpoint", ";", "if", "(", "CommandExpiryWriter", ".", "isSupported", "(", "clientOptions", ")", ")", "{", "writer", "=", "new", "CommandExpiryWriter", "(", "writer", ",", "clientOptions", ",", "clientResources", ")", ";", "}", "StatefulRedisConnectionImpl", "<", "K", ",", "V", ">", "connection", "=", "new", "StatefulRedisConnectionImpl", "<", "K", ",", "V", ">", "(", "writer", ",", "codec", ",", "timeout", ")", ";", "ConnectionFuture", "<", "StatefulRedisConnection", "<", "K", ",", "V", ">", ">", "connectionFuture", "=", "connectStatefulAsync", "(", "connection", ",", "codec", ",", "endpoint", ",", "getFirstUri", "(", ")", ",", "socketAddressSupplier", ",", "(", ")", "->", "new", "CommandHandler", "(", "clientOptions", ",", "clientResources", ",", "endpoint", ")", ")", ";", "return", "connectionFuture", ".", "whenComplete", "(", "(", "conn", ",", "throwable", ")", "->", "{", "if", "(", "throwable", "!=", "null", ")", "{", "connection", ".", "close", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create a connection to a redis socket address. @param codec Use this codec to encode/decode keys and values, must not be {@literal null} @param nodeId the nodeId @param clusterWriter global cluster writer @param socketAddressSupplier supplier for the socket address @param <K> Key type @param <V> Value type @return A new connection
[ "Create", "a", "connection", "to", "a", "redis", "socket", "address", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java#L482-L507
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java
LabsInner.createOrUpdateAsync
public Observable<LabInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, LabInner lab) { """ Create or replace an existing Lab. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param lab Represents a lab. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LabInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, lab).map(new Func1<ServiceResponse<LabInner>, LabInner>() { @Override public LabInner call(ServiceResponse<LabInner> response) { return response.body(); } }); }
java
public Observable<LabInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, LabInner lab) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, lab).map(new Func1<ServiceResponse<LabInner>, LabInner>() { @Override public LabInner call(ServiceResponse<LabInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LabInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "LabInner", "lab", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName", ",", "lab", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "LabInner", ">", ",", "LabInner", ">", "(", ")", "{", "@", "Override", "public", "LabInner", "call", "(", "ServiceResponse", "<", "LabInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or replace an existing Lab. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param lab Represents a lab. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LabInner object
[ "Create", "or", "replace", "an", "existing", "Lab", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java#L594-L601
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/grid/DataRecordBuffer.java
DataRecordBuffer.bookmarkToIndex
public int bookmarkToIndex(Object bookmark, int iHandleType) { """ This method was created by a SmartGuide. @return int index in table; or -1 if not found. @param bookmark java.lang.Object The bookmark to find in this table. @param iHandleType int The type of handle to look for (typically OBJECT_ID). """ DataRecord thisBookmark = null; if (bookmark == null) return -1; for (int iTargetPosition = m_iCurrentRecordStart; iTargetPosition < m_iCurrentRecordEnd; iTargetPosition++) { thisBookmark = (DataRecord)this.elementAt(iTargetPosition); if (thisBookmark != null) if (bookmark.equals(thisBookmark.getHandle(iHandleType))) return iTargetPosition; } //+ Still not found, do a binary search through the recordlist for a matching key return -1; // Not found }
java
public int bookmarkToIndex(Object bookmark, int iHandleType) { DataRecord thisBookmark = null; if (bookmark == null) return -1; for (int iTargetPosition = m_iCurrentRecordStart; iTargetPosition < m_iCurrentRecordEnd; iTargetPosition++) { thisBookmark = (DataRecord)this.elementAt(iTargetPosition); if (thisBookmark != null) if (bookmark.equals(thisBookmark.getHandle(iHandleType))) return iTargetPosition; } //+ Still not found, do a binary search through the recordlist for a matching key return -1; // Not found }
[ "public", "int", "bookmarkToIndex", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "{", "DataRecord", "thisBookmark", "=", "null", ";", "if", "(", "bookmark", "==", "null", ")", "return", "-", "1", ";", "for", "(", "int", "iTargetPosition", "=", "m_iCurrentRecordStart", ";", "iTargetPosition", "<", "m_iCurrentRecordEnd", ";", "iTargetPosition", "++", ")", "{", "thisBookmark", "=", "(", "DataRecord", ")", "this", ".", "elementAt", "(", "iTargetPosition", ")", ";", "if", "(", "thisBookmark", "!=", "null", ")", "if", "(", "bookmark", ".", "equals", "(", "thisBookmark", ".", "getHandle", "(", "iHandleType", ")", ")", ")", "return", "iTargetPosition", ";", "}", "//+ Still not found, do a binary search through the recordlist for a matching key", "return", "-", "1", ";", "// Not found", "}" ]
This method was created by a SmartGuide. @return int index in table; or -1 if not found. @param bookmark java.lang.Object The bookmark to find in this table. @param iHandleType int The type of handle to look for (typically OBJECT_ID).
[ "This", "method", "was", "created", "by", "a", "SmartGuide", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/DataRecordBuffer.java#L26-L40
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/hffax/Fax.java
Fax.isAbout
public static boolean isAbout(double expected, double value, double tolerance) { """ Returns true if value differs only tolerance percent. @param expected @param value @param tolerance @return """ double delta = expected*tolerance/100.0; return value > expected-delta && value < expected+delta; }
java
public static boolean isAbout(double expected, double value, double tolerance) { double delta = expected*tolerance/100.0; return value > expected-delta && value < expected+delta; }
[ "public", "static", "boolean", "isAbout", "(", "double", "expected", ",", "double", "value", ",", "double", "tolerance", ")", "{", "double", "delta", "=", "expected", "*", "tolerance", "/", "100.0", ";", "return", "value", ">", "expected", "-", "delta", "&&", "value", "<", "expected", "+", "delta", ";", "}" ]
Returns true if value differs only tolerance percent. @param expected @param value @param tolerance @return
[ "Returns", "true", "if", "value", "differs", "only", "tolerance", "percent", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/hffax/Fax.java#L52-L56
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java
RelationalJMapper.oneToManyWithoutControl
public <D> D oneToManyWithoutControl(D destination,final T source) { """ This Method returns the destination given in input enriched with data contained in source given in input<br> with this setting: <table summary =""> <tr> <td><code>NullPointerControl</code></td><td><code>NOT_ANY</code></td> </tr><tr> <td><code>MappingType</code> of Destination</td><td><code>ALL_FIELDS</code></td> </tr><tr> <td><code>MappingType</code> of Source</td><td><code>ALL_FIELDS</code></td> </tr> </table> @param destination instance of Target Class to enrich @param source instance of Configured Class that contains the data @return destination enriched @see NullPointerControl @see MappingType """ try{ return this.<D,T>getJMapper(relationalOneToManyMapper,destination.getClass()).getDestinationWithoutControl(destination,source); } catch (Exception e) { return this.logAndReturnNull(e); } }
java
public <D> D oneToManyWithoutControl(D destination,final T source) { try{ return this.<D,T>getJMapper(relationalOneToManyMapper,destination.getClass()).getDestinationWithoutControl(destination,source); } catch (Exception e) { return this.logAndReturnNull(e); } }
[ "public", "<", "D", ">", "D", "oneToManyWithoutControl", "(", "D", "destination", ",", "final", "T", "source", ")", "{", "try", "{", "return", "this", ".", "<", "D", ",", "T", ">", "getJMapper", "(", "relationalOneToManyMapper", ",", "destination", ".", "getClass", "(", ")", ")", ".", "getDestinationWithoutControl", "(", "destination", ",", "source", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "this", ".", "logAndReturnNull", "(", "e", ")", ";", "}", "}" ]
This Method returns the destination given in input enriched with data contained in source given in input<br> with this setting: <table summary =""> <tr> <td><code>NullPointerControl</code></td><td><code>NOT_ANY</code></td> </tr><tr> <td><code>MappingType</code> of Destination</td><td><code>ALL_FIELDS</code></td> </tr><tr> <td><code>MappingType</code> of Source</td><td><code>ALL_FIELDS</code></td> </tr> </table> @param destination instance of Target Class to enrich @param source instance of Configured Class that contains the data @return destination enriched @see NullPointerControl @see MappingType
[ "This", "Method", "returns", "the", "destination", "given", "in", "input", "enriched", "with", "data", "contained", "in", "source", "given", "in", "input<br", ">", "with", "this", "setting", ":", "<table", "summary", "=", ">", "<tr", ">", "<td", ">", "<code", ">", "NullPointerControl<", "/", "code", ">", "<", "/", "td", ">", "<td", ">", "<code", ">", "NOT_ANY<", "/", "code", ">", "<", "/", "td", ">", "<", "/", "tr", ">", "<tr", ">", "<td", ">", "<code", ">", "MappingType<", "/", "code", ">", "of", "Destination<", "/", "td", ">", "<td", ">", "<code", ">", "ALL_FIELDS<", "/", "code", ">", "<", "/", "td", ">", "<", "/", "tr", ">", "<tr", ">", "<td", ">", "<code", ">", "MappingType<", "/", "code", ">", "of", "Source<", "/", "td", ">", "<td", ">", "<code", ">", "ALL_FIELDS<", "/", "code", ">", "<", "/", "td", ">", "<", "/", "tr", ">", "<", "/", "table", ">" ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L603-L606
Azure/azure-sdk-for-java
privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/RecordSetsInner.java
RecordSetsInner.getAsync
public Observable<RecordSetInner> getAsync(String resourceGroupName, String privateZoneName, RecordType recordType, String relativeRecordSetName) { """ Gets a record set. @param resourceGroupName The name of the resource group. @param privateZoneName The name of the Private DNS zone (without a terminating dot). @param recordType The type of DNS record in this record set. Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', 'TXT' @param relativeRecordSetName The name of the record set, relative to the name of the zone. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RecordSetInner object """ return getWithServiceResponseAsync(resourceGroupName, privateZoneName, recordType, relativeRecordSetName).map(new Func1<ServiceResponse<RecordSetInner>, RecordSetInner>() { @Override public RecordSetInner call(ServiceResponse<RecordSetInner> response) { return response.body(); } }); }
java
public Observable<RecordSetInner> getAsync(String resourceGroupName, String privateZoneName, RecordType recordType, String relativeRecordSetName) { return getWithServiceResponseAsync(resourceGroupName, privateZoneName, recordType, relativeRecordSetName).map(new Func1<ServiceResponse<RecordSetInner>, RecordSetInner>() { @Override public RecordSetInner call(ServiceResponse<RecordSetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RecordSetInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "privateZoneName", ",", "RecordType", "recordType", ",", "String", "relativeRecordSetName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "privateZoneName", ",", "recordType", ",", "relativeRecordSetName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "RecordSetInner", ">", ",", "RecordSetInner", ">", "(", ")", "{", "@", "Override", "public", "RecordSetInner", "call", "(", "ServiceResponse", "<", "RecordSetInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a record set. @param resourceGroupName The name of the resource group. @param privateZoneName The name of the Private DNS zone (without a terminating dot). @param recordType The type of DNS record in this record set. Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'PTR', 'SOA', 'SRV', 'TXT' @param relativeRecordSetName The name of the record set, relative to the name of the zone. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RecordSetInner object
[ "Gets", "a", "record", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/RecordSetsInner.java#L772-L779
jirutka/spring-rest-exception-handler
src/main/java/cz/jirutka/spring/exhandler/RestHandlerExceptionResolverBuilder.java
RestHandlerExceptionResolverBuilder.addErrorMessageHandler
public RestHandlerExceptionResolverBuilder addErrorMessageHandler( Class<? extends Exception> exceptionClass, HttpStatus status) { """ Registers {@link ErrorMessageRestExceptionHandler} for the specified exception type. This handler will be also used for all the exception subtypes, when no more specific mapping is found. @param exceptionClass The exception type to handle. @param status The HTTP status to map the specified exception to. """ return addHandler(new ErrorMessageRestExceptionHandler<>(exceptionClass, status)); }
java
public RestHandlerExceptionResolverBuilder addErrorMessageHandler( Class<? extends Exception> exceptionClass, HttpStatus status) { return addHandler(new ErrorMessageRestExceptionHandler<>(exceptionClass, status)); }
[ "public", "RestHandlerExceptionResolverBuilder", "addErrorMessageHandler", "(", "Class", "<", "?", "extends", "Exception", ">", "exceptionClass", ",", "HttpStatus", "status", ")", "{", "return", "addHandler", "(", "new", "ErrorMessageRestExceptionHandler", "<>", "(", "exceptionClass", ",", "status", ")", ")", ";", "}" ]
Registers {@link ErrorMessageRestExceptionHandler} for the specified exception type. This handler will be also used for all the exception subtypes, when no more specific mapping is found. @param exceptionClass The exception type to handle. @param status The HTTP status to map the specified exception to.
[ "Registers", "{", "@link", "ErrorMessageRestExceptionHandler", "}", "for", "the", "specified", "exception", "type", ".", "This", "handler", "will", "be", "also", "used", "for", "all", "the", "exception", "subtypes", "when", "no", "more", "specific", "mapping", "is", "found", "." ]
train
https://github.com/jirutka/spring-rest-exception-handler/blob/f171956e59fe866f1a853c7d38444f136acc7a3b/src/main/java/cz/jirutka/spring/exhandler/RestHandlerExceptionResolverBuilder.java#L212-L216
aalmiray/Json-lib
src/main/java/net/sf/json/JsonConfig.java
JsonConfig.registerJsonBeanProcessor
public void registerJsonBeanProcessor( Class target, JsonBeanProcessor jsonBeanProcessor ) { """ Registers a JsonBeanProcessor.<br> [Java -&gt; JSON] @param target the class to use as key @param jsonBeanProcessor the processor to register """ if( target != null && jsonBeanProcessor != null ) { beanProcessorMap.put( target, jsonBeanProcessor ); } }
java
public void registerJsonBeanProcessor( Class target, JsonBeanProcessor jsonBeanProcessor ) { if( target != null && jsonBeanProcessor != null ) { beanProcessorMap.put( target, jsonBeanProcessor ); } }
[ "public", "void", "registerJsonBeanProcessor", "(", "Class", "target", ",", "JsonBeanProcessor", "jsonBeanProcessor", ")", "{", "if", "(", "target", "!=", "null", "&&", "jsonBeanProcessor", "!=", "null", ")", "{", "beanProcessorMap", ".", "put", "(", "target", ",", "jsonBeanProcessor", ")", ";", "}", "}" ]
Registers a JsonBeanProcessor.<br> [Java -&gt; JSON] @param target the class to use as key @param jsonBeanProcessor the processor to register
[ "Registers", "a", "JsonBeanProcessor", ".", "<br", ">", "[", "Java", "-", "&gt", ";", "JSON", "]" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L786-L790
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/CompressionUtil.java
CompressionUtil.extractFileGzip
public static File extractFileGzip(String _compressedFile, String _outputFileName) { """ Extracts a GZIP compressed file to the given outputfile. @param _compressedFile @param _outputFileName @return file-object with outputfile or null on any error. """ return decompress(CompressionMethod.GZIP, _compressedFile, _outputFileName); }
java
public static File extractFileGzip(String _compressedFile, String _outputFileName) { return decompress(CompressionMethod.GZIP, _compressedFile, _outputFileName); }
[ "public", "static", "File", "extractFileGzip", "(", "String", "_compressedFile", ",", "String", "_outputFileName", ")", "{", "return", "decompress", "(", "CompressionMethod", ".", "GZIP", ",", "_compressedFile", ",", "_outputFileName", ")", ";", "}" ]
Extracts a GZIP compressed file to the given outputfile. @param _compressedFile @param _outputFileName @return file-object with outputfile or null on any error.
[ "Extracts", "a", "GZIP", "compressed", "file", "to", "the", "given", "outputfile", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/CompressionUtil.java#L42-L44
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java
ReUtil.extractMulti
public static String extractMulti(Pattern pattern, CharSequence content, String template) { """ 从content中匹配出多个值并根据template生成新的字符串<br> 例如:<br> content 2013年5月 pattern (.*?)年(.*?)月 template: $1-$2 return 2013-5 @param pattern 匹配正则 @param content 被匹配的内容 @param template 生成内容模板,变量 $1 表示group1的内容,以此类推 @return 新字符串 """ if (null == content || null == pattern || null == template) { return null; } //提取模板中的编号 final TreeSet<Integer> varNums = new TreeSet<>(new Comparator<Integer>() { @Override public int compare(Integer o1, Integer o2) { return ObjectUtil.compare(o2, o1); } }); final Matcher matcherForTemplate = PatternPool.GROUP_VAR.matcher(template); while (matcherForTemplate.find()) { varNums.add(Integer.parseInt(matcherForTemplate.group(1))); } final Matcher matcher = pattern.matcher(content); if (matcher.find()) { for (Integer group : varNums) { template = template.replace("$" + group, matcher.group(group)); } return template; } return null; }
java
public static String extractMulti(Pattern pattern, CharSequence content, String template) { if (null == content || null == pattern || null == template) { return null; } //提取模板中的编号 final TreeSet<Integer> varNums = new TreeSet<>(new Comparator<Integer>() { @Override public int compare(Integer o1, Integer o2) { return ObjectUtil.compare(o2, o1); } }); final Matcher matcherForTemplate = PatternPool.GROUP_VAR.matcher(template); while (matcherForTemplate.find()) { varNums.add(Integer.parseInt(matcherForTemplate.group(1))); } final Matcher matcher = pattern.matcher(content); if (matcher.find()) { for (Integer group : varNums) { template = template.replace("$" + group, matcher.group(group)); } return template; } return null; }
[ "public", "static", "String", "extractMulti", "(", "Pattern", "pattern", ",", "CharSequence", "content", ",", "String", "template", ")", "{", "if", "(", "null", "==", "content", "||", "null", "==", "pattern", "||", "null", "==", "template", ")", "{", "return", "null", ";", "}", "//提取模板中的编号\r", "final", "TreeSet", "<", "Integer", ">", "varNums", "=", "new", "TreeSet", "<>", "(", "new", "Comparator", "<", "Integer", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Integer", "o1", ",", "Integer", "o2", ")", "{", "return", "ObjectUtil", ".", "compare", "(", "o2", ",", "o1", ")", ";", "}", "}", ")", ";", "final", "Matcher", "matcherForTemplate", "=", "PatternPool", ".", "GROUP_VAR", ".", "matcher", "(", "template", ")", ";", "while", "(", "matcherForTemplate", ".", "find", "(", ")", ")", "{", "varNums", ".", "add", "(", "Integer", ".", "parseInt", "(", "matcherForTemplate", ".", "group", "(", "1", ")", ")", ")", ";", "}", "final", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "content", ")", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "for", "(", "Integer", "group", ":", "varNums", ")", "{", "template", "=", "template", ".", "replace", "(", "\"$\"", "+", "group", ",", "matcher", ".", "group", "(", "group", ")", ")", ";", "}", "return", "template", ";", "}", "return", "null", ";", "}" ]
从content中匹配出多个值并根据template生成新的字符串<br> 例如:<br> content 2013年5月 pattern (.*?)年(.*?)月 template: $1-$2 return 2013-5 @param pattern 匹配正则 @param content 被匹配的内容 @param template 生成内容模板,变量 $1 表示group1的内容,以此类推 @return 新字符串
[ "从content中匹配出多个值并根据template生成新的字符串<br", ">", "例如:<br", ">", "content", "2013年5月", "pattern", "(", ".", "*", "?", ")", "年", "(", ".", "*", "?", ")", "月", "template:", "$1", "-", "$2", "return", "2013", "-", "5" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L171-L196
OpenLiberty/open-liberty
dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java
AbstractMBeanIntrospector.introspectMBeanAttributes
@FFDCIgnore(Throwable.class) void introspectMBeanAttributes(MBeanServer mbeanServer, ObjectName mbean, PrintWriter writer) { """ Introspect an MBean's attributes. Introspection will capture the MBean's description, its canonical object name, and its attributes. When attributes are a complex {@link OpenType}, an attempt will be made to format the complex type. Primitives and types that do not have metadata will be formatted with {@linkplain String#valueOf}. @param mbeanServer the mbean server hosting the mbean @param mbean the mbean to introspect @param writer the print writer to write the instrospection to """ try { // Dump the description and the canonical form of the object name writer.println(); writer.print(mbeanServer.getMBeanInfo(mbean).getDescription()); writer.println(" (" + mbean.getCanonicalName() + ")"); // Iterate over the attributes of the mbean. For each, capture the name // and then attempt format the attribute. String indent = INDENT; MBeanAttributeInfo[] attrs = mbeanServer.getMBeanInfo(mbean).getAttributes(); for (MBeanAttributeInfo attr : attrs) { StringBuilder sb = new StringBuilder(); sb.append(indent).append(attr.getName()).append(": "); sb.append(getFormattedAttribute(mbeanServer, mbean, attr, indent)); writer.println(sb.toString()); } } catch (Throwable t) { Throwable rootCause = t; while (rootCause.getCause() != null) { rootCause = rootCause.getCause(); } StringBuilder sb = new StringBuilder(); sb.append("<<Introspection failed: "); sb.append(rootCause.getMessage() != null ? rootCause.getMessage() : rootCause); sb.append(">>"); writer.println(sb.toString()); } }
java
@FFDCIgnore(Throwable.class) void introspectMBeanAttributes(MBeanServer mbeanServer, ObjectName mbean, PrintWriter writer) { try { // Dump the description and the canonical form of the object name writer.println(); writer.print(mbeanServer.getMBeanInfo(mbean).getDescription()); writer.println(" (" + mbean.getCanonicalName() + ")"); // Iterate over the attributes of the mbean. For each, capture the name // and then attempt format the attribute. String indent = INDENT; MBeanAttributeInfo[] attrs = mbeanServer.getMBeanInfo(mbean).getAttributes(); for (MBeanAttributeInfo attr : attrs) { StringBuilder sb = new StringBuilder(); sb.append(indent).append(attr.getName()).append(": "); sb.append(getFormattedAttribute(mbeanServer, mbean, attr, indent)); writer.println(sb.toString()); } } catch (Throwable t) { Throwable rootCause = t; while (rootCause.getCause() != null) { rootCause = rootCause.getCause(); } StringBuilder sb = new StringBuilder(); sb.append("<<Introspection failed: "); sb.append(rootCause.getMessage() != null ? rootCause.getMessage() : rootCause); sb.append(">>"); writer.println(sb.toString()); } }
[ "@", "FFDCIgnore", "(", "Throwable", ".", "class", ")", "void", "introspectMBeanAttributes", "(", "MBeanServer", "mbeanServer", ",", "ObjectName", "mbean", ",", "PrintWriter", "writer", ")", "{", "try", "{", "// Dump the description and the canonical form of the object name", "writer", ".", "println", "(", ")", ";", "writer", ".", "print", "(", "mbeanServer", ".", "getMBeanInfo", "(", "mbean", ")", ".", "getDescription", "(", ")", ")", ";", "writer", ".", "println", "(", "\" (\"", "+", "mbean", ".", "getCanonicalName", "(", ")", "+", "\")\"", ")", ";", "// Iterate over the attributes of the mbean. For each, capture the name", "// and then attempt format the attribute.", "String", "indent", "=", "INDENT", ";", "MBeanAttributeInfo", "[", "]", "attrs", "=", "mbeanServer", ".", "getMBeanInfo", "(", "mbean", ")", ".", "getAttributes", "(", ")", ";", "for", "(", "MBeanAttributeInfo", "attr", ":", "attrs", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "indent", ")", ".", "append", "(", "attr", ".", "getName", "(", ")", ")", ".", "append", "(", "\": \"", ")", ";", "sb", ".", "append", "(", "getFormattedAttribute", "(", "mbeanServer", ",", "mbean", ",", "attr", ",", "indent", ")", ")", ";", "writer", ".", "println", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "Throwable", "rootCause", "=", "t", ";", "while", "(", "rootCause", ".", "getCause", "(", ")", "!=", "null", ")", "{", "rootCause", "=", "rootCause", ".", "getCause", "(", ")", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"<<Introspection failed: \"", ")", ";", "sb", ".", "append", "(", "rootCause", ".", "getMessage", "(", ")", "!=", "null", "?", "rootCause", ".", "getMessage", "(", ")", ":", "rootCause", ")", ";", "sb", ".", "append", "(", "\">>\"", ")", ";", "writer", ".", "println", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Introspect an MBean's attributes. Introspection will capture the MBean's description, its canonical object name, and its attributes. When attributes are a complex {@link OpenType}, an attempt will be made to format the complex type. Primitives and types that do not have metadata will be formatted with {@linkplain String#valueOf}. @param mbeanServer the mbean server hosting the mbean @param mbean the mbean to introspect @param writer the print writer to write the instrospection to
[ "Introspect", "an", "MBean", "s", "attributes", ".", "Introspection", "will", "capture", "the", "MBean", "s", "description", "its", "canonical", "object", "name", "and", "its", "attributes", ".", "When", "attributes", "are", "a", "complex", "{", "@link", "OpenType", "}", "an", "attempt", "will", "be", "made", "to", "format", "the", "complex", "type", ".", "Primitives", "and", "types", "that", "do", "not", "have", "metadata", "will", "be", "formatted", "with", "{", "@linkplain", "String#valueOf", "}", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java#L89-L118
OpenTSDB/opentsdb
src/tools/UidManager.java
UidManager.purgeTree
private static int purgeTree(final TSDB tsdb, final int tree_id, final boolean delete_definition) throws Exception { """ Attempts to delete the branches, leaves, collisions and not-matched entries for a given tree. Optionally removes the tree definition itself @param tsdb The TSDB to use for access @param tree_id ID of the tree to delete @param delete_definition Whether or not to delete the tree definition as well @return 0 if completed successfully, something else if an error occurred """ final TreeSync sync = new TreeSync(tsdb, 0, 1, 0); return sync.purgeTree(tree_id, delete_definition); }
java
private static int purgeTree(final TSDB tsdb, final int tree_id, final boolean delete_definition) throws Exception { final TreeSync sync = new TreeSync(tsdb, 0, 1, 0); return sync.purgeTree(tree_id, delete_definition); }
[ "private", "static", "int", "purgeTree", "(", "final", "TSDB", "tsdb", ",", "final", "int", "tree_id", ",", "final", "boolean", "delete_definition", ")", "throws", "Exception", "{", "final", "TreeSync", "sync", "=", "new", "TreeSync", "(", "tsdb", ",", "0", ",", "1", ",", "0", ")", ";", "return", "sync", ".", "purgeTree", "(", "tree_id", ",", "delete_definition", ")", ";", "}" ]
Attempts to delete the branches, leaves, collisions and not-matched entries for a given tree. Optionally removes the tree definition itself @param tsdb The TSDB to use for access @param tree_id ID of the tree to delete @param delete_definition Whether or not to delete the tree definition as well @return 0 if completed successfully, something else if an error occurred
[ "Attempts", "to", "delete", "the", "branches", "leaves", "collisions", "and", "not", "-", "matched", "entries", "for", "a", "given", "tree", ".", "Optionally", "removes", "the", "tree", "definition", "itself" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L1149-L1153
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/html/TableForm.java
TableForm.addTextArea
public TextArea addTextArea(String tag, String label, int width, int height, String value) { """ Add a Text Area. @param tag The form name of the element @param label The label for the element in the table. """ TextArea ta = new TextArea(tag,value); ta.setSize(width,height); addField(label,ta); return ta; }
java
public TextArea addTextArea(String tag, String label, int width, int height, String value) { TextArea ta = new TextArea(tag,value); ta.setSize(width,height); addField(label,ta); return ta; }
[ "public", "TextArea", "addTextArea", "(", "String", "tag", ",", "String", "label", ",", "int", "width", ",", "int", "height", ",", "String", "value", ")", "{", "TextArea", "ta", "=", "new", "TextArea", "(", "tag", ",", "value", ")", ";", "ta", ".", "setSize", "(", "width", ",", "height", ")", ";", "addField", "(", "label", ",", "ta", ")", ";", "return", "ta", ";", "}" ]
Add a Text Area. @param tag The form name of the element @param label The label for the element in the table.
[ "Add", "a", "Text", "Area", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/TableForm.java#L84-L94
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java
TopicsInner.beginCreateOrUpdateAsync
public Observable<TopicInner> beginCreateOrUpdateAsync(String resourceGroupName, String topicName, TopicInner topicInfo) { """ Create a topic. Asynchronously creates a new topic with the specified parameters. @param resourceGroupName The name of the resource group within the user's subscription. @param topicName Name of the topic @param topicInfo Topic information @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TopicInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, topicName, topicInfo).map(new Func1<ServiceResponse<TopicInner>, TopicInner>() { @Override public TopicInner call(ServiceResponse<TopicInner> response) { return response.body(); } }); }
java
public Observable<TopicInner> beginCreateOrUpdateAsync(String resourceGroupName, String topicName, TopicInner topicInfo) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, topicName, topicInfo).map(new Func1<ServiceResponse<TopicInner>, TopicInner>() { @Override public TopicInner call(ServiceResponse<TopicInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TopicInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "topicName", ",", "TopicInner", "topicInfo", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "topicName", ",", "topicInfo", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "TopicInner", ">", ",", "TopicInner", ">", "(", ")", "{", "@", "Override", "public", "TopicInner", "call", "(", "ServiceResponse", "<", "TopicInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create a topic. Asynchronously creates a new topic with the specified parameters. @param resourceGroupName The name of the resource group within the user's subscription. @param topicName Name of the topic @param topicInfo Topic information @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TopicInner object
[ "Create", "a", "topic", ".", "Asynchronously", "creates", "a", "new", "topic", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L331-L338
tvesalainen/util
util/src/main/java/org/vesalainen/math/Circles.java
Circles.distanceFromCenter
public static double distanceFromCenter(Point center, double x, double y) { """ Returns point (x, y) distance from circles center. @param center @param x @param y @return """ return Math.hypot(x-center.getX(), y-center.getY()); }
java
public static double distanceFromCenter(Point center, double x, double y) { return Math.hypot(x-center.getX(), y-center.getY()); }
[ "public", "static", "double", "distanceFromCenter", "(", "Point", "center", ",", "double", "x", ",", "double", "y", ")", "{", "return", "Math", ".", "hypot", "(", "x", "-", "center", ".", "getX", "(", ")", ",", "y", "-", "center", ".", "getY", "(", ")", ")", ";", "}" ]
Returns point (x, y) distance from circles center. @param center @param x @param y @return
[ "Returns", "point", "(", "x", "y", ")", "distance", "from", "circles", "center", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Circles.java#L71-L74
google/flogger
api/src/main/java/com/google/common/flogger/parser/ParseException.java
ParseException.atPosition
public static ParseException atPosition(String errorMessage, String logMessage, int position) { """ Creates a new parse exception for situations in which the position of the error is known. @param errorMessage the user error message. @param logMessage the original log message. @param position the index of the invalid character in the log message. @return the parser exception. """ return new ParseException(msg(errorMessage, logMessage, position, position + 1), logMessage); }
java
public static ParseException atPosition(String errorMessage, String logMessage, int position) { return new ParseException(msg(errorMessage, logMessage, position, position + 1), logMessage); }
[ "public", "static", "ParseException", "atPosition", "(", "String", "errorMessage", ",", "String", "logMessage", ",", "int", "position", ")", "{", "return", "new", "ParseException", "(", "msg", "(", "errorMessage", ",", "logMessage", ",", "position", ",", "position", "+", "1", ")", ",", "logMessage", ")", ";", "}" ]
Creates a new parse exception for situations in which the position of the error is known. @param errorMessage the user error message. @param logMessage the original log message. @param position the index of the invalid character in the log message. @return the parser exception.
[ "Creates", "a", "new", "parse", "exception", "for", "situations", "in", "which", "the", "position", "of", "the", "error", "is", "known", "." ]
train
https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/parser/ParseException.java#L56-L58
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
EqualsBuilder.reflectionEquals
@GwtIncompatible("incompatible method") public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients, final Class<?> reflectUpToClass, final String... excludeFields) { """ <p>This method uses reflection to determine if the two <code>Object</code>s are equal.</p> <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly. Non-primitive fields are compared using <code>equals()</code>.</p> <p>If the testTransients parameter is set to <code>true</code>, transient members will be tested, otherwise they are ignored, as they are likely derived fields, and not part of the value of the <code>Object</code>.</p> <p>Static fields will not be included. Superclass fields will be appended up to and including the specified superclass. A null superclass is treated as java.lang.Object.</p> @param lhs <code>this</code> object @param rhs the other object @param testTransients whether to include transient fields @param reflectUpToClass the superclass to reflect up to (inclusive), may be <code>null</code> @param excludeFields array of field names to exclude from testing @return <code>true</code> if the two Objects have tested equals. @see EqualsExclude @since 2.0 """ return reflectionEquals(lhs, rhs, testTransients, reflectUpToClass, false, excludeFields); }
java
@GwtIncompatible("incompatible method") public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients, final Class<?> reflectUpToClass, final String... excludeFields) { return reflectionEquals(lhs, rhs, testTransients, reflectUpToClass, false, excludeFields); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "boolean", "reflectionEquals", "(", "final", "Object", "lhs", ",", "final", "Object", "rhs", ",", "final", "boolean", "testTransients", ",", "final", "Class", "<", "?", ">", "reflectUpToClass", ",", "final", "String", "...", "excludeFields", ")", "{", "return", "reflectionEquals", "(", "lhs", ",", "rhs", ",", "testTransients", ",", "reflectUpToClass", ",", "false", ",", "excludeFields", ")", ";", "}" ]
<p>This method uses reflection to determine if the two <code>Object</code>s are equal.</p> <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly. Non-primitive fields are compared using <code>equals()</code>.</p> <p>If the testTransients parameter is set to <code>true</code>, transient members will be tested, otherwise they are ignored, as they are likely derived fields, and not part of the value of the <code>Object</code>.</p> <p>Static fields will not be included. Superclass fields will be appended up to and including the specified superclass. A null superclass is treated as java.lang.Object.</p> @param lhs <code>this</code> object @param rhs the other object @param testTransients whether to include transient fields @param reflectUpToClass the superclass to reflect up to (inclusive), may be <code>null</code> @param excludeFields array of field names to exclude from testing @return <code>true</code> if the two Objects have tested equals. @see EqualsExclude @since 2.0
[ "<p", ">", "This", "method", "uses", "reflection", "to", "determine", "if", "the", "two", "<code", ">", "Object<", "/", "code", ">", "s", "are", "equal", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java#L394-L398
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/ConditionalProbabilityTable.java
ConditionalProbabilityTable.query
public double query(int targetClass, int targetValue, int[] cord) { """ Queries the CPT for the probability of the target class occurring with the specified value given the class values of the other attributes @param targetClass the index in the original data set of the class that we want to probability of @param targetValue the value of the <tt>targetClass</tt> that we want to probability of occurring @param cord the coordinate array that corresponds the the class values for the CPT, where the coordinate of the <tt>targetClass</tt> may contain any value. @return the probability in [0, 1] of the <tt>targetClass</tt> occurring with the <tt>targetValue</tt> given the information in <tt>cord</tt> @see #dataPointToCord(jsat.classifiers.DataPointPair, int, int[]) """ double sumVal = 0; double targetVal = 0; int realTargetIndex = catIndexToRealIndex[targetClass]; CategoricalData queryData = valid.get(targetClass); //Now do all other target class posibilty querys for (int i = 0; i < queryData.getNumOfCategories(); i++) { cord[realTargetIndex] = i; double tmp = countArray[cordToIndex(cord)]; sumVal += tmp; if (i == targetValue) targetVal = tmp; } return targetVal/sumVal; }
java
public double query(int targetClass, int targetValue, int[] cord) { double sumVal = 0; double targetVal = 0; int realTargetIndex = catIndexToRealIndex[targetClass]; CategoricalData queryData = valid.get(targetClass); //Now do all other target class posibilty querys for (int i = 0; i < queryData.getNumOfCategories(); i++) { cord[realTargetIndex] = i; double tmp = countArray[cordToIndex(cord)]; sumVal += tmp; if (i == targetValue) targetVal = tmp; } return targetVal/sumVal; }
[ "public", "double", "query", "(", "int", "targetClass", ",", "int", "targetValue", ",", "int", "[", "]", "cord", ")", "{", "double", "sumVal", "=", "0", ";", "double", "targetVal", "=", "0", ";", "int", "realTargetIndex", "=", "catIndexToRealIndex", "[", "targetClass", "]", ";", "CategoricalData", "queryData", "=", "valid", ".", "get", "(", "targetClass", ")", ";", "//Now do all other target class posibilty querys ", "for", "(", "int", "i", "=", "0", ";", "i", "<", "queryData", ".", "getNumOfCategories", "(", ")", ";", "i", "++", ")", "{", "cord", "[", "realTargetIndex", "]", "=", "i", ";", "double", "tmp", "=", "countArray", "[", "cordToIndex", "(", "cord", ")", "]", ";", "sumVal", "+=", "tmp", ";", "if", "(", "i", "==", "targetValue", ")", "targetVal", "=", "tmp", ";", "}", "return", "targetVal", "/", "sumVal", ";", "}" ]
Queries the CPT for the probability of the target class occurring with the specified value given the class values of the other attributes @param targetClass the index in the original data set of the class that we want to probability of @param targetValue the value of the <tt>targetClass</tt> that we want to probability of occurring @param cord the coordinate array that corresponds the the class values for the CPT, where the coordinate of the <tt>targetClass</tt> may contain any value. @return the probability in [0, 1] of the <tt>targetClass</tt> occurring with the <tt>targetValue</tt> given the information in <tt>cord</tt> @see #dataPointToCord(jsat.classifiers.DataPointPair, int, int[])
[ "Queries", "the", "CPT", "for", "the", "probability", "of", "the", "target", "class", "occurring", "with", "the", "specified", "value", "given", "the", "class", "values", "of", "the", "other", "attributes" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/ConditionalProbabilityTable.java#L225-L248
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableVeneerSettingsFactory.java
BigtableVeneerSettingsFactory.buildMutateRowSettings
private static void buildMutateRowSettings(Builder builder, BigtableOptions options) { """ To build BigtableDataSettings#mutateRowSettings with default Retry settings. """ RetrySettings retrySettings = buildIdempotentRetrySettings(builder.mutateRowSettings().getRetrySettings(), options); builder.mutateRowSettings() .setRetrySettings(retrySettings) .setRetryableCodes(buildRetryCodes(options.getRetryOptions())); }
java
private static void buildMutateRowSettings(Builder builder, BigtableOptions options) { RetrySettings retrySettings = buildIdempotentRetrySettings(builder.mutateRowSettings().getRetrySettings(), options); builder.mutateRowSettings() .setRetrySettings(retrySettings) .setRetryableCodes(buildRetryCodes(options.getRetryOptions())); }
[ "private", "static", "void", "buildMutateRowSettings", "(", "Builder", "builder", ",", "BigtableOptions", "options", ")", "{", "RetrySettings", "retrySettings", "=", "buildIdempotentRetrySettings", "(", "builder", ".", "mutateRowSettings", "(", ")", ".", "getRetrySettings", "(", ")", ",", "options", ")", ";", "builder", ".", "mutateRowSettings", "(", ")", ".", "setRetrySettings", "(", "retrySettings", ")", ".", "setRetryableCodes", "(", "buildRetryCodes", "(", "options", ".", "getRetryOptions", "(", ")", ")", ")", ";", "}" ]
To build BigtableDataSettings#mutateRowSettings with default Retry settings.
[ "To", "build", "BigtableDataSettings#mutateRowSettings", "with", "default", "Retry", "settings", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableVeneerSettingsFactory.java#L214-L221
jhalterman/failsafe
src/main/java/net/jodah/failsafe/FailsafeExecutor.java
FailsafeExecutor.getStageAsync
public <T extends R> CompletableFuture<T> getStageAsync(CheckedSupplier<? extends CompletionStage<T>> supplier) { """ Executes the {@code supplier} asynchronously until the resulting future is successfully completed or the configured policies are exceeded. <p> If a configured circuit breaker is open, the resulting future is completed exceptionally with {@link CircuitBreakerOpenException}. @throws NullPointerException if the {@code supplier} is null @throws RejectedExecutionException if the {@code supplier} cannot be scheduled for execution """ return callAsync(execution -> Functions.promiseOfStage(supplier, execution), false); }
java
public <T extends R> CompletableFuture<T> getStageAsync(CheckedSupplier<? extends CompletionStage<T>> supplier) { return callAsync(execution -> Functions.promiseOfStage(supplier, execution), false); }
[ "public", "<", "T", "extends", "R", ">", "CompletableFuture", "<", "T", ">", "getStageAsync", "(", "CheckedSupplier", "<", "?", "extends", "CompletionStage", "<", "T", ">", ">", "supplier", ")", "{", "return", "callAsync", "(", "execution", "->", "Functions", ".", "promiseOfStage", "(", "supplier", ",", "execution", ")", ",", "false", ")", ";", "}" ]
Executes the {@code supplier} asynchronously until the resulting future is successfully completed or the configured policies are exceeded. <p> If a configured circuit breaker is open, the resulting future is completed exceptionally with {@link CircuitBreakerOpenException}. @throws NullPointerException if the {@code supplier} is null @throws RejectedExecutionException if the {@code supplier} cannot be scheduled for execution
[ "Executes", "the", "{", "@code", "supplier", "}", "asynchronously", "until", "the", "resulting", "future", "is", "successfully", "completed", "or", "the", "configured", "policies", "are", "exceeded", ".", "<p", ">", "If", "a", "configured", "circuit", "breaker", "is", "open", "the", "resulting", "future", "is", "completed", "exceptionally", "with", "{", "@link", "CircuitBreakerOpenException", "}", "." ]
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/FailsafeExecutor.java#L174-L176
XiaoMi/chronos
chronos-server/src/main/java/com/xiaomi/infra/chronos/zookeeper/HostPort.java
HostPort.parseHostPort
public static HostPort parseHostPort(String string) { """ Parse a host_port string to construct the HostPost object. @param string the host_port string @return the HostPort object """ String[] strings = string.split("_"); return new HostPort(strings[0], Integer.parseInt(strings[1])); }
java
public static HostPort parseHostPort(String string) { String[] strings = string.split("_"); return new HostPort(strings[0], Integer.parseInt(strings[1])); }
[ "public", "static", "HostPort", "parseHostPort", "(", "String", "string", ")", "{", "String", "[", "]", "strings", "=", "string", ".", "split", "(", "\"_\"", ")", ";", "return", "new", "HostPort", "(", "strings", "[", "0", "]", ",", "Integer", ".", "parseInt", "(", "strings", "[", "1", "]", ")", ")", ";", "}" ]
Parse a host_port string to construct the HostPost object. @param string the host_port string @return the HostPort object
[ "Parse", "a", "host_port", "string", "to", "construct", "the", "HostPost", "object", "." ]
train
https://github.com/XiaoMi/chronos/blob/92e4a30c98947e87aba47ea88c944a56505a4ec0/chronos-server/src/main/java/com/xiaomi/infra/chronos/zookeeper/HostPort.java#L39-L42
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectMgr.java
FrameworkProjectMgr.getFrameworkProject
public FrameworkProject getFrameworkProject(final String name) { """ @return an existing Project object and returns it @param name The name of the project """ FrameworkProject frameworkProject = loadChild(name); if (null != frameworkProject) { return frameworkProject; } throw new NoSuchResourceException("Project does not exist: " + name, this); }
java
public FrameworkProject getFrameworkProject(final String name) { FrameworkProject frameworkProject = loadChild(name); if (null != frameworkProject) { return frameworkProject; } throw new NoSuchResourceException("Project does not exist: " + name, this); }
[ "public", "FrameworkProject", "getFrameworkProject", "(", "final", "String", "name", ")", "{", "FrameworkProject", "frameworkProject", "=", "loadChild", "(", "name", ")", ";", "if", "(", "null", "!=", "frameworkProject", ")", "{", "return", "frameworkProject", ";", "}", "throw", "new", "NoSuchResourceException", "(", "\"Project does not exist: \"", "+", "name", ",", "this", ")", ";", "}" ]
@return an existing Project object and returns it @param name The name of the project
[ "@return", "an", "existing", "Project", "object", "and", "returns", "it" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectMgr.java#L197-L203
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/vat/VATManager.java
VATManager.isZeroVATAllowed
public boolean isZeroVATAllowed (@Nonnull final Locale aCountry, final boolean bUndefinedValue) { """ Check if zero VAT is allowed for the passed country @param aCountry The country to be checked. @param bUndefinedValue The value to be returned, if no VAT data is available for the passed country @return <code>true</code> or <code>false</code> """ ValueEnforcer.notNull (aCountry, "Country"); // first get locale specific VAT types final VATCountryData aVATCountryData = getVATCountryData (aCountry); return aVATCountryData != null ? aVATCountryData.isZeroVATAllowed () : bUndefinedValue; }
java
public boolean isZeroVATAllowed (@Nonnull final Locale aCountry, final boolean bUndefinedValue) { ValueEnforcer.notNull (aCountry, "Country"); // first get locale specific VAT types final VATCountryData aVATCountryData = getVATCountryData (aCountry); return aVATCountryData != null ? aVATCountryData.isZeroVATAllowed () : bUndefinedValue; }
[ "public", "boolean", "isZeroVATAllowed", "(", "@", "Nonnull", "final", "Locale", "aCountry", ",", "final", "boolean", "bUndefinedValue", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aCountry", ",", "\"Country\"", ")", ";", "// first get locale specific VAT types", "final", "VATCountryData", "aVATCountryData", "=", "getVATCountryData", "(", "aCountry", ")", ";", "return", "aVATCountryData", "!=", "null", "?", "aVATCountryData", ".", "isZeroVATAllowed", "(", ")", ":", "bUndefinedValue", ";", "}" ]
Check if zero VAT is allowed for the passed country @param aCountry The country to be checked. @param bUndefinedValue The value to be returned, if no VAT data is available for the passed country @return <code>true</code> or <code>false</code>
[ "Check", "if", "zero", "VAT", "is", "allowed", "for", "the", "passed", "country" ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/vat/VATManager.java#L258-L265
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/QueryRecord.java
QueryRecord.getField
public BaseField getField(String strTableName, int iFieldSeq) // Lookup this field { """ Get this field in the record. This is a little different for a query record, because I have to look through multiple records. @param iFieldSeq The position in the query to retrive. @param strTableName The record name. @return The field at this location. """ Record record = this.getRecord(strTableName); if (record != null) return record.getField(iFieldSeq); return null; // Not found }
java
public BaseField getField(String strTableName, int iFieldSeq) // Lookup this field { Record record = this.getRecord(strTableName); if (record != null) return record.getField(iFieldSeq); return null; // Not found }
[ "public", "BaseField", "getField", "(", "String", "strTableName", ",", "int", "iFieldSeq", ")", "// Lookup this field", "{", "Record", "record", "=", "this", ".", "getRecord", "(", "strTableName", ")", ";", "if", "(", "record", "!=", "null", ")", "return", "record", ".", "getField", "(", "iFieldSeq", ")", ";", "return", "null", ";", "// Not found", "}" ]
Get this field in the record. This is a little different for a query record, because I have to look through multiple records. @param iFieldSeq The position in the query to retrive. @param strTableName The record name. @return The field at this location.
[ "Get", "this", "field", "in", "the", "record", ".", "This", "is", "a", "little", "different", "for", "a", "query", "record", "because", "I", "have", "to", "look", "through", "multiple", "records", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/QueryRecord.java#L327-L333
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java
WorkflowTriggersInner.getSchemaJson
public JsonSchemaInner getSchemaJson(String resourceGroupName, String workflowName, String triggerName) { """ Get the trigger schema as JSON. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param triggerName The workflow trigger name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JsonSchemaInner object if successful. """ return getSchemaJsonWithServiceResponseAsync(resourceGroupName, workflowName, triggerName).toBlocking().single().body(); }
java
public JsonSchemaInner getSchemaJson(String resourceGroupName, String workflowName, String triggerName) { return getSchemaJsonWithServiceResponseAsync(resourceGroupName, workflowName, triggerName).toBlocking().single().body(); }
[ "public", "JsonSchemaInner", "getSchemaJson", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "String", "triggerName", ")", "{", "return", "getSchemaJsonWithServiceResponseAsync", "(", "resourceGroupName", ",", "workflowName", ",", "triggerName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get the trigger schema as JSON. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param triggerName The workflow trigger name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JsonSchemaInner object if successful.
[ "Get", "the", "trigger", "schema", "as", "JSON", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java#L638-L640
hibernate/hibernate-ogm
infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/LocalCacheManager.java
LocalCacheManager.enableClusteringHashGroups
private static Configuration enableClusteringHashGroups(String cacheName, Configuration configuration) { """ Enable the clustering.hash.groups configuration if it's not already enabled. <p> Infinispan requires this option enabled because we are using fine grained maps. The function will log a warning if the property is disabled. @return the updated configuration """ if ( configuration.clustering().hash().groups().enabled() ) { return configuration; } LOG.clusteringHashGroupsMustBeEnabled( cacheName ); ConfigurationBuilder builder = new ConfigurationBuilder().read( configuration ); builder.clustering().hash().groups().enabled(); return builder.build(); }
java
private static Configuration enableClusteringHashGroups(String cacheName, Configuration configuration) { if ( configuration.clustering().hash().groups().enabled() ) { return configuration; } LOG.clusteringHashGroupsMustBeEnabled( cacheName ); ConfigurationBuilder builder = new ConfigurationBuilder().read( configuration ); builder.clustering().hash().groups().enabled(); return builder.build(); }
[ "private", "static", "Configuration", "enableClusteringHashGroups", "(", "String", "cacheName", ",", "Configuration", "configuration", ")", "{", "if", "(", "configuration", ".", "clustering", "(", ")", ".", "hash", "(", ")", ".", "groups", "(", ")", ".", "enabled", "(", ")", ")", "{", "return", "configuration", ";", "}", "LOG", ".", "clusteringHashGroupsMustBeEnabled", "(", "cacheName", ")", ";", "ConfigurationBuilder", "builder", "=", "new", "ConfigurationBuilder", "(", ")", ".", "read", "(", "configuration", ")", ";", "builder", ".", "clustering", "(", ")", ".", "hash", "(", ")", ".", "groups", "(", ")", ".", "enabled", "(", ")", ";", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Enable the clustering.hash.groups configuration if it's not already enabled. <p> Infinispan requires this option enabled because we are using fine grained maps. The function will log a warning if the property is disabled. @return the updated configuration
[ "Enable", "the", "clustering", ".", "hash", ".", "groups", "configuration", "if", "it", "s", "not", "already", "enabled", ".", "<p", ">", "Infinispan", "requires", "this", "option", "enabled", "because", "we", "are", "using", "fine", "grained", "maps", ".", "The", "function", "will", "log", "a", "warning", "if", "the", "property", "is", "disabled", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/LocalCacheManager.java#L155-L163
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.inclusiveBetween
@SuppressWarnings("boxing") public static void inclusiveBetween(final double start, final double end, final double value) { """ Validate that the specified primitive value falls between the two inclusive values specified; otherwise, throws an exception. <pre>Validate.inclusiveBetween(0.1, 2.1, 1.1);</pre> @param start the inclusive start value @param end the inclusive end value @param value the value to validate @throws IllegalArgumentException if the value falls outside the boundaries (inclusive) @since 3.3 """ // TODO when breaking BC, consider returning value if (value < start || value > end) { throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end)); } }
java
@SuppressWarnings("boxing") public static void inclusiveBetween(final double start, final double end, final double value) { // TODO when breaking BC, consider returning value if (value < start || value > end) { throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end)); } }
[ "@", "SuppressWarnings", "(", "\"boxing\"", ")", "public", "static", "void", "inclusiveBetween", "(", "final", "double", "start", ",", "final", "double", "end", ",", "final", "double", "value", ")", "{", "// TODO when breaking BC, consider returning value", "if", "(", "value", "<", "start", "||", "value", ">", "end", ")", "{", "throw", "new", "IllegalArgumentException", "(", "StringUtils", ".", "simpleFormat", "(", "DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE", ",", "value", ",", "start", ",", "end", ")", ")", ";", "}", "}" ]
Validate that the specified primitive value falls between the two inclusive values specified; otherwise, throws an exception. <pre>Validate.inclusiveBetween(0.1, 2.1, 1.1);</pre> @param start the inclusive start value @param end the inclusive end value @param value the value to validate @throws IllegalArgumentException if the value falls outside the boundaries (inclusive) @since 3.3
[ "Validate", "that", "the", "specified", "primitive", "value", "falls", "between", "the", "two", "inclusive", "values", "specified", ";", "otherwise", "throws", "an", "exception", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L1078-L1084
leancloud/java-sdk-all
core/src/main/java/cn/leancloud/AVQuery.java
AVQuery.whereMatchesKeyInQuery
public AVQuery<T> whereMatchesKeyInQuery(String key, String keyInQuery, AVQuery<?> query) { """ Add a constraint to the query that requires a particular key's value matches a value for a key in the results of another AVQuery @param key The key whose value is being checked @param keyInQuery The key in the objects from the sub query to look in @param query The sub query to run @return Returns the query so you can chain this call. """ Map<String, Object> inner = new HashMap<String, Object>(); inner.put("className", query.getClassName()); inner.put("where", query.conditions.compileWhereOperationMap()); if (query.conditions.getSkip() > 0) inner.put("skip", query.conditions.getSkip()); if (query.conditions.getLimit() > 0) inner.put("limit", query.conditions.getLimit()); if (!StringUtil.isEmpty(query.getOrder())) inner.put("order", query.getOrder()); Map<String, Object> queryMap = new HashMap<String, Object>(); queryMap.put("query", inner); queryMap.put("key", keyInQuery); return addWhereItem(key, "$select", queryMap); }
java
public AVQuery<T> whereMatchesKeyInQuery(String key, String keyInQuery, AVQuery<?> query) { Map<String, Object> inner = new HashMap<String, Object>(); inner.put("className", query.getClassName()); inner.put("where", query.conditions.compileWhereOperationMap()); if (query.conditions.getSkip() > 0) inner.put("skip", query.conditions.getSkip()); if (query.conditions.getLimit() > 0) inner.put("limit", query.conditions.getLimit()); if (!StringUtil.isEmpty(query.getOrder())) inner.put("order", query.getOrder()); Map<String, Object> queryMap = new HashMap<String, Object>(); queryMap.put("query", inner); queryMap.put("key", keyInQuery); return addWhereItem(key, "$select", queryMap); }
[ "public", "AVQuery", "<", "T", ">", "whereMatchesKeyInQuery", "(", "String", "key", ",", "String", "keyInQuery", ",", "AVQuery", "<", "?", ">", "query", ")", "{", "Map", "<", "String", ",", "Object", ">", "inner", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "inner", ".", "put", "(", "\"className\"", ",", "query", ".", "getClassName", "(", ")", ")", ";", "inner", ".", "put", "(", "\"where\"", ",", "query", ".", "conditions", ".", "compileWhereOperationMap", "(", ")", ")", ";", "if", "(", "query", ".", "conditions", ".", "getSkip", "(", ")", ">", "0", ")", "inner", ".", "put", "(", "\"skip\"", ",", "query", ".", "conditions", ".", "getSkip", "(", ")", ")", ";", "if", "(", "query", ".", "conditions", ".", "getLimit", "(", ")", ">", "0", ")", "inner", ".", "put", "(", "\"limit\"", ",", "query", ".", "conditions", ".", "getLimit", "(", ")", ")", ";", "if", "(", "!", "StringUtil", ".", "isEmpty", "(", "query", ".", "getOrder", "(", ")", ")", ")", "inner", ".", "put", "(", "\"order\"", ",", "query", ".", "getOrder", "(", ")", ")", ";", "Map", "<", "String", ",", "Object", ">", "queryMap", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "queryMap", ".", "put", "(", "\"query\"", ",", "inner", ")", ";", "queryMap", ".", "put", "(", "\"key\"", ",", "keyInQuery", ")", ";", "return", "addWhereItem", "(", "key", ",", "\"$select\"", ",", "queryMap", ")", ";", "}" ]
Add a constraint to the query that requires a particular key's value matches a value for a key in the results of another AVQuery @param key The key whose value is being checked @param keyInQuery The key in the objects from the sub query to look in @param query The sub query to run @return Returns the query so you can chain this call.
[ "Add", "a", "constraint", "to", "the", "query", "that", "requires", "a", "particular", "key", "s", "value", "matches", "a", "value", "for", "a", "key", "in", "the", "results", "of", "another", "AVQuery" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/core/src/main/java/cn/leancloud/AVQuery.java#L737-L749
virgo47/javasimon
core/src/main/java/org/javasimon/utils/SimonUtils.java
SimonUtils.doWithStopwatch
public static void doWithStopwatch(String name, Runnable runnable) { """ Calls a block of code with stopwatch around, can not return any result or throw an exception (use {@link #doWithStopwatch(String, java.util.concurrent.Callable)} instead). @param name name of the Stopwatch @param runnable wrapped block of code @since 3.0 """ try (Split split = SimonManager.getStopwatch(name).start()) { runnable.run(); } }
java
public static void doWithStopwatch(String name, Runnable runnable) { try (Split split = SimonManager.getStopwatch(name).start()) { runnable.run(); } }
[ "public", "static", "void", "doWithStopwatch", "(", "String", "name", ",", "Runnable", "runnable", ")", "{", "try", "(", "Split", "split", "=", "SimonManager", ".", "getStopwatch", "(", "name", ")", ".", "start", "(", ")", ")", "{", "runnable", ".", "run", "(", ")", ";", "}", "}" ]
Calls a block of code with stopwatch around, can not return any result or throw an exception (use {@link #doWithStopwatch(String, java.util.concurrent.Callable)} instead). @param name name of the Stopwatch @param runnable wrapped block of code @since 3.0
[ "Calls", "a", "block", "of", "code", "with", "stopwatch", "around", "can", "not", "return", "any", "result", "or", "throw", "an", "exception", "(", "use", "{", "@link", "#doWithStopwatch", "(", "String", "java", ".", "util", ".", "concurrent", ".", "Callable", ")", "}", "instead", ")", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SimonUtils.java#L358-L362
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaMemcpyFromArray
public static int cudaMemcpyFromArray(Pointer dst, cudaArray src, long wOffset, long hOffset, long count, int cudaMemcpyKind_kind) { """ Copies data between host and device. <pre> cudaError_t cudaMemcpyFromArray ( void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind ) </pre> <div> <p>Copies data between host and device. Copies <tt>count</tt> bytes from the CUDA array <tt>src</tt> starting at the upper left corner (<tt>wOffset</tt>, hOffset) to the memory area pointed to by <tt>dst</tt>, where <tt>kind</tt> is one of cudaMemcpyHostToHost, cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost, or cudaMemcpyDeviceToDevice, and specifies the direction of the copy. </p> <div> <span>Note:</span> <ul> <li> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li> <p>This function exhibits synchronous behavior for most use cases. </p> </li> </ul> </div> </p> </div> @param dst Destination memory address @param src Source memory address @param wOffset Source starting X offset @param hOffset Source starting Y offset @param count Size in bytes to copy @param kind Type of transfer @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidMemcpyDirection @see JCuda#cudaMemcpy @see JCuda#cudaMemcpy2D @see JCuda#cudaMemcpyToArray @see JCuda#cudaMemcpy2DToArray @see JCuda#cudaMemcpy2DFromArray @see JCuda#cudaMemcpyArrayToArray @see JCuda#cudaMemcpy2DArrayToArray @see JCuda#cudaMemcpyToSymbol @see JCuda#cudaMemcpyFromSymbol @see JCuda#cudaMemcpyAsync @see JCuda#cudaMemcpy2DAsync @see JCuda#cudaMemcpyToArrayAsync @see JCuda#cudaMemcpy2DToArrayAsync @see JCuda#cudaMemcpyFromArrayAsync @see JCuda#cudaMemcpy2DFromArrayAsync @see JCuda#cudaMemcpyToSymbolAsync @see JCuda#cudaMemcpyFromSymbolAsync """ return checkResult(cudaMemcpyFromArrayNative(dst, src, wOffset, hOffset, count, cudaMemcpyKind_kind)); }
java
public static int cudaMemcpyFromArray(Pointer dst, cudaArray src, long wOffset, long hOffset, long count, int cudaMemcpyKind_kind) { return checkResult(cudaMemcpyFromArrayNative(dst, src, wOffset, hOffset, count, cudaMemcpyKind_kind)); }
[ "public", "static", "int", "cudaMemcpyFromArray", "(", "Pointer", "dst", ",", "cudaArray", "src", ",", "long", "wOffset", ",", "long", "hOffset", ",", "long", "count", ",", "int", "cudaMemcpyKind_kind", ")", "{", "return", "checkResult", "(", "cudaMemcpyFromArrayNative", "(", "dst", ",", "src", ",", "wOffset", ",", "hOffset", ",", "count", ",", "cudaMemcpyKind_kind", ")", ")", ";", "}" ]
Copies data between host and device. <pre> cudaError_t cudaMemcpyFromArray ( void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind ) </pre> <div> <p>Copies data between host and device. Copies <tt>count</tt> bytes from the CUDA array <tt>src</tt> starting at the upper left corner (<tt>wOffset</tt>, hOffset) to the memory area pointed to by <tt>dst</tt>, where <tt>kind</tt> is one of cudaMemcpyHostToHost, cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost, or cudaMemcpyDeviceToDevice, and specifies the direction of the copy. </p> <div> <span>Note:</span> <ul> <li> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li> <p>This function exhibits synchronous behavior for most use cases. </p> </li> </ul> </div> </p> </div> @param dst Destination memory address @param src Source memory address @param wOffset Source starting X offset @param hOffset Source starting Y offset @param count Size in bytes to copy @param kind Type of transfer @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidMemcpyDirection @see JCuda#cudaMemcpy @see JCuda#cudaMemcpy2D @see JCuda#cudaMemcpyToArray @see JCuda#cudaMemcpy2DToArray @see JCuda#cudaMemcpy2DFromArray @see JCuda#cudaMemcpyArrayToArray @see JCuda#cudaMemcpy2DArrayToArray @see JCuda#cudaMemcpyToSymbol @see JCuda#cudaMemcpyFromSymbol @see JCuda#cudaMemcpyAsync @see JCuda#cudaMemcpy2DAsync @see JCuda#cudaMemcpyToArrayAsync @see JCuda#cudaMemcpy2DToArrayAsync @see JCuda#cudaMemcpyFromArrayAsync @see JCuda#cudaMemcpy2DFromArrayAsync @see JCuda#cudaMemcpyToSymbolAsync @see JCuda#cudaMemcpyFromSymbolAsync
[ "Copies", "data", "between", "host", "and", "device", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L4820-L4823
belaban/JGroups
src/org/jgroups/fork/ForkChannel.java
ForkChannel.disconnect
@Override public ForkChannel disconnect() { """ Removes the fork-channel from the fork-stack's hashmap and resets its state. Does <em>not</em> affect the main-channel """ if(state != State.CONNECTED) return this; prot_stack.down(new Event(Event.DISCONNECT, local_addr)); // will be discarded by ForkProtocol prot_stack.stopStack(cluster_name); ((ForkProtocolStack)prot_stack).remove(fork_channel_id); nullFields(); state=State.OPEN; notifyChannelDisconnected(this); return this; }
java
@Override public ForkChannel disconnect() { if(state != State.CONNECTED) return this; prot_stack.down(new Event(Event.DISCONNECT, local_addr)); // will be discarded by ForkProtocol prot_stack.stopStack(cluster_name); ((ForkProtocolStack)prot_stack).remove(fork_channel_id); nullFields(); state=State.OPEN; notifyChannelDisconnected(this); return this; }
[ "@", "Override", "public", "ForkChannel", "disconnect", "(", ")", "{", "if", "(", "state", "!=", "State", ".", "CONNECTED", ")", "return", "this", ";", "prot_stack", ".", "down", "(", "new", "Event", "(", "Event", ".", "DISCONNECT", ",", "local_addr", ")", ")", ";", "// will be discarded by ForkProtocol", "prot_stack", ".", "stopStack", "(", "cluster_name", ")", ";", "(", "(", "ForkProtocolStack", ")", "prot_stack", ")", ".", "remove", "(", "fork_channel_id", ")", ";", "nullFields", "(", ")", ";", "state", "=", "State", ".", "OPEN", ";", "notifyChannelDisconnected", "(", "this", ")", ";", "return", "this", ";", "}" ]
Removes the fork-channel from the fork-stack's hashmap and resets its state. Does <em>not</em> affect the main-channel
[ "Removes", "the", "fork", "-", "channel", "from", "the", "fork", "-", "stack", "s", "hashmap", "and", "resets", "its", "state", ".", "Does", "<em", ">", "not<", "/", "em", ">", "affect", "the", "main", "-", "channel" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/fork/ForkChannel.java#L180-L191
orhanobut/mockwebserverplus
mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/Fixture.java
Fixture.parseFrom
public static Fixture parseFrom(String fileName, Parser parser) { """ Parse the given filename and returns the Fixture object. @param fileName filename should not contain extension or relative path. ie: login @param parser parser is required for parsing operation, it should not be null """ if (fileName == null) { throw new NullPointerException("File name should not be null"); } String path = "fixtures/" + fileName + ".yaml"; InputStream inputStream = openPathAsStream(path); Fixture result = parser.parse(inputStream); if (result.body != null && !result.body.startsWith("{")) { String bodyPath = "fixtures/" + result.body; try { result.body = readPathIntoString(bodyPath); } catch (IOException e) { throw new IllegalStateException("Error reading body: " + bodyPath, e); } } return result; }
java
public static Fixture parseFrom(String fileName, Parser parser) { if (fileName == null) { throw new NullPointerException("File name should not be null"); } String path = "fixtures/" + fileName + ".yaml"; InputStream inputStream = openPathAsStream(path); Fixture result = parser.parse(inputStream); if (result.body != null && !result.body.startsWith("{")) { String bodyPath = "fixtures/" + result.body; try { result.body = readPathIntoString(bodyPath); } catch (IOException e) { throw new IllegalStateException("Error reading body: " + bodyPath, e); } } return result; }
[ "public", "static", "Fixture", "parseFrom", "(", "String", "fileName", ",", "Parser", "parser", ")", "{", "if", "(", "fileName", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"File name should not be null\"", ")", ";", "}", "String", "path", "=", "\"fixtures/\"", "+", "fileName", "+", "\".yaml\"", ";", "InputStream", "inputStream", "=", "openPathAsStream", "(", "path", ")", ";", "Fixture", "result", "=", "parser", ".", "parse", "(", "inputStream", ")", ";", "if", "(", "result", ".", "body", "!=", "null", "&&", "!", "result", ".", "body", ".", "startsWith", "(", "\"{\"", ")", ")", "{", "String", "bodyPath", "=", "\"fixtures/\"", "+", "result", ".", "body", ";", "try", "{", "result", ".", "body", "=", "readPathIntoString", "(", "bodyPath", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error reading body: \"", "+", "bodyPath", ",", "e", ")", ";", "}", "}", "return", "result", ";", "}" ]
Parse the given filename and returns the Fixture object. @param fileName filename should not contain extension or relative path. ie: login @param parser parser is required for parsing operation, it should not be null
[ "Parse", "the", "given", "filename", "and", "returns", "the", "Fixture", "object", "." ]
train
https://github.com/orhanobut/mockwebserverplus/blob/bb2c5cb4eece98745688ec562486b6bfc5d1b6c7/mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/Fixture.java#L38-L55
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/GroupService.java
GroupService.ifindLockableGroup
private ILockableEntityGroup ifindLockableGroup(String key, String lockOwner) throws GroupsException { """ Returns a pre-existing <code>ILockableEntityGroup</code> or null if the group is not found. @param key String - the group key. @param lockOwner String - typically the user. @return org.apereo.portal.groups.ILockableEntityGroup """ return compositeGroupService.findGroupWithLock(key, lockOwner); }
java
private ILockableEntityGroup ifindLockableGroup(String key, String lockOwner) throws GroupsException { return compositeGroupService.findGroupWithLock(key, lockOwner); }
[ "private", "ILockableEntityGroup", "ifindLockableGroup", "(", "String", "key", ",", "String", "lockOwner", ")", "throws", "GroupsException", "{", "return", "compositeGroupService", ".", "findGroupWithLock", "(", "key", ",", "lockOwner", ")", ";", "}" ]
Returns a pre-existing <code>ILockableEntityGroup</code> or null if the group is not found. @param key String - the group key. @param lockOwner String - typically the user. @return org.apereo.portal.groups.ILockableEntityGroup
[ "Returns", "a", "pre", "-", "existing", "<code", ">", "ILockableEntityGroup<", "/", "code", ">", "or", "null", "if", "the", "group", "is", "not", "found", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/GroupService.java#L239-L242
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java
AbstractCasView.getErrorCodeFrom
protected String getErrorCodeFrom(final Map<String, Object> model) { """ Gets error code from. @param model the model @return the error code from """ return model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_ERROR_CODE).toString(); }
java
protected String getErrorCodeFrom(final Map<String, Object> model) { return model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_ERROR_CODE).toString(); }
[ "protected", "String", "getErrorCodeFrom", "(", "final", "Map", "<", "String", ",", "Object", ">", "model", ")", "{", "return", "model", ".", "get", "(", "CasViewConstants", ".", "MODEL_ATTRIBUTE_NAME_ERROR_CODE", ")", ".", "toString", "(", ")", ";", "}" ]
Gets error code from. @param model the model @return the error code from
[ "Gets", "error", "code", "from", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java#L86-L88
interedition/collatex
collatex-core/src/main/java/eu/interedition/collatex/suffixarray/Skew.java
Skew.radixPass
private static void radixPass(int[] src, int[] dst, int[] v, int vi, final int n, final int K, int start, int[] cnt) { """ Stably sort indexes from src[0..n-1] to dst[0..n-1] with values in 0..K from v. A constant offset of <code>vi</code> is added to indexes from src. """ // check counter array's size. assert cnt.length >= K + 1; Arrays.fill(cnt, 0, K + 1, 0); // count occurrences for (int i = 0; i < n; i++) cnt[v[start + vi + src[i]]]++; // exclusive prefix sums for (int i = 0, sum = 0; i <= K; i++) { final int t = cnt[i]; cnt[i] = sum; sum += t; } // sort for (int i = 0; i < n; i++) dst[cnt[v[start + vi + src[i]]]++] = src[i]; }
java
private static void radixPass(int[] src, int[] dst, int[] v, int vi, final int n, final int K, int start, int[] cnt) { // check counter array's size. assert cnt.length >= K + 1; Arrays.fill(cnt, 0, K + 1, 0); // count occurrences for (int i = 0; i < n; i++) cnt[v[start + vi + src[i]]]++; // exclusive prefix sums for (int i = 0, sum = 0; i <= K; i++) { final int t = cnt[i]; cnt[i] = sum; sum += t; } // sort for (int i = 0; i < n; i++) dst[cnt[v[start + vi + src[i]]]++] = src[i]; }
[ "private", "static", "void", "radixPass", "(", "int", "[", "]", "src", ",", "int", "[", "]", "dst", ",", "int", "[", "]", "v", ",", "int", "vi", ",", "final", "int", "n", ",", "final", "int", "K", ",", "int", "start", ",", "int", "[", "]", "cnt", ")", "{", "// check counter array's size.", "assert", "cnt", ".", "length", ">=", "K", "+", "1", ";", "Arrays", ".", "fill", "(", "cnt", ",", "0", ",", "K", "+", "1", ",", "0", ")", ";", "// count occurrences", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "cnt", "[", "v", "[", "start", "+", "vi", "+", "src", "[", "i", "]", "]", "]", "++", ";", "// exclusive prefix sums", "for", "(", "int", "i", "=", "0", ",", "sum", "=", "0", ";", "i", "<=", "K", ";", "i", "++", ")", "{", "final", "int", "t", "=", "cnt", "[", "i", "]", ";", "cnt", "[", "i", "]", "=", "sum", ";", "sum", "+=", "t", ";", "}", "// sort", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "dst", "[", "cnt", "[", "v", "[", "start", "+", "vi", "+", "src", "[", "i", "]", "]", "]", "++", "]", "=", "src", "[", "i", "]", ";", "}" ]
Stably sort indexes from src[0..n-1] to dst[0..n-1] with values in 0..K from v. A constant offset of <code>vi</code> is added to indexes from src.
[ "Stably", "sort", "indexes", "from", "src", "[", "0", "..", "n", "-", "1", "]", "to", "dst", "[", "0", "..", "n", "-", "1", "]", "with", "values", "in", "0", "..", "K", "from", "v", ".", "A", "constant", "offset", "of", "<code", ">", "vi<", "/", "code", ">", "is", "added", "to", "indexes", "from", "src", "." ]
train
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/Skew.java#L41-L61