repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java
DefaultComparisonFormatter.appendDocumentType
protected boolean appendDocumentType(StringBuilder sb, DocumentType type) { """ Appends the XML DOCTYPE for {@link #getShortString} or {@link #appendFullDocumentHeader} if present. @param sb the builder to append to @param type the document type @return true if the DOCTPYE has been appended @since XMLUnit 2.4.0 """ if (type == null) { return false; } sb.append("<!DOCTYPE ").append(type.getName()); boolean hasNoPublicId = true; if (type.getPublicId() != null && type.getPublicId().length() > 0) { sb.append(" PUBLIC \"").append(type.getPublicId()).append('"'); hasNoPublicId = false; } if (type.getSystemId() != null && type.getSystemId().length() > 0) { if (hasNoPublicId) { sb.append(" SYSTEM"); } sb.append(" \"").append(type.getSystemId()).append("\""); } sb.append(">"); return true; }
java
protected boolean appendDocumentType(StringBuilder sb, DocumentType type) { if (type == null) { return false; } sb.append("<!DOCTYPE ").append(type.getName()); boolean hasNoPublicId = true; if (type.getPublicId() != null && type.getPublicId().length() > 0) { sb.append(" PUBLIC \"").append(type.getPublicId()).append('"'); hasNoPublicId = false; } if (type.getSystemId() != null && type.getSystemId().length() > 0) { if (hasNoPublicId) { sb.append(" SYSTEM"); } sb.append(" \"").append(type.getSystemId()).append("\""); } sb.append(">"); return true; }
[ "protected", "boolean", "appendDocumentType", "(", "StringBuilder", "sb", ",", "DocumentType", "type", ")", "{", "if", "(", "type", "==", "null", ")", "{", "return", "false", ";", "}", "sb", ".", "append", "(", "\"<!DOCTYPE \"", ")", ".", "append", "(", "type", ".", "getName", "(", ")", ")", ";", "boolean", "hasNoPublicId", "=", "true", ";", "if", "(", "type", ".", "getPublicId", "(", ")", "!=", "null", "&&", "type", ".", "getPublicId", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "sb", ".", "append", "(", "\" PUBLIC \\\"\"", ")", ".", "append", "(", "type", ".", "getPublicId", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "hasNoPublicId", "=", "false", ";", "}", "if", "(", "type", ".", "getSystemId", "(", ")", "!=", "null", "&&", "type", ".", "getSystemId", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "hasNoPublicId", ")", "{", "sb", ".", "append", "(", "\" SYSTEM\"", ")", ";", "}", "sb", ".", "append", "(", "\" \\\"\"", ")", ".", "append", "(", "type", ".", "getSystemId", "(", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "}", "sb", ".", "append", "(", "\">\"", ")", ";", "return", "true", ";", "}" ]
Appends the XML DOCTYPE for {@link #getShortString} or {@link #appendFullDocumentHeader} if present. @param sb the builder to append to @param type the document type @return true if the DOCTPYE has been appended @since XMLUnit 2.4.0
[ "Appends", "the", "XML", "DOCTYPE", "for", "{", "@link", "#getShortString", "}", "or", "{", "@link", "#appendFullDocumentHeader", "}", "if", "present", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L220-L238
konvergeio/cofoja
src/main/java/com/google/java/contract/util/Predicates.java
Predicates.allEntries
public static <K, V> Predicate<Map<K, V>> allEntries( Predicate<? super Map.Entry<K, V>> p) { """ Returns a predicate that applies {@code all(p)} to the entries of its argument. """ return forEntries(Predicates.<Map.Entry<K, V>>all(p)); }
java
public static <K, V> Predicate<Map<K, V>> allEntries( Predicate<? super Map.Entry<K, V>> p) { return forEntries(Predicates.<Map.Entry<K, V>>all(p)); }
[ "public", "static", "<", "K", ",", "V", ">", "Predicate", "<", "Map", "<", "K", ",", "V", ">", ">", "allEntries", "(", "Predicate", "<", "?", "super", "Map", ".", "Entry", "<", "K", ",", "V", ">", ">", "p", ")", "{", "return", "forEntries", "(", "Predicates", ".", "<", "Map", ".", "Entry", "<", "K", ",", "V", ">", ">", "all", "(", "p", ")", ")", ";", "}" ]
Returns a predicate that applies {@code all(p)} to the entries of its argument.
[ "Returns", "a", "predicate", "that", "applies", "{" ]
train
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/util/Predicates.java#L307-L310
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java
Collections.anyWithin
public static SatisfiesBuilder anyWithin(String variable, Expression expression) { """ Create an ANY comprehension with a first WITHIN range. ANY is a range predicate that allows you to test a Boolean condition over the elements or attributes of a collection, object, or objects. It uses the IN and WITHIN operators to range through the collection. IN ranges in the direct elements of its array expression, WITHIN also ranges in its descendants. If at least one item in the array satisfies the ANY expression, then ANY returns TRUE, otherwise returns FALSE. """ return new SatisfiesBuilder(x("ANY"), variable, expression, false); }
java
public static SatisfiesBuilder anyWithin(String variable, Expression expression) { return new SatisfiesBuilder(x("ANY"), variable, expression, false); }
[ "public", "static", "SatisfiesBuilder", "anyWithin", "(", "String", "variable", ",", "Expression", "expression", ")", "{", "return", "new", "SatisfiesBuilder", "(", "x", "(", "\"ANY\"", ")", ",", "variable", ",", "expression", ",", "false", ")", ";", "}" ]
Create an ANY comprehension with a first WITHIN range. ANY is a range predicate that allows you to test a Boolean condition over the elements or attributes of a collection, object, or objects. It uses the IN and WITHIN operators to range through the collection. IN ranges in the direct elements of its array expression, WITHIN also ranges in its descendants. If at least one item in the array satisfies the ANY expression, then ANY returns TRUE, otherwise returns FALSE.
[ "Create", "an", "ANY", "comprehension", "with", "a", "first", "WITHIN", "range", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L184-L186
JodaOrg/joda-time
src/main/java/org/joda/time/Duration.java
Duration.withDurationAdded
public Duration withDurationAdded(long durationToAdd, int scalar) { """ Returns a new duration with this length plus that specified multiplied by the scalar. This instance is immutable and is not altered. <p> If the addition is zero, this instance is returned. @param durationToAdd the duration to add to this one @param scalar the amount of times to add, such as -1 to subtract once @return the new duration instance """ if (durationToAdd == 0 || scalar == 0) { return this; } long add = FieldUtils.safeMultiply(durationToAdd, scalar); long duration = FieldUtils.safeAdd(getMillis(), add); return new Duration(duration); }
java
public Duration withDurationAdded(long durationToAdd, int scalar) { if (durationToAdd == 0 || scalar == 0) { return this; } long add = FieldUtils.safeMultiply(durationToAdd, scalar); long duration = FieldUtils.safeAdd(getMillis(), add); return new Duration(duration); }
[ "public", "Duration", "withDurationAdded", "(", "long", "durationToAdd", ",", "int", "scalar", ")", "{", "if", "(", "durationToAdd", "==", "0", "||", "scalar", "==", "0", ")", "{", "return", "this", ";", "}", "long", "add", "=", "FieldUtils", ".", "safeMultiply", "(", "durationToAdd", ",", "scalar", ")", ";", "long", "duration", "=", "FieldUtils", ".", "safeAdd", "(", "getMillis", "(", ")", ",", "add", ")", ";", "return", "new", "Duration", "(", "duration", ")", ";", "}" ]
Returns a new duration with this length plus that specified multiplied by the scalar. This instance is immutable and is not altered. <p> If the addition is zero, this instance is returned. @param durationToAdd the duration to add to this one @param scalar the amount of times to add, such as -1 to subtract once @return the new duration instance
[ "Returns", "a", "new", "duration", "with", "this", "length", "plus", "that", "specified", "multiplied", "by", "the", "scalar", ".", "This", "instance", "is", "immutable", "and", "is", "not", "altered", ".", "<p", ">", "If", "the", "addition", "is", "zero", "this", "instance", "is", "returned", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Duration.java#L390-L397
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java
PathfindableModel.checkObjectId
private boolean checkObjectId(int dtx, int dty) { """ Check if the object id location is available for the pathfindable. @param dtx The tile horizontal destination. @param dty The tile vertical destination. @return <code>true</code> if available, <code>false</code> else. """ final int tw = transformable.getWidth() / map.getTileWidth(); final int th = transformable.getHeight() / map.getTileHeight(); for (int tx = dtx; tx < dtx + tw; tx++) { for (int ty = dty; ty < dty + th; ty++) { final Collection<Integer> ids = mapPath.getObjectsId(tx, ty); if (!ids.isEmpty() && !ids.contains(id)) { return false; } } } return mapPath.isAreaAvailable(this, dtx, dty, tw, th, id); }
java
private boolean checkObjectId(int dtx, int dty) { final int tw = transformable.getWidth() / map.getTileWidth(); final int th = transformable.getHeight() / map.getTileHeight(); for (int tx = dtx; tx < dtx + tw; tx++) { for (int ty = dty; ty < dty + th; ty++) { final Collection<Integer> ids = mapPath.getObjectsId(tx, ty); if (!ids.isEmpty() && !ids.contains(id)) { return false; } } } return mapPath.isAreaAvailable(this, dtx, dty, tw, th, id); }
[ "private", "boolean", "checkObjectId", "(", "int", "dtx", ",", "int", "dty", ")", "{", "final", "int", "tw", "=", "transformable", ".", "getWidth", "(", ")", "/", "map", ".", "getTileWidth", "(", ")", ";", "final", "int", "th", "=", "transformable", ".", "getHeight", "(", ")", "/", "map", ".", "getTileHeight", "(", ")", ";", "for", "(", "int", "tx", "=", "dtx", ";", "tx", "<", "dtx", "+", "tw", ";", "tx", "++", ")", "{", "for", "(", "int", "ty", "=", "dty", ";", "ty", "<", "dty", "+", "th", ";", "ty", "++", ")", "{", "final", "Collection", "<", "Integer", ">", "ids", "=", "mapPath", ".", "getObjectsId", "(", "tx", ",", "ty", ")", ";", "if", "(", "!", "ids", ".", "isEmpty", "(", ")", "&&", "!", "ids", ".", "contains", "(", "id", ")", ")", "{", "return", "false", ";", "}", "}", "}", "return", "mapPath", ".", "isAreaAvailable", "(", "this", ",", "dtx", ",", "dty", ",", "tw", ",", "th", ",", "id", ")", ";", "}" ]
Check if the object id location is available for the pathfindable. @param dtx The tile horizontal destination. @param dty The tile vertical destination. @return <code>true</code> if available, <code>false</code> else.
[ "Check", "if", "the", "object", "id", "location", "is", "available", "for", "the", "pathfindable", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java#L434-L450
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.deleteAllToCacheWriter
private @Nullable CacheWriterException deleteAllToCacheWriter(Set<? extends K> keys) { """ Deletes all of the entries using the cache writer, retaining only the keys that succeeded. """ if (!configuration.isWriteThrough() || keys.isEmpty()) { return null; } List<K> keysToDelete = new ArrayList<>(keys); try { writer.deleteAll(keysToDelete); return null; } catch (CacheWriterException e) { keys.removeAll(keysToDelete); throw e; } catch (RuntimeException e) { keys.removeAll(keysToDelete); return new CacheWriterException("Exception in CacheWriter", e); } }
java
private @Nullable CacheWriterException deleteAllToCacheWriter(Set<? extends K> keys) { if (!configuration.isWriteThrough() || keys.isEmpty()) { return null; } List<K> keysToDelete = new ArrayList<>(keys); try { writer.deleteAll(keysToDelete); return null; } catch (CacheWriterException e) { keys.removeAll(keysToDelete); throw e; } catch (RuntimeException e) { keys.removeAll(keysToDelete); return new CacheWriterException("Exception in CacheWriter", e); } }
[ "private", "@", "Nullable", "CacheWriterException", "deleteAllToCacheWriter", "(", "Set", "<", "?", "extends", "K", ">", "keys", ")", "{", "if", "(", "!", "configuration", ".", "isWriteThrough", "(", ")", "||", "keys", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "List", "<", "K", ">", "keysToDelete", "=", "new", "ArrayList", "<>", "(", "keys", ")", ";", "try", "{", "writer", ".", "deleteAll", "(", "keysToDelete", ")", ";", "return", "null", ";", "}", "catch", "(", "CacheWriterException", "e", ")", "{", "keys", ".", "removeAll", "(", "keysToDelete", ")", ";", "throw", "e", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "keys", ".", "removeAll", "(", "keysToDelete", ")", ";", "return", "new", "CacheWriterException", "(", "\"Exception in CacheWriter\"", ",", "e", ")", ";", "}", "}" ]
Deletes all of the entries using the cache writer, retaining only the keys that succeeded.
[ "Deletes", "all", "of", "the", "entries", "using", "the", "cache", "writer", "retaining", "only", "the", "keys", "that", "succeeded", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L1032-L1047
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/client/WorldState.java
WorldState.addState
public void addState(final String id, final Collection<Attribute> attributes) { """ Binds a set of Attribute values to an identifier. @param id the identifier @param attributes the set of attributes. """ this.stateMap.put(id, attributes); }
java
public void addState(final String id, final Collection<Attribute> attributes) { this.stateMap.put(id, attributes); }
[ "public", "void", "addState", "(", "final", "String", "id", ",", "final", "Collection", "<", "Attribute", ">", "attributes", ")", "{", "this", ".", "stateMap", ".", "put", "(", "id", ",", "attributes", ")", ";", "}" ]
Binds a set of Attribute values to an identifier. @param id the identifier @param attributes the set of attributes.
[ "Binds", "a", "set", "of", "Attribute", "values", "to", "an", "identifier", "." ]
train
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/client/WorldState.java#L50-L52
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.deleteWhitespace
public static String deleteWhitespace(final String str) { """ <p> Deletes all white spaces from a String as defined by {@link Character#isWhitespace(char)}. </p> <pre> N.deleteWhitespace(null) = null N.deleteWhitespace("") = "" N.deleteWhitespace("abc") = "abc" N.deleteWhitespace(" ab c ") = "abc" </pre> @param str the String to delete whitespace from, may be null @return the String without whitespaces, {@code null} if null String input """ if (N.isNullOrEmpty(str)) { return str; } final char[] chars = getCharsForReadOnly(str); final char[] cbuf = new char[chars.length]; int count = 0; for (int i = 0, len = chars.length; i < len; i++) { if (!Character.isWhitespace(chars[i])) { cbuf[count++] = chars[i]; } } return count == chars.length ? str : new String(cbuf, 0, count); }
java
public static String deleteWhitespace(final String str) { if (N.isNullOrEmpty(str)) { return str; } final char[] chars = getCharsForReadOnly(str); final char[] cbuf = new char[chars.length]; int count = 0; for (int i = 0, len = chars.length; i < len; i++) { if (!Character.isWhitespace(chars[i])) { cbuf[count++] = chars[i]; } } return count == chars.length ? str : new String(cbuf, 0, count); }
[ "public", "static", "String", "deleteWhitespace", "(", "final", "String", "str", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "str", ")", ")", "{", "return", "str", ";", "}", "final", "char", "[", "]", "chars", "=", "getCharsForReadOnly", "(", "str", ")", ";", "final", "char", "[", "]", "cbuf", "=", "new", "char", "[", "chars", ".", "length", "]", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "len", "=", "chars", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "!", "Character", ".", "isWhitespace", "(", "chars", "[", "i", "]", ")", ")", "{", "cbuf", "[", "count", "++", "]", "=", "chars", "[", "i", "]", ";", "}", "}", "return", "count", "==", "chars", ".", "length", "?", "str", ":", "new", "String", "(", "cbuf", ",", "0", ",", "count", ")", ";", "}" ]
<p> Deletes all white spaces from a String as defined by {@link Character#isWhitespace(char)}. </p> <pre> N.deleteWhitespace(null) = null N.deleteWhitespace("") = "" N.deleteWhitespace("abc") = "abc" N.deleteWhitespace(" ab c ") = "abc" </pre> @param str the String to delete whitespace from, may be null @return the String without whitespaces, {@code null} if null String input
[ "<p", ">", "Deletes", "all", "white", "spaces", "from", "a", "String", "as", "defined", "by", "{", "@link", "Character#isWhitespace", "(", "char", ")", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L2246-L2261
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java
XBaseGridScreen.printEndRecordData
public void printEndRecordData(Rec record, PrintWriter out, int iPrintOptions) { """ Display the end record in input format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception. """ String strRecordName = record.getTableNames(false); if ((strRecordName == null) || (strRecordName.length() == 0)) strRecordName = "Record"; out.println(Utility.endTag(strRecordName)); }
java
public void printEndRecordData(Rec record, PrintWriter out, int iPrintOptions) { String strRecordName = record.getTableNames(false); if ((strRecordName == null) || (strRecordName.length() == 0)) strRecordName = "Record"; out.println(Utility.endTag(strRecordName)); }
[ "public", "void", "printEndRecordData", "(", "Rec", "record", ",", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "String", "strRecordName", "=", "record", ".", "getTableNames", "(", "false", ")", ";", "if", "(", "(", "strRecordName", "==", "null", ")", "||", "(", "strRecordName", ".", "length", "(", ")", "==", "0", ")", ")", "strRecordName", "=", "\"Record\"", ";", "out", ".", "println", "(", "Utility", ".", "endTag", "(", "strRecordName", ")", ")", ";", "}" ]
Display the end record in input format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception.
[ "Display", "the", "end", "record", "in", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java#L223-L229
perwendel/spark
src/main/java/spark/serialization/Serializer.java
Serializer.processElement
public void processElement(OutputStream outputStream, Object element) throws IOException { """ Wraps {@link Serializer#process(java.io.OutputStream, Object)} and calls next serializer in chain. @param outputStream the output stream. @param element the element to process. @throws IOException IOException in case of IO error. """ if (canProcess(element)) { process(outputStream, element); } else { if (next != null) { this.next.processElement(outputStream, element); } } }
java
public void processElement(OutputStream outputStream, Object element) throws IOException { if (canProcess(element)) { process(outputStream, element); } else { if (next != null) { this.next.processElement(outputStream, element); } } }
[ "public", "void", "processElement", "(", "OutputStream", "outputStream", ",", "Object", "element", ")", "throws", "IOException", "{", "if", "(", "canProcess", "(", "element", ")", ")", "{", "process", "(", "outputStream", ",", "element", ")", ";", "}", "else", "{", "if", "(", "next", "!=", "null", ")", "{", "this", ".", "next", ".", "processElement", "(", "outputStream", ",", "element", ")", ";", "}", "}", "}" ]
Wraps {@link Serializer#process(java.io.OutputStream, Object)} and calls next serializer in chain. @param outputStream the output stream. @param element the element to process. @throws IOException IOException in case of IO error.
[ "Wraps", "{", "@link", "Serializer#process", "(", "java", ".", "io", ".", "OutputStream", "Object", ")", "}", "and", "calls", "next", "serializer", "in", "chain", "." ]
train
https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/serialization/Serializer.java#L47-L55
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/OverlapResolver.java
OverlapResolver.areIntersected
public boolean areIntersected(IBond bond1, IBond bond2) { """ Checks if two bonds cross each other. @param bond1 Description of the Parameter @param bond2 Description of the Parameter @return Description of the Return Value """ double x1 = 0, x2 = 0, x3 = 0, x4 = 0; double y1 = 0, y2 = 0, y3 = 0, y4 = 0; //Point2D.Double p1 = null, p2 = null, p3 = null, p4 = null; x1 = bond1.getBegin().getPoint2d().x; x2 = bond1.getEnd().getPoint2d().x; x3 = bond2.getBegin().getPoint2d().x; x4 = bond2.getEnd().getPoint2d().x; y1 = bond1.getBegin().getPoint2d().y; y2 = bond1.getEnd().getPoint2d().y; y3 = bond2.getBegin().getPoint2d().y; y4 = bond2.getEnd().getPoint2d().y; Line2D.Double line1 = new Line2D.Double(new Point2D.Double(x1, y1), new Point2D.Double(x2, y2)); Line2D.Double line2 = new Line2D.Double(new Point2D.Double(x3, y3), new Point2D.Double(x4, y4)); if (line1.intersectsLine(line2)) { logger.debug("Two intersecting bonds detected."); return true; } return false; }
java
public boolean areIntersected(IBond bond1, IBond bond2) { double x1 = 0, x2 = 0, x3 = 0, x4 = 0; double y1 = 0, y2 = 0, y3 = 0, y4 = 0; //Point2D.Double p1 = null, p2 = null, p3 = null, p4 = null; x1 = bond1.getBegin().getPoint2d().x; x2 = bond1.getEnd().getPoint2d().x; x3 = bond2.getBegin().getPoint2d().x; x4 = bond2.getEnd().getPoint2d().x; y1 = bond1.getBegin().getPoint2d().y; y2 = bond1.getEnd().getPoint2d().y; y3 = bond2.getBegin().getPoint2d().y; y4 = bond2.getEnd().getPoint2d().y; Line2D.Double line1 = new Line2D.Double(new Point2D.Double(x1, y1), new Point2D.Double(x2, y2)); Line2D.Double line2 = new Line2D.Double(new Point2D.Double(x3, y3), new Point2D.Double(x4, y4)); if (line1.intersectsLine(line2)) { logger.debug("Two intersecting bonds detected."); return true; } return false; }
[ "public", "boolean", "areIntersected", "(", "IBond", "bond1", ",", "IBond", "bond2", ")", "{", "double", "x1", "=", "0", ",", "x2", "=", "0", ",", "x3", "=", "0", ",", "x4", "=", "0", ";", "double", "y1", "=", "0", ",", "y2", "=", "0", ",", "y3", "=", "0", ",", "y4", "=", "0", ";", "//Point2D.Double p1 = null, p2 = null, p3 = null, p4 = null;", "x1", "=", "bond1", ".", "getBegin", "(", ")", ".", "getPoint2d", "(", ")", ".", "x", ";", "x2", "=", "bond1", ".", "getEnd", "(", ")", ".", "getPoint2d", "(", ")", ".", "x", ";", "x3", "=", "bond2", ".", "getBegin", "(", ")", ".", "getPoint2d", "(", ")", ".", "x", ";", "x4", "=", "bond2", ".", "getEnd", "(", ")", ".", "getPoint2d", "(", ")", ".", "x", ";", "y1", "=", "bond1", ".", "getBegin", "(", ")", ".", "getPoint2d", "(", ")", ".", "y", ";", "y2", "=", "bond1", ".", "getEnd", "(", ")", ".", "getPoint2d", "(", ")", ".", "y", ";", "y3", "=", "bond2", ".", "getBegin", "(", ")", ".", "getPoint2d", "(", ")", ".", "y", ";", "y4", "=", "bond2", ".", "getEnd", "(", ")", ".", "getPoint2d", "(", ")", ".", "y", ";", "Line2D", ".", "Double", "line1", "=", "new", "Line2D", ".", "Double", "(", "new", "Point2D", ".", "Double", "(", "x1", ",", "y1", ")", ",", "new", "Point2D", ".", "Double", "(", "x2", ",", "y2", ")", ")", ";", "Line2D", ".", "Double", "line2", "=", "new", "Line2D", ".", "Double", "(", "new", "Point2D", ".", "Double", "(", "x3", ",", "y3", ")", ",", "new", "Point2D", ".", "Double", "(", "x4", ",", "y4", ")", ")", ";", "if", "(", "line1", ".", "intersectsLine", "(", "line2", ")", ")", "{", "logger", ".", "debug", "(", "\"Two intersecting bonds detected.\"", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Checks if two bonds cross each other. @param bond1 Description of the Parameter @param bond2 Description of the Parameter @return Description of the Return Value
[ "Checks", "if", "two", "bonds", "cross", "each", "other", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/OverlapResolver.java#L245-L268
stevespringett/Alpine
alpine/src/main/java/alpine/crypto/DataEncryption.java
DataEncryption.encryptAsBytes
public static byte[] encryptAsBytes(final String plainText) throws Exception { """ Encrypts the specified plainText using AES-256. This method uses the default secret key. @param plainText the text to encrypt @return the encrypted bytes @throws Exception a number of exceptions may be thrown @since 1.3.0 """ final SecretKey secretKey = KeyManager.getInstance().getSecretKey(); return encryptAsBytes(secretKey, plainText); }
java
public static byte[] encryptAsBytes(final String plainText) throws Exception { final SecretKey secretKey = KeyManager.getInstance().getSecretKey(); return encryptAsBytes(secretKey, plainText); }
[ "public", "static", "byte", "[", "]", "encryptAsBytes", "(", "final", "String", "plainText", ")", "throws", "Exception", "{", "final", "SecretKey", "secretKey", "=", "KeyManager", ".", "getInstance", "(", ")", ".", "getSecretKey", "(", ")", ";", "return", "encryptAsBytes", "(", "secretKey", ",", "plainText", ")", ";", "}" ]
Encrypts the specified plainText using AES-256. This method uses the default secret key. @param plainText the text to encrypt @return the encrypted bytes @throws Exception a number of exceptions may be thrown @since 1.3.0
[ "Encrypts", "the", "specified", "plainText", "using", "AES", "-", "256", ".", "This", "method", "uses", "the", "default", "secret", "key", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/DataEncryption.java#L81-L84
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getAccountAdjustments
public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type) { """ Get Account Adjustments <p> @param accountCode recurly account id @param type {@link com.ning.billing.recurly.model.Adjustments.AdjustmentType} @return the adjustments on the account """ return getAccountAdjustments(accountCode, type, null, new QueryParams()); }
java
public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type) { return getAccountAdjustments(accountCode, type, null, new QueryParams()); }
[ "public", "Adjustments", "getAccountAdjustments", "(", "final", "String", "accountCode", ",", "final", "Adjustments", ".", "AdjustmentType", "type", ")", "{", "return", "getAccountAdjustments", "(", "accountCode", ",", "type", ",", "null", ",", "new", "QueryParams", "(", ")", ")", ";", "}" ]
Get Account Adjustments <p> @param accountCode recurly account id @param type {@link com.ning.billing.recurly.model.Adjustments.AdjustmentType} @return the adjustments on the account
[ "Get", "Account", "Adjustments", "<p", ">" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L387-L389
jparsec/jparsec
jparsec/src/main/java/org/jparsec/ParseContext.java
ParseContext.applyNewNode
final boolean applyNewNode(Parser<?> parser, String name) { """ Applies {@code parser} as a new tree node with {@code name}, and if fails, reports "expecting $name". """ int physical = at; int logical = step; TreeNode latestChild = trace.getLatestChild(); trace.push(name); if (parser.apply(this)) { trace.setCurrentResult(result); trace.pop(); return true; } if (stillThere(physical, logical)) expected(name); trace.pop(); // On failure, the erroneous path shouldn't be counted in the parse tree. trace.setLatestChild(latestChild); return false; }
java
final boolean applyNewNode(Parser<?> parser, String name) { int physical = at; int logical = step; TreeNode latestChild = trace.getLatestChild(); trace.push(name); if (parser.apply(this)) { trace.setCurrentResult(result); trace.pop(); return true; } if (stillThere(physical, logical)) expected(name); trace.pop(); // On failure, the erroneous path shouldn't be counted in the parse tree. trace.setLatestChild(latestChild); return false; }
[ "final", "boolean", "applyNewNode", "(", "Parser", "<", "?", ">", "parser", ",", "String", "name", ")", "{", "int", "physical", "=", "at", ";", "int", "logical", "=", "step", ";", "TreeNode", "latestChild", "=", "trace", ".", "getLatestChild", "(", ")", ";", "trace", ".", "push", "(", "name", ")", ";", "if", "(", "parser", ".", "apply", "(", "this", ")", ")", "{", "trace", ".", "setCurrentResult", "(", "result", ")", ";", "trace", ".", "pop", "(", ")", ";", "return", "true", ";", "}", "if", "(", "stillThere", "(", "physical", ",", "logical", ")", ")", "expected", "(", "name", ")", ";", "trace", ".", "pop", "(", ")", ";", "// On failure, the erroneous path shouldn't be counted in the parse tree.", "trace", ".", "setLatestChild", "(", "latestChild", ")", ";", "return", "false", ";", "}" ]
Applies {@code parser} as a new tree node with {@code name}, and if fails, reports "expecting $name".
[ "Applies", "{" ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/ParseContext.java#L140-L155
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/masterslave/AsyncConnections.java
AsyncConnections.addConnection
public void addConnection(RedisURI redisURI, CompletableFuture<StatefulRedisConnection<String, String>> connection) { """ Add a connection for a {@link RedisURI} @param redisURI @param connection """ connections.put(redisURI, connection); }
java
public void addConnection(RedisURI redisURI, CompletableFuture<StatefulRedisConnection<String, String>> connection) { connections.put(redisURI, connection); }
[ "public", "void", "addConnection", "(", "RedisURI", "redisURI", ",", "CompletableFuture", "<", "StatefulRedisConnection", "<", "String", ",", "String", ">", ">", "connection", ")", "{", "connections", ".", "put", "(", "redisURI", ",", "connection", ")", ";", "}" ]
Add a connection for a {@link RedisURI} @param redisURI @param connection
[ "Add", "a", "connection", "for", "a", "{", "@link", "RedisURI", "}" ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/masterslave/AsyncConnections.java#L50-L52
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java
MemorizeTransactionProxy.runWithPossibleProxySwap
private Object runWithPossibleProxySwap(Method method, Object target, Object[] args) throws IllegalAccessException, InvocationTargetException { """ Runs the given method with the specified arguments, substituting with proxies where necessary @param method @param target proxy target @param args @return Proxy-fied result for statements, actual call result otherwise @throws IllegalAccessException @throws InvocationTargetException """ Object result; // swap with proxies to these too. if (method.getName().equals("createStatement")){ result = memorize((Statement)method.invoke(target, args), this.connectionHandle.get()); } else if (method.getName().equals("prepareStatement")){ result = memorize((PreparedStatement)method.invoke(target, args), this.connectionHandle.get()); } else if (method.getName().equals("prepareCall")){ result = memorize((CallableStatement)method.invoke(target, args), this.connectionHandle.get()); } else result = method.invoke(target, args); return result; }
java
private Object runWithPossibleProxySwap(Method method, Object target, Object[] args) throws IllegalAccessException, InvocationTargetException { Object result; // swap with proxies to these too. if (method.getName().equals("createStatement")){ result = memorize((Statement)method.invoke(target, args), this.connectionHandle.get()); } else if (method.getName().equals("prepareStatement")){ result = memorize((PreparedStatement)method.invoke(target, args), this.connectionHandle.get()); } else if (method.getName().equals("prepareCall")){ result = memorize((CallableStatement)method.invoke(target, args), this.connectionHandle.get()); } else result = method.invoke(target, args); return result; }
[ "private", "Object", "runWithPossibleProxySwap", "(", "Method", "method", ",", "Object", "target", ",", "Object", "[", "]", "args", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", "{", "Object", "result", ";", "// swap with proxies to these too.", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "\"createStatement\"", ")", ")", "{", "result", "=", "memorize", "(", "(", "Statement", ")", "method", ".", "invoke", "(", "target", ",", "args", ")", ",", "this", ".", "connectionHandle", ".", "get", "(", ")", ")", ";", "}", "else", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "\"prepareStatement\"", ")", ")", "{", "result", "=", "memorize", "(", "(", "PreparedStatement", ")", "method", ".", "invoke", "(", "target", ",", "args", ")", ",", "this", ".", "connectionHandle", ".", "get", "(", ")", ")", ";", "}", "else", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "\"prepareCall\"", ")", ")", "{", "result", "=", "memorize", "(", "(", "CallableStatement", ")", "method", ".", "invoke", "(", "target", ",", "args", ")", ",", "this", ".", "connectionHandle", ".", "get", "(", ")", ")", ";", "}", "else", "result", "=", "method", ".", "invoke", "(", "target", ",", "args", ")", ";", "return", "result", ";", "}" ]
Runs the given method with the specified arguments, substituting with proxies where necessary @param method @param target proxy target @param args @return Proxy-fied result for statements, actual call result otherwise @throws IllegalAccessException @throws InvocationTargetException
[ "Runs", "the", "given", "method", "with", "the", "specified", "arguments", "substituting", "with", "proxies", "where", "necessary" ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java#L246-L261
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.vps_serviceName_plesk_duration_GET
public OvhOrder vps_serviceName_plesk_duration_GET(String serviceName, String duration, OvhPleskLicenseDomainNumberEnum domainNumber) throws IOException { """ Get prices and contracts information REST: GET /order/vps/{serviceName}/plesk/{duration} @param domainNumber [required] Domain number you want to order a licence for @param serviceName [required] The internal name of your VPS offer @param duration [required] Duration @deprecated """ String qPath = "/order/vps/{serviceName}/plesk/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "domainNumber", domainNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder vps_serviceName_plesk_duration_GET(String serviceName, String duration, OvhPleskLicenseDomainNumberEnum domainNumber) throws IOException { String qPath = "/order/vps/{serviceName}/plesk/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "domainNumber", domainNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "vps_serviceName_plesk_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhPleskLicenseDomainNumberEnum", "domainNumber", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/vps/{serviceName}/plesk/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "duration", ")", ";", "query", "(", "sb", ",", "\"domainNumber\"", ",", "domainNumber", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/vps/{serviceName}/plesk/{duration} @param domainNumber [required] Domain number you want to order a licence for @param serviceName [required] The internal name of your VPS offer @param duration [required] Duration @deprecated
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3325-L3331
fullcontact/hadoop-sstable
sstable-core/src/main/java/com/fullcontact/cassandra/io/compress/CompressionMetadata.java
CompressionMetadata.chunkFor
public Chunk chunkFor(long position) { """ Get a chunk of compressed data (offset, length) corresponding to given position @param position Position in the file. @return pair of chunk offset and length. """ // position of the chunk int idx = 8 * (int) (position / parameters.chunkLength()); if (idx >= chunkOffsets.size()) throw new CorruptSSTableException(new EOFException(), indexFilePath); long chunkOffset = chunkOffsets.getLong(idx); long nextChunkOffset = (idx + 8 == chunkOffsets.size()) ? compressedFileLength : chunkOffsets.getLong(idx + 8); return new Chunk(chunkOffset, (int) (nextChunkOffset - chunkOffset - 4)); // "4" bytes reserved for checksum }
java
public Chunk chunkFor(long position) { // position of the chunk int idx = 8 * (int) (position / parameters.chunkLength()); if (idx >= chunkOffsets.size()) throw new CorruptSSTableException(new EOFException(), indexFilePath); long chunkOffset = chunkOffsets.getLong(idx); long nextChunkOffset = (idx + 8 == chunkOffsets.size()) ? compressedFileLength : chunkOffsets.getLong(idx + 8); return new Chunk(chunkOffset, (int) (nextChunkOffset - chunkOffset - 4)); // "4" bytes reserved for checksum }
[ "public", "Chunk", "chunkFor", "(", "long", "position", ")", "{", "// position of the chunk", "int", "idx", "=", "8", "*", "(", "int", ")", "(", "position", "/", "parameters", ".", "chunkLength", "(", ")", ")", ";", "if", "(", "idx", ">=", "chunkOffsets", ".", "size", "(", ")", ")", "throw", "new", "CorruptSSTableException", "(", "new", "EOFException", "(", ")", ",", "indexFilePath", ")", ";", "long", "chunkOffset", "=", "chunkOffsets", ".", "getLong", "(", "idx", ")", ";", "long", "nextChunkOffset", "=", "(", "idx", "+", "8", "==", "chunkOffsets", ".", "size", "(", ")", ")", "?", "compressedFileLength", ":", "chunkOffsets", ".", "getLong", "(", "idx", "+", "8", ")", ";", "return", "new", "Chunk", "(", "chunkOffset", ",", "(", "int", ")", "(", "nextChunkOffset", "-", "chunkOffset", "-", "4", ")", ")", ";", "// \"4\" bytes reserved for checksum", "}" ]
Get a chunk of compressed data (offset, length) corresponding to given position @param position Position in the file. @return pair of chunk offset and length.
[ "Get", "a", "chunk", "of", "compressed", "data", "(", "offset", "length", ")", "corresponding", "to", "given", "position" ]
train
https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/cassandra/io/compress/CompressionMetadata.java#L163-L176
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java
vpnformssoaction.get
public static vpnformssoaction get(nitro_service service, String name) throws Exception { """ Use this API to fetch vpnformssoaction resource of given name . """ vpnformssoaction obj = new vpnformssoaction(); obj.set_name(name); vpnformssoaction response = (vpnformssoaction) obj.get_resource(service); return response; }
java
public static vpnformssoaction get(nitro_service service, String name) throws Exception{ vpnformssoaction obj = new vpnformssoaction(); obj.set_name(name); vpnformssoaction response = (vpnformssoaction) obj.get_resource(service); return response; }
[ "public", "static", "vpnformssoaction", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "vpnformssoaction", "obj", "=", "new", "vpnformssoaction", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "vpnformssoaction", "response", "=", "(", "vpnformssoaction", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch vpnformssoaction resource of given name .
[ "Use", "this", "API", "to", "fetch", "vpnformssoaction", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnformssoaction.java#L450-L455
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/DemoRule.java
DemoRule.match
@Override public RuleMatch[] match(AnalyzedSentence sentence) throws IOException { """ This is the method with the error detection logic that you need to implement: """ List<RuleMatch> ruleMatches = new ArrayList<>(); // Let's get all the tokens (i.e. words) of this sentence, but not the spaces: AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace(); // No let's iterate over those - note that the first token will // be a special token that indicates the start of a sentence: for (AnalyzedTokenReadings token : tokens) { System.out.println("Token: " + token.getToken()); // the original word from the input text // A word can have more than one reading, e.g. 'dance' can be a verb or a noun, // so we iterate over the readings: for (AnalyzedToken analyzedToken : token.getReadings()) { System.out.println(" Lemma: " + analyzedToken.getLemma()); System.out.println(" POS: " + analyzedToken.getPOSTag()); } // You can add your own logic here to find errors. Here, we just consider // the word "demo" an error and create a rule match that LanguageTool will // then show to the user: if (token.getToken().equals("demo")) { RuleMatch ruleMatch = new RuleMatch(this, sentence, token.getStartPos(), token.getEndPos(), "The demo rule thinks this looks wrong"); ruleMatch.setSuggestedReplacement("blablah"); // the user will see this as a suggested correction ruleMatches.add(ruleMatch); } } return toRuleMatchArray(ruleMatches); }
java
@Override public RuleMatch[] match(AnalyzedSentence sentence) throws IOException { List<RuleMatch> ruleMatches = new ArrayList<>(); // Let's get all the tokens (i.e. words) of this sentence, but not the spaces: AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace(); // No let's iterate over those - note that the first token will // be a special token that indicates the start of a sentence: for (AnalyzedTokenReadings token : tokens) { System.out.println("Token: " + token.getToken()); // the original word from the input text // A word can have more than one reading, e.g. 'dance' can be a verb or a noun, // so we iterate over the readings: for (AnalyzedToken analyzedToken : token.getReadings()) { System.out.println(" Lemma: " + analyzedToken.getLemma()); System.out.println(" POS: " + analyzedToken.getPOSTag()); } // You can add your own logic here to find errors. Here, we just consider // the word "demo" an error and create a rule match that LanguageTool will // then show to the user: if (token.getToken().equals("demo")) { RuleMatch ruleMatch = new RuleMatch(this, sentence, token.getStartPos(), token.getEndPos(), "The demo rule thinks this looks wrong"); ruleMatch.setSuggestedReplacement("blablah"); // the user will see this as a suggested correction ruleMatches.add(ruleMatch); } } return toRuleMatchArray(ruleMatches); }
[ "@", "Override", "public", "RuleMatch", "[", "]", "match", "(", "AnalyzedSentence", "sentence", ")", "throws", "IOException", "{", "List", "<", "RuleMatch", ">", "ruleMatches", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Let's get all the tokens (i.e. words) of this sentence, but not the spaces:", "AnalyzedTokenReadings", "[", "]", "tokens", "=", "sentence", ".", "getTokensWithoutWhitespace", "(", ")", ";", "// No let's iterate over those - note that the first token will", "// be a special token that indicates the start of a sentence:", "for", "(", "AnalyzedTokenReadings", "token", ":", "tokens", ")", "{", "System", ".", "out", ".", "println", "(", "\"Token: \"", "+", "token", ".", "getToken", "(", ")", ")", ";", "// the original word from the input text", "// A word can have more than one reading, e.g. 'dance' can be a verb or a noun,", "// so we iterate over the readings:", "for", "(", "AnalyzedToken", "analyzedToken", ":", "token", ".", "getReadings", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\" Lemma: \"", "+", "analyzedToken", ".", "getLemma", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\" POS: \"", "+", "analyzedToken", ".", "getPOSTag", "(", ")", ")", ";", "}", "// You can add your own logic here to find errors. Here, we just consider", "// the word \"demo\" an error and create a rule match that LanguageTool will", "// then show to the user:", "if", "(", "token", ".", "getToken", "(", ")", ".", "equals", "(", "\"demo\"", ")", ")", "{", "RuleMatch", "ruleMatch", "=", "new", "RuleMatch", "(", "this", ",", "sentence", ",", "token", ".", "getStartPos", "(", ")", ",", "token", ".", "getEndPos", "(", ")", ",", "\"The demo rule thinks this looks wrong\"", ")", ";", "ruleMatch", ".", "setSuggestedReplacement", "(", "\"blablah\"", ")", ";", "// the user will see this as a suggested correction", "ruleMatches", ".", "add", "(", "ruleMatch", ")", ";", "}", "}", "return", "toRuleMatchArray", "(", "ruleMatches", ")", ";", "}" ]
This is the method with the error detection logic that you need to implement:
[ "This", "is", "the", "method", "with", "the", "error", "detection", "logic", "that", "you", "need", "to", "implement", ":" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/DemoRule.java#L52-L83
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java
BigtableClusterUtilities.lookupInstanceId
public static String lookupInstanceId(String projectId, String clusterId, String zoneId) throws IOException { """ @return The instance id associated with the given project, zone and cluster. We expect instance and cluster to have one-to-one relationship. @throws IllegalStateException if the cluster is not found """ BigtableClusterUtilities utils; try { utils = BigtableClusterUtilities.forAllInstances(projectId); } catch (GeneralSecurityException e) { throw new RuntimeException("Could not initialize BigtableClusterUtilities", e); } try { Cluster cluster = utils.getCluster(clusterId, zoneId); return new BigtableClusterName(cluster.getName()).getInstanceId(); } finally { try { utils.close(); } catch (Exception e) { logger.warn("Error closing BigtableClusterUtilities: ", e); } } }
java
public static String lookupInstanceId(String projectId, String clusterId, String zoneId) throws IOException { BigtableClusterUtilities utils; try { utils = BigtableClusterUtilities.forAllInstances(projectId); } catch (GeneralSecurityException e) { throw new RuntimeException("Could not initialize BigtableClusterUtilities", e); } try { Cluster cluster = utils.getCluster(clusterId, zoneId); return new BigtableClusterName(cluster.getName()).getInstanceId(); } finally { try { utils.close(); } catch (Exception e) { logger.warn("Error closing BigtableClusterUtilities: ", e); } } }
[ "public", "static", "String", "lookupInstanceId", "(", "String", "projectId", ",", "String", "clusterId", ",", "String", "zoneId", ")", "throws", "IOException", "{", "BigtableClusterUtilities", "utils", ";", "try", "{", "utils", "=", "BigtableClusterUtilities", ".", "forAllInstances", "(", "projectId", ")", ";", "}", "catch", "(", "GeneralSecurityException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Could not initialize BigtableClusterUtilities\"", ",", "e", ")", ";", "}", "try", "{", "Cluster", "cluster", "=", "utils", ".", "getCluster", "(", "clusterId", ",", "zoneId", ")", ";", "return", "new", "BigtableClusterName", "(", "cluster", ".", "getName", "(", ")", ")", ".", "getInstanceId", "(", ")", ";", "}", "finally", "{", "try", "{", "utils", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "warn", "(", "\"Error closing BigtableClusterUtilities: \"", ",", "e", ")", ";", "}", "}", "}" ]
@return The instance id associated with the given project, zone and cluster. We expect instance and cluster to have one-to-one relationship. @throws IllegalStateException if the cluster is not found
[ "@return", "The", "instance", "id", "associated", "with", "the", "given", "project", "zone", "and", "cluster", ".", "We", "expect", "instance", "and", "cluster", "to", "have", "one", "-", "to", "-", "one", "relationship", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java#L79-L98
alkacon/opencms-core
src/org/opencms/ui/contextmenu/CmsContextMenu.java
CmsContextMenu.openForTable
public void openForTable(ClickEvent event, Object itemId, Object propertyId, Table table) { """ Opens the context menu of the given table.<p> @param event the click event @param itemId of clicked item @param propertyId of clicked item @param table the table """ fireEvent(new ContextMenuOpenedOnTableRowEvent(this, table, itemId, propertyId)); open(event.getClientX(), event.getClientY()); }
java
public void openForTable(ClickEvent event, Object itemId, Object propertyId, Table table) { fireEvent(new ContextMenuOpenedOnTableRowEvent(this, table, itemId, propertyId)); open(event.getClientX(), event.getClientY()); }
[ "public", "void", "openForTable", "(", "ClickEvent", "event", ",", "Object", "itemId", ",", "Object", "propertyId", ",", "Table", "table", ")", "{", "fireEvent", "(", "new", "ContextMenuOpenedOnTableRowEvent", "(", "this", ",", "table", ",", "itemId", ",", "propertyId", ")", ")", ";", "open", "(", "event", ".", "getClientX", "(", ")", ",", "event", ".", "getClientY", "(", ")", ")", ";", "}" ]
Opens the context menu of the given table.<p> @param event the click event @param itemId of clicked item @param propertyId of clicked item @param table the table
[ "Opens", "the", "context", "menu", "of", "the", "given", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/contextmenu/CmsContextMenu.java#L1135-L1140
OpenTSDB/opentsdb
src/core/Internal.java
Internal.extractDataPoints
public static ArrayList<Cell> extractDataPoints(final KeyValue column) { """ Extracts the data points from a single column. While it's meant for use on a compacted column, you can pass any other type of column and it will be returned. If the column represents a data point, a single cell will be returned. If the column contains an annotation or other object, the result will be an empty array list. Compacted columns will be split into individual data points. <b>Note:</b> This method does not account for duplicate timestamps in qualifiers. @param column The column to parse @return An array list of data point {@link Cell} objects. The list may be empty if the column did not contain a data point. @throws IllegalDataException if one of the cells cannot be read because it's corrupted or in a format we don't understand. @since 2.0 """ final ArrayList<KeyValue> row = new ArrayList<KeyValue>(1); row.add(column); return extractDataPoints(row, column.qualifier().length / 2); }
java
public static ArrayList<Cell> extractDataPoints(final KeyValue column) { final ArrayList<KeyValue> row = new ArrayList<KeyValue>(1); row.add(column); return extractDataPoints(row, column.qualifier().length / 2); }
[ "public", "static", "ArrayList", "<", "Cell", ">", "extractDataPoints", "(", "final", "KeyValue", "column", ")", "{", "final", "ArrayList", "<", "KeyValue", ">", "row", "=", "new", "ArrayList", "<", "KeyValue", ">", "(", "1", ")", ";", "row", ".", "add", "(", "column", ")", ";", "return", "extractDataPoints", "(", "row", ",", "column", ".", "qualifier", "(", ")", ".", "length", "/", "2", ")", ";", "}" ]
Extracts the data points from a single column. While it's meant for use on a compacted column, you can pass any other type of column and it will be returned. If the column represents a data point, a single cell will be returned. If the column contains an annotation or other object, the result will be an empty array list. Compacted columns will be split into individual data points. <b>Note:</b> This method does not account for duplicate timestamps in qualifiers. @param column The column to parse @return An array list of data point {@link Cell} objects. The list may be empty if the column did not contain a data point. @throws IllegalDataException if one of the cells cannot be read because it's corrupted or in a format we don't understand. @since 2.0
[ "Extracts", "the", "data", "points", "from", "a", "single", "column", ".", "While", "it", "s", "meant", "for", "use", "on", "a", "compacted", "column", "you", "can", "pass", "any", "other", "type", "of", "column", "and", "it", "will", "be", "returned", ".", "If", "the", "column", "represents", "a", "data", "point", "a", "single", "cell", "will", "be", "returned", ".", "If", "the", "column", "contains", "an", "annotation", "or", "other", "object", "the", "result", "will", "be", "an", "empty", "array", "list", ".", "Compacted", "columns", "will", "be", "split", "into", "individual", "data", "points", ".", "<b", ">", "Note", ":", "<", "/", "b", ">", "This", "method", "does", "not", "account", "for", "duplicate", "timestamps", "in", "qualifiers", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L216-L220
iron-io/iron_mq_java
src/main/java/io/iron/ironmq/Queue.java
Queue.touchMessage
public MessageOptions touchMessage(String id, String reservationId) throws IOException { """ Touching a reserved message extends its timeout to the duration specified when the message was created. @param id The ID of the message to delete. @param reservationId This id is returned when you reserve a message and must be provided to delete a message that is reserved. @throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK. @throws java.io.IOException If there is an error accessing the IronMQ server. """ return touchMessage(id, reservationId, null); }
java
public MessageOptions touchMessage(String id, String reservationId) throws IOException { return touchMessage(id, reservationId, null); }
[ "public", "MessageOptions", "touchMessage", "(", "String", "id", ",", "String", "reservationId", ")", "throws", "IOException", "{", "return", "touchMessage", "(", "id", ",", "reservationId", ",", "null", ")", ";", "}" ]
Touching a reserved message extends its timeout to the duration specified when the message was created. @param id The ID of the message to delete. @param reservationId This id is returned when you reserve a message and must be provided to delete a message that is reserved. @throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK. @throws java.io.IOException If there is an error accessing the IronMQ server.
[ "Touching", "a", "reserved", "message", "extends", "its", "timeout", "to", "the", "duration", "specified", "when", "the", "message", "was", "created", "." ]
train
https://github.com/iron-io/iron_mq_java/blob/62d6a86545ca7ef31b7b4797aae0c5b31394a507/src/main/java/io/iron/ironmq/Queue.java#L222-L224
looly/hutool
hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java
StrSpliter.split
public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty) { """ 切分字符串,大小写敏感 @param str 被切分的字符串 @param separator 分隔符字符 @param limit 限制分片数,-1不限制 @param isTrim 是否去除切分字符串后每个元素两边的空格 @param ignoreEmpty 是否忽略空串 @return 切分后的集合 @since 3.0.8 """ return split(str, separator, limit, isTrim, ignoreEmpty, false); }
java
public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty){ return split(str, separator, limit, isTrim, ignoreEmpty, false); }
[ "public", "static", "List", "<", "String", ">", "split", "(", "String", "str", ",", "char", "separator", ",", "int", "limit", ",", "boolean", "isTrim", ",", "boolean", "ignoreEmpty", ")", "{", "return", "split", "(", "str", ",", "separator", ",", "limit", ",", "isTrim", ",", "ignoreEmpty", ",", "false", ")", ";", "}" ]
切分字符串,大小写敏感 @param str 被切分的字符串 @param separator 分隔符字符 @param limit 限制分片数,-1不限制 @param isTrim 是否去除切分字符串后每个元素两边的空格 @param ignoreEmpty 是否忽略空串 @return 切分后的集合 @since 3.0.8
[ "切分字符串,大小写敏感" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L119-L121
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateRouteResult.java
UpdateRouteResult.withRequestModels
public UpdateRouteResult withRequestModels(java.util.Map<String, String> requestModels) { """ <p> The request models for the route. </p> @param requestModels The request models for the route. @return Returns a reference to this object so that method calls can be chained together. """ setRequestModels(requestModels); return this; }
java
public UpdateRouteResult withRequestModels(java.util.Map<String, String> requestModels) { setRequestModels(requestModels); return this; }
[ "public", "UpdateRouteResult", "withRequestModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestModels", ")", "{", "setRequestModels", "(", "requestModels", ")", ";", "return", "this", ";", "}" ]
<p> The request models for the route. </p> @param requestModels The request models for the route. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "request", "models", "for", "the", "route", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateRouteResult.java#L486-L489
osglworks/java-tool
src/main/java/org/osgl/util/IO.java
IO.readContentAsString
public static String readContentAsString(File file, String encoding) { """ Read file content to a String @param file The file to read @param encoding encoding used to read the file into string content @return The String content """ try { return readContentAsString(new FileInputStream(file), encoding); } catch (FileNotFoundException e) { throw E.ioException(e); } }
java
public static String readContentAsString(File file, String encoding) { try { return readContentAsString(new FileInputStream(file), encoding); } catch (FileNotFoundException e) { throw E.ioException(e); } }
[ "public", "static", "String", "readContentAsString", "(", "File", "file", ",", "String", "encoding", ")", "{", "try", "{", "return", "readContentAsString", "(", "new", "FileInputStream", "(", "file", ")", ",", "encoding", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "E", ".", "ioException", "(", "e", ")", ";", "}", "}" ]
Read file content to a String @param file The file to read @param encoding encoding used to read the file into string content @return The String content
[ "Read", "file", "content", "to", "a", "String" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/IO.java#L1553-L1559
federkasten/appbundle-maven-plugin
src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java
CreateApplicationBundleMojo.copyDependencies
private List<String> copyDependencies(File javaDirectory) throws MojoExecutionException { """ Copy all dependencies into the $JAVAROOT directory @param javaDirectory where to put jar files @return A list of file names added @throws MojoExecutionException """ ArtifactRepositoryLayout layout = new DefaultRepositoryLayout(); List<String> list = new ArrayList<String>(); // First, copy the project's own artifact File artifactFile = project.getArtifact().getFile(); list.add(layout.pathOf(project.getArtifact())); try { FileUtils.copyFile(artifactFile, new File(javaDirectory, layout.pathOf(project.getArtifact()))); } catch (IOException ex) { throw new MojoExecutionException("Could not copy artifact file " + artifactFile + " to " + javaDirectory, ex); } if (excludeDependencies) { // skip adding dependencies from project.getArtifacts() return list; } for (Artifact artifact : project.getArtifacts()) { File file = artifact.getFile(); File dest = new File(javaDirectory, layout.pathOf(artifact)); getLog().debug("Adding " + file); try { FileUtils.copyFile(file, dest); } catch (IOException ex) { throw new MojoExecutionException("Error copying file " + file + " into " + javaDirectory, ex); } list.add(layout.pathOf(artifact)); } return list; }
java
private List<String> copyDependencies(File javaDirectory) throws MojoExecutionException { ArtifactRepositoryLayout layout = new DefaultRepositoryLayout(); List<String> list = new ArrayList<String>(); // First, copy the project's own artifact File artifactFile = project.getArtifact().getFile(); list.add(layout.pathOf(project.getArtifact())); try { FileUtils.copyFile(artifactFile, new File(javaDirectory, layout.pathOf(project.getArtifact()))); } catch (IOException ex) { throw new MojoExecutionException("Could not copy artifact file " + artifactFile + " to " + javaDirectory, ex); } if (excludeDependencies) { // skip adding dependencies from project.getArtifacts() return list; } for (Artifact artifact : project.getArtifacts()) { File file = artifact.getFile(); File dest = new File(javaDirectory, layout.pathOf(artifact)); getLog().debug("Adding " + file); try { FileUtils.copyFile(file, dest); } catch (IOException ex) { throw new MojoExecutionException("Error copying file " + file + " into " + javaDirectory, ex); } list.add(layout.pathOf(artifact)); } return list; }
[ "private", "List", "<", "String", ">", "copyDependencies", "(", "File", "javaDirectory", ")", "throws", "MojoExecutionException", "{", "ArtifactRepositoryLayout", "layout", "=", "new", "DefaultRepositoryLayout", "(", ")", ";", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "// First, copy the project's own artifact", "File", "artifactFile", "=", "project", ".", "getArtifact", "(", ")", ".", "getFile", "(", ")", ";", "list", ".", "add", "(", "layout", ".", "pathOf", "(", "project", ".", "getArtifact", "(", ")", ")", ")", ";", "try", "{", "FileUtils", ".", "copyFile", "(", "artifactFile", ",", "new", "File", "(", "javaDirectory", ",", "layout", ".", "pathOf", "(", "project", ".", "getArtifact", "(", ")", ")", ")", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "MojoExecutionException", "(", "\"Could not copy artifact file \"", "+", "artifactFile", "+", "\" to \"", "+", "javaDirectory", ",", "ex", ")", ";", "}", "if", "(", "excludeDependencies", ")", "{", "// skip adding dependencies from project.getArtifacts()", "return", "list", ";", "}", "for", "(", "Artifact", "artifact", ":", "project", ".", "getArtifacts", "(", ")", ")", "{", "File", "file", "=", "artifact", ".", "getFile", "(", ")", ";", "File", "dest", "=", "new", "File", "(", "javaDirectory", ",", "layout", ".", "pathOf", "(", "artifact", ")", ")", ";", "getLog", "(", ")", ".", "debug", "(", "\"Adding \"", "+", "file", ")", ";", "try", "{", "FileUtils", ".", "copyFile", "(", "file", ",", "dest", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "MojoExecutionException", "(", "\"Error copying file \"", "+", "file", "+", "\" into \"", "+", "javaDirectory", ",", "ex", ")", ";", "}", "list", ".", "add", "(", "layout", ".", "pathOf", "(", "artifact", ")", ")", ";", "}", "return", "list", ";", "}" ]
Copy all dependencies into the $JAVAROOT directory @param javaDirectory where to put jar files @return A list of file names added @throws MojoExecutionException
[ "Copy", "all", "dependencies", "into", "the", "$JAVAROOT", "directory" ]
train
https://github.com/federkasten/appbundle-maven-plugin/blob/4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f/src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java#L511-L547
grpc/grpc-java
okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/DistinguishedNameParser.java
DistinguishedNameParser.quotedAV
private String quotedAV() { """ gets quoted attribute value: QUOTATION *( quotechar / pair ) QUOTATION """ pos++; beg = pos; end = beg; while (true) { if (pos == length) { throw new IllegalStateException("Unexpected end of DN: " + dn); } if (chars[pos] == '"') { // enclosing quotation was found pos++; break; } else if (chars[pos] == '\\') { chars[end] = getEscaped(); } else { // shift char: required for string with escaped chars chars[end] = chars[pos]; } pos++; end++; } // skip trailing space chars before comma or semicolon. // (compatibility with RFC 1779) for (; pos < length && chars[pos] == ' '; pos++) { } return new String(chars, beg, end - beg); }
java
private String quotedAV() { pos++; beg = pos; end = beg; while (true) { if (pos == length) { throw new IllegalStateException("Unexpected end of DN: " + dn); } if (chars[pos] == '"') { // enclosing quotation was found pos++; break; } else if (chars[pos] == '\\') { chars[end] = getEscaped(); } else { // shift char: required for string with escaped chars chars[end] = chars[pos]; } pos++; end++; } // skip trailing space chars before comma or semicolon. // (compatibility with RFC 1779) for (; pos < length && chars[pos] == ' '; pos++) { } return new String(chars, beg, end - beg); }
[ "private", "String", "quotedAV", "(", ")", "{", "pos", "++", ";", "beg", "=", "pos", ";", "end", "=", "beg", ";", "while", "(", "true", ")", "{", "if", "(", "pos", "==", "length", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Unexpected end of DN: \"", "+", "dn", ")", ";", "}", "if", "(", "chars", "[", "pos", "]", "==", "'", "'", ")", "{", "// enclosing quotation was found", "pos", "++", ";", "break", ";", "}", "else", "if", "(", "chars", "[", "pos", "]", "==", "'", "'", ")", "{", "chars", "[", "end", "]", "=", "getEscaped", "(", ")", ";", "}", "else", "{", "// shift char: required for string with escaped chars", "chars", "[", "end", "]", "=", "chars", "[", "pos", "]", ";", "}", "pos", "++", ";", "end", "++", ";", "}", "// skip trailing space chars before comma or semicolon.", "// (compatibility with RFC 1779)", "for", "(", ";", "pos", "<", "length", "&&", "chars", "[", "pos", "]", "==", "'", "'", ";", "pos", "++", ")", "{", "}", "return", "new", "String", "(", "chars", ",", "beg", ",", "end", "-", "beg", ")", ";", "}" ]
gets quoted attribute value: QUOTATION *( quotechar / pair ) QUOTATION
[ "gets", "quoted", "attribute", "value", ":", "QUOTATION", "*", "(", "quotechar", "/", "pair", ")", "QUOTATION" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/DistinguishedNameParser.java#L107-L137
alkacon/opencms-core
src/org/opencms/widgets/CmsHtmlWidget.java
CmsHtmlWidget.getJSONConfiguration
protected JSONObject getJSONConfiguration(CmsObject cms, CmsResource resource, Locale contentLocale) { """ Returns the WYSIWYG editor configuration as a JSON object.<p> @param cms the OpenCms context @param resource the edited resource @param contentLocale the edited content locale @return the configuration """ return getJSONConfiguration(getHtmlWidgetOption(), cms, resource, contentLocale); }
java
protected JSONObject getJSONConfiguration(CmsObject cms, CmsResource resource, Locale contentLocale) { return getJSONConfiguration(getHtmlWidgetOption(), cms, resource, contentLocale); }
[ "protected", "JSONObject", "getJSONConfiguration", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "Locale", "contentLocale", ")", "{", "return", "getJSONConfiguration", "(", "getHtmlWidgetOption", "(", ")", ",", "cms", ",", "resource", ",", "contentLocale", ")", ";", "}" ]
Returns the WYSIWYG editor configuration as a JSON object.<p> @param cms the OpenCms context @param resource the edited resource @param contentLocale the edited content locale @return the configuration
[ "Returns", "the", "WYSIWYG", "editor", "configuration", "as", "a", "JSON", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsHtmlWidget.java#L440-L443
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.appendln
@GwtIncompatible("incompatible method") public StrBuilder appendln(final String format, final Object... objs) { """ Calls {@link String#format(String, Object...)} and appends the result. @param format the format string @param objs the objects to use in the format string @return {@code this} to enable chaining @see String#format(String, Object...) @since 3.2 """ return append(format, objs).appendNewLine(); }
java
@GwtIncompatible("incompatible method") public StrBuilder appendln(final String format, final Object... objs) { return append(format, objs).appendNewLine(); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "StrBuilder", "appendln", "(", "final", "String", "format", ",", "final", "Object", "...", "objs", ")", "{", "return", "append", "(", "format", ",", "objs", ")", ".", "appendNewLine", "(", ")", ";", "}" ]
Calls {@link String#format(String, Object...)} and appends the result. @param format the format string @param objs the objects to use in the format string @return {@code this} to enable chaining @see String#format(String, Object...) @since 3.2
[ "Calls", "{", "@link", "String#format", "(", "String", "Object", "...", ")", "}", "and", "appends", "the", "result", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1003-L1006
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java
GenericBoJdbcDao.getAllSorted
protected Stream<T> getAllSorted(Connection conn) { """ Fetch all existing BOs from storage, sorted by primary key(s) and return the result as a stream. @param conn @return @since 0.9.0 """ return executeSelectAsStream(rowMapper, conn, true, calcSqlSelectAllSorted()); }
java
protected Stream<T> getAllSorted(Connection conn) { return executeSelectAsStream(rowMapper, conn, true, calcSqlSelectAllSorted()); }
[ "protected", "Stream", "<", "T", ">", "getAllSorted", "(", "Connection", "conn", ")", "{", "return", "executeSelectAsStream", "(", "rowMapper", ",", "conn", ",", "true", ",", "calcSqlSelectAllSorted", "(", ")", ")", ";", "}" ]
Fetch all existing BOs from storage, sorted by primary key(s) and return the result as a stream. @param conn @return @since 0.9.0
[ "Fetch", "all", "existing", "BOs", "from", "storage", "sorted", "by", "primary", "key", "(", "s", ")", "and", "return", "the", "result", "as", "a", "stream", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java#L616-L618
uber/NullAway
nullaway/src/main/java/com/uber/nullaway/ErrorBuilder.java
ErrorBuilder.createErrorDescription
Description createErrorDescription( ErrorMessage errorMessage, TreePath path, Description.Builder descriptionBuilder) { """ create an error description for a nullability warning @param errorMessage the error message object. @param path the TreePath to the error location. Used to compute a suggested fix at the enclosing method for the error location @param descriptionBuilder the description builder for the error. @return the error description """ Tree enclosingSuppressTree = suppressibleNode(path); return createErrorDescription(errorMessage, enclosingSuppressTree, descriptionBuilder); }
java
Description createErrorDescription( ErrorMessage errorMessage, TreePath path, Description.Builder descriptionBuilder) { Tree enclosingSuppressTree = suppressibleNode(path); return createErrorDescription(errorMessage, enclosingSuppressTree, descriptionBuilder); }
[ "Description", "createErrorDescription", "(", "ErrorMessage", "errorMessage", ",", "TreePath", "path", ",", "Description", ".", "Builder", "descriptionBuilder", ")", "{", "Tree", "enclosingSuppressTree", "=", "suppressibleNode", "(", "path", ")", ";", "return", "createErrorDescription", "(", "errorMessage", ",", "enclosingSuppressTree", ",", "descriptionBuilder", ")", ";", "}" ]
create an error description for a nullability warning @param errorMessage the error message object. @param path the TreePath to the error location. Used to compute a suggested fix at the enclosing method for the error location @param descriptionBuilder the description builder for the error. @return the error description
[ "create", "an", "error", "description", "for", "a", "nullability", "warning" ]
train
https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/ErrorBuilder.java#L78-L82
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicylabel_appfwpolicy_binding.java
appfwpolicylabel_appfwpolicy_binding.count_filtered
public static long count_filtered(nitro_service service, String labelname, String filter) throws Exception { """ Use this API to count the filtered set of appfwpolicylabel_appfwpolicy_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP". """ appfwpolicylabel_appfwpolicy_binding obj = new appfwpolicylabel_appfwpolicy_binding(); obj.set_labelname(labelname); options option = new options(); option.set_count(true); option.set_filter(filter); appfwpolicylabel_appfwpolicy_binding[] response = (appfwpolicylabel_appfwpolicy_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String labelname, String filter) throws Exception{ appfwpolicylabel_appfwpolicy_binding obj = new appfwpolicylabel_appfwpolicy_binding(); obj.set_labelname(labelname); options option = new options(); option.set_count(true); option.set_filter(filter); appfwpolicylabel_appfwpolicy_binding[] response = (appfwpolicylabel_appfwpolicy_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "labelname", ",", "String", "filter", ")", "throws", "Exception", "{", "appfwpolicylabel_appfwpolicy_binding", "obj", "=", "new", "appfwpolicylabel_appfwpolicy_binding", "(", ")", ";", "obj", ".", "set_labelname", "(", "labelname", ")", ";", "options", "option", "=", "new", "options", "(", ")", ";", "option", ".", "set_count", "(", "true", ")", ";", "option", ".", "set_filter", "(", "filter", ")", ";", "appfwpolicylabel_appfwpolicy_binding", "[", "]", "response", "=", "(", "appfwpolicylabel_appfwpolicy_binding", "[", "]", ")", "obj", ".", "getfiltered", "(", "service", ",", "option", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "return", "response", "[", "0", "]", ".", "__count", ";", "}", "return", "0", ";", "}" ]
Use this API to count the filtered set of appfwpolicylabel_appfwpolicy_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "the", "filtered", "set", "of", "appfwpolicylabel_appfwpolicy_binding", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicylabel_appfwpolicy_binding.java#L335-L346
protostuff/protostuff-compiler
protostuff-generator/src/main/java/io/protostuff/generator/html/uml/PlantUmlVerbatimSerializer.java
PlantUmlVerbatimSerializer.addToMap
public static void addToMap(final Map<String, VerbatimSerializer> serializerMap) { """ Register an instance of {@link PlantUmlVerbatimSerializer} in the given serializer's map. """ PlantUmlVerbatimSerializer serializer = new PlantUmlVerbatimSerializer(); for (Type type : Type.values()) { String name = type.getName(); serializerMap.put(name, serializer); } }
java
public static void addToMap(final Map<String, VerbatimSerializer> serializerMap) { PlantUmlVerbatimSerializer serializer = new PlantUmlVerbatimSerializer(); for (Type type : Type.values()) { String name = type.getName(); serializerMap.put(name, serializer); } }
[ "public", "static", "void", "addToMap", "(", "final", "Map", "<", "String", ",", "VerbatimSerializer", ">", "serializerMap", ")", "{", "PlantUmlVerbatimSerializer", "serializer", "=", "new", "PlantUmlVerbatimSerializer", "(", ")", ";", "for", "(", "Type", "type", ":", "Type", ".", "values", "(", ")", ")", "{", "String", "name", "=", "type", ".", "getName", "(", ")", ";", "serializerMap", ".", "put", "(", "name", ",", "serializer", ")", ";", "}", "}" ]
Register an instance of {@link PlantUmlVerbatimSerializer} in the given serializer's map.
[ "Register", "an", "instance", "of", "{" ]
train
https://github.com/protostuff/protostuff-compiler/blob/665256c42cb41da849e8321ffcab088350ace171/protostuff-generator/src/main/java/io/protostuff/generator/html/uml/PlantUmlVerbatimSerializer.java#L27-L33
structurizr/java
structurizr-core/src/com/structurizr/model/Model.java
Model.addPerson
@Nonnull public Person addPerson(Location location, @Nonnull String name, @Nullable String description) { """ Creates a person and adds it to the model. @param location the location of the person (e.g. internal, external, etc) @param name the name of the person (e.g. "Admin User" or "Bob the Business User") @param description a short description of the person @return the Person instance created and added to the model (or null) @throws IllegalArgumentException if a person with the same name already exists """ if (getPersonWithName(name) == null) { Person person = new Person(); person.setLocation(location); person.setName(name); person.setDescription(description); people.add(person); person.setId(idGenerator.generateId(person)); addElementToInternalStructures(person); return person; } else { throw new IllegalArgumentException("A person named '" + name + "' already exists."); } }
java
@Nonnull public Person addPerson(Location location, @Nonnull String name, @Nullable String description) { if (getPersonWithName(name) == null) { Person person = new Person(); person.setLocation(location); person.setName(name); person.setDescription(description); people.add(person); person.setId(idGenerator.generateId(person)); addElementToInternalStructures(person); return person; } else { throw new IllegalArgumentException("A person named '" + name + "' already exists."); } }
[ "@", "Nonnull", "public", "Person", "addPerson", "(", "Location", "location", ",", "@", "Nonnull", "String", "name", ",", "@", "Nullable", "String", "description", ")", "{", "if", "(", "getPersonWithName", "(", "name", ")", "==", "null", ")", "{", "Person", "person", "=", "new", "Person", "(", ")", ";", "person", ".", "setLocation", "(", "location", ")", ";", "person", ".", "setName", "(", "name", ")", ";", "person", ".", "setDescription", "(", "description", ")", ";", "people", ".", "add", "(", "person", ")", ";", "person", ".", "setId", "(", "idGenerator", ".", "generateId", "(", "person", ")", ")", ";", "addElementToInternalStructures", "(", "person", ")", ";", "return", "person", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"A person named '\"", "+", "name", "+", "\"' already exists.\"", ")", ";", "}", "}" ]
Creates a person and adds it to the model. @param location the location of the person (e.g. internal, external, etc) @param name the name of the person (e.g. "Admin User" or "Bob the Business User") @param description a short description of the person @return the Person instance created and added to the model (or null) @throws IllegalArgumentException if a person with the same name already exists
[ "Creates", "a", "person", "and", "adds", "it", "to", "the", "model", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L109-L126
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.tagImage
public TagResult tagImage(String url, TagImageOptionalParameter tagImageOptionalParameter) { """ This operation generates a list of words, or tags, that are relevant to the content of the supplied image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image content. Tags may contain hints to avoid ambiguity or provide context, for example the tag 'cello' may be accompanied by the hint 'musical instrument'. All tags are in English. @param url Publicly reachable URL of an image @param tagImageOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ComputerVisionErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the TagResult object if successful. """ return tagImageWithServiceResponseAsync(url, tagImageOptionalParameter).toBlocking().single().body(); }
java
public TagResult tagImage(String url, TagImageOptionalParameter tagImageOptionalParameter) { return tagImageWithServiceResponseAsync(url, tagImageOptionalParameter).toBlocking().single().body(); }
[ "public", "TagResult", "tagImage", "(", "String", "url", ",", "TagImageOptionalParameter", "tagImageOptionalParameter", ")", "{", "return", "tagImageWithServiceResponseAsync", "(", "url", ",", "tagImageOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
This operation generates a list of words, or tags, that are relevant to the content of the supplied image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image content. Tags may contain hints to avoid ambiguity or provide context, for example the tag 'cello' may be accompanied by the hint 'musical instrument'. All tags are in English. @param url Publicly reachable URL of an image @param tagImageOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ComputerVisionErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the TagResult object if successful.
[ "This", "operation", "generates", "a", "list", "of", "words", "or", "tags", "that", "are", "relevant", "to", "the", "content", "of", "the", "supplied", "image", ".", "The", "Computer", "Vision", "API", "can", "return", "tags", "based", "on", "objects", "living", "beings", "scenery", "or", "actions", "found", "in", "images", ".", "Unlike", "categories", "tags", "are", "not", "organized", "according", "to", "a", "hierarchical", "classification", "system", "but", "correspond", "to", "image", "content", ".", "Tags", "may", "contain", "hints", "to", "avoid", "ambiguity", "or", "provide", "context", "for", "example", "the", "tag", "cello", "may", "be", "accompanied", "by", "the", "hint", "musical", "instrument", ".", "All", "tags", "are", "in", "English", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1584-L1586
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.describeImageInStreamWithServiceResponseAsync
public Observable<ServiceResponse<ImageDescription>> describeImageInStreamWithServiceResponseAsync(byte[] image, DescribeImageInStreamOptionalParameter describeImageInStreamOptionalParameter) { """ This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL.A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong. @param image An image stream. @param describeImageInStreamOptionalParameter 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 ImageDescription object """ if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } final String maxCandidates = describeImageInStreamOptionalParameter != null ? describeImageInStreamOptionalParameter.maxCandidates() : null; final String language = describeImageInStreamOptionalParameter != null ? describeImageInStreamOptionalParameter.language() : null; return describeImageInStreamWithServiceResponseAsync(image, maxCandidates, language); }
java
public Observable<ServiceResponse<ImageDescription>> describeImageInStreamWithServiceResponseAsync(byte[] image, DescribeImageInStreamOptionalParameter describeImageInStreamOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } final String maxCandidates = describeImageInStreamOptionalParameter != null ? describeImageInStreamOptionalParameter.maxCandidates() : null; final String language = describeImageInStreamOptionalParameter != null ? describeImageInStreamOptionalParameter.language() : null; return describeImageInStreamWithServiceResponseAsync(image, maxCandidates, language); }
[ "public", "Observable", "<", "ServiceResponse", "<", "ImageDescription", ">", ">", "describeImageInStreamWithServiceResponseAsync", "(", "byte", "[", "]", "image", ",", "DescribeImageInStreamOptionalParameter", "describeImageInStreamOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoint", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.endpoint() is required and cannot be null.\"", ")", ";", "}", "if", "(", "image", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter image is required and cannot be null.\"", ")", ";", "}", "final", "String", "maxCandidates", "=", "describeImageInStreamOptionalParameter", "!=", "null", "?", "describeImageInStreamOptionalParameter", ".", "maxCandidates", "(", ")", ":", "null", ";", "final", "String", "language", "=", "describeImageInStreamOptionalParameter", "!=", "null", "?", "describeImageInStreamOptionalParameter", ".", "language", "(", ")", ":", "null", ";", "return", "describeImageInStreamWithServiceResponseAsync", "(", "image", ",", "maxCandidates", ",", "language", ")", ";", "}" ]
This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL.A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong. @param image An image stream. @param describeImageInStreamOptionalParameter 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 ImageDescription object
[ "This", "operation", "generates", "a", "description", "of", "an", "image", "in", "human", "readable", "language", "with", "complete", "sentences", ".", "The", "description", "is", "based", "on", "a", "collection", "of", "content", "tags", "which", "are", "also", "returned", "by", "the", "operation", ".", "More", "than", "one", "description", "can", "be", "generated", "for", "each", "image", ".", "Descriptions", "are", "ordered", "by", "their", "confidence", "score", ".", "All", "descriptions", "are", "in", "English", ".", "Two", "input", "methods", "are", "supported", "--", "(", "1", ")", "Uploading", "an", "image", "or", "(", "2", ")", "specifying", "an", "image", "URL", ".", "A", "successful", "response", "will", "be", "returned", "in", "JSON", ".", "If", "the", "request", "failed", "the", "response", "will", "contain", "an", "error", "code", "and", "a", "message", "to", "help", "understand", "what", "went", "wrong", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L620-L631
huahin/huahin-core
src/main/java/org/huahinframework/core/SimpleJob.java
SimpleJob.setSummarizer
public SimpleJob setSummarizer(Class<? extends Reducer<Key, Value, Key, Value>> clazz) { """ Job {@link Summarizer} class setting. @param clazz {@link Summarizer} class @return this """ return setSummarizer(clazz, false, 0); }
java
public SimpleJob setSummarizer(Class<? extends Reducer<Key, Value, Key, Value>> clazz) { return setSummarizer(clazz, false, 0); }
[ "public", "SimpleJob", "setSummarizer", "(", "Class", "<", "?", "extends", "Reducer", "<", "Key", ",", "Value", ",", "Key", ",", "Value", ">", ">", "clazz", ")", "{", "return", "setSummarizer", "(", "clazz", ",", "false", ",", "0", ")", ";", "}" ]
Job {@link Summarizer} class setting. @param clazz {@link Summarizer} class @return this
[ "Job", "{" ]
train
https://github.com/huahin/huahin-core/blob/a87921b5a12be92a822f753c075ab2431036e6f5/src/main/java/org/huahinframework/core/SimpleJob.java#L160-L162
zmarko/sss
src/main/java/rs/in/zivanovic/sss/SasUtils.java
SasUtils.decodeIntegerToString
@SuppressWarnings("empty-statement") public static String decodeIntegerToString(BigInteger num) { """ Decode integer encoded with {@link #encodeStringToInteger(java.lang.String) } back to Unicode string form. @param num integer to decode back to string. @return decoded string. """ byte[] bytes = num.toByteArray(); int count; for (count = 0; count < bytes.length && bytes[count] == 0; count++); byte[] trimmed = new byte[bytes.length - count]; System.arraycopy(bytes, count, trimmed, 0, trimmed.length); return new String(trimmed, StandardCharsets.UTF_8); }
java
@SuppressWarnings("empty-statement") public static String decodeIntegerToString(BigInteger num) { byte[] bytes = num.toByteArray(); int count; for (count = 0; count < bytes.length && bytes[count] == 0; count++); byte[] trimmed = new byte[bytes.length - count]; System.arraycopy(bytes, count, trimmed, 0, trimmed.length); return new String(trimmed, StandardCharsets.UTF_8); }
[ "@", "SuppressWarnings", "(", "\"empty-statement\"", ")", "public", "static", "String", "decodeIntegerToString", "(", "BigInteger", "num", ")", "{", "byte", "[", "]", "bytes", "=", "num", ".", "toByteArray", "(", ")", ";", "int", "count", ";", "for", "(", "count", "=", "0", ";", "count", "<", "bytes", ".", "length", "&&", "bytes", "[", "count", "]", "==", "0", ";", "count", "++", ")", ";", "byte", "[", "]", "trimmed", "=", "new", "byte", "[", "bytes", ".", "length", "-", "count", "]", ";", "System", ".", "arraycopy", "(", "bytes", ",", "count", ",", "trimmed", ",", "0", ",", "trimmed", ".", "length", ")", ";", "return", "new", "String", "(", "trimmed", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "}" ]
Decode integer encoded with {@link #encodeStringToInteger(java.lang.String) } back to Unicode string form. @param num integer to decode back to string. @return decoded string.
[ "Decode", "integer", "encoded", "with", "{", "@link", "#encodeStringToInteger", "(", "java", ".", "lang", ".", "String", ")", "}", "back", "to", "Unicode", "string", "form", "." ]
train
https://github.com/zmarko/sss/blob/a41d9d39ca9a4ca1a2719c441c88e209ffc511f5/src/main/java/rs/in/zivanovic/sss/SasUtils.java#L70-L78
redkale/redkale
src/org/redkale/util/ResourceFactory.java
ResourceFactory.register
public <A> A register(final boolean autoSync, final String name, final Type clazz, final A rs) { """ 将对象以指定资源名和类型注入到资源池中 @param <A> 泛型 @param autoSync 是否同步已被注入的资源 @param name 资源名 @param clazz 资源类型 @param rs 资源对象 @return 旧资源对象 """ checkResourceName(name); ConcurrentHashMap<String, ResourceEntry> map = this.store.get(clazz); if (map == null) { synchronized (clazz) { map = this.store.get(clazz); if (map == null) { map = new ConcurrentHashMap(); store.put(clazz, map); } } } ResourceEntry re = map.get(name); if (re == null) { map.put(name, new ResourceEntry(rs)); } else { map.put(name, new ResourceEntry(rs, name, re.elements, autoSync)); } return re == null ? null : (A) re.value; }
java
public <A> A register(final boolean autoSync, final String name, final Type clazz, final A rs) { checkResourceName(name); ConcurrentHashMap<String, ResourceEntry> map = this.store.get(clazz); if (map == null) { synchronized (clazz) { map = this.store.get(clazz); if (map == null) { map = new ConcurrentHashMap(); store.put(clazz, map); } } } ResourceEntry re = map.get(name); if (re == null) { map.put(name, new ResourceEntry(rs)); } else { map.put(name, new ResourceEntry(rs, name, re.elements, autoSync)); } return re == null ? null : (A) re.value; }
[ "public", "<", "A", ">", "A", "register", "(", "final", "boolean", "autoSync", ",", "final", "String", "name", ",", "final", "Type", "clazz", ",", "final", "A", "rs", ")", "{", "checkResourceName", "(", "name", ")", ";", "ConcurrentHashMap", "<", "String", ",", "ResourceEntry", ">", "map", "=", "this", ".", "store", ".", "get", "(", "clazz", ")", ";", "if", "(", "map", "==", "null", ")", "{", "synchronized", "(", "clazz", ")", "{", "map", "=", "this", ".", "store", ".", "get", "(", "clazz", ")", ";", "if", "(", "map", "==", "null", ")", "{", "map", "=", "new", "ConcurrentHashMap", "(", ")", ";", "store", ".", "put", "(", "clazz", ",", "map", ")", ";", "}", "}", "}", "ResourceEntry", "re", "=", "map", ".", "get", "(", "name", ")", ";", "if", "(", "re", "==", "null", ")", "{", "map", ".", "put", "(", "name", ",", "new", "ResourceEntry", "(", "rs", ")", ")", ";", "}", "else", "{", "map", ".", "put", "(", "name", ",", "new", "ResourceEntry", "(", "rs", ",", "name", ",", "re", ".", "elements", ",", "autoSync", ")", ")", ";", "}", "return", "re", "==", "null", "?", "null", ":", "(", "A", ")", "re", ".", "value", ";", "}" ]
将对象以指定资源名和类型注入到资源池中 @param <A> 泛型 @param autoSync 是否同步已被注入的资源 @param name 资源名 @param clazz 资源类型 @param rs 资源对象 @return 旧资源对象
[ "将对象以指定资源名和类型注入到资源池中" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/ResourceFactory.java#L401-L420
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java
Path3d.getPathIteratorProperty
@Pure public PathIterator3d getPathIteratorProperty(Transform3D transform, double flatness) { """ Replies an iterator on the path elements. <p> Only {@link PathElementType#MOVE_TO}, {@link PathElementType#LINE_TO}, and {@link PathElementType#CLOSE} types are returned by the iterator. <p> The amount of subdivision of the curved segments is controlled by the flatness parameter, which specifies the maximum distance that any point on the unflattened transformed curve can deviate from the returned flattened path segments. Note that a limit on the accuracy of the flattened path might be silently imposed, causing very small flattening parameters to be treated as larger values. This limit, if there is one, is defined by the particular implementation that is used. <p> The iterator for this class is not multi-threaded safe. @param transform is an optional affine Transform3D to be applied to the coordinates as they are returned in the iteration, or <code>null</code> if untransformed coordinates are desired. @param flatness is the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve. @return an iterator on the path elements. """ return new FlatteningPathIterator3d(getWindingRule(), getPathIteratorProperty(transform), flatness, 10); }
java
@Pure public PathIterator3d getPathIteratorProperty(Transform3D transform, double flatness) { return new FlatteningPathIterator3d(getWindingRule(), getPathIteratorProperty(transform), flatness, 10); }
[ "@", "Pure", "public", "PathIterator3d", "getPathIteratorProperty", "(", "Transform3D", "transform", ",", "double", "flatness", ")", "{", "return", "new", "FlatteningPathIterator3d", "(", "getWindingRule", "(", ")", ",", "getPathIteratorProperty", "(", "transform", ")", ",", "flatness", ",", "10", ")", ";", "}" ]
Replies an iterator on the path elements. <p> Only {@link PathElementType#MOVE_TO}, {@link PathElementType#LINE_TO}, and {@link PathElementType#CLOSE} types are returned by the iterator. <p> The amount of subdivision of the curved segments is controlled by the flatness parameter, which specifies the maximum distance that any point on the unflattened transformed curve can deviate from the returned flattened path segments. Note that a limit on the accuracy of the flattened path might be silently imposed, causing very small flattening parameters to be treated as larger values. This limit, if there is one, is defined by the particular implementation that is used. <p> The iterator for this class is not multi-threaded safe. @param transform is an optional affine Transform3D to be applied to the coordinates as they are returned in the iteration, or <code>null</code> if untransformed coordinates are desired. @param flatness is the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve. @return an iterator on the path elements.
[ "Replies", "an", "iterator", "on", "the", "path", "elements", ".", "<p", ">", "Only", "{", "@link", "PathElementType#MOVE_TO", "}", "{", "@link", "PathElementType#LINE_TO", "}", "and", "{", "@link", "PathElementType#CLOSE", "}", "types", "are", "returned", "by", "the", "iterator", ".", "<p", ">", "The", "amount", "of", "subdivision", "of", "the", "curved", "segments", "is", "controlled", "by", "the", "flatness", "parameter", "which", "specifies", "the", "maximum", "distance", "that", "any", "point", "on", "the", "unflattened", "transformed", "curve", "can", "deviate", "from", "the", "returned", "flattened", "path", "segments", ".", "Note", "that", "a", "limit", "on", "the", "accuracy", "of", "the", "flattened", "path", "might", "be", "silently", "imposed", "causing", "very", "small", "flattening", "parameters", "to", "be", "treated", "as", "larger", "values", ".", "This", "limit", "if", "there", "is", "one", "is", "defined", "by", "the", "particular", "implementation", "that", "is", "used", ".", "<p", ">", "The", "iterator", "for", "this", "class", "is", "not", "multi", "-", "threaded", "safe", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L1835-L1838
Labs64/swid-generator
src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java
DefaultSwidProcessor.setProductVersion
public DefaultSwidProcessor setProductVersion(final String productVersion, final long productVersionMajor, final long productVersionMinor, final long productVersionBuild, final long productVersionReview) { """ Identifies the product version (tag: product_version) using two values – numeric version and version string. @param productVersion product version @param productVersionMajor product major version @param productVersionMinor product minor version @param productVersionBuild product build version @param productVersionReview product review version @return a reference to this object. """ final NumericVersionComplexType numericVersion = new NumericVersionComplexType( new UInt(productVersionMajor, idGenerator.nextId()), new UInt(productVersionMinor, idGenerator.nextId()), new UInt(productVersionBuild, idGenerator.nextId()), new UInt(productVersionReview, idGenerator.nextId()), idGenerator.nextId()); swidTag.setProductVersion( new ProductVersionComplexType( new Token(productVersion, idGenerator.nextId()), numericVersion, idGenerator.nextId())); return this; }
java
public DefaultSwidProcessor setProductVersion(final String productVersion, final long productVersionMajor, final long productVersionMinor, final long productVersionBuild, final long productVersionReview) { final NumericVersionComplexType numericVersion = new NumericVersionComplexType( new UInt(productVersionMajor, idGenerator.nextId()), new UInt(productVersionMinor, idGenerator.nextId()), new UInt(productVersionBuild, idGenerator.nextId()), new UInt(productVersionReview, idGenerator.nextId()), idGenerator.nextId()); swidTag.setProductVersion( new ProductVersionComplexType( new Token(productVersion, idGenerator.nextId()), numericVersion, idGenerator.nextId())); return this; }
[ "public", "DefaultSwidProcessor", "setProductVersion", "(", "final", "String", "productVersion", ",", "final", "long", "productVersionMajor", ",", "final", "long", "productVersionMinor", ",", "final", "long", "productVersionBuild", ",", "final", "long", "productVersionReview", ")", "{", "final", "NumericVersionComplexType", "numericVersion", "=", "new", "NumericVersionComplexType", "(", "new", "UInt", "(", "productVersionMajor", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "new", "UInt", "(", "productVersionMinor", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "new", "UInt", "(", "productVersionBuild", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "new", "UInt", "(", "productVersionReview", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "idGenerator", ".", "nextId", "(", ")", ")", ";", "swidTag", ".", "setProductVersion", "(", "new", "ProductVersionComplexType", "(", "new", "Token", "(", "productVersion", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "numericVersion", ",", "idGenerator", ".", "nextId", "(", ")", ")", ")", ";", "return", "this", ";", "}" ]
Identifies the product version (tag: product_version) using two values – numeric version and version string. @param productVersion product version @param productVersionMajor product major version @param productVersionMinor product minor version @param productVersionBuild product build version @param productVersionReview product review version @return a reference to this object.
[ "Identifies", "the", "product", "version", "(", "tag", ":", "product_version", ")", "using", "two", "values", "–", "numeric", "version", "and", "version", "string", "." ]
train
https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java#L111-L126
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java
AbstractRegionPainter.getFocusPaint
public Paint getFocusPaint(Shape s, FocusType focusType, boolean useToolBarFocus) { """ Get the paint to use for a focus ring. @param s the shape to paint. @param focusType the focus type. @param useToolBarFocus whether we should use the colors for a toolbar control. @return the paint to use to paint the focus ring. """ if (focusType == FocusType.OUTER_FOCUS) { return useToolBarFocus ? outerToolBarFocus : outerFocus; } else { return useToolBarFocus ? innerToolBarFocus : innerFocus; } }
java
public Paint getFocusPaint(Shape s, FocusType focusType, boolean useToolBarFocus) { if (focusType == FocusType.OUTER_FOCUS) { return useToolBarFocus ? outerToolBarFocus : outerFocus; } else { return useToolBarFocus ? innerToolBarFocus : innerFocus; } }
[ "public", "Paint", "getFocusPaint", "(", "Shape", "s", ",", "FocusType", "focusType", ",", "boolean", "useToolBarFocus", ")", "{", "if", "(", "focusType", "==", "FocusType", ".", "OUTER_FOCUS", ")", "{", "return", "useToolBarFocus", "?", "outerToolBarFocus", ":", "outerFocus", ";", "}", "else", "{", "return", "useToolBarFocus", "?", "innerToolBarFocus", ":", "innerFocus", ";", "}", "}" ]
Get the paint to use for a focus ring. @param s the shape to paint. @param focusType the focus type. @param useToolBarFocus whether we should use the colors for a toolbar control. @return the paint to use to paint the focus ring.
[ "Get", "the", "paint", "to", "use", "for", "a", "focus", "ring", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java#L175-L181
fuinorg/srcgen4j-commons
src/main/java/org/fuin/srcgen4j/commons/JaxbHelper.java
JaxbHelper.containsStartTag
public boolean containsStartTag(@NotNull @FileExists @IsFile final File file, @NotNull final String tagName) { """ Checks if the given file contains a start tag within the first 1024 bytes. @param file File to check. @param tagName Name of the tag. A "&lt;" will be added to this name internally to locate the start tag. @return If the file contains the start tag TRUE else FALSE. """ Contract.requireArgNotNull("file", file); FileExistsValidator.requireArgValid("file", file); IsFileValidator.requireArgValid("file", file); Contract.requireArgNotNull("tagName", tagName); final String xml = readFirstPartOfFile(file); return xml.indexOf("<" + tagName) > -1; }
java
public boolean containsStartTag(@NotNull @FileExists @IsFile final File file, @NotNull final String tagName) { Contract.requireArgNotNull("file", file); FileExistsValidator.requireArgValid("file", file); IsFileValidator.requireArgValid("file", file); Contract.requireArgNotNull("tagName", tagName); final String xml = readFirstPartOfFile(file); return xml.indexOf("<" + tagName) > -1; }
[ "public", "boolean", "containsStartTag", "(", "@", "NotNull", "@", "FileExists", "@", "IsFile", "final", "File", "file", ",", "@", "NotNull", "final", "String", "tagName", ")", "{", "Contract", ".", "requireArgNotNull", "(", "\"file\"", ",", "file", ")", ";", "FileExistsValidator", ".", "requireArgValid", "(", "\"file\"", ",", "file", ")", ";", "IsFileValidator", ".", "requireArgValid", "(", "\"file\"", ",", "file", ")", ";", "Contract", ".", "requireArgNotNull", "(", "\"tagName\"", ",", "tagName", ")", ";", "final", "String", "xml", "=", "readFirstPartOfFile", "(", "file", ")", ";", "return", "xml", ".", "indexOf", "(", "\"<\"", "+", "tagName", ")", ">", "-", "1", ";", "}" ]
Checks if the given file contains a start tag within the first 1024 bytes. @param file File to check. @param tagName Name of the tag. A "&lt;" will be added to this name internally to locate the start tag. @return If the file contains the start tag TRUE else FALSE.
[ "Checks", "if", "the", "given", "file", "contains", "a", "start", "tag", "within", "the", "first", "1024", "bytes", "." ]
train
https://github.com/fuinorg/srcgen4j-commons/blob/bce26fd3167ea91fb2f3ad3fc9a1836d3d9fb14b/src/main/java/org/fuin/srcgen4j/commons/JaxbHelper.java#L76-L84
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.summarizeForResourceGroupLevelPolicyAssignmentAsync
public Observable<SummarizeResultsInner> summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { """ Summarizes policy states for the resource group level policy assignment. @param subscriptionId Microsoft Azure subscription ID. @param resourceGroupName Resource group name. @param policyAssignmentName Policy assignment name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SummarizeResultsInner object """ return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
java
public Observable<SummarizeResultsInner> summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SummarizeResultsInner", ">", "summarizeForResourceGroupLevelPolicyAssignmentAsync", "(", "String", "subscriptionId", ",", "String", "resourceGroupName", ",", "String", "policyAssignmentName", ")", "{", "return", "summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync", "(", "subscriptionId", ",", "resourceGroupName", ",", "policyAssignmentName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "SummarizeResultsInner", ">", ",", "SummarizeResultsInner", ">", "(", ")", "{", "@", "Override", "public", "SummarizeResultsInner", "call", "(", "ServiceResponse", "<", "SummarizeResultsInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Summarizes policy states for the resource group level policy assignment. @param subscriptionId Microsoft Azure subscription ID. @param resourceGroupName Resource group name. @param policyAssignmentName Policy assignment name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SummarizeResultsInner object
[ "Summarizes", "policy", "states", "for", "the", "resource", "group", "level", "policy", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L3136-L3143
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java
JpaControllerManagement.isUpdatingActionStatusAllowed
private boolean isUpdatingActionStatusAllowed(final JpaAction action, final JpaActionStatus actionStatus) { """ ActionStatus updates are allowed mainly if the action is active. If the action is not active we accept further status updates if permitted so by repository configuration. In this case, only the values: Status.ERROR and Status.FINISHED are allowed. In the case of a DOWNLOAD_ONLY action, we accept status updates only once. """ final boolean isIntermediateFeedback = !FINISHED.equals(actionStatus.getStatus()) && !Status.ERROR.equals(actionStatus.getStatus()); final boolean isAllowedByRepositoryConfiguration = !repositoryProperties.isRejectActionStatusForClosedAction() && isIntermediateFeedback; final boolean isAllowedForDownloadOnlyActions = isDownloadOnly(action) && !isIntermediateFeedback; return action.isActive() || isAllowedByRepositoryConfiguration || isAllowedForDownloadOnlyActions; }
java
private boolean isUpdatingActionStatusAllowed(final JpaAction action, final JpaActionStatus actionStatus) { final boolean isIntermediateFeedback = !FINISHED.equals(actionStatus.getStatus()) && !Status.ERROR.equals(actionStatus.getStatus()); final boolean isAllowedByRepositoryConfiguration = !repositoryProperties.isRejectActionStatusForClosedAction() && isIntermediateFeedback; final boolean isAllowedForDownloadOnlyActions = isDownloadOnly(action) && !isIntermediateFeedback; return action.isActive() || isAllowedByRepositoryConfiguration || isAllowedForDownloadOnlyActions; }
[ "private", "boolean", "isUpdatingActionStatusAllowed", "(", "final", "JpaAction", "action", ",", "final", "JpaActionStatus", "actionStatus", ")", "{", "final", "boolean", "isIntermediateFeedback", "=", "!", "FINISHED", ".", "equals", "(", "actionStatus", ".", "getStatus", "(", ")", ")", "&&", "!", "Status", ".", "ERROR", ".", "equals", "(", "actionStatus", ".", "getStatus", "(", ")", ")", ";", "final", "boolean", "isAllowedByRepositoryConfiguration", "=", "!", "repositoryProperties", ".", "isRejectActionStatusForClosedAction", "(", ")", "&&", "isIntermediateFeedback", ";", "final", "boolean", "isAllowedForDownloadOnlyActions", "=", "isDownloadOnly", "(", "action", ")", "&&", "!", "isIntermediateFeedback", ";", "return", "action", ".", "isActive", "(", ")", "||", "isAllowedByRepositoryConfiguration", "||", "isAllowedForDownloadOnlyActions", ";", "}" ]
ActionStatus updates are allowed mainly if the action is active. If the action is not active we accept further status updates if permitted so by repository configuration. In this case, only the values: Status.ERROR and Status.FINISHED are allowed. In the case of a DOWNLOAD_ONLY action, we accept status updates only once.
[ "ActionStatus", "updates", "are", "allowed", "mainly", "if", "the", "action", "is", "active", ".", "If", "the", "action", "is", "not", "active", "we", "accept", "further", "status", "updates", "if", "permitted", "so", "by", "repository", "configuration", ".", "In", "this", "case", "only", "the", "values", ":", "Status", ".", "ERROR", "and", "Status", ".", "FINISHED", "are", "allowed", ".", "In", "the", "case", "of", "a", "DOWNLOAD_ONLY", "action", "we", "accept", "status", "updates", "only", "once", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java#L589-L600
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java
MainClassFinder.findMainClass
public static String findMainClass(JarFile jarFile, String classesLocation) throws IOException { """ Find the main class in a given jar file. @param jarFile the jar file to search @param classesLocation the location within the jar containing classes @return the main class or {@code null} @throws IOException if the jar file cannot be read """ return doWithMainClasses(jarFile, classesLocation, MainClass::getName); }
java
public static String findMainClass(JarFile jarFile, String classesLocation) throws IOException { return doWithMainClasses(jarFile, classesLocation, MainClass::getName); }
[ "public", "static", "String", "findMainClass", "(", "JarFile", "jarFile", ",", "String", "classesLocation", ")", "throws", "IOException", "{", "return", "doWithMainClasses", "(", "jarFile", ",", "classesLocation", ",", "MainClass", "::", "getName", ")", ";", "}" ]
Find the main class in a given jar file. @param jarFile the jar file to search @param classesLocation the location within the jar containing classes @return the main class or {@code null} @throws IOException if the jar file cannot be read
[ "Find", "the", "main", "class", "in", "a", "given", "jar", "file", "." ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java#L173-L176
WASdev/ci.maven
liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java
SpringBootUtil.getSpringBootUberJARLocation
public static File getSpringBootUberJARLocation(MavenProject project, Log log) { """ Get the Spring Boot Uber JAR in its expected location, taking into account the spring-boot-maven-plugin classifier configuration as well. No validation is done, that is, there is no guarantee the JAR file actually exists at the returned location. @param outputDirectory @param project @param log @return the File representing the JAR location, whether a file exists there or not. """ String classifier = getSpringBootMavenPluginClassifier(project, log); if (classifier == null) { classifier = ""; } if (!classifier.isEmpty() && !classifier.startsWith("-")) { classifier = "-" + classifier; } return new File(project.getBuild().getDirectory(), project.getBuild().getFinalName() + classifier + "." + project.getArtifact().getArtifactHandler().getExtension()); }
java
public static File getSpringBootUberJARLocation(MavenProject project, Log log) { String classifier = getSpringBootMavenPluginClassifier(project, log); if (classifier == null) { classifier = ""; } if (!classifier.isEmpty() && !classifier.startsWith("-")) { classifier = "-" + classifier; } return new File(project.getBuild().getDirectory(), project.getBuild().getFinalName() + classifier + "." + project.getArtifact().getArtifactHandler().getExtension()); }
[ "public", "static", "File", "getSpringBootUberJARLocation", "(", "MavenProject", "project", ",", "Log", "log", ")", "{", "String", "classifier", "=", "getSpringBootMavenPluginClassifier", "(", "project", ",", "log", ")", ";", "if", "(", "classifier", "==", "null", ")", "{", "classifier", "=", "\"\"", ";", "}", "if", "(", "!", "classifier", ".", "isEmpty", "(", ")", "&&", "!", "classifier", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "classifier", "=", "\"-\"", "+", "classifier", ";", "}", "return", "new", "File", "(", "project", ".", "getBuild", "(", ")", ".", "getDirectory", "(", ")", ",", "project", ".", "getBuild", "(", ")", ".", "getFinalName", "(", ")", "+", "classifier", "+", "\".\"", "+", "project", ".", "getArtifact", "(", ")", ".", "getArtifactHandler", "(", ")", ".", "getExtension", "(", ")", ")", ";", "}" ]
Get the Spring Boot Uber JAR in its expected location, taking into account the spring-boot-maven-plugin classifier configuration as well. No validation is done, that is, there is no guarantee the JAR file actually exists at the returned location. @param outputDirectory @param project @param log @return the File representing the JAR location, whether a file exists there or not.
[ "Get", "the", "Spring", "Boot", "Uber", "JAR", "in", "its", "expected", "location", "taking", "into", "account", "the", "spring", "-", "boot", "-", "maven", "-", "plugin", "classifier", "configuration", "as", "well", ".", "No", "validation", "is", "done", "that", "is", "there", "is", "no", "guarantee", "the", "JAR", "file", "actually", "exists", "at", "the", "returned", "location", "." ]
train
https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java#L79-L92
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getSummonerSpells
public Future<Collection<SummonerSpell>> getSummonerSpells(SpellData data) { """ <p> Get a list of all summoner spells as Java Collection </p> This method does not count towards the rate limit and is not affected by the throttle @param data Additional information to retrieve @return The summoner spells @see <a href=https://developer.riotgames.com/api/methods#!/649/2174>Official API documentation</a> """ return new DummyFuture<>(handler.getSummonerSpells(data)); }
java
public Future<Collection<SummonerSpell>> getSummonerSpells(SpellData data) { return new DummyFuture<>(handler.getSummonerSpells(data)); }
[ "public", "Future", "<", "Collection", "<", "SummonerSpell", ">", ">", "getSummonerSpells", "(", "SpellData", "data", ")", "{", "return", "new", "DummyFuture", "<>", "(", "handler", ".", "getSummonerSpells", "(", "data", ")", ")", ";", "}" ]
<p> Get a list of all summoner spells as Java Collection </p> This method does not count towards the rate limit and is not affected by the throttle @param data Additional information to retrieve @return The summoner spells @see <a href=https://developer.riotgames.com/api/methods#!/649/2174>Official API documentation</a>
[ "<p", ">", "Get", "a", "list", "of", "all", "summoner", "spells", "as", "Java", "Collection", "<", "/", "p", ">", "This", "method", "does", "not", "count", "towards", "the", "rate", "limit", "and", "is", "not", "affected", "by", "the", "throttle" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L766-L768
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java
StyleUtil.setAlign
public static CellStyle setAlign(CellStyle cellStyle, HorizontalAlignment halign, VerticalAlignment valign) { """ 设置cell文本对齐样式 @param cellStyle {@link CellStyle} @param halign 横向位置 @param valign 纵向位置 @return {@link CellStyle} """ cellStyle.setAlignment(halign); cellStyle.setVerticalAlignment(valign); return cellStyle; }
java
public static CellStyle setAlign(CellStyle cellStyle, HorizontalAlignment halign, VerticalAlignment valign) { cellStyle.setAlignment(halign); cellStyle.setVerticalAlignment(valign); return cellStyle; }
[ "public", "static", "CellStyle", "setAlign", "(", "CellStyle", "cellStyle", ",", "HorizontalAlignment", "halign", ",", "VerticalAlignment", "valign", ")", "{", "cellStyle", ".", "setAlignment", "(", "halign", ")", ";", "cellStyle", ".", "setVerticalAlignment", "(", "valign", ")", ";", "return", "cellStyle", ";", "}" ]
设置cell文本对齐样式 @param cellStyle {@link CellStyle} @param halign 横向位置 @param valign 纵向位置 @return {@link CellStyle}
[ "设置cell文本对齐样式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L55-L59
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/ThemeUtil.java
ThemeUtil.getString
public static String getString(@NonNull final Context context, @AttrRes final int resourceId) { """ Obtains the string, which corresponds to a specific resource id, from a context's theme. If the given resource id is invalid, a {@link NotFoundException} will be thrown. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource id of the attribute, which should be obtained, as an {@link Integer} value. The resource id must corresponds to a valid theme attribute @return The string, which has been obtained, as a {@link String} """ return getString(context, -1, resourceId); }
java
public static String getString(@NonNull final Context context, @AttrRes final int resourceId) { return getString(context, -1, resourceId); }
[ "public", "static", "String", "getString", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "AttrRes", "final", "int", "resourceId", ")", "{", "return", "getString", "(", "context", ",", "-", "1", ",", "resourceId", ")", ";", "}" ]
Obtains the string, which corresponds to a specific resource id, from a context's theme. If the given resource id is invalid, a {@link NotFoundException} will be thrown. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource id of the attribute, which should be obtained, as an {@link Integer} value. The resource id must corresponds to a valid theme attribute @return The string, which has been obtained, as a {@link String}
[ "Obtains", "the", "string", "which", "corresponds", "to", "a", "specific", "resource", "id", "from", "a", "context", "s", "theme", ".", "If", "the", "given", "resource", "id", "is", "invalid", "a", "{", "@link", "NotFoundException", "}", "will", "be", "thrown", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ThemeUtil.java#L202-L204
NessComputing/components-ness-config
src/main/java/com/nesscomputing/config/Config.java
Config.getFixedConfig
public static Config getFixedConfig(@Nonnull Map<String, String> config) { """ Creates a fixed configuration for the supplied Map. Only key/value pairs from this map will be present in the final configuration. There is no implicit override from system properties. """ return getFixedConfig(new MapConfiguration(config)); }
java
public static Config getFixedConfig(@Nonnull Map<String, String> config) { return getFixedConfig(new MapConfiguration(config)); }
[ "public", "static", "Config", "getFixedConfig", "(", "@", "Nonnull", "Map", "<", "String", ",", "String", ">", "config", ")", "{", "return", "getFixedConfig", "(", "new", "MapConfiguration", "(", "config", ")", ")", ";", "}" ]
Creates a fixed configuration for the supplied Map. Only key/value pairs from this map will be present in the final configuration. There is no implicit override from system properties.
[ "Creates", "a", "fixed", "configuration", "for", "the", "supplied", "Map", ".", "Only", "key", "/", "value", "pairs", "from", "this", "map", "will", "be", "present", "in", "the", "final", "configuration", "." ]
train
https://github.com/NessComputing/components-ness-config/blob/eb9b37327a9e612a097f1258eb09d288f475e2cb/src/main/java/com/nesscomputing/config/Config.java#L92-L95
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/dataprovider/MapCompositeDataProvider.java
MapCompositeDataProvider.addDataProvider
public void addDataProvider(K key, DataProvider<DPO> dataProvider) { """ Adds the specified data provider with the specified key. @param key Key associated to the data provider. @param dataProvider Data provider associated to the key. """ dataProviders.put(key, dataProvider); }
java
public void addDataProvider(K key, DataProvider<DPO> dataProvider) { dataProviders.put(key, dataProvider); }
[ "public", "void", "addDataProvider", "(", "K", "key", ",", "DataProvider", "<", "DPO", ">", "dataProvider", ")", "{", "dataProviders", ".", "put", "(", "key", ",", "dataProvider", ")", ";", "}" ]
Adds the specified data provider with the specified key. @param key Key associated to the data provider. @param dataProvider Data provider associated to the key.
[ "Adds", "the", "specified", "data", "provider", "with", "the", "specified", "key", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/dataprovider/MapCompositeDataProvider.java#L56-L58
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java
SymmetryAxes.getRepeatsCyclicForm
public List<List<Integer>> getRepeatsCyclicForm(int level, int firstRepeat) { """ Get the indices of participating repeats in cyclic form. <p> Each inner list gives a set of equivalent repeats and should have length equal to the order of the axis' operator. @param level @param firstRepeat @return """ Axis axis = axes.get(level); int m = getNumRepeats(level+1);//size of the children int d = axis.getOrder(); // degree of this node int n = m*d; // number of repeats included if(firstRepeat % n != 0) { throw new IllegalArgumentException(String.format("Repeat %d cannot start a block at level %s of this tree",firstRepeat,level)); } if(axis.getSymmType() == SymmetryType.OPEN) { n -= m; // leave off last child for open symm } List<List<Integer>> repeats = new ArrayList<>(m); for(int i=0;i<m;i++) { List<Integer> cycle = new ArrayList<>(d); for(int j=0;j<d;j++) { cycle.add(firstRepeat+i+j*m); } repeats.add(cycle); } return repeats; }
java
public List<List<Integer>> getRepeatsCyclicForm(int level, int firstRepeat) { Axis axis = axes.get(level); int m = getNumRepeats(level+1);//size of the children int d = axis.getOrder(); // degree of this node int n = m*d; // number of repeats included if(firstRepeat % n != 0) { throw new IllegalArgumentException(String.format("Repeat %d cannot start a block at level %s of this tree",firstRepeat,level)); } if(axis.getSymmType() == SymmetryType.OPEN) { n -= m; // leave off last child for open symm } List<List<Integer>> repeats = new ArrayList<>(m); for(int i=0;i<m;i++) { List<Integer> cycle = new ArrayList<>(d); for(int j=0;j<d;j++) { cycle.add(firstRepeat+i+j*m); } repeats.add(cycle); } return repeats; }
[ "public", "List", "<", "List", "<", "Integer", ">", ">", "getRepeatsCyclicForm", "(", "int", "level", ",", "int", "firstRepeat", ")", "{", "Axis", "axis", "=", "axes", ".", "get", "(", "level", ")", ";", "int", "m", "=", "getNumRepeats", "(", "level", "+", "1", ")", ";", "//size of the children", "int", "d", "=", "axis", ".", "getOrder", "(", ")", ";", "// degree of this node", "int", "n", "=", "m", "*", "d", ";", "// number of repeats included", "if", "(", "firstRepeat", "%", "n", "!=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Repeat %d cannot start a block at level %s of this tree\"", ",", "firstRepeat", ",", "level", ")", ")", ";", "}", "if", "(", "axis", ".", "getSymmType", "(", ")", "==", "SymmetryType", ".", "OPEN", ")", "{", "n", "-=", "m", ";", "// leave off last child for open symm", "}", "List", "<", "List", "<", "Integer", ">", ">", "repeats", "=", "new", "ArrayList", "<>", "(", "m", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m", ";", "i", "++", ")", "{", "List", "<", "Integer", ">", "cycle", "=", "new", "ArrayList", "<>", "(", "d", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "d", ";", "j", "++", ")", "{", "cycle", ".", "add", "(", "firstRepeat", "+", "i", "+", "j", "*", "m", ")", ";", "}", "repeats", ".", "add", "(", "cycle", ")", ";", "}", "return", "repeats", ";", "}" ]
Get the indices of participating repeats in cyclic form. <p> Each inner list gives a set of equivalent repeats and should have length equal to the order of the axis' operator. @param level @param firstRepeat @return
[ "Get", "the", "indices", "of", "participating", "repeats", "in", "cyclic", "form", ".", "<p", ">", "Each", "inner", "list", "gives", "a", "set", "of", "equivalent", "repeats", "and", "should", "have", "length", "equal", "to", "the", "order", "of", "the", "axis", "operator", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java#L333-L354
rimerosolutions/ant-git-tasks
src/main/java/com/rimerosolutions/ant/git/tasks/TagListTask.java
TagListTask.processReferencesAndOutput
protected void processReferencesAndOutput(List<Ref> refList) { """ Processes a list of references, check references names and output to a file if requested. @param refList The list of references to process """ List<String> refNames = new ArrayList<String>(refList.size()); for (Ref ref : refList) { refNames.add(GitTaskUtils.sanitizeRefName(ref.getName())); } if (!namesToCheck.isEmpty()) { if (!refNames.containsAll(namesToCheck)) { List<String> namesCopy = new ArrayList<String>(namesToCheck); namesCopy.removeAll(refNames); throw new GitBuildException(String.format(MISSING_REFS_TEMPLATE, namesCopy.toString())); } } if (!GitTaskUtils.isNullOrBlankString(outputFilename)) { FileUtils fileUtils = FileUtils.getFileUtils(); Echo echo = new Echo(); echo.setProject(getProject()); echo.setFile(fileUtils.resolveFile(getProject().getBaseDir(), outputFilename)); for (int i = 0; i < refNames.size(); i++) { String refName = refNames.get(i); echo.addText(String.format(REF_NAME_TEMPLATE, refName)); } echo.perform(); } }
java
protected void processReferencesAndOutput(List<Ref> refList) { List<String> refNames = new ArrayList<String>(refList.size()); for (Ref ref : refList) { refNames.add(GitTaskUtils.sanitizeRefName(ref.getName())); } if (!namesToCheck.isEmpty()) { if (!refNames.containsAll(namesToCheck)) { List<String> namesCopy = new ArrayList<String>(namesToCheck); namesCopy.removeAll(refNames); throw new GitBuildException(String.format(MISSING_REFS_TEMPLATE, namesCopy.toString())); } } if (!GitTaskUtils.isNullOrBlankString(outputFilename)) { FileUtils fileUtils = FileUtils.getFileUtils(); Echo echo = new Echo(); echo.setProject(getProject()); echo.setFile(fileUtils.resolveFile(getProject().getBaseDir(), outputFilename)); for (int i = 0; i < refNames.size(); i++) { String refName = refNames.get(i); echo.addText(String.format(REF_NAME_TEMPLATE, refName)); } echo.perform(); } }
[ "protected", "void", "processReferencesAndOutput", "(", "List", "<", "Ref", ">", "refList", ")", "{", "List", "<", "String", ">", "refNames", "=", "new", "ArrayList", "<", "String", ">", "(", "refList", ".", "size", "(", ")", ")", ";", "for", "(", "Ref", "ref", ":", "refList", ")", "{", "refNames", ".", "add", "(", "GitTaskUtils", ".", "sanitizeRefName", "(", "ref", ".", "getName", "(", ")", ")", ")", ";", "}", "if", "(", "!", "namesToCheck", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "!", "refNames", ".", "containsAll", "(", "namesToCheck", ")", ")", "{", "List", "<", "String", ">", "namesCopy", "=", "new", "ArrayList", "<", "String", ">", "(", "namesToCheck", ")", ";", "namesCopy", ".", "removeAll", "(", "refNames", ")", ";", "throw", "new", "GitBuildException", "(", "String", ".", "format", "(", "MISSING_REFS_TEMPLATE", ",", "namesCopy", ".", "toString", "(", ")", ")", ")", ";", "}", "}", "if", "(", "!", "GitTaskUtils", ".", "isNullOrBlankString", "(", "outputFilename", ")", ")", "{", "FileUtils", "fileUtils", "=", "FileUtils", ".", "getFileUtils", "(", ")", ";", "Echo", "echo", "=", "new", "Echo", "(", ")", ";", "echo", ".", "setProject", "(", "getProject", "(", ")", ")", ";", "echo", ".", "setFile", "(", "fileUtils", ".", "resolveFile", "(", "getProject", "(", ")", ".", "getBaseDir", "(", ")", ",", "outputFilename", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "refNames", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "refName", "=", "refNames", ".", "get", "(", "i", ")", ";", "echo", ".", "addText", "(", "String", ".", "format", "(", "REF_NAME_TEMPLATE", ",", "refName", ")", ")", ";", "}", "echo", ".", "perform", "(", ")", ";", "}", "}" ]
Processes a list of references, check references names and output to a file if requested. @param refList The list of references to process
[ "Processes", "a", "list", "of", "references", "check", "references", "names", "and", "output", "to", "a", "file", "if", "requested", "." ]
train
https://github.com/rimerosolutions/ant-git-tasks/blob/bfb32fe68afe6b9dcfd0a5194497d748ef3e8a6f/src/main/java/com/rimerosolutions/ant/git/tasks/TagListTask.java#L104-L134
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/PagedGrid.java
PagedGrid.formatCell
protected void formatCell (HTMLTable.CellFormatter formatter, int row, int col, int limit) { """ Configures the formatting for a particular cell based on its location in the grid. """ formatter.setHorizontalAlignment(row, col, _cellHorizAlign); formatter.setVerticalAlignment(row, col, _cellVertAlign); formatter.setStyleName(row, col, "Cell"); if (row == (limit-1)/_cols) { formatter.addStyleName(row, col, "BottomCell"); } else if (row == 0) { formatter.addStyleName(row, col, "TopCell"); } else { formatter.addStyleName(row, col, "MiddleCell"); } }
java
protected void formatCell (HTMLTable.CellFormatter formatter, int row, int col, int limit) { formatter.setHorizontalAlignment(row, col, _cellHorizAlign); formatter.setVerticalAlignment(row, col, _cellVertAlign); formatter.setStyleName(row, col, "Cell"); if (row == (limit-1)/_cols) { formatter.addStyleName(row, col, "BottomCell"); } else if (row == 0) { formatter.addStyleName(row, col, "TopCell"); } else { formatter.addStyleName(row, col, "MiddleCell"); } }
[ "protected", "void", "formatCell", "(", "HTMLTable", ".", "CellFormatter", "formatter", ",", "int", "row", ",", "int", "col", ",", "int", "limit", ")", "{", "formatter", ".", "setHorizontalAlignment", "(", "row", ",", "col", ",", "_cellHorizAlign", ")", ";", "formatter", ".", "setVerticalAlignment", "(", "row", ",", "col", ",", "_cellVertAlign", ")", ";", "formatter", ".", "setStyleName", "(", "row", ",", "col", ",", "\"Cell\"", ")", ";", "if", "(", "row", "==", "(", "limit", "-", "1", ")", "/", "_cols", ")", "{", "formatter", ".", "addStyleName", "(", "row", ",", "col", ",", "\"BottomCell\"", ")", ";", "}", "else", "if", "(", "row", "==", "0", ")", "{", "formatter", ".", "addStyleName", "(", "row", ",", "col", ",", "\"TopCell\"", ")", ";", "}", "else", "{", "formatter", ".", "addStyleName", "(", "row", ",", "col", ",", "\"MiddleCell\"", ")", ";", "}", "}" ]
Configures the formatting for a particular cell based on its location in the grid.
[ "Configures", "the", "formatting", "for", "a", "particular", "cell", "based", "on", "its", "location", "in", "the", "grid", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/PagedGrid.java#L99-L111
pravega/pravega
controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java
StreamMetrics.deleteStreamFailed
public void deleteStreamFailed(String scope, String streamName) { """ This method increments the counter of failed Stream deletions in the system as well as the failed deletion attempts for this specific Stream. @param scope Scope. @param streamName Name of the Stream. """ DYNAMIC_LOGGER.incCounterValue(globalMetricName(DELETE_STREAM_FAILED), 1); DYNAMIC_LOGGER.incCounterValue(DELETE_STREAM_FAILED, 1, streamTags(scope, streamName)); }
java
public void deleteStreamFailed(String scope, String streamName) { DYNAMIC_LOGGER.incCounterValue(globalMetricName(DELETE_STREAM_FAILED), 1); DYNAMIC_LOGGER.incCounterValue(DELETE_STREAM_FAILED, 1, streamTags(scope, streamName)); }
[ "public", "void", "deleteStreamFailed", "(", "String", "scope", ",", "String", "streamName", ")", "{", "DYNAMIC_LOGGER", ".", "incCounterValue", "(", "globalMetricName", "(", "DELETE_STREAM_FAILED", ")", ",", "1", ")", ";", "DYNAMIC_LOGGER", ".", "incCounterValue", "(", "DELETE_STREAM_FAILED", ",", "1", ",", "streamTags", "(", "scope", ",", "streamName", ")", ")", ";", "}" ]
This method increments the counter of failed Stream deletions in the system as well as the failed deletion attempts for this specific Stream. @param scope Scope. @param streamName Name of the Stream.
[ "This", "method", "increments", "the", "counter", "of", "failed", "Stream", "deletions", "in", "the", "system", "as", "well", "as", "the", "failed", "deletion", "attempts", "for", "this", "specific", "Stream", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java#L100-L103
google/closure-compiler
src/com/google/javascript/refactoring/Matchers.java
Matchers.enumDefinitionOfType
public static Matcher enumDefinitionOfType(final String type) { """ Returns a Matcher that matches definitions of an enum of the given type. """ return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { JSType providedJsType = getJsType(metadata, type); if (providedJsType == null) { return false; } providedJsType = providedJsType.restrictByNotNullOrUndefined(); JSType jsType = node.getJSType(); return jsType != null && jsType.isEnumType() && providedJsType.isEquivalentTo( jsType.toMaybeEnumType().getElementsType().getPrimitiveType()); } }; }
java
public static Matcher enumDefinitionOfType(final String type) { return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { JSType providedJsType = getJsType(metadata, type); if (providedJsType == null) { return false; } providedJsType = providedJsType.restrictByNotNullOrUndefined(); JSType jsType = node.getJSType(); return jsType != null && jsType.isEnumType() && providedJsType.isEquivalentTo( jsType.toMaybeEnumType().getElementsType().getPrimitiveType()); } }; }
[ "public", "static", "Matcher", "enumDefinitionOfType", "(", "final", "String", "type", ")", "{", "return", "new", "Matcher", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "Node", "node", ",", "NodeMetadata", "metadata", ")", "{", "JSType", "providedJsType", "=", "getJsType", "(", "metadata", ",", "type", ")", ";", "if", "(", "providedJsType", "==", "null", ")", "{", "return", "false", ";", "}", "providedJsType", "=", "providedJsType", ".", "restrictByNotNullOrUndefined", "(", ")", ";", "JSType", "jsType", "=", "node", ".", "getJSType", "(", ")", ";", "return", "jsType", "!=", "null", "&&", "jsType", ".", "isEnumType", "(", ")", "&&", "providedJsType", ".", "isEquivalentTo", "(", "jsType", ".", "toMaybeEnumType", "(", ")", ".", "getElementsType", "(", ")", ".", "getPrimitiveType", "(", ")", ")", ";", "}", "}", ";", "}" ]
Returns a Matcher that matches definitions of an enum of the given type.
[ "Returns", "a", "Matcher", "that", "matches", "definitions", "of", "an", "enum", "of", "the", "given", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L286-L300
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/AbstractSessionBasedScope.java
AbstractSessionBasedScope.addToList
protected void addToList(List<IEObjectDescription> descriptions, List<IEObjectDescription> result) { """ Clients may override to reject certain descriptions from the result. All subtypes of {@link AbstractSessionBasedScope} in the framework code will delegate to this method to accumulate descriptions in a list. @see #addToList(IEObjectDescription, List) """ result.addAll(descriptions); }
java
protected void addToList(List<IEObjectDescription> descriptions, List<IEObjectDescription> result) { result.addAll(descriptions); }
[ "protected", "void", "addToList", "(", "List", "<", "IEObjectDescription", ">", "descriptions", ",", "List", "<", "IEObjectDescription", ">", "result", ")", "{", "result", ".", "addAll", "(", "descriptions", ")", ";", "}" ]
Clients may override to reject certain descriptions from the result. All subtypes of {@link AbstractSessionBasedScope} in the framework code will delegate to this method to accumulate descriptions in a list. @see #addToList(IEObjectDescription, List)
[ "Clients", "may", "override", "to", "reject", "certain", "descriptions", "from", "the", "result", ".", "All", "subtypes", "of", "{", "@link", "AbstractSessionBasedScope", "}", "in", "the", "framework", "code", "will", "delegate", "to", "this", "method", "to", "accumulate", "descriptions", "in", "a", "list", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/AbstractSessionBasedScope.java#L165-L167
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.toSortedString
public static <T> String toSortedString(Counter<T> counter, int k, String itemFormat, String joiner) { """ Returns a string representation of a Counter, displaying the keys and their counts in decreasing order of count. At most k keys are displayed. @param counter A Counter. @param k The number of keys to include. Use Integer.MAX_VALUE to include all keys. @param itemFormat The format string for key/count pairs, where the key is first and the value is second. To display the value first, use argument indices, e.g. "%2$f %1$s". @param joiner The string used between pairs of key/value strings. @return The top k values from the Counter, formatted as specified. """ return toSortedString(counter, k, itemFormat, joiner, "%s"); }
java
public static <T> String toSortedString(Counter<T> counter, int k, String itemFormat, String joiner) { return toSortedString(counter, k, itemFormat, joiner, "%s"); }
[ "public", "static", "<", "T", ">", "String", "toSortedString", "(", "Counter", "<", "T", ">", "counter", ",", "int", "k", ",", "String", "itemFormat", ",", "String", "joiner", ")", "{", "return", "toSortedString", "(", "counter", ",", "k", ",", "itemFormat", ",", "joiner", ",", "\"%s\"", ")", ";", "}" ]
Returns a string representation of a Counter, displaying the keys and their counts in decreasing order of count. At most k keys are displayed. @param counter A Counter. @param k The number of keys to include. Use Integer.MAX_VALUE to include all keys. @param itemFormat The format string for key/count pairs, where the key is first and the value is second. To display the value first, use argument indices, e.g. "%2$f %1$s". @param joiner The string used between pairs of key/value strings. @return The top k values from the Counter, formatted as specified.
[ "Returns", "a", "string", "representation", "of", "a", "Counter", "displaying", "the", "keys", "and", "their", "counts", "in", "decreasing", "order", "of", "count", ".", "At", "most", "k", "keys", "are", "displayed", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1792-L1794
alkacon/opencms-core
src/org/opencms/jsp/CmsJspActionElement.java
CmsJspActionElement.includeSilent
public void includeSilent(String target, String element) { """ Includes a named sub-element suppressing all Exceptions that occur during the include, otherwise the same as using {@link #include(String, String, Map)}.<p> This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.<p> @param target the target URI of the file in the OpenCms VFS (can be relative or absolute) @param element the element (template selector) to display from the target """ try { include(target, element, null); } catch (Throwable t) { // ignore } }
java
public void includeSilent(String target, String element) { try { include(target, element, null); } catch (Throwable t) { // ignore } }
[ "public", "void", "includeSilent", "(", "String", "target", ",", "String", "element", ")", "{", "try", "{", "include", "(", "target", ",", "element", ",", "null", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// ignore", "}", "}" ]
Includes a named sub-element suppressing all Exceptions that occur during the include, otherwise the same as using {@link #include(String, String, Map)}.<p> This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.<p> @param target the target URI of the file in the OpenCms VFS (can be relative or absolute) @param element the element (template selector) to display from the target
[ "Includes", "a", "named", "sub", "-", "element", "suppressing", "all", "Exceptions", "that", "occur", "during", "the", "include", "otherwise", "the", "same", "as", "using", "{", "@link", "#include", "(", "String", "String", "Map", ")", "}", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspActionElement.java#L587-L594
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java
DatabasesInner.createImportOperation
public ImportExportResponseInner createImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { """ Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database to import into @param parameters The required parameters for importing a Bacpac into a database. @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 ImportExportResponseInner object if successful. """ return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); }
java
public ImportExportResponseInner createImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); }
[ "public", "ImportExportResponseInner", "createImportOperation", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "ImportExtensionRequest", "parameters", ")", "{", "return", "createImportOperationWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database to import into @param parameters The required parameters for importing a Bacpac into a database. @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 ImportExportResponseInner object if successful.
[ "Creates", "an", "import", "operation", "that", "imports", "a", "bacpac", "into", "an", "existing", "database", ".", "The", "existing", "database", "must", "be", "empty", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L1910-L1912
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.mapping
public static void mapping(String mappedFieldName, String mappedClassName) { """ Thrown when the length of classes and attribute parameter isn't the same. @param mappedFieldName name of the mapped field @param mappedClassName name of the mapped field's class """ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException2length,mappedFieldName,mappedClassName)); }
java
public static void mapping(String mappedFieldName, String mappedClassName){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException2length,mappedFieldName,mappedClassName)); }
[ "public", "static", "void", "mapping", "(", "String", "mappedFieldName", ",", "String", "mappedClassName", ")", "{", "throw", "new", "MappingErrorException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "mappingErrorException2length", ",", "mappedFieldName", ",", "mappedClassName", ")", ")", ";", "}" ]
Thrown when the length of classes and attribute parameter isn't the same. @param mappedFieldName name of the mapped field @param mappedClassName name of the mapped field's class
[ "Thrown", "when", "the", "length", "of", "classes", "and", "attribute", "parameter", "isn", "t", "the", "same", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L463-L465
adyliu/jafka
src/main/java/io/jafka/api/FetchRequest.java
FetchRequest.readFrom
public static FetchRequest readFrom(ByteBuffer buffer) { """ Read a fetch request from buffer(socket data) @param buffer the buffer data @return a fetch request @throws IllegalArgumentException while error data format(no topic) """ String topic = Utils.readShortString(buffer); int partition = buffer.getInt(); long offset = buffer.getLong(); int size = buffer.getInt(); return new FetchRequest(topic, partition, offset, size); }
java
public static FetchRequest readFrom(ByteBuffer buffer) { String topic = Utils.readShortString(buffer); int partition = buffer.getInt(); long offset = buffer.getLong(); int size = buffer.getInt(); return new FetchRequest(topic, partition, offset, size); }
[ "public", "static", "FetchRequest", "readFrom", "(", "ByteBuffer", "buffer", ")", "{", "String", "topic", "=", "Utils", ".", "readShortString", "(", "buffer", ")", ";", "int", "partition", "=", "buffer", ".", "getInt", "(", ")", ";", "long", "offset", "=", "buffer", ".", "getLong", "(", ")", ";", "int", "size", "=", "buffer", ".", "getInt", "(", ")", ";", "return", "new", "FetchRequest", "(", "topic", ",", "partition", ",", "offset", ",", "size", ")", ";", "}" ]
Read a fetch request from buffer(socket data) @param buffer the buffer data @return a fetch request @throws IllegalArgumentException while error data format(no topic)
[ "Read", "a", "fetch", "request", "from", "buffer", "(", "socket", "data", ")" ]
train
https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/api/FetchRequest.java#L105-L111
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/CheckedMemorySegment.java
CheckedMemorySegment.putChar
public final CheckedMemorySegment putChar(int index, char value) { """ Writes two memory containing the given char value, in the current byte order, into this buffer at the given position. @param position The position at which the memory will be written. @param value The char value to be written. @return This view itself. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger then the segment size minus 2. """ if (index >= 0 && index < this.size - 1) { this.memory[this.offset + index + 0] = (byte) (value >> 8); this.memory[this.offset + index + 1] = (byte) value; return this; } else { throw new IndexOutOfBoundsException(); } }
java
public final CheckedMemorySegment putChar(int index, char value) { if (index >= 0 && index < this.size - 1) { this.memory[this.offset + index + 0] = (byte) (value >> 8); this.memory[this.offset + index + 1] = (byte) value; return this; } else { throw new IndexOutOfBoundsException(); } }
[ "public", "final", "CheckedMemorySegment", "putChar", "(", "int", "index", ",", "char", "value", ")", "{", "if", "(", "index", ">=", "0", "&&", "index", "<", "this", ".", "size", "-", "1", ")", "{", "this", ".", "memory", "[", "this", ".", "offset", "+", "index", "+", "0", "]", "=", "(", "byte", ")", "(", "value", ">>", "8", ")", ";", "this", ".", "memory", "[", "this", ".", "offset", "+", "index", "+", "1", "]", "=", "(", "byte", ")", "value", ";", "return", "this", ";", "}", "else", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "}" ]
Writes two memory containing the given char value, in the current byte order, into this buffer at the given position. @param position The position at which the memory will be written. @param value The char value to be written. @return This view itself. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger then the segment size minus 2.
[ "Writes", "two", "memory", "containing", "the", "given", "char", "value", "in", "the", "current", "byte", "order", "into", "this", "buffer", "at", "the", "given", "position", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/CheckedMemorySegment.java#L386-L394
geomajas/geomajas-project-client-gwt2
server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java
GeomajasServerExtension.initializeMap
public void initializeMap(final MapPresenter mapPresenter, String applicationId, String id) { """ Initialize the map by fetching a configuration on the server. This method will create a map and add the default map widgets (zoom in/out, zoom to rectangle and scale bar). @param mapPresenter The map to initialize. @param applicationId The application ID in the backend configuration. @param id The map ID in the backend configuration. """ initializeMap(mapPresenter, applicationId, id, new DefaultMapWidget[] { DefaultMapWidget.ZOOM_CONTROL, DefaultMapWidget.ZOOM_TO_RECTANGLE_CONTROL, DefaultMapWidget.SCALEBAR }); }
java
public void initializeMap(final MapPresenter mapPresenter, String applicationId, String id) { initializeMap(mapPresenter, applicationId, id, new DefaultMapWidget[] { DefaultMapWidget.ZOOM_CONTROL, DefaultMapWidget.ZOOM_TO_RECTANGLE_CONTROL, DefaultMapWidget.SCALEBAR }); }
[ "public", "void", "initializeMap", "(", "final", "MapPresenter", "mapPresenter", ",", "String", "applicationId", ",", "String", "id", ")", "{", "initializeMap", "(", "mapPresenter", ",", "applicationId", ",", "id", ",", "new", "DefaultMapWidget", "[", "]", "{", "DefaultMapWidget", ".", "ZOOM_CONTROL", ",", "DefaultMapWidget", ".", "ZOOM_TO_RECTANGLE_CONTROL", ",", "DefaultMapWidget", ".", "SCALEBAR", "}", ")", ";", "}" ]
Initialize the map by fetching a configuration on the server. This method will create a map and add the default map widgets (zoom in/out, zoom to rectangle and scale bar). @param mapPresenter The map to initialize. @param applicationId The application ID in the backend configuration. @param id The map ID in the backend configuration.
[ "Initialize", "the", "map", "by", "fetching", "a", "configuration", "on", "the", "server", ".", "This", "method", "will", "create", "a", "map", "and", "add", "the", "default", "map", "widgets", "(", "zoom", "in", "/", "out", "zoom", "to", "rectangle", "and", "scale", "bar", ")", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java#L146-L149
jmurty/java-xmlbuilder
src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java
BaseXMLBuilder.attributeImpl
protected void attributeImpl(String name, String value) { """ Add a named attribute value to the element for this builder node. @param name the attribute's name. @param value the attribute's value. """ if (! (this.xmlNode instanceof Element)) { throw new RuntimeException( "Cannot add an attribute to non-Element underlying node: " + this.xmlNode); } ((Element) xmlNode).setAttribute(name, value); }
java
protected void attributeImpl(String name, String value) { if (! (this.xmlNode instanceof Element)) { throw new RuntimeException( "Cannot add an attribute to non-Element underlying node: " + this.xmlNode); } ((Element) xmlNode).setAttribute(name, value); }
[ "protected", "void", "attributeImpl", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "!", "(", "this", ".", "xmlNode", "instanceof", "Element", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Cannot add an attribute to non-Element underlying node: \"", "+", "this", ".", "xmlNode", ")", ";", "}", "(", "(", "Element", ")", "xmlNode", ")", ".", "setAttribute", "(", "name", ",", "value", ")", ";", "}" ]
Add a named attribute value to the element for this builder node. @param name the attribute's name. @param value the attribute's value.
[ "Add", "a", "named", "attribute", "value", "to", "the", "element", "for", "this", "builder", "node", "." ]
train
https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L806-L813
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/http/TrustingSSLSocketFactory.java
TrustingSSLSocketFactory.createSimulatedSocket
private Socket createSimulatedSocket(SSLSocket socket) { """ just an helper function to wrap a normal sslSocket into a simulated one so we can do throttling """ SimulatedSocketFactory.configure(socket); socket.setEnabledProtocols(new String[] { SSLAlgorithm.SSLv3.name(), SSLAlgorithm.TLSv1.name() } ); //socket.setEnabledCipherSuites(new String[] { "SSL_RSA_WITH_RC4_128_MD5" }); return new SimulatedSSLSocket(socket, streamManager); }
java
private Socket createSimulatedSocket(SSLSocket socket) { SimulatedSocketFactory.configure(socket); socket.setEnabledProtocols(new String[] { SSLAlgorithm.SSLv3.name(), SSLAlgorithm.TLSv1.name() } ); //socket.setEnabledCipherSuites(new String[] { "SSL_RSA_WITH_RC4_128_MD5" }); return new SimulatedSSLSocket(socket, streamManager); }
[ "private", "Socket", "createSimulatedSocket", "(", "SSLSocket", "socket", ")", "{", "SimulatedSocketFactory", ".", "configure", "(", "socket", ")", ";", "socket", ".", "setEnabledProtocols", "(", "new", "String", "[", "]", "{", "SSLAlgorithm", ".", "SSLv3", ".", "name", "(", ")", ",", "SSLAlgorithm", ".", "TLSv1", ".", "name", "(", ")", "}", ")", ";", "//socket.setEnabledCipherSuites(new String[] { \"SSL_RSA_WITH_RC4_128_MD5\" });", "return", "new", "SimulatedSSLSocket", "(", "socket", ",", "streamManager", ")", ";", "}" ]
just an helper function to wrap a normal sslSocket into a simulated one so we can do throttling
[ "just", "an", "helper", "function", "to", "wrap", "a", "normal", "sslSocket", "into", "a", "simulated", "one", "so", "we", "can", "do", "throttling" ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/http/TrustingSSLSocketFactory.java#L74-L79
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddWaiters.java
AddWaiters.executeToAstProcess
private Process executeToAstProcess(String argument) throws IOException { """ Execute the jp-to-ast.py command and wait for it to complete. @param argument JP expression to compile to AST. @return Process with access to output streams. """ try { Process p = new ProcessBuilder("python", codeGenBinDirectory + "/jp-to-ast.py", argument).start(); p.waitFor(); return p; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } }
java
private Process executeToAstProcess(String argument) throws IOException { try { Process p = new ProcessBuilder("python", codeGenBinDirectory + "/jp-to-ast.py", argument).start(); p.waitFor(); return p; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } }
[ "private", "Process", "executeToAstProcess", "(", "String", "argument", ")", "throws", "IOException", "{", "try", "{", "Process", "p", "=", "new", "ProcessBuilder", "(", "\"python\"", ",", "codeGenBinDirectory", "+", "\"/jp-to-ast.py\"", ",", "argument", ")", ".", "start", "(", ")", ";", "p", ".", "waitFor", "(", ")", ";", "return", "p", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Execute the jp-to-ast.py command and wait for it to complete. @param argument JP expression to compile to AST. @return Process with access to output streams.
[ "Execute", "the", "jp", "-", "to", "-", "ast", ".", "py", "command", "and", "wait", "for", "it", "to", "complete", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddWaiters.java#L116-L125
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CategoryUrl.java
CategoryUrl.deleteCategoryByIdUrl
public static MozuUrl deleteCategoryByIdUrl(Boolean cascadeDelete, Integer categoryId, Boolean forceDelete, Boolean reassignToParent) { """ Get Resource Url for DeleteCategoryById @param cascadeDelete Specifies whether to also delete all subcategories associated with the specified category.If you set this value is false, only the specified category is deleted.The default value is false. @param categoryId Unique identifier of the category to modify. @param forceDelete Specifies whether the category, and any associated subcategories, are deleted even if there are products that reference them. The default value is false. @param reassignToParent Specifies whether any subcategories of the specified category are reassigned to the parent of the specified category.This field only applies if the cascadeDelete parameter is false.The default value is false. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}/?cascadeDelete={cascadeDelete}&forceDelete={forceDelete}&reassignToParent={reassignToParent}"); formatter.formatUrl("cascadeDelete", cascadeDelete); formatter.formatUrl("categoryId", categoryId); formatter.formatUrl("forceDelete", forceDelete); formatter.formatUrl("reassignToParent", reassignToParent); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deleteCategoryByIdUrl(Boolean cascadeDelete, Integer categoryId, Boolean forceDelete, Boolean reassignToParent) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}/?cascadeDelete={cascadeDelete}&forceDelete={forceDelete}&reassignToParent={reassignToParent}"); formatter.formatUrl("cascadeDelete", cascadeDelete); formatter.formatUrl("categoryId", categoryId); formatter.formatUrl("forceDelete", forceDelete); formatter.formatUrl("reassignToParent", reassignToParent); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deleteCategoryByIdUrl", "(", "Boolean", "cascadeDelete", ",", "Integer", "categoryId", ",", "Boolean", "forceDelete", ",", "Boolean", "reassignToParent", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/categories/{categoryId}/?cascadeDelete={cascadeDelete}&forceDelete={forceDelete}&reassignToParent={reassignToParent}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"cascadeDelete\"", ",", "cascadeDelete", ")", ";", "formatter", ".", "formatUrl", "(", "\"categoryId\"", ",", "categoryId", ")", ";", "formatter", ".", "formatUrl", "(", "\"forceDelete\"", ",", "forceDelete", ")", ";", "formatter", ".", "formatUrl", "(", "\"reassignToParent\"", ",", "reassignToParent", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for DeleteCategoryById @param cascadeDelete Specifies whether to also delete all subcategories associated with the specified category.If you set this value is false, only the specified category is deleted.The default value is false. @param categoryId Unique identifier of the category to modify. @param forceDelete Specifies whether the category, and any associated subcategories, are deleted even if there are products that reference them. The default value is false. @param reassignToParent Specifies whether any subcategories of the specified category are reassigned to the parent of the specified category.This field only applies if the cascadeDelete parameter is false.The default value is false. @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeleteCategoryById" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CategoryUrl.java#L152-L160
jenkinsci/jenkins
core/src/main/java/jenkins/org/apache/commons/validator/routines/DomainValidator.java
DomainValidator.isValidLocalTld
public boolean isValidLocalTld(String lTld) { """ Returns true if the specified <code>String</code> matches any widely used "local" domains (localhost or localdomain). Leading dots are ignored if present. The search is case-insensitive. @param lTld the parameter to check for local TLD status, not null @return true if the parameter is an local TLD """ final String key = chompLeadingDot(unicodeToASCII(lTld).toLowerCase(Locale.ENGLISH)); return arrayContains(LOCAL_TLDS, key); }
java
public boolean isValidLocalTld(String lTld) { final String key = chompLeadingDot(unicodeToASCII(lTld).toLowerCase(Locale.ENGLISH)); return arrayContains(LOCAL_TLDS, key); }
[ "public", "boolean", "isValidLocalTld", "(", "String", "lTld", ")", "{", "final", "String", "key", "=", "chompLeadingDot", "(", "unicodeToASCII", "(", "lTld", ")", ".", "toLowerCase", "(", "Locale", ".", "ENGLISH", ")", ")", ";", "return", "arrayContains", "(", "LOCAL_TLDS", ",", "key", ")", ";", "}" ]
Returns true if the specified <code>String</code> matches any widely used "local" domains (localhost or localdomain). Leading dots are ignored if present. The search is case-insensitive. @param lTld the parameter to check for local TLD status, not null @return true if the parameter is an local TLD
[ "Returns", "true", "if", "the", "specified", "<code", ">", "String<", "/", "code", ">", "matches", "any", "widely", "used", "local", "domains", "(", "localhost", "or", "localdomain", ")", ".", "Leading", "dots", "are", "ignored", "if", "present", ".", "The", "search", "is", "case", "-", "insensitive", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/org/apache/commons/validator/routines/DomainValidator.java#L258-L261
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/attribute/Attribute.java
Attribute.joinEqWithSourceAndAsOfCheck
protected Operation joinEqWithSourceAndAsOfCheck(Attribute other) { """ /* public Operation in(List dataHolders, Extractor extractor) { return new InOperationWithExtractor(this, dataHolders, extractor); } """ Mapper mapper = null; if (this.getSourceAttributeType() != null && !(other instanceof MappedAttribute) && this.getSourceAttributeType().equals(other.getSourceAttributeType())) { MultiEqualityMapper mem = new MultiEqualityMapper(this, other); mem.addAutoGeneratedAttributeMap(this.getSourceAttribute(), other.getSourceAttribute()); mapper = mem; } mapper = constructEqualityMapperWithAsOfCheck(other, mapper); if (mapper == null) { mapper = this.constructEqualityMapper(other); } mapper.setAnonymous(true); Attribute target = other; if (other instanceof MappedAttribute) { target = ((MappedAttribute)other).getWrappedAttribute(); } return new MappedOperation(mapper, new All(target)); }
java
protected Operation joinEqWithSourceAndAsOfCheck(Attribute other) { Mapper mapper = null; if (this.getSourceAttributeType() != null && !(other instanceof MappedAttribute) && this.getSourceAttributeType().equals(other.getSourceAttributeType())) { MultiEqualityMapper mem = new MultiEqualityMapper(this, other); mem.addAutoGeneratedAttributeMap(this.getSourceAttribute(), other.getSourceAttribute()); mapper = mem; } mapper = constructEqualityMapperWithAsOfCheck(other, mapper); if (mapper == null) { mapper = this.constructEqualityMapper(other); } mapper.setAnonymous(true); Attribute target = other; if (other instanceof MappedAttribute) { target = ((MappedAttribute)other).getWrappedAttribute(); } return new MappedOperation(mapper, new All(target)); }
[ "protected", "Operation", "joinEqWithSourceAndAsOfCheck", "(", "Attribute", "other", ")", "{", "Mapper", "mapper", "=", "null", ";", "if", "(", "this", ".", "getSourceAttributeType", "(", ")", "!=", "null", "&&", "!", "(", "other", "instanceof", "MappedAttribute", ")", "&&", "this", ".", "getSourceAttributeType", "(", ")", ".", "equals", "(", "other", ".", "getSourceAttributeType", "(", ")", ")", ")", "{", "MultiEqualityMapper", "mem", "=", "new", "MultiEqualityMapper", "(", "this", ",", "other", ")", ";", "mem", ".", "addAutoGeneratedAttributeMap", "(", "this", ".", "getSourceAttribute", "(", ")", ",", "other", ".", "getSourceAttribute", "(", ")", ")", ";", "mapper", "=", "mem", ";", "}", "mapper", "=", "constructEqualityMapperWithAsOfCheck", "(", "other", ",", "mapper", ")", ";", "if", "(", "mapper", "==", "null", ")", "{", "mapper", "=", "this", ".", "constructEqualityMapper", "(", "other", ")", ";", "}", "mapper", ".", "setAnonymous", "(", "true", ")", ";", "Attribute", "target", "=", "other", ";", "if", "(", "other", "instanceof", "MappedAttribute", ")", "{", "target", "=", "(", "(", "MappedAttribute", ")", "other", ")", ".", "getWrappedAttribute", "(", ")", ";", "}", "return", "new", "MappedOperation", "(", "mapper", ",", "new", "All", "(", "target", ")", ")", ";", "}" ]
/* public Operation in(List dataHolders, Extractor extractor) { return new InOperationWithExtractor(this, dataHolders, extractor); }
[ "/", "*", "public", "Operation", "in", "(", "List", "dataHolders", "Extractor", "extractor", ")", "{", "return", "new", "InOperationWithExtractor", "(", "this", "dataHolders", "extractor", ")", ";", "}" ]
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/attribute/Attribute.java#L275-L296
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSchemeManipulator.java
ReactionSchemeManipulator.setScheme
private static IReactionScheme setScheme(IReaction reaction, IReactionSet reactionSet) { """ Create a IReactionScheme given as a top a IReaction. If it doesn't exist any subsequent reaction return null; @param reaction The IReaction as a top @param reactionSet The IReactionSet to extract a IReactionScheme @return The IReactionScheme """ IReactionScheme reactionScheme = reaction.getBuilder().newInstance(IReactionScheme.class); IReactionSet reactConSet = extractSubsequentReaction(reaction, reactionSet); if (reactConSet.getReactionCount() != 0) { for (IReaction reactionInt : reactConSet.reactions()) { reactionScheme.addReaction(reactionInt); IReactionScheme newRScheme = setScheme(reactionInt, reactionSet); if (newRScheme.getReactionCount() != 0 || newRScheme.getReactionSchemeCount() != 0) { reactionScheme.add(newRScheme); } } } return reactionScheme; }
java
private static IReactionScheme setScheme(IReaction reaction, IReactionSet reactionSet) { IReactionScheme reactionScheme = reaction.getBuilder().newInstance(IReactionScheme.class); IReactionSet reactConSet = extractSubsequentReaction(reaction, reactionSet); if (reactConSet.getReactionCount() != 0) { for (IReaction reactionInt : reactConSet.reactions()) { reactionScheme.addReaction(reactionInt); IReactionScheme newRScheme = setScheme(reactionInt, reactionSet); if (newRScheme.getReactionCount() != 0 || newRScheme.getReactionSchemeCount() != 0) { reactionScheme.add(newRScheme); } } } return reactionScheme; }
[ "private", "static", "IReactionScheme", "setScheme", "(", "IReaction", "reaction", ",", "IReactionSet", "reactionSet", ")", "{", "IReactionScheme", "reactionScheme", "=", "reaction", ".", "getBuilder", "(", ")", ".", "newInstance", "(", "IReactionScheme", ".", "class", ")", ";", "IReactionSet", "reactConSet", "=", "extractSubsequentReaction", "(", "reaction", ",", "reactionSet", ")", ";", "if", "(", "reactConSet", ".", "getReactionCount", "(", ")", "!=", "0", ")", "{", "for", "(", "IReaction", "reactionInt", ":", "reactConSet", ".", "reactions", "(", ")", ")", "{", "reactionScheme", ".", "addReaction", "(", "reactionInt", ")", ";", "IReactionScheme", "newRScheme", "=", "setScheme", "(", "reactionInt", ",", "reactionSet", ")", ";", "if", "(", "newRScheme", ".", "getReactionCount", "(", ")", "!=", "0", "||", "newRScheme", ".", "getReactionSchemeCount", "(", ")", "!=", "0", ")", "{", "reactionScheme", ".", "add", "(", "newRScheme", ")", ";", "}", "}", "}", "return", "reactionScheme", ";", "}" ]
Create a IReactionScheme given as a top a IReaction. If it doesn't exist any subsequent reaction return null; @param reaction The IReaction as a top @param reactionSet The IReactionSet to extract a IReactionScheme @return The IReactionScheme
[ "Create", "a", "IReactionScheme", "given", "as", "a", "top", "a", "IReaction", ".", "If", "it", "doesn", "t", "exist", "any", "subsequent", "reaction", "return", "null", ";" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSchemeManipulator.java#L186-L200
pravega/pravega
client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java
ReaderGroupStateManager.releaseSegment
boolean releaseSegment(Segment segment, long lastOffset, long timeLag) throws ReaderNotInReaderGroupException { """ Releases a segment to another reader. This reader should no longer read from the segment. @param segment The segment to be released @param lastOffset The offset from which the new owner should start reading from. @param timeLag How far the reader is from the tail of the stream in time. @return a boolean indicating if the segment was successfully released. @throws ReaderNotInReaderGroupException If the reader has been declared offline. """ sync.updateState((state, updates) -> { Set<Segment> segments = state.getSegments(readerId); if (segments != null && segments.contains(segment) && state.getCheckpointForReader(readerId) == null && doesReaderOwnTooManySegments(state)) { updates.add(new ReleaseSegment(readerId, segment, lastOffset)); updates.add(new UpdateDistanceToTail(readerId, timeLag)); } }); ReaderGroupState state = sync.getState(); releaseTimer.reset(calculateReleaseTime(readerId, state)); acquireTimer.reset(calculateAcquireTime(readerId, state)); if (!state.isReaderOnline(readerId)) { throw new ReaderNotInReaderGroupException(readerId); } return !state.getSegments(readerId).contains(segment); }
java
boolean releaseSegment(Segment segment, long lastOffset, long timeLag) throws ReaderNotInReaderGroupException { sync.updateState((state, updates) -> { Set<Segment> segments = state.getSegments(readerId); if (segments != null && segments.contains(segment) && state.getCheckpointForReader(readerId) == null && doesReaderOwnTooManySegments(state)) { updates.add(new ReleaseSegment(readerId, segment, lastOffset)); updates.add(new UpdateDistanceToTail(readerId, timeLag)); } }); ReaderGroupState state = sync.getState(); releaseTimer.reset(calculateReleaseTime(readerId, state)); acquireTimer.reset(calculateAcquireTime(readerId, state)); if (!state.isReaderOnline(readerId)) { throw new ReaderNotInReaderGroupException(readerId); } return !state.getSegments(readerId).contains(segment); }
[ "boolean", "releaseSegment", "(", "Segment", "segment", ",", "long", "lastOffset", ",", "long", "timeLag", ")", "throws", "ReaderNotInReaderGroupException", "{", "sync", ".", "updateState", "(", "(", "state", ",", "updates", ")", "->", "{", "Set", "<", "Segment", ">", "segments", "=", "state", ".", "getSegments", "(", "readerId", ")", ";", "if", "(", "segments", "!=", "null", "&&", "segments", ".", "contains", "(", "segment", ")", "&&", "state", ".", "getCheckpointForReader", "(", "readerId", ")", "==", "null", "&&", "doesReaderOwnTooManySegments", "(", "state", ")", ")", "{", "updates", ".", "add", "(", "new", "ReleaseSegment", "(", "readerId", ",", "segment", ",", "lastOffset", ")", ")", ";", "updates", ".", "add", "(", "new", "UpdateDistanceToTail", "(", "readerId", ",", "timeLag", ")", ")", ";", "}", "}", ")", ";", "ReaderGroupState", "state", "=", "sync", ".", "getState", "(", ")", ";", "releaseTimer", ".", "reset", "(", "calculateReleaseTime", "(", "readerId", ",", "state", ")", ")", ";", "acquireTimer", ".", "reset", "(", "calculateAcquireTime", "(", "readerId", ",", "state", ")", ")", ";", "if", "(", "!", "state", ".", "isReaderOnline", "(", "readerId", ")", ")", "{", "throw", "new", "ReaderNotInReaderGroupException", "(", "readerId", ")", ";", "}", "return", "!", "state", ".", "getSegments", "(", "readerId", ")", ".", "contains", "(", "segment", ")", ";", "}" ]
Releases a segment to another reader. This reader should no longer read from the segment. @param segment The segment to be released @param lastOffset The offset from which the new owner should start reading from. @param timeLag How far the reader is from the tail of the stream in time. @return a boolean indicating if the segment was successfully released. @throws ReaderNotInReaderGroupException If the reader has been declared offline.
[ "Releases", "a", "segment", "to", "another", "reader", ".", "This", "reader", "should", "no", "longer", "read", "from", "the", "segment", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L251-L267
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java
KeyChainGroup.createBasic
public static KeyChainGroup createBasic(NetworkParameters params) { """ Creates a keychain group with just a basic chain. No deterministic chains will be created automatically. """ return new KeyChainGroup(params, new BasicKeyChain(), null, -1, -1, null, null); }
java
public static KeyChainGroup createBasic(NetworkParameters params) { return new KeyChainGroup(params, new BasicKeyChain(), null, -1, -1, null, null); }
[ "public", "static", "KeyChainGroup", "createBasic", "(", "NetworkParameters", "params", ")", "{", "return", "new", "KeyChainGroup", "(", "params", ",", "new", "BasicKeyChain", "(", ")", ",", "null", ",", "-", "1", ",", "-", "1", ",", "null", ",", "null", ")", ";", "}" ]
Creates a keychain group with just a basic chain. No deterministic chains will be created automatically.
[ "Creates", "a", "keychain", "group", "with", "just", "a", "basic", "chain", ".", "No", "deterministic", "chains", "will", "be", "created", "automatically", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L198-L200
Netflix/zeno
src/examples/java/com/netflix/zeno/examples/framework/IntSumFrameworkSerializer.java
IntSumFrameworkSerializer.serializePrimitive
@Override public void serializePrimitive(IntSumRecord rec, String fieldName, Object value) { """ We need to implement serializePrimitive to describe what happens when we encounter one of the following types: Integer, Long, Float, Double, Boolean, String. """ /// only interested in int values. if(value instanceof Integer) { rec.addValue(((Integer) value).intValue()); } }
java
@Override public void serializePrimitive(IntSumRecord rec, String fieldName, Object value) { /// only interested in int values. if(value instanceof Integer) { rec.addValue(((Integer) value).intValue()); } }
[ "@", "Override", "public", "void", "serializePrimitive", "(", "IntSumRecord", "rec", ",", "String", "fieldName", ",", "Object", "value", ")", "{", "/// only interested in int values.", "if", "(", "value", "instanceof", "Integer", ")", "{", "rec", ".", "addValue", "(", "(", "(", "Integer", ")", "value", ")", ".", "intValue", "(", ")", ")", ";", "}", "}" ]
We need to implement serializePrimitive to describe what happens when we encounter one of the following types: Integer, Long, Float, Double, Boolean, String.
[ "We", "need", "to", "implement", "serializePrimitive", "to", "describe", "what", "happens", "when", "we", "encounter", "one", "of", "the", "following", "types", ":", "Integer", "Long", "Float", "Double", "Boolean", "String", "." ]
train
https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/examples/java/com/netflix/zeno/examples/framework/IntSumFrameworkSerializer.java#L43-L49
hibernate/hibernate-ogm
infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/common/externalizer/impl/VersionChecker.java
VersionChecker.readAndCheckVersion
public static void readAndCheckVersion(ObjectInput input, int supportedVersion, Class<?> externalizedType) throws IOException { """ Consumes the version field from the given input and raises an exception if the record is in a newer version, written by a newer version of Hibernate OGM. @param input the input to read from @param supportedVersion the type version supported by this version of OGM @param externalizedType the type to be unmarshalled @throws IOException if an error occurs while reading the input """ int version = input.readInt(); if ( version != supportedVersion ) { throw LOG.unexpectedKeyVersion( externalizedType, version, supportedVersion ); } }
java
public static void readAndCheckVersion(ObjectInput input, int supportedVersion, Class<?> externalizedType) throws IOException { int version = input.readInt(); if ( version != supportedVersion ) { throw LOG.unexpectedKeyVersion( externalizedType, version, supportedVersion ); } }
[ "public", "static", "void", "readAndCheckVersion", "(", "ObjectInput", "input", ",", "int", "supportedVersion", ",", "Class", "<", "?", ">", "externalizedType", ")", "throws", "IOException", "{", "int", "version", "=", "input", ".", "readInt", "(", ")", ";", "if", "(", "version", "!=", "supportedVersion", ")", "{", "throw", "LOG", ".", "unexpectedKeyVersion", "(", "externalizedType", ",", "version", ",", "supportedVersion", ")", ";", "}", "}" ]
Consumes the version field from the given input and raises an exception if the record is in a newer version, written by a newer version of Hibernate OGM. @param input the input to read from @param supportedVersion the type version supported by this version of OGM @param externalizedType the type to be unmarshalled @throws IOException if an error occurs while reading the input
[ "Consumes", "the", "version", "field", "from", "the", "given", "input", "and", "raises", "an", "exception", "if", "the", "record", "is", "in", "a", "newer", "version", "written", "by", "a", "newer", "version", "of", "Hibernate", "OGM", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/common/externalizer/impl/VersionChecker.java#L35-L41
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.updateObject
@Override public <T> long updateObject(String name, T obj, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException { """ Update the Object in the datasource. The CpoAdapter will check to see if the object exists in the datasource. If it exists then the object will be updated. If it does not exist, an exception will be thrown <p> <pre>Example: <code> <p> class SomeObject so = new SomeObject(); class CpoAdapter cpo = null; <p> try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.updateObject("updateSomeObject",so); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the UPDATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. @param wheres A collection of CpoWhere objects to be used by the function @param orderBy A collection of CpoOrderBy objects to be used by the function @param nativeExpressions A collection of CpoNativeFunction objects to be used by the function @return The number of objects updated in the datasource @throws CpoException Thrown if there are errors accessing the datasource """ return getCurrentResource().updateObject(name, obj, wheres, orderBy, nativeExpressions); }
java
@Override public <T> long updateObject(String name, T obj, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException { return getCurrentResource().updateObject(name, obj, wheres, orderBy, nativeExpressions); }
[ "@", "Override", "public", "<", "T", ">", "long", "updateObject", "(", "String", "name", ",", "T", "obj", ",", "Collection", "<", "CpoWhere", ">", "wheres", ",", "Collection", "<", "CpoOrderBy", ">", "orderBy", ",", "Collection", "<", "CpoNativeFunction", ">", "nativeExpressions", ")", "throws", "CpoException", "{", "return", "getCurrentResource", "(", ")", ".", "updateObject", "(", "name", ",", "obj", ",", "wheres", ",", "orderBy", ",", "nativeExpressions", ")", ";", "}" ]
Update the Object in the datasource. The CpoAdapter will check to see if the object exists in the datasource. If it exists then the object will be updated. If it does not exist, an exception will be thrown <p> <pre>Example: <code> <p> class SomeObject so = new SomeObject(); class CpoAdapter cpo = null; <p> try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.updateObject("updateSomeObject",so); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the UPDATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. @param wheres A collection of CpoWhere objects to be used by the function @param orderBy A collection of CpoOrderBy objects to be used by the function @param nativeExpressions A collection of CpoNativeFunction objects to be used by the function @return The number of objects updated in the datasource @throws CpoException Thrown if there are errors accessing the datasource
[ "Update", "the", "Object", "in", "the", "datasource", ".", "The", "CpoAdapter", "will", "check", "to", "see", "if", "the", "object", "exists", "in", "the", "datasource", ".", "If", "it", "exists", "then", "the", "object", "will", "be", "updated", ".", "If", "it", "does", "not", "exist", "an", "exception", "will", "be", "thrown", "<p", ">", "<pre", ">", "Example", ":", "<code", ">", "<p", ">", "class", "SomeObject", "so", "=", "new", "SomeObject", "()", ";", "class", "CpoAdapter", "cpo", "=", "null", ";", "<p", ">", "try", "{", "cpo", "=", "new", "JdbcCpoAdapter", "(", "new", "JdbcDataSourceInfo", "(", "driver", "url", "user", "password", "1", "1", "false", "))", ";", "}", "catch", "(", "CpoException", "ce", ")", "{", "//", "Handle", "the", "error", "cpo", "=", "null", ";", "}", "<p", ">", "if", "(", "cpo!", "=", "null", ")", "{", "so", ".", "setId", "(", "1", ")", ";", "so", ".", "setName", "(", "SomeName", ")", ";", "try", "{", "cpo", ".", "updateObject", "(", "updateSomeObject", "so", ")", ";", "}", "catch", "(", "CpoException", "ce", ")", "{", "//", "Handle", "the", "error", "}", "}", "<", "/", "code", ">", "<", "/", "pre", ">" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L1668-L1671
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.listFromJobSchedule
public PagedList<CloudJob> listFromJobSchedule(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions) { """ Lists the jobs that have been created under the specified job schedule. @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. @param jobListFromJobScheduleOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;CloudJob&gt; object if successful. """ ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> response = listFromJobScheduleSinglePageAsync(jobScheduleId, jobListFromJobScheduleOptions).toBlocking().single(); return new PagedList<CloudJob>(response.body()) { @Override public Page<CloudJob> nextPage(String nextPageLink) { JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null; if (jobListFromJobScheduleOptions != null) { jobListFromJobScheduleNextOptions = new JobListFromJobScheduleNextOptions(); jobListFromJobScheduleNextOptions.withClientRequestId(jobListFromJobScheduleOptions.clientRequestId()); jobListFromJobScheduleNextOptions.withReturnClientRequestId(jobListFromJobScheduleOptions.returnClientRequestId()); jobListFromJobScheduleNextOptions.withOcpDate(jobListFromJobScheduleOptions.ocpDate()); } return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<CloudJob> listFromJobSchedule(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions) { ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> response = listFromJobScheduleSinglePageAsync(jobScheduleId, jobListFromJobScheduleOptions).toBlocking().single(); return new PagedList<CloudJob>(response.body()) { @Override public Page<CloudJob> nextPage(String nextPageLink) { JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null; if (jobListFromJobScheduleOptions != null) { jobListFromJobScheduleNextOptions = new JobListFromJobScheduleNextOptions(); jobListFromJobScheduleNextOptions.withClientRequestId(jobListFromJobScheduleOptions.clientRequestId()); jobListFromJobScheduleNextOptions.withReturnClientRequestId(jobListFromJobScheduleOptions.returnClientRequestId()); jobListFromJobScheduleNextOptions.withOcpDate(jobListFromJobScheduleOptions.ocpDate()); } return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "CloudJob", ">", "listFromJobSchedule", "(", "final", "String", "jobScheduleId", ",", "final", "JobListFromJobScheduleOptions", "jobListFromJobScheduleOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJob", ">", ",", "JobListFromJobScheduleHeaders", ">", "response", "=", "listFromJobScheduleSinglePageAsync", "(", "jobScheduleId", ",", "jobListFromJobScheduleOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ";", "return", "new", "PagedList", "<", "CloudJob", ">", "(", "response", ".", "body", "(", ")", ")", "{", "@", "Override", "public", "Page", "<", "CloudJob", ">", "nextPage", "(", "String", "nextPageLink", ")", "{", "JobListFromJobScheduleNextOptions", "jobListFromJobScheduleNextOptions", "=", "null", ";", "if", "(", "jobListFromJobScheduleOptions", "!=", "null", ")", "{", "jobListFromJobScheduleNextOptions", "=", "new", "JobListFromJobScheduleNextOptions", "(", ")", ";", "jobListFromJobScheduleNextOptions", ".", "withClientRequestId", "(", "jobListFromJobScheduleOptions", ".", "clientRequestId", "(", ")", ")", ";", "jobListFromJobScheduleNextOptions", ".", "withReturnClientRequestId", "(", "jobListFromJobScheduleOptions", ".", "returnClientRequestId", "(", ")", ")", ";", "jobListFromJobScheduleNextOptions", ".", "withOcpDate", "(", "jobListFromJobScheduleOptions", ".", "ocpDate", "(", ")", ")", ";", "}", "return", "listFromJobScheduleNextSinglePageAsync", "(", "nextPageLink", ",", "jobListFromJobScheduleNextOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}", "}", ";", "}" ]
Lists the jobs that have been created under the specified job schedule. @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. @param jobListFromJobScheduleOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;CloudJob&gt; object if successful.
[ "Lists", "the", "jobs", "that", "have", "been", "created", "under", "the", "specified", "job", "schedule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L2635-L2650
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java
MapPolyline.getNearestEndIndex
@Pure public final int getNearestEndIndex(double x, double y, OutputParameter<Double> distance) { """ Replies the index of the nearest end of line according to the specified point. @param x is the point coordinate from which the distance must be computed @param y is the point coordinate from which the distance must be computed @param distance is the distance value that will be set by this function (if the parameter is not <code>null</code>). @return index of the nearest end point. """ final int count = getPointCount(); final Point2d firstPoint = getPointAt(0); final Point2d lastPoint = getPointAt(count - 1); final double d1 = Point2D.getDistancePointPoint(firstPoint.getX(), firstPoint.getY(), x, y); final double d2 = Point2D.getDistancePointPoint(lastPoint.getX(), lastPoint.getY(), x, y); if (d1 <= d2) { if (distance != null) { distance.set(d1); } return 0; } if (distance != null) { distance.set(d2); } return count - 1; }
java
@Pure public final int getNearestEndIndex(double x, double y, OutputParameter<Double> distance) { final int count = getPointCount(); final Point2d firstPoint = getPointAt(0); final Point2d lastPoint = getPointAt(count - 1); final double d1 = Point2D.getDistancePointPoint(firstPoint.getX(), firstPoint.getY(), x, y); final double d2 = Point2D.getDistancePointPoint(lastPoint.getX(), lastPoint.getY(), x, y); if (d1 <= d2) { if (distance != null) { distance.set(d1); } return 0; } if (distance != null) { distance.set(d2); } return count - 1; }
[ "@", "Pure", "public", "final", "int", "getNearestEndIndex", "(", "double", "x", ",", "double", "y", ",", "OutputParameter", "<", "Double", ">", "distance", ")", "{", "final", "int", "count", "=", "getPointCount", "(", ")", ";", "final", "Point2d", "firstPoint", "=", "getPointAt", "(", "0", ")", ";", "final", "Point2d", "lastPoint", "=", "getPointAt", "(", "count", "-", "1", ")", ";", "final", "double", "d1", "=", "Point2D", ".", "getDistancePointPoint", "(", "firstPoint", ".", "getX", "(", ")", ",", "firstPoint", ".", "getY", "(", ")", ",", "x", ",", "y", ")", ";", "final", "double", "d2", "=", "Point2D", ".", "getDistancePointPoint", "(", "lastPoint", ".", "getX", "(", ")", ",", "lastPoint", ".", "getY", "(", ")", ",", "x", ",", "y", ")", ";", "if", "(", "d1", "<=", "d2", ")", "{", "if", "(", "distance", "!=", "null", ")", "{", "distance", ".", "set", "(", "d1", ")", ";", "}", "return", "0", ";", "}", "if", "(", "distance", "!=", "null", ")", "{", "distance", ".", "set", "(", "d2", ")", ";", "}", "return", "count", "-", "1", ";", "}" ]
Replies the index of the nearest end of line according to the specified point. @param x is the point coordinate from which the distance must be computed @param y is the point coordinate from which the distance must be computed @param distance is the distance value that will be set by this function (if the parameter is not <code>null</code>). @return index of the nearest end point.
[ "Replies", "the", "index", "of", "the", "nearest", "end", "of", "line", "according", "to", "the", "specified", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L248-L265
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/AccountHeader.java
AccountHeader.setActiveProfile
public void setActiveProfile(IProfile profile, boolean fireOnProfileChanged) { """ Selects the given profile and sets it to the new active profile @param profile """ final boolean isCurrentSelectedProfile = mAccountHeaderBuilder.switchProfiles(profile); //if the selectionList is shown we should also update the current selected profile in the list if (mAccountHeaderBuilder.mDrawer != null && isSelectionListShown()) { mAccountHeaderBuilder.mDrawer.setSelection(profile.getIdentifier(), false); } //fire the event if enabled and a listener is set if (fireOnProfileChanged && mAccountHeaderBuilder.mOnAccountHeaderListener != null) { mAccountHeaderBuilder.mOnAccountHeaderListener.onProfileChanged(null, profile, isCurrentSelectedProfile); } }
java
public void setActiveProfile(IProfile profile, boolean fireOnProfileChanged) { final boolean isCurrentSelectedProfile = mAccountHeaderBuilder.switchProfiles(profile); //if the selectionList is shown we should also update the current selected profile in the list if (mAccountHeaderBuilder.mDrawer != null && isSelectionListShown()) { mAccountHeaderBuilder.mDrawer.setSelection(profile.getIdentifier(), false); } //fire the event if enabled and a listener is set if (fireOnProfileChanged && mAccountHeaderBuilder.mOnAccountHeaderListener != null) { mAccountHeaderBuilder.mOnAccountHeaderListener.onProfileChanged(null, profile, isCurrentSelectedProfile); } }
[ "public", "void", "setActiveProfile", "(", "IProfile", "profile", ",", "boolean", "fireOnProfileChanged", ")", "{", "final", "boolean", "isCurrentSelectedProfile", "=", "mAccountHeaderBuilder", ".", "switchProfiles", "(", "profile", ")", ";", "//if the selectionList is shown we should also update the current selected profile in the list", "if", "(", "mAccountHeaderBuilder", ".", "mDrawer", "!=", "null", "&&", "isSelectionListShown", "(", ")", ")", "{", "mAccountHeaderBuilder", ".", "mDrawer", ".", "setSelection", "(", "profile", ".", "getIdentifier", "(", ")", ",", "false", ")", ";", "}", "//fire the event if enabled and a listener is set", "if", "(", "fireOnProfileChanged", "&&", "mAccountHeaderBuilder", ".", "mOnAccountHeaderListener", "!=", "null", ")", "{", "mAccountHeaderBuilder", ".", "mOnAccountHeaderListener", ".", "onProfileChanged", "(", "null", ",", "profile", ",", "isCurrentSelectedProfile", ")", ";", "}", "}" ]
Selects the given profile and sets it to the new active profile @param profile
[ "Selects", "the", "given", "profile", "and", "sets", "it", "to", "the", "new", "active", "profile" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/AccountHeader.java#L190-L200
facebookarchive/hadoop-20
src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java
SimulatorTaskTracker.progressTaskStatus
private void progressTaskStatus(SimulatorTaskInProgress tip, long now) { """ Updates the progress indicator of a task if it is running. @param tip simulator task in progress whose progress is to be updated @param now current simulation time """ TaskStatus status = tip.getTaskStatus(); if (status.getRunState() != State.RUNNING) { return; // nothing to be done } boolean isMap = tip.isMapTask(); // Time when the user space code started long startTime = -1; // Time spent in map or just in the REDUCE phase of a reduce task long runTime = tip.getUserSpaceRunTime(); float progress = 0.0f; if (isMap) { // We linearly estimate the progress of maps since their start startTime = status.getStartTime(); progress = ((float)(now - startTime)) / runTime; } else { // We don't model reduce progress in the SHUFFLE or SORT phases // We use linear estimate for the 3rd, REDUCE phase Phase reducePhase = status.getPhase(); switch (reducePhase) { case SHUFFLE: progress = 0.0f; // 0 phase is done out of 3 break; case SORT: progress = 1.0f/3; // 1 phase is done out of 3 break; case REDUCE: { // REDUCE phase with the user code started when sort finished startTime = status.getSortFinishTime(); // 0.66f : 2 phases are done out of of 3 progress = 2.0f/3 + (((float) (now - startTime)) / runTime) / 3.0f; } break; default: // should never get here throw new IllegalArgumentException("Invalid reducePhase=" + reducePhase); } } final float EPSILON = 0.0001f; if (progress < -EPSILON || progress > 1 + EPSILON) { throw new IllegalStateException("Task progress out of range: " + progress); } progress = Math.max(Math.min(1.0f, progress), 0.0f); status.setProgress(progress); if (LOG.isDebugEnabled()) { LOG.debug("Updated task progress, taskId=" + status.getTaskID() + ", progress=" + status.getProgress()); } }
java
private void progressTaskStatus(SimulatorTaskInProgress tip, long now) { TaskStatus status = tip.getTaskStatus(); if (status.getRunState() != State.RUNNING) { return; // nothing to be done } boolean isMap = tip.isMapTask(); // Time when the user space code started long startTime = -1; // Time spent in map or just in the REDUCE phase of a reduce task long runTime = tip.getUserSpaceRunTime(); float progress = 0.0f; if (isMap) { // We linearly estimate the progress of maps since their start startTime = status.getStartTime(); progress = ((float)(now - startTime)) / runTime; } else { // We don't model reduce progress in the SHUFFLE or SORT phases // We use linear estimate for the 3rd, REDUCE phase Phase reducePhase = status.getPhase(); switch (reducePhase) { case SHUFFLE: progress = 0.0f; // 0 phase is done out of 3 break; case SORT: progress = 1.0f/3; // 1 phase is done out of 3 break; case REDUCE: { // REDUCE phase with the user code started when sort finished startTime = status.getSortFinishTime(); // 0.66f : 2 phases are done out of of 3 progress = 2.0f/3 + (((float) (now - startTime)) / runTime) / 3.0f; } break; default: // should never get here throw new IllegalArgumentException("Invalid reducePhase=" + reducePhase); } } final float EPSILON = 0.0001f; if (progress < -EPSILON || progress > 1 + EPSILON) { throw new IllegalStateException("Task progress out of range: " + progress); } progress = Math.max(Math.min(1.0f, progress), 0.0f); status.setProgress(progress); if (LOG.isDebugEnabled()) { LOG.debug("Updated task progress, taskId=" + status.getTaskID() + ", progress=" + status.getProgress()); } }
[ "private", "void", "progressTaskStatus", "(", "SimulatorTaskInProgress", "tip", ",", "long", "now", ")", "{", "TaskStatus", "status", "=", "tip", ".", "getTaskStatus", "(", ")", ";", "if", "(", "status", ".", "getRunState", "(", ")", "!=", "State", ".", "RUNNING", ")", "{", "return", ";", "// nothing to be done", "}", "boolean", "isMap", "=", "tip", ".", "isMapTask", "(", ")", ";", "// Time when the user space code started", "long", "startTime", "=", "-", "1", ";", "// Time spent in map or just in the REDUCE phase of a reduce task", "long", "runTime", "=", "tip", ".", "getUserSpaceRunTime", "(", ")", ";", "float", "progress", "=", "0.0f", ";", "if", "(", "isMap", ")", "{", "// We linearly estimate the progress of maps since their start ", "startTime", "=", "status", ".", "getStartTime", "(", ")", ";", "progress", "=", "(", "(", "float", ")", "(", "now", "-", "startTime", ")", ")", "/", "runTime", ";", "}", "else", "{", "// We don't model reduce progress in the SHUFFLE or SORT phases", "// We use linear estimate for the 3rd, REDUCE phase", "Phase", "reducePhase", "=", "status", ".", "getPhase", "(", ")", ";", "switch", "(", "reducePhase", ")", "{", "case", "SHUFFLE", ":", "progress", "=", "0.0f", ";", "// 0 phase is done out of 3", "break", ";", "case", "SORT", ":", "progress", "=", "1.0f", "/", "3", ";", "// 1 phase is done out of 3", "break", ";", "case", "REDUCE", ":", "{", "// REDUCE phase with the user code started when sort finished", "startTime", "=", "status", ".", "getSortFinishTime", "(", ")", ";", "// 0.66f : 2 phases are done out of of 3", "progress", "=", "2.0f", "/", "3", "+", "(", "(", "(", "float", ")", "(", "now", "-", "startTime", ")", ")", "/", "runTime", ")", "/", "3.0f", ";", "}", "break", ";", "default", ":", "// should never get here", "throw", "new", "IllegalArgumentException", "(", "\"Invalid reducePhase=\"", "+", "reducePhase", ")", ";", "}", "}", "final", "float", "EPSILON", "=", "0.0001f", ";", "if", "(", "progress", "<", "-", "EPSILON", "||", "progress", ">", "1", "+", "EPSILON", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Task progress out of range: \"", "+", "progress", ")", ";", "}", "progress", "=", "Math", ".", "max", "(", "Math", ".", "min", "(", "1.0f", ",", "progress", ")", ",", "0.0f", ")", ";", "status", ".", "setProgress", "(", "progress", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Updated task progress, taskId=\"", "+", "status", ".", "getTaskID", "(", ")", "+", "\", progress=\"", "+", "status", ".", "getProgress", "(", ")", ")", ";", "}", "}" ]
Updates the progress indicator of a task if it is running. @param tip simulator task in progress whose progress is to be updated @param now current simulation time
[ "Updates", "the", "progress", "indicator", "of", "a", "task", "if", "it", "is", "running", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java#L440-L491
alkacon/opencms-core
src/org/opencms/security/CmsPrincipal.java
CmsPrincipal.readPrincipalIncludingHistory
public static I_CmsPrincipal readPrincipalIncludingHistory(CmsObject cms, CmsUUID id) throws CmsException { """ Utility function to read a principal by its id from the OpenCms database using the provided OpenCms user context.<p> @param cms the OpenCms user context to use when reading the principal @param id the id of the principal to read @return the principal read from the OpenCms database @throws CmsException in case the principal could not be read """ try { // first try to read the principal as a user return cms.readUser(id); } catch (CmsException exc) { // assume user does not exist } try { // now try to read the principal as a group return cms.readGroup(id); } catch (CmsException exc) { // assume group does not exist } try { // at the end try to read the principal from the history return cms.readHistoryPrincipal(id); } catch (CmsException exc) { // assume the principal does not exist at all } // invalid principal name was given throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_INVALID_PRINCIPAL_1, id)); }
java
public static I_CmsPrincipal readPrincipalIncludingHistory(CmsObject cms, CmsUUID id) throws CmsException { try { // first try to read the principal as a user return cms.readUser(id); } catch (CmsException exc) { // assume user does not exist } try { // now try to read the principal as a group return cms.readGroup(id); } catch (CmsException exc) { // assume group does not exist } try { // at the end try to read the principal from the history return cms.readHistoryPrincipal(id); } catch (CmsException exc) { // assume the principal does not exist at all } // invalid principal name was given throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_INVALID_PRINCIPAL_1, id)); }
[ "public", "static", "I_CmsPrincipal", "readPrincipalIncludingHistory", "(", "CmsObject", "cms", ",", "CmsUUID", "id", ")", "throws", "CmsException", "{", "try", "{", "// first try to read the principal as a user", "return", "cms", ".", "readUser", "(", "id", ")", ";", "}", "catch", "(", "CmsException", "exc", ")", "{", "// assume user does not exist", "}", "try", "{", "// now try to read the principal as a group", "return", "cms", ".", "readGroup", "(", "id", ")", ";", "}", "catch", "(", "CmsException", "exc", ")", "{", "// assume group does not exist", "}", "try", "{", "// at the end try to read the principal from the history", "return", "cms", ".", "readHistoryPrincipal", "(", "id", ")", ";", "}", "catch", "(", "CmsException", "exc", ")", "{", "// assume the principal does not exist at all", "}", "// invalid principal name was given", "throw", "new", "CmsDbEntryNotFoundException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_INVALID_PRINCIPAL_1", ",", "id", ")", ")", ";", "}" ]
Utility function to read a principal by its id from the OpenCms database using the provided OpenCms user context.<p> @param cms the OpenCms user context to use when reading the principal @param id the id of the principal to read @return the principal read from the OpenCms database @throws CmsException in case the principal could not be read
[ "Utility", "function", "to", "read", "a", "principal", "by", "its", "id", "from", "the", "OpenCms", "database", "using", "the", "provided", "OpenCms", "user", "context", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsPrincipal.java#L338-L360
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/Logger.java
Logger.getMessage
public String getMessage(final String aMessage, final Object... aDetails) { """ Gets a message from the logger's backing resource bundle if what's passed in is a message key; if it's not then what's passed in is, itself, returned. If what's passed in is the same thing as what's returned, any additional details passed in are ignored. @param aMessage A message to check against the backing resource bundle @param aDetails An array of additional details @return A message value (potentially from the backing resource bundle) """ if (hasI18nKey(aMessage)) { return getI18n(aMessage, aDetails); } else if (aDetails.length == 0) { return aMessage; } else { return StringUtils.format(aMessage, aDetails); } }
java
public String getMessage(final String aMessage, final Object... aDetails) { if (hasI18nKey(aMessage)) { return getI18n(aMessage, aDetails); } else if (aDetails.length == 0) { return aMessage; } else { return StringUtils.format(aMessage, aDetails); } }
[ "public", "String", "getMessage", "(", "final", "String", "aMessage", ",", "final", "Object", "...", "aDetails", ")", "{", "if", "(", "hasI18nKey", "(", "aMessage", ")", ")", "{", "return", "getI18n", "(", "aMessage", ",", "aDetails", ")", ";", "}", "else", "if", "(", "aDetails", ".", "length", "==", "0", ")", "{", "return", "aMessage", ";", "}", "else", "{", "return", "StringUtils", ".", "format", "(", "aMessage", ",", "aDetails", ")", ";", "}", "}" ]
Gets a message from the logger's backing resource bundle if what's passed in is a message key; if it's not then what's passed in is, itself, returned. If what's passed in is the same thing as what's returned, any additional details passed in are ignored. @param aMessage A message to check against the backing resource bundle @param aDetails An array of additional details @return A message value (potentially from the backing resource bundle)
[ "Gets", "a", "message", "from", "the", "logger", "s", "backing", "resource", "bundle", "if", "what", "s", "passed", "in", "is", "a", "message", "key", ";", "if", "it", "s", "not", "then", "what", "s", "passed", "in", "is", "itself", "returned", ".", "If", "what", "s", "passed", "in", "is", "the", "same", "thing", "as", "what", "s", "returned", "any", "additional", "details", "passed", "in", "are", "ignored", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/Logger.java#L1144-L1152
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java
WTemplate.addParameter
public void addParameter(final String tag, final Object value) { """ Add a template parameter. @param tag the tag for the template parameter @param value the value for the template parameter """ if (Util.empty(tag)) { throw new IllegalArgumentException("A tag must be provided"); } TemplateModel model = getOrCreateComponentModel(); if (model.parameters == null) { model.parameters = new HashMap<>(); } model.parameters.put(tag, value); }
java
public void addParameter(final String tag, final Object value) { if (Util.empty(tag)) { throw new IllegalArgumentException("A tag must be provided"); } TemplateModel model = getOrCreateComponentModel(); if (model.parameters == null) { model.parameters = new HashMap<>(); } model.parameters.put(tag, value); }
[ "public", "void", "addParameter", "(", "final", "String", "tag", ",", "final", "Object", "value", ")", "{", "if", "(", "Util", ".", "empty", "(", "tag", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A tag must be provided\"", ")", ";", "}", "TemplateModel", "model", "=", "getOrCreateComponentModel", "(", ")", ";", "if", "(", "model", ".", "parameters", "==", "null", ")", "{", "model", ".", "parameters", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "model", ".", "parameters", ".", "put", "(", "tag", ",", "value", ")", ";", "}" ]
Add a template parameter. @param tag the tag for the template parameter @param value the value for the template parameter
[ "Add", "a", "template", "parameter", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java#L223-L233
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java
AptControlImplementation.getControlInterface
public AptControlInterface getControlInterface() { """ Returns the ControlInterface implemented by this ControlImpl. """ if ( _implDecl == null || _implDecl.getSuperinterfaces() == null ) return null; Collection<InterfaceType> superInterfaces = _implDecl.getSuperinterfaces(); for (InterfaceType intfType : superInterfaces) { InterfaceDeclaration intfDecl = intfType.getDeclaration(); if (intfDecl != null && intfDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlInterface.class) != null) return new AptControlInterface(intfDecl, _ap); } return null; }
java
public AptControlInterface getControlInterface() { if ( _implDecl == null || _implDecl.getSuperinterfaces() == null ) return null; Collection<InterfaceType> superInterfaces = _implDecl.getSuperinterfaces(); for (InterfaceType intfType : superInterfaces) { InterfaceDeclaration intfDecl = intfType.getDeclaration(); if (intfDecl != null && intfDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlInterface.class) != null) return new AptControlInterface(intfDecl, _ap); } return null; }
[ "public", "AptControlInterface", "getControlInterface", "(", ")", "{", "if", "(", "_implDecl", "==", "null", "||", "_implDecl", ".", "getSuperinterfaces", "(", ")", "==", "null", ")", "return", "null", ";", "Collection", "<", "InterfaceType", ">", "superInterfaces", "=", "_implDecl", ".", "getSuperinterfaces", "(", ")", ";", "for", "(", "InterfaceType", "intfType", ":", "superInterfaces", ")", "{", "InterfaceDeclaration", "intfDecl", "=", "intfType", ".", "getDeclaration", "(", ")", ";", "if", "(", "intfDecl", "!=", "null", "&&", "intfDecl", ".", "getAnnotation", "(", "org", ".", "apache", ".", "beehive", ".", "controls", ".", "api", ".", "bean", ".", "ControlInterface", ".", "class", ")", "!=", "null", ")", "return", "new", "AptControlInterface", "(", "intfDecl", ",", "_ap", ")", ";", "}", "return", "null", ";", "}" ]
Returns the ControlInterface implemented by this ControlImpl.
[ "Returns", "the", "ControlInterface", "implemented", "by", "this", "ControlImpl", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java#L283-L298
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/RESTAppListener.java
RESTAppListener.setVirtualHost
@Reference(service = VirtualHost.class, target = "(&(enabled=true)(id=default_host)(httpsAlias=*))", policy = ReferencePolicy.STATIC, cardinality = ReferenceCardinality.MANDATORY) protected void setVirtualHost(VirtualHost vhost, Map<String, Object> props) { """ Set required VirtualHost. This will be called before activate. The target filter will only allow the enabled default_host virtual host to be bound if/when it has an SSL port available """ if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Set vhost: ", vhost); } secureVirtualHost = vhost; secureAlias = props.get("httpsAlias").toString(); createJMXWorkAreaResourceIfChanged(vhost); }
java
@Reference(service = VirtualHost.class, target = "(&(enabled=true)(id=default_host)(httpsAlias=*))", policy = ReferencePolicy.STATIC, cardinality = ReferenceCardinality.MANDATORY) protected void setVirtualHost(VirtualHost vhost, Map<String, Object> props) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Set vhost: ", vhost); } secureVirtualHost = vhost; secureAlias = props.get("httpsAlias").toString(); createJMXWorkAreaResourceIfChanged(vhost); }
[ "@", "Reference", "(", "service", "=", "VirtualHost", ".", "class", ",", "target", "=", "\"(&(enabled=true)(id=default_host)(httpsAlias=*))\"", ",", "policy", "=", "ReferencePolicy", ".", "STATIC", ",", "cardinality", "=", "ReferenceCardinality", ".", "MANDATORY", ")", "protected", "void", "setVirtualHost", "(", "VirtualHost", "vhost", ",", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Set vhost: \"", ",", "vhost", ")", ";", "}", "secureVirtualHost", "=", "vhost", ";", "secureAlias", "=", "props", ".", "get", "(", "\"httpsAlias\"", ")", ".", "toString", "(", ")", ";", "createJMXWorkAreaResourceIfChanged", "(", "vhost", ")", ";", "}" ]
Set required VirtualHost. This will be called before activate. The target filter will only allow the enabled default_host virtual host to be bound if/when it has an SSL port available
[ "Set", "required", "VirtualHost", ".", "This", "will", "be", "called", "before", "activate", ".", "The", "target", "filter", "will", "only", "allow", "the", "enabled", "default_host", "virtual", "host", "to", "be", "bound", "if", "/", "when", "it", "has", "an", "SSL", "port", "available" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/RESTAppListener.java#L131-L142
crnk-project/crnk-framework
crnk-data/crnk-data-jpa/src/main/java/io/crnk/data/jpa/JpaEntityRepositoryBase.java
JpaEntityRepositoryBase.getIdFromEntity
@SuppressWarnings("unchecked") protected I getIdFromEntity(EntityManager em, Object entity, ResourceField idField) { """ Extracts the resource ID from the entity. By default it uses the entity's primary key if the field name matches the DTO's ID field. Override in subclasses if a different entity field should be used. @return the resource ID or <code>null</code> when it could not be determined """ Object pk = em.getEntityManagerFactory().getPersistenceUnitUtil().getIdentifier(entity); PreconditionUtil.verify(pk != null, "pk not available for entity %s", entity); if (pk != null && primaryKeyAttribute.getName().equals(idField.getUnderlyingName()) && idField.getElementType().isAssignableFrom(pk.getClass())) { return (I) pk; } return null; }
java
@SuppressWarnings("unchecked") protected I getIdFromEntity(EntityManager em, Object entity, ResourceField idField) { Object pk = em.getEntityManagerFactory().getPersistenceUnitUtil().getIdentifier(entity); PreconditionUtil.verify(pk != null, "pk not available for entity %s", entity); if (pk != null && primaryKeyAttribute.getName().equals(idField.getUnderlyingName()) && idField.getElementType().isAssignableFrom(pk.getClass())) { return (I) pk; } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "I", "getIdFromEntity", "(", "EntityManager", "em", ",", "Object", "entity", ",", "ResourceField", "idField", ")", "{", "Object", "pk", "=", "em", ".", "getEntityManagerFactory", "(", ")", ".", "getPersistenceUnitUtil", "(", ")", ".", "getIdentifier", "(", "entity", ")", ";", "PreconditionUtil", ".", "verify", "(", "pk", "!=", "null", ",", "\"pk not available for entity %s\"", ",", "entity", ")", ";", "if", "(", "pk", "!=", "null", "&&", "primaryKeyAttribute", ".", "getName", "(", ")", ".", "equals", "(", "idField", ".", "getUnderlyingName", "(", ")", ")", "&&", "idField", ".", "getElementType", "(", ")", ".", "isAssignableFrom", "(", "pk", ".", "getClass", "(", ")", ")", ")", "{", "return", "(", "I", ")", "pk", ";", "}", "return", "null", ";", "}" ]
Extracts the resource ID from the entity. By default it uses the entity's primary key if the field name matches the DTO's ID field. Override in subclasses if a different entity field should be used. @return the resource ID or <code>null</code> when it could not be determined
[ "Extracts", "the", "resource", "ID", "from", "the", "entity", ".", "By", "default", "it", "uses", "the", "entity", "s", "primary", "key", "if", "the", "field", "name", "matches", "the", "DTO", "s", "ID", "field", ".", "Override", "in", "subclasses", "if", "a", "different", "entity", "field", "should", "be", "used", "." ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-data/crnk-data-jpa/src/main/java/io/crnk/data/jpa/JpaEntityRepositoryBase.java#L200-L208
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.requestState
@ObjectiveCName("requestStateWithFileId:withCallback:") public void requestState(long fileId, final FileCallback callback) { """ Request file state @param fileId file id @param callback file state callback """ modules.getFilesModule().requestState(fileId, callback); }
java
@ObjectiveCName("requestStateWithFileId:withCallback:") public void requestState(long fileId, final FileCallback callback) { modules.getFilesModule().requestState(fileId, callback); }
[ "@", "ObjectiveCName", "(", "\"requestStateWithFileId:withCallback:\"", ")", "public", "void", "requestState", "(", "long", "fileId", ",", "final", "FileCallback", "callback", ")", "{", "modules", ".", "getFilesModule", "(", ")", ".", "requestState", "(", "fileId", ",", "callback", ")", ";", "}" ]
Request file state @param fileId file id @param callback file state callback
[ "Request", "file", "state" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L1975-L1978
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.saveCounter
public static <E> void saveCounter(Counter<E> c, OutputStream stream) { """ Saves a Counter as one key/count pair per line separated by white space to the given OutputStream. Does not close the stream. """ PrintStream out = new PrintStream(stream); for (E key : c.keySet()) { out.println(key + " " + c.getCount(key)); } }
java
public static <E> void saveCounter(Counter<E> c, OutputStream stream) { PrintStream out = new PrintStream(stream); for (E key : c.keySet()) { out.println(key + " " + c.getCount(key)); } }
[ "public", "static", "<", "E", ">", "void", "saveCounter", "(", "Counter", "<", "E", ">", "c", ",", "OutputStream", "stream", ")", "{", "PrintStream", "out", "=", "new", "PrintStream", "(", "stream", ")", ";", "for", "(", "E", "key", ":", "c", ".", "keySet", "(", ")", ")", "{", "out", ".", "println", "(", "key", "+", "\" \"", "+", "c", ".", "getCount", "(", "key", ")", ")", ";", "}", "}" ]
Saves a Counter as one key/count pair per line separated by white space to the given OutputStream. Does not close the stream.
[ "Saves", "a", "Counter", "as", "one", "key", "/", "count", "pair", "per", "line", "separated", "by", "white", "space", "to", "the", "given", "OutputStream", ".", "Does", "not", "close", "the", "stream", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1632-L1637
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/AESUtils.java
AESUtils.createCipher
public static Cipher createCipher(int mode, byte[] keyData, byte[] iv, String cipherTransformation) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { """ Create and initialize a {@link Cipher} instance. @param mode either {@link Cipher#ENCRYPT_MODE} or {@link Cipher#DECRYPT_MODE} @param keyData @param iv @param cipherTransformation @return @throws NoSuchPaddingException @throws NoSuchAlgorithmException @throws InvalidKeyException @throws InvalidAlgorithmParameterException @since 0.9.2 """ if (StringUtils.isBlank(cipherTransformation)) { cipherTransformation = DEFAULT_CIPHER_TRANSFORMATION; } if (!cipherTransformation.startsWith("AES/ECB/")) { // non-ECB requires IV if (iv == null || iv.length == 0) { iv = DEFAULT_IV_BYTES; } } else { // must not use IV with ECB iv = null; } SecretKeySpec aesKey = new SecretKeySpec(keyData, CIPHER_ALGORITHM); Cipher cipher = Cipher.getInstance(cipherTransformation); if (iv == null) { cipher.init(mode, aesKey); } else { AlgorithmParameterSpec spec = cipherTransformation.startsWith("AES/GCM/") ? new GCMParameterSpec(128, iv) : new IvParameterSpec(iv); cipher.init(mode, aesKey, spec); } return cipher; }
java
public static Cipher createCipher(int mode, byte[] keyData, byte[] iv, String cipherTransformation) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { if (StringUtils.isBlank(cipherTransformation)) { cipherTransformation = DEFAULT_CIPHER_TRANSFORMATION; } if (!cipherTransformation.startsWith("AES/ECB/")) { // non-ECB requires IV if (iv == null || iv.length == 0) { iv = DEFAULT_IV_BYTES; } } else { // must not use IV with ECB iv = null; } SecretKeySpec aesKey = new SecretKeySpec(keyData, CIPHER_ALGORITHM); Cipher cipher = Cipher.getInstance(cipherTransformation); if (iv == null) { cipher.init(mode, aesKey); } else { AlgorithmParameterSpec spec = cipherTransformation.startsWith("AES/GCM/") ? new GCMParameterSpec(128, iv) : new IvParameterSpec(iv); cipher.init(mode, aesKey, spec); } return cipher; }
[ "public", "static", "Cipher", "createCipher", "(", "int", "mode", ",", "byte", "[", "]", "keyData", ",", "byte", "[", "]", "iv", ",", "String", "cipherTransformation", ")", "throws", "NoSuchAlgorithmException", ",", "NoSuchPaddingException", ",", "InvalidKeyException", ",", "InvalidAlgorithmParameterException", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "cipherTransformation", ")", ")", "{", "cipherTransformation", "=", "DEFAULT_CIPHER_TRANSFORMATION", ";", "}", "if", "(", "!", "cipherTransformation", ".", "startsWith", "(", "\"AES/ECB/\"", ")", ")", "{", "// non-ECB requires IV", "if", "(", "iv", "==", "null", "||", "iv", ".", "length", "==", "0", ")", "{", "iv", "=", "DEFAULT_IV_BYTES", ";", "}", "}", "else", "{", "// must not use IV with ECB", "iv", "=", "null", ";", "}", "SecretKeySpec", "aesKey", "=", "new", "SecretKeySpec", "(", "keyData", ",", "CIPHER_ALGORITHM", ")", ";", "Cipher", "cipher", "=", "Cipher", ".", "getInstance", "(", "cipherTransformation", ")", ";", "if", "(", "iv", "==", "null", ")", "{", "cipher", ".", "init", "(", "mode", ",", "aesKey", ")", ";", "}", "else", "{", "AlgorithmParameterSpec", "spec", "=", "cipherTransformation", ".", "startsWith", "(", "\"AES/GCM/\"", ")", "?", "new", "GCMParameterSpec", "(", "128", ",", "iv", ")", ":", "new", "IvParameterSpec", "(", "iv", ")", ";", "cipher", ".", "init", "(", "mode", ",", "aesKey", ",", "spec", ")", ";", "}", "return", "cipher", ";", "}" ]
Create and initialize a {@link Cipher} instance. @param mode either {@link Cipher#ENCRYPT_MODE} or {@link Cipher#DECRYPT_MODE} @param keyData @param iv @param cipherTransformation @return @throws NoSuchPaddingException @throws NoSuchAlgorithmException @throws InvalidKeyException @throws InvalidAlgorithmParameterException @since 0.9.2
[ "Create", "and", "initialize", "a", "{", "@link", "Cipher", "}", "instance", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/AESUtils.java#L110-L136
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java
GenericIHEAuditEventMessage.addValueSetParticipantObject
public void addValueSetParticipantObject(String valueSetUniqueId, String valueSetName, String valueSetVersion) { """ Adds a Participant Object representing a value set for SVS Exports @param valueSetUniqueId unique id (OID) of the returned value set @param valueSetName name associated with the unique id (OID) of the returned value set @param valueSetVersion version of the returned value set """ if (valueSetName == null){ valueSetName = ""; } if (valueSetVersion == null){ valueSetVersion = ""; } List<TypeValuePairType> tvp = new LinkedList<>(); tvp.add(getTypeValuePair("Value Set Version", valueSetVersion.getBytes())); addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(), valueSetName, null, tvp, valueSetUniqueId, RFC3881ParticipantObjectTypeCodes.SYSTEM, RFC3881ParticipantObjectTypeRoleCodes.REPORT, null, null); }
java
public void addValueSetParticipantObject(String valueSetUniqueId, String valueSetName, String valueSetVersion) { if (valueSetName == null){ valueSetName = ""; } if (valueSetVersion == null){ valueSetVersion = ""; } List<TypeValuePairType> tvp = new LinkedList<>(); tvp.add(getTypeValuePair("Value Set Version", valueSetVersion.getBytes())); addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(), valueSetName, null, tvp, valueSetUniqueId, RFC3881ParticipantObjectTypeCodes.SYSTEM, RFC3881ParticipantObjectTypeRoleCodes.REPORT, null, null); }
[ "public", "void", "addValueSetParticipantObject", "(", "String", "valueSetUniqueId", ",", "String", "valueSetName", ",", "String", "valueSetVersion", ")", "{", "if", "(", "valueSetName", "==", "null", ")", "{", "valueSetName", "=", "\"\"", ";", "}", "if", "(", "valueSetVersion", "==", "null", ")", "{", "valueSetVersion", "=", "\"\"", ";", "}", "List", "<", "TypeValuePairType", ">", "tvp", "=", "new", "LinkedList", "<>", "(", ")", ";", "tvp", ".", "add", "(", "getTypeValuePair", "(", "\"Value Set Version\"", ",", "valueSetVersion", ".", "getBytes", "(", ")", ")", ")", ";", "addParticipantObjectIdentification", "(", "new", "RFC3881ParticipantObjectCodes", ".", "RFC3881ParticipantObjectIDTypeCodes", ".", "ReportNumber", "(", ")", ",", "valueSetName", ",", "null", ",", "tvp", ",", "valueSetUniqueId", ",", "RFC3881ParticipantObjectTypeCodes", ".", "SYSTEM", ",", "RFC3881ParticipantObjectTypeRoleCodes", ".", "REPORT", ",", "null", ",", "null", ")", ";", "}" ]
Adds a Participant Object representing a value set for SVS Exports @param valueSetUniqueId unique id (OID) of the returned value set @param valueSetName name associated with the unique id (OID) of the returned value set @param valueSetVersion version of the returned value set
[ "Adds", "a", "Participant", "Object", "representing", "a", "value", "set", "for", "SVS", "Exports" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L262-L282
paypal/SeLion
codegen/src/main/java/com/paypal/selion/plugins/GUIObjectDetails.java
GUIObjectDetails.transformKeys
public static List<GUIObjectDetails> transformKeys(List<String> keys) { """ A overloaded version of transformKeys method which internally specifies {@link TestPlatform#WEB} as the {@link TestPlatform} @param keys keys for which {@link GUIObjectDetails} is to be created. @return the {@link List} of {@link GUIObjectDetails} """ return transformKeys(keys, TestPlatform.WEB); }
java
public static List<GUIObjectDetails> transformKeys(List<String> keys) { return transformKeys(keys, TestPlatform.WEB); }
[ "public", "static", "List", "<", "GUIObjectDetails", ">", "transformKeys", "(", "List", "<", "String", ">", "keys", ")", "{", "return", "transformKeys", "(", "keys", ",", "TestPlatform", ".", "WEB", ")", ";", "}" ]
A overloaded version of transformKeys method which internally specifies {@link TestPlatform#WEB} as the {@link TestPlatform} @param keys keys for which {@link GUIObjectDetails} is to be created. @return the {@link List} of {@link GUIObjectDetails}
[ "A", "overloaded", "version", "of", "transformKeys", "method", "which", "internally", "specifies", "{", "@link", "TestPlatform#WEB", "}", "as", "the", "{", "@link", "TestPlatform", "}" ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/codegen/src/main/java/com/paypal/selion/plugins/GUIObjectDetails.java#L124-L126
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.createTransitionForState
public Transition createTransitionForState(final TransitionableState state, final String criteriaOutcome, final String targetState) { """ Create transition for state transition. @param state the state @param criteriaOutcome the criteria outcome @param targetState the target state @return the transition """ return createTransitionForState(state, criteriaOutcome, targetState, false); }
java
public Transition createTransitionForState(final TransitionableState state, final String criteriaOutcome, final String targetState) { return createTransitionForState(state, criteriaOutcome, targetState, false); }
[ "public", "Transition", "createTransitionForState", "(", "final", "TransitionableState", "state", ",", "final", "String", "criteriaOutcome", ",", "final", "String", "targetState", ")", "{", "return", "createTransitionForState", "(", "state", ",", "criteriaOutcome", ",", "targetState", ",", "false", ")", ";", "}" ]
Create transition for state transition. @param state the state @param criteriaOutcome the criteria outcome @param targetState the target state @return the transition
[ "Create", "transition", "for", "state", "transition", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L295-L297
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_plesk_serviceName_upgrade_GET
public ArrayList<String> license_plesk_serviceName_upgrade_GET(String serviceName, OvhOrderableAntispamEnum antispam, OvhOrderableAntivirusEnum antivirus, OvhPleskApplicationSetEnum applicationSet, OvhOrderablePleskDomainNumberEnum domainNumber, OvhOrderablePleskLanguagePackEnum languagePackNumber, Boolean powerpack, Boolean resellerManagement, OvhPleskVersionEnum version, Boolean wordpressToolkit) throws IOException { """ Get allowed durations for 'upgrade' option REST: GET /order/license/plesk/{serviceName}/upgrade @param antispam [required] The antispam currently enabled on this Plesk License @param resellerManagement [required] Reseller management option activation @param languagePackNumber [required] The amount (between 0 and 5) of language pack numbers to include in this licences @param antivirus [required] The antivirus to enable on this Plesk license @param wordpressToolkit [required] WordpressToolkit option activation @param applicationSet [required] Wanted application set @param domainNumber [required] This license domain number @param powerpack [required] powerpack current activation state on your license @param version [required] This license version @param serviceName [required] The name of your Plesk license """ String qPath = "/order/license/plesk/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "antispam", antispam); query(sb, "antivirus", antivirus); query(sb, "applicationSet", applicationSet); query(sb, "domainNumber", domainNumber); query(sb, "languagePackNumber", languagePackNumber); query(sb, "powerpack", powerpack); query(sb, "resellerManagement", resellerManagement); query(sb, "version", version); query(sb, "wordpressToolkit", wordpressToolkit); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> license_plesk_serviceName_upgrade_GET(String serviceName, OvhOrderableAntispamEnum antispam, OvhOrderableAntivirusEnum antivirus, OvhPleskApplicationSetEnum applicationSet, OvhOrderablePleskDomainNumberEnum domainNumber, OvhOrderablePleskLanguagePackEnum languagePackNumber, Boolean powerpack, Boolean resellerManagement, OvhPleskVersionEnum version, Boolean wordpressToolkit) throws IOException { String qPath = "/order/license/plesk/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "antispam", antispam); query(sb, "antivirus", antivirus); query(sb, "applicationSet", applicationSet); query(sb, "domainNumber", domainNumber); query(sb, "languagePackNumber", languagePackNumber); query(sb, "powerpack", powerpack); query(sb, "resellerManagement", resellerManagement); query(sb, "version", version); query(sb, "wordpressToolkit", wordpressToolkit); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "license_plesk_serviceName_upgrade_GET", "(", "String", "serviceName", ",", "OvhOrderableAntispamEnum", "antispam", ",", "OvhOrderableAntivirusEnum", "antivirus", ",", "OvhPleskApplicationSetEnum", "applicationSet", ",", "OvhOrderablePleskDomainNumberEnum", "domainNumber", ",", "OvhOrderablePleskLanguagePackEnum", "languagePackNumber", ",", "Boolean", "powerpack", ",", "Boolean", "resellerManagement", ",", "OvhPleskVersionEnum", "version", ",", "Boolean", "wordpressToolkit", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/license/plesk/{serviceName}/upgrade\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"antispam\"", ",", "antispam", ")", ";", "query", "(", "sb", ",", "\"antivirus\"", ",", "antivirus", ")", ";", "query", "(", "sb", ",", "\"applicationSet\"", ",", "applicationSet", ")", ";", "query", "(", "sb", ",", "\"domainNumber\"", ",", "domainNumber", ")", ";", "query", "(", "sb", ",", "\"languagePackNumber\"", ",", "languagePackNumber", ")", ";", "query", "(", "sb", ",", "\"powerpack\"", ",", "powerpack", ")", ";", "query", "(", "sb", ",", "\"resellerManagement\"", ",", "resellerManagement", ")", ";", "query", "(", "sb", ",", "\"version\"", ",", "version", ")", ";", "query", "(", "sb", ",", "\"wordpressToolkit\"", ",", "wordpressToolkit", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
Get allowed durations for 'upgrade' option REST: GET /order/license/plesk/{serviceName}/upgrade @param antispam [required] The antispam currently enabled on this Plesk License @param resellerManagement [required] Reseller management option activation @param languagePackNumber [required] The amount (between 0 and 5) of language pack numbers to include in this licences @param antivirus [required] The antivirus to enable on this Plesk license @param wordpressToolkit [required] WordpressToolkit option activation @param applicationSet [required] Wanted application set @param domainNumber [required] This license domain number @param powerpack [required] powerpack current activation state on your license @param version [required] This license version @param serviceName [required] The name of your Plesk license
[ "Get", "allowed", "durations", "for", "upgrade", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1863-L1877
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java
CPDisplayLayoutPersistenceImpl.findByC_C
@Override public CPDisplayLayout findByC_C(long classNameId, long classPK) throws NoSuchCPDisplayLayoutException { """ Returns the cp display layout where classNameId = &#63; and classPK = &#63; or throws a {@link NoSuchCPDisplayLayoutException} if it could not be found. @param classNameId the class name ID @param classPK the class pk @return the matching cp display layout @throws NoSuchCPDisplayLayoutException if a matching cp display layout could not be found """ CPDisplayLayout cpDisplayLayout = fetchByC_C(classNameId, classPK); if (cpDisplayLayout == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("classNameId="); msg.append(classNameId); msg.append(", classPK="); msg.append(classPK); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPDisplayLayoutException(msg.toString()); } return cpDisplayLayout; }
java
@Override public CPDisplayLayout findByC_C(long classNameId, long classPK) throws NoSuchCPDisplayLayoutException { CPDisplayLayout cpDisplayLayout = fetchByC_C(classNameId, classPK); if (cpDisplayLayout == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("classNameId="); msg.append(classNameId); msg.append(", classPK="); msg.append(classPK); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPDisplayLayoutException(msg.toString()); } return cpDisplayLayout; }
[ "@", "Override", "public", "CPDisplayLayout", "findByC_C", "(", "long", "classNameId", ",", "long", "classPK", ")", "throws", "NoSuchCPDisplayLayoutException", "{", "CPDisplayLayout", "cpDisplayLayout", "=", "fetchByC_C", "(", "classNameId", ",", "classPK", ")", ";", "if", "(", "cpDisplayLayout", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"classNameId=\"", ")", ";", "msg", ".", "append", "(", "classNameId", ")", ";", "msg", ".", "append", "(", "\", classPK=\"", ")", ";", "msg", ".", "append", "(", "classPK", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchCPDisplayLayoutException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "cpDisplayLayout", ";", "}" ]
Returns the cp display layout where classNameId = &#63; and classPK = &#63; or throws a {@link NoSuchCPDisplayLayoutException} if it could not be found. @param classNameId the class name ID @param classPK the class pk @return the matching cp display layout @throws NoSuchCPDisplayLayoutException if a matching cp display layout could not be found
[ "Returns", "the", "cp", "display", "layout", "where", "classNameId", "=", "&#63", ";", "and", "classPK", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPDisplayLayoutException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java#L1501-L1527
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java
StableUniqueStanzaIdManager.enable
public synchronized void enable() { """ Start appending origin-id elements to outgoing stanzas and add the feature to disco. """ ServiceDiscoveryManager.getInstanceFor(connection()).addFeature(NAMESPACE); StanzaFilter filter = new AndFilter(OUTGOING_FILTER, new NotFilter(OUTGOING_FILTER)); connection().addStanzaInterceptor(ADD_ORIGIN_ID_INTERCEPTOR, filter); }
java
public synchronized void enable() { ServiceDiscoveryManager.getInstanceFor(connection()).addFeature(NAMESPACE); StanzaFilter filter = new AndFilter(OUTGOING_FILTER, new NotFilter(OUTGOING_FILTER)); connection().addStanzaInterceptor(ADD_ORIGIN_ID_INTERCEPTOR, filter); }
[ "public", "synchronized", "void", "enable", "(", ")", "{", "ServiceDiscoveryManager", ".", "getInstanceFor", "(", "connection", "(", ")", ")", ".", "addFeature", "(", "NAMESPACE", ")", ";", "StanzaFilter", "filter", "=", "new", "AndFilter", "(", "OUTGOING_FILTER", ",", "new", "NotFilter", "(", "OUTGOING_FILTER", ")", ")", ";", "connection", "(", ")", ".", "addStanzaInterceptor", "(", "ADD_ORIGIN_ID_INTERCEPTOR", ",", "filter", ")", ";", "}" ]
Start appending origin-id elements to outgoing stanzas and add the feature to disco.
[ "Start", "appending", "origin", "-", "id", "elements", "to", "outgoing", "stanzas", "and", "add", "the", "feature", "to", "disco", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java#L93-L97
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_util.java
Dcs_util.cs_spalloc
public static Dcs cs_spalloc(int m, int n, int nzmax, boolean values, boolean triplet) { """ Allocate a sparse matrix (triplet form or compressed-column form). @param m number of rows @param n number of columns @param nzmax maximum number of entries @param values allocate pattern only if false, values and pattern otherwise @param triplet compressed-column if false, triplet form otherwise @return sparse matrix """ Dcs A = new Dcs(); /* allocate the Dcs struct */ A.m = m; /* define dimensions and nzmax */ A.n = n; A.nzmax = nzmax = Math.max(nzmax, 1); A.nz = triplet ? 0 : -1; /* allocate triplet or comp.col */ A.p = triplet ? new int[nzmax] : new int[n + 1]; A.i = new int[nzmax]; A.x = values ? new double[nzmax] : null; return A; }
java
public static Dcs cs_spalloc(int m, int n, int nzmax, boolean values, boolean triplet) { Dcs A = new Dcs(); /* allocate the Dcs struct */ A.m = m; /* define dimensions and nzmax */ A.n = n; A.nzmax = nzmax = Math.max(nzmax, 1); A.nz = triplet ? 0 : -1; /* allocate triplet or comp.col */ A.p = triplet ? new int[nzmax] : new int[n + 1]; A.i = new int[nzmax]; A.x = values ? new double[nzmax] : null; return A; }
[ "public", "static", "Dcs", "cs_spalloc", "(", "int", "m", ",", "int", "n", ",", "int", "nzmax", ",", "boolean", "values", ",", "boolean", "triplet", ")", "{", "Dcs", "A", "=", "new", "Dcs", "(", ")", ";", "/* allocate the Dcs struct */", "A", ".", "m", "=", "m", ";", "/* define dimensions and nzmax */", "A", ".", "n", "=", "n", ";", "A", ".", "nzmax", "=", "nzmax", "=", "Math", ".", "max", "(", "nzmax", ",", "1", ")", ";", "A", ".", "nz", "=", "triplet", "?", "0", ":", "-", "1", ";", "/* allocate triplet or comp.col */", "A", ".", "p", "=", "triplet", "?", "new", "int", "[", "nzmax", "]", ":", "new", "int", "[", "n", "+", "1", "]", ";", "A", ".", "i", "=", "new", "int", "[", "nzmax", "]", ";", "A", ".", "x", "=", "values", "?", "new", "double", "[", "nzmax", "]", ":", "null", ";", "return", "A", ";", "}" ]
Allocate a sparse matrix (triplet form or compressed-column form). @param m number of rows @param n number of columns @param nzmax maximum number of entries @param values allocate pattern only if false, values and pattern otherwise @param triplet compressed-column if false, triplet form otherwise @return sparse matrix
[ "Allocate", "a", "sparse", "matrix", "(", "triplet", "form", "or", "compressed", "-", "column", "form", ")", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_util.java#L53-L63
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/FilePathProcessor.java
FilePathProcessor.processPath
public static void processPath(File path, String suffix, boolean recursively, FileProcessor processor) { """ Apply a method to the files under a given directory and perhaps its subdirectories. @param path file or directory to load from @param suffix suffix (normally "File extension") of files to load @param recursively true means descend into subdirectories as well @param processor The <code>FileProcessor</code> to apply to each <code>File</code> """ processPath(path, new ExtensionFileFilter(suffix, recursively), processor); }
java
public static void processPath(File path, String suffix, boolean recursively, FileProcessor processor) { processPath(path, new ExtensionFileFilter(suffix, recursively), processor); }
[ "public", "static", "void", "processPath", "(", "File", "path", ",", "String", "suffix", ",", "boolean", "recursively", ",", "FileProcessor", "processor", ")", "{", "processPath", "(", "path", ",", "new", "ExtensionFileFilter", "(", "suffix", ",", "recursively", ")", ",", "processor", ")", ";", "}" ]
Apply a method to the files under a given directory and perhaps its subdirectories. @param path file or directory to load from @param suffix suffix (normally "File extension") of files to load @param recursively true means descend into subdirectories as well @param processor The <code>FileProcessor</code> to apply to each <code>File</code>
[ "Apply", "a", "method", "to", "the", "files", "under", "a", "given", "directory", "and", "perhaps", "its", "subdirectories", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/FilePathProcessor.java#L49-L51