repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | TypeUtils.determineTypeArguments | public static Map<TypeVariable<?>, Type> determineTypeArguments(final Class<?> cls,
final ParameterizedType superType) {
Validate.notNull(cls, "cls is null");
Validate.notNull(superType, "superType is null");
final Class<?> superClass = getRawType(superType);
// compatibility check
if (!isAssignable(cls, superClass)) {
return null;
}
if (cls.equals(superClass)) {
return getTypeArguments(superType, superClass, null);
}
// get the next class in the inheritance hierarchy
final Type midType = getClosestParentType(cls, superClass);
// can only be a class or a parameterized type
if (midType instanceof Class<?>) {
return determineTypeArguments((Class<?>) midType, superType);
}
final ParameterizedType midParameterizedType = (ParameterizedType) midType;
final Class<?> midClass = getRawType(midParameterizedType);
// get the type variables of the mid class that map to the type
// arguments of the super class
final Map<TypeVariable<?>, Type> typeVarAssigns = determineTypeArguments(midClass, superType);
// map the arguments of the mid type to the class type variables
mapTypeVariablesToArguments(cls, midParameterizedType, typeVarAssigns);
return typeVarAssigns;
} | java | public static Map<TypeVariable<?>, Type> determineTypeArguments(final Class<?> cls,
final ParameterizedType superType) {
Validate.notNull(cls, "cls is null");
Validate.notNull(superType, "superType is null");
final Class<?> superClass = getRawType(superType);
// compatibility check
if (!isAssignable(cls, superClass)) {
return null;
}
if (cls.equals(superClass)) {
return getTypeArguments(superType, superClass, null);
}
// get the next class in the inheritance hierarchy
final Type midType = getClosestParentType(cls, superClass);
// can only be a class or a parameterized type
if (midType instanceof Class<?>) {
return determineTypeArguments((Class<?>) midType, superType);
}
final ParameterizedType midParameterizedType = (ParameterizedType) midType;
final Class<?> midClass = getRawType(midParameterizedType);
// get the type variables of the mid class that map to the type
// arguments of the super class
final Map<TypeVariable<?>, Type> typeVarAssigns = determineTypeArguments(midClass, superType);
// map the arguments of the mid type to the class type variables
mapTypeVariablesToArguments(cls, midParameterizedType, typeVarAssigns);
return typeVarAssigns;
} | [
"public",
"static",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
"Type",
">",
"determineTypeArguments",
"(",
"final",
"Class",
"<",
"?",
">",
"cls",
",",
"final",
"ParameterizedType",
"superType",
")",
"{",
"Validate",
".",
"notNull",
"(",
"cls",
",",
... | <p>Tries to determine the type arguments of a class/interface based on a
super parameterized type's type arguments. This method is the inverse of
{@link #getTypeArguments(Type, Class)} which gets a class/interface's
type arguments based on a subtype. It is far more limited in determining
the type arguments for the subject class's type variables in that it can
only determine those parameters that map from the subject {@link Class}
object to the supertype.</p> <p>Example: {@link java.util.TreeSet
TreeSet} sets its parameter as the parameter for
{@link java.util.NavigableSet NavigableSet}, which in turn sets the
parameter of {@link java.util.SortedSet}, which in turn sets the
parameter of {@link Set}, which in turn sets the parameter of
{@link java.util.Collection}, which in turn sets the parameter of
{@link java.lang.Iterable}. Since {@code TreeSet}'s parameter maps
(indirectly) to {@code Iterable}'s parameter, it will be able to
determine that based on the super type {@code Iterable<? extends
Map<Integer, ? extends Collection<?>>>}, the parameter of
{@code TreeSet} is {@code ? extends Map<Integer, ? extends
Collection<?>>}.</p>
@param cls the class whose type parameters are to be determined, not {@code null}
@param superType the super type from which {@code cls}'s type
arguments are to be determined, not {@code null}
@return a {@code Map} of the type assignments that could be determined
for the type variables in each type in the inheritance hierarchy from
{@code type} to {@code toClass} inclusive. | [
"<p",
">",
"Tries",
"to",
"determine",
"the",
"type",
"arguments",
"of",
"a",
"class",
"/",
"interface",
"based",
"on",
"a",
"super",
"parameterized",
"type",
"s",
"type",
"arguments",
".",
"This",
"method",
"is",
"the",
"inverse",
"of",
"{",
"@link",
"#... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java#L963-L996 |
JodaOrg/joda-time | src/main/java/org/joda/time/LocalDate.java | LocalDate.toDateTimeAtStartOfDay | public DateTime toDateTimeAtStartOfDay(DateTimeZone zone) {
zone = DateTimeUtils.getZone(zone);
Chronology chrono = getChronology().withZone(zone);
long localMillis = getLocalMillis() + 6L * DateTimeConstants.MILLIS_PER_HOUR;
long instant = zone.convertLocalToUTC(localMillis, false);
instant = chrono.dayOfMonth().roundFloor(instant);
return new DateTime(instant, chrono).withEarlierOffsetAtOverlap();
} | java | public DateTime toDateTimeAtStartOfDay(DateTimeZone zone) {
zone = DateTimeUtils.getZone(zone);
Chronology chrono = getChronology().withZone(zone);
long localMillis = getLocalMillis() + 6L * DateTimeConstants.MILLIS_PER_HOUR;
long instant = zone.convertLocalToUTC(localMillis, false);
instant = chrono.dayOfMonth().roundFloor(instant);
return new DateTime(instant, chrono).withEarlierOffsetAtOverlap();
} | [
"public",
"DateTime",
"toDateTimeAtStartOfDay",
"(",
"DateTimeZone",
"zone",
")",
"{",
"zone",
"=",
"DateTimeUtils",
".",
"getZone",
"(",
"zone",
")",
";",
"Chronology",
"chrono",
"=",
"getChronology",
"(",
")",
".",
"withZone",
"(",
"zone",
")",
";",
"long"... | Converts this LocalDate to a full datetime at the earliest valid time
for the date using the specified time zone.
<p>
The time will normally be midnight, as that is the earliest time on
any given day. However, in some time zones when Daylight Savings Time
starts, there is no midnight because time jumps from 11:59 to 01:00.
This method handles that situation by returning 01:00 on that date.
<p>
This method uses the chronology from this instance plus the time zone
specified.
<p>
This instance is immutable and unaffected by this method call.
@param zone the zone to use, null means default zone
@return this date as a datetime at the start of the day
@since 1.5 | [
"Converts",
"this",
"LocalDate",
"to",
"a",
"full",
"datetime",
"at",
"the",
"earliest",
"valid",
"time",
"for",
"the",
"date",
"using",
"the",
"specified",
"time",
"zone",
".",
"<p",
">",
"The",
"time",
"will",
"normally",
"be",
"midnight",
"as",
"that",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDate.java#L727-L734 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java | CouchDbClient.executeToResponse | public Response executeToResponse(HttpConnection connection) {
InputStream is = null;
try {
is = this.executeToInputStream(connection);
Response response = getResponse(is, Response.class, getGson());
response.setStatusCode(connection.getConnection().getResponseCode());
response.setReason(connection.getConnection().getResponseMessage());
return response;
} catch (IOException e) {
throw new CouchDbException("Error retrieving response code or message.", e);
} finally {
close(is);
}
} | java | public Response executeToResponse(HttpConnection connection) {
InputStream is = null;
try {
is = this.executeToInputStream(connection);
Response response = getResponse(is, Response.class, getGson());
response.setStatusCode(connection.getConnection().getResponseCode());
response.setReason(connection.getConnection().getResponseMessage());
return response;
} catch (IOException e) {
throw new CouchDbException("Error retrieving response code or message.", e);
} finally {
close(is);
}
} | [
"public",
"Response",
"executeToResponse",
"(",
"HttpConnection",
"connection",
")",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"this",
".",
"executeToInputStream",
"(",
"connection",
")",
";",
"Response",
"response",
"=",
"getResponse",
... | Executes a HTTP request and parses the JSON response into a Response instance.
@param connection The HTTP request to execute.
@return Response object of the deserialized JSON response | [
"Executes",
"a",
"HTTP",
"request",
"and",
"parses",
"the",
"JSON",
"response",
"into",
"a",
"Response",
"instance",
"."
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java#L356-L369 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/JSMinPostProcessor.java | JSMinPostProcessor.minifyStringBuffer | public StringBuffer minifyStringBuffer(StringBuffer sb, Charset charset) throws IOException, JSMinException {
byte[] bundleBytes = sb.toString().getBytes(charset.name());
ByteArrayInputStream bIs = new ByteArrayInputStream(bundleBytes);
ByteArrayOutputStream bOs = new ByteArrayOutputStream();
// Compress data and recover it as a byte array.
JSMin minifier = new JSMin(bIs, bOs);
minifier.jsmin();
byte[] minified = bOs.toByteArray();
return byteArrayToString(charset, minified);
} | java | public StringBuffer minifyStringBuffer(StringBuffer sb, Charset charset) throws IOException, JSMinException {
byte[] bundleBytes = sb.toString().getBytes(charset.name());
ByteArrayInputStream bIs = new ByteArrayInputStream(bundleBytes);
ByteArrayOutputStream bOs = new ByteArrayOutputStream();
// Compress data and recover it as a byte array.
JSMin minifier = new JSMin(bIs, bOs);
minifier.jsmin();
byte[] minified = bOs.toByteArray();
return byteArrayToString(charset, minified);
} | [
"public",
"StringBuffer",
"minifyStringBuffer",
"(",
"StringBuffer",
"sb",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
",",
"JSMinException",
"{",
"byte",
"[",
"]",
"bundleBytes",
"=",
"sb",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
"charse... | Utility method for components that need to use JSMin in a different
context other than bundle postprocessing.
@param sb
the content to minify
@param charset
the charset
@return the minified content
@throws java.io.IOException
if an IOException occurs
@throws net.jawr.web.minification.JSMin.JSMinException
if a JSMin exception occurs | [
"Utility",
"method",
"for",
"components",
"that",
"need",
"to",
"use",
"JSMin",
"in",
"a",
"different",
"context",
"other",
"than",
"bundle",
"postprocessing",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/JSMinPostProcessor.java#L100-L110 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.copyToUnsafe | public final void copyToUnsafe(int offset, Object target, int targetPointer, int numBytes) {
final long thisPointer = this.address + offset;
if (thisPointer + numBytes > addressLimit) {
throw new IndexOutOfBoundsException(
String.format("offset=%d, numBytes=%d, address=%d",
offset, numBytes, this.address));
}
UNSAFE.copyMemory(this.heapMemory, thisPointer, target, targetPointer, numBytes);
} | java | public final void copyToUnsafe(int offset, Object target, int targetPointer, int numBytes) {
final long thisPointer = this.address + offset;
if (thisPointer + numBytes > addressLimit) {
throw new IndexOutOfBoundsException(
String.format("offset=%d, numBytes=%d, address=%d",
offset, numBytes, this.address));
}
UNSAFE.copyMemory(this.heapMemory, thisPointer, target, targetPointer, numBytes);
} | [
"public",
"final",
"void",
"copyToUnsafe",
"(",
"int",
"offset",
",",
"Object",
"target",
",",
"int",
"targetPointer",
",",
"int",
"numBytes",
")",
"{",
"final",
"long",
"thisPointer",
"=",
"this",
".",
"address",
"+",
"offset",
";",
"if",
"(",
"thisPointe... | Bulk copy method. Copies {@code numBytes} bytes to target unsafe object and pointer.
NOTE: This is a unsafe method, no check here, please be carefully.
@param offset The position where the bytes are started to be read from in this memory segment.
@param target The unsafe memory to copy the bytes to.
@param targetPointer The position in the target unsafe memory to copy the chunk to.
@param numBytes The number of bytes to copy.
@throws IndexOutOfBoundsException If the source segment does not contain the given number
of bytes (starting from offset). | [
"Bulk",
"copy",
"method",
".",
"Copies",
"{",
"@code",
"numBytes",
"}",
"bytes",
"to",
"target",
"unsafe",
"object",
"and",
"pointer",
".",
"NOTE",
":",
"This",
"is",
"a",
"unsafe",
"method",
"no",
"check",
"here",
"please",
"be",
"carefully",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L1285-L1293 |
aws/aws-sdk-java | aws-java-sdk-marketplaceentitlement/src/main/java/com/amazonaws/services/marketplaceentitlement/model/GetEntitlementsRequest.java | GetEntitlementsRequest.setFilter | public void setFilter(java.util.Map<String, java.util.List<String>> filter) {
this.filter = filter;
} | java | public void setFilter(java.util.Map<String, java.util.List<String>> filter) {
this.filter = filter;
} | [
"public",
"void",
"setFilter",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"filter",
")",
"{",
"this",
".",
"filter",
"=",
"filter",
";",
"}"
] | <p>
Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are described
as keys mapped to a lists of values. Filtered requests are <i>unioned</i> for each value in the value list, and
then <i>intersected</i> for each filter key.
</p>
@param filter
Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are
described as keys mapped to a lists of values. Filtered requests are <i>unioned</i> for each value in the
value list, and then <i>intersected</i> for each filter key. | [
"<p",
">",
"Filter",
"is",
"used",
"to",
"return",
"entitlements",
"for",
"a",
"specific",
"customer",
"or",
"for",
"a",
"specific",
"dimension",
".",
"Filters",
"are",
"described",
"as",
"keys",
"mapped",
"to",
"a",
"lists",
"of",
"values",
".",
"Filtered... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-marketplaceentitlement/src/main/java/com/amazonaws/services/marketplaceentitlement/model/GetEntitlementsRequest.java#L135-L137 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java | ScopedServletUtils.getRelativeURI | public static final String getRelativeURI( HttpServletRequest request, String uri )
{
return getRelativeURI( request.getContextPath(), uri );
} | java | public static final String getRelativeURI( HttpServletRequest request, String uri )
{
return getRelativeURI( request.getContextPath(), uri );
} | [
"public",
"static",
"final",
"String",
"getRelativeURI",
"(",
"HttpServletRequest",
"request",
",",
"String",
"uri",
")",
"{",
"return",
"getRelativeURI",
"(",
"request",
".",
"getContextPath",
"(",
")",
",",
"uri",
")",
";",
"}"
] | Get a URI relative to the webapp root.
@param request the current HttpServletRequest.
@param uri the URI which should be made relative. | [
"Get",
"a",
"URI",
"relative",
"to",
"the",
"webapp",
"root",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java#L384-L387 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java | OptimalCECPMain.permuteAFPChain | private static void permuteAFPChain(AFPChain afpChain, int cp) {
int ca2len = afpChain.getCa2Length();
//fix up cp to be positive
if(cp == 0) {
return;
}
if(cp < 0) {
cp = ca2len+cp;
}
if(cp < 0 || cp >= ca2len) {
throw new ArrayIndexOutOfBoundsException(
"Permutation point ("+cp+") must be between -ca2.length and ca2.length-1" );
}
// Fix up optAln
permuteOptAln(afpChain,cp);
if(afpChain.getBlockNum() > 1)
afpChain.setSequentialAlignment(false);
// fix up matrices
// ca1 corresponds to row indices, while ca2 corresponds to column indices.
afpChain.setDistanceMatrix(permuteMatrix(afpChain.getDistanceMatrix(),0,-cp));
// this is square, so permute both
afpChain.setDisTable2(permuteMatrix(afpChain.getDisTable2(),-cp,-cp));
//TODO fix up other AFP parameters?
} | java | private static void permuteAFPChain(AFPChain afpChain, int cp) {
int ca2len = afpChain.getCa2Length();
//fix up cp to be positive
if(cp == 0) {
return;
}
if(cp < 0) {
cp = ca2len+cp;
}
if(cp < 0 || cp >= ca2len) {
throw new ArrayIndexOutOfBoundsException(
"Permutation point ("+cp+") must be between -ca2.length and ca2.length-1" );
}
// Fix up optAln
permuteOptAln(afpChain,cp);
if(afpChain.getBlockNum() > 1)
afpChain.setSequentialAlignment(false);
// fix up matrices
// ca1 corresponds to row indices, while ca2 corresponds to column indices.
afpChain.setDistanceMatrix(permuteMatrix(afpChain.getDistanceMatrix(),0,-cp));
// this is square, so permute both
afpChain.setDisTable2(permuteMatrix(afpChain.getDisTable2(),-cp,-cp));
//TODO fix up other AFP parameters?
} | [
"private",
"static",
"void",
"permuteAFPChain",
"(",
"AFPChain",
"afpChain",
",",
"int",
"cp",
")",
"{",
"int",
"ca2len",
"=",
"afpChain",
".",
"getCa2Length",
"(",
")",
";",
"//fix up cp to be positive",
"if",
"(",
"cp",
"==",
"0",
")",
"{",
"return",
";"... | Permute the second protein of afpChain by the specified number of residues.
@param afpChain Input alignment
@param cp Amount leftwards (or rightward, if negative) to shift the
@return A new alignment equivalent to afpChain after the permutations | [
"Permute",
"the",
"second",
"protein",
"of",
"afpChain",
"by",
"the",
"specified",
"number",
"of",
"residues",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java#L217-L246 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java | ReadOnlyStyledDocument.summaryProvider | private static <PS, SEG, S> ToSemigroup<Paragraph<PS, SEG, S>, Summary> summaryProvider() {
return new ToSemigroup<Paragraph<PS, SEG, S>, Summary>() {
@Override
public Summary apply(Paragraph<PS, SEG, S> p) {
return new Summary(1, p.length());
}
@Override
public Summary reduce(Summary left, Summary right) {
return new Summary(
left.paragraphCount + right.paragraphCount,
left.charCount + right.charCount);
}
};
} | java | private static <PS, SEG, S> ToSemigroup<Paragraph<PS, SEG, S>, Summary> summaryProvider() {
return new ToSemigroup<Paragraph<PS, SEG, S>, Summary>() {
@Override
public Summary apply(Paragraph<PS, SEG, S> p) {
return new Summary(1, p.length());
}
@Override
public Summary reduce(Summary left, Summary right) {
return new Summary(
left.paragraphCount + right.paragraphCount,
left.charCount + right.charCount);
}
};
} | [
"private",
"static",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"ToSemigroup",
"<",
"Paragraph",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
",",
"Summary",
">",
"summaryProvider",
"(",
")",
"{",
"return",
"new",
"ToSemigroup",
"<",
"Paragraph",
"<",
"PS",
",",... | Private method for quickly calculating the length of a portion (subdocument) of this document. | [
"Private",
"method",
"for",
"quickly",
"calculating",
"the",
"length",
"of",
"a",
"portion",
"(",
"subdocument",
")",
"of",
"this",
"document",
"."
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java#L64-L80 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/mapped/MappedDeleteCollection.java | MappedDeleteCollection.deleteIds | public static <T, ID> int deleteIds(Dao<T, ID> dao, TableInfo<T, ID> tableInfo,
DatabaseConnection databaseConnection, Collection<ID> ids, ObjectCache objectCache) throws SQLException {
MappedDeleteCollection<T, ID> deleteCollection = MappedDeleteCollection.build(dao, tableInfo, ids.size());
Object[] fieldObjects = new Object[ids.size()];
FieldType idField = tableInfo.getIdField();
int objC = 0;
for (ID id : ids) {
fieldObjects[objC] = idField.convertJavaFieldToSqlArgValue(id);
objC++;
}
return updateRows(databaseConnection, tableInfo.getDataClass(), deleteCollection, fieldObjects, objectCache);
} | java | public static <T, ID> int deleteIds(Dao<T, ID> dao, TableInfo<T, ID> tableInfo,
DatabaseConnection databaseConnection, Collection<ID> ids, ObjectCache objectCache) throws SQLException {
MappedDeleteCollection<T, ID> deleteCollection = MappedDeleteCollection.build(dao, tableInfo, ids.size());
Object[] fieldObjects = new Object[ids.size()];
FieldType idField = tableInfo.getIdField();
int objC = 0;
for (ID id : ids) {
fieldObjects[objC] = idField.convertJavaFieldToSqlArgValue(id);
objC++;
}
return updateRows(databaseConnection, tableInfo.getDataClass(), deleteCollection, fieldObjects, objectCache);
} | [
"public",
"static",
"<",
"T",
",",
"ID",
">",
"int",
"deleteIds",
"(",
"Dao",
"<",
"T",
",",
"ID",
">",
"dao",
",",
"TableInfo",
"<",
"T",
",",
"ID",
">",
"tableInfo",
",",
"DatabaseConnection",
"databaseConnection",
",",
"Collection",
"<",
"ID",
">",
... | Delete all of the objects in the collection. This builds a {@link MappedDeleteCollection} on the fly because the
ids could be variable sized. | [
"Delete",
"all",
"of",
"the",
"objects",
"in",
"the",
"collection",
".",
"This",
"builds",
"a",
"{"
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/mapped/MappedDeleteCollection.java#L47-L58 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/ST_ConstrainedDelaunay.java | ST_ConstrainedDelaunay.createCDT | public static GeometryCollection createCDT(Geometry geometry, int flag) throws SQLException {
if (geometry != null) {
DelaunayData delaunayData = new DelaunayData();
delaunayData.put(geometry, DelaunayData.MODE.CONSTRAINED);
delaunayData.triangulate();
if (flag == 0) {
return delaunayData.getTriangles();
} else if (flag == 1) {
return delaunayData.getTrianglesSides();
} else {
throw new SQLException("Only flag 0 or 1 is supported.");
}
}
return null;
} | java | public static GeometryCollection createCDT(Geometry geometry, int flag) throws SQLException {
if (geometry != null) {
DelaunayData delaunayData = new DelaunayData();
delaunayData.put(geometry, DelaunayData.MODE.CONSTRAINED);
delaunayData.triangulate();
if (flag == 0) {
return delaunayData.getTriangles();
} else if (flag == 1) {
return delaunayData.getTrianglesSides();
} else {
throw new SQLException("Only flag 0 or 1 is supported.");
}
}
return null;
} | [
"public",
"static",
"GeometryCollection",
"createCDT",
"(",
"Geometry",
"geometry",
",",
"int",
"flag",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometry",
"!=",
"null",
")",
"{",
"DelaunayData",
"delaunayData",
"=",
"new",
"DelaunayData",
"(",
")",
";"... | Build a constrained delaunay triangulation based on a geometry
(point, line, polygon)
@param geometry
@param flag
@return a set of polygons (triangles)
@throws SQLException | [
"Build",
"a",
"constrained",
"delaunay",
"triangulation",
"based",
"on",
"a",
"geometry",
"(",
"point",
"line",
"polygon",
")"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/ST_ConstrainedDelaunay.java#L71-L85 |
google/closure-compiler | src/com/google/javascript/jscomp/RemoveUnusedCode.java | RemoveUnusedCode.createPolyfillInfo | private PolyfillInfo createPolyfillInfo(Node call, Scope scope, String name) {
checkState(scope.isGlobal());
checkState(call.getParent().isExprResult());
// Make the removable and polyfill info. Add continuations for all arguments.
RemovableBuilder builder = new RemovableBuilder();
for (Node n = call.getFirstChild().getNext(); n != null; n = n.getNext()) {
builder.addContinuation(new Continuation(n, scope));
}
Polyfill removable = builder.buildPolyfill(call.getParent());
int lastDot = name.lastIndexOf(".");
if (lastDot < 0) {
return new GlobalPolyfillInfo(removable, name);
}
String owner = name.substring(0, lastDot);
String prop = name.substring(lastDot + 1);
boolean typed = call.getJSType() != null;
if (owner.endsWith(DOT_PROTOTYPE)) {
owner = owner.substring(0, owner.length() - DOT_PROTOTYPE.length());
return new PrototypePropertyPolyfillInfo(
removable, prop, typed ? compiler.getTypeRegistry().getType(scope, owner) : null);
}
ObjectType ownerInstanceType =
typed ? ObjectType.cast(compiler.getTypeRegistry().getType(scope, owner)) : null;
JSType ownerCtorType = ownerInstanceType != null ? ownerInstanceType.getConstructor() : null;
return new StaticPropertyPolyfillInfo(removable, prop, ownerCtorType, owner);
} | java | private PolyfillInfo createPolyfillInfo(Node call, Scope scope, String name) {
checkState(scope.isGlobal());
checkState(call.getParent().isExprResult());
// Make the removable and polyfill info. Add continuations for all arguments.
RemovableBuilder builder = new RemovableBuilder();
for (Node n = call.getFirstChild().getNext(); n != null; n = n.getNext()) {
builder.addContinuation(new Continuation(n, scope));
}
Polyfill removable = builder.buildPolyfill(call.getParent());
int lastDot = name.lastIndexOf(".");
if (lastDot < 0) {
return new GlobalPolyfillInfo(removable, name);
}
String owner = name.substring(0, lastDot);
String prop = name.substring(lastDot + 1);
boolean typed = call.getJSType() != null;
if (owner.endsWith(DOT_PROTOTYPE)) {
owner = owner.substring(0, owner.length() - DOT_PROTOTYPE.length());
return new PrototypePropertyPolyfillInfo(
removable, prop, typed ? compiler.getTypeRegistry().getType(scope, owner) : null);
}
ObjectType ownerInstanceType =
typed ? ObjectType.cast(compiler.getTypeRegistry().getType(scope, owner)) : null;
JSType ownerCtorType = ownerInstanceType != null ? ownerInstanceType.getConstructor() : null;
return new StaticPropertyPolyfillInfo(removable, prop, ownerCtorType, owner);
} | [
"private",
"PolyfillInfo",
"createPolyfillInfo",
"(",
"Node",
"call",
",",
"Scope",
"scope",
",",
"String",
"name",
")",
"{",
"checkState",
"(",
"scope",
".",
"isGlobal",
"(",
")",
")",
";",
"checkState",
"(",
"call",
".",
"getParent",
"(",
")",
".",
"is... | Makes a new PolyfillInfo, including the correct Removable. Parses the name to determine whether
this is a global, static, or prototype polyfill. | [
"Makes",
"a",
"new",
"PolyfillInfo",
"including",
"the",
"correct",
"Removable",
".",
"Parses",
"the",
"name",
"to",
"determine",
"whether",
"this",
"is",
"a",
"global",
"static",
"or",
"prototype",
"polyfill",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RemoveUnusedCode.java#L2625-L2650 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.delegatedAccount_email_filter_name_changePriority_POST | public OvhTaskFilter delegatedAccount_email_filter_name_changePriority_POST(String email, String name, Long priority) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/changePriority";
StringBuilder sb = path(qPath, email, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "priority", priority);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskFilter.class);
} | java | public OvhTaskFilter delegatedAccount_email_filter_name_changePriority_POST(String email, String name, Long priority) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/changePriority";
StringBuilder sb = path(qPath, email, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "priority", priority);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskFilter.class);
} | [
"public",
"OvhTaskFilter",
"delegatedAccount_email_filter_name_changePriority_POST",
"(",
"String",
"email",
",",
"String",
"name",
",",
"Long",
"priority",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/delegatedAccount/{email}/filter/{name}/change... | Change filter priority
REST: POST /email/domain/delegatedAccount/{email}/filter/{name}/changePriority
@param priority [required] New priority
@param email [required] Email
@param name [required] Filter name | [
"Change",
"filter",
"priority"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L144-L151 |
landawn/AbacusUtil | src/com/landawn/abacus/util/PropertiesUtil.java | PropertiesUtil.xml2Java | public static void xml2Java(File file, String srcPath, String packageName, String className, boolean isPublicField) {
InputStream is = null;
try {
is = new FileInputStream(file);
xml2Java(is, srcPath, packageName, className, isPublicField);
} catch (FileNotFoundException e) {
throw new UncheckedIOException(e);
} finally {
IOUtil.close(is);
}
} | java | public static void xml2Java(File file, String srcPath, String packageName, String className, boolean isPublicField) {
InputStream is = null;
try {
is = new FileInputStream(file);
xml2Java(is, srcPath, packageName, className, isPublicField);
} catch (FileNotFoundException e) {
throw new UncheckedIOException(e);
} finally {
IOUtil.close(is);
}
} | [
"public",
"static",
"void",
"xml2Java",
"(",
"File",
"file",
",",
"String",
"srcPath",
",",
"String",
"packageName",
",",
"String",
"className",
",",
"boolean",
"isPublicField",
")",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"new",... | Generate java code by the specified xml.
@param file
@param srcPath
@param packageName
@param className
@param isPublicField | [
"Generate",
"java",
"code",
"by",
"the",
"specified",
"xml",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/PropertiesUtil.java#L837-L849 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java | ContentSpecParser.processSpecContents | protected ParserResults processSpecContents(ParserData parserData, final boolean processProcesses) {
parserData.setCurrentLevel(parserData.getContentSpec().getBaseLevel());
boolean error = false;
while (parserData.getLines().peek() != null) {
parserData.setLineCount(parserData.getLineCount() + 1);
// Process the content specification and print an error message if an error occurs
try {
if (!parseLine(parserData, parserData.getLines().poll(), parserData.getLineCount())) {
error = true;
}
} catch (IndentationException e) {
log.error(e.getMessage());
return new ParserResults(false, null);
}
}
// Before validating the content specification, processes should be loaded first so that the
// relationships and targets are created
if (processProcesses) {
for (final Process process : parserData.getProcesses()) {
process.processTopics(parserData.getSpecTopics(), parserData.getTargetTopics(), topicProvider, serverSettingsProvider);
}
}
// Setup the relationships
processRelationships(parserData);
return new ParserResults(!error, parserData.getContentSpec());
} | java | protected ParserResults processSpecContents(ParserData parserData, final boolean processProcesses) {
parserData.setCurrentLevel(parserData.getContentSpec().getBaseLevel());
boolean error = false;
while (parserData.getLines().peek() != null) {
parserData.setLineCount(parserData.getLineCount() + 1);
// Process the content specification and print an error message if an error occurs
try {
if (!parseLine(parserData, parserData.getLines().poll(), parserData.getLineCount())) {
error = true;
}
} catch (IndentationException e) {
log.error(e.getMessage());
return new ParserResults(false, null);
}
}
// Before validating the content specification, processes should be loaded first so that the
// relationships and targets are created
if (processProcesses) {
for (final Process process : parserData.getProcesses()) {
process.processTopics(parserData.getSpecTopics(), parserData.getTargetTopics(), topicProvider, serverSettingsProvider);
}
}
// Setup the relationships
processRelationships(parserData);
return new ParserResults(!error, parserData.getContentSpec());
} | [
"protected",
"ParserResults",
"processSpecContents",
"(",
"ParserData",
"parserData",
",",
"final",
"boolean",
"processProcesses",
")",
"{",
"parserData",
".",
"setCurrentLevel",
"(",
"parserData",
".",
"getContentSpec",
"(",
")",
".",
"getBaseLevel",
"(",
")",
")",... | Process the contents of a content specification and parse it into a ContentSpec object.
@param parserData
@param processProcesses If processes should be processed to populate the relationships.
@return True if the contents were processed successfully otherwise false. | [
"Process",
"the",
"contents",
"of",
"a",
"content",
"specification",
"and",
"parse",
"it",
"into",
"a",
"ContentSpec",
"object",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L375-L403 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java | AbstractJsonDeserializer.getStringParam | protected String getStringParam(String paramName, String errorMessage)
throws IOException {
return getStringParam(paramName, errorMessage, (Map<String, Object>) inputParams.get());
} | java | protected String getStringParam(String paramName, String errorMessage)
throws IOException {
return getStringParam(paramName, errorMessage, (Map<String, Object>) inputParams.get());
} | [
"protected",
"String",
"getStringParam",
"(",
"String",
"paramName",
",",
"String",
"errorMessage",
")",
"throws",
"IOException",
"{",
"return",
"getStringParam",
"(",
"paramName",
",",
"errorMessage",
",",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"... | Convenience method for subclasses. Uses the default map for parameterinput
@param paramName the name of the parameter
@param errorMessage the errormessage to add to the exception if the param does not exist.
@return a stringparameter with given name. If it does not exist and the errormessage is provided,
an IOException is thrown with that message. if the errormessage is not provided, null is returned.
@throws IOException Exception if the paramname does not exist and an errormessage is provided. | [
"Convenience",
"method",
"for",
"subclasses",
".",
"Uses",
"the",
"default",
"map",
"for",
"parameterinput"
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L110-L113 |
lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newWasInvalidatedBy | public WasInvalidatedBy newWasInvalidatedBy(QualifiedName id, QualifiedName entity, QualifiedName activity, XMLGregorianCalendar time, Collection<Attribute> attributes) {
WasInvalidatedBy res=newWasInvalidatedBy(id,entity,activity);
res.setTime(time);
setAttributes(res, attributes);
return res;
} | java | public WasInvalidatedBy newWasInvalidatedBy(QualifiedName id, QualifiedName entity, QualifiedName activity, XMLGregorianCalendar time, Collection<Attribute> attributes) {
WasInvalidatedBy res=newWasInvalidatedBy(id,entity,activity);
res.setTime(time);
setAttributes(res, attributes);
return res;
} | [
"public",
"WasInvalidatedBy",
"newWasInvalidatedBy",
"(",
"QualifiedName",
"id",
",",
"QualifiedName",
"entity",
",",
"QualifiedName",
"activity",
",",
"XMLGregorianCalendar",
"time",
",",
"Collection",
"<",
"Attribute",
">",
"attributes",
")",
"{",
"WasInvalidatedBy",
... | /* (non-Javadoc)
@see org.openprovenance.prov.model.ModelConstructor#newWasInvalidatedBy(org.openprovenance.model.QualifiedName, org.openprovenance.model.QualifiedName, org.openprovenance.model.QualifiedName, javax.xml.datatype.XMLGregorianCalendar, java.util.Collection) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L1470-L1475 |
EdwardRaff/JSAT | JSAT/src/jsat/math/optimization/ModifiedOWLQN.java | ModifiedOWLQN.setBeta | public void setBeta(double beta)
{
if(beta <= 0 || beta >= 1 || Double.isNaN(beta))
throw new IllegalArgumentException("shrinkage term must be in (0, 1), not " + beta);
this.beta = beta;
} | java | public void setBeta(double beta)
{
if(beta <= 0 || beta >= 1 || Double.isNaN(beta))
throw new IllegalArgumentException("shrinkage term must be in (0, 1), not " + beta);
this.beta = beta;
} | [
"public",
"void",
"setBeta",
"(",
"double",
"beta",
")",
"{",
"if",
"(",
"beta",
"<=",
"0",
"||",
"beta",
">=",
"1",
"||",
"Double",
".",
"isNaN",
"(",
"beta",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"shrinkage term must be in (0, 1), no... | Sets the shrinkage term used for the line search.
@param beta the line search shrinkage term | [
"Sets",
"the",
"shrinkage",
"term",
"used",
"for",
"the",
"line",
"search",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/ModifiedOWLQN.java#L176-L181 |
FXMisc/WellBehavedFX | src/main/java/org/fxmisc/wellbehaved/event/Nodes.java | Nodes.pushInputMap | public static void pushInputMap(Node node, InputMap<?> im) {
// store currently installed im; getInputMap calls init
InputMap<?> previousInputMap = getInputMap(node);
getStack(node).push(previousInputMap);
// completely override the previous one with the given one
setInputMapUnsafe(node, im);
} | java | public static void pushInputMap(Node node, InputMap<?> im) {
// store currently installed im; getInputMap calls init
InputMap<?> previousInputMap = getInputMap(node);
getStack(node).push(previousInputMap);
// completely override the previous one with the given one
setInputMapUnsafe(node, im);
} | [
"public",
"static",
"void",
"pushInputMap",
"(",
"Node",
"node",
",",
"InputMap",
"<",
"?",
">",
"im",
")",
"{",
"// store currently installed im; getInputMap calls init",
"InputMap",
"<",
"?",
">",
"previousInputMap",
"=",
"getInputMap",
"(",
"node",
")",
";",
... | Removes the currently installed {@link InputMap} (InputMap1) on the given node and installs the {@code im}
(InputMap2) in its place. When finished, InputMap2 can be uninstalled and InputMap1 reinstalled via
{@link #popInputMap(Node)}. Multiple InputMaps can be installed so that InputMap(n) will be installed over
InputMap(n-1) | [
"Removes",
"the",
"currently",
"installed",
"{"
] | train | https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/Nodes.java#L88-L95 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.sumCols | public static DMatrixRMaj sumCols(DMatrixRMaj input , DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(1,input.numCols);
} else {
output.reshape(1,input.numCols);
}
for( int cols = 0; cols < input.numCols; cols++ ) {
double total = 0;
int index = cols;
int end = index + input.numCols*input.numRows;
for( ; index < end; index += input.numCols ) {
total += input.data[index];
}
output.set(cols, total);
}
return output;
} | java | public static DMatrixRMaj sumCols(DMatrixRMaj input , DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(1,input.numCols);
} else {
output.reshape(1,input.numCols);
}
for( int cols = 0; cols < input.numCols; cols++ ) {
double total = 0;
int index = cols;
int end = index + input.numCols*input.numRows;
for( ; index < end; index += input.numCols ) {
total += input.data[index];
}
output.set(cols, total);
}
return output;
} | [
"public",
"static",
"DMatrixRMaj",
"sumCols",
"(",
"DMatrixRMaj",
"input",
",",
"DMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"DMatrixRMaj",
"(",
"1",
",",
"input",
".",
"numCols",
")",
";",
"}",
... | <p>
Computes the sum of each column in the input matrix and returns the results in a vector:<br>
<br>
b<sub>j</sub> = min(i=1:m ; a<sub>ij</sub>)
</p>
@param input Input matrix
@param output Optional storage for output. Reshaped into a row vector. Modified.
@return Vector containing the sum of each column | [
"<p",
">",
"Computes",
"the",
"sum",
"of",
"each",
"column",
"in",
"the",
"input",
"matrix",
"and",
"returns",
"the",
"results",
"in",
"a",
"vector",
":",
"<br",
">",
"<br",
">",
"b<sub",
">",
"j<",
"/",
"sub",
">",
"=",
"min",
"(",
"i",
"=",
"1"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1959-L1978 |
google/auto | factory/src/main/java/com/google/auto/factory/processor/Key.java | Key.boxedType | private static TypeMirror boxedType(TypeMirror type, Types types) {
return type.getKind().isPrimitive()
? types.boxedClass(MoreTypes.asPrimitiveType(type)).asType()
: type;
} | java | private static TypeMirror boxedType(TypeMirror type, Types types) {
return type.getKind().isPrimitive()
? types.boxedClass(MoreTypes.asPrimitiveType(type)).asType()
: type;
} | [
"private",
"static",
"TypeMirror",
"boxedType",
"(",
"TypeMirror",
"type",
",",
"Types",
"types",
")",
"{",
"return",
"type",
".",
"getKind",
"(",
")",
".",
"isPrimitive",
"(",
")",
"?",
"types",
".",
"boxedClass",
"(",
"MoreTypes",
".",
"asPrimitiveType",
... | If {@code type} is a primitive type, returns the boxed equivalent; otherwise returns
{@code type}. | [
"If",
"{"
] | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/factory/src/main/java/com/google/auto/factory/processor/Key.java#L90-L94 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.getDeltaC | public <C> DbxDeltaC<C> getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>, C> collector, /*@Nullable*/String cursor,
boolean includeMediaInfo)
throws DbxException
{
return _getDeltaC(collector, cursor, null, includeMediaInfo);
} | java | public <C> DbxDeltaC<C> getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>, C> collector, /*@Nullable*/String cursor,
boolean includeMediaInfo)
throws DbxException
{
return _getDeltaC(collector, cursor, null, includeMediaInfo);
} | [
"public",
"<",
"C",
">",
"DbxDeltaC",
"<",
"C",
">",
"getDeltaC",
"(",
"Collector",
"<",
"DbxDeltaC",
".",
"Entry",
"<",
"DbxEntry",
">",
",",
"C",
">",
"collector",
",",
"/*@Nullable*/",
"String",
"cursor",
",",
"boolean",
"includeMediaInfo",
")",
"throws... | A more generic version of {@link #getDelta}. You provide a <em>collector</em>,
which lets you process the delta entries as they arrive over the network. | [
"A",
"more",
"generic",
"version",
"of",
"{"
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1498-L1503 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java | PrefixMappedItemCache.invalidateBucket | public synchronized void invalidateBucket(String bucket) {
PrefixKey key = new PrefixKey(bucket, "");
getPrefixSubMap(itemMap, key).clear();
getPrefixSubMap(prefixMap, key).clear();
} | java | public synchronized void invalidateBucket(String bucket) {
PrefixKey key = new PrefixKey(bucket, "");
getPrefixSubMap(itemMap, key).clear();
getPrefixSubMap(prefixMap, key).clear();
} | [
"public",
"synchronized",
"void",
"invalidateBucket",
"(",
"String",
"bucket",
")",
"{",
"PrefixKey",
"key",
"=",
"new",
"PrefixKey",
"(",
"bucket",
",",
"\"\"",
")",
";",
"getPrefixSubMap",
"(",
"itemMap",
",",
"key",
")",
".",
"clear",
"(",
")",
";",
"... | Invalidates all cached items and lists associated with the given bucket.
@param bucket the bucket to invalidate. This must not be null. | [
"Invalidates",
"all",
"cached",
"items",
"and",
"lists",
"associated",
"with",
"the",
"given",
"bucket",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java#L212-L217 |
jhalterman/failsafe | src/main/java/net/jodah/failsafe/ExecutionResult.java | ExecutionResult.withResult | public ExecutionResult withResult(Object result) {
return new ExecutionResult(result, null, nonResult, waitNanos, true, true, successAll);
} | java | public ExecutionResult withResult(Object result) {
return new ExecutionResult(result, null, nonResult, waitNanos, true, true, successAll);
} | [
"public",
"ExecutionResult",
"withResult",
"(",
"Object",
"result",
")",
"{",
"return",
"new",
"ExecutionResult",
"(",
"result",
",",
"null",
",",
"nonResult",
",",
"waitNanos",
",",
"true",
",",
"true",
",",
"successAll",
")",
";",
"}"
] | Returns a copy of the ExecutionResult with the {@code result} value, and completed and success set to true. | [
"Returns",
"a",
"copy",
"of",
"the",
"ExecutionResult",
"with",
"the",
"{"
] | train | https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/ExecutionResult.java#L103-L105 |
TouK/sputnik | src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java | SonarResultParser.getIssueFilePath | private String getIssueFilePath(String issueComponent, Map<String, Component> components) {
Component comp = components.get(issueComponent);
String file = comp.path;
if (!Strings.isNullOrEmpty(comp.moduleKey)) {
String theKey = comp.moduleKey;
while (!theKey.isEmpty()) {
Component theChildComp = components.get(theKey);
int p = theKey.lastIndexOf(":");
if (p > 0) {
theKey = theKey.substring(0, p);
} else {
theKey = "";
}
if (theChildComp != null && !Strings.isNullOrEmpty(theChildComp.path)) {
file = theChildComp.path + '/' + file;
}
}
}
return file;
} | java | private String getIssueFilePath(String issueComponent, Map<String, Component> components) {
Component comp = components.get(issueComponent);
String file = comp.path;
if (!Strings.isNullOrEmpty(comp.moduleKey)) {
String theKey = comp.moduleKey;
while (!theKey.isEmpty()) {
Component theChildComp = components.get(theKey);
int p = theKey.lastIndexOf(":");
if (p > 0) {
theKey = theKey.substring(0, p);
} else {
theKey = "";
}
if (theChildComp != null && !Strings.isNullOrEmpty(theChildComp.path)) {
file = theChildComp.path + '/' + file;
}
}
}
return file;
} | [
"private",
"String",
"getIssueFilePath",
"(",
"String",
"issueComponent",
",",
"Map",
"<",
"String",
",",
"Component",
">",
"components",
")",
"{",
"Component",
"comp",
"=",
"components",
".",
"get",
"(",
"issueComponent",
")",
";",
"String",
"file",
"=",
"c... | Returns the path of the file linked to an issue created by Sonar.
The path is relative to the folder where Sonar has been run.
@param issueComponent "component" field in an issue.
@param components information about all components. | [
"Returns",
"the",
"path",
"of",
"the",
"file",
"linked",
"to",
"an",
"issue",
"created",
"by",
"Sonar",
".",
"The",
"path",
"is",
"relative",
"to",
"the",
"folder",
"where",
"Sonar",
"has",
"been",
"run",
"."
] | train | https://github.com/TouK/sputnik/blob/64569e603d8837e800e3b3797b604a6942a7b5c5/src/main/java/pl/touk/sputnik/processor/sonar/SonarResultParser.java#L117-L138 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java | DataService.voidRequestAsync | public <T extends IEntity> void voidRequestAsync(T entity, CallbackHandler callbackHandler) throws FMSException {
IntuitMessage intuitMessage = prepareVoidRequest(entity);
//set callback handler
intuitMessage.getRequestElements().setCallbackHandler(callbackHandler);
//execute async interceptors
executeAsyncInterceptors(intuitMessage);
} | java | public <T extends IEntity> void voidRequestAsync(T entity, CallbackHandler callbackHandler) throws FMSException {
IntuitMessage intuitMessage = prepareVoidRequest(entity);
//set callback handler
intuitMessage.getRequestElements().setCallbackHandler(callbackHandler);
//execute async interceptors
executeAsyncInterceptors(intuitMessage);
} | [
"public",
"<",
"T",
"extends",
"IEntity",
">",
"void",
"voidRequestAsync",
"(",
"T",
"entity",
",",
"CallbackHandler",
"callbackHandler",
")",
"throws",
"FMSException",
"{",
"IntuitMessage",
"intuitMessage",
"=",
"prepareVoidRequest",
"(",
"entity",
")",
";",
"//s... | Method to cancel the operation for the corresponding entity in asynchronous fashion
@param entity
the entity
@param callbackHandler
the callback handler
@throws FMSException | [
"Method",
"to",
"cancel",
"the",
"operation",
"for",
"the",
"corresponding",
"entity",
"in",
"asynchronous",
"fashion"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L839-L848 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java | IOUtil.copyWithClose | public static void copyWithClose(InputStream input, OutputStream output) throws IOException {
try {
copy(input, output);
} finally {
try {
input.close();
} catch (final IOException ignore) {
if (log.isLoggable(Level.FINER)) {
log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring");
}
}
try {
output.close();
} catch (final IOException ignore) {
if (log.isLoggable(Level.FINER)) {
log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring");
}
}
}
} | java | public static void copyWithClose(InputStream input, OutputStream output) throws IOException {
try {
copy(input, output);
} finally {
try {
input.close();
} catch (final IOException ignore) {
if (log.isLoggable(Level.FINER)) {
log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring");
}
}
try {
output.close();
} catch (final IOException ignore) {
if (log.isLoggable(Level.FINER)) {
log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring");
}
}
}
} | [
"public",
"static",
"void",
"copyWithClose",
"(",
"InputStream",
"input",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"try",
"{",
"copy",
"(",
"input",
",",
"output",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"input",
".",
"close",
... | Copies the contents from an InputStream to an OutputStream and closes both streams.
@param input
@param output
@throws IOException
If a problem occurred during any I/O operations during the copy, but on closing the streams these
will be ignored and logged at {@link Level#FINER} | [
"Copies",
"the",
"contents",
"from",
"an",
"InputStream",
"to",
"an",
"OutputStream",
"and",
"closes",
"both",
"streams",
"."
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java#L202-L221 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.writeJpg | public static void writeJpg(Image image, OutputStream out) throws IORuntimeException {
write(image, IMAGE_TYPE_JPG, out);
} | java | public static void writeJpg(Image image, OutputStream out) throws IORuntimeException {
write(image, IMAGE_TYPE_JPG, out);
} | [
"public",
"static",
"void",
"writeJpg",
"(",
"Image",
"image",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"image",
",",
"IMAGE_TYPE_JPG",
",",
"out",
")",
";",
"}"
] | 写出图像为JPG格式
@param image {@link Image}
@param out 写出到的目标流
@throws IORuntimeException IO异常
@since 4.0.10 | [
"写出图像为JPG格式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1377-L1379 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/writer/initializer/WriterInitializerFactory.java | WriterInitializerFactory.newInstace | public static WriterInitializer newInstace(State state, WorkUnitStream workUnits) {
int branches = state.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1);
if (branches == 1) {
return newSingleInstance(state, workUnits, branches, 0);
}
List<WriterInitializer> wis = Lists.newArrayList();
for (int branchId = 0; branchId < branches; branchId++) {
wis.add(newSingleInstance(state, workUnits, branches, branchId));
}
return new MultiWriterInitializer(wis);
} | java | public static WriterInitializer newInstace(State state, WorkUnitStream workUnits) {
int branches = state.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1);
if (branches == 1) {
return newSingleInstance(state, workUnits, branches, 0);
}
List<WriterInitializer> wis = Lists.newArrayList();
for (int branchId = 0; branchId < branches; branchId++) {
wis.add(newSingleInstance(state, workUnits, branches, branchId));
}
return new MultiWriterInitializer(wis);
} | [
"public",
"static",
"WriterInitializer",
"newInstace",
"(",
"State",
"state",
",",
"WorkUnitStream",
"workUnits",
")",
"{",
"int",
"branches",
"=",
"state",
".",
"getPropAsInt",
"(",
"ConfigurationKeys",
".",
"FORK_BRANCHES_KEY",
",",
"1",
")",
";",
"if",
"(",
... | Provides WriterInitializer based on the writer. Mostly writer is decided by the Writer builder (and destination) that user passes.
If there's more than one branch, it will instantiate same number of WriterInitializer instance as number of branches and combine it into MultiWriterInitializer.
@param state
@return WriterInitializer | [
"Provides",
"WriterInitializer",
"based",
"on",
"the",
"writer",
".",
"Mostly",
"writer",
"is",
"decided",
"by",
"the",
"Writer",
"builder",
"(",
"and",
"destination",
")",
"that",
"user",
"passes",
".",
"If",
"there",
"s",
"more",
"than",
"one",
"branch",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/writer/initializer/WriterInitializerFactory.java#L42-L53 |
stephenc/simple-java-mail | src/main/java/org/codemonkey/simplejavamail/Email.java | Email.addAttachment | public void addAttachment(final String name, final byte[] data, final String mimetype) {
final ByteArrayDataSource dataSource = new ByteArrayDataSource(data, mimetype);
dataSource.setName(name);
addAttachment(name, dataSource);
} | java | public void addAttachment(final String name, final byte[] data, final String mimetype) {
final ByteArrayDataSource dataSource = new ByteArrayDataSource(data, mimetype);
dataSource.setName(name);
addAttachment(name, dataSource);
} | [
"public",
"void",
"addAttachment",
"(",
"final",
"String",
"name",
",",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"String",
"mimetype",
")",
"{",
"final",
"ByteArrayDataSource",
"dataSource",
"=",
"new",
"ByteArrayDataSource",
"(",
"data",
",",
"mimetyp... | Adds an attachment to the email message and generates the necessary {@link DataSource} with the given byte data.
Then delegates to {@link #addAttachment(String, DataSource)}. At this point the datasource is actually a
{@link ByteArrayDataSource}.
@param name The name of the extension (eg. filename including extension).
@param data The byte data of the attachment.
@param mimetype The content type of the given data (eg. "plain/text", "image/gif" or "application/pdf").
@see ByteArrayDataSource
@see #addAttachment(String, DataSource) | [
"Adds",
"an",
"attachment",
"to",
"the",
"email",
"message",
"and",
"generates",
"the",
"necessary",
"{",
"@link",
"DataSource",
"}",
"with",
"the",
"given",
"byte",
"data",
".",
"Then",
"delegates",
"to",
"{",
"@link",
"#addAttachment",
"(",
"String",
"Data... | train | https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/Email.java#L144-L148 |
alipay/sofa-rpc | extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperRegistry.java | ZookeeperRegistry.subscribeConfig | protected void subscribeConfig(final AbstractInterfaceConfig config, ConfigListener listener) {
try {
if (configObserver == null) { // 初始化
configObserver = new ZookeeperConfigObserver();
}
configObserver.addConfigListener(config, listener);
final String configPath = buildConfigPath(rootPath, config);
// 监听配置节点下 子节点增加、子节点删除、子节点Data修改事件
PathChildrenCache pathChildrenCache = new PathChildrenCache(zkClient, configPath, true);
pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() {
@Override
public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
if (LOGGER.isDebugEnabled(config.getAppName())) {
LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
}
switch (event.getType()) {
case CHILD_ADDED: //新增接口级配置
configObserver.addConfig(config, configPath, event.getData());
break;
case CHILD_REMOVED: //删除接口级配置
configObserver.removeConfig(config, configPath, event.getData());
break;
case CHILD_UPDATED:// 更新接口级配置
configObserver.updateConfig(config, configPath, event.getData());
break;
default:
break;
}
}
});
pathChildrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
INTERFACE_CONFIG_CACHE.put(configPath, pathChildrenCache);
configObserver.updateConfigAll(config, configPath, pathChildrenCache.getCurrentData());
} catch (Exception e) {
throw new SofaRpcRuntimeException("Failed to subscribe provider config from zookeeperRegistry!", e);
}
} | java | protected void subscribeConfig(final AbstractInterfaceConfig config, ConfigListener listener) {
try {
if (configObserver == null) { // 初始化
configObserver = new ZookeeperConfigObserver();
}
configObserver.addConfigListener(config, listener);
final String configPath = buildConfigPath(rootPath, config);
// 监听配置节点下 子节点增加、子节点删除、子节点Data修改事件
PathChildrenCache pathChildrenCache = new PathChildrenCache(zkClient, configPath, true);
pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() {
@Override
public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
if (LOGGER.isDebugEnabled(config.getAppName())) {
LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
}
switch (event.getType()) {
case CHILD_ADDED: //新增接口级配置
configObserver.addConfig(config, configPath, event.getData());
break;
case CHILD_REMOVED: //删除接口级配置
configObserver.removeConfig(config, configPath, event.getData());
break;
case CHILD_UPDATED:// 更新接口级配置
configObserver.updateConfig(config, configPath, event.getData());
break;
default:
break;
}
}
});
pathChildrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
INTERFACE_CONFIG_CACHE.put(configPath, pathChildrenCache);
configObserver.updateConfigAll(config, configPath, pathChildrenCache.getCurrentData());
} catch (Exception e) {
throw new SofaRpcRuntimeException("Failed to subscribe provider config from zookeeperRegistry!", e);
}
} | [
"protected",
"void",
"subscribeConfig",
"(",
"final",
"AbstractInterfaceConfig",
"config",
",",
"ConfigListener",
"listener",
")",
"{",
"try",
"{",
"if",
"(",
"configObserver",
"==",
"null",
")",
"{",
"// 初始化",
"configObserver",
"=",
"new",
"ZookeeperConfigObserver"... | 订阅接口级配置
@param config provider/consumer config
@param listener config listener | [
"订阅接口级配置"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperRegistry.java#L409-L445 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StorageReadManager.java | StorageReadManager.executeStorageRead | private void executeStorageRead(Request request) {
try {
byte[] buffer = new byte[request.length];
getHandle()
.thenComposeAsync(handle -> this.storage.read(handle, request.offset, buffer, 0, buffer.length, request.getTimeout()), this.executor)
.thenAcceptAsync(bytesRead -> request.complete(new ByteArraySegment(buffer, 0, bytesRead)), this.executor)
.whenComplete((r, ex) -> {
if (ex != null) {
request.fail(ex);
}
// Unregister the Request after every request fulfillment.
finalizeRequest(request);
});
} catch (Throwable ex) {
if (Exceptions.mustRethrow(ex)) {
throw ex;
}
request.fail(ex);
finalizeRequest(request);
}
} | java | private void executeStorageRead(Request request) {
try {
byte[] buffer = new byte[request.length];
getHandle()
.thenComposeAsync(handle -> this.storage.read(handle, request.offset, buffer, 0, buffer.length, request.getTimeout()), this.executor)
.thenAcceptAsync(bytesRead -> request.complete(new ByteArraySegment(buffer, 0, bytesRead)), this.executor)
.whenComplete((r, ex) -> {
if (ex != null) {
request.fail(ex);
}
// Unregister the Request after every request fulfillment.
finalizeRequest(request);
});
} catch (Throwable ex) {
if (Exceptions.mustRethrow(ex)) {
throw ex;
}
request.fail(ex);
finalizeRequest(request);
}
} | [
"private",
"void",
"executeStorageRead",
"(",
"Request",
"request",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"request",
".",
"length",
"]",
";",
"getHandle",
"(",
")",
".",
"thenComposeAsync",
"(",
"handle",
"->",
"this"... | Executes the Storage Read for the given request.
@param request The request. | [
"Executes",
"the",
"Storage",
"Read",
"for",
"the",
"given",
"request",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StorageReadManager.java#L132-L154 |
JOML-CI/JOML | src/org/joml/Quaterniond.java | Quaterniond.fromAxisAngleDeg | public Quaterniond fromAxisAngleDeg(double axisX, double axisY, double axisZ, double angle) {
return fromAxisAngleRad(axisX, axisY, axisZ, Math.toRadians(angle));
} | java | public Quaterniond fromAxisAngleDeg(double axisX, double axisY, double axisZ, double angle) {
return fromAxisAngleRad(axisX, axisY, axisZ, Math.toRadians(angle));
} | [
"public",
"Quaterniond",
"fromAxisAngleDeg",
"(",
"double",
"axisX",
",",
"double",
"axisY",
",",
"double",
"axisZ",
",",
"double",
"angle",
")",
"{",
"return",
"fromAxisAngleRad",
"(",
"axisX",
",",
"axisY",
",",
"axisZ",
",",
"Math",
".",
"toRadians",
"(",... | Set this quaternion to be a representation of the supplied axis and
angle (in degrees).
@param axisX
the x component of the rotation axis
@param axisY
the y component of the rotation axis
@param axisZ
the z component of the rotation axis
@param angle
the angle in radians
@return this | [
"Set",
"this",
"quaternion",
"to",
"be",
"a",
"representation",
"of",
"the",
"supplied",
"axis",
"and",
"angle",
"(",
"in",
"degrees",
")",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L704-L706 |
lucee/Lucee | core/src/main/java/lucee/commons/io/res/type/cache/CacheResourceProvider.java | CacheResourceProvider.createCore | CacheResourceCore createCore(String path, String name, int type) throws IOException {
CacheResourceCore value = new CacheResourceCore(type, path, name);
getCache().put(toKey(path, name), value, null, null);
return value;
} | java | CacheResourceCore createCore(String path, String name, int type) throws IOException {
CacheResourceCore value = new CacheResourceCore(type, path, name);
getCache().put(toKey(path, name), value, null, null);
return value;
} | [
"CacheResourceCore",
"createCore",
"(",
"String",
"path",
",",
"String",
"name",
",",
"int",
"type",
")",
"throws",
"IOException",
"{",
"CacheResourceCore",
"value",
"=",
"new",
"CacheResourceCore",
"(",
"type",
",",
"path",
",",
"name",
")",
";",
"getCache",
... | create a new core
@param path
@param type
@return created core
@throws IOException | [
"create",
"a",
"new",
"core"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/cache/CacheResourceProvider.java#L153-L157 |
jtablesaw/tablesaw | core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java | DataFrameJoiner.inner | public Table inner(Table table2, boolean outer, boolean allowDuplicateColumnNames, String... col2Names) {
Table joinedTable;
joinedTable = joinInternal(table, table2, outer, allowDuplicateColumnNames, col2Names);
return joinedTable;
} | java | public Table inner(Table table2, boolean outer, boolean allowDuplicateColumnNames, String... col2Names) {
Table joinedTable;
joinedTable = joinInternal(table, table2, outer, allowDuplicateColumnNames, col2Names);
return joinedTable;
} | [
"public",
"Table",
"inner",
"(",
"Table",
"table2",
",",
"boolean",
"outer",
",",
"boolean",
"allowDuplicateColumnNames",
",",
"String",
"...",
"col2Names",
")",
"{",
"Table",
"joinedTable",
";",
"joinedTable",
"=",
"joinInternal",
"(",
"table",
",",
"table2",
... | Joins the joiner to the table2, using the given columns for the second table and returns the resulting table
@param table2 The table to join with
@param outer True if this join is actually an outer join, left or right or full, otherwise false.
@param allowDuplicateColumnNames if {@code false} the join will fail if any columns other than the join column have the same name
if {@code true} the join will succeed and duplicate columns are renamed*
@param col2Names The columns to join on. If a name refers to a double column, the join is performed after
rounding to integers.
@return The resulting table | [
"Joins",
"the",
"joiner",
"to",
"the",
"table2",
"using",
"the",
"given",
"columns",
"for",
"the",
"second",
"table",
"and",
"returns",
"the",
"resulting",
"table"
] | train | https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L158-L162 |
casmi/casmi | src/main/java/casmi/graphics/color/HSBColor.java | HSBColor.getComplementaryColor | public HSBColor getComplementaryColor() {
double[] rgb = HSBColor.getRGB(hue, saturation, brightness);
double[] hsb = HSBColor.getHSB(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
return new HSBColor(hsb[0], hsb[1], hsb[2]);
} | java | public HSBColor getComplementaryColor() {
double[] rgb = HSBColor.getRGB(hue, saturation, brightness);
double[] hsb = HSBColor.getHSB(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
return new HSBColor(hsb[0], hsb[1], hsb[2]);
} | [
"public",
"HSBColor",
"getComplementaryColor",
"(",
")",
"{",
"double",
"[",
"]",
"rgb",
"=",
"HSBColor",
".",
"getRGB",
"(",
"hue",
",",
"saturation",
",",
"brightness",
")",
";",
"double",
"[",
"]",
"hsb",
"=",
"HSBColor",
".",
"getHSB",
"(",
"1.0",
... | Returns a Color object that shows a complementary color.
@return a complementary Color object. | [
"Returns",
"a",
"Color",
"object",
"that",
"shows",
"a",
"complementary",
"color",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/color/HSBColor.java#L287-L291 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.setWarningSeverity | public void setWarningSeverity(String warningId, Severity severity) {
if (!Strings.isEmpty(warningId) && severity != null) {
this.issueSeverityProvider.setSeverity(warningId, severity);
}
} | java | public void setWarningSeverity(String warningId, Severity severity) {
if (!Strings.isEmpty(warningId) && severity != null) {
this.issueSeverityProvider.setSeverity(warningId, severity);
}
} | [
"public",
"void",
"setWarningSeverity",
"(",
"String",
"warningId",
",",
"Severity",
"severity",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"warningId",
")",
"&&",
"severity",
"!=",
"null",
")",
"{",
"this",
".",
"issueSeverityProvider",
".",
... | Change the severity level of a warning.
@param warningId the identifier of the warning. If {@code null} or empty, this function does nothing.
@param severity the new severity. If {@code null} this function does nothing.
@since 0.5 | [
"Change",
"the",
"severity",
"level",
"of",
"a",
"warning",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L2264-L2268 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.unGzip | public static String unGzip(byte[] buf, String charset) throws UtilException {
return StrUtil.str(unGzip(buf), charset);
} | java | public static String unGzip(byte[] buf, String charset) throws UtilException {
return StrUtil.str(unGzip(buf), charset);
} | [
"public",
"static",
"String",
"unGzip",
"(",
"byte",
"[",
"]",
"buf",
",",
"String",
"charset",
")",
"throws",
"UtilException",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"unGzip",
"(",
"buf",
")",
",",
"charset",
")",
";",
"}"
] | Gzip解压缩处理
@param buf 压缩过的字节流
@param charset 编码
@return 解压后的字符串
@throws UtilException IO异常 | [
"Gzip解压缩处理"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L567-L569 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java | HCRenderer.getAsNode | @SuppressWarnings ("unchecked")
@Nullable
public static IMicroNode getAsNode (@Nonnull final IHCNode aSrcNode,
@Nonnull final IHCConversionSettingsToNode aConversionSettings)
{
IHCNode aConvertNode = aSrcNode;
// Special case for HCHtml - must have been done separately because the
// extraction of the OOB nodes must happen before the HTML HEAD is filled
if (!(aSrcNode instanceof HCHtml))
{
// Determine the target node to use
final boolean bSrcNodeCanHaveChildren = aSrcNode instanceof IHCHasChildrenMutable <?, ?>;
IHCHasChildrenMutable <?, IHCNode> aTempNode;
if (bSrcNodeCanHaveChildren)
{
// Passed node can handle it
aTempNode = (IHCHasChildrenMutable <?, IHCNode>) aSrcNode;
}
else
{
aTempNode = new HCNodeList ();
aTempNode.addChild (aSrcNode);
}
// customize, finalize and extract resources
prepareForConversion (aTempNode, aTempNode, aConversionSettings);
// NOTE: no OOB extraction here, because it is unclear what would happen
// to the nodes.
// Select node to convert to MicroDOM - if something was extracted, use
// the temp node
if (!bSrcNodeCanHaveChildren && aTempNode.getChildCount () > 1)
aConvertNode = aTempNode;
}
final IMicroNode aMicroNode = aConvertNode.convertToMicroNode (aConversionSettings);
return aMicroNode;
} | java | @SuppressWarnings ("unchecked")
@Nullable
public static IMicroNode getAsNode (@Nonnull final IHCNode aSrcNode,
@Nonnull final IHCConversionSettingsToNode aConversionSettings)
{
IHCNode aConvertNode = aSrcNode;
// Special case for HCHtml - must have been done separately because the
// extraction of the OOB nodes must happen before the HTML HEAD is filled
if (!(aSrcNode instanceof HCHtml))
{
// Determine the target node to use
final boolean bSrcNodeCanHaveChildren = aSrcNode instanceof IHCHasChildrenMutable <?, ?>;
IHCHasChildrenMutable <?, IHCNode> aTempNode;
if (bSrcNodeCanHaveChildren)
{
// Passed node can handle it
aTempNode = (IHCHasChildrenMutable <?, IHCNode>) aSrcNode;
}
else
{
aTempNode = new HCNodeList ();
aTempNode.addChild (aSrcNode);
}
// customize, finalize and extract resources
prepareForConversion (aTempNode, aTempNode, aConversionSettings);
// NOTE: no OOB extraction here, because it is unclear what would happen
// to the nodes.
// Select node to convert to MicroDOM - if something was extracted, use
// the temp node
if (!bSrcNodeCanHaveChildren && aTempNode.getChildCount () > 1)
aConvertNode = aTempNode;
}
final IMicroNode aMicroNode = aConvertNode.convertToMicroNode (aConversionSettings);
return aMicroNode;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Nullable",
"public",
"static",
"IMicroNode",
"getAsNode",
"(",
"@",
"Nonnull",
"final",
"IHCNode",
"aSrcNode",
",",
"@",
"Nonnull",
"final",
"IHCConversionSettingsToNode",
"aConversionSettings",
")",
"{",
"IH... | Convert the passed HC node to a micro node using the provided conversion
settings.
@param aSrcNode
The node to be converted. May not be <code>null</code>.
@param aConversionSettings
The conversion settings to be used. May not be <code>null</code>.
@return The fully created HTML node | [
"Convert",
"the",
"passed",
"HC",
"node",
"to",
"a",
"micro",
"node",
"using",
"the",
"provided",
"conversion",
"settings",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L192-L231 |
unbescape/unbescape | src/main/java/org/unbescape/properties/PropertiesEscape.java | PropertiesEscape.escapePropertiesKey | public static void escapePropertiesKey(final String text, final Writer writer)
throws IOException {
escapePropertiesKey(text, writer, PropertiesKeyEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
} | java | public static void escapePropertiesKey(final String text, final Writer writer)
throws IOException {
escapePropertiesKey(text, writer, PropertiesKeyEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
} | [
"public",
"static",
"void",
"escapePropertiesKey",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapePropertiesKey",
"(",
"text",
",",
"writer",
",",
"PropertiesKeyEscapeLevel",
".",
"LEVEL_2_ALL_NON_ASCII_PLUS... | <p>
Perform a Java Properties Key level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation
on a <tt>String</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 2</em> means this method will escape:
</p>
<ul>
<li>The Java Properties Key basic escape set:
<ul>
<li>The <em>Single Escape Characters</em>:
<tt>\t</tt> (<tt>U+0009</tt>),
<tt>\n</tt> (<tt>U+000A</tt>),
<tt>\f</tt> (<tt>U+000C</tt>),
<tt>\r</tt> (<tt>U+000D</tt>),
<tt>\ </tt> (<tt>U+0020</tt>),
<tt>\:</tt> (<tt>U+003A</tt>),
<tt>\=</tt> (<tt>U+003D</tt>) and
<tt>\\</tt> (<tt>U+005C</tt>).
</li>
<li>
Two ranges of non-displayable, control characters (some of which are already part of the
<em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt>
and <tt>U+007F</tt> to <tt>U+009F</tt>.
</li>
</ul>
</li>
<li>All non ASCII characters.</li>
</ul>
<p>
This escape will be performed by using the Single Escape Chars whenever possible. For escaped
characters that do not have an associated SEC, default to <tt>\uFFFF</tt>
Hexadecimal Escapes.
</p>
<p>
This method calls {@link #escapePropertiesKey(String, Writer, PropertiesKeyEscapeLevel)}
with the following preconfigured values:
</p>
<ul>
<li><tt>level</tt>:
{@link PropertiesKeyEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs | [
"<p",
">",
"Perform",
"a",
"Java",
"Properties",
"Key",
"level",
"2",
"(",
"basic",
"set",
"and",
"all",
"non",
"-",
"ASCII",
"chars",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L994-L997 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java | TupleGenerator.getBaseFailureCases | private List<TestCaseDef> getBaseFailureCases( FunctionInputDef inputDef, VarTupleSet validTuples, VarTupleSet failureTuples, List<TestCaseDef> baseCases)
{
logger_.debug( "{}: Extending base failure test cases", inputDef);
Iterator<TestCaseDef> failureBaseCases =
IteratorUtils.filteredIterator(
baseCases.iterator(),
testCase -> testCase.getInvalidVar() != null);
List<TestCaseDef> testCases = extendBaseCases( inputDef, validTuples, failureBaseCases);
// Consume all failure values used.
for( TestCaseDef testCase : testCases)
{
VarDef failureVar = testCase.getInvalidVar();
failureTuples.used( new Tuple( new VarBindingDef( failureVar, testCase.getValue( failureVar))));
}
logger_.info( "{}: Extended {} base failure test cases", inputDef, testCases.size());
return testCases;
} | java | private List<TestCaseDef> getBaseFailureCases( FunctionInputDef inputDef, VarTupleSet validTuples, VarTupleSet failureTuples, List<TestCaseDef> baseCases)
{
logger_.debug( "{}: Extending base failure test cases", inputDef);
Iterator<TestCaseDef> failureBaseCases =
IteratorUtils.filteredIterator(
baseCases.iterator(),
testCase -> testCase.getInvalidVar() != null);
List<TestCaseDef> testCases = extendBaseCases( inputDef, validTuples, failureBaseCases);
// Consume all failure values used.
for( TestCaseDef testCase : testCases)
{
VarDef failureVar = testCase.getInvalidVar();
failureTuples.used( new Tuple( new VarBindingDef( failureVar, testCase.getValue( failureVar))));
}
logger_.info( "{}: Extended {} base failure test cases", inputDef, testCases.size());
return testCases;
} | [
"private",
"List",
"<",
"TestCaseDef",
">",
"getBaseFailureCases",
"(",
"FunctionInputDef",
"inputDef",
",",
"VarTupleSet",
"validTuples",
",",
"VarTupleSet",
"failureTuples",
",",
"List",
"<",
"TestCaseDef",
">",
"baseCases",
")",
"{",
"logger_",
".",
"debug",
"(... | Returns a set of failure {@link TestCaseDef test case definitions} that extend the given base test cases. | [
"Returns",
"a",
"set",
"of",
"failure",
"{"
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java#L294-L314 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/HiCO.java | HiCO.adjust | private void adjust(double[][] v, double[] vector, int corrDim) {
double[] sum = new double[v.length];
for(int k = 0; k < corrDim; k++) {
plusTimesEquals(sum, v[k], transposeTimes(vector, v[k]));
}
v[corrDim] = normalizeEquals(minus(vector, sum));
} | java | private void adjust(double[][] v, double[] vector, int corrDim) {
double[] sum = new double[v.length];
for(int k = 0; k < corrDim; k++) {
plusTimesEquals(sum, v[k], transposeTimes(vector, v[k]));
}
v[corrDim] = normalizeEquals(minus(vector, sum));
} | [
"private",
"void",
"adjust",
"(",
"double",
"[",
"]",
"[",
"]",
"v",
",",
"double",
"[",
"]",
"vector",
",",
"int",
"corrDim",
")",
"{",
"double",
"[",
"]",
"sum",
"=",
"new",
"double",
"[",
"v",
".",
"length",
"]",
";",
"for",
"(",
"int",
"k",... | Inserts the specified vector into the given orthonormal matrix
<code>v</code> at column <code>corrDim</code>. After insertion the matrix
<code>v</code> is orthonormalized and column <code>corrDim</code> of matrix
<code>e_czech</code> is set to the <code>corrDim</code>-th unit vector.
@param v the orthonormal matrix of the eigenvectors
@param vector the vector to be inserted
@param corrDim the column at which the vector should be inserted | [
"Inserts",
"the",
"specified",
"vector",
"into",
"the",
"given",
"orthonormal",
"matrix",
"<code",
">",
"v<",
"/",
"code",
">",
"at",
"column",
"<code",
">",
"corrDim<",
"/",
"code",
">",
".",
"After",
"insertion",
"the",
"matrix",
"<code",
">",
"v<",
"/... | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/HiCO.java#L364-L370 |
h2oai/h2o-3 | h2o-core/src/main/java/water/util/ReflectionUtils.java | ReflectionUtils.findNamedField | public static Field findNamedField(Object o, String field_name) {
Class clz = o.getClass();
Field f = null;
do {
try {
f = clz.getDeclaredField(field_name);
f.setAccessible(true);
return f;
}
catch (NoSuchFieldException e) {
// fall through and try our parent
}
clz = clz.getSuperclass();
} while (clz != Object.class);
return null;
} | java | public static Field findNamedField(Object o, String field_name) {
Class clz = o.getClass();
Field f = null;
do {
try {
f = clz.getDeclaredField(field_name);
f.setAccessible(true);
return f;
}
catch (NoSuchFieldException e) {
// fall through and try our parent
}
clz = clz.getSuperclass();
} while (clz != Object.class);
return null;
} | [
"public",
"static",
"Field",
"findNamedField",
"(",
"Object",
"o",
",",
"String",
"field_name",
")",
"{",
"Class",
"clz",
"=",
"o",
".",
"getClass",
"(",
")",
";",
"Field",
"f",
"=",
"null",
";",
"do",
"{",
"try",
"{",
"f",
"=",
"clz",
".",
"getDec... | Return the Field for the specified name.
<p>
Java reflection will either give you all the public fields all the way up the class hierarchy (getField()),
or will give you all the private/protected/public only in the single class (getDeclaredField()).
This method uses the latter but walks up the class hierarchy. | [
"Return",
"the",
"Field",
"for",
"the",
"specified",
"name",
".",
"<p",
">",
"Java",
"reflection",
"will",
"either",
"give",
"you",
"all",
"the",
"public",
"fields",
"all",
"the",
"way",
"up",
"the",
"class",
"hierarchy",
"(",
"getField",
"()",
")",
"or"... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/ReflectionUtils.java#L115-L131 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTextureCapturer.java | GVRTextureCapturer.setCapture | public void setCapture(boolean capture, float fps) {
capturing = capture;
NativeTextureCapturer.setCapture(getNative(), capture, fps);
} | java | public void setCapture(boolean capture, float fps) {
capturing = capture;
NativeTextureCapturer.setCapture(getNative(), capture, fps);
} | [
"public",
"void",
"setCapture",
"(",
"boolean",
"capture",
",",
"float",
"fps",
")",
"{",
"capturing",
"=",
"capture",
";",
"NativeTextureCapturer",
".",
"setCapture",
"(",
"getNative",
"(",
")",
",",
"capture",
",",
"fps",
")",
";",
"}"
] | Starts or stops capturing.
@param capture If true, capturing is started. If false, it is stopped.
@param fps Capturing FPS (frames per second). | [
"Starts",
"or",
"stops",
"capturing",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTextureCapturer.java#L122-L125 |
Jasig/uPortal | uPortal-events/src/main/java/org/apereo/portal/events/aggr/EventDateTimeUtils.java | EventDateTimeUtils.findDateRangeSorted | public static <DR extends DateRange<DT>, DT> DR findDateRangeSorted(
ReadableInstant instant, List<DR> dateRanges) {
if (dateRanges.isEmpty()) {
return null;
}
if (!(dateRanges instanceof RandomAccess)) {
// Not random access not much use doing a binary search
return findDateRange(instant, dateRanges);
}
int low = 0;
int high = dateRanges.size() - 1;
while (low <= high) {
int mid = (low + high) >>> 1;
final DR dateRange = dateRanges.get(mid);
final int cmp = dateRange.compareTo(instant);
if (cmp == -1) low = mid + 1;
else if (cmp == 1) high = mid - 1;
else return dateRange;
}
return null;
} | java | public static <DR extends DateRange<DT>, DT> DR findDateRangeSorted(
ReadableInstant instant, List<DR> dateRanges) {
if (dateRanges.isEmpty()) {
return null;
}
if (!(dateRanges instanceof RandomAccess)) {
// Not random access not much use doing a binary search
return findDateRange(instant, dateRanges);
}
int low = 0;
int high = dateRanges.size() - 1;
while (low <= high) {
int mid = (low + high) >>> 1;
final DR dateRange = dateRanges.get(mid);
final int cmp = dateRange.compareTo(instant);
if (cmp == -1) low = mid + 1;
else if (cmp == 1) high = mid - 1;
else return dateRange;
}
return null;
} | [
"public",
"static",
"<",
"DR",
"extends",
"DateRange",
"<",
"DT",
">",
",",
"DT",
">",
"DR",
"findDateRangeSorted",
"(",
"ReadableInstant",
"instant",
",",
"List",
"<",
"DR",
">",
"dateRanges",
")",
"{",
"if",
"(",
"dateRanges",
".",
"isEmpty",
"(",
")",... | Same function as {@link #findDateRange(ReadableInstant, Collection)} optimized for working on
a pre-sorted List of date ranges by doing a binary search. The List must be sorted by {@link
DateRange#getStart()} | [
"Same",
"function",
"as",
"{"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-events/src/main/java/org/apereo/portal/events/aggr/EventDateTimeUtils.java#L161-L186 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLGeometry.java | KMLGeometry.toKMLGeometry | public static void toKMLGeometry(Geometry geometry, ExtrudeMode extrude, int altitudeModeEnum, StringBuilder sb) throws SQLException {
if (geometry instanceof Point) {
toKMLPoint((Point) geometry, extrude, altitudeModeEnum, sb);
} else if (geometry instanceof LineString) {
toKMLLineString((LineString) geometry, extrude, altitudeModeEnum, sb);
} else if (geometry instanceof Polygon) {
toKMLPolygon((Polygon) geometry, extrude, altitudeModeEnum, sb);
} else if (geometry instanceof GeometryCollection) {
toKMLMultiGeometry((GeometryCollection) geometry, extrude, altitudeModeEnum, sb);
} else {
throw new SQLException("This geometry type is not supported : " + geometry.toString());
}
} | java | public static void toKMLGeometry(Geometry geometry, ExtrudeMode extrude, int altitudeModeEnum, StringBuilder sb) throws SQLException {
if (geometry instanceof Point) {
toKMLPoint((Point) geometry, extrude, altitudeModeEnum, sb);
} else if (geometry instanceof LineString) {
toKMLLineString((LineString) geometry, extrude, altitudeModeEnum, sb);
} else if (geometry instanceof Polygon) {
toKMLPolygon((Polygon) geometry, extrude, altitudeModeEnum, sb);
} else if (geometry instanceof GeometryCollection) {
toKMLMultiGeometry((GeometryCollection) geometry, extrude, altitudeModeEnum, sb);
} else {
throw new SQLException("This geometry type is not supported : " + geometry.toString());
}
} | [
"public",
"static",
"void",
"toKMLGeometry",
"(",
"Geometry",
"geometry",
",",
"ExtrudeMode",
"extrude",
",",
"int",
"altitudeModeEnum",
",",
"StringBuilder",
"sb",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometry",
"instanceof",
"Point",
")",
"{",
"toKM... | Convert JTS geometry to a kml geometry representation.
@param geometry
@param extrude
@param altitudeModeEnum
@param sb | [
"Convert",
"JTS",
"geometry",
"to",
"a",
"kml",
"geometry",
"representation",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLGeometry.java#L56-L68 |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java | SessionIdFormat.changeJvmRoute | @Nonnull
public String changeJvmRoute( @Nonnull final String sessionId, @Nonnull final String newJvmRoute ) {
return stripJvmRoute( sessionId ) + "." + newJvmRoute;
} | java | @Nonnull
public String changeJvmRoute( @Nonnull final String sessionId, @Nonnull final String newJvmRoute ) {
return stripJvmRoute( sessionId ) + "." + newJvmRoute;
} | [
"@",
"Nonnull",
"public",
"String",
"changeJvmRoute",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
",",
"@",
"Nonnull",
"final",
"String",
"newJvmRoute",
")",
"{",
"return",
"stripJvmRoute",
"(",
"sessionId",
")",
"+",
"\".\"",
"+",
"newJvmRoute",
";",... | Change the provided session id (optionally already including a jvmRoute) so that it
contains the provided newJvmRoute.
@param sessionId
the session id that may contain a former jvmRoute.
@param newJvmRoute
the new jvm route.
@return the sessionId which now contains the new jvmRoute instead the
former one. | [
"Change",
"the",
"provided",
"session",
"id",
"(",
"optionally",
"already",
"including",
"a",
"jvmRoute",
")",
"so",
"that",
"it",
"contains",
"the",
"provided",
"newJvmRoute",
"."
] | train | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java#L132-L135 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.getSqDist | private static double getSqDist(Point p1, Point p2) {
double dx = p1.longitude() - p2.longitude();
double dy = p1.latitude() - p2.latitude();
return dx * dx + dy * dy;
} | java | private static double getSqDist(Point p1, Point p2) {
double dx = p1.longitude() - p2.longitude();
double dy = p1.latitude() - p2.latitude();
return dx * dx + dy * dy;
} | [
"private",
"static",
"double",
"getSqDist",
"(",
"Point",
"p1",
",",
"Point",
"p2",
")",
"{",
"double",
"dx",
"=",
"p1",
".",
"longitude",
"(",
")",
"-",
"p2",
".",
"longitude",
"(",
")",
";",
"double",
"dy",
"=",
"p1",
".",
"latitude",
"(",
")",
... | Square distance between 2 points.
@param p1 first {@link Point}
@param p2 second Point
@return square of the distance between two input points | [
"Square",
"distance",
"between",
"2",
"points",
"."
] | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L209-L213 |
joniles/mpxj | src/main/java/net/sf/mpxj/Duration.java | Duration.add | public static Duration add(Duration a, Duration b, ProjectProperties defaults)
{
if (a == null && b == null)
{
return null;
}
if (a == null)
{
return b;
}
if (b == null)
{
return a;
}
TimeUnit unit = a.getUnits();
if (b.getUnits() != unit)
{
b = b.convertUnits(unit, defaults);
}
return Duration.getInstance(a.getDuration() + b.getDuration(), unit);
} | java | public static Duration add(Duration a, Duration b, ProjectProperties defaults)
{
if (a == null && b == null)
{
return null;
}
if (a == null)
{
return b;
}
if (b == null)
{
return a;
}
TimeUnit unit = a.getUnits();
if (b.getUnits() != unit)
{
b = b.convertUnits(unit, defaults);
}
return Duration.getInstance(a.getDuration() + b.getDuration(), unit);
} | [
"public",
"static",
"Duration",
"add",
"(",
"Duration",
"a",
",",
"Duration",
"b",
",",
"ProjectProperties",
"defaults",
")",
"{",
"if",
"(",
"a",
"==",
"null",
"&&",
"b",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"a",
"==",
"n... | If a and b are not null, returns a new duration of a + b.
If a is null and b is not null, returns b.
If a is not null and b is null, returns a.
If a and b are null, returns null.
If needed, b is converted to a's time unit using the project properties.
@param a first duration
@param b second duration
@param defaults project properties containing default values
@return a + b | [
"If",
"a",
"and",
"b",
"are",
"not",
"null",
"returns",
"a",
"new",
"duration",
"of",
"a",
"+",
"b",
".",
"If",
"a",
"is",
"null",
"and",
"b",
"is",
"not",
"null",
"returns",
"b",
".",
"If",
"a",
"is",
"not",
"null",
"and",
"b",
"is",
"null",
... | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Duration.java#L405-L426 |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.overlay/src/com/ibm/ws/artifact/overlay/internal/DirectoryBasedOverlayContainerImpl.java | DirectoryBasedOverlayContainerImpl.collectPaths | private void collectPaths(ArtifactContainer c, Set<String> s) {
if (!"/".equals(c.getPath())) {
s.add(c.getPath());
}
for (ArtifactEntry e : c) {
s.add(e.getPath());
ArtifactContainer n = e.convertToContainer();
if (n != null && !n.isRoot()) {
collectPaths(n, s);
}
}
} | java | private void collectPaths(ArtifactContainer c, Set<String> s) {
if (!"/".equals(c.getPath())) {
s.add(c.getPath());
}
for (ArtifactEntry e : c) {
s.add(e.getPath());
ArtifactContainer n = e.convertToContainer();
if (n != null && !n.isRoot()) {
collectPaths(n, s);
}
}
} | [
"private",
"void",
"collectPaths",
"(",
"ArtifactContainer",
"c",
",",
"Set",
"<",
"String",
">",
"s",
")",
"{",
"if",
"(",
"!",
"\"/\"",
".",
"equals",
"(",
"c",
".",
"getPath",
"(",
")",
")",
")",
"{",
"s",
".",
"add",
"(",
"c",
".",
"getPath",... | Little recursive routine to collect all the files present within a ArtifactContainer.<p>
@param c The ArtifactContainer to process
@param s The set to add paths to. | [
"Little",
"recursive",
"routine",
"to",
"collect",
"all",
"the",
"files",
"present",
"within",
"a",
"ArtifactContainer",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.overlay/src/com/ibm/ws/artifact/overlay/internal/DirectoryBasedOverlayContainerImpl.java#L1153-L1164 |
js-lib-com/commons | src/main/java/js/util/Strings.java | Strings.getMethodAccessor | public static String getMethodAccessor(String prefix, String memberName) throws IllegalArgumentException
{
Params.notNullOrEmpty(prefix, "Prefix");
Params.notNullOrEmpty(memberName, "Member name");
StringBuilder builder = new StringBuilder();
builder.append(prefix);
String[] parts = memberName.split("-+");
for(int i = 0; i < parts.length; i++) {
if(parts.length > 0) {
builder.append(Character.toUpperCase(parts[i].charAt(0)));
builder.append(parts[i].substring(1));
}
}
return builder.toString();
} | java | public static String getMethodAccessor(String prefix, String memberName) throws IllegalArgumentException
{
Params.notNullOrEmpty(prefix, "Prefix");
Params.notNullOrEmpty(memberName, "Member name");
StringBuilder builder = new StringBuilder();
builder.append(prefix);
String[] parts = memberName.split("-+");
for(int i = 0; i < parts.length; i++) {
if(parts.length > 0) {
builder.append(Character.toUpperCase(parts[i].charAt(0)));
builder.append(parts[i].substring(1));
}
}
return builder.toString();
} | [
"public",
"static",
"String",
"getMethodAccessor",
"(",
"String",
"prefix",
",",
"String",
"memberName",
")",
"throws",
"IllegalArgumentException",
"{",
"Params",
".",
"notNullOrEmpty",
"(",
"prefix",
",",
"\"Prefix\"",
")",
";",
"Params",
".",
"notNullOrEmpty",
"... | Get Java accessor for a given member name. Returns the given <code>memberName</code> prefixed by
<code>prefix</code>. If <code>memberName</code> is dashed case, that is, contains dash character convert it to
camel case. For example getter for <em>email-addresses</em> is <em>getEmailAddresses</em> and for <em>picture</em>
is <em>getPicture</em>.
<p>
Accessor <code>prefix</code> is inserted before method name and for flexibility it can be anything. Anyway, ususal
values are <code>get</code>, <code>set</code> and <code>is</code>. It is caller responsibility to supply the right
prefix.
@param prefix accessor prefix,
@param memberName member name.
@return member accessor name.
@throws IllegalArgumentException if any given parameter is null or empty. | [
"Get",
"Java",
"accessor",
"for",
"a",
"given",
"member",
"name",
".",
"Returns",
"the",
"given",
"<code",
">",
"memberName<",
"/",
"code",
">",
"prefixed",
"by",
"<code",
">",
"prefix<",
"/",
"code",
">",
".",
"If",
"<code",
">",
"memberName<",
"/",
"... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Strings.java#L353-L369 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java | LabAccountsInner.getByResourceGroup | public LabAccountInner getByResourceGroup(String resourceGroupName, String labAccountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, labAccountName).toBlocking().single().body();
} | java | public LabAccountInner getByResourceGroup(String resourceGroupName, String labAccountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, labAccountName).toBlocking().single().body();
} | [
"public",
"LabAccountInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
")",
".",
"toBlocking",
"(",
")",
"."... | Get lab account.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@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 LabAccountInner object if successful. | [
"Get",
"lab",
"account",
"."
] | 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/LabAccountsInner.java#L605-L607 |
westnordost/osmapi | src/main/java/de/westnordost/osmapi/user/UserPreferencesDao.java | UserPreferencesDao.get | public String get(String key)
{
String urlKey = urlEncode(key);
ApiResponseReader<String> reader = new ApiResponseReader<String>()
{
public String parse(InputStream in) throws Exception
{
InputStreamReader isr = new InputStreamReader(in, OsmConnection.CHARSET);
BufferedReader reader = new BufferedReader(isr, BUFFER_SIZE_PREFS);
return reader.readLine();
}
};
try
{
return osm.makeAuthenticatedRequest(USERPREFS + urlKey, "GET", reader);
}
catch(OsmNotFoundException e)
{
return null;
}
} | java | public String get(String key)
{
String urlKey = urlEncode(key);
ApiResponseReader<String> reader = new ApiResponseReader<String>()
{
public String parse(InputStream in) throws Exception
{
InputStreamReader isr = new InputStreamReader(in, OsmConnection.CHARSET);
BufferedReader reader = new BufferedReader(isr, BUFFER_SIZE_PREFS);
return reader.readLine();
}
};
try
{
return osm.makeAuthenticatedRequest(USERPREFS + urlKey, "GET", reader);
}
catch(OsmNotFoundException e)
{
return null;
}
} | [
"public",
"String",
"get",
"(",
"String",
"key",
")",
"{",
"String",
"urlKey",
"=",
"urlEncode",
"(",
"key",
")",
";",
"ApiResponseReader",
"<",
"String",
">",
"reader",
"=",
"new",
"ApiResponseReader",
"<",
"String",
">",
"(",
")",
"{",
"public",
"Strin... | @param key the preference to query
@return the value of the given preference or null if the preference does not exist
@throws OsmAuthorizationException if the application is not authenticated to read the
user's preferences. (Permission.READ_PREFERENCES_AND_USER_DETAILS) | [
"@param",
"key",
"the",
"preference",
"to",
"query",
"@return",
"the",
"value",
"of",
"the",
"given",
"preference",
"or",
"null",
"if",
"the",
"preference",
"does",
"not",
"exist"
] | train | https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/user/UserPreferencesDao.java#L50-L70 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java | Drawable.loadSpriteTiled | public static SpriteTiled loadSpriteTiled(ImageBuffer surface, int tileWidth, int tileHeight)
{
return new SpriteTiledImpl(surface, tileWidth, tileHeight);
} | java | public static SpriteTiled loadSpriteTiled(ImageBuffer surface, int tileWidth, int tileHeight)
{
return new SpriteTiledImpl(surface, tileWidth, tileHeight);
} | [
"public",
"static",
"SpriteTiled",
"loadSpriteTiled",
"(",
"ImageBuffer",
"surface",
",",
"int",
"tileWidth",
",",
"int",
"tileHeight",
")",
"{",
"return",
"new",
"SpriteTiledImpl",
"(",
"surface",
",",
"tileWidth",
",",
"tileHeight",
")",
";",
"}"
] | Load a tiled sprite using an image reference, giving tile dimension (sharing the same surface). It may be
useful in case of multiple tiled sprites.
<p>
{@link SpriteTiled#load()} must not be called as surface has already been loaded.
</p>
@param surface The surface reference (must not be <code>null</code>).
@param tileWidth The tile width (must be strictly positive).
@param tileHeight The tile height (must be strictly positive).
@return The loaded tiled sprite.
@throws LionEngineException If arguments are invalid. | [
"Load",
"a",
"tiled",
"sprite",
"using",
"an",
"image",
"reference",
"giving",
"tile",
"dimension",
"(",
"sharing",
"the",
"same",
"surface",
")",
".",
"It",
"may",
"be",
"useful",
"in",
"case",
"of",
"multiple",
"tiled",
"sprites",
".",
"<p",
">",
"{",
... | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java#L232-L235 |
jmeter-maven-plugin/jmeter-maven-plugin | src/main/java/com/lazerycode/jmeter/configuration/ArtifactHelpers.java | ArtifactHelpers.convertExclusionPatternIntoExclusion | static Exclusion convertExclusionPatternIntoExclusion(String exceptionPattern) throws MojoExecutionException {
Matcher matcher = COORDINATE_PATTERN.matcher(exceptionPattern);
if (!matcher.matches()) {
throw new MojoExecutionException(String.format("Bad artifact coordinates %s, expected format is <groupId>:<artifactId>[:<extension>][:<classifier>]", exceptionPattern));
}
return new Exclusion(matcher.group(1), matcher.group(2), matcher.group(4), matcher.group(6));
} | java | static Exclusion convertExclusionPatternIntoExclusion(String exceptionPattern) throws MojoExecutionException {
Matcher matcher = COORDINATE_PATTERN.matcher(exceptionPattern);
if (!matcher.matches()) {
throw new MojoExecutionException(String.format("Bad artifact coordinates %s, expected format is <groupId>:<artifactId>[:<extension>][:<classifier>]", exceptionPattern));
}
return new Exclusion(matcher.group(1), matcher.group(2), matcher.group(4), matcher.group(6));
} | [
"static",
"Exclusion",
"convertExclusionPatternIntoExclusion",
"(",
"String",
"exceptionPattern",
")",
"throws",
"MojoExecutionException",
"{",
"Matcher",
"matcher",
"=",
"COORDINATE_PATTERN",
".",
"matcher",
"(",
"exceptionPattern",
")",
";",
"if",
"(",
"!",
"matcher",... | Convert an exclusion pattern into an Exclusion object
@param exceptionPattern coords pattern in the format <groupId>:<artifactId>[:<extension>][:<classifier>]
@return Exclusion object
@throws MojoExecutionException if coords pattern is invalid | [
"Convert",
"an",
"exclusion",
"pattern",
"into",
"an",
"Exclusion",
"object"
] | train | https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/configuration/ArtifactHelpers.java#L84-L91 |
helun/Ektorp | org.ektorp/src/main/java/org/ektorp/support/DesignDocument.java | DesignDocument.mergeWith | public boolean mergeWith(DesignDocument dd, boolean updateOnDiff) {
boolean changed = mergeViews(dd.views(), updateOnDiff);
changed = mergeFunctions(lists(), dd.lists(), updateOnDiff) || changed;
changed = mergeFunctions(shows(), dd.shows(), updateOnDiff) || changed;
changed = mergeFunctions(filters(), dd.filters(), updateOnDiff) || changed;
changed = mergeFunctions(updates(), dd.updates(), updateOnDiff) || changed;
return changed;
} | java | public boolean mergeWith(DesignDocument dd, boolean updateOnDiff) {
boolean changed = mergeViews(dd.views(), updateOnDiff);
changed = mergeFunctions(lists(), dd.lists(), updateOnDiff) || changed;
changed = mergeFunctions(shows(), dd.shows(), updateOnDiff) || changed;
changed = mergeFunctions(filters(), dd.filters(), updateOnDiff) || changed;
changed = mergeFunctions(updates(), dd.updates(), updateOnDiff) || changed;
return changed;
} | [
"public",
"boolean",
"mergeWith",
"(",
"DesignDocument",
"dd",
",",
"boolean",
"updateOnDiff",
")",
"{",
"boolean",
"changed",
"=",
"mergeViews",
"(",
"dd",
".",
"views",
"(",
")",
",",
"updateOnDiff",
")",
";",
"changed",
"=",
"mergeFunctions",
"(",
"lists"... | Merge this design document with the specified document, the result being
stored in this design document.
@param dd
the design document to merge with
@param updateOnDiff
true to overwrite existing views/functions in this document
with the views/functions in the specified document; false will
only add new views/functions.
@return true if there was any modification to this document, false otherwise. | [
"Merge",
"this",
"design",
"document",
"with",
"the",
"specified",
"document",
"the",
"result",
"being",
"stored",
"in",
"this",
"design",
"document",
"."
] | train | https://github.com/helun/Ektorp/blob/b822c0d656aefb90a5e0cb5ec2de3daa969e3eaa/org.ektorp/src/main/java/org/ektorp/support/DesignDocument.java#L199-L206 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnGatewaysInner.java | VpnGatewaysInner.createOrUpdate | public VpnGatewayInner createOrUpdate(String resourceGroupName, String gatewayName, VpnGatewayInner vpnGatewayParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, vpnGatewayParameters).toBlocking().last().body();
} | java | public VpnGatewayInner createOrUpdate(String resourceGroupName, String gatewayName, VpnGatewayInner vpnGatewayParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, vpnGatewayParameters).toBlocking().last().body();
} | [
"public",
"VpnGatewayInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"gatewayName",
",",
"VpnGatewayInner",
"vpnGatewayParameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"gatewayName",
",",
... | Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway.
@param resourceGroupName The resource group name of the VpnGateway.
@param gatewayName The name of the gateway.
@param vpnGatewayParameters Parameters supplied to create or Update a virtual wan vpn gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VpnGatewayInner object if successful. | [
"Creates",
"a",
"virtual",
"wan",
"vpn",
"gateway",
"if",
"it",
"doesn",
"t",
"exist",
"else",
"updates",
"the",
"existing",
"gateway",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnGatewaysInner.java#L211-L213 |
dbracewell/mango | src/main/java/com/davidbracewell/reflection/Reflect.java | Reflect.onClass | public static Reflect onClass(String clazz) throws Exception {
return new Reflect(null, ReflectionUtils.getClassForName(clazz));
} | java | public static Reflect onClass(String clazz) throws Exception {
return new Reflect(null, ReflectionUtils.getClassForName(clazz));
} | [
"public",
"static",
"Reflect",
"onClass",
"(",
"String",
"clazz",
")",
"throws",
"Exception",
"{",
"return",
"new",
"Reflect",
"(",
"null",
",",
"ReflectionUtils",
".",
"getClassForName",
"(",
"clazz",
")",
")",
";",
"}"
] | Creates an instance of Reflect associated with a class
@param clazz The class for reflection as string
@return The Reflect object
@throws Exception the exception | [
"Creates",
"an",
"instance",
"of",
"Reflect",
"associated",
"with",
"a",
"class"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/reflection/Reflect.java#L90-L92 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java | RandomMatrices_ZDRM.fillUniform | public static void fillUniform(ZMatrixD1 mat , double min , double max , Random rand )
{
double d[] = mat.getData();
int size = mat.getDataLength();
double r = max-min;
for( int i = 0; i < size; i++ ) {
d[i] = r*rand.nextDouble()+min;
}
} | java | public static void fillUniform(ZMatrixD1 mat , double min , double max , Random rand )
{
double d[] = mat.getData();
int size = mat.getDataLength();
double r = max-min;
for( int i = 0; i < size; i++ ) {
d[i] = r*rand.nextDouble()+min;
}
} | [
"public",
"static",
"void",
"fillUniform",
"(",
"ZMatrixD1",
"mat",
",",
"double",
"min",
",",
"double",
"max",
",",
"Random",
"rand",
")",
"{",
"double",
"d",
"[",
"]",
"=",
"mat",
".",
"getData",
"(",
")",
";",
"int",
"size",
"=",
"mat",
".",
"ge... | <p>
Sets each element in the matrix to a value drawn from an uniform distribution from 'min' to 'max' inclusive.
</p>
@param min The minimum value each element can be.
@param max The maximum value each element can be.
@param mat The matrix who is to be randomized. Modified.
@param rand Random number generator used to fill the matrix. | [
"<p",
">",
"Sets",
"each",
"element",
"in",
"the",
"matrix",
"to",
"a",
"value",
"drawn",
"from",
"an",
"uniform",
"distribution",
"from",
"min",
"to",
"max",
"inclusive",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java#L91-L101 |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OClusterLocal.java | OClusterLocal.updateDataSegmentPosition | public void updateDataSegmentPosition(long iPosition, final int iDataSegmentId, final long iDataSegmentPosition)
throws IOException {
iPosition = iPosition * RECORD_SIZE;
acquireExclusiveLock();
try {
final long[] pos = fileSegment.getRelativePosition(iPosition);
final OFile f = fileSegment.files[(int) pos[0]];
long p = pos[1];
f.writeShort(p, (short) iDataSegmentId);
f.writeLong(p += OBinaryProtocol.SIZE_SHORT, iDataSegmentPosition);
} finally {
releaseExclusiveLock();
}
} | java | public void updateDataSegmentPosition(long iPosition, final int iDataSegmentId, final long iDataSegmentPosition)
throws IOException {
iPosition = iPosition * RECORD_SIZE;
acquireExclusiveLock();
try {
final long[] pos = fileSegment.getRelativePosition(iPosition);
final OFile f = fileSegment.files[(int) pos[0]];
long p = pos[1];
f.writeShort(p, (short) iDataSegmentId);
f.writeLong(p += OBinaryProtocol.SIZE_SHORT, iDataSegmentPosition);
} finally {
releaseExclusiveLock();
}
} | [
"public",
"void",
"updateDataSegmentPosition",
"(",
"long",
"iPosition",
",",
"final",
"int",
"iDataSegmentId",
",",
"final",
"long",
"iDataSegmentPosition",
")",
"throws",
"IOException",
"{",
"iPosition",
"=",
"iPosition",
"*",
"RECORD_SIZE",
";",
"acquireExclusiveLo... | Update position in data segment (usually on defrag)
@throws IOException | [
"Update",
"position",
"in",
"data",
"segment",
"(",
"usually",
"on",
"defrag",
")"
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OClusterLocal.java#L227-L245 |
ltsopensource/light-task-scheduler | lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java | WebUtils.doGet | public static String doGet(String url, Map<String, String> params) throws IOException {
return doGet(url, params, DEFAULT_CHARSET);
} | java | public static String doGet(String url, Map<String, String> params) throws IOException {
return doGet(url, params, DEFAULT_CHARSET);
} | [
"public",
"static",
"String",
"doGet",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"IOException",
"{",
"return",
"doGet",
"(",
"url",
",",
"params",
",",
"DEFAULT_CHARSET",
")",
";",
"}"
] | 执行HTTP GET请求。
@param url 请求地址
@param params 请求参数
@return 响应字符串 | [
"执行HTTP",
"GET请求。"
] | train | https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java#L120-L122 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/Keys.java | Keys.fillServer | public static void fillServer(final Map<String, Object> dataModel) {
dataModel.put(Server.SERVER_SCHEME, Latkes.getServerScheme());
dataModel.put(Server.SERVER_HOST, Latkes.getServerHost());
dataModel.put(Server.SERVER_PORT, Latkes.getServerPort());
dataModel.put(Server.SERVER, Latkes.getServer());
dataModel.put(Server.CONTEXT_PATH, Latkes.getContextPath());
dataModel.put(Server.SERVE_PATH, Latkes.getServePath());
dataModel.put(Server.STATIC_SERVER_SCHEME, Latkes.getStaticServerScheme());
dataModel.put(Server.STATIC_SERVER_HOST, Latkes.getStaticServerHost());
dataModel.put(Server.STATIC_SERVER_PORT, Latkes.getStaticServerPort());
dataModel.put(Server.STATIC_SERVER, Latkes.getStaticServer());
dataModel.put(Server.STATIC_PATH, Latkes.getStaticPath());
dataModel.put(Server.STATIC_SERVE_PATH, Latkes.getStaticServePath());
} | java | public static void fillServer(final Map<String, Object> dataModel) {
dataModel.put(Server.SERVER_SCHEME, Latkes.getServerScheme());
dataModel.put(Server.SERVER_HOST, Latkes.getServerHost());
dataModel.put(Server.SERVER_PORT, Latkes.getServerPort());
dataModel.put(Server.SERVER, Latkes.getServer());
dataModel.put(Server.CONTEXT_PATH, Latkes.getContextPath());
dataModel.put(Server.SERVE_PATH, Latkes.getServePath());
dataModel.put(Server.STATIC_SERVER_SCHEME, Latkes.getStaticServerScheme());
dataModel.put(Server.STATIC_SERVER_HOST, Latkes.getStaticServerHost());
dataModel.put(Server.STATIC_SERVER_PORT, Latkes.getStaticServerPort());
dataModel.put(Server.STATIC_SERVER, Latkes.getStaticServer());
dataModel.put(Server.STATIC_PATH, Latkes.getStaticPath());
dataModel.put(Server.STATIC_SERVE_PATH, Latkes.getStaticServePath());
} | [
"public",
"static",
"void",
"fillServer",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"dataModel",
")",
"{",
"dataModel",
".",
"put",
"(",
"Server",
".",
"SERVER_SCHEME",
",",
"Latkes",
".",
"getServerScheme",
"(",
")",
")",
";",
"dataModel",
... | Fills the server info into the specified data model.
<ul>
<li>{@value org.b3log.latke.Keys.Server#SERVER_SCHEME}</li>
<li>{@value org.b3log.latke.Keys.Server#SERVER_HOST}</li>
<li>{@value org.b3log.latke.Keys.Server#SERVER_PORT}</li>
<li>{@value org.b3log.latke.Keys.Server#SERVER}</li>
<li>{@value org.b3log.latke.Keys.Server#CONTEXT_PATH}</li>
<li>{@value org.b3log.latke.Keys.Server#SERVE_PATH}</li>
<li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER_SCHEME}</li>
<li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER_HOST}</li>
<li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER_PORT}</li>
<li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER}</li>
<li>{@value org.b3log.latke.Keys.Server#STATIC_PATH}</li>
<li>{@value org.b3log.latke.Keys.Server#STATIC_SERVE_PATH}</li>
</ul>
@param dataModel the specified data model | [
"Fills",
"the",
"server",
"info",
"into",
"the",
"specified",
"data",
"model",
".",
"<ul",
">",
"<li",
">",
"{",
"@value",
"org",
".",
"b3log",
".",
"latke",
".",
"Keys",
".",
"Server#SERVER_SCHEME",
"}",
"<",
"/",
"li",
">",
"<li",
">",
"{",
"@value... | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Keys.java#L142-L156 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java | URLConnectionTools.getInputStream | public static InputStream getInputStream(URL url, int timeout) throws IOException
{
return getInputStream(url,true, timeout);
} | java | public static InputStream getInputStream(URL url, int timeout) throws IOException
{
return getInputStream(url,true, timeout);
} | [
"public",
"static",
"InputStream",
"getInputStream",
"(",
"URL",
"url",
",",
"int",
"timeout",
")",
"throws",
"IOException",
"{",
"return",
"getInputStream",
"(",
"url",
",",
"true",
",",
"timeout",
")",
";",
"}"
] | Connect to server and return result as an InputStream.
always asks for response to be in GZIP encoded
<p>
The caller is responsible to close the returned InputStream not to cause
resource leaks.
@param url the URL to connect to
@param timeout the timeout for the connection
@return an {@link InputStream} of response
@throws IOException due to an error opening the URL | [
"Connect",
"to",
"server",
"and",
"return",
"result",
"as",
"an",
"InputStream",
".",
"always",
"asks",
"for",
"response",
"to",
"be",
"in",
"GZIP",
"encoded",
"<p",
">",
"The",
"caller",
"is",
"responsible",
"to",
"close",
"the",
"returned",
"InputStream",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java#L91-L94 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java | TypeConverter.convertToByte | public static byte convertToByte (@Nullable final Object aSrcValue, final byte nDefault)
{
final Byte aValue = convert (aSrcValue, Byte.class, null);
return aValue == null ? nDefault : aValue.byteValue ();
} | java | public static byte convertToByte (@Nullable final Object aSrcValue, final byte nDefault)
{
final Byte aValue = convert (aSrcValue, Byte.class, null);
return aValue == null ? nDefault : aValue.byteValue ();
} | [
"public",
"static",
"byte",
"convertToByte",
"(",
"@",
"Nullable",
"final",
"Object",
"aSrcValue",
",",
"final",
"byte",
"nDefault",
")",
"{",
"final",
"Byte",
"aValue",
"=",
"convert",
"(",
"aSrcValue",
",",
"Byte",
".",
"class",
",",
"null",
")",
";",
... | Convert the passed source value to byte
@param aSrcValue
The source value. May be <code>null</code>.
@param nDefault
The default value to be returned if an error occurs during type
conversion.
@return The converted value.
@throws RuntimeException
If the converter itself throws an exception
@see TypeConverterProviderBestMatch | [
"Convert",
"the",
"passed",
"source",
"value",
"to",
"byte"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L175-L179 |
spring-projects/spring-plugin | core/src/main/java/org/springframework/plugin/core/OrderAwarePluginRegistry.java | OrderAwarePluginRegistry.reverse | public OrderAwarePluginRegistry<T, S> reverse() {
List<T> copy = new ArrayList<>(getPlugins());
return of(copy, comparator.reversed());
} | java | public OrderAwarePluginRegistry<T, S> reverse() {
List<T> copy = new ArrayList<>(getPlugins());
return of(copy, comparator.reversed());
} | [
"public",
"OrderAwarePluginRegistry",
"<",
"T",
",",
"S",
">",
"reverse",
"(",
")",
"{",
"List",
"<",
"T",
">",
"copy",
"=",
"new",
"ArrayList",
"<>",
"(",
"getPlugins",
"(",
")",
")",
";",
"return",
"of",
"(",
"copy",
",",
"comparator",
".",
"revers... | Returns a new {@link OrderAwarePluginRegistry} with the order of the plugins reverted.
@return | [
"Returns",
"a",
"new",
"{",
"@link",
"OrderAwarePluginRegistry",
"}",
"with",
"the",
"order",
"of",
"the",
"plugins",
"reverted",
"."
] | train | https://github.com/spring-projects/spring-plugin/blob/953d2ce12f05f26444fbb3bf21011f538f729868/core/src/main/java/org/springframework/plugin/core/OrderAwarePluginRegistry.java#L226-L230 |
actorapp/actor-platform | actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java | MarkdownParser.handleTextBlock | private void handleTextBlock(TextCursor cursor, int blockEnd, ArrayList<MDSection> paragraphs) {
MDText[] spans = handleSpans(cursor, blockEnd);
paragraphs.add(new MDSection(spans));
cursor.currentOffset = blockEnd;
} | java | private void handleTextBlock(TextCursor cursor, int blockEnd, ArrayList<MDSection> paragraphs) {
MDText[] spans = handleSpans(cursor, blockEnd);
paragraphs.add(new MDSection(spans));
cursor.currentOffset = blockEnd;
} | [
"private",
"void",
"handleTextBlock",
"(",
"TextCursor",
"cursor",
",",
"int",
"blockEnd",
",",
"ArrayList",
"<",
"MDSection",
">",
"paragraphs",
")",
"{",
"MDText",
"[",
"]",
"spans",
"=",
"handleSpans",
"(",
"cursor",
",",
"blockEnd",
")",
";",
"paragraphs... | Processing text blocks between code blocks
@param cursor text cursor
@param blockEnd text block end
@param paragraphs current paragraphs | [
"Processing",
"text",
"blocks",
"between",
"code",
"blocks"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java#L85-L89 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/ActivityUtils.java | ActivityUtils.getCurrentActivity | public Activity getCurrentActivity(boolean shouldSleepFirst, boolean waitForActivity) {
if(shouldSleepFirst){
sleeper.sleep();
}
if(!config.trackActivities){
return activity;
}
if(waitForActivity){
waitForActivityIfNotAvailable();
}
if(!activityStack.isEmpty()){
activity=activityStack.peek().get();
}
return activity;
} | java | public Activity getCurrentActivity(boolean shouldSleepFirst, boolean waitForActivity) {
if(shouldSleepFirst){
sleeper.sleep();
}
if(!config.trackActivities){
return activity;
}
if(waitForActivity){
waitForActivityIfNotAvailable();
}
if(!activityStack.isEmpty()){
activity=activityStack.peek().get();
}
return activity;
} | [
"public",
"Activity",
"getCurrentActivity",
"(",
"boolean",
"shouldSleepFirst",
",",
"boolean",
"waitForActivity",
")",
"{",
"if",
"(",
"shouldSleepFirst",
")",
"{",
"sleeper",
".",
"sleep",
"(",
")",
";",
"}",
"if",
"(",
"!",
"config",
".",
"trackActivities",... | Returns the current {@code Activity}.
@param shouldSleepFirst whether to sleep a default pause first
@param waitForActivity whether to wait for the activity
@return the current {@code Activity} | [
"Returns",
"the",
"current",
"{",
"@code",
"Activity",
"}",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/ActivityUtils.java#L295-L310 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.getAt | public static String getAt(CharSequence self, Collection indices) {
StringBuilder answer = new StringBuilder();
for (Object value : indices) {
if (value instanceof Range) {
answer.append(getAt(self, (Range) value));
} else if (value instanceof Collection) {
answer.append(getAt(self, (Collection) value));
} else {
int idx = DefaultTypeTransformation.intUnbox(value);
answer.append(getAt(self, idx));
}
}
return answer.toString();
} | java | public static String getAt(CharSequence self, Collection indices) {
StringBuilder answer = new StringBuilder();
for (Object value : indices) {
if (value instanceof Range) {
answer.append(getAt(self, (Range) value));
} else if (value instanceof Collection) {
answer.append(getAt(self, (Collection) value));
} else {
int idx = DefaultTypeTransformation.intUnbox(value);
answer.append(getAt(self, idx));
}
}
return answer.toString();
} | [
"public",
"static",
"String",
"getAt",
"(",
"CharSequence",
"self",
",",
"Collection",
"indices",
")",
"{",
"StringBuilder",
"answer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Object",
"value",
":",
"indices",
")",
"{",
"if",
"(",
"value",
... | Select a List of characters from a CharSequence using a Collection
to identify the indices to be selected.
@param self a CharSequence
@param indices a Collection of indices
@return a String consisting of the characters at the given indices
@since 1.0 | [
"Select",
"a",
"List",
"of",
"characters",
"from",
"a",
"CharSequence",
"using",
"a",
"Collection",
"to",
"identify",
"the",
"indices",
"to",
"be",
"selected",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1205-L1218 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.failoverPriorityChange | public void failoverPriorityChange(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) {
failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().last().body();
} | java | public void failoverPriorityChange(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) {
failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().last().body();
} | [
"public",
"void",
"failoverPriorityChange",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"List",
"<",
"FailoverPolicy",
">",
"failoverPolicies",
")",
"{",
"failoverPriorityChangeWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName... | Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param failoverPolicies List of failover policies.
@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 | [
"Changes",
"the",
"failover",
"priority",
"for",
"the",
"Azure",
"Cosmos",
"DB",
"database",
"account",
".",
"A",
"failover",
"priority",
"of",
"0",
"indicates",
"a",
"write",
"region",
".",
"The",
"maximum",
"value",
"for",
"a",
"failover",
"priority",
"=",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L769-L771 |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java | NameHelper.getPropertyName | public String getPropertyName(String jsonFieldName, JsonNode node) {
jsonFieldName = getFieldName(jsonFieldName, node);
jsonFieldName = replaceIllegalCharacters(jsonFieldName);
jsonFieldName = normalizeName(jsonFieldName);
jsonFieldName = makeLowerCamelCase(jsonFieldName);
if (isKeyword(jsonFieldName)) {
jsonFieldName = "_" + jsonFieldName;
}
if (isKeyword(jsonFieldName)) {
jsonFieldName += "_";
}
return jsonFieldName;
} | java | public String getPropertyName(String jsonFieldName, JsonNode node) {
jsonFieldName = getFieldName(jsonFieldName, node);
jsonFieldName = replaceIllegalCharacters(jsonFieldName);
jsonFieldName = normalizeName(jsonFieldName);
jsonFieldName = makeLowerCamelCase(jsonFieldName);
if (isKeyword(jsonFieldName)) {
jsonFieldName = "_" + jsonFieldName;
}
if (isKeyword(jsonFieldName)) {
jsonFieldName += "_";
}
return jsonFieldName;
} | [
"public",
"String",
"getPropertyName",
"(",
"String",
"jsonFieldName",
",",
"JsonNode",
"node",
")",
"{",
"jsonFieldName",
"=",
"getFieldName",
"(",
"jsonFieldName",
",",
"node",
")",
";",
"jsonFieldName",
"=",
"replaceIllegalCharacters",
"(",
"jsonFieldName",
")",
... | Convert jsonFieldName into the equivalent Java fieldname by replacing
illegal characters and normalizing it.
@param jsonFieldName
@param node
@return | [
"Convert",
"jsonFieldName",
"into",
"the",
"equivalent",
"Java",
"fieldname",
"by",
"replacing",
"illegal",
"characters",
"and",
"normalizing",
"it",
"."
] | train | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java#L103-L119 |
taimos/dvalin | mongodb/src/main/java/de/taimos/dvalin/mongo/ChangelogUtil.java | ChangelogUtil.addIndex | public static void addIndex(DBCollection collection, String field, boolean asc, boolean background) {
int dir = (asc) ? 1 : -1;
collection.createIndex(new BasicDBObject(field, dir), new BasicDBObject("background", background));
} | java | public static void addIndex(DBCollection collection, String field, boolean asc, boolean background) {
int dir = (asc) ? 1 : -1;
collection.createIndex(new BasicDBObject(field, dir), new BasicDBObject("background", background));
} | [
"public",
"static",
"void",
"addIndex",
"(",
"DBCollection",
"collection",
",",
"String",
"field",
",",
"boolean",
"asc",
",",
"boolean",
"background",
")",
"{",
"int",
"dir",
"=",
"(",
"asc",
")",
"?",
"1",
":",
"-",
"1",
";",
"collection",
".",
"crea... | Add an index on the given collection and field
@param collection the collection to use for the index
@param field the field to use for the index
@param asc the sorting direction. <code>true</code> to sort ascending; <code>false</code> to sort descending
@param background iff <code>true</code> the index is created in the background | [
"Add",
"an",
"index",
"on",
"the",
"given",
"collection",
"and",
"field"
] | train | https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/mongodb/src/main/java/de/taimos/dvalin/mongo/ChangelogUtil.java#L62-L65 |
jillesvangurp/iterables-support | src/main/java/com/jillesvangurp/iterables/Iterables.java | Iterables.castingIterable | public static <I,O> Iterable<O> castingIterable(Iterable<I> it, Class<O> clazz) {
return map(it, new Processor<I,O>() {
@SuppressWarnings("unchecked")
@Override
public O process(I input) {
return (O)input;
}});
} | java | public static <I,O> Iterable<O> castingIterable(Iterable<I> it, Class<O> clazz) {
return map(it, new Processor<I,O>() {
@SuppressWarnings("unchecked")
@Override
public O process(I input) {
return (O)input;
}});
} | [
"public",
"static",
"<",
"I",
",",
"O",
">",
"Iterable",
"<",
"O",
">",
"castingIterable",
"(",
"Iterable",
"<",
"I",
">",
"it",
",",
"Class",
"<",
"O",
">",
"clazz",
")",
"{",
"return",
"map",
"(",
"it",
",",
"new",
"Processor",
"<",
"I",
",",
... | Allows you to iterate over objects and cast them to the appropriate type on the fly.
@param it iterable of I
@param clazz class to cast to
@param <I> input type
@param <O> output type
@return an iterable that casts elements to the specified class.
@throws ClassCastException if the elements are not castable | [
"Allows",
"you",
"to",
"iterate",
"over",
"objects",
"and",
"cast",
"them",
"to",
"the",
"appropriate",
"type",
"on",
"the",
"fly",
"."
] | train | https://github.com/jillesvangurp/iterables-support/blob/a0a967d82fb7d8d5504a50eb19d5e7f1541b2771/src/main/java/com/jillesvangurp/iterables/Iterables.java#L298-L305 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/service/RunService.java | RunService.findContainerId | private String findContainerId(String imageNameOrAlias, boolean checkAllContainers) throws DockerAccessException {
String id = lookupContainer(imageNameOrAlias);
// check for external container. The image name is interpreted as a *container name* for that case ...
if (id == null) {
Container container = queryService.getContainer(imageNameOrAlias);
if (container != null && (checkAllContainers || container.isRunning())) {
id = container.getId();
}
}
return id;
} | java | private String findContainerId(String imageNameOrAlias, boolean checkAllContainers) throws DockerAccessException {
String id = lookupContainer(imageNameOrAlias);
// check for external container. The image name is interpreted as a *container name* for that case ...
if (id == null) {
Container container = queryService.getContainer(imageNameOrAlias);
if (container != null && (checkAllContainers || container.isRunning())) {
id = container.getId();
}
}
return id;
} | [
"private",
"String",
"findContainerId",
"(",
"String",
"imageNameOrAlias",
",",
"boolean",
"checkAllContainers",
")",
"throws",
"DockerAccessException",
"{",
"String",
"id",
"=",
"lookupContainer",
"(",
"imageNameOrAlias",
")",
";",
"// check for external container. The ima... | checkAllContainers: false = only running containers are considered | [
"checkAllContainers",
":",
"false",
"=",
"only",
"running",
"containers",
"are",
"considered"
] | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/service/RunService.java#L423-L434 |
cqframework/clinical_quality_language | Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java | ElmBaseVisitor.visitNaryExpression | public T visitNaryExpression(NaryExpression elm, C context) {
if (elm instanceof Coalesce) return visitCoalesce((Coalesce)elm, context);
else if (elm instanceof Concatenate) return visitConcatenate((Concatenate)elm, context);
else if (elm instanceof Except) return visitExcept((Except)elm, context);
else if (elm instanceof Intersect) return visitIntersect((Intersect)elm, context);
else if (elm instanceof Union) return visitUnion((Union)elm, context);
else return null;
} | java | public T visitNaryExpression(NaryExpression elm, C context) {
if (elm instanceof Coalesce) return visitCoalesce((Coalesce)elm, context);
else if (elm instanceof Concatenate) return visitConcatenate((Concatenate)elm, context);
else if (elm instanceof Except) return visitExcept((Except)elm, context);
else if (elm instanceof Intersect) return visitIntersect((Intersect)elm, context);
else if (elm instanceof Union) return visitUnion((Union)elm, context);
else return null;
} | [
"public",
"T",
"visitNaryExpression",
"(",
"NaryExpression",
"elm",
",",
"C",
"context",
")",
"{",
"if",
"(",
"elm",
"instanceof",
"Coalesce",
")",
"return",
"visitCoalesce",
"(",
"(",
"Coalesce",
")",
"elm",
",",
"context",
")",
";",
"else",
"if",
"(",
... | Visit a NaryExpression. This method will be called for
every node in the tree that is a NaryExpression.
@param elm the ELM tree
@param context the context passed to the visitor
@return the visitor result | [
"Visit",
"a",
"NaryExpression",
".",
"This",
"method",
"will",
"be",
"called",
"for",
"every",
"node",
"in",
"the",
"tree",
"that",
"is",
"a",
"NaryExpression",
"."
] | train | https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L299-L306 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/util/AbstractAlgorithmRunner.java | AbstractAlgorithmRunner.printQualityIndicators | public static <S extends Solution<?>> void printQualityIndicators(List<S> population, String paretoFrontFile)
throws FileNotFoundException {
Front referenceFront = new ArrayFront(paretoFrontFile);
FrontNormalizer frontNormalizer = new FrontNormalizer(referenceFront) ;
Front normalizedReferenceFront = frontNormalizer.normalize(referenceFront) ;
Front normalizedFront = frontNormalizer.normalize(new ArrayFront(population)) ;
List<PointSolution> normalizedPopulation = FrontUtils
.convertFrontToSolutionList(normalizedFront) ;
String outputString = "\n" ;
outputString += "Hypervolume (N) : " +
new PISAHypervolume<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString += "Hypervolume : " +
new PISAHypervolume<S>(referenceFront).evaluate(population) + "\n";
outputString += "Epsilon (N) : " +
new Epsilon<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) +
"\n" ;
outputString += "Epsilon : " +
new Epsilon<S>(referenceFront).evaluate(population) + "\n" ;
outputString += "GD (N) : " +
new GenerationalDistance<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString += "GD : " +
new GenerationalDistance<S>(referenceFront).evaluate(population) + "\n";
outputString += "IGD (N) : " +
new InvertedGenerationalDistance<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString +="IGD : " +
new InvertedGenerationalDistance<S>(referenceFront).evaluate(population) + "\n";
outputString += "IGD+ (N) : " +
new InvertedGenerationalDistancePlus<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString += "IGD+ : " +
new InvertedGenerationalDistancePlus<S>(referenceFront).evaluate(population) + "\n";
outputString += "Spread (N) : " +
new Spread<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString += "Spread : " +
new Spread<S>(referenceFront).evaluate(population) + "\n";
// outputString += "R2 (N) : " +
// new R2<List<DoubleSolution>>(normalizedReferenceFront).runAlgorithm(normalizedPopulation) + "\n";
// outputString += "R2 : " +
// new R2<List<? extends Solution<?>>>(referenceFront).runAlgorithm(population) + "\n";
outputString += "Error ratio : " +
new ErrorRatio<List<? extends Solution<?>>>(referenceFront).evaluate(population) + "\n";
JMetalLogger.logger.info(outputString);
} | java | public static <S extends Solution<?>> void printQualityIndicators(List<S> population, String paretoFrontFile)
throws FileNotFoundException {
Front referenceFront = new ArrayFront(paretoFrontFile);
FrontNormalizer frontNormalizer = new FrontNormalizer(referenceFront) ;
Front normalizedReferenceFront = frontNormalizer.normalize(referenceFront) ;
Front normalizedFront = frontNormalizer.normalize(new ArrayFront(population)) ;
List<PointSolution> normalizedPopulation = FrontUtils
.convertFrontToSolutionList(normalizedFront) ;
String outputString = "\n" ;
outputString += "Hypervolume (N) : " +
new PISAHypervolume<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString += "Hypervolume : " +
new PISAHypervolume<S>(referenceFront).evaluate(population) + "\n";
outputString += "Epsilon (N) : " +
new Epsilon<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) +
"\n" ;
outputString += "Epsilon : " +
new Epsilon<S>(referenceFront).evaluate(population) + "\n" ;
outputString += "GD (N) : " +
new GenerationalDistance<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString += "GD : " +
new GenerationalDistance<S>(referenceFront).evaluate(population) + "\n";
outputString += "IGD (N) : " +
new InvertedGenerationalDistance<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString +="IGD : " +
new InvertedGenerationalDistance<S>(referenceFront).evaluate(population) + "\n";
outputString += "IGD+ (N) : " +
new InvertedGenerationalDistancePlus<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString += "IGD+ : " +
new InvertedGenerationalDistancePlus<S>(referenceFront).evaluate(population) + "\n";
outputString += "Spread (N) : " +
new Spread<PointSolution>(normalizedReferenceFront).evaluate(normalizedPopulation) + "\n";
outputString += "Spread : " +
new Spread<S>(referenceFront).evaluate(population) + "\n";
// outputString += "R2 (N) : " +
// new R2<List<DoubleSolution>>(normalizedReferenceFront).runAlgorithm(normalizedPopulation) + "\n";
// outputString += "R2 : " +
// new R2<List<? extends Solution<?>>>(referenceFront).runAlgorithm(population) + "\n";
outputString += "Error ratio : " +
new ErrorRatio<List<? extends Solution<?>>>(referenceFront).evaluate(population) + "\n";
JMetalLogger.logger.info(outputString);
} | [
"public",
"static",
"<",
"S",
"extends",
"Solution",
"<",
"?",
">",
">",
"void",
"printQualityIndicators",
"(",
"List",
"<",
"S",
">",
"population",
",",
"String",
"paretoFrontFile",
")",
"throws",
"FileNotFoundException",
"{",
"Front",
"referenceFront",
"=",
... | Print all the available quality indicators
@param population
@param paretoFrontFile
@throws FileNotFoundException | [
"Print",
"all",
"the",
"available",
"quality",
"indicators"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/AbstractAlgorithmRunner.java#L47-L91 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/AtsUtils.java | AtsUtils.ungzip | public static File ungzip(File gzip, File toDir) throws IOException {
toDir.mkdirs();
File out = new File(toDir, gzip.getName());
GZIPInputStream gin = null;
FileOutputStream fout = null;
try {
FileInputStream fin = new FileInputStream(gzip);
gin = new GZIPInputStream(fin);
fout = new FileOutputStream(out);
copy(gin, fout);
gin.close();
fout.close();
} finally {
closeQuietly(gin);
closeQuietly(fout);
}
return out;
} | java | public static File ungzip(File gzip, File toDir) throws IOException {
toDir.mkdirs();
File out = new File(toDir, gzip.getName());
GZIPInputStream gin = null;
FileOutputStream fout = null;
try {
FileInputStream fin = new FileInputStream(gzip);
gin = new GZIPInputStream(fin);
fout = new FileOutputStream(out);
copy(gin, fout);
gin.close();
fout.close();
} finally {
closeQuietly(gin);
closeQuietly(fout);
}
return out;
} | [
"public",
"static",
"File",
"ungzip",
"(",
"File",
"gzip",
",",
"File",
"toDir",
")",
"throws",
"IOException",
"{",
"toDir",
".",
"mkdirs",
"(",
")",
";",
"File",
"out",
"=",
"new",
"File",
"(",
"toDir",
",",
"gzip",
".",
"getName",
"(",
")",
")",
... | 解压gzip文件到指定的目录,目前只能解压gzip包里面只包含一个文件的压缩包。
@param gzip 需要解压的gzip文件
@param toDir 需要解压到的目录
@return 解压后的文件
@throws IOException | [
"解压gzip文件到指定的目录,目前只能解压gzip包里面只包含一个文件的压缩包。"
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/AtsUtils.java#L46-L63 |
apache/incubator-heron | heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java | SchedulerStateManagerAdaptor.getExecutionState | public ExecutionEnvironment.ExecutionState getExecutionState(String topologyName) {
return awaitResult(delegate.getExecutionState(null, topologyName));
} | java | public ExecutionEnvironment.ExecutionState getExecutionState(String topologyName) {
return awaitResult(delegate.getExecutionState(null, topologyName));
} | [
"public",
"ExecutionEnvironment",
".",
"ExecutionState",
"getExecutionState",
"(",
"String",
"topologyName",
")",
"{",
"return",
"awaitResult",
"(",
"delegate",
".",
"getExecutionState",
"(",
"null",
",",
"topologyName",
")",
")",
";",
"}"
] | Get the execution state for the given topology
@return ExecutionState | [
"Get",
"the",
"execution",
"state",
"for",
"the",
"given",
"topology"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L284-L286 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java | WebhookCluster.broadcast | public List<RequestFuture<?>> broadcast(File file)
{
Checks.notNull(file, "File");
return broadcast(file, file.getName());
} | java | public List<RequestFuture<?>> broadcast(File file)
{
Checks.notNull(file, "File");
return broadcast(file, file.getName());
} | [
"public",
"List",
"<",
"RequestFuture",
"<",
"?",
">",
">",
"broadcast",
"(",
"File",
"file",
")",
"{",
"Checks",
".",
"notNull",
"(",
"file",
",",
"\"File\"",
")",
";",
"return",
"broadcast",
"(",
"file",
",",
"file",
".",
"getName",
"(",
")",
")",
... | Sends the provided {@link java.io.File File}
to all registered {@link net.dv8tion.jda.webhook.WebhookClient WebhookClients}.
<br>Use {@link WebhookMessage#files(String, Object, Object...)} to send up to 10 files!
<p><b>The provided data should not exceed 8MB in size!</b>
@param file
The file that should be sent to the clients
@throws java.lang.IllegalArgumentException
If the provided file is {@code null}, does not exist or ist not readable
@throws java.util.concurrent.RejectedExecutionException
If any of the receivers has been shutdown
@return A list of {@link java.util.concurrent.Future Future} instances
representing all message tasks. | [
"Sends",
"the",
"provided",
"{",
"@link",
"java",
".",
"io",
".",
"File",
"File",
"}",
"to",
"all",
"registered",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"webhook",
".",
"WebhookClient",
"WebhookClients",
"}",
".",
"<br",
">",
"Use",
"{",... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java#L736-L740 |
JOML-CI/JOML | src/org/joml/Vector3i.java | Vector3i.setComponent | public Vector3i setComponent(int component, int value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
case 2:
z = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | java | public Vector3i setComponent(int component, int value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
case 2:
z = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | [
"public",
"Vector3i",
"setComponent",
"(",
"int",
"component",
",",
"int",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"switch",
"(",
"component",
")",
"{",
"case",
"0",
":",
"x",
"=",
"value",
";",
"break",
";",
"case",
"1",
":",
"y",
"=",
... | Set the value of the specified component of this vector.
@param component
the component whose value to set, within <code>[0..2]</code>
@param value
the value to set
@return this
@throws IllegalArgumentException if <code>component</code> is not within <code>[0..2]</code> | [
"Set",
"the",
"value",
"of",
"the",
"specified",
"component",
"of",
"this",
"vector",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3i.java#L417-L432 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/cache/cachepolicy_binding.java | cachepolicy_binding.get | public static cachepolicy_binding get(nitro_service service, String policyname) throws Exception{
cachepolicy_binding obj = new cachepolicy_binding();
obj.set_policyname(policyname);
cachepolicy_binding response = (cachepolicy_binding) obj.get_resource(service);
return response;
} | java | public static cachepolicy_binding get(nitro_service service, String policyname) throws Exception{
cachepolicy_binding obj = new cachepolicy_binding();
obj.set_policyname(policyname);
cachepolicy_binding response = (cachepolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"cachepolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"policyname",
")",
"throws",
"Exception",
"{",
"cachepolicy_binding",
"obj",
"=",
"new",
"cachepolicy_binding",
"(",
")",
";",
"obj",
".",
"set_policyname",
"(",
"pol... | Use this API to fetch cachepolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"cachepolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cache/cachepolicy_binding.java#L136-L141 |
bazaarvoice/emodb | auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/jersey/AuthResourceFilterFactory.java | AuthResourceFilterFactory.getSubstitutionIndex | private int getSubstitutionIndex(String param, String path) {
final String match = String.format("{%s}", param);
if (path.startsWith("/")) {
path = path.substring(1);
}
if (path.endsWith("/")) {
path = path.substring(0, path.length()-1);
}
String[] segments = path.split("/");
for (int i=0; i < segments.length; i++) {
if (match.equals(segments[i])) {
return i;
}
}
return -segments.length;
} | java | private int getSubstitutionIndex(String param, String path) {
final String match = String.format("{%s}", param);
if (path.startsWith("/")) {
path = path.substring(1);
}
if (path.endsWith("/")) {
path = path.substring(0, path.length()-1);
}
String[] segments = path.split("/");
for (int i=0; i < segments.length; i++) {
if (match.equals(segments[i])) {
return i;
}
}
return -segments.length;
} | [
"private",
"int",
"getSubstitutionIndex",
"(",
"String",
"param",
",",
"String",
"path",
")",
"{",
"final",
"String",
"match",
"=",
"String",
".",
"format",
"(",
"\"{%s}\"",
",",
"param",
")",
";",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"/\"",
")",... | Gets the index in a path where the substitution parameter was found, or the negative of the number of segments
in the path if it was not found. For example:
assert(getSubstitutionIndex("id", "resource/{id}/move") == 1)
assert(getSubstitutionIndex("not_found", "path/with/four/segments") == -4) | [
"Gets",
"the",
"index",
"in",
"a",
"path",
"where",
"the",
"substitution",
"parameter",
"was",
"found",
"or",
"the",
"negative",
"of",
"the",
"number",
"of",
"segments",
"in",
"the",
"path",
"if",
"it",
"was",
"not",
"found",
".",
"For",
"example",
":"
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/jersey/AuthResourceFilterFactory.java#L170-L188 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexResponse.java | CmsFlexResponse.setDateHeader | @Override
public void setDateHeader(String name, long date) {
setHeader(name, CmsDateUtil.getHeaderDate(date));
} | java | @Override
public void setDateHeader(String name, long date) {
setHeader(name, CmsDateUtil.getHeaderDate(date));
} | [
"@",
"Override",
"public",
"void",
"setDateHeader",
"(",
"String",
"name",
",",
"long",
"date",
")",
"{",
"setHeader",
"(",
"name",
",",
"CmsDateUtil",
".",
"getHeaderDate",
"(",
"date",
")",
")",
";",
"}"
] | Method overload from the standard HttpServletRequest API.<p>
@see javax.servlet.http.HttpServletResponse#setDateHeader(java.lang.String, long) | [
"Method",
"overload",
"from",
"the",
"standard",
"HttpServletRequest",
"API",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexResponse.java#L741-L745 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java | GrailsDomainBinder.bindJoinedSubClass | protected void bindJoinedSubClass(HibernatePersistentEntity sub, JoinedSubclass joinedSubclass,
InFlightMetadataCollector mappings, Mapping gormMapping, String sessionFactoryBeanName) {
bindClass(sub, joinedSubclass, mappings);
String schemaName = getSchemaName(mappings);
String catalogName = getCatalogName(mappings);
Table mytable = mappings.addTable(
schemaName, catalogName,
getJoinedSubClassTableName(sub, joinedSubclass, null, mappings, sessionFactoryBeanName),
null, false);
joinedSubclass.setTable(mytable);
LOG.info("Mapping joined-subclass: " + joinedSubclass.getEntityName() +
" -> " + joinedSubclass.getTable().getName());
SimpleValue key = new DependantValue(metadataBuildingContext, mytable, joinedSubclass.getIdentifier());
joinedSubclass.setKey(key);
final PersistentProperty identifier = sub.getIdentity();
String columnName = getColumnNameForPropertyAndPath(identifier, EMPTY_PATH, null, sessionFactoryBeanName);
bindSimpleValue(identifier.getType().getName(), key, false, columnName, mappings);
joinedSubclass.createPrimaryKey();
// properties
createClassProperties(sub, joinedSubclass, mappings, sessionFactoryBeanName);
} | java | protected void bindJoinedSubClass(HibernatePersistentEntity sub, JoinedSubclass joinedSubclass,
InFlightMetadataCollector mappings, Mapping gormMapping, String sessionFactoryBeanName) {
bindClass(sub, joinedSubclass, mappings);
String schemaName = getSchemaName(mappings);
String catalogName = getCatalogName(mappings);
Table mytable = mappings.addTable(
schemaName, catalogName,
getJoinedSubClassTableName(sub, joinedSubclass, null, mappings, sessionFactoryBeanName),
null, false);
joinedSubclass.setTable(mytable);
LOG.info("Mapping joined-subclass: " + joinedSubclass.getEntityName() +
" -> " + joinedSubclass.getTable().getName());
SimpleValue key = new DependantValue(metadataBuildingContext, mytable, joinedSubclass.getIdentifier());
joinedSubclass.setKey(key);
final PersistentProperty identifier = sub.getIdentity();
String columnName = getColumnNameForPropertyAndPath(identifier, EMPTY_PATH, null, sessionFactoryBeanName);
bindSimpleValue(identifier.getType().getName(), key, false, columnName, mappings);
joinedSubclass.createPrimaryKey();
// properties
createClassProperties(sub, joinedSubclass, mappings, sessionFactoryBeanName);
} | [
"protected",
"void",
"bindJoinedSubClass",
"(",
"HibernatePersistentEntity",
"sub",
",",
"JoinedSubclass",
"joinedSubclass",
",",
"InFlightMetadataCollector",
"mappings",
",",
"Mapping",
"gormMapping",
",",
"String",
"sessionFactoryBeanName",
")",
"{",
"bindClass",
"(",
"... | Binds a joined sub-class mapping using table-per-subclass
@param sub The Grails sub class
@param joinedSubclass The Hibernate Subclass object
@param mappings The mappings Object
@param gormMapping The GORM mapping object
@param sessionFactoryBeanName the session factory bean name | [
"Binds",
"a",
"joined",
"sub",
"-",
"class",
"mapping",
"using",
"table",
"-",
"per",
"-",
"subclass"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L1586-L1612 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java | AnnotationUtility.extractString | static void extractString(Elements elementUtils, Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attribute, OnAttributeFoundListener listener) {
extractAttributeValue(elementUtils, item, annotationClass.getCanonicalName(), attribute, listener);
} | java | static void extractString(Elements elementUtils, Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attribute, OnAttributeFoundListener listener) {
extractAttributeValue(elementUtils, item, annotationClass.getCanonicalName(), attribute, listener);
} | [
"static",
"void",
"extractString",
"(",
"Elements",
"elementUtils",
",",
"Element",
"item",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
",",
"AnnotationAttributeType",
"attribute",
",",
"OnAttributeFoundListener",
"listener",
")",
"{",
"... | Extract string.
@param elementUtils the element utils
@param item the item
@param annotationClass the annotation class
@param attribute the attribute
@param listener the listener | [
"Extract",
"string",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java#L340-L342 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/QuantilesHelper.java | QuantilesHelper.posOfPhi | public static long posOfPhi(final double phi, final long n) {
final long pos = (long) Math.floor(phi * n);
return (pos == n) ? n - 1 : pos;
} | java | public static long posOfPhi(final double phi, final long n) {
final long pos = (long) Math.floor(phi * n);
return (pos == n) ? n - 1 : pos;
} | [
"public",
"static",
"long",
"posOfPhi",
"(",
"final",
"double",
"phi",
",",
"final",
"long",
"n",
")",
"{",
"final",
"long",
"pos",
"=",
"(",
"long",
")",
"Math",
".",
"floor",
"(",
"phi",
"*",
"n",
")",
";",
"return",
"(",
"pos",
"==",
"n",
")",... | Returns the zero-based index (position) of a value in the hypothetical sorted stream of
values of size n.
@param phi the fractional position where: 0 ≤ φ ≤ 1.0.
@param n the size of the stream
@return the index, a value between 0 and n-1. | [
"Returns",
"the",
"zero",
"-",
"based",
"index",
"(",
"position",
")",
"of",
"a",
"value",
"in",
"the",
"hypothetical",
"sorted",
"stream",
"of",
"values",
"of",
"size",
"n",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuantilesHelper.java#L35-L38 |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java | InMemoryPublicationsFile.verifyMagicBytes | private void verifyMagicBytes(TLVInputStream input) throws InvalidPublicationsFileException {
try {
byte[] magicBytes = new byte[PUBLICATIONS_FILE_MAGIC_BYTES_LENGTH];
input.read(magicBytes);
if (!Arrays.equals(magicBytes, FILE_BEGINNING_MAGIC_BYTES)) {
throw new InvalidPublicationsFileException("Invalid publications file magic bytes");
}
} catch (IOException e) {
throw new InvalidPublicationsFileException("Checking publications file magic bytes failed", e);
}
} | java | private void verifyMagicBytes(TLVInputStream input) throws InvalidPublicationsFileException {
try {
byte[] magicBytes = new byte[PUBLICATIONS_FILE_MAGIC_BYTES_LENGTH];
input.read(magicBytes);
if (!Arrays.equals(magicBytes, FILE_BEGINNING_MAGIC_BYTES)) {
throw new InvalidPublicationsFileException("Invalid publications file magic bytes");
}
} catch (IOException e) {
throw new InvalidPublicationsFileException("Checking publications file magic bytes failed", e);
}
} | [
"private",
"void",
"verifyMagicBytes",
"(",
"TLVInputStream",
"input",
")",
"throws",
"InvalidPublicationsFileException",
"{",
"try",
"{",
"byte",
"[",
"]",
"magicBytes",
"=",
"new",
"byte",
"[",
"PUBLICATIONS_FILE_MAGIC_BYTES_LENGTH",
"]",
";",
"input",
".",
"read"... | Verifies that input stream starts with publications file magic bytes.
@param input
instance of input stream to check. not null. | [
"Verifies",
"that",
"input",
"stream",
"starts",
"with",
"publications",
"file",
"magic",
"bytes",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java#L155-L165 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/DefaultXPathBinder.java | DefaultXPathBinder.asInt | @Override
public CloseableValue<Integer> asInt() {
final Class<?> callerClass = ReflectionHelper.getDirectCallerClass();
return bindSingeValue(Integer.TYPE, callerClass);
} | java | @Override
public CloseableValue<Integer> asInt() {
final Class<?> callerClass = ReflectionHelper.getDirectCallerClass();
return bindSingeValue(Integer.TYPE, callerClass);
} | [
"@",
"Override",
"public",
"CloseableValue",
"<",
"Integer",
">",
"asInt",
"(",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"callerClass",
"=",
"ReflectionHelper",
".",
"getDirectCallerClass",
"(",
")",
";",
"return",
"bindSingeValue",
"(",
"Integer",
".",
"T... | Evaluates the XPath as a int value. This method is just a shortcut for as(Integer.TYPE);
@return int value of evaluation result. | [
"Evaluates",
"the",
"XPath",
"as",
"a",
"int",
"value",
".",
"This",
"method",
"is",
"just",
"a",
"shortcut",
"for",
"as",
"(",
"Integer",
".",
"TYPE",
")",
";"
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/DefaultXPathBinder.java#L87-L91 |
couchbase/CouchbaseMock | src/main/java/com/couchbase/mock/memcached/MemcachedServer.java | MemcachedServer.main | public static void main(String[] args) {
try {
VBucketInfo vbi[] = new VBucketInfo[1024];
for (int ii = 0; ii < vbi.length; ++ii) {
vbi[ii] = new VBucketInfo();
}
MemcachedServer server = new MemcachedServer(null, null, 11211, vbi, false);
for (VBucketInfo aVbi : vbi) {
aVbi.setOwner(server);
}
server.run();
} catch (IOException e) {
Logger.getLogger(MemcachedServer.class.getName()).log(Level.SEVERE, "Fatal error! failed to create socket: ", e);
}
} | java | public static void main(String[] args) {
try {
VBucketInfo vbi[] = new VBucketInfo[1024];
for (int ii = 0; ii < vbi.length; ++ii) {
vbi[ii] = new VBucketInfo();
}
MemcachedServer server = new MemcachedServer(null, null, 11211, vbi, false);
for (VBucketInfo aVbi : vbi) {
aVbi.setOwner(server);
}
server.run();
} catch (IOException e) {
Logger.getLogger(MemcachedServer.class.getName()).log(Level.SEVERE, "Fatal error! failed to create socket: ", e);
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"VBucketInfo",
"vbi",
"[",
"]",
"=",
"new",
"VBucketInfo",
"[",
"1024",
"]",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"vbi",
".",
"length",
... | Program entry point that runs the memcached server as a standalone
server just like any other memcached server...
@param args Program arguments (not used) | [
"Program",
"entry",
"point",
"that",
"runs",
"the",
"memcached",
"server",
"as",
"a",
"standalone",
"server",
"just",
"like",
"any",
"other",
"memcached",
"server",
"..."
] | train | https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/memcached/MemcachedServer.java#L651-L665 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.setText | public void setText(int index, String value)
{
set(selectField(AssignmentFieldLists.CUSTOM_TEXT, index), value);
} | java | public void setText(int index, String value)
{
set(selectField(AssignmentFieldLists.CUSTOM_TEXT, index), value);
} | [
"public",
"void",
"setText",
"(",
"int",
"index",
",",
"String",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"CUSTOM_TEXT",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set a text value.
@param index text index (1-30)
@param value text value | [
"Set",
"a",
"text",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1518-L1521 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getCertificatePolicy | public CertificatePolicy getCertificatePolicy(String vaultBaseUrl, String certificateName) {
return getCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking().single().body();
} | java | public CertificatePolicy getCertificatePolicy(String vaultBaseUrl, String certificateName) {
return getCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking().single().body();
} | [
"public",
"CertificatePolicy",
"getCertificatePolicy",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
")",
"{",
"return",
"getCertificatePolicyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"certificateName",
")",
".",
"toBlocking",
"(",
")",
".",
... | Lists the policy for a certificate.
The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. This operation requires the certificates/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate in a given key vault.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificatePolicy object if successful. | [
"Lists",
"the",
"policy",
"for",
"a",
"certificate",
".",
"The",
"GetCertificatePolicy",
"operation",
"returns",
"the",
"specified",
"certificate",
"policy",
"resources",
"in",
"the",
"specified",
"key",
"vault",
".",
"This",
"operation",
"requires",
"the",
"certi... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7152-L7154 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Single.java | Single.fromPublisher | @BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Single<T> fromPublisher(final Publisher<? extends T> publisher) {
ObjectHelper.requireNonNull(publisher, "publisher is null");
return RxJavaPlugins.onAssembly(new SingleFromPublisher<T>(publisher));
} | java | @BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Single<T> fromPublisher(final Publisher<? extends T> publisher) {
ObjectHelper.requireNonNull(publisher, "publisher is null");
return RxJavaPlugins.onAssembly(new SingleFromPublisher<T>(publisher));
} | [
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"UNBOUNDED_IN",
")",
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"static",
"<",
"T",
">",
"Single",
"<",
"T",
">",
"fromPublisher",
"(",
"final",... | Wraps a specific Publisher into a Single and signals its single element or error.
<p>If the source Publisher is empty, a NoSuchElementException is signalled. If
the source has more than one element, an IndexOutOfBoundsException is signalled.
<p>
The {@link Publisher} must follow the
<a href="https://github.com/reactive-streams/reactive-streams-jvm#reactive-streams">Reactive-Streams specification</a>.
Violating the specification may result in undefined behavior.
<p>
If possible, use {@link #create(SingleOnSubscribe)} to create a
source-like {@code Single} instead.
<p>
Note that even though {@link Publisher} appears to be a functional interface, it
is not recommended to implement it through a lambda as the specification requires
state management that is not achievable with a stateless lambda.
<p>
<img width="640" height="322" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.fromPublisher.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The {@code publisher} is consumed in an unbounded fashion but will be cancelled
if it produced more than one item.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code fromPublisher} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param <T> the value type
@param publisher the source Publisher instance, not null
@return the new Single instance
@see #create(SingleOnSubscribe) | [
"Wraps",
"a",
"specific",
"Publisher",
"into",
"a",
"Single",
"and",
"signals",
"its",
"single",
"element",
"or",
"error",
".",
"<p",
">",
"If",
"the",
"source",
"Publisher",
"is",
"empty",
"a",
"NoSuchElementException",
"is",
"signalled",
".",
"If",
"the",
... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Single.java#L764-L770 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveCopyEntityHelper.java | HiveCopyEntityHelper.getTargetLocation | Path getTargetLocation(FileSystem sourceFs, FileSystem targetFs, Path path, Optional<Partition> partition)
throws IOException {
return getTargetPathHelper().getTargetPath(path, targetFs, partition, false);
} | java | Path getTargetLocation(FileSystem sourceFs, FileSystem targetFs, Path path, Optional<Partition> partition)
throws IOException {
return getTargetPathHelper().getTargetPath(path, targetFs, partition, false);
} | [
"Path",
"getTargetLocation",
"(",
"FileSystem",
"sourceFs",
",",
"FileSystem",
"targetFs",
",",
"Path",
"path",
",",
"Optional",
"<",
"Partition",
">",
"partition",
")",
"throws",
"IOException",
"{",
"return",
"getTargetPathHelper",
"(",
")",
".",
"getTargetPath",... | Compute the target location for a Hive location.
@param sourceFs Source {@link FileSystem}.
@param path source {@link Path} in Hive location.
@param partition partition these paths correspond to.
@return transformed location in the target.
@throws IOException if cannot generate a single target location. | [
"Compute",
"the",
"target",
"location",
"for",
"a",
"Hive",
"location",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveCopyEntityHelper.java#L780-L783 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.fromCsvReader | public static <K, VV> GraphCsvReader fromCsvReader(String edgesPath,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
return new GraphCsvReader(edgesPath, vertexValueInitializer, context);
} | java | public static <K, VV> GraphCsvReader fromCsvReader(String edgesPath,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
return new GraphCsvReader(edgesPath, vertexValueInitializer, context);
} | [
"public",
"static",
"<",
"K",
",",
"VV",
">",
"GraphCsvReader",
"fromCsvReader",
"(",
"String",
"edgesPath",
",",
"final",
"MapFunction",
"<",
"K",
",",
"VV",
">",
"vertexValueInitializer",
",",
"ExecutionEnvironment",
"context",
")",
"{",
"return",
"new",
"Gr... | Creates a graph from a CSV file of edges. Vertices will be created automatically and
Vertex values can be initialized using a user-defined mapper.
@param edgesPath a path to a CSV file with the Edge data
@param vertexValueInitializer the mapper function that initializes the vertex values.
It allows to apply a map transformation on the vertex ID to produce an initial vertex value.
@param context the execution environment.
@return An instance of {@link org.apache.flink.graph.GraphCsvReader},
on which calling methods to specify types of the Vertex ID, Vertex Value and Edge value returns a Graph.
@see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class)
@see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class)
@see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class)
@see org.apache.flink.graph.GraphCsvReader#keyType(Class) | [
"Creates",
"a",
"graph",
"from",
"a",
"CSV",
"file",
"of",
"edges",
".",
"Vertices",
"will",
"be",
"created",
"automatically",
"and",
"Vertex",
"values",
"can",
"be",
"initialized",
"using",
"a",
"user",
"-",
"defined",
"mapper",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L428-L431 |
SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java | DateUtils.parseEndingDateOrDateTime | @CheckForNull
public static Date parseEndingDateOrDateTime(@Nullable String stringDate) {
if (stringDate == null) {
return null;
}
Date date = parseDateTimeQuietly(stringDate);
if (date != null) {
return date;
}
date = parseDateQuietly(stringDate);
checkArgument(date != null, "Date '%s' cannot be parsed as either a date or date+time", stringDate);
return addDays(date, 1);
} | java | @CheckForNull
public static Date parseEndingDateOrDateTime(@Nullable String stringDate) {
if (stringDate == null) {
return null;
}
Date date = parseDateTimeQuietly(stringDate);
if (date != null) {
return date;
}
date = parseDateQuietly(stringDate);
checkArgument(date != null, "Date '%s' cannot be parsed as either a date or date+time", stringDate);
return addDays(date, 1);
} | [
"@",
"CheckForNull",
"public",
"static",
"Date",
"parseEndingDateOrDateTime",
"(",
"@",
"Nullable",
"String",
"stringDate",
")",
"{",
"if",
"(",
"stringDate",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Date",
"date",
"=",
"parseDateTimeQuietly",
"(",... | Return the datetime if @param stringDate is a datetime, date + 1 day if stringDate is a date.
So '2016-09-01' would return a date equivalent to '2016-09-02T00:00:00+0000' in GMT (Warning: relies on default timezone!)
@return the datetime, {@code null} if stringDate is null
@throws IllegalArgumentException if stringDate is not a correctly formed date or datetime
@see #parseDateOrDateTime(String)
@since 6.1 | [
"Return",
"the",
"datetime",
"if",
"@param",
"stringDate",
"is",
"a",
"datetime",
"date",
"+",
"1",
"day",
"if",
"stringDate",
"is",
"a",
"date",
".",
"So",
"2016",
"-",
"09",
"-",
"01",
"would",
"return",
"a",
"date",
"equivalent",
"to",
"2016",
"-",
... | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java#L272-L287 |
keyboardsurfer/Crouton | library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java | Crouton.make | public static Crouton make(Activity activity, View customView, int viewGroupResId) {
return new Crouton(activity, customView, (ViewGroup) activity.findViewById(viewGroupResId));
} | java | public static Crouton make(Activity activity, View customView, int viewGroupResId) {
return new Crouton(activity, customView, (ViewGroup) activity.findViewById(viewGroupResId));
} | [
"public",
"static",
"Crouton",
"make",
"(",
"Activity",
"activity",
",",
"View",
"customView",
",",
"int",
"viewGroupResId",
")",
"{",
"return",
"new",
"Crouton",
"(",
"activity",
",",
"customView",
",",
"(",
"ViewGroup",
")",
"activity",
".",
"findViewById",
... | Creates a {@link Crouton} with provided text-resource and style for a given
activity.
@param activity
The {@link Activity} that represents the context in which the Crouton should exist.
@param customView
The custom {@link View} to display
@param viewGroupResId
The resource id of the {@link ViewGroup} that this {@link Crouton} should be added to.
@return The created {@link Crouton}. | [
"Creates",
"a",
"{",
"@link",
"Crouton",
"}",
"with",
"provided",
"text",
"-",
"resource",
"and",
"style",
"for",
"a",
"given",
"activity",
"."
] | train | https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java#L341-L343 |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java | ForceFieldConfigurator.setForceFieldConfigurator | public void setForceFieldConfigurator(String ffname, IChemObjectBuilder builder) throws CDKException {
ffname = ffname.toLowerCase();
boolean check = false;
if (ffname == ffName && parameterSet != null) {
} else {
check = this.checkForceFieldType(ffname);
ffName = ffname;
if (ffName.equals("mm2")) {
//logger.debug("ForceFieldConfigurator: open Force Field mm2");
//f = new File(mm2File);
//readFile(f);
ins = this.getClass().getClassLoader()
.getResourceAsStream("org/openscience/cdk/modeling/forcefield/data/mm2.prm");
//logger.debug("ForceFieldConfigurator: open Force Field mm2 ... READY");
mm2 = new MM2BasedParameterSetReader();
mm2.setInputStream(ins);
//logger.debug("ForceFieldConfigurator: mm2 set input stream ... READY");
try {
this.setMM2Parameters(builder);
} catch (Exception ex1) {
throw new CDKException("Problems with set MM2Parameters due to " + ex1.toString(), ex1);
}
} else if (ffName.equals("mmff94") || !check) {
//logger.debug("ForceFieldConfigurator: open Force Field mmff94");
//f = new File(mmff94File);
//readFile(f);
ins = this.getClass().getClassLoader()
.getResourceAsStream("org/openscience/cdk/modeling/forcefield/data/mmff94.prm");
mmff94 = new MMFF94BasedParameterSetReader();
mmff94.setInputStream(ins);
try {
this.setMMFF94Parameters(builder);
} catch (Exception ex2) {
throw new CDKException("Problems with set MM2Parameters due to" + ex2.toString(), ex2);
}
}
}
//throw new CDKException("Data file for "+ffName+" force field could not be found");
} | java | public void setForceFieldConfigurator(String ffname, IChemObjectBuilder builder) throws CDKException {
ffname = ffname.toLowerCase();
boolean check = false;
if (ffname == ffName && parameterSet != null) {
} else {
check = this.checkForceFieldType(ffname);
ffName = ffname;
if (ffName.equals("mm2")) {
//logger.debug("ForceFieldConfigurator: open Force Field mm2");
//f = new File(mm2File);
//readFile(f);
ins = this.getClass().getClassLoader()
.getResourceAsStream("org/openscience/cdk/modeling/forcefield/data/mm2.prm");
//logger.debug("ForceFieldConfigurator: open Force Field mm2 ... READY");
mm2 = new MM2BasedParameterSetReader();
mm2.setInputStream(ins);
//logger.debug("ForceFieldConfigurator: mm2 set input stream ... READY");
try {
this.setMM2Parameters(builder);
} catch (Exception ex1) {
throw new CDKException("Problems with set MM2Parameters due to " + ex1.toString(), ex1);
}
} else if (ffName.equals("mmff94") || !check) {
//logger.debug("ForceFieldConfigurator: open Force Field mmff94");
//f = new File(mmff94File);
//readFile(f);
ins = this.getClass().getClassLoader()
.getResourceAsStream("org/openscience/cdk/modeling/forcefield/data/mmff94.prm");
mmff94 = new MMFF94BasedParameterSetReader();
mmff94.setInputStream(ins);
try {
this.setMMFF94Parameters(builder);
} catch (Exception ex2) {
throw new CDKException("Problems with set MM2Parameters due to" + ex2.toString(), ex2);
}
}
}
//throw new CDKException("Data file for "+ffName+" force field could not be found");
} | [
"public",
"void",
"setForceFieldConfigurator",
"(",
"String",
"ffname",
",",
"IChemObjectBuilder",
"builder",
")",
"throws",
"CDKException",
"{",
"ffname",
"=",
"ffname",
".",
"toLowerCase",
"(",
")",
";",
"boolean",
"check",
"=",
"false",
";",
"if",
"(",
"ffn... | Constructor for the ForceFieldConfigurator object
@param ffname name of the force field data file | [
"Constructor",
"for",
"the",
"ForceFieldConfigurator",
"object"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java#L122-L162 |
keenon/loglinear | src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java | GraphicalModel.setTrainingLabel | public void setTrainingLabel(int variable, int value) {
getVariableMetaDataByReference(variable).put(LogLikelihoodDifferentiableFunction.VARIABLE_TRAINING_VALUE, Integer.toString(value));
} | java | public void setTrainingLabel(int variable, int value) {
getVariableMetaDataByReference(variable).put(LogLikelihoodDifferentiableFunction.VARIABLE_TRAINING_VALUE, Integer.toString(value));
} | [
"public",
"void",
"setTrainingLabel",
"(",
"int",
"variable",
",",
"int",
"value",
")",
"{",
"getVariableMetaDataByReference",
"(",
"variable",
")",
".",
"put",
"(",
"LogLikelihoodDifferentiableFunction",
".",
"VARIABLE_TRAINING_VALUE",
",",
"Integer",
".",
"toString"... | Set a training value for this variable in the graphical model.
@param variable The variable to set.
@param value The value to set on the variable. | [
"Set",
"a",
"training",
"value",
"for",
"this",
"variable",
"in",
"the",
"graphical",
"model",
"."
] | train | https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java#L500-L502 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/TypedStreamReader.java | TypedStreamReader._constructTypeException | protected TypedXMLStreamException _constructTypeException(IllegalArgumentException iae, String lexicalValue)
{
return new TypedXMLStreamException(lexicalValue, iae.getMessage(), getStartLocation(), iae);
} | java | protected TypedXMLStreamException _constructTypeException(IllegalArgumentException iae, String lexicalValue)
{
return new TypedXMLStreamException(lexicalValue, iae.getMessage(), getStartLocation(), iae);
} | [
"protected",
"TypedXMLStreamException",
"_constructTypeException",
"(",
"IllegalArgumentException",
"iae",
",",
"String",
"lexicalValue",
")",
"{",
"return",
"new",
"TypedXMLStreamException",
"(",
"lexicalValue",
",",
"iae",
".",
"getMessage",
"(",
")",
",",
"getStartLo... | Method called to wrap or convert given conversion-fail exception
into a full {@link TypedXMLStreamException},
@param iae Problem as reported by converter
@param lexicalValue Lexical value (element content, attribute value)
that could not be converted succesfully. | [
"Method",
"called",
"to",
"wrap",
"or",
"convert",
"given",
"conversion",
"-",
"fail",
"exception",
"into",
"a",
"full",
"{",
"@link",
"TypedXMLStreamException",
"}"
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/TypedStreamReader.java#L782-L785 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java | MPD9AbstractReader.getDefaultOnNull | public Integer getDefaultOnNull(Integer value, Integer defaultValue)
{
return (value == null ? defaultValue : value);
} | java | public Integer getDefaultOnNull(Integer value, Integer defaultValue)
{
return (value == null ? defaultValue : value);
} | [
"public",
"Integer",
"getDefaultOnNull",
"(",
"Integer",
"value",
",",
"Integer",
"defaultValue",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"defaultValue",
":",
"value",
")",
";",
"}"
] | Returns a default value if a null value is found.
@param value value under test
@param defaultValue default if value is null
@return value | [
"Returns",
"a",
"default",
"value",
"if",
"a",
"null",
"value",
"is",
"found",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L1307-L1310 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractFuture.java | AbstractFuture.getFutureValue | private static Object getFutureValue(ListenableFuture<?> future) {
Object valueToSet;
if (future instanceof TrustedFuture) {
// Break encapsulation for TrustedFuture instances since we know that subclasses cannot
// override .get() (since it is final) and therefore this is equivalent to calling .get()
// and unpacking the exceptions like we do below (just much faster because it is a single
// field read instead of a read, several branches and possibly creating exceptions).
return ((AbstractFuture<?>) future).value;
} else {
// Otherwise calculate valueToSet by calling .get()
try {
Object v = getDone(future);
valueToSet = v == null ? NULL : v;
} catch (ExecutionException exception) {
valueToSet = new Failure(exception.getCause());
} catch (CancellationException cancellation) {
valueToSet = new Cancellation(false, cancellation);
} catch (Throwable t) {
valueToSet = new Failure(t);
}
}
return valueToSet;
} | java | private static Object getFutureValue(ListenableFuture<?> future) {
Object valueToSet;
if (future instanceof TrustedFuture) {
// Break encapsulation for TrustedFuture instances since we know that subclasses cannot
// override .get() (since it is final) and therefore this is equivalent to calling .get()
// and unpacking the exceptions like we do below (just much faster because it is a single
// field read instead of a read, several branches and possibly creating exceptions).
return ((AbstractFuture<?>) future).value;
} else {
// Otherwise calculate valueToSet by calling .get()
try {
Object v = getDone(future);
valueToSet = v == null ? NULL : v;
} catch (ExecutionException exception) {
valueToSet = new Failure(exception.getCause());
} catch (CancellationException cancellation) {
valueToSet = new Cancellation(false, cancellation);
} catch (Throwable t) {
valueToSet = new Failure(t);
}
}
return valueToSet;
} | [
"private",
"static",
"Object",
"getFutureValue",
"(",
"ListenableFuture",
"<",
"?",
">",
"future",
")",
"{",
"Object",
"valueToSet",
";",
"if",
"(",
"future",
"instanceof",
"TrustedFuture",
")",
"{",
"// Break encapsulation for TrustedFuture instances since we know that s... | Returns a value, suitable for storing in the {@link #value} field. From the given future,
which is assumed to be done.
<p>This is approximately the inverse of {@link #getDoneValue(Object)} | [
"Returns",
"a",
"value",
"suitable",
"for",
"storing",
"in",
"the",
"{",
"@link",
"#value",
"}",
"field",
".",
"From",
"the",
"given",
"future",
"which",
"is",
"assumed",
"to",
"be",
"done",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractFuture.java#L770-L792 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.