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
inkstand-io/scribble
scribble-file/src/main/java/io/inkstand/scribble/rules/builder/TemporaryFileBuilder.java
TemporaryFileBuilder.asZip
public ZipFileBuilder asZip() { """ Indicates the content for the file should be zipped. If only one content reference is provided, the zip will only contain this file. @return the builder """ final ZipFileBuilder zfb = new ZipFileBuilder(folder, filename); if(this.content != null) { zfb.addResource(getContenFileName(), this.content); } return zfb; }
java
public ZipFileBuilder asZip() { final ZipFileBuilder zfb = new ZipFileBuilder(folder, filename); if(this.content != null) { zfb.addResource(getContenFileName(), this.content); } return zfb; }
[ "public", "ZipFileBuilder", "asZip", "(", ")", "{", "final", "ZipFileBuilder", "zfb", "=", "new", "ZipFileBuilder", "(", "folder", ",", "filename", ")", ";", "if", "(", "this", ".", "content", "!=", "null", ")", "{", "zfb", ".", "addResource", "(", "getContenFileName", "(", ")", ",", "this", ".", "content", ")", ";", "}", "return", "zfb", ";", "}" ]
Indicates the content for the file should be zipped. If only one content reference is provided, the zip will only contain this file. @return the builder
[ "Indicates", "the", "content", "for", "the", "file", "should", "be", "zipped", ".", "If", "only", "one", "content", "reference", "is", "provided", "the", "zip", "will", "only", "contain", "this", "file", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-file/src/main/java/io/inkstand/scribble/rules/builder/TemporaryFileBuilder.java#L100-L106
b3dgs/lionengine
lionengine-game/src/it/java/com/b3dgs/lionengine/game/it/background/Foreground.java
Foreground.setScreenSize
public final void setScreenSize(int width, int height) { """ Called when the resolution changed. @param width The new width. @param height The new height. """ screenWidth = width; screenHeight = height; final double scaleH = width / (double) Scene.NATIVE.getWidth(); final double scaleV = height / (double) Scene.NATIVE.getHeight(); this.scaleH = scaleH; this.scaleV = scaleV; primary.updateMainY(); secondary.updateMainY(); }
java
public final void setScreenSize(int width, int height) { screenWidth = width; screenHeight = height; final double scaleH = width / (double) Scene.NATIVE.getWidth(); final double scaleV = height / (double) Scene.NATIVE.getHeight(); this.scaleH = scaleH; this.scaleV = scaleV; primary.updateMainY(); secondary.updateMainY(); }
[ "public", "final", "void", "setScreenSize", "(", "int", "width", ",", "int", "height", ")", "{", "screenWidth", "=", "width", ";", "screenHeight", "=", "height", ";", "final", "double", "scaleH", "=", "width", "/", "(", "double", ")", "Scene", ".", "NATIVE", ".", "getWidth", "(", ")", ";", "final", "double", "scaleV", "=", "height", "/", "(", "double", ")", "Scene", ".", "NATIVE", ".", "getHeight", "(", ")", ";", "this", ".", "scaleH", "=", "scaleH", ";", "this", ".", "scaleV", "=", "scaleV", ";", "primary", ".", "updateMainY", "(", ")", ";", "secondary", ".", "updateMainY", "(", ")", ";", "}" ]
Called when the resolution changed. @param width The new width. @param height The new height.
[ "Called", "when", "the", "resolution", "changed", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/it/java/com/b3dgs/lionengine/game/it/background/Foreground.java#L105-L115
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.wrapLine
private static String wrapLine(final String givenLine, final String newline, final int wrapColumn) { """ Wraps a single line of text. Called by wrapText(). I can't think of any good reason for exposing this to the public, since wrapText should always be used AFAIK. @param line A line which is in need of word-wrapping. @param newline The characters that define a newline. @param wrapColumn The column to wrap the words at. @return A line with newlines inserted. """ final StringBuilder wrappedLine = new StringBuilder(); String line = givenLine; while (line.length() > wrapColumn) { int spaceToWrapAt = line.lastIndexOf(' ', wrapColumn); if (spaceToWrapAt >= 0) { wrappedLine.append(line.substring(0, spaceToWrapAt)); wrappedLine.append(newline); line = line.substring(spaceToWrapAt + 1); } else { // This must be a really long word or URL. Pass it // through unchanged even though it's longer than the // wrapColumn would allow. This behavior could be // dependent on a parameter for those situations when // someone wants long words broken at line length. spaceToWrapAt = line.indexOf(' ', wrapColumn); if (spaceToWrapAt >= 0) { wrappedLine.append(line.substring(0, spaceToWrapAt)); wrappedLine.append(newline); line = line.substring(spaceToWrapAt + 1); } else { wrappedLine.append(line); line = ""; } } } // Whatever is left in line is short enough to just pass through, // just like a small small kidney stone wrappedLine.append(line); return wrappedLine.toString(); }
java
private static String wrapLine(final String givenLine, final String newline, final int wrapColumn) { final StringBuilder wrappedLine = new StringBuilder(); String line = givenLine; while (line.length() > wrapColumn) { int spaceToWrapAt = line.lastIndexOf(' ', wrapColumn); if (spaceToWrapAt >= 0) { wrappedLine.append(line.substring(0, spaceToWrapAt)); wrappedLine.append(newline); line = line.substring(spaceToWrapAt + 1); } else { // This must be a really long word or URL. Pass it // through unchanged even though it's longer than the // wrapColumn would allow. This behavior could be // dependent on a parameter for those situations when // someone wants long words broken at line length. spaceToWrapAt = line.indexOf(' ', wrapColumn); if (spaceToWrapAt >= 0) { wrappedLine.append(line.substring(0, spaceToWrapAt)); wrappedLine.append(newline); line = line.substring(spaceToWrapAt + 1); } else { wrappedLine.append(line); line = ""; } } } // Whatever is left in line is short enough to just pass through, // just like a small small kidney stone wrappedLine.append(line); return wrappedLine.toString(); }
[ "private", "static", "String", "wrapLine", "(", "final", "String", "givenLine", ",", "final", "String", "newline", ",", "final", "int", "wrapColumn", ")", "{", "final", "StringBuilder", "wrappedLine", "=", "new", "StringBuilder", "(", ")", ";", "String", "line", "=", "givenLine", ";", "while", "(", "line", ".", "length", "(", ")", ">", "wrapColumn", ")", "{", "int", "spaceToWrapAt", "=", "line", ".", "lastIndexOf", "(", "'", "'", ",", "wrapColumn", ")", ";", "if", "(", "spaceToWrapAt", ">=", "0", ")", "{", "wrappedLine", ".", "append", "(", "line", ".", "substring", "(", "0", ",", "spaceToWrapAt", ")", ")", ";", "wrappedLine", ".", "append", "(", "newline", ")", ";", "line", "=", "line", ".", "substring", "(", "spaceToWrapAt", "+", "1", ")", ";", "}", "else", "{", "// This must be a really long word or URL. Pass it\r", "// through unchanged even though it's longer than the\r", "// wrapColumn would allow. This behavior could be\r", "// dependent on a parameter for those situations when\r", "// someone wants long words broken at line length.\r", "spaceToWrapAt", "=", "line", ".", "indexOf", "(", "'", "'", ",", "wrapColumn", ")", ";", "if", "(", "spaceToWrapAt", ">=", "0", ")", "{", "wrappedLine", ".", "append", "(", "line", ".", "substring", "(", "0", ",", "spaceToWrapAt", ")", ")", ";", "wrappedLine", ".", "append", "(", "newline", ")", ";", "line", "=", "line", ".", "substring", "(", "spaceToWrapAt", "+", "1", ")", ";", "}", "else", "{", "wrappedLine", ".", "append", "(", "line", ")", ";", "line", "=", "\"\"", ";", "}", "}", "}", "// Whatever is left in line is short enough to just pass through,\r", "// just like a small small kidney stone\r", "wrappedLine", ".", "append", "(", "line", ")", ";", "return", "wrappedLine", ".", "toString", "(", ")", ";", "}" ]
Wraps a single line of text. Called by wrapText(). I can't think of any good reason for exposing this to the public, since wrapText should always be used AFAIK. @param line A line which is in need of word-wrapping. @param newline The characters that define a newline. @param wrapColumn The column to wrap the words at. @return A line with newlines inserted.
[ "Wraps", "a", "single", "line", "of", "text", ".", "Called", "by", "wrapText", "()", ".", "I", "can", "t", "think", "of", "any", "good", "reason", "for", "exposing", "this", "to", "the", "public", "since", "wrapText", "should", "always", "be", "used", "AFAIK", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L220-L255
greenrobot/essentials
java-essentials/src/main/java/org/greenrobot/essentials/io/IoUtils.java
IoUtils.copyAllBytes
public static int copyAllBytes(InputStream in, OutputStream out) throws IOException { """ Copies all available data from in to out without closing any stream. @return number of bytes copied """ int byteCount = 0; byte[] buffer = new byte[BUFFER_SIZE]; while (true) { int read = in.read(buffer); if (read == -1) { break; } out.write(buffer, 0, read); byteCount += read; } return byteCount; }
java
public static int copyAllBytes(InputStream in, OutputStream out) throws IOException { int byteCount = 0; byte[] buffer = new byte[BUFFER_SIZE]; while (true) { int read = in.read(buffer); if (read == -1) { break; } out.write(buffer, 0, read); byteCount += read; } return byteCount; }
[ "public", "static", "int", "copyAllBytes", "(", "InputStream", "in", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "int", "byteCount", "=", "0", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "BUFFER_SIZE", "]", ";", "while", "(", "true", ")", "{", "int", "read", "=", "in", ".", "read", "(", "buffer", ")", ";", "if", "(", "read", "==", "-", "1", ")", "{", "break", ";", "}", "out", ".", "write", "(", "buffer", ",", "0", ",", "read", ")", ";", "byteCount", "+=", "read", ";", "}", "return", "byteCount", ";", "}" ]
Copies all available data from in to out without closing any stream. @return number of bytes copied
[ "Copies", "all", "available", "data", "from", "in", "to", "out", "without", "closing", "any", "stream", "." ]
train
https://github.com/greenrobot/essentials/blob/31eaaeb410174004196c9ef9c9469e0d02afd94b/java-essentials/src/main/java/org/greenrobot/essentials/io/IoUtils.java#L130-L142
graphql-java/graphql-java
src/main/java/graphql/execution/FieldCollector.java
FieldCollector.collectFields
public MergedSelectionSet collectFields(FieldCollectorParameters parameters, SelectionSet selectionSet) { """ Given a selection set this will collect the sub-field selections and return it as a map @param parameters the parameters to this method @param selectionSet the selection set to collect on @return a map of the sub field selections """ Map<String, MergedField> subFields = new LinkedHashMap<>(); List<String> visitedFragments = new ArrayList<>(); this.collectFields(parameters, selectionSet, visitedFragments, subFields); return newMergedSelectionSet().subFields(subFields).build(); }
java
public MergedSelectionSet collectFields(FieldCollectorParameters parameters, SelectionSet selectionSet) { Map<String, MergedField> subFields = new LinkedHashMap<>(); List<String> visitedFragments = new ArrayList<>(); this.collectFields(parameters, selectionSet, visitedFragments, subFields); return newMergedSelectionSet().subFields(subFields).build(); }
[ "public", "MergedSelectionSet", "collectFields", "(", "FieldCollectorParameters", "parameters", ",", "SelectionSet", "selectionSet", ")", "{", "Map", "<", "String", ",", "MergedField", ">", "subFields", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "List", "<", "String", ">", "visitedFragments", "=", "new", "ArrayList", "<>", "(", ")", ";", "this", ".", "collectFields", "(", "parameters", ",", "selectionSet", ",", "visitedFragments", ",", "subFields", ")", ";", "return", "newMergedSelectionSet", "(", ")", ".", "subFields", "(", "subFields", ")", ".", "build", "(", ")", ";", "}" ]
Given a selection set this will collect the sub-field selections and return it as a map @param parameters the parameters to this method @param selectionSet the selection set to collect on @return a map of the sub field selections
[ "Given", "a", "selection", "set", "this", "will", "collect", "the", "sub", "-", "field", "selections", "and", "return", "it", "as", "a", "map" ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/FieldCollector.java#L53-L58
andkulikov/Transitions-Everywhere
library(1.x)/src/main/java/com/transitionseverywhere/Transition.java
Transition.excludeChildren
@NonNull public Transition excludeChildren(@Nullable View target, boolean exclude) { """ Whether to add the children of given target to the list of target children to exclude from this transition. The <code>exclude</code> parameter specifies whether the target should be added to or removed from the excluded list. <p/> <p>Excluding targets is a general mechanism for allowing transitions to run on a view hierarchy while skipping target views that should not be part of the transition. For example, you may want to avoid animating children of a specific ListView or Spinner. Views can be excluded either by their id, or by their instance reference, or by the Class of that view (eg, {@link Spinner}).</p> @param target The target to ignore when running this transition. @param exclude Whether to add the target to or remove the target from the current list of excluded targets. @return This transition object. @see #excludeTarget(View, boolean) @see #excludeChildren(int, boolean) @see #excludeChildren(Class, boolean) """ mTargetChildExcludes = excludeObject(mTargetChildExcludes, target, exclude); return this; }
java
@NonNull public Transition excludeChildren(@Nullable View target, boolean exclude) { mTargetChildExcludes = excludeObject(mTargetChildExcludes, target, exclude); return this; }
[ "@", "NonNull", "public", "Transition", "excludeChildren", "(", "@", "Nullable", "View", "target", ",", "boolean", "exclude", ")", "{", "mTargetChildExcludes", "=", "excludeObject", "(", "mTargetChildExcludes", ",", "target", ",", "exclude", ")", ";", "return", "this", ";", "}" ]
Whether to add the children of given target to the list of target children to exclude from this transition. The <code>exclude</code> parameter specifies whether the target should be added to or removed from the excluded list. <p/> <p>Excluding targets is a general mechanism for allowing transitions to run on a view hierarchy while skipping target views that should not be part of the transition. For example, you may want to avoid animating children of a specific ListView or Spinner. Views can be excluded either by their id, or by their instance reference, or by the Class of that view (eg, {@link Spinner}).</p> @param target The target to ignore when running this transition. @param exclude Whether to add the target to or remove the target from the current list of excluded targets. @return This transition object. @see #excludeTarget(View, boolean) @see #excludeChildren(int, boolean) @see #excludeChildren(Class, boolean)
[ "Whether", "to", "add", "the", "children", "of", "given", "target", "to", "the", "list", "of", "target", "children", "to", "exclude", "from", "this", "transition", ".", "The", "<code", ">", "exclude<", "/", "code", ">", "parameter", "specifies", "whether", "the", "target", "should", "be", "added", "to", "or", "removed", "from", "the", "excluded", "list", ".", "<p", "/", ">", "<p", ">", "Excluding", "targets", "is", "a", "general", "mechanism", "for", "allowing", "transitions", "to", "run", "on", "a", "view", "hierarchy", "while", "skipping", "target", "views", "that", "should", "not", "be", "part", "of", "the", "transition", ".", "For", "example", "you", "may", "want", "to", "avoid", "animating", "children", "of", "a", "specific", "ListView", "or", "Spinner", ".", "Views", "can", "be", "excluded", "either", "by", "their", "id", "or", "by", "their", "instance", "reference", "or", "by", "the", "Class", "of", "that", "view", "(", "eg", "{", "@link", "Spinner", "}", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/Transition.java#L1251-L1255
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java
FontUtils.drawLeft
public static void drawLeft(Font font, String s, int x, int y) { """ Draw text left justified @param font The font to draw with @param s The string to draw @param x The x location to draw at @param y The y location to draw at """ drawString(font, s, Alignment.LEFT, x, y, 0, Color.white); }
java
public static void drawLeft(Font font, String s, int x, int y) { drawString(font, s, Alignment.LEFT, x, y, 0, Color.white); }
[ "public", "static", "void", "drawLeft", "(", "Font", "font", ",", "String", "s", ",", "int", "x", ",", "int", "y", ")", "{", "drawString", "(", "font", ",", "s", ",", "Alignment", ".", "LEFT", ",", "x", ",", "y", ",", "0", ",", "Color", ".", "white", ")", ";", "}" ]
Draw text left justified @param font The font to draw with @param s The string to draw @param x The x location to draw at @param y The y location to draw at
[ "Draw", "text", "left", "justified" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java#L38-L40
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJHelper.java
IfmapJHelper.getKeyManagers
public static KeyManager[] getKeyManagers() throws InitializationException { """ Creates {@link KeyManager} instances based on the javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword environment variables. @return an array of {@link KeyManager} instances. @throws InitializationException """ String file = System.getProperty("javax.net.ssl.keyStore"); String pass = System.getProperty("javax.net.ssl.keyStorePassword"); if (file == null || pass == null) { throw new InitializationException("javax.net.ssl.keyStore / " + "javax.net.ssl.keyStorePassword not set"); } return getKeyManagers(file, pass); }
java
public static KeyManager[] getKeyManagers() throws InitializationException { String file = System.getProperty("javax.net.ssl.keyStore"); String pass = System.getProperty("javax.net.ssl.keyStorePassword"); if (file == null || pass == null) { throw new InitializationException("javax.net.ssl.keyStore / " + "javax.net.ssl.keyStorePassword not set"); } return getKeyManagers(file, pass); }
[ "public", "static", "KeyManager", "[", "]", "getKeyManagers", "(", ")", "throws", "InitializationException", "{", "String", "file", "=", "System", ".", "getProperty", "(", "\"javax.net.ssl.keyStore\"", ")", ";", "String", "pass", "=", "System", ".", "getProperty", "(", "\"javax.net.ssl.keyStorePassword\"", ")", ";", "if", "(", "file", "==", "null", "||", "pass", "==", "null", ")", "{", "throw", "new", "InitializationException", "(", "\"javax.net.ssl.keyStore / \"", "+", "\"javax.net.ssl.keyStorePassword not set\"", ")", ";", "}", "return", "getKeyManagers", "(", "file", ",", "pass", ")", ";", "}" ]
Creates {@link KeyManager} instances based on the javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword environment variables. @return an array of {@link KeyManager} instances. @throws InitializationException
[ "Creates", "{", "@link", "KeyManager", "}", "instances", "based", "on", "the", "javax", ".", "net", ".", "ssl", ".", "keyStore", "and", "javax", ".", "net", ".", "ssl", ".", "keyStorePassword", "environment", "variables", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJHelper.java#L75-L85
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/ReadExcelUtils.java
ReadExcelUtils.getCellValue
public static Object getCellValue(int type, Cell cell) { """ 获取指定单元格的内容。只能是日期(返回java.util.Date),整数值(返回的均是String类型),小数值(返回的均是String类型,并 保留两位小数),字符串, 布尔类型。 其他类型返回null。 @param type 指定类型(Cell中定义的类型) @param cell 指定单元格 @return 返回Cell里的内容 """ switch (type) { case Cell.CELL_TYPE_BOOLEAN: return cell.getBooleanCellValue(); case Cell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { return DateUtil.getJavaDate(cell.getNumericCellValue()); } else { BigDecimal bd = new BigDecimal(cell.getNumericCellValue()); return bd.toString().contains(".") ? bd.setScale(2, RoundingMode.HALF_UP).toString() : bd.toString(); } case Cell.CELL_TYPE_STRING: try { return DateUtils.parseDate(cell.getStringCellValue(), ReadExcelUtils.PATTERN); } catch (Exception e) { return cell.getStringCellValue(); } case Cell.CELL_TYPE_FORMULA: if (DateUtil.isCellDateFormatted(cell)) { return cell.getDateCellValue(); } break; default: break; } return null; }
java
public static Object getCellValue(int type, Cell cell) { switch (type) { case Cell.CELL_TYPE_BOOLEAN: return cell.getBooleanCellValue(); case Cell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { return DateUtil.getJavaDate(cell.getNumericCellValue()); } else { BigDecimal bd = new BigDecimal(cell.getNumericCellValue()); return bd.toString().contains(".") ? bd.setScale(2, RoundingMode.HALF_UP).toString() : bd.toString(); } case Cell.CELL_TYPE_STRING: try { return DateUtils.parseDate(cell.getStringCellValue(), ReadExcelUtils.PATTERN); } catch (Exception e) { return cell.getStringCellValue(); } case Cell.CELL_TYPE_FORMULA: if (DateUtil.isCellDateFormatted(cell)) { return cell.getDateCellValue(); } break; default: break; } return null; }
[ "public", "static", "Object", "getCellValue", "(", "int", "type", ",", "Cell", "cell", ")", "{", "switch", "(", "type", ")", "{", "case", "Cell", ".", "CELL_TYPE_BOOLEAN", ":", "return", "cell", ".", "getBooleanCellValue", "(", ")", ";", "case", "Cell", ".", "CELL_TYPE_NUMERIC", ":", "if", "(", "DateUtil", ".", "isCellDateFormatted", "(", "cell", ")", ")", "{", "return", "DateUtil", ".", "getJavaDate", "(", "cell", ".", "getNumericCellValue", "(", ")", ")", ";", "}", "else", "{", "BigDecimal", "bd", "=", "new", "BigDecimal", "(", "cell", ".", "getNumericCellValue", "(", ")", ")", ";", "return", "bd", ".", "toString", "(", ")", ".", "contains", "(", "\".\"", ")", "?", "bd", ".", "setScale", "(", "2", ",", "RoundingMode", ".", "HALF_UP", ")", ".", "toString", "(", ")", ":", "bd", ".", "toString", "(", ")", ";", "}", "case", "Cell", ".", "CELL_TYPE_STRING", ":", "try", "{", "return", "DateUtils", ".", "parseDate", "(", "cell", ".", "getStringCellValue", "(", ")", ",", "ReadExcelUtils", ".", "PATTERN", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "cell", ".", "getStringCellValue", "(", ")", ";", "}", "case", "Cell", ".", "CELL_TYPE_FORMULA", ":", "if", "(", "DateUtil", ".", "isCellDateFormatted", "(", "cell", ")", ")", "{", "return", "cell", ".", "getDateCellValue", "(", ")", ";", "}", "break", ";", "default", ":", "break", ";", "}", "return", "null", ";", "}" ]
获取指定单元格的内容。只能是日期(返回java.util.Date),整数值(返回的均是String类型),小数值(返回的均是String类型,并 保留两位小数),字符串, 布尔类型。 其他类型返回null。 @param type 指定类型(Cell中定义的类型) @param cell 指定单元格 @return 返回Cell里的内容
[ "获取指定单元格的内容。只能是日期(返回java", ".", "util", ".", "Date),整数值(返回的均是String类型),小数值(返回的均是String类型,并", "保留两位小数),字符串,", "布尔类型。", "其他类型返回null。" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/ReadExcelUtils.java#L36-L63
FXMisc/RichTextFX
richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java
ReadOnlyStyledDocumentBuilder.addParagraph
public ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(List<SEG> segments, StyleSpans<S> styles) { """ Adds to the list a paragraph that has multiple segments with multiple styles throughout those segments """ return addParagraph(segments, styles, null); }
java
public ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(List<SEG> segments, StyleSpans<S> styles) { return addParagraph(segments, styles, null); }
[ "public", "ReadOnlyStyledDocumentBuilder", "<", "PS", ",", "SEG", ",", "S", ">", "addParagraph", "(", "List", "<", "SEG", ">", "segments", ",", "StyleSpans", "<", "S", ">", "styles", ")", "{", "return", "addParagraph", "(", "segments", ",", "styles", ",", "null", ")", ";", "}" ]
Adds to the list a paragraph that has multiple segments with multiple styles throughout those segments
[ "Adds", "to", "the", "list", "a", "paragraph", "that", "has", "multiple", "segments", "with", "multiple", "styles", "throughout", "those", "segments" ]
train
https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java#L134-L136
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java
PermissionUtil.canInteract
public static boolean canInteract(Member issuer, Member target) { """ Checks if one given Member can interact with a 2nd given Member - in a permission sense (kick/ban/modify perms). This only checks the Role-Position and does not check the actual permission (kick/ban/manage_role/...) @param issuer The member that tries to interact with 2nd member @param target The member that is the target of the interaction @throws IllegalArgumentException if any of the provided parameters is {@code null} or the provided entities are not from the same guild @return True, if issuer can interact with target in guild """ Checks.notNull(issuer, "Issuer Member"); Checks.notNull(target, "Target Member"); Guild guild = issuer.getGuild(); if (!guild.equals(target.getGuild())) throw new IllegalArgumentException("Provided members must both be Member objects of the same Guild!"); if(guild.getOwner().equals(issuer)) return true; if(guild.getOwner().equals(target)) return false; List<Role> issuerRoles = issuer.getRoles(); List<Role> targetRoles = target.getRoles(); return !issuerRoles.isEmpty() && (targetRoles.isEmpty() || canInteract(issuerRoles.get(0), targetRoles.get(0))); }
java
public static boolean canInteract(Member issuer, Member target) { Checks.notNull(issuer, "Issuer Member"); Checks.notNull(target, "Target Member"); Guild guild = issuer.getGuild(); if (!guild.equals(target.getGuild())) throw new IllegalArgumentException("Provided members must both be Member objects of the same Guild!"); if(guild.getOwner().equals(issuer)) return true; if(guild.getOwner().equals(target)) return false; List<Role> issuerRoles = issuer.getRoles(); List<Role> targetRoles = target.getRoles(); return !issuerRoles.isEmpty() && (targetRoles.isEmpty() || canInteract(issuerRoles.get(0), targetRoles.get(0))); }
[ "public", "static", "boolean", "canInteract", "(", "Member", "issuer", ",", "Member", "target", ")", "{", "Checks", ".", "notNull", "(", "issuer", ",", "\"Issuer Member\"", ")", ";", "Checks", ".", "notNull", "(", "target", ",", "\"Target Member\"", ")", ";", "Guild", "guild", "=", "issuer", ".", "getGuild", "(", ")", ";", "if", "(", "!", "guild", ".", "equals", "(", "target", ".", "getGuild", "(", ")", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Provided members must both be Member objects of the same Guild!\"", ")", ";", "if", "(", "guild", ".", "getOwner", "(", ")", ".", "equals", "(", "issuer", ")", ")", "return", "true", ";", "if", "(", "guild", ".", "getOwner", "(", ")", ".", "equals", "(", "target", ")", ")", "return", "false", ";", "List", "<", "Role", ">", "issuerRoles", "=", "issuer", ".", "getRoles", "(", ")", ";", "List", "<", "Role", ">", "targetRoles", "=", "target", ".", "getRoles", "(", ")", ";", "return", "!", "issuerRoles", ".", "isEmpty", "(", ")", "&&", "(", "targetRoles", ".", "isEmpty", "(", ")", "||", "canInteract", "(", "issuerRoles", ".", "get", "(", "0", ")", ",", "targetRoles", ".", "get", "(", "0", ")", ")", ")", ";", "}" ]
Checks if one given Member can interact with a 2nd given Member - in a permission sense (kick/ban/modify perms). This only checks the Role-Position and does not check the actual permission (kick/ban/manage_role/...) @param issuer The member that tries to interact with 2nd member @param target The member that is the target of the interaction @throws IllegalArgumentException if any of the provided parameters is {@code null} or the provided entities are not from the same guild @return True, if issuer can interact with target in guild
[ "Checks", "if", "one", "given", "Member", "can", "interact", "with", "a", "2nd", "given", "Member", "-", "in", "a", "permission", "sense", "(", "kick", "/", "ban", "/", "modify", "perms", ")", ".", "This", "only", "checks", "the", "Role", "-", "Position", "and", "does", "not", "check", "the", "actual", "permission", "(", "kick", "/", "ban", "/", "manage_role", "/", "...", ")" ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java#L43-L58
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java
Taint.addLocation
public void addLocation(TaintLocation location, boolean isKnownTaintSource) { """ Adds location for a taint source or path to remember for reporting @param location location to remember @param isKnownTaintSource true for tainted value, false if just not safe @throws NullPointerException if location is null """ Objects.requireNonNull(location, "location is null"); if (isKnownTaintSource) { taintLocations.add(location); } else { unknownLocations.add(location); } }
java
public void addLocation(TaintLocation location, boolean isKnownTaintSource) { Objects.requireNonNull(location, "location is null"); if (isKnownTaintSource) { taintLocations.add(location); } else { unknownLocations.add(location); } }
[ "public", "void", "addLocation", "(", "TaintLocation", "location", ",", "boolean", "isKnownTaintSource", ")", "{", "Objects", ".", "requireNonNull", "(", "location", ",", "\"location is null\"", ")", ";", "if", "(", "isKnownTaintSource", ")", "{", "taintLocations", ".", "add", "(", "location", ")", ";", "}", "else", "{", "unknownLocations", ".", "add", "(", "location", ")", ";", "}", "}" ]
Adds location for a taint source or path to remember for reporting @param location location to remember @param isKnownTaintSource true for tainted value, false if just not safe @throws NullPointerException if location is null
[ "Adds", "location", "for", "a", "taint", "source", "or", "path", "to", "remember", "for", "reporting" ]
train
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java#L239-L246
javamelody/javamelody
javamelody-swing/src/main/java/net/bull/javamelody/swing/table/MListTable.java
MListTable.setList
public void setList(final List<T> newList) { """ Définit la valeur de la propriété list. <BR> Cette méthode adaptent automatiquement les largeurs des colonnes selon les données. @param newList List @see #getList """ getListTableModel().setList(newList); adjustColumnWidths(); // Réinitialise les hauteurs des lignes qui pourraient avoir été particularisées // avec setRowHeight(row, rowHeight). setRowHeight(getRowHeight()); // remarque perf: on pourrait parcourir les colonnes pour affecter des renderers aux colonnes n'en ayant pas selon getDefaultRenderer(getColumnClass(i)) // pour éliminer les appels à getDefaultRenderer pour chaque cellule }
java
public void setList(final List<T> newList) { getListTableModel().setList(newList); adjustColumnWidths(); // Réinitialise les hauteurs des lignes qui pourraient avoir été particularisées // avec setRowHeight(row, rowHeight). setRowHeight(getRowHeight()); // remarque perf: on pourrait parcourir les colonnes pour affecter des renderers aux colonnes n'en ayant pas selon getDefaultRenderer(getColumnClass(i)) // pour éliminer les appels à getDefaultRenderer pour chaque cellule }
[ "public", "void", "setList", "(", "final", "List", "<", "T", ">", "newList", ")", "{", "getListTableModel", "(", ")", ".", "setList", "(", "newList", ")", ";", "adjustColumnWidths", "(", ")", ";", "// Réinitialise les hauteurs des lignes qui pourraient avoir été particularisées\r", "// avec setRowHeight(row, rowHeight).\r", "setRowHeight", "(", "getRowHeight", "(", ")", ")", ";", "// remarque perf: on pourrait parcourir les colonnes pour affecter des renderers aux colonnes n'en ayant pas selon getDefaultRenderer(getColumnClass(i))\r", "// pour éliminer les appels à getDefaultRenderer pour chaque cellule\r", "}" ]
Définit la valeur de la propriété list. <BR> Cette méthode adaptent automatiquement les largeurs des colonnes selon les données. @param newList List @see #getList
[ "Définit", "la", "valeur", "de", "la", "propriété", "list", ".", "<BR", ">" ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/table/MListTable.java#L86-L97
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java
Services.stopServices
public static void stopServices(IServiceManager manager) { """ Stop the services associated to the given service manager. <p>This stopping function supports the {@link DependentService prioritized services}. @param manager the manager of the services to stop. """ final List<Service> otherServices = new ArrayList<>(); final List<Service> infraServices = new ArrayList<>(); final LinkedList<DependencyNode> serviceQueue = new LinkedList<>(); final Accessors accessors = new StoppingPhaseAccessors(); // Build the dependency graph buildInvertedDependencyGraph(manager, serviceQueue, infraServices, otherServices, accessors); // Launch the services runDependencyGraph(serviceQueue, infraServices, otherServices, accessors); manager.awaitStopped(); }
java
public static void stopServices(IServiceManager manager) { final List<Service> otherServices = new ArrayList<>(); final List<Service> infraServices = new ArrayList<>(); final LinkedList<DependencyNode> serviceQueue = new LinkedList<>(); final Accessors accessors = new StoppingPhaseAccessors(); // Build the dependency graph buildInvertedDependencyGraph(manager, serviceQueue, infraServices, otherServices, accessors); // Launch the services runDependencyGraph(serviceQueue, infraServices, otherServices, accessors); manager.awaitStopped(); }
[ "public", "static", "void", "stopServices", "(", "IServiceManager", "manager", ")", "{", "final", "List", "<", "Service", ">", "otherServices", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "List", "<", "Service", ">", "infraServices", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "LinkedList", "<", "DependencyNode", ">", "serviceQueue", "=", "new", "LinkedList", "<>", "(", ")", ";", "final", "Accessors", "accessors", "=", "new", "StoppingPhaseAccessors", "(", ")", ";", "// Build the dependency graph", "buildInvertedDependencyGraph", "(", "manager", ",", "serviceQueue", ",", "infraServices", ",", "otherServices", ",", "accessors", ")", ";", "// Launch the services", "runDependencyGraph", "(", "serviceQueue", ",", "infraServices", ",", "otherServices", ",", "accessors", ")", ";", "manager", ".", "awaitStopped", "(", ")", ";", "}" ]
Stop the services associated to the given service manager. <p>This stopping function supports the {@link DependentService prioritized services}. @param manager the manager of the services to stop.
[ "Stop", "the", "services", "associated", "to", "the", "given", "service", "manager", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java#L108-L121
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java
EmbedBuilder.setFooter
public EmbedBuilder setFooter(String text, Icon icon) { """ Sets the footer of the embed. @param text The text of the footer. @param icon The footer's icon. @return The current instance in order to chain call methods. """ delegate.setFooter(text, icon); return this; }
java
public EmbedBuilder setFooter(String text, Icon icon) { delegate.setFooter(text, icon); return this; }
[ "public", "EmbedBuilder", "setFooter", "(", "String", "text", ",", "Icon", "icon", ")", "{", "delegate", ".", "setFooter", "(", "text", ",", "icon", ")", ";", "return", "this", ";", "}" ]
Sets the footer of the embed. @param text The text of the footer. @param icon The footer's icon. @return The current instance in order to chain call methods.
[ "Sets", "the", "footer", "of", "the", "embed", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java#L131-L134
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/extras/Poi.java
Poi.setLat
public void setLat(final int LAT_DEG, final double LAT_MIN) { """ Sets the latitude of the poi in the format 7° 20.123' @param LAT_DEG @param LAT_MIN """ this.lat = convert(LAT_DEG, LAT_MIN); this.LOCATION.setLocation(this.lat, this.lon); adjustDirection(); }
java
public void setLat(final int LAT_DEG, final double LAT_MIN) { this.lat = convert(LAT_DEG, LAT_MIN); this.LOCATION.setLocation(this.lat, this.lon); adjustDirection(); }
[ "public", "void", "setLat", "(", "final", "int", "LAT_DEG", ",", "final", "double", "LAT_MIN", ")", "{", "this", ".", "lat", "=", "convert", "(", "LAT_DEG", ",", "LAT_MIN", ")", ";", "this", ".", "LOCATION", ".", "setLocation", "(", "this", ".", "lat", ",", "this", ".", "lon", ")", ";", "adjustDirection", "(", ")", ";", "}" ]
Sets the latitude of the poi in the format 7° 20.123' @param LAT_DEG @param LAT_MIN
[ "Sets", "the", "latitude", "of", "the", "poi", "in", "the", "format", "7°", "20", ".", "123" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Poi.java#L285-L289
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/annotation/OrderUtils.java
OrderUtils.getOrder
public static Integer getOrder(Class<?> type, Integer defaultOrder) { """ Return the order on the specified {@code type}, or the specified default value if none can be found. <p>Take care of {@link Order @Order} and {@code @javax.annotation.Priority}. @param type the type to handle @return the priority value, or the specified default order if none can be found """ Order order = AnnotationUtils.findAnnotation(type, Order.class); if (order != null) { return order.value(); } Integer priorityOrder = getPriority(type); if (priorityOrder != null) { return priorityOrder; } return defaultOrder; }
java
public static Integer getOrder(Class<?> type, Integer defaultOrder) { Order order = AnnotationUtils.findAnnotation(type, Order.class); if (order != null) { return order.value(); } Integer priorityOrder = getPriority(type); if (priorityOrder != null) { return priorityOrder; } return defaultOrder; }
[ "public", "static", "Integer", "getOrder", "(", "Class", "<", "?", ">", "type", ",", "Integer", "defaultOrder", ")", "{", "Order", "order", "=", "AnnotationUtils", ".", "findAnnotation", "(", "type", ",", "Order", ".", "class", ")", ";", "if", "(", "order", "!=", "null", ")", "{", "return", "order", ".", "value", "(", ")", ";", "}", "Integer", "priorityOrder", "=", "getPriority", "(", "type", ")", ";", "if", "(", "priorityOrder", "!=", "null", ")", "{", "return", "priorityOrder", ";", "}", "return", "defaultOrder", ";", "}" ]
Return the order on the specified {@code type}, or the specified default value if none can be found. <p>Take care of {@link Order @Order} and {@code @javax.annotation.Priority}. @param type the type to handle @return the priority value, or the specified default order if none can be found
[ "Return", "the", "order", "on", "the", "specified", "{" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/OrderUtils.java#L67-L77
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java
MediaServicesInner.syncStorageKeys
public void syncStorageKeys(String resourceGroupName, String mediaServiceName, String id) { """ Synchronizes storage account keys for a storage account associated with the Media Service account. @param resourceGroupName Name of the resource group within the Azure subscription. @param mediaServiceName Name of the Media Service. @param id The id of the storage account resource. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ syncStorageKeysWithServiceResponseAsync(resourceGroupName, mediaServiceName, id).toBlocking().single().body(); }
java
public void syncStorageKeys(String resourceGroupName, String mediaServiceName, String id) { syncStorageKeysWithServiceResponseAsync(resourceGroupName, mediaServiceName, id).toBlocking().single().body(); }
[ "public", "void", "syncStorageKeys", "(", "String", "resourceGroupName", ",", "String", "mediaServiceName", ",", "String", "id", ")", "{", "syncStorageKeysWithServiceResponseAsync", "(", "resourceGroupName", ",", "mediaServiceName", ",", "id", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Synchronizes storage account keys for a storage account associated with the Media Service account. @param resourceGroupName Name of the resource group within the Azure subscription. @param mediaServiceName Name of the Media Service. @param id The id of the storage account resource. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Synchronizes", "storage", "account", "keys", "for", "a", "storage", "account", "associated", "with", "the", "Media", "Service", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java#L827-L829
pravega/pravega
common/src/main/java/io/pravega/common/concurrent/Futures.java
Futures.runOrFail
@SneakyThrows(Exception.class) public static <T, R> R runOrFail(Callable<R> callable, CompletableFuture<T> future) { """ Runs the provided Callable in the current thread (synchronously) if it throws any Exception or Throwable the exception is propagated, but the supplied future is also failed. @param <T> The type of the future. @param <R> The return type of the callable. @param callable The function to invoke. @param future The future to fail if the function fails. @return The return value of the function. """ try { return callable.call(); } catch (Throwable t) { future.completeExceptionally(t); throw t; } }
java
@SneakyThrows(Exception.class) public static <T, R> R runOrFail(Callable<R> callable, CompletableFuture<T> future) { try { return callable.call(); } catch (Throwable t) { future.completeExceptionally(t); throw t; } }
[ "@", "SneakyThrows", "(", "Exception", ".", "class", ")", "public", "static", "<", "T", ",", "R", ">", "R", "runOrFail", "(", "Callable", "<", "R", ">", "callable", ",", "CompletableFuture", "<", "T", ">", "future", ")", "{", "try", "{", "return", "callable", ".", "call", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "future", ".", "completeExceptionally", "(", "t", ")", ";", "throw", "t", ";", "}", "}" ]
Runs the provided Callable in the current thread (synchronously) if it throws any Exception or Throwable the exception is propagated, but the supplied future is also failed. @param <T> The type of the future. @param <R> The return type of the callable. @param callable The function to invoke. @param future The future to fail if the function fails. @return The return value of the function.
[ "Runs", "the", "provided", "Callable", "in", "the", "current", "thread", "(", "synchronously", ")", "if", "it", "throws", "any", "Exception", "or", "Throwable", "the", "exception", "is", "propagated", "but", "the", "supplied", "future", "is", "also", "failed", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Futures.java#L569-L577
gosu-lang/gosu-lang
gosu-lab/src/main/java/editor/util/TextComponentUtil.java
TextComponentUtil.getDeepestWhiteSpaceLineStartAfter
public static int getDeepestWhiteSpaceLineStartAfter( String script, int offset ) { """ Eats whitespace lines after the given offset until it finds a non-whitespace line and returns the start of the last whitespace line found, or the initial value if none was. """ if( offset < 0 ) { return offset; } int i = offset; while( true ) { int lineStartAfter = getWhiteSpaceLineStartAfter( script, i ); if( lineStartAfter == -1 ) { return i; } else { i = lineStartAfter; } } }
java
public static int getDeepestWhiteSpaceLineStartAfter( String script, int offset ) { if( offset < 0 ) { return offset; } int i = offset; while( true ) { int lineStartAfter = getWhiteSpaceLineStartAfter( script, i ); if( lineStartAfter == -1 ) { return i; } else { i = lineStartAfter; } } }
[ "public", "static", "int", "getDeepestWhiteSpaceLineStartAfter", "(", "String", "script", ",", "int", "offset", ")", "{", "if", "(", "offset", "<", "0", ")", "{", "return", "offset", ";", "}", "int", "i", "=", "offset", ";", "while", "(", "true", ")", "{", "int", "lineStartAfter", "=", "getWhiteSpaceLineStartAfter", "(", "script", ",", "i", ")", ";", "if", "(", "lineStartAfter", "==", "-", "1", ")", "{", "return", "i", ";", "}", "else", "{", "i", "=", "lineStartAfter", ";", "}", "}", "}" ]
Eats whitespace lines after the given offset until it finds a non-whitespace line and returns the start of the last whitespace line found, or the initial value if none was.
[ "Eats", "whitespace", "lines", "after", "the", "given", "offset", "until", "it", "finds", "a", "non", "-", "whitespace", "line", "and", "returns", "the", "start", "of", "the", "last", "whitespace", "line", "found", "or", "the", "initial", "value", "if", "none", "was", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TextComponentUtil.java#L858-L879
datumbox/lpsolve
src/main/java/lpsolve/LpSolve.java
LpSolve.putAbortfunc
public void putAbortfunc(AbortListener listener, Object userhandle) throws LpSolveException { """ Register an <code>AbortListener</code> for callback. @param listener the listener that should be called by lp_solve @param userhandle an arbitrary object that is passed to the listener on call """ abortListener = listener; abortUserhandle = (listener != null) ? userhandle : null; addLp(this); registerAbortfunc(); }
java
public void putAbortfunc(AbortListener listener, Object userhandle) throws LpSolveException { abortListener = listener; abortUserhandle = (listener != null) ? userhandle : null; addLp(this); registerAbortfunc(); }
[ "public", "void", "putAbortfunc", "(", "AbortListener", "listener", ",", "Object", "userhandle", ")", "throws", "LpSolveException", "{", "abortListener", "=", "listener", ";", "abortUserhandle", "=", "(", "listener", "!=", "null", ")", "?", "userhandle", ":", "null", ";", "addLp", "(", "this", ")", ";", "registerAbortfunc", "(", ")", ";", "}" ]
Register an <code>AbortListener</code> for callback. @param listener the listener that should be called by lp_solve @param userhandle an arbitrary object that is passed to the listener on call
[ "Register", "an", "<code", ">", "AbortListener<", "/", "code", ">", "for", "callback", "." ]
train
https://github.com/datumbox/lpsolve/blob/201b3e99153d907bb99c189e5647bc71a3a1add6/src/main/java/lpsolve/LpSolve.java#L1595-L1600
jurmous/etcd4j
src/main/java/mousio/etcd4j/transport/EtcdNettyClient.java
EtcdNettyClient.modifyPipeLine
private <R> void modifyPipeLine(final EtcdRequest<R> req, final ChannelPipeline pipeline) { """ Modify the pipeline for the request @param req to process @param pipeline to modify @param <R> Type of Response """ final EtcdResponseHandler<R> handler = new EtcdResponseHandler<>(this, req); if (req.hasTimeout()) { pipeline.addFirst(new ReadTimeoutHandler(req.getTimeout(), req.getTimeoutUnit())); } pipeline.addLast(handler); pipeline.addLast(new ChannelHandlerAdapter() { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { handler.retried(true); req.getPromise().handleRetry(cause); } }); }
java
private <R> void modifyPipeLine(final EtcdRequest<R> req, final ChannelPipeline pipeline) { final EtcdResponseHandler<R> handler = new EtcdResponseHandler<>(this, req); if (req.hasTimeout()) { pipeline.addFirst(new ReadTimeoutHandler(req.getTimeout(), req.getTimeoutUnit())); } pipeline.addLast(handler); pipeline.addLast(new ChannelHandlerAdapter() { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { handler.retried(true); req.getPromise().handleRetry(cause); } }); }
[ "private", "<", "R", ">", "void", "modifyPipeLine", "(", "final", "EtcdRequest", "<", "R", ">", "req", ",", "final", "ChannelPipeline", "pipeline", ")", "{", "final", "EtcdResponseHandler", "<", "R", ">", "handler", "=", "new", "EtcdResponseHandler", "<>", "(", "this", ",", "req", ")", ";", "if", "(", "req", ".", "hasTimeout", "(", ")", ")", "{", "pipeline", ".", "addFirst", "(", "new", "ReadTimeoutHandler", "(", "req", ".", "getTimeout", "(", ")", ",", "req", ".", "getTimeoutUnit", "(", ")", ")", ")", ";", "}", "pipeline", ".", "addLast", "(", "handler", ")", ";", "pipeline", ".", "addLast", "(", "new", "ChannelHandlerAdapter", "(", ")", "{", "@", "Override", "public", "void", "exceptionCaught", "(", "ChannelHandlerContext", "ctx", ",", "Throwable", "cause", ")", "throws", "Exception", "{", "handler", ".", "retried", "(", "true", ")", ";", "req", ".", "getPromise", "(", ")", ".", "handleRetry", "(", "cause", ")", ";", "}", "}", ")", ";", "}" ]
Modify the pipeline for the request @param req to process @param pipeline to modify @param <R> Type of Response
[ "Modify", "the", "pipeline", "for", "the", "request" ]
train
https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/transport/EtcdNettyClient.java#L331-L346
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsADECache.java
CmsADECache.uncacheGroupContainer
public void uncacheGroupContainer(CmsUUID structureId, boolean online) { """ Removes the group container identified by its structure id from the cache.<p> @param structureId the group container's structure id @param online if online or offline """ try { m_lock.writeLock().lock(); if (online) { m_groupContainersOnline.remove(getCacheKey(structureId, true)); m_groupContainersOnline.remove(getCacheKey(structureId, false)); } else { m_groupContainersOffline.remove(getCacheKey(structureId, true)); m_groupContainersOffline.remove(getCacheKey(structureId, false)); } } finally { m_lock.writeLock().unlock(); } }
java
public void uncacheGroupContainer(CmsUUID structureId, boolean online) { try { m_lock.writeLock().lock(); if (online) { m_groupContainersOnline.remove(getCacheKey(structureId, true)); m_groupContainersOnline.remove(getCacheKey(structureId, false)); } else { m_groupContainersOffline.remove(getCacheKey(structureId, true)); m_groupContainersOffline.remove(getCacheKey(structureId, false)); } } finally { m_lock.writeLock().unlock(); } }
[ "public", "void", "uncacheGroupContainer", "(", "CmsUUID", "structureId", ",", "boolean", "online", ")", "{", "try", "{", "m_lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "if", "(", "online", ")", "{", "m_groupContainersOnline", ".", "remove", "(", "getCacheKey", "(", "structureId", ",", "true", ")", ")", ";", "m_groupContainersOnline", ".", "remove", "(", "getCacheKey", "(", "structureId", ",", "false", ")", ")", ";", "}", "else", "{", "m_groupContainersOffline", ".", "remove", "(", "getCacheKey", "(", "structureId", ",", "true", ")", ")", ";", "m_groupContainersOffline", ".", "remove", "(", "getCacheKey", "(", "structureId", ",", "false", ")", ")", ";", "}", "}", "finally", "{", "m_lock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Removes the group container identified by its structure id from the cache.<p> @param structureId the group container's structure id @param online if online or offline
[ "Removes", "the", "group", "container", "identified", "by", "its", "structure", "id", "from", "the", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADECache.java#L338-L352
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/AnonymousOdsFileWriter.java
AnonymousOdsFileWriter.saveAs
public void saveAs(final String filename, final ZipUTF8WriterBuilder builder) throws IOException { """ Save the document to filename. @param filename the name of the destination file @param builder a builder for the ZipOutputStream and the Writer (buffers, level, ...) @throws IOException if the file was not saved """ try { final FileOutputStream out = new FileOutputStream(filename); final ZipUTF8Writer writer = builder.build(out); try { this.save(writer); } finally { writer.close(); } } catch (final FileNotFoundException e) { this.logger.log(Level.SEVERE, "Can't open " + filename, e); throw new IOException(e); } }
java
public void saveAs(final String filename, final ZipUTF8WriterBuilder builder) throws IOException { try { final FileOutputStream out = new FileOutputStream(filename); final ZipUTF8Writer writer = builder.build(out); try { this.save(writer); } finally { writer.close(); } } catch (final FileNotFoundException e) { this.logger.log(Level.SEVERE, "Can't open " + filename, e); throw new IOException(e); } }
[ "public", "void", "saveAs", "(", "final", "String", "filename", ",", "final", "ZipUTF8WriterBuilder", "builder", ")", "throws", "IOException", "{", "try", "{", "final", "FileOutputStream", "out", "=", "new", "FileOutputStream", "(", "filename", ")", ";", "final", "ZipUTF8Writer", "writer", "=", "builder", ".", "build", "(", "out", ")", ";", "try", "{", "this", ".", "save", "(", "writer", ")", ";", "}", "finally", "{", "writer", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "final", "FileNotFoundException", "e", ")", "{", "this", ".", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Can't open \"", "+", "filename", ",", "e", ")", ";", "throw", "new", "IOException", "(", "e", ")", ";", "}", "}" ]
Save the document to filename. @param filename the name of the destination file @param builder a builder for the ZipOutputStream and the Writer (buffers, level, ...) @throws IOException if the file was not saved
[ "Save", "the", "document", "to", "filename", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/AnonymousOdsFileWriter.java#L136-L150
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageSaver.java
ImageSaver.saveImage
public static void saveImage(Image image, String filename, String imgFileFormat) { """ Saves image using {@link #saveImage(Image, File, String)}. @param image to be saved @param filename path to file @param imgFileFormat image file format. Consult {@link #getSaveableImageFileFormats()} @throws ImageSaverException if an IOException occured during the process, the provided filename path does refer to a directory or no appropriate writer could be found for specified format. @since 1.0 """ File f = new File(filename); if(!f.isDirectory()){ saveImage(image, f, imgFileFormat); } else { throw new ImageSaverException(new IOException(String.format("provided file name denotes a directory. %s", filename))); } }
java
public static void saveImage(Image image, String filename, String imgFileFormat){ File f = new File(filename); if(!f.isDirectory()){ saveImage(image, f, imgFileFormat); } else { throw new ImageSaverException(new IOException(String.format("provided file name denotes a directory. %s", filename))); } }
[ "public", "static", "void", "saveImage", "(", "Image", "image", ",", "String", "filename", ",", "String", "imgFileFormat", ")", "{", "File", "f", "=", "new", "File", "(", "filename", ")", ";", "if", "(", "!", "f", ".", "isDirectory", "(", ")", ")", "{", "saveImage", "(", "image", ",", "f", ",", "imgFileFormat", ")", ";", "}", "else", "{", "throw", "new", "ImageSaverException", "(", "new", "IOException", "(", "String", ".", "format", "(", "\"provided file name denotes a directory. %s\"", ",", "filename", ")", ")", ")", ";", "}", "}" ]
Saves image using {@link #saveImage(Image, File, String)}. @param image to be saved @param filename path to file @param imgFileFormat image file format. Consult {@link #getSaveableImageFileFormats()} @throws ImageSaverException if an IOException occured during the process, the provided filename path does refer to a directory or no appropriate writer could be found for specified format. @since 1.0
[ "Saves", "image", "using", "{" ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageSaver.java#L124-L131
jtmelton/appsensor
analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java
AggregateEventAnalysisEngine.findMostRecentAttackTime
protected DateTime findMostRecentAttackTime(Event triggerEvent, Rule rule) { """ Finds the most recent {@link Attack} from the {@link Rule} being evaluated. @param triggerEvent the {@link Event} that triggered the {@link Rule} @param rule the {@link Rule} being evaluated @return a {@link DateTime} of the most recent attack related to the {@link Rule} """ DateTime newest = DateUtils.epoch(); SearchCriteria criteria = new SearchCriteria(). setUser(new User(triggerEvent.getUser().getUsername())). setRule(rule). setDetectionSystemIds(appSensorServer.getConfiguration().getRelatedDetectionSystems(triggerEvent.getDetectionSystem())); Collection<Attack> attacks = appSensorServer.getAttackStore().findAttacks(criteria); for (Attack attack : attacks) { if (attack.getRule().guidMatches(rule)) { if (DateUtils.fromString(attack.getTimestamp()).isAfter(newest)) { newest = DateUtils.fromString(attack.getTimestamp()); } } } return newest; }
java
protected DateTime findMostRecentAttackTime(Event triggerEvent, Rule rule) { DateTime newest = DateUtils.epoch(); SearchCriteria criteria = new SearchCriteria(). setUser(new User(triggerEvent.getUser().getUsername())). setRule(rule). setDetectionSystemIds(appSensorServer.getConfiguration().getRelatedDetectionSystems(triggerEvent.getDetectionSystem())); Collection<Attack> attacks = appSensorServer.getAttackStore().findAttacks(criteria); for (Attack attack : attacks) { if (attack.getRule().guidMatches(rule)) { if (DateUtils.fromString(attack.getTimestamp()).isAfter(newest)) { newest = DateUtils.fromString(attack.getTimestamp()); } } } return newest; }
[ "protected", "DateTime", "findMostRecentAttackTime", "(", "Event", "triggerEvent", ",", "Rule", "rule", ")", "{", "DateTime", "newest", "=", "DateUtils", ".", "epoch", "(", ")", ";", "SearchCriteria", "criteria", "=", "new", "SearchCriteria", "(", ")", ".", "setUser", "(", "new", "User", "(", "triggerEvent", ".", "getUser", "(", ")", ".", "getUsername", "(", ")", ")", ")", ".", "setRule", "(", "rule", ")", ".", "setDetectionSystemIds", "(", "appSensorServer", ".", "getConfiguration", "(", ")", ".", "getRelatedDetectionSystems", "(", "triggerEvent", ".", "getDetectionSystem", "(", ")", ")", ")", ";", "Collection", "<", "Attack", ">", "attacks", "=", "appSensorServer", ".", "getAttackStore", "(", ")", ".", "findAttacks", "(", "criteria", ")", ";", "for", "(", "Attack", "attack", ":", "attacks", ")", "{", "if", "(", "attack", ".", "getRule", "(", ")", ".", "guidMatches", "(", "rule", ")", ")", "{", "if", "(", "DateUtils", ".", "fromString", "(", "attack", ".", "getTimestamp", "(", ")", ")", ".", "isAfter", "(", "newest", ")", ")", "{", "newest", "=", "DateUtils", ".", "fromString", "(", "attack", ".", "getTimestamp", "(", ")", ")", ";", "}", "}", "}", "return", "newest", ";", "}" ]
Finds the most recent {@link Attack} from the {@link Rule} being evaluated. @param triggerEvent the {@link Event} that triggered the {@link Rule} @param rule the {@link Rule} being evaluated @return a {@link DateTime} of the most recent attack related to the {@link Rule}
[ "Finds", "the", "most", "recent", "{", "@link", "Attack", "}", "from", "the", "{", "@link", "Rule", "}", "being", "evaluated", "." ]
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java#L301-L320
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/session/SessionMemory.java
SessionMemory.getInstance
public static Session getInstance(PageContext pc, RefBoolean isNew, Log log) { """ load a new instance of the class @param pc @param isNew @return """ isNew.setValue(true); return new SessionMemory(pc, log); }
java
public static Session getInstance(PageContext pc, RefBoolean isNew, Log log) { isNew.setValue(true); return new SessionMemory(pc, log); }
[ "public", "static", "Session", "getInstance", "(", "PageContext", "pc", ",", "RefBoolean", "isNew", ",", "Log", "log", ")", "{", "isNew", ".", "setValue", "(", "true", ")", ";", "return", "new", "SessionMemory", "(", "pc", ",", "log", ")", ";", "}" ]
load a new instance of the class @param pc @param isNew @return
[ "load", "a", "new", "instance", "of", "the", "class" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/session/SessionMemory.java#L62-L65
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/extendedIdentifiers/ExtendedIdentifiers.java
ExtendedIdentifiers.createExtendedIdentifier
public static Identity createExtendedIdentifier(String namespaceUri, String namespacePrefix, String identifierName) { """ Creates an Extended Identifier; uses an empty string for the administrativeDomain attribute and does not add an attribute <i>name</i>. @param namespaceUri URI of the namespace of the inner XML of the Extended Identifier @param namespacePrefix prefix of the namespace of the inner XML of the Extended Identifier @param identifierName the name value of the Extended Identifier (will be the root node of the inner XML) @return an {@link Identity} instance encapsulating the Extended Identifier """ return createExtendedIdentifier(namespaceUri, namespacePrefix, identifierName, null, ""); }
java
public static Identity createExtendedIdentifier(String namespaceUri, String namespacePrefix, String identifierName) { return createExtendedIdentifier(namespaceUri, namespacePrefix, identifierName, null, ""); }
[ "public", "static", "Identity", "createExtendedIdentifier", "(", "String", "namespaceUri", ",", "String", "namespacePrefix", ",", "String", "identifierName", ")", "{", "return", "createExtendedIdentifier", "(", "namespaceUri", ",", "namespacePrefix", ",", "identifierName", ",", "null", ",", "\"\"", ")", ";", "}" ]
Creates an Extended Identifier; uses an empty string for the administrativeDomain attribute and does not add an attribute <i>name</i>. @param namespaceUri URI of the namespace of the inner XML of the Extended Identifier @param namespacePrefix prefix of the namespace of the inner XML of the Extended Identifier @param identifierName the name value of the Extended Identifier (will be the root node of the inner XML) @return an {@link Identity} instance encapsulating the Extended Identifier
[ "Creates", "an", "Extended", "Identifier", ";", "uses", "an", "empty", "string", "for", "the", "administrativeDomain", "attribute", "and", "does", "not", "add", "an", "attribute", "<i", ">", "name<", "/", "i", ">", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/extendedIdentifiers/ExtendedIdentifiers.java#L143-L145
Ordinastie/MalisisCore
src/main/java/net/malisis/core/inventory/MalisisInventoryContainer.java
MalisisInventoryContainer.handleHotbar
private ItemStack handleHotbar(MalisisInventory inventory, MalisisSlot hoveredSlot, int num) { """ Handles player pressing 1-9 key while hovering a slot. @param hoveredSlot hoveredSlot @param num the num @return the item stack """ MalisisSlot hotbarSlot = getPlayerInventory().getSlot(num); // slot from player's inventory, swap itemStacks if (inventory == getPlayerInventory() || hoveredSlot.getItemStack().isEmpty()) { if (hoveredSlot.isState(PLAYER_INSERT)) { ItemStack dest = hotbarSlot.extract(ItemUtils.FULL_STACK); ItemStack src = hoveredSlot.extract(ItemUtils.FULL_STACK); dest = hoveredSlot.insert(dest); //couldn't fit all into the slot, put back what's left in hotbar if (!dest.isEmpty()) { hotbarSlot.insert(dest); //src should be empty but better safe than sorry inventory.transferInto(src); } else src = hotbarSlot.insert(src); } } // merge itemStack in slot into hotbar. If already holding an itemStack, move elsewhere inside player inventory else { if (hoveredSlot.isState(PLAYER_EXTRACT)) { ItemStack dest = hoveredSlot.extract(ItemUtils.FULL_STACK); ItemStack left = hotbarSlot.insert(dest, ItemUtils.FULL_STACK, true); getPlayerInventory().transferInto(left, false); } } return hotbarSlot.getItemStack(); }
java
private ItemStack handleHotbar(MalisisInventory inventory, MalisisSlot hoveredSlot, int num) { MalisisSlot hotbarSlot = getPlayerInventory().getSlot(num); // slot from player's inventory, swap itemStacks if (inventory == getPlayerInventory() || hoveredSlot.getItemStack().isEmpty()) { if (hoveredSlot.isState(PLAYER_INSERT)) { ItemStack dest = hotbarSlot.extract(ItemUtils.FULL_STACK); ItemStack src = hoveredSlot.extract(ItemUtils.FULL_STACK); dest = hoveredSlot.insert(dest); //couldn't fit all into the slot, put back what's left in hotbar if (!dest.isEmpty()) { hotbarSlot.insert(dest); //src should be empty but better safe than sorry inventory.transferInto(src); } else src = hotbarSlot.insert(src); } } // merge itemStack in slot into hotbar. If already holding an itemStack, move elsewhere inside player inventory else { if (hoveredSlot.isState(PLAYER_EXTRACT)) { ItemStack dest = hoveredSlot.extract(ItemUtils.FULL_STACK); ItemStack left = hotbarSlot.insert(dest, ItemUtils.FULL_STACK, true); getPlayerInventory().transferInto(left, false); } } return hotbarSlot.getItemStack(); }
[ "private", "ItemStack", "handleHotbar", "(", "MalisisInventory", "inventory", ",", "MalisisSlot", "hoveredSlot", ",", "int", "num", ")", "{", "MalisisSlot", "hotbarSlot", "=", "getPlayerInventory", "(", ")", ".", "getSlot", "(", "num", ")", ";", "// slot from player's inventory, swap itemStacks", "if", "(", "inventory", "==", "getPlayerInventory", "(", ")", "||", "hoveredSlot", ".", "getItemStack", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "hoveredSlot", ".", "isState", "(", "PLAYER_INSERT", ")", ")", "{", "ItemStack", "dest", "=", "hotbarSlot", ".", "extract", "(", "ItemUtils", ".", "FULL_STACK", ")", ";", "ItemStack", "src", "=", "hoveredSlot", ".", "extract", "(", "ItemUtils", ".", "FULL_STACK", ")", ";", "dest", "=", "hoveredSlot", ".", "insert", "(", "dest", ")", ";", "//couldn't fit all into the slot, put back what's left in hotbar", "if", "(", "!", "dest", ".", "isEmpty", "(", ")", ")", "{", "hotbarSlot", ".", "insert", "(", "dest", ")", ";", "//src should be empty but better safe than sorry", "inventory", ".", "transferInto", "(", "src", ")", ";", "}", "else", "src", "=", "hotbarSlot", ".", "insert", "(", "src", ")", ";", "}", "}", "// merge itemStack in slot into hotbar. If already holding an itemStack, move elsewhere inside player inventory", "else", "{", "if", "(", "hoveredSlot", ".", "isState", "(", "PLAYER_EXTRACT", ")", ")", "{", "ItemStack", "dest", "=", "hoveredSlot", ".", "extract", "(", "ItemUtils", ".", "FULL_STACK", ")", ";", "ItemStack", "left", "=", "hotbarSlot", ".", "insert", "(", "dest", ",", "ItemUtils", ".", "FULL_STACK", ",", "true", ")", ";", "getPlayerInventory", "(", ")", ".", "transferInto", "(", "left", ",", "false", ")", ";", "}", "}", "return", "hotbarSlot", ".", "getItemStack", "(", ")", ";", "}" ]
Handles player pressing 1-9 key while hovering a slot. @param hoveredSlot hoveredSlot @param num the num @return the item stack
[ "Handles", "player", "pressing", "1", "-", "9", "key", "while", "hovering", "a", "slot", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/inventory/MalisisInventoryContainer.java#L534-L570
LearnLib/automatalib
commons/util/src/main/java/net/automatalib/commons/util/ReflectUtil.java
ReflectUtil.findMethod
public static Method findMethod(Class<?> clazz, String name, Class<?>... params) { """ Tries to find a method of the given name that is able to accept parameters of the given types. First tries to find the method matching the exact parameter types. If such a method does not exist, tries to find any (the first match of arbitrary order) method that is able to accept the parameter types by means of auto-boxing, i.e. a {@code Method(int)} would be returned for the parameters class {@code Integer.class}. <p> Returns {@code null} if no such method could be found. @param clazz the class which should be scanned for methods @param name the name of the method @param params the types of the method arguments @return A method that is able to accept parameters of the specified types, {@code null} if such a method could not be found. """ try { return clazz.getMethod(name, params); } catch (NoSuchMethodException e) { Method[] methods = clazz.getMethods(); for (Method candidate : methods) { if (candidate.getName().equals(name) && w2pEquals(candidate.getParameterTypes(), params)) { return candidate; } } return null; } }
java
public static Method findMethod(Class<?> clazz, String name, Class<?>... params) { try { return clazz.getMethod(name, params); } catch (NoSuchMethodException e) { Method[] methods = clazz.getMethods(); for (Method candidate : methods) { if (candidate.getName().equals(name) && w2pEquals(candidate.getParameterTypes(), params)) { return candidate; } } return null; } }
[ "public", "static", "Method", "findMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ",", "Class", "<", "?", ">", "...", "params", ")", "{", "try", "{", "return", "clazz", ".", "getMethod", "(", "name", ",", "params", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "Method", "[", "]", "methods", "=", "clazz", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "candidate", ":", "methods", ")", "{", "if", "(", "candidate", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", "&&", "w2pEquals", "(", "candidate", ".", "getParameterTypes", "(", ")", ",", "params", ")", ")", "{", "return", "candidate", ";", "}", "}", "return", "null", ";", "}", "}" ]
Tries to find a method of the given name that is able to accept parameters of the given types. First tries to find the method matching the exact parameter types. If such a method does not exist, tries to find any (the first match of arbitrary order) method that is able to accept the parameter types by means of auto-boxing, i.e. a {@code Method(int)} would be returned for the parameters class {@code Integer.class}. <p> Returns {@code null} if no such method could be found. @param clazz the class which should be scanned for methods @param name the name of the method @param params the types of the method arguments @return A method that is able to accept parameters of the specified types, {@code null} if such a method could not be found.
[ "Tries", "to", "find", "a", "method", "of", "the", "given", "name", "that", "is", "able", "to", "accept", "parameters", "of", "the", "given", "types", ".", "First", "tries", "to", "find", "the", "method", "matching", "the", "exact", "parameter", "types", ".", "If", "such", "a", "method", "does", "not", "exist", "tries", "to", "find", "any", "(", "the", "first", "match", "of", "arbitrary", "order", ")", "method", "that", "is", "able", "to", "accept", "the", "parameter", "types", "by", "means", "of", "auto", "-", "boxing", "i", ".", "e", ".", "a", "{", "@code", "Method", "(", "int", ")", "}", "would", "be", "returned", "for", "the", "parameters", "class", "{", "@code", "Integer", ".", "class", "}", ".", "<p", ">", "Returns", "{", "@code", "null", "}", "if", "no", "such", "method", "could", "be", "found", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/ReflectUtil.java#L87-L101
devcon5io/common
cli/src/main/java/io/devcon5/cli/OptionInjector.java
OptionInjector.injectParameters
private void injectParameters(Object target, Map<String, Option> options) { """ Inject parameter values from the map of options. @param target the target instance to parse cli parameters @param options the map of options, mapping short option names to {@link org.apache.commons.cli.Option} instances """ ClassStreams.selfAndSupertypes(target.getClass()).forEach(type -> { for (Field f : type.getDeclaredFields()) { Optional.ofNullable(f.getAnnotation(CliOption.class)) .ifPresent(opt -> populate(f, target, getEffectiveValue(options, opt))); Optional.ofNullable(f.getAnnotation(CliOptionGroup.class)) .ifPresent(opt -> populate(f, target, options)); } }); }
java
private void injectParameters(Object target, Map<String, Option> options) { ClassStreams.selfAndSupertypes(target.getClass()).forEach(type -> { for (Field f : type.getDeclaredFields()) { Optional.ofNullable(f.getAnnotation(CliOption.class)) .ifPresent(opt -> populate(f, target, getEffectiveValue(options, opt))); Optional.ofNullable(f.getAnnotation(CliOptionGroup.class)) .ifPresent(opt -> populate(f, target, options)); } }); }
[ "private", "void", "injectParameters", "(", "Object", "target", ",", "Map", "<", "String", ",", "Option", ">", "options", ")", "{", "ClassStreams", ".", "selfAndSupertypes", "(", "target", ".", "getClass", "(", ")", ")", ".", "forEach", "(", "type", "->", "{", "for", "(", "Field", "f", ":", "type", ".", "getDeclaredFields", "(", ")", ")", "{", "Optional", ".", "ofNullable", "(", "f", ".", "getAnnotation", "(", "CliOption", ".", "class", ")", ")", ".", "ifPresent", "(", "opt", "->", "populate", "(", "f", ",", "target", ",", "getEffectiveValue", "(", "options", ",", "opt", ")", ")", ")", ";", "Optional", ".", "ofNullable", "(", "f", ".", "getAnnotation", "(", "CliOptionGroup", ".", "class", ")", ")", ".", "ifPresent", "(", "opt", "->", "populate", "(", "f", ",", "target", ",", "options", ")", ")", ";", "}", "}", ")", ";", "}" ]
Inject parameter values from the map of options. @param target the target instance to parse cli parameters @param options the map of options, mapping short option names to {@link org.apache.commons.cli.Option} instances
[ "Inject", "parameter", "values", "from", "the", "map", "of", "options", "." ]
train
https://github.com/devcon5io/common/blob/363688e0dc904d559682bf796bd6c836b4e0efc7/cli/src/main/java/io/devcon5/cli/OptionInjector.java#L141-L150
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.getTextureMapModeU
public AiTextureMapMode getTextureMapModeU(AiTextureType type, int index) { """ Returns the texture mapping mode for the u axis.<p> If missing, defaults to {@link AiTextureMapMode#CLAMP} @param type the texture type @param index the index in the texture stack @return the texture mapping mode """ checkTexRange(type, index); Property p = getProperty(PropertyKey.TEX_MAP_MODE_U.m_key); if (null == p || null == p.getData()) { return (AiTextureMapMode) m_defaults.get( PropertyKey.TEX_MAP_MODE_U); } return AiTextureMapMode.fromRawValue(p.getData()); }
java
public AiTextureMapMode getTextureMapModeU(AiTextureType type, int index) { checkTexRange(type, index); Property p = getProperty(PropertyKey.TEX_MAP_MODE_U.m_key); if (null == p || null == p.getData()) { return (AiTextureMapMode) m_defaults.get( PropertyKey.TEX_MAP_MODE_U); } return AiTextureMapMode.fromRawValue(p.getData()); }
[ "public", "AiTextureMapMode", "getTextureMapModeU", "(", "AiTextureType", "type", ",", "int", "index", ")", "{", "checkTexRange", "(", "type", ",", "index", ")", ";", "Property", "p", "=", "getProperty", "(", "PropertyKey", ".", "TEX_MAP_MODE_U", ".", "m_key", ")", ";", "if", "(", "null", "==", "p", "||", "null", "==", "p", ".", "getData", "(", ")", ")", "{", "return", "(", "AiTextureMapMode", ")", "m_defaults", ".", "get", "(", "PropertyKey", ".", "TEX_MAP_MODE_U", ")", ";", "}", "return", "AiTextureMapMode", ".", "fromRawValue", "(", "p", ".", "getData", "(", ")", ")", ";", "}" ]
Returns the texture mapping mode for the u axis.<p> If missing, defaults to {@link AiTextureMapMode#CLAMP} @param type the texture type @param index the index in the texture stack @return the texture mapping mode
[ "Returns", "the", "texture", "mapping", "mode", "for", "the", "u", "axis", ".", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L977-L988
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/MacroCycleLayout.java
MacroCycleLayout.selectCoords
private int selectCoords(Collection<Point2d[]> ps, Point2d[] coords, IRing macrocycle, IRingSet ringset) { """ Select the best coordinates @param ps template points @param coords best coordinates (updated by this method) @param macrocycle the macrocycle @param ringset rest of the ring system @return offset into the coordinates """ assert ps.size() != 0; final int[] winding = new int[coords.length]; MacroScore best = null; for (Point2d[] p : ps) { final int wind = winding(p, winding); MacroScore score = bestScore(macrocycle, ringset, wind, winding); if (score.compareTo(best) < 0) { best = score; System.arraycopy(p, 0, coords, 0, p.length); } } // never null return best != null ? best.offset : 0; }
java
private int selectCoords(Collection<Point2d[]> ps, Point2d[] coords, IRing macrocycle, IRingSet ringset) { assert ps.size() != 0; final int[] winding = new int[coords.length]; MacroScore best = null; for (Point2d[] p : ps) { final int wind = winding(p, winding); MacroScore score = bestScore(macrocycle, ringset, wind, winding); if (score.compareTo(best) < 0) { best = score; System.arraycopy(p, 0, coords, 0, p.length); } } // never null return best != null ? best.offset : 0; }
[ "private", "int", "selectCoords", "(", "Collection", "<", "Point2d", "[", "]", ">", "ps", ",", "Point2d", "[", "]", "coords", ",", "IRing", "macrocycle", ",", "IRingSet", "ringset", ")", "{", "assert", "ps", ".", "size", "(", ")", "!=", "0", ";", "final", "int", "[", "]", "winding", "=", "new", "int", "[", "coords", ".", "length", "]", ";", "MacroScore", "best", "=", "null", ";", "for", "(", "Point2d", "[", "]", "p", ":", "ps", ")", "{", "final", "int", "wind", "=", "winding", "(", "p", ",", "winding", ")", ";", "MacroScore", "score", "=", "bestScore", "(", "macrocycle", ",", "ringset", ",", "wind", ",", "winding", ")", ";", "if", "(", "score", ".", "compareTo", "(", "best", ")", "<", "0", ")", "{", "best", "=", "score", ";", "System", ".", "arraycopy", "(", "p", ",", "0", ",", "coords", ",", "0", ",", "p", ".", "length", ")", ";", "}", "}", "// never null", "return", "best", "!=", "null", "?", "best", ".", "offset", ":", "0", ";", "}" ]
Select the best coordinates @param ps template points @param coords best coordinates (updated by this method) @param macrocycle the macrocycle @param ringset rest of the ring system @return offset into the coordinates
[ "Select", "the", "best", "coordinates" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/MacroCycleLayout.java#L268-L284
aws/aws-sdk-java
aws-java-sdk-gamelift/src/main/java/com/amazonaws/services/gamelift/model/Player.java
Player.withPlayerAttributes
public Player withPlayerAttributes(java.util.Map<String, AttributeValue> playerAttributes) { """ <p> Collection of key:value pairs containing player information for use in matchmaking. Player attribute keys must match the <i>playerAttributes</i> used in a matchmaking rule set. Example: <code>"PlayerAttributes": {"skill": {"N": "23"}, "gameMode": {"S": "deathmatch"}}</code>. </p> @param playerAttributes Collection of key:value pairs containing player information for use in matchmaking. Player attribute keys must match the <i>playerAttributes</i> used in a matchmaking rule set. Example: <code>"PlayerAttributes": {"skill": {"N": "23"}, "gameMode": {"S": "deathmatch"}}</code>. @return Returns a reference to this object so that method calls can be chained together. """ setPlayerAttributes(playerAttributes); return this; }
java
public Player withPlayerAttributes(java.util.Map<String, AttributeValue> playerAttributes) { setPlayerAttributes(playerAttributes); return this; }
[ "public", "Player", "withPlayerAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", "playerAttributes", ")", "{", "setPlayerAttributes", "(", "playerAttributes", ")", ";", "return", "this", ";", "}" ]
<p> Collection of key:value pairs containing player information for use in matchmaking. Player attribute keys must match the <i>playerAttributes</i> used in a matchmaking rule set. Example: <code>"PlayerAttributes": {"skill": {"N": "23"}, "gameMode": {"S": "deathmatch"}}</code>. </p> @param playerAttributes Collection of key:value pairs containing player information for use in matchmaking. Player attribute keys must match the <i>playerAttributes</i> used in a matchmaking rule set. Example: <code>"PlayerAttributes": {"skill": {"N": "23"}, "gameMode": {"S": "deathmatch"}}</code>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Collection", "of", "key", ":", "value", "pairs", "containing", "player", "information", "for", "use", "in", "matchmaking", ".", "Player", "attribute", "keys", "must", "match", "the", "<i", ">", "playerAttributes<", "/", "i", ">", "used", "in", "a", "matchmaking", "rule", "set", ".", "Example", ":", "<code", ">", "PlayerAttributes", ":", "{", "skill", ":", "{", "N", ":", "23", "}", "gameMode", ":", "{", "S", ":", "deathmatch", "}}", "<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-gamelift/src/main/java/com/amazonaws/services/gamelift/model/Player.java#L153-L156
google/closure-compiler
src/com/google/javascript/refactoring/ErrorToFixMapper.java
ErrorToFixMapper.getFixForJsError
public static SuggestedFix getFixForJsError(JSError error, AbstractCompiler compiler) { """ Creates a SuggestedFix for the given error. Note that some errors have multiple fixes so getFixesForJsError should often be used instead of this. """ switch (error.getType().key) { case "JSC_REDECLARED_VARIABLE": return getFixForRedeclaration(error, compiler); case "JSC_REFERENCE_BEFORE_DECLARE": return getFixForEarlyReference(error, compiler); case "JSC_MISSING_SEMICOLON": return getFixForMissingSemicolon(error, compiler); case "JSC_REQUIRES_NOT_SORTED": return getFixForUnsortedRequires(error, compiler); case "JSC_PROVIDES_NOT_SORTED": return getFixForUnsortedProvides(error, compiler); case "JSC_DEBUGGER_STATEMENT_PRESENT": return removeNode(error, compiler); case "JSC_USELESS_EMPTY_STATEMENT": return removeEmptyStatement(error, compiler); case "JSC_INEXISTENT_PROPERTY": return getFixForInexistentProperty(error, compiler); case "JSC_MISSING_CALL_TO_SUPER": return getFixForMissingSuper(error, compiler); case "JSC_INVALID_SUPER_CALL_WITH_SUGGESTION": return getFixForInvalidSuper(error, compiler); case "JSC_MISSING_REQUIRE_WARNING": case "JSC_MISSING_REQUIRE_STRICT_WARNING": return getFixForMissingRequire(error, compiler); case "JSC_EXTRA_REQUIRE_WARNING": return getFixForExtraRequire(error, compiler); case "JSC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME": case "JSC_JSDOC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME": case "JSC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME": // TODO(tbreisacher): Apply this fix for JSC_JSDOC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME. return getFixForReferenceToShortImportByLongName(error, compiler); case "JSC_REDUNDANT_NULLABILITY_MODIFIER_JSDOC": return getFixForRedundantNullabilityModifierJsDoc(error, compiler); default: return null; } }
java
public static SuggestedFix getFixForJsError(JSError error, AbstractCompiler compiler) { switch (error.getType().key) { case "JSC_REDECLARED_VARIABLE": return getFixForRedeclaration(error, compiler); case "JSC_REFERENCE_BEFORE_DECLARE": return getFixForEarlyReference(error, compiler); case "JSC_MISSING_SEMICOLON": return getFixForMissingSemicolon(error, compiler); case "JSC_REQUIRES_NOT_SORTED": return getFixForUnsortedRequires(error, compiler); case "JSC_PROVIDES_NOT_SORTED": return getFixForUnsortedProvides(error, compiler); case "JSC_DEBUGGER_STATEMENT_PRESENT": return removeNode(error, compiler); case "JSC_USELESS_EMPTY_STATEMENT": return removeEmptyStatement(error, compiler); case "JSC_INEXISTENT_PROPERTY": return getFixForInexistentProperty(error, compiler); case "JSC_MISSING_CALL_TO_SUPER": return getFixForMissingSuper(error, compiler); case "JSC_INVALID_SUPER_CALL_WITH_SUGGESTION": return getFixForInvalidSuper(error, compiler); case "JSC_MISSING_REQUIRE_WARNING": case "JSC_MISSING_REQUIRE_STRICT_WARNING": return getFixForMissingRequire(error, compiler); case "JSC_EXTRA_REQUIRE_WARNING": return getFixForExtraRequire(error, compiler); case "JSC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME": case "JSC_JSDOC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME": case "JSC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME": // TODO(tbreisacher): Apply this fix for JSC_JSDOC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME. return getFixForReferenceToShortImportByLongName(error, compiler); case "JSC_REDUNDANT_NULLABILITY_MODIFIER_JSDOC": return getFixForRedundantNullabilityModifierJsDoc(error, compiler); default: return null; } }
[ "public", "static", "SuggestedFix", "getFixForJsError", "(", "JSError", "error", ",", "AbstractCompiler", "compiler", ")", "{", "switch", "(", "error", ".", "getType", "(", ")", ".", "key", ")", "{", "case", "\"JSC_REDECLARED_VARIABLE\"", ":", "return", "getFixForRedeclaration", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_REFERENCE_BEFORE_DECLARE\"", ":", "return", "getFixForEarlyReference", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_MISSING_SEMICOLON\"", ":", "return", "getFixForMissingSemicolon", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_REQUIRES_NOT_SORTED\"", ":", "return", "getFixForUnsortedRequires", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_PROVIDES_NOT_SORTED\"", ":", "return", "getFixForUnsortedProvides", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_DEBUGGER_STATEMENT_PRESENT\"", ":", "return", "removeNode", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_USELESS_EMPTY_STATEMENT\"", ":", "return", "removeEmptyStatement", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_INEXISTENT_PROPERTY\"", ":", "return", "getFixForInexistentProperty", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_MISSING_CALL_TO_SUPER\"", ":", "return", "getFixForMissingSuper", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_INVALID_SUPER_CALL_WITH_SUGGESTION\"", ":", "return", "getFixForInvalidSuper", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_MISSING_REQUIRE_WARNING\"", ":", "case", "\"JSC_MISSING_REQUIRE_STRICT_WARNING\"", ":", "return", "getFixForMissingRequire", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_EXTRA_REQUIRE_WARNING\"", ":", "return", "getFixForExtraRequire", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME\"", ":", "case", "\"JSC_JSDOC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME\"", ":", "case", "\"JSC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME\"", ":", "// TODO(tbreisacher): Apply this fix for JSC_JSDOC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME.", "return", "getFixForReferenceToShortImportByLongName", "(", "error", ",", "compiler", ")", ";", "case", "\"JSC_REDUNDANT_NULLABILITY_MODIFIER_JSDOC\"", ":", "return", "getFixForRedundantNullabilityModifierJsDoc", "(", "error", ",", "compiler", ")", ";", "default", ":", "return", "null", ";", "}", "}" ]
Creates a SuggestedFix for the given error. Note that some errors have multiple fixes so getFixesForJsError should often be used instead of this.
[ "Creates", "a", "SuggestedFix", "for", "the", "given", "error", ".", "Note", "that", "some", "errors", "have", "multiple", "fixes", "so", "getFixesForJsError", "should", "often", "be", "used", "instead", "of", "this", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/ErrorToFixMapper.java#L74-L111
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java
PAbstractObject.getObject
@Override public final PObject getObject(final String key) { """ Get a property as a object or throw exception. @param key the property name """ PObject result = optObject(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
@Override public final PObject getObject(final String key) { PObject result = optObject(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
[ "@", "Override", "public", "final", "PObject", "getObject", "(", "final", "String", "key", ")", "{", "PObject", "result", "=", "optObject", "(", "key", ")", ";", "if", "(", "result", "==", "null", ")", "{", "throw", "new", "ObjectMissingException", "(", "this", ",", "key", ")", ";", "}", "return", "result", ";", "}" ]
Get a property as a object or throw exception. @param key the property name
[ "Get", "a", "property", "as", "a", "object", "or", "throw", "exception", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L180-L187
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.java
ProcessEngineConfigurationImpl.ensurePrefixAndSchemaFitToegether
protected void ensurePrefixAndSchemaFitToegether(String prefix, String schema) { """ When providing a schema and a prefix the prefix has to be the schema ending with a dot. """ if (schema == null) { return; } else if (prefix == null || (prefix != null && !prefix.startsWith(schema + "."))) { throw new ProcessEngineException("When setting a schema the prefix has to be schema + '.'. Received schema: " + schema + " prefix: " + prefix); } }
java
protected void ensurePrefixAndSchemaFitToegether(String prefix, String schema) { if (schema == null) { return; } else if (prefix == null || (prefix != null && !prefix.startsWith(schema + "."))) { throw new ProcessEngineException("When setting a schema the prefix has to be schema + '.'. Received schema: " + schema + " prefix: " + prefix); } }
[ "protected", "void", "ensurePrefixAndSchemaFitToegether", "(", "String", "prefix", ",", "String", "schema", ")", "{", "if", "(", "schema", "==", "null", ")", "{", "return", ";", "}", "else", "if", "(", "prefix", "==", "null", "||", "(", "prefix", "!=", "null", "&&", "!", "prefix", ".", "startsWith", "(", "schema", "+", "\".\"", ")", ")", ")", "{", "throw", "new", "ProcessEngineException", "(", "\"When setting a schema the prefix has to be schema + '.'. Received schema: \"", "+", "schema", "+", "\" prefix: \"", "+", "prefix", ")", ";", "}", "}" ]
When providing a schema and a prefix the prefix has to be the schema ending with a dot.
[ "When", "providing", "a", "schema", "and", "a", "prefix", "the", "prefix", "has", "to", "be", "the", "schema", "ending", "with", "a", "dot", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L1677-L1683
jcuda/jcudnn
JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java
JCudnn.cudnnSetLRNDescriptor
public static int cudnnSetLRNDescriptor( cudnnLRNDescriptor normDesc, int lrnN, double lrnAlpha, double lrnBeta, double lrnK) { """ <pre> Uses a window [center-lookBehind, center+lookAhead], where lookBehind = floor( (lrnN-1)/2 ), lookAhead = lrnN-lookBehind-1. Values of double parameters cast to tensor data type. </pre> """ return checkResult(cudnnSetLRNDescriptorNative(normDesc, lrnN, lrnAlpha, lrnBeta, lrnK)); }
java
public static int cudnnSetLRNDescriptor( cudnnLRNDescriptor normDesc, int lrnN, double lrnAlpha, double lrnBeta, double lrnK) { return checkResult(cudnnSetLRNDescriptorNative(normDesc, lrnN, lrnAlpha, lrnBeta, lrnK)); }
[ "public", "static", "int", "cudnnSetLRNDescriptor", "(", "cudnnLRNDescriptor", "normDesc", ",", "int", "lrnN", ",", "double", "lrnAlpha", ",", "double", "lrnBeta", ",", "double", "lrnK", ")", "{", "return", "checkResult", "(", "cudnnSetLRNDescriptorNative", "(", "normDesc", ",", "lrnN", ",", "lrnAlpha", ",", "lrnBeta", ",", "lrnK", ")", ")", ";", "}" ]
<pre> Uses a window [center-lookBehind, center+lookAhead], where lookBehind = floor( (lrnN-1)/2 ), lookAhead = lrnN-lookBehind-1. Values of double parameters cast to tensor data type. </pre>
[ "<pre", ">", "Uses", "a", "window", "[", "center", "-", "lookBehind", "center", "+", "lookAhead", "]", "where", "lookBehind", "=", "floor", "(", "(", "lrnN", "-", "1", ")", "/", "2", ")", "lookAhead", "=", "lrnN", "-", "lookBehind", "-", "1", ".", "Values", "of", "double", "parameters", "cast", "to", "tensor", "data", "type", ".", "<", "/", "pre", ">" ]
train
https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L2002-L2010
drewwills/cernunnos
cernunnos-core/src/main/java/org/danann/cernunnos/runtime/web/Settings.java
Settings.locateContextConfig
public static URL locateContextConfig(String webappRootContext, String userSpecifiedContextLocation, URL defaultLocation) { """ Locate the configuration file, if present, for a Portlet or Servlet. @param webappRootContext Context URL (in String form) from which <code>userSpecifiedContextLocation</code> will be evaluated by <code>ResourceHelper</code>, if specified @param userSpecifiedContextLocation Optional location specified in the deployment descriptor @param defaultLocation Optional default, which will be returned if <code>userSpecifiedContextLocation</code> is not provided @return The location of a configuration file, if present, or <code>null</code> """ // Assertions. if (webappRootContext == null) { String msg = "Argument 'webappRootContext' cannot be null."; throw new IllegalArgumentException(msg); } // NB: Both 'userSpecifiedContextLocation' & 'defaultLocation' may be null URL rslt = null; if (userSpecifiedContextLocation != null) { /* * SPECIAL HANDLING: We remove a leaving slash ('/') here because, when * no protocol is specified, the expectation is that the path is * evaluated from the root of the webapp ('webappRootContext'). If we * didn't, the ResourceHelper would incorrectly interpret these as the * root of the protocol, which is likely 'file:/' or 'jndi:/'. */ if (userSpecifiedContextLocation.startsWith("/")) { userSpecifiedContextLocation = userSpecifiedContextLocation.substring(1); } rslt = ResourceHelper.evaluate(webappRootContext, userSpecifiedContextLocation); } else { rslt = defaultLocation; // may be null... } return rslt; }
java
public static URL locateContextConfig(String webappRootContext, String userSpecifiedContextLocation, URL defaultLocation) { // Assertions. if (webappRootContext == null) { String msg = "Argument 'webappRootContext' cannot be null."; throw new IllegalArgumentException(msg); } // NB: Both 'userSpecifiedContextLocation' & 'defaultLocation' may be null URL rslt = null; if (userSpecifiedContextLocation != null) { /* * SPECIAL HANDLING: We remove a leaving slash ('/') here because, when * no protocol is specified, the expectation is that the path is * evaluated from the root of the webapp ('webappRootContext'). If we * didn't, the ResourceHelper would incorrectly interpret these as the * root of the protocol, which is likely 'file:/' or 'jndi:/'. */ if (userSpecifiedContextLocation.startsWith("/")) { userSpecifiedContextLocation = userSpecifiedContextLocation.substring(1); } rslt = ResourceHelper.evaluate(webappRootContext, userSpecifiedContextLocation); } else { rslt = defaultLocation; // may be null... } return rslt; }
[ "public", "static", "URL", "locateContextConfig", "(", "String", "webappRootContext", ",", "String", "userSpecifiedContextLocation", ",", "URL", "defaultLocation", ")", "{", "// Assertions.", "if", "(", "webappRootContext", "==", "null", ")", "{", "String", "msg", "=", "\"Argument 'webappRootContext' cannot be null.\"", ";", "throw", "new", "IllegalArgumentException", "(", "msg", ")", ";", "}", "// NB: Both 'userSpecifiedContextLocation' & 'defaultLocation' may be null", "URL", "rslt", "=", "null", ";", "if", "(", "userSpecifiedContextLocation", "!=", "null", ")", "{", "/*\n * SPECIAL HANDLING: We remove a leaving slash ('/') here because, when \n * no protocol is specified, the expectation is that the path is \n * evaluated from the root of the webapp ('webappRootContext'). If we \n * didn't, the ResourceHelper would incorrectly interpret these as the \n * root of the protocol, which is likely 'file:/' or 'jndi:/'. \n */", "if", "(", "userSpecifiedContextLocation", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "userSpecifiedContextLocation", "=", "userSpecifiedContextLocation", ".", "substring", "(", "1", ")", ";", "}", "rslt", "=", "ResourceHelper", ".", "evaluate", "(", "webappRootContext", ",", "userSpecifiedContextLocation", ")", ";", "}", "else", "{", "rslt", "=", "defaultLocation", ";", "// may be null...", "}", "return", "rslt", ";", "}" ]
Locate the configuration file, if present, for a Portlet or Servlet. @param webappRootContext Context URL (in String form) from which <code>userSpecifiedContextLocation</code> will be evaluated by <code>ResourceHelper</code>, if specified @param userSpecifiedContextLocation Optional location specified in the deployment descriptor @param defaultLocation Optional default, which will be returned if <code>userSpecifiedContextLocation</code> is not provided @return The location of a configuration file, if present, or <code>null</code>
[ "Locate", "the", "configuration", "file", "if", "present", "for", "a", "Portlet", "or", "Servlet", "." ]
train
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/runtime/web/Settings.java#L64-L95
tango-controls/JTango
server/src/main/java/org/tango/server/servant/ORBUtils.java
ORBUtils.registerDeviceForJacorb
private static void registerDeviceForJacorb(final String name) throws DevFailed { """ WARNING: The following code is JacORB specific. Add device name in HashTable used for JacORB objectKeyMap if _UseDb==false. @param name The device's name. @throws DevFailed """ // Get the 3 fields of device name final StringTokenizer st = new StringTokenizer(name, "/"); final String[] field = new String[3]; for (int i = 0; i < 3 && st.countTokens() > 0; i++) { field[i] = st.nextToken(); } // After a header used by JacORB, in the device name // the '/' char must be replaced by another separator final String separator = "&%25"; final String targetname = ORBManager.SERVER_IMPL_NAME + "/" + ORBManager.NODB_POA + "/" + field[0] + separator + field[1] + separator + field[2]; // And set the JacORB objectKeyMap HashMap final org.jacorb.orb.ORB jacorb = (org.jacorb.orb.ORB) ORBManager.getOrb(); jacorb.addObjectKey(name, targetname); }
java
private static void registerDeviceForJacorb(final String name) throws DevFailed { // Get the 3 fields of device name final StringTokenizer st = new StringTokenizer(name, "/"); final String[] field = new String[3]; for (int i = 0; i < 3 && st.countTokens() > 0; i++) { field[i] = st.nextToken(); } // After a header used by JacORB, in the device name // the '/' char must be replaced by another separator final String separator = "&%25"; final String targetname = ORBManager.SERVER_IMPL_NAME + "/" + ORBManager.NODB_POA + "/" + field[0] + separator + field[1] + separator + field[2]; // And set the JacORB objectKeyMap HashMap final org.jacorb.orb.ORB jacorb = (org.jacorb.orb.ORB) ORBManager.getOrb(); jacorb.addObjectKey(name, targetname); }
[ "private", "static", "void", "registerDeviceForJacorb", "(", "final", "String", "name", ")", "throws", "DevFailed", "{", "// Get the 3 fields of device name", "final", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "name", ",", "\"/\"", ")", ";", "final", "String", "[", "]", "field", "=", "new", "String", "[", "3", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", "&&", "st", ".", "countTokens", "(", ")", ">", "0", ";", "i", "++", ")", "{", "field", "[", "i", "]", "=", "st", ".", "nextToken", "(", ")", ";", "}", "// After a header used by JacORB, in the device name", "// the '/' char must be replaced by another separator", "final", "String", "separator", "=", "\"&%25\"", ";", "final", "String", "targetname", "=", "ORBManager", ".", "SERVER_IMPL_NAME", "+", "\"/\"", "+", "ORBManager", ".", "NODB_POA", "+", "\"/\"", "+", "field", "[", "0", "]", "+", "separator", "+", "field", "[", "1", "]", "+", "separator", "+", "field", "[", "2", "]", ";", "// And set the JacORB objectKeyMap HashMap", "final", "org", ".", "jacorb", ".", "orb", ".", "ORB", "jacorb", "=", "(", "org", ".", "jacorb", ".", "orb", ".", "ORB", ")", "ORBManager", ".", "getOrb", "(", ")", ";", "jacorb", ".", "addObjectKey", "(", "name", ",", "targetname", ")", ";", "}" ]
WARNING: The following code is JacORB specific. Add device name in HashTable used for JacORB objectKeyMap if _UseDb==false. @param name The device's name. @throws DevFailed
[ "WARNING", ":", "The", "following", "code", "is", "JacORB", "specific", ".", "Add", "device", "name", "in", "HashTable", "used", "for", "JacORB", "objectKeyMap", "if", "_UseDb", "==", "false", "." ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/servant/ORBUtils.java#L157-L173
h2oai/h2o-3
h2o-genmodel/src/main/java/hex/genmodel/ModelMojoReader.java
ModelMojoReader.readFrom
public static MojoModel readFrom(MojoReaderBackend reader, final boolean readModelDescriptor) throws IOException { """ De-serializes a {@link MojoModel}, creating an instance of {@link MojoModel} useful for scoring and model evaluation. @param reader An instance of {@link MojoReaderBackend} to read from existing MOJO @param readModelDescriptor If true, @return De-serialized {@link MojoModel} @throws IOException Whenever there is an error reading the {@link MojoModel}'s data. """ try { Map<String, Object> info = parseModelInfo(reader); if (! info.containsKey("algorithm")) throw new IllegalStateException("Unable to find information about the model's algorithm."); String algo = String.valueOf(info.get("algorithm")); ModelMojoReader mmr = ModelMojoFactory.INSTANCE.getMojoReader(algo); mmr._lkv = info; mmr._reader = reader; mmr.readAll(readModelDescriptor); return mmr._model; } finally { if (reader instanceof Closeable) ((Closeable) reader).close(); } }
java
public static MojoModel readFrom(MojoReaderBackend reader, final boolean readModelDescriptor) throws IOException { try { Map<String, Object> info = parseModelInfo(reader); if (! info.containsKey("algorithm")) throw new IllegalStateException("Unable to find information about the model's algorithm."); String algo = String.valueOf(info.get("algorithm")); ModelMojoReader mmr = ModelMojoFactory.INSTANCE.getMojoReader(algo); mmr._lkv = info; mmr._reader = reader; mmr.readAll(readModelDescriptor); return mmr._model; } finally { if (reader instanceof Closeable) ((Closeable) reader).close(); } }
[ "public", "static", "MojoModel", "readFrom", "(", "MojoReaderBackend", "reader", ",", "final", "boolean", "readModelDescriptor", ")", "throws", "IOException", "{", "try", "{", "Map", "<", "String", ",", "Object", ">", "info", "=", "parseModelInfo", "(", "reader", ")", ";", "if", "(", "!", "info", ".", "containsKey", "(", "\"algorithm\"", ")", ")", "throw", "new", "IllegalStateException", "(", "\"Unable to find information about the model's algorithm.\"", ")", ";", "String", "algo", "=", "String", ".", "valueOf", "(", "info", ".", "get", "(", "\"algorithm\"", ")", ")", ";", "ModelMojoReader", "mmr", "=", "ModelMojoFactory", ".", "INSTANCE", ".", "getMojoReader", "(", "algo", ")", ";", "mmr", ".", "_lkv", "=", "info", ";", "mmr", ".", "_reader", "=", "reader", ";", "mmr", ".", "readAll", "(", "readModelDescriptor", ")", ";", "return", "mmr", ".", "_model", ";", "}", "finally", "{", "if", "(", "reader", "instanceof", "Closeable", ")", "(", "(", "Closeable", ")", "reader", ")", ".", "close", "(", ")", ";", "}", "}" ]
De-serializes a {@link MojoModel}, creating an instance of {@link MojoModel} useful for scoring and model evaluation. @param reader An instance of {@link MojoReaderBackend} to read from existing MOJO @param readModelDescriptor If true, @return De-serialized {@link MojoModel} @throws IOException Whenever there is an error reading the {@link MojoModel}'s data.
[ "De", "-", "serializes", "a", "{", "@link", "MojoModel", "}", "creating", "an", "instance", "of", "{", "@link", "MojoModel", "}", "useful", "for", "scoring", "and", "model", "evaluation", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/ModelMojoReader.java#L50-L65
fuinorg/utils4j
src/main/java/org/fuin/utils4j/WaitHelper.java
WaitHelper.waitUntilResult
public <T> T waitUntilResult(final Callable<T> function, final List<T> expectedValues) throws Exception { """ Wait until one of the expected values was returned or the number of wait cycles has been exceeded. Throws {@link IllegalStateException} if the timeout is reached. @param function Function to read the value from. @param expectedValues List of values that are acceptable. @return Result. @throws Exception The function raised an exception. @param <T> Expected return type that must be an object that support equals/hasCode that is not the {@link Object}'s default method. """ final List<T> actualResults = new ArrayList<>(); int tries = 0; while (tries < maxTries) { final T result = function.call(); if (expectedValues.contains(result)) { return result; } actualResults.add(result); tries++; Utils4J.sleep(sleepMillis); } throw new IllegalStateException( "Waited too long for one of the expected results: " + expectedValues + ", Actual results: " + actualResults); }
java
public <T> T waitUntilResult(final Callable<T> function, final List<T> expectedValues) throws Exception { final List<T> actualResults = new ArrayList<>(); int tries = 0; while (tries < maxTries) { final T result = function.call(); if (expectedValues.contains(result)) { return result; } actualResults.add(result); tries++; Utils4J.sleep(sleepMillis); } throw new IllegalStateException( "Waited too long for one of the expected results: " + expectedValues + ", Actual results: " + actualResults); }
[ "public", "<", "T", ">", "T", "waitUntilResult", "(", "final", "Callable", "<", "T", ">", "function", ",", "final", "List", "<", "T", ">", "expectedValues", ")", "throws", "Exception", "{", "final", "List", "<", "T", ">", "actualResults", "=", "new", "ArrayList", "<>", "(", ")", ";", "int", "tries", "=", "0", ";", "while", "(", "tries", "<", "maxTries", ")", "{", "final", "T", "result", "=", "function", ".", "call", "(", ")", ";", "if", "(", "expectedValues", ".", "contains", "(", "result", ")", ")", "{", "return", "result", ";", "}", "actualResults", ".", "add", "(", "result", ")", ";", "tries", "++", ";", "Utils4J", ".", "sleep", "(", "sleepMillis", ")", ";", "}", "throw", "new", "IllegalStateException", "(", "\"Waited too long for one of the expected results: \"", "+", "expectedValues", "+", "\", Actual results: \"", "+", "actualResults", ")", ";", "}" ]
Wait until one of the expected values was returned or the number of wait cycles has been exceeded. Throws {@link IllegalStateException} if the timeout is reached. @param function Function to read the value from. @param expectedValues List of values that are acceptable. @return Result. @throws Exception The function raised an exception. @param <T> Expected return type that must be an object that support equals/hasCode that is not the {@link Object}'s default method.
[ "Wait", "until", "one", "of", "the", "expected", "values", "was", "returned", "or", "the", "number", "of", "wait", "cycles", "has", "been", "exceeded", ".", "Throws", "{", "@link", "IllegalStateException", "}", "if", "the", "timeout", "is", "reached", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/WaitHelper.java#L94-L110
census-instrumentation/opencensus-java
impl_core/src/main/java/io/opencensus/implcore/tags/propagation/CorrelationContextFormat.java
CorrelationContextFormat.decodeTag
private static void decodeTag(String stringTag, Map<TagKey, TagValueWithMetadata> tags) { """ The format of encoded string tag is name1=value1;properties1=p1;properties2=p2. """ String keyWithValue; int firstPropertyIndex = stringTag.indexOf(TAG_PROPERTIES_DELIMITER); if (firstPropertyIndex != -1) { // Tag with properties. keyWithValue = stringTag.substring(0, firstPropertyIndex); // TODO(songya): support decoding tag properties. } else { // Tag without properties. keyWithValue = stringTag; } List<String> keyValuePair = TAG_KEY_VALUE_SPLITTER.splitToList(keyWithValue); checkArgument(keyValuePair.size() == 2, "Malformed tag " + stringTag); TagKey key = TagKey.create(keyValuePair.get(0).trim()); TagValue value = TagValue.create(keyValuePair.get(1).trim()); TagValueWithMetadata valueWithMetadata = TagValueWithMetadata.create(value, METADATA_UNLIMITED_PROPAGATION); tags.put(key, valueWithMetadata); }
java
private static void decodeTag(String stringTag, Map<TagKey, TagValueWithMetadata> tags) { String keyWithValue; int firstPropertyIndex = stringTag.indexOf(TAG_PROPERTIES_DELIMITER); if (firstPropertyIndex != -1) { // Tag with properties. keyWithValue = stringTag.substring(0, firstPropertyIndex); // TODO(songya): support decoding tag properties. } else { // Tag without properties. keyWithValue = stringTag; } List<String> keyValuePair = TAG_KEY_VALUE_SPLITTER.splitToList(keyWithValue); checkArgument(keyValuePair.size() == 2, "Malformed tag " + stringTag); TagKey key = TagKey.create(keyValuePair.get(0).trim()); TagValue value = TagValue.create(keyValuePair.get(1).trim()); TagValueWithMetadata valueWithMetadata = TagValueWithMetadata.create(value, METADATA_UNLIMITED_PROPAGATION); tags.put(key, valueWithMetadata); }
[ "private", "static", "void", "decodeTag", "(", "String", "stringTag", ",", "Map", "<", "TagKey", ",", "TagValueWithMetadata", ">", "tags", ")", "{", "String", "keyWithValue", ";", "int", "firstPropertyIndex", "=", "stringTag", ".", "indexOf", "(", "TAG_PROPERTIES_DELIMITER", ")", ";", "if", "(", "firstPropertyIndex", "!=", "-", "1", ")", "{", "// Tag with properties.", "keyWithValue", "=", "stringTag", ".", "substring", "(", "0", ",", "firstPropertyIndex", ")", ";", "// TODO(songya): support decoding tag properties.", "}", "else", "{", "// Tag without properties.", "keyWithValue", "=", "stringTag", ";", "}", "List", "<", "String", ">", "keyValuePair", "=", "TAG_KEY_VALUE_SPLITTER", ".", "splitToList", "(", "keyWithValue", ")", ";", "checkArgument", "(", "keyValuePair", ".", "size", "(", ")", "==", "2", ",", "\"Malformed tag \"", "+", "stringTag", ")", ";", "TagKey", "key", "=", "TagKey", ".", "create", "(", "keyValuePair", ".", "get", "(", "0", ")", ".", "trim", "(", ")", ")", ";", "TagValue", "value", "=", "TagValue", ".", "create", "(", "keyValuePair", ".", "get", "(", "1", ")", ".", "trim", "(", ")", ")", ";", "TagValueWithMetadata", "valueWithMetadata", "=", "TagValueWithMetadata", ".", "create", "(", "value", ",", "METADATA_UNLIMITED_PROPAGATION", ")", ";", "tags", ".", "put", "(", "key", ",", "valueWithMetadata", ")", ";", "}" ]
The format of encoded string tag is name1=value1;properties1=p1;properties2=p2.
[ "The", "format", "of", "encoded", "string", "tag", "is", "name1", "=", "value1", ";", "properties1", "=", "p1", ";", "properties2", "=", "p2", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/impl_core/src/main/java/io/opencensus/implcore/tags/propagation/CorrelationContextFormat.java#L171-L187
scravy/java-pair
src/main/java/de/scravy/pair/Pairs.java
Pairs.toMap
public static <K, V, M extends Map<K, V>> M toMap( final Iterable<Pair<K, V>> pairs, final Class<M> mapType) { """ Creates a {@link Map} of the given <code>mapType</code> from an {@link Iterable} of pairs <code>(k, v)</code>. @since 1.0.0 @param pairs The pairs. @param mapType The map type (must have a public default constructor). @return The map populated with the values from <code>pairs</code> or <code>null</code>, if the Map could not be instantiated. """ try { final M map = mapType.newInstance(); return toMap(pairs, map); } catch (final Exception exc) { return null; } }
java
public static <K, V, M extends Map<K, V>> M toMap( final Iterable<Pair<K, V>> pairs, final Class<M> mapType) { try { final M map = mapType.newInstance(); return toMap(pairs, map); } catch (final Exception exc) { return null; } }
[ "public", "static", "<", "K", ",", "V", ",", "M", "extends", "Map", "<", "K", ",", "V", ">", ">", "M", "toMap", "(", "final", "Iterable", "<", "Pair", "<", "K", ",", "V", ">", ">", "pairs", ",", "final", "Class", "<", "M", ">", "mapType", ")", "{", "try", "{", "final", "M", "map", "=", "mapType", ".", "newInstance", "(", ")", ";", "return", "toMap", "(", "pairs", ",", "map", ")", ";", "}", "catch", "(", "final", "Exception", "exc", ")", "{", "return", "null", ";", "}", "}" ]
Creates a {@link Map} of the given <code>mapType</code> from an {@link Iterable} of pairs <code>(k, v)</code>. @since 1.0.0 @param pairs The pairs. @param mapType The map type (must have a public default constructor). @return The map populated with the values from <code>pairs</code> or <code>null</code>, if the Map could not be instantiated.
[ "Creates", "a", "{", "@link", "Map", "}", "of", "the", "given", "<code", ">", "mapType<", "/", "code", ">", "from", "an", "{", "@link", "Iterable", "}", "of", "pairs", "<code", ">", "(", "k", "v", ")", "<", "/", "code", ">", "." ]
train
https://github.com/scravy/java-pair/blob/d8792e86c4f8e977826a4ccb940e4416a1119ccb/src/main/java/de/scravy/pair/Pairs.java#L243-L251
liyiorg/weixin-popular
src/main/java/weixin/popular/api/WxaAPI.java
WxaAPI.get_auditstatus
public static GetAuditstatusResult get_auditstatus(String access_token,String auditid) { """ 代码管理<br> 获取第三方提交的审核版本的审核状态(仅供第三方代小程序调用) @since 2.8.9 @param access_token access_token @param auditid 审核ID @return result """ String json = String.format("{\"auditid\":\"%s\"}",auditid); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/wxa/get_auditstatus") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,GetAuditstatusResult.class); }
java
public static GetAuditstatusResult get_auditstatus(String access_token,String auditid){ String json = String.format("{\"auditid\":\"%s\"}",auditid); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/wxa/get_auditstatus") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,GetAuditstatusResult.class); }
[ "public", "static", "GetAuditstatusResult", "get_auditstatus", "(", "String", "access_token", ",", "String", "auditid", ")", "{", "String", "json", "=", "String", ".", "format", "(", "\"{\\\"auditid\\\":\\\"%s\\\"}\"", ",", "auditid", ")", ";", "HttpUriRequest", "httpUriRequest", "=", "RequestBuilder", ".", "post", "(", ")", ".", "setHeader", "(", "jsonHeader", ")", ".", "setUri", "(", "BASE_URI", "+", "\"/wxa/get_auditstatus\"", ")", ".", "addParameter", "(", "PARAM_ACCESS_TOKEN", ",", "API", ".", "accessToken", "(", "access_token", ")", ")", ".", "setEntity", "(", "new", "StringEntity", "(", "json", ",", "Charset", ".", "forName", "(", "\"utf-8\"", ")", ")", ")", ".", "build", "(", ")", ";", "return", "LocalHttpClient", ".", "executeJsonResult", "(", "httpUriRequest", ",", "GetAuditstatusResult", ".", "class", ")", ";", "}" ]
代码管理<br> 获取第三方提交的审核版本的审核状态(仅供第三方代小程序调用) @since 2.8.9 @param access_token access_token @param auditid 审核ID @return result
[ "代码管理<br", ">", "获取第三方提交的审核版本的审核状态(仅供第三方代小程序调用)" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/WxaAPI.java#L229-L238
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java
TransformerHandlerImpl.setResult
public void setResult(Result result) throws IllegalArgumentException { """ Enables the user of the TransformerHandler to set the to set the Result for the transformation. @param result A Result instance, should not be null. @throws IllegalArgumentException if result is invalid for some reason. """ if (null == result) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"result should not be null"); try { // ContentHandler handler = // m_transformer.createResultContentHandler(result); // m_transformer.setContentHandler(handler); SerializationHandler xoh = m_transformer.createSerializationHandler(result); m_transformer.setSerializationHandler(xoh); } catch (javax.xml.transform.TransformerException te) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_COULD_NOT_BE_SET, null)); //"result could not be set"); } m_result = result; }
java
public void setResult(Result result) throws IllegalArgumentException { if (null == result) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"result should not be null"); try { // ContentHandler handler = // m_transformer.createResultContentHandler(result); // m_transformer.setContentHandler(handler); SerializationHandler xoh = m_transformer.createSerializationHandler(result); m_transformer.setSerializationHandler(xoh); } catch (javax.xml.transform.TransformerException te) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_COULD_NOT_BE_SET, null)); //"result could not be set"); } m_result = result; }
[ "public", "void", "setResult", "(", "Result", "result", ")", "throws", "IllegalArgumentException", "{", "if", "(", "null", "==", "result", ")", "throw", "new", "IllegalArgumentException", "(", "XSLMessages", ".", "createMessage", "(", "XSLTErrorResources", ".", "ER_RESULT_NULL", ",", "null", ")", ")", ";", "//\"result should not be null\");", "try", "{", "// ContentHandler handler =", "// m_transformer.createResultContentHandler(result);", "// m_transformer.setContentHandler(handler);", "SerializationHandler", "xoh", "=", "m_transformer", ".", "createSerializationHandler", "(", "result", ")", ";", "m_transformer", ".", "setSerializationHandler", "(", "xoh", ")", ";", "}", "catch", "(", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "te", ")", "{", "throw", "new", "IllegalArgumentException", "(", "XSLMessages", ".", "createMessage", "(", "XSLTErrorResources", ".", "ER_RESULT_COULD_NOT_BE_SET", ",", "null", ")", ")", ";", "//\"result could not be set\");", "}", "m_result", "=", "result", ";", "}" ]
Enables the user of the TransformerHandler to set the to set the Result for the transformation. @param result A Result instance, should not be null. @throws IllegalArgumentException if result is invalid for some reason.
[ "Enables", "the", "user", "of", "the", "TransformerHandler", "to", "set", "the", "to", "set", "the", "Result", "for", "the", "transformation", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L174-L195
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
CuratorFrameworkFactory.newClient
public static CuratorFramework newClient(String connectString, RetryPolicy retryPolicy) { """ Create a new client with default session timeout and default connection timeout @param connectString list of servers to connect to @param retryPolicy retry policy to use @return client """ return newClient(connectString, DEFAULT_SESSION_TIMEOUT_MS, DEFAULT_CONNECTION_TIMEOUT_MS, retryPolicy); }
java
public static CuratorFramework newClient(String connectString, RetryPolicy retryPolicy) { return newClient(connectString, DEFAULT_SESSION_TIMEOUT_MS, DEFAULT_CONNECTION_TIMEOUT_MS, retryPolicy); }
[ "public", "static", "CuratorFramework", "newClient", "(", "String", "connectString", ",", "RetryPolicy", "retryPolicy", ")", "{", "return", "newClient", "(", "connectString", ",", "DEFAULT_SESSION_TIMEOUT_MS", ",", "DEFAULT_CONNECTION_TIMEOUT_MS", ",", "retryPolicy", ")", ";", "}" ]
Create a new client with default session timeout and default connection timeout @param connectString list of servers to connect to @param retryPolicy retry policy to use @return client
[ "Create", "a", "new", "client", "with", "default", "session", "timeout", "and", "default", "connection", "timeout" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java#L79-L82
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpRequestBuilder.java
FoxHttpRequestBuilder.addFoxHttpPlaceholderEntry
public FoxHttpRequestBuilder addFoxHttpPlaceholderEntry(String placeholder, String value) { """ Add a FoxHttpPlaceholderEntry to the FoxHttpPlaceholderStrategy @param placeholder name of the placeholder (without escape char) @param value value of the placeholder @return FoxHttpClientBuilder (this) """ foxHttpRequest.getFoxHttpClient().getFoxHttpPlaceholderStrategy().addPlaceholder(placeholder, value); return this; }
java
public FoxHttpRequestBuilder addFoxHttpPlaceholderEntry(String placeholder, String value) { foxHttpRequest.getFoxHttpClient().getFoxHttpPlaceholderStrategy().addPlaceholder(placeholder, value); return this; }
[ "public", "FoxHttpRequestBuilder", "addFoxHttpPlaceholderEntry", "(", "String", "placeholder", ",", "String", "value", ")", "{", "foxHttpRequest", ".", "getFoxHttpClient", "(", ")", ".", "getFoxHttpPlaceholderStrategy", "(", ")", ".", "addPlaceholder", "(", "placeholder", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add a FoxHttpPlaceholderEntry to the FoxHttpPlaceholderStrategy @param placeholder name of the placeholder (without escape char) @param value value of the placeholder @return FoxHttpClientBuilder (this)
[ "Add", "a", "FoxHttpPlaceholderEntry", "to", "the", "FoxHttpPlaceholderStrategy" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpRequestBuilder.java#L251-L254
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnalyticsItemsInner.java
AnalyticsItemsInner.listAsync
public Observable<List<ApplicationInsightsComponentAnalyticsItemInner>> listAsync(String resourceGroupName, String resourceName, ItemScopePath scopePath) { """ Gets a list of Analytics Items defined within an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param scopePath Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'analyticsItems', 'myanalyticsItems' @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ApplicationInsightsComponentAnalyticsItemInner&gt; object """ return listWithServiceResponseAsync(resourceGroupName, resourceName, scopePath).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>, List<ApplicationInsightsComponentAnalyticsItemInner>>() { @Override public List<ApplicationInsightsComponentAnalyticsItemInner> call(ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>> response) { return response.body(); } }); }
java
public Observable<List<ApplicationInsightsComponentAnalyticsItemInner>> listAsync(String resourceGroupName, String resourceName, ItemScopePath scopePath) { return listWithServiceResponseAsync(resourceGroupName, resourceName, scopePath).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>, List<ApplicationInsightsComponentAnalyticsItemInner>>() { @Override public List<ApplicationInsightsComponentAnalyticsItemInner> call(ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ApplicationInsightsComponentAnalyticsItemInner", ">", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ItemScopePath", "scopePath", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "scopePath", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "ApplicationInsightsComponentAnalyticsItemInner", ">", ">", ",", "List", "<", "ApplicationInsightsComponentAnalyticsItemInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "ApplicationInsightsComponentAnalyticsItemInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "ApplicationInsightsComponentAnalyticsItemInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a list of Analytics Items defined within an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param scopePath Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'analyticsItems', 'myanalyticsItems' @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ApplicationInsightsComponentAnalyticsItemInner&gt; object
[ "Gets", "a", "list", "of", "Analytics", "Items", "defined", "within", "an", "Application", "Insights", "component", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnalyticsItemsInner.java#L118-L125
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java
DerInputStream.subStream
public DerInputStream subStream(int len, boolean do_skip) throws IOException { """ Creates a new DER input stream from part of this input stream. @param len how long a chunk of the current input stream to use, starting at the current position. @param do_skip true if the existing data in the input stream should be skipped. If this value is false, the next data read on this stream and the newly created stream will be the same. """ DerInputBuffer newbuf = buffer.dup(); newbuf.truncate(len); if (do_skip) { buffer.skip(len); } return new DerInputStream(newbuf); }
java
public DerInputStream subStream(int len, boolean do_skip) throws IOException { DerInputBuffer newbuf = buffer.dup(); newbuf.truncate(len); if (do_skip) { buffer.skip(len); } return new DerInputStream(newbuf); }
[ "public", "DerInputStream", "subStream", "(", "int", "len", ",", "boolean", "do_skip", ")", "throws", "IOException", "{", "DerInputBuffer", "newbuf", "=", "buffer", ".", "dup", "(", ")", ";", "newbuf", ".", "truncate", "(", "len", ")", ";", "if", "(", "do_skip", ")", "{", "buffer", ".", "skip", "(", "len", ")", ";", "}", "return", "new", "DerInputStream", "(", "newbuf", ")", ";", "}" ]
Creates a new DER input stream from part of this input stream. @param len how long a chunk of the current input stream to use, starting at the current position. @param do_skip true if the existing data in the input stream should be skipped. If this value is false, the next data read on this stream and the newly created stream will be the same.
[ "Creates", "a", "new", "DER", "input", "stream", "from", "part", "of", "this", "input", "stream", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L132-L141
alkacon/opencms-core
src/org/opencms/loader/CmsRedirectLoader.java
CmsRedirectLoader.getController
protected CmsFlexController getController( CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res, boolean streaming, boolean top) { """ Delivers a Flex controller, either by creating a new one, or by re-using an existing one.<p> @param cms the initial CmsObject to wrap in the controller @param resource the resource requested @param req the current request @param res the current response @param streaming indicates if the response is streaming @param top indicates if the response is the top response @return a Flex controller """ CmsFlexController controller = null; if (top) { // only check for existing controller if this is the "top" request/response controller = CmsFlexController.getController(req); } if (controller == null) { // create new request / response wrappers controller = new CmsFlexController(cms, resource, m_cache, req, res, streaming, top); CmsFlexController.setController(req, controller); CmsFlexRequest f_req = new CmsFlexRequest(req, controller); CmsFlexResponse f_res = new CmsFlexResponse(res, controller, streaming, true); controller.push(f_req, f_res); } else if (controller.isForwardMode()) { // reset CmsObject (because of URI) if in forward mode controller = new CmsFlexController(cms, controller); CmsFlexController.setController(req, controller); } return controller; }
java
protected CmsFlexController getController( CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res, boolean streaming, boolean top) { CmsFlexController controller = null; if (top) { // only check for existing controller if this is the "top" request/response controller = CmsFlexController.getController(req); } if (controller == null) { // create new request / response wrappers controller = new CmsFlexController(cms, resource, m_cache, req, res, streaming, top); CmsFlexController.setController(req, controller); CmsFlexRequest f_req = new CmsFlexRequest(req, controller); CmsFlexResponse f_res = new CmsFlexResponse(res, controller, streaming, true); controller.push(f_req, f_res); } else if (controller.isForwardMode()) { // reset CmsObject (because of URI) if in forward mode controller = new CmsFlexController(cms, controller); CmsFlexController.setController(req, controller); } return controller; }
[ "protected", "CmsFlexController", "getController", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ",", "boolean", "streaming", ",", "boolean", "top", ")", "{", "CmsFlexController", "controller", "=", "null", ";", "if", "(", "top", ")", "{", "// only check for existing controller if this is the \"top\" request/response", "controller", "=", "CmsFlexController", ".", "getController", "(", "req", ")", ";", "}", "if", "(", "controller", "==", "null", ")", "{", "// create new request / response wrappers", "controller", "=", "new", "CmsFlexController", "(", "cms", ",", "resource", ",", "m_cache", ",", "req", ",", "res", ",", "streaming", ",", "top", ")", ";", "CmsFlexController", ".", "setController", "(", "req", ",", "controller", ")", ";", "CmsFlexRequest", "f_req", "=", "new", "CmsFlexRequest", "(", "req", ",", "controller", ")", ";", "CmsFlexResponse", "f_res", "=", "new", "CmsFlexResponse", "(", "res", ",", "controller", ",", "streaming", ",", "true", ")", ";", "controller", ".", "push", "(", "f_req", ",", "f_res", ")", ";", "}", "else", "if", "(", "controller", ".", "isForwardMode", "(", ")", ")", "{", "// reset CmsObject (because of URI) if in forward mode", "controller", "=", "new", "CmsFlexController", "(", "cms", ",", "controller", ")", ";", "CmsFlexController", ".", "setController", "(", "req", ",", "controller", ")", ";", "}", "return", "controller", ";", "}" ]
Delivers a Flex controller, either by creating a new one, or by re-using an existing one.<p> @param cms the initial CmsObject to wrap in the controller @param resource the resource requested @param req the current request @param res the current response @param streaming indicates if the response is streaming @param top indicates if the response is the top response @return a Flex controller
[ "Delivers", "a", "Flex", "controller", "either", "by", "creating", "a", "new", "one", "or", "by", "re", "-", "using", "an", "existing", "one", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsRedirectLoader.java#L209-L235
tencentyun/cos-java-sdk
src/main/java/com/qcloud/cos/sign/Sign.java
Sign.getDownLoadSign
public static String getDownLoadSign(String bucketName, String cosPath, Credentials cred, long expired) throws AbstractCosException { """ 下载签名, 用于获取后拼接成下载链接,下载私有bucket的文件 @param bucketName bucket名称 @param cosPath 要签名的cos路径 @param cred 用户的身份信息, 包括appid, secret_id和secret_key @param expired 签名过期时间, UNIX时间戳。如想让签名在30秒后过期, 即可将expired设成当前时间加上30秒 @return base64编码的字符串 @throws AbstractCosException """ return appSignatureBase(cred, bucketName, cosPath, expired, false); }
java
public static String getDownLoadSign(String bucketName, String cosPath, Credentials cred, long expired) throws AbstractCosException { return appSignatureBase(cred, bucketName, cosPath, expired, false); }
[ "public", "static", "String", "getDownLoadSign", "(", "String", "bucketName", ",", "String", "cosPath", ",", "Credentials", "cred", ",", "long", "expired", ")", "throws", "AbstractCosException", "{", "return", "appSignatureBase", "(", "cred", ",", "bucketName", ",", "cosPath", ",", "expired", ",", "false", ")", ";", "}" ]
下载签名, 用于获取后拼接成下载链接,下载私有bucket的文件 @param bucketName bucket名称 @param cosPath 要签名的cos路径 @param cred 用户的身份信息, 包括appid, secret_id和secret_key @param expired 签名过期时间, UNIX时间戳。如想让签名在30秒后过期, 即可将expired设成当前时间加上30秒 @return base64编码的字符串 @throws AbstractCosException
[ "下载签名", "用于获取后拼接成下载链接,下载私有bucket的文件" ]
train
https://github.com/tencentyun/cos-java-sdk/blob/6709a48f67c1ea7b82a7215f5037d6ccf218b630/src/main/java/com/qcloud/cos/sign/Sign.java#L111-L114
iipc/webarchive-commons
src/main/java/org/archive/util/DateUtils.java
DateUtils.padTo
public static String padTo(final int i, final int pad) { """ Convert an <code>int</code> to a <code>String</code>, and pad it to <code>pad</code> spaces. @param i the int @param pad the width to pad to. @return String w/ padding. """ String n = Integer.toString(i); return padTo(n, pad); }
java
public static String padTo(final int i, final int pad) { String n = Integer.toString(i); return padTo(n, pad); }
[ "public", "static", "String", "padTo", "(", "final", "int", "i", ",", "final", "int", "pad", ")", "{", "String", "n", "=", "Integer", ".", "toString", "(", "i", ")", ";", "return", "padTo", "(", "n", ",", "pad", ")", ";", "}" ]
Convert an <code>int</code> to a <code>String</code>, and pad it to <code>pad</code> spaces. @param i the int @param pad the width to pad to. @return String w/ padding.
[ "Convert", "an", "<code", ">", "int<", "/", "code", ">", "to", "a", "<code", ">", "String<", "/", "code", ">", "and", "pad", "it", "to", "<code", ">", "pad<", "/", "code", ">", "spaces", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/DateUtils.java#L467-L470
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java
GeneratedDi18nDaoImpl.queryByCreatedDate
public Iterable<Di18n> queryByCreatedDate(java.util.Date createdDate) { """ query-by method for field createdDate @param createdDate the specified attribute @return an Iterable of Di18ns for the specified createdDate """ return queryByField(null, Di18nMapper.Field.CREATEDDATE.getFieldName(), createdDate); }
java
public Iterable<Di18n> queryByCreatedDate(java.util.Date createdDate) { return queryByField(null, Di18nMapper.Field.CREATEDDATE.getFieldName(), createdDate); }
[ "public", "Iterable", "<", "Di18n", ">", "queryByCreatedDate", "(", "java", ".", "util", ".", "Date", "createdDate", ")", "{", "return", "queryByField", "(", "null", ",", "Di18nMapper", ".", "Field", ".", "CREATEDDATE", ".", "getFieldName", "(", ")", ",", "createdDate", ")", ";", "}" ]
query-by method for field createdDate @param createdDate the specified attribute @return an Iterable of Di18ns for the specified createdDate
[ "query", "-", "by", "method", "for", "field", "createdDate" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java#L61-L63
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/common/Utils.java
Utils.extractReminder
public static String extractReminder(String publicURL, String accessURL) { """ Extracts container/object from http://hostname/v1/auth_id/container/object @param publicURL pubic url @param accessURL access url @return reminder of the URI """ return publicURL.substring(accessURL.length()); }
java
public static String extractReminder(String publicURL, String accessURL) { return publicURL.substring(accessURL.length()); }
[ "public", "static", "String", "extractReminder", "(", "String", "publicURL", ",", "String", "accessURL", ")", "{", "return", "publicURL", ".", "substring", "(", "accessURL", ".", "length", "(", ")", ")", ";", "}" ]
Extracts container/object from http://hostname/v1/auth_id/container/object @param publicURL pubic url @param accessURL access url @return reminder of the URI
[ "Extracts", "container", "/", "object", "from", "http", ":", "//", "hostname", "/", "v1", "/", "auth_id", "/", "container", "/", "object" ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/common/Utils.java#L458-L460
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.optJSONObject
public static <P extends Enum<P>> JSONObject optJSONObject(final JSONObject json, P e) { """ Returns the value mapped by enum if it exists and is a {@link JSONObject}. If the value does not exist returns {@code null}. @param json {@link JSONObject} to get data from @param e {@link Enum} labeling the data to get @return A {@code JSONObject} if the mapping exists; {@code null} otherwise """ return json.optJSONObject(e.name()); }
java
public static <P extends Enum<P>> JSONObject optJSONObject(final JSONObject json, P e) { return json.optJSONObject(e.name()); }
[ "public", "static", "<", "P", "extends", "Enum", "<", "P", ">", ">", "JSONObject", "optJSONObject", "(", "final", "JSONObject", "json", ",", "P", "e", ")", "{", "return", "json", ".", "optJSONObject", "(", "e", ".", "name", "(", ")", ")", ";", "}" ]
Returns the value mapped by enum if it exists and is a {@link JSONObject}. If the value does not exist returns {@code null}. @param json {@link JSONObject} to get data from @param e {@link Enum} labeling the data to get @return A {@code JSONObject} if the mapping exists; {@code null} otherwise
[ "Returns", "the", "value", "mapped", "by", "enum", "if", "it", "exists", "and", "is", "a", "{", "@link", "JSONObject", "}", ".", "If", "the", "value", "does", "not", "exist", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L399-L401
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java
DatabasesInner.beginPause
public void beginPause(String resourceGroupName, String serverName, String databaseName) { """ Pauses a data warehouse. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the data warehouse to pause. @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 """ beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
java
public void beginPause(String resourceGroupName, String serverName, String databaseName) { beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
[ "public", "void", "beginPause", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "beginPauseWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Pauses a data warehouse. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the data warehouse to pause. @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
[ "Pauses", "a", "data", "warehouse", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L244-L246
aws/aws-sdk-java
aws-java-sdk-costexplorer/src/main/java/com/amazonaws/services/costexplorer/model/Group.java
Group.withMetrics
public Group withMetrics(java.util.Map<String, MetricValue> metrics) { """ <p> The metrics that are included in this group. </p> @param metrics The metrics that are included in this group. @return Returns a reference to this object so that method calls can be chained together. """ setMetrics(metrics); return this; }
java
public Group withMetrics(java.util.Map<String, MetricValue> metrics) { setMetrics(metrics); return this; }
[ "public", "Group", "withMetrics", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "MetricValue", ">", "metrics", ")", "{", "setMetrics", "(", "metrics", ")", ";", "return", "this", ";", "}" ]
<p> The metrics that are included in this group. </p> @param metrics The metrics that are included in this group. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "metrics", "that", "are", "included", "in", "this", "group", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-costexplorer/src/main/java/com/amazonaws/services/costexplorer/model/Group.java#L148-L151
RuedigerMoeller/kontraktor
src/main/java/org/nustaq/kontraktor/Promise.java
Promise.finallyDo
public void finallyDo(Callback resultCB) { """ same as then, but avoid creation of new promise @param resultCB """ // FIXME: this can be implemented more efficient while( !lock.compareAndSet(false,true) ) {} try { if (resultReceiver != null) throw new RuntimeException("Double register of future listener"); resultReceiver = resultCB; if (hadResult) { hasFired = true; lock.set(false); resultCB.complete(result, error); } } finally { lock.set(false); } }
java
public void finallyDo(Callback resultCB) { // FIXME: this can be implemented more efficient while( !lock.compareAndSet(false,true) ) {} try { if (resultReceiver != null) throw new RuntimeException("Double register of future listener"); resultReceiver = resultCB; if (hadResult) { hasFired = true; lock.set(false); resultCB.complete(result, error); } } finally { lock.set(false); } }
[ "public", "void", "finallyDo", "(", "Callback", "resultCB", ")", "{", "// FIXME: this can be implemented more efficient", "while", "(", "!", "lock", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "}", "try", "{", "if", "(", "resultReceiver", "!=", "null", ")", "throw", "new", "RuntimeException", "(", "\"Double register of future listener\"", ")", ";", "resultReceiver", "=", "resultCB", ";", "if", "(", "hadResult", ")", "{", "hasFired", "=", "true", ";", "lock", ".", "set", "(", "false", ")", ";", "resultCB", ".", "complete", "(", "result", ",", "error", ")", ";", "}", "}", "finally", "{", "lock", ".", "set", "(", "false", ")", ";", "}", "}" ]
same as then, but avoid creation of new promise @param resultCB
[ "same", "as", "then", "but", "avoid", "creation", "of", "new", "promise" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/src/main/java/org/nustaq/kontraktor/Promise.java#L320-L335
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java
MarkLogicClient.sendUpdateQuery
public void sendUpdateQuery(String queryString, SPARQLQueryBindingSet bindings, boolean includeInferred, String baseURI) throws IOException, RepositoryException, MalformedQueryException,UpdateExecutionException { """ UpdateQuery @param queryString @param bindings @param includeInferred @param baseURI @throws IOException @throws RepositoryException @throws MalformedQueryException @throws UnauthorizedException @throws UpdateExecutionException """ getClient().performUpdateQuery(queryString, bindings, this.tx, includeInferred, baseURI); }
java
public void sendUpdateQuery(String queryString, SPARQLQueryBindingSet bindings, boolean includeInferred, String baseURI) throws IOException, RepositoryException, MalformedQueryException,UpdateExecutionException { getClient().performUpdateQuery(queryString, bindings, this.tx, includeInferred, baseURI); }
[ "public", "void", "sendUpdateQuery", "(", "String", "queryString", ",", "SPARQLQueryBindingSet", "bindings", ",", "boolean", "includeInferred", ",", "String", "baseURI", ")", "throws", "IOException", ",", "RepositoryException", ",", "MalformedQueryException", ",", "UpdateExecutionException", "{", "getClient", "(", ")", ".", "performUpdateQuery", "(", "queryString", ",", "bindings", ",", "this", ".", "tx", ",", "includeInferred", ",", "baseURI", ")", ";", "}" ]
UpdateQuery @param queryString @param bindings @param includeInferred @param baseURI @throws IOException @throws RepositoryException @throws MalformedQueryException @throws UnauthorizedException @throws UpdateExecutionException
[ "UpdateQuery" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L289-L291
JodaOrg/joda-money
src/main/java/org/joda/money/Money.java
Money.ofMajor
public static Money ofMajor(CurrencyUnit currency, long amountMajor) { """ Obtains an instance of {@code Money} from an amount in major units. <p> This allows you to create an instance with a specific currency and amount. The amount is a whole number only. Thus you can initialise the value 'USD 20', but not the value 'USD 20.32'. For example, {@code ofMajor(USD, 25)} creates the instance {@code USD 25.00}. @param currency the currency, not null @param amountMajor the amount of money in the major division of the currency @return the new instance, never null """ return Money.of(currency, BigDecimal.valueOf(amountMajor), RoundingMode.UNNECESSARY); }
java
public static Money ofMajor(CurrencyUnit currency, long amountMajor) { return Money.of(currency, BigDecimal.valueOf(amountMajor), RoundingMode.UNNECESSARY); }
[ "public", "static", "Money", "ofMajor", "(", "CurrencyUnit", "currency", ",", "long", "amountMajor", ")", "{", "return", "Money", ".", "of", "(", "currency", ",", "BigDecimal", ".", "valueOf", "(", "amountMajor", ")", ",", "RoundingMode", ".", "UNNECESSARY", ")", ";", "}" ]
Obtains an instance of {@code Money} from an amount in major units. <p> This allows you to create an instance with a specific currency and amount. The amount is a whole number only. Thus you can initialise the value 'USD 20', but not the value 'USD 20.32'. For example, {@code ofMajor(USD, 25)} creates the instance {@code USD 25.00}. @param currency the currency, not null @param amountMajor the amount of money in the major division of the currency @return the new instance, never null
[ "Obtains", "an", "instance", "of", "{", "@code", "Money", "}", "from", "an", "amount", "in", "major", "units", ".", "<p", ">", "This", "allows", "you", "to", "create", "an", "instance", "with", "a", "specific", "currency", "and", "amount", ".", "The", "amount", "is", "a", "whole", "number", "only", ".", "Thus", "you", "can", "initialise", "the", "value", "USD", "20", "but", "not", "the", "value", "USD", "20", ".", "32", ".", "For", "example", "{", "@code", "ofMajor", "(", "USD", "25", ")", "}", "creates", "the", "instance", "{", "@code", "USD", "25", ".", "00", "}", "." ]
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L162-L164
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/SecureHash.java
SecureHash.createHashingStream
public static HashingInputStream createHashingStream( String digestName, InputStream inputStream ) throws NoSuchAlgorithmException { """ Create an InputStream instance that wraps another stream and that computes the secure hash (using the algorithm with the supplied name) as the returned stream is used. This can be used to compute the hash of a stream while the stream is being processed by another reader, and saves from having to process the same stream twice. @param digestName the name of the hashing function (or {@link MessageDigest message digest}) that should be used @param inputStream the stream containing the content that is to be hashed @return the hash of the contents as a byte array @throws NoSuchAlgorithmException """ MessageDigest digest = MessageDigest.getInstance(digestName); return new HashingInputStream(digest, inputStream); }
java
public static HashingInputStream createHashingStream( String digestName, InputStream inputStream ) throws NoSuchAlgorithmException { MessageDigest digest = MessageDigest.getInstance(digestName); return new HashingInputStream(digest, inputStream); }
[ "public", "static", "HashingInputStream", "createHashingStream", "(", "String", "digestName", ",", "InputStream", "inputStream", ")", "throws", "NoSuchAlgorithmException", "{", "MessageDigest", "digest", "=", "MessageDigest", ".", "getInstance", "(", "digestName", ")", ";", "return", "new", "HashingInputStream", "(", "digest", ",", "inputStream", ")", ";", "}" ]
Create an InputStream instance that wraps another stream and that computes the secure hash (using the algorithm with the supplied name) as the returned stream is used. This can be used to compute the hash of a stream while the stream is being processed by another reader, and saves from having to process the same stream twice. @param digestName the name of the hashing function (or {@link MessageDigest message digest}) that should be used @param inputStream the stream containing the content that is to be hashed @return the hash of the contents as a byte array @throws NoSuchAlgorithmException
[ "Create", "an", "InputStream", "instance", "that", "wraps", "another", "stream", "and", "that", "computes", "the", "secure", "hash", "(", "using", "the", "algorithm", "with", "the", "supplied", "name", ")", "as", "the", "returned", "stream", "is", "used", ".", "This", "can", "be", "used", "to", "compute", "the", "hash", "of", "a", "stream", "while", "the", "stream", "is", "being", "processed", "by", "another", "reader", "and", "saves", "from", "having", "to", "process", "the", "same", "stream", "twice", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/SecureHash.java#L280-L284
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java
CommerceAddressRestrictionPersistenceImpl.removeByC_C
@Override public void removeByC_C(long classNameId, long classPK) { """ Removes all the commerce address restrictions where classNameId = &#63; and classPK = &#63; from the database. @param classNameId the class name ID @param classPK the class pk """ for (CommerceAddressRestriction commerceAddressRestriction : findByC_C( classNameId, classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceAddressRestriction); } }
java
@Override public void removeByC_C(long classNameId, long classPK) { for (CommerceAddressRestriction commerceAddressRestriction : findByC_C( classNameId, classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceAddressRestriction); } }
[ "@", "Override", "public", "void", "removeByC_C", "(", "long", "classNameId", ",", "long", "classPK", ")", "{", "for", "(", "CommerceAddressRestriction", "commerceAddressRestriction", ":", "findByC_C", "(", "classNameId", ",", "classPK", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "commerceAddressRestriction", ")", ";", "}", "}" ]
Removes all the commerce address restrictions where classNameId = &#63; and classPK = &#63; from the database. @param classNameId the class name ID @param classPK the class pk
[ "Removes", "all", "the", "commerce", "address", "restrictions", "where", "classNameId", "=", "&#63", ";", "and", "classPK", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java#L1113-L1119
spockframework/spock
spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java
GroovyRuntimeUtil.instantiateClosure
public static <T extends Closure<?>> T instantiateClosure(Class<T> closureType, Object owner, Object thisObject) { """ Note: This method may throw checked exceptions although it doesn't say so. """ try { Constructor<T> constructor = closureType.getConstructor(Object.class, Object.class); return constructor.newInstance(owner, thisObject); } catch (Exception e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
java
public static <T extends Closure<?>> T instantiateClosure(Class<T> closureType, Object owner, Object thisObject) { try { Constructor<T> constructor = closureType.getConstructor(Object.class, Object.class); return constructor.newInstance(owner, thisObject); } catch (Exception e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
[ "public", "static", "<", "T", "extends", "Closure", "<", "?", ">", ">", "T", "instantiateClosure", "(", "Class", "<", "T", ">", "closureType", ",", "Object", "owner", ",", "Object", "thisObject", ")", "{", "try", "{", "Constructor", "<", "T", ">", "constructor", "=", "closureType", ".", "getConstructor", "(", "Object", ".", "class", ",", "Object", ".", "class", ")", ";", "return", "constructor", ".", "newInstance", "(", "owner", ",", "thisObject", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ExceptionUtil", ".", "sneakyThrow", "(", "e", ".", "getCause", "(", ")", ")", ";", "return", "null", ";", "// never reached", "}", "}" ]
Note: This method may throw checked exceptions although it doesn't say so.
[ "Note", ":", "This", "method", "may", "throw", "checked", "exceptions", "although", "it", "doesn", "t", "say", "so", "." ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java#L211-L219
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.sqrtNewtonRaphson
private static BigDecimal sqrtNewtonRaphson(final BigDecimal c, final BigDecimal xn, final BigDecimal precision) { """ Private utility method used to compute the square root of a BigDecimal. @author Luciano Culacciatti @see <a href="http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal">http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal</a> """ BigDecimal fx = xn.pow(2).add(c.negate()); BigDecimal fpx = xn.multiply(new BigDecimal(2)); BigDecimal xn1 = fx.divide(fpx, 2 * SQRT_DIG.intValue(), RoundingMode.HALF_DOWN); xn1 = xn.add(xn1.negate()); BigDecimal currentSquare = xn1.pow(2); BigDecimal currentPrecision = currentSquare.subtract(c); currentPrecision = currentPrecision.abs(); if (currentPrecision.compareTo(precision) <= -1) { return xn1; } return sqrtNewtonRaphson(c, xn1, precision); }
java
private static BigDecimal sqrtNewtonRaphson(final BigDecimal c, final BigDecimal xn, final BigDecimal precision) { BigDecimal fx = xn.pow(2).add(c.negate()); BigDecimal fpx = xn.multiply(new BigDecimal(2)); BigDecimal xn1 = fx.divide(fpx, 2 * SQRT_DIG.intValue(), RoundingMode.HALF_DOWN); xn1 = xn.add(xn1.negate()); BigDecimal currentSquare = xn1.pow(2); BigDecimal currentPrecision = currentSquare.subtract(c); currentPrecision = currentPrecision.abs(); if (currentPrecision.compareTo(precision) <= -1) { return xn1; } return sqrtNewtonRaphson(c, xn1, precision); }
[ "private", "static", "BigDecimal", "sqrtNewtonRaphson", "(", "final", "BigDecimal", "c", ",", "final", "BigDecimal", "xn", ",", "final", "BigDecimal", "precision", ")", "{", "BigDecimal", "fx", "=", "xn", ".", "pow", "(", "2", ")", ".", "add", "(", "c", ".", "negate", "(", ")", ")", ";", "BigDecimal", "fpx", "=", "xn", ".", "multiply", "(", "new", "BigDecimal", "(", "2", ")", ")", ";", "BigDecimal", "xn1", "=", "fx", ".", "divide", "(", "fpx", ",", "2", "*", "SQRT_DIG", ".", "intValue", "(", ")", ",", "RoundingMode", ".", "HALF_DOWN", ")", ";", "xn1", "=", "xn", ".", "add", "(", "xn1", ".", "negate", "(", ")", ")", ";", "BigDecimal", "currentSquare", "=", "xn1", ".", "pow", "(", "2", ")", ";", "BigDecimal", "currentPrecision", "=", "currentSquare", ".", "subtract", "(", "c", ")", ";", "currentPrecision", "=", "currentPrecision", ".", "abs", "(", ")", ";", "if", "(", "currentPrecision", ".", "compareTo", "(", "precision", ")", "<=", "-", "1", ")", "{", "return", "xn1", ";", "}", "return", "sqrtNewtonRaphson", "(", "c", ",", "xn1", ",", "precision", ")", ";", "}" ]
Private utility method used to compute the square root of a BigDecimal. @author Luciano Culacciatti @see <a href="http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal">http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal</a>
[ "Private", "utility", "method", "used", "to", "compute", "the", "square", "root", "of", "a", "BigDecimal", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L782-L794
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java
ExtensionFactory.getExtensionAuthor
public ExtensionAuthor getExtensionAuthor(String name, String url) { """ Store and return a weak reference equals to the passed {@link ExtensionAuthor}. @param name the name of the author @param url the url of the author public profile @return unique instance of {@link ExtensionAuthor} equals to the passed one """ return getExtensionAuthor(new DefaultExtensionAuthor(name, url)); }
java
public ExtensionAuthor getExtensionAuthor(String name, String url) { return getExtensionAuthor(new DefaultExtensionAuthor(name, url)); }
[ "public", "ExtensionAuthor", "getExtensionAuthor", "(", "String", "name", ",", "String", "url", ")", "{", "return", "getExtensionAuthor", "(", "new", "DefaultExtensionAuthor", "(", "name", ",", "url", ")", ")", ";", "}" ]
Store and return a weak reference equals to the passed {@link ExtensionAuthor}. @param name the name of the author @param url the url of the author public profile @return unique instance of {@link ExtensionAuthor} equals to the passed one
[ "Store", "and", "return", "a", "weak", "reference", "equals", "to", "the", "passed", "{", "@link", "ExtensionAuthor", "}", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java#L110-L113
zsoltk/overpasser
library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java
OverpassFilterQuery.tagRegexNot
public OverpassFilterQuery tagRegexNot(String name, String value) { """ Adds a <i>["name"!~value]</i> filter tag to the current query. @param name the filter name @param value the filter value @return the current query object """ builder.regexDoesntMatch(name, value); return this; }
java
public OverpassFilterQuery tagRegexNot(String name, String value) { builder.regexDoesntMatch(name, value); return this; }
[ "public", "OverpassFilterQuery", "tagRegexNot", "(", "String", "name", ",", "String", "value", ")", "{", "builder", ".", "regexDoesntMatch", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a <i>["name"!~value]</i> filter tag to the current query. @param name the filter name @param value the filter value @return the current query object
[ "Adds", "a", "<i", ">", "[", "name", "!~value", "]", "<", "/", "i", ">", "filter", "tag", "to", "the", "current", "query", "." ]
train
https://github.com/zsoltk/overpasser/blob/0464d3844e75c5f9393d2458d3a3aedf3e40f30d/library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java#L205-L209
brutusin/commons
src/main/java/org/brutusin/commons/utils/Miscellaneous.java
Miscellaneous.countMatches
public static int countMatches(String str, String subStrRegExp) { """ <p> Counts how many times the substring appears in the larger String.</p> <p> A <code>null</code> or empty ("") String input returns <code>0</code>.</p> <pre> StringUtils.countMatches(null, *) = 0 StringUtils.countMatches("", *) = 0 StringUtils.countMatches("abba", null) = 0 StringUtils.countMatches("abba", "") = 0 StringUtils.countMatches("abba", "a") = 2 StringUtils.countMatches("abba", "ab") = 1 StringUtils.countMatches("abba", "xxx") = 0 </pre> <p> @param str the String to check, may be null @param subStrRegExp the substring reg expression to count, may be null @return the number of occurrences, 0 if either String is <code>null</code> """ if (isEmpty(str) || isEmpty(subStrRegExp)) { return 0; } Pattern p = Pattern.compile(subStrRegExp); Matcher m = p.matcher(str); int count = 0; while (m.find()) { count += 1; } return count; }
java
public static int countMatches(String str, String subStrRegExp) { if (isEmpty(str) || isEmpty(subStrRegExp)) { return 0; } Pattern p = Pattern.compile(subStrRegExp); Matcher m = p.matcher(str); int count = 0; while (m.find()) { count += 1; } return count; }
[ "public", "static", "int", "countMatches", "(", "String", "str", ",", "String", "subStrRegExp", ")", "{", "if", "(", "isEmpty", "(", "str", ")", "||", "isEmpty", "(", "subStrRegExp", ")", ")", "{", "return", "0", ";", "}", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "subStrRegExp", ")", ";", "Matcher", "m", "=", "p", ".", "matcher", "(", "str", ")", ";", "int", "count", "=", "0", ";", "while", "(", "m", ".", "find", "(", ")", ")", "{", "count", "+=", "1", ";", "}", "return", "count", ";", "}" ]
<p> Counts how many times the substring appears in the larger String.</p> <p> A <code>null</code> or empty ("") String input returns <code>0</code>.</p> <pre> StringUtils.countMatches(null, *) = 0 StringUtils.countMatches("", *) = 0 StringUtils.countMatches("abba", null) = 0 StringUtils.countMatches("abba", "") = 0 StringUtils.countMatches("abba", "a") = 2 StringUtils.countMatches("abba", "ab") = 1 StringUtils.countMatches("abba", "xxx") = 0 </pre> <p> @param str the String to check, may be null @param subStrRegExp the substring reg expression to count, may be null @return the number of occurrences, 0 if either String is <code>null</code>
[ "<p", ">", "Counts", "how", "many", "times", "the", "substring", "appears", "in", "the", "larger", "String", ".", "<", "/", "p", ">" ]
train
https://github.com/brutusin/commons/blob/70685df2b2456d0bf1e6a4754d72c87bba4949df/src/main/java/org/brutusin/commons/utils/Miscellaneous.java#L216-L227
josueeduardo/snappy
plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/jar/JarEntryData.java
JarEntryData.fromInputStream
static JarEntryData fromInputStream(JarFile source, InputStream inputStream) throws IOException { """ Create a new {@link JarEntryData} instance from the specified input stream. @param source the source {@link JarFile} @param inputStream the input stream to load data from @return a {@link JarEntryData} or {@code null} @throws IOException in case of I/O errors """ byte[] header = new byte[46]; if (!Bytes.fill(inputStream, header)) { return null; } return new JarEntryData(source, header, inputStream); }
java
static JarEntryData fromInputStream(JarFile source, InputStream inputStream) throws IOException { byte[] header = new byte[46]; if (!Bytes.fill(inputStream, header)) { return null; } return new JarEntryData(source, header, inputStream); }
[ "static", "JarEntryData", "fromInputStream", "(", "JarFile", "source", ",", "InputStream", "inputStream", ")", "throws", "IOException", "{", "byte", "[", "]", "header", "=", "new", "byte", "[", "46", "]", ";", "if", "(", "!", "Bytes", ".", "fill", "(", "inputStream", ",", "header", ")", ")", "{", "return", "null", ";", "}", "return", "new", "JarEntryData", "(", "source", ",", "header", ",", "inputStream", ")", ";", "}" ]
Create a new {@link JarEntryData} instance from the specified input stream. @param source the source {@link JarFile} @param inputStream the input stream to load data from @return a {@link JarEntryData} or {@code null} @throws IOException in case of I/O errors
[ "Create", "a", "new", "{", "@link", "JarEntryData", "}", "instance", "from", "the", "specified", "input", "stream", "." ]
train
https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/jar/JarEntryData.java#L83-L90
JodaOrg/joda-time
src/example/org/joda/example/time/DateTimeBrowser.java
DateTimeBrowser.dumpObjs
private void dumpObjs(Object[][] objs, PrintStream out ) { """ /* A private method to dump the arrays of Object[][] if desired by the developer @param objs The array of arrays to be dumped. """ for (int i = 0; i < objs.length; ++i) { for (int j = 0; j < objs[i].length; ++j) { out.println(i + " " + j + " " + objs[i][j]); } // for j } // for i }
java
private void dumpObjs(Object[][] objs, PrintStream out ) { for (int i = 0; i < objs.length; ++i) { for (int j = 0; j < objs[i].length; ++j) { out.println(i + " " + j + " " + objs[i][j]); } // for j } // for i }
[ "private", "void", "dumpObjs", "(", "Object", "[", "]", "[", "]", "objs", ",", "PrintStream", "out", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "objs", ".", "length", ";", "++", "i", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "objs", "[", "i", "]", ".", "length", ";", "++", "j", ")", "{", "out", ".", "println", "(", "i", "+", "\" \"", "+", "j", "+", "\" \"", "+", "objs", "[", "i", "]", "[", "j", "]", ")", ";", "}", "// for j", "}", "// for i", "}" ]
/* A private method to dump the arrays of Object[][] if desired by the developer @param objs The array of arrays to be dumped.
[ "/", "*", "A", "private", "method", "to", "dump", "the", "arrays", "of", "Object", "[]", "[]", "if", "desired", "by", "the", "developer" ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/example/org/joda/example/time/DateTimeBrowser.java#L337-L344
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java
CertificatesInner.getAsync
public Observable<IntegrationAccountCertificateInner> getAsync(String resourceGroupName, String integrationAccountName, String certificateName) { """ Gets an integration account certificate. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param certificateName The integration account certificate name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountCertificateInner object """ return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, certificateName).map(new Func1<ServiceResponse<IntegrationAccountCertificateInner>, IntegrationAccountCertificateInner>() { @Override public IntegrationAccountCertificateInner call(ServiceResponse<IntegrationAccountCertificateInner> response) { return response.body(); } }); }
java
public Observable<IntegrationAccountCertificateInner> getAsync(String resourceGroupName, String integrationAccountName, String certificateName) { return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, certificateName).map(new Func1<ServiceResponse<IntegrationAccountCertificateInner>, IntegrationAccountCertificateInner>() { @Override public IntegrationAccountCertificateInner call(ServiceResponse<IntegrationAccountCertificateInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IntegrationAccountCertificateInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "certificateName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationAccountName", ",", "certificateName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "IntegrationAccountCertificateInner", ">", ",", "IntegrationAccountCertificateInner", ">", "(", ")", "{", "@", "Override", "public", "IntegrationAccountCertificateInner", "call", "(", "ServiceResponse", "<", "IntegrationAccountCertificateInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets an integration account certificate. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param certificateName The integration account certificate name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountCertificateInner object
[ "Gets", "an", "integration", "account", "certificate", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java#L369-L376
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_hunting_agent_agentId_bannerAccess_GET
public OvhBannerAccess billingAccount_ovhPabx_serviceName_hunting_agent_agentId_bannerAccess_GET(String billingAccount, String serviceName, Long agentId) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}/bannerAccess @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param agentId [required] """ String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}/bannerAccess"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBannerAccess.class); }
java
public OvhBannerAccess billingAccount_ovhPabx_serviceName_hunting_agent_agentId_bannerAccess_GET(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}/bannerAccess"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBannerAccess.class); }
[ "public", "OvhBannerAccess", "billingAccount_ovhPabx_serviceName_hunting_agent_agentId_bannerAccess_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "agentId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}/bannerAccess\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "agentId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhBannerAccess", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}/bannerAccess @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param agentId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6163-L6168
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/TraceId.java
TraceId.fromBytes
public static TraceId fromBytes(byte[] src, int srcOffset) { """ Returns a {@code TraceId} whose representation is copied from the {@code src} beginning at the {@code srcOffset} offset. @param src the buffer where the representation of the {@code TraceId} is copied. @param srcOffset the offset in the buffer where the representation of the {@code TraceId} begins. @return a {@code TraceId} whose representation is copied from the buffer. @throws NullPointerException if {@code src} is null. @throws IndexOutOfBoundsException if {@code srcOffset+TraceId.SIZE} is greater than {@code src.length}. @since 0.5 """ Utils.checkNotNull(src, "src"); return new TraceId( BigendianEncoding.longFromByteArray(src, srcOffset), BigendianEncoding.longFromByteArray(src, srcOffset + BigendianEncoding.LONG_BYTES)); }
java
public static TraceId fromBytes(byte[] src, int srcOffset) { Utils.checkNotNull(src, "src"); return new TraceId( BigendianEncoding.longFromByteArray(src, srcOffset), BigendianEncoding.longFromByteArray(src, srcOffset + BigendianEncoding.LONG_BYTES)); }
[ "public", "static", "TraceId", "fromBytes", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "{", "Utils", ".", "checkNotNull", "(", "src", ",", "\"src\"", ")", ";", "return", "new", "TraceId", "(", "BigendianEncoding", ".", "longFromByteArray", "(", "src", ",", "srcOffset", ")", ",", "BigendianEncoding", ".", "longFromByteArray", "(", "src", ",", "srcOffset", "+", "BigendianEncoding", ".", "LONG_BYTES", ")", ")", ";", "}" ]
Returns a {@code TraceId} whose representation is copied from the {@code src} beginning at the {@code srcOffset} offset. @param src the buffer where the representation of the {@code TraceId} is copied. @param srcOffset the offset in the buffer where the representation of the {@code TraceId} begins. @return a {@code TraceId} whose representation is copied from the buffer. @throws NullPointerException if {@code src} is null. @throws IndexOutOfBoundsException if {@code srcOffset+TraceId.SIZE} is greater than {@code src.length}. @since 0.5
[ "Returns", "a", "{", "@code", "TraceId", "}", "whose", "representation", "is", "copied", "from", "the", "{", "@code", "src", "}", "beginning", "at", "the", "{", "@code", "srcOffset", "}", "offset", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/TraceId.java#L87-L92
pip-services3-java/pip-services3-components-java
src/org/pipservices3/components/count/CompositeCounters.java
CompositeCounters.setReferences
public void setReferences(IReferences references) throws ReferenceException { """ Sets references to dependent components. @param references references to locate the component dependencies. @throws ReferenceException when no references found. """ List<Object> counters = references.getOptional(new Descriptor(null, "counters", null, null, null)); for (Object counter : counters) { if (counter instanceof ICounters && counter != this) _counters.add((ICounters) counter); } }
java
public void setReferences(IReferences references) throws ReferenceException { List<Object> counters = references.getOptional(new Descriptor(null, "counters", null, null, null)); for (Object counter : counters) { if (counter instanceof ICounters && counter != this) _counters.add((ICounters) counter); } }
[ "public", "void", "setReferences", "(", "IReferences", "references", ")", "throws", "ReferenceException", "{", "List", "<", "Object", ">", "counters", "=", "references", ".", "getOptional", "(", "new", "Descriptor", "(", "null", ",", "\"counters\"", ",", "null", ",", "null", ",", "null", ")", ")", ";", "for", "(", "Object", "counter", ":", "counters", ")", "{", "if", "(", "counter", "instanceof", "ICounters", "&&", "counter", "!=", "this", ")", "_counters", ".", "add", "(", "(", "ICounters", ")", "counter", ")", ";", "}", "}" ]
Sets references to dependent components. @param references references to locate the component dependencies. @throws ReferenceException when no references found.
[ "Sets", "references", "to", "dependent", "components", "." ]
train
https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/count/CompositeCounters.java#L58-L64
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-api/src/main/java/org/hawkular/cmdgw/api/ApiDeserializer.java
ApiDeserializer.toHawkularFormat
public static BinaryData toHawkularFormat(BasicMessage msg, InputStream extraData) { """ Returns a BinaryData object (which is a stream) that encodes the given message just like {@link #toHawkularFormat(BasicMessage)} does but also packages the given input stream as extra data with the JSON message. The returned object can be used to deserialize the msg and extra data via {@link #deserialize(InputStream)}. @param msg the message object that will be serialized into JSON @param extraData the extra data to be packages with the given message @return an object that can be used by other Hawkular endpoints to deserialize the message. """ String msgJson = toHawkularFormat(msg); return new BinaryData(msgJson.getBytes(), extraData); }
java
public static BinaryData toHawkularFormat(BasicMessage msg, InputStream extraData) { String msgJson = toHawkularFormat(msg); return new BinaryData(msgJson.getBytes(), extraData); }
[ "public", "static", "BinaryData", "toHawkularFormat", "(", "BasicMessage", "msg", ",", "InputStream", "extraData", ")", "{", "String", "msgJson", "=", "toHawkularFormat", "(", "msg", ")", ";", "return", "new", "BinaryData", "(", "msgJson", ".", "getBytes", "(", ")", ",", "extraData", ")", ";", "}" ]
Returns a BinaryData object (which is a stream) that encodes the given message just like {@link #toHawkularFormat(BasicMessage)} does but also packages the given input stream as extra data with the JSON message. The returned object can be used to deserialize the msg and extra data via {@link #deserialize(InputStream)}. @param msg the message object that will be serialized into JSON @param extraData the extra data to be packages with the given message @return an object that can be used by other Hawkular endpoints to deserialize the message.
[ "Returns", "a", "BinaryData", "object", "(", "which", "is", "a", "stream", ")", "that", "encodes", "the", "given", "message", "just", "like", "{", "@link", "#toHawkularFormat", "(", "BasicMessage", ")", "}", "does", "but", "also", "packages", "the", "given", "input", "stream", "as", "extra", "data", "with", "the", "JSON", "message", "." ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-api/src/main/java/org/hawkular/cmdgw/api/ApiDeserializer.java#L60-L63
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsRenameImages.java
CmsRenameImages.buildImageInformation
public String buildImageInformation() { """ Returns information about the image count of the selected gallery folder.<p> @return information about the image count of the selected gallery folder """ // count all image resources of the gallery folder int count = 0; try { int imageId = OpenCms.getResourceManager().getResourceType( CmsResourceTypeImage.getStaticTypeName()).getTypeId(); CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireType(imageId); List<CmsResource> images = getCms().readResources(getParamResource(), filter, false); count = images.size(); } catch (CmsException e) { // ignore this exception } Object[] args = new Object[] {getParamResource(), new Integer(count)}; return key(Messages.GUI_RENAMEIMAGES_INFO_IMAGECOUNT_2, args); }
java
public String buildImageInformation() { // count all image resources of the gallery folder int count = 0; try { int imageId = OpenCms.getResourceManager().getResourceType( CmsResourceTypeImage.getStaticTypeName()).getTypeId(); CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireType(imageId); List<CmsResource> images = getCms().readResources(getParamResource(), filter, false); count = images.size(); } catch (CmsException e) { // ignore this exception } Object[] args = new Object[] {getParamResource(), new Integer(count)}; return key(Messages.GUI_RENAMEIMAGES_INFO_IMAGECOUNT_2, args); }
[ "public", "String", "buildImageInformation", "(", ")", "{", "// count all image resources of the gallery folder", "int", "count", "=", "0", ";", "try", "{", "int", "imageId", "=", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "CmsResourceTypeImage", ".", "getStaticTypeName", "(", ")", ")", ".", "getTypeId", "(", ")", ";", "CmsResourceFilter", "filter", "=", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ".", "addRequireType", "(", "imageId", ")", ";", "List", "<", "CmsResource", ">", "images", "=", "getCms", "(", ")", ".", "readResources", "(", "getParamResource", "(", ")", ",", "filter", ",", "false", ")", ";", "count", "=", "images", ".", "size", "(", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "// ignore this exception", "}", "Object", "[", "]", "args", "=", "new", "Object", "[", "]", "{", "getParamResource", "(", ")", ",", "new", "Integer", "(", "count", ")", "}", ";", "return", "key", "(", "Messages", ".", "GUI_RENAMEIMAGES_INFO_IMAGECOUNT_2", ",", "args", ")", ";", "}" ]
Returns information about the image count of the selected gallery folder.<p> @return information about the image count of the selected gallery folder
[ "Returns", "information", "about", "the", "image", "count", "of", "the", "selected", "gallery", "folder", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsRenameImages.java#L158-L174
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Request.java
Request.newStatusUpdateRequest
public static Request newStatusUpdateRequest(Session session, String message, Callback callback) { """ Creates a new Request configured to post a status update to a user's feed. @param session the Session to use, or null; if non-null, the session must be in an opened state @param message the text of the status update @param callback a callback that will be called when the request is completed to handle success or error conditions @return a Request that is ready to execute """ return newStatusUpdateRequest(session, message, (String)null, null, callback); }
java
public static Request newStatusUpdateRequest(Session session, String message, Callback callback) { return newStatusUpdateRequest(session, message, (String)null, null, callback); }
[ "public", "static", "Request", "newStatusUpdateRequest", "(", "Session", "session", ",", "String", "message", ",", "Callback", "callback", ")", "{", "return", "newStatusUpdateRequest", "(", "session", ",", "message", ",", "(", "String", ")", "null", ",", "null", ",", "callback", ")", ";", "}" ]
Creates a new Request configured to post a status update to a user's feed. @param session the Session to use, or null; if non-null, the session must be in an opened state @param message the text of the status update @param callback a callback that will be called when the request is completed to handle success or error conditions @return a Request that is ready to execute
[ "Creates", "a", "new", "Request", "configured", "to", "post", "a", "status", "update", "to", "a", "user", "s", "feed", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L440-L442
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopsFlowToJobSpecCompiler.java
MultiHopsFlowToJobSpecCompiler.buildJobSpec
private JobSpec buildJobSpec (ServiceNode sourceNode, ServiceNode targetNode, URI templateURI, FlowSpec flowSpec) { """ Generate JobSpec based on the #templateURI that user specified. """ JobSpec jobSpec; JobSpec.Builder jobSpecBuilder = JobSpec.builder(jobSpecURIGenerator(flowSpec, sourceNode, targetNode)) .withConfig(flowSpec.getConfig()) .withDescription(flowSpec.getDescription()) .withVersion(flowSpec.getVersion()); if (templateURI != null) { jobSpecBuilder.withTemplate(templateURI); try { jobSpec = new ResolvedJobSpec(jobSpecBuilder.build(), templateCatalog.get()); log.info("Resolved JobSpec properties are: " + jobSpec.getConfigAsProperties()); } catch (SpecNotFoundException | JobTemplate.TemplateException e) { throw new RuntimeException("Could not resolve template in JobSpec from TemplateCatalog", e); } } else { jobSpec = jobSpecBuilder.build(); log.info("Unresolved JobSpec properties are: " + jobSpec.getConfigAsProperties()); } // Remove schedule jobSpec.setConfig(jobSpec.getConfig().withoutPath(ConfigurationKeys.JOB_SCHEDULE_KEY)); // Add job.name and job.group if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_NAME_KEY)) { jobSpec.setConfig(jobSpec.getConfig() .withValue(ConfigurationKeys.JOB_NAME_KEY, ConfigValueFactory.fromAnyRef( flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_NAME_KEY).unwrapped().toString() + "-" + sourceNode.getNodeName() + "-" + targetNode.getNodeName()))); } if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_GROUP_KEY)) { jobSpec.setConfig(jobSpec.getConfig() .withValue(ConfigurationKeys.JOB_GROUP_KEY, flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_GROUP_KEY))); } // Add flow execution id for this compilation long flowExecutionId = FlowUtils.getOrCreateFlowExecutionId(flowSpec); jobSpec.setConfig(jobSpec.getConfig().withValue(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, ConfigValueFactory.fromAnyRef(flowExecutionId))); // Reset properties in Spec from Config jobSpec.setConfigAsProperties(ConfigUtils.configToProperties(jobSpec.getConfig())); return jobSpec; }
java
private JobSpec buildJobSpec (ServiceNode sourceNode, ServiceNode targetNode, URI templateURI, FlowSpec flowSpec) { JobSpec jobSpec; JobSpec.Builder jobSpecBuilder = JobSpec.builder(jobSpecURIGenerator(flowSpec, sourceNode, targetNode)) .withConfig(flowSpec.getConfig()) .withDescription(flowSpec.getDescription()) .withVersion(flowSpec.getVersion()); if (templateURI != null) { jobSpecBuilder.withTemplate(templateURI); try { jobSpec = new ResolvedJobSpec(jobSpecBuilder.build(), templateCatalog.get()); log.info("Resolved JobSpec properties are: " + jobSpec.getConfigAsProperties()); } catch (SpecNotFoundException | JobTemplate.TemplateException e) { throw new RuntimeException("Could not resolve template in JobSpec from TemplateCatalog", e); } } else { jobSpec = jobSpecBuilder.build(); log.info("Unresolved JobSpec properties are: " + jobSpec.getConfigAsProperties()); } // Remove schedule jobSpec.setConfig(jobSpec.getConfig().withoutPath(ConfigurationKeys.JOB_SCHEDULE_KEY)); // Add job.name and job.group if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_NAME_KEY)) { jobSpec.setConfig(jobSpec.getConfig() .withValue(ConfigurationKeys.JOB_NAME_KEY, ConfigValueFactory.fromAnyRef( flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_NAME_KEY).unwrapped().toString() + "-" + sourceNode.getNodeName() + "-" + targetNode.getNodeName()))); } if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_GROUP_KEY)) { jobSpec.setConfig(jobSpec.getConfig() .withValue(ConfigurationKeys.JOB_GROUP_KEY, flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_GROUP_KEY))); } // Add flow execution id for this compilation long flowExecutionId = FlowUtils.getOrCreateFlowExecutionId(flowSpec); jobSpec.setConfig(jobSpec.getConfig().withValue(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, ConfigValueFactory.fromAnyRef(flowExecutionId))); // Reset properties in Spec from Config jobSpec.setConfigAsProperties(ConfigUtils.configToProperties(jobSpec.getConfig())); return jobSpec; }
[ "private", "JobSpec", "buildJobSpec", "(", "ServiceNode", "sourceNode", ",", "ServiceNode", "targetNode", ",", "URI", "templateURI", ",", "FlowSpec", "flowSpec", ")", "{", "JobSpec", "jobSpec", ";", "JobSpec", ".", "Builder", "jobSpecBuilder", "=", "JobSpec", ".", "builder", "(", "jobSpecURIGenerator", "(", "flowSpec", ",", "sourceNode", ",", "targetNode", ")", ")", ".", "withConfig", "(", "flowSpec", ".", "getConfig", "(", ")", ")", ".", "withDescription", "(", "flowSpec", ".", "getDescription", "(", ")", ")", ".", "withVersion", "(", "flowSpec", ".", "getVersion", "(", ")", ")", ";", "if", "(", "templateURI", "!=", "null", ")", "{", "jobSpecBuilder", ".", "withTemplate", "(", "templateURI", ")", ";", "try", "{", "jobSpec", "=", "new", "ResolvedJobSpec", "(", "jobSpecBuilder", ".", "build", "(", ")", ",", "templateCatalog", ".", "get", "(", ")", ")", ";", "log", ".", "info", "(", "\"Resolved JobSpec properties are: \"", "+", "jobSpec", ".", "getConfigAsProperties", "(", ")", ")", ";", "}", "catch", "(", "SpecNotFoundException", "|", "JobTemplate", ".", "TemplateException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Could not resolve template in JobSpec from TemplateCatalog\"", ",", "e", ")", ";", "}", "}", "else", "{", "jobSpec", "=", "jobSpecBuilder", ".", "build", "(", ")", ";", "log", ".", "info", "(", "\"Unresolved JobSpec properties are: \"", "+", "jobSpec", ".", "getConfigAsProperties", "(", ")", ")", ";", "}", "// Remove schedule", "jobSpec", ".", "setConfig", "(", "jobSpec", ".", "getConfig", "(", ")", ".", "withoutPath", "(", "ConfigurationKeys", ".", "JOB_SCHEDULE_KEY", ")", ")", ";", "// Add job.name and job.group", "if", "(", "flowSpec", ".", "getConfig", "(", ")", ".", "hasPath", "(", "ConfigurationKeys", ".", "FLOW_NAME_KEY", ")", ")", "{", "jobSpec", ".", "setConfig", "(", "jobSpec", ".", "getConfig", "(", ")", ".", "withValue", "(", "ConfigurationKeys", ".", "JOB_NAME_KEY", ",", "ConfigValueFactory", ".", "fromAnyRef", "(", "flowSpec", ".", "getConfig", "(", ")", ".", "getValue", "(", "ConfigurationKeys", ".", "FLOW_NAME_KEY", ")", ".", "unwrapped", "(", ")", ".", "toString", "(", ")", "+", "\"-\"", "+", "sourceNode", ".", "getNodeName", "(", ")", "+", "\"-\"", "+", "targetNode", ".", "getNodeName", "(", ")", ")", ")", ")", ";", "}", "if", "(", "flowSpec", ".", "getConfig", "(", ")", ".", "hasPath", "(", "ConfigurationKeys", ".", "FLOW_GROUP_KEY", ")", ")", "{", "jobSpec", ".", "setConfig", "(", "jobSpec", ".", "getConfig", "(", ")", ".", "withValue", "(", "ConfigurationKeys", ".", "JOB_GROUP_KEY", ",", "flowSpec", ".", "getConfig", "(", ")", ".", "getValue", "(", "ConfigurationKeys", ".", "FLOW_GROUP_KEY", ")", ")", ")", ";", "}", "// Add flow execution id for this compilation", "long", "flowExecutionId", "=", "FlowUtils", ".", "getOrCreateFlowExecutionId", "(", "flowSpec", ")", ";", "jobSpec", ".", "setConfig", "(", "jobSpec", ".", "getConfig", "(", ")", ".", "withValue", "(", "ConfigurationKeys", ".", "FLOW_EXECUTION_ID_KEY", ",", "ConfigValueFactory", ".", "fromAnyRef", "(", "flowExecutionId", ")", ")", ")", ";", "// Reset properties in Spec from Config", "jobSpec", ".", "setConfigAsProperties", "(", "ConfigUtils", ".", "configToProperties", "(", "jobSpec", ".", "getConfig", "(", ")", ")", ")", ";", "return", "jobSpec", ";", "}" ]
Generate JobSpec based on the #templateURI that user specified.
[ "Generate", "JobSpec", "based", "on", "the", "#templateURI", "that", "user", "specified", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopsFlowToJobSpecCompiler.java#L277-L320
codeprimate-software/cp-elements
src/main/java/org/cp/elements/data/conversion/converters/URIConverter.java
URIConverter.canConvert
@Override public boolean canConvert(Class<?> fromType, Class<?> toType) { """ Determines whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @param fromType {@link Class type} to convert from. @param toType {@link Class type} to convert to. @return a boolean indicating whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @see org.cp.elements.data.conversion.ConversionService#canConvert(Class, Class) @see #canConvert(Object, Class) """ return fromType != null && isAssignableTo(fromType, URI.class, URL.class, String.class) && URI.class.equals(toType); }
java
@Override public boolean canConvert(Class<?> fromType, Class<?> toType) { return fromType != null && isAssignableTo(fromType, URI.class, URL.class, String.class) && URI.class.equals(toType); }
[ "@", "Override", "public", "boolean", "canConvert", "(", "Class", "<", "?", ">", "fromType", ",", "Class", "<", "?", ">", "toType", ")", "{", "return", "fromType", "!=", "null", "&&", "isAssignableTo", "(", "fromType", ",", "URI", ".", "class", ",", "URL", ".", "class", ",", "String", ".", "class", ")", "&&", "URI", ".", "class", ".", "equals", "(", "toType", ")", ";", "}" ]
Determines whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @param fromType {@link Class type} to convert from. @param toType {@link Class type} to convert to. @return a boolean indicating whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @see org.cp.elements.data.conversion.ConversionService#canConvert(Class, Class) @see #canConvert(Object, Class)
[ "Determines", "whether", "this", "{", "@link", "Converter", "}", "can", "convert", "{", "@link", "Object", "Objects", "}", "{", "@link", "Class", "from", "type", "}", "{", "@link", "Class", "to", "type", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/conversion/converters/URIConverter.java#L51-L55
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java
AbstractAggregatorImpl.initialize
public void initialize(IConfig config) throws Exception { """ This method does some initialization for the aggregator servlet. This method is called from platform dependent Aggregator implementation during its initialization. @param config The aggregator config @throws Exception """ // Check last-modified times of resources in the overrides folders. These resources // are considered to be dynamic in a production environment and we want to // detect new/changed resources in these folders on startup so that we can clear // caches, etc. OverrideFoldersTreeWalker walker = new OverrideFoldersTreeWalker(this, config); walker.walkTree(); cacheMgr = newCacheManager(walker.getLastModified()); deps = newDependencies(walker.getLastModifiedJS()); resourcePaths = getPathsAndAliases(getInitParams()); // Notify listeners this.config = config; notifyConfigListeners(1); }
java
public void initialize(IConfig config) throws Exception { // Check last-modified times of resources in the overrides folders. These resources // are considered to be dynamic in a production environment and we want to // detect new/changed resources in these folders on startup so that we can clear // caches, etc. OverrideFoldersTreeWalker walker = new OverrideFoldersTreeWalker(this, config); walker.walkTree(); cacheMgr = newCacheManager(walker.getLastModified()); deps = newDependencies(walker.getLastModifiedJS()); resourcePaths = getPathsAndAliases(getInitParams()); // Notify listeners this.config = config; notifyConfigListeners(1); }
[ "public", "void", "initialize", "(", "IConfig", "config", ")", "throws", "Exception", "{", "// Check last-modified times of resources in the overrides folders. These resources\r", "// are considered to be dynamic in a production environment and we want to\r", "// detect new/changed resources in these folders on startup so that we can clear\r", "// caches, etc.\r", "OverrideFoldersTreeWalker", "walker", "=", "new", "OverrideFoldersTreeWalker", "(", "this", ",", "config", ")", ";", "walker", ".", "walkTree", "(", ")", ";", "cacheMgr", "=", "newCacheManager", "(", "walker", ".", "getLastModified", "(", ")", ")", ";", "deps", "=", "newDependencies", "(", "walker", ".", "getLastModifiedJS", "(", ")", ")", ";", "resourcePaths", "=", "getPathsAndAliases", "(", "getInitParams", "(", ")", ")", ";", "// Notify listeners\r", "this", ".", "config", "=", "config", ";", "notifyConfigListeners", "(", "1", ")", ";", "}" ]
This method does some initialization for the aggregator servlet. This method is called from platform dependent Aggregator implementation during its initialization. @param config The aggregator config @throws Exception
[ "This", "method", "does", "some", "initialization", "for", "the", "aggregator", "servlet", ".", "This", "method", "is", "called", "from", "platform", "dependent", "Aggregator", "implementation", "during", "its", "initialization", "." ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java#L1541-L1557
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java
SyncMembersInner.beginCreateOrUpdateAsync
public Observable<SyncMemberInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { """ Creates or updates a sync member. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group on which the sync member is hosted. @param syncMemberName The name of the sync member. @param parameters The requested sync member resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SyncMemberInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1<ServiceResponse<SyncMemberInner>, SyncMemberInner>() { @Override public SyncMemberInner call(ServiceResponse<SyncMemberInner> response) { return response.body(); } }); }
java
public Observable<SyncMemberInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1<ServiceResponse<SyncMemberInner>, SyncMemberInner>() { @Override public SyncMemberInner call(ServiceResponse<SyncMemberInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SyncMemberInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "syncGroupName", ",", "String", "syncMemberName", ",", "SyncMemberInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "syncGroupName", ",", "syncMemberName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "SyncMemberInner", ">", ",", "SyncMemberInner", ">", "(", ")", "{", "@", "Override", "public", "SyncMemberInner", "call", "(", "ServiceResponse", "<", "SyncMemberInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a sync member. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group on which the sync member is hosted. @param syncMemberName The name of the sync member. @param parameters The requested sync member resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SyncMemberInner object
[ "Creates", "or", "updates", "a", "sync", "member", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L372-L379
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setAsciiStream
public void setAsciiStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { """ Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large ASCII value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical to send it via a <code>java.io.InputStream</code>. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format. <p/> <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface. @param parameterIndex the first parameter is 1, the second is 2, ... @param x the Java input stream that contains the ASCII parameter value @param length the number of bytes in the stream @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code> """ if(x == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(x, length)); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
java
public void setAsciiStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { if(x == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(x, length)); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
[ "public", "void", "setAsciiStream", "(", "final", "int", "parameterIndex", ",", "final", "InputStream", "x", ",", "final", "int", "length", ")", "throws", "SQLException", "{", "if", "(", "x", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "Types", ".", "BLOB", ")", ";", "return", ";", "}", "try", "{", "setParameter", "(", "parameterIndex", ",", "new", "StreamParameter", "(", "x", ",", "length", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "SQLExceptionMapper", ".", "getSQLException", "(", "\"Could not read stream\"", ",", "e", ")", ";", "}", "}" ]
Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large ASCII value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical to send it via a <code>java.io.InputStream</code>. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format. <p/> <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface. @param parameterIndex the first parameter is 1, the second is 2, ... @param x the Java input stream that contains the ASCII parameter value @param length the number of bytes in the stream @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code>
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "input", "stream", "which", "will", "have", "the", "specified", "number", "of", "bytes", ".", "When", "a", "very", "large", "ASCII", "value", "is", "input", "to", "a", "<code", ">", "LONGVARCHAR<", "/", "code", ">", "parameter", "it", "may", "be", "more", "practical", "to", "send", "it", "via", "a", "<code", ">", "java", ".", "io", ".", "InputStream<", "/", "code", ">", ".", "Data", "will", "be", "read", "from", "the", "stream", "as", "needed", "until", "end", "-", "of", "-", "file", "is", "reached", ".", "The", "JDBC", "driver", "will", "do", "any", "necessary", "conversion", "from", "ASCII", "to", "the", "database", "char", "format", ".", "<p", "/", ">", "<P", ">", "<B", ">", "Note", ":", "<", "/", "B", ">", "This", "stream", "object", "can", "either", "be", "a", "standard", "Java", "stream", "object", "or", "your", "own", "subclass", "that", "implements", "the", "standard", "interface", "." ]
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L1200-L1212
samskivert/samskivert
src/main/java/com/samskivert/swing/util/MenuUtil.java
MenuUtil.addMenuItem
public static JMenuItem addMenuItem ( JMenu menu, String name, Object target, String callbackName) { """ Adds a new menu item to the menu with the specified name and attributes. The supplied method name will be called (it must have the same signature as {@link ActionListener#actionPerformed} but can be named whatever you like) when the menu item is selected. @param menu the menu to add the item to. @param name the item name. @param target the object on which to invoke a method when the menu is selected. @param callbackName the name of the method to invoke when the menu is selected. @return the new menu item. """ JMenuItem item = createItem(name, null, null); item.addActionListener(new ReflectedAction(target, callbackName)); menu.add(item); return item; }
java
public static JMenuItem addMenuItem ( JMenu menu, String name, Object target, String callbackName) { JMenuItem item = createItem(name, null, null); item.addActionListener(new ReflectedAction(target, callbackName)); menu.add(item); return item; }
[ "public", "static", "JMenuItem", "addMenuItem", "(", "JMenu", "menu", ",", "String", "name", ",", "Object", "target", ",", "String", "callbackName", ")", "{", "JMenuItem", "item", "=", "createItem", "(", "name", ",", "null", ",", "null", ")", ";", "item", ".", "addActionListener", "(", "new", "ReflectedAction", "(", "target", ",", "callbackName", ")", ")", ";", "menu", ".", "add", "(", "item", ")", ";", "return", "item", ";", "}" ]
Adds a new menu item to the menu with the specified name and attributes. The supplied method name will be called (it must have the same signature as {@link ActionListener#actionPerformed} but can be named whatever you like) when the menu item is selected. @param menu the menu to add the item to. @param name the item name. @param target the object on which to invoke a method when the menu is selected. @param callbackName the name of the method to invoke when the menu is selected. @return the new menu item.
[ "Adds", "a", "new", "menu", "item", "to", "the", "menu", "with", "the", "specified", "name", "and", "attributes", ".", "The", "supplied", "method", "name", "will", "be", "called", "(", "it", "must", "have", "the", "same", "signature", "as", "{", "@link", "ActionListener#actionPerformed", "}", "but", "can", "be", "named", "whatever", "you", "like", ")", "when", "the", "menu", "item", "is", "selected", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/MenuUtil.java#L142-L149
ontop/ontop
client/protege/src/main/java/it/unibz/inf/ontop/protege/gui/treemodels/QueryControllerTreeModel.java
QueryControllerTreeModel.getElementQuery
public QueryTreeElement getElementQuery(String element, String group) { """ Search a query node in a group and returns the object else returns null. """ QueryTreeElement node = null; Enumeration<TreeNode> elements = root.children(); while (elements.hasMoreElements()) { TreeElement currentNode = (TreeElement) elements.nextElement(); if (currentNode instanceof QueryGroupTreeElement && currentNode.getID().equals(group)) { QueryGroupTreeElement groupTElement = (QueryGroupTreeElement) currentNode; Enumeration<TreeNode> queries = groupTElement.children(); while (queries.hasMoreElements()) { QueryTreeElement queryTElement = (QueryTreeElement) queries.nextElement(); if (queryTElement.getID().equals(element)) { node = queryTElement; break; } } } else { continue; } } return node; }
java
public QueryTreeElement getElementQuery(String element, String group) { QueryTreeElement node = null; Enumeration<TreeNode> elements = root.children(); while (elements.hasMoreElements()) { TreeElement currentNode = (TreeElement) elements.nextElement(); if (currentNode instanceof QueryGroupTreeElement && currentNode.getID().equals(group)) { QueryGroupTreeElement groupTElement = (QueryGroupTreeElement) currentNode; Enumeration<TreeNode> queries = groupTElement.children(); while (queries.hasMoreElements()) { QueryTreeElement queryTElement = (QueryTreeElement) queries.nextElement(); if (queryTElement.getID().equals(element)) { node = queryTElement; break; } } } else { continue; } } return node; }
[ "public", "QueryTreeElement", "getElementQuery", "(", "String", "element", ",", "String", "group", ")", "{", "QueryTreeElement", "node", "=", "null", ";", "Enumeration", "<", "TreeNode", ">", "elements", "=", "root", ".", "children", "(", ")", ";", "while", "(", "elements", ".", "hasMoreElements", "(", ")", ")", "{", "TreeElement", "currentNode", "=", "(", "TreeElement", ")", "elements", ".", "nextElement", "(", ")", ";", "if", "(", "currentNode", "instanceof", "QueryGroupTreeElement", "&&", "currentNode", ".", "getID", "(", ")", ".", "equals", "(", "group", ")", ")", "{", "QueryGroupTreeElement", "groupTElement", "=", "(", "QueryGroupTreeElement", ")", "currentNode", ";", "Enumeration", "<", "TreeNode", ">", "queries", "=", "groupTElement", ".", "children", "(", ")", ";", "while", "(", "queries", ".", "hasMoreElements", "(", ")", ")", "{", "QueryTreeElement", "queryTElement", "=", "(", "QueryTreeElement", ")", "queries", ".", "nextElement", "(", ")", ";", "if", "(", "queryTElement", ".", "getID", "(", ")", ".", "equals", "(", "element", ")", ")", "{", "node", "=", "queryTElement", ";", "break", ";", "}", "}", "}", "else", "{", "continue", ";", "}", "}", "return", "node", ";", "}" ]
Search a query node in a group and returns the object else returns null.
[ "Search", "a", "query", "node", "in", "a", "group", "and", "returns", "the", "object", "else", "returns", "null", "." ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/client/protege/src/main/java/it/unibz/inf/ontop/protege/gui/treemodels/QueryControllerTreeModel.java#L262-L282
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSchemeManipulator.java
ReactionSchemeManipulator.extractPrecursorReaction
private static IReactionSet extractPrecursorReaction(IReaction reaction, IReactionSet reactionSet) { """ Extract reactions from a IReactionSet which at least one product is existing as reactant given a IReaction @param reaction The IReaction to analyze @param reactionSet The IReactionSet to inspect @return A IReactionSet containing the reactions """ IReactionSet reactConSet = reaction.getBuilder().newInstance(IReactionSet.class); for (IAtomContainer reactant : reaction.getReactants().atomContainers()) { for (IReaction reactionInt : reactionSet.reactions()) { for (IAtomContainer precursor : reactionInt.getProducts().atomContainers()) { if (reactant.equals(precursor)) { reactConSet.addReaction(reactionInt); } } } } return reactConSet; }
java
private static IReactionSet extractPrecursorReaction(IReaction reaction, IReactionSet reactionSet) { IReactionSet reactConSet = reaction.getBuilder().newInstance(IReactionSet.class); for (IAtomContainer reactant : reaction.getReactants().atomContainers()) { for (IReaction reactionInt : reactionSet.reactions()) { for (IAtomContainer precursor : reactionInt.getProducts().atomContainers()) { if (reactant.equals(precursor)) { reactConSet.addReaction(reactionInt); } } } } return reactConSet; }
[ "private", "static", "IReactionSet", "extractPrecursorReaction", "(", "IReaction", "reaction", ",", "IReactionSet", "reactionSet", ")", "{", "IReactionSet", "reactConSet", "=", "reaction", ".", "getBuilder", "(", ")", ".", "newInstance", "(", "IReactionSet", ".", "class", ")", ";", "for", "(", "IAtomContainer", "reactant", ":", "reaction", ".", "getReactants", "(", ")", ".", "atomContainers", "(", ")", ")", "{", "for", "(", "IReaction", "reactionInt", ":", "reactionSet", ".", "reactions", "(", ")", ")", "{", "for", "(", "IAtomContainer", "precursor", ":", "reactionInt", ".", "getProducts", "(", ")", ".", "atomContainers", "(", ")", ")", "{", "if", "(", "reactant", ".", "equals", "(", "precursor", ")", ")", "{", "reactConSet", ".", "addReaction", "(", "reactionInt", ")", ";", "}", "}", "}", "}", "return", "reactConSet", ";", "}" ]
Extract reactions from a IReactionSet which at least one product is existing as reactant given a IReaction @param reaction The IReaction to analyze @param reactionSet The IReactionSet to inspect @return A IReactionSet containing the reactions
[ "Extract", "reactions", "from", "a", "IReactionSet", "which", "at", "least", "one", "product", "is", "existing", "as", "reactant", "given", "a", "IReaction" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSchemeManipulator.java#L210-L222
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.getByResourceGroupAsync
public Observable<VirtualMachineInner> getByResourceGroupAsync(String resourceGroupName, String vmName) { """ Retrieves information about the model view or the instance view of a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineInner> getByResourceGroupAsync(String resourceGroupName, String vmName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualMachineInner", ">", ",", "VirtualMachineInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualMachineInner", "call", "(", "ServiceResponse", "<", "VirtualMachineInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieves information about the model view or the instance view of a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineInner object
[ "Retrieves", "information", "about", "the", "model", "view", "or", "the", "instance", "view", "of", "a", "virtual", "machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L903-L910
WASdev/ci.ant
src/main/java/net/wasdev/wlp/ant/AbstractTask.java
AbstractTask.findStringInFile
protected String findStringInFile(String regexp, File fileToSearch) throws Exception { """ Searches the given file for the given regular expression. @param regexp a regular expression (or just a text snippet) to search for @param fileToSearch the file to search @return The first line which includes the pattern, or null if the pattern isn't found or if the file doesn't exist @throws Exception """ String foundString = null; List<String> matches = findStringsInFileCommon(regexp, true, -1, fileToSearch); if (matches != null && !matches.isEmpty()) { foundString = matches.get(0); } return foundString; }
java
protected String findStringInFile(String regexp, File fileToSearch) throws Exception { String foundString = null; List<String> matches = findStringsInFileCommon(regexp, true, -1, fileToSearch); if (matches != null && !matches.isEmpty()) { foundString = matches.get(0); } return foundString; }
[ "protected", "String", "findStringInFile", "(", "String", "regexp", ",", "File", "fileToSearch", ")", "throws", "Exception", "{", "String", "foundString", "=", "null", ";", "List", "<", "String", ">", "matches", "=", "findStringsInFileCommon", "(", "regexp", ",", "true", ",", "-", "1", ",", "fileToSearch", ")", ";", "if", "(", "matches", "!=", "null", "&&", "!", "matches", ".", "isEmpty", "(", ")", ")", "{", "foundString", "=", "matches", ".", "get", "(", "0", ")", ";", "}", "return", "foundString", ";", "}" ]
Searches the given file for the given regular expression. @param regexp a regular expression (or just a text snippet) to search for @param fileToSearch the file to search @return The first line which includes the pattern, or null if the pattern isn't found or if the file doesn't exist @throws Exception
[ "Searches", "the", "given", "file", "for", "the", "given", "regular", "expression", "." ]
train
https://github.com/WASdev/ci.ant/blob/13edd5c9111b98e12f74c0be83f9180285e6e40c/src/main/java/net/wasdev/wlp/ant/AbstractTask.java#L336-L346
jaydeepw/audio-wife
libAudioWife/app/src/main/java/nl/changer/audiowife/AudioWife.java
AudioWife.useDefaultUi
public AudioWife useDefaultUi(ViewGroup playerContainer, LayoutInflater inflater) { """ ** Sets the default audio player UI as a child of the parameter container view. <br/> This is the simplest way to get AudioWife working for you. If you are using the default player provided by this method, calling method {@link nl.changer.audiowife.AudioWife#setPlayView(android.view.View)}, {@link nl.changer.audiowife.AudioWife#setPauseView(android.view.View)}, {@link nl.changer.audiowife.AudioWife#setSeekBar(android.widget.SeekBar)}, {@link nl.changer.audiowife.AudioWife#setPlaytime(android.widget.TextView)} will have no effect. <br/> <br/> The default player UI consists of: <ul> <li>Play view</li> <li>Pause view</li> <li>Seekbar</li> <li>Playtime</li> <ul> <br/> @param playerContainer View to integrate default player UI into. ** """ if (playerContainer == null) { throw new NullPointerException("Player container cannot be null"); } if (inflater == null) { throw new IllegalArgumentException("Inflater cannot be null"); } View playerUi = inflater.inflate(R.layout.aw_player, playerContainer); // init play view View playView = playerUi.findViewById(R.id.play); setPlayView(playView); // init pause view View pauseView = playerUi.findViewById(R.id.pause); setPauseView(pauseView); // init seekbar SeekBar seekBar = (SeekBar) playerUi.findViewById(R.id.media_seekbar); setSeekBar(seekBar); // init playback time view TextView playbackTime = (TextView) playerUi.findViewById(R.id.playback_time); setPlaytime(playbackTime); // this has to be set after all the views // have finished initializing. mHasDefaultUi = true; return this; }
java
public AudioWife useDefaultUi(ViewGroup playerContainer, LayoutInflater inflater) { if (playerContainer == null) { throw new NullPointerException("Player container cannot be null"); } if (inflater == null) { throw new IllegalArgumentException("Inflater cannot be null"); } View playerUi = inflater.inflate(R.layout.aw_player, playerContainer); // init play view View playView = playerUi.findViewById(R.id.play); setPlayView(playView); // init pause view View pauseView = playerUi.findViewById(R.id.pause); setPauseView(pauseView); // init seekbar SeekBar seekBar = (SeekBar) playerUi.findViewById(R.id.media_seekbar); setSeekBar(seekBar); // init playback time view TextView playbackTime = (TextView) playerUi.findViewById(R.id.playback_time); setPlaytime(playbackTime); // this has to be set after all the views // have finished initializing. mHasDefaultUi = true; return this; }
[ "public", "AudioWife", "useDefaultUi", "(", "ViewGroup", "playerContainer", ",", "LayoutInflater", "inflater", ")", "{", "if", "(", "playerContainer", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Player container cannot be null\"", ")", ";", "}", "if", "(", "inflater", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Inflater cannot be null\"", ")", ";", "}", "View", "playerUi", "=", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "aw_player", ",", "playerContainer", ")", ";", "// init play view", "View", "playView", "=", "playerUi", ".", "findViewById", "(", "R", ".", "id", ".", "play", ")", ";", "setPlayView", "(", "playView", ")", ";", "// init pause view", "View", "pauseView", "=", "playerUi", ".", "findViewById", "(", "R", ".", "id", ".", "pause", ")", ";", "setPauseView", "(", "pauseView", ")", ";", "// init seekbar", "SeekBar", "seekBar", "=", "(", "SeekBar", ")", "playerUi", ".", "findViewById", "(", "R", ".", "id", ".", "media_seekbar", ")", ";", "setSeekBar", "(", "seekBar", ")", ";", "// init playback time view", "TextView", "playbackTime", "=", "(", "TextView", ")", "playerUi", ".", "findViewById", "(", "R", ".", "id", ".", "playback_time", ")", ";", "setPlaytime", "(", "playbackTime", ")", ";", "// this has to be set after all the views", "// have finished initializing.", "mHasDefaultUi", "=", "true", ";", "return", "this", ";", "}" ]
** Sets the default audio player UI as a child of the parameter container view. <br/> This is the simplest way to get AudioWife working for you. If you are using the default player provided by this method, calling method {@link nl.changer.audiowife.AudioWife#setPlayView(android.view.View)}, {@link nl.changer.audiowife.AudioWife#setPauseView(android.view.View)}, {@link nl.changer.audiowife.AudioWife#setSeekBar(android.widget.SeekBar)}, {@link nl.changer.audiowife.AudioWife#setPlaytime(android.widget.TextView)} will have no effect. <br/> <br/> The default player UI consists of: <ul> <li>Play view</li> <li>Pause view</li> <li>Seekbar</li> <li>Playtime</li> <ul> <br/> @param playerContainer View to integrate default player UI into. **
[ "**", "Sets", "the", "default", "audio", "player", "UI", "as", "a", "child", "of", "the", "parameter", "container", "view", "." ]
train
https://github.com/jaydeepw/audio-wife/blob/e5cf4d1306ff742e9c7fc0e3d990792f0b4e56d9/libAudioWife/app/src/main/java/nl/changer/audiowife/AudioWife.java#L708-L739
mojohaus/jaxb2-maven-plugin
src/it/mjaxb-55/src/main/java/se/west/validation/XmlNormalizer.java
XmlNormalizer.getNormalizedXml
public String getNormalizedXml(String filePath) { """ Reads the XML file found at the provided filePath, returning a normalized XML form suitable for comparison. @param filePath The path to the XML file to read. @return A normalized, human-readable, version of the given XML document. """ // Read the provided filename final StringWriter toReturn = new StringWriter(); final BufferedReader in; try { in = new BufferedReader(new FileReader(new File(filePath))); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Could not find file [" + filePath + "]", e); } // Parse into a Document final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); Document document = null; try { document = factory.newDocumentBuilder().parse(new InputSource(in)); Transformer transformer = FACTORY.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.transform(new DOMSource(document.getFirstChild()), new StreamResult(toReturn)); } catch (Exception e) { throw new IllegalArgumentException("Could not transform DOM Document", e); } // All done. return toReturn.toString(); }
java
public String getNormalizedXml(String filePath) { // Read the provided filename final StringWriter toReturn = new StringWriter(); final BufferedReader in; try { in = new BufferedReader(new FileReader(new File(filePath))); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Could not find file [" + filePath + "]", e); } // Parse into a Document final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); Document document = null; try { document = factory.newDocumentBuilder().parse(new InputSource(in)); Transformer transformer = FACTORY.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.transform(new DOMSource(document.getFirstChild()), new StreamResult(toReturn)); } catch (Exception e) { throw new IllegalArgumentException("Could not transform DOM Document", e); } // All done. return toReturn.toString(); }
[ "public", "String", "getNormalizedXml", "(", "String", "filePath", ")", "{", "// Read the provided filename\r", "final", "StringWriter", "toReturn", "=", "new", "StringWriter", "(", ")", ";", "final", "BufferedReader", "in", ";", "try", "{", "in", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "new", "File", "(", "filePath", ")", ")", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not find file [\"", "+", "filePath", "+", "\"]\"", ",", "e", ")", ";", "}", "// Parse into a Document\r", "final", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "factory", ".", "setNamespaceAware", "(", "true", ")", ";", "Document", "document", "=", "null", ";", "try", "{", "document", "=", "factory", ".", "newDocumentBuilder", "(", ")", ".", "parse", "(", "new", "InputSource", "(", "in", ")", ")", ";", "Transformer", "transformer", "=", "FACTORY", ".", "newTransformer", "(", ")", ";", "transformer", ".", "setOutputProperty", "(", "OutputKeys", ".", "INDENT", ",", "\"yes\"", ")", ";", "transformer", ".", "transform", "(", "new", "DOMSource", "(", "document", ".", "getFirstChild", "(", ")", ")", ",", "new", "StreamResult", "(", "toReturn", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not transform DOM Document\"", ",", "e", ")", ";", "}", "// All done.\r", "return", "toReturn", ".", "toString", "(", ")", ";", "}" ]
Reads the XML file found at the provided filePath, returning a normalized XML form suitable for comparison. @param filePath The path to the XML file to read. @return A normalized, human-readable, version of the given XML document.
[ "Reads", "the", "XML", "file", "found", "at", "the", "provided", "filePath", "returning", "a", "normalized", "XML", "form", "suitable", "for", "comparison", "." ]
train
https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/it/mjaxb-55/src/main/java/se/west/validation/XmlNormalizer.java#L37-L66
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java
InternalOutputStreamManager.stampNotFlushed
public ControlNotFlushed stampNotFlushed(ControlNotFlushed msg, SIBUuid12 streamID) throws SIResourceException { """ Attach the appropriate completed and duplicate prefixes for the stream stored in this array to a ControlNotFlushed message. @param msg The ControlNotFlushed message to stamp. @throws SIResourceException """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "stampNotFlushed", new Object[] { msg }); int count = 0; //the maximum possible number of streams in a set int max = (SIMPConstants.MSG_HIGH_PRIORITY + 1) * (Reliability.MAX_INDEX + 1); //an array of priorities int[] ps = new int[max]; //an array of reliabilities int[] qs = new int[max]; //an array of prefixes long[] cs = new long[max]; StreamSet streamSet = getStreamSet(streamID, false); //iterate through the non-null streams Iterator itr = streamSet.iterator(); while (itr.hasNext()) { InternalOutputStream oStream = (InternalOutputStream) itr.next(); // for each stream, store it's priority, reliability and completed prefix ps[count] = oStream.getPriority(); qs[count] = oStream.getReliability().toInt(); cs[count] = oStream.getCompletedPrefix(); count++; } //create some arrays which are of the correct size int[] realps = new int[count]; int[] realqs = new int[count]; long[] realcs = new long[count]; //copy the data in to them System.arraycopy(ps, 0, realps, 0, count); System.arraycopy(qs, 0, realqs, 0, count); System.arraycopy(cs, 0, realcs, 0, count); //set the appropriate message fields msg.setCompletedPrefixPriority(realps); msg.setCompletedPrefixQOS(realqs); msg.setCompletedPrefixTicks(realcs); msg.setDuplicatePrefixPriority(realps); msg.setDuplicatePrefixQOS(realqs); msg.setDuplicatePrefixTicks(realcs); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "stampNotFlushed", msg); //return the message return msg; }
java
public ControlNotFlushed stampNotFlushed(ControlNotFlushed msg, SIBUuid12 streamID) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "stampNotFlushed", new Object[] { msg }); int count = 0; //the maximum possible number of streams in a set int max = (SIMPConstants.MSG_HIGH_PRIORITY + 1) * (Reliability.MAX_INDEX + 1); //an array of priorities int[] ps = new int[max]; //an array of reliabilities int[] qs = new int[max]; //an array of prefixes long[] cs = new long[max]; StreamSet streamSet = getStreamSet(streamID, false); //iterate through the non-null streams Iterator itr = streamSet.iterator(); while (itr.hasNext()) { InternalOutputStream oStream = (InternalOutputStream) itr.next(); // for each stream, store it's priority, reliability and completed prefix ps[count] = oStream.getPriority(); qs[count] = oStream.getReliability().toInt(); cs[count] = oStream.getCompletedPrefix(); count++; } //create some arrays which are of the correct size int[] realps = new int[count]; int[] realqs = new int[count]; long[] realcs = new long[count]; //copy the data in to them System.arraycopy(ps, 0, realps, 0, count); System.arraycopy(qs, 0, realqs, 0, count); System.arraycopy(cs, 0, realcs, 0, count); //set the appropriate message fields msg.setCompletedPrefixPriority(realps); msg.setCompletedPrefixQOS(realqs); msg.setCompletedPrefixTicks(realcs); msg.setDuplicatePrefixPriority(realps); msg.setDuplicatePrefixQOS(realqs); msg.setDuplicatePrefixTicks(realcs); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "stampNotFlushed", msg); //return the message return msg; }
[ "public", "ControlNotFlushed", "stampNotFlushed", "(", "ControlNotFlushed", "msg", ",", "SIBUuid12", "streamID", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"stampNotFlushed\"", ",", "new", "Object", "[", "]", "{", "msg", "}", ")", ";", "int", "count", "=", "0", ";", "//the maximum possible number of streams in a set", "int", "max", "=", "(", "SIMPConstants", ".", "MSG_HIGH_PRIORITY", "+", "1", ")", "*", "(", "Reliability", ".", "MAX_INDEX", "+", "1", ")", ";", "//an array of priorities", "int", "[", "]", "ps", "=", "new", "int", "[", "max", "]", ";", "//an array of reliabilities", "int", "[", "]", "qs", "=", "new", "int", "[", "max", "]", ";", "//an array of prefixes", "long", "[", "]", "cs", "=", "new", "long", "[", "max", "]", ";", "StreamSet", "streamSet", "=", "getStreamSet", "(", "streamID", ",", "false", ")", ";", "//iterate through the non-null streams", "Iterator", "itr", "=", "streamSet", ".", "iterator", "(", ")", ";", "while", "(", "itr", ".", "hasNext", "(", ")", ")", "{", "InternalOutputStream", "oStream", "=", "(", "InternalOutputStream", ")", "itr", ".", "next", "(", ")", ";", "// for each stream, store it's priority, reliability and completed prefix", "ps", "[", "count", "]", "=", "oStream", ".", "getPriority", "(", ")", ";", "qs", "[", "count", "]", "=", "oStream", ".", "getReliability", "(", ")", ".", "toInt", "(", ")", ";", "cs", "[", "count", "]", "=", "oStream", ".", "getCompletedPrefix", "(", ")", ";", "count", "++", ";", "}", "//create some arrays which are of the correct size", "int", "[", "]", "realps", "=", "new", "int", "[", "count", "]", ";", "int", "[", "]", "realqs", "=", "new", "int", "[", "count", "]", ";", "long", "[", "]", "realcs", "=", "new", "long", "[", "count", "]", ";", "//copy the data in to them", "System", ".", "arraycopy", "(", "ps", ",", "0", ",", "realps", ",", "0", ",", "count", ")", ";", "System", ".", "arraycopy", "(", "qs", ",", "0", ",", "realqs", ",", "0", ",", "count", ")", ";", "System", ".", "arraycopy", "(", "cs", ",", "0", ",", "realcs", ",", "0", ",", "count", ")", ";", "//set the appropriate message fields", "msg", ".", "setCompletedPrefixPriority", "(", "realps", ")", ";", "msg", ".", "setCompletedPrefixQOS", "(", "realqs", ")", ";", "msg", ".", "setCompletedPrefixTicks", "(", "realcs", ")", ";", "msg", ".", "setDuplicatePrefixPriority", "(", "realps", ")", ";", "msg", ".", "setDuplicatePrefixQOS", "(", "realqs", ")", ";", "msg", ".", "setDuplicatePrefixTicks", "(", "realcs", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"stampNotFlushed\"", ",", "msg", ")", ";", "//return the message", "return", "msg", ";", "}" ]
Attach the appropriate completed and duplicate prefixes for the stream stored in this array to a ControlNotFlushed message. @param msg The ControlNotFlushed message to stamp. @throws SIResourceException
[ "Attach", "the", "appropriate", "completed", "and", "duplicate", "prefixes", "for", "the", "stream", "stored", "in", "this", "array", "to", "a", "ControlNotFlushed", "message", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/InternalOutputStreamManager.java#L806-L860
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/RtfWriter2.java
RtfWriter2.importRtfDocument
public void importRtfDocument(InputStream documentSource, EventListener[] events ) throws IOException, DocumentException { """ Adds the complete RTF document to the current RTF document being generated. It will parse the font and color tables and correct the font and color references so that the imported RTF document retains its formattings. Uses new RtfParser object. (author: Howard Shank) @param documentSource The InputStream to read the RTF document from. @param events The array of event listeners. May be null @throws IOException @throws DocumentException @see RtfParser @see RtfParser#importRtfDocument(InputStream, RtfDocument) @since 2.0.8 """ if(!this.open) { throw new DocumentException("The document must be open to import RTF documents."); } RtfParser rtfImport = new RtfParser(this.document); if(events != null) { for(int idx=0;idx<events.length;idx++) { rtfImport.addListener(events[idx]); } } rtfImport.importRtfDocument(documentSource, this.rtfDoc); }
java
public void importRtfDocument(InputStream documentSource, EventListener[] events ) throws IOException, DocumentException { if(!this.open) { throw new DocumentException("The document must be open to import RTF documents."); } RtfParser rtfImport = new RtfParser(this.document); if(events != null) { for(int idx=0;idx<events.length;idx++) { rtfImport.addListener(events[idx]); } } rtfImport.importRtfDocument(documentSource, this.rtfDoc); }
[ "public", "void", "importRtfDocument", "(", "InputStream", "documentSource", ",", "EventListener", "[", "]", "events", ")", "throws", "IOException", ",", "DocumentException", "{", "if", "(", "!", "this", ".", "open", ")", "{", "throw", "new", "DocumentException", "(", "\"The document must be open to import RTF documents.\"", ")", ";", "}", "RtfParser", "rtfImport", "=", "new", "RtfParser", "(", "this", ".", "document", ")", ";", "if", "(", "events", "!=", "null", ")", "{", "for", "(", "int", "idx", "=", "0", ";", "idx", "<", "events", ".", "length", ";", "idx", "++", ")", "{", "rtfImport", ".", "addListener", "(", "events", "[", "idx", "]", ")", ";", "}", "}", "rtfImport", ".", "importRtfDocument", "(", "documentSource", ",", "this", ".", "rtfDoc", ")", ";", "}" ]
Adds the complete RTF document to the current RTF document being generated. It will parse the font and color tables and correct the font and color references so that the imported RTF document retains its formattings. Uses new RtfParser object. (author: Howard Shank) @param documentSource The InputStream to read the RTF document from. @param events The array of event listeners. May be null @throws IOException @throws DocumentException @see RtfParser @see RtfParser#importRtfDocument(InputStream, RtfDocument) @since 2.0.8
[ "Adds", "the", "complete", "RTF", "document", "to", "the", "current", "RTF", "document", "being", "generated", ".", "It", "will", "parse", "the", "font", "and", "color", "tables", "and", "correct", "the", "font", "and", "color", "references", "so", "that", "the", "imported", "RTF", "document", "retains", "its", "formattings", ".", "Uses", "new", "RtfParser", "object", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/RtfWriter2.java#L286-L297
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java
Validator.demapProperties
public static Map<String, String> demapProperties(final Map<String, String> input, final Description desc) { """ Reverses a set of properties mapped using the description's configuration to property mapping, or the same input if the description has no mapping @param input input map @param desc plugin description @return mapped values """ final Map<String, String> mapping = desc.getPropertiesMapping(); return demapProperties(input, mapping, true); }
java
public static Map<String, String> demapProperties(final Map<String, String> input, final Description desc) { final Map<String, String> mapping = desc.getPropertiesMapping(); return demapProperties(input, mapping, true); }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "demapProperties", "(", "final", "Map", "<", "String", ",", "String", ">", "input", ",", "final", "Description", "desc", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "mapping", "=", "desc", ".", "getPropertiesMapping", "(", ")", ";", "return", "demapProperties", "(", "input", ",", "mapping", ",", "true", ")", ";", "}" ]
Reverses a set of properties mapped using the description's configuration to property mapping, or the same input if the description has no mapping @param input input map @param desc plugin description @return mapped values
[ "Reverses", "a", "set", "of", "properties", "mapped", "using", "the", "description", "s", "configuration", "to", "property", "mapping", "or", "the", "same", "input", "if", "the", "description", "has", "no", "mapping" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java#L277-L280
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/DBQuery.java
DBQuery.lessThan
public static Query lessThan(String field, Object value) { """ The field is less than the given value @param field The field to compare @param value The value to compare to @return the query """ return new Query().lessThan(field, value); }
java
public static Query lessThan(String field, Object value) { return new Query().lessThan(field, value); }
[ "public", "static", "Query", "lessThan", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "new", "Query", "(", ")", ".", "lessThan", "(", "field", ",", "value", ")", ";", "}" ]
The field is less than the given value @param field The field to compare @param value The value to compare to @return the query
[ "The", "field", "is", "less", "than", "the", "given", "value" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBQuery.java#L62-L64
hal/core
gui/src/main/java/org/jboss/as/console/client/v3/elemento/Elements.java
Elements.innerHtml
public static void innerHtml(Element element, SafeHtml html) { """ Convenience method to set the inner HTML of the given element. """ if (element != null) { element.setInnerHTML(html.asString()); } }
java
public static void innerHtml(Element element, SafeHtml html) { if (element != null) { element.setInnerHTML(html.asString()); } }
[ "public", "static", "void", "innerHtml", "(", "Element", "element", ",", "SafeHtml", "html", ")", "{", "if", "(", "element", "!=", "null", ")", "{", "element", ".", "setInnerHTML", "(", "html", ".", "asString", "(", ")", ")", ";", "}", "}" ]
Convenience method to set the inner HTML of the given element.
[ "Convenience", "method", "to", "set", "the", "inner", "HTML", "of", "the", "given", "element", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/v3/elemento/Elements.java#L556-L560
hankcs/HanLP
src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java
AbstractLexicalAnalyzer.pushPiece
private void pushPiece(String sentence, String normalized, int start, int end, byte preType, List<String> wordList) { """ CT_CHINESE区间交给统计分词,否则视作整个单位 @param sentence @param normalized @param start @param end @param preType @param wordList """ if (preType == CharType.CT_CHINESE) { segmenter.segment(sentence.substring(start, end), normalized.substring(start, end), wordList); } else { wordList.add(sentence.substring(start, end)); } }
java
private void pushPiece(String sentence, String normalized, int start, int end, byte preType, List<String> wordList) { if (preType == CharType.CT_CHINESE) { segmenter.segment(sentence.substring(start, end), normalized.substring(start, end), wordList); } else { wordList.add(sentence.substring(start, end)); } }
[ "private", "void", "pushPiece", "(", "String", "sentence", ",", "String", "normalized", ",", "int", "start", ",", "int", "end", ",", "byte", "preType", ",", "List", "<", "String", ">", "wordList", ")", "{", "if", "(", "preType", "==", "CharType", ".", "CT_CHINESE", ")", "{", "segmenter", ".", "segment", "(", "sentence", ".", "substring", "(", "start", ",", "end", ")", ",", "normalized", ".", "substring", "(", "start", ",", "end", ")", ",", "wordList", ")", ";", "}", "else", "{", "wordList", ".", "add", "(", "sentence", ".", "substring", "(", "start", ",", "end", ")", ")", ";", "}", "}" ]
CT_CHINESE区间交给统计分词,否则视作整个单位 @param sentence @param normalized @param start @param end @param preType @param wordList
[ "CT_CHINESE区间交给统计分词,否则视作整个单位" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java#L522-L532
netty/netty
common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java
SystemPropertyUtil.getLong
public static long getLong(String key, long def) { """ Returns the value of the Java system property with the specified {@code key}, while falling back to the specified default value if the property access fails. @return the property value. {@code def} if there's no such property or if an access to the specified property is not allowed. """ String value = get(key); if (value == null) { return def; } value = value.trim(); try { return Long.parseLong(value); } catch (Exception e) { // Ignore } logger.warn( "Unable to parse the long integer system property '{}':{} - using the default value: {}", key, value, def ); return def; }
java
public static long getLong(String key, long def) { String value = get(key); if (value == null) { return def; } value = value.trim(); try { return Long.parseLong(value); } catch (Exception e) { // Ignore } logger.warn( "Unable to parse the long integer system property '{}':{} - using the default value: {}", key, value, def ); return def; }
[ "public", "static", "long", "getLong", "(", "String", "key", ",", "long", "def", ")", "{", "String", "value", "=", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "def", ";", "}", "value", "=", "value", ".", "trim", "(", ")", ";", "try", "{", "return", "Long", ".", "parseLong", "(", "value", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// Ignore", "}", "logger", ".", "warn", "(", "\"Unable to parse the long integer system property '{}':{} - using the default value: {}\"", ",", "key", ",", "value", ",", "def", ")", ";", "return", "def", ";", "}" ]
Returns the value of the Java system property with the specified {@code key}, while falling back to the specified default value if the property access fails. @return the property value. {@code def} if there's no such property or if an access to the specified property is not allowed.
[ "Returns", "the", "value", "of", "the", "Java", "system", "property", "with", "the", "specified", "{", "@code", "key", "}", "while", "falling", "back", "to", "the", "specified", "default", "value", "if", "the", "property", "access", "fails", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java#L164-L183
citrusframework/citrus
modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java
PurgeJmsQueuesAction.purgeDestination
private void purgeDestination(Destination destination, Session session, String destinationName) throws JMSException { """ Purge destination by receiving all available messages. @param destination @param session @param destinationName @throws JMSException """ if (log.isDebugEnabled()) { log.debug("Try to purge destination " + destinationName); } int messagesPurged = 0; MessageConsumer messageConsumer = session.createConsumer(destination); try { javax.jms.Message message; do { message = (receiveTimeout >= 0) ? messageConsumer.receive(receiveTimeout) : messageConsumer.receive(); if (message != null) { log.debug("Removed message from destination " + destinationName); messagesPurged++; try { Thread.sleep(sleepTime); } catch (InterruptedException e) { log.warn("Interrupted during wait", e); } } } while (message != null); if (log.isDebugEnabled()) { log.debug("Purged " + messagesPurged + " messages from destination"); } } finally { JmsUtils.closeMessageConsumer(messageConsumer); } }
java
private void purgeDestination(Destination destination, Session session, String destinationName) throws JMSException { if (log.isDebugEnabled()) { log.debug("Try to purge destination " + destinationName); } int messagesPurged = 0; MessageConsumer messageConsumer = session.createConsumer(destination); try { javax.jms.Message message; do { message = (receiveTimeout >= 0) ? messageConsumer.receive(receiveTimeout) : messageConsumer.receive(); if (message != null) { log.debug("Removed message from destination " + destinationName); messagesPurged++; try { Thread.sleep(sleepTime); } catch (InterruptedException e) { log.warn("Interrupted during wait", e); } } } while (message != null); if (log.isDebugEnabled()) { log.debug("Purged " + messagesPurged + " messages from destination"); } } finally { JmsUtils.closeMessageConsumer(messageConsumer); } }
[ "private", "void", "purgeDestination", "(", "Destination", "destination", ",", "Session", "session", ",", "String", "destinationName", ")", "throws", "JMSException", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Try to purge destination \"", "+", "destinationName", ")", ";", "}", "int", "messagesPurged", "=", "0", ";", "MessageConsumer", "messageConsumer", "=", "session", ".", "createConsumer", "(", "destination", ")", ";", "try", "{", "javax", ".", "jms", ".", "Message", "message", ";", "do", "{", "message", "=", "(", "receiveTimeout", ">=", "0", ")", "?", "messageConsumer", ".", "receive", "(", "receiveTimeout", ")", ":", "messageConsumer", ".", "receive", "(", ")", ";", "if", "(", "message", "!=", "null", ")", "{", "log", ".", "debug", "(", "\"Removed message from destination \"", "+", "destinationName", ")", ";", "messagesPurged", "++", ";", "try", "{", "Thread", ".", "sleep", "(", "sleepTime", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "log", ".", "warn", "(", "\"Interrupted during wait\"", ",", "e", ")", ";", "}", "}", "}", "while", "(", "message", "!=", "null", ")", ";", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Purged \"", "+", "messagesPurged", "+", "\" messages from destination\"", ")", ";", "}", "}", "finally", "{", "JmsUtils", ".", "closeMessageConsumer", "(", "messageConsumer", ")", ";", "}", "}" ]
Purge destination by receiving all available messages. @param destination @param session @param destinationName @throws JMSException
[ "Purge", "destination", "by", "receiving", "all", "available", "messages", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java#L128-L158
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java
PhoneNumberUtil.formatE123
public final String formatE123(final String pphoneNumber, final String pcountryCode) { """ format phone number in E123 format. @param pphoneNumber phone number as String to format @param pcountryCode iso code of country @return formated phone number as String """ return this.formatE123(this.parsePhoneNumber(pphoneNumber), CreatePhoneCountryConstantsClass .create().countryMap().get(StringUtils.defaultString(pcountryCode))); }
java
public final String formatE123(final String pphoneNumber, final String pcountryCode) { return this.formatE123(this.parsePhoneNumber(pphoneNumber), CreatePhoneCountryConstantsClass .create().countryMap().get(StringUtils.defaultString(pcountryCode))); }
[ "public", "final", "String", "formatE123", "(", "final", "String", "pphoneNumber", ",", "final", "String", "pcountryCode", ")", "{", "return", "this", ".", "formatE123", "(", "this", ".", "parsePhoneNumber", "(", "pphoneNumber", ")", ",", "CreatePhoneCountryConstantsClass", ".", "create", "(", ")", ".", "countryMap", "(", ")", ".", "get", "(", "StringUtils", ".", "defaultString", "(", "pcountryCode", ")", ")", ")", ";", "}" ]
format phone number in E123 format. @param pphoneNumber phone number as String to format @param pcountryCode iso code of country @return formated phone number as String
[ "format", "phone", "number", "in", "E123", "format", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java#L394-L397
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.beginPerformMaintenance
public OperationStatusResponseInner beginPerformMaintenance(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { """ Perform maintenance on one or more virtual machines in a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceIds The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. @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 OperationStatusResponseInner object if successful. """ return beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); }
java
public OperationStatusResponseInner beginPerformMaintenance(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { return beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); }
[ "public", "OperationStatusResponseInner", "beginPerformMaintenance", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "List", "<", "String", ">", "instanceIds", ")", "{", "return", "beginPerformMaintenanceWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ",", "instanceIds", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Perform maintenance on one or more virtual machines in a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceIds The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. @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 OperationStatusResponseInner object if successful.
[ "Perform", "maintenance", "on", "one", "or", "more", "virtual", "machines", "in", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java#L3426-L3428
dkpro/dkpro-statistics
dkpro-statistics-correlation/src/main/java/org/dkpro/statistics/correlation/SpearmansRankCorrelation.java
SpearmansRankCorrelation.computeCorrelation
public static double computeCorrelation(List<Double> list1, List<Double> list2) { """ Computes the correlation between two datasets. @param list1 The first dataset as a list. @param list2 The second dataset as a list. @return The correlation between the two datasets. """ double[] l1 = new double[list1.size()]; double[] l2 = new double[list2.size()]; for (int i=0; i<list1.size(); i++) { l1[i] = list1.get(i); } for (int i=0; i<list2.size(); i++) { l2[i] = list2.get(i); } SpearmansCorrelation sc = new SpearmansCorrelation(); return sc.correlation(l1, l2); }
java
public static double computeCorrelation(List<Double> list1, List<Double> list2) { double[] l1 = new double[list1.size()]; double[] l2 = new double[list2.size()]; for (int i=0; i<list1.size(); i++) { l1[i] = list1.get(i); } for (int i=0; i<list2.size(); i++) { l2[i] = list2.get(i); } SpearmansCorrelation sc = new SpearmansCorrelation(); return sc.correlation(l1, l2); }
[ "public", "static", "double", "computeCorrelation", "(", "List", "<", "Double", ">", "list1", ",", "List", "<", "Double", ">", "list2", ")", "{", "double", "[", "]", "l1", "=", "new", "double", "[", "list1", ".", "size", "(", ")", "]", ";", "double", "[", "]", "l2", "=", "new", "double", "[", "list2", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list1", ".", "size", "(", ")", ";", "i", "++", ")", "{", "l1", "[", "i", "]", "=", "list1", ".", "get", "(", "i", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list2", ".", "size", "(", ")", ";", "i", "++", ")", "{", "l2", "[", "i", "]", "=", "list2", ".", "get", "(", "i", ")", ";", "}", "SpearmansCorrelation", "sc", "=", "new", "SpearmansCorrelation", "(", ")", ";", "return", "sc", ".", "correlation", "(", "l1", ",", "l2", ")", ";", "}" ]
Computes the correlation between two datasets. @param list1 The first dataset as a list. @param list2 The second dataset as a list. @return The correlation between the two datasets.
[ "Computes", "the", "correlation", "between", "two", "datasets", "." ]
train
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-correlation/src/main/java/org/dkpro/statistics/correlation/SpearmansRankCorrelation.java#L34-L47