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
kevinherron/opc-ua-stack
stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/ArrayUtil.java
ArrayUtil.unflatten
public static Object unflatten(Object array, int[] dimensions) { """ Un-flatten a one-dimensional array into an multi-dimensional array based on the provided dimensions. @param array the 1-dimensional array to un-flatten. @param dimensions the dimensions to un-flatten to. @return a multi-dimensional array of the provided dimensions. """ Class<?> type = getType(array); return unflatten(type, array, dimensions, 0); }
java
public static Object unflatten(Object array, int[] dimensions) { Class<?> type = getType(array); return unflatten(type, array, dimensions, 0); }
[ "public", "static", "Object", "unflatten", "(", "Object", "array", ",", "int", "[", "]", "dimensions", ")", "{", "Class", "<", "?", ">", "type", "=", "getType", "(", "array", ")", ";", "return", "unflatten", "(", "type", ",", "array", ",", "dimensions", ",", "0", ")", ";", "}" ]
Un-flatten a one-dimensional array into an multi-dimensional array based on the provided dimensions. @param array the 1-dimensional array to un-flatten. @param dimensions the dimensions to un-flatten to. @return a multi-dimensional array of the provided dimensions.
[ "Un", "-", "flatten", "a", "one", "-", "dimensional", "array", "into", "an", "multi", "-", "dimensional", "array", "based", "on", "the", "provided", "dimensions", "." ]
train
https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/ArrayUtil.java#L70-L74
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.setPerspective
public Matrix4d setPerspective(double fovy, double aspect, double zNear, double zFar, boolean zZeroToOne) { """ Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspective(double, double, double, double, boolean) perspective()}. @see #perspective(double, double, double, double, boolean) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this """ double h = Math.tan(fovy * 0.5); m00 = 1.0 / (h * aspect); m01 = 0.0; m02 = 0.0; m03 = 0.0; m10 = 0.0; m11 = 1.0 / h; m12 = 0.0; m13 = 0.0; m20 = 0.0; m21 = 0.0; boolean farInf = zFar > 0 && Double.isInfinite(zFar); boolean nearInf = zNear > 0 && Double.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) double e = 1E-6; m22 = e - 1.0; m32 = (e - (zZeroToOne ? 1.0 : 2.0)) * zNear; } else if (nearInf) { double e = 1E-6; m22 = (zZeroToOne ? 0.0 : 1.0) - e; m32 = ((zZeroToOne ? 1.0 : 2.0) - e) * zFar; } else { m22 = (zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar); m32 = (zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar); } m23 = -1.0; m30 = 0.0; m31 = 0.0; m33 = 0.0; properties = PROPERTY_PERSPECTIVE; return this; }
java
public Matrix4d setPerspective(double fovy, double aspect, double zNear, double zFar, boolean zZeroToOne) { double h = Math.tan(fovy * 0.5); m00 = 1.0 / (h * aspect); m01 = 0.0; m02 = 0.0; m03 = 0.0; m10 = 0.0; m11 = 1.0 / h; m12 = 0.0; m13 = 0.0; m20 = 0.0; m21 = 0.0; boolean farInf = zFar > 0 && Double.isInfinite(zFar); boolean nearInf = zNear > 0 && Double.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) double e = 1E-6; m22 = e - 1.0; m32 = (e - (zZeroToOne ? 1.0 : 2.0)) * zNear; } else if (nearInf) { double e = 1E-6; m22 = (zZeroToOne ? 0.0 : 1.0) - e; m32 = ((zZeroToOne ? 1.0 : 2.0) - e) * zFar; } else { m22 = (zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar); m32 = (zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar); } m23 = -1.0; m30 = 0.0; m31 = 0.0; m33 = 0.0; properties = PROPERTY_PERSPECTIVE; return this; }
[ "public", "Matrix4d", "setPerspective", "(", "double", "fovy", ",", "double", "aspect", ",", "double", "zNear", ",", "double", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "double", "h", "=", "Math", ".", "tan", "(", "fovy", "*", "0.5", ")", ";", "m00", "=", "1.0", "/", "(", "h", "*", "aspect", ")", ";", "m01", "=", "0.0", ";", "m02", "=", "0.0", ";", "m03", "=", "0.0", ";", "m10", "=", "0.0", ";", "m11", "=", "1.0", "/", "h", ";", "m12", "=", "0.0", ";", "m13", "=", "0.0", ";", "m20", "=", "0.0", ";", "m21", "=", "0.0", ";", "boolean", "farInf", "=", "zFar", ">", "0", "&&", "Double", ".", "isInfinite", "(", "zFar", ")", ";", "boolean", "nearInf", "=", "zNear", ">", "0", "&&", "Double", ".", "isInfinite", "(", "zNear", ")", ";", "if", "(", "farInf", ")", "{", "// See: \"Infinite Projection Matrix\" (http://www.terathon.com/gdc07_lengyel.pdf)", "double", "e", "=", "1E-6", ";", "m22", "=", "e", "-", "1.0", ";", "m32", "=", "(", "e", "-", "(", "zZeroToOne", "?", "1.0", ":", "2.0", ")", ")", "*", "zNear", ";", "}", "else", "if", "(", "nearInf", ")", "{", "double", "e", "=", "1E-6", ";", "m22", "=", "(", "zZeroToOne", "?", "0.0", ":", "1.0", ")", "-", "e", ";", "m32", "=", "(", "(", "zZeroToOne", "?", "1.0", ":", "2.0", ")", "-", "e", ")", "*", "zFar", ";", "}", "else", "{", "m22", "=", "(", "zZeroToOne", "?", "zFar", ":", "zFar", "+", "zNear", ")", "/", "(", "zNear", "-", "zFar", ")", ";", "m32", "=", "(", "zZeroToOne", "?", "zFar", ":", "zFar", "+", "zFar", ")", "*", "zNear", "/", "(", "zNear", "-", "zFar", ")", ";", "}", "m23", "=", "-", "1.0", ";", "m30", "=", "0.0", ";", "m31", "=", "0.0", ";", "m33", "=", "0.0", ";", "properties", "=", "PROPERTY_PERSPECTIVE", ";", "return", "this", ";", "}" ]
Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspective(double, double, double, double, boolean) perspective()}. @see #perspective(double, double, double, double, boolean) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", ".", "<p", ">", "In", "order", "to", "apply", "the", "perspective", "projection", "transformation", "to", "an", "existing", "transformation", "use", "{", "@link", "#perspective", "(", "double", "double", "double", "double", "boolean", ")", "perspective", "()", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L12572-L12605
GerdHolz/TOVAL
src/de/invation/code/toval/misc/ListUtils.java
ListUtils.divideListSize
public static <T> List<List<T>> divideListSize(List<T> list, int listSize) { """ Divides the given list using the boundaries in <code>cuts</code>.<br> Cuts are interpreted in an inclusive way, which means that a single cut at position i divides the given list in 0...i-1 + i...n<br> This method deals with both cut positions including and excluding start and end-indexes<br> @param <T> Type of list elements @param list The list to divide @param positions Cut positions for divide operations @return A list of sublists of <code>list</code> according to the given cut positions """ if(list.size() <= listSize) return new ArrayList<>(Arrays.asList(list)); int numLists = (int) Math.ceil(list.size() / (listSize + 0.0)); // System.out.println("num lists: " + numLists); Integer[] positions = new Integer[numLists-1]; for(int i=0; i<numLists; i++){ int position = ((i+1)*listSize); // System.out.println("position: " + position); if(position < list.size()){ positions[i] = position; // System.out.println("add position"); } } // System.out.println(Arrays.toString(positions)); return divideListPos(list, positions); }
java
public static <T> List<List<T>> divideListSize(List<T> list, int listSize) { if(list.size() <= listSize) return new ArrayList<>(Arrays.asList(list)); int numLists = (int) Math.ceil(list.size() / (listSize + 0.0)); // System.out.println("num lists: " + numLists); Integer[] positions = new Integer[numLists-1]; for(int i=0; i<numLists; i++){ int position = ((i+1)*listSize); // System.out.println("position: " + position); if(position < list.size()){ positions[i] = position; // System.out.println("add position"); } } // System.out.println(Arrays.toString(positions)); return divideListPos(list, positions); }
[ "public", "static", "<", "T", ">", "List", "<", "List", "<", "T", ">", ">", "divideListSize", "(", "List", "<", "T", ">", "list", ",", "int", "listSize", ")", "{", "if", "(", "list", ".", "size", "(", ")", "<=", "listSize", ")", "return", "new", "ArrayList", "<>", "(", "Arrays", ".", "asList", "(", "list", ")", ")", ";", "int", "numLists", "=", "(", "int", ")", "Math", ".", "ceil", "(", "list", ".", "size", "(", ")", "/", "(", "listSize", "+", "0.0", ")", ")", ";", "//\t\tSystem.out.println(\"num lists: \" + numLists);\r", "Integer", "[", "]", "positions", "=", "new", "Integer", "[", "numLists", "-", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numLists", ";", "i", "++", ")", "{", "int", "position", "=", "(", "(", "i", "+", "1", ")", "*", "listSize", ")", ";", "//\t\t\tSystem.out.println(\"position: \" + position);\r", "if", "(", "position", "<", "list", ".", "size", "(", ")", ")", "{", "positions", "[", "i", "]", "=", "position", ";", "//\t\t\t\tSystem.out.println(\"add position\");\r", "}", "}", "//\t\tSystem.out.println(Arrays.toString(positions));\r", "return", "divideListPos", "(", "list", ",", "positions", ")", ";", "}" ]
Divides the given list using the boundaries in <code>cuts</code>.<br> Cuts are interpreted in an inclusive way, which means that a single cut at position i divides the given list in 0...i-1 + i...n<br> This method deals with both cut positions including and excluding start and end-indexes<br> @param <T> Type of list elements @param list The list to divide @param positions Cut positions for divide operations @return A list of sublists of <code>list</code> according to the given cut positions
[ "Divides", "the", "given", "list", "using", "the", "boundaries", "in", "<code", ">", "cuts<", "/", "code", ">", ".", "<br", ">", "Cuts", "are", "interpreted", "in", "an", "inclusive", "way", "which", "means", "that", "a", "single", "cut", "at", "position", "i", "divides", "the", "given", "list", "in", "0", "...", "i", "-", "1", "+", "i", "...", "n<br", ">", "This", "method", "deals", "with", "both", "cut", "positions", "including", "and", "excluding", "start", "and", "end", "-", "indexes<br", ">" ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ListUtils.java#L218-L234
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java
SerializationUtils.fromByteArray
public static <T> T fromByteArray(byte[] data, Class<T> clazz, ClassLoader classLoader) { """ Deserialize a byte array back to an object, with custom class loader. <p> If the target class implements {@link ISerializationSupport}, this method calls its {@link ISerializationSupport#toBytes()} method; otherwise FST library is used to serialize the object. </p> @param data @param clazz @param classLoader @return @deprecated since 0.9.2 with no replacement, use {@link #fromByteArrayFst(byte[], Class, ClassLoader)} or {@link #fromByteArrayKryo(byte[], Class, ClassLoader)} """ if (data == null) { return null; } if (ReflectionUtils.hasInterface(clazz, ISerializationSupport.class)) { ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); if (classLoader != null) { Thread.currentThread().setContextClassLoader(classLoader); } try { Constructor<T> constructor = clazz.getDeclaredConstructor(); constructor.setAccessible(true); T obj = constructor.newInstance(); ((ISerializationSupport) obj).fromBytes(data); return obj; } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e) { throw new DeserializationException(e); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } } return SerializationUtils.fromByteArrayFst(data, clazz, classLoader); }
java
public static <T> T fromByteArray(byte[] data, Class<T> clazz, ClassLoader classLoader) { if (data == null) { return null; } if (ReflectionUtils.hasInterface(clazz, ISerializationSupport.class)) { ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); if (classLoader != null) { Thread.currentThread().setContextClassLoader(classLoader); } try { Constructor<T> constructor = clazz.getDeclaredConstructor(); constructor.setAccessible(true); T obj = constructor.newInstance(); ((ISerializationSupport) obj).fromBytes(data); return obj; } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e) { throw new DeserializationException(e); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } } return SerializationUtils.fromByteArrayFst(data, clazz, classLoader); }
[ "public", "static", "<", "T", ">", "T", "fromByteArray", "(", "byte", "[", "]", "data", ",", "Class", "<", "T", ">", "clazz", ",", "ClassLoader", "classLoader", ")", "{", "if", "(", "data", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "ReflectionUtils", ".", "hasInterface", "(", "clazz", ",", "ISerializationSupport", ".", "class", ")", ")", "{", "ClassLoader", "oldClassLoader", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "if", "(", "classLoader", "!=", "null", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "setContextClassLoader", "(", "classLoader", ")", ";", "}", "try", "{", "Constructor", "<", "T", ">", "constructor", "=", "clazz", ".", "getDeclaredConstructor", "(", ")", ";", "constructor", ".", "setAccessible", "(", "true", ")", ";", "T", "obj", "=", "constructor", ".", "newInstance", "(", ")", ";", "(", "(", "ISerializationSupport", ")", "obj", ")", ".", "fromBytes", "(", "data", ")", ";", "return", "obj", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAccessException", "|", "NoSuchMethodException", "|", "SecurityException", "|", "IllegalArgumentException", "|", "InvocationTargetException", "e", ")", "{", "throw", "new", "DeserializationException", "(", "e", ")", ";", "}", "finally", "{", "Thread", ".", "currentThread", "(", ")", ".", "setContextClassLoader", "(", "oldClassLoader", ")", ";", "}", "}", "return", "SerializationUtils", ".", "fromByteArrayFst", "(", "data", ",", "clazz", ",", "classLoader", ")", ";", "}" ]
Deserialize a byte array back to an object, with custom class loader. <p> If the target class implements {@link ISerializationSupport}, this method calls its {@link ISerializationSupport#toBytes()} method; otherwise FST library is used to serialize the object. </p> @param data @param clazz @param classLoader @return @deprecated since 0.9.2 with no replacement, use {@link #fromByteArrayFst(byte[], Class, ClassLoader)} or {@link #fromByteArrayKryo(byte[], Class, ClassLoader)}
[ "Deserialize", "a", "byte", "array", "back", "to", "an", "object", "with", "custom", "class", "loader", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L132-L155
jparsec/jparsec
jparsec/src/main/java/org/jparsec/Terminals.java
Terminals.caseInsensitive
@Deprecated public static Terminals caseInsensitive(String[] ops, String[] keywords) { """ Returns a {@link Terminals} object for lexing and parsing the operators with names specified in {@code ops}, and for lexing and parsing the keywords case insensitively. Parsers for operators and keywords can be obtained through {@link #token}; parsers for identifiers through {@link #identifier}. <p>In detail, keywords and operators are lexed as {@link Tokens.Fragment} with {@link Tag#RESERVED} tag. Words that are not among {@code keywords} are lexed as {@code Fragment} with {@link Tag#IDENTIFIER} tag. <p>A word is defined as an alphanumeric string that starts with {@code [_a - zA - Z]}, with 0 or more {@code [0 - 9_a - zA - Z]} following. @param ops the operator names. @param keywords the keyword names. @return the Terminals instance. @deprecated Use {@code operators(ops) .words(Scanners.IDENTIFIER) .caseInsensitiveKeywords(keywords) .build()} instead. """ return operators(ops).words(Scanners.IDENTIFIER).caseInsensitiveKeywords(asList(keywords)).build(); }
java
@Deprecated public static Terminals caseInsensitive(String[] ops, String[] keywords) { return operators(ops).words(Scanners.IDENTIFIER).caseInsensitiveKeywords(asList(keywords)).build(); }
[ "@", "Deprecated", "public", "static", "Terminals", "caseInsensitive", "(", "String", "[", "]", "ops", ",", "String", "[", "]", "keywords", ")", "{", "return", "operators", "(", "ops", ")", ".", "words", "(", "Scanners", ".", "IDENTIFIER", ")", ".", "caseInsensitiveKeywords", "(", "asList", "(", "keywords", ")", ")", ".", "build", "(", ")", ";", "}" ]
Returns a {@link Terminals} object for lexing and parsing the operators with names specified in {@code ops}, and for lexing and parsing the keywords case insensitively. Parsers for operators and keywords can be obtained through {@link #token}; parsers for identifiers through {@link #identifier}. <p>In detail, keywords and operators are lexed as {@link Tokens.Fragment} with {@link Tag#RESERVED} tag. Words that are not among {@code keywords} are lexed as {@code Fragment} with {@link Tag#IDENTIFIER} tag. <p>A word is defined as an alphanumeric string that starts with {@code [_a - zA - Z]}, with 0 or more {@code [0 - 9_a - zA - Z]} following. @param ops the operator names. @param keywords the keyword names. @return the Terminals instance. @deprecated Use {@code operators(ops) .words(Scanners.IDENTIFIER) .caseInsensitiveKeywords(keywords) .build()} instead.
[ "Returns", "a", "{", "@link", "Terminals", "}", "object", "for", "lexing", "and", "parsing", "the", "operators", "with", "names", "specified", "in", "{", "@code", "ops", "}", "and", "for", "lexing", "and", "parsing", "the", "keywords", "case", "insensitively", ".", "Parsers", "for", "operators", "and", "keywords", "can", "be", "obtained", "through", "{", "@link", "#token", "}", ";", "parsers", "for", "identifiers", "through", "{", "@link", "#identifier", "}", "." ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/Terminals.java#L241-L244
joniles/mpxj
src/main/java/net/sf/mpxj/Duration.java
Duration.convertUnits
public Duration convertUnits(TimeUnit type, ProjectProperties defaults) { """ This method provides an <i>approximate</i> conversion between duration units. It does take into account the project defaults for number of hours in a day and a week, but it does not take account of calendar details. The results obtained from it should therefore be treated with caution. @param type target duration type @param defaults project properties containing default values @return new Duration instance """ return (convertUnits(m_duration, m_units, type, defaults)); }
java
public Duration convertUnits(TimeUnit type, ProjectProperties defaults) { return (convertUnits(m_duration, m_units, type, defaults)); }
[ "public", "Duration", "convertUnits", "(", "TimeUnit", "type", ",", "ProjectProperties", "defaults", ")", "{", "return", "(", "convertUnits", "(", "m_duration", ",", "m_units", ",", "type", ",", "defaults", ")", ")", ";", "}" ]
This method provides an <i>approximate</i> conversion between duration units. It does take into account the project defaults for number of hours in a day and a week, but it does not take account of calendar details. The results obtained from it should therefore be treated with caution. @param type target duration type @param defaults project properties containing default values @return new Duration instance
[ "This", "method", "provides", "an", "<i", ">", "approximate<", "/", "i", ">", "conversion", "between", "duration", "units", ".", "It", "does", "take", "into", "account", "the", "project", "defaults", "for", "number", "of", "hours", "in", "a", "day", "and", "a", "week", "but", "it", "does", "not", "take", "account", "of", "calendar", "details", ".", "The", "results", "obtained", "from", "it", "should", "therefore", "be", "treated", "with", "caution", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Duration.java#L92-L95
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java
SVGPlot.saveAsPDF
public void saveAsPDF(File file) throws IOException, TranscoderException, ClassNotFoundException { """ Transcode file to PDF. @param file Output filename @throws IOException On write errors @throws TranscoderException On input/parsing errors. @throws ClassNotFoundException PDF transcoder not installed """ try { Object t = Class.forName("org.apache.fop.svg.PDFTranscoder").newInstance(); transcode(file, (Transcoder) t); } catch(InstantiationException | IllegalAccessException e) { throw new ClassNotFoundException("Could not instantiate PDF transcoder - is Apache FOP installed?", e); } }
java
public void saveAsPDF(File file) throws IOException, TranscoderException, ClassNotFoundException { try { Object t = Class.forName("org.apache.fop.svg.PDFTranscoder").newInstance(); transcode(file, (Transcoder) t); } catch(InstantiationException | IllegalAccessException e) { throw new ClassNotFoundException("Could not instantiate PDF transcoder - is Apache FOP installed?", e); } }
[ "public", "void", "saveAsPDF", "(", "File", "file", ")", "throws", "IOException", ",", "TranscoderException", ",", "ClassNotFoundException", "{", "try", "{", "Object", "t", "=", "Class", ".", "forName", "(", "\"org.apache.fop.svg.PDFTranscoder\"", ")", ".", "newInstance", "(", ")", ";", "transcode", "(", "file", ",", "(", "Transcoder", ")", "t", ")", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAccessException", "e", ")", "{", "throw", "new", "ClassNotFoundException", "(", "\"Could not instantiate PDF transcoder - is Apache FOP installed?\"", ",", "e", ")", ";", "}", "}" ]
Transcode file to PDF. @param file Output filename @throws IOException On write errors @throws TranscoderException On input/parsing errors. @throws ClassNotFoundException PDF transcoder not installed
[ "Transcode", "file", "to", "PDF", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L461-L469
cdapio/tephra
tephra-hbase-compat-1.1/src/main/java/co/cask/tephra/hbase11/coprocessor/TransactionVisibilityFilter.java
TransactionVisibilityFilter.determineReturnCode
protected ReturnCode determineReturnCode(ReturnCode txFilterCode, ReturnCode subFilterCode) { """ Determines the return code of TransactionVisibilityFilter based on sub-filter's return code. Sub-filter can only exclude cells included by TransactionVisibilityFilter, i.e., sub-filter's INCLUDE will be ignored. This behavior makes sure that sub-filter only sees cell versions valid for the given transaction. If sub-filter needs to see older versions of cell, then this method can be overridden. @param txFilterCode return code from TransactionVisibilityFilter @param subFilterCode return code from sub-filter @return final return code """ // Return the more restrictive of the two filter responses switch (subFilterCode) { case INCLUDE: return txFilterCode; case INCLUDE_AND_NEXT_COL: return ReturnCode.INCLUDE_AND_NEXT_COL; case SKIP: return txFilterCode == ReturnCode.INCLUDE ? ReturnCode.SKIP : ReturnCode.NEXT_COL; default: return subFilterCode; } }
java
protected ReturnCode determineReturnCode(ReturnCode txFilterCode, ReturnCode subFilterCode) { // Return the more restrictive of the two filter responses switch (subFilterCode) { case INCLUDE: return txFilterCode; case INCLUDE_AND_NEXT_COL: return ReturnCode.INCLUDE_AND_NEXT_COL; case SKIP: return txFilterCode == ReturnCode.INCLUDE ? ReturnCode.SKIP : ReturnCode.NEXT_COL; default: return subFilterCode; } }
[ "protected", "ReturnCode", "determineReturnCode", "(", "ReturnCode", "txFilterCode", ",", "ReturnCode", "subFilterCode", ")", "{", "// Return the more restrictive of the two filter responses", "switch", "(", "subFilterCode", ")", "{", "case", "INCLUDE", ":", "return", "txFilterCode", ";", "case", "INCLUDE_AND_NEXT_COL", ":", "return", "ReturnCode", ".", "INCLUDE_AND_NEXT_COL", ";", "case", "SKIP", ":", "return", "txFilterCode", "==", "ReturnCode", ".", "INCLUDE", "?", "ReturnCode", ".", "SKIP", ":", "ReturnCode", ".", "NEXT_COL", ";", "default", ":", "return", "subFilterCode", ";", "}", "}" ]
Determines the return code of TransactionVisibilityFilter based on sub-filter's return code. Sub-filter can only exclude cells included by TransactionVisibilityFilter, i.e., sub-filter's INCLUDE will be ignored. This behavior makes sure that sub-filter only sees cell versions valid for the given transaction. If sub-filter needs to see older versions of cell, then this method can be overridden. @param txFilterCode return code from TransactionVisibilityFilter @param subFilterCode return code from sub-filter @return final return code
[ "Determines", "the", "return", "code", "of", "TransactionVisibilityFilter", "based", "on", "sub", "-", "filter", "s", "return", "code", ".", "Sub", "-", "filter", "can", "only", "exclude", "cells", "included", "by", "TransactionVisibilityFilter", "i", ".", "e", ".", "sub", "-", "filter", "s", "INCLUDE", "will", "be", "ignored", ".", "This", "behavior", "makes", "sure", "that", "sub", "-", "filter", "only", "sees", "cell", "versions", "valid", "for", "the", "given", "transaction", ".", "If", "sub", "-", "filter", "needs", "to", "see", "older", "versions", "of", "cell", "then", "this", "method", "can", "be", "overridden", "." ]
train
https://github.com/cdapio/tephra/blob/082c56c15c6ece15002631ff6f89206a00d8915c/tephra-hbase-compat-1.1/src/main/java/co/cask/tephra/hbase11/coprocessor/TransactionVisibilityFilter.java#L173-L185
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.genClass
public boolean genClass(Env<AttrContext> env, JCClassDecl cdef) { """ Generate code for a class definition. @param env The attribution environment that belongs to the outermost class containing this class definition. We need this for resolving some additional symbols. @param cdef The tree representing the class definition. @return True if code is generated with no errors. """ try { attrEnv = env; ClassSymbol c = cdef.sym; this.toplevel = env.toplevel; this.endPosTable = toplevel.endPositions; c.pool = pool; pool.reset(); /* method normalizeDefs() can add references to external classes into the constant pool */ cdef.defs = normalizeDefs(cdef.defs, c); generateReferencesToPrunedTree(c, pool); Env<GenContext> localEnv = new Env<>(cdef, new GenContext()); localEnv.toplevel = env.toplevel; localEnv.enclClass = cdef; for (List<JCTree> l = cdef.defs; l.nonEmpty(); l = l.tail) { genDef(l.head, localEnv); } if (pool.numEntries() > Pool.MAX_ENTRIES) { log.error(cdef.pos(), "limit.pool"); nerrs++; } if (nerrs != 0) { // if errors, discard code for (List<JCTree> l = cdef.defs; l.nonEmpty(); l = l.tail) { if (l.head.hasTag(METHODDEF)) ((JCMethodDecl) l.head).sym.code = null; } } cdef.defs = List.nil(); // discard trees return nerrs == 0; } finally { // note: this method does NOT support recursion. attrEnv = null; this.env = null; toplevel = null; endPosTable = null; nerrs = 0; } }
java
public boolean genClass(Env<AttrContext> env, JCClassDecl cdef) { try { attrEnv = env; ClassSymbol c = cdef.sym; this.toplevel = env.toplevel; this.endPosTable = toplevel.endPositions; c.pool = pool; pool.reset(); /* method normalizeDefs() can add references to external classes into the constant pool */ cdef.defs = normalizeDefs(cdef.defs, c); generateReferencesToPrunedTree(c, pool); Env<GenContext> localEnv = new Env<>(cdef, new GenContext()); localEnv.toplevel = env.toplevel; localEnv.enclClass = cdef; for (List<JCTree> l = cdef.defs; l.nonEmpty(); l = l.tail) { genDef(l.head, localEnv); } if (pool.numEntries() > Pool.MAX_ENTRIES) { log.error(cdef.pos(), "limit.pool"); nerrs++; } if (nerrs != 0) { // if errors, discard code for (List<JCTree> l = cdef.defs; l.nonEmpty(); l = l.tail) { if (l.head.hasTag(METHODDEF)) ((JCMethodDecl) l.head).sym.code = null; } } cdef.defs = List.nil(); // discard trees return nerrs == 0; } finally { // note: this method does NOT support recursion. attrEnv = null; this.env = null; toplevel = null; endPosTable = null; nerrs = 0; } }
[ "public", "boolean", "genClass", "(", "Env", "<", "AttrContext", ">", "env", ",", "JCClassDecl", "cdef", ")", "{", "try", "{", "attrEnv", "=", "env", ";", "ClassSymbol", "c", "=", "cdef", ".", "sym", ";", "this", ".", "toplevel", "=", "env", ".", "toplevel", ";", "this", ".", "endPosTable", "=", "toplevel", ".", "endPositions", ";", "c", ".", "pool", "=", "pool", ";", "pool", ".", "reset", "(", ")", ";", "/* method normalizeDefs() can add references to external classes into the constant pool\n */", "cdef", ".", "defs", "=", "normalizeDefs", "(", "cdef", ".", "defs", ",", "c", ")", ";", "generateReferencesToPrunedTree", "(", "c", ",", "pool", ")", ";", "Env", "<", "GenContext", ">", "localEnv", "=", "new", "Env", "<>", "(", "cdef", ",", "new", "GenContext", "(", ")", ")", ";", "localEnv", ".", "toplevel", "=", "env", ".", "toplevel", ";", "localEnv", ".", "enclClass", "=", "cdef", ";", "for", "(", "List", "<", "JCTree", ">", "l", "=", "cdef", ".", "defs", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "{", "genDef", "(", "l", ".", "head", ",", "localEnv", ")", ";", "}", "if", "(", "pool", ".", "numEntries", "(", ")", ">", "Pool", ".", "MAX_ENTRIES", ")", "{", "log", ".", "error", "(", "cdef", ".", "pos", "(", ")", ",", "\"limit.pool\"", ")", ";", "nerrs", "++", ";", "}", "if", "(", "nerrs", "!=", "0", ")", "{", "// if errors, discard code", "for", "(", "List", "<", "JCTree", ">", "l", "=", "cdef", ".", "defs", ";", "l", ".", "nonEmpty", "(", ")", ";", "l", "=", "l", ".", "tail", ")", "{", "if", "(", "l", ".", "head", ".", "hasTag", "(", "METHODDEF", ")", ")", "(", "(", "JCMethodDecl", ")", "l", ".", "head", ")", ".", "sym", ".", "code", "=", "null", ";", "}", "}", "cdef", ".", "defs", "=", "List", ".", "nil", "(", ")", ";", "// discard trees", "return", "nerrs", "==", "0", ";", "}", "finally", "{", "// note: this method does NOT support recursion.", "attrEnv", "=", "null", ";", "this", ".", "env", "=", "null", ";", "toplevel", "=", "null", ";", "endPosTable", "=", "null", ";", "nerrs", "=", "0", ";", "}", "}" ]
Generate code for a class definition. @param env The attribution environment that belongs to the outermost class containing this class definition. We need this for resolving some additional symbols. @param cdef The tree representing the class definition. @return True if code is generated with no errors.
[ "Generate", "code", "for", "a", "class", "definition", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L2154-L2194
beanshell/beanshell
src/main/java/bsh/Reflect.java
Reflect.getDeclaredVariable
public static Variable getDeclaredVariable(Class<?> type, String name) { """ /* Get variable from either class static or object instance namespaces """ if (!isGeneratedClass(type)) return null; Variable var = getVariable(type, name); if (null == var && !type.isInterface()) return getVariable(getNewInstance(type), name); return var; }
java
public static Variable getDeclaredVariable(Class<?> type, String name) { if (!isGeneratedClass(type)) return null; Variable var = getVariable(type, name); if (null == var && !type.isInterface()) return getVariable(getNewInstance(type), name); return var; }
[ "public", "static", "Variable", "getDeclaredVariable", "(", "Class", "<", "?", ">", "type", ",", "String", "name", ")", "{", "if", "(", "!", "isGeneratedClass", "(", "type", ")", ")", "return", "null", ";", "Variable", "var", "=", "getVariable", "(", "type", ",", "name", ")", ";", "if", "(", "null", "==", "var", "&&", "!", "type", ".", "isInterface", "(", ")", ")", "return", "getVariable", "(", "getNewInstance", "(", "type", ")", ",", "name", ")", ";", "return", "var", ";", "}" ]
/* Get variable from either class static or object instance namespaces
[ "/", "*", "Get", "variable", "from", "either", "class", "static", "or", "object", "instance", "namespaces" ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Reflect.java#L906-L913
upwork/java-upwork
src/com/Upwork/api/UpworkRestClient.java
UpworkRestClient.genError
private static JSONObject genError(HttpResponse response) throws JSONException { """ Generate error as JSONObject @param code Error code @param message Error message @throws JSONException @return {@link JSONObject} """ String code = response.getFirstHeader("X-Upwork-Error-Code").getValue(); String message = response.getFirstHeader("X-Upwork-Error-Message").getValue(); if (code == null) { code = Integer.toString(response.getStatusLine().getStatusCode()); } if (message == null) { message = response.getStatusLine().toString(); } return new JSONObject("{error: {code: \"" + code + "\", message: \"" + message + "\"}}"); }
java
private static JSONObject genError(HttpResponse response) throws JSONException { String code = response.getFirstHeader("X-Upwork-Error-Code").getValue(); String message = response.getFirstHeader("X-Upwork-Error-Message").getValue(); if (code == null) { code = Integer.toString(response.getStatusLine().getStatusCode()); } if (message == null) { message = response.getStatusLine().toString(); } return new JSONObject("{error: {code: \"" + code + "\", message: \"" + message + "\"}}"); }
[ "private", "static", "JSONObject", "genError", "(", "HttpResponse", "response", ")", "throws", "JSONException", "{", "String", "code", "=", "response", ".", "getFirstHeader", "(", "\"X-Upwork-Error-Code\"", ")", ".", "getValue", "(", ")", ";", "String", "message", "=", "response", ".", "getFirstHeader", "(", "\"X-Upwork-Error-Message\"", ")", ".", "getValue", "(", ")", ";", "if", "(", "code", "==", "null", ")", "{", "code", "=", "Integer", ".", "toString", "(", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ")", ";", "}", "if", "(", "message", "==", "null", ")", "{", "message", "=", "response", ".", "getStatusLine", "(", ")", ".", "toString", "(", ")", ";", "}", "return", "new", "JSONObject", "(", "\"{error: {code: \\\"\"", "+", "code", "+", "\"\\\", message: \\\"\"", "+", "message", "+", "\"\\\"}}\"", ")", ";", "}" ]
Generate error as JSONObject @param code Error code @param message Error message @throws JSONException @return {@link JSONObject}
[ "Generate", "error", "as", "JSONObject" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/UpworkRestClient.java#L254-L267
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java
DBInitializerHelper.getObjectScript
public static String getObjectScript(String objectName, boolean multiDb, String dialect, WorkspaceEntry wsEntry) throws RepositoryConfigurationException, IOException { """ Returns SQL script for create objects such as index, primary of foreign key. """ String scripts = prepareScripts(wsEntry, dialect); String sql = null; for (String query : JDBCUtils.splitWithSQLDelimiter(scripts)) { String q = JDBCUtils.cleanWhitespaces(query); if (q.contains(objectName)) { if (sql != null) { throw new RepositoryConfigurationException("Can't find unique script for object creation. Object name: " + objectName); } sql = q; } } if (sql != null) { return sql; } throw new RepositoryConfigurationException("Script for object creation is not found. Object name: " + objectName); }
java
public static String getObjectScript(String objectName, boolean multiDb, String dialect, WorkspaceEntry wsEntry) throws RepositoryConfigurationException, IOException { String scripts = prepareScripts(wsEntry, dialect); String sql = null; for (String query : JDBCUtils.splitWithSQLDelimiter(scripts)) { String q = JDBCUtils.cleanWhitespaces(query); if (q.contains(objectName)) { if (sql != null) { throw new RepositoryConfigurationException("Can't find unique script for object creation. Object name: " + objectName); } sql = q; } } if (sql != null) { return sql; } throw new RepositoryConfigurationException("Script for object creation is not found. Object name: " + objectName); }
[ "public", "static", "String", "getObjectScript", "(", "String", "objectName", ",", "boolean", "multiDb", ",", "String", "dialect", ",", "WorkspaceEntry", "wsEntry", ")", "throws", "RepositoryConfigurationException", ",", "IOException", "{", "String", "scripts", "=", "prepareScripts", "(", "wsEntry", ",", "dialect", ")", ";", "String", "sql", "=", "null", ";", "for", "(", "String", "query", ":", "JDBCUtils", ".", "splitWithSQLDelimiter", "(", "scripts", ")", ")", "{", "String", "q", "=", "JDBCUtils", ".", "cleanWhitespaces", "(", "query", ")", ";", "if", "(", "q", ".", "contains", "(", "objectName", ")", ")", "{", "if", "(", "sql", "!=", "null", ")", "{", "throw", "new", "RepositoryConfigurationException", "(", "\"Can't find unique script for object creation. Object name: \"", "+", "objectName", ")", ";", "}", "sql", "=", "q", ";", "}", "}", "if", "(", "sql", "!=", "null", ")", "{", "return", "sql", ";", "}", "throw", "new", "RepositoryConfigurationException", "(", "\"Script for object creation is not found. Object name: \"", "+", "objectName", ")", ";", "}" ]
Returns SQL script for create objects such as index, primary of foreign key.
[ "Returns", "SQL", "script", "for", "create", "objects", "such", "as", "index", "primary", "of", "foreign", "key", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java#L303-L330
apache/groovy
src/main/groovy/groovy/lang/MetaClassImpl.java
MetaClassImpl.invokeStaticMissingProperty
protected Object invokeStaticMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter) { """ Hook to deal with the case of MissingProperty for static properties. The method will look attempt to look up "propertyMissing" handlers and invoke them otherwise thrown a MissingPropertyException @param instance The instance @param propertyName The name of the property @param optionalValue The value in the case of a setter @param isGetter True if its a getter @return The value in the case of a getter or a MissingPropertyException """ MetaClass mc = instance instanceof Class ? registry.getMetaClass((Class) instance) : this; if (isGetter) { MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, GETTER_MISSING_ARGS); if (propertyMissing != null) { return propertyMissing.invoke(instance, new Object[]{propertyName}); } } else { MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, SETTER_MISSING_ARGS); if (propertyMissing != null) { return propertyMissing.invoke(instance, new Object[]{propertyName, optionalValue}); } } if (instance instanceof Class) { throw new MissingPropertyException(propertyName, (Class) instance); } throw new MissingPropertyException(propertyName, theClass); }
java
protected Object invokeStaticMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter) { MetaClass mc = instance instanceof Class ? registry.getMetaClass((Class) instance) : this; if (isGetter) { MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, GETTER_MISSING_ARGS); if (propertyMissing != null) { return propertyMissing.invoke(instance, new Object[]{propertyName}); } } else { MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, SETTER_MISSING_ARGS); if (propertyMissing != null) { return propertyMissing.invoke(instance, new Object[]{propertyName, optionalValue}); } } if (instance instanceof Class) { throw new MissingPropertyException(propertyName, (Class) instance); } throw new MissingPropertyException(propertyName, theClass); }
[ "protected", "Object", "invokeStaticMissingProperty", "(", "Object", "instance", ",", "String", "propertyName", ",", "Object", "optionalValue", ",", "boolean", "isGetter", ")", "{", "MetaClass", "mc", "=", "instance", "instanceof", "Class", "?", "registry", ".", "getMetaClass", "(", "(", "Class", ")", "instance", ")", ":", "this", ";", "if", "(", "isGetter", ")", "{", "MetaMethod", "propertyMissing", "=", "mc", ".", "getMetaMethod", "(", "STATIC_PROPERTY_MISSING", ",", "GETTER_MISSING_ARGS", ")", ";", "if", "(", "propertyMissing", "!=", "null", ")", "{", "return", "propertyMissing", ".", "invoke", "(", "instance", ",", "new", "Object", "[", "]", "{", "propertyName", "}", ")", ";", "}", "}", "else", "{", "MetaMethod", "propertyMissing", "=", "mc", ".", "getMetaMethod", "(", "STATIC_PROPERTY_MISSING", ",", "SETTER_MISSING_ARGS", ")", ";", "if", "(", "propertyMissing", "!=", "null", ")", "{", "return", "propertyMissing", ".", "invoke", "(", "instance", ",", "new", "Object", "[", "]", "{", "propertyName", ",", "optionalValue", "}", ")", ";", "}", "}", "if", "(", "instance", "instanceof", "Class", ")", "{", "throw", "new", "MissingPropertyException", "(", "propertyName", ",", "(", "Class", ")", "instance", ")", ";", "}", "throw", "new", "MissingPropertyException", "(", "propertyName", ",", "theClass", ")", ";", "}" ]
Hook to deal with the case of MissingProperty for static properties. The method will look attempt to look up "propertyMissing" handlers and invoke them otherwise thrown a MissingPropertyException @param instance The instance @param propertyName The name of the property @param optionalValue The value in the case of a setter @param isGetter True if its a getter @return The value in the case of a getter or a MissingPropertyException
[ "Hook", "to", "deal", "with", "the", "case", "of", "MissingProperty", "for", "static", "properties", ".", "The", "method", "will", "look", "attempt", "to", "look", "up", "propertyMissing", "handlers", "and", "invoke", "them", "otherwise", "thrown", "a", "MissingPropertyException" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaClassImpl.java#L1009-L1027
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.convert
@Deprecated public static void convert(ImageInputStream srcStream, String formatName, ImageOutputStream destStream) { """ 图像类型转换:GIF=》JPG、GIF=》PNG、PNG=》JPG、PNG=》GIF(X)、BMP=》PNG<br> 此方法并不关闭流 @param srcStream 源图像流 @param formatName 包含格式非正式名称的 String:如JPG、JPEG、GIF等 @param destStream 目标图像输出流 @since 3.0.9 @deprecated 请使用{@link #write(Image, String, ImageOutputStream)} """ write(read(srcStream), formatName, destStream); }
java
@Deprecated public static void convert(ImageInputStream srcStream, String formatName, ImageOutputStream destStream) { write(read(srcStream), formatName, destStream); }
[ "@", "Deprecated", "public", "static", "void", "convert", "(", "ImageInputStream", "srcStream", ",", "String", "formatName", ",", "ImageOutputStream", "destStream", ")", "{", "write", "(", "read", "(", "srcStream", ")", ",", "formatName", ",", "destStream", ")", ";", "}" ]
图像类型转换:GIF=》JPG、GIF=》PNG、PNG=》JPG、PNG=》GIF(X)、BMP=》PNG<br> 此方法并不关闭流 @param srcStream 源图像流 @param formatName 包含格式非正式名称的 String:如JPG、JPEG、GIF等 @param destStream 目标图像输出流 @since 3.0.9 @deprecated 请使用{@link #write(Image, String, ImageOutputStream)}
[ "图像类型转换:GIF", "=", "》JPG、GIF", "=", "》PNG、PNG", "=", "》JPG、PNG", "=", "》GIF", "(", "X", ")", "、BMP", "=", "》PNG<br", ">", "此方法并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L535-L538
elki-project/elki
elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/ClassicMultidimensionalScalingTransform.java
ClassicMultidimensionalScalingTransform.computeSquaredDistanceMatrix
protected static <I> double[][] computeSquaredDistanceMatrix(final List<I> col, PrimitiveDistanceFunction<? super I> dist) { """ Compute the squared distance matrix. @param col Input data @param dist Distance function @return Distance matrix. """ final int size = col.size(); double[][] imat = new double[size][size]; boolean squared = dist.isSquared(); FiniteProgress dprog = LOG.isVerbose() ? new FiniteProgress("Computing distance matrix", (size * (size - 1)) >>> 1, LOG) : null; for(int x = 0; x < size; x++) { final I ox = col.get(x); for(int y = x + 1; y < size; y++) { final I oy = col.get(y); double distance = dist.distance(ox, oy); distance *= squared ? -.5 : (-.5 * distance); imat[x][y] = imat[y][x] = distance; } if(dprog != null) { dprog.setProcessed(dprog.getProcessed() + size - x - 1, LOG); } } LOG.ensureCompleted(dprog); return imat; }
java
protected static <I> double[][] computeSquaredDistanceMatrix(final List<I> col, PrimitiveDistanceFunction<? super I> dist) { final int size = col.size(); double[][] imat = new double[size][size]; boolean squared = dist.isSquared(); FiniteProgress dprog = LOG.isVerbose() ? new FiniteProgress("Computing distance matrix", (size * (size - 1)) >>> 1, LOG) : null; for(int x = 0; x < size; x++) { final I ox = col.get(x); for(int y = x + 1; y < size; y++) { final I oy = col.get(y); double distance = dist.distance(ox, oy); distance *= squared ? -.5 : (-.5 * distance); imat[x][y] = imat[y][x] = distance; } if(dprog != null) { dprog.setProcessed(dprog.getProcessed() + size - x - 1, LOG); } } LOG.ensureCompleted(dprog); return imat; }
[ "protected", "static", "<", "I", ">", "double", "[", "]", "[", "]", "computeSquaredDistanceMatrix", "(", "final", "List", "<", "I", ">", "col", ",", "PrimitiveDistanceFunction", "<", "?", "super", "I", ">", "dist", ")", "{", "final", "int", "size", "=", "col", ".", "size", "(", ")", ";", "double", "[", "]", "[", "]", "imat", "=", "new", "double", "[", "size", "]", "[", "size", "]", ";", "boolean", "squared", "=", "dist", ".", "isSquared", "(", ")", ";", "FiniteProgress", "dprog", "=", "LOG", ".", "isVerbose", "(", ")", "?", "new", "FiniteProgress", "(", "\"Computing distance matrix\"", ",", "(", "size", "*", "(", "size", "-", "1", ")", ")", ">>>", "1", ",", "LOG", ")", ":", "null", ";", "for", "(", "int", "x", "=", "0", ";", "x", "<", "size", ";", "x", "++", ")", "{", "final", "I", "ox", "=", "col", ".", "get", "(", "x", ")", ";", "for", "(", "int", "y", "=", "x", "+", "1", ";", "y", "<", "size", ";", "y", "++", ")", "{", "final", "I", "oy", "=", "col", ".", "get", "(", "y", ")", ";", "double", "distance", "=", "dist", ".", "distance", "(", "ox", ",", "oy", ")", ";", "distance", "*=", "squared", "?", "-", ".5", ":", "(", "-", ".5", "*", "distance", ")", ";", "imat", "[", "x", "]", "[", "y", "]", "=", "imat", "[", "y", "]", "[", "x", "]", "=", "distance", ";", "}", "if", "(", "dprog", "!=", "null", ")", "{", "dprog", ".", "setProcessed", "(", "dprog", ".", "getProcessed", "(", ")", "+", "size", "-", "x", "-", "1", ",", "LOG", ")", ";", "}", "}", "LOG", ".", "ensureCompleted", "(", "dprog", ")", ";", "return", "imat", ";", "}" ]
Compute the squared distance matrix. @param col Input data @param dist Distance function @return Distance matrix.
[ "Compute", "the", "squared", "distance", "matrix", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/ClassicMultidimensionalScalingTransform.java#L158-L177
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.notNegative
@Throws(IllegalNegativeArgumentException.class) public static double notNegative(final double value, @Nullable final String name) { """ Ensures that an double reference passed as a parameter to the calling method is not smaller than {@code 0}. @param value a number @param name name of the number reference (in source code) @return the non-null reference that was validated @throws IllegalNullArgumentException if the given argument {@code reference} is smaller than {@code 0} """ if (value < 0.0) { throw new IllegalNegativeArgumentException(name, value); } return value; }
java
@Throws(IllegalNegativeArgumentException.class) public static double notNegative(final double value, @Nullable final String name) { if (value < 0.0) { throw new IllegalNegativeArgumentException(name, value); } return value; }
[ "@", "Throws", "(", "IllegalNegativeArgumentException", ".", "class", ")", "public", "static", "double", "notNegative", "(", "final", "double", "value", ",", "@", "Nullable", "final", "String", "name", ")", "{", "if", "(", "value", "<", "0.0", ")", "{", "throw", "new", "IllegalNegativeArgumentException", "(", "name", ",", "value", ")", ";", "}", "return", "value", ";", "}" ]
Ensures that an double reference passed as a parameter to the calling method is not smaller than {@code 0}. @param value a number @param name name of the number reference (in source code) @return the non-null reference that was validated @throws IllegalNullArgumentException if the given argument {@code reference} is smaller than {@code 0}
[ "Ensures", "that", "an", "double", "reference", "passed", "as", "a", "parameter", "to", "the", "calling", "method", "is", "not", "smaller", "than", "{", "@code", "0", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L2779-L2785
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureRepository.java
FeatureRepository.updateBadManifestCache
private void updateBadManifestCache(String line) { """ Read the data from the cache: if the file still exists, add it to the list of known bad features. It will be checked for updates alongside the other checks for current-ness in {@link #readFeatureManifests()} @param line line read from the cache file """ String[] parts = FeatureDefinitionUtils.splitPattern.split(line); if (parts.length == 3) { File f = new File(parts[0]); long lastModified = FeatureDefinitionUtils.getLongValue(parts[1], -1); long length = FeatureDefinitionUtils.getLongValue(parts[2], -1); // If the file still exists, add it to our list. We'll check if anything // changed in readFeatureManifests if (f.isFile()) knownBadFeatures.put(f, new BadFeature(lastModified, length)); } }
java
private void updateBadManifestCache(String line) { String[] parts = FeatureDefinitionUtils.splitPattern.split(line); if (parts.length == 3) { File f = new File(parts[0]); long lastModified = FeatureDefinitionUtils.getLongValue(parts[1], -1); long length = FeatureDefinitionUtils.getLongValue(parts[2], -1); // If the file still exists, add it to our list. We'll check if anything // changed in readFeatureManifests if (f.isFile()) knownBadFeatures.put(f, new BadFeature(lastModified, length)); } }
[ "private", "void", "updateBadManifestCache", "(", "String", "line", ")", "{", "String", "[", "]", "parts", "=", "FeatureDefinitionUtils", ".", "splitPattern", ".", "split", "(", "line", ")", ";", "if", "(", "parts", ".", "length", "==", "3", ")", "{", "File", "f", "=", "new", "File", "(", "parts", "[", "0", "]", ")", ";", "long", "lastModified", "=", "FeatureDefinitionUtils", ".", "getLongValue", "(", "parts", "[", "1", "]", ",", "-", "1", ")", ";", "long", "length", "=", "FeatureDefinitionUtils", ".", "getLongValue", "(", "parts", "[", "2", "]", ",", "-", "1", ")", ";", "// If the file still exists, add it to our list. We'll check if anything", "// changed in readFeatureManifests", "if", "(", "f", ".", "isFile", "(", ")", ")", "knownBadFeatures", ".", "put", "(", "f", ",", "new", "BadFeature", "(", "lastModified", ",", "length", ")", ")", ";", "}", "}" ]
Read the data from the cache: if the file still exists, add it to the list of known bad features. It will be checked for updates alongside the other checks for current-ness in {@link #readFeatureManifests()} @param line line read from the cache file
[ "Read", "the", "data", "from", "the", "cache", ":", "if", "the", "file", "still", "exists", "add", "it", "to", "the", "list", "of", "known", "bad", "features", ".", "It", "will", "be", "checked", "for", "updates", "alongside", "the", "other", "checks", "for", "current", "-", "ness", "in", "{", "@link", "#readFeatureManifests", "()", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureRepository.java#L316-L328
aws/aws-sdk-java
aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/model/StorageGatewayError.java
StorageGatewayError.withErrorDetails
public StorageGatewayError withErrorDetails(java.util.Map<String, String> errorDetails) { """ <p> Human-readable text that provides detail about the error that occurred. </p> @param errorDetails Human-readable text that provides detail about the error that occurred. @return Returns a reference to this object so that method calls can be chained together. """ setErrorDetails(errorDetails); return this; }
java
public StorageGatewayError withErrorDetails(java.util.Map<String, String> errorDetails) { setErrorDetails(errorDetails); return this; }
[ "public", "StorageGatewayError", "withErrorDetails", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "errorDetails", ")", "{", "setErrorDetails", "(", "errorDetails", ")", ";", "return", "this", ";", "}" ]
<p> Human-readable text that provides detail about the error that occurred. </p> @param errorDetails Human-readable text that provides detail about the error that occurred. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Human", "-", "readable", "text", "that", "provides", "detail", "about", "the", "error", "that", "occurred", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/model/StorageGatewayError.java#L153-L156
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTransitionExtractor.java
MapTransitionExtractor.getTransitionSingleGroup
private static Transition getTransitionSingleGroup(Collection<String> groups) { """ Get the tile transition with one group only. @param groups The groups (must contain one group). @return The tile transition. """ final Iterator<String> iterator = groups.iterator(); final String group = iterator.next(); return new Transition(TransitionType.CENTER, group, group); }
java
private static Transition getTransitionSingleGroup(Collection<String> groups) { final Iterator<String> iterator = groups.iterator(); final String group = iterator.next(); return new Transition(TransitionType.CENTER, group, group); }
[ "private", "static", "Transition", "getTransitionSingleGroup", "(", "Collection", "<", "String", ">", "groups", ")", "{", "final", "Iterator", "<", "String", ">", "iterator", "=", "groups", ".", "iterator", "(", ")", ";", "final", "String", "group", "=", "iterator", ".", "next", "(", ")", ";", "return", "new", "Transition", "(", "TransitionType", ".", "CENTER", ",", "group", ",", "group", ")", ";", "}" ]
Get the tile transition with one group only. @param groups The groups (must contain one group). @return The tile transition.
[ "Get", "the", "tile", "transition", "with", "one", "group", "only", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTransitionExtractor.java#L42-L48
VoltDB/voltdb
src/frontend/org/voltdb/export/ExportGeneration.java
ExportGeneration.prepareTransferMastership
public void prepareTransferMastership(int partitionId, int hostId) { """ Indicate to all associated {@link ExportDataSource}to PREPARE give up mastership role for the given partition id @param partitionId """ synchronized(m_dataSourcesByPartition) { Map<String, ExportDataSource> partitionDataSourceMap = m_dataSourcesByPartition.get(partitionId); // this case happens when there are no export tables if (partitionDataSourceMap == null) { return; } for (ExportDataSource eds : partitionDataSourceMap.values()) { eds.prepareTransferMastership(hostId); } } }
java
public void prepareTransferMastership(int partitionId, int hostId) { synchronized(m_dataSourcesByPartition) { Map<String, ExportDataSource> partitionDataSourceMap = m_dataSourcesByPartition.get(partitionId); // this case happens when there are no export tables if (partitionDataSourceMap == null) { return; } for (ExportDataSource eds : partitionDataSourceMap.values()) { eds.prepareTransferMastership(hostId); } } }
[ "public", "void", "prepareTransferMastership", "(", "int", "partitionId", ",", "int", "hostId", ")", "{", "synchronized", "(", "m_dataSourcesByPartition", ")", "{", "Map", "<", "String", ",", "ExportDataSource", ">", "partitionDataSourceMap", "=", "m_dataSourcesByPartition", ".", "get", "(", "partitionId", ")", ";", "// this case happens when there are no export tables", "if", "(", "partitionDataSourceMap", "==", "null", ")", "{", "return", ";", "}", "for", "(", "ExportDataSource", "eds", ":", "partitionDataSourceMap", ".", "values", "(", ")", ")", "{", "eds", ".", "prepareTransferMastership", "(", "hostId", ")", ";", "}", "}", "}" ]
Indicate to all associated {@link ExportDataSource}to PREPARE give up mastership role for the given partition id @param partitionId
[ "Indicate", "to", "all", "associated", "{" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportGeneration.java#L1043-L1055
google/error-prone
check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java
ASTHelpers.hasAnnotation
public static boolean hasAnnotation( Symbol sym, Class<? extends Annotation> annotationClass, VisitorState state) { """ Check for the presence of an annotation, considering annotation inheritance. @return true if the symbol is annotated with given type. """ return hasAnnotation(sym, annotationClass.getName(), state); }
java
public static boolean hasAnnotation( Symbol sym, Class<? extends Annotation> annotationClass, VisitorState state) { return hasAnnotation(sym, annotationClass.getName(), state); }
[ "public", "static", "boolean", "hasAnnotation", "(", "Symbol", "sym", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ",", "VisitorState", "state", ")", "{", "return", "hasAnnotation", "(", "sym", ",", "annotationClass", ".", "getName", "(", ")", ",", "state", ")", ";", "}" ]
Check for the presence of an annotation, considering annotation inheritance. @return true if the symbol is annotated with given type.
[ "Check", "for", "the", "presence", "of", "an", "annotation", "considering", "annotation", "inheritance", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L705-L708
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java
StringSupport.writeToOutputStream
public static void writeToOutputStream(String s, OutputStream output, String encoding) throws IOException { """ Writes the contents of a string to an output stream. @param s @param output @param encoding @throws IOException """ BufferedReader reader = new BufferedReader(new StringReader(s)); PrintStream writer; if (encoding != null) { writer = new PrintStream(output, true, encoding); } else { writer = new PrintStream(output, true); } String line; while ((line = reader.readLine()) != null) { writer.println(line); } }
java
public static void writeToOutputStream(String s, OutputStream output, String encoding) throws IOException { BufferedReader reader = new BufferedReader(new StringReader(s)); PrintStream writer; if (encoding != null) { writer = new PrintStream(output, true, encoding); } else { writer = new PrintStream(output, true); } String line; while ((line = reader.readLine()) != null) { writer.println(line); } }
[ "public", "static", "void", "writeToOutputStream", "(", "String", "s", ",", "OutputStream", "output", ",", "String", "encoding", ")", "throws", "IOException", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "StringReader", "(", "s", ")", ")", ";", "PrintStream", "writer", ";", "if", "(", "encoding", "!=", "null", ")", "{", "writer", "=", "new", "PrintStream", "(", "output", ",", "true", ",", "encoding", ")", ";", "}", "else", "{", "writer", "=", "new", "PrintStream", "(", "output", ",", "true", ")", ";", "}", "String", "line", ";", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "writer", ".", "println", "(", "line", ")", ";", "}", "}" ]
Writes the contents of a string to an output stream. @param s @param output @param encoding @throws IOException
[ "Writes", "the", "contents", "of", "a", "string", "to", "an", "output", "stream", "." ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L483-L496
Bedework/bw-util
bw-util-security/src/main/java/org/bedework/util/security/pki/PKITools.java
PKITools.writeFile
private void writeFile(final String fileName, final byte[] bs, final boolean append) throws IOException { """ Write a single string to a file. Used to write keys @param fileName String file to write to @param bs bytes to write @param append true to add the key to the file. @throws IOException """ FileOutputStream fstr = null; try { fstr = new FileOutputStream(fileName, append); fstr.write(bs); // Terminate key with newline fstr.write('\n'); fstr.flush(); } finally { if (fstr != null) { fstr.close(); } } }
java
private void writeFile(final String fileName, final byte[] bs, final boolean append) throws IOException { FileOutputStream fstr = null; try { fstr = new FileOutputStream(fileName, append); fstr.write(bs); // Terminate key with newline fstr.write('\n'); fstr.flush(); } finally { if (fstr != null) { fstr.close(); } } }
[ "private", "void", "writeFile", "(", "final", "String", "fileName", ",", "final", "byte", "[", "]", "bs", ",", "final", "boolean", "append", ")", "throws", "IOException", "{", "FileOutputStream", "fstr", "=", "null", ";", "try", "{", "fstr", "=", "new", "FileOutputStream", "(", "fileName", ",", "append", ")", ";", "fstr", ".", "write", "(", "bs", ")", ";", "// Terminate key with newline", "fstr", ".", "write", "(", "'", "'", ")", ";", "fstr", ".", "flush", "(", ")", ";", "}", "finally", "{", "if", "(", "fstr", "!=", "null", ")", "{", "fstr", ".", "close", "(", ")", ";", "}", "}", "}" ]
Write a single string to a file. Used to write keys @param fileName String file to write to @param bs bytes to write @param append true to add the key to the file. @throws IOException
[ "Write", "a", "single", "string", "to", "a", "file", ".", "Used", "to", "write", "keys" ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-security/src/main/java/org/bedework/util/security/pki/PKITools.java#L433-L451
ehcache/ehcache3
core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java
ServiceUtils.findSingletonAmongst
public static <T> T findSingletonAmongst(Class<T> clazz, Object ... instances) { """ Find the only expected instance of {@code clazz} among the {@code instances}. @param clazz searched class @param instances instances looked at @param <T> type of the searched instance @return the compatible instance or null if none are found @throws IllegalArgumentException if more than one matching instance """ return findSingletonAmongst(clazz, Arrays.asList(instances)); }
java
public static <T> T findSingletonAmongst(Class<T> clazz, Object ... instances) { return findSingletonAmongst(clazz, Arrays.asList(instances)); }
[ "public", "static", "<", "T", ">", "T", "findSingletonAmongst", "(", "Class", "<", "T", ">", "clazz", ",", "Object", "...", "instances", ")", "{", "return", "findSingletonAmongst", "(", "clazz", ",", "Arrays", ".", "asList", "(", "instances", ")", ")", ";", "}" ]
Find the only expected instance of {@code clazz} among the {@code instances}. @param clazz searched class @param instances instances looked at @param <T> type of the searched instance @return the compatible instance or null if none are found @throws IllegalArgumentException if more than one matching instance
[ "Find", "the", "only", "expected", "instance", "of", "{", "@code", "clazz", "}", "among", "the", "{", "@code", "instances", "}", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java#L105-L107
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
HtmlTree.FRAME
public static HtmlTree FRAME(String src, String name, String title) { """ Generates a Frame tag. @param src the url of the document to be shown in the frame @param name specifies the name of the frame @param title the title for the frame @return an HtmlTree object for the SPAN tag """ return FRAME(src, name, title, null); }
java
public static HtmlTree FRAME(String src, String name, String title) { return FRAME(src, name, title, null); }
[ "public", "static", "HtmlTree", "FRAME", "(", "String", "src", ",", "String", "name", ",", "String", "title", ")", "{", "return", "FRAME", "(", "src", ",", "name", ",", "title", ",", "null", ")", ";", "}" ]
Generates a Frame tag. @param src the url of the document to be shown in the frame @param name specifies the name of the frame @param title the title for the frame @return an HtmlTree object for the SPAN tag
[ "Generates", "a", "Frame", "tag", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L357-L359
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.getMessage
protected String getMessage(String key, String defaultMessage, Locale locale) { """ Syntactic sugar for safely resolving a no-args message from message bundle. @param key Message bundle key @param defaultMessage Ready-to-present message to fall back upon. @param locale desired locale @return Resolved interpolated message or defaultMessage. """ try { return messageSource.getMessage(key, new Object[] {}, defaultMessage, locale); } catch (Exception e) { // sadly, messageSource.getMessage can throw e.g. when message is ill formatted. logger.error("Error resolving message with key {}.", key, e); return defaultMessage; } }
java
protected String getMessage(String key, String defaultMessage, Locale locale) { try { return messageSource.getMessage(key, new Object[] {}, defaultMessage, locale); } catch (Exception e) { // sadly, messageSource.getMessage can throw e.g. when message is ill formatted. logger.error("Error resolving message with key {}.", key, e); return defaultMessage; } }
[ "protected", "String", "getMessage", "(", "String", "key", ",", "String", "defaultMessage", ",", "Locale", "locale", ")", "{", "try", "{", "return", "messageSource", ".", "getMessage", "(", "key", ",", "new", "Object", "[", "]", "{", "}", ",", "defaultMessage", ",", "locale", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// sadly, messageSource.getMessage can throw e.g. when message is ill formatted.", "logger", ".", "error", "(", "\"Error resolving message with key {}.\"", ",", "key", ",", "e", ")", ";", "return", "defaultMessage", ";", "}", "}" ]
Syntactic sugar for safely resolving a no-args message from message bundle. @param key Message bundle key @param defaultMessage Ready-to-present message to fall back upon. @param locale desired locale @return Resolved interpolated message or defaultMessage.
[ "Syntactic", "sugar", "for", "safely", "resolving", "a", "no", "-", "args", "message", "from", "message", "bundle", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L1424-L1432
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.eachObject
public static void eachObject(ObjectInputStream ois, Closure closure) throws IOException, ClassNotFoundException { """ Iterates through the given object stream object by object. The ObjectInputStream is closed afterwards. @param ois an ObjectInputStream, closed after the operation @param closure a closure @throws IOException if an IOException occurs. @throws ClassNotFoundException if the class is not found. @since 1.0 """ try { while (true) { try { Object obj = ois.readObject(); // we allow null objects in the object stream closure.call(obj); } catch (EOFException e) { break; } } InputStream temp = ois; ois = null; temp.close(); } finally { closeWithWarning(ois); } }
java
public static void eachObject(ObjectInputStream ois, Closure closure) throws IOException, ClassNotFoundException { try { while (true) { try { Object obj = ois.readObject(); // we allow null objects in the object stream closure.call(obj); } catch (EOFException e) { break; } } InputStream temp = ois; ois = null; temp.close(); } finally { closeWithWarning(ois); } }
[ "public", "static", "void", "eachObject", "(", "ObjectInputStream", "ois", ",", "Closure", "closure", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "try", "{", "while", "(", "true", ")", "{", "try", "{", "Object", "obj", "=", "ois", ".", "readObject", "(", ")", ";", "// we allow null objects in the object stream", "closure", ".", "call", "(", "obj", ")", ";", "}", "catch", "(", "EOFException", "e", ")", "{", "break", ";", "}", "}", "InputStream", "temp", "=", "ois", ";", "ois", "=", "null", ";", "temp", ".", "close", "(", ")", ";", "}", "finally", "{", "closeWithWarning", "(", "ois", ")", ";", "}", "}" ]
Iterates through the given object stream object by object. The ObjectInputStream is closed afterwards. @param ois an ObjectInputStream, closed after the operation @param closure a closure @throws IOException if an IOException occurs. @throws ClassNotFoundException if the class is not found. @since 1.0
[ "Iterates", "through", "the", "given", "object", "stream", "object", "by", "object", ".", "The", "ObjectInputStream", "is", "closed", "afterwards", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L299-L316
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ConceptMention.java
ConceptMention.setResourceEntryList
public void setResourceEntryList(int i, ResourceEntry v) { """ indexed setter for resourceEntryList - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array """ if (ConceptMention_Type.featOkTst && ((ConceptMention_Type)jcasType).casFeat_resourceEntryList == null) jcasType.jcas.throwFeatMissing("resourceEntryList", "de.julielab.jules.types.ConceptMention"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ConceptMention_Type)jcasType).casFeatCode_resourceEntryList), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ConceptMention_Type)jcasType).casFeatCode_resourceEntryList), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setResourceEntryList(int i, ResourceEntry v) { if (ConceptMention_Type.featOkTst && ((ConceptMention_Type)jcasType).casFeat_resourceEntryList == null) jcasType.jcas.throwFeatMissing("resourceEntryList", "de.julielab.jules.types.ConceptMention"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ConceptMention_Type)jcasType).casFeatCode_resourceEntryList), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ConceptMention_Type)jcasType).casFeatCode_resourceEntryList), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setResourceEntryList", "(", "int", "i", ",", "ResourceEntry", "v", ")", "{", "if", "(", "ConceptMention_Type", ".", "featOkTst", "&&", "(", "(", "ConceptMention_Type", ")", "jcasType", ")", ".", "casFeat_resourceEntryList", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"resourceEntryList\"", ",", "\"de.julielab.jules.types.ConceptMention\"", ")", ";", "jcasType", ".", "jcas", ".", "checkArrayBounds", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "ConceptMention_Type", ")", "jcasType", ")", ".", "casFeatCode_resourceEntryList", ")", ",", "i", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setRefArrayValue", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "ConceptMention_Type", ")", "jcasType", ")", ".", "casFeatCode_resourceEntryList", ")", ",", "i", ",", "jcasType", ".", "ll_cas", ".", "ll_getFSRef", "(", "v", ")", ")", ";", "}" ]
indexed setter for resourceEntryList - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "resourceEntryList", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ConceptMention.java#L161-L165
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java
DocumentFactory.newDocument
public static EditableDocument newDocument( Document original ) { """ Create a new editable document that is a copy of the supplied document. @param original the original document @return the editable document; never null """ BasicDocument newDoc = new BasicDocument(); newDoc.putAll(original); return new DocumentEditor(newDoc, DEFAULT_FACTORY); }
java
public static EditableDocument newDocument( Document original ) { BasicDocument newDoc = new BasicDocument(); newDoc.putAll(original); return new DocumentEditor(newDoc, DEFAULT_FACTORY); }
[ "public", "static", "EditableDocument", "newDocument", "(", "Document", "original", ")", "{", "BasicDocument", "newDoc", "=", "new", "BasicDocument", "(", ")", ";", "newDoc", ".", "putAll", "(", "original", ")", ";", "return", "new", "DocumentEditor", "(", "newDoc", ",", "DEFAULT_FACTORY", ")", ";", "}" ]
Create a new editable document that is a copy of the supplied document. @param original the original document @return the editable document; never null
[ "Create", "a", "new", "editable", "document", "that", "is", "a", "copy", "of", "the", "supplied", "document", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java#L44-L48
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java
AmazonS3Client.addParameterIfNotNull
private static void addParameterIfNotNull(Request<?> request, String paramName, String paramValue) { """ Adds the specified parameter to the specified request, if the parameter value is not null. @param request The request to add the parameter to. @param paramName The parameter name. @param paramValue The parameter value. """ if (paramValue != null) { request.addParameter(paramName, paramValue); } }
java
private static void addParameterIfNotNull(Request<?> request, String paramName, String paramValue) { if (paramValue != null) { request.addParameter(paramName, paramValue); } }
[ "private", "static", "void", "addParameterIfNotNull", "(", "Request", "<", "?", ">", "request", ",", "String", "paramName", ",", "String", "paramValue", ")", "{", "if", "(", "paramValue", "!=", "null", ")", "{", "request", ".", "addParameter", "(", "paramName", ",", "paramValue", ")", ";", "}", "}" ]
Adds the specified parameter to the specified request, if the parameter value is not null. @param request The request to add the parameter to. @param paramName The parameter name. @param paramValue The parameter value.
[ "Adds", "the", "specified", "parameter", "to", "the", "specified", "request", "if", "the", "parameter", "value", "is", "not", "null", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L4471-L4475
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java
ComputeNodesImpl.uploadBatchServiceLogsAsync
public Observable<UploadBatchServiceLogsResult> uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions) { """ Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UploadBatchServiceLogsResult object """ return uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration, computeNodeUploadBatchServiceLogsOptions).map(new Func1<ServiceResponseWithHeaders<UploadBatchServiceLogsResult, ComputeNodeUploadBatchServiceLogsHeaders>, UploadBatchServiceLogsResult>() { @Override public UploadBatchServiceLogsResult call(ServiceResponseWithHeaders<UploadBatchServiceLogsResult, ComputeNodeUploadBatchServiceLogsHeaders> response) { return response.body(); } }); }
java
public Observable<UploadBatchServiceLogsResult> uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions) { return uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration, computeNodeUploadBatchServiceLogsOptions).map(new Func1<ServiceResponseWithHeaders<UploadBatchServiceLogsResult, ComputeNodeUploadBatchServiceLogsHeaders>, UploadBatchServiceLogsResult>() { @Override public UploadBatchServiceLogsResult call(ServiceResponseWithHeaders<UploadBatchServiceLogsResult, ComputeNodeUploadBatchServiceLogsHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "UploadBatchServiceLogsResult", ">", "uploadBatchServiceLogsAsync", "(", "String", "poolId", ",", "String", "nodeId", ",", "UploadBatchServiceLogsConfiguration", "uploadBatchServiceLogsConfiguration", ",", "ComputeNodeUploadBatchServiceLogsOptions", "computeNodeUploadBatchServiceLogsOptions", ")", "{", "return", "uploadBatchServiceLogsWithServiceResponseAsync", "(", "poolId", ",", "nodeId", ",", "uploadBatchServiceLogsConfiguration", ",", "computeNodeUploadBatchServiceLogsOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "UploadBatchServiceLogsResult", ",", "ComputeNodeUploadBatchServiceLogsHeaders", ">", ",", "UploadBatchServiceLogsResult", ">", "(", ")", "{", "@", "Override", "public", "UploadBatchServiceLogsResult", "call", "(", "ServiceResponseWithHeaders", "<", "UploadBatchServiceLogsResult", ",", "ComputeNodeUploadBatchServiceLogsHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UploadBatchServiceLogsResult object
[ "Upload", "Azure", "Batch", "service", "log", "files", "from", "the", "specified", "compute", "node", "to", "Azure", "Blob", "Storage", ".", "This", "is", "for", "gathering", "Azure", "Batch", "service", "log", "files", "in", "an", "automated", "fashion", "from", "nodes", "if", "you", "are", "experiencing", "an", "error", "and", "wish", "to", "escalate", "to", "Azure", "support", ".", "The", "Azure", "Batch", "service", "log", "files", "should", "be", "shared", "with", "Azure", "support", "to", "aid", "in", "debugging", "issues", "with", "the", "Batch", "service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L2515-L2522
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java
IndexElasticsearchUpdater.isIndexExist
@Deprecated public static boolean isIndexExist(Client client, String index) { """ Check if an index already exists @param client Elasticsearch client @param index Index name @return true if index already exists """ return client.admin().indices().prepareExists(index).get().isExists(); }
java
@Deprecated public static boolean isIndexExist(Client client, String index) { return client.admin().indices().prepareExists(index).get().isExists(); }
[ "@", "Deprecated", "public", "static", "boolean", "isIndexExist", "(", "Client", "client", ",", "String", "index", ")", "{", "return", "client", ".", "admin", "(", ")", ".", "indices", "(", ")", ".", "prepareExists", "(", "index", ")", ".", "get", "(", ")", ".", "isExists", "(", ")", ";", "}" ]
Check if an index already exists @param client Elasticsearch client @param index Index name @return true if index already exists
[ "Check", "if", "an", "index", "already", "exists" ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java#L172-L175
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByPhoneNumber1
public Iterable<DUser> queryByPhoneNumber1(java.lang.String phoneNumber1) { """ query-by method for field phoneNumber1 @param phoneNumber1 the specified attribute @return an Iterable of DUsers for the specified phoneNumber1 """ return queryByField(null, DUserMapper.Field.PHONENUMBER1.getFieldName(), phoneNumber1); }
java
public Iterable<DUser> queryByPhoneNumber1(java.lang.String phoneNumber1) { return queryByField(null, DUserMapper.Field.PHONENUMBER1.getFieldName(), phoneNumber1); }
[ "public", "Iterable", "<", "DUser", ">", "queryByPhoneNumber1", "(", "java", ".", "lang", ".", "String", "phoneNumber1", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "PHONENUMBER1", ".", "getFieldName", "(", ")", ",", "phoneNumber1", ")", ";", "}" ]
query-by method for field phoneNumber1 @param phoneNumber1 the specified attribute @return an Iterable of DUsers for the specified phoneNumber1
[ "query", "-", "by", "method", "for", "field", "phoneNumber1" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L187-L189
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java
FileHelper.getOutputStream
@Nullable public static FileOutputStream getOutputStream (@Nonnull final File aFile) { """ Get an output stream for writing to a file. @param aFile The file to write to. May not be <code>null</code>. @return <code>null</code> if the file could not be opened """ return getOutputStream (aFile, EAppend.DEFAULT); }
java
@Nullable public static FileOutputStream getOutputStream (@Nonnull final File aFile) { return getOutputStream (aFile, EAppend.DEFAULT); }
[ "@", "Nullable", "public", "static", "FileOutputStream", "getOutputStream", "(", "@", "Nonnull", "final", "File", "aFile", ")", "{", "return", "getOutputStream", "(", "aFile", ",", "EAppend", ".", "DEFAULT", ")", ";", "}" ]
Get an output stream for writing to a file. @param aFile The file to write to. May not be <code>null</code>. @return <code>null</code> if the file could not be opened
[ "Get", "an", "output", "stream", "for", "writing", "to", "a", "file", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java#L348-L352
james-hu/jabb-core
src/main/java/net/sf/jabb/util/prop/PlaceHolderReplacer.java
PlaceHolderReplacer.replaceWithProperties
static public String replaceWithProperties(final String str, final Properties props) { """ If running inside JBoss, it replace any occurrence of ${p} with the System.getProperty(p) value. If there is no such property p defined, then the ${p} reference will remain unchanged. If the property reference is of the form ${p:v} and there is no such property p, then the default value v will be returned. If the property reference is of the form ${p1,p2} or ${p1,p2:v} then the primary and the secondary properties will be tried in turn, before returning either the unchanged input, or the default value. The property ${/} is replaced with System.getProperty("file.separator") value and the property ${:} is replaced with System.getProperty("path.separator"). @param str the input string that substitution will be performed upon. @param props the properties to be used instead of System.getProerty() @return the output string that had been replaced """ String result = null; switch (IMPL_TYPE){ case JBOSS_IMPL: result = StringPropertyReplacer.replaceProperties(str, props); break; default: result = str; } return result; }
java
static public String replaceWithProperties(final String str, final Properties props){ String result = null; switch (IMPL_TYPE){ case JBOSS_IMPL: result = StringPropertyReplacer.replaceProperties(str, props); break; default: result = str; } return result; }
[ "static", "public", "String", "replaceWithProperties", "(", "final", "String", "str", ",", "final", "Properties", "props", ")", "{", "String", "result", "=", "null", ";", "switch", "(", "IMPL_TYPE", ")", "{", "case", "JBOSS_IMPL", ":", "result", "=", "StringPropertyReplacer", ".", "replaceProperties", "(", "str", ",", "props", ")", ";", "break", ";", "default", ":", "result", "=", "str", ";", "}", "return", "result", ";", "}" ]
If running inside JBoss, it replace any occurrence of ${p} with the System.getProperty(p) value. If there is no such property p defined, then the ${p} reference will remain unchanged. If the property reference is of the form ${p:v} and there is no such property p, then the default value v will be returned. If the property reference is of the form ${p1,p2} or ${p1,p2:v} then the primary and the secondary properties will be tried in turn, before returning either the unchanged input, or the default value. The property ${/} is replaced with System.getProperty("file.separator") value and the property ${:} is replaced with System.getProperty("path.separator"). @param str the input string that substitution will be performed upon. @param props the properties to be used instead of System.getProerty() @return the output string that had been replaced
[ "If", "running", "inside", "JBoss", "it", "replace", "any", "occurrence", "of", "$", "{", "p", "}", "with", "the", "System", ".", "getProperty", "(", "p", ")", "value", ".", "If", "there", "is", "no", "such", "property", "p", "defined", "then", "the", "$", "{", "p", "}", "reference", "will", "remain", "unchanged", ".", "If", "the", "property", "reference", "is", "of", "the", "form", "$", "{", "p", ":", "v", "}", "and", "there", "is", "no", "such", "property", "p", "then", "the", "default", "value", "v", "will", "be", "returned", ".", "If", "the", "property", "reference", "is", "of", "the", "form", "$", "{", "p1", "p2", "}", "or", "$", "{", "p1", "p2", ":", "v", "}", "then", "the", "primary", "and", "the", "secondary", "properties", "will", "be", "tried", "in", "turn", "before", "returning", "either", "the", "unchanged", "input", "or", "the", "default", "value", ".", "The", "property", "$", "{", "/", "}", "is", "replaced", "with", "System", ".", "getProperty", "(", "file", ".", "separator", ")", "value", "and", "the", "property", "$", "{", ":", "}", "is", "replaced", "with", "System", ".", "getProperty", "(", "path", ".", "separator", ")", "." ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/prop/PlaceHolderReplacer.java#L75-L85
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/report/XReportBreakScreen.java
XReportBreakScreen.printDataStartForm
public void printDataStartForm(PrintWriter out, int iPrintOptions) { """ Print this field's data in XML format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception. """ Record record = ((ReportBreakScreen)this.getScreenField()).getMainRecord(); String strFile = record.getTableNames(false); if ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN) out.println(Utility.startTag(XMLTags.FOOTING)); else out.println(Utility.startTag(XMLTags.HEADING)); out.println(Utility.startTag(XMLTags.FILE)); out.println(Utility.startTag(strFile)); }
java
public void printDataStartForm(PrintWriter out, int iPrintOptions) { Record record = ((ReportBreakScreen)this.getScreenField()).getMainRecord(); String strFile = record.getTableNames(false); if ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN) out.println(Utility.startTag(XMLTags.FOOTING)); else out.println(Utility.startTag(XMLTags.HEADING)); out.println(Utility.startTag(XMLTags.FILE)); out.println(Utility.startTag(strFile)); }
[ "public", "void", "printDataStartForm", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "Record", "record", "=", "(", "(", "ReportBreakScreen", ")", "this", ".", "getScreenField", "(", ")", ")", ".", "getMainRecord", "(", ")", ";", "String", "strFile", "=", "record", ".", "getTableNames", "(", "false", ")", ";", "if", "(", "(", "iPrintOptions", "&", "HtmlConstants", ".", "FOOTING_SCREEN", ")", "==", "HtmlConstants", ".", "FOOTING_SCREEN", ")", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "FOOTING", ")", ")", ";", "else", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "HEADING", ")", ")", ";", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "FILE", ")", ")", ";", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "strFile", ")", ")", ";", "}" ]
Print this field's data in XML format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception.
[ "Print", "this", "field", "s", "data", "in", "XML", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/report/XReportBreakScreen.java#L93-L103
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java
SQLiteDatabase.rawQuery
public Cursor rawQuery(String sql, String[] selectionArgs) { """ Runs the provided SQL and returns a {@link Cursor} over the result set. @param sql the SQL query. The SQL string must not be ; terminated @param selectionArgs You may include ?s in where clause in the query, which will be replaced by the values from selectionArgs. The values will be bound as Strings. @return A {@link Cursor} object, which is positioned before the first entry. Note that {@link Cursor}s are not synchronized, see the documentation for more details. """ return rawQueryWithFactory(null, sql, selectionArgs, null, null); }
java
public Cursor rawQuery(String sql, String[] selectionArgs) { return rawQueryWithFactory(null, sql, selectionArgs, null, null); }
[ "public", "Cursor", "rawQuery", "(", "String", "sql", ",", "String", "[", "]", "selectionArgs", ")", "{", "return", "rawQueryWithFactory", "(", "null", ",", "sql", ",", "selectionArgs", ",", "null", ",", "null", ")", ";", "}" ]
Runs the provided SQL and returns a {@link Cursor} over the result set. @param sql the SQL query. The SQL string must not be ; terminated @param selectionArgs You may include ?s in where clause in the query, which will be replaced by the values from selectionArgs. The values will be bound as Strings. @return A {@link Cursor} object, which is positioned before the first entry. Note that {@link Cursor}s are not synchronized, see the documentation for more details.
[ "Runs", "the", "provided", "SQL", "and", "returns", "a", "{", "@link", "Cursor", "}", "over", "the", "result", "set", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L1258-L1260
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java
InMemoryLockMapImpl.setWriter
public boolean setWriter(TransactionImpl tx, Object obj) { """ generate a writer lock entry for transaction tx on object obj and write it to the persistent storage. """ checkTimedOutLocks(); Identity oid = new Identity(obj, tx.getBroker()); LockEntry writer = new LockEntry(oid.toString(), tx.getGUID(), System.currentTimeMillis(), LockStrategyFactory.getIsolationLevel(obj), LockEntry.LOCK_WRITE); String oidString = oid.toString(); setWriterInternal(writer, oidString); return true; }
java
public boolean setWriter(TransactionImpl tx, Object obj) { checkTimedOutLocks(); Identity oid = new Identity(obj, tx.getBroker()); LockEntry writer = new LockEntry(oid.toString(), tx.getGUID(), System.currentTimeMillis(), LockStrategyFactory.getIsolationLevel(obj), LockEntry.LOCK_WRITE); String oidString = oid.toString(); setWriterInternal(writer, oidString); return true; }
[ "public", "boolean", "setWriter", "(", "TransactionImpl", "tx", ",", "Object", "obj", ")", "{", "checkTimedOutLocks", "(", ")", ";", "Identity", "oid", "=", "new", "Identity", "(", "obj", ",", "tx", ".", "getBroker", "(", ")", ")", ";", "LockEntry", "writer", "=", "new", "LockEntry", "(", "oid", ".", "toString", "(", ")", ",", "tx", ".", "getGUID", "(", ")", ",", "System", ".", "currentTimeMillis", "(", ")", ",", "LockStrategyFactory", ".", "getIsolationLevel", "(", "obj", ")", ",", "LockEntry", ".", "LOCK_WRITE", ")", ";", "String", "oidString", "=", "oid", ".", "toString", "(", ")", ";", "setWriterInternal", "(", "writer", ",", "oidString", ")", ";", "return", "true", ";", "}" ]
generate a writer lock entry for transaction tx on object obj and write it to the persistent storage.
[ "generate", "a", "writer", "lock", "entry", "for", "transaction", "tx", "on", "object", "obj", "and", "write", "it", "to", "the", "persistent", "storage", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java#L294-L307
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/ServiceRemoveStepHandler.java
ServiceRemoveStepHandler.performRuntime
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { """ If the {@link OperationContext#isResourceServiceRestartAllowed() context allows resource removal}, removes services; otherwise puts the process in reload-required state. The following services are removed: <ul> <li>The service named by the value returned from {@link #serviceName(String, PathAddress)}, if there is one</li> <li>The service names associated with any {@code unavailableCapabilities} passed to the constructor.</li> </ul> {@inheritDoc} """ if (context.isResourceServiceRestartAllowed()) { final PathAddress address = context.getCurrentAddress(); final String name = address.getLastElement().getValue(); ServiceName nonCapabilityServiceName = serviceName(name, address); if (nonCapabilityServiceName != null) { context.removeService(serviceName(name, address)); } Set<RuntimeCapability> capabilitySet = unavailableCapabilities.isEmpty() ? context.getResourceRegistration().getCapabilities() : unavailableCapabilities; for (RuntimeCapability<?> capability : capabilitySet) { if (capability.getCapabilityServiceValueType() != null) { context.removeService(capability.getCapabilityServiceName(address)); } } } else { context.reloadRequired(); } }
java
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { if (context.isResourceServiceRestartAllowed()) { final PathAddress address = context.getCurrentAddress(); final String name = address.getLastElement().getValue(); ServiceName nonCapabilityServiceName = serviceName(name, address); if (nonCapabilityServiceName != null) { context.removeService(serviceName(name, address)); } Set<RuntimeCapability> capabilitySet = unavailableCapabilities.isEmpty() ? context.getResourceRegistration().getCapabilities() : unavailableCapabilities; for (RuntimeCapability<?> capability : capabilitySet) { if (capability.getCapabilityServiceValueType() != null) { context.removeService(capability.getCapabilityServiceName(address)); } } } else { context.reloadRequired(); } }
[ "@", "Override", "protected", "void", "performRuntime", "(", "OperationContext", "context", ",", "ModelNode", "operation", ",", "ModelNode", "model", ")", "{", "if", "(", "context", ".", "isResourceServiceRestartAllowed", "(", ")", ")", "{", "final", "PathAddress", "address", "=", "context", ".", "getCurrentAddress", "(", ")", ";", "final", "String", "name", "=", "address", ".", "getLastElement", "(", ")", ".", "getValue", "(", ")", ";", "ServiceName", "nonCapabilityServiceName", "=", "serviceName", "(", "name", ",", "address", ")", ";", "if", "(", "nonCapabilityServiceName", "!=", "null", ")", "{", "context", ".", "removeService", "(", "serviceName", "(", "name", ",", "address", ")", ")", ";", "}", "Set", "<", "RuntimeCapability", ">", "capabilitySet", "=", "unavailableCapabilities", ".", "isEmpty", "(", ")", "?", "context", ".", "getResourceRegistration", "(", ")", ".", "getCapabilities", "(", ")", ":", "unavailableCapabilities", ";", "for", "(", "RuntimeCapability", "<", "?", ">", "capability", ":", "capabilitySet", ")", "{", "if", "(", "capability", ".", "getCapabilityServiceValueType", "(", ")", "!=", "null", ")", "{", "context", ".", "removeService", "(", "capability", ".", "getCapabilityServiceName", "(", "address", ")", ")", ";", "}", "}", "}", "else", "{", "context", ".", "reloadRequired", "(", ")", ";", "}", "}" ]
If the {@link OperationContext#isResourceServiceRestartAllowed() context allows resource removal}, removes services; otherwise puts the process in reload-required state. The following services are removed: <ul> <li>The service named by the value returned from {@link #serviceName(String, PathAddress)}, if there is one</li> <li>The service names associated with any {@code unavailableCapabilities} passed to the constructor.</li> </ul> {@inheritDoc}
[ "If", "the", "{", "@link", "OperationContext#isResourceServiceRestartAllowed", "()", "context", "allows", "resource", "removal", "}", "removes", "services", ";", "otherwise", "puts", "the", "process", "in", "reload", "-", "required", "state", ".", "The", "following", "services", "are", "removed", ":", "<ul", ">", "<li", ">", "The", "service", "named", "by", "the", "value", "returned", "from", "{", "@link", "#serviceName", "(", "String", "PathAddress", ")", "}", "if", "there", "is", "one<", "/", "li", ">", "<li", ">", "The", "service", "names", "associated", "with", "any", "{", "@code", "unavailableCapabilities", "}", "passed", "to", "the", "constructor", ".", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ServiceRemoveStepHandler.java#L100-L122
Coveros/selenified
src/main/java/com/coveros/selenified/application/WaitFor.java
WaitFor.confirmationEquals
public void confirmationEquals(double seconds, String expectedConfirmationText) { """ Waits up to the provided wait time for a confirmation present on the page has content equal to the expected text. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param expectedConfirmationText the expected text of the confirmation @param seconds the number of seconds to wait """ try { double timeTook = popup(seconds); timeTook = popupEquals(seconds - timeTook, expectedConfirmationText); checkConfirmationEquals(expectedConfirmationText, seconds, timeTook); } catch (TimeoutException e) { checkConfirmationEquals(expectedConfirmationText, seconds, seconds); } }
java
public void confirmationEquals(double seconds, String expectedConfirmationText) { try { double timeTook = popup(seconds); timeTook = popupEquals(seconds - timeTook, expectedConfirmationText); checkConfirmationEquals(expectedConfirmationText, seconds, timeTook); } catch (TimeoutException e) { checkConfirmationEquals(expectedConfirmationText, seconds, seconds); } }
[ "public", "void", "confirmationEquals", "(", "double", "seconds", ",", "String", "expectedConfirmationText", ")", "{", "try", "{", "double", "timeTook", "=", "popup", "(", "seconds", ")", ";", "timeTook", "=", "popupEquals", "(", "seconds", "-", "timeTook", ",", "expectedConfirmationText", ")", ";", "checkConfirmationEquals", "(", "expectedConfirmationText", ",", "seconds", ",", "timeTook", ")", ";", "}", "catch", "(", "TimeoutException", "e", ")", "{", "checkConfirmationEquals", "(", "expectedConfirmationText", ",", "seconds", ",", "seconds", ")", ";", "}", "}" ]
Waits up to the provided wait time for a confirmation present on the page has content equal to the expected text. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param expectedConfirmationText the expected text of the confirmation @param seconds the number of seconds to wait
[ "Waits", "up", "to", "the", "provided", "wait", "time", "for", "a", "confirmation", "present", "on", "the", "page", "has", "content", "equal", "to", "the", "expected", "text", ".", "This", "information", "will", "be", "logged", "and", "recorded", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L560-L568
killbill/killbill
invoice/src/main/java/org/killbill/billing/invoice/tree/SubscriptionItemTree.java
SubscriptionItemTree.mergeProposedItem
public void mergeProposedItem(final InvoiceItem invoiceItem) { """ Merge a new proposed item in the tree. @param invoiceItem new proposed item that should be merged in the existing tree """ Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem); // Check if it was an existing item ignored for tree purposes (e.g. FIXED or $0 RECURRING, both of which aren't repaired) final InvoiceItem existingItem = Iterables.tryFind(existingIgnoredItems, new Predicate<InvoiceItem>() { @Override public boolean apply(final InvoiceItem input) { return input.matches(invoiceItem); } }).orNull(); if (existingItem != null) { return; } switch (invoiceItem.getInvoiceItemType()) { case RECURRING: // merged means we've either matched the proposed to an existing, or triggered a repair final boolean merged = root.addProposedItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD))); if (!merged) { items.add(new Item(invoiceItem, targetInvoiceId, ItemAction.ADD)); } break; case FIXED: remainingIgnoredItems.add(invoiceItem); break; default: Preconditions.checkState(false, "Unexpected proposed item " + invoiceItem); } }
java
public void mergeProposedItem(final InvoiceItem invoiceItem) { Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem); // Check if it was an existing item ignored for tree purposes (e.g. FIXED or $0 RECURRING, both of which aren't repaired) final InvoiceItem existingItem = Iterables.tryFind(existingIgnoredItems, new Predicate<InvoiceItem>() { @Override public boolean apply(final InvoiceItem input) { return input.matches(invoiceItem); } }).orNull(); if (existingItem != null) { return; } switch (invoiceItem.getInvoiceItemType()) { case RECURRING: // merged means we've either matched the proposed to an existing, or triggered a repair final boolean merged = root.addProposedItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD))); if (!merged) { items.add(new Item(invoiceItem, targetInvoiceId, ItemAction.ADD)); } break; case FIXED: remainingIgnoredItems.add(invoiceItem); break; default: Preconditions.checkState(false, "Unexpected proposed item " + invoiceItem); } }
[ "public", "void", "mergeProposedItem", "(", "final", "InvoiceItem", "invoiceItem", ")", "{", "Preconditions", ".", "checkState", "(", "!", "isBuilt", ",", "\"Tree already built, unable to add new invoiceItem=%s\"", ",", "invoiceItem", ")", ";", "// Check if it was an existing item ignored for tree purposes (e.g. FIXED or $0 RECURRING, both of which aren't repaired)", "final", "InvoiceItem", "existingItem", "=", "Iterables", ".", "tryFind", "(", "existingIgnoredItems", ",", "new", "Predicate", "<", "InvoiceItem", ">", "(", ")", "{", "@", "Override", "public", "boolean", "apply", "(", "final", "InvoiceItem", "input", ")", "{", "return", "input", ".", "matches", "(", "invoiceItem", ")", ";", "}", "}", ")", ".", "orNull", "(", ")", ";", "if", "(", "existingItem", "!=", "null", ")", "{", "return", ";", "}", "switch", "(", "invoiceItem", ".", "getInvoiceItemType", "(", ")", ")", "{", "case", "RECURRING", ":", "// merged means we've either matched the proposed to an existing, or triggered a repair", "final", "boolean", "merged", "=", "root", ".", "addProposedItem", "(", "new", "ItemsNodeInterval", "(", "root", ",", "new", "Item", "(", "invoiceItem", ",", "targetInvoiceId", ",", "ItemAction", ".", "ADD", ")", ")", ")", ";", "if", "(", "!", "merged", ")", "{", "items", ".", "add", "(", "new", "Item", "(", "invoiceItem", ",", "targetInvoiceId", ",", "ItemAction", ".", "ADD", ")", ")", ";", "}", "break", ";", "case", "FIXED", ":", "remainingIgnoredItems", ".", "add", "(", "invoiceItem", ")", ";", "break", ";", "default", ":", "Preconditions", ".", "checkState", "(", "false", ",", "\"Unexpected proposed item \"", "+", "invoiceItem", ")", ";", "}", "}" ]
Merge a new proposed item in the tree. @param invoiceItem new proposed item that should be merged in the existing tree
[ "Merge", "a", "new", "proposed", "item", "in", "the", "tree", "." ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/SubscriptionItemTree.java#L173-L203
azkaban/azkaban
az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopSecureHiveWrapper.java
HadoopSecureHiveWrapper.populateHiveConf
private static void populateHiveConf(HiveConf hiveConf, String[] args) { """ Extract hiveconf from command line arguments and populate them into HiveConf An example: -hiveconf 'zipcode=10', -hiveconf hive.root.logger=INFO,console """ if (args == null) { return; } int index = 0; for (; index < args.length; index++) { if ("-hiveconf".equals(args[index])) { String hiveConfParam = stripSingleDoubleQuote(args[++index]); String[] tokens = hiveConfParam.split("="); if (tokens.length == 2) { String name = tokens[0]; String value = tokens[1]; logger.info("Setting: " + name + "=" + value + " to hiveConf"); hiveConf.set(name, value); } else { logger.warn("Invalid hiveconf: " + hiveConfParam); } } } }
java
private static void populateHiveConf(HiveConf hiveConf, String[] args) { if (args == null) { return; } int index = 0; for (; index < args.length; index++) { if ("-hiveconf".equals(args[index])) { String hiveConfParam = stripSingleDoubleQuote(args[++index]); String[] tokens = hiveConfParam.split("="); if (tokens.length == 2) { String name = tokens[0]; String value = tokens[1]; logger.info("Setting: " + name + "=" + value + " to hiveConf"); hiveConf.set(name, value); } else { logger.warn("Invalid hiveconf: " + hiveConfParam); } } } }
[ "private", "static", "void", "populateHiveConf", "(", "HiveConf", "hiveConf", ",", "String", "[", "]", "args", ")", "{", "if", "(", "args", "==", "null", ")", "{", "return", ";", "}", "int", "index", "=", "0", ";", "for", "(", ";", "index", "<", "args", ".", "length", ";", "index", "++", ")", "{", "if", "(", "\"-hiveconf\"", ".", "equals", "(", "args", "[", "index", "]", ")", ")", "{", "String", "hiveConfParam", "=", "stripSingleDoubleQuote", "(", "args", "[", "++", "index", "]", ")", ";", "String", "[", "]", "tokens", "=", "hiveConfParam", ".", "split", "(", "\"=\"", ")", ";", "if", "(", "tokens", ".", "length", "==", "2", ")", "{", "String", "name", "=", "tokens", "[", "0", "]", ";", "String", "value", "=", "tokens", "[", "1", "]", ";", "logger", ".", "info", "(", "\"Setting: \"", "+", "name", "+", "\"=\"", "+", "value", "+", "\" to hiveConf\"", ")", ";", "hiveConf", ".", "set", "(", "name", ",", "value", ")", ";", "}", "else", "{", "logger", ".", "warn", "(", "\"Invalid hiveconf: \"", "+", "hiveConfParam", ")", ";", "}", "}", "}", "}" ]
Extract hiveconf from command line arguments and populate them into HiveConf An example: -hiveconf 'zipcode=10', -hiveconf hive.root.logger=INFO,console
[ "Extract", "hiveconf", "from", "command", "line", "arguments", "and", "populate", "them", "into", "HiveConf" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopSecureHiveWrapper.java#L210-L232
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.min
public static Date min(Date d1, Date d2) { """ Returns the earlier of two dates, handling null values. A non-null Date is always considered to be earlier than a null Date. @param d1 Date instance @param d2 Date instance @return Date earliest date """ Date result; if (d1 == null) { result = d2; } else if (d2 == null) { result = d1; } else { result = (d1.compareTo(d2) < 0) ? d1 : d2; } return result; }
java
public static Date min(Date d1, Date d2) { Date result; if (d1 == null) { result = d2; } else if (d2 == null) { result = d1; } else { result = (d1.compareTo(d2) < 0) ? d1 : d2; } return result; }
[ "public", "static", "Date", "min", "(", "Date", "d1", ",", "Date", "d2", ")", "{", "Date", "result", ";", "if", "(", "d1", "==", "null", ")", "{", "result", "=", "d2", ";", "}", "else", "if", "(", "d2", "==", "null", ")", "{", "result", "=", "d1", ";", "}", "else", "{", "result", "=", "(", "d1", ".", "compareTo", "(", "d2", ")", "<", "0", ")", "?", "d1", ":", "d2", ";", "}", "return", "result", ";", "}" ]
Returns the earlier of two dates, handling null values. A non-null Date is always considered to be earlier than a null Date. @param d1 Date instance @param d2 Date instance @return Date earliest date
[ "Returns", "the", "earlier", "of", "two", "dates", "handling", "null", "values", ".", "A", "non", "-", "null", "Date", "is", "always", "considered", "to", "be", "earlier", "than", "a", "null", "Date", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L191-L208
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DevicesApi.java
DevicesApi.updateDevice
public DeviceEnvelope updateDevice(String deviceId, Device device) throws ApiException { """ Update Device Updates a device @param deviceId deviceId (required) @param device Device to be updated (required) @return DeviceEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<DeviceEnvelope> resp = updateDeviceWithHttpInfo(deviceId, device); return resp.getData(); }
java
public DeviceEnvelope updateDevice(String deviceId, Device device) throws ApiException { ApiResponse<DeviceEnvelope> resp = updateDeviceWithHttpInfo(deviceId, device); return resp.getData(); }
[ "public", "DeviceEnvelope", "updateDevice", "(", "String", "deviceId", ",", "Device", "device", ")", "throws", "ApiException", "{", "ApiResponse", "<", "DeviceEnvelope", ">", "resp", "=", "updateDeviceWithHttpInfo", "(", "deviceId", ",", "device", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Update Device Updates a device @param deviceId deviceId (required) @param device Device to be updated (required) @return DeviceEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Update", "Device", "Updates", "a", "device" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesApi.java#L846-L849
haraldk/TwelveMonkeys
imageio/imageio-hdr/src/main/java/com/twelvemonkeys/imageio/plugins/hdr/RGBE.java
RGBE.rgbe2float
public static void rgbe2float(float[] rgb, byte[] rgbe, int startRGBEOffset) { """ Standard conversion from rgbe to float pixels. Note: Ward uses ldexp(col+0.5,exp-(128+8)). However we wanted pixels in the range [0,1] to map back into the range [0,1]. """ float f; if (rgbe[startRGBEOffset + 3] != 0) { // nonzero pixel f = (float) ldexp(1.0, (rgbe[startRGBEOffset + 3] & 0xFF) - (128 + 8)); rgb[0] = (rgbe[startRGBEOffset + 0] & 0xFF) * f; rgb[1] = (rgbe[startRGBEOffset + 1] & 0xFF) * f; rgb[2] = (rgbe[startRGBEOffset + 2] & 0xFF) * f; } else { rgb[0] = 0; rgb[1] = 0; rgb[2] = 0; } }
java
public static void rgbe2float(float[] rgb, byte[] rgbe, int startRGBEOffset) { float f; if (rgbe[startRGBEOffset + 3] != 0) { // nonzero pixel f = (float) ldexp(1.0, (rgbe[startRGBEOffset + 3] & 0xFF) - (128 + 8)); rgb[0] = (rgbe[startRGBEOffset + 0] & 0xFF) * f; rgb[1] = (rgbe[startRGBEOffset + 1] & 0xFF) * f; rgb[2] = (rgbe[startRGBEOffset + 2] & 0xFF) * f; } else { rgb[0] = 0; rgb[1] = 0; rgb[2] = 0; } }
[ "public", "static", "void", "rgbe2float", "(", "float", "[", "]", "rgb", ",", "byte", "[", "]", "rgbe", ",", "int", "startRGBEOffset", ")", "{", "float", "f", ";", "if", "(", "rgbe", "[", "startRGBEOffset", "+", "3", "]", "!=", "0", ")", "{", "// nonzero pixel", "f", "=", "(", "float", ")", "ldexp", "(", "1.0", ",", "(", "rgbe", "[", "startRGBEOffset", "+", "3", "]", "&", "0xFF", ")", "-", "(", "128", "+", "8", ")", ")", ";", "rgb", "[", "0", "]", "=", "(", "rgbe", "[", "startRGBEOffset", "+", "0", "]", "&", "0xFF", ")", "*", "f", ";", "rgb", "[", "1", "]", "=", "(", "rgbe", "[", "startRGBEOffset", "+", "1", "]", "&", "0xFF", ")", "*", "f", ";", "rgb", "[", "2", "]", "=", "(", "rgbe", "[", "startRGBEOffset", "+", "2", "]", "&", "0xFF", ")", "*", "f", ";", "}", "else", "{", "rgb", "[", "0", "]", "=", "0", ";", "rgb", "[", "1", "]", "=", "0", ";", "rgb", "[", "2", "]", "=", "0", ";", "}", "}" ]
Standard conversion from rgbe to float pixels. Note: Ward uses ldexp(col+0.5,exp-(128+8)). However we wanted pixels in the range [0,1] to map back into the range [0,1].
[ "Standard", "conversion", "from", "rgbe", "to", "float", "pixels", ".", "Note", ":", "Ward", "uses", "ldexp", "(", "col", "+", "0", ".", "5", "exp", "-", "(", "128", "+", "8", "))", ".", "However", "we", "wanted", "pixels", "in", "the", "range", "[", "0", "1", "]", "to", "map", "back", "into", "the", "range", "[", "0", "1", "]", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-hdr/src/main/java/com/twelvemonkeys/imageio/plugins/hdr/RGBE.java#L320-L334
rterp/GMapsFX
GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptRuntime.java
JavascriptRuntime.getFunction
@Override public String getFunction(String variable, String function, Object... args) { """ Gets a function as a String, which then can be passed to the execute() method. @param variable The variable to invoke the function on. @param function The function to invoke @param args Arguments the function requires @return A string which can be passed to the JavaScript environment to invoke the function """ return getFunction(variable + "." + function, args); }
java
@Override public String getFunction(String variable, String function, Object... args) { return getFunction(variable + "." + function, args); }
[ "@", "Override", "public", "String", "getFunction", "(", "String", "variable", ",", "String", "function", ",", "Object", "...", "args", ")", "{", "return", "getFunction", "(", "variable", "+", "\".\"", "+", "function", ",", "args", ")", ";", "}" ]
Gets a function as a String, which then can be passed to the execute() method. @param variable The variable to invoke the function on. @param function The function to invoke @param args Arguments the function requires @return A string which can be passed to the JavaScript environment to invoke the function
[ "Gets", "a", "function", "as", "a", "String", "which", "then", "can", "be", "passed", "to", "the", "execute", "()", "method", "." ]
train
https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptRuntime.java#L109-L112
facebookarchive/swift
swift-service/src/main/java/com/facebook/swift/service/ThriftServerConfig.java
ThriftServerConfig.getOrBuildWorkerExecutor
public ExecutorService getOrBuildWorkerExecutor(Map<String, ExecutorService> boundWorkerExecutors) { """ <p>Builds the {@link java.util.concurrent.ExecutorService} used for running Thrift server methods.</p> <p>The details of the {@link java.util.concurrent.ExecutorService} that gets built can be tweaked by calling any of the following (though only <b>one</b> of these should actually be called):</p> <ul> <li>{@link com.facebook.swift.service.ThriftServerConfig#setWorkerThreads}</li> <li>{@link com.facebook.swift.service.ThriftServerConfig#setWorkerExecutor}</li> <li>{@link com.facebook.swift.service.ThriftServerConfig#setWorkerExecutorKey}</li> </ul> <p>The default behavior if none of the above were called is to synthesize a fixed-size {@link java.util.concurrent.ThreadPoolExecutor} using {@link com.facebook.swift.service.ThriftServerConfig#DEFAULT_WORKER_THREAD_COUNT} threads.</p> """ if (workerExecutorKey.isPresent()) { checkState(!workerExecutor.isPresent(), "Worker executor key should not be set along with a specific worker executor instance"); checkState(!workerThreads.isPresent(), "Worker executor key should not be set along with a number of worker threads"); checkState(!maxQueuedRequests.isPresent(), "When using a custom executor, handling maximum queued requests must be done manually"); String key = workerExecutorKey.get(); checkArgument(boundWorkerExecutors.containsKey(key), "No ExecutorService was bound to key '" + key + "'"); ExecutorService executor = boundWorkerExecutors.get(key); checkNotNull(executor, "WorkerExecutorKey maps to null"); return executor; } else if (workerExecutor.isPresent()) { checkState(!workerThreads.isPresent(), "Worker executor should not be set along with number of worker threads"); checkState(!maxQueuedRequests.isPresent(), "When using a custom executor, handling maximum queued requests must be done manually"); return workerExecutor.get(); } else { return makeDefaultWorkerExecutor(); } }
java
public ExecutorService getOrBuildWorkerExecutor(Map<String, ExecutorService> boundWorkerExecutors) { if (workerExecutorKey.isPresent()) { checkState(!workerExecutor.isPresent(), "Worker executor key should not be set along with a specific worker executor instance"); checkState(!workerThreads.isPresent(), "Worker executor key should not be set along with a number of worker threads"); checkState(!maxQueuedRequests.isPresent(), "When using a custom executor, handling maximum queued requests must be done manually"); String key = workerExecutorKey.get(); checkArgument(boundWorkerExecutors.containsKey(key), "No ExecutorService was bound to key '" + key + "'"); ExecutorService executor = boundWorkerExecutors.get(key); checkNotNull(executor, "WorkerExecutorKey maps to null"); return executor; } else if (workerExecutor.isPresent()) { checkState(!workerThreads.isPresent(), "Worker executor should not be set along with number of worker threads"); checkState(!maxQueuedRequests.isPresent(), "When using a custom executor, handling maximum queued requests must be done manually"); return workerExecutor.get(); } else { return makeDefaultWorkerExecutor(); } }
[ "public", "ExecutorService", "getOrBuildWorkerExecutor", "(", "Map", "<", "String", ",", "ExecutorService", ">", "boundWorkerExecutors", ")", "{", "if", "(", "workerExecutorKey", ".", "isPresent", "(", ")", ")", "{", "checkState", "(", "!", "workerExecutor", ".", "isPresent", "(", ")", ",", "\"Worker executor key should not be set along with a specific worker executor instance\"", ")", ";", "checkState", "(", "!", "workerThreads", ".", "isPresent", "(", ")", ",", "\"Worker executor key should not be set along with a number of worker threads\"", ")", ";", "checkState", "(", "!", "maxQueuedRequests", ".", "isPresent", "(", ")", ",", "\"When using a custom executor, handling maximum queued requests must be done manually\"", ")", ";", "String", "key", "=", "workerExecutorKey", ".", "get", "(", ")", ";", "checkArgument", "(", "boundWorkerExecutors", ".", "containsKey", "(", "key", ")", ",", "\"No ExecutorService was bound to key '\"", "+", "key", "+", "\"'\"", ")", ";", "ExecutorService", "executor", "=", "boundWorkerExecutors", ".", "get", "(", "key", ")", ";", "checkNotNull", "(", "executor", ",", "\"WorkerExecutorKey maps to null\"", ")", ";", "return", "executor", ";", "}", "else", "if", "(", "workerExecutor", ".", "isPresent", "(", ")", ")", "{", "checkState", "(", "!", "workerThreads", ".", "isPresent", "(", ")", ",", "\"Worker executor should not be set along with number of worker threads\"", ")", ";", "checkState", "(", "!", "maxQueuedRequests", ".", "isPresent", "(", ")", ",", "\"When using a custom executor, handling maximum queued requests must be done manually\"", ")", ";", "return", "workerExecutor", ".", "get", "(", ")", ";", "}", "else", "{", "return", "makeDefaultWorkerExecutor", "(", ")", ";", "}", "}" ]
<p>Builds the {@link java.util.concurrent.ExecutorService} used for running Thrift server methods.</p> <p>The details of the {@link java.util.concurrent.ExecutorService} that gets built can be tweaked by calling any of the following (though only <b>one</b> of these should actually be called):</p> <ul> <li>{@link com.facebook.swift.service.ThriftServerConfig#setWorkerThreads}</li> <li>{@link com.facebook.swift.service.ThriftServerConfig#setWorkerExecutor}</li> <li>{@link com.facebook.swift.service.ThriftServerConfig#setWorkerExecutorKey}</li> </ul> <p>The default behavior if none of the above were called is to synthesize a fixed-size {@link java.util.concurrent.ThreadPoolExecutor} using {@link com.facebook.swift.service.ThriftServerConfig#DEFAULT_WORKER_THREAD_COUNT} threads.</p>
[ "<p", ">", "Builds", "the", "{", "@link", "java", ".", "util", ".", "concurrent", ".", "ExecutorService", "}", "used", "for", "running", "Thrift", "server", "methods", ".", "<", "/", "p", ">" ]
train
https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-service/src/main/java/com/facebook/swift/service/ThriftServerConfig.java#L374-L402
census-instrumentation/opencensus-java
contrib/resource_util/src/main/java/io/opencensus/contrib/resource/util/K8sResource.java
K8sResource.create
public static Resource create(String clusterName, String namespace, String podName) { """ Returns a {@link Resource} that describes Kubernetes deployment service. @param clusterName the k8s cluster name. @param namespace the k8s namespace. @param podName the k8s pod name. @return a {@link Resource} that describes a k8s container. @since 0.20 """ Map<String, String> labels = new LinkedHashMap<String, String>(); labels.put(CLUSTER_NAME_KEY, checkNotNull(clusterName, "clusterName")); labels.put(NAMESPACE_NAME_KEY, checkNotNull(namespace, "namespace")); labels.put(POD_NAME_KEY, checkNotNull(podName, "podName")); return Resource.create(TYPE, labels); }
java
public static Resource create(String clusterName, String namespace, String podName) { Map<String, String> labels = new LinkedHashMap<String, String>(); labels.put(CLUSTER_NAME_KEY, checkNotNull(clusterName, "clusterName")); labels.put(NAMESPACE_NAME_KEY, checkNotNull(namespace, "namespace")); labels.put(POD_NAME_KEY, checkNotNull(podName, "podName")); return Resource.create(TYPE, labels); }
[ "public", "static", "Resource", "create", "(", "String", "clusterName", ",", "String", "namespace", ",", "String", "podName", ")", "{", "Map", "<", "String", ",", "String", ">", "labels", "=", "new", "LinkedHashMap", "<", "String", ",", "String", ">", "(", ")", ";", "labels", ".", "put", "(", "CLUSTER_NAME_KEY", ",", "checkNotNull", "(", "clusterName", ",", "\"clusterName\"", ")", ")", ";", "labels", ".", "put", "(", "NAMESPACE_NAME_KEY", ",", "checkNotNull", "(", "namespace", ",", "\"namespace\"", ")", ")", ";", "labels", ".", "put", "(", "POD_NAME_KEY", ",", "checkNotNull", "(", "podName", ",", "\"podName\"", ")", ")", ";", "return", "Resource", ".", "create", "(", "TYPE", ",", "labels", ")", ";", "}" ]
Returns a {@link Resource} that describes Kubernetes deployment service. @param clusterName the k8s cluster name. @param namespace the k8s namespace. @param podName the k8s pod name. @return a {@link Resource} that describes a k8s container. @since 0.20
[ "Returns", "a", "{", "@link", "Resource", "}", "that", "describes", "Kubernetes", "deployment", "service", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/resource_util/src/main/java/io/opencensus/contrib/resource/util/K8sResource.java#L69-L75
stapler/stapler
core/src/main/java/org/kohsuke/stapler/HttpResponses.java
HttpResponses.staticResource
public static HttpResponse staticResource(final URL resource, final long expiration) { """ Serves a static resource specified by the URL. @param resource The static resource to be served. @param expiration The number of milliseconds until the resource will "expire". Until it expires the browser will be allowed to cache it and serve it without checking back with the server. After it expires, the client will send conditional GET to check if the resource is actually modified or not. If 0, it will immediately expire. """ return new HttpResponse() { public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { rsp.serveFile(req,resource,expiration); } }; }
java
public static HttpResponse staticResource(final URL resource, final long expiration) { return new HttpResponse() { public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { rsp.serveFile(req,resource,expiration); } }; }
[ "public", "static", "HttpResponse", "staticResource", "(", "final", "URL", "resource", ",", "final", "long", "expiration", ")", "{", "return", "new", "HttpResponse", "(", ")", "{", "public", "void", "generateResponse", "(", "StaplerRequest", "req", ",", "StaplerResponse", "rsp", ",", "Object", "node", ")", "throws", "IOException", ",", "ServletException", "{", "rsp", ".", "serveFile", "(", "req", ",", "resource", ",", "expiration", ")", ";", "}", "}", ";", "}" ]
Serves a static resource specified by the URL. @param resource The static resource to be served. @param expiration The number of milliseconds until the resource will "expire". Until it expires the browser will be allowed to cache it and serve it without checking back with the server. After it expires, the client will send conditional GET to check if the resource is actually modified or not. If 0, it will immediately expire.
[ "Serves", "a", "static", "resource", "specified", "by", "the", "URL", "." ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/HttpResponses.java#L197-L203
graphql-java/graphql-java
src/main/java/graphql/language/NodeTraverser.java
NodeTraverser.depthFirst
public Object depthFirst(NodeVisitor nodeVisitor, Collection<? extends Node> roots) { """ depthFirst traversal with a enter/leave phase. @param nodeVisitor the visitor of the nodes @param roots the root nodes @return the accumulation result of this traversal """ TraverserVisitor<Node> nodeTraverserVisitor = new TraverserVisitor<Node>() { @Override public TraversalControl enter(TraverserContext<Node> context) { context.setVar(LeaveOrEnter.class, LeaveOrEnter.ENTER); return context.thisNode().accept(context, nodeVisitor); } @Override public TraversalControl leave(TraverserContext<Node> context) { context.setVar(LeaveOrEnter.class, LeaveOrEnter.LEAVE); return context.thisNode().accept(context, nodeVisitor); } }; return doTraverse(roots, nodeTraverserVisitor); }
java
public Object depthFirst(NodeVisitor nodeVisitor, Collection<? extends Node> roots) { TraverserVisitor<Node> nodeTraverserVisitor = new TraverserVisitor<Node>() { @Override public TraversalControl enter(TraverserContext<Node> context) { context.setVar(LeaveOrEnter.class, LeaveOrEnter.ENTER); return context.thisNode().accept(context, nodeVisitor); } @Override public TraversalControl leave(TraverserContext<Node> context) { context.setVar(LeaveOrEnter.class, LeaveOrEnter.LEAVE); return context.thisNode().accept(context, nodeVisitor); } }; return doTraverse(roots, nodeTraverserVisitor); }
[ "public", "Object", "depthFirst", "(", "NodeVisitor", "nodeVisitor", ",", "Collection", "<", "?", "extends", "Node", ">", "roots", ")", "{", "TraverserVisitor", "<", "Node", ">", "nodeTraverserVisitor", "=", "new", "TraverserVisitor", "<", "Node", ">", "(", ")", "{", "@", "Override", "public", "TraversalControl", "enter", "(", "TraverserContext", "<", "Node", ">", "context", ")", "{", "context", ".", "setVar", "(", "LeaveOrEnter", ".", "class", ",", "LeaveOrEnter", ".", "ENTER", ")", ";", "return", "context", ".", "thisNode", "(", ")", ".", "accept", "(", "context", ",", "nodeVisitor", ")", ";", "}", "@", "Override", "public", "TraversalControl", "leave", "(", "TraverserContext", "<", "Node", ">", "context", ")", "{", "context", ".", "setVar", "(", "LeaveOrEnter", ".", "class", ",", "LeaveOrEnter", ".", "LEAVE", ")", ";", "return", "context", ".", "thisNode", "(", ")", ".", "accept", "(", "context", ",", "nodeVisitor", ")", ";", "}", "}", ";", "return", "doTraverse", "(", "roots", ",", "nodeTraverserVisitor", ")", ";", "}" ]
depthFirst traversal with a enter/leave phase. @param nodeVisitor the visitor of the nodes @param roots the root nodes @return the accumulation result of this traversal
[ "depthFirst", "traversal", "with", "a", "enter", "/", "leave", "phase", "." ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/language/NodeTraverser.java#L64-L80
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java
ObjectPropertiesController.loadObject
public void loadObject(Object object, Set<String> excludedMethods) { """ Populate the model with the object's properties. @param object object whose properties we're displaying @param excludedMethods method names to exclude """ m_model.setTableModel(createTableModel(object, excludedMethods)); }
java
public void loadObject(Object object, Set<String> excludedMethods) { m_model.setTableModel(createTableModel(object, excludedMethods)); }
[ "public", "void", "loadObject", "(", "Object", "object", ",", "Set", "<", "String", ">", "excludedMethods", ")", "{", "m_model", ".", "setTableModel", "(", "createTableModel", "(", "object", ",", "excludedMethods", ")", ")", ";", "}" ]
Populate the model with the object's properties. @param object object whose properties we're displaying @param excludedMethods method names to exclude
[ "Populate", "the", "model", "with", "the", "object", "s", "properties", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java#L62-L65
elki-project/elki
addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/AbstractXTreeNode.java
AbstractXTreeNode.integrityCheckParameters
@Override protected void integrityCheckParameters(N parent, int index) { """ Tests, if the parameters of the entry representing this node, are correctly set. Subclasses may need to overwrite this method. @param parent the parent holding the entry representing this node @param index the index of the entry in the parents child array """ // test if mbr is correctly set SpatialEntry entry = parent.getEntry(index); HyperBoundingBox mbr = computeMBR(); if(/*entry.getMBR() == null && */ mbr == null) { return; } if(!SpatialUtil.equals(entry, mbr)) { String soll = mbr.toString(); String ist = (new HyperBoundingBox(entry)).toString(); throw new RuntimeException("Wrong MBR in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist); } if(isSuperNode() && isLeaf()) { throw new RuntimeException("Node " + toString() + " is a supernode and a leaf"); } if(isSuperNode() && !parent.isSuperNode() && parent.getCapacity() >= getCapacity()) { throw new RuntimeException("Supernode " + toString() + " has capacity " + getCapacity() + "; its non-super parent node has capacity " + parent.getCapacity()); } }
java
@Override protected void integrityCheckParameters(N parent, int index) { // test if mbr is correctly set SpatialEntry entry = parent.getEntry(index); HyperBoundingBox mbr = computeMBR(); if(/*entry.getMBR() == null && */ mbr == null) { return; } if(!SpatialUtil.equals(entry, mbr)) { String soll = mbr.toString(); String ist = (new HyperBoundingBox(entry)).toString(); throw new RuntimeException("Wrong MBR in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist); } if(isSuperNode() && isLeaf()) { throw new RuntimeException("Node " + toString() + " is a supernode and a leaf"); } if(isSuperNode() && !parent.isSuperNode() && parent.getCapacity() >= getCapacity()) { throw new RuntimeException("Supernode " + toString() + " has capacity " + getCapacity() + "; its non-super parent node has capacity " + parent.getCapacity()); } }
[ "@", "Override", "protected", "void", "integrityCheckParameters", "(", "N", "parent", ",", "int", "index", ")", "{", "// test if mbr is correctly set", "SpatialEntry", "entry", "=", "parent", ".", "getEntry", "(", "index", ")", ";", "HyperBoundingBox", "mbr", "=", "computeMBR", "(", ")", ";", "if", "(", "/*entry.getMBR() == null && */", "mbr", "==", "null", ")", "{", "return", ";", "}", "if", "(", "!", "SpatialUtil", ".", "equals", "(", "entry", ",", "mbr", ")", ")", "{", "String", "soll", "=", "mbr", ".", "toString", "(", ")", ";", "String", "ist", "=", "(", "new", "HyperBoundingBox", "(", "entry", ")", ")", ".", "toString", "(", ")", ";", "throw", "new", "RuntimeException", "(", "\"Wrong MBR in node \"", "+", "parent", ".", "getPageID", "(", ")", "+", "\" at index \"", "+", "index", "+", "\" (child \"", "+", "entry", "+", "\")\"", "+", "\"\\nsoll: \"", "+", "soll", "+", "\",\\n ist: \"", "+", "ist", ")", ";", "}", "if", "(", "isSuperNode", "(", ")", "&&", "isLeaf", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Node \"", "+", "toString", "(", ")", "+", "\" is a supernode and a leaf\"", ")", ";", "}", "if", "(", "isSuperNode", "(", ")", "&&", "!", "parent", ".", "isSuperNode", "(", ")", "&&", "parent", ".", "getCapacity", "(", ")", ">=", "getCapacity", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Supernode \"", "+", "toString", "(", ")", "+", "\" has capacity \"", "+", "getCapacity", "(", ")", "+", "\"; its non-super parent node has capacity \"", "+", "parent", ".", "getCapacity", "(", ")", ")", ";", "}", "}" ]
Tests, if the parameters of the entry representing this node, are correctly set. Subclasses may need to overwrite this method. @param parent the parent holding the entry representing this node @param index the index of the entry in the parents child array
[ "Tests", "if", "the", "parameters", "of", "the", "entry", "representing", "this", "node", "are", "correctly", "set", ".", "Subclasses", "may", "need", "to", "overwrite", "this", "method", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/AbstractXTreeNode.java#L282-L302
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisMenuController.java
MolgenisMenuController.forwardMenuDefaultPlugin
@SuppressWarnings("squid:S3752") // multiple methods required @RequestMapping( method = { """ Forwards to the first menu item in the specified menu. Forwards to the void controller if the user has no permissions to view anything in that menu, i.e. the menu is empty. @param menuId ID of the menu or plugin """RequestMethod.GET, RequestMethod.POST}, value = "/{menuId}") public String forwardMenuDefaultPlugin(@Valid @NotNull @PathVariable String menuId, Model model) { Menu filteredMenu = menuReaderService .getMenu() .flatMap(menu -> menu.findMenu(menuId)) .orElseThrow( () -> new RuntimeException("menu with id [" + menuId + "] does not exist")); model.addAttribute(KEY_MENU_ID, menuId); String pluginId = filteredMenu.firstItem().map(MenuItem::getId).orElse(VoidPluginController.ID); String contextUri = URI + '/' + menuId + '/' + pluginId; addModelAttributes(model, contextUri); return getForwardPluginUri(pluginId); }
java
@SuppressWarnings("squid:S3752") // multiple methods required @RequestMapping( method = {RequestMethod.GET, RequestMethod.POST}, value = "/{menuId}") public String forwardMenuDefaultPlugin(@Valid @NotNull @PathVariable String menuId, Model model) { Menu filteredMenu = menuReaderService .getMenu() .flatMap(menu -> menu.findMenu(menuId)) .orElseThrow( () -> new RuntimeException("menu with id [" + menuId + "] does not exist")); model.addAttribute(KEY_MENU_ID, menuId); String pluginId = filteredMenu.firstItem().map(MenuItem::getId).orElse(VoidPluginController.ID); String contextUri = URI + '/' + menuId + '/' + pluginId; addModelAttributes(model, contextUri); return getForwardPluginUri(pluginId); }
[ "@", "SuppressWarnings", "(", "\"squid:S3752\"", ")", "// multiple methods required", "@", "RequestMapping", "(", "method", "=", "{", "RequestMethod", ".", "GET", ",", "RequestMethod", ".", "POST", "}", ",", "value", "=", "\"/{menuId}\"", ")", "public", "String", "forwardMenuDefaultPlugin", "(", "@", "Valid", "@", "NotNull", "@", "PathVariable", "String", "menuId", ",", "Model", "model", ")", "{", "Menu", "filteredMenu", "=", "menuReaderService", ".", "getMenu", "(", ")", ".", "flatMap", "(", "menu", "->", "menu", ".", "findMenu", "(", "menuId", ")", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "RuntimeException", "(", "\"menu with id [\"", "+", "menuId", "+", "\"] does not exist\"", ")", ")", ";", "model", ".", "addAttribute", "(", "KEY_MENU_ID", ",", "menuId", ")", ";", "String", "pluginId", "=", "filteredMenu", ".", "firstItem", "(", ")", ".", "map", "(", "MenuItem", "::", "getId", ")", ".", "orElse", "(", "VoidPluginController", ".", "ID", ")", ";", "String", "contextUri", "=", "URI", "+", "'", "'", "+", "menuId", "+", "'", "'", "+", "pluginId", ";", "addModelAttributes", "(", "model", ",", "contextUri", ")", ";", "return", "getForwardPluginUri", "(", "pluginId", ")", ";", "}" ]
Forwards to the first menu item in the specified menu. Forwards to the void controller if the user has no permissions to view anything in that menu, i.e. the menu is empty. @param menuId ID of the menu or plugin
[ "Forwards", "to", "the", "first", "menu", "item", "in", "the", "specified", "menu", ".", "Forwards", "to", "the", "void", "controller", "if", "the", "user", "has", "no", "permissions", "to", "view", "anything", "in", "that", "menu", "i", ".", "e", ".", "the", "menu", "is", "empty", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisMenuController.java#L120-L138
mangstadt/biweekly
src/main/java/biweekly/io/ParseContext.java
ParseContext.addTimezonedDate
public void addTimezonedDate(String tzid, ICalProperty property, ICalDate date) { """ Keeps track of a date-time property value that uses a timezone so it can be parsed later. Timezones cannot be handled until the entire iCalendar object has been parsed. @param tzid the timezone ID (TZID parameter) @param property the property @param date the date object that was assigned to the property object """ timezonedDates.put(tzid, new TimezonedDate(date, property)); }
java
public void addTimezonedDate(String tzid, ICalProperty property, ICalDate date) { timezonedDates.put(tzid, new TimezonedDate(date, property)); }
[ "public", "void", "addTimezonedDate", "(", "String", "tzid", ",", "ICalProperty", "property", ",", "ICalDate", "date", ")", "{", "timezonedDates", ".", "put", "(", "tzid", ",", "new", "TimezonedDate", "(", "date", ",", "property", ")", ")", ";", "}" ]
Keeps track of a date-time property value that uses a timezone so it can be parsed later. Timezones cannot be handled until the entire iCalendar object has been parsed. @param tzid the timezone ID (TZID parameter) @param property the property @param date the date object that was assigned to the property object
[ "Keeps", "track", "of", "a", "date", "-", "time", "property", "value", "that", "uses", "a", "timezone", "so", "it", "can", "be", "parsed", "later", ".", "Timezones", "cannot", "be", "handled", "until", "the", "entire", "iCalendar", "object", "has", "been", "parsed", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/ParseContext.java#L133-L135
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java
EventServiceImpl.registerListenerInternal
private EventRegistration registerListenerInternal(String serviceName, String topic, EventFilter filter, Object listener, boolean localOnly) { """ Registers the listener for events matching the service name, topic and filter. If {@code localOnly} is {@code true}, it will register only for events published on this node, otherwise, the registration is sent to other nodes and the listener will listen for events on all cluster members. @param serviceName the service name for which we are registering @param topic the event topic for which we are registering @param filter the filter for the listened events @param listener the event listener @param localOnly whether to register on local events or on events on all cluster members @return the event registration @throws IllegalArgumentException if the listener or filter is null """ if (listener == null) { throw new IllegalArgumentException("Listener required!"); } if (filter == null) { throw new IllegalArgumentException("EventFilter required!"); } EventServiceSegment segment = getSegment(serviceName, true); String id = UuidUtil.newUnsecureUuidString(); Registration reg = new Registration(id, serviceName, topic, filter, nodeEngine.getThisAddress(), listener, localOnly); if (!segment.addRegistration(topic, reg)) { return null; } if (!localOnly) { Supplier<Operation> supplier = new RegistrationOperationSupplier(reg, nodeEngine.getClusterService()); invokeOnAllMembers(supplier); } return reg; }
java
private EventRegistration registerListenerInternal(String serviceName, String topic, EventFilter filter, Object listener, boolean localOnly) { if (listener == null) { throw new IllegalArgumentException("Listener required!"); } if (filter == null) { throw new IllegalArgumentException("EventFilter required!"); } EventServiceSegment segment = getSegment(serviceName, true); String id = UuidUtil.newUnsecureUuidString(); Registration reg = new Registration(id, serviceName, topic, filter, nodeEngine.getThisAddress(), listener, localOnly); if (!segment.addRegistration(topic, reg)) { return null; } if (!localOnly) { Supplier<Operation> supplier = new RegistrationOperationSupplier(reg, nodeEngine.getClusterService()); invokeOnAllMembers(supplier); } return reg; }
[ "private", "EventRegistration", "registerListenerInternal", "(", "String", "serviceName", ",", "String", "topic", ",", "EventFilter", "filter", ",", "Object", "listener", ",", "boolean", "localOnly", ")", "{", "if", "(", "listener", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Listener required!\"", ")", ";", "}", "if", "(", "filter", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"EventFilter required!\"", ")", ";", "}", "EventServiceSegment", "segment", "=", "getSegment", "(", "serviceName", ",", "true", ")", ";", "String", "id", "=", "UuidUtil", ".", "newUnsecureUuidString", "(", ")", ";", "Registration", "reg", "=", "new", "Registration", "(", "id", ",", "serviceName", ",", "topic", ",", "filter", ",", "nodeEngine", ".", "getThisAddress", "(", ")", ",", "listener", ",", "localOnly", ")", ";", "if", "(", "!", "segment", ".", "addRegistration", "(", "topic", ",", "reg", ")", ")", "{", "return", "null", ";", "}", "if", "(", "!", "localOnly", ")", "{", "Supplier", "<", "Operation", ">", "supplier", "=", "new", "RegistrationOperationSupplier", "(", "reg", ",", "nodeEngine", ".", "getClusterService", "(", ")", ")", ";", "invokeOnAllMembers", "(", "supplier", ")", ";", "}", "return", "reg", ";", "}" ]
Registers the listener for events matching the service name, topic and filter. If {@code localOnly} is {@code true}, it will register only for events published on this node, otherwise, the registration is sent to other nodes and the listener will listen for events on all cluster members. @param serviceName the service name for which we are registering @param topic the event topic for which we are registering @param filter the filter for the listened events @param listener the event listener @param localOnly whether to register on local events or on events on all cluster members @return the event registration @throws IllegalArgumentException if the listener or filter is null
[ "Registers", "the", "listener", "for", "events", "matching", "the", "service", "name", "topic", "and", "filter", ".", "If", "{", "@code", "localOnly", "}", "is", "{", "@code", "true", "}", "it", "will", "register", "only", "for", "events", "published", "on", "this", "node", "otherwise", "the", "registration", "is", "sent", "to", "other", "nodes", "and", "the", "listener", "will", "listen", "for", "events", "on", "all", "cluster", "members", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java#L276-L296
kiegroup/jbpm
jbpm-human-task/jbpm-human-task-audit/src/main/java/org/jbpm/services/task/audit/TaskAuditLoggerFactory.java
TaskAuditLoggerFactory.newJMSInstance
public static AsyncTaskLifeCycleEventProducer newJMSInstance(boolean transacted, ConnectionFactory connFactory, Queue queue) { """ Creates new instance of JMS task audit logger based on given connection factory and queue. @param transacted determines if JMS session is transacted or not @param connFactory connection factory instance @param queue JMS queue instance @return new instance of JMS task audit logger """ AsyncTaskLifeCycleEventProducer logger = new AsyncTaskLifeCycleEventProducer(); logger.setTransacted(transacted); logger.setConnectionFactory(connFactory); logger.setQueue(queue); return logger; }
java
public static AsyncTaskLifeCycleEventProducer newJMSInstance(boolean transacted, ConnectionFactory connFactory, Queue queue) { AsyncTaskLifeCycleEventProducer logger = new AsyncTaskLifeCycleEventProducer(); logger.setTransacted(transacted); logger.setConnectionFactory(connFactory); logger.setQueue(queue); return logger; }
[ "public", "static", "AsyncTaskLifeCycleEventProducer", "newJMSInstance", "(", "boolean", "transacted", ",", "ConnectionFactory", "connFactory", ",", "Queue", "queue", ")", "{", "AsyncTaskLifeCycleEventProducer", "logger", "=", "new", "AsyncTaskLifeCycleEventProducer", "(", ")", ";", "logger", ".", "setTransacted", "(", "transacted", ")", ";", "logger", ".", "setConnectionFactory", "(", "connFactory", ")", ";", "logger", ".", "setQueue", "(", "queue", ")", ";", "return", "logger", ";", "}" ]
Creates new instance of JMS task audit logger based on given connection factory and queue. @param transacted determines if JMS session is transacted or not @param connFactory connection factory instance @param queue JMS queue instance @return new instance of JMS task audit logger
[ "Creates", "new", "instance", "of", "JMS", "task", "audit", "logger", "based", "on", "given", "connection", "factory", "and", "queue", "." ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-audit/src/main/java/org/jbpm/services/task/audit/TaskAuditLoggerFactory.java#L109-L116
lucee/Lucee
core/src/main/java/lucee/runtime/op/date/DateCaster.java
DateCaster.toDateSimple
public static DateTime toDateSimple(String str, short convertingType, boolean alsoMonthString, TimeZone timeZone) throws PageException { """ converts a Object to a DateTime Object, returns null if invalid string @param str Stringt to Convert @param convertingType one of the following values: - CONVERTING_TYPE_NONE: number are not converted at all - CONVERTING_TYPE_YEAR: integers are handled as years - CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTC @param timeZone @return coverted Date Time Object @throws PageException """ DateTime dt = toDateSimple(str, convertingType, alsoMonthString, timeZone, null); if (dt == null) throw new ExpressionException("can't cast value to a Date Object"); return dt; }
java
public static DateTime toDateSimple(String str, short convertingType, boolean alsoMonthString, TimeZone timeZone) throws PageException { DateTime dt = toDateSimple(str, convertingType, alsoMonthString, timeZone, null); if (dt == null) throw new ExpressionException("can't cast value to a Date Object"); return dt; }
[ "public", "static", "DateTime", "toDateSimple", "(", "String", "str", ",", "short", "convertingType", ",", "boolean", "alsoMonthString", ",", "TimeZone", "timeZone", ")", "throws", "PageException", "{", "DateTime", "dt", "=", "toDateSimple", "(", "str", ",", "convertingType", ",", "alsoMonthString", ",", "timeZone", ",", "null", ")", ";", "if", "(", "dt", "==", "null", ")", "throw", "new", "ExpressionException", "(", "\"can't cast value to a Date Object\"", ")", ";", "return", "dt", ";", "}" ]
converts a Object to a DateTime Object, returns null if invalid string @param str Stringt to Convert @param convertingType one of the following values: - CONVERTING_TYPE_NONE: number are not converted at all - CONVERTING_TYPE_YEAR: integers are handled as years - CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTC @param timeZone @return coverted Date Time Object @throws PageException
[ "converts", "a", "Object", "to", "a", "DateTime", "Object", "returns", "null", "if", "invalid", "string" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L501-L505
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/io/DataIO.java
DataIO.fromCSP
public static TableModel fromCSP(CSProperties p, final int dim) { """ Returns a r/o table from a CSP file @param p @param dim @return a table model for properties with dimension. """ List<String> dims = keysByMeta(p, "role", "dimension"); if (dims.isEmpty()) { return null; } for (String d : dims) { if (Integer.parseInt(p.get(d).toString()) == dim) { final List<String> bounds = keysByMeta(p, "bound", d); final List<Object> columns = new ArrayList<Object>(bounds.size()); for (String bound : bounds) { columns.add(Conversions.convert(p.get(bound), double[].class)); } return new AbstractTableModel() { @Override public int getRowCount() { return dim; } @Override public int getColumnCount() { return bounds.size(); } @Override public Object getValueAt(int rowIndex, int columnIndex) { return Array.get(columns.get(columnIndex), rowIndex); } @Override public String getColumnName(int column) { return bounds.get(column); } @Override public Class<?> getColumnClass(int columnIndex) { return Double.class; } }; } } return null; }
java
public static TableModel fromCSP(CSProperties p, final int dim) { List<String> dims = keysByMeta(p, "role", "dimension"); if (dims.isEmpty()) { return null; } for (String d : dims) { if (Integer.parseInt(p.get(d).toString()) == dim) { final List<String> bounds = keysByMeta(p, "bound", d); final List<Object> columns = new ArrayList<Object>(bounds.size()); for (String bound : bounds) { columns.add(Conversions.convert(p.get(bound), double[].class)); } return new AbstractTableModel() { @Override public int getRowCount() { return dim; } @Override public int getColumnCount() { return bounds.size(); } @Override public Object getValueAt(int rowIndex, int columnIndex) { return Array.get(columns.get(columnIndex), rowIndex); } @Override public String getColumnName(int column) { return bounds.get(column); } @Override public Class<?> getColumnClass(int columnIndex) { return Double.class; } }; } } return null; }
[ "public", "static", "TableModel", "fromCSP", "(", "CSProperties", "p", ",", "final", "int", "dim", ")", "{", "List", "<", "String", ">", "dims", "=", "keysByMeta", "(", "p", ",", "\"role\"", ",", "\"dimension\"", ")", ";", "if", "(", "dims", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "for", "(", "String", "d", ":", "dims", ")", "{", "if", "(", "Integer", ".", "parseInt", "(", "p", ".", "get", "(", "d", ")", ".", "toString", "(", ")", ")", "==", "dim", ")", "{", "final", "List", "<", "String", ">", "bounds", "=", "keysByMeta", "(", "p", ",", "\"bound\"", ",", "d", ")", ";", "final", "List", "<", "Object", ">", "columns", "=", "new", "ArrayList", "<", "Object", ">", "(", "bounds", ".", "size", "(", ")", ")", ";", "for", "(", "String", "bound", ":", "bounds", ")", "{", "columns", ".", "add", "(", "Conversions", ".", "convert", "(", "p", ".", "get", "(", "bound", ")", ",", "double", "[", "]", ".", "class", ")", ")", ";", "}", "return", "new", "AbstractTableModel", "(", ")", "{", "@", "Override", "public", "int", "getRowCount", "(", ")", "{", "return", "dim", ";", "}", "@", "Override", "public", "int", "getColumnCount", "(", ")", "{", "return", "bounds", ".", "size", "(", ")", ";", "}", "@", "Override", "public", "Object", "getValueAt", "(", "int", "rowIndex", ",", "int", "columnIndex", ")", "{", "return", "Array", ".", "get", "(", "columns", ".", "get", "(", "columnIndex", ")", ",", "rowIndex", ")", ";", "}", "@", "Override", "public", "String", "getColumnName", "(", "int", "column", ")", "{", "return", "bounds", ".", "get", "(", "column", ")", ";", "}", "@", "Override", "public", "Class", "<", "?", ">", "getColumnClass", "(", "int", "columnIndex", ")", "{", "return", "Double", ".", "class", ";", "}", "}", ";", "}", "}", "return", "null", ";", "}" ]
Returns a r/o table from a CSP file @param p @param dim @return a table model for properties with dimension.
[ "Returns", "a", "r", "/", "o", "table", "from", "a", "CSP", "file" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/DataIO.java#L828-L871
jmrozanec/cron-utils
src/main/java/com/cronutils/model/field/expression/visitor/ValidationFieldExpressionVisitor.java
ValidationFieldExpressionVisitor.isInRange
@VisibleForTesting protected void isInRange(final FieldValue<?> fieldValue) { """ Check if given number is greater or equal to start range and minor or equal to end range. @param fieldValue - to be validated @throws IllegalArgumentException - if not in range """ if (fieldValue instanceof IntegerFieldValue) { final int value = ((IntegerFieldValue) fieldValue).getValue(); if (!constraints.isInRange(value)) { throw new IllegalArgumentException(String.format(OORANGE, value, constraints.getStartRange(), constraints.getEndRange())); } } }
java
@VisibleForTesting protected void isInRange(final FieldValue<?> fieldValue) { if (fieldValue instanceof IntegerFieldValue) { final int value = ((IntegerFieldValue) fieldValue).getValue(); if (!constraints.isInRange(value)) { throw new IllegalArgumentException(String.format(OORANGE, value, constraints.getStartRange(), constraints.getEndRange())); } } }
[ "@", "VisibleForTesting", "protected", "void", "isInRange", "(", "final", "FieldValue", "<", "?", ">", "fieldValue", ")", "{", "if", "(", "fieldValue", "instanceof", "IntegerFieldValue", ")", "{", "final", "int", "value", "=", "(", "(", "IntegerFieldValue", ")", "fieldValue", ")", ".", "getValue", "(", ")", ";", "if", "(", "!", "constraints", ".", "isInRange", "(", "value", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "OORANGE", ",", "value", ",", "constraints", ".", "getStartRange", "(", ")", ",", "constraints", ".", "getEndRange", "(", ")", ")", ")", ";", "}", "}", "}" ]
Check if given number is greater or equal to start range and minor or equal to end range. @param fieldValue - to be validated @throws IllegalArgumentException - if not in range
[ "Check", "if", "given", "number", "is", "greater", "or", "equal", "to", "start", "range", "and", "minor", "or", "equal", "to", "end", "range", "." ]
train
https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/model/field/expression/visitor/ValidationFieldExpressionVisitor.java#L151-L159
jmxtrans/jmxtrans
jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/output/Settings.java
Settings.getBooleanSetting
public static Boolean getBooleanSetting(Map<String, Object> settings, String key) { """ Returns a boolean value for the key, defaults to false if not specified. This is equivalent to calling {@link #getBooleanSetting(java.util.Map, String, Boolean)}. @param settings @param key the key value to get the boolean setting for @return the value set for the key, defaults to false """ return getBooleanSetting(settings, key, false); }
java
public static Boolean getBooleanSetting(Map<String, Object> settings, String key) { return getBooleanSetting(settings, key, false); }
[ "public", "static", "Boolean", "getBooleanSetting", "(", "Map", "<", "String", ",", "Object", ">", "settings", ",", "String", "key", ")", "{", "return", "getBooleanSetting", "(", "settings", ",", "key", ",", "false", ")", ";", "}" ]
Returns a boolean value for the key, defaults to false if not specified. This is equivalent to calling {@link #getBooleanSetting(java.util.Map, String, Boolean)}. @param settings @param key the key value to get the boolean setting for @return the value set for the key, defaults to false
[ "Returns", "a", "boolean", "value", "for", "the", "key", "defaults", "to", "false", "if", "not", "specified", ".", "This", "is", "equivalent", "to", "calling", "{", "@link", "#getBooleanSetting", "(", "java", ".", "util", ".", "Map", "String", "Boolean", ")", "}", "." ]
train
https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/output/Settings.java#L47-L49
ops4j/org.ops4j.pax.web
pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java
WebAppParser.parseErrorPages
private static void parseErrorPages(final ErrorPageType errorPageType, final WebApp webApp) { """ Parses error pages out of web.xml. @param errorPageType errorPageType element from web.xml @param webApp model for web.xml """ final WebAppErrorPage errorPage = new WebAppErrorPage(); if (errorPageType.getErrorCode() != null) { errorPage.setErrorCode(errorPageType.getErrorCode().getValue().toString()); } if (errorPageType.getExceptionType() != null) { errorPage.setExceptionType(errorPageType.getExceptionType().getValue()); } if (errorPageType.getLocation() != null) { errorPage.setLocation(errorPageType.getLocation().getValue()); } if (errorPage.getErrorCode() == null && errorPage.getExceptionType() == null) { errorPage.setExceptionType(ErrorPageModel.ERROR_PAGE); } webApp.addErrorPage(errorPage); }
java
private static void parseErrorPages(final ErrorPageType errorPageType, final WebApp webApp) { final WebAppErrorPage errorPage = new WebAppErrorPage(); if (errorPageType.getErrorCode() != null) { errorPage.setErrorCode(errorPageType.getErrorCode().getValue().toString()); } if (errorPageType.getExceptionType() != null) { errorPage.setExceptionType(errorPageType.getExceptionType().getValue()); } if (errorPageType.getLocation() != null) { errorPage.setLocation(errorPageType.getLocation().getValue()); } if (errorPage.getErrorCode() == null && errorPage.getExceptionType() == null) { errorPage.setExceptionType(ErrorPageModel.ERROR_PAGE); } webApp.addErrorPage(errorPage); }
[ "private", "static", "void", "parseErrorPages", "(", "final", "ErrorPageType", "errorPageType", ",", "final", "WebApp", "webApp", ")", "{", "final", "WebAppErrorPage", "errorPage", "=", "new", "WebAppErrorPage", "(", ")", ";", "if", "(", "errorPageType", ".", "getErrorCode", "(", ")", "!=", "null", ")", "{", "errorPage", ".", "setErrorCode", "(", "errorPageType", ".", "getErrorCode", "(", ")", ".", "getValue", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "errorPageType", ".", "getExceptionType", "(", ")", "!=", "null", ")", "{", "errorPage", ".", "setExceptionType", "(", "errorPageType", ".", "getExceptionType", "(", ")", ".", "getValue", "(", ")", ")", ";", "}", "if", "(", "errorPageType", ".", "getLocation", "(", ")", "!=", "null", ")", "{", "errorPage", ".", "setLocation", "(", "errorPageType", ".", "getLocation", "(", ")", ".", "getValue", "(", ")", ")", ";", "}", "if", "(", "errorPage", ".", "getErrorCode", "(", ")", "==", "null", "&&", "errorPage", ".", "getExceptionType", "(", ")", "==", "null", ")", "{", "errorPage", ".", "setExceptionType", "(", "ErrorPageModel", ".", "ERROR_PAGE", ")", ";", "}", "webApp", ".", "addErrorPage", "(", "errorPage", ")", ";", "}" ]
Parses error pages out of web.xml. @param errorPageType errorPageType element from web.xml @param webApp model for web.xml
[ "Parses", "error", "pages", "out", "of", "web", ".", "xml", "." ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L755-L770
knowm/XChange
xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseMarketDataServiceRaw.java
CoinbaseMarketDataServiceRaw.getCoinbaseBuyPrice
public CoinbasePrice getCoinbaseBuyPrice(BigDecimal quantity, String currency) throws IOException { """ Unauthenticated resource that tells you the total price to buy some quantity of Bitcoin. @param quantity The quantity of Bitcoin you would like to buy (default is 1 if null). @param currency Default is USD. Right now this is the only value allowed. @return The price in the desired {@code currency} to buy the given {@code quantity} BTC. @throws IOException @see <a href="https://coinbase.com/api/doc/1.0/prices/buy.html">coinbase.com/api/doc/1.0/prices/buy.html</a> """ return coinbase.getBuyPrice(quantity, currency); }
java
public CoinbasePrice getCoinbaseBuyPrice(BigDecimal quantity, String currency) throws IOException { return coinbase.getBuyPrice(quantity, currency); }
[ "public", "CoinbasePrice", "getCoinbaseBuyPrice", "(", "BigDecimal", "quantity", ",", "String", "currency", ")", "throws", "IOException", "{", "return", "coinbase", ".", "getBuyPrice", "(", "quantity", ",", "currency", ")", ";", "}" ]
Unauthenticated resource that tells you the total price to buy some quantity of Bitcoin. @param quantity The quantity of Bitcoin you would like to buy (default is 1 if null). @param currency Default is USD. Right now this is the only value allowed. @return The price in the desired {@code currency} to buy the given {@code quantity} BTC. @throws IOException @see <a href="https://coinbase.com/api/doc/1.0/prices/buy.html">coinbase.com/api/doc/1.0/prices/buy.html</a>
[ "Unauthenticated", "resource", "that", "tells", "you", "the", "total", "price", "to", "buy", "some", "quantity", "of", "Bitcoin", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseMarketDataServiceRaw.java#L76-L80
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/matching/MessageProcessorMatching.java
MessageProcessorMatching.removeConsumerDispatcherMatchTarget
public void removeConsumerDispatcherMatchTarget(ConsumerDispatcher consumerDispatcher, SelectionCriteria selectionCriteria) { """ Method removeConsumerDispatcherMatchTarget Used to remove a ConsumerDispatcher from the MatchSpace. @param consumerDispatcher The consumer dispatcher to remove """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "removeConsumerDispatcherMatchTarget", new Object[] {consumerDispatcher, selectionCriteria}); // Remove the consumer point from the matchspace // Set the CD and selection criteria into a wrapper that extends MatchTarget MatchingConsumerDispatcherWithCriteira key = new MatchingConsumerDispatcherWithCriteira (consumerDispatcher,selectionCriteria); // Reset the CD flag to indicate that this subscription is not in the MatchSpace. consumerDispatcher.setIsInMatchSpace(false); try { removeTarget(key); } catch (MatchingException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.matching.MessageProcessorMatching.removeConsumerDispatcherMatchTarget", "1:1312:1.117.1.11", this); SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeConsumerDispatcherMatchTarget", "SICoreException"); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching", "1:1323:1.117.1.11", e }); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching", "1:1331:1.117.1.11", e }, null), e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeConsumerDispatcherMatchTarget"); }
java
public void removeConsumerDispatcherMatchTarget(ConsumerDispatcher consumerDispatcher, SelectionCriteria selectionCriteria) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "removeConsumerDispatcherMatchTarget", new Object[] {consumerDispatcher, selectionCriteria}); // Remove the consumer point from the matchspace // Set the CD and selection criteria into a wrapper that extends MatchTarget MatchingConsumerDispatcherWithCriteira key = new MatchingConsumerDispatcherWithCriteira (consumerDispatcher,selectionCriteria); // Reset the CD flag to indicate that this subscription is not in the MatchSpace. consumerDispatcher.setIsInMatchSpace(false); try { removeTarget(key); } catch (MatchingException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.matching.MessageProcessorMatching.removeConsumerDispatcherMatchTarget", "1:1312:1.117.1.11", this); SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeConsumerDispatcherMatchTarget", "SICoreException"); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching", "1:1323:1.117.1.11", e }); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching", "1:1331:1.117.1.11", e }, null), e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeConsumerDispatcherMatchTarget"); }
[ "public", "void", "removeConsumerDispatcherMatchTarget", "(", "ConsumerDispatcher", "consumerDispatcher", ",", "SelectionCriteria", "selectionCriteria", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"removeConsumerDispatcherMatchTarget\"", ",", "new", "Object", "[", "]", "{", "consumerDispatcher", ",", "selectionCriteria", "}", ")", ";", "// Remove the consumer point from the matchspace", "// Set the CD and selection criteria into a wrapper that extends MatchTarget", "MatchingConsumerDispatcherWithCriteira", "key", "=", "new", "MatchingConsumerDispatcherWithCriteira", "(", "consumerDispatcher", ",", "selectionCriteria", ")", ";", "// Reset the CD flag to indicate that this subscription is not in the MatchSpace.", "consumerDispatcher", ".", "setIsInMatchSpace", "(", "false", ")", ";", "try", "{", "removeTarget", "(", "key", ")", ";", "}", "catch", "(", "MatchingException", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.matching.MessageProcessorMatching.removeConsumerDispatcherMatchTarget\"", ",", "\"1:1312:1.117.1.11\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"removeConsumerDispatcherMatchTarget\"", ",", "\"SICoreException\"", ")", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.matching.MessageProcessorMatching\"", ",", "\"1:1323:1.117.1.11\"", ",", "e", "}", ")", ";", "throw", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.matching.MessageProcessorMatching\"", ",", "\"1:1331:1.117.1.11\"", ",", "e", "}", ",", "null", ")", ",", "e", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"removeConsumerDispatcherMatchTarget\"", ")", ";", "}" ]
Method removeConsumerDispatcherMatchTarget Used to remove a ConsumerDispatcher from the MatchSpace. @param consumerDispatcher The consumer dispatcher to remove
[ "Method", "removeConsumerDispatcherMatchTarget", "Used", "to", "remove", "a", "ConsumerDispatcher", "from", "the", "MatchSpace", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/matching/MessageProcessorMatching.java#L1247-L1299
RestComm/jain-slee.http
resources/http-client-nio/ra/src/main/java/org/restcomm/slee/ra/httpclient/nio/ra/HttpClientNIOResourceAdaptor.java
HttpClientNIOResourceAdaptor.processResponseEvent
public void processResponseEvent(HttpClientNIOResponseEvent event, HttpClientNIORequestActivityImpl activity) { """ Receives an Event from the HTTP client and sends it to the SLEE. @param event @param activity """ HttpClientNIORequestActivityHandle ah = new HttpClientNIORequestActivityHandle(activity.getId()); if (tracer.isFineEnabled()) tracer.fine("==== FIRING ResponseEvent EVENT TO LOCAL SLEE, Event: " + event + " ===="); try { resourceAdaptorContext.getSleeEndpoint().fireEvent(ah, fireableEventType, event, null, null, EVENT_FLAGS); } catch (Throwable e) { tracer.severe(e.getMessage(), e); } }
java
public void processResponseEvent(HttpClientNIOResponseEvent event, HttpClientNIORequestActivityImpl activity) { HttpClientNIORequestActivityHandle ah = new HttpClientNIORequestActivityHandle(activity.getId()); if (tracer.isFineEnabled()) tracer.fine("==== FIRING ResponseEvent EVENT TO LOCAL SLEE, Event: " + event + " ===="); try { resourceAdaptorContext.getSleeEndpoint().fireEvent(ah, fireableEventType, event, null, null, EVENT_FLAGS); } catch (Throwable e) { tracer.severe(e.getMessage(), e); } }
[ "public", "void", "processResponseEvent", "(", "HttpClientNIOResponseEvent", "event", ",", "HttpClientNIORequestActivityImpl", "activity", ")", "{", "HttpClientNIORequestActivityHandle", "ah", "=", "new", "HttpClientNIORequestActivityHandle", "(", "activity", ".", "getId", "(", ")", ")", ";", "if", "(", "tracer", ".", "isFineEnabled", "(", ")", ")", "tracer", ".", "fine", "(", "\"==== FIRING ResponseEvent EVENT TO LOCAL SLEE, Event: \"", "+", "event", "+", "\" ====\"", ")", ";", "try", "{", "resourceAdaptorContext", ".", "getSleeEndpoint", "(", ")", ".", "fireEvent", "(", "ah", ",", "fireableEventType", ",", "event", ",", "null", ",", "null", ",", "EVENT_FLAGS", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "tracer", ".", "severe", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Receives an Event from the HTTP client and sends it to the SLEE. @param event @param activity
[ "Receives", "an", "Event", "from", "the", "HTTP", "client", "and", "sends", "it", "to", "the", "SLEE", "." ]
train
https://github.com/RestComm/jain-slee.http/blob/938e502a60355b988d6998d2539bbb16207674e8/resources/http-client-nio/ra/src/main/java/org/restcomm/slee/ra/httpclient/nio/ra/HttpClientNIOResourceAdaptor.java#L489-L501
EsotericSoftware/jsonbeans
src/com/esotericsoftware/jsonbeans/Json.java
Json.addClassTag
public void addClassTag (String tag, Class type) { """ Sets a tag to use instead of the fully qualifier class name. This can make the JSON easier to read. """ tagToClass.put(tag, type); classToTag.put(type, tag); }
java
public void addClassTag (String tag, Class type) { tagToClass.put(tag, type); classToTag.put(type, tag); }
[ "public", "void", "addClassTag", "(", "String", "tag", ",", "Class", "type", ")", "{", "tagToClass", ".", "put", "(", "tag", ",", "type", ")", ";", "classToTag", ".", "put", "(", "type", ",", "tag", ")", ";", "}" ]
Sets a tag to use instead of the fully qualifier class name. This can make the JSON easier to read.
[ "Sets", "a", "tag", "to", "use", "instead", "of", "the", "fully", "qualifier", "class", "name", ".", "This", "can", "make", "the", "JSON", "easier", "to", "read", "." ]
train
https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L96-L99
jparsec/jparsec
jparsec/src/main/java/org/jparsec/SourceLocator.java
SourceLocator.binarySearch
@Private static int binarySearch(IntList ascendingInts, int value) { """ Uses binary search to look up the index of the first element in {@code ascendingInts} that's greater than or equal to {@code value}. If all elements are smaller than {@code value}, {@code ascendingInts.size()} is returned. """ for (int begin = 0, to = ascendingInts.size();;) { if (begin == to) return begin; int i = (begin + to) / 2; int x = ascendingInts.get(i); if (x == value) return i; else if (x > value) to = i; else begin = i + 1; } }
java
@Private static int binarySearch(IntList ascendingInts, int value) { for (int begin = 0, to = ascendingInts.size();;) { if (begin == to) return begin; int i = (begin + to) / 2; int x = ascendingInts.get(i); if (x == value) return i; else if (x > value) to = i; else begin = i + 1; } }
[ "@", "Private", "static", "int", "binarySearch", "(", "IntList", "ascendingInts", ",", "int", "value", ")", "{", "for", "(", "int", "begin", "=", "0", ",", "to", "=", "ascendingInts", ".", "size", "(", ")", ";", ";", ")", "{", "if", "(", "begin", "==", "to", ")", "return", "begin", ";", "int", "i", "=", "(", "begin", "+", "to", ")", "/", "2", ";", "int", "x", "=", "ascendingInts", ".", "get", "(", "i", ")", ";", "if", "(", "x", "==", "value", ")", "return", "i", ";", "else", "if", "(", "x", ">", "value", ")", "to", "=", "i", ";", "else", "begin", "=", "i", "+", "1", ";", "}", "}" ]
Uses binary search to look up the index of the first element in {@code ascendingInts} that's greater than or equal to {@code value}. If all elements are smaller than {@code value}, {@code ascendingInts.size()} is returned.
[ "Uses", "binary", "search", "to", "look", "up", "the", "index", "of", "the", "first", "element", "in", "{" ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/SourceLocator.java#L148-L157
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/global/ExecutorFactoryConfigurationBuilder.java
ExecutorFactoryConfigurationBuilder.addProperty
public ExecutorFactoryConfigurationBuilder addProperty(String key, String value) { """ Add key/value property pair to this executor factory configuration @param key property key @param value property value @return this ExecutorFactoryConfig """ attributes.attribute(PROPERTIES).get().put(key, value); return this; }
java
public ExecutorFactoryConfigurationBuilder addProperty(String key, String value) { attributes.attribute(PROPERTIES).get().put(key, value); return this; }
[ "public", "ExecutorFactoryConfigurationBuilder", "addProperty", "(", "String", "key", ",", "String", "value", ")", "{", "attributes", ".", "attribute", "(", "PROPERTIES", ")", ".", "get", "(", ")", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add key/value property pair to this executor factory configuration @param key property key @param value property value @return this ExecutorFactoryConfig
[ "Add", "key", "/", "value", "property", "pair", "to", "this", "executor", "factory", "configuration" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/global/ExecutorFactoryConfigurationBuilder.java#L45-L48
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java
CraftingHelper.attemptSmelting
public static boolean attemptSmelting(EntityPlayerMP player, ItemStack input) { """ Attempt to smelt the given item.<br> This returns instantly, callously disregarding such frivolous niceties as cooking times or the presence of a furnace.<br> It will, however, consume fuel from the player's inventory. @param player @param input the raw ingredients we want to cook. @return true if cooking was successful. """ if (player == null || input == null) return false; List<ItemStack> ingredients = new ArrayList<ItemStack>(); ingredients.add(input); ItemStack isOutput = (ItemStack)FurnaceRecipes.instance().getSmeltingList().get(input); if (isOutput == null) return false; int cookingTime = 200; // Seems to be hard-coded in TileEntityFurnace. if (playerHasIngredients(player, ingredients) && totalBurnTimeInInventory(player) >= cookingTime) { removeIngredientsFromPlayer(player, ingredients); burnInventory(player, cookingTime, input); ItemStack resultForInventory = isOutput.copy(); ItemStack resultForReward = isOutput.copy(); player.inventory.addItemStackToInventory(resultForInventory); RewardForCollectingItemImplementation.GainItemEvent event = new RewardForCollectingItemImplementation.GainItemEvent(resultForReward); MinecraftForge.EVENT_BUS.post(event); return true; } return false; }
java
public static boolean attemptSmelting(EntityPlayerMP player, ItemStack input) { if (player == null || input == null) return false; List<ItemStack> ingredients = new ArrayList<ItemStack>(); ingredients.add(input); ItemStack isOutput = (ItemStack)FurnaceRecipes.instance().getSmeltingList().get(input); if (isOutput == null) return false; int cookingTime = 200; // Seems to be hard-coded in TileEntityFurnace. if (playerHasIngredients(player, ingredients) && totalBurnTimeInInventory(player) >= cookingTime) { removeIngredientsFromPlayer(player, ingredients); burnInventory(player, cookingTime, input); ItemStack resultForInventory = isOutput.copy(); ItemStack resultForReward = isOutput.copy(); player.inventory.addItemStackToInventory(resultForInventory); RewardForCollectingItemImplementation.GainItemEvent event = new RewardForCollectingItemImplementation.GainItemEvent(resultForReward); MinecraftForge.EVENT_BUS.post(event); return true; } return false; }
[ "public", "static", "boolean", "attemptSmelting", "(", "EntityPlayerMP", "player", ",", "ItemStack", "input", ")", "{", "if", "(", "player", "==", "null", "||", "input", "==", "null", ")", "return", "false", ";", "List", "<", "ItemStack", ">", "ingredients", "=", "new", "ArrayList", "<", "ItemStack", ">", "(", ")", ";", "ingredients", ".", "add", "(", "input", ")", ";", "ItemStack", "isOutput", "=", "(", "ItemStack", ")", "FurnaceRecipes", ".", "instance", "(", ")", ".", "getSmeltingList", "(", ")", ".", "get", "(", "input", ")", ";", "if", "(", "isOutput", "==", "null", ")", "return", "false", ";", "int", "cookingTime", "=", "200", ";", "// Seems to be hard-coded in TileEntityFurnace.", "if", "(", "playerHasIngredients", "(", "player", ",", "ingredients", ")", "&&", "totalBurnTimeInInventory", "(", "player", ")", ">=", "cookingTime", ")", "{", "removeIngredientsFromPlayer", "(", "player", ",", "ingredients", ")", ";", "burnInventory", "(", "player", ",", "cookingTime", ",", "input", ")", ";", "ItemStack", "resultForInventory", "=", "isOutput", ".", "copy", "(", ")", ";", "ItemStack", "resultForReward", "=", "isOutput", ".", "copy", "(", ")", ";", "player", ".", "inventory", ".", "addItemStackToInventory", "(", "resultForInventory", ")", ";", "RewardForCollectingItemImplementation", ".", "GainItemEvent", "event", "=", "new", "RewardForCollectingItemImplementation", ".", "GainItemEvent", "(", "resultForReward", ")", ";", "MinecraftForge", ".", "EVENT_BUS", ".", "post", "(", "event", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Attempt to smelt the given item.<br> This returns instantly, callously disregarding such frivolous niceties as cooking times or the presence of a furnace.<br> It will, however, consume fuel from the player's inventory. @param player @param input the raw ingredients we want to cook. @return true if cooking was successful.
[ "Attempt", "to", "smelt", "the", "given", "item", ".", "<br", ">", "This", "returns", "instantly", "callously", "disregarding", "such", "frivolous", "niceties", "as", "cooking", "times", "or", "the", "presence", "of", "a", "furnace", ".", "<br", ">", "It", "will", "however", "consume", "fuel", "from", "the", "player", "s", "inventory", "." ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java#L412-L436
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VTimeZone.java
VTimeZone.writeSimple
public void writeSimple(Writer writer, long time) throws IOException { """ Writes RFC2445 VTIMEZONE data applicable near the specified date. Some common iCalendar implementations can only handle a single time zone property or a pair of standard and daylight time properties using BYDAY rule with day of week (such as BYDAY=1SUN). This method produce the VTIMEZONE data which can be handled these implementations. The rules produced by this method can be used only for calculating time zone offset around the specified date. @param writer The <code>Writer</code> used for the output @param time The date @throws IOException If there were problems reading or writing to the writer. """ // Extract simple rules TimeZoneRule[] rules = tz.getSimpleTimeZoneRulesNear(time); // Create a RuleBasedTimeZone with the subset rule RuleBasedTimeZone rbtz = new RuleBasedTimeZone(tz.getID(), (InitialTimeZoneRule)rules[0]); for (int i = 1; i < rules.length; i++) { rbtz.addTransitionRule(rules[i]); } String[] customProperties = null; if (olsonzid != null && ICU_TZVERSION != null) { customProperties = new String[1]; customProperties[0] = ICU_TZINFO_PROP + COLON + olsonzid + "[" + ICU_TZVERSION + "/Simple@" + time + "]"; } writeZone(writer, rbtz, customProperties); }
java
public void writeSimple(Writer writer, long time) throws IOException { // Extract simple rules TimeZoneRule[] rules = tz.getSimpleTimeZoneRulesNear(time); // Create a RuleBasedTimeZone with the subset rule RuleBasedTimeZone rbtz = new RuleBasedTimeZone(tz.getID(), (InitialTimeZoneRule)rules[0]); for (int i = 1; i < rules.length; i++) { rbtz.addTransitionRule(rules[i]); } String[] customProperties = null; if (olsonzid != null && ICU_TZVERSION != null) { customProperties = new String[1]; customProperties[0] = ICU_TZINFO_PROP + COLON + olsonzid + "[" + ICU_TZVERSION + "/Simple@" + time + "]"; } writeZone(writer, rbtz, customProperties); }
[ "public", "void", "writeSimple", "(", "Writer", "writer", ",", "long", "time", ")", "throws", "IOException", "{", "// Extract simple rules", "TimeZoneRule", "[", "]", "rules", "=", "tz", ".", "getSimpleTimeZoneRulesNear", "(", "time", ")", ";", "// Create a RuleBasedTimeZone with the subset rule", "RuleBasedTimeZone", "rbtz", "=", "new", "RuleBasedTimeZone", "(", "tz", ".", "getID", "(", ")", ",", "(", "InitialTimeZoneRule", ")", "rules", "[", "0", "]", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "rules", ".", "length", ";", "i", "++", ")", "{", "rbtz", ".", "addTransitionRule", "(", "rules", "[", "i", "]", ")", ";", "}", "String", "[", "]", "customProperties", "=", "null", ";", "if", "(", "olsonzid", "!=", "null", "&&", "ICU_TZVERSION", "!=", "null", ")", "{", "customProperties", "=", "new", "String", "[", "1", "]", ";", "customProperties", "[", "0", "]", "=", "ICU_TZINFO_PROP", "+", "COLON", "+", "olsonzid", "+", "\"[\"", "+", "ICU_TZVERSION", "+", "\"/Simple@\"", "+", "time", "+", "\"]\"", ";", "}", "writeZone", "(", "writer", ",", "rbtz", ",", "customProperties", ")", ";", "}" ]
Writes RFC2445 VTIMEZONE data applicable near the specified date. Some common iCalendar implementations can only handle a single time zone property or a pair of standard and daylight time properties using BYDAY rule with day of week (such as BYDAY=1SUN). This method produce the VTIMEZONE data which can be handled these implementations. The rules produced by this method can be used only for calculating time zone offset around the specified date. @param writer The <code>Writer</code> used for the output @param time The date @throws IOException If there were problems reading or writing to the writer.
[ "Writes", "RFC2445", "VTIMEZONE", "data", "applicable", "near", "the", "specified", "date", ".", "Some", "common", "iCalendar", "implementations", "can", "only", "handle", "a", "single", "time", "zone", "property", "or", "a", "pair", "of", "standard", "and", "daylight", "time", "properties", "using", "BYDAY", "rule", "with", "day", "of", "week", "(", "such", "as", "BYDAY", "=", "1SUN", ")", ".", "This", "method", "produce", "the", "VTIMEZONE", "data", "which", "can", "be", "handled", "these", "implementations", ".", "The", "rules", "produced", "by", "this", "method", "can", "be", "used", "only", "for", "calculating", "time", "zone", "offset", "around", "the", "specified", "date", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VTimeZone.java#L290-L306
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java
FastDateFormat.getTimeInstance
public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone) { """ 获得 {@link FastDateFormat} 实例<br> 支持缓存 @param style time style: FULL, LONG, MEDIUM, or SHORT @param timeZone optional time zone, overrides time zone of formatted time @return 本地化 {@link FastDateFormat} """ return cache.getTimeInstance(style, timeZone, null); }
java
public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone) { return cache.getTimeInstance(style, timeZone, null); }
[ "public", "static", "FastDateFormat", "getTimeInstance", "(", "final", "int", "style", ",", "final", "TimeZone", "timeZone", ")", "{", "return", "cache", ".", "getTimeInstance", "(", "style", ",", "timeZone", ",", "null", ")", ";", "}" ]
获得 {@link FastDateFormat} 实例<br> 支持缓存 @param style time style: FULL, LONG, MEDIUM, or SHORT @param timeZone optional time zone, overrides time zone of formatted time @return 本地化 {@link FastDateFormat}
[ "获得", "{", "@link", "FastDateFormat", "}", "实例<br", ">", "支持缓存" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L194-L196
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentTreeUrl.java
DocumentTreeUrl.getTreeDocumentUrl
public static MozuUrl getTreeDocumentUrl(String documentListName, String documentName, Boolean includeInactive, String responseFields) { """ Get Resource Url for GetTreeDocument @param documentListName Name of content documentListName to delete @param documentName The name of the document in the site. @param includeInactive Include inactive content. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documentTree/{documentName}?includeInactive={includeInactive}&responseFields={responseFields}"); formatter.formatUrl("documentListName", documentListName); formatter.formatUrl("documentName", documentName); formatter.formatUrl("includeInactive", includeInactive); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getTreeDocumentUrl(String documentListName, String documentName, Boolean includeInactive, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documentTree/{documentName}?includeInactive={includeInactive}&responseFields={responseFields}"); formatter.formatUrl("documentListName", documentListName); formatter.formatUrl("documentName", documentName); formatter.formatUrl("includeInactive", includeInactive); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getTreeDocumentUrl", "(", "String", "documentListName", ",", "String", "documentName", ",", "Boolean", "includeInactive", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/content/documentlists/{documentListName}/documentTree/{documentName}?includeInactive={includeInactive}&responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"documentListName\"", ",", "documentListName", ")", ";", "formatter", ".", "formatUrl", "(", "\"documentName\"", ",", "documentName", ")", ";", "formatter", ".", "formatUrl", "(", "\"includeInactive\"", ",", "includeInactive", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for GetTreeDocument @param documentListName Name of content documentListName to delete @param documentName The name of the document in the site. @param includeInactive Include inactive content. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetTreeDocument" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentTreeUrl.java#L66-L74
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/font/MalisisFont.java
MalisisFont.getStringHeight
public float getStringHeight(String text, FontOptions options) { """ Gets the rendering height of strings. @return the string height """ StringWalker walker = new StringWalker(text, options); walker.walkToEnd(); return walker.lineHeight(); }
java
public float getStringHeight(String text, FontOptions options) { StringWalker walker = new StringWalker(text, options); walker.walkToEnd(); return walker.lineHeight(); }
[ "public", "float", "getStringHeight", "(", "String", "text", ",", "FontOptions", "options", ")", "{", "StringWalker", "walker", "=", "new", "StringWalker", "(", "text", ",", "options", ")", ";", "walker", ".", "walkToEnd", "(", ")", ";", "return", "walker", ".", "lineHeight", "(", ")", ";", "}" ]
Gets the rendering height of strings. @return the string height
[ "Gets", "the", "rendering", "height", "of", "strings", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/font/MalisisFont.java#L472-L477
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toDate
public static DateTime toDate(String str, boolean alsoNumbers, TimeZone tz, DateTime defaultValue) { """ cast a Object to a DateTime Object @param str String to cast @param alsoNumbers define if also numbers will casted to a datetime value @param tz @param defaultValue @return casted DateTime Object """ return DateCaster.toDateAdvanced(str, alsoNumbers ? DateCaster.CONVERTING_TYPE_OFFSET : DateCaster.CONVERTING_TYPE_NONE, tz, defaultValue); }
java
public static DateTime toDate(String str, boolean alsoNumbers, TimeZone tz, DateTime defaultValue) { return DateCaster.toDateAdvanced(str, alsoNumbers ? DateCaster.CONVERTING_TYPE_OFFSET : DateCaster.CONVERTING_TYPE_NONE, tz, defaultValue); }
[ "public", "static", "DateTime", "toDate", "(", "String", "str", ",", "boolean", "alsoNumbers", ",", "TimeZone", "tz", ",", "DateTime", "defaultValue", ")", "{", "return", "DateCaster", ".", "toDateAdvanced", "(", "str", ",", "alsoNumbers", "?", "DateCaster", ".", "CONVERTING_TYPE_OFFSET", ":", "DateCaster", ".", "CONVERTING_TYPE_NONE", ",", "tz", ",", "defaultValue", ")", ";", "}" ]
cast a Object to a DateTime Object @param str String to cast @param alsoNumbers define if also numbers will casted to a datetime value @param tz @param defaultValue @return casted DateTime Object
[ "cast", "a", "Object", "to", "a", "DateTime", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L2924-L2926
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByAddress1
public Iterable<DUser> queryByAddress1(java.lang.String address1) { """ query-by method for field address1 @param address1 the specified attribute @return an Iterable of DUsers for the specified address1 """ return queryByField(null, DUserMapper.Field.ADDRESS1.getFieldName(), address1); }
java
public Iterable<DUser> queryByAddress1(java.lang.String address1) { return queryByField(null, DUserMapper.Field.ADDRESS1.getFieldName(), address1); }
[ "public", "Iterable", "<", "DUser", ">", "queryByAddress1", "(", "java", ".", "lang", ".", "String", "address1", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "ADDRESS1", ".", "getFieldName", "(", ")", ",", "address1", ")", ";", "}" ]
query-by method for field address1 @param address1 the specified attribute @return an Iterable of DUsers for the specified address1
[ "query", "-", "by", "method", "for", "field", "address1" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L70-L72
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java
KickflipApiClient.getStreamInfo
public void getStreamInfo(String streamId, final KickflipCallback cb) { """ Get Stream Metadata for a a public {@link io.kickflip.sdk.api.json.Stream#mStreamId}. The target Stream must belong a User within your Kickflip app. <p/> This method is useful when digesting a Kickflip.io/<stream_id> url, where only the StreamId String is known. @param streamId the stream Id of the given stream. This is the value that appears in urls of form kickflip.io/<stream_id> @param cb A callback to receive the current {@link io.kickflip.sdk.api.json.Stream} upon request completion """ GenericData data = new GenericData(); data.put("stream_id", streamId); post(GET_META, new UrlEncodedContent(data), Stream.class, cb); }
java
public void getStreamInfo(String streamId, final KickflipCallback cb) { GenericData data = new GenericData(); data.put("stream_id", streamId); post(GET_META, new UrlEncodedContent(data), Stream.class, cb); }
[ "public", "void", "getStreamInfo", "(", "String", "streamId", ",", "final", "KickflipCallback", "cb", ")", "{", "GenericData", "data", "=", "new", "GenericData", "(", ")", ";", "data", ".", "put", "(", "\"stream_id\"", ",", "streamId", ")", ";", "post", "(", "GET_META", ",", "new", "UrlEncodedContent", "(", "data", ")", ",", "Stream", ".", "class", ",", "cb", ")", ";", "}" ]
Get Stream Metadata for a a public {@link io.kickflip.sdk.api.json.Stream#mStreamId}. The target Stream must belong a User within your Kickflip app. <p/> This method is useful when digesting a Kickflip.io/<stream_id> url, where only the StreamId String is known. @param streamId the stream Id of the given stream. This is the value that appears in urls of form kickflip.io/<stream_id> @param cb A callback to receive the current {@link io.kickflip.sdk.api.json.Stream} upon request completion
[ "Get", "Stream", "Metadata", "for", "a", "a", "public", "{", "@link", "io", ".", "kickflip", ".", "sdk", ".", "api", ".", "json", ".", "Stream#mStreamId", "}", ".", "The", "target", "Stream", "must", "belong", "a", "User", "within", "your", "Kickflip", "app", ".", "<p", "/", ">", "This", "method", "is", "useful", "when", "digesting", "a", "Kickflip", ".", "io", "/", "<stream_id", ">", "url", "where", "only", "the", "StreamId", "String", "is", "known", "." ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L458-L463
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/cluster/clusterinstance_clusternode_binding.java
clusterinstance_clusternode_binding.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { """ <pre> converts nitro response into object and returns the object array in case of get request. </pre> """ clusterinstance_clusternode_binding_response result = (clusterinstance_clusternode_binding_response) service.get_payload_formatter().string_to_resource(clusterinstance_clusternode_binding_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } return result.clusterinstance_clusternode_binding; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception{ clusterinstance_clusternode_binding_response result = (clusterinstance_clusternode_binding_response) service.get_payload_formatter().string_to_resource(clusterinstance_clusternode_binding_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } return result.clusterinstance_clusternode_binding; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "clusterinstance_clusternode_binding_response", "result", "=", "(", "clusterinstance_clusternode_binding_response", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "clusterinstance_clusternode_binding_response", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "444", ")", "{", "service", ".", "clear_session", "(", ")", ";", "}", "if", "(", "result", ".", "severity", "!=", "null", ")", "{", "if", "(", "result", ".", "severity", ".", "equals", "(", "\"ERROR\"", ")", ")", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ")", ";", "}", "else", "{", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ")", ";", "}", "}", "return", "result", ".", "clusterinstance_clusternode_binding", ";", "}" ]
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cluster/clusterinstance_clusternode_binding.java#L198-L215
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setEnterpriseCustomField
public void setEnterpriseCustomField(int index, String value) { """ Set an enterprise custom field value. @param index field index @param value field value """ set(selectField(ResourceFieldLists.ENTERPRISE_CUSTOM_FIELD, index), value); }
java
public void setEnterpriseCustomField(int index, String value) { set(selectField(ResourceFieldLists.ENTERPRISE_CUSTOM_FIELD, index), value); }
[ "public", "void", "setEnterpriseCustomField", "(", "int", "index", ",", "String", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "ENTERPRISE_CUSTOM_FIELD", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise custom field value. @param index field index @param value field value
[ "Set", "an", "enterprise", "custom", "field", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L2183-L2186
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/collection/LazyList.java
LazyList.ensureSize
public static Object ensureSize(Object list, int initialSize) { """ Ensure the capacity of the underlying list. @param list the list to grow @param initialSize the size to grow to @return the new List with new size """ if (list == null) return new ArrayList<Object>(initialSize); if (list instanceof ArrayList) { ArrayList<?> ol = (ArrayList<?>) list; if (ol.size() > initialSize) return ol; ArrayList<Object> nl = new ArrayList<Object>(initialSize); nl.addAll(ol); return nl; } List<Object> l = new ArrayList<Object>(initialSize); l.add(list); return l; }
java
public static Object ensureSize(Object list, int initialSize) { if (list == null) return new ArrayList<Object>(initialSize); if (list instanceof ArrayList) { ArrayList<?> ol = (ArrayList<?>) list; if (ol.size() > initialSize) return ol; ArrayList<Object> nl = new ArrayList<Object>(initialSize); nl.addAll(ol); return nl; } List<Object> l = new ArrayList<Object>(initialSize); l.add(list); return l; }
[ "public", "static", "Object", "ensureSize", "(", "Object", "list", ",", "int", "initialSize", ")", "{", "if", "(", "list", "==", "null", ")", "return", "new", "ArrayList", "<", "Object", ">", "(", "initialSize", ")", ";", "if", "(", "list", "instanceof", "ArrayList", ")", "{", "ArrayList", "<", "?", ">", "ol", "=", "(", "ArrayList", "<", "?", ">", ")", "list", ";", "if", "(", "ol", ".", "size", "(", ")", ">", "initialSize", ")", "return", "ol", ";", "ArrayList", "<", "Object", ">", "nl", "=", "new", "ArrayList", "<", "Object", ">", "(", "initialSize", ")", ";", "nl", ".", "addAll", "(", "ol", ")", ";", "return", "nl", ";", "}", "List", "<", "Object", ">", "l", "=", "new", "ArrayList", "<", "Object", ">", "(", "initialSize", ")", ";", "l", ".", "add", "(", "list", ")", ";", "return", "l", ";", "}" ]
Ensure the capacity of the underlying list. @param list the list to grow @param initialSize the size to grow to @return the new List with new size
[ "Ensure", "the", "capacity", "of", "the", "underlying", "list", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/collection/LazyList.java#L139-L153
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/views/OAuth20ConsentApprovalViewResolver.java
OAuth20ConsentApprovalViewResolver.redirectToApproveView
@SneakyThrows protected ModelAndView redirectToApproveView(final J2EContext ctx, final OAuthRegisteredService svc) { """ Redirect to approve view model and view. @param ctx the ctx @param svc the svc @return the model and view """ val callbackUrl = ctx.getFullRequestURL(); LOGGER.trace("callbackUrl: [{}]", callbackUrl); val url = new URIBuilder(callbackUrl); url.addParameter(OAuth20Constants.BYPASS_APPROVAL_PROMPT, Boolean.TRUE.toString()); val model = new HashMap<String, Object>(); model.put("service", svc); model.put("callbackUrl", url.toString()); model.put("serviceName", svc.getName()); model.put("deniedApprovalUrl", svc.getAccessStrategy().getUnauthorizedRedirectUrl()); prepareApprovalViewModel(model, ctx, svc); return getApprovalModelAndView(model); }
java
@SneakyThrows protected ModelAndView redirectToApproveView(final J2EContext ctx, final OAuthRegisteredService svc) { val callbackUrl = ctx.getFullRequestURL(); LOGGER.trace("callbackUrl: [{}]", callbackUrl); val url = new URIBuilder(callbackUrl); url.addParameter(OAuth20Constants.BYPASS_APPROVAL_PROMPT, Boolean.TRUE.toString()); val model = new HashMap<String, Object>(); model.put("service", svc); model.put("callbackUrl", url.toString()); model.put("serviceName", svc.getName()); model.put("deniedApprovalUrl", svc.getAccessStrategy().getUnauthorizedRedirectUrl()); prepareApprovalViewModel(model, ctx, svc); return getApprovalModelAndView(model); }
[ "@", "SneakyThrows", "protected", "ModelAndView", "redirectToApproveView", "(", "final", "J2EContext", "ctx", ",", "final", "OAuthRegisteredService", "svc", ")", "{", "val", "callbackUrl", "=", "ctx", ".", "getFullRequestURL", "(", ")", ";", "LOGGER", ".", "trace", "(", "\"callbackUrl: [{}]\"", ",", "callbackUrl", ")", ";", "val", "url", "=", "new", "URIBuilder", "(", "callbackUrl", ")", ";", "url", ".", "addParameter", "(", "OAuth20Constants", ".", "BYPASS_APPROVAL_PROMPT", ",", "Boolean", ".", "TRUE", ".", "toString", "(", ")", ")", ";", "val", "model", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "model", ".", "put", "(", "\"service\"", ",", "svc", ")", ";", "model", ".", "put", "(", "\"callbackUrl\"", ",", "url", ".", "toString", "(", ")", ")", ";", "model", ".", "put", "(", "\"serviceName\"", ",", "svc", ".", "getName", "(", ")", ")", ";", "model", ".", "put", "(", "\"deniedApprovalUrl\"", ",", "svc", ".", "getAccessStrategy", "(", ")", ".", "getUnauthorizedRedirectUrl", "(", ")", ")", ";", "prepareApprovalViewModel", "(", "model", ",", "ctx", ",", "svc", ")", ";", "return", "getApprovalModelAndView", "(", "model", ")", ";", "}" ]
Redirect to approve view model and view. @param ctx the ctx @param svc the svc @return the model and view
[ "Redirect", "to", "approve", "view", "model", "and", "view", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/views/OAuth20ConsentApprovalViewResolver.java#L66-L81
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java
FastDateFormat.getInstance
public static synchronized FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale) { """ <p>Gets a formatter instance using the specified pattern, time zone and locale.</p> @param pattern {@link java.text.SimpleDateFormat} compatible pattern @param timeZone optional time zone, overrides time zone of formatted date @param locale optional locale, overrides system locale @return a pattern based date/time formatter @throws IllegalArgumentException if pattern is invalid or <code>null</code> """ FastDateFormat emptyFormat = new FastDateFormat(pattern, timeZone, locale); FastDateFormat format = (FastDateFormat) cInstanceCache.get(emptyFormat); if (format == null) { format = emptyFormat; format.init(); // convert shell format into usable one cInstanceCache.put(format, format); // this is OK! } return format; }
java
public static synchronized FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale) { FastDateFormat emptyFormat = new FastDateFormat(pattern, timeZone, locale); FastDateFormat format = (FastDateFormat) cInstanceCache.get(emptyFormat); if (format == null) { format = emptyFormat; format.init(); // convert shell format into usable one cInstanceCache.put(format, format); // this is OK! } return format; }
[ "public", "static", "synchronized", "FastDateFormat", "getInstance", "(", "String", "pattern", ",", "TimeZone", "timeZone", ",", "Locale", "locale", ")", "{", "FastDateFormat", "emptyFormat", "=", "new", "FastDateFormat", "(", "pattern", ",", "timeZone", ",", "locale", ")", ";", "FastDateFormat", "format", "=", "(", "FastDateFormat", ")", "cInstanceCache", ".", "get", "(", "emptyFormat", ")", ";", "if", "(", "format", "==", "null", ")", "{", "format", "=", "emptyFormat", ";", "format", ".", "init", "(", ")", ";", "// convert shell format into usable one\r", "cInstanceCache", ".", "put", "(", "format", ",", "format", ")", ";", "// this is OK!\r", "}", "return", "format", ";", "}" ]
<p>Gets a formatter instance using the specified pattern, time zone and locale.</p> @param pattern {@link java.text.SimpleDateFormat} compatible pattern @param timeZone optional time zone, overrides time zone of formatted date @param locale optional locale, overrides system locale @return a pattern based date/time formatter @throws IllegalArgumentException if pattern is invalid or <code>null</code>
[ "<p", ">", "Gets", "a", "formatter", "instance", "using", "the", "specified", "pattern", "time", "zone", "and", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java#L213-L222
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java
FeatureScopes.createLocalVariableScope
protected IScope createLocalVariableScope(EObject featureCall, IScope parent, IFeatureScopeSession session, IResolvedTypes resolvedTypes) { """ Creates a scope for the local variables that have been registered in the given session. @param featureCall the feature call that is currently processed by the scoping infrastructure @param parent the parent scope. Is never null. @param session the currently known scope session. Is never null. @param resolvedTypes may be used by inheritors. """ return new LocalVariableScope(parent, session, asAbstractFeatureCall(featureCall)); }
java
protected IScope createLocalVariableScope(EObject featureCall, IScope parent, IFeatureScopeSession session, IResolvedTypes resolvedTypes) { return new LocalVariableScope(parent, session, asAbstractFeatureCall(featureCall)); }
[ "protected", "IScope", "createLocalVariableScope", "(", "EObject", "featureCall", ",", "IScope", "parent", ",", "IFeatureScopeSession", "session", ",", "IResolvedTypes", "resolvedTypes", ")", "{", "return", "new", "LocalVariableScope", "(", "parent", ",", "session", ",", "asAbstractFeatureCall", "(", "featureCall", ")", ")", ";", "}" ]
Creates a scope for the local variables that have been registered in the given session. @param featureCall the feature call that is currently processed by the scoping infrastructure @param parent the parent scope. Is never null. @param session the currently known scope session. Is never null. @param resolvedTypes may be used by inheritors.
[ "Creates", "a", "scope", "for", "the", "local", "variables", "that", "have", "been", "registered", "in", "the", "given", "session", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java#L628-L630
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/TopoGraph.java
TopoGraph.querySegmentXY
void querySegmentXY(int half_edge, SegmentBuffer outBuffer) { """ Queries segment for the edge (only xy coordinates, no attributes) """ outBuffer.createLine(); Segment seg = outBuffer.get(); Point2D pt = new Point2D(); getHalfEdgeFromXY(half_edge, pt); seg.setStartXY(pt); getHalfEdgeToXY(half_edge, pt); seg.setEndXY(pt); }
java
void querySegmentXY(int half_edge, SegmentBuffer outBuffer) { outBuffer.createLine(); Segment seg = outBuffer.get(); Point2D pt = new Point2D(); getHalfEdgeFromXY(half_edge, pt); seg.setStartXY(pt); getHalfEdgeToXY(half_edge, pt); seg.setEndXY(pt); }
[ "void", "querySegmentXY", "(", "int", "half_edge", ",", "SegmentBuffer", "outBuffer", ")", "{", "outBuffer", ".", "createLine", "(", ")", ";", "Segment", "seg", "=", "outBuffer", ".", "get", "(", ")", ";", "Point2D", "pt", "=", "new", "Point2D", "(", ")", ";", "getHalfEdgeFromXY", "(", "half_edge", ",", "pt", ")", ";", "seg", ".", "setStartXY", "(", "pt", ")", ";", "getHalfEdgeToXY", "(", "half_edge", ",", "pt", ")", ";", "seg", ".", "setEndXY", "(", "pt", ")", ";", "}" ]
Queries segment for the edge (only xy coordinates, no attributes)
[ "Queries", "segment", "for", "the", "edge", "(", "only", "xy", "coordinates", "no", "attributes", ")" ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/TopoGraph.java#L2490-L2498
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.validateMoveResourcesAsync
public Observable<Void> validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { """ Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. @param parameters Parameters for moving resources. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { return validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "validateMoveResourcesAsync", "(", "String", "sourceResourceGroupName", ",", "ResourcesMoveInfo", "parameters", ")", "{", "return", "validateMoveResourcesWithServiceResponseAsync", "(", "sourceResourceGroupName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Validates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. @param parameters Parameters for moving resources. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Validates", "whether", "resources", "can", "be", "moved", "from", "one", "resource", "group", "to", "another", "resource", "group", ".", "This", "operation", "checks", "whether", "the", "specified", "resources", "can", "be", "moved", "to", "the", "target", ".", "The", "resources", "to", "move", "must", "be", "in", "the", "same", "source", "resource", "group", ".", "The", "target", "resource", "group", "may", "be", "in", "a", "different", "subscription", ".", "If", "validation", "succeeds", "it", "returns", "HTTP", "response", "code", "204", "(", "no", "content", ")", ".", "If", "validation", "fails", "it", "returns", "HTTP", "response", "code", "409", "(", "Conflict", ")", "with", "an", "error", "message", ".", "Retrieve", "the", "URL", "in", "the", "Location", "header", "value", "to", "check", "the", "result", "of", "the", "long", "-", "running", "operation", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L609-L616
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/data/LibDaiFgIo.java
LibDaiFgIo.libDaiIxToConfigId
public static int libDaiIxToConfigId(int libDaiIx, int[] dims, Var[] varArray, VarSet vs) { """ converts the index to the index used in pacaya the difference is that the vars in vs may be reordered compared to varArray and that pacaya representation has the leftmost v in vs be the slowest changing while libdai has the rightmost in varArray be the slowest changing; dims and varArray are assumed to both correspond to the order of the variables that is left to right (slowest changing last); the resulting index will respect the order of var in vs which is vs.get(0) as the slowest changing. """ int[] config = Tensor.unravelIndexMatlab(libDaiIx, dims); VarConfig vc = new VarConfig(varArray, config); return vc.getConfigIndexOfSubset(vs); }
java
public static int libDaiIxToConfigId(int libDaiIx, int[] dims, Var[] varArray, VarSet vs) { int[] config = Tensor.unravelIndexMatlab(libDaiIx, dims); VarConfig vc = new VarConfig(varArray, config); return vc.getConfigIndexOfSubset(vs); }
[ "public", "static", "int", "libDaiIxToConfigId", "(", "int", "libDaiIx", ",", "int", "[", "]", "dims", ",", "Var", "[", "]", "varArray", ",", "VarSet", "vs", ")", "{", "int", "[", "]", "config", "=", "Tensor", ".", "unravelIndexMatlab", "(", "libDaiIx", ",", "dims", ")", ";", "VarConfig", "vc", "=", "new", "VarConfig", "(", "varArray", ",", "config", ")", ";", "return", "vc", ".", "getConfigIndexOfSubset", "(", "vs", ")", ";", "}" ]
converts the index to the index used in pacaya the difference is that the vars in vs may be reordered compared to varArray and that pacaya representation has the leftmost v in vs be the slowest changing while libdai has the rightmost in varArray be the slowest changing; dims and varArray are assumed to both correspond to the order of the variables that is left to right (slowest changing last); the resulting index will respect the order of var in vs which is vs.get(0) as the slowest changing.
[ "converts", "the", "index", "to", "the", "index", "used", "in", "pacaya", "the", "difference", "is", "that", "the", "vars", "in", "vs", "may", "be", "reordered", "compared", "to", "varArray", "and", "that", "pacaya", "representation", "has", "the", "leftmost", "v", "in", "vs", "be", "the", "slowest", "changing", "while", "libdai", "has", "the", "rightmost", "in", "varArray", "be", "the", "slowest", "changing", ";", "dims", "and", "varArray", "are", "assumed", "to", "both", "correspond", "to", "the", "order", "of", "the", "variables", "that", "is", "left", "to", "right", "(", "slowest", "changing", "last", ")", ";", "the", "resulting", "index", "will", "respect", "the", "order", "of", "var", "in", "vs", "which", "is", "vs", ".", "get", "(", "0", ")", "as", "the", "slowest", "changing", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/data/LibDaiFgIo.java#L148-L152
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java
JpaControllerManagement.cancelAction
@Override @Modifying @Transactional(isolation = Isolation.READ_COMMITTED) public Action cancelAction(final long actionId) { """ Cancels given {@link Action} for this {@link Target}. The method will immediately add a {@link Status#CANCELED} status to the action. However, it might be possible that the controller will continue to work on the cancelation. The controller needs to acknowledge or reject the cancelation using {@link DdiRootController#postCancelActionFeedback}. @param actionId to be canceled @return canceled {@link Action} @throws CancelActionNotAllowedException in case the given action is not active or is already canceled @throws EntityNotFoundException if action with given actionId does not exist. """ LOG.debug("cancelAction({})", actionId); final JpaAction action = actionRepository.findById(actionId) .orElseThrow(() -> new EntityNotFoundException(Action.class, actionId)); if (action.isCancelingOrCanceled()) { throw new CancelActionNotAllowedException("Actions in canceling or canceled state cannot be canceled"); } if (action.isActive()) { LOG.debug("action ({}) was still active. Change to {}.", action, Status.CANCELING); action.setStatus(Status.CANCELING); // document that the status has been retrieved actionStatusRepository.save(new JpaActionStatus(action, Status.CANCELING, System.currentTimeMillis(), "manual cancelation requested")); final Action saveAction = actionRepository.save(action); cancelAssignDistributionSetEvent((JpaTarget) action.getTarget(), action.getId()); return saveAction; } else { throw new CancelActionNotAllowedException( "Action [id: " + action.getId() + "] is not active and cannot be canceled"); } }
java
@Override @Modifying @Transactional(isolation = Isolation.READ_COMMITTED) public Action cancelAction(final long actionId) { LOG.debug("cancelAction({})", actionId); final JpaAction action = actionRepository.findById(actionId) .orElseThrow(() -> new EntityNotFoundException(Action.class, actionId)); if (action.isCancelingOrCanceled()) { throw new CancelActionNotAllowedException("Actions in canceling or canceled state cannot be canceled"); } if (action.isActive()) { LOG.debug("action ({}) was still active. Change to {}.", action, Status.CANCELING); action.setStatus(Status.CANCELING); // document that the status has been retrieved actionStatusRepository.save(new JpaActionStatus(action, Status.CANCELING, System.currentTimeMillis(), "manual cancelation requested")); final Action saveAction = actionRepository.save(action); cancelAssignDistributionSetEvent((JpaTarget) action.getTarget(), action.getId()); return saveAction; } else { throw new CancelActionNotAllowedException( "Action [id: " + action.getId() + "] is not active and cannot be canceled"); } }
[ "@", "Override", "@", "Modifying", "@", "Transactional", "(", "isolation", "=", "Isolation", ".", "READ_COMMITTED", ")", "public", "Action", "cancelAction", "(", "final", "long", "actionId", ")", "{", "LOG", ".", "debug", "(", "\"cancelAction({})\"", ",", "actionId", ")", ";", "final", "JpaAction", "action", "=", "actionRepository", ".", "findById", "(", "actionId", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "EntityNotFoundException", "(", "Action", ".", "class", ",", "actionId", ")", ")", ";", "if", "(", "action", ".", "isCancelingOrCanceled", "(", ")", ")", "{", "throw", "new", "CancelActionNotAllowedException", "(", "\"Actions in canceling or canceled state cannot be canceled\"", ")", ";", "}", "if", "(", "action", ".", "isActive", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"action ({}) was still active. Change to {}.\"", ",", "action", ",", "Status", ".", "CANCELING", ")", ";", "action", ".", "setStatus", "(", "Status", ".", "CANCELING", ")", ";", "// document that the status has been retrieved", "actionStatusRepository", ".", "save", "(", "new", "JpaActionStatus", "(", "action", ",", "Status", ".", "CANCELING", ",", "System", ".", "currentTimeMillis", "(", ")", ",", "\"manual cancelation requested\"", ")", ")", ";", "final", "Action", "saveAction", "=", "actionRepository", ".", "save", "(", "action", ")", ";", "cancelAssignDistributionSetEvent", "(", "(", "JpaTarget", ")", "action", ".", "getTarget", "(", ")", ",", "action", ".", "getId", "(", ")", ")", ";", "return", "saveAction", ";", "}", "else", "{", "throw", "new", "CancelActionNotAllowedException", "(", "\"Action [id: \"", "+", "action", ".", "getId", "(", ")", "+", "\"] is not active and cannot be canceled\"", ")", ";", "}", "}" ]
Cancels given {@link Action} for this {@link Target}. The method will immediately add a {@link Status#CANCELED} status to the action. However, it might be possible that the controller will continue to work on the cancelation. The controller needs to acknowledge or reject the cancelation using {@link DdiRootController#postCancelActionFeedback}. @param actionId to be canceled @return canceled {@link Action} @throws CancelActionNotAllowedException in case the given action is not active or is already canceled @throws EntityNotFoundException if action with given actionId does not exist.
[ "Cancels", "given", "{", "@link", "Action", "}", "for", "this", "{", "@link", "Target", "}", ".", "The", "method", "will", "immediately", "add", "a", "{", "@link", "Status#CANCELED", "}", "status", "to", "the", "action", ".", "However", "it", "might", "be", "possible", "that", "the", "controller", "will", "continue", "to", "work", "on", "the", "cancelation", ".", "The", "controller", "needs", "to", "acknowledge", "or", "reject", "the", "cancelation", "using", "{", "@link", "DdiRootController#postCancelActionFeedback", "}", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java#L1004-L1032
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteNote
public void deleteNote(GitlabIssue issue, GitlabNote noteToDelete) throws IOException { """ Delete an Issue Note @param issue The issue @param noteToDelete The note to delete @throws IOException on gitlab api call error """ deleteNote(String.valueOf(issue.getProjectId()), issue.getId(), noteToDelete); }
java
public void deleteNote(GitlabIssue issue, GitlabNote noteToDelete) throws IOException { deleteNote(String.valueOf(issue.getProjectId()), issue.getId(), noteToDelete); }
[ "public", "void", "deleteNote", "(", "GitlabIssue", "issue", ",", "GitlabNote", "noteToDelete", ")", "throws", "IOException", "{", "deleteNote", "(", "String", ".", "valueOf", "(", "issue", ".", "getProjectId", "(", ")", ")", ",", "issue", ".", "getId", "(", ")", ",", "noteToDelete", ")", ";", "}" ]
Delete an Issue Note @param issue The issue @param noteToDelete The note to delete @throws IOException on gitlab api call error
[ "Delete", "an", "Issue", "Note" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2591-L2593
UrielCh/ovh-java-sdk
ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java
ApiOvhHorizonView.serviceName_domainTrust_POST
public ArrayList<OvhTask> serviceName_domainTrust_POST(String serviceName, String activeDirectoryIP, String dns1, String dns2, String domain) throws IOException { """ Link your Active Directory to your CDI Active Directory REST: POST /horizonView/{serviceName}/domainTrust @param activeDirectoryIP [required] IP of your Active Directory @param domain [required] Domain of your active directory (for example domain.local) @param dns2 [required] IP of your second DNS @param dns1 [required] IP of your first DNS @param serviceName [required] Domain of the service """ String qPath = "/horizonView/{serviceName}/domainTrust"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "activeDirectoryIP", activeDirectoryIP); addBody(o, "dns1", dns1); addBody(o, "dns2", dns2); addBody(o, "domain", domain); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t2); }
java
public ArrayList<OvhTask> serviceName_domainTrust_POST(String serviceName, String activeDirectoryIP, String dns1, String dns2, String domain) throws IOException { String qPath = "/horizonView/{serviceName}/domainTrust"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "activeDirectoryIP", activeDirectoryIP); addBody(o, "dns1", dns1); addBody(o, "dns2", dns2); addBody(o, "domain", domain); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "OvhTask", ">", "serviceName_domainTrust_POST", "(", "String", "serviceName", ",", "String", "activeDirectoryIP", ",", "String", "dns1", ",", "String", "dns2", ",", "String", "domain", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/horizonView/{serviceName}/domainTrust\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"activeDirectoryIP\"", ",", "activeDirectoryIP", ")", ";", "addBody", "(", "o", ",", "\"dns1\"", ",", "dns1", ")", ";", "addBody", "(", "o", ",", "\"dns2\"", ",", "dns2", ")", ";", "addBody", "(", "o", ",", "\"domain\"", ",", "domain", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
Link your Active Directory to your CDI Active Directory REST: POST /horizonView/{serviceName}/domainTrust @param activeDirectoryIP [required] IP of your Active Directory @param domain [required] Domain of your active directory (for example domain.local) @param dns2 [required] IP of your second DNS @param dns1 [required] IP of your first DNS @param serviceName [required] Domain of the service
[ "Link", "your", "Active", "Directory", "to", "your", "CDI", "Active", "Directory" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L381-L391
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getAllContinentTaskID
public void getAllContinentTaskID(int continentID, int floorID, int regionID, int mapID, Callback<List<Integer>> callback) throws NullPointerException { """ For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param continentID {@link Continent#id} @param floorID {@link ContinentFloor#id} @param regionID {@link ContinentRegion#id} @param mapID {@link ContinentMap#id} @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @see ContinentMap.Task continents map task info """ gw2API.getAllContinentTaskIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).enqueue(callback); }
java
public void getAllContinentTaskID(int continentID, int floorID, int regionID, int mapID, Callback<List<Integer>> callback) throws NullPointerException { gw2API.getAllContinentTaskIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).enqueue(callback); }
[ "public", "void", "getAllContinentTaskID", "(", "int", "continentID", ",", "int", "floorID", ",", "int", "regionID", ",", "int", "mapID", ",", "Callback", "<", "List", "<", "Integer", ">", ">", "callback", ")", "throws", "NullPointerException", "{", "gw2API", ".", "getAllContinentTaskIDs", "(", "Integer", ".", "toString", "(", "continentID", ")", ",", "Integer", ".", "toString", "(", "floorID", ")", ",", "Integer", ".", "toString", "(", "regionID", ")", ",", "Integer", ".", "toString", "(", "mapID", ")", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param continentID {@link Continent#id} @param floorID {@link ContinentFloor#id} @param regionID {@link ContinentRegion#id} @param mapID {@link ContinentMap#id} @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @see ContinentMap.Task continents map task info
[ "For", "more", "info", "on", "continents", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "continents", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1212-L1214
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.beginUpdateAsync
public Observable<EventSubscriptionInner> beginUpdateAsync(String scope, String eventSubscriptionName, EventSubscriptionUpdateParameters eventSubscriptionUpdateParameters) { """ Update an event subscription. Asynchronously updates an existing event subscription. @param scope The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param eventSubscriptionName Name of the event subscription to be updated @param eventSubscriptionUpdateParameters Updated event subscription information @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventSubscriptionInner object """ return beginUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionUpdateParameters).map(new Func1<ServiceResponse<EventSubscriptionInner>, EventSubscriptionInner>() { @Override public EventSubscriptionInner call(ServiceResponse<EventSubscriptionInner> response) { return response.body(); } }); }
java
public Observable<EventSubscriptionInner> beginUpdateAsync(String scope, String eventSubscriptionName, EventSubscriptionUpdateParameters eventSubscriptionUpdateParameters) { return beginUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionUpdateParameters).map(new Func1<ServiceResponse<EventSubscriptionInner>, EventSubscriptionInner>() { @Override public EventSubscriptionInner call(ServiceResponse<EventSubscriptionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EventSubscriptionInner", ">", "beginUpdateAsync", "(", "String", "scope", ",", "String", "eventSubscriptionName", ",", "EventSubscriptionUpdateParameters", "eventSubscriptionUpdateParameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "scope", ",", "eventSubscriptionName", ",", "eventSubscriptionUpdateParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "EventSubscriptionInner", ">", ",", "EventSubscriptionInner", ">", "(", ")", "{", "@", "Override", "public", "EventSubscriptionInner", "call", "(", "ServiceResponse", "<", "EventSubscriptionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Update an event subscription. Asynchronously updates an existing event subscription. @param scope The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param eventSubscriptionName Name of the event subscription to be updated @param eventSubscriptionUpdateParameters Updated event subscription information @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventSubscriptionInner object
[ "Update", "an", "event", "subscription", ".", "Asynchronously", "updates", "an", "existing", "event", "subscription", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L672-L679
threerings/nenya
core/src/main/java/com/threerings/media/sprite/ImageSprite.java
ImageSprite.accomodateFrame
protected void accomodateFrame (int frameIdx, int width, int height) { """ Must adjust the bounds to accommodate the our new frame. This includes changing the width and height to reflect the size of the new frame and also updating the render origin (if necessary) and calling {@link Sprite#updateRenderOrigin} to reflect those changes in the sprite's bounds. @param frameIdx the index of our new frame. @param width the width of the new frame. @param height the height of the new frame. """ _bounds.width = width; _bounds.height = height; }
java
protected void accomodateFrame (int frameIdx, int width, int height) { _bounds.width = width; _bounds.height = height; }
[ "protected", "void", "accomodateFrame", "(", "int", "frameIdx", ",", "int", "width", ",", "int", "height", ")", "{", "_bounds", ".", "width", "=", "width", ";", "_bounds", ".", "height", "=", "height", ";", "}" ]
Must adjust the bounds to accommodate the our new frame. This includes changing the width and height to reflect the size of the new frame and also updating the render origin (if necessary) and calling {@link Sprite#updateRenderOrigin} to reflect those changes in the sprite's bounds. @param frameIdx the index of our new frame. @param width the width of the new frame. @param height the height of the new frame.
[ "Must", "adjust", "the", "bounds", "to", "accommodate", "the", "our", "new", "frame", ".", "This", "includes", "changing", "the", "width", "and", "height", "to", "reflect", "the", "size", "of", "the", "new", "frame", "and", "also", "updating", "the", "render", "origin", "(", "if", "necessary", ")", "and", "calling", "{", "@link", "Sprite#updateRenderOrigin", "}", "to", "reflect", "those", "changes", "in", "the", "sprite", "s", "bounds", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/ImageSprite.java#L227-L231
spockframework/spock
spock-core/src/main/java/org/spockframework/util/ReflectionUtil.java
ReflectionUtil.getMethodByName
@Nullable public static Method getMethodByName(Class<?> clazz, String name) { """ Finds a public method with the given name declared in the given class/interface or one of its super classes/interfaces. If multiple such methods exists, it is undefined which one is returned. """ for (Method method : clazz.getMethods()) if (method.getName().equals(name)) return method; return null; }
java
@Nullable public static Method getMethodByName(Class<?> clazz, String name) { for (Method method : clazz.getMethods()) if (method.getName().equals(name)) return method; return null; }
[ "@", "Nullable", "public", "static", "Method", "getMethodByName", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ")", "{", "for", "(", "Method", "method", ":", "clazz", ".", "getMethods", "(", ")", ")", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", ")", "return", "method", ";", "return", "null", ";", "}" ]
Finds a public method with the given name declared in the given class/interface or one of its super classes/interfaces. If multiple such methods exists, it is undefined which one is returned.
[ "Finds", "a", "public", "method", "with", "the", "given", "name", "declared", "in", "the", "given", "class", "/", "interface", "or", "one", "of", "its", "super", "classes", "/", "interfaces", ".", "If", "multiple", "such", "methods", "exists", "it", "is", "undefined", "which", "one", "is", "returned", "." ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/util/ReflectionUtil.java#L118-L125
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.setLookAlong
public Matrix4x3d setLookAlong(Vector3dc dir, Vector3dc up) { """ Set this matrix to a rotation transformation to make <code>-z</code> point along <code>dir</code>. <p> This is equivalent to calling {@link #setLookAt(Vector3dc, Vector3dc, Vector3dc) setLookAt()} with <code>eye = (0, 0, 0)</code> and <code>center = dir</code>. <p> In order to apply the lookalong transformation to any previous existing transformation, use {@link #lookAlong(Vector3dc, Vector3dc)}. @see #setLookAlong(Vector3dc, Vector3dc) @see #lookAlong(Vector3dc, Vector3dc) @param dir the direction in space to look along @param up the direction of 'up' @return this """ return setLookAlong(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
java
public Matrix4x3d setLookAlong(Vector3dc dir, Vector3dc up) { return setLookAlong(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
[ "public", "Matrix4x3d", "setLookAlong", "(", "Vector3dc", "dir", ",", "Vector3dc", "up", ")", "{", "return", "setLookAlong", "(", "dir", ".", "x", "(", ")", ",", "dir", ".", "y", "(", ")", ",", "dir", ".", "z", "(", ")", ",", "up", ".", "x", "(", ")", ",", "up", ".", "y", "(", ")", ",", "up", ".", "z", "(", ")", ")", ";", "}" ]
Set this matrix to a rotation transformation to make <code>-z</code> point along <code>dir</code>. <p> This is equivalent to calling {@link #setLookAt(Vector3dc, Vector3dc, Vector3dc) setLookAt()} with <code>eye = (0, 0, 0)</code> and <code>center = dir</code>. <p> In order to apply the lookalong transformation to any previous existing transformation, use {@link #lookAlong(Vector3dc, Vector3dc)}. @see #setLookAlong(Vector3dc, Vector3dc) @see #lookAlong(Vector3dc, Vector3dc) @param dir the direction in space to look along @param up the direction of 'up' @return this
[ "Set", "this", "matrix", "to", "a", "rotation", "transformation", "to", "make", "<code", ">", "-", "z<", "/", "code", ">", "point", "along", "<code", ">", "dir<", "/", "code", ">", ".", "<p", ">", "This", "is", "equivalent", "to", "calling", "{", "@link", "#setLookAt", "(", "Vector3dc", "Vector3dc", "Vector3dc", ")", "setLookAt", "()", "}", "with", "<code", ">", "eye", "=", "(", "0", "0", "0", ")", "<", "/", "code", ">", "and", "<code", ">", "center", "=", "dir<", "/", "code", ">", ".", "<p", ">", "In", "order", "to", "apply", "the", "lookalong", "transformation", "to", "any", "previous", "existing", "transformation", "use", "{", "@link", "#lookAlong", "(", "Vector3dc", "Vector3dc", ")", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L7985-L7987
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/Stream.java
Stream.parallelConcatt
public static <T> Stream<T> parallelConcatt(final Collection<? extends Iterator<? extends T>> c) { """ Put the stream in try-catch to stop the back-end reading thread if error happens <br /> <code> try (Stream<Integer> stream = Stream.parallelConcat(a,b, ...)) { stream.forEach(N::println); } </code> @param c @return """ return parallelConcatt(c, DEFAULT_READING_THREAD_NUM); }
java
public static <T> Stream<T> parallelConcatt(final Collection<? extends Iterator<? extends T>> c) { return parallelConcatt(c, DEFAULT_READING_THREAD_NUM); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "parallelConcatt", "(", "final", "Collection", "<", "?", "extends", "Iterator", "<", "?", "extends", "T", ">", ">", "c", ")", "{", "return", "parallelConcatt", "(", "c", ",", "DEFAULT_READING_THREAD_NUM", ")", ";", "}" ]
Put the stream in try-catch to stop the back-end reading thread if error happens <br /> <code> try (Stream<Integer> stream = Stream.parallelConcat(a,b, ...)) { stream.forEach(N::println); } </code> @param c @return
[ "Put", "the", "stream", "in", "try", "-", "catch", "to", "stop", "the", "back", "-", "end", "reading", "thread", "if", "error", "happens", "<br", "/", ">", "<code", ">", "try", "(", "Stream<Integer", ">", "stream", "=", "Stream", ".", "parallelConcat", "(", "a", "b", "...", "))", "{", "stream", ".", "forEach", "(", "N", "::", "println", ")", ";", "}", "<", "/", "code", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Stream.java#L4391-L4393
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java
ClustersInner.listSkusByResource
public List<AzureResourceSkuInner> listSkusByResource(String resourceGroupName, String clusterName) { """ Returns the SKUs available for the provided resource. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @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 List&lt;AzureResourceSkuInner&gt; object if successful. """ return listSkusByResourceWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); }
java
public List<AzureResourceSkuInner> listSkusByResource(String resourceGroupName, String clusterName) { return listSkusByResourceWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); }
[ "public", "List", "<", "AzureResourceSkuInner", ">", "listSkusByResource", "(", "String", "resourceGroupName", ",", "String", "clusterName", ")", "{", "return", "listSkusByResourceWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Returns the SKUs available for the provided resource. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @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 List&lt;AzureResourceSkuInner&gt; object if successful.
[ "Returns", "the", "SKUs", "available", "for", "the", "provided", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L1377-L1379
mozilla/rhino
src/org/mozilla/javascript/NativeArray.java
NativeArray.deleteElem
private static void deleteElem(Scriptable target, long index) { """ /* Utility functions to encapsulate index > Integer.MAX_VALUE handling. Also avoids unnecessary object creation that would be necessary to use the general ScriptRuntime.get/setElem functions... though this is probably premature optimization. """ int i = (int)index; if (i == index) { target.delete(i); } else { target.delete(Long.toString(index)); } }
java
private static void deleteElem(Scriptable target, long index) { int i = (int)index; if (i == index) { target.delete(i); } else { target.delete(Long.toString(index)); } }
[ "private", "static", "void", "deleteElem", "(", "Scriptable", "target", ",", "long", "index", ")", "{", "int", "i", "=", "(", "int", ")", "index", ";", "if", "(", "i", "==", "index", ")", "{", "target", ".", "delete", "(", "i", ")", ";", "}", "else", "{", "target", ".", "delete", "(", "Long", ".", "toString", "(", "index", ")", ")", ";", "}", "}" ]
/* Utility functions to encapsulate index > Integer.MAX_VALUE handling. Also avoids unnecessary object creation that would be necessary to use the general ScriptRuntime.get/setElem functions... though this is probably premature optimization.
[ "/", "*", "Utility", "functions", "to", "encapsulate", "index", ">", "Integer", ".", "MAX_VALUE", "handling", ".", "Also", "avoids", "unnecessary", "object", "creation", "that", "would", "be", "necessary", "to", "use", "the", "general", "ScriptRuntime", ".", "get", "/", "setElem", "functions", "...", "though", "this", "is", "probably", "premature", "optimization", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeArray.java#L780-L784
p6spy/p6spy
src/main/java/com/p6spy/engine/common/ConnectionInformation.java
ConnectionInformation.fromPooledConnection
public static ConnectionInformation fromPooledConnection(PooledConnection pooledConnection, Connection connection, long timeToGetConnectionNs) { """ Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a {@link PooledConnection} @param pooledConnection the {@link PooledConnection} which created the {@link #connection} @param connection the {@link #connection} created by the {@link #pooledConnection} @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds @return a new {@link ConnectionInformation} instance """ final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.pooledConnection = pooledConnection; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
java
public static ConnectionInformation fromPooledConnection(PooledConnection pooledConnection, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.pooledConnection = pooledConnection; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
[ "public", "static", "ConnectionInformation", "fromPooledConnection", "(", "PooledConnection", "pooledConnection", ",", "Connection", "connection", ",", "long", "timeToGetConnectionNs", ")", "{", "final", "ConnectionInformation", "connectionInformation", "=", "new", "ConnectionInformation", "(", ")", ";", "connectionInformation", ".", "pooledConnection", "=", "pooledConnection", ";", "connectionInformation", ".", "connection", "=", "connection", ";", "connectionInformation", ".", "timeToGetConnectionNs", "=", "timeToGetConnectionNs", ";", "return", "connectionInformation", ";", "}" ]
Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a {@link PooledConnection} @param pooledConnection the {@link PooledConnection} which created the {@link #connection} @param connection the {@link #connection} created by the {@link #pooledConnection} @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds @return a new {@link ConnectionInformation} instance
[ "Creates", "a", "new", "{", "@link", "ConnectionInformation", "}", "instance", "for", "a", "{", "@link", "Connection", "}", "which", "has", "been", "obtained", "via", "a", "{", "@link", "PooledConnection", "}" ]
train
https://github.com/p6spy/p6spy/blob/c3c0fecd6e26156eecf90a90901c3c1c8a7dbdf2/src/main/java/com/p6spy/engine/common/ConnectionInformation.java#L89-L95
fuinorg/objects4j
src/main/java/org/fuin/objects4j/vo/HourRange.java
HourRange.normalize
public final List<HourRange> normalize() { """ If the hour range represents two different days, this method returns two hour ranges, one for each day. Example: '18:00-03:00' will be splitted into '18:00-24:00' and '00:00-03:00'. @return This range or range for today and tomorrow. """ final List<HourRange> ranges = new ArrayList<>(); if (this.from.toMinutes() > this.to.toMinutes()) { ranges.add(new HourRange(this.from, new Hour(24, 00))); ranges.add(new HourRange(new Hour(0, 0), this.to)); } else { ranges.add(this); } return ranges; }
java
public final List<HourRange> normalize() { final List<HourRange> ranges = new ArrayList<>(); if (this.from.toMinutes() > this.to.toMinutes()) { ranges.add(new HourRange(this.from, new Hour(24, 00))); ranges.add(new HourRange(new Hour(0, 0), this.to)); } else { ranges.add(this); } return ranges; }
[ "public", "final", "List", "<", "HourRange", ">", "normalize", "(", ")", "{", "final", "List", "<", "HourRange", ">", "ranges", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "this", ".", "from", ".", "toMinutes", "(", ")", ">", "this", ".", "to", ".", "toMinutes", "(", ")", ")", "{", "ranges", ".", "add", "(", "new", "HourRange", "(", "this", ".", "from", ",", "new", "Hour", "(", "24", ",", "00", ")", ")", ")", ";", "ranges", ".", "add", "(", "new", "HourRange", "(", "new", "Hour", "(", "0", ",", "0", ")", ",", "this", ".", "to", ")", ")", ";", "}", "else", "{", "ranges", ".", "add", "(", "this", ")", ";", "}", "return", "ranges", ";", "}" ]
If the hour range represents two different days, this method returns two hour ranges, one for each day. Example: '18:00-03:00' will be splitted into '18:00-24:00' and '00:00-03:00'. @return This range or range for today and tomorrow.
[ "If", "the", "hour", "range", "represents", "two", "different", "days", "this", "method", "returns", "two", "hour", "ranges", "one", "for", "each", "day", ".", "Example", ":", "18", ":", "00", "-", "03", ":", "00", "will", "be", "splitted", "into", "18", ":", "00", "-", "24", ":", "00", "and", "00", ":", "00", "-", "03", ":", "00", "." ]
train
https://github.com/fuinorg/objects4j/blob/e7f278b5bae073ebb6a76053650571c718f36246/src/main/java/org/fuin/objects4j/vo/HourRange.java#L193-L202
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java
FaceListsImpl.updateAsync
public Observable<Void> updateAsync(String faceListId, UpdateFaceListsOptionalParameter updateOptionalParameter) { """ Update information of a face list. @param faceListId Id referencing a particular face list. @param updateOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return updateWithServiceResponseAsync(faceListId, updateOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> updateAsync(String faceListId, UpdateFaceListsOptionalParameter updateOptionalParameter) { return updateWithServiceResponseAsync(faceListId, updateOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "updateAsync", "(", "String", "faceListId", ",", "UpdateFaceListsOptionalParameter", "updateOptionalParameter", ")", "{", "return", "updateWithServiceResponseAsync", "(", "faceListId", ",", "updateOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Update information of a face list. @param faceListId Id referencing a particular face list. @param updateOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Update", "information", "of", "a", "face", "list", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L383-L390
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/handlers/HandlerOperations.java
HandlerOperations.enableHandler
private static void enableHandler(final LogContextConfiguration configuration, final String handlerName) { """ Enables the handler if it was previously disabled. <p/> If it was not previously disable, nothing happens. @param configuration the log context configuration. @param handlerName the name of the handler to enable. """ final HandlerConfiguration handlerConfiguration = configuration.getHandlerConfiguration(handlerName); try { handlerConfiguration.setPropertyValueString("enabled", "true"); return; } catch (IllegalArgumentException e) { // do nothing } final Map<String, String> disableHandlers = configuration.getLogContext().getAttachment(CommonAttributes.ROOT_LOGGER_NAME, DISABLED_HANDLERS_KEY); if (disableHandlers != null && disableHandlers.containsKey(handlerName)) { synchronized (HANDLER_LOCK) { final String filter = disableHandlers.get(handlerName); handlerConfiguration.setFilter(filter); disableHandlers.remove(handlerName); } } }
java
private static void enableHandler(final LogContextConfiguration configuration, final String handlerName) { final HandlerConfiguration handlerConfiguration = configuration.getHandlerConfiguration(handlerName); try { handlerConfiguration.setPropertyValueString("enabled", "true"); return; } catch (IllegalArgumentException e) { // do nothing } final Map<String, String> disableHandlers = configuration.getLogContext().getAttachment(CommonAttributes.ROOT_LOGGER_NAME, DISABLED_HANDLERS_KEY); if (disableHandlers != null && disableHandlers.containsKey(handlerName)) { synchronized (HANDLER_LOCK) { final String filter = disableHandlers.get(handlerName); handlerConfiguration.setFilter(filter); disableHandlers.remove(handlerName); } } }
[ "private", "static", "void", "enableHandler", "(", "final", "LogContextConfiguration", "configuration", ",", "final", "String", "handlerName", ")", "{", "final", "HandlerConfiguration", "handlerConfiguration", "=", "configuration", ".", "getHandlerConfiguration", "(", "handlerName", ")", ";", "try", "{", "handlerConfiguration", ".", "setPropertyValueString", "(", "\"enabled\"", ",", "\"true\"", ")", ";", "return", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "// do nothing", "}", "final", "Map", "<", "String", ",", "String", ">", "disableHandlers", "=", "configuration", ".", "getLogContext", "(", ")", ".", "getAttachment", "(", "CommonAttributes", ".", "ROOT_LOGGER_NAME", ",", "DISABLED_HANDLERS_KEY", ")", ";", "if", "(", "disableHandlers", "!=", "null", "&&", "disableHandlers", ".", "containsKey", "(", "handlerName", ")", ")", "{", "synchronized", "(", "HANDLER_LOCK", ")", "{", "final", "String", "filter", "=", "disableHandlers", ".", "get", "(", "handlerName", ")", ";", "handlerConfiguration", ".", "setFilter", "(", "filter", ")", ";", "disableHandlers", ".", "remove", "(", "handlerName", ")", ";", "}", "}", "}" ]
Enables the handler if it was previously disabled. <p/> If it was not previously disable, nothing happens. @param configuration the log context configuration. @param handlerName the name of the handler to enable.
[ "Enables", "the", "handler", "if", "it", "was", "previously", "disabled", ".", "<p", "/", ">", "If", "it", "was", "not", "previously", "disable", "nothing", "happens", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/handlers/HandlerOperations.java#L880-L896
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_soa_GET
public OvhSoa zone_zoneName_soa_GET(String zoneName) throws IOException { """ Get this object properties REST: GET /domain/zone/{zoneName}/soa @param zoneName [required] The internal name of your zone """ String qPath = "/domain/zone/{zoneName}/soa"; StringBuilder sb = path(qPath, zoneName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSoa.class); }
java
public OvhSoa zone_zoneName_soa_GET(String zoneName) throws IOException { String qPath = "/domain/zone/{zoneName}/soa"; StringBuilder sb = path(qPath, zoneName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSoa.class); }
[ "public", "OvhSoa", "zone_zoneName_soa_GET", "(", "String", "zoneName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/soa\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "zoneName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhSoa", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /domain/zone/{zoneName}/soa @param zoneName [required] The internal name of your zone
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L967-L972