repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.scalarProduct
public static final double scalarProduct(Atom a, Atom b) { return a.getX() * b.getX() + a.getY() * b.getY() + a.getZ() * b.getZ(); }
java
public static final double scalarProduct(Atom a, Atom b) { return a.getX() * b.getX() + a.getY() * b.getY() + a.getZ() * b.getZ(); }
[ "public", "static", "final", "double", "scalarProduct", "(", "Atom", "a", ",", "Atom", "b", ")", "{", "return", "a", ".", "getX", "(", ")", "*", "b", ".", "getX", "(", ")", "+", "a", ".", "getY", "(", ")", "*", "b", ".", "getY", "(", ")", "+"...
Scalar product (dot product). @param a an Atom object @param b an Atom object @return a double
[ "Scalar", "product", "(", "dot", "product", ")", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L170-L172
dvasilen/Hive-XML-SerDe
src/main/java/com/ibm/spss/hive/serde2/xml/processor/java/JavaXmlProcessor.java
JavaXmlProcessor.getObjectValue
private Object getObjectValue(Node node, String fieldName) { // we have to take into account the fact that fieldName will be in the lower case if (node != null) { String name = node.getLocalName(); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: return name.equalsIgnoreCase(fieldName) ? node : null; case Node.ELEMENT_NODE: { if (name.equalsIgnoreCase(fieldName)) { return new NodeArray(node.getChildNodes()); } else { NamedNodeMap namedNodeMap = node.getAttributes(); for (int attributeIndex = 0; attributeIndex < namedNodeMap.getLength(); ++attributeIndex) { Node attribute = namedNodeMap.item(attributeIndex); if (attribute.getLocalName().equalsIgnoreCase(fieldName)) { return attribute; } } return null; } } default: return null; } } return null; }
java
private Object getObjectValue(Node node, String fieldName) { // we have to take into account the fact that fieldName will be in the lower case if (node != null) { String name = node.getLocalName(); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: return name.equalsIgnoreCase(fieldName) ? node : null; case Node.ELEMENT_NODE: { if (name.equalsIgnoreCase(fieldName)) { return new NodeArray(node.getChildNodes()); } else { NamedNodeMap namedNodeMap = node.getAttributes(); for (int attributeIndex = 0; attributeIndex < namedNodeMap.getLength(); ++attributeIndex) { Node attribute = namedNodeMap.item(attributeIndex); if (attribute.getLocalName().equalsIgnoreCase(fieldName)) { return attribute; } } return null; } } default: return null; } } return null; }
[ "private", "Object", "getObjectValue", "(", "Node", "node", ",", "String", "fieldName", ")", "{", "// we have to take into account the fact that fieldName will be in the lower case", "if", "(", "node", "!=", "null", ")", "{", "String", "name", "=", "node", ".", "getLo...
Returns the object value for the given field name and node @param node the node @param fieldName the field name @return the object value for the given field name and node
[ "Returns", "the", "object", "value", "for", "the", "given", "field", "name", "and", "node" ]
train
https://github.com/dvasilen/Hive-XML-SerDe/blob/2a7a184b2cfaeb63008529a9851cd72edb8025d9/src/main/java/com/ibm/spss/hive/serde2/xml/processor/java/JavaXmlProcessor.java#L168-L194
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXTablesFactory.java
GPXTablesFactory.createTrackPointsTable
public static PreparedStatement createTrackPointsTable(Connection connection, String trackPointsTableName,boolean isH2) throws SQLException { try (Statement stmt = connection.createStatement()) { StringBuilder sb = new StringBuilder("CREATE TABLE "); sb.append(trackPointsTableName).append(" ("); if(isH2){ sb.append("the_geom POINT CHECK ST_SRID(THE_GEOM) = 4326,"); } else{ sb.append("the_geom GEOMETRY(POINT, 4326),"); } sb.append(" id INT,"); sb.append(GPXTags.LAT.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.LON.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.ELE.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.TIME.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.MAGVAR.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.GEOIDHEIGHT.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.NAME.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.CMT.toLowerCase()).append(" TEXT,"); sb.append("description").append(" TEXT,"); sb.append(GPXTags.SRC.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.HREF.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.HREFTITLE.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.SYM.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.TYPE.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.FIX.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.SAT.toLowerCase()).append(" INT,"); sb.append(GPXTags.HDOP.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.VDOP.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.PDOP.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.AGEOFDGPSDATA.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.DGPSID.toLowerCase()).append(" INT,"); sb.append(GPXTags.EXTENSIONS.toLowerCase()).append(" BOOLEAN,"); sb.append("track_segment_id").append(" INT);"); stmt.execute(sb.toString()); } //We return the preparedstatement of the waypoints table StringBuilder insert = new StringBuilder("INSERT INTO ").append(trackPointsTableName).append(" VALUES ( ?"); for (int i = 1; i < GpxMetadata.RTEPTFIELDCOUNT; i++) { insert.append(",?"); } insert.append(");"); return connection.prepareStatement(insert.toString()); }
java
public static PreparedStatement createTrackPointsTable(Connection connection, String trackPointsTableName,boolean isH2) throws SQLException { try (Statement stmt = connection.createStatement()) { StringBuilder sb = new StringBuilder("CREATE TABLE "); sb.append(trackPointsTableName).append(" ("); if(isH2){ sb.append("the_geom POINT CHECK ST_SRID(THE_GEOM) = 4326,"); } else{ sb.append("the_geom GEOMETRY(POINT, 4326),"); } sb.append(" id INT,"); sb.append(GPXTags.LAT.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.LON.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.ELE.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.TIME.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.MAGVAR.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.GEOIDHEIGHT.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.NAME.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.CMT.toLowerCase()).append(" TEXT,"); sb.append("description").append(" TEXT,"); sb.append(GPXTags.SRC.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.HREF.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.HREFTITLE.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.SYM.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.TYPE.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.FIX.toLowerCase()).append(" TEXT,"); sb.append(GPXTags.SAT.toLowerCase()).append(" INT,"); sb.append(GPXTags.HDOP.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.VDOP.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.PDOP.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.AGEOFDGPSDATA.toLowerCase()).append(" FLOAT8,"); sb.append(GPXTags.DGPSID.toLowerCase()).append(" INT,"); sb.append(GPXTags.EXTENSIONS.toLowerCase()).append(" BOOLEAN,"); sb.append("track_segment_id").append(" INT);"); stmt.execute(sb.toString()); } //We return the preparedstatement of the waypoints table StringBuilder insert = new StringBuilder("INSERT INTO ").append(trackPointsTableName).append(" VALUES ( ?"); for (int i = 1; i < GpxMetadata.RTEPTFIELDCOUNT; i++) { insert.append(",?"); } insert.append(");"); return connection.prepareStatement(insert.toString()); }
[ "public", "static", "PreparedStatement", "createTrackPointsTable", "(", "Connection", "connection", ",", "String", "trackPointsTableName", ",", "boolean", "isH2", ")", "throws", "SQLException", "{", "try", "(", "Statement", "stmt", "=", "connection", ".", "createState...
Create the track points table to store the track waypoints @param connection @param trackPointsTableName @param isH2 set true if it's an H2 database @return @throws SQLException
[ "Create", "the", "track", "points", "table", "to", "store", "the", "track", "waypoints" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXTablesFactory.java#L277-L320
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java
AnnotationUtils.getClassAnnotation
@Deprecated public static <A> A getClassAnnotation(Object object, Class<A> annotationClass) { return (A) getAnnotation(object, (Class<? extends Annotation>) annotationClass); }
java
@Deprecated public static <A> A getClassAnnotation(Object object, Class<A> annotationClass) { return (A) getAnnotation(object, (Class<? extends Annotation>) annotationClass); }
[ "@", "Deprecated", "public", "static", "<", "A", ">", "A", "getClassAnnotation", "(", "Object", "object", ",", "Class", "<", "A", ">", "annotationClass", ")", "{", "return", "(", "A", ")", "getAnnotation", "(", "object", ",", "(", "Class", "<", "?", "e...
Searches for a class annotation. All inheritance tree is analysed. @deprecated As of 3.1, replaced by {@link #getAnnotation(Object,Class)}
[ "Searches", "for", "a", "class", "annotation", ".", "All", "inheritance", "tree", "is", "analysed", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java#L67-L70
Blazebit/blaze-utils
blaze-ee-utils/src/main/java/com/blazebit/cdi/CdiUtils.java
CdiUtils.getBean
public static <T> T getBean(Class<T> clazz, Annotation... annotations) { return getBean(getBeanManager(), clazz, annotations); }
java
public static <T> T getBean(Class<T> clazz, Annotation... annotations) { return getBean(getBeanManager(), clazz, annotations); }
[ "public", "static", "<", "T", ">", "T", "getBean", "(", "Class", "<", "T", ">", "clazz", ",", "Annotation", "...", "annotations", ")", "{", "return", "getBean", "(", "getBeanManager", "(", ")", ",", "clazz", ",", "annotations", ")", ";", "}" ]
Retrieves the bean for the given class from the bean manager available via JNDI qualified with the given annotation(s). @param <T> The type of the bean to look for @param clazz The class of the bean to look for @param annotationClasses The qualifiers the bean for the given class must have @return The bean instance if found, otherwise null
[ "Retrieves", "the", "bean", "for", "the", "given", "class", "from", "the", "bean", "manager", "available", "via", "JNDI", "qualified", "with", "the", "given", "annotation", "(", "s", ")", "." ]
train
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-ee-utils/src/main/java/com/blazebit/cdi/CdiUtils.java#L93-L95
samskivert/samskivert
src/main/java/com/samskivert/util/HashIntSet.java
HashIntSet.getBucketCount
protected static int getBucketCount (int capacity, float loadFactor) { int size = (int)(capacity / loadFactor); int highest = Integer.highestOneBit(size); return Math.max((size == highest) ? highest : (highest << 1), MIN_BUCKET_COUNT); }
java
protected static int getBucketCount (int capacity, float loadFactor) { int size = (int)(capacity / loadFactor); int highest = Integer.highestOneBit(size); return Math.max((size == highest) ? highest : (highest << 1), MIN_BUCKET_COUNT); }
[ "protected", "static", "int", "getBucketCount", "(", "int", "capacity", ",", "float", "loadFactor", ")", "{", "int", "size", "=", "(", "int", ")", "(", "capacity", "/", "loadFactor", ")", ";", "int", "highest", "=", "Integer", ".", "highestOneBit", "(", ...
Computes the number of buckets needed to provide the given capacity with the specified load factor.
[ "Computes", "the", "number", "of", "buckets", "needed", "to", "provide", "the", "given", "capacity", "with", "the", "specified", "load", "factor", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/HashIntSet.java#L414-L419
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java
GenericUtils.putByteArray
static public WsByteBuffer[] putByteArray(WsByteBuffer[] buffers, byte[] value, BNFHeadersImpl bnfObj) { // LIDB2356-41: byte[]/offset/length support return putByteArray(buffers, value, 0, value.length, bnfObj); }
java
static public WsByteBuffer[] putByteArray(WsByteBuffer[] buffers, byte[] value, BNFHeadersImpl bnfObj) { // LIDB2356-41: byte[]/offset/length support return putByteArray(buffers, value, 0, value.length, bnfObj); }
[ "static", "public", "WsByteBuffer", "[", "]", "putByteArray", "(", "WsByteBuffer", "[", "]", "buffers", ",", "byte", "[", "]", "value", ",", "BNFHeadersImpl", "bnfObj", ")", "{", "// LIDB2356-41: byte[]/offset/length support", "return", "putByteArray", "(", "buffers...
Given a wsbb[], we're adding a byte[] value to the last buffer. If that buffer fills up, then we will allocate a new one, expand the wsbb[] and keep going until the entire byte[] is added. <p> Returns the new wsbb[] (expanded if needed). @param buffers @param value @param bnfObj @return WsByteBuffer[]
[ "Given", "a", "wsbb", "[]", "we", "re", "adding", "a", "byte", "[]", "value", "to", "the", "last", "buffer", ".", "If", "that", "buffer", "fills", "up", "then", "we", "will", "allocate", "a", "new", "one", "expand", "the", "wsbb", "[]", "and", "keep"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L149-L152
dihedron/dihedron-commons
src/main/java/org/dihedron/core/formatters/HexWriter.java
HexWriter.toHex
public static String toHex(byte[] data, int length) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i != length; i++) { int v = data[i] & 0xff; buffer.append(DIGITS.charAt(v >> 4)); buffer.append(DIGITS.charAt(v & 0xf)); } return buffer.toString(); }
java
public static String toHex(byte[] data, int length) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i != length; i++) { int v = data[i] & 0xff; buffer.append(DIGITS.charAt(v >> 4)); buffer.append(DIGITS.charAt(v & 0xf)); } return buffer.toString(); }
[ "public", "static", "String", "toHex", "(", "byte", "[", "]", "data", ",", "int", "length", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "!=", "length", ";", "i", "++", ...
Return length many bytes of the passed in byte array as a hex string. @param data the bytes to be converted. @param length the number of bytes in the data block to be converted. @return a hex representation of length bytes of data.
[ "Return", "length", "many", "bytes", "of", "the", "passed", "in", "byte", "array", "as", "a", "hex", "string", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/formatters/HexWriter.java#L40-L51
cloudbees/bees-maven-components
src/main/java/com/cloudbees/sdk/maven/RepositoryService.java
RepositoryService.resolveDependencies
public DependencyResult resolveDependencies(GAV a, String scope) throws DependencyResolutionException { DependencyFilter classpathFlter = DependencyFilterUtils.classpathFilter(scope); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new Dependency(new DefaultArtifact(a.toString()), JavaScopes.COMPILE)); collectRequest.setRepositories(remoteRepositories); DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, classpathFlter); return resolveDependencies(dependencyRequest); }
java
public DependencyResult resolveDependencies(GAV a, String scope) throws DependencyResolutionException { DependencyFilter classpathFlter = DependencyFilterUtils.classpathFilter(scope); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new Dependency(new DefaultArtifact(a.toString()), JavaScopes.COMPILE)); collectRequest.setRepositories(remoteRepositories); DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, classpathFlter); return resolveDependencies(dependencyRequest); }
[ "public", "DependencyResult", "resolveDependencies", "(", "GAV", "a", ",", "String", "scope", ")", "throws", "DependencyResolutionException", "{", "DependencyFilter", "classpathFlter", "=", "DependencyFilterUtils", ".", "classpathFilter", "(", "scope", ")", ";", "Collec...
Resolves dependencies transitively from the given jar artifact, with the specified Maven scope (compile, runtime, and so on.)
[ "Resolves", "dependencies", "transitively", "from", "the", "given", "jar", "artifact", "with", "the", "specified", "Maven", "scope", "(", "compile", "runtime", "and", "so", "on", ".", ")" ]
train
https://github.com/cloudbees/bees-maven-components/blob/b4410c4826c38a83c209286dad847f3bdfad682a/src/main/java/com/cloudbees/sdk/maven/RepositoryService.java#L181-L191
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java
MapPolyline.distanceToEnd
@Pure public double distanceToEnd(Point2D<?, ?> point, double width) { final Point2d firstPoint = getPointAt(0); final Point2d lastPoint = getPointAt(-1); double d1 = firstPoint.getDistance(point); double d2 = lastPoint.getDistance(point); d1 -= width; if (d1 < 0) { d1 = 0; } d2 -= width; if (d2 < 0) { d2 = 0; } return d1 < d2 ? d1 : d2; }
java
@Pure public double distanceToEnd(Point2D<?, ?> point, double width) { final Point2d firstPoint = getPointAt(0); final Point2d lastPoint = getPointAt(-1); double d1 = firstPoint.getDistance(point); double d2 = lastPoint.getDistance(point); d1 -= width; if (d1 < 0) { d1 = 0; } d2 -= width; if (d2 < 0) { d2 = 0; } return d1 < d2 ? d1 : d2; }
[ "@", "Pure", "public", "double", "distanceToEnd", "(", "Point2D", "<", "?", ",", "?", ">", "point", ",", "double", "width", ")", "{", "final", "Point2d", "firstPoint", "=", "getPointAt", "(", "0", ")", ";", "final", "Point2d", "lastPoint", "=", "getPoint...
Replies the distance between the nearest end of this MapElement and the point. @param point is the x-coordinate of the point. @param width is the width of the polyline. @return the computed distance
[ "Replies", "the", "distance", "between", "the", "nearest", "end", "of", "this", "MapElement", "and", "the", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L211-L226
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMapIndexColorModel.java
InverseColorMapIndexColorModel.getDataElements
public Object getDataElements(int rgb, Object pixel) { int alpha = (rgb>>>24); int pix; if (alpha < ALPHA_THRESHOLD && getTransparentPixel() != -1) { pix = getTransparentPixel(); } else { int color = rgb & RGB_MASK; if (color == WHITE && whiteIndex != -1) { pix = whiteIndex; } else { pix = inverseMap.getIndexNearest(color); } } return installpixel(pixel, pix); }
java
public Object getDataElements(int rgb, Object pixel) { int alpha = (rgb>>>24); int pix; if (alpha < ALPHA_THRESHOLD && getTransparentPixel() != -1) { pix = getTransparentPixel(); } else { int color = rgb & RGB_MASK; if (color == WHITE && whiteIndex != -1) { pix = whiteIndex; } else { pix = inverseMap.getIndexNearest(color); } } return installpixel(pixel, pix); }
[ "public", "Object", "getDataElements", "(", "int", "rgb", ",", "Object", "pixel", ")", "{", "int", "alpha", "=", "(", "rgb", ">>>", "24", ")", ";", "int", "pix", ";", "if", "(", "alpha", "<", "ALPHA_THRESHOLD", "&&", "getTransparentPixel", "(", ")", "!...
Returns a data element array representation of a pixel in this ColorModel, given an integer pixel representation in the default RGB color model. This array can then be passed to the {@link java.awt.image.WritableRaster#setDataElements(int, int, Object) setDataElements} method of a {@link java.awt.image.WritableRaster} object. If the pixel variable is {@code null}, a new array is allocated. If {@code pixel} is not {@code null}, it must be a primitive array of type {@code transferType}; otherwise, a {@code ClassCastException} is thrown. An {@code ArrayIndexOutOfBoundsException} is thrown if {@code pixel} is not large enough to hold a pixel value for this {@code ColorModel}. The pixel array is returned. <p> Since {@code OpaqueIndexColorModel} can be subclassed, subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported {@code transferType}. #param rgb the integer pixel representation in the default RGB color model #param pixel the specified pixel #return an array representation of the specified pixel in this {@code OpaqueIndexColorModel}. #throws ClassCastException if {@code pixel} is not a primitive array of type {@code transferType} #throws ArrayIndexOutOfBoundsException if {@code pixel} is not large enough to hold a pixel value for this {@code ColorModel} #throws UnsupportedOperationException if {@code transferType} is invalid @see java.awt.image.WritableRaster#setDataElements @see java.awt.image.SampleModel#setDataElements
[ "Returns", "a", "data", "element", "array", "representation", "of", "a", "pixel", "in", "this", "ColorModel", "given", "an", "integer", "pixel", "representation", "in", "the", "default", "RGB", "color", "model", ".", "This", "array", "can", "then", "be", "pa...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMapIndexColorModel.java#L243-L261
elastic/elasticsearch-metrics-reporter-java
src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java
ElasticsearchReporter.createNewConnectionIfBulkSizeReached
private HttpURLConnection createNewConnectionIfBulkSizeReached(HttpURLConnection connection, int entriesWritten) throws IOException { if (entriesWritten % bulkSize == 0) { closeConnection(connection); return openConnection("/_bulk", "POST"); } return connection; }
java
private HttpURLConnection createNewConnectionIfBulkSizeReached(HttpURLConnection connection, int entriesWritten) throws IOException { if (entriesWritten % bulkSize == 0) { closeConnection(connection); return openConnection("/_bulk", "POST"); } return connection; }
[ "private", "HttpURLConnection", "createNewConnectionIfBulkSizeReached", "(", "HttpURLConnection", "connection", ",", "int", "entriesWritten", ")", "throws", "IOException", "{", "if", "(", "entriesWritten", "%", "bulkSize", "==", "0", ")", "{", "closeConnection", "(", ...
Create a new connection when the bulk size has hit the limit Checked on every write of a metric
[ "Create", "a", "new", "connection", "when", "the", "bulk", "size", "has", "hit", "the", "limit", "Checked", "on", "every", "write", "of", "a", "metric" ]
train
https://github.com/elastic/elasticsearch-metrics-reporter-java/blob/4018eaef6fc7721312f7440b2bf5a19699a6cb56/src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java#L412-L419
samskivert/pythagoras
src/main/java/pythagoras/f/Box.java
Box.intersectsX
protected boolean intersectsX (IRay3 ray, float x) { IVector3 origin = ray.origin(), dir = ray.direction(); float t = (x - origin.x()) / dir.x(); if (t < 0f) { return false; } float iy = origin.y() + t*dir.y(), iz = origin.z() + t*dir.z(); return iy >= _minExtent.y && iy <= _maxExtent.y && iz >= _minExtent.z && iz <= _maxExtent.z; }
java
protected boolean intersectsX (IRay3 ray, float x) { IVector3 origin = ray.origin(), dir = ray.direction(); float t = (x - origin.x()) / dir.x(); if (t < 0f) { return false; } float iy = origin.y() + t*dir.y(), iz = origin.z() + t*dir.z(); return iy >= _minExtent.y && iy <= _maxExtent.y && iz >= _minExtent.z && iz <= _maxExtent.z; }
[ "protected", "boolean", "intersectsX", "(", "IRay3", "ray", ",", "float", "x", ")", "{", "IVector3", "origin", "=", "ray", ".", "origin", "(", ")", ",", "dir", "=", "ray", ".", "direction", "(", ")", ";", "float", "t", "=", "(", "x", "-", "origin",...
Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box at the plane where x equals the value specified.
[ "Helper", "method", "for", "{" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Box.java#L434-L443
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.calculateFrameLength
private static int calculateFrameLength(int layer, int bitRate, int sampleRate, int padding) { if (layer == AudioFrame.LAYER_1) { return (12 * bitRate / sampleRate + padding) * 4; } else { return 144 * bitRate / sampleRate + padding; } }
java
private static int calculateFrameLength(int layer, int bitRate, int sampleRate, int padding) { if (layer == AudioFrame.LAYER_1) { return (12 * bitRate / sampleRate + padding) * 4; } else { return 144 * bitRate / sampleRate + padding; } }
[ "private", "static", "int", "calculateFrameLength", "(", "int", "layer", ",", "int", "bitRate", ",", "int", "sampleRate", ",", "int", "padding", ")", "{", "if", "(", "layer", "==", "AudioFrame", ".", "LAYER_1", ")", "{", "return", "(", "12", "*", "bitRat...
Calculates the length of an MPEG frame based on the given parameters. @param layer the layer @param bitRate the bit rate @param sampleRate the sample rate @param padding the padding flag @return the length of the frame in bytes
[ "Calculates", "the", "length", "of", "an", "MPEG", "frame", "based", "on", "the", "given", "parameters", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L312-L318
kefirfromperm/kefirbb
src/org/kefirsf/bb/util/IntSet.java
IntSet.binarySearch
private static int binarySearch(int[] array, int toIndex, int key) { int low = 0; int high = toIndex - 1; while (low <= high) { int mid = (low + high) >>> 1; int midVal = array[mid]; if (midVal < key) { low = mid + 1; } else if (midVal > key) { high = mid - 1; } else { return mid; // key found } } return -(low + 1); // key not found. }
java
private static int binarySearch(int[] array, int toIndex, int key) { int low = 0; int high = toIndex - 1; while (low <= high) { int mid = (low + high) >>> 1; int midVal = array[mid]; if (midVal < key) { low = mid + 1; } else if (midVal > key) { high = mid - 1; } else { return mid; // key found } } return -(low + 1); // key not found. }
[ "private", "static", "int", "binarySearch", "(", "int", "[", "]", "array", ",", "int", "toIndex", ",", "int", "key", ")", "{", "int", "low", "=", "0", ";", "int", "high", "=", "toIndex", "-", "1", ";", "while", "(", "low", "<=", "high", ")", "{",...
Realisation of binary search algorithm. It is in JDK 1.6.0 but for JDK 1.5.0 compatibility I added it there. @param array array of integers values ordered by ascending @param toIndex top break of array @param key searched value @return value index or -(index of position)
[ "Realisation", "of", "binary", "search", "algorithm", ".", "It", "is", "in", "JDK", "1", ".", "6", ".", "0", "but", "for", "JDK", "1", ".", "5", ".", "0", "compatibility", "I", "added", "it", "there", "." ]
train
https://github.com/kefirfromperm/kefirbb/blob/8c36fc3d3dc27459b0cdc179b87582df30420856/src/org/kefirsf/bb/util/IntSet.java#L66-L83
apache/groovy
src/main/java/org/codehaus/groovy/transform/trait/TraitComposer.java
TraitComposer.doCreateSuperForwarder
private static void doCreateSuperForwarder(ClassNode targetNode, MethodNode forwarderMethod, ClassNode[] interfacesToGenerateForwarderFor, Map<String,ClassNode> genericsSpec) { Parameter[] parameters = forwarderMethod.getParameters(); Parameter[] superForwarderParams = new Parameter[parameters.length]; for (int i = 0; i < parameters.length; i++) { Parameter parameter = parameters[i]; ClassNode originType = parameter.getOriginType(); superForwarderParams[i] = new Parameter(correctToGenericsSpecRecurse(genericsSpec, originType), parameter.getName()); } for (int i = 0; i < interfacesToGenerateForwarderFor.length; i++) { final ClassNode current = interfacesToGenerateForwarderFor[i]; final ClassNode next = i < interfacesToGenerateForwarderFor.length - 1 ? interfacesToGenerateForwarderFor[i + 1] : null; String forwarderName = Traits.getSuperTraitMethodName(current, forwarderMethod.getName()); if (targetNode.getDeclaredMethod(forwarderName, superForwarderParams) == null) { ClassNode returnType = correctToGenericsSpecRecurse(genericsSpec, forwarderMethod.getReturnType()); Statement delegate = next == null ? createSuperFallback(forwarderMethod, returnType) : createDelegatingForwarder(forwarderMethod, next); MethodNode methodNode = targetNode.addMethod(forwarderName, Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, returnType, superForwarderParams, ClassNode.EMPTY_ARRAY, delegate); methodNode.setGenericsTypes(forwarderMethod.getGenericsTypes()); } } }
java
private static void doCreateSuperForwarder(ClassNode targetNode, MethodNode forwarderMethod, ClassNode[] interfacesToGenerateForwarderFor, Map<String,ClassNode> genericsSpec) { Parameter[] parameters = forwarderMethod.getParameters(); Parameter[] superForwarderParams = new Parameter[parameters.length]; for (int i = 0; i < parameters.length; i++) { Parameter parameter = parameters[i]; ClassNode originType = parameter.getOriginType(); superForwarderParams[i] = new Parameter(correctToGenericsSpecRecurse(genericsSpec, originType), parameter.getName()); } for (int i = 0; i < interfacesToGenerateForwarderFor.length; i++) { final ClassNode current = interfacesToGenerateForwarderFor[i]; final ClassNode next = i < interfacesToGenerateForwarderFor.length - 1 ? interfacesToGenerateForwarderFor[i + 1] : null; String forwarderName = Traits.getSuperTraitMethodName(current, forwarderMethod.getName()); if (targetNode.getDeclaredMethod(forwarderName, superForwarderParams) == null) { ClassNode returnType = correctToGenericsSpecRecurse(genericsSpec, forwarderMethod.getReturnType()); Statement delegate = next == null ? createSuperFallback(forwarderMethod, returnType) : createDelegatingForwarder(forwarderMethod, next); MethodNode methodNode = targetNode.addMethod(forwarderName, Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, returnType, superForwarderParams, ClassNode.EMPTY_ARRAY, delegate); methodNode.setGenericsTypes(forwarderMethod.getGenericsTypes()); } } }
[ "private", "static", "void", "doCreateSuperForwarder", "(", "ClassNode", "targetNode", ",", "MethodNode", "forwarderMethod", ",", "ClassNode", "[", "]", "interfacesToGenerateForwarderFor", ",", "Map", "<", "String", ",", "ClassNode", ">", "genericsSpec", ")", "{", "...
Creates a method to dispatch to "super traits" in a "stackable" fashion. The generated method looks like this: <p> <code>ReturnType trait$super$method(Class clazz, Arg1 arg1, Arg2 arg2, ...) { if (SomeTrait.is(A) { return SomeOtherTrait$Trait$Helper.method(this, arg1, arg2) } super.method(arg1,arg2) }</code> </p> @param targetNode @param forwarderMethod @param interfacesToGenerateForwarderFor @param genericsSpec
[ "Creates", "a", "method", "to", "dispatch", "to", "super", "traits", "in", "a", "stackable", "fashion", ".", "The", "generated", "method", "looks", "like", "this", ":", "<p", ">", "<code", ">", "ReturnType", "trait$super$method", "(", "Class", "clazz", "Arg1...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/trait/TraitComposer.java#L493-L512
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cache/impl/journal/RingbufferCacheEventJournalImpl.java
RingbufferCacheEventJournalImpl.toRingbufferConfig
@Override public RingbufferConfig toRingbufferConfig(EventJournalConfig config, ObjectNamespace namespace) { CacheConfig cacheConfig = getCacheService().getCacheConfig(namespace.getObjectName()); if (cacheConfig == null) { throw new CacheNotExistsException("Cache " + namespace.getObjectName() + " is already destroyed or not created yet, on " + nodeEngine.getLocalMember()); } int partitionCount = nodeEngine.getPartitionService().getPartitionCount(); return new RingbufferConfig() .setAsyncBackupCount(cacheConfig.getAsyncBackupCount()) .setBackupCount(cacheConfig.getBackupCount()) .setInMemoryFormat(InMemoryFormat.OBJECT) .setCapacity(config.getCapacity() / partitionCount) .setTimeToLiveSeconds(config.getTimeToLiveSeconds()); }
java
@Override public RingbufferConfig toRingbufferConfig(EventJournalConfig config, ObjectNamespace namespace) { CacheConfig cacheConfig = getCacheService().getCacheConfig(namespace.getObjectName()); if (cacheConfig == null) { throw new CacheNotExistsException("Cache " + namespace.getObjectName() + " is already destroyed or not created yet, on " + nodeEngine.getLocalMember()); } int partitionCount = nodeEngine.getPartitionService().getPartitionCount(); return new RingbufferConfig() .setAsyncBackupCount(cacheConfig.getAsyncBackupCount()) .setBackupCount(cacheConfig.getBackupCount()) .setInMemoryFormat(InMemoryFormat.OBJECT) .setCapacity(config.getCapacity() / partitionCount) .setTimeToLiveSeconds(config.getTimeToLiveSeconds()); }
[ "@", "Override", "public", "RingbufferConfig", "toRingbufferConfig", "(", "EventJournalConfig", "config", ",", "ObjectNamespace", "namespace", ")", "{", "CacheConfig", "cacheConfig", "=", "getCacheService", "(", ")", ".", "getCacheConfig", "(", "namespace", ".", "getO...
{@inheritDoc} @throws CacheNotExistsException if the cache configuration was not found
[ "{", "@inheritDoc", "}" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/journal/RingbufferCacheEventJournalImpl.java#L189-L204
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.getSQLFromField
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException { if (this.isNull()) { if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE) && (iType != DBConstants.SQL_SEEK_TYPE)) statement.setNull(iParamColumn, Types.VARCHAR); else statement.setString(iParamColumn, Constants.BLANK); // Can't be null in the db } else { String string = this.getString(); boolean bUseBlob = false; if (string.length() >= 256) // Access must use blob if >= 256 if (DBConstants.TRUE.equals(this.getRecord().getTable().getDatabase().getProperty(SQLParams.USE_BLOB_ON_LARGE_STRINGS))) bUseBlob = true; if (!bUseBlob) { statement.setString(iParamColumn, string); } else { byte rgBytes[] = string.getBytes(); ByteArrayInputStream ba = new ByteArrayInputStream(rgBytes); statement.setAsciiStream(iParamColumn, ba, rgBytes.length); } } }
java
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException { if (this.isNull()) { if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE) && (iType != DBConstants.SQL_SEEK_TYPE)) statement.setNull(iParamColumn, Types.VARCHAR); else statement.setString(iParamColumn, Constants.BLANK); // Can't be null in the db } else { String string = this.getString(); boolean bUseBlob = false; if (string.length() >= 256) // Access must use blob if >= 256 if (DBConstants.TRUE.equals(this.getRecord().getTable().getDatabase().getProperty(SQLParams.USE_BLOB_ON_LARGE_STRINGS))) bUseBlob = true; if (!bUseBlob) { statement.setString(iParamColumn, string); } else { byte rgBytes[] = string.getBytes(); ByteArrayInputStream ba = new ByteArrayInputStream(rgBytes); statement.setAsciiStream(iParamColumn, ba, rgBytes.length); } } }
[ "public", "void", "getSQLFromField", "(", "PreparedStatement", "statement", ",", "int", "iType", ",", "int", "iParamColumn", ")", "throws", "SQLException", "{", "if", "(", "this", ".", "isNull", "(", ")", ")", "{", "if", "(", "(", "this", ".", "isNullable"...
Move the physical binary data to this SQL parameter row. This is overidden to move the physical data type. @param statement The SQL prepare statement. @param iType the type of SQL statement. @param iParamColumn The column in the prepared statement to set the data. @exception SQLException From SQL calls.
[ "Move", "the", "physical", "binary", "data", "to", "this", "SQL", "parameter", "row", ".", "This", "is", "overidden", "to", "move", "the", "physical", "data", "type", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L801-L828
alkacon/opencms-core
src/org/opencms/main/CmsStaticResourceHandler.java
CmsStaticResourceHandler.streamContent
private void streamContent(HttpServletResponse response, InputStream is) throws IOException { OutputStream os = response.getOutputStream(); try { byte buffer[] = new byte[DEFAULT_BUFFER_SIZE]; int bytes; while ((bytes = is.read(buffer)) >= 0) { os.write(buffer, 0, bytes); } } finally { os.close(); } }
java
private void streamContent(HttpServletResponse response, InputStream is) throws IOException { OutputStream os = response.getOutputStream(); try { byte buffer[] = new byte[DEFAULT_BUFFER_SIZE]; int bytes; while ((bytes = is.read(buffer)) >= 0) { os.write(buffer, 0, bytes); } } finally { os.close(); } }
[ "private", "void", "streamContent", "(", "HttpServletResponse", "response", ",", "InputStream", "is", ")", "throws", "IOException", "{", "OutputStream", "os", "=", "response", ".", "getOutputStream", "(", ")", ";", "try", "{", "byte", "buffer", "[", "]", "=", ...
Streams the input stream to the response.<p> @param response the response @param is the input stream @throws IOException in case writing to the response fails
[ "Streams", "the", "input", "stream", "to", "the", "response", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsStaticResourceHandler.java#L438-L450
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionAffinityManager.java
SessionAffinityManager.getInUseSessionID
@Override public String getInUseSessionID(ServletRequest req, SessionAffinityContext sac) { String id = null; if (sac.isRequestedSessionIDFromSSL() && req != null) { id = getActualSSLSessionId(req); } else { // We may have been dispatched and a previous app created a session. // If so, the Id will be in the response id, and we need to use it id = sac.getResponseSessionID(); if (id == null) { id = sac.getRequestedSessionID(); } } return id; }
java
@Override public String getInUseSessionID(ServletRequest req, SessionAffinityContext sac) { String id = null; if (sac.isRequestedSessionIDFromSSL() && req != null) { id = getActualSSLSessionId(req); } else { // We may have been dispatched and a previous app created a session. // If so, the Id will be in the response id, and we need to use it id = sac.getResponseSessionID(); if (id == null) { id = sac.getRequestedSessionID(); } } return id; }
[ "@", "Override", "public", "String", "getInUseSessionID", "(", "ServletRequest", "req", ",", "SessionAffinityContext", "sac", ")", "{", "String", "id", "=", "null", ";", "if", "(", "sac", ".", "isRequestedSessionIDFromSSL", "(", ")", "&&", "req", "!=", "null",...
/* Method to get the requestedId. If the id is from a SSL request, we need to get the actual SSL id as this id shouldn't be stored on the request or Affinity Context @see com.ibm.wsspi.session.ISessionAffinityManager#getRequestSessionID(javax .servlet.ServletRequest, com.ibm.wsspi.session.SessionAffinityContext)
[ "/", "*", "Method", "to", "get", "the", "requestedId", ".", "If", "the", "id", "is", "from", "a", "SSL", "request", "we", "need", "to", "get", "the", "actual", "SSL", "id", "as", "this", "id", "shouldn", "t", "be", "stored", "on", "the", "request", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionAffinityManager.java#L467-L481
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java
CommerceWarehousePersistenceImpl.findByGroupId
@Override public List<CommerceWarehouse> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceWarehouse> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceWarehouse", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce warehouses where groupId = &#63;. @param groupId the group ID @return the matching commerce warehouses
[ "Returns", "all", "the", "commerce", "warehouses", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java#L124-L127
baratine/baratine
framework/src/main/java/com/caucho/v5/loader/CompilingLoader.java
CompilingLoader.compileBatch
void compileBatch(String []files, boolean isMake) throws ClassNotFoundException { try { JavaCompilerUtil compiler = JavaCompilerUtil.create(getClassLoader()); compiler.setClassDir(_classDir); compiler.setSourceDir(_sourceDir); if (_encoding != null) compiler.setEncoding(_encoding); compiler.setArgs(_args); compiler.setCompileParent(! isMake); compiler.setSourceExtension(_sourceExt); if (_compiler != null) compiler.setCompiler(_compiler); //LineMap lineMap = new LineMap(javaFile.getNativePath()); // The context path is obvious from the browser url //lineMap.add(name.replace('.', '/') + _sourceExt, 1, 1); compiler.compileBatch(files); } catch (Exception e) { getClassLoader().addDependency(AlwaysModified.create()); // Compile errors are wrapped in a special ClassNotFound class // so the server can give a nice error message throw new CompileClassNotFound(e); } }
java
void compileBatch(String []files, boolean isMake) throws ClassNotFoundException { try { JavaCompilerUtil compiler = JavaCompilerUtil.create(getClassLoader()); compiler.setClassDir(_classDir); compiler.setSourceDir(_sourceDir); if (_encoding != null) compiler.setEncoding(_encoding); compiler.setArgs(_args); compiler.setCompileParent(! isMake); compiler.setSourceExtension(_sourceExt); if (_compiler != null) compiler.setCompiler(_compiler); //LineMap lineMap = new LineMap(javaFile.getNativePath()); // The context path is obvious from the browser url //lineMap.add(name.replace('.', '/') + _sourceExt, 1, 1); compiler.compileBatch(files); } catch (Exception e) { getClassLoader().addDependency(AlwaysModified.create()); // Compile errors are wrapped in a special ClassNotFound class // so the server can give a nice error message throw new CompileClassNotFound(e); } }
[ "void", "compileBatch", "(", "String", "[", "]", "files", ",", "boolean", "isMake", ")", "throws", "ClassNotFoundException", "{", "try", "{", "JavaCompilerUtil", "compiler", "=", "JavaCompilerUtil", ".", "create", "(", "getClassLoader", "(", ")", ")", ";", "co...
Compile the Java source. Compile errors are encapsulated in a ClassNotFound wrapper.
[ "Compile", "the", "Java", "source", ".", "Compile", "errors", "are", "encapsulated", "in", "a", "ClassNotFound", "wrapper", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/loader/CompilingLoader.java#L681-L708
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_instance_instanceId_interface_POST
public OvhInterface project_serviceName_instance_instanceId_interface_POST(String serviceName, String instanceId, String ip, String networkId) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/interface"; StringBuilder sb = path(qPath, serviceName, instanceId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); addBody(o, "networkId", networkId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhInterface.class); }
java
public OvhInterface project_serviceName_instance_instanceId_interface_POST(String serviceName, String instanceId, String ip, String networkId) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/interface"; StringBuilder sb = path(qPath, serviceName, instanceId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); addBody(o, "networkId", networkId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhInterface.class); }
[ "public", "OvhInterface", "project_serviceName_instance_instanceId_interface_POST", "(", "String", "serviceName", ",", "String", "instanceId", ",", "String", "ip", ",", "String", "networkId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{se...
Create interface on an instance and attached it to a network REST: POST /cloud/project/{serviceName}/instance/{instanceId}/interface @param instanceId [required] Instance id @param ip [required] Static ip (Can only be defined for private networks) @param networkId [required] Network id @param serviceName [required] Service name
[ "Create", "interface", "on", "an", "instance", "and", "attached", "it", "to", "a", "network" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1941-L1949
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/DBService.java
DBService.getAllColumns
public Iterable<DColumn> getAllColumns(String storeName, String rowKey) { return getColumnSlice(storeName, rowKey, null, null); }
java
public Iterable<DColumn> getAllColumns(String storeName, String rowKey) { return getColumnSlice(storeName, rowKey, null, null); }
[ "public", "Iterable", "<", "DColumn", ">", "getAllColumns", "(", "String", "storeName", ",", "String", "rowKey", ")", "{", "return", "getColumnSlice", "(", "storeName", ",", "rowKey", ",", "null", ",", "null", ")", ";", "}" ]
Get all columns for the row with the given key in the given store. Columns are returned as an Iterator of {@link DColumn}s. If no row is found with the given key, the iterator's hasNext() will be false. @param storeName Name of store to query. @param rowKey Key of row to fetch. @return Iterator of {@link DColumn}s. If there is no such row, hasNext() will be false.
[ "Get", "all", "columns", "for", "the", "row", "with", "the", "given", "key", "in", "the", "given", "store", ".", "Columns", "are", "returned", "as", "an", "Iterator", "of", "{", "@link", "DColumn", "}", "s", ".", "If", "no", "row", "is", "found", "wi...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBService.java#L241-L243
ontop/ontop
binding/owlapi/src/main/java/it/unibz/inf/ontop/owlapi/impl/QuestOWL.java
QuestOWL.extractVersion
private static Version extractVersion() { VersionInfo versionInfo = VersionInfo.getVersionInfo(); String versionString = versionInfo.getVersion(); String[] splits = versionString.split("\\."); int major = 0; int minor = 0; int patch = 0; int build = 0; try { major = Integer.parseInt(splits[0]); minor = Integer.parseInt(splits[1]); patch = Integer.parseInt(splits[2]); build = Integer.parseInt(splits[3]); } catch (Exception ignored) { } return new Version(major, minor, patch, build); }
java
private static Version extractVersion() { VersionInfo versionInfo = VersionInfo.getVersionInfo(); String versionString = versionInfo.getVersion(); String[] splits = versionString.split("\\."); int major = 0; int minor = 0; int patch = 0; int build = 0; try { major = Integer.parseInt(splits[0]); minor = Integer.parseInt(splits[1]); patch = Integer.parseInt(splits[2]); build = Integer.parseInt(splits[3]); } catch (Exception ignored) { } return new Version(major, minor, patch, build); }
[ "private", "static", "Version", "extractVersion", "(", ")", "{", "VersionInfo", "versionInfo", "=", "VersionInfo", ".", "getVersionInfo", "(", ")", ";", "String", "versionString", "=", "versionInfo", ".", "getVersion", "(", ")", ";", "String", "[", "]", "split...
extract version from {@link it.unibz.inf.ontop.utils.VersionInfo}, which is from the file {@code version.properties}
[ "extract", "version", "from", "{" ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/binding/owlapi/src/main/java/it/unibz/inf/ontop/owlapi/impl/QuestOWL.java#L158-L175
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java
AbstractProfileProfileAligner.setTarget
public void setTarget(Profile<S, C> target) { this.target = target; targetFuture = null; reset(); }
java
public void setTarget(Profile<S, C> target) { this.target = target; targetFuture = null; reset(); }
[ "public", "void", "setTarget", "(", "Profile", "<", "S", ",", "C", ">", "target", ")", "{", "this", ".", "target", "=", "target", ";", "targetFuture", "=", "null", ";", "reset", "(", ")", ";", "}" ]
Sets the target {@link Profile}. @param target the second {@link Profile} of the pair to align
[ "Sets", "the", "target", "{", "@link", "Profile", "}", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java#L154-L158
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/URLConnectionFactory.java
URLConnectionFactory.createHttpURLConnection
public HttpURLConnection createHttpURLConnection(URL url, boolean proxy) throws URLConnectionFailureException { if (proxy) { return createHttpURLConnection(url); } HttpURLConnection conn = null; try { conn = (HttpURLConnection) url.openConnection(); final int timeout = settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); conn.setConnectTimeout(timeout); conn.setInstanceFollowRedirects(true); } catch (IOException ioe) { throw new URLConnectionFailureException("Error getting connection.", ioe); } configureTLS(url, conn); return conn; }
java
public HttpURLConnection createHttpURLConnection(URL url, boolean proxy) throws URLConnectionFailureException { if (proxy) { return createHttpURLConnection(url); } HttpURLConnection conn = null; try { conn = (HttpURLConnection) url.openConnection(); final int timeout = settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); conn.setConnectTimeout(timeout); conn.setInstanceFollowRedirects(true); } catch (IOException ioe) { throw new URLConnectionFailureException("Error getting connection.", ioe); } configureTLS(url, conn); return conn; }
[ "public", "HttpURLConnection", "createHttpURLConnection", "(", "URL", "url", ",", "boolean", "proxy", ")", "throws", "URLConnectionFailureException", "{", "if", "(", "proxy", ")", "{", "return", "createHttpURLConnection", "(", "url", ")", ";", "}", "HttpURLConnectio...
Utility method to create an HttpURLConnection. The use of a proxy here is optional as there may be cases where a proxy is configured but we don't want to use it (for example, if there's an internal repository configured) @param url the URL to connect to @param proxy whether to use the proxy (if configured) @return a newly constructed HttpURLConnection @throws org.owasp.dependencycheck.utils.URLConnectionFailureException thrown if there is an exception
[ "Utility", "method", "to", "create", "an", "HttpURLConnection", ".", "The", "use", "of", "a", "proxy", "here", "is", "optional", "as", "there", "may", "be", "cases", "where", "a", "proxy", "is", "configured", "but", "we", "don", "t", "want", "to", "use",...
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/URLConnectionFactory.java#L188-L203
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.createOrUpdateAsync
public Observable<EnvironmentInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, EnvironmentInner environment) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).map(new Func1<ServiceResponse<EnvironmentInner>, EnvironmentInner>() { @Override public EnvironmentInner call(ServiceResponse<EnvironmentInner> response) { return response.body(); } }); }
java
public Observable<EnvironmentInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, EnvironmentInner environment) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).map(new Func1<ServiceResponse<EnvironmentInner>, EnvironmentInner>() { @Override public EnvironmentInner call(ServiceResponse<EnvironmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EnvironmentInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ",", "EnvironmentInner", ...
Create or replace an existing Environment. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param environment Represents an environment instance @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EnvironmentInner object
[ "Create", "or", "replace", "an", "existing", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L680-L687
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/WriteChannelConfiguration.java
WriteChannelConfiguration.of
public static WriteChannelConfiguration of(TableId destinationTable, FormatOptions format) { return newBuilder(destinationTable).setFormatOptions(format).build(); }
java
public static WriteChannelConfiguration of(TableId destinationTable, FormatOptions format) { return newBuilder(destinationTable).setFormatOptions(format).build(); }
[ "public", "static", "WriteChannelConfiguration", "of", "(", "TableId", "destinationTable", ",", "FormatOptions", "format", ")", "{", "return", "newBuilder", "(", "destinationTable", ")", ".", "setFormatOptions", "(", "format", ")", ".", "build", "(", ")", ";", "...
Returns a BigQuery Load Configuration for the given destination table and format.
[ "Returns", "a", "BigQuery", "Load", "Configuration", "for", "the", "given", "destination", "table", "and", "format", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/WriteChannelConfiguration.java#L499-L501
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.addYears
public static <T extends java.util.Date> T addYears(final T date, final int amount) { return roll(date, amount, CalendarUnit.YEAR); }
java
public static <T extends java.util.Date> T addYears(final T date, final int amount) { return roll(date, amount, CalendarUnit.YEAR); }
[ "public", "static", "<", "T", "extends", "java", ".", "util", ".", "Date", ">", "T", "addYears", "(", "final", "T", "date", ",", "final", "int", "amount", ")", "{", "return", "roll", "(", "date", ",", "amount", ",", "CalendarUnit", ".", "YEAR", ")", ...
Adds a number of years to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the date is null
[ "Adds", "a", "number", "of", "years", "to", "a", "date", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L951-L953
Stratio/deep-spark
deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java
Cells.getString
public String getString(String nameSpace, String cellName) { return getValue(nameSpace, cellName, String.class); }
java
public String getString(String nameSpace, String cellName) { return getValue(nameSpace, cellName, String.class); }
[ "public", "String", "getString", "(", "String", "nameSpace", ",", "String", "cellName", ")", "{", "return", "getValue", "(", "nameSpace", ",", "cellName", ",", "String", ".", "class", ")", ";", "}" ]
Returns the {@code String} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or null if this Cells object contains no cell whose name is cellName. @param nameSpace the name of the owning table @param cellName the name of the Cell we want to retrieve from this Cells object. @return the {@code String} value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null if this Cells object contains no cell whose name is cellName
[ "Returns", "the", "{", "@code", "String", "}", "value", "of", "the", "{", "@link", "Cell", "}", "(", "associated", "to", "{", "@code", "table", "}", ")", "whose", "name", "iscellName", "or", "null", "if", "this", "Cells", "object", "contains", "no", "c...
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L739-L741
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/recognition/ExampleClassifySceneKnn.java
ExampleClassifySceneKnn.learnAndSave
public void learnAndSave() { System.out.println("======== Learning Classifier"); // Either load pre-computed words or compute the words from the training images AssignCluster<double[]> assignment; if( new File(CLUSTER_FILE_NAME).exists() ) { assignment = UtilIO.load(CLUSTER_FILE_NAME); } else { System.out.println(" Computing clusters"); assignment = computeClusters(); } // Use these clusters to assign features to words FeatureToWordHistogram_F64 featuresToHistogram = new FeatureToWordHistogram_F64(assignment,HISTOGRAM_HARD); // Storage for the work histogram in each image in the training set and their label List<HistogramScene> memory; if( !new File(HISTOGRAM_FILE_NAME).exists() ) { System.out.println(" computing histograms"); memory = computeHistograms(featuresToHistogram); UtilIO.save(memory,HISTOGRAM_FILE_NAME); } }
java
public void learnAndSave() { System.out.println("======== Learning Classifier"); // Either load pre-computed words or compute the words from the training images AssignCluster<double[]> assignment; if( new File(CLUSTER_FILE_NAME).exists() ) { assignment = UtilIO.load(CLUSTER_FILE_NAME); } else { System.out.println(" Computing clusters"); assignment = computeClusters(); } // Use these clusters to assign features to words FeatureToWordHistogram_F64 featuresToHistogram = new FeatureToWordHistogram_F64(assignment,HISTOGRAM_HARD); // Storage for the work histogram in each image in the training set and their label List<HistogramScene> memory; if( !new File(HISTOGRAM_FILE_NAME).exists() ) { System.out.println(" computing histograms"); memory = computeHistograms(featuresToHistogram); UtilIO.save(memory,HISTOGRAM_FILE_NAME); } }
[ "public", "void", "learnAndSave", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"======== Learning Classifier\"", ")", ";", "// Either load pre-computed words or compute the words from the training images", "AssignCluster", "<", "double", "[", "]", ">", "ass...
Process all the data in the training data set to learn the classifications. See code for details.
[ "Process", "all", "the", "data", "in", "the", "training", "data", "set", "to", "learn", "the", "classifications", ".", "See", "code", "for", "details", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/recognition/ExampleClassifySceneKnn.java#L107-L130
netty/netty
common/src/main/java/io/netty/util/internal/PlatformDependent.java
PlatformDependent.hashCodeAsciiSanitizeInt
private static int hashCodeAsciiSanitizeInt(CharSequence value, int offset) { if (BIG_ENDIAN_NATIVE_ORDER) { // mimic a unsafe.getInt call on a big endian machine return (value.charAt(offset + 3) & 0x1f) | (value.charAt(offset + 2) & 0x1f) << 8 | (value.charAt(offset + 1) & 0x1f) << 16 | (value.charAt(offset) & 0x1f) << 24; } return (value.charAt(offset + 3) & 0x1f) << 24 | (value.charAt(offset + 2) & 0x1f) << 16 | (value.charAt(offset + 1) & 0x1f) << 8 | (value.charAt(offset) & 0x1f); }
java
private static int hashCodeAsciiSanitizeInt(CharSequence value, int offset) { if (BIG_ENDIAN_NATIVE_ORDER) { // mimic a unsafe.getInt call on a big endian machine return (value.charAt(offset + 3) & 0x1f) | (value.charAt(offset + 2) & 0x1f) << 8 | (value.charAt(offset + 1) & 0x1f) << 16 | (value.charAt(offset) & 0x1f) << 24; } return (value.charAt(offset + 3) & 0x1f) << 24 | (value.charAt(offset + 2) & 0x1f) << 16 | (value.charAt(offset + 1) & 0x1f) << 8 | (value.charAt(offset) & 0x1f); }
[ "private", "static", "int", "hashCodeAsciiSanitizeInt", "(", "CharSequence", "value", ",", "int", "offset", ")", "{", "if", "(", "BIG_ENDIAN_NATIVE_ORDER", ")", "{", "// mimic a unsafe.getInt call on a big endian machine", "return", "(", "value", ".", "charAt", "(", "...
Identical to {@link PlatformDependent0#hashCodeAsciiSanitize(int)} but for {@link CharSequence}.
[ "Identical", "to", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L521-L533
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java
MapFileHelper.copyMapFiles
static public File copyMapFiles(File mapFile, boolean isTemporary) { System.out.println("Current directory: "+System.getProperty("user.dir")); // Look for the basemap file. // If it exists, copy it into the Minecraft saves folder, // and attempt to load it. File savesDir = FMLClientHandler.instance().getSavesDir(); File dst = null; if (mapFile != null && mapFile.exists()) { dst = new File(savesDir, getNewSaveFileLocation(isTemporary)); try { FileUtils.copyDirectory(mapFile, dst); } catch (IOException e) { System.out.println("Failed to load file: " + mapFile.getPath()); return null; } } return dst; }
java
static public File copyMapFiles(File mapFile, boolean isTemporary) { System.out.println("Current directory: "+System.getProperty("user.dir")); // Look for the basemap file. // If it exists, copy it into the Minecraft saves folder, // and attempt to load it. File savesDir = FMLClientHandler.instance().getSavesDir(); File dst = null; if (mapFile != null && mapFile.exists()) { dst = new File(savesDir, getNewSaveFileLocation(isTemporary)); try { FileUtils.copyDirectory(mapFile, dst); } catch (IOException e) { System.out.println("Failed to load file: " + mapFile.getPath()); return null; } } return dst; }
[ "static", "public", "File", "copyMapFiles", "(", "File", "mapFile", ",", "boolean", "isTemporary", ")", "{", "System", ".", "out", ".", "println", "(", "\"Current directory: \"", "+", "System", ".", "getProperty", "(", "\"user.dir\"", ")", ")", ";", "// Look f...
Attempt to copy the specified file into the Minecraft saves folder. @param mapFile full path to the map file required @param overwriteOldFiles if false, will rename copy to avoid overwriting any other saved games @return if successful, a File object representing the new copy, which can be fed to Minecraft to load - otherwise null.
[ "Attempt", "to", "copy", "the", "specified", "file", "into", "the", "Minecraft", "saves", "folder", "." ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java#L48-L72
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java
AbstractProfileIndexWriter.buildProfileIndexFile
protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException { String windowOverview = configuration.getText(title); Content body = getBody(includeScript, getWindowTitle(windowOverview)); addNavigationBarHeader(body); addOverviewHeader(body); addIndex(body); addOverview(body); addNavigationBarFooter(body); printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), includeScript, body); }
java
protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException { String windowOverview = configuration.getText(title); Content body = getBody(includeScript, getWindowTitle(windowOverview)); addNavigationBarHeader(body); addOverviewHeader(body); addIndex(body); addOverview(body); addNavigationBarFooter(body); printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), includeScript, body); }
[ "protected", "void", "buildProfileIndexFile", "(", "String", "title", ",", "boolean", "includeScript", ")", "throws", "IOException", "{", "String", "windowOverview", "=", "configuration", ".", "getText", "(", "title", ")", ";", "Content", "body", "=", "getBody", ...
Generate and prints the contents in the profile index file. Call appropriate methods from the sub-class in order to generate Frame or Non Frame format. @param title the title of the window. @param includeScript boolean set true if windowtitle script is to be included
[ "Generate", "and", "prints", "the", "contents", "in", "the", "profile", "index", "file", ".", "Call", "appropriate", "methods", "from", "the", "sub", "-", "class", "in", "order", "to", "generate", "Frame", "or", "Non", "Frame", "format", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java#L118-L128
hellosign/hellosign-java-sdk
src/main/java/com/hellosign/sdk/resource/AbstractRequest.java
AbstractRequest.addDocument
public void addDocument(Document doc, int order) throws HelloSignException { if (doc == null) { throw new HelloSignException("Document cannot be null"); } try { documents.add(order, doc); } catch (Exception ex) { throw new HelloSignException(ex); } }
java
public void addDocument(Document doc, int order) throws HelloSignException { if (doc == null) { throw new HelloSignException("Document cannot be null"); } try { documents.add(order, doc); } catch (Exception ex) { throw new HelloSignException(ex); } }
[ "public", "void", "addDocument", "(", "Document", "doc", ",", "int", "order", ")", "throws", "HelloSignException", "{", "if", "(", "doc", "==", "null", ")", "{", "throw", "new", "HelloSignException", "(", "\"Document cannot be null\"", ")", ";", "}", "try", ...
Adds a Document to the signature request at the specific order. @param doc Document @param order int @throws HelloSignException thrown if null is provided or there is a problem attaching the Document.
[ "Adds", "a", "Document", "to", "the", "signature", "request", "at", "the", "specific", "order", "." ]
train
https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/resource/AbstractRequest.java#L287-L296
GoSimpleLLC/nbvcxz
src/main/java/me/gosimple/nbvcxz/Nbvcxz.java
Nbvcxz.isRandom
private boolean isRandom(final String password, final List<Match> matches) { int matched_length = 0; int max_matched_length = 0; for (Match match : matches) { if (!(match instanceof BruteForceMatch)) { matched_length += match.getLength(); if (match.getLength() > max_matched_length) { max_matched_length = match.getLength(); } } } if (matched_length < (password.length() * 0.5)) { return true; } else if (matched_length < (password.length() * 0.8) && password.length() * 0.25 > max_matched_length) { return true; } else { return false; } }
java
private boolean isRandom(final String password, final List<Match> matches) { int matched_length = 0; int max_matched_length = 0; for (Match match : matches) { if (!(match instanceof BruteForceMatch)) { matched_length += match.getLength(); if (match.getLength() > max_matched_length) { max_matched_length = match.getLength(); } } } if (matched_length < (password.length() * 0.5)) { return true; } else if (matched_length < (password.length() * 0.8) && password.length() * 0.25 > max_matched_length) { return true; } else { return false; } }
[ "private", "boolean", "isRandom", "(", "final", "String", "password", ",", "final", "List", "<", "Match", ">", "matches", ")", "{", "int", "matched_length", "=", "0", ";", "int", "max_matched_length", "=", "0", ";", "for", "(", "Match", "match", ":", "ma...
Method to determine if the password should be considered random, and to just use brute force matches. <p> We determine a password to be random if the matches cover less than 50% of the password, or if they cover less than 80% but the max length for a match is no more than 25% of the total length of the password. @param password the password @param matches the final list of matches @return true if determined to be random
[ "Method", "to", "determine", "if", "the", "password", "should", "be", "considered", "random", "and", "to", "just", "use", "brute", "force", "matches", ".", "<p", ">", "We", "determine", "a", "password", "to", "be", "random", "if", "the", "matches", "cover"...
train
https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/Nbvcxz.java#L495-L523
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java
ProvFactory.newEntity
public Entity newEntity(QualifiedName id, String label) { Entity res = newEntity(id); if (label != null) res.getLabel().add(newInternationalizedString(label)); return res; }
java
public Entity newEntity(QualifiedName id, String label) { Entity res = newEntity(id); if (label != null) res.getLabel().add(newInternationalizedString(label)); return res; }
[ "public", "Entity", "newEntity", "(", "QualifiedName", "id", ",", "String", "label", ")", "{", "Entity", "res", "=", "newEntity", "(", "id", ")", ";", "if", "(", "label", "!=", "null", ")", "res", ".", "getLabel", "(", ")", ".", "add", "(", "newInter...
Creates a new {@link Entity} with provided identifier and label @param id a {@link QualifiedName} for the entity @param label a String for the label property (see {@link HasLabel#getLabel()} @return an object of type {@link Entity}
[ "Creates", "a", "new", "{" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L649-L654
p6spy/p6spy
src/main/java/com/p6spy/engine/common/ConnectionInformation.java
ConnectionInformation.fromDataSource
public static ConnectionInformation fromDataSource(CommonDataSource dataSource, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.dataSource = dataSource; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
java
public static ConnectionInformation fromDataSource(CommonDataSource dataSource, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.dataSource = dataSource; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
[ "public", "static", "ConnectionInformation", "fromDataSource", "(", "CommonDataSource", "dataSource", ",", "Connection", "connection", ",", "long", "timeToGetConnectionNs", ")", "{", "final", "ConnectionInformation", "connectionInformation", "=", "new", "ConnectionInformation...
Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a {@link CommonDataSource} @param dataSource the {@link javax.sql.CommonDataSource} which created the {@link #connection} @param connection the {@link #connection} created by the {@link #dataSource} @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds @return a new {@link ConnectionInformation} instance
[ "Creates", "a", "new", "{", "@link", "ConnectionInformation", "}", "instance", "for", "a", "{", "@link", "Connection", "}", "which", "has", "been", "obtained", "via", "a", "{", "@link", "CommonDataSource", "}" ]
train
https://github.com/p6spy/p6spy/blob/c3c0fecd6e26156eecf90a90901c3c1c8a7dbdf2/src/main/java/com/p6spy/engine/common/ConnectionInformation.java#L72-L78
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/AminoAcidParser.java
AminoAcidParser.getAminoAcidList
public static List<String> getAminoAcidList(String peptideSequence, String delimiter) throws MonomerException, NotationException, MonomerLoadingException, ChemistryException { if (null == peptideSequence) { throw new NotationException("Peptide Sequence must be specified"); } if (null == delimiter || delimiter.length() == 0) { return getAminoAcidList(peptideSequence); } else { if (!isValidDelimiter(delimiter)) throw new NotationException("Invalid sequence delimiter [" + delimiter + "], only the following are supported: [" + getValidDelimiters() + "]"); } List<String> blocks = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(peptideSequence, delimiter); while (st.hasMoreTokens()) { blocks.add(st.nextToken()); } List<String> l = new ArrayList<String>(); for (String block : blocks) { List<String> tmpL = getAminoAcidList(block); l.addAll(tmpL); } return l; }
java
public static List<String> getAminoAcidList(String peptideSequence, String delimiter) throws MonomerException, NotationException, MonomerLoadingException, ChemistryException { if (null == peptideSequence) { throw new NotationException("Peptide Sequence must be specified"); } if (null == delimiter || delimiter.length() == 0) { return getAminoAcidList(peptideSequence); } else { if (!isValidDelimiter(delimiter)) throw new NotationException("Invalid sequence delimiter [" + delimiter + "], only the following are supported: [" + getValidDelimiters() + "]"); } List<String> blocks = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(peptideSequence, delimiter); while (st.hasMoreTokens()) { blocks.add(st.nextToken()); } List<String> l = new ArrayList<String>(); for (String block : blocks) { List<String> tmpL = getAminoAcidList(block); l.addAll(tmpL); } return l; }
[ "public", "static", "List", "<", "String", ">", "getAminoAcidList", "(", "String", "peptideSequence", ",", "String", "delimiter", ")", "throws", "MonomerException", ",", "NotationException", ",", "MonomerLoadingException", ",", "ChemistryException", "{", "if", "(", ...
This method converts peptide sequence into a List of amino acid with optional delimiter @param peptideSequence input sequence @param delimiter optional delimeter in the input sequence @return list of amino acid @throws MonomerException if monomer is not valid @throws NotationException if notation is not valid @throws MonomerLoadingException if monomer could not be read from the source @throws ChemistryException if chemistry could not be initialized
[ "This", "method", "converts", "peptide", "sequence", "into", "a", "List", "of", "amino", "acid", "with", "optional", "delimiter" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/AminoAcidParser.java#L111-L140
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateBetween.java
DateBetween.create
public static DateBetween create(Date begin, Date end, boolean isAbs) { return new DateBetween(begin, end, isAbs); }
java
public static DateBetween create(Date begin, Date end, boolean isAbs) { return new DateBetween(begin, end, isAbs); }
[ "public", "static", "DateBetween", "create", "(", "Date", "begin", ",", "Date", "end", ",", "boolean", "isAbs", ")", "{", "return", "new", "DateBetween", "(", "begin", ",", "end", ",", "isAbs", ")", ";", "}" ]
创建<br> 在前的日期做为起始时间,在后的做为结束时间,间隔只保留绝对值正数 @param begin 起始时间 @param end 结束时间 @param isAbs 日期间隔是否只保留绝对值正数 @return {@link DateBetween} @since 3.2.3
[ "创建<br", ">", "在前的日期做为起始时间,在后的做为结束时间,间隔只保留绝对值正数" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateBetween.java#L44-L46
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java
ToHTMLStream.processAttribute
protected void processAttribute( java.io.Writer writer, String name, String value, ElemDesc elemDesc) throws IOException { writer.write(' '); if ( ((value.length() == 0) || value.equalsIgnoreCase(name)) && elemDesc != null && elemDesc.isAttrFlagSet(name, ElemDesc.ATTREMPTY)) { writer.write(name); } else { // %REVIEW% %OPT% // Two calls to single-char write may NOT // be more efficient than one to string-write... writer.write(name); writer.write("=\""); if ( elemDesc != null && elemDesc.isAttrFlagSet(name, ElemDesc.ATTRURL)) writeAttrURI(writer, value, m_specialEscapeURLs); else writeAttrString(writer, value, this.getEncoding()); writer.write('"'); } }
java
protected void processAttribute( java.io.Writer writer, String name, String value, ElemDesc elemDesc) throws IOException { writer.write(' '); if ( ((value.length() == 0) || value.equalsIgnoreCase(name)) && elemDesc != null && elemDesc.isAttrFlagSet(name, ElemDesc.ATTREMPTY)) { writer.write(name); } else { // %REVIEW% %OPT% // Two calls to single-char write may NOT // be more efficient than one to string-write... writer.write(name); writer.write("=\""); if ( elemDesc != null && elemDesc.isAttrFlagSet(name, ElemDesc.ATTRURL)) writeAttrURI(writer, value, m_specialEscapeURLs); else writeAttrString(writer, value, this.getEncoding()); writer.write('"'); } }
[ "protected", "void", "processAttribute", "(", "java", ".", "io", ".", "Writer", "writer", ",", "String", "name", ",", "String", "value", ",", "ElemDesc", "elemDesc", ")", "throws", "IOException", "{", "writer", ".", "write", "(", "'", "'", ")", ";", "if"...
Process an attribute. @param writer The writer to write the processed output to. @param name The name of the attribute. @param value The value of the attribute. @param elemDesc The description of the HTML element that has this attribute. @throws org.xml.sax.SAXException
[ "Process", "an", "attribute", ".", "@param", "writer", "The", "writer", "to", "write", "the", "processed", "output", "to", ".", "@param", "name", "The", "name", "of", "the", "attribute", ".", "@param", "value", "The", "value", "of", "the", "attribute", "."...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java#L1059-L1089
Crab2died/Excel4J
src/main/java/com/github/crab2died/utils/Utils.java
Utils.matchClassField
private static Field matchClassField(Class clazz, String fieldName) { List<Field> fields = new ArrayList<>(); for (; clazz != Object.class; clazz = clazz.getSuperclass()) { fields.addAll(Arrays.asList(clazz.getDeclaredFields())); } for (Field field : fields) { if (fieldName.equals(field.getName())) { return field; } } throw new IllegalArgumentException("[" + clazz.getName() + "] can`t found field with [" + fieldName + "]"); }
java
private static Field matchClassField(Class clazz, String fieldName) { List<Field> fields = new ArrayList<>(); for (; clazz != Object.class; clazz = clazz.getSuperclass()) { fields.addAll(Arrays.asList(clazz.getDeclaredFields())); } for (Field field : fields) { if (fieldName.equals(field.getName())) { return field; } } throw new IllegalArgumentException("[" + clazz.getName() + "] can`t found field with [" + fieldName + "]"); }
[ "private", "static", "Field", "matchClassField", "(", "Class", "clazz", ",", "String", "fieldName", ")", "{", "List", "<", "Field", ">", "fields", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", ";", "clazz", "!=", "Object", ".", "class", ";"...
<p>根据对象的属性名{@code fieldName}获取某个java的属性{@link java.lang.reflect.Field}</p> @param clazz java对象的class属性 @param fieldName 属性名 @return {@link java.lang.reflect.Field} java对象的属性 @author Crab2Died
[ "<p", ">", "根据对象的属性名", "{", "@code", "fieldName", "}", "获取某个java的属性", "{", "@link", "java", ".", "lang", ".", "reflect", ".", "Field", "}", "<", "/", "p", ">" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/utils/Utils.java#L259-L271
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_sharedAccount_sharedEmailAddress_PUT
public void organizationName_service_exchangeService_sharedAccount_sharedEmailAddress_PUT(String organizationName, String exchangeService, String sharedEmailAddress, OvhSharedAccount body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/sharedAccount/{sharedEmailAddress}"; StringBuilder sb = path(qPath, organizationName, exchangeService, sharedEmailAddress); exec(qPath, "PUT", sb.toString(), body); }
java
public void organizationName_service_exchangeService_sharedAccount_sharedEmailAddress_PUT(String organizationName, String exchangeService, String sharedEmailAddress, OvhSharedAccount body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/sharedAccount/{sharedEmailAddress}"; StringBuilder sb = path(qPath, organizationName, exchangeService, sharedEmailAddress); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "organizationName_service_exchangeService_sharedAccount_sharedEmailAddress_PUT", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "sharedEmailAddress", ",", "OvhSharedAccount", "body", ")", "throws", "IOException", "{", "Stri...
Alter this object properties REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/sharedAccount/{sharedEmailAddress} @param body [required] New object properties @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param sharedEmailAddress [required] Default email for this shared mailbox
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L883-L887
RestComm/jss7
map/map-impl/src/main/java/org/restcomm/protocols/ss7/map/MAPDialogImpl.java
MAPDialogImpl.getMessageUserDataLengthOnSend
public int getMessageUserDataLengthOnSend() throws MAPException { try { switch (this.tcapDialog.getState()) { case Idle: ApplicationContextName acn = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory() .createApplicationContextName(this.appCntx.getOID()); TCBeginRequest tb = this.mapProviderImpl.encodeTCBegin(this.getTcapDialog(), acn, destReference, origReference, this.extContainer, this.eriStyle, this.eriMsisdn, this.eriVlrNo); return tcapDialog.getDataLength(tb); case Active: // Its Active send TC-CONTINUE TCContinueRequest tc = this.mapProviderImpl.encodeTCContinue(this.getTcapDialog(), false, null, null); return tcapDialog.getDataLength(tc); case InitialReceived: // Its first Reply to TC-Begin ApplicationContextName acn1 = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory() .createApplicationContextName(this.appCntx.getOID()); tc = this.mapProviderImpl.encodeTCContinue(this.getTcapDialog(), true, acn1, this.extContainer); return tcapDialog.getDataLength(tc); } } catch (TCAPSendException e) { throw new MAPException("TCAPSendException when getMessageUserDataLengthOnSend", e); } throw new MAPException("Bad TCAP Dialog state: " + this.tcapDialog.getState()); }
java
public int getMessageUserDataLengthOnSend() throws MAPException { try { switch (this.tcapDialog.getState()) { case Idle: ApplicationContextName acn = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory() .createApplicationContextName(this.appCntx.getOID()); TCBeginRequest tb = this.mapProviderImpl.encodeTCBegin(this.getTcapDialog(), acn, destReference, origReference, this.extContainer, this.eriStyle, this.eriMsisdn, this.eriVlrNo); return tcapDialog.getDataLength(tb); case Active: // Its Active send TC-CONTINUE TCContinueRequest tc = this.mapProviderImpl.encodeTCContinue(this.getTcapDialog(), false, null, null); return tcapDialog.getDataLength(tc); case InitialReceived: // Its first Reply to TC-Begin ApplicationContextName acn1 = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory() .createApplicationContextName(this.appCntx.getOID()); tc = this.mapProviderImpl.encodeTCContinue(this.getTcapDialog(), true, acn1, this.extContainer); return tcapDialog.getDataLength(tc); } } catch (TCAPSendException e) { throw new MAPException("TCAPSendException when getMessageUserDataLengthOnSend", e); } throw new MAPException("Bad TCAP Dialog state: " + this.tcapDialog.getState()); }
[ "public", "int", "getMessageUserDataLengthOnSend", "(", ")", "throws", "MAPException", "{", "try", "{", "switch", "(", "this", ".", "tcapDialog", ".", "getState", "(", ")", ")", "{", "case", "Idle", ":", "ApplicationContextName", "acn", "=", "this", ".", "ma...
Return the MAP message length (in bytes) that will be after encoding if TC-BEGIN or TC-CONTINUE cases This value must not exceed getMaxUserDataLength() value @return
[ "Return", "the", "MAP", "message", "length", "(", "in", "bytes", ")", "that", "will", "be", "after", "encoding", "if", "TC", "-", "BEGIN", "or", "TC", "-", "CONTINUE", "cases", "This", "value", "must", "not", "exceed", "getMaxUserDataLength", "()", "value"...
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/map/map-impl/src/main/java/org/restcomm/protocols/ss7/map/MAPDialogImpl.java#L608-L640
ops4j/org.ops4j.pax.web
pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java
Activator.trackHttpContexts
private void trackHttpContexts(final BundleContext bundleContext, ExtendedHttpServiceRuntime httpServiceRuntime) { final ServiceTracker<HttpContext, HttpContextElement> httpContextTracker = HttpContextTracker .createTracker(extenderContext, bundleContext, httpServiceRuntime); httpContextTracker.open(); trackers.add(0, httpContextTracker); final ServiceTracker<HttpContextMapping, HttpContextElement> httpContextMappingTracker = HttpContextMappingTracker .createTracker(extenderContext, bundleContext, httpServiceRuntime); httpContextMappingTracker.open(); trackers.add(0, httpContextMappingTracker); }
java
private void trackHttpContexts(final BundleContext bundleContext, ExtendedHttpServiceRuntime httpServiceRuntime) { final ServiceTracker<HttpContext, HttpContextElement> httpContextTracker = HttpContextTracker .createTracker(extenderContext, bundleContext, httpServiceRuntime); httpContextTracker.open(); trackers.add(0, httpContextTracker); final ServiceTracker<HttpContextMapping, HttpContextElement> httpContextMappingTracker = HttpContextMappingTracker .createTracker(extenderContext, bundleContext, httpServiceRuntime); httpContextMappingTracker.open(); trackers.add(0, httpContextMappingTracker); }
[ "private", "void", "trackHttpContexts", "(", "final", "BundleContext", "bundleContext", ",", "ExtendedHttpServiceRuntime", "httpServiceRuntime", ")", "{", "final", "ServiceTracker", "<", "HttpContext", ",", "HttpContextElement", ">", "httpContextTracker", "=", "HttpContextT...
Track http contexts. @param bundleContext the BundleContext associated with this bundle @param httpServiceRuntime
[ "Track", "http", "contexts", "." ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/Activator.java#L143-L155
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java
BlockDataHandler.setBlockData
static void setBlockData(int chunkX, int chunkZ, String identifier, ByteBuf data) { HandlerInfo<?> handlerInfo = instance.handlerInfos.get(identifier); if (handlerInfo == null) return; //MalisisCore.message("Received blockData (" + chunkX + "/" + chunkZ + ") for " + identifier); Chunk chunk = Utils.getClientWorld().getChunkFromChunkCoords(chunkX, chunkZ); ChunkData<?> chunkData = new ChunkData<>(handlerInfo).fromBytes(data); datas.get().put(handlerInfo.identifier, chunk, chunkData); }
java
static void setBlockData(int chunkX, int chunkZ, String identifier, ByteBuf data) { HandlerInfo<?> handlerInfo = instance.handlerInfos.get(identifier); if (handlerInfo == null) return; //MalisisCore.message("Received blockData (" + chunkX + "/" + chunkZ + ") for " + identifier); Chunk chunk = Utils.getClientWorld().getChunkFromChunkCoords(chunkX, chunkZ); ChunkData<?> chunkData = new ChunkData<>(handlerInfo).fromBytes(data); datas.get().put(handlerInfo.identifier, chunk, chunkData); }
[ "static", "void", "setBlockData", "(", "int", "chunkX", ",", "int", "chunkZ", ",", "String", "identifier", ",", "ByteBuf", "data", ")", "{", "HandlerInfo", "<", "?", ">", "handlerInfo", "=", "instance", ".", "handlerInfos", ".", "get", "(", "identifier", "...
Called on the client when receiving the data from the server, either because client started to watch the chunk or server manually sent the data. @param chunkX the chunk X @param chunkZ the chunk Z @param identifier the identifier @param data the data
[ "Called", "on", "the", "client", "when", "receiving", "the", "data", "from", "the", "server", "either", "because", "client", "started", "to", "watch", "the", "chunk", "or", "server", "manually", "sent", "the", "data", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java#L375-L385
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/resourceindex/cdxserver/EmbeddedCDXServerIndex.java
EmbeddedCDXServerIndex.createAuthToken
protected AuthToken createAuthToken(WaybackRequest wbRequest, String urlkey) { AuthToken waybackAuthToken = new APContextAuthToken( wbRequest.getAccessPoint()); waybackAuthToken.setAllCdxFieldsAllow(); boolean ignoreRobots = wbRequest.isCSSContext() || wbRequest.isIMGContext() || wbRequest.isJSContext(); if (ignoreRobots) { waybackAuthToken.setIgnoreRobots(true); } if (ignoreRobotPaths != null) { for (String path : ignoreRobotPaths) { if (urlkey.startsWith(path)) { waybackAuthToken.setIgnoreRobots(true); break; } } } return waybackAuthToken; }
java
protected AuthToken createAuthToken(WaybackRequest wbRequest, String urlkey) { AuthToken waybackAuthToken = new APContextAuthToken( wbRequest.getAccessPoint()); waybackAuthToken.setAllCdxFieldsAllow(); boolean ignoreRobots = wbRequest.isCSSContext() || wbRequest.isIMGContext() || wbRequest.isJSContext(); if (ignoreRobots) { waybackAuthToken.setIgnoreRobots(true); } if (ignoreRobotPaths != null) { for (String path : ignoreRobotPaths) { if (urlkey.startsWith(path)) { waybackAuthToken.setIgnoreRobots(true); break; } } } return waybackAuthToken; }
[ "protected", "AuthToken", "createAuthToken", "(", "WaybackRequest", "wbRequest", ",", "String", "urlkey", ")", "{", "AuthToken", "waybackAuthToken", "=", "new", "APContextAuthToken", "(", "wbRequest", ".", "getAccessPoint", "(", ")", ")", ";", "waybackAuthToken", "....
<ul> <li>robots.txt may be ignored for embedded resources (CSS, images, javascripts)</li> <li>robots.txt may be ignored if {@code urlkey} starts with any of {@code ignoreRobotPaths}</li> </ul> @param wbRequest @param urlkey @return {@link AuthToken} representing user's privileges on {@code urlkey}.
[ "<ul", ">", "<li", ">", "robots", ".", "txt", "may", "be", "ignored", "for", "embedded", "resources", "(", "CSS", "images", "javascripts", ")", "<", "/", "li", ">", "<li", ">", "robots", ".", "txt", "may", "be", "ignored", "if", "{" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourceindex/cdxserver/EmbeddedCDXServerIndex.java#L132-L154
intellimate/Izou
src/main/java/org/intellimate/izou/output/OutputManager.java
OutputManager.addOutputPlugin
public void addOutputPlugin(OutputPluginModel<?, ?> outputPlugin) throws IllegalIDException { if (!futureHashMap.containsKey(outputPlugin.getID())) { outputPlugins.add(outputPlugin); futureHashMap.put(outputPlugin.getID(), submit(outputPlugin)); } else { if (futureHashMap.get(outputPlugin.getID()).isDone()) { futureHashMap.remove(outputPlugin.getID()); futureHashMap.put(outputPlugin.getID(), submit(outputPlugin)); } } }
java
public void addOutputPlugin(OutputPluginModel<?, ?> outputPlugin) throws IllegalIDException { if (!futureHashMap.containsKey(outputPlugin.getID())) { outputPlugins.add(outputPlugin); futureHashMap.put(outputPlugin.getID(), submit(outputPlugin)); } else { if (futureHashMap.get(outputPlugin.getID()).isDone()) { futureHashMap.remove(outputPlugin.getID()); futureHashMap.put(outputPlugin.getID(), submit(outputPlugin)); } } }
[ "public", "void", "addOutputPlugin", "(", "OutputPluginModel", "<", "?", ",", "?", ">", "outputPlugin", ")", "throws", "IllegalIDException", "{", "if", "(", "!", "futureHashMap", ".", "containsKey", "(", "outputPlugin", ".", "getID", "(", ")", ")", ")", "{",...
adds outputPlugin to outputPluginList, starts a new thread for the outputPlugin, and stores the future object in a HashMap @param outputPlugin OutputPlugin to add @throws IllegalIDException not yet implemented
[ "adds", "outputPlugin", "to", "outputPluginList", "starts", "a", "new", "thread", "for", "the", "outputPlugin", "and", "stores", "the", "future", "object", "in", "a", "HashMap" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/output/OutputManager.java#L67-L77
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/Flickr.java
Flickr.getTagsInterface
@Override public TagsInterface getTagsInterface() { if (tagsInterface == null) { tagsInterface = new TagsInterface(apiKey, sharedSecret, transport); } return tagsInterface; }
java
@Override public TagsInterface getTagsInterface() { if (tagsInterface == null) { tagsInterface = new TagsInterface(apiKey, sharedSecret, transport); } return tagsInterface; }
[ "@", "Override", "public", "TagsInterface", "getTagsInterface", "(", ")", "{", "if", "(", "tagsInterface", "==", "null", ")", "{", "tagsInterface", "=", "new", "TagsInterface", "(", "apiKey", ",", "sharedSecret", ",", "transport", ")", ";", "}", "return", "t...
Get the TagsInterface for working with Flickr Tags. @return The TagsInterface
[ "Get", "the", "TagsInterface", "for", "working", "with", "Flickr", "Tags", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/Flickr.java#L583-L589
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/scriptio/ScriptWriterBase.java
ScriptWriterBase.openFile
protected void openFile() { try { FileAccess fa = isDump ? FileUtil.getDefaultInstance() : database.getFileAccess(); OutputStream fos = fa.openOutputStreamElement(outFile); outDescriptor = fa.getFileSync(fos); fileStreamOut = new BufferedOutputStream(fos, 2 << 12); } catch (IOException e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_Message_Pair, new Object[] { e.toString(), outFile }); } }
java
protected void openFile() { try { FileAccess fa = isDump ? FileUtil.getDefaultInstance() : database.getFileAccess(); OutputStream fos = fa.openOutputStreamElement(outFile); outDescriptor = fa.getFileSync(fos); fileStreamOut = new BufferedOutputStream(fos, 2 << 12); } catch (IOException e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_Message_Pair, new Object[] { e.toString(), outFile }); } }
[ "protected", "void", "openFile", "(", ")", "{", "try", "{", "FileAccess", "fa", "=", "isDump", "?", "FileUtil", ".", "getDefaultInstance", "(", ")", ":", "database", ".", "getFileAccess", "(", ")", ";", "OutputStream", "fos", "=", "fa", ".", "openOutputStr...
File is opened in append mode although in current usage the file never pre-exists
[ "File", "is", "opened", "in", "append", "mode", "although", "in", "current", "usage", "the", "file", "never", "pre", "-", "exists" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/scriptio/ScriptWriterBase.java#L253-L268
hankcs/HanLP
src/main/java/com/hankcs/hanlp/summary/BM25.java
BM25.sim
public double sim(List<String> sentence, int index) { double score = 0; for (String word : sentence) { if (!f[index].containsKey(word)) continue; int d = docs.get(index).size(); Integer tf = f[index].get(word); score += (idf.get(word) * tf * (k1 + 1) / (tf + k1 * (1 - b + b * d / avgdl))); } return score; }
java
public double sim(List<String> sentence, int index) { double score = 0; for (String word : sentence) { if (!f[index].containsKey(word)) continue; int d = docs.get(index).size(); Integer tf = f[index].get(word); score += (idf.get(word) * tf * (k1 + 1) / (tf + k1 * (1 - b + b * d / avgdl))); } return score; }
[ "public", "double", "sim", "(", "List", "<", "String", ">", "sentence", ",", "int", "index", ")", "{", "double", "score", "=", "0", ";", "for", "(", "String", "word", ":", "sentence", ")", "{", "if", "(", "!", "f", "[", "index", "]", ".", "contai...
计算一个句子与一个文档的BM25相似度 @param sentence 句子(查询语句) @param index 文档(用语料库中的下标表示) @return BM25 score
[ "计算一个句子与一个文档的BM25相似度" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/summary/BM25.java#L119-L133
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/MapCircuitExtractor.java
MapCircuitExtractor.getCircuitGroups
private static Circuit getCircuitGroups(String group, Collection<String> neighborGroups) { final Collection<String> set = new HashSet<>(neighborGroups); final Circuit circuit; if (set.size() > 1) { final Iterator<String> iterator = set.iterator(); final String groupIn = iterator.next(); final String groupOut = iterator.next(); final CircuitType type = getCircuitType(group, neighborGroups); if (groupIn.equals(group)) { circuit = new Circuit(type, group, groupOut); } else { circuit = new Circuit(type, group, groupIn); } } else { circuit = null; } return circuit; }
java
private static Circuit getCircuitGroups(String group, Collection<String> neighborGroups) { final Collection<String> set = new HashSet<>(neighborGroups); final Circuit circuit; if (set.size() > 1) { final Iterator<String> iterator = set.iterator(); final String groupIn = iterator.next(); final String groupOut = iterator.next(); final CircuitType type = getCircuitType(group, neighborGroups); if (groupIn.equals(group)) { circuit = new Circuit(type, group, groupOut); } else { circuit = new Circuit(type, group, groupIn); } } else { circuit = null; } return circuit; }
[ "private", "static", "Circuit", "getCircuitGroups", "(", "String", "group", ",", "Collection", "<", "String", ">", "neighborGroups", ")", "{", "final", "Collection", "<", "String", ">", "set", "=", "new", "HashSet", "<>", "(", "neighborGroups", ")", ";", "fi...
Get the tile circuit between two groups. @param group The initial group. @param neighborGroups The neighbor groups. @return The tile circuit, <code>null</code> if invalid groups number.
[ "Get", "the", "tile", "circuit", "between", "two", "groups", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/MapCircuitExtractor.java#L41-L66
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toNumber
public static Number toNumber(String str, Number defaultValue) { try { // float if (str.indexOf('.') != -1) { return new BigDecimal(str); } // integer BigInteger bi = new BigInteger(str); int l = bi.bitLength(); if (l < 32) return new Integer(bi.intValue()); if (l < 64) return new Long(bi.longValue()); return bi; } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); return defaultValue; } }
java
public static Number toNumber(String str, Number defaultValue) { try { // float if (str.indexOf('.') != -1) { return new BigDecimal(str); } // integer BigInteger bi = new BigInteger(str); int l = bi.bitLength(); if (l < 32) return new Integer(bi.intValue()); if (l < 64) return new Long(bi.longValue()); return bi; } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); return defaultValue; } }
[ "public", "static", "Number", "toNumber", "(", "String", "str", ",", "Number", "defaultValue", ")", "{", "try", "{", "// float", "if", "(", "str", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "return", "new", "BigDecimal", "(", "str"...
returns a number Object, this can be a BigDecimal,BigInteger,Long, Double, depending on the input. @param str @return @throws PageException
[ "returns", "a", "number", "Object", "this", "can", "be", "a", "BigDecimal", "BigInteger", "Long", "Double", "depending", "on", "the", "input", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L1433-L1450
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/PickupUrl.java
PickupUrl.getAvailablePickupFulfillmentActionsUrl
public static MozuUrl getAvailablePickupFulfillmentActionsUrl(String orderId, String pickupId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/pickups/{pickupId}/actions"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("pickupId", pickupId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getAvailablePickupFulfillmentActionsUrl(String orderId, String pickupId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/pickups/{pickupId}/actions"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("pickupId", pickupId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getAvailablePickupFulfillmentActionsUrl", "(", "String", "orderId", ",", "String", "pickupId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/orders/{orderId}/pickups/{pickupId}/actions\"", ")", ";", ...
Get Resource Url for GetAvailablePickupFulfillmentActions @param orderId Unique identifier of the order. @param pickupId Unique identifier of the pickup to remove. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetAvailablePickupFulfillmentActions" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/PickupUrl.java#L22-L28
kaazing/gateway
util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java
Asn1Utils.encodeOctetString
public static int encodeOctetString(short[] octets, ByteBuffer buf) { if (octets == null) { octets = new short[0]; } int pos = buf.position(); for (int i = octets.length - 1; i >= 0; i--) { pos--; buf.put(pos, (byte) octets[i]); } buf.position(buf.position() - octets.length); int headerLength = DerUtils.encodeIdAndLength(DerId.TagClass.UNIVERSAL, DerId.EncodingType.PRIMITIVE, ASN1_OCTET_STRING_TAG_NUM, octets.length, buf); return headerLength + octets.length; }
java
public static int encodeOctetString(short[] octets, ByteBuffer buf) { if (octets == null) { octets = new short[0]; } int pos = buf.position(); for (int i = octets.length - 1; i >= 0; i--) { pos--; buf.put(pos, (byte) octets[i]); } buf.position(buf.position() - octets.length); int headerLength = DerUtils.encodeIdAndLength(DerId.TagClass.UNIVERSAL, DerId.EncodingType.PRIMITIVE, ASN1_OCTET_STRING_TAG_NUM, octets.length, buf); return headerLength + octets.length; }
[ "public", "static", "int", "encodeOctetString", "(", "short", "[", "]", "octets", ",", "ByteBuffer", "buf", ")", "{", "if", "(", "octets", "==", "null", ")", "{", "octets", "=", "new", "short", "[", "0", "]", ";", "}", "int", "pos", "=", "buf", "."...
Encode an ASN.1 OCTET STRING. @param octets the octets @param buf the buffer with space to the left of current position where the value will be encoded @return the length of the encoded data
[ "Encode", "an", "ASN", ".", "1", "OCTET", "STRING", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java#L354-L367
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipAssert.java
SipAssert.awaitReceivedResponses
public static void awaitReceivedResponses(final SipCall call, final int count) { await().until(new Callable<Integer>() { @Override public Integer call() throws Exception { return call.getAllReceivedResponses().size(); } }, is(count)); }
java
public static void awaitReceivedResponses(final SipCall call, final int count) { await().until(new Callable<Integer>() { @Override public Integer call() throws Exception { return call.getAllReceivedResponses().size(); } }, is(count)); }
[ "public", "static", "void", "awaitReceivedResponses", "(", "final", "SipCall", "call", ",", "final", "int", "count", ")", "{", "await", "(", ")", ".", "until", "(", "new", "Callable", "<", "Integer", ">", "(", ")", "{", "@", "Override", "public", "Intege...
Await until a the size of {@link SipCall#getAllReceivedResponses()} is equal to count. @param call the {@link SipCall} under test @param count the expected amount of responses @throws ConditionTimeoutException If condition was not fulfilled within the default time period.
[ "Await", "until", "a", "the", "size", "of", "{", "@link", "SipCall#getAllReceivedResponses", "()", "}", "is", "equal", "to", "count", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L285-L293
landawn/AbacusUtil
src/com/landawn/abacus/util/URLEncodedUtil.java
URLEncodedUtil.encPath
static void encPath(final StringBuilder sb, final String content, final Charset charset) { urlEncode(sb, content, charset, PATHSAFE, false); }
java
static void encPath(final StringBuilder sb, final String content, final Charset charset) { urlEncode(sb, content, charset, PATHSAFE, false); }
[ "static", "void", "encPath", "(", "final", "StringBuilder", "sb", ",", "final", "String", "content", ",", "final", "Charset", "charset", ")", "{", "urlEncode", "(", "sb", ",", "content", ",", "charset", ",", "PATHSAFE", ",", "false", ")", ";", "}" ]
Encode a String using the {@link #PATHSAFE} set of characters. <p> Used by URIBuilder to encode path segments. @param content the string to encode, does not convert space to '+' @param charset the charset to use @return the encoded string
[ "Encode", "a", "String", "using", "the", "{", "@link", "#PATHSAFE", "}", "set", "of", "characters", ".", "<p", ">", "Used", "by", "URIBuilder", "to", "encode", "path", "segments", ".", "@param", "content", "the", "string", "to", "encode", "does", "not", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/URLEncodedUtil.java#L544-L546
JodaOrg/joda-time
src/main/java/org/joda/time/DateTimeZone.java
DateTimeZone.forID
@FromString public static DateTimeZone forID(String id) { if (id == null) { return getDefault(); } if (id.equals("UTC")) { return DateTimeZone.UTC; } DateTimeZone zone = getProvider().getZone(id); if (zone != null) { return zone; } if (id.startsWith("+") || id.startsWith("-")) { int offset = parseOffset(id); if (offset == 0L) { return DateTimeZone.UTC; } else { id = printOffset(offset); return fixedOffsetZone(id, offset); } } throw new IllegalArgumentException("The datetime zone id '" + id + "' is not recognised"); }
java
@FromString public static DateTimeZone forID(String id) { if (id == null) { return getDefault(); } if (id.equals("UTC")) { return DateTimeZone.UTC; } DateTimeZone zone = getProvider().getZone(id); if (zone != null) { return zone; } if (id.startsWith("+") || id.startsWith("-")) { int offset = parseOffset(id); if (offset == 0L) { return DateTimeZone.UTC; } else { id = printOffset(offset); return fixedOffsetZone(id, offset); } } throw new IllegalArgumentException("The datetime zone id '" + id + "' is not recognised"); }
[ "@", "FromString", "public", "static", "DateTimeZone", "forID", "(", "String", "id", ")", "{", "if", "(", "id", "==", "null", ")", "{", "return", "getDefault", "(", ")", ";", "}", "if", "(", "id", ".", "equals", "(", "\"UTC\"", ")", ")", "{", "retu...
Gets a time zone instance for the specified time zone id. <p> The time zone id may be one of those returned by getAvailableIDs. Short ids, as accepted by {@link java.util.TimeZone}, are not accepted. All IDs must be specified in the long format. The exception is UTC, which is an acceptable id. <p> Alternatively a locale independent, fixed offset, datetime zone can be specified. The form <code>[+-]hh:mm</code> can be used. @param id the ID of the datetime zone, null means default @return the DateTimeZone object for the ID @throws IllegalArgumentException if the ID is not recognised
[ "Gets", "a", "time", "zone", "instance", "for", "the", "specified", "time", "zone", "id", ".", "<p", ">", "The", "time", "zone", "id", "may", "be", "one", "of", "those", "returned", "by", "getAvailableIDs", ".", "Short", "ids", "as", "accepted", "by", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTimeZone.java#L213-L235
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java
URIUtils.newURI
public static String newURI(String scheme, String server, int port, String path, String query) { StringBuilder builder = newURIBuilder(scheme, server, port); builder.append(path); if (query != null && query.length() > 0) builder.append('?').append(query); return builder.toString(); }
java
public static String newURI(String scheme, String server, int port, String path, String query) { StringBuilder builder = newURIBuilder(scheme, server, port); builder.append(path); if (query != null && query.length() > 0) builder.append('?').append(query); return builder.toString(); }
[ "public", "static", "String", "newURI", "(", "String", "scheme", ",", "String", "server", ",", "int", "port", ",", "String", "path", ",", "String", "query", ")", "{", "StringBuilder", "builder", "=", "newURIBuilder", "(", "scheme", ",", "server", ",", "por...
Create a new URI from the arguments, handling IPv6 host encoding and default ports @param scheme the URI scheme @param server the URI server @param port the URI port @param path the URI path @param query the URI query @return A String URI
[ "Create", "a", "new", "URI", "from", "the", "arguments", "handling", "IPv6", "host", "encoding", "and", "default", "ports" ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java#L838-L844
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/Shutdown.java
Shutdown.run
public VoltTable[] run(SystemProcedureExecutionContext ctx) { createAndExecuteSysProcPlan(SysProcFragmentId.PF_shutdownSync, SysProcFragmentId.PF_shutdownSyncDone); SynthesizedPlanFragment pfs[] = new SynthesizedPlanFragment[] { new SynthesizedPlanFragment(SysProcFragmentId.PF_shutdownCommand, true) }; executeSysProcPlanFragments(pfs, SysProcFragmentId.PF_procedureDone); return new VoltTable[0]; }
java
public VoltTable[] run(SystemProcedureExecutionContext ctx) { createAndExecuteSysProcPlan(SysProcFragmentId.PF_shutdownSync, SysProcFragmentId.PF_shutdownSyncDone); SynthesizedPlanFragment pfs[] = new SynthesizedPlanFragment[] { new SynthesizedPlanFragment(SysProcFragmentId.PF_shutdownCommand, true) }; executeSysProcPlanFragments(pfs, SysProcFragmentId.PF_procedureDone); return new VoltTable[0]; }
[ "public", "VoltTable", "[", "]", "run", "(", "SystemProcedureExecutionContext", "ctx", ")", "{", "createAndExecuteSysProcPlan", "(", "SysProcFragmentId", ".", "PF_shutdownSync", ",", "SysProcFragmentId", ".", "PF_shutdownSyncDone", ")", ";", "SynthesizedPlanFragment", "pf...
Begin an un-graceful shutdown. @param ctx Internal parameter not exposed to the end-user. @return Never returned, no he never returned...
[ "Begin", "an", "un", "-", "graceful", "shutdown", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/Shutdown.java#L126-L134
kstateome/canvas-api
src/main/java/edu/ksu/canvas/requestOptions/BaseOptions.java
BaseOptions.addEnumList
protected void addEnumList(String key, List<? extends Enum> list) { optionsMap.put(key, list.stream().map(i -> i.toString()).collect(Collectors.toList())); }
java
protected void addEnumList(String key, List<? extends Enum> list) { optionsMap.put(key, list.stream().map(i -> i.toString()).collect(Collectors.toList())); }
[ "protected", "void", "addEnumList", "(", "String", "key", ",", "List", "<", "?", "extends", "Enum", ">", "list", ")", "{", "optionsMap", ".", "put", "(", "key", ",", "list", ".", "stream", "(", ")", ".", "map", "(", "i", "->", "i", ".", "toString",...
Add a list of enums to the options map @param key The key for the options map (ex: "include[]") @param list A list of enums
[ "Add", "a", "list", "of", "enums", "to", "the", "options", "map" ]
train
https://github.com/kstateome/canvas-api/blob/426bf403a8fd7aca3f170348005feda25b374e5a/src/main/java/edu/ksu/canvas/requestOptions/BaseOptions.java#L23-L25
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/io/GeoPackageIOUtils.java
GeoPackageIOUtils.addFileExtension
public static File addFileExtension(File file, String extension) { return new File(file.getAbsolutePath() + "." + extension); }
java
public static File addFileExtension(File file, String extension) { return new File(file.getAbsolutePath() + "." + extension); }
[ "public", "static", "File", "addFileExtension", "(", "File", "file", ",", "String", "extension", ")", "{", "return", "new", "File", "(", "file", ".", "getAbsolutePath", "(", ")", "+", "\".\"", "+", "extension", ")", ";", "}" ]
Add a the file extension to the file @param file file @param extension file extension @return new file with extension @since 3.0.2
[ "Add", "a", "the", "file", "extension", "to", "the", "file" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/io/GeoPackageIOUtils.java#L70-L72
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/DbEntityManager.java
DbEntityManager.deletePreserveOrder
public DbBulkOperation deletePreserveOrder(Class<? extends DbEntity> entityType, String statement, Object parameter) { return performBulkOperationPreserveOrder(entityType, statement, parameter, DELETE_BULK); }
java
public DbBulkOperation deletePreserveOrder(Class<? extends DbEntity> entityType, String statement, Object parameter) { return performBulkOperationPreserveOrder(entityType, statement, parameter, DELETE_BULK); }
[ "public", "DbBulkOperation", "deletePreserveOrder", "(", "Class", "<", "?", "extends", "DbEntity", ">", "entityType", ",", "String", "statement", ",", "Object", "parameter", ")", "{", "return", "performBulkOperationPreserveOrder", "(", "entityType", ",", "statement", ...
Several delete operations added by this method will be executed preserving the order of method calls, no matter what entity type they refer to. They will though be executed after all "not-bulk" operations (e.g. {@link DbEntityManager#insert(DbEntity)} or {@link DbEntityManager#merge(DbEntity)}) and after those deletes added by {@link DbEntityManager#delete(Class, String, Object)}. @param entityType @param statement @param parameter @return delete operation
[ "Several", "delete", "operations", "added", "by", "this", "method", "will", "be", "executed", "preserving", "the", "order", "of", "method", "calls", "no", "matter", "what", "entity", "type", "they", "refer", "to", ".", "They", "will", "though", "be", "execut...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/DbEntityManager.java#L637-L639
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsWorker.java
FindBugsWorker.loadXml
public void loadXml(String fileName) throws CoreException { if (fileName == null) { return; } st = new StopTimer(); // clear markers clearMarkers(null); final Project findBugsProject = new Project(); final Reporter bugReporter = new Reporter(javaProject, findBugsProject, monitor); bugReporter.setPriorityThreshold(userPrefs.getUserDetectorThreshold()); reportFromXml(fileName, findBugsProject, bugReporter); // Merge new results into existing results. updateBugCollection(findBugsProject, bugReporter, false); monitor.done(); }
java
public void loadXml(String fileName) throws CoreException { if (fileName == null) { return; } st = new StopTimer(); // clear markers clearMarkers(null); final Project findBugsProject = new Project(); final Reporter bugReporter = new Reporter(javaProject, findBugsProject, monitor); bugReporter.setPriorityThreshold(userPrefs.getUserDetectorThreshold()); reportFromXml(fileName, findBugsProject, bugReporter); // Merge new results into existing results. updateBugCollection(findBugsProject, bugReporter, false); monitor.done(); }
[ "public", "void", "loadXml", "(", "String", "fileName", ")", "throws", "CoreException", "{", "if", "(", "fileName", "==", "null", ")", "{", "return", ";", "}", "st", "=", "new", "StopTimer", "(", ")", ";", "// clear markers", "clearMarkers", "(", "null", ...
Load existing FindBugs xml report for the given collection of files. @param fileName xml file name to load bugs from @throws CoreException
[ "Load", "existing", "FindBugs", "xml", "report", "for", "the", "given", "collection", "of", "files", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsWorker.java#L247-L264
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java
DiagonalMatrix.setColumn
public void setColumn(int column, double[] values) { checkIndices(values.length - 1, column); values[column] = values[column]; }
java
public void setColumn(int column, double[] values) { checkIndices(values.length - 1, column); values[column] = values[column]; }
[ "public", "void", "setColumn", "(", "int", "column", ",", "double", "[", "]", "values", ")", "{", "checkIndices", "(", "values", ".", "length", "-", "1", ",", "column", ")", ";", "values", "[", "column", "]", "=", "values", "[", "column", "]", ";", ...
{@inheritDoc} Note that any values are not on the diagonal are ignored.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java#L165-L169
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/tsdb/model/Filters.java
Filters.addField
public Filters addField(String field, String value) { initialFields(); fields.add(new FieldFilter(field, value)); return this; }
java
public Filters addField(String field, String value) { initialFields(); fields.add(new FieldFilter(field, value)); return this; }
[ "public", "Filters", "addField", "(", "String", "field", ",", "String", "value", ")", "{", "initialFields", "(", ")", ";", "fields", ".", "add", "(", "new", "FieldFilter", "(", "field", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add field filter to fields which just append not replace. @param field The field name for filter @param value The value filter @return Filters
[ "Add", "field", "filter", "to", "fields", "which", "just", "append", "not", "replace", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/Filters.java#L277-L281
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/WhitelistingApi.java
WhitelistingApi.enableWhitelist
public WhitelistEnvelope enableWhitelist(String dtid, DeviceTypeUpdateInput deviceTypeUpdateInfo) throws ApiException { ApiResponse<WhitelistEnvelope> resp = enableWhitelistWithHttpInfo(dtid, deviceTypeUpdateInfo); return resp.getData(); }
java
public WhitelistEnvelope enableWhitelist(String dtid, DeviceTypeUpdateInput deviceTypeUpdateInfo) throws ApiException { ApiResponse<WhitelistEnvelope> resp = enableWhitelistWithHttpInfo(dtid, deviceTypeUpdateInfo); return resp.getData(); }
[ "public", "WhitelistEnvelope", "enableWhitelist", "(", "String", "dtid", ",", "DeviceTypeUpdateInput", "deviceTypeUpdateInfo", ")", "throws", "ApiException", "{", "ApiResponse", "<", "WhitelistEnvelope", ">", "resp", "=", "enableWhitelistWithHttpInfo", "(", "dtid", ",", ...
Enable or disble whitelist feature of a device type Enable or disble whitelist feature of a device type @param dtid Device Type ID. (required) @param deviceTypeUpdateInfo Device type update input. (required) @return WhitelistEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Enable", "or", "disble", "whitelist", "feature", "of", "a", "device", "type", "Enable", "or", "disble", "whitelist", "feature", "of", "a", "device", "type" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/WhitelistingApi.java#L392-L395
Azure/azure-sdk-for-java
streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java
FunctionsInner.createOrReplace
public FunctionInner createOrReplace(String resourceGroupName, String jobName, String functionName, FunctionInner function) { return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, functionName, function).toBlocking().single().body(); }
java
public FunctionInner createOrReplace(String resourceGroupName, String jobName, String functionName, FunctionInner function) { return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, functionName, function).toBlocking().single().body(); }
[ "public", "FunctionInner", "createOrReplace", "(", "String", "resourceGroupName", ",", "String", "jobName", ",", "String", "functionName", ",", "FunctionInner", "function", ")", "{", "return", "createOrReplaceWithServiceResponseAsync", "(", "resourceGroupName", ",", "jobN...
Creates a function or replaces an already existing function under an existing streaming job. @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 jobName The name of the streaming job. @param functionName The name of the function. @param function The definition of the function that will be used to create a new function or replace the existing one under the streaming job. @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 FunctionInner object if successful.
[ "Creates", "a", "function", "or", "replaces", "an", "already", "existing", "function", "under", "an", "existing", "streaming", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java#L121-L123
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufProxy.java
ProtobufProxy.dynamicCodeGenerate
public static void dynamicCodeGenerate(OutputStream os, Class cls, Charset charset) throws IOException { dynamicCodeGenerate(os, cls, charset, getCodeGenerator(cls)); }
java
public static void dynamicCodeGenerate(OutputStream os, Class cls, Charset charset) throws IOException { dynamicCodeGenerate(os, cls, charset, getCodeGenerator(cls)); }
[ "public", "static", "void", "dynamicCodeGenerate", "(", "OutputStream", "os", ",", "Class", "cls", ",", "Charset", "charset", ")", "throws", "IOException", "{", "dynamicCodeGenerate", "(", "os", ",", "cls", ",", "charset", ",", "getCodeGenerator", "(", "cls", ...
To generate a protobuf proxy java source code for target class. @param os to generate java source code @param cls target class @param charset charset type @throws IOException in case of any io relative exception.
[ "To", "generate", "a", "protobuf", "proxy", "java", "source", "code", "for", "target", "class", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufProxy.java#L131-L133
zandero/rest.vertx
src/main/java/com/zandero/rest/AnnotationProcessor.java
AnnotationProcessor.isMatching
private static boolean isMatching(Method base, Method compare) { // if names and argument types match ... then this are the same method if (base.getName().equals(compare.getName()) && base.getParameterCount() == compare.getParameterCount()) { Class<?>[] typeBase = base.getParameterTypes(); Class<?>[] typeCompare = compare.getParameterTypes(); for (int index = 0; index < typeBase.length; index++) { Class clazzBase = typeBase[index]; Class clazzCompare = typeCompare[index]; if (!clazzBase.equals(clazzCompare)) { return false; } } return true; } return false; }
java
private static boolean isMatching(Method base, Method compare) { // if names and argument types match ... then this are the same method if (base.getName().equals(compare.getName()) && base.getParameterCount() == compare.getParameterCount()) { Class<?>[] typeBase = base.getParameterTypes(); Class<?>[] typeCompare = compare.getParameterTypes(); for (int index = 0; index < typeBase.length; index++) { Class clazzBase = typeBase[index]; Class clazzCompare = typeCompare[index]; if (!clazzBase.equals(clazzCompare)) { return false; } } return true; } return false; }
[ "private", "static", "boolean", "isMatching", "(", "Method", "base", ",", "Method", "compare", ")", "{", "// if names and argument types match ... then this are the same method", "if", "(", "base", ".", "getName", "(", ")", ".", "equals", "(", "compare", ".", "getNa...
Checks if methods in base and inherited/abstract class are the same method @param base method @param compare to compare @return true if the same, false otherwise
[ "Checks", "if", "methods", "in", "base", "and", "inherited", "/", "abstract", "class", "are", "the", "same", "method" ]
train
https://github.com/zandero/rest.vertx/blob/ba458720cf59e076953eab9dac7227eeaf9e58ce/src/main/java/com/zandero/rest/AnnotationProcessor.java#L156-L177
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.getMantissa
private static String getMantissa(final String str, final int stopPos) { final char firstChar = str.charAt(0); final boolean hasSign = firstChar == '-' || firstChar == '+'; return hasSign ? str.substring(1, stopPos) : str.substring(0, stopPos); }
java
private static String getMantissa(final String str, final int stopPos) { final char firstChar = str.charAt(0); final boolean hasSign = firstChar == '-' || firstChar == '+'; return hasSign ? str.substring(1, stopPos) : str.substring(0, stopPos); }
[ "private", "static", "String", "getMantissa", "(", "final", "String", "str", ",", "final", "int", "stopPos", ")", "{", "final", "char", "firstChar", "=", "str", ".", "charAt", "(", "0", ")", ";", "final", "boolean", "hasSign", "=", "firstChar", "==", "'"...
<p>Utility method for {@link #createNumber(java.lang.String)}.</p> <p>Returns mantissa of the given number.</p> @param str the string representation of the number @param stopPos the position of the exponent or decimal point @return mantissa of the given number
[ "<p", ">", "Utility", "method", "for", "{", "@link", "#createNumber", "(", "java", ".", "lang", ".", "String", ")", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L6497-L6502
CodeNarc/CodeNarc
src/main/java/org/codenarc/rule/AbstractMethodCallExpressionVisitor.java
AbstractMethodCallExpressionVisitor.addViolation
protected void addViolation(MethodCallExpression node, String message) { if (node.getLineNumber() >= 0) { int lineNumber = AstUtil.findFirstNonAnnotationLine(node, sourceCode); String sourceLine = sourceCode.line(AstUtil.findFirstNonAnnotationLine(node, sourceCode) - 1); Violation violation = new Violation(); violation.setRule(rule); violation.setLineNumber(lineNumber); violation.setSourceLine(sourceLine); if (currentClassNode != null) { violation.setMessage(String.format( "Violation in class %s. %s", currentClassNode.getName(), message )); } else { violation.setMessage(message); } violations.add(violation); } }
java
protected void addViolation(MethodCallExpression node, String message) { if (node.getLineNumber() >= 0) { int lineNumber = AstUtil.findFirstNonAnnotationLine(node, sourceCode); String sourceLine = sourceCode.line(AstUtil.findFirstNonAnnotationLine(node, sourceCode) - 1); Violation violation = new Violation(); violation.setRule(rule); violation.setLineNumber(lineNumber); violation.setSourceLine(sourceLine); if (currentClassNode != null) { violation.setMessage(String.format( "Violation in class %s. %s", currentClassNode.getName(), message )); } else { violation.setMessage(message); } violations.add(violation); } }
[ "protected", "void", "addViolation", "(", "MethodCallExpression", "node", ",", "String", "message", ")", "{", "if", "(", "node", ".", "getLineNumber", "(", ")", ">=", "0", ")", "{", "int", "lineNumber", "=", "AstUtil", ".", "findFirstNonAnnotationLine", "(", ...
Add a new Violation to the list of violations found by this visitor. Only add the violation if the node lineNumber >= 0. @param node - the Groovy AST Node @param message - the message for the violation; defaults to null
[ "Add", "a", "new", "Violation", "to", "the", "list", "of", "violations", "found", "by", "this", "visitor", ".", "Only", "add", "the", "violation", "if", "the", "node", "lineNumber", ">", "=", "0", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/rule/AbstractMethodCallExpressionVisitor.java#L54-L71
mgormley/pacaya
src/main/java/edu/jhu/pacaya/parse/dep/ParentsArray.java
ParentsArray.countChildrenOf
public static int countChildrenOf(int[] parents, int parent) { int count = 0; for (int i=0; i<parents.length; i++) { if (parents[i] == parent) { count++; } } return count; }
java
public static int countChildrenOf(int[] parents, int parent) { int count = 0; for (int i=0; i<parents.length; i++) { if (parents[i] == parent) { count++; } } return count; }
[ "public", "static", "int", "countChildrenOf", "(", "int", "[", "]", "parents", ",", "int", "parent", ")", "{", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parents", ".", "length", ";", "i", "++", ")", "{", "...
Counts of the number of children in a dependency tree for the given parent index. @param parents A parents array where parents[i] contains the index of the parent of the word at position i, with parents[i] = -1 indicating that the parent of word i is the wall node. @param parent The parent for which the children should be counted. @return The number of entries in <code>parents</code> that equal <code>parent</code>.
[ "Counts", "of", "the", "number", "of", "children", "in", "a", "dependency", "tree", "for", "the", "given", "parent", "index", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/ParentsArray.java#L184-L192
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscConfigurationsInner.java
DscConfigurationsInner.createOrUpdate
public DscConfigurationInner createOrUpdate(String resourceGroupName, String automationAccountName, String configurationName, DscConfigurationCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, configurationName, parameters).toBlocking().single().body(); }
java
public DscConfigurationInner createOrUpdate(String resourceGroupName, String automationAccountName, String configurationName, DscConfigurationCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, configurationName, parameters).toBlocking().single().body(); }
[ "public", "DscConfigurationInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "configurationName", ",", "DscConfigurationCreateOrUpdateParameters", "parameters", ")", "{", "return", "createOrUpdateWithServiceRespon...
Create the configuration identified by configuration name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param configurationName The create or update parameters for configuration. @param parameters The create or update parameters for configuration. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DscConfigurationInner object if successful.
[ "Create", "the", "configuration", "identified", "by", "configuration", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscConfigurationsInner.java#L291-L293
samskivert/samskivert
src/main/java/com/samskivert/util/PrefsConfig.java
PrefsConfig.setValue
public void setValue (String name, String value) { String oldValue = getValue(name, (String)null); _prefs.put(name, value); _propsup.firePropertyChange(name, oldValue, value); }
java
public void setValue (String name, String value) { String oldValue = getValue(name, (String)null); _prefs.put(name, value); _propsup.firePropertyChange(name, oldValue, value); }
[ "public", "void", "setValue", "(", "String", "name", ",", "String", "value", ")", "{", "String", "oldValue", "=", "getValue", "(", "name", ",", "(", "String", ")", "null", ")", ";", "_prefs", ".", "put", "(", "name", ",", "value", ")", ";", "_propsup...
Sets the value of the specified preference, overriding the value defined in the configuration files shipped with the application.
[ "Sets", "the", "value", "of", "the", "specified", "preference", "overriding", "the", "value", "defined", "in", "the", "configuration", "files", "shipped", "with", "the", "application", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PrefsConfig.java#L129-L134
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java
CPOptionCategoryPersistenceImpl.findByGroupId
@Override public List<CPOptionCategory> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
java
@Override public List<CPOptionCategory> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPOptionCategory", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp option categories where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPOptionCategoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of cp option categories @param end the upper bound of the range of cp option categories (not inclusive) @return the range of matching cp option categories
[ "Returns", "a", "range", "of", "all", "the", "cp", "option", "categories", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java#L1534-L1537
apptik/jus
android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java
ImageLoader.onGetImageError
protected void onGetImageError(String cacheKey, JusError error) { // Notify the requesters that something failed via a null result. // Remove this request from the list of in-flight requests. BatchedImageRequest request = inFlightRequests.remove(cacheKey); if (request != null) { // Set the error for this request request.setError(error); // Send the batched response batchResponse(cacheKey, request); } }
java
protected void onGetImageError(String cacheKey, JusError error) { // Notify the requesters that something failed via a null result. // Remove this request from the list of in-flight requests. BatchedImageRequest request = inFlightRequests.remove(cacheKey); if (request != null) { // Set the error for this request request.setError(error); // Send the batched response batchResponse(cacheKey, request); } }
[ "protected", "void", "onGetImageError", "(", "String", "cacheKey", ",", "JusError", "error", ")", "{", "// Notify the requesters that something failed via a null result.", "// Remove this request from the list of in-flight requests.", "BatchedImageRequest", "request", "=", "inFlightR...
Handler for when an image failed to load. @param cacheKey The cache key that is associated with the image request.
[ "Handler", "for", "when", "an", "image", "failed", "to", "load", "." ]
train
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java#L363-L375
lucee/Lucee
core/src/main/java/lucee/commons/io/SystemUtil.java
SystemUtil.getClassPathesFromClassLoader
private static void getClassPathesFromClassLoader(URLClassLoader ucl, ArrayList<Resource> pathes) { ClassLoader pcl = ucl.getParent(); // parent first if (pcl instanceof URLClassLoader) getClassPathesFromClassLoader((URLClassLoader) pcl, pathes); ResourceProvider frp = ResourcesImpl.getFileResourceProvider(); // get all pathes URL[] urls = ucl.getURLs(); for (int i = 0; i < urls.length; i++) { Resource file = frp.getResource(urls[i].getPath()); if (file.exists()) pathes.add(ResourceUtil.getCanonicalResourceEL(file)); } }
java
private static void getClassPathesFromClassLoader(URLClassLoader ucl, ArrayList<Resource> pathes) { ClassLoader pcl = ucl.getParent(); // parent first if (pcl instanceof URLClassLoader) getClassPathesFromClassLoader((URLClassLoader) pcl, pathes); ResourceProvider frp = ResourcesImpl.getFileResourceProvider(); // get all pathes URL[] urls = ucl.getURLs(); for (int i = 0; i < urls.length; i++) { Resource file = frp.getResource(urls[i].getPath()); if (file.exists()) pathes.add(ResourceUtil.getCanonicalResourceEL(file)); } }
[ "private", "static", "void", "getClassPathesFromClassLoader", "(", "URLClassLoader", "ucl", ",", "ArrayList", "<", "Resource", ">", "pathes", ")", "{", "ClassLoader", "pcl", "=", "ucl", ".", "getParent", "(", ")", ";", "// parent first", "if", "(", "pcl", "ins...
get class pathes from all url ClassLoaders @param ucl URL Class Loader @param pathes Hashmap with allpathes
[ "get", "class", "pathes", "from", "all", "url", "ClassLoaders" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/SystemUtil.java#L459-L472
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java
HttpFields.put
public void put(String name, String value) { if (value == null) remove(name); else put(new HttpField(name, value)); }
java
public void put(String name, String value) { if (value == null) remove(name); else put(new HttpField(name, value)); }
[ "public", "void", "put", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "remove", "(", "name", ")", ";", "else", "put", "(", "new", "HttpField", "(", "name", ",", "value", ")", ")", ";", "}" ]
Set a field. @param name the name of the field @param value the value of the field. If null the field is cleared.
[ "Set", "a", "field", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java#L502-L507
termsuite/termsuite-core
src/main/java/fr/univnantes/termsuite/engines/postproc/TwoOrderVariationMerger.java
TwoOrderVariationMerger.mergeTwoOrderVariations
private void mergeTwoOrderVariations(Predicate<RelationService> p1, Predicate<RelationService> p2) { /* * t1 --r1--> t2 --r2--> t3 * t1 --rtrans--> t3 */ terminology.terms(TermProperty.FREQUENCY.getComparator(true)) .forEach(t1 -> { final Map<Term, Relation> r1Set = new HashMap<>(); t1.variations().forEach(r1 -> { if(p1.test(r1)) r1Set.put(r1.getTo().getTerm(), r1.getRelation()); }); final Set<Relation> rem = new HashSet<>(); r1Set.keySet().forEach(t2-> { terminology .outboundRelations(t2, RelationType.VARIATION) .filter(p2) .filter(r2 -> r1Set.containsKey(r2.getTo())) .forEach(r2 -> { Term t3 = r2.getTo().getTerm(); Relation rtrans = r1Set.get(t3); if(logger.isTraceEnabled()) { logger.trace("Found order-2 relation in variation set {}-->{}-->{}", t1, t2, t3); logger.trace("Removing {}", rtrans); } watchRemoval(t1.getTerm(), t2, t3, rtrans); rem.add(rtrans); }) ; }); rem.forEach(rel -> { terminology.removeRelation(rel); }); }); }
java
private void mergeTwoOrderVariations(Predicate<RelationService> p1, Predicate<RelationService> p2) { /* * t1 --r1--> t2 --r2--> t3 * t1 --rtrans--> t3 */ terminology.terms(TermProperty.FREQUENCY.getComparator(true)) .forEach(t1 -> { final Map<Term, Relation> r1Set = new HashMap<>(); t1.variations().forEach(r1 -> { if(p1.test(r1)) r1Set.put(r1.getTo().getTerm(), r1.getRelation()); }); final Set<Relation> rem = new HashSet<>(); r1Set.keySet().forEach(t2-> { terminology .outboundRelations(t2, RelationType.VARIATION) .filter(p2) .filter(r2 -> r1Set.containsKey(r2.getTo())) .forEach(r2 -> { Term t3 = r2.getTo().getTerm(); Relation rtrans = r1Set.get(t3); if(logger.isTraceEnabled()) { logger.trace("Found order-2 relation in variation set {}-->{}-->{}", t1, t2, t3); logger.trace("Removing {}", rtrans); } watchRemoval(t1.getTerm(), t2, t3, rtrans); rem.add(rtrans); }) ; }); rem.forEach(rel -> { terminology.removeRelation(rel); }); }); }
[ "private", "void", "mergeTwoOrderVariations", "(", "Predicate", "<", "RelationService", ">", "p1", ",", "Predicate", "<", "RelationService", ">", "p2", ")", "{", "/*\n\t\t * t1 --r1--> t2 --r2--> t3\n\t\t * t1 --rtrans--> t3\n\t\t */", "terminology", ".", "terms", "(", ...
/* When baseTerm -r1-> v1 baseTerm --rtrans--> v2 and v1 -r2-> v2 Then remove baseTerm --rtrans--> v2
[ "/", "*", "When" ]
train
https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/engines/postproc/TwoOrderVariationMerger.java#L99-L140
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseCsr2cscEx
public static int cusparseCsr2cscEx( cusparseHandle handle, int m, int n, int nnz, Pointer csrSortedVal, int csrSortedValtype, Pointer csrSortedRowPtr, Pointer csrSortedColInd, Pointer cscSortedVal, int cscSortedValtype, Pointer cscSortedRowInd, Pointer cscSortedColPtr, int copyValues, int idxBase, int executiontype) { return checkResult(cusparseCsr2cscExNative(handle, m, n, nnz, csrSortedVal, csrSortedValtype, csrSortedRowPtr, csrSortedColInd, cscSortedVal, cscSortedValtype, cscSortedRowInd, cscSortedColPtr, copyValues, idxBase, executiontype)); }
java
public static int cusparseCsr2cscEx( cusparseHandle handle, int m, int n, int nnz, Pointer csrSortedVal, int csrSortedValtype, Pointer csrSortedRowPtr, Pointer csrSortedColInd, Pointer cscSortedVal, int cscSortedValtype, Pointer cscSortedRowInd, Pointer cscSortedColPtr, int copyValues, int idxBase, int executiontype) { return checkResult(cusparseCsr2cscExNative(handle, m, n, nnz, csrSortedVal, csrSortedValtype, csrSortedRowPtr, csrSortedColInd, cscSortedVal, cscSortedValtype, cscSortedRowInd, cscSortedColPtr, copyValues, idxBase, executiontype)); }
[ "public", "static", "int", "cusparseCsr2cscEx", "(", "cusparseHandle", "handle", ",", "int", "m", ",", "int", "n", ",", "int", "nnz", ",", "Pointer", "csrSortedVal", ",", "int", "csrSortedValtype", ",", "Pointer", "csrSortedRowPtr", ",", "Pointer", "csrSortedCol...
Description: This routine converts a matrix from CSR to CSC sparse storage format. The resulting matrix can be re-interpreted as a transpose of the original matrix in CSR storage format.
[ "Description", ":", "This", "routine", "converts", "a", "matrix", "from", "CSR", "to", "CSC", "sparse", "storage", "format", ".", "The", "resulting", "matrix", "can", "be", "re", "-", "interpreted", "as", "a", "transpose", "of", "the", "original", "matrix", ...
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L11644-L11662
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/user/UserCoreDao.java
UserCoreDao.buildWhereLike
public String buildWhereLike(String field, ColumnValue value) { String where; if (value != null) { if (value.getTolerance() != null) { throw new GeoPackageException( "Field value tolerance not supported for LIKE query, Field: " + field + ", Value: " + ", Tolerance: " + value.getTolerance()); } where = buildWhereLike(field, value.getValue()); } else { where = buildWhere(field, null, null); } return where; }
java
public String buildWhereLike(String field, ColumnValue value) { String where; if (value != null) { if (value.getTolerance() != null) { throw new GeoPackageException( "Field value tolerance not supported for LIKE query, Field: " + field + ", Value: " + ", Tolerance: " + value.getTolerance()); } where = buildWhereLike(field, value.getValue()); } else { where = buildWhere(field, null, null); } return where; }
[ "public", "String", "buildWhereLike", "(", "String", "field", ",", "ColumnValue", "value", ")", "{", "String", "where", ";", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "value", ".", "getTolerance", "(", ")", "!=", "null", ")", "{", "throw",...
Build where (or selection) LIKE statement for a single field @param field field name @param value column value @return where clause @since 3.0.1
[ "Build", "where", "(", "or", "selection", ")", "LIKE", "statement", "for", "a", "single", "field" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserCoreDao.java#L759-L773
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableChecker.java
ImmutableChecker.checkSubtype
private Description checkSubtype(ClassTree tree, VisitorState state) { ClassSymbol sym = ASTHelpers.getSymbol(tree); if (sym == null) { return NO_MATCH; } Type superType = immutableSupertype(sym, state); if (superType == null) { return NO_MATCH; } String message = String.format( "Class extends @Immutable type %s, but is not annotated as immutable", superType); Fix fix = SuggestedFix.builder() .prefixWith(tree, "@Immutable ") .addImport(Immutable.class.getName()) .build(); return buildDescription(tree).setMessage(message).addFix(fix).build(); }
java
private Description checkSubtype(ClassTree tree, VisitorState state) { ClassSymbol sym = ASTHelpers.getSymbol(tree); if (sym == null) { return NO_MATCH; } Type superType = immutableSupertype(sym, state); if (superType == null) { return NO_MATCH; } String message = String.format( "Class extends @Immutable type %s, but is not annotated as immutable", superType); Fix fix = SuggestedFix.builder() .prefixWith(tree, "@Immutable ") .addImport(Immutable.class.getName()) .build(); return buildDescription(tree).setMessage(message).addFix(fix).build(); }
[ "private", "Description", "checkSubtype", "(", "ClassTree", "tree", ",", "VisitorState", "state", ")", "{", "ClassSymbol", "sym", "=", "ASTHelpers", ".", "getSymbol", "(", "tree", ")", ";", "if", "(", "sym", "==", "null", ")", "{", "return", "NO_MATCH", ";...
Check for classes without {@code @Immutable} that have immutable supertypes.
[ "Check", "for", "classes", "without", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableChecker.java#L309-L327
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyRangeAxiomImpl_CustomFieldSerializer.java
OWLAnnotationPropertyRangeAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLAnnotationPropertyRangeAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLAnnotationPropertyRangeAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLAnnotationPropertyRangeAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}"...
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyRangeAxiomImpl_CustomFieldSerializer.java#L77-L80
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java
FileUtil.zipDir
public static void zipDir(String dirName, String nameZipFile) throws IOException { try (FileOutputStream fW = new FileOutputStream(nameZipFile); ZipOutputStream zip = new ZipOutputStream(fW)) { addFolderToZip("", dirName, zip); } }
java
public static void zipDir(String dirName, String nameZipFile) throws IOException { try (FileOutputStream fW = new FileOutputStream(nameZipFile); ZipOutputStream zip = new ZipOutputStream(fW)) { addFolderToZip("", dirName, zip); } }
[ "public", "static", "void", "zipDir", "(", "String", "dirName", ",", "String", "nameZipFile", ")", "throws", "IOException", "{", "try", "(", "FileOutputStream", "fW", "=", "new", "FileOutputStream", "(", "nameZipFile", ")", ";", "ZipOutputStream", "zip", "=", ...
Compresses directory into zip archive. @param dirName the path to the directory @param nameZipFile archive name. @throws IOException
[ "Compresses", "directory", "into", "zip", "archive", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java#L251-L256
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/ui/jedit/TextUtilities.java
TextUtilities.findWordEnd
public static int findWordEnd(String line, int pos, String noWordSep, boolean joinNonWordChars) { return findWordEnd(line, pos, noWordSep, joinNonWordChars, false); }
java
public static int findWordEnd(String line, int pos, String noWordSep, boolean joinNonWordChars) { return findWordEnd(line, pos, noWordSep, joinNonWordChars, false); }
[ "public", "static", "int", "findWordEnd", "(", "String", "line", ",", "int", "pos", ",", "String", "noWordSep", ",", "boolean", "joinNonWordChars", ")", "{", "return", "findWordEnd", "(", "line", ",", "pos", ",", "noWordSep", ",", "joinNonWordChars", ",", "f...
Locates the end of the word at the specified position. @param line The text @param pos The position @param noWordSep Characters that are non-alphanumeric, but should be treated as word characters anyway @param joinNonWordChars Treat consecutive non-alphanumeric characters as one word @since jEdit 4.1pre2
[ "Locates", "the", "end", "of", "the", "word", "at", "the", "specified", "position", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/ui/jedit/TextUtilities.java#L151-L153
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.internalToTime
public static java.sql.Time internalToTime(int v, TimeZone tz) { // note that, in this case, can't handle Daylight Saving Time return new java.sql.Time(v - tz.getOffset(v)); }
java
public static java.sql.Time internalToTime(int v, TimeZone tz) { // note that, in this case, can't handle Daylight Saving Time return new java.sql.Time(v - tz.getOffset(v)); }
[ "public", "static", "java", ".", "sql", ".", "Time", "internalToTime", "(", "int", "v", ",", "TimeZone", "tz", ")", "{", "// note that, in this case, can't handle Daylight Saving Time", "return", "new", "java", ".", "sql", ".", "Time", "(", "v", "-", "tz", "."...
Converts the internal representation of a SQL TIME (int) to the Java type used for UDF parameters ({@link java.sql.Time}). <p>The internal int represents the seconds since "00:00:00". When we convert it to {@link java.sql.Time} (time milliseconds since January 1, 1970, 00:00:00 GMT), we need a TimeZone.
[ "Converts", "the", "internal", "representation", "of", "a", "SQL", "TIME", "(", "int", ")", "to", "the", "Java", "type", "used", "for", "UDF", "parameters", "(", "{", "@link", "java", ".", "sql", ".", "Time", "}", ")", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L153-L156
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.email_exchange_organizationName_service_exchangeService_accountUpgrade_duration_GET
public OvhOrder email_exchange_organizationName_service_exchangeService_accountUpgrade_duration_GET(String organizationName, String exchangeService, String duration, OvhAccountQuotaEnum newQuota, String primaryEmailAddress) throws IOException { String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/accountUpgrade/{duration}"; StringBuilder sb = path(qPath, organizationName, exchangeService, duration); query(sb, "newQuota", newQuota); query(sb, "primaryEmailAddress", primaryEmailAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder email_exchange_organizationName_service_exchangeService_accountUpgrade_duration_GET(String organizationName, String exchangeService, String duration, OvhAccountQuotaEnum newQuota, String primaryEmailAddress) throws IOException { String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/accountUpgrade/{duration}"; StringBuilder sb = path(qPath, organizationName, exchangeService, duration); query(sb, "newQuota", newQuota); query(sb, "primaryEmailAddress", primaryEmailAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "email_exchange_organizationName_service_exchangeService_accountUpgrade_duration_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "duration", ",", "OvhAccountQuotaEnum", "newQuota", ",", "String", "primaryEmailAddress",...
Get prices and contracts information REST: GET /order/email/exchange/{organizationName}/service/{exchangeService}/accountUpgrade/{duration} @param newQuota [required] New storage quota for that account @param primaryEmailAddress [required] The account you wish to upgrade @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param duration [required] Duration
[ "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#L3984-L3991
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java
DomUtil.filterNodeListByName
public static List<DomElement> filterNodeListByName(NodeList nodeList, String namespaceUri, String localName) { return filterNodeList(nodeList, new ElementByNameListFilter(localName, namespaceUri)); }
java
public static List<DomElement> filterNodeListByName(NodeList nodeList, String namespaceUri, String localName) { return filterNodeList(nodeList, new ElementByNameListFilter(localName, namespaceUri)); }
[ "public", "static", "List", "<", "DomElement", ">", "filterNodeListByName", "(", "NodeList", "nodeList", ",", "String", "namespaceUri", ",", "String", "localName", ")", "{", "return", "filterNodeList", "(", "nodeList", ",", "new", "ElementByNameListFilter", "(", "...
Filter a {@link NodeList} retaining all elements with a specific name @param nodeList the {@link NodeList} to filter @param namespaceUri the namespace for the elements @param localName the local element name to filter for @return the List of all Elements which match the filter
[ "Filter", "a", "{", "@link", "NodeList", "}", "retaining", "all", "elements", "with", "a", "specific", "name" ]
train
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java#L170-L172
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseReadTimeout
private void parseReadTimeout(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_READ_TIMEOUT); if (null != value) { try { this.readTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Read timeout is " + getReadTimeout()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseReadTimeout", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid read timeout; " + value); } } } }
java
private void parseReadTimeout(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_READ_TIMEOUT); if (null != value) { try { this.readTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Read timeout is " + getReadTimeout()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseReadTimeout", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid read timeout; " + value); } } } }
[ "private", "void", "parseReadTimeout", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_READ_TIMEOUT", ")", ";", "if", "(", "null", "!=", "value", ")",...
Check the input configuration for the timeout to use when doing any read during a connection. @param props
[ "Check", "the", "input", "configuration", "for", "the", "timeout", "to", "use", "when", "doing", "any", "read", "during", "a", "connection", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L658-L673
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java
br_broker.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { br_broker_responses result = (br_broker_responses) service.get_payload_formatter().string_to_resource(br_broker_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_broker_response_array); } br_broker[] result_br_broker = new br_broker[result.br_broker_response_array.length]; for(int i = 0; i < result.br_broker_response_array.length; i++) { result_br_broker[i] = result.br_broker_response_array[i].br_broker[0]; } return result_br_broker; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { br_broker_responses result = (br_broker_responses) service.get_payload_formatter().string_to_resource(br_broker_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_broker_response_array); } br_broker[] result_br_broker = new br_broker[result.br_broker_response_array.length]; for(int i = 0; i < result.br_broker_response_array.length; i++) { result_br_broker[i] = result.br_broker_response_array[i].br_broker[0]; } return result_br_broker; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "br_broker_responses", "result", "=", "(", "br_broker_responses", ")", "service", ".", "get_payload_formatter"...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java#L688-L705
google/closure-compiler
src/com/google/javascript/jscomp/TypedCodeGenerator.java
TypedCodeGenerator.getParameterJSDocName
private String getParameterJSDocName(Node paramNode, int paramIndex) { Node nameNode = null; if (paramNode != null) { checkArgument(paramNode.getParent().isParamList(), paramNode); if (paramNode.isRest()) { // use `restParam` of `...restParam` // restParam might still be a destructuring pattern paramNode = paramNode.getOnlyChild(); } else if (paramNode.isDefaultValue()) { // use `defaultParam` of `defaultParam = something` // defaultParam might still be a destructuring pattern paramNode = paramNode.getFirstChild(); } if (paramNode.isName()) { nameNode = paramNode; } else { checkState(paramNode.isObjectPattern() || paramNode.isArrayPattern(), paramNode); nameNode = null; // must generate a fake name } } if (nameNode == null) { return "p" + paramIndex; } else { checkState(nameNode.isName(), nameNode); return nameNode.getString(); } }
java
private String getParameterJSDocName(Node paramNode, int paramIndex) { Node nameNode = null; if (paramNode != null) { checkArgument(paramNode.getParent().isParamList(), paramNode); if (paramNode.isRest()) { // use `restParam` of `...restParam` // restParam might still be a destructuring pattern paramNode = paramNode.getOnlyChild(); } else if (paramNode.isDefaultValue()) { // use `defaultParam` of `defaultParam = something` // defaultParam might still be a destructuring pattern paramNode = paramNode.getFirstChild(); } if (paramNode.isName()) { nameNode = paramNode; } else { checkState(paramNode.isObjectPattern() || paramNode.isArrayPattern(), paramNode); nameNode = null; // must generate a fake name } } if (nameNode == null) { return "p" + paramIndex; } else { checkState(nameNode.isName(), nameNode); return nameNode.getString(); } }
[ "private", "String", "getParameterJSDocName", "(", "Node", "paramNode", ",", "int", "paramIndex", ")", "{", "Node", "nameNode", "=", "null", ";", "if", "(", "paramNode", "!=", "null", ")", "{", "checkArgument", "(", "paramNode", ".", "getParent", "(", ")", ...
Return the name of the parameter to be used in JSDoc, generating one for destructuring parameters. @param paramNode child node of a parameter list @param paramIndex position of child in the list @return name to use in JSDoc
[ "Return", "the", "name", "of", "the", "parameter", "to", "be", "used", "in", "JSDoc", "generating", "one", "for", "destructuring", "parameters", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedCodeGenerator.java#L308-L334
groupon/odo
proxyserver/src/main/java/com/groupon/odo/Proxy.java
Proxy.getApplicablePathNames
private JSONArray getApplicablePathNames (String requestUrl, Integer requestType) throws Exception { RequestInformation requestInfo = requestInformation.get(); List<EndpointOverride> applicablePaths; JSONArray pathNames = new JSONArray(); // Get all paths that match the request applicablePaths = PathOverrideService.getInstance().getSelectedPaths(Constants.OVERRIDE_TYPE_REQUEST, requestInfo.client, requestInfo.profile, requestUrl + "?" + requestInfo.originalRequestInfo.getQueryString(), requestType, true); // Extract just the path name from each path for (EndpointOverride path : applicablePaths) { JSONObject pathName = new JSONObject(); pathName.put("name", path.getPathName()); pathNames.put(pathName); } return pathNames; }
java
private JSONArray getApplicablePathNames (String requestUrl, Integer requestType) throws Exception { RequestInformation requestInfo = requestInformation.get(); List<EndpointOverride> applicablePaths; JSONArray pathNames = new JSONArray(); // Get all paths that match the request applicablePaths = PathOverrideService.getInstance().getSelectedPaths(Constants.OVERRIDE_TYPE_REQUEST, requestInfo.client, requestInfo.profile, requestUrl + "?" + requestInfo.originalRequestInfo.getQueryString(), requestType, true); // Extract just the path name from each path for (EndpointOverride path : applicablePaths) { JSONObject pathName = new JSONObject(); pathName.put("name", path.getPathName()); pathNames.put(pathName); } return pathNames; }
[ "private", "JSONArray", "getApplicablePathNames", "(", "String", "requestUrl", ",", "Integer", "requestType", ")", "throws", "Exception", "{", "RequestInformation", "requestInfo", "=", "requestInformation", ".", "get", "(", ")", ";", "List", "<", "EndpointOverride", ...
Get the names of the paths that would apply to the request @param requestUrl URL of the request @param requestType Type of the request: GET, POST, PUT, or DELETE as integer @return JSONArray of path names @throws Exception
[ "Get", "the", "names", "of", "the", "paths", "that", "would", "apply", "to", "the", "request" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyserver/src/main/java/com/groupon/odo/Proxy.java#L551-L568
rjeschke/txtmark
src/main/java/com/github/rjeschke/txtmark/Emitter.java
Emitter.emitLines
private void emitLines(final StringBuilder out, final Block block) { switch (block.type) { case CODE: this.emitCodeLines(out, block.lines, block.meta, true); break; case FENCED_CODE: this.emitCodeLines(out, block.lines, block.meta, false); break; case XML: this.emitRawLines(out, block.lines); break; default: this.emitMarkedLines(out, block.lines); break; } }
java
private void emitLines(final StringBuilder out, final Block block) { switch (block.type) { case CODE: this.emitCodeLines(out, block.lines, block.meta, true); break; case FENCED_CODE: this.emitCodeLines(out, block.lines, block.meta, false); break; case XML: this.emitRawLines(out, block.lines); break; default: this.emitMarkedLines(out, block.lines); break; } }
[ "private", "void", "emitLines", "(", "final", "StringBuilder", "out", ",", "final", "Block", "block", ")", "{", "switch", "(", "block", ".", "type", ")", "{", "case", "CODE", ":", "this", ".", "emitCodeLines", "(", "out", ",", "block", ".", "lines", ",...
Transforms lines into HTML. @param out The StringBuilder to write to. @param block The Block to process.
[ "Transforms", "lines", "into", "HTML", "." ]
train
https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Emitter.java#L172-L189
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
ServiceDiscoveryManager.supportsFeature
public boolean supportsFeature(Jid jid, CharSequence feature) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return supportsFeatures(jid, feature); }
java
public boolean supportsFeature(Jid jid, CharSequence feature) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return supportsFeatures(jid, feature); }
[ "public", "boolean", "supportsFeature", "(", "Jid", "jid", ",", "CharSequence", "feature", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "return", "supportsFeatures", "(", "jid", ",", "...
Queries the remote entity for it's features and returns true if the given feature is found. @param jid the JID of the remote entity @param feature @return true if the entity supports the feature, false otherwise @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Queries", "the", "remote", "entity", "for", "it", "s", "features", "and", "returns", "true", "if", "the", "given", "feature", "is", "found", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java#L647-L649
jparsec/jparsec
jparsec/src/main/java/org/jparsec/pattern/Patterns.java
Patterns.atLeast
public static Pattern atLeast(final int min, final CharPredicate predicate) { Checks.checkMin(min); return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { int minLen = RepeatCharPredicatePattern.matchRepeat(min, predicate, src, end, begin, 0); if (minLen == MISMATCH) return MISMATCH; return matchMany(predicate, src, end, begin + minLen, minLen); } @Override public String toString() { return (min > 1) ? (predicate + "{" + min + ",}") : (predicate + "+"); } }; }
java
public static Pattern atLeast(final int min, final CharPredicate predicate) { Checks.checkMin(min); return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { int minLen = RepeatCharPredicatePattern.matchRepeat(min, predicate, src, end, begin, 0); if (minLen == MISMATCH) return MISMATCH; return matchMany(predicate, src, end, begin + minLen, minLen); } @Override public String toString() { return (min > 1) ? (predicate + "{" + min + ",}") : (predicate + "+"); } }; }
[ "public", "static", "Pattern", "atLeast", "(", "final", "int", "min", ",", "final", "CharPredicate", "predicate", ")", "{", "Checks", ".", "checkMin", "(", "min", ")", ";", "return", "new", "Pattern", "(", ")", "{", "@", "Override", "public", "int", "mat...
Returns a {@link Pattern} object that matches if the input starts with {@code min} or more characters and all satisfy {@code predicate}. @since 2.2
[ "Returns", "a", "{" ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/pattern/Patterns.java#L369-L381
michael-rapp/AndroidMaterialDialog
library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java
DialogRootView.applyDialogPaddingRight
private void applyDialogPaddingRight(@NonNull final Area area, @NonNull final View view) { int padding = area != Area.HEADER && area != Area.BUTTON_BAR && area != Area.CONTENT ? dialogPadding[2] : 0; view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), padding, view.getPaddingBottom()); }
java
private void applyDialogPaddingRight(@NonNull final Area area, @NonNull final View view) { int padding = area != Area.HEADER && area != Area.BUTTON_BAR && area != Area.CONTENT ? dialogPadding[2] : 0; view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), padding, view.getPaddingBottom()); }
[ "private", "void", "applyDialogPaddingRight", "(", "@", "NonNull", "final", "Area", "area", ",", "@", "NonNull", "final", "View", "view", ")", "{", "int", "padding", "=", "area", "!=", "Area", ".", "HEADER", "&&", "area", "!=", "Area", ".", "BUTTON_BAR", ...
Applies the dialog's right padding to the view of a specific area. @param area The area, the view, the padding should be applied to, corresponds to, as an instance of the class {@link Area}. The area may not be null @param view The view, the padding should be applied to, as an instance of the class {@link View}. The view may not be null
[ "Applies", "the", "dialog", "s", "right", "padding", "to", "the", "view", "of", "a", "specific", "area", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java#L703-L708
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
ExecutionEnvironment.fromCollection
public <X> DataSource<X> fromCollection(Iterator<X> data, Class<X> type) { return fromCollection(data, TypeExtractor.getForClass(type)); }
java
public <X> DataSource<X> fromCollection(Iterator<X> data, Class<X> type) { return fromCollection(data, TypeExtractor.getForClass(type)); }
[ "public", "<", "X", ">", "DataSource", "<", "X", ">", "fromCollection", "(", "Iterator", "<", "X", ">", "data", ",", "Class", "<", "X", ">", "type", ")", "{", "return", "fromCollection", "(", "data", ",", "TypeExtractor", ".", "getForClass", "(", "type...
Creates a DataSet from the given iterator. Because the iterator will remain unmodified until the actual execution happens, the type of data returned by the iterator must be given explicitly in the form of the type class (this is due to the fact that the Java compiler erases the generic type information). <p>Note that this operation will result in a non-parallel data source, i.e. a data source with a parallelism of one. @param data The collection of elements to create the data set from. @param type The class of the data produced by the iterator. Must not be a generic class. @return A DataSet representing the elements in the iterator. @see #fromCollection(Iterator, TypeInformation)
[ "Creates", "a", "DataSet", "from", "the", "given", "iterator", ".", "Because", "the", "iterator", "will", "remain", "unmodified", "until", "the", "actual", "execution", "happens", "the", "type", "of", "data", "returned", "by", "the", "iterator", "must", "be", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L653-L655
Omertron/api-thetvdb
src/main/java/com/omertron/thetvdbapi/TheTVDBApi.java
TheTVDBApi.getEpisodeById
public Episode getEpisodeById(String episodeId, String language) throws TvDbException { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(BASE_URL) .append(apiKey) .append("/episodes/") .append(episodeId) .append("/"); if (StringUtils.isNotBlank(language)) { urlBuilder.append(language); urlBuilder.append(XML_EXTENSION); } LOG.trace(URL, urlBuilder.toString()); return TvdbParser.getEpisode(urlBuilder.toString()); }
java
public Episode getEpisodeById(String episodeId, String language) throws TvDbException { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(BASE_URL) .append(apiKey) .append("/episodes/") .append(episodeId) .append("/"); if (StringUtils.isNotBlank(language)) { urlBuilder.append(language); urlBuilder.append(XML_EXTENSION); } LOG.trace(URL, urlBuilder.toString()); return TvdbParser.getEpisode(urlBuilder.toString()); }
[ "public", "Episode", "getEpisodeById", "(", "String", "episodeId", ",", "String", "language", ")", "throws", "TvDbException", "{", "StringBuilder", "urlBuilder", "=", "new", "StringBuilder", "(", ")", ";", "urlBuilder", ".", "append", "(", "BASE_URL", ")", ".", ...
Get information for a specific episode @param episodeId @param language @return @throws com.omertron.thetvdbapi.TvDbException
[ "Get", "information", "for", "a", "specific", "episode" ]
train
https://github.com/Omertron/api-thetvdb/blob/2ff9f9580e76043f19d2fc3234d87e16a95fa485/src/main/java/com/omertron/thetvdbapi/TheTVDBApi.java#L373-L388