repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
diffplug/durian
src/com/diffplug/common/base/TreeQuery.java
TreeQuery.isDescendantOfOrEqualTo
public static <T> boolean isDescendantOfOrEqualTo(TreeDef.Parented<T> treeDef, T child, T parent) { if (child.equals(parent)) { return true; } else { return isDescendantOf(treeDef, child, parent); } }
java
public static <T> boolean isDescendantOfOrEqualTo(TreeDef.Parented<T> treeDef, T child, T parent) { if (child.equals(parent)) { return true; } else { return isDescendantOf(treeDef, child, parent); } }
[ "public", "static", "<", "T", ">", "boolean", "isDescendantOfOrEqualTo", "(", "TreeDef", ".", "Parented", "<", "T", ">", "treeDef", ",", "T", "child", ",", "T", "parent", ")", "{", "if", "(", "child", ".", "equals", "(", "parent", ")", ")", "{", "ret...
Returns true iff child is a descendant of parent, or if child is equal to parent.
[ "Returns", "true", "iff", "child", "is", "a", "descendant", "of", "parent", "or", "if", "child", "is", "equal", "to", "parent", "." ]
train
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L47-L53
javamelody/javamelody
javamelody-core/src/main/java/net/bull/javamelody/internal/web/pdf/PdfDocumentFactory.java
PdfDocumentFactory.createWriter
private void createWriter(Document document, String title) throws DocumentException, IOException { final PdfWriter writer = PdfWriter.getInstance(document, output); //writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft); // title final HeaderFooter header = new HeaderFooter(new Phrase(title), false); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); // simple page numbers : x //HeaderFooter footer = new HeaderFooter(new Phrase(), true); //footer.setAlignment(Element.ALIGN_RIGHT); //footer.setBorder(Rectangle.TOP); //document.setFooter(footer); // add the event handler for advanced page numbers : x/y writer.setPageEvent(new PdfAdvancedPageNumberEvents()); }
java
private void createWriter(Document document, String title) throws DocumentException, IOException { final PdfWriter writer = PdfWriter.getInstance(document, output); //writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft); // title final HeaderFooter header = new HeaderFooter(new Phrase(title), false); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); // simple page numbers : x //HeaderFooter footer = new HeaderFooter(new Phrase(), true); //footer.setAlignment(Element.ALIGN_RIGHT); //footer.setBorder(Rectangle.TOP); //document.setFooter(footer); // add the event handler for advanced page numbers : x/y writer.setPageEvent(new PdfAdvancedPageNumberEvents()); }
[ "private", "void", "createWriter", "(", "Document", "document", ",", "String", "title", ")", "throws", "DocumentException", ",", "IOException", "{", "final", "PdfWriter", "writer", "=", "PdfWriter", ".", "getInstance", "(", "document", ",", "output", ")", ";", ...
We create a writer that listens to the document and directs a PDF-stream to output
[ "We", "create", "a", "writer", "that", "listens", "to", "the", "document", "and", "directs", "a", "PDF", "-", "stream", "to", "output" ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/web/pdf/PdfDocumentFactory.java#L180-L199
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateEmail
public static <T extends CharSequence> T validateEmail(T value, String errorMsg) throws ValidateException { if (false == isEmail(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateEmail(T value, String errorMsg) throws ValidateException { if (false == isEmail(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateEmail", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isEmail", "(", "value", ")", ")", "{", "throw", "new", "...
验证是否为可用邮箱地址 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为可用邮箱地址" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L651-L656
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/CookieHelper.java
CookieHelper.addCookiesToResponse
public static void addCookiesToResponse(List<Cookie> cookieList, HttpServletResponse resp) { Iterator<Cookie> iterator = cookieList.listIterator(); while (iterator.hasNext()) { Cookie cookie = iterator.next(); if (cookie != null) { resp.addCookie(cookie); } } }
java
public static void addCookiesToResponse(List<Cookie> cookieList, HttpServletResponse resp) { Iterator<Cookie> iterator = cookieList.listIterator(); while (iterator.hasNext()) { Cookie cookie = iterator.next(); if (cookie != null) { resp.addCookie(cookie); } } }
[ "public", "static", "void", "addCookiesToResponse", "(", "List", "<", "Cookie", ">", "cookieList", ",", "HttpServletResponse", "resp", ")", "{", "Iterator", "<", "Cookie", ">", "iterator", "=", "cookieList", ".", "listIterator", "(", ")", ";", "while", "(", ...
Given a list of Cookie objects, set them into the HttpServletResponse. This method does not alter the cookies in any way. @param cookieList A List of Cookie objects @param resp HttpServletResponse into which to set the cookie
[ "Given", "a", "list", "of", "Cookie", "objects", "set", "them", "into", "the", "HttpServletResponse", ".", "This", "method", "does", "not", "alter", "the", "cookies", "in", "any", "way", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/CookieHelper.java#L90-L98
momokan/LWJGFont
src/main/java/net/chocolapod/lwjgfont/LWJGFont.java
LWJGFont.drawString
public final void drawString(String text, float dstX, float dstY, float dstZ) throws IOException { DrawPoint drawPoint = new DrawPoint(dstX, dstY, dstZ); MappedCharacter character; if (!LwjgFontUtil.isEmpty(text)) { for (int i = 0; i < text.length(); i++) { char ch = text.charAt(i); if (ch == LineFeed.getCharacter()) { // LF は改行扱いにする drawPoint.dstX = dstX; drawPoint.dstY -= getLineHeight(); continue; } else if (ch == CarriageReturn.getCharacter()) { // CR は無視する continue; } character = retreiveCharacter(ch); drawCharacter(drawPoint, character); } } }
java
public final void drawString(String text, float dstX, float dstY, float dstZ) throws IOException { DrawPoint drawPoint = new DrawPoint(dstX, dstY, dstZ); MappedCharacter character; if (!LwjgFontUtil.isEmpty(text)) { for (int i = 0; i < text.length(); i++) { char ch = text.charAt(i); if (ch == LineFeed.getCharacter()) { // LF は改行扱いにする drawPoint.dstX = dstX; drawPoint.dstY -= getLineHeight(); continue; } else if (ch == CarriageReturn.getCharacter()) { // CR は無視する continue; } character = retreiveCharacter(ch); drawCharacter(drawPoint, character); } } }
[ "public", "final", "void", "drawString", "(", "String", "text", ",", "float", "dstX", ",", "float", "dstY", ",", "float", "dstZ", ")", "throws", "IOException", "{", "DrawPoint", "drawPoint", "=", "new", "DrawPoint", "(", "dstX", ",", "dstY", ",", "dstZ", ...
Draws the text given by the specified string, using this font instance's current color.<br> Note that the specified destination coordinates is a left point of the rendered string's baseline. @param text the string to be drawn. @param dstX the x coordinate to render the string. @param dstY the y coordinate to render the string. @param dstZ the z coordinate to render the string. @throws IOException Indicates a failure to read font images as textures.
[ "Draws", "the", "text", "given", "by", "the", "specified", "string", "using", "this", "font", "instance", "s", "current", "color", ".", "<br", ">", "Note", "that", "the", "specified", "destination", "coordinates", "is", "a", "left", "point", "of", "the", "...
train
https://github.com/momokan/LWJGFont/blob/f2d6138b73d84a7e2c1271bae25b4c76488d9ec2/src/main/java/net/chocolapod/lwjgfont/LWJGFont.java#L103-L125
google/gwtmockito
gwtmockito/src/main/java/com/google/gwtmockito/impl/StubGenerator.java
StubGenerator.shouldStub
public static boolean shouldStub(CtMethod method, Collection<Class<?>> classesToStub) { // Stub any methods for which we have given explicit implementations if (STUB_METHODS.containsKey(new ClassAndMethod( method.getDeclaringClass().getName(), method.getName()))) { return true; } // Stub all non-abstract methods of classes for which stubbing has been requested for (Class<?> clazz : classesToStub) { if (declaringClassIs(method, clazz) && (method.getModifiers() & Modifier.ABSTRACT) == 0) { return true; } } // Stub all native methods if ((method.getModifiers() & Modifier.NATIVE) != 0) { return true; } return false; }
java
public static boolean shouldStub(CtMethod method, Collection<Class<?>> classesToStub) { // Stub any methods for which we have given explicit implementations if (STUB_METHODS.containsKey(new ClassAndMethod( method.getDeclaringClass().getName(), method.getName()))) { return true; } // Stub all non-abstract methods of classes for which stubbing has been requested for (Class<?> clazz : classesToStub) { if (declaringClassIs(method, clazz) && (method.getModifiers() & Modifier.ABSTRACT) == 0) { return true; } } // Stub all native methods if ((method.getModifiers() & Modifier.NATIVE) != 0) { return true; } return false; }
[ "public", "static", "boolean", "shouldStub", "(", "CtMethod", "method", ",", "Collection", "<", "Class", "<", "?", ">", ">", "classesToStub", ")", "{", "// Stub any methods for which we have given explicit implementations", "if", "(", "STUB_METHODS", ".", "containsKey",...
Returns whether the behavior of the given method should be replaced.
[ "Returns", "whether", "the", "behavior", "of", "the", "given", "method", "should", "be", "replaced", "." ]
train
https://github.com/google/gwtmockito/blob/e886a9b9d290169b5f83582dd89b7545c5f198a2/gwtmockito/src/main/java/com/google/gwtmockito/impl/StubGenerator.java#L76-L96
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java
JBBPUtils.splitString
public static String[] splitString(final String str, final char splitChar) { final int length = str.length(); final StringBuilder bulder = new StringBuilder(Math.max(8, length)); int counter = 1; for (int i = 0; i < length; i++) { if (str.charAt(i) == splitChar) { counter++; } } final String[] result = new String[counter]; int position = 0; for (int i = 0; i < length; i++) { final char chr = str.charAt(i); if (chr == splitChar) { result[position++] = bulder.toString(); bulder.setLength(0); } else { bulder.append(chr); } } if (position < result.length) { result[position] = bulder.toString(); } return result; }
java
public static String[] splitString(final String str, final char splitChar) { final int length = str.length(); final StringBuilder bulder = new StringBuilder(Math.max(8, length)); int counter = 1; for (int i = 0; i < length; i++) { if (str.charAt(i) == splitChar) { counter++; } } final String[] result = new String[counter]; int position = 0; for (int i = 0; i < length; i++) { final char chr = str.charAt(i); if (chr == splitChar) { result[position++] = bulder.toString(); bulder.setLength(0); } else { bulder.append(chr); } } if (position < result.length) { result[position] = bulder.toString(); } return result; }
[ "public", "static", "String", "[", "]", "splitString", "(", "final", "String", "str", ",", "final", "char", "splitChar", ")", "{", "final", "int", "length", "=", "str", ".", "length", "(", ")", ";", "final", "StringBuilder", "bulder", "=", "new", "String...
Split a string for a char used as the delimeter. @param str a string to be split @param splitChar a char to be used as delimeter @return array contains split string parts without delimeter chars
[ "Split", "a", "string", "for", "a", "char", "used", "as", "the", "delimeter", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L441-L469
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/Marshaller.java
Marshaller.createCompleteKey
private void createCompleteKey(Key parent, long id) { String kind = entityMetadata.getKind(); if (parent == null) { key = entityManager.newNativeKeyFactory().setKind(kind).newKey(id); } else { key = Key.newBuilder(parent, kind, id).build(); } }
java
private void createCompleteKey(Key parent, long id) { String kind = entityMetadata.getKind(); if (parent == null) { key = entityManager.newNativeKeyFactory().setKind(kind).newKey(id); } else { key = Key.newBuilder(parent, kind, id).build(); } }
[ "private", "void", "createCompleteKey", "(", "Key", "parent", ",", "long", "id", ")", "{", "String", "kind", "=", "entityMetadata", ".", "getKind", "(", ")", ";", "if", "(", "parent", "==", "null", ")", "{", "key", "=", "entityManager", ".", "newNativeKe...
Creates a complete key using the given parameters. @param parent the parent key, may be <code>null</code>. @param id the numeric ID
[ "Creates", "a", "complete", "key", "using", "the", "given", "parameters", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L349-L356
apollographql/apollo-android
apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java
ResponseField.forString
public static ResponseField forString(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.STRING, responseName, fieldName, arguments, optional, conditions); }
java
public static ResponseField forString(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.STRING, responseName, fieldName, arguments, optional, conditions); }
[ "public", "static", "ResponseField", "forString", "(", "String", "responseName", ",", "String", "fieldName", ",", "Map", "<", "String", ",", "Object", ">", "arguments", ",", "boolean", "optional", ",", "List", "<", "Condition", ">", "conditions", ")", "{", "...
Factory method for creating a Field instance representing {@link Type#STRING}. @param responseName alias for the result of a field @param fieldName name of the field in the GraphQL operation @param arguments arguments to be passed along with the field @param optional whether the arguments passed along are optional or required @param conditions list of conditions for this field @return Field instance representing {@link Type#STRING}
[ "Factory", "method", "for", "creating", "a", "Field", "instance", "representing", "{", "@link", "Type#STRING", "}", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L40-L43
eclipse/xtext-extras
org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java
SignatureUtil.scanIdentifier
private static int scanIdentifier(String string, int start) { // need a minimum 1 char if (start >= string.length()) { throw new IllegalArgumentException(); } int p = start; while (true) { char c = string.charAt(p); if (c == '<' || c == '>' || c == ':' || c == ';' || c == '.' || c == '/') { return p - 1; } p++; if (p == string.length()) { return p - 1; } } }
java
private static int scanIdentifier(String string, int start) { // need a minimum 1 char if (start >= string.length()) { throw new IllegalArgumentException(); } int p = start; while (true) { char c = string.charAt(p); if (c == '<' || c == '>' || c == ':' || c == ';' || c == '.' || c == '/') { return p - 1; } p++; if (p == string.length()) { return p - 1; } } }
[ "private", "static", "int", "scanIdentifier", "(", "String", "string", ",", "int", "start", ")", "{", "// need a minimum 1 char", "if", "(", "start", ">=", "string", ".", "length", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";"...
Scans the given string for an identifier starting at the given index and returns the index of the last character. Stop characters are: ";", ":", "&lt;", "&gt;", "/", ".". @param string the signature string @param start the 0-based character index of the first character @return the 0-based character index of the last character @exception IllegalArgumentException if this is not an identifier
[ "Scans", "the", "given", "string", "for", "an", "identifier", "starting", "at", "the", "given", "index", "and", "returns", "the", "index", "of", "the", "last", "character", ".", "Stop", "characters", "are", ":", ";", ":", "&lt", ";", "&gt", ";", "/", "...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java#L336-L352
jbehave/jbehave-core
jbehave-core/src/main/java/org/jbehave/core/io/StoryFinder.java
StoryFinder.findClassNames
public List<String> findClassNames(String searchIn, List<String> includes, List<String> excludes) { return classNames(normalise(sort(scan(searchIn, includes, excludes)))); }
java
public List<String> findClassNames(String searchIn, List<String> includes, List<String> excludes) { return classNames(normalise(sort(scan(searchIn, includes, excludes)))); }
[ "public", "List", "<", "String", ">", "findClassNames", "(", "String", "searchIn", ",", "List", "<", "String", ">", "includes", ",", "List", "<", "String", ">", "excludes", ")", "{", "return", "classNames", "(", "normalise", "(", "sort", "(", "scan", "("...
Finds Java classes from a source path, allowing for includes/excludes, and converts them to class names. @param searchIn the path to search in @param includes the List of include patterns, or <code>null</code> if none @param excludes the List of exclude patterns, or <code>null</code> if none @return A List of class names found
[ "Finds", "Java", "classes", "from", "a", "source", "path", "allowing", "for", "includes", "/", "excludes", "and", "converts", "them", "to", "class", "names", "." ]
train
https://github.com/jbehave/jbehave-core/blob/bdd6a6199528df3c35087e72d4644870655b23e6/jbehave-core/src/main/java/org/jbehave/core/io/StoryFinder.java#L60-L62
apache/flink
flink-connectors/flink-orc/src/main/java/org/apache/flink/orc/OrcBatchReader.java
OrcBatchReader.fillRows
static int fillRows(Row[] rows, TypeDescription schema, VectorizedRowBatch batch, int[] selectedFields) { int rowsToRead = Math.min((int) batch.count(), rows.length); List<TypeDescription> fieldTypes = schema.getChildren(); // read each selected field for (int fieldIdx = 0; fieldIdx < selectedFields.length; fieldIdx++) { int orcIdx = selectedFields[fieldIdx]; readField(rows, fieldIdx, fieldTypes.get(orcIdx), batch.cols[orcIdx], rowsToRead); } return rowsToRead; }
java
static int fillRows(Row[] rows, TypeDescription schema, VectorizedRowBatch batch, int[] selectedFields) { int rowsToRead = Math.min((int) batch.count(), rows.length); List<TypeDescription> fieldTypes = schema.getChildren(); // read each selected field for (int fieldIdx = 0; fieldIdx < selectedFields.length; fieldIdx++) { int orcIdx = selectedFields[fieldIdx]; readField(rows, fieldIdx, fieldTypes.get(orcIdx), batch.cols[orcIdx], rowsToRead); } return rowsToRead; }
[ "static", "int", "fillRows", "(", "Row", "[", "]", "rows", ",", "TypeDescription", "schema", ",", "VectorizedRowBatch", "batch", ",", "int", "[", "]", "selectedFields", ")", "{", "int", "rowsToRead", "=", "Math", ".", "min", "(", "(", "int", ")", "batch"...
Fills an ORC batch into an array of Row. @param rows The batch of rows need to be filled. @param schema The schema of the ORC data. @param batch The ORC data. @param selectedFields The list of selected ORC fields. @return The number of rows that were filled.
[ "Fills", "an", "ORC", "batch", "into", "an", "array", "of", "Row", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-orc/src/main/java/org/apache/flink/orc/OrcBatchReader.java#L135-L146
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/URIBuilder.java
URIBuilder.build
public URI build() { try { return new URI((isView ? VIEW_SCHEME : DATASET_SCHEME) + ":" + pattern.construct(options).toString()); } catch (URISyntaxException e) { throw new IllegalArgumentException("Could not build URI", e); } }
java
public URI build() { try { return new URI((isView ? VIEW_SCHEME : DATASET_SCHEME) + ":" + pattern.construct(options).toString()); } catch (URISyntaxException e) { throw new IllegalArgumentException("Could not build URI", e); } }
[ "public", "URI", "build", "(", ")", "{", "try", "{", "return", "new", "URI", "(", "(", "isView", "?", "VIEW_SCHEME", ":", "DATASET_SCHEME", ")", "+", "\":\"", "+", "pattern", ".", "construct", "(", "options", ")", ".", "toString", "(", ")", ")", ";",...
Returns a dataset or view URI encompassing the given constraints. The referenced {@link Dataset} or {@link View} may be loaded again with {@link Datasets#load(URI, Class)}. @return a dataset or view URI @since 0.17.0
[ "Returns", "a", "dataset", "or", "view", "URI", "encompassing", "the", "given", "constraints", ".", "The", "referenced", "{", "@link", "Dataset", "}", "or", "{", "@link", "View", "}", "may", "be", "loaded", "again", "with", "{", "@link", "Datasets#load", "...
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/URIBuilder.java#L212-L219
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriter.java
XMLWriter.getNodeAsString
@Nullable public static String getNodeAsString (@Nonnull final Node aNode) { return getNodeAsString (aNode, XMLWriterSettings.DEFAULT_XML_SETTINGS); }
java
@Nullable public static String getNodeAsString (@Nonnull final Node aNode) { return getNodeAsString (aNode, XMLWriterSettings.DEFAULT_XML_SETTINGS); }
[ "@", "Nullable", "public", "static", "String", "getNodeAsString", "(", "@", "Nonnull", "final", "Node", "aNode", ")", "{", "return", "getNodeAsString", "(", "aNode", ",", "XMLWriterSettings", ".", "DEFAULT_XML_SETTINGS", ")", ";", "}" ]
Convert the passed DOM node to an XML string using {@link XMLWriterSettings#DEFAULT_XML_SETTINGS}. This is a specialized version of {@link #getNodeAsString(Node, IXMLWriterSettings)}. @param aNode The node to be converted to a string. May not be <code>null</code> . @return The string representation of the passed node. @since 8.6.3
[ "Convert", "the", "passed", "DOM", "node", "to", "an", "XML", "string", "using", "{", "@link", "XMLWriterSettings#DEFAULT_XML_SETTINGS", "}", ".", "This", "is", "a", "specialized", "version", "of", "{", "@link", "#getNodeAsString", "(", "Node", "IXMLWriterSettings...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriter.java#L232-L236
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/Minutes.java
Minutes.ofHours
public static Minutes ofHours(int hours) { if (hours == 0) { return ZERO; } return new Minutes(Math.multiplyExact(hours, MINUTES_PER_HOUR)); }
java
public static Minutes ofHours(int hours) { if (hours == 0) { return ZERO; } return new Minutes(Math.multiplyExact(hours, MINUTES_PER_HOUR)); }
[ "public", "static", "Minutes", "ofHours", "(", "int", "hours", ")", "{", "if", "(", "hours", "==", "0", ")", "{", "return", "ZERO", ";", "}", "return", "new", "Minutes", "(", "Math", ".", "multiplyExact", "(", "hours", ",", "MINUTES_PER_HOUR", ")", ")"...
Obtains a {@code Minutes} representing the number of minutes equivalent to a number of hours. <p> The resulting amount will be minute-based, with the number of minutes equal to the number of hours multiplied by 60. @param hours the number of hours, positive or negative @return the amount with the input hours converted to minutes, not null @throws ArithmeticException if numeric overflow occurs
[ "Obtains", "a", "{", "@code", "Minutes", "}", "representing", "the", "number", "of", "minutes", "equivalent", "to", "a", "number", "of", "hours", ".", "<p", ">", "The", "resulting", "amount", "will", "be", "minute", "-", "based", "with", "the", "number", ...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/Minutes.java#L131-L136
TakahikoKawasaki/nv-websocket-client
src/main/java/com/neovisionaries/ws/client/WebSocket.java
WebSocket.setUserInfo
public WebSocket setUserInfo(String id, String password) { mHandshakeBuilder.setUserInfo(id, password); return this; }
java
public WebSocket setUserInfo(String id, String password) { mHandshakeBuilder.setUserInfo(id, password); return this; }
[ "public", "WebSocket", "setUserInfo", "(", "String", "id", ",", "String", "password", ")", "{", "mHandshakeBuilder", ".", "setUserInfo", "(", "id", ",", "password", ")", ";", "return", "this", ";", "}" ]
Set the credentials to connect to the WebSocket endpoint. @param id The ID. @param password The password. @return {@code this} object.
[ "Set", "the", "credentials", "to", "connect", "to", "the", "WebSocket", "endpoint", "." ]
train
https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/WebSocket.java#L1540-L1545
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java
RunsInner.listAsync
public Observable<Page<RunInner>> listAsync(final String resourceGroupName, final String registryName) { return listWithServiceResponseAsync(resourceGroupName, registryName) .map(new Func1<ServiceResponse<Page<RunInner>>, Page<RunInner>>() { @Override public Page<RunInner> call(ServiceResponse<Page<RunInner>> response) { return response.body(); } }); }
java
public Observable<Page<RunInner>> listAsync(final String resourceGroupName, final String registryName) { return listWithServiceResponseAsync(resourceGroupName, registryName) .map(new Func1<ServiceResponse<Page<RunInner>>, Page<RunInner>>() { @Override public Page<RunInner> call(ServiceResponse<Page<RunInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "RunInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "registryName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ")", ...
Gets all the runs for a registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;RunInner&gt; object
[ "Gets", "all", "the", "runs", "for", "a", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java#L147-L155
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java
BranchDao.updateManualBaseline
public int updateManualBaseline(DbSession dbSession, String uuid, @Nullable String analysisUuid) { long now = system2.now(); return mapper(dbSession).updateManualBaseline(uuid, analysisUuid == null || analysisUuid.isEmpty() ? null : analysisUuid, now); }
java
public int updateManualBaseline(DbSession dbSession, String uuid, @Nullable String analysisUuid) { long now = system2.now(); return mapper(dbSession).updateManualBaseline(uuid, analysisUuid == null || analysisUuid.isEmpty() ? null : analysisUuid, now); }
[ "public", "int", "updateManualBaseline", "(", "DbSession", "dbSession", ",", "String", "uuid", ",", "@", "Nullable", "String", "analysisUuid", ")", "{", "long", "now", "=", "system2", ".", "now", "(", ")", ";", "return", "mapper", "(", "dbSession", ")", "....
Set or unset the uuid of the manual baseline analysis by updating the manual_baseline_analysis_uuid column, if: - the specified uuid exists - and the specified uuid corresponds to a long-living branch (including the main branch) @return the number of rows that were updated
[ "Set", "or", "unset", "the", "uuid", "of", "the", "manual", "baseline", "analysis", "by", "updating", "the", "manual_baseline_analysis_uuid", "column", "if", ":" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java#L75-L78
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java
ServiceEndpointPoliciesInner.updateAsync
public Observable<ServiceEndpointPolicyInner> updateAsync(String resourceGroupName, String serviceEndpointPolicyName) { return updateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName).map(new Func1<ServiceResponse<ServiceEndpointPolicyInner>, ServiceEndpointPolicyInner>() { @Override public ServiceEndpointPolicyInner call(ServiceResponse<ServiceEndpointPolicyInner> response) { return response.body(); } }); }
java
public Observable<ServiceEndpointPolicyInner> updateAsync(String resourceGroupName, String serviceEndpointPolicyName) { return updateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName).map(new Func1<ServiceResponse<ServiceEndpointPolicyInner>, ServiceEndpointPolicyInner>() { @Override public ServiceEndpointPolicyInner call(ServiceResponse<ServiceEndpointPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServiceEndpointPolicyInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "serviceEndpointPolicyName", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serviceEndpointPolicyName", ")"...
Updates service Endpoint Policies. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "service", "Endpoint", "Policies", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java#L636-L643
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/tracking/ExamplePointFeatureTracker.java
ExamplePointFeatureTracker.updateGUI
private void updateGUI(SimpleImageSequence<T> sequence) { BufferedImage orig = sequence.getGuiImage(); Graphics2D g2 = orig.createGraphics(); // draw tracks with semi-unique colors so you can track individual points with your eyes for( PointTrack p : tracker.getActiveTracks(null) ) { int red = (int)(2.5*(p.featureId%100)); int green = (int)((255.0/150.0)*(p.featureId%150)); int blue = (int)(p.featureId%255); VisualizeFeatures.drawPoint(g2, (int)p.x, (int)p.y, new Color(red,green,blue)); } // draw tracks which have just been spawned green for( PointTrack p : tracker.getNewTracks(null) ) { VisualizeFeatures.drawPoint(g2, (int)p.x, (int)p.y, Color.green); } // tell the GUI to update gui.setImage(orig); gui.repaint(); }
java
private void updateGUI(SimpleImageSequence<T> sequence) { BufferedImage orig = sequence.getGuiImage(); Graphics2D g2 = orig.createGraphics(); // draw tracks with semi-unique colors so you can track individual points with your eyes for( PointTrack p : tracker.getActiveTracks(null) ) { int red = (int)(2.5*(p.featureId%100)); int green = (int)((255.0/150.0)*(p.featureId%150)); int blue = (int)(p.featureId%255); VisualizeFeatures.drawPoint(g2, (int)p.x, (int)p.y, new Color(red,green,blue)); } // draw tracks which have just been spawned green for( PointTrack p : tracker.getNewTracks(null) ) { VisualizeFeatures.drawPoint(g2, (int)p.x, (int)p.y, Color.green); } // tell the GUI to update gui.setImage(orig); gui.repaint(); }
[ "private", "void", "updateGUI", "(", "SimpleImageSequence", "<", "T", ">", "sequence", ")", "{", "BufferedImage", "orig", "=", "sequence", ".", "getGuiImage", "(", ")", ";", "Graphics2D", "g2", "=", "orig", ".", "createGraphics", "(", ")", ";", "// draw trac...
Draw tracked features in blue, or red if they were just spawned.
[ "Draw", "tracked", "features", "in", "blue", "or", "red", "if", "they", "were", "just", "spawned", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/tracking/ExamplePointFeatureTracker.java#L107-L127
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
@SuppressWarnings("unchecked") public static List<Boolean> getAt(boolean[] array, ObjectRange range) { return primitiveArrayGet(array, range); }
java
@SuppressWarnings("unchecked") public static List<Boolean> getAt(boolean[] array, ObjectRange range) { return primitiveArrayGet(array, range); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "Boolean", ">", "getAt", "(", "boolean", "[", "]", "array", ",", "ObjectRange", "range", ")", "{", "return", "primitiveArrayGet", "(", "array", ",", "range", ")", ";", "}"...
Support the subscript operator with an ObjectRange for a byte array @param array a byte array @param range an ObjectRange indicating the indices for the items to retrieve @return list of the retrieved bytes @since 1.0
[ "Support", "the", "subscript", "operator", "with", "an", "ObjectRange", "for", "a", "byte", "array" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13925-L13928
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/optheader/OptionalHeader.java
OptionalHeader.newInstance
public static OptionalHeader newInstance(byte[] headerbytes, long offset) throws IOException { OptionalHeader header = new OptionalHeader(headerbytes, offset); header.read(); return header; }
java
public static OptionalHeader newInstance(byte[] headerbytes, long offset) throws IOException { OptionalHeader header = new OptionalHeader(headerbytes, offset); header.read(); return header; }
[ "public", "static", "OptionalHeader", "newInstance", "(", "byte", "[", "]", "headerbytes", ",", "long", "offset", ")", "throws", "IOException", "{", "OptionalHeader", "header", "=", "new", "OptionalHeader", "(", "headerbytes", ",", "offset", ")", ";", "header", ...
Creates and returns a new instance of the optional header. @param headerbytes the bytes that make up the optional header @param offset the file offset to the beginning of the optional header @return instance of the optional header @throws IOException if headerbytes can not be read
[ "Creates", "and", "returns", "a", "new", "instance", "of", "the", "optional", "header", "." ]
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/optheader/OptionalHeader.java#L177-L182
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getRolesBatch
public OneLoginResponse<Role> getRolesBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getRolesBatch(batchSize, null); }
java
public OneLoginResponse<Role> getRolesBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getRolesBatch(batchSize, null); }
[ "public", "OneLoginResponse", "<", "Role", ">", "getRolesBatch", "(", "int", "batchSize", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "return", "getRolesBatch", "(", "batchSize", ",", "null", ")", ";", "}" ]
Get a batch of Roles. @param batchSize Size of the Batch @return OneLoginResponse of Role (Batch) @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.Role @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/roles/get-roles">Get Roles documentation</a>
[ "Get", "a", "batch", "of", "Roles", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L1739-L1741
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java
SeaGlassGraphicsUtils.paintText
public void paintText(SynthContext ss, Graphics g, String text, int x, int y, int mnemonicIndex) { if (text != null) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); JComponent c = ss.getComponent(); // SynthStyle style = ss.getStyle(); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g2d); y += fm.getAscent(); SwingUtilities2.drawString(c, g2d, text, x, y); if (mnemonicIndex >= 0 && mnemonicIndex < text.length()) { int underlineX = x + SwingUtilities2.stringWidth(c, fm, text.substring(0, mnemonicIndex)); int underlineY = y; int underlineWidth = fm.charWidth(text.charAt(mnemonicIndex)); int underlineHeight = 1; g2d.fillRect(underlineX, underlineY + fm.getDescent() - 1, underlineWidth, underlineHeight); } } }
java
public void paintText(SynthContext ss, Graphics g, String text, int x, int y, int mnemonicIndex) { if (text != null) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); JComponent c = ss.getComponent(); // SynthStyle style = ss.getStyle(); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g2d); y += fm.getAscent(); SwingUtilities2.drawString(c, g2d, text, x, y); if (mnemonicIndex >= 0 && mnemonicIndex < text.length()) { int underlineX = x + SwingUtilities2.stringWidth(c, fm, text.substring(0, mnemonicIndex)); int underlineY = y; int underlineWidth = fm.charWidth(text.charAt(mnemonicIndex)); int underlineHeight = 1; g2d.fillRect(underlineX, underlineY + fm.getDescent() - 1, underlineWidth, underlineHeight); } } }
[ "public", "void", "paintText", "(", "SynthContext", "ss", ",", "Graphics", "g", ",", "String", "text", ",", "int", "x", ",", "int", "y", ",", "int", "mnemonicIndex", ")", "{", "if", "(", "text", "!=", "null", ")", "{", "Graphics2D", "g2d", "=", "(", ...
Paints text at the specified location. This will not attempt to render the text as html nor will it offset by the insets of the component. @param ss SynthContext @param g Graphics used to render string in. @param text Text to render @param x X location to draw text at. @param y Upper left corner to draw text at. @param mnemonicIndex Index to draw string at.
[ "Paints", "text", "at", "the", "specified", "location", ".", "This", "will", "not", "attempt", "to", "render", "the", "text", "as", "html", "nor", "will", "it", "offset", "by", "the", "insets", "of", "the", "component", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java#L211-L233
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java
AbstractAggregatorImpl.exceptionResponse
protected void exceptionResponse(HttpServletRequest req, HttpServletResponse resp, Throwable t, int status) { final String sourceMethod = "exceptionResponse"; //$NON-NLS-1$ resp.addHeader("Cache-control", "no-store"); //$NON-NLS-1$ //$NON-NLS-2$ Level logLevel = (t instanceof BadRequestException || t instanceof NotFoundException) ? Level.WARNING : Level.SEVERE; logException(req, logLevel, sourceMethod, t); if (getOptions().isDevelopmentMode() || getOptions().isDebugMode()) { // In development mode, display server exceptions on the browser console String msg = StringUtil.escapeForJavaScript( MessageFormat.format( Messages.ExceptionResponse, new Object[]{ t.getClass().getName(), t.getMessage() != null ? StringUtil.escapeForJavaScript(t.getMessage()) : "" //$NON-NLS-1$ } ) ); String content = "console.error('" + msg + "');"; //$NON-NLS-1$ //$NON-NLS-2$ try { CopyUtil.copy(new StringReader(content), resp.getOutputStream()); } catch (IOException e1) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e1.getMessage(), e1); } resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } else { resp.setStatus(status); } }
java
protected void exceptionResponse(HttpServletRequest req, HttpServletResponse resp, Throwable t, int status) { final String sourceMethod = "exceptionResponse"; //$NON-NLS-1$ resp.addHeader("Cache-control", "no-store"); //$NON-NLS-1$ //$NON-NLS-2$ Level logLevel = (t instanceof BadRequestException || t instanceof NotFoundException) ? Level.WARNING : Level.SEVERE; logException(req, logLevel, sourceMethod, t); if (getOptions().isDevelopmentMode() || getOptions().isDebugMode()) { // In development mode, display server exceptions on the browser console String msg = StringUtil.escapeForJavaScript( MessageFormat.format( Messages.ExceptionResponse, new Object[]{ t.getClass().getName(), t.getMessage() != null ? StringUtil.escapeForJavaScript(t.getMessage()) : "" //$NON-NLS-1$ } ) ); String content = "console.error('" + msg + "');"; //$NON-NLS-1$ //$NON-NLS-2$ try { CopyUtil.copy(new StringReader(content), resp.getOutputStream()); } catch (IOException e1) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e1.getMessage(), e1); } resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } else { resp.setStatus(status); } }
[ "protected", "void", "exceptionResponse", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ",", "Throwable", "t", ",", "int", "status", ")", "{", "final", "String", "sourceMethod", "=", "\"exceptionResponse\"", ";", "//$NON-NLS-1$\r", "resp", "....
Sets response status and headers for an error response based on the information in the specified exception. If development mode is enabled, then returns a 200 status with a console.error() message specifying the exception message @param req the request object @param resp The response object @param t The exception object @param status The response status
[ "Sets", "response", "status", "and", "headers", "for", "an", "error", "response", "based", "on", "the", "information", "in", "the", "specified", "exception", ".", "If", "development", "mode", "is", "enabled", "then", "returns", "a", "200", "status", "with", ...
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java#L997-L1026
tvesalainen/util
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
RPMBuilder.addFile
@Override public FileBuilder addFile(ByteBuffer content, Path target) throws IOException { checkTarget(target); FileBuilder fb = new FileBuilder(); fb.content = content; fb.target = target; fb.size = content.limit(); fb.compressFilename(); fileBuilders.add(fb); return fb; }
java
@Override public FileBuilder addFile(ByteBuffer content, Path target) throws IOException { checkTarget(target); FileBuilder fb = new FileBuilder(); fb.content = content; fb.target = target; fb.size = content.limit(); fb.compressFilename(); fileBuilders.add(fb); return fb; }
[ "@", "Override", "public", "FileBuilder", "addFile", "(", "ByteBuffer", "content", ",", "Path", "target", ")", "throws", "IOException", "{", "checkTarget", "(", "target", ")", ";", "FileBuilder", "fb", "=", "new", "FileBuilder", "(", ")", ";", "fb", ".", "...
Add file to package from content @param content @param target Target path like /opt/application/bin/foo @return @throws IOException
[ "Add", "file", "to", "package", "from", "content" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L364-L375
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/implementation/util/TypeUtil.java
TypeUtil.isTypeOrSubTypeOf
public static boolean isTypeOrSubTypeOf(Type subType, Type superType) { Class<?> sub = getRawClass(subType); Class<?> sup = getRawClass(superType); return sup.isAssignableFrom(sub); }
java
public static boolean isTypeOrSubTypeOf(Type subType, Type superType) { Class<?> sub = getRawClass(subType); Class<?> sup = getRawClass(superType); return sup.isAssignableFrom(sub); }
[ "public", "static", "boolean", "isTypeOrSubTypeOf", "(", "Type", "subType", ",", "Type", "superType", ")", "{", "Class", "<", "?", ">", "sub", "=", "getRawClass", "(", "subType", ")", ";", "Class", "<", "?", ">", "sup", "=", "getRawClass", "(", "superTyp...
Determines if a type is the same or a subtype for another type. @param subType the supposed sub type @param superType the supposed super type @return true if the first type is the same or a subtype for the second type
[ "Determines", "if", "a", "type", "is", "the", "same", "or", "a", "subtype", "for", "another", "type", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/util/TypeUtil.java#L140-L145
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationcertpolicy_binding.java
authenticationcertpolicy_binding.get
public static authenticationcertpolicy_binding get(nitro_service service, String name) throws Exception{ authenticationcertpolicy_binding obj = new authenticationcertpolicy_binding(); obj.set_name(name); authenticationcertpolicy_binding response = (authenticationcertpolicy_binding) obj.get_resource(service); return response; }
java
public static authenticationcertpolicy_binding get(nitro_service service, String name) throws Exception{ authenticationcertpolicy_binding obj = new authenticationcertpolicy_binding(); obj.set_name(name); authenticationcertpolicy_binding response = (authenticationcertpolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "authenticationcertpolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "authenticationcertpolicy_binding", "obj", "=", "new", "authenticationcertpolicy_binding", "(", ")", ";", "obj", ".", ...
Use this API to fetch authenticationcertpolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "authenticationcertpolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationcertpolicy_binding.java#L136-L141
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/core/AbstractDateFunction.java
AbstractDateFunction.getDateValueOffset
protected int getDateValueOffset(String offsetString, char c) { ArrayList<Character> charList = new ArrayList<Character>(); int index = offsetString.indexOf(c); if (index != -1) { for (int i = index-1; i >= 0; i--) { if (Character.isDigit(offsetString.charAt(i))) { charList.add(0, offsetString.charAt(i)); } else { StringBuffer offsetValue = new StringBuffer(); offsetValue.append("0"); for (int j = 0; j < charList.size(); j++) { offsetValue.append(charList.get(j)); } if (offsetString.charAt(i) == '-') { return Integer.valueOf("-" + offsetValue.toString()); } else { return Integer.valueOf(offsetValue.toString()); } } } } return 0; }
java
protected int getDateValueOffset(String offsetString, char c) { ArrayList<Character> charList = new ArrayList<Character>(); int index = offsetString.indexOf(c); if (index != -1) { for (int i = index-1; i >= 0; i--) { if (Character.isDigit(offsetString.charAt(i))) { charList.add(0, offsetString.charAt(i)); } else { StringBuffer offsetValue = new StringBuffer(); offsetValue.append("0"); for (int j = 0; j < charList.size(); j++) { offsetValue.append(charList.get(j)); } if (offsetString.charAt(i) == '-') { return Integer.valueOf("-" + offsetValue.toString()); } else { return Integer.valueOf(offsetValue.toString()); } } } } return 0; }
[ "protected", "int", "getDateValueOffset", "(", "String", "offsetString", ",", "char", "c", ")", "{", "ArrayList", "<", "Character", ">", "charList", "=", "new", "ArrayList", "<", "Character", ">", "(", ")", ";", "int", "index", "=", "offsetString", ".", "i...
Parse offset string and add or subtract date offset value. @param offsetString @param c @return
[ "Parse", "offset", "string", "and", "add", "or", "subtract", "date", "offset", "value", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/core/AbstractDateFunction.java#L56-L82
indeedeng/util
varexport/src/main/java/com/indeed/util/varexport/VarExporter.java
VarExporter.forNamespace
public static synchronized VarExporter forNamespace(@Nonnull final Class<?> clazz, final boolean declaredFieldsOnly) { return getInstance(clazz.getSimpleName(), clazz, declaredFieldsOnly); }
java
public static synchronized VarExporter forNamespace(@Nonnull final Class<?> clazz, final boolean declaredFieldsOnly) { return getInstance(clazz.getSimpleName(), clazz, declaredFieldsOnly); }
[ "public", "static", "synchronized", "VarExporter", "forNamespace", "(", "@", "Nonnull", "final", "Class", "<", "?", ">", "clazz", ",", "final", "boolean", "declaredFieldsOnly", ")", "{", "return", "getInstance", "(", "clazz", ".", "getSimpleName", "(", ")", ",...
Load an exporter with a specified class. @param clazz Class type from which variables will be exported. @param declaredFieldsOnly if true, will not export any variable belonging to superclasses of {@code clazz}. @return exporter for the given class will be created if never before accessed.
[ "Load", "an", "exporter", "with", "a", "specified", "class", "." ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/varexport/src/main/java/com/indeed/util/varexport/VarExporter.java#L88-L90
stackify/stackify-api-java
src/main/java/com/stackify/api/common/error/ErrorCounter.java
ErrorCounter.incrementCounter
public int incrementCounter(final StackifyError error, long epochMinute) { if (error == null) { throw new NullPointerException("StackifyError is null"); } ErrorItem baseError = getBaseError(error); String uniqueKey = getUniqueKey(baseError); // get the counter for this error int count = 0; if (errorCounter.containsKey(uniqueKey)) { // counter exists MinuteCounter counter = errorCounter.get(uniqueKey); if (counter.getEpochMinute() == epochMinute) { // counter exists for this current minute // increment the counter MinuteCounter incCounter = MinuteCounter.incrementCounter(counter); errorCounter.put(uniqueKey, incCounter); count = incCounter.getErrorCount(); } else { // counter did not exist for this minute // overwrite the entry with a new one MinuteCounter newCounter = MinuteCounter.newMinuteCounter(epochMinute); errorCounter.put(uniqueKey, newCounter); count = newCounter.getErrorCount(); } } else { // counter did not exist so create a new one MinuteCounter newCounter = MinuteCounter.newMinuteCounter(epochMinute); errorCounter.put(uniqueKey, newCounter); count = newCounter.getErrorCount(); } return count; }
java
public int incrementCounter(final StackifyError error, long epochMinute) { if (error == null) { throw new NullPointerException("StackifyError is null"); } ErrorItem baseError = getBaseError(error); String uniqueKey = getUniqueKey(baseError); // get the counter for this error int count = 0; if (errorCounter.containsKey(uniqueKey)) { // counter exists MinuteCounter counter = errorCounter.get(uniqueKey); if (counter.getEpochMinute() == epochMinute) { // counter exists for this current minute // increment the counter MinuteCounter incCounter = MinuteCounter.incrementCounter(counter); errorCounter.put(uniqueKey, incCounter); count = incCounter.getErrorCount(); } else { // counter did not exist for this minute // overwrite the entry with a new one MinuteCounter newCounter = MinuteCounter.newMinuteCounter(epochMinute); errorCounter.put(uniqueKey, newCounter); count = newCounter.getErrorCount(); } } else { // counter did not exist so create a new one MinuteCounter newCounter = MinuteCounter.newMinuteCounter(epochMinute); errorCounter.put(uniqueKey, newCounter); count = newCounter.getErrorCount(); } return count; }
[ "public", "int", "incrementCounter", "(", "final", "StackifyError", "error", ",", "long", "epochMinute", ")", "{", "if", "(", "error", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"StackifyError is null\"", ")", ";", "}", "ErrorItem", ...
Increments the counter for this error in the epoch minute specified @param error The error @param epochMinute The epoch minute @return The count for the error after it has been incremented
[ "Increments", "the", "counter", "for", "this", "error", "in", "the", "epoch", "minute", "specified" ]
train
https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/error/ErrorCounter.java#L135-L174
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java
EmulatedFields.get
public short get(String name, short defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, short.class); return slot.defaulted ? defaultValue : ((Short) slot.fieldValue).shortValue(); }
java
public short get(String name, short defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, short.class); return slot.defaulted ? defaultValue : ((Short) slot.fieldValue).shortValue(); }
[ "public", "short", "get", "(", "String", "name", ",", "short", "defaultValue", ")", "throws", "IllegalArgumentException", "{", "ObjectSlot", "slot", "=", "findMandatorySlot", "(", "name", ",", "short", ".", "class", ")", ";", "return", "slot", ".", "defaulted"...
Finds and returns the short value of a given field named {@code name} in the receiver. If the field has not been assigned any value yet, the default value {@code defaultValue} is returned instead. @param name the name of the field to find. @param defaultValue return value in case the field has not been assigned to yet. @return the value of the given field if it has been assigned, the default value otherwise. @throws IllegalArgumentException if the corresponding field can not be found.
[ "Finds", "and", "returns", "the", "short", "value", "of", "a", "given", "field", "named", "{", "@code", "name", "}", "in", "the", "receiver", ".", "If", "the", "field", "has", "not", "been", "assigned", "any", "value", "yet", "the", "default", "value", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L348-L351
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/SchemaConfiguration.java
SchemaConfiguration.getOrderByColumn
private String getOrderByColumn(String[] orderByColumns, Attribute column) { if (orderByColumns != null) { for (String orderColumn : orderByColumns) { String[] orderValue = orderColumn.split("\\s"); String orderColumnName = orderValue[0].substring(orderValue[0].lastIndexOf('.') + 1); String orderColumnValue = orderValue[1]; if (orderColumnName.equals(((AbstractAttribute) column).getName()) || orderColumnName.equals(((AbstractAttribute) column).getJPAColumnName())) { return orderColumnValue; } } } return null; }
java
private String getOrderByColumn(String[] orderByColumns, Attribute column) { if (orderByColumns != null) { for (String orderColumn : orderByColumns) { String[] orderValue = orderColumn.split("\\s"); String orderColumnName = orderValue[0].substring(orderValue[0].lastIndexOf('.') + 1); String orderColumnValue = orderValue[1]; if (orderColumnName.equals(((AbstractAttribute) column).getName()) || orderColumnName.equals(((AbstractAttribute) column).getJPAColumnName())) { return orderColumnValue; } } } return null; }
[ "private", "String", "getOrderByColumn", "(", "String", "[", "]", "orderByColumns", ",", "Attribute", "column", ")", "{", "if", "(", "orderByColumns", "!=", "null", ")", "{", "for", "(", "String", "orderColumn", ":", "orderByColumns", ")", "{", "String", "["...
getOrderByColumn method return order by value of the column @param String [] orderByColumns @param Attribute column @return orderColumnValue.
[ "getOrderByColumn", "method", "return", "order", "by", "value", "of", "the", "column" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/SchemaConfiguration.java#L654-L674
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.listRegionalBySubscriptionForTopicType
public List<EventSubscriptionInner> listRegionalBySubscriptionForTopicType(String location, String topicTypeName) { return listRegionalBySubscriptionForTopicTypeWithServiceResponseAsync(location, topicTypeName).toBlocking().single().body(); }
java
public List<EventSubscriptionInner> listRegionalBySubscriptionForTopicType(String location, String topicTypeName) { return listRegionalBySubscriptionForTopicTypeWithServiceResponseAsync(location, topicTypeName).toBlocking().single().body(); }
[ "public", "List", "<", "EventSubscriptionInner", ">", "listRegionalBySubscriptionForTopicType", "(", "String", "location", ",", "String", "topicTypeName", ")", "{", "return", "listRegionalBySubscriptionForTopicTypeWithServiceResponseAsync", "(", "location", ",", "topicTypeName"...
List all regional event subscriptions under an Azure subscription for a topic type. List all event subscriptions from the given location under a specific Azure subscription and topic type. @param location Name of the location @param topicTypeName Name of the topic type @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;EventSubscriptionInner&gt; object if successful.
[ "List", "all", "regional", "event", "subscriptions", "under", "an", "Azure", "subscription", "for", "a", "topic", "type", ".", "List", "all", "event", "subscriptions", "from", "the", "given", "location", "under", "a", "specific", "Azure", "subscription", "and", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L1367-L1369
dita-ot/dita-ot
src/main/java/org/dita/dost/writer/AbstractDitaMetaWriter.java
AbstractDitaMetaWriter.skipUnlockedNavtitle
boolean skipUnlockedNavtitle(final Element metadataContainer, final Element checkForNavtitle) { if (!TOPIC_TITLEALTS.matches(metadataContainer) || !TOPIC_NAVTITLE.matches(checkForNavtitle)) { return false; } else if (checkForNavtitle.getAttributeNodeNS(DITA_OT_NS, ATTRIBUTE_NAME_LOCKTITLE) == null) { return false; } else if (ATTRIBUTE_NAME_LOCKTITLE_VALUE_YES.matches(checkForNavtitle.getAttributeNodeNS(DITA_OT_NS, ATTRIBUTE_NAME_LOCKTITLE).getValue())) { return false; } return true; }
java
boolean skipUnlockedNavtitle(final Element metadataContainer, final Element checkForNavtitle) { if (!TOPIC_TITLEALTS.matches(metadataContainer) || !TOPIC_NAVTITLE.matches(checkForNavtitle)) { return false; } else if (checkForNavtitle.getAttributeNodeNS(DITA_OT_NS, ATTRIBUTE_NAME_LOCKTITLE) == null) { return false; } else if (ATTRIBUTE_NAME_LOCKTITLE_VALUE_YES.matches(checkForNavtitle.getAttributeNodeNS(DITA_OT_NS, ATTRIBUTE_NAME_LOCKTITLE).getValue())) { return false; } return true; }
[ "boolean", "skipUnlockedNavtitle", "(", "final", "Element", "metadataContainer", ",", "final", "Element", "checkForNavtitle", ")", "{", "if", "(", "!", "TOPIC_TITLEALTS", ".", "matches", "(", "metadataContainer", ")", "||", "!", "TOPIC_NAVTITLE", ".", "matches", "...
Check if an element is an unlocked navtitle, which should not be pushed into topics. @param metadataContainer container element @param checkForNavtitle title element
[ "Check", "if", "an", "element", "is", "an", "unlocked", "navtitle", "which", "should", "not", "be", "pushed", "into", "topics", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/AbstractDitaMetaWriter.java#L86-L96
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.getIconSrc
public static String getIconSrc(final FacesContext facesContext, final UIComponent component, final String attributeName) { // JSF 2.0: if "name" attribute is available, treat as a resource reference. final Map<String, Object> attributes = component.getAttributes(); final String resourceName = (String) attributes.get(JSFAttr.NAME_ATTR); if (resourceName != null && (resourceName.length() > 0)) { final ResourceHandler resourceHandler = facesContext .getApplication().getResourceHandler(); final Resource resource; final String libraryName = (String) component.getAttributes().get( JSFAttr.LIBRARY_ATTR); if ((libraryName != null) && (libraryName.length() > 0)) { resource = resourceHandler.createResource(resourceName, libraryName); } else { resource = resourceHandler.createResource(resourceName); } if (resource == null) { // If resourceName/libraryName are set but no resource created -> probably a typo, // show a message if (facesContext.isProjectStage(ProjectStage.Development)) { String summary = "Unable to find resource: " + resourceName; if (libraryName != null) { summary = summary + " from library: " + libraryName; } facesContext.addMessage( component.getClientId(facesContext), new FacesMessage(FacesMessage.SEVERITY_WARN, summary, summary)); } return RES_NOT_FOUND; } else { return resource.getRequestPath(); } } else { String value = (String) component.getAttributes() .get(attributeName); return toResourceUri(facesContext, value); } }
java
public static String getIconSrc(final FacesContext facesContext, final UIComponent component, final String attributeName) { // JSF 2.0: if "name" attribute is available, treat as a resource reference. final Map<String, Object> attributes = component.getAttributes(); final String resourceName = (String) attributes.get(JSFAttr.NAME_ATTR); if (resourceName != null && (resourceName.length() > 0)) { final ResourceHandler resourceHandler = facesContext .getApplication().getResourceHandler(); final Resource resource; final String libraryName = (String) component.getAttributes().get( JSFAttr.LIBRARY_ATTR); if ((libraryName != null) && (libraryName.length() > 0)) { resource = resourceHandler.createResource(resourceName, libraryName); } else { resource = resourceHandler.createResource(resourceName); } if (resource == null) { // If resourceName/libraryName are set but no resource created -> probably a typo, // show a message if (facesContext.isProjectStage(ProjectStage.Development)) { String summary = "Unable to find resource: " + resourceName; if (libraryName != null) { summary = summary + " from library: " + libraryName; } facesContext.addMessage( component.getClientId(facesContext), new FacesMessage(FacesMessage.SEVERITY_WARN, summary, summary)); } return RES_NOT_FOUND; } else { return resource.getRequestPath(); } } else { String value = (String) component.getAttributes() .get(attributeName); return toResourceUri(facesContext, value); } }
[ "public", "static", "String", "getIconSrc", "(", "final", "FacesContext", "facesContext", ",", "final", "UIComponent", "component", ",", "final", "String", "attributeName", ")", "{", "// JSF 2.0: if \"name\" attribute is available, treat as a resource reference.", "final", "M...
Checks for name/library attributes on component and if they are avaliable, creates {@link Resource} and returns it's path suitable for rendering. If component doesn't have name/library gets value for attribute named <code>attributeName</code> returns it processed with {@link CoreRenderer#toResourceUri(FacesContext, Object)} @param facesContext a {@link FacesContext} @param component a {@link UIComponent} @param attributeName name of attribute that represents "image", "icon", "source", ... @since 4.0.1
[ "Checks", "for", "name", "/", "library", "attributes", "on", "component", "and", "if", "they", "are", "avaliable", "creates", "{", "@link", "Resource", "}", "and", "returns", "it", "s", "path", "suitable", "for", "rendering", ".", "If", "component", "doesn",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L1510-L1566
windup/windup
config/api/src/main/java/org/jboss/windup/config/metadata/RuleProviderRegistry.java
RuleProviderRegistry.setRules
public void setRules(RuleProvider provider, List<Rule> rules) { providersToRules.put(provider, rules); }
java
public void setRules(RuleProvider provider, List<Rule> rules) { providersToRules.put(provider, rules); }
[ "public", "void", "setRules", "(", "RuleProvider", "provider", ",", "List", "<", "Rule", ">", "rules", ")", "{", "providersToRules", ".", "put", "(", "provider", ",", "rules", ")", ";", "}" ]
Sets the {@link List} of {@link Rule}s that were loaded from the given {@link RuleProvider}.
[ "Sets", "the", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/metadata/RuleProviderRegistry.java#L53-L56
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/aromaticity/Kekulization.java
Kekulization.kekulize
public static void kekulize(final IAtomContainer ac) throws CDKException { // storage of pairs of atoms that have pi-bonded final Matching matching = Matching.withCapacity(ac.getAtomCount()); // exract data structures for efficient access final IAtom[] atoms = AtomContainerManipulator.getAtomArray(ac); final EdgeToBondMap bonds = EdgeToBondMap.withSpaceFor(ac); final int[][] graph = GraphUtil.toAdjList(ac, bonds); // determine which atoms are available to have a pi bond placed final BitSet available = available(graph, atoms, bonds); // attempt to find a perfect matching such that a pi bond is placed // next to each available atom. if not found the solution is ambiguous if (!matching.perfect(graph, available)) throw new CDKException("Cannot assign Kekulé structure without randomly creating radicals."); // propegate bond order information from the matching for (final IBond bond : ac.bonds()) { if (bond.getOrder() == UNSET && bond.isAromatic()) bond.setOrder(SINGLE); } for (int v = available.nextSetBit(0); v >= 0; v = available.nextSetBit(v + 1)) { final int w = matching.other(v); final IBond bond = bonds.get(v, w); // sanity check, something wrong if this happens if (bond.getOrder().numeric() > 1) throw new CDKException( "Cannot assign Kekulé structure, non-sigma bond order has already been assigned?"); bond.setOrder(IBond.Order.DOUBLE); available.clear(w); } }
java
public static void kekulize(final IAtomContainer ac) throws CDKException { // storage of pairs of atoms that have pi-bonded final Matching matching = Matching.withCapacity(ac.getAtomCount()); // exract data structures for efficient access final IAtom[] atoms = AtomContainerManipulator.getAtomArray(ac); final EdgeToBondMap bonds = EdgeToBondMap.withSpaceFor(ac); final int[][] graph = GraphUtil.toAdjList(ac, bonds); // determine which atoms are available to have a pi bond placed final BitSet available = available(graph, atoms, bonds); // attempt to find a perfect matching such that a pi bond is placed // next to each available atom. if not found the solution is ambiguous if (!matching.perfect(graph, available)) throw new CDKException("Cannot assign Kekulé structure without randomly creating radicals."); // propegate bond order information from the matching for (final IBond bond : ac.bonds()) { if (bond.getOrder() == UNSET && bond.isAromatic()) bond.setOrder(SINGLE); } for (int v = available.nextSetBit(0); v >= 0; v = available.nextSetBit(v + 1)) { final int w = matching.other(v); final IBond bond = bonds.get(v, w); // sanity check, something wrong if this happens if (bond.getOrder().numeric() > 1) throw new CDKException( "Cannot assign Kekulé structure, non-sigma bond order has already been assigned?"); bond.setOrder(IBond.Order.DOUBLE); available.clear(w); } }
[ "public", "static", "void", "kekulize", "(", "final", "IAtomContainer", "ac", ")", "throws", "CDKException", "{", "// storage of pairs of atoms that have pi-bonded", "final", "Matching", "matching", "=", "Matching", ".", "withCapacity", "(", "ac", ".", "getAtomCount", ...
Assign a Kekulé representation to the aromatic systems of a compound. @param ac structural representation @throws CDKException a Kekulé form could not be assigned
[ "Assign", "a", "Kekulé", "representation", "to", "the", "aromatic", "systems", "of", "a", "compound", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/aromaticity/Kekulization.java#L85-L119
box/box-java-sdk
src/main/java/com/box/sdk/BoxFolder.java
BoxFolder.createWebLink
public BoxWebLink.Info createWebLink(String name, URL linkURL) { return this.createWebLink(name, linkURL, null); }
java
public BoxWebLink.Info createWebLink(String name, URL linkURL) { return this.createWebLink(name, linkURL, null); }
[ "public", "BoxWebLink", ".", "Info", "createWebLink", "(", "String", "name", ",", "URL", "linkURL", ")", "{", "return", "this", ".", "createWebLink", "(", "name", ",", "linkURL", ",", "null", ")", ";", "}" ]
Uploads a new weblink to this folder. @param name the filename for the weblink. @param linkURL the URL the weblink points to. @return the uploaded weblink's info.
[ "Uploads", "a", "new", "weblink", "to", "this", "folder", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L582-L585
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.replaceImpl
private void replaceImpl(final int startIndex, final int endIndex, final int removeLen, final String insertStr, final int insertLen) { final int newSize = size - removeLen + insertLen; if (insertLen != removeLen) { ensureCapacity(newSize); System.arraycopy(buffer, endIndex, buffer, startIndex + insertLen, size - endIndex); size = newSize; } if (insertLen > 0) { insertStr.getChars(0, insertLen, buffer, startIndex); } }
java
private void replaceImpl(final int startIndex, final int endIndex, final int removeLen, final String insertStr, final int insertLen) { final int newSize = size - removeLen + insertLen; if (insertLen != removeLen) { ensureCapacity(newSize); System.arraycopy(buffer, endIndex, buffer, startIndex + insertLen, size - endIndex); size = newSize; } if (insertLen > 0) { insertStr.getChars(0, insertLen, buffer, startIndex); } }
[ "private", "void", "replaceImpl", "(", "final", "int", "startIndex", ",", "final", "int", "endIndex", ",", "final", "int", "removeLen", ",", "final", "String", "insertStr", ",", "final", "int", "insertLen", ")", "{", "final", "int", "newSize", "=", "size", ...
Internal method to delete a range without validation. @param startIndex the start index, must be valid @param endIndex the end index (exclusive), must be valid @param removeLen the length to remove (endIndex - startIndex), must be valid @param insertStr the string to replace with, null means delete range @param insertLen the length of the insert string, must be valid @throws IndexOutOfBoundsException if any index is invalid
[ "Internal", "method", "to", "delete", "a", "range", "without", "validation", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1928-L1938
grycap/coreutils
coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/Http2Client.java
Http2Client.asyncGet
public void asyncGet(final String url, final boolean nocache, final Callback callback) { asyncGet(url, null, nocache, callback); }
java
public void asyncGet(final String url, final boolean nocache, final Callback callback) { asyncGet(url, null, nocache, callback); }
[ "public", "void", "asyncGet", "(", "final", "String", "url", ",", "final", "boolean", "nocache", ",", "final", "Callback", "callback", ")", "{", "asyncGet", "(", "url", ",", "null", ",", "nocache", ",", "callback", ")", ";", "}" ]
Retrieve information from a server via a HTTP GET request. @param url - URL target of this request @param nocache - don't accept an invalidated cached response, and don't store the server's response in any cache @param callback - is called back when the response is readable
[ "Retrieve", "information", "from", "a", "server", "via", "a", "HTTP", "GET", "request", "." ]
train
https://github.com/grycap/coreutils/blob/e6db61dc50b49ea7276c0c29c7401204681a10c2/coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/Http2Client.java#L72-L74
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java
DiagnosticsInner.listHostingEnvironmentDetectorResponsesAsync
public Observable<Page<DetectorResponseInner>> listHostingEnvironmentDetectorResponsesAsync(final String resourceGroupName, final String name) { return listHostingEnvironmentDetectorResponsesWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Page<DetectorResponseInner>>() { @Override public Page<DetectorResponseInner> call(ServiceResponse<Page<DetectorResponseInner>> response) { return response.body(); } }); }
java
public Observable<Page<DetectorResponseInner>> listHostingEnvironmentDetectorResponsesAsync(final String resourceGroupName, final String name) { return listHostingEnvironmentDetectorResponsesWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Page<DetectorResponseInner>>() { @Override public Page<DetectorResponseInner> call(ServiceResponse<Page<DetectorResponseInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DetectorResponseInner", ">", ">", "listHostingEnvironmentDetectorResponsesAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listHostingEnvironmentDetectorResponsesWithServiceRes...
List Hosting Environment Detector Responses. List Hosting Environment Detector Responses. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Site Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorResponseInner&gt; object
[ "List", "Hosting", "Environment", "Detector", "Responses", ".", "List", "Hosting", "Environment", "Detector", "Responses", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java#L248-L256
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.createImage
public BufferedImage createImage(File file) throws IOException { resetAvailabilityFlags(); this.data = PELoader.loadPE(file); image = new BufferedImage(fileWidth, height, IMAGE_TYPE); drawSections(); Overlay overlay = new Overlay(data); if (overlay.exists()) { long overlayOffset = overlay.getOffset(); drawPixels(colorMap.get(OVERLAY), overlayOffset, withMinLength(overlay.getSize())); overlayAvailable = true; } drawPEHeaders(); drawSpecials(); drawResourceTypes(); assert image != null; assert image.getWidth() == fileWidth; assert image.getHeight() == height; return image; }
java
public BufferedImage createImage(File file) throws IOException { resetAvailabilityFlags(); this.data = PELoader.loadPE(file); image = new BufferedImage(fileWidth, height, IMAGE_TYPE); drawSections(); Overlay overlay = new Overlay(data); if (overlay.exists()) { long overlayOffset = overlay.getOffset(); drawPixels(colorMap.get(OVERLAY), overlayOffset, withMinLength(overlay.getSize())); overlayAvailable = true; } drawPEHeaders(); drawSpecials(); drawResourceTypes(); assert image != null; assert image.getWidth() == fileWidth; assert image.getHeight() == height; return image; }
[ "public", "BufferedImage", "createImage", "(", "File", "file", ")", "throws", "IOException", "{", "resetAvailabilityFlags", "(", ")", ";", "this", ".", "data", "=", "PELoader", ".", "loadPE", "(", "file", ")", ";", "image", "=", "new", "BufferedImage", "(", ...
Creates a buffered image that displays the structure of the PE file. @param file the PE file to create an image from @return buffered image @throws IOException if sections can not be read
[ "Creates", "a", "buffered", "image", "that", "displays", "the", "structure", "of", "the", "PE", "file", "." ]
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L379-L401
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateCompositeEntityRoleWithServiceResponseAsync
public Observable<ServiceResponse<OperationStatus>> updateCompositeEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, UUID roleId, UpdateCompositeEntityRoleOptionalParameter updateCompositeEntityRoleOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (cEntityId == null) { throw new IllegalArgumentException("Parameter cEntityId is required and cannot be null."); } if (roleId == null) { throw new IllegalArgumentException("Parameter roleId is required and cannot be null."); } final String name = updateCompositeEntityRoleOptionalParameter != null ? updateCompositeEntityRoleOptionalParameter.name() : null; return updateCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId, name); }
java
public Observable<ServiceResponse<OperationStatus>> updateCompositeEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, UUID roleId, UpdateCompositeEntityRoleOptionalParameter updateCompositeEntityRoleOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (cEntityId == null) { throw new IllegalArgumentException("Parameter cEntityId is required and cannot be null."); } if (roleId == null) { throw new IllegalArgumentException("Parameter roleId is required and cannot be null."); } final String name = updateCompositeEntityRoleOptionalParameter != null ? updateCompositeEntityRoleOptionalParameter.name() : null; return updateCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId, name); }
[ "public", "Observable", "<", "ServiceResponse", "<", "OperationStatus", ">", ">", "updateCompositeEntityRoleWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ",", "UUID", "roleId", ",", "UpdateCompositeEntityRoleOptiona...
Update an entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param roleId The entity role ID. @param updateCompositeEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Update", "an", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12505-L12524
looly/hutool
hutool-json/src/main/java/cn/hutool/json/JSONUtil.java
JSONUtil.getByPath
public static Object getByPath(JSON json, String expression) { return (null == json || StrUtil.isBlank(expression)) ? null : json.getByPath(expression); }
java
public static Object getByPath(JSON json, String expression) { return (null == json || StrUtil.isBlank(expression)) ? null : json.getByPath(expression); }
[ "public", "static", "Object", "getByPath", "(", "JSON", "json", ",", "String", "expression", ")", "{", "return", "(", "null", "==", "json", "||", "StrUtil", ".", "isBlank", "(", "expression", ")", ")", "?", "null", ":", "json", ".", "getByPath", "(", "...
通过表达式获取JSON中嵌套的对象<br> <ol> <li>.表达式,可以获取Bean对象中的属性(字段)值或者Map中key对应的值</li> <li>[]表达式,可以获取集合等对象中对应index的值</li> </ol> 表达式栗子: <pre> persion persion.name persons[3] person.friends[5].name </pre> @param json {@link JSON} @param expression 表达式 @return 对象 @see JSON#getByPath(String)
[ "通过表达式获取JSON中嵌套的对象<br", ">", "<ol", ">", "<li", ">", ".", "表达式,可以获取Bean对象中的属性(字段)值或者Map中key对应的值<", "/", "li", ">", "<li", ">", "[]", "表达式,可以获取集合等对象中对应index的值<", "/", "li", ">", "<", "/", "ol", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L410-L412
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/ipc/RPC.java
RPC.getProxy
public static <V extends VersionedProtocol> V getProxy(Class<V> protocol, InetSocketAddress addr, SocketFactory factory) throws IOException { @SuppressWarnings("unchecked") V proxy = (V) Proxy.newProxyInstance(protocol.getClassLoader(), new Class[] { protocol }, new Invoker(addr, factory)); return proxy; }
java
public static <V extends VersionedProtocol> V getProxy(Class<V> protocol, InetSocketAddress addr, SocketFactory factory) throws IOException { @SuppressWarnings("unchecked") V proxy = (V) Proxy.newProxyInstance(protocol.getClassLoader(), new Class[] { protocol }, new Invoker(addr, factory)); return proxy; }
[ "public", "static", "<", "V", "extends", "VersionedProtocol", ">", "V", "getProxy", "(", "Class", "<", "V", ">", "protocol", ",", "InetSocketAddress", "addr", ",", "SocketFactory", "factory", ")", "throws", "IOException", "{", "@", "SuppressWarnings", "(", "\"...
Construct a client-side proxy object that implements the named protocol, talking to a server at the named address.
[ "Construct", "a", "client", "-", "side", "proxy", "object", "that", "implements", "the", "named", "protocol", "talking", "to", "a", "server", "at", "the", "named", "address", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/ipc/RPC.java#L315-L322
mojohaus/aspectj-maven-plugin
src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java
AjcHelper.getWeaveSourceFiles
public static Set<String> getWeaveSourceFiles( String[] weaveDirs ) throws MojoExecutionException { Set<String> result = new HashSet<String>(); for ( int i = 0; i < weaveDirs.length; i++ ) { String weaveDir = weaveDirs[i]; if ( FileUtils.fileExists( weaveDir ) ) { try { result.addAll( FileUtils.getFileNames( new File( weaveDir ), "**/*.class", DEFAULT_EXCLUDES, true ) ); } catch ( IOException e ) { throw new MojoExecutionException( "IO Error resolving weavedirs", e ); } } } return result; }
java
public static Set<String> getWeaveSourceFiles( String[] weaveDirs ) throws MojoExecutionException { Set<String> result = new HashSet<String>(); for ( int i = 0; i < weaveDirs.length; i++ ) { String weaveDir = weaveDirs[i]; if ( FileUtils.fileExists( weaveDir ) ) { try { result.addAll( FileUtils.getFileNames( new File( weaveDir ), "**/*.class", DEFAULT_EXCLUDES, true ) ); } catch ( IOException e ) { throw new MojoExecutionException( "IO Error resolving weavedirs", e ); } } } return result; }
[ "public", "static", "Set", "<", "String", ">", "getWeaveSourceFiles", "(", "String", "[", "]", "weaveDirs", ")", "throws", "MojoExecutionException", "{", "Set", "<", "String", ">", "result", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", ...
Based on a set of weavedirs returns a set of all the files to be weaved. @return @throws MojoExecutionException
[ "Based", "on", "a", "set", "of", "weavedirs", "returns", "a", "set", "of", "all", "the", "files", "to", "be", "weaved", "." ]
train
https://github.com/mojohaus/aspectj-maven-plugin/blob/120ee1ce08b93873931035ed98cd70e3ccceeefb/src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java#L206-L227
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java
Utility.readTextFile
public static String readTextFile(Context context, String asset) { try { InputStream inputStream = context.getAssets().open(asset); return org.gearvrf.utility.TextFile.readTextFile(inputStream); } catch (FileNotFoundException f) { Log.w(TAG, "readTextFile(): asset file '%s' doesn't exist", asset); } catch (IOException e) { e.printStackTrace(); Log.e(TAG, e, "readTextFile()"); } return null; }
java
public static String readTextFile(Context context, String asset) { try { InputStream inputStream = context.getAssets().open(asset); return org.gearvrf.utility.TextFile.readTextFile(inputStream); } catch (FileNotFoundException f) { Log.w(TAG, "readTextFile(): asset file '%s' doesn't exist", asset); } catch (IOException e) { e.printStackTrace(); Log.e(TAG, e, "readTextFile()"); } return null; }
[ "public", "static", "String", "readTextFile", "(", "Context", "context", ",", "String", "asset", ")", "{", "try", "{", "InputStream", "inputStream", "=", "context", ".", "getAssets", "(", ")", ".", "open", "(", "asset", ")", ";", "return", "org", ".", "g...
Read a text file from assets into a single string @param context A non-null Android Context @param asset The asset file to read @return The contents or null on error.
[ "Read", "a", "text", "file", "from", "assets", "into", "a", "single", "string" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java#L42-L53
samskivert/samskivert
src/main/java/com/samskivert/jdbc/BaseLiaison.java
BaseLiaison.expandDefinition
public String expandDefinition (ColumnDefinition def) { return expandDefinition(def.type, def.nullable, def.unique, def.defaultValue); }
java
public String expandDefinition (ColumnDefinition def) { return expandDefinition(def.type, def.nullable, def.unique, def.defaultValue); }
[ "public", "String", "expandDefinition", "(", "ColumnDefinition", "def", ")", "{", "return", "expandDefinition", "(", "def", ".", "type", ",", "def", ".", "nullable", ",", "def", ".", "unique", ",", "def", ".", "defaultValue", ")", ";", "}" ]
Create an SQL string that summarizes a column definition in that format generally accepted in table creation and column addition statements, e.g. {@code INTEGER UNIQUE NOT NULL DEFAULT 100}.
[ "Create", "an", "SQL", "string", "that", "summarizes", "a", "column", "definition", "in", "that", "format", "generally", "accepted", "in", "table", "creation", "and", "column", "addition", "statements", "e", ".", "g", ".", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/BaseLiaison.java#L313-L316
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.multAdd
public static void multAdd(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multAdd_reorder(a, b, c); } else { MatrixMatrixMult_ZDRM.multAdd_small(a,b,c); } }
java
public static void multAdd(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multAdd_reorder(a, b, c); } else { MatrixMatrixMult_ZDRM.multAdd_small(a,b,c); } }
[ "public", "static", "void", "multAdd", "(", "ZMatrixRMaj", "a", ",", "ZMatrixRMaj", "b", ",", "ZMatrixRMaj", "c", ")", "{", "if", "(", "b", ".", "numCols", ">=", "EjmlParameters", ".", "MULT_COLUMN_SWITCH", ")", "{", "MatrixMatrixMult_ZDRM", ".", "multAdd_reor...
<p> Performs the following operation:<br> <br> c = c + a * b<br> c<sub>ij</sub> = c<sub>ij</sub> + &sum;<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>kj</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "c", "+", "a", "*", "b<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "c<sub", ">", "ij<", "/", "sub", ">", "+", "&sum", ";", "<sub", ">", "k...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L410-L417
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
GrailsDomainBinder.getTableName
protected String getTableName(PersistentEntity domainClass, String sessionFactoryBeanName) { Mapping m = getMapping(domainClass); String tableName = null; if (m != null && m.getTableName() != null) { tableName = m.getTableName(); } if (tableName == null) { String shortName = domainClass.getJavaClass().getSimpleName(); PersistentEntityNamingStrategy namingStrategy = this.namingStrategy; if(namingStrategy != null) { tableName = namingStrategy.resolveTableName(domainClass); } if(tableName == null) { tableName = getNamingStrategy(sessionFactoryBeanName).classToTableName(shortName); } } return tableName; }
java
protected String getTableName(PersistentEntity domainClass, String sessionFactoryBeanName) { Mapping m = getMapping(domainClass); String tableName = null; if (m != null && m.getTableName() != null) { tableName = m.getTableName(); } if (tableName == null) { String shortName = domainClass.getJavaClass().getSimpleName(); PersistentEntityNamingStrategy namingStrategy = this.namingStrategy; if(namingStrategy != null) { tableName = namingStrategy.resolveTableName(domainClass); } if(tableName == null) { tableName = getNamingStrategy(sessionFactoryBeanName).classToTableName(shortName); } } return tableName; }
[ "protected", "String", "getTableName", "(", "PersistentEntity", "domainClass", ",", "String", "sessionFactoryBeanName", ")", "{", "Mapping", "m", "=", "getMapping", "(", "domainClass", ")", ";", "String", "tableName", "=", "null", ";", "if", "(", "m", "!=", "n...
Evaluates the table name for the given property @param domainClass The domain class to evaluate @return The table name
[ "Evaluates", "the", "table", "name", "for", "the", "given", "property" ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L1199-L1217
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.setSeconds
public static Date setSeconds(final Date date, final int amount) { return set(date, Calendar.SECOND, amount); }
java
public static Date setSeconds(final Date date, final int amount) { return set(date, Calendar.SECOND, amount); }
[ "public", "static", "Date", "setSeconds", "(", "final", "Date", "date", ",", "final", "int", "amount", ")", "{", "return", "set", "(", "date", ",", "Calendar", ".", "SECOND", ",", "amount", ")", ";", "}" ]
Sets the seconds field to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to set @return a new {@code Date} set with the specified value @throws IllegalArgumentException if the date is null @since 2.4
[ "Sets", "the", "seconds", "field", "to", "a", "date", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L616-L618
talsma-ict/umldoclet
src/main/java/nl/talsmasoftware/umldoclet/javadoc/TypeNameVisitor.java
TypeNameVisitor._visit
private TypeName _visit(TypeMirror type, Void parameter) { if (VISITED.get().add(type)) try { return super.visit(type, parameter); } finally { VISITED.get().remove(type); if (VISITED.get().isEmpty()) VISITED.remove(); } return defaultAction(type, parameter); }
java
private TypeName _visit(TypeMirror type, Void parameter) { if (VISITED.get().add(type)) try { return super.visit(type, parameter); } finally { VISITED.get().remove(type); if (VISITED.get().isEmpty()) VISITED.remove(); } return defaultAction(type, parameter); }
[ "private", "TypeName", "_visit", "(", "TypeMirror", "type", ",", "Void", "parameter", ")", "{", "if", "(", "VISITED", ".", "get", "(", ")", ".", "add", "(", "type", ")", ")", "try", "{", "return", "super", ".", "visit", "(", "type", ",", "parameter",...
Internal variant of {@link #visit(TypeMirror, Object)} for calls from inside this visitor itself. <p> Main purpose of this method is to limit the endless recursion that would result for types such as {@code <T extends Comparable<T>>} @param type The type to visit. @param parameter The parameter (ignored by our visitor). @return The type name
[ "Internal", "variant", "of", "{", "@link", "#visit", "(", "TypeMirror", "Object", ")", "}", "for", "calls", "from", "inside", "this", "visitor", "itself", ".", "<p", ">", "Main", "purpose", "of", "this", "method", "is", "to", "limit", "the", "endless", "...
train
https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/javadoc/TypeNameVisitor.java#L64-L72
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
CacheableWorkspaceDataManager.loadFilters
protected boolean loadFilters(final boolean cleanOnFail, boolean asynchronous) { if (!filtersSupported.get()) { if (LOG.isWarnEnabled()) { LOG.warn("The bloom filters are not supported therefore they cannot be reloaded"); } return false; } filtersEnabled.set(false); this.filterPermissions = new BloomFilter<String>(bfProbability, bfElementNumber); this.filterOwner = new BloomFilter<String>(bfProbability, bfElementNumber); if (asynchronous) { new Thread(new Runnable() { public void run() { doLoadFilters(cleanOnFail); } }, "BloomFilter-Loader-" + dataContainer.getName()).start(); return true; } else { return doLoadFilters(cleanOnFail); } }
java
protected boolean loadFilters(final boolean cleanOnFail, boolean asynchronous) { if (!filtersSupported.get()) { if (LOG.isWarnEnabled()) { LOG.warn("The bloom filters are not supported therefore they cannot be reloaded"); } return false; } filtersEnabled.set(false); this.filterPermissions = new BloomFilter<String>(bfProbability, bfElementNumber); this.filterOwner = new BloomFilter<String>(bfProbability, bfElementNumber); if (asynchronous) { new Thread(new Runnable() { public void run() { doLoadFilters(cleanOnFail); } }, "BloomFilter-Loader-" + dataContainer.getName()).start(); return true; } else { return doLoadFilters(cleanOnFail); } }
[ "protected", "boolean", "loadFilters", "(", "final", "boolean", "cleanOnFail", ",", "boolean", "asynchronous", ")", "{", "if", "(", "!", "filtersSupported", ".", "get", "(", ")", ")", "{", "if", "(", "LOG", ".", "isWarnEnabled", "(", ")", ")", "{", "LOG"...
Loads the bloom filters @param cleanOnFail clean everything if an error occurs @param asynchronous make the bloom filters loading asynchronous @return <code>true</code> if the filters could be loaded successfully, <code>false</code> otherwise.
[ "Loads", "the", "bloom", "filters" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L2640-L2670
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.settleCapturedViewAt
public boolean settleCapturedViewAt(int finalLeft, int finalTop) { if (!mReleaseInProgress) { throw new IllegalStateException("Cannot settleCapturedViewAt outside of a call to " + "Callback#onViewReleased"); } return forceSettleCapturedViewAt(finalLeft, finalTop, (int) VelocityTrackerCompat.getXVelocity(mVelocityTracker, mActivePointerId), (int) VelocityTrackerCompat.getYVelocity(mVelocityTracker, mActivePointerId)); }
java
public boolean settleCapturedViewAt(int finalLeft, int finalTop) { if (!mReleaseInProgress) { throw new IllegalStateException("Cannot settleCapturedViewAt outside of a call to " + "Callback#onViewReleased"); } return forceSettleCapturedViewAt(finalLeft, finalTop, (int) VelocityTrackerCompat.getXVelocity(mVelocityTracker, mActivePointerId), (int) VelocityTrackerCompat.getYVelocity(mVelocityTracker, mActivePointerId)); }
[ "public", "boolean", "settleCapturedViewAt", "(", "int", "finalLeft", ",", "int", "finalTop", ")", "{", "if", "(", "!", "mReleaseInProgress", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot settleCapturedViewAt outside of a call to \"", "+", "\"Callbac...
Settle the captured view at the given (left, top) position. The appropriate velocity from prior motion will be taken into account. If this method returns true, the caller should invoke {@link #continueSettling(boolean)} on each subsequent frame to continue the motion until it returns false. If this method returns false there is no further work to do to complete the movement. @param finalLeft Settled left edge position for the captured view @param finalTop Settled top edge position for the captured view @return true if animation should continue through {@link #continueSettling(boolean)} calls
[ "Settle", "the", "captured", "view", "at", "the", "given", "(", "left", "top", ")", "position", ".", "The", "appropriate", "velocity", "from", "prior", "motion", "will", "be", "taken", "into", "account", ".", "If", "this", "method", "returns", "true", "the...
train
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L587-L596
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/AbstractFullProjection.java
AbstractFullProjection.projectRelativeScaledToDataSpace
@Override public <NV extends NumberVector> NV projectRelativeScaledToDataSpace(double[] v, NumberVector.Factory<NV> prototype) { final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getRelativeUnscaled(v[d]); } return prototype.newNumberVector(vec); }
java
@Override public <NV extends NumberVector> NV projectRelativeScaledToDataSpace(double[] v, NumberVector.Factory<NV> prototype) { final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getRelativeUnscaled(v[d]); } return prototype.newNumberVector(vec); }
[ "@", "Override", "public", "<", "NV", "extends", "NumberVector", ">", "NV", "projectRelativeScaledToDataSpace", "(", "double", "[", "]", "v", ",", "NumberVector", ".", "Factory", "<", "NV", ">", "prototype", ")", "{", "final", "int", "dim", "=", "v", ".", ...
Project a relative vector from scaled space to data space. @param <NV> Vector type @param v relative vector in scaled space @param prototype Object factory @return relative vector in data space
[ "Project", "a", "relative", "vector", "from", "scaled", "space", "to", "data", "space", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/AbstractFullProjection.java#L201-L209
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java
SparkComputationGraph.evaluateRegressionMDS
public <T extends RegressionEvaluation> T evaluateRegressionMDS(JavaRDD<MultiDataSet> data, int minibatchSize) { return (T)doEvaluationMDS(data, minibatchSize, new org.deeplearning4j.eval.RegressionEvaluation())[0]; }
java
public <T extends RegressionEvaluation> T evaluateRegressionMDS(JavaRDD<MultiDataSet> data, int minibatchSize) { return (T)doEvaluationMDS(data, minibatchSize, new org.deeplearning4j.eval.RegressionEvaluation())[0]; }
[ "public", "<", "T", "extends", "RegressionEvaluation", ">", "T", "evaluateRegressionMDS", "(", "JavaRDD", "<", "MultiDataSet", ">", "data", ",", "int", "minibatchSize", ")", "{", "return", "(", "T", ")", "doEvaluationMDS", "(", "data", ",", "minibatchSize", ",...
Evaluate the network (regression performance) in a distributed manner on the provided data @param data Data to evaluate @param minibatchSize Minibatch size to use when doing performing evaluation @return {@link RegressionEvaluation} instance with regression performance
[ "Evaluate", "the", "network", "(", "regression", "performance", ")", "in", "a", "distributed", "manner", "on", "the", "provided", "data" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L754-L756
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.uploadContent
public void uploadContent(@NonNull final String folder, @NonNull final ContentData data, @Nullable Callback<ComapiResult<UploadContentResponse>> callback) { adapter.adapt(uploadContent(folder, data), callback); }
java
public void uploadContent(@NonNull final String folder, @NonNull final ContentData data, @Nullable Callback<ComapiResult<UploadContentResponse>> callback) { adapter.adapt(uploadContent(folder, data), callback); }
[ "public", "void", "uploadContent", "(", "@", "NonNull", "final", "String", "folder", ",", "@", "NonNull", "final", "ContentData", "data", ",", "@", "Nullable", "Callback", "<", "ComapiResult", "<", "UploadContentResponse", ">", ">", "callback", ")", "{", "adap...
Upload content data. @param folder Folder name to put the file in. @param data Content data. @param callback Callback with the details of uploaded content.
[ "Upload", "content", "data", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L752-L754
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/servlet/MockHttpServletResponse.java
MockHttpServletResponse.setDateHeader
@Override public void setDateHeader(final String name, final long value) { headers.put(name, String.valueOf(value)); }
java
@Override public void setDateHeader(final String name, final long value) { headers.put(name, String.valueOf(value)); }
[ "@", "Override", "public", "void", "setDateHeader", "(", "final", "String", "name", ",", "final", "long", "value", ")", "{", "headers", ".", "put", "(", "name", ",", "String", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
Sets a date header. @param name the header name. @param value the header value.
[ "Sets", "a", "date", "header", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/servlet/MockHttpServletResponse.java#L175-L178
lunisolar/magma
magma-func-builder/src/main/java/eu/lunisolar/magma/func/build/supplier/LLongSupplierBuilder.java
LLongSupplierBuilder.withHandling
@Nonnull public final LLongSupplierBuilder withHandling(@Nonnull HandlingInstructions<RuntimeException, RuntimeException> handling) { Null.nonNullArg(handling, "handling"); if (this.handling != null) { throw new UnsupportedOperationException("Handling is already set for this builder."); } this.handling = handling; return self(); }
java
@Nonnull public final LLongSupplierBuilder withHandling(@Nonnull HandlingInstructions<RuntimeException, RuntimeException> handling) { Null.nonNullArg(handling, "handling"); if (this.handling != null) { throw new UnsupportedOperationException("Handling is already set for this builder."); } this.handling = handling; return self(); }
[ "@", "Nonnull", "public", "final", "LLongSupplierBuilder", "withHandling", "(", "@", "Nonnull", "HandlingInstructions", "<", "RuntimeException", ",", "RuntimeException", ">", "handling", ")", "{", "Null", ".", "nonNullArg", "(", "handling", ",", "\"handling\"", ")",...
One of ways of creating builder. In most cases (considering all _functional_ builders) it requires to provide generic parameters (in most cases redundantly)
[ "One", "of", "ways", "of", "creating", "builder", ".", "In", "most", "cases", "(", "considering", "all", "_functional_", "builders", ")", "it", "requires", "to", "provide", "generic", "parameters", "(", "in", "most", "cases", "redundantly", ")" ]
train
https://github.com/lunisolar/magma/blob/83809c6d1a33d913aec6c49920251e4f0be8b213/magma-func-builder/src/main/java/eu/lunisolar/magma/func/build/supplier/LLongSupplierBuilder.java#L96-L104
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java
NGCommunicator.readPayload
private InputStream readPayload(InputStream in, int len) throws IOException { byte[] receiveBuffer = new byte[len]; int totalRead = 0; while (totalRead < len) { int currentRead = in.read(receiveBuffer, totalRead, len - totalRead); if (currentRead < 0) { // server may forcefully close the socket/stream and this will cause InputStream to // return -1. Throw EOFException (same what DataInputStream does) to signal up // that we are in client disconnect mode throw new EOFException("stdin EOF before payload read."); } totalRead += currentRead; } return new ByteArrayInputStream(receiveBuffer); }
java
private InputStream readPayload(InputStream in, int len) throws IOException { byte[] receiveBuffer = new byte[len]; int totalRead = 0; while (totalRead < len) { int currentRead = in.read(receiveBuffer, totalRead, len - totalRead); if (currentRead < 0) { // server may forcefully close the socket/stream and this will cause InputStream to // return -1. Throw EOFException (same what DataInputStream does) to signal up // that we are in client disconnect mode throw new EOFException("stdin EOF before payload read."); } totalRead += currentRead; } return new ByteArrayInputStream(receiveBuffer); }
[ "private", "InputStream", "readPayload", "(", "InputStream", "in", ",", "int", "len", ")", "throws", "IOException", "{", "byte", "[", "]", "receiveBuffer", "=", "new", "byte", "[", "len", "]", ";", "int", "totalRead", "=", "0", ";", "while", "(", "totalR...
Reads a NailGun chunk payload from {@link #in} and returns an InputStream that reads from that chunk. @param in the InputStream to read the chunk payload from. @param len the size of the payload chunk read from the chunkHeader. @return an InputStream containing the read data. @throws IOException if thrown by the underlying InputStream @throws EOFException if EOF is reached by underlying stream before the payload has been read, or if underlying stream was closed
[ "Reads", "a", "NailGun", "chunk", "payload", "from", "{", "@link", "#in", "}", "and", "returns", "an", "InputStream", "that", "reads", "from", "that", "chunk", "." ]
train
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java#L457-L471
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java
CraftingHelper.removeIngredientsFromPlayer
public static void removeIngredientsFromPlayer(EntityPlayerMP player, List<ItemStack> ingredients) { NonNullList<ItemStack> main = player.inventory.mainInventory; NonNullList<ItemStack> arm = player.inventory.armorInventory; for (ItemStack isIngredient : ingredients) { int target = isIngredient.getCount(); for (int i = 0; i < main.size() + arm.size() && target > 0; i++) { ItemStack isPlayer = (i >= main.size()) ? arm.get(i - main.size()) : main.get(i); if (isPlayer != null && isIngredient != null && itemStackIngredientsMatch(isPlayer, isIngredient)) { if (target >= isPlayer.getCount()) { // Consume this stack: target -= isPlayer.getCount(); if (i >= main.size()) arm.get(i - main.size()).setCount(0); else main.get(i).setCount(0); } else { isPlayer.setCount(isPlayer.getCount() - target); target = 0; } } } ItemStack resultForReward = isIngredient.copy(); RewardForDiscardingItemImplementation.LoseItemEvent event = new RewardForDiscardingItemImplementation.LoseItemEvent(resultForReward); MinecraftForge.EVENT_BUS.post(event); } }
java
public static void removeIngredientsFromPlayer(EntityPlayerMP player, List<ItemStack> ingredients) { NonNullList<ItemStack> main = player.inventory.mainInventory; NonNullList<ItemStack> arm = player.inventory.armorInventory; for (ItemStack isIngredient : ingredients) { int target = isIngredient.getCount(); for (int i = 0; i < main.size() + arm.size() && target > 0; i++) { ItemStack isPlayer = (i >= main.size()) ? arm.get(i - main.size()) : main.get(i); if (isPlayer != null && isIngredient != null && itemStackIngredientsMatch(isPlayer, isIngredient)) { if (target >= isPlayer.getCount()) { // Consume this stack: target -= isPlayer.getCount(); if (i >= main.size()) arm.get(i - main.size()).setCount(0); else main.get(i).setCount(0); } else { isPlayer.setCount(isPlayer.getCount() - target); target = 0; } } } ItemStack resultForReward = isIngredient.copy(); RewardForDiscardingItemImplementation.LoseItemEvent event = new RewardForDiscardingItemImplementation.LoseItemEvent(resultForReward); MinecraftForge.EVENT_BUS.post(event); } }
[ "public", "static", "void", "removeIngredientsFromPlayer", "(", "EntityPlayerMP", "player", ",", "List", "<", "ItemStack", ">", "ingredients", ")", "{", "NonNullList", "<", "ItemStack", ">", "main", "=", "player", ".", "inventory", ".", "mainInventory", ";", "No...
Manually attempt to remove ingredients from the player's inventory.<br> @param player @param ingredients
[ "Manually", "attempt", "to", "remove", "ingredients", "from", "the", "player", "s", "inventory", ".", "<br", ">" ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java#L290-L323
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/AnnotatedTypeLoader.java
AnnotatedTypeLoader.loadAnnotatedType
public <T> SlimAnnotatedTypeContext<T> loadAnnotatedType(Class<T> clazz, String bdaId) { return createContext(internalLoadAnnotatedType(clazz, bdaId)); }
java
public <T> SlimAnnotatedTypeContext<T> loadAnnotatedType(Class<T> clazz, String bdaId) { return createContext(internalLoadAnnotatedType(clazz, bdaId)); }
[ "public", "<", "T", ">", "SlimAnnotatedTypeContext", "<", "T", ">", "loadAnnotatedType", "(", "Class", "<", "T", ">", "clazz", ",", "String", "bdaId", ")", "{", "return", "createContext", "(", "internalLoadAnnotatedType", "(", "clazz", ",", "bdaId", ")", ")"...
Creates a new {@link SlimAnnotatedTypeContext} instance for the given class. This method may return null if there is a problem loading the class or this class is not needed for further processing (e.g. an annotation or a vetoed class). @param clazz the given class @param bdaId the identifier of the bean archive this class resides in @return a new {@code SlimAnnotatedTypeContext} for a specified class or null
[ "Creates", "a", "new", "{", "@link", "SlimAnnotatedTypeContext", "}", "instance", "for", "the", "given", "class", ".", "This", "method", "may", "return", "null", "if", "there", "is", "a", "problem", "loading", "the", "class", "or", "this", "class", "is", "...
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/AnnotatedTypeLoader.java#L73-L75
jeluard/semantic-versioning
api/src/main/java/org/osjava/jardiff/DOMDiffHandler.java
DOMDiffHandler.startDiff
public void startDiff(String oldJar, String newJar) throws DiffException { Element tmp = doc.createElementNS(XML_URI, "diff"); tmp.setAttribute( "old", oldJar); tmp.setAttribute( "new", newJar); doc.appendChild(tmp); currentNode = tmp; }
java
public void startDiff(String oldJar, String newJar) throws DiffException { Element tmp = doc.createElementNS(XML_URI, "diff"); tmp.setAttribute( "old", oldJar); tmp.setAttribute( "new", newJar); doc.appendChild(tmp); currentNode = tmp; }
[ "public", "void", "startDiff", "(", "String", "oldJar", ",", "String", "newJar", ")", "throws", "DiffException", "{", "Element", "tmp", "=", "doc", ".", "createElementNS", "(", "XML_URI", ",", "\"diff\"", ")", ";", "tmp", ".", "setAttribute", "(", "\"old\"",...
Start the diff. This writes out the start of a &lt;diff&gt; node. @param oldJar ignored @param newJar ignored @throws DiffException when there is an underlying exception, e.g. writing to a file caused an IOException
[ "Start", "the", "diff", ".", "This", "writes", "out", "the", "start", "of", "a", "&lt", ";", "diff&gt", ";", "node", "." ]
train
https://github.com/jeluard/semantic-versioning/blob/d0bfbeddca8ac4202f5225810227c72a708360a9/api/src/main/java/org/osjava/jardiff/DOMDiffHandler.java#L127-L133
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java
MarkLogicClient.sendRemove
public void sendRemove(String baseURI, Resource subject,URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException { if (DELETE_CACHE_ENABLED) { timerDeleteCache.add(subject, predicate, object, contexts); } else { if (WRITE_CACHE_ENABLED) sync(); getClient().performRemove(baseURI, (Resource) skolemize(subject), (URI) skolemize(predicate), skolemize(object), this.tx, contexts); } }
java
public void sendRemove(String baseURI, Resource subject,URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException { if (DELETE_CACHE_ENABLED) { timerDeleteCache.add(subject, predicate, object, contexts); } else { if (WRITE_CACHE_ENABLED) sync(); getClient().performRemove(baseURI, (Resource) skolemize(subject), (URI) skolemize(predicate), skolemize(object), this.tx, contexts); } }
[ "public", "void", "sendRemove", "(", "String", "baseURI", ",", "Resource", "subject", ",", "URI", "predicate", ",", "Value", "object", ",", "Resource", "...", "contexts", ")", "throws", "MarkLogicSesameException", "{", "if", "(", "DELETE_CACHE_ENABLED", ")", "{"...
remove single triple @param baseURI @param subject @param predicate @param object @param contexts
[ "remove", "single", "triple" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L357-L365
apereo/cas
support/cas-server-support-rest-authentication/src/main/java/org/apereo/cas/adaptors/rest/RestAuthenticationHandler.java
RestAuthenticationHandler.getWarnings
protected List<MessageDescriptor> getWarnings(final ResponseEntity<?> authenticationResponse) { val messageDescriptors = new ArrayList<MessageDescriptor>(); val passwordExpirationDate = authenticationResponse.getHeaders().getFirstZonedDateTime("X-CAS-PasswordExpirationDate"); if (passwordExpirationDate != null) { val days = Duration.between(Instant.now(), passwordExpirationDate).toDays(); messageDescriptors.add(new PasswordExpiringWarningMessageDescriptor(null, days)); } val warnings = authenticationResponse.getHeaders().get("X-CAS-Warning"); if (warnings != null) { warnings.stream() .map(DefaultMessageDescriptor::new) .forEach(messageDescriptors::add); } return messageDescriptors; }
java
protected List<MessageDescriptor> getWarnings(final ResponseEntity<?> authenticationResponse) { val messageDescriptors = new ArrayList<MessageDescriptor>(); val passwordExpirationDate = authenticationResponse.getHeaders().getFirstZonedDateTime("X-CAS-PasswordExpirationDate"); if (passwordExpirationDate != null) { val days = Duration.between(Instant.now(), passwordExpirationDate).toDays(); messageDescriptors.add(new PasswordExpiringWarningMessageDescriptor(null, days)); } val warnings = authenticationResponse.getHeaders().get("X-CAS-Warning"); if (warnings != null) { warnings.stream() .map(DefaultMessageDescriptor::new) .forEach(messageDescriptors::add); } return messageDescriptors; }
[ "protected", "List", "<", "MessageDescriptor", ">", "getWarnings", "(", "final", "ResponseEntity", "<", "?", ">", "authenticationResponse", ")", "{", "val", "messageDescriptors", "=", "new", "ArrayList", "<", "MessageDescriptor", ">", "(", ")", ";", "val", "pass...
Resolve {@link MessageDescriptor warnings} from the {@link ResponseEntity authenticationResponse}. @param authenticationResponse The response sent by the REST authentication endpoint @return The warnings for the created {@link AuthenticationHandlerExecutionResult}
[ "Resolve", "{", "@link", "MessageDescriptor", "warnings", "}", "from", "the", "{", "@link", "ResponseEntity", "authenticationResponse", "}", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-rest-authentication/src/main/java/org/apereo/cas/adaptors/rest/RestAuthenticationHandler.java#L95-L112
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.writeResourceExtendedAttributes
private void writeResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx) { Project.Resources.Resource.ExtendedAttribute attrib; List<Project.Resources.Resource.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute(); for (ResourceField mpxFieldID : getAllResourceExtendedAttributes()) { Object value = mpx.getCachedValue(mpxFieldID); if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value)) { m_extendedAttributesInUse.add(mpxFieldID); Integer xmlFieldID = Integer.valueOf(MPPResourceField.getID(mpxFieldID) | MPPResourceField.RESOURCE_FIELD_BASE); attrib = m_factory.createProjectResourcesResourceExtendedAttribute(); extendedAttributes.add(attrib); attrib.setFieldID(xmlFieldID.toString()); attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType())); attrib.setDurationFormat(printExtendedAttributeDurationFormat(value)); } } }
java
private void writeResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx) { Project.Resources.Resource.ExtendedAttribute attrib; List<Project.Resources.Resource.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute(); for (ResourceField mpxFieldID : getAllResourceExtendedAttributes()) { Object value = mpx.getCachedValue(mpxFieldID); if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value)) { m_extendedAttributesInUse.add(mpxFieldID); Integer xmlFieldID = Integer.valueOf(MPPResourceField.getID(mpxFieldID) | MPPResourceField.RESOURCE_FIELD_BASE); attrib = m_factory.createProjectResourcesResourceExtendedAttribute(); extendedAttributes.add(attrib); attrib.setFieldID(xmlFieldID.toString()); attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType())); attrib.setDurationFormat(printExtendedAttributeDurationFormat(value)); } } }
[ "private", "void", "writeResourceExtendedAttributes", "(", "Project", ".", "Resources", ".", "Resource", "xml", ",", "Resource", "mpx", ")", "{", "Project", ".", "Resources", ".", "Resource", ".", "ExtendedAttribute", "attrib", ";", "List", "<", "Project", ".", ...
This method writes extended attribute data for a resource. @param xml MSPDI resource @param mpx MPXJ resource
[ "This", "method", "writes", "extended", "attribute", "data", "for", "a", "resource", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L915-L937
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.write
public static void write(OutputStream out, String charsetName, boolean isCloseOut, Object... contents) throws IORuntimeException { write(out, CharsetUtil.charset(charsetName), isCloseOut, contents); }
java
public static void write(OutputStream out, String charsetName, boolean isCloseOut, Object... contents) throws IORuntimeException { write(out, CharsetUtil.charset(charsetName), isCloseOut, contents); }
[ "public", "static", "void", "write", "(", "OutputStream", "out", ",", "String", "charsetName", ",", "boolean", "isCloseOut", ",", "Object", "...", "contents", ")", "throws", "IORuntimeException", "{", "write", "(", "out", ",", "CharsetUtil", ".", "charset", "(...
将多部分内容写到流中,自动转换为字符串 @param out 输出流 @param charsetName 写出的内容的字符集 @param isCloseOut 写入完毕是否关闭输出流 @param contents 写入的内容,调用toString()方法,不包括不会自动换行 @throws IORuntimeException IO异常
[ "将多部分内容写到流中,自动转换为字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L891-L893
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PromotionCommitOperation.java
PromotionCommitOperation.beforePromotion
private CallStatus beforePromotion() { NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine(); InternalOperationService operationService = nodeEngine.getOperationService(); InternalPartitionServiceImpl partitionService = getService(); if (!partitionService.getMigrationManager().acquirePromotionPermit()) { throw new RetryableHazelcastException("Another promotion is being run currently. " + "This is only expected when promotion is retried to an unresponsive destination."); } ILogger logger = getLogger(); int partitionStateVersion = partitionService.getPartitionStateVersion(); if (partitionState.getVersion() <= partitionStateVersion) { logger.warning("Already applied promotions to the partition state. Promotion state version: " + partitionState.getVersion() + ", current version: " + partitionStateVersion); partitionService.getMigrationManager().releasePromotionPermit(); success = true; return CallStatus.DONE_RESPONSE; } partitionService.getInternalMigrationListener().onPromotionStart(MigrationParticipant.DESTINATION, promotions); if (logger.isFineEnabled()) { logger.fine("Submitting BeforePromotionOperations for " + promotions.size() + " promotions. " + "Promotion partition state version: " + partitionState.getVersion() + ", current partition state version: " + partitionStateVersion); } Runnable beforePromotionsCallback = new BeforePromotionOperationCallback(this, new AtomicInteger(promotions.size())); for (MigrationInfo promotion : promotions) { if (logger.isFinestEnabled()) { logger.finest("Submitting BeforePromotionOperation for promotion: " + promotion); } BeforePromotionOperation op = new BeforePromotionOperation(promotion, beforePromotionsCallback); op.setPartitionId(promotion.getPartitionId()).setNodeEngine(nodeEngine).setService(partitionService); operationService.execute(op); } return CallStatus.DONE_VOID; }
java
private CallStatus beforePromotion() { NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine(); InternalOperationService operationService = nodeEngine.getOperationService(); InternalPartitionServiceImpl partitionService = getService(); if (!partitionService.getMigrationManager().acquirePromotionPermit()) { throw new RetryableHazelcastException("Another promotion is being run currently. " + "This is only expected when promotion is retried to an unresponsive destination."); } ILogger logger = getLogger(); int partitionStateVersion = partitionService.getPartitionStateVersion(); if (partitionState.getVersion() <= partitionStateVersion) { logger.warning("Already applied promotions to the partition state. Promotion state version: " + partitionState.getVersion() + ", current version: " + partitionStateVersion); partitionService.getMigrationManager().releasePromotionPermit(); success = true; return CallStatus.DONE_RESPONSE; } partitionService.getInternalMigrationListener().onPromotionStart(MigrationParticipant.DESTINATION, promotions); if (logger.isFineEnabled()) { logger.fine("Submitting BeforePromotionOperations for " + promotions.size() + " promotions. " + "Promotion partition state version: " + partitionState.getVersion() + ", current partition state version: " + partitionStateVersion); } Runnable beforePromotionsCallback = new BeforePromotionOperationCallback(this, new AtomicInteger(promotions.size())); for (MigrationInfo promotion : promotions) { if (logger.isFinestEnabled()) { logger.finest("Submitting BeforePromotionOperation for promotion: " + promotion); } BeforePromotionOperation op = new BeforePromotionOperation(promotion, beforePromotionsCallback); op.setPartitionId(promotion.getPartitionId()).setNodeEngine(nodeEngine).setService(partitionService); operationService.execute(op); } return CallStatus.DONE_VOID; }
[ "private", "CallStatus", "beforePromotion", "(", ")", "{", "NodeEngineImpl", "nodeEngine", "=", "(", "NodeEngineImpl", ")", "getNodeEngine", "(", ")", ";", "InternalOperationService", "operationService", "=", "nodeEngine", ".", "getOperationService", "(", ")", ";", ...
Sends {@link BeforePromotionOperation}s for all promotions and register a callback on each operation to track when operations are finished.
[ "Sends", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PromotionCommitOperation.java#L116-L155
JDBDT/jdbdt
src/main/java/org/jdbdt/DBSetup.java
DBSetup.populateIfChanged
static void populateIfChanged(CallInfo callInfo, DataSet data) { Table table = asTable(data.getSource()); if ( table.getDirtyStatus() ) { table.setDirtyStatus(true); doPopulate(callInfo, table, data); } }
java
static void populateIfChanged(CallInfo callInfo, DataSet data) { Table table = asTable(data.getSource()); if ( table.getDirtyStatus() ) { table.setDirtyStatus(true); doPopulate(callInfo, table, data); } }
[ "static", "void", "populateIfChanged", "(", "CallInfo", "callInfo", ",", "DataSet", "data", ")", "{", "Table", "table", "=", "asTable", "(", "data", ".", "getSource", "(", ")", ")", ";", "if", "(", "table", ".", "getDirtyStatus", "(", ")", ")", "{", "t...
Populate database table with a data set, if associated table has changed. @param callInfo Call Info. @param data Data Set.
[ "Populate", "database", "table", "with", "a", "data", "set", "if", "associated", "table", "has", "changed", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DBSetup.java#L80-L86
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java
BinarySerde.writeArrayToDisk
public static void writeArrayToDisk(INDArray arr, File toWrite) throws IOException { try (FileOutputStream os = new FileOutputStream(toWrite)) { FileChannel channel = os.getChannel(); ByteBuffer buffer = BinarySerde.toByteBuffer(arr); channel.write(buffer); } }
java
public static void writeArrayToDisk(INDArray arr, File toWrite) throws IOException { try (FileOutputStream os = new FileOutputStream(toWrite)) { FileChannel channel = os.getChannel(); ByteBuffer buffer = BinarySerde.toByteBuffer(arr); channel.write(buffer); } }
[ "public", "static", "void", "writeArrayToDisk", "(", "INDArray", "arr", ",", "File", "toWrite", ")", "throws", "IOException", "{", "try", "(", "FileOutputStream", "os", "=", "new", "FileOutputStream", "(", "toWrite", ")", ")", "{", "FileChannel", "channel", "=...
Write an ndarray to disk in binary format @param arr the array to write @param toWrite the file tow rite to @throws IOException
[ "Write", "an", "ndarray", "to", "disk", "in", "binary", "format" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L277-L283
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteProjectMember
public void deleteProjectMember(Integer projectId, Integer userId) throws IOException { String tailUrl = GitlabProject.URL + "/" + projectId + "/" + GitlabProjectMember.URL + "/" + userId; retrieve().method(DELETE).to(tailUrl, Void.class); }
java
public void deleteProjectMember(Integer projectId, Integer userId) throws IOException { String tailUrl = GitlabProject.URL + "/" + projectId + "/" + GitlabProjectMember.URL + "/" + userId; retrieve().method(DELETE).to(tailUrl, Void.class); }
[ "public", "void", "deleteProjectMember", "(", "Integer", "projectId", ",", "Integer", "userId", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "projectId", "+", "\"/\"", "+", "GitlabProjectMember", "....
Delete a project team member. @param projectId the project id @param userId the user id @throws IOException on gitlab api call error
[ "Delete", "a", "project", "team", "member", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3068-L3071
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java
AbstractHibernateCriteriaBuilder.sqlRestriction
public org.grails.datastore.mapping.query.api.Criteria sqlRestriction(String sqlRestriction) { if (!validateSimpleExpression()) { throwRuntimeException(new IllegalArgumentException("Call to [sqlRestriction] with value [" + sqlRestriction + "] not allowed here.")); } return sqlRestriction(sqlRestriction, Collections.EMPTY_LIST); }
java
public org.grails.datastore.mapping.query.api.Criteria sqlRestriction(String sqlRestriction) { if (!validateSimpleExpression()) { throwRuntimeException(new IllegalArgumentException("Call to [sqlRestriction] with value [" + sqlRestriction + "] not allowed here.")); } return sqlRestriction(sqlRestriction, Collections.EMPTY_LIST); }
[ "public", "org", ".", "grails", ".", "datastore", ".", "mapping", ".", "query", ".", "api", ".", "Criteria", "sqlRestriction", "(", "String", "sqlRestriction", ")", "{", "if", "(", "!", "validateSimpleExpression", "(", ")", ")", "{", "throwRuntimeException", ...
Applies a sql restriction to the results to allow something like: @param sqlRestriction the sql restriction @return a Criteria instance
[ "Applies", "a", "sql", "restriction", "to", "the", "results", "to", "allow", "something", "like", ":" ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L1143-L1149
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/AccountingDate.java
AccountingDate.now
public static AccountingDate now(AccountingChronology chronology, ZoneId zone) { return now(chronology, Clock.system(zone)); }
java
public static AccountingDate now(AccountingChronology chronology, ZoneId zone) { return now(chronology, Clock.system(zone)); }
[ "public", "static", "AccountingDate", "now", "(", "AccountingChronology", "chronology", ",", "ZoneId", "zone", ")", "{", "return", "now", "(", "chronology", ",", "Clock", ".", "system", "(", "zone", ")", ")", ";", "}" ]
Obtains the current {@code AccountingDate} from the system clock in the specified time-zone, translated with the given AccountingChronology. <p> This will query the {@link Clock#system(ZoneId) system clock} to obtain the current date. Specifying the time-zone avoids dependence on the default time-zone. <p> Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded. @param chronology the Accounting chronology to base the date on, not null @param zone the zone ID to use, not null @return the current date using the system clock, not null @throws DateTimeException if the current date cannot be obtained, NullPointerException if an AccountingChronology was not provided
[ "Obtains", "the", "current", "{", "@code", "AccountingDate", "}", "from", "the", "system", "clock", "in", "the", "specified", "time", "-", "zone", "translated", "with", "the", "given", "AccountingChronology", ".", "<p", ">", "This", "will", "query", "the", "...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/AccountingDate.java#L146-L148
alkacon/opencms-core
src/org/opencms/cache/CmsVfsNameBasedDiskCache.java
CmsVfsNameBasedDiskCache.getCacheName
public String getCacheName(CmsResource resource, String parameters) { // calculate the base cache path for the resource String rfsName = m_rfsRepository + resource.getRootPath(); String extension = CmsFileUtil.getExtension(rfsName); // create a StringBuffer for the result StringBuffer buf = new StringBuffer(rfsName.length() + 24); buf.append(rfsName.substring(0, rfsName.length() - extension.length())); // calculate a hash code that contains the resource DateLastModified, DateCreated and Length StringBuffer ext = new StringBuffer(48); ext.append(resource.getDateLastModified()); ext.append(';'); ext.append(resource.getDateCreated()); if (resource.getLength() > 0) { ext.append(';'); ext.append(resource.getLength()); } // append hash code to the result buffer buf.append('_'); buf.append(ext.toString().hashCode()); // check if parameters are provided, if so add them as well if (parameters != null) { buf.append('_'); try { buf.append(DigestUtils.md5Hex(parameters.getBytes("UTF-8"))); } catch (UnsupportedEncodingException e) { // can't happen LOG.error(e.getLocalizedMessage(), e); } } // finally append the extension from the original file name buf.append(extension); return buf.toString(); }
java
public String getCacheName(CmsResource resource, String parameters) { // calculate the base cache path for the resource String rfsName = m_rfsRepository + resource.getRootPath(); String extension = CmsFileUtil.getExtension(rfsName); // create a StringBuffer for the result StringBuffer buf = new StringBuffer(rfsName.length() + 24); buf.append(rfsName.substring(0, rfsName.length() - extension.length())); // calculate a hash code that contains the resource DateLastModified, DateCreated and Length StringBuffer ext = new StringBuffer(48); ext.append(resource.getDateLastModified()); ext.append(';'); ext.append(resource.getDateCreated()); if (resource.getLength() > 0) { ext.append(';'); ext.append(resource.getLength()); } // append hash code to the result buffer buf.append('_'); buf.append(ext.toString().hashCode()); // check if parameters are provided, if so add them as well if (parameters != null) { buf.append('_'); try { buf.append(DigestUtils.md5Hex(parameters.getBytes("UTF-8"))); } catch (UnsupportedEncodingException e) { // can't happen LOG.error(e.getLocalizedMessage(), e); } } // finally append the extension from the original file name buf.append(extension); return buf.toString(); }
[ "public", "String", "getCacheName", "(", "CmsResource", "resource", ",", "String", "parameters", ")", "{", "// calculate the base cache path for the resource", "String", "rfsName", "=", "m_rfsRepository", "+", "resource", ".", "getRootPath", "(", ")", ";", "String", "...
Returns the RFS name to use for caching the given VFS resource with parameters in the disk cache.<p> @param resource the VFS resource to generate the cache name for @param parameters the parameters of the request to the VFS resource @return the RFS name to use for caching the given VFS resource with parameters
[ "Returns", "the", "RFS", "name", "to", "use", "for", "caching", "the", "given", "VFS", "resource", "with", "parameters", "in", "the", "disk", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsNameBasedDiskCache.java#L111-L148
alkacon/opencms-core
src/org/opencms/newsletter/CmsNewsletter.java
CmsNewsletter.replaceMacros
private String replaceMacros(String msg, I_CmsNewsletterRecipient recipient) { CmsMacroResolver resolver = CmsMacroResolver.newInstance(); resolver.addMacro(MACRO_USER_FIRSTNAME, recipient.getFirstname()); resolver.addMacro(MACRO_USER_LASTNAME, recipient.getLastname()); resolver.addMacro(MACRO_USER_FULLNAME, recipient.getFullName()); resolver.addMacro(MACRO_USER_EMAIL, recipient.getEmail()); resolver.addMacro( MACRO_SEND_DATE, DateFormat.getDateTimeInstance().format(new Date(System.currentTimeMillis()))); return resolver.resolveMacros(msg); }
java
private String replaceMacros(String msg, I_CmsNewsletterRecipient recipient) { CmsMacroResolver resolver = CmsMacroResolver.newInstance(); resolver.addMacro(MACRO_USER_FIRSTNAME, recipient.getFirstname()); resolver.addMacro(MACRO_USER_LASTNAME, recipient.getLastname()); resolver.addMacro(MACRO_USER_FULLNAME, recipient.getFullName()); resolver.addMacro(MACRO_USER_EMAIL, recipient.getEmail()); resolver.addMacro( MACRO_SEND_DATE, DateFormat.getDateTimeInstance().format(new Date(System.currentTimeMillis()))); return resolver.resolveMacros(msg); }
[ "private", "String", "replaceMacros", "(", "String", "msg", ",", "I_CmsNewsletterRecipient", "recipient", ")", "{", "CmsMacroResolver", "resolver", "=", "CmsMacroResolver", ".", "newInstance", "(", ")", ";", "resolver", ".", "addMacro", "(", "MACRO_USER_FIRSTNAME", ...
Replaces the macros in the given message.<p> @param msg the message in which the macros are replaced @param recipient the recipient in the message @return the message with the macros replaced
[ "Replaces", "the", "macros", "in", "the", "given", "message", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/newsletter/CmsNewsletter.java#L180-L191
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/type/TypeFrameModelingVisitor.java
TypeFrameModelingVisitor.consumeStack
protected void consumeStack(Instruction ins) { ConstantPoolGen cpg = getCPG(); TypeFrame frame = getFrame(); int numWordsConsumed = ins.consumeStack(cpg); if (numWordsConsumed == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack consumption for " + ins); } if (numWordsConsumed > frame.getStackDepth()) { throw new InvalidBytecodeException("Stack underflow for " + ins + ", " + numWordsConsumed + " needed, " + frame.getStackDepth() + " avail, frame is " + frame); } try { while (numWordsConsumed-- > 0) { frame.popValue(); } } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException("Stack underflow for " + ins + ": " + e.getMessage()); } }
java
protected void consumeStack(Instruction ins) { ConstantPoolGen cpg = getCPG(); TypeFrame frame = getFrame(); int numWordsConsumed = ins.consumeStack(cpg); if (numWordsConsumed == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack consumption for " + ins); } if (numWordsConsumed > frame.getStackDepth()) { throw new InvalidBytecodeException("Stack underflow for " + ins + ", " + numWordsConsumed + " needed, " + frame.getStackDepth() + " avail, frame is " + frame); } try { while (numWordsConsumed-- > 0) { frame.popValue(); } } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException("Stack underflow for " + ins + ": " + e.getMessage()); } }
[ "protected", "void", "consumeStack", "(", "Instruction", "ins", ")", "{", "ConstantPoolGen", "cpg", "=", "getCPG", "(", ")", ";", "TypeFrame", "frame", "=", "getFrame", "(", ")", ";", "int", "numWordsConsumed", "=", "ins", ".", "consumeStack", "(", "cpg", ...
Consume stack. This is a convenience method for instructions where the types of popped operands can be ignored.
[ "Consume", "stack", ".", "This", "is", "a", "convenience", "method", "for", "instructions", "where", "the", "types", "of", "popped", "operands", "can", "be", "ignored", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/type/TypeFrameModelingVisitor.java#L214-L232
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/InputUtils.java
InputUtils.defineOrder
public static void defineOrder(ProcessedInput processedInput, QueryParameters parameters) { String parameterName = null; for (int i = 0; i < processedInput.getAmountOfParameters(); i++) { parameterName = processedInput.getParameterName(i); if (parameterName != null) { parameters.updatePosition(parameterName, i); } } }
java
public static void defineOrder(ProcessedInput processedInput, QueryParameters parameters) { String parameterName = null; for (int i = 0; i < processedInput.getAmountOfParameters(); i++) { parameterName = processedInput.getParameterName(i); if (parameterName != null) { parameters.updatePosition(parameterName, i); } } }
[ "public", "static", "void", "defineOrder", "(", "ProcessedInput", "processedInput", ",", "QueryParameters", "parameters", ")", "{", "String", "parameterName", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "processedInput", ".", "getAmountO...
Defines order of @parameters based on @processedInput @param processedInput InputHandler processedInput @param parameters Query Parameters ordering of which would be updated
[ "Defines", "order", "of", "@parameters", "based", "on", "@processedInput" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/InputUtils.java#L39-L49
alkacon/opencms-core
src/org/opencms/ui/login/CmsLoginHelper.java
CmsLoginHelper.getCookie
protected static Cookie getCookie(HttpServletRequest request, String name) { Cookie[] cookies = request.getCookies(); for (int i = 0; (cookies != null) && (i < cookies.length); i++) { if (name.equalsIgnoreCase(cookies[i].getName())) { return cookies[i]; } } return new Cookie(name, ""); }
java
protected static Cookie getCookie(HttpServletRequest request, String name) { Cookie[] cookies = request.getCookies(); for (int i = 0; (cookies != null) && (i < cookies.length); i++) { if (name.equalsIgnoreCase(cookies[i].getName())) { return cookies[i]; } } return new Cookie(name, ""); }
[ "protected", "static", "Cookie", "getCookie", "(", "HttpServletRequest", "request", ",", "String", "name", ")", "{", "Cookie", "[", "]", "cookies", "=", "request", ".", "getCookies", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "(", "cookies", ...
Returns the cookie with the given name, if not cookie is found a new one is created.<p> @param request the current request @param name the name of the cookie @return the cookie
[ "Returns", "the", "cookie", "with", "the", "given", "name", "if", "not", "cookie", "is", "found", "a", "new", "one", "is", "created", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsLoginHelper.java#L599-L608
febit/wit
wit-core/src/main/java/org/febit/wit/InternalContext.java
InternalContext.getBeanProperty
public <T> Object getBeanProperty(final T bean, final Object property) { if (bean != null) { @SuppressWarnings("unchecked") GetResolver<T> resolver = this.getters.unsafeGet(bean.getClass()); if (resolver != null) { return resolver.get(bean, property); } } return this.resolverManager.get(bean, property); }
java
public <T> Object getBeanProperty(final T bean, final Object property) { if (bean != null) { @SuppressWarnings("unchecked") GetResolver<T> resolver = this.getters.unsafeGet(bean.getClass()); if (resolver != null) { return resolver.get(bean, property); } } return this.resolverManager.get(bean, property); }
[ "public", "<", "T", ">", "Object", "getBeanProperty", "(", "final", "T", "bean", ",", "final", "Object", "property", ")", "{", "if", "(", "bean", "!=", "null", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "GetResolver", "<", "T", ">", ...
Get a bean's property. @param <T> bean type @param bean bean @param property property @return value
[ "Get", "a", "bean", "s", "property", "." ]
train
https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit/InternalContext.java#L255-L264
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.prettyHexDump
public static String prettyHexDump(ByteBuf buffer, int offset, int length) { return HexUtil.prettyHexDump(buffer, offset, length); }
java
public static String prettyHexDump(ByteBuf buffer, int offset, int length) { return HexUtil.prettyHexDump(buffer, offset, length); }
[ "public", "static", "String", "prettyHexDump", "(", "ByteBuf", "buffer", ",", "int", "offset", ",", "int", "length", ")", "{", "return", "HexUtil", ".", "prettyHexDump", "(", "buffer", ",", "offset", ",", "length", ")", ";", "}" ]
Returns a multi-line hexadecimal dump of the specified {@link ByteBuf} that is easy to read by humans, starting at the given {@code offset} using the given {@code length}.
[ "Returns", "a", "multi", "-", "line", "hexadecimal", "dump", "of", "the", "specified", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L918-L920
google/closure-templates
java/src/com/google/template/soy/SoyUtils.java
SoyUtils.parseCompileTimeGlobals
public static ImmutableMap<String, PrimitiveData> parseCompileTimeGlobals(CharSource inputSource) throws IOException { Builder<String, PrimitiveData> compileTimeGlobalsBuilder = ImmutableMap.builder(); ErrorReporter errorReporter = ErrorReporter.exploding(); try (BufferedReader reader = inputSource.openBufferedStream()) { int lineNum = 1; for (String line = reader.readLine(); line != null; line = reader.readLine(), ++lineNum) { if (line.startsWith("//") || line.trim().length() == 0) { continue; } SourceLocation sourceLocation = new SourceLocation("globals", lineNum, 1, lineNum, 1); Matcher matcher = COMPILE_TIME_GLOBAL_LINE.matcher(line); if (!matcher.matches()) { errorReporter.report(sourceLocation, INVALID_FORMAT, line); continue; } String name = matcher.group(1); String valueText = matcher.group(2).trim(); ExprNode valueExpr = SoyFileParser.parseExprOrDie(valueText); // Record error for non-primitives. // TODO: Consider allowing non-primitives (e.g. list/map literals). if (!(valueExpr instanceof PrimitiveNode)) { if (valueExpr instanceof GlobalNode || valueExpr instanceof VarRefNode) { errorReporter.report(sourceLocation, INVALID_VALUE, valueExpr.toSourceString()); } else { errorReporter.report(sourceLocation, NON_PRIMITIVE_VALUE, valueExpr.toSourceString()); } continue; } // Default case. compileTimeGlobalsBuilder.put( name, InternalValueUtils.convertPrimitiveExprToData((PrimitiveNode) valueExpr)); } } return compileTimeGlobalsBuilder.build(); }
java
public static ImmutableMap<String, PrimitiveData> parseCompileTimeGlobals(CharSource inputSource) throws IOException { Builder<String, PrimitiveData> compileTimeGlobalsBuilder = ImmutableMap.builder(); ErrorReporter errorReporter = ErrorReporter.exploding(); try (BufferedReader reader = inputSource.openBufferedStream()) { int lineNum = 1; for (String line = reader.readLine(); line != null; line = reader.readLine(), ++lineNum) { if (line.startsWith("//") || line.trim().length() == 0) { continue; } SourceLocation sourceLocation = new SourceLocation("globals", lineNum, 1, lineNum, 1); Matcher matcher = COMPILE_TIME_GLOBAL_LINE.matcher(line); if (!matcher.matches()) { errorReporter.report(sourceLocation, INVALID_FORMAT, line); continue; } String name = matcher.group(1); String valueText = matcher.group(2).trim(); ExprNode valueExpr = SoyFileParser.parseExprOrDie(valueText); // Record error for non-primitives. // TODO: Consider allowing non-primitives (e.g. list/map literals). if (!(valueExpr instanceof PrimitiveNode)) { if (valueExpr instanceof GlobalNode || valueExpr instanceof VarRefNode) { errorReporter.report(sourceLocation, INVALID_VALUE, valueExpr.toSourceString()); } else { errorReporter.report(sourceLocation, NON_PRIMITIVE_VALUE, valueExpr.toSourceString()); } continue; } // Default case. compileTimeGlobalsBuilder.put( name, InternalValueUtils.convertPrimitiveExprToData((PrimitiveNode) valueExpr)); } } return compileTimeGlobalsBuilder.build(); }
[ "public", "static", "ImmutableMap", "<", "String", ",", "PrimitiveData", ">", "parseCompileTimeGlobals", "(", "CharSource", "inputSource", ")", "throws", "IOException", "{", "Builder", "<", "String", ",", "PrimitiveData", ">", "compileTimeGlobalsBuilder", "=", "Immuta...
Parses a globals file in the format created by {@link #generateCompileTimeGlobalsFile} into a map from global name to primitive value. @param inputSource A source that returns a reader for the globals file. @return The parsed globals map. @throws IOException If an error occurs while reading the globals file. @throws IllegalStateException If the globals file is not in the correct format.
[ "Parses", "a", "globals", "file", "in", "the", "format", "created", "by", "{", "@link", "#generateCompileTimeGlobalsFile", "}", "into", "a", "map", "from", "global", "name", "to", "primitive", "value", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/SoyUtils.java#L96-L138
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.createPrinterGraphicsShapes
public java.awt.Graphics2D createPrinterGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality, PrinterJob printerJob) { return new PdfPrinterGraphics2D(this, width, height, null, true, convertImagesToJPEG, quality, printerJob); }
java
public java.awt.Graphics2D createPrinterGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality, PrinterJob printerJob) { return new PdfPrinterGraphics2D(this, width, height, null, true, convertImagesToJPEG, quality, printerJob); }
[ "public", "java", ".", "awt", ".", "Graphics2D", "createPrinterGraphicsShapes", "(", "float", "width", ",", "float", "height", ",", "boolean", "convertImagesToJPEG", ",", "float", "quality", ",", "PrinterJob", "printerJob", ")", "{", "return", "new", "PdfPrinterGr...
Gets a <CODE>Graphics2D</CODE> to print on. The graphics are translated to PDF commands. @param width @param height @param convertImagesToJPEG @param quality @param printerJob @return a Graphics2D object
[ "Gets", "a", "<CODE", ">", "Graphics2D<", "/", "CODE", ">", "to", "print", "on", ".", "The", "graphics", "are", "translated", "to", "PDF", "commands", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2873-L2875
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/internal/EvaluateVarianceRatioCriteria.java
EvaluateVarianceRatioCriteria.globalCentroid
public static int globalCentroid(Centroid overallCentroid, Relation<? extends NumberVector> rel, List<? extends Cluster<?>> clusters, NumberVector[] centroids, NoiseHandling noiseOption) { int clustercount = 0; Iterator<? extends Cluster<?>> ci = clusters.iterator(); for(int i = 0; ci.hasNext(); i++) { Cluster<?> cluster = ci.next(); if(cluster.size() <= 1 || cluster.isNoise()) { switch(noiseOption){ case IGNORE_NOISE: continue; // Ignore completely case TREAT_NOISE_AS_SINGLETONS: clustercount += cluster.size(); // Update global centroid: for(DBIDIter it = cluster.getIDs().iter(); it.valid(); it.advance()) { overallCentroid.put(rel.get(it)); } continue; // With NEXT cluster. case MERGE_NOISE: break; // Treat as cluster below: } } // Update centroid: assert (centroids[i] != null); overallCentroid.put(centroids[i], cluster.size()); ++clustercount; } return clustercount; }
java
public static int globalCentroid(Centroid overallCentroid, Relation<? extends NumberVector> rel, List<? extends Cluster<?>> clusters, NumberVector[] centroids, NoiseHandling noiseOption) { int clustercount = 0; Iterator<? extends Cluster<?>> ci = clusters.iterator(); for(int i = 0; ci.hasNext(); i++) { Cluster<?> cluster = ci.next(); if(cluster.size() <= 1 || cluster.isNoise()) { switch(noiseOption){ case IGNORE_NOISE: continue; // Ignore completely case TREAT_NOISE_AS_SINGLETONS: clustercount += cluster.size(); // Update global centroid: for(DBIDIter it = cluster.getIDs().iter(); it.valid(); it.advance()) { overallCentroid.put(rel.get(it)); } continue; // With NEXT cluster. case MERGE_NOISE: break; // Treat as cluster below: } } // Update centroid: assert (centroids[i] != null); overallCentroid.put(centroids[i], cluster.size()); ++clustercount; } return clustercount; }
[ "public", "static", "int", "globalCentroid", "(", "Centroid", "overallCentroid", ",", "Relation", "<", "?", "extends", "NumberVector", ">", "rel", ",", "List", "<", "?", "extends", "Cluster", "<", "?", ">", ">", "clusters", ",", "NumberVector", "[", "]", "...
Update the global centroid. @param overallCentroid Centroid to udpate @param rel Data relation @param clusters Clusters @param centroids Cluster centroids @return Number of clusters
[ "Update", "the", "global", "centroid", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/internal/EvaluateVarianceRatioCriteria.java#L190-L216
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java
AbstractPipeline.spliterator
@Override @SuppressWarnings("unchecked") public Spliterator<E_OUT> spliterator() { if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; if (this == sourceStage) { if (sourceStage.sourceSpliterator != null) { @SuppressWarnings("unchecked") Spliterator<E_OUT> s = (Spliterator<E_OUT>) sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; return s; } else if (sourceStage.sourceSupplier != null) { @SuppressWarnings("unchecked") Supplier<Spliterator<E_OUT>> s = (Supplier<Spliterator<E_OUT>>) sourceStage.sourceSupplier; sourceStage.sourceSupplier = null; return lazySpliterator(s); } else { throw new IllegalStateException(MSG_CONSUMED); } } else { return wrap(this, () -> sourceSpliterator(0), isParallel()); } }
java
@Override @SuppressWarnings("unchecked") public Spliterator<E_OUT> spliterator() { if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; if (this == sourceStage) { if (sourceStage.sourceSpliterator != null) { @SuppressWarnings("unchecked") Spliterator<E_OUT> s = (Spliterator<E_OUT>) sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; return s; } else if (sourceStage.sourceSupplier != null) { @SuppressWarnings("unchecked") Supplier<Spliterator<E_OUT>> s = (Supplier<Spliterator<E_OUT>>) sourceStage.sourceSupplier; sourceStage.sourceSupplier = null; return lazySpliterator(s); } else { throw new IllegalStateException(MSG_CONSUMED); } } else { return wrap(this, () -> sourceSpliterator(0), isParallel()); } }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Spliterator", "<", "E_OUT", ">", "spliterator", "(", ")", "{", "if", "(", "linkedOrConsumed", ")", "throw", "new", "IllegalStateException", "(", "MSG_STREAM_LINKED", ")", ";", "linke...
Primitive specialization use co-variant overrides, hence is not final
[ "Primitive", "specialization", "use", "co", "-", "variant", "overrides", "hence", "is", "not", "final" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java#L343-L370
Azure/autorest-clientruntime-for-java
azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java
AzureClient.pollPostOrDeleteAsync
private <T> Observable<PollingState<T>> pollPostOrDeleteAsync(final PollingState<T> pollingState, final Type resourceType) { pollingState.withResourceType(resourceType); pollingState.withSerializerAdapter(restClient().serializerAdapter()); return Observable.just(true) .flatMap(new Func1<Boolean, Observable<PollingState<T>>>() { @Override public Observable<PollingState<T>> call(Boolean aBoolean) { return pollPostOrDeleteSingleAsync(pollingState, resourceType).toObservable(); } }).repeatWhen(new Func1<Observable<? extends Void>, Observable<?>>() { @Override public Observable<?> call(Observable<? extends Void> observable) { return observable.flatMap(new Func1<Void, Observable<Long>>() { @Override public Observable<Long> call(Void aVoid) { return Observable.timer(pollingState.delayInMilliseconds(), TimeUnit.MILLISECONDS, Schedulers.immediate()); } }); } }).takeUntil(new Func1<PollingState<T>, Boolean>() { @Override public Boolean call(PollingState<T> tPollingState) { return pollingState.isStatusTerminal(); } }); }
java
private <T> Observable<PollingState<T>> pollPostOrDeleteAsync(final PollingState<T> pollingState, final Type resourceType) { pollingState.withResourceType(resourceType); pollingState.withSerializerAdapter(restClient().serializerAdapter()); return Observable.just(true) .flatMap(new Func1<Boolean, Observable<PollingState<T>>>() { @Override public Observable<PollingState<T>> call(Boolean aBoolean) { return pollPostOrDeleteSingleAsync(pollingState, resourceType).toObservable(); } }).repeatWhen(new Func1<Observable<? extends Void>, Observable<?>>() { @Override public Observable<?> call(Observable<? extends Void> observable) { return observable.flatMap(new Func1<Void, Observable<Long>>() { @Override public Observable<Long> call(Void aVoid) { return Observable.timer(pollingState.delayInMilliseconds(), TimeUnit.MILLISECONDS, Schedulers.immediate()); } }); } }).takeUntil(new Func1<PollingState<T>, Boolean>() { @Override public Boolean call(PollingState<T> tPollingState) { return pollingState.isStatusTerminal(); } }); }
[ "private", "<", "T", ">", "Observable", "<", "PollingState", "<", "T", ">", ">", "pollPostOrDeleteAsync", "(", "final", "PollingState", "<", "T", ">", "pollingState", ",", "final", "Type", "resourceType", ")", "{", "pollingState", ".", "withResourceType", "(",...
Given a polling state representing state of a POST or DELETE operation, this method returns {@link Observable} object, when subscribed to it, a series of polling will be performed and emits each polling state to downstream. Polling will completes when the operation finish with success, failure or exception. @param pollingState the current polling state @param resourceType the java.lang.reflect.Type of the resource. @param <T> the type of the resource @return the observable of which a subscription will lead multiple polling action.
[ "Given", "a", "polling", "state", "representing", "state", "of", "a", "POST", "or", "DELETE", "operation", "this", "method", "returns", "{", "@link", "Observable", "}", "object", "when", "subscribed", "to", "it", "a", "series", "of", "polling", "will", "be",...
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L452-L478
google/truth
core/src/main/java/com/google/common/truth/Facts.java
Facts.and
Facts and(Facts moreFacts) { return new Facts(Iterables.concat(facts, moreFacts.asIterable())); }
java
Facts and(Facts moreFacts) { return new Facts(Iterables.concat(facts, moreFacts.asIterable())); }
[ "Facts", "and", "(", "Facts", "moreFacts", ")", "{", "return", "new", "Facts", "(", "Iterables", ".", "concat", "(", "facts", ",", "moreFacts", ".", "asIterable", "(", ")", ")", ")", ";", "}" ]
Returns an instance concatenating the facts wrapped by the current instance followed by the given facts.
[ "Returns", "an", "instance", "concatenating", "the", "facts", "wrapped", "by", "the", "current", "instance", "followed", "by", "the", "given", "facts", "." ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Facts.java#L54-L56
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java
Price.createFromGrossAmount
@Nonnull public static Price createFromGrossAmount (@Nonnull final ECurrency eCurrency, @Nonnull final BigDecimal aGrossAmount, @Nonnull final IVATItem aVATItem) { final PerCurrencySettings aPCS = CurrencyHelper.getSettings (eCurrency); return createFromGrossAmount (eCurrency, aGrossAmount, aVATItem, aPCS.getScale (), aPCS.getRoundingMode ()); }
java
@Nonnull public static Price createFromGrossAmount (@Nonnull final ECurrency eCurrency, @Nonnull final BigDecimal aGrossAmount, @Nonnull final IVATItem aVATItem) { final PerCurrencySettings aPCS = CurrencyHelper.getSettings (eCurrency); return createFromGrossAmount (eCurrency, aGrossAmount, aVATItem, aPCS.getScale (), aPCS.getRoundingMode ()); }
[ "@", "Nonnull", "public", "static", "Price", "createFromGrossAmount", "(", "@", "Nonnull", "final", "ECurrency", "eCurrency", ",", "@", "Nonnull", "final", "BigDecimal", "aGrossAmount", ",", "@", "Nonnull", "final", "IVATItem", "aVATItem", ")", "{", "final", "Pe...
Create a price from a gross amount using the scale and rounding mode from the currency. @param eCurrency Currency to use. May not be <code>null</code>. @param aGrossAmount The gross amount to use. May not be <code>null</code>. @param aVATItem The VAT item to use. May not be <code>null</code>. @return The created {@link Price}
[ "Create", "a", "price", "from", "a", "gross", "amount", "using", "the", "scale", "and", "rounding", "mode", "from", "the", "currency", "." ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java#L264-L271
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/forms/layout/FormSpec.java
FormSpec.parseAtomicSize
private Size parseAtomicSize(String token) { String trimmedToken = token.trim(); if (trimmedToken.startsWith("'") && trimmedToken.endsWith("'")) { int length = trimmedToken.length(); if (length < 2) { throw new IllegalArgumentException("Missing closing \"'\" for prototype."); } return new PrototypeSize(trimmedToken.substring(1, length - 1)); } Sizes.ComponentSize componentSize = Sizes.ComponentSize.valueOf(trimmedToken); if (componentSize != null) { return componentSize; } return ConstantSize.valueOf(trimmedToken, isHorizontal()); }
java
private Size parseAtomicSize(String token) { String trimmedToken = token.trim(); if (trimmedToken.startsWith("'") && trimmedToken.endsWith("'")) { int length = trimmedToken.length(); if (length < 2) { throw new IllegalArgumentException("Missing closing \"'\" for prototype."); } return new PrototypeSize(trimmedToken.substring(1, length - 1)); } Sizes.ComponentSize componentSize = Sizes.ComponentSize.valueOf(trimmedToken); if (componentSize != null) { return componentSize; } return ConstantSize.valueOf(trimmedToken, isHorizontal()); }
[ "private", "Size", "parseAtomicSize", "(", "String", "token", ")", "{", "String", "trimmedToken", "=", "token", ".", "trim", "(", ")", ";", "if", "(", "trimmedToken", ".", "startsWith", "(", "\"'\"", ")", "&&", "trimmedToken", ".", "endsWith", "(", "\"'\""...
Decodes and returns an atomic size that is either a constant size or a component size. @param token the encoded size @return the decoded size either a constant or component size
[ "Decodes", "and", "returns", "an", "atomic", "size", "that", "is", "either", "a", "constant", "size", "or", "a", "component", "size", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormSpec.java#L364-L378
magro/memcached-session-manager
core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSession.java
MemcachedBackupSession.getMemcachedExpirationTime
int getMemcachedExpirationTime() { if ( !_sticky ) { throw new IllegalStateException( "The memcached expiration time cannot be determined in non-sticky mode." ); } if ( _lastMemcachedExpirationTime == 0 ) { return 0; } final long timeIdleInMillis = _lastBackupTime == 0 ? 0 : System.currentTimeMillis() - _lastBackupTime; /* rounding is just for tests, as they are using actually seconds for testing. * with a default setup 1 second difference wouldn't matter... */ final int timeIdle = Math.round( (float)timeIdleInMillis / 1000L ); final int expirationTime = _lastMemcachedExpirationTime - timeIdle; /* prevent negative expiration times. * because 0 means no expiration at all, we use 1 as min value here */ return max(1, expirationTime); }
java
int getMemcachedExpirationTime() { if ( !_sticky ) { throw new IllegalStateException( "The memcached expiration time cannot be determined in non-sticky mode." ); } if ( _lastMemcachedExpirationTime == 0 ) { return 0; } final long timeIdleInMillis = _lastBackupTime == 0 ? 0 : System.currentTimeMillis() - _lastBackupTime; /* rounding is just for tests, as they are using actually seconds for testing. * with a default setup 1 second difference wouldn't matter... */ final int timeIdle = Math.round( (float)timeIdleInMillis / 1000L ); final int expirationTime = _lastMemcachedExpirationTime - timeIdle; /* prevent negative expiration times. * because 0 means no expiration at all, we use 1 as min value here */ return max(1, expirationTime); }
[ "int", "getMemcachedExpirationTime", "(", ")", "{", "if", "(", "!", "_sticky", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The memcached expiration time cannot be determined in non-sticky mode.\"", ")", ";", "}", "if", "(", "_lastMemcachedExpirationTime", "...
Gets the time in seconds when this session will expire in memcached. If the session was stored in memcached with expiration 0 this method will just return 0. @return the time in seconds
[ "Gets", "the", "time", "in", "seconds", "when", "this", "session", "will", "expire", "in", "memcached", ".", "If", "the", "session", "was", "stored", "in", "memcached", "with", "expiration", "0", "this", "method", "will", "just", "return", "0", "." ]
train
https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSession.java#L312-L330
alkacon/opencms-core
src-gwt/org/opencms/ade/publish/client/CmsPublishSelectPanel.java
CmsPublishSelectPanel.setGroupList
public void setGroupList(CmsPublishGroupList groups, boolean newData, String defaultWorkflow) { if (groups.getToken() == null) { setGroups(groups.getGroups(), newData, defaultWorkflow); setShowResources(true, ""); } else { setShowResources(false, groups.getTooManyResourcesMessage()); } boolean isDirectPublish = m_publishDialog.getPublishOptions().getProjectId().equals(m_directPublishId); m_checkboxAddContents.setVisible(isDirectPublish); }
java
public void setGroupList(CmsPublishGroupList groups, boolean newData, String defaultWorkflow) { if (groups.getToken() == null) { setGroups(groups.getGroups(), newData, defaultWorkflow); setShowResources(true, ""); } else { setShowResources(false, groups.getTooManyResourcesMessage()); } boolean isDirectPublish = m_publishDialog.getPublishOptions().getProjectId().equals(m_directPublishId); m_checkboxAddContents.setVisible(isDirectPublish); }
[ "public", "void", "setGroupList", "(", "CmsPublishGroupList", "groups", ",", "boolean", "newData", ",", "String", "defaultWorkflow", ")", "{", "if", "(", "groups", ".", "getToken", "(", ")", "==", "null", ")", "{", "setGroups", "(", "groups", ".", "getGroups...
Sets the publish groups used by this widget.<p> @param groups the new publish groups @param newData true if the groups are new data which has been loaded @param defaultWorkflow if not null, selects the given workflow
[ "Sets", "the", "publish", "groups", "used", "by", "this", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsPublishSelectPanel.java#L655-L665
probedock/probedock-java
src/main/java/io/probedock/client/common/model/v1/ModelFactory.java
ModelFactory.createFingerprint
public static String createFingerprint(Class cl, Method m) { return FingerprintGenerator.fingerprint(cl, m); }
java
public static String createFingerprint(Class cl, Method m) { return FingerprintGenerator.fingerprint(cl, m); }
[ "public", "static", "String", "createFingerprint", "(", "Class", "cl", ",", "Method", "m", ")", "{", "return", "FingerprintGenerator", ".", "fingerprint", "(", "cl", ",", "m", ")", ";", "}" ]
Create fingerprint for java test method @param cl The test class @param m The test method @return The fingerprint generated
[ "Create", "fingerprint", "for", "java", "test", "method" ]
train
https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/common/model/v1/ModelFactory.java#L32-L34
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/util/ArgUtils.java
ArgUtils.notEmpty
public static void notEmpty(final Object[] arg, final String name) { if(arg == null) { throw new NullPointerException(String.format("%s should not be null.", name)); } if(arg.length == 0) { throw new IllegalArgumentException(String.format("%s should has length ararys.", name)); } }
java
public static void notEmpty(final Object[] arg, final String name) { if(arg == null) { throw new NullPointerException(String.format("%s should not be null.", name)); } if(arg.length == 0) { throw new IllegalArgumentException(String.format("%s should has length ararys.", name)); } }
[ "public", "static", "void", "notEmpty", "(", "final", "Object", "[", "]", "arg", ",", "final", "String", "name", ")", "{", "if", "(", "arg", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "String", ".", "format", "(", "\"%s should n...
配列のサイズが0または、nullでないかどうか検証する。 @param arg 検証対象の値 @param name 検証対象の引数の名前 @throws NullPointerException {@literal arg == null} @throws IllegalArgumentException {@literal arg.length == 0.}
[ "配列のサイズが0または、nullでないかどうか検証する。" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/util/ArgUtils.java#L51-L59
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.rotateXYZ
public Matrix4d rotateXYZ(Vector3d angles) { return rotateXYZ(angles.x, angles.y, angles.z); }
java
public Matrix4d rotateXYZ(Vector3d angles) { return rotateXYZ(angles.x, angles.y, angles.z); }
[ "public", "Matrix4d", "rotateXYZ", "(", "Vector3d", "angles", ")", "{", "return", "rotateXYZ", "(", "angles", ".", "x", ",", "angles", ".", "y", ",", "angles", ".", "z", ")", ";", "}" ]
Apply rotation of <code>angles.x</code> radians about the X axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and followed by a rotation of <code>angles.z</code> radians about the Z axis. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> This method is equivalent to calling: <code>rotateX(angles.x).rotateY(angles.y).rotateZ(angles.z)</code> @param angles the Euler angles @return this
[ "Apply", "rotation", "of", "<code", ">", "angles", ".", "x<", "/", "code", ">", "radians", "about", "the", "X", "axis", "followed", "by", "a", "rotation", "of", "<code", ">", "angles", ".", "y<", "/", "code", ">", "radians", "about", "the", "Y", "axi...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L6255-L6257
apereo/cas
webapp/cas-server-webapp-config/src/main/java/org/apereo/cas/web/security/CasWebSecurityConfigurerAdapter.java
CasWebSecurityConfigurerAdapter.configureLdapAuthenticationProvider
protected void configureLdapAuthenticationProvider(final AuthenticationManagerBuilder auth, final MonitorProperties.Endpoints.LdapSecurity ldap) { if (isLdapAuthorizationActive()) { val p = new MonitorEndpointLdapAuthenticationProvider(ldap, securityProperties); auth.authenticationProvider(p); } else { LOGGER.trace("LDAP authorization is undefined, given no LDAP url, base-dn, search filter or role/group filter is configured"); } }
java
protected void configureLdapAuthenticationProvider(final AuthenticationManagerBuilder auth, final MonitorProperties.Endpoints.LdapSecurity ldap) { if (isLdapAuthorizationActive()) { val p = new MonitorEndpointLdapAuthenticationProvider(ldap, securityProperties); auth.authenticationProvider(p); } else { LOGGER.trace("LDAP authorization is undefined, given no LDAP url, base-dn, search filter or role/group filter is configured"); } }
[ "protected", "void", "configureLdapAuthenticationProvider", "(", "final", "AuthenticationManagerBuilder", "auth", ",", "final", "MonitorProperties", ".", "Endpoints", ".", "LdapSecurity", "ldap", ")", "{", "if", "(", "isLdapAuthorizationActive", "(", ")", ")", "{", "v...
Configure ldap authentication provider. @param auth the auth @param ldap the ldap
[ "Configure", "ldap", "authentication", "provider", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/webapp/cas-server-webapp-config/src/main/java/org/apereo/cas/web/security/CasWebSecurityConfigurerAdapter.java#L142-L149
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setBaselineDurationText
public void setBaselineDurationText(int baselineNumber, String value) { set(selectField(TaskFieldLists.BASELINE_DURATIONS, baselineNumber), value); }
java
public void setBaselineDurationText(int baselineNumber, String value) { set(selectField(TaskFieldLists.BASELINE_DURATIONS, baselineNumber), value); }
[ "public", "void", "setBaselineDurationText", "(", "int", "baselineNumber", ",", "String", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "BASELINE_DURATIONS", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Sets the baseline duration text value. @param baselineNumber baseline number @param value baseline duration text value
[ "Sets", "the", "baseline", "duration", "text", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4088-L4091
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ScoreNode.java
ScoreNode.getDoc
public int getDoc(IndexReader reader) throws IOException { if (doc == -1) { TermDocs docs = reader.termDocs(new Term(FieldNames.UUID, id.toString())); try { if (docs.next()) { return docs.doc(); } else { throw new IOException("Node with id " + id + " not found in index"); } } finally { docs.close(); } } else { return doc; } }
java
public int getDoc(IndexReader reader) throws IOException { if (doc == -1) { TermDocs docs = reader.termDocs(new Term(FieldNames.UUID, id.toString())); try { if (docs.next()) { return docs.doc(); } else { throw new IOException("Node with id " + id + " not found in index"); } } finally { docs.close(); } } else { return doc; } }
[ "public", "int", "getDoc", "(", "IndexReader", "reader", ")", "throws", "IOException", "{", "if", "(", "doc", "==", "-", "1", ")", "{", "TermDocs", "docs", "=", "reader", ".", "termDocs", "(", "new", "Term", "(", "FieldNames", ".", "UUID", ",", "id", ...
Returns the document number for this score node. @param reader the current index reader to look up the document if needed. @return the document number. @throws IOException if an error occurs while reading from the index or the node is not present in the index.
[ "Returns", "the", "document", "number", "for", "this", "score", "node", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ScoreNode.java#L93-L108
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/TypeCache.java
TypeCache.findOrInsert
public Class<?> findOrInsert(ClassLoader classLoader, T key, Callable<Class<?>> lazy) { Class<?> type = find(classLoader, key); if (type != null) { return type; } else { try { return insert(classLoader, key, lazy.call()); } catch (Throwable throwable) { throw new IllegalArgumentException("Could not create type", throwable); } } }
java
public Class<?> findOrInsert(ClassLoader classLoader, T key, Callable<Class<?>> lazy) { Class<?> type = find(classLoader, key); if (type != null) { return type; } else { try { return insert(classLoader, key, lazy.call()); } catch (Throwable throwable) { throw new IllegalArgumentException("Could not create type", throwable); } } }
[ "public", "Class", "<", "?", ">", "findOrInsert", "(", "ClassLoader", "classLoader", ",", "T", "key", ",", "Callable", "<", "Class", "<", "?", ">", ">", "lazy", ")", "{", "Class", "<", "?", ">", "type", "=", "find", "(", "classLoader", ",", "key", ...
Finds an existing type or inserts a new one if the previous type was not found. @param classLoader The class loader for which this type is stored. @param key The key for the type in question. @param lazy A lazy creator for the type to insert of no previous type was stored in the cache. @return The lazily created type or a previously submitted type for the same class loader and key combination.
[ "Finds", "an", "existing", "type", "or", "inserts", "a", "new", "one", "if", "the", "previous", "type", "was", "not", "found", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/TypeCache.java#L146-L157
aol/cyclops
cyclops/src/main/java/cyclops/function/Predicates.java
Predicates.iterablePresent
public static <T> Predicate<T> iterablePresent() { return t -> t instanceof Iterable ? ((Iterable) t).iterator() .hasNext() : false; }
java
public static <T> Predicate<T> iterablePresent() { return t -> t instanceof Iterable ? ((Iterable) t).iterator() .hasNext() : false; }
[ "public", "static", "<", "T", ">", "Predicate", "<", "T", ">", "iterablePresent", "(", ")", "{", "return", "t", "->", "t", "instanceof", "Iterable", "?", "(", "(", "Iterable", ")", "t", ")", ".", "iterator", "(", ")", ".", "hasNext", "(", ")", ":",...
<pre> {@code import static cyclops2.function.Predicates.valuePresent; Seq.of(Arrays.asList(),Arrays.asList(1),null) .filter(iterablePresent()); //Seq[List[1]] } </pre> @return A Predicate that checks if it's input is an Iterable with at least one value
[ "<pre", ">", "{", "@code", "import", "static", "cyclops2", ".", "function", ".", "Predicates", ".", "valuePresent", ";" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/Predicates.java#L138-L142
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java
GeneratedDOAuth2UserDaoImpl.queryByThumbnailUrl
public Iterable<DOAuth2User> queryByThumbnailUrl(java.lang.String thumbnailUrl) { return queryByField(null, DOAuth2UserMapper.Field.THUMBNAILURL.getFieldName(), thumbnailUrl); }
java
public Iterable<DOAuth2User> queryByThumbnailUrl(java.lang.String thumbnailUrl) { return queryByField(null, DOAuth2UserMapper.Field.THUMBNAILURL.getFieldName(), thumbnailUrl); }
[ "public", "Iterable", "<", "DOAuth2User", ">", "queryByThumbnailUrl", "(", "java", ".", "lang", ".", "String", "thumbnailUrl", ")", "{", "return", "queryByField", "(", "null", ",", "DOAuth2UserMapper", ".", "Field", ".", "THUMBNAILURL", ".", "getFieldName", "(",...
query-by method for field thumbnailUrl @param thumbnailUrl the specified attribute @return an Iterable of DOAuth2Users for the specified thumbnailUrl
[ "query", "-", "by", "method", "for", "field", "thumbnailUrl" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java#L133-L135