repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
landawn/AbacusUtil | src/com/landawn/abacus/util/Matth.java | Matth.saturatedSubtract | public static long saturatedSubtract(long a, long b) {
long naiveDifference = a - b;
if ((a ^ b) >= 0 | (a ^ naiveDifference) >= 0) {
// If a and b have the same signs or a has the same sign as the result then there was no
// overflow, return.
return naiveDifference;
}
// we did over/under flow
return Long.MAX_VALUE + ((naiveDifference >>> (Long.SIZE - 1)) ^ 1);
} | java | public static long saturatedSubtract(long a, long b) {
long naiveDifference = a - b;
if ((a ^ b) >= 0 | (a ^ naiveDifference) >= 0) {
// If a and b have the same signs or a has the same sign as the result then there was no
// overflow, return.
return naiveDifference;
}
// we did over/under flow
return Long.MAX_VALUE + ((naiveDifference >>> (Long.SIZE - 1)) ^ 1);
} | [
"public",
"static",
"long",
"saturatedSubtract",
"(",
"long",
"a",
",",
"long",
"b",
")",
"{",
"long",
"naiveDifference",
"=",
"a",
"-",
"b",
";",
"if",
"(",
"(",
"a",
"^",
"b",
")",
">=",
"0",
"|",
"(",
"a",
"^",
"naiveDifference",
")",
">=",
"0... | Returns the difference of {@code a} and {@code b} unless it would overflow or underflow in
which case {@code Long.MAX_VALUE} or {@code Long.MIN_VALUE} is returned, respectively.
@since 20.0 | [
"Returns",
"the",
"difference",
"of",
"{",
"@code",
"a",
"}",
"and",
"{",
"@code",
"b",
"}",
"unless",
"it",
"would",
"overflow",
"or",
"underflow",
"in",
"which",
"case",
"{",
"@code",
"Long",
".",
"MAX_VALUE",
"}",
"or",
"{",
"@code",
"Long",
".",
... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1601-L1610 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/Type3Font.java | Type3Font.defineGlyph | public PdfContentByte defineGlyph(char c, float wx, float llx, float lly, float urx, float ury) {
if (c == 0 || c > 255)
throw new IllegalArgumentException("The char " + (int)c + " doesn't belong in this Type3 font");
usedSlot[c] = true;
Integer ck = Integer.valueOf(c);
Type3Glyph glyph = (Type3Glyph)char2glyph.get(ck);
if (glyph != null)
return glyph;
widths3.put(c, (int)wx);
if (!colorized) {
if (Float.isNaN(this.llx)) {
this.llx = llx;
this.lly = lly;
this.urx = urx;
this.ury = ury;
}
else {
this.llx = Math.min(this.llx, llx);
this.lly = Math.min(this.lly, lly);
this.urx = Math.max(this.urx, urx);
this.ury = Math.max(this.ury, ury);
}
}
glyph = new Type3Glyph(writer, pageResources, wx, llx, lly, urx, ury, colorized);
char2glyph.put(ck, glyph);
return glyph;
} | java | public PdfContentByte defineGlyph(char c, float wx, float llx, float lly, float urx, float ury) {
if (c == 0 || c > 255)
throw new IllegalArgumentException("The char " + (int)c + " doesn't belong in this Type3 font");
usedSlot[c] = true;
Integer ck = Integer.valueOf(c);
Type3Glyph glyph = (Type3Glyph)char2glyph.get(ck);
if (glyph != null)
return glyph;
widths3.put(c, (int)wx);
if (!colorized) {
if (Float.isNaN(this.llx)) {
this.llx = llx;
this.lly = lly;
this.urx = urx;
this.ury = ury;
}
else {
this.llx = Math.min(this.llx, llx);
this.lly = Math.min(this.lly, lly);
this.urx = Math.max(this.urx, urx);
this.ury = Math.max(this.ury, ury);
}
}
glyph = new Type3Glyph(writer, pageResources, wx, llx, lly, urx, ury, colorized);
char2glyph.put(ck, glyph);
return glyph;
} | [
"public",
"PdfContentByte",
"defineGlyph",
"(",
"char",
"c",
",",
"float",
"wx",
",",
"float",
"llx",
",",
"float",
"lly",
",",
"float",
"urx",
",",
"float",
"ury",
")",
"{",
"if",
"(",
"c",
"==",
"0",
"||",
"c",
">",
"255",
")",
"throw",
"new",
... | Defines a glyph. If the character was already defined it will return the same content
@param c the character to match this glyph.
@param wx the advance this character will have
@param llx the X lower left corner of the glyph bounding box. If the <CODE>colorize</CODE> option is
<CODE>true</CODE> the value is ignored
@param lly the Y lower left corner of the glyph bounding box. If the <CODE>colorize</CODE> option is
<CODE>true</CODE> the value is ignored
@param urx the X upper right corner of the glyph bounding box. If the <CODE>colorize</CODE> option is
<CODE>true</CODE> the value is ignored
@param ury the Y upper right corner of the glyph bounding box. If the <CODE>colorize</CODE> option is
<CODE>true</CODE> the value is ignored
@return a content where the glyph can be defined | [
"Defines",
"a",
"glyph",
".",
"If",
"the",
"character",
"was",
"already",
"defined",
"it",
"will",
"return",
"the",
"same",
"content"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/Type3Font.java#L126-L152 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/DcosSpec.java | DcosSpec.setGoSecSSOCookie | @Given("^I( do not)? set sso token using host '(.+?)' with user '(.+?)' and password '(.+?)'( and tenant '(.+?)')?$")
public void setGoSecSSOCookie(String set, String ssoHost, String userName, String passWord, String foo, String tenant) throws Exception {
if (set == null) {
HashMap<String, String> ssoCookies = new GosecSSOUtils(ssoHost, userName, passWord, tenant).ssoTokenGenerator();
String[] tokenList = {"user", "dcos-acs-auth-cookie"};
List<com.ning.http.client.cookie.Cookie> cookiesAtributes = addSsoToken(ssoCookies, tokenList);
commonspec.setCookies(cookiesAtributes);
}
} | java | @Given("^I( do not)? set sso token using host '(.+?)' with user '(.+?)' and password '(.+?)'( and tenant '(.+?)')?$")
public void setGoSecSSOCookie(String set, String ssoHost, String userName, String passWord, String foo, String tenant) throws Exception {
if (set == null) {
HashMap<String, String> ssoCookies = new GosecSSOUtils(ssoHost, userName, passWord, tenant).ssoTokenGenerator();
String[] tokenList = {"user", "dcos-acs-auth-cookie"};
List<com.ning.http.client.cookie.Cookie> cookiesAtributes = addSsoToken(ssoCookies, tokenList);
commonspec.setCookies(cookiesAtributes);
}
} | [
"@",
"Given",
"(",
"\"^I( do not)? set sso token using host '(.+?)' with user '(.+?)' and password '(.+?)'( and tenant '(.+?)')?$\"",
")",
"public",
"void",
"setGoSecSSOCookie",
"(",
"String",
"set",
",",
"String",
"ssoHost",
",",
"String",
"userName",
",",
"String",
"passWord"... | Generate token to authenticate in gosec SSO
@param ssoHost current sso host
@param userName username
@param passWord password
@throws Exception exception | [
"Generate",
"token",
"to",
"authenticate",
"in",
"gosec",
"SSO"
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DcosSpec.java#L96-L105 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/Tools.java | Tools.Clamp | public static int Clamp(int x, IntRange range) {
return Clamp(x, range.getMin(), range.getMax());
} | java | public static int Clamp(int x, IntRange range) {
return Clamp(x, range.getMin(), range.getMax());
} | [
"public",
"static",
"int",
"Clamp",
"(",
"int",
"x",
",",
"IntRange",
"range",
")",
"{",
"return",
"Clamp",
"(",
"x",
",",
"range",
".",
"getMin",
"(",
")",
",",
"range",
".",
"getMax",
"(",
")",
")",
";",
"}"
] | Clamp values.
@param x Value.
@param range Range.
@return Value. | [
"Clamp",
"values",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/Tools.java#L134-L136 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java | SpatialDbsImportUtils.importShapefile | public static boolean importShapefile( ASpatialDb db, File shapeFile, String tableName, int limit, IHMProgressMonitor pm )
throws Exception {
FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile);
SimpleFeatureSource featureSource = store.getFeatureSource();
SimpleFeatureCollection features = featureSource.getFeatures();
return importFeatureCollection(db, features, tableName, limit, pm);
} | java | public static boolean importShapefile( ASpatialDb db, File shapeFile, String tableName, int limit, IHMProgressMonitor pm )
throws Exception {
FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile);
SimpleFeatureSource featureSource = store.getFeatureSource();
SimpleFeatureCollection features = featureSource.getFeatures();
return importFeatureCollection(db, features, tableName, limit, pm);
} | [
"public",
"static",
"boolean",
"importShapefile",
"(",
"ASpatialDb",
"db",
",",
"File",
"shapeFile",
",",
"String",
"tableName",
",",
"int",
"limit",
",",
"IHMProgressMonitor",
"pm",
")",
"throws",
"Exception",
"{",
"FileDataStore",
"store",
"=",
"FileDataStoreFin... | Import a shapefile into a table.
@param db the database to use.
@param shapeFile the shapefile to import.
@param tableName the name of the table to import to.
@param limit if > 0, a limit to the imported features is applied.
@param pm the progress monitor.
@return <code>false</code>, is an error occurred.
@throws Exception | [
"Import",
"a",
"shapefile",
"into",
"a",
"table",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java#L199-L207 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/process/ProcessUtil.java | ProcessUtil.invokeProcess | public static int invokeProcess(String[] commandLine, Reader input) throws IOException, InterruptedException {
return invokeProcess(commandLine, input, new NOPConsumer());
} | java | public static int invokeProcess(String[] commandLine, Reader input) throws IOException, InterruptedException {
return invokeProcess(commandLine, input, new NOPConsumer());
} | [
"public",
"static",
"int",
"invokeProcess",
"(",
"String",
"[",
"]",
"commandLine",
",",
"Reader",
"input",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"invokeProcess",
"(",
"commandLine",
",",
"input",
",",
"new",
"NOPConsumer",
"(... | Runs the given set of command line arguments as a system process and returns the exit value of the spawned
process. Additionally allows to supply an input stream to the invoked program. Discards any output of the
process.
@param commandLine
the list of command line arguments to run
@param input
the input passed to the program
@return the exit code of the process
@throws IOException
if an exception occurred while reading the process' outputs, or writing the process' inputs
@throws InterruptedException
if an exception occurred during process exception | [
"Runs",
"the",
"given",
"set",
"of",
"command",
"line",
"arguments",
"as",
"a",
"system",
"process",
"and",
"returns",
"the",
"exit",
"value",
"of",
"the",
"spawned",
"process",
".",
"Additionally",
"allows",
"to",
"supply",
"an",
"input",
"stream",
"to",
... | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/process/ProcessUtil.java#L78-L80 |
infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/LuceneCacheLoader.java | LuceneCacheLoader.getDirectory | private DirectoryLoaderAdaptor getDirectory(final String indexName) {
DirectoryLoaderAdaptor adapter = openDirectories.get(indexName);
if (adapter == null) {
synchronized (openDirectories) {
adapter = openDirectories.get(indexName);
if (adapter == null) {
final File path = new File(this.rootDirectory, indexName);
final FSDirectory directory = openLuceneDirectory(path);
adapter = new DirectoryLoaderAdaptor(directory, indexName, autoChunkSize, affinitySegmentId);
openDirectories.put(indexName, adapter);
}
}
}
return adapter;
} | java | private DirectoryLoaderAdaptor getDirectory(final String indexName) {
DirectoryLoaderAdaptor adapter = openDirectories.get(indexName);
if (adapter == null) {
synchronized (openDirectories) {
adapter = openDirectories.get(indexName);
if (adapter == null) {
final File path = new File(this.rootDirectory, indexName);
final FSDirectory directory = openLuceneDirectory(path);
adapter = new DirectoryLoaderAdaptor(directory, indexName, autoChunkSize, affinitySegmentId);
openDirectories.put(indexName, adapter);
}
}
}
return adapter;
} | [
"private",
"DirectoryLoaderAdaptor",
"getDirectory",
"(",
"final",
"String",
"indexName",
")",
"{",
"DirectoryLoaderAdaptor",
"adapter",
"=",
"openDirectories",
".",
"get",
"(",
"indexName",
")",
";",
"if",
"(",
"adapter",
"==",
"null",
")",
"{",
"synchronized",
... | Looks up the Directory adapter if it's already known, or attempts to initialize indexes. | [
"Looks",
"up",
"the",
"Directory",
"adapter",
"if",
"it",
"s",
"already",
"known",
"or",
"attempts",
"to",
"initialize",
"indexes",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/LuceneCacheLoader.java#L172-L186 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java | JDBCResultSet.updateFloat | public void updateFloat(int columnIndex, float x) throws SQLException {
Double value = new Double(x);
startUpdate(columnIndex);
preparedStatement.setParameter(columnIndex, value);
} | java | public void updateFloat(int columnIndex, float x) throws SQLException {
Double value = new Double(x);
startUpdate(columnIndex);
preparedStatement.setParameter(columnIndex, value);
} | [
"public",
"void",
"updateFloat",
"(",
"int",
"columnIndex",
",",
"float",
"x",
")",
"throws",
"SQLException",
"{",
"Double",
"value",
"=",
"new",
"Double",
"(",
"x",
")",
";",
"startUpdate",
"(",
"columnIndex",
")",
";",
"preparedStatement",
".",
"setParamet... | <!-- start generic documentation -->
Updates the designated column with a <code>float</code> value.
The updater methods are used to update column values in the
current row or the insert row. The updater methods do not
update the underlying database; instead the <code>updateRow</code> or
<code>insertRow</code> methods are called to update the database.
<!-- end generic documentation -->
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB supports this feature. <p>
</div>
<!-- end release-specific documentation -->
@param columnIndex the first column is 1, the second is 2, ...
@param x the new column value
@exception SQLException if a database access error occurs,
the result set concurrency is <code>CONCUR_READ_ONLY</code>
or this method is called on a closed result set
@exception SQLFeatureNotSupportedException if the JDBC driver does not support
this method
@since JDK 1.2 (JDK 1.1.x developers: read the overview for
JDBCResultSet) | [
"<!",
"--",
"start",
"generic",
"documentation",
"--",
">",
"Updates",
"the",
"designated",
"column",
"with",
"a",
"<code",
">",
"float<",
"/",
"code",
">",
"value",
".",
"The",
"updater",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L2813-L2819 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/AbstractValueModel.java | AbstractValueModel.fireValueChange | protected final void fireValueChange(boolean oldValue, boolean newValue) {
fireValueChange(Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
} | java | protected final void fireValueChange(boolean oldValue, boolean newValue) {
fireValueChange(Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
} | [
"protected",
"final",
"void",
"fireValueChange",
"(",
"boolean",
"oldValue",
",",
"boolean",
"newValue",
")",
"{",
"fireValueChange",
"(",
"Boolean",
".",
"valueOf",
"(",
"oldValue",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"newValue",
")",
")",
";",
"}"
] | Notifies all listeners that have registered interest for
notification on this event type. The event instance
is lazily created using the parameters passed into
the fire method.
@param oldValue the boolean value before the change
@param newValue the boolean value after the change | [
"Notifies",
"all",
"listeners",
"that",
"have",
"registered",
"interest",
"for",
"notification",
"on",
"this",
"event",
"type",
".",
"The",
"event",
"instance",
"is",
"lazily",
"created",
"using",
"the",
"parameters",
"passed",
"into",
"the",
"fire",
"method",
... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/AbstractValueModel.java#L91-L93 |
milaboratory/milib | src/main/java/com/milaboratory/core/Range.java | Range.without | @SuppressWarnings("unchecked")
public List<Range> without(Range range) {
if (!intersectsWith(range))
return Collections.singletonList(this);
if (upper <= range.upper)
return range.lower <= lower ? Collections.EMPTY_LIST : Collections.singletonList(new Range(lower, range.lower, reversed));
if (range.lower <= lower)
return Collections.singletonList(new Range(range.upper, upper, reversed));
return Arrays.asList(new Range(lower, range.lower, reversed), new Range(range.upper, upper, reversed));
} | java | @SuppressWarnings("unchecked")
public List<Range> without(Range range) {
if (!intersectsWith(range))
return Collections.singletonList(this);
if (upper <= range.upper)
return range.lower <= lower ? Collections.EMPTY_LIST : Collections.singletonList(new Range(lower, range.lower, reversed));
if (range.lower <= lower)
return Collections.singletonList(new Range(range.upper, upper, reversed));
return Arrays.asList(new Range(lower, range.lower, reversed), new Range(range.upper, upper, reversed));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"List",
"<",
"Range",
">",
"without",
"(",
"Range",
"range",
")",
"{",
"if",
"(",
"!",
"intersectsWith",
"(",
"range",
")",
")",
"return",
"Collections",
".",
"singletonList",
"(",
"this",
")",
... | Subtract provided range and return list of ranges contained in current range and not intersecting with other
range.
@param range range to subtract
@return list of ranges contained in current range and not intersecting with other range | [
"Subtract",
"provided",
"range",
"and",
"return",
"list",
"of",
"ranges",
"contained",
"in",
"current",
"range",
"and",
"not",
"intersecting",
"with",
"other",
"range",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/Range.java#L317-L329 |
aequologica/geppaequo | geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java | MethodUtils.getAccessibleMethodFromSuperclass | private static Method getAccessibleMethodFromSuperclass
(Class<?> clazz, String methodName, Class<?>[] parameterTypes) {
Class<?> parentClazz = clazz.getSuperclass();
while (parentClazz != null) {
if (Modifier.isPublic(parentClazz.getModifiers())) {
try {
return parentClazz.getMethod(methodName, parameterTypes);
} catch (NoSuchMethodException e) {
return null;
}
}
parentClazz = parentClazz.getSuperclass();
}
return null;
} | java | private static Method getAccessibleMethodFromSuperclass
(Class<?> clazz, String methodName, Class<?>[] parameterTypes) {
Class<?> parentClazz = clazz.getSuperclass();
while (parentClazz != null) {
if (Modifier.isPublic(parentClazz.getModifiers())) {
try {
return parentClazz.getMethod(methodName, parameterTypes);
} catch (NoSuchMethodException e) {
return null;
}
}
parentClazz = parentClazz.getSuperclass();
}
return null;
} | [
"private",
"static",
"Method",
"getAccessibleMethodFromSuperclass",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
")",
"{",
"Class",
"<",
"?",
">",
"parentClazz",
"=",
"clazz",
"... | <p>Return an accessible method (that is, one that can be invoked via
reflection) by scanning through the superclasses. If no such method
can be found, return <code>null</code>.</p>
@param clazz Class to be checked
@param methodName Method name of the method we wish to call
@param parameterTypes The parameter type signatures | [
"<p",
">",
"Return",
"an",
"accessible",
"method",
"(",
"that",
"is",
"one",
"that",
"can",
"be",
"invoked",
"via",
"reflection",
")",
"by",
"scanning",
"through",
"the",
"superclasses",
".",
"If",
"no",
"such",
"method",
"can",
"be",
"found",
"return",
... | train | https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L841-L856 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/IndexedTail.java | IndexedTail.put | public void put(@NonNull INDArray update) {
try {
lock.writeLock().lock();
//if we're already in collapsed mode - we just insta-decompress
if (collapsedMode.get()) {
val lastUpdateIndex = collapsedIndex.get();
val lastUpdate = updates.get(lastUpdateIndex);
Preconditions.checkArgument(!lastUpdate.isCompressed(), "lastUpdate should NOT be compressed during collapse mode");
smartDecompress(update, lastUpdate);
// collapser only can work if all consumers are already introduced
} else if (allowCollapse && positions.size() >= expectedConsumers) {
// getting last added update
val lastUpdateIndex = updatesCounter.get();
// looking for max common non-applied update
long maxIdx = firstNotAppliedIndexEverywhere();
val array = Nd4j.create(shape);
val delta = lastUpdateIndex - maxIdx;
if (delta >= collapseThreshold) {
log.trace("Max delta to collapse: {}; Range: <{}...{}>", delta, maxIdx, lastUpdateIndex);
for (long e = maxIdx; e < lastUpdateIndex; e++) {
val u = updates.get(e);
if (u == null)
log.error("Failed on index {}", e);
// continue;
smartDecompress(u, array);
// removing updates array
updates.remove(e);
}
// decode latest update
smartDecompress(update, array);
// putting collapsed array back at last index
updates.put(lastUpdateIndex, array);
collapsedIndex.set(lastUpdateIndex);
// shift counter by 1
updatesCounter.getAndIncrement();
// we're saying that right now all updates within some range are collapsed into 1 update
collapsedMode.set(true);
} else {
updates.put(updatesCounter.getAndIncrement(), update);
}
} else {
updates.put(updatesCounter.getAndIncrement(), update);
}
} finally {
lock.writeLock().unlock();
}
} | java | public void put(@NonNull INDArray update) {
try {
lock.writeLock().lock();
//if we're already in collapsed mode - we just insta-decompress
if (collapsedMode.get()) {
val lastUpdateIndex = collapsedIndex.get();
val lastUpdate = updates.get(lastUpdateIndex);
Preconditions.checkArgument(!lastUpdate.isCompressed(), "lastUpdate should NOT be compressed during collapse mode");
smartDecompress(update, lastUpdate);
// collapser only can work if all consumers are already introduced
} else if (allowCollapse && positions.size() >= expectedConsumers) {
// getting last added update
val lastUpdateIndex = updatesCounter.get();
// looking for max common non-applied update
long maxIdx = firstNotAppliedIndexEverywhere();
val array = Nd4j.create(shape);
val delta = lastUpdateIndex - maxIdx;
if (delta >= collapseThreshold) {
log.trace("Max delta to collapse: {}; Range: <{}...{}>", delta, maxIdx, lastUpdateIndex);
for (long e = maxIdx; e < lastUpdateIndex; e++) {
val u = updates.get(e);
if (u == null)
log.error("Failed on index {}", e);
// continue;
smartDecompress(u, array);
// removing updates array
updates.remove(e);
}
// decode latest update
smartDecompress(update, array);
// putting collapsed array back at last index
updates.put(lastUpdateIndex, array);
collapsedIndex.set(lastUpdateIndex);
// shift counter by 1
updatesCounter.getAndIncrement();
// we're saying that right now all updates within some range are collapsed into 1 update
collapsedMode.set(true);
} else {
updates.put(updatesCounter.getAndIncrement(), update);
}
} else {
updates.put(updatesCounter.getAndIncrement(), update);
}
} finally {
lock.writeLock().unlock();
}
} | [
"public",
"void",
"put",
"(",
"@",
"NonNull",
"INDArray",
"update",
")",
"{",
"try",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"//if we're already in collapsed mode - we just insta-decompress",
"if",
"(",
"collapsedMode",
".",
"get",
... | This mehtod adds update, with optional collapse
@param update | [
"This",
"mehtod",
"adds",
"update",
"with",
"optional",
"collapse"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/IndexedTail.java#L91-L149 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/MapCircuitExtractor.java | MapCircuitExtractor.getCircuit | public Circuit getCircuit(Tile tile)
{
final Collection<String> neighborGroups = getNeighborGroups(tile);
final Collection<String> groups = new HashSet<>(neighborGroups);
final String group = mapGroup.getGroup(tile);
final Circuit circuit;
if (groups.size() == 1)
{
if (group.equals(groups.iterator().next()))
{
circuit = new Circuit(CircuitType.MIDDLE, group, group);
}
else
{
circuit = new Circuit(CircuitType.BLOCK, group, groups.iterator().next());
}
}
else
{
circuit = getCircuitGroups(group, neighborGroups);
}
return circuit;
} | java | public Circuit getCircuit(Tile tile)
{
final Collection<String> neighborGroups = getNeighborGroups(tile);
final Collection<String> groups = new HashSet<>(neighborGroups);
final String group = mapGroup.getGroup(tile);
final Circuit circuit;
if (groups.size() == 1)
{
if (group.equals(groups.iterator().next()))
{
circuit = new Circuit(CircuitType.MIDDLE, group, group);
}
else
{
circuit = new Circuit(CircuitType.BLOCK, group, groups.iterator().next());
}
}
else
{
circuit = getCircuitGroups(group, neighborGroups);
}
return circuit;
} | [
"public",
"Circuit",
"getCircuit",
"(",
"Tile",
"tile",
")",
"{",
"final",
"Collection",
"<",
"String",
">",
"neighborGroups",
"=",
"getNeighborGroups",
"(",
"tile",
")",
";",
"final",
"Collection",
"<",
"String",
">",
"groups",
"=",
"new",
"HashSet",
"<>",
... | Get the tile circuit.
@param tile The current tile.
@return The tile circuit, <code>null</code> if none. | [
"Get",
"the",
"tile",
"circuit",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/MapCircuitExtractor.java#L111-L135 |
stapler/stapler | jruby/src/main/java/org/kohsuke/stapler/jelly/jruby/AbstractRubyTearOff.java | AbstractRubyTearOff.createDispatcher | public RequestDispatcher createDispatcher(Object it, String viewName) throws IOException {
Script script = findScript(viewName+getDefaultScriptExtension());
if(script!=null)
return new JellyRequestDispatcher(it,script);
return null;
} | java | public RequestDispatcher createDispatcher(Object it, String viewName) throws IOException {
Script script = findScript(viewName+getDefaultScriptExtension());
if(script!=null)
return new JellyRequestDispatcher(it,script);
return null;
} | [
"public",
"RequestDispatcher",
"createDispatcher",
"(",
"Object",
"it",
",",
"String",
"viewName",
")",
"throws",
"IOException",
"{",
"Script",
"script",
"=",
"findScript",
"(",
"viewName",
"+",
"getDefaultScriptExtension",
"(",
")",
")",
";",
"if",
"(",
"script... | Creates a {@link RequestDispatcher} that forwards to the jelly view, if available. | [
"Creates",
"a",
"{"
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/jruby/src/main/java/org/kohsuke/stapler/jelly/jruby/AbstractRubyTearOff.java#L36-L41 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/EntityType_CustomFieldSerializer.java | EntityType_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, EntityType instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, EntityType instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"EntityType",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/EntityType_CustomFieldSerializer.java#L95-L98 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.transformProject | public Vector4f transformProject(float x, float y, float z, float w, Vector4f dest) {
dest.x = x;
dest.y = y;
dest.z = z;
dest.w = w;
return dest.mulProject(this);
} | java | public Vector4f transformProject(float x, float y, float z, float w, Vector4f dest) {
dest.x = x;
dest.y = y;
dest.z = z;
dest.w = w;
return dest.mulProject(this);
} | [
"public",
"Vector4f",
"transformProject",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
",",
"float",
"w",
",",
"Vector4f",
"dest",
")",
"{",
"dest",
".",
"x",
"=",
"x",
";",
"dest",
".",
"y",
"=",
"y",
";",
"dest",
".",
"z",
"=",
"z... | /* (non-Javadoc)
@see org.joml.Matrix4fc#transformProject(float, float, float, float, org.joml.Vector4f) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L4553-L4559 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/util/Pacer.java | Pacer.pacedCall | public void pacedCall(Runnable call, Runnable orElse) {
long now = timeSource.getTimeMillis();
long end = nextLogTime.get();
if(now >= end && nextLogTime.compareAndSet(end, now + delay)) {
call.run();
} else {
orElse.run();
}
} | java | public void pacedCall(Runnable call, Runnable orElse) {
long now = timeSource.getTimeMillis();
long end = nextLogTime.get();
if(now >= end && nextLogTime.compareAndSet(end, now + delay)) {
call.run();
} else {
orElse.run();
}
} | [
"public",
"void",
"pacedCall",
"(",
"Runnable",
"call",
",",
"Runnable",
"orElse",
")",
"{",
"long",
"now",
"=",
"timeSource",
".",
"getTimeMillis",
"(",
")",
";",
"long",
"end",
"=",
"nextLogTime",
".",
"get",
"(",
")",
";",
"if",
"(",
"now",
">=",
... | Execute the call at the request page or call the alternative the rest of the time. An example would be to log
a repetitive error once every 30 seconds or always if in debug.
<p>
<pre>{@code
Pacer pacer = new Pacer(30_000);
String errorMessage = "my error";
pacer.pacedCall(() -> log.error(errorMessage), () -> log.debug(errorMessage);
}
</pre>
@param call call to be paced
@param orElse call to be done everytime | [
"Execute",
"the",
"call",
"at",
"the",
"request",
"page",
"or",
"call",
"the",
"alternative",
"the",
"rest",
"of",
"the",
"time",
".",
"An",
"example",
"would",
"be",
"to",
"log",
"a",
"repetitive",
"error",
"once",
"every",
"30",
"seconds",
"or",
"alway... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/util/Pacer.java#L56-L64 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java | ManagedDatabasesInner.listByInstanceAsync | public Observable<Page<ManagedDatabaseInner>> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) {
return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName)
.map(new Func1<ServiceResponse<Page<ManagedDatabaseInner>>, Page<ManagedDatabaseInner>>() {
@Override
public Page<ManagedDatabaseInner> call(ServiceResponse<Page<ManagedDatabaseInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ManagedDatabaseInner>> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) {
return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName)
.map(new Func1<ServiceResponse<Page<ManagedDatabaseInner>>, Page<ManagedDatabaseInner>>() {
@Override
public Page<ManagedDatabaseInner> call(ServiceResponse<Page<ManagedDatabaseInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ManagedDatabaseInner",
">",
">",
"listByInstanceAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"managedInstanceName",
")",
"{",
"return",
"listByInstanceWithServiceResponseAsync",
"(",
"resourceGroup... | Gets a list of managed databases.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ManagedDatabaseInner> object | [
"Gets",
"a",
"list",
"of",
"managed",
"databases",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java#L336-L344 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java | MatrixFeatures_DDRM.isSkewSymmetric | public static boolean isSkewSymmetric(DMatrixRMaj A , double tol ){
if( A.numCols != A.numRows )
return false;
for( int i = 0; i < A.numRows; i++ ) {
for( int j = 0; j < i; j++ ) {
double a = A.get(i,j);
double b = A.get(j,i);
double diff = Math.abs(a+b);
if( !(diff <= tol) ) {
return false;
}
}
}
return true;
} | java | public static boolean isSkewSymmetric(DMatrixRMaj A , double tol ){
if( A.numCols != A.numRows )
return false;
for( int i = 0; i < A.numRows; i++ ) {
for( int j = 0; j < i; j++ ) {
double a = A.get(i,j);
double b = A.get(j,i);
double diff = Math.abs(a+b);
if( !(diff <= tol) ) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"isSkewSymmetric",
"(",
"DMatrixRMaj",
"A",
",",
"double",
"tol",
")",
"{",
"if",
"(",
"A",
".",
"numCols",
"!=",
"A",
".",
"numRows",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"A",... | <p>
Checks to see if a matrix is skew symmetric with in tolerance:<br>
<br>
-A = A<sup>T</sup><br>
or<br>
|a<sub>ij</sub> + a<sub>ji</sub>| ≤ tol
</p>
@param A The matrix being tested.
@param tol Tolerance for being skew symmetric.
@return True if it is skew symmetric and false if it is not. | [
"<p",
">",
"Checks",
"to",
"see",
"if",
"a",
"matrix",
"is",
"skew",
"symmetric",
"with",
"in",
"tolerance",
":",
"<br",
">",
"<br",
">",
"-",
"A",
"=",
"A<sup",
">",
"T<",
"/",
"sup",
">",
"<br",
">",
"or<br",
">",
"|a<sub",
">",
"ij<",
"/",
"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L240-L257 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java | BaseNeo4jAssociationQueries.getEntityKey | private EntityKey getEntityKey(AssociationKey associationKey, RowKey rowKey) {
String[] associationKeyColumns = associationKey.getMetadata().getAssociatedEntityKeyMetadata().getAssociationKeyColumns();
Object[] columnValues = new Object[associationKeyColumns.length];
int i = 0;
for ( String associationKeyColumn : associationKeyColumns ) {
columnValues[i] = rowKey.getColumnValue( associationKeyColumn );
i++;
}
EntityKeyMetadata entityKeyMetadata = associationKey.getMetadata().getAssociatedEntityKeyMetadata().getEntityKeyMetadata();
return new EntityKey( entityKeyMetadata, columnValues );
} | java | private EntityKey getEntityKey(AssociationKey associationKey, RowKey rowKey) {
String[] associationKeyColumns = associationKey.getMetadata().getAssociatedEntityKeyMetadata().getAssociationKeyColumns();
Object[] columnValues = new Object[associationKeyColumns.length];
int i = 0;
for ( String associationKeyColumn : associationKeyColumns ) {
columnValues[i] = rowKey.getColumnValue( associationKeyColumn );
i++;
}
EntityKeyMetadata entityKeyMetadata = associationKey.getMetadata().getAssociatedEntityKeyMetadata().getEntityKeyMetadata();
return new EntityKey( entityKeyMetadata, columnValues );
} | [
"private",
"EntityKey",
"getEntityKey",
"(",
"AssociationKey",
"associationKey",
",",
"RowKey",
"rowKey",
")",
"{",
"String",
"[",
"]",
"associationKeyColumns",
"=",
"associationKey",
".",
"getMetadata",
"(",
")",
".",
"getAssociatedEntityKeyMetadata",
"(",
")",
"."... | Returns the entity key on the other side of association row represented by the given row key.
<p>
<b>Note:</b> May only be invoked if the row key actually contains all the columns making up that entity key.
Specifically, it may <b>not</b> be invoked if the association has index columns (maps, ordered collections), as
the entity key columns will not be part of the row key in this case. | [
"Returns",
"the",
"entity",
"key",
"on",
"the",
"other",
"side",
"of",
"association",
"row",
"represented",
"by",
"the",
"given",
"row",
"key",
".",
"<p",
">",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"May",
"only",
"be",
"invoked",
"if",
"the",
... | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java#L288-L300 |
linroid/FilterMenu | library/src/main/java/com/linroid/filtermenu/library/FilterMenuLayout.java | FilterMenuLayout.arcAngle | private static double arcAngle(Point center, Point a, Point b, Rect area, int radius) {
double angle = threePointsAngle(center, a, b);
Point innerPoint = findMidnormalPoint(center, a, b, area, radius);
Point midInsectPoint = new Point((a.x + b.x) / 2, (a.y + b.y) / 2);
double distance = pointsDistance(midInsectPoint, innerPoint);
if (distance > radius) {
return 360 - angle;
}
return angle;
} | java | private static double arcAngle(Point center, Point a, Point b, Rect area, int radius) {
double angle = threePointsAngle(center, a, b);
Point innerPoint = findMidnormalPoint(center, a, b, area, radius);
Point midInsectPoint = new Point((a.x + b.x) / 2, (a.y + b.y) / 2);
double distance = pointsDistance(midInsectPoint, innerPoint);
if (distance > radius) {
return 360 - angle;
}
return angle;
} | [
"private",
"static",
"double",
"arcAngle",
"(",
"Point",
"center",
",",
"Point",
"a",
",",
"Point",
"b",
",",
"Rect",
"area",
",",
"int",
"radius",
")",
"{",
"double",
"angle",
"=",
"threePointsAngle",
"(",
"center",
",",
"a",
",",
"b",
")",
";",
"Po... | calculate arc angle between point a and point b
@param center
@param a
@param b
@param area
@param radius
@return | [
"calculate",
"arc",
"angle",
"between",
"point",
"a",
"and",
"point",
"b"
] | train | https://github.com/linroid/FilterMenu/blob/5a6e5472631c2304b71a51034683f38271962ef5/library/src/main/java/com/linroid/filtermenu/library/FilterMenuLayout.java#L143-L152 |
lightblue-platform/lightblue-migrator | facade/src/main/java/com/redhat/lightblue/migrator/facade/TimeoutConfiguration.java | TimeoutConfiguration.getTimeoutMS | public long getTimeoutMS(String methodName, FacadeOperation op) {
return getMS(methodName, op, Type.timeout);
} | java | public long getTimeoutMS(String methodName, FacadeOperation op) {
return getMS(methodName, op, Type.timeout);
} | [
"public",
"long",
"getTimeoutMS",
"(",
"String",
"methodName",
",",
"FacadeOperation",
"op",
")",
"{",
"return",
"getMS",
"(",
"methodName",
",",
"op",
",",
"Type",
".",
"timeout",
")",
";",
"}"
] | See ${link
{@link TimeoutConfiguration#getMS(String, FacadeOperation, Type)}
@param methodName
@param op
@return | [
"See",
"$",
"{",
"link",
"{",
"@link",
"TimeoutConfiguration#getMS",
"(",
"String",
"FacadeOperation",
"Type",
")",
"}"
] | train | https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/facade/src/main/java/com/redhat/lightblue/migrator/facade/TimeoutConfiguration.java#L169-L171 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/smiles/FixBondOrdersTool.java | FixBondOrdersTool.setAllRingBondsSingleOrder | private Boolean setAllRingBondsSingleOrder(List<Integer> ringGroup, IRingSet ringSet) {
for (Integer i : ringGroup) {
for (IBond bond : ringSet.getAtomContainer(i).bonds()) {
bond.setOrder(IBond.Order.SINGLE);
}
}
return true;
} | java | private Boolean setAllRingBondsSingleOrder(List<Integer> ringGroup, IRingSet ringSet) {
for (Integer i : ringGroup) {
for (IBond bond : ringSet.getAtomContainer(i).bonds()) {
bond.setOrder(IBond.Order.SINGLE);
}
}
return true;
} | [
"private",
"Boolean",
"setAllRingBondsSingleOrder",
"(",
"List",
"<",
"Integer",
">",
"ringGroup",
",",
"IRingSet",
"ringSet",
")",
"{",
"for",
"(",
"Integer",
"i",
":",
"ringGroup",
")",
"{",
"for",
"(",
"IBond",
"bond",
":",
"ringSet",
".",
"getAtomContain... | Sets all bonds in an {@link IRingSet} to single order.
@param ringGroup
@param ringSet
@return True for success | [
"Sets",
"all",
"bonds",
"in",
"an",
"{"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smiles/FixBondOrdersTool.java#L361-L368 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_vrack_network_GET | public ArrayList<Long> serviceName_vrack_network_GET(String serviceName, String subnet, Long vlan) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/vrack/network";
StringBuilder sb = path(qPath, serviceName);
query(sb, "subnet", subnet);
query(sb, "vlan", vlan);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> serviceName_vrack_network_GET(String serviceName, String subnet, Long vlan) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/vrack/network";
StringBuilder sb = path(qPath, serviceName);
query(sb, "subnet", subnet);
query(sb, "vlan", vlan);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_vrack_network_GET",
"(",
"String",
"serviceName",
",",
"String",
"subnet",
",",
"Long",
"vlan",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/vrack/network\"",
";",
"S... | Descriptions of private networks in the vRack attached to this Load Balancer
REST: GET /ipLoadbalancing/{serviceName}/vrack/network
@param vlan [required] Filter the value of vlan property (=)
@param subnet [required] Filter the value of subnet property (=)
@param serviceName [required] The internal name of your IP load balancing
API beta | [
"Descriptions",
"of",
"private",
"networks",
"in",
"the",
"vRack",
"attached",
"to",
"this",
"Load",
"Balancer"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1157-L1164 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.recognizePrintedTextInStreamAsync | public Observable<OcrResult> recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) {
return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, recognizePrintedTextInStreamOptionalParameter).map(new Func1<ServiceResponse<OcrResult>, OcrResult>() {
@Override
public OcrResult call(ServiceResponse<OcrResult> response) {
return response.body();
}
});
} | java | public Observable<OcrResult> recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) {
return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, recognizePrintedTextInStreamOptionalParameter).map(new Func1<ServiceResponse<OcrResult>, OcrResult>() {
@Override
public OcrResult call(ServiceResponse<OcrResult> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OcrResult",
">",
"recognizePrintedTextInStreamAsync",
"(",
"boolean",
"detectOrientation",
",",
"byte",
"[",
"]",
"image",
",",
"RecognizePrintedTextInStreamOptionalParameter",
"recognizePrintedTextInStreamOptionalParameter",
")",
"{",
"return",
... | Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
@param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down).
@param image An image stream.
@param recognizePrintedTextInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OcrResult object | [
"Optical",
"Character",
"Recognition",
"(",
"OCR",
")",
"detects",
"printed",
"text",
"in",
"an",
"image",
"and",
"extracts",
"the",
"recognized",
"characters",
"into",
"a",
"machine",
"-",
"usable",
"character",
"stream",
".",
"Upon",
"success",
"the",
"OCR",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L767-L774 |
openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.executeScript | @Help(
help =
"Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id"
)
public void executeScript(final String idNsr, final String idVnfr, String script)
throws SDKException {
String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/execute-script";
requestPost(url, script);
} | java | @Help(
help =
"Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id"
)
public void executeScript(final String idNsr, final String idVnfr, String script)
throws SDKException {
String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/execute-script";
requestPost(url, script);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id\"",
")",
"public",
"void",
"executeScript",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfr",
",",
"String",
"script",
")",
"thro... | Executes a script at runtime for a VNFR of a defined VNFD in a running NSR.
@param idNsr the ID of the NetworkServiceRecord
@param idVnfr the ID of the VNFR to be upgraded
@param script the script to execute
@throws SDKException if the request fails | [
"Executes",
"a",
"script",
"at",
"runtime",
"for",
"a",
"VNFR",
"of",
"a",
"defined",
"VNFD",
"in",
"a",
"running",
"NSR",
"."
] | train | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L721-L729 |
bazaarvoice/emodb | common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java | EmoUriComponent.decodePercentEncodedOctets | private static ByteBuffer decodePercentEncodedOctets(String s, int i, ByteBuffer bb) {
if (bb == null) {
bb = ByteBuffer.allocate(1);
} else {
bb.clear();
}
while (true) {
// Decode the hex digits
bb.put((byte) (decodeHex(s, i++) << 4 | decodeHex(s, i++)));
// Finish if at the end of the string
if (i == s.length()) {
break;
}
// Finish if no more percent-encoded octets follow
if (s.charAt(i++) != '%') {
break;
}
// Check if the byte buffer needs to be increased in size
if (bb.position() == bb.capacity()) {
bb.flip();
// Create a new byte buffer with the maximum number of possible
// octets, hence resize should only occur once
ByteBuffer bb_new = ByteBuffer.allocate(s.length() / 3);
bb_new.put(bb);
bb = bb_new;
}
}
bb.flip();
return bb;
} | java | private static ByteBuffer decodePercentEncodedOctets(String s, int i, ByteBuffer bb) {
if (bb == null) {
bb = ByteBuffer.allocate(1);
} else {
bb.clear();
}
while (true) {
// Decode the hex digits
bb.put((byte) (decodeHex(s, i++) << 4 | decodeHex(s, i++)));
// Finish if at the end of the string
if (i == s.length()) {
break;
}
// Finish if no more percent-encoded octets follow
if (s.charAt(i++) != '%') {
break;
}
// Check if the byte buffer needs to be increased in size
if (bb.position() == bb.capacity()) {
bb.flip();
// Create a new byte buffer with the maximum number of possible
// octets, hence resize should only occur once
ByteBuffer bb_new = ByteBuffer.allocate(s.length() / 3);
bb_new.put(bb);
bb = bb_new;
}
}
bb.flip();
return bb;
} | [
"private",
"static",
"ByteBuffer",
"decodePercentEncodedOctets",
"(",
"String",
"s",
",",
"int",
"i",
",",
"ByteBuffer",
"bb",
")",
"{",
"if",
"(",
"bb",
"==",
"null",
")",
"{",
"bb",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"1",
")",
";",
"}",
"else",... | Decode a continuous sequence of percent encoded octets.
<p>
Assumes the index, i, starts that the first hex digit of the first
percent-encoded octet. | [
"Decode",
"a",
"continuous",
"sequence",
"of",
"percent",
"encoded",
"octets",
".",
"<p",
">",
"Assumes",
"the",
"index",
"i",
"starts",
"that",
"the",
"first",
"hex",
"digit",
"of",
"the",
"first",
"percent",
"-",
"encoded",
"octet",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java#L780-L814 |
rzwitserloot/lombok | src/core/lombok/javac/apt/LombokProcessor.java | LombokProcessor.getJavacFiler | public JavacFiler getJavacFiler(Object filer) {
if (filer instanceof JavacFiler) return (JavacFiler) filer;
// try to find a "delegate" field in the object, and use this to check for a JavacFiler
for (Class<?> filerClass = filer.getClass(); filerClass != null; filerClass = filerClass.getSuperclass()) {
try {
return getJavacFiler(tryGetDelegateField(filerClass, filer));
} catch (final Exception e) {
// delegate field was not found, try on superclass
}
}
processingEnv.getMessager().printMessage(Kind.WARNING,
"Can't get a JavacFiler from " + filer.getClass().getName() + ". Lombok won't work.");
return null;
} | java | public JavacFiler getJavacFiler(Object filer) {
if (filer instanceof JavacFiler) return (JavacFiler) filer;
// try to find a "delegate" field in the object, and use this to check for a JavacFiler
for (Class<?> filerClass = filer.getClass(); filerClass != null; filerClass = filerClass.getSuperclass()) {
try {
return getJavacFiler(tryGetDelegateField(filerClass, filer));
} catch (final Exception e) {
// delegate field was not found, try on superclass
}
}
processingEnv.getMessager().printMessage(Kind.WARNING,
"Can't get a JavacFiler from " + filer.getClass().getName() + ". Lombok won't work.");
return null;
} | [
"public",
"JavacFiler",
"getJavacFiler",
"(",
"Object",
"filer",
")",
"{",
"if",
"(",
"filer",
"instanceof",
"JavacFiler",
")",
"return",
"(",
"JavacFiler",
")",
"filer",
";",
"// try to find a \"delegate\" field in the object, and use this to check for a JavacFiler",
"for"... | This class returns the given filer as a JavacFiler. In case the filer is no
JavacFiler (e.g. the Gradle IncrementalFiler), its "delegate" field is used to get the JavacFiler
(directly or through a delegate field again) | [
"This",
"class",
"returns",
"the",
"given",
"filer",
"as",
"a",
"JavacFiler",
".",
"In",
"case",
"the",
"filer",
"is",
"no",
"JavacFiler",
"(",
"e",
".",
"g",
".",
"the",
"Gradle",
"IncrementalFiler",
")",
"its",
"delegate",
"field",
"is",
"used",
"to",
... | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/apt/LombokProcessor.java#L431-L446 |
JadiraOrg/jadira | bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java | BasicBinder.registerBinding | public final <S, T> void registerBinding(Class<S> source, Class<T> target, Binding<S, T> converter) {
Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass());
registerBinding(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter);
} | java | public final <S, T> void registerBinding(Class<S> source, Class<T> target, Binding<S, T> converter) {
Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass());
registerBinding(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter);
} | [
"public",
"final",
"<",
"S",
",",
"T",
">",
"void",
"registerBinding",
"(",
"Class",
"<",
"S",
">",
"source",
",",
"Class",
"<",
"T",
">",
"target",
",",
"Binding",
"<",
"S",
",",
"T",
">",
"converter",
")",
"{",
"Class",
"<",
"?",
"extends",
"An... | Register a Binding with the given source and target class.
A binding unifies a marshaller and an unmarshaller and both must be available to resolve a binding.
The source class is considered the owning class of the binding. The source can be marshalled
into the target class. Similarly, the target can be unmarshalled to produce an instance of the source type.
@param source The source (owning) class
@param target The target (foreign) class
@param converter The binding to be registered | [
"Register",
"a",
"Binding",
"with",
"the",
"given",
"source",
"and",
"target",
"class",
".",
"A",
"binding",
"unifies",
"a",
"marshaller",
"and",
"an",
"unmarshaller",
"and",
"both",
"must",
"be",
"available",
"to",
"resolve",
"a",
"binding",
"."
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L544-L547 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/BaseLevel2.java | BaseLevel2.ger | @Override
public void ger(char order, double alpha, INDArray X, INDArray Y, INDArray A) {
if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
OpProfiler.getInstance().processBlasCall(false, A, X, Y);
// FIXME: int cast
if (X.data().dataType() == DataType.DOUBLE) {
DefaultOpExecutioner.validateDataType(DataType.DOUBLE, A, X, Y);
dger(order, (int) A.rows(), (int) A.columns(), alpha, X, X.stride(-1), Y, Y.stride(-1), A, (int) A.size(0));
} else {
DefaultOpExecutioner.validateDataType(DataType.FLOAT, A, X, Y);
sger(order, (int) A.rows(), (int) A.columns(), (float) alpha, X, X.stride(-1), Y, Y.stride(-1), A, (int) A.size(0));
}
OpExecutionerUtil.checkForAny(A);
} | java | @Override
public void ger(char order, double alpha, INDArray X, INDArray Y, INDArray A) {
if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
OpProfiler.getInstance().processBlasCall(false, A, X, Y);
// FIXME: int cast
if (X.data().dataType() == DataType.DOUBLE) {
DefaultOpExecutioner.validateDataType(DataType.DOUBLE, A, X, Y);
dger(order, (int) A.rows(), (int) A.columns(), alpha, X, X.stride(-1), Y, Y.stride(-1), A, (int) A.size(0));
} else {
DefaultOpExecutioner.validateDataType(DataType.FLOAT, A, X, Y);
sger(order, (int) A.rows(), (int) A.columns(), (float) alpha, X, X.stride(-1), Y, Y.stride(-1), A, (int) A.size(0));
}
OpExecutionerUtil.checkForAny(A);
} | [
"@",
"Override",
"public",
"void",
"ger",
"(",
"char",
"order",
",",
"double",
"alpha",
",",
"INDArray",
"X",
",",
"INDArray",
"Y",
",",
"INDArray",
"A",
")",
"{",
"if",
"(",
"Nd4j",
".",
"getExecutioner",
"(",
")",
".",
"getProfilingMode",
"(",
")",
... | performs a rank-1 update of a general m-by-n matrix a:
a := alpha*x*y' + a.
@param order
@param alpha
@param X
@param Y
@param A | [
"performs",
"a",
"rank",
"-",
"1",
"update",
"of",
"a",
"general",
"m",
"-",
"by",
"-",
"n",
"matrix",
"a",
":",
"a",
":",
"=",
"alpha",
"*",
"x",
"*",
"y",
"+",
"a",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/BaseLevel2.java#L145-L161 |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/EglCore.java | EglCore.makeCurrent | public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) {
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent(draw,read) failed");
}
} | java | public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) {
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent(draw,read) failed");
}
} | [
"public",
"void",
"makeCurrent",
"(",
"EGLSurface",
"drawSurface",
",",
"EGLSurface",
"readSurface",
")",
"{",
"if",
"(",
"mEGLDisplay",
"==",
"EGL14",
".",
"EGL_NO_DISPLAY",
")",
"{",
"// called makeCurrent() before create?",
"Log",
".",
"d",
"(",
"TAG",
",",
"... | Makes our EGL context current, using the supplied "draw" and "read" surfaces. | [
"Makes",
"our",
"EGL",
"context",
"current",
"using",
"the",
"supplied",
"draw",
"and",
"read",
"surfaces",
"."
] | train | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L276-L284 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/LicenseResource.java | LicenseResource.postLicense | @POST
public Response postLicense(@Auth final DbCredential credential, final License license){
if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
LOG.info("Got a post license request.");
//
// Checks if the data is corrupted, pattern can be compiled etc.
//
DataValidator.validate(license);
// Save the license
final DbLicense dbLicense = getModelMapper().getDbLicense(license);
//
// The store method will deal with making sure there are no pattern conflicts
// The reason behind this move is the presence of the instance of RepositoryHandler
// and the imposibility to access that handler from here.
//
getLicenseHandler().store(dbLicense);
cacheUtils.clear(CacheName.PROMOTION_REPORTS);
return Response.ok().status(HttpStatus.CREATED_201).build();
} | java | @POST
public Response postLicense(@Auth final DbCredential credential, final License license){
if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
LOG.info("Got a post license request.");
//
// Checks if the data is corrupted, pattern can be compiled etc.
//
DataValidator.validate(license);
// Save the license
final DbLicense dbLicense = getModelMapper().getDbLicense(license);
//
// The store method will deal with making sure there are no pattern conflicts
// The reason behind this move is the presence of the instance of RepositoryHandler
// and the imposibility to access that handler from here.
//
getLicenseHandler().store(dbLicense);
cacheUtils.clear(CacheName.PROMOTION_REPORTS);
return Response.ok().status(HttpStatus.CREATED_201).build();
} | [
"@",
"POST",
"public",
"Response",
"postLicense",
"(",
"@",
"Auth",
"final",
"DbCredential",
"credential",
",",
"final",
"License",
"license",
")",
"{",
"if",
"(",
"!",
"credential",
".",
"getRoles",
"(",
")",
".",
"contains",
"(",
"AvailableRoles",
".",
"... | Handle license posts when the server got a request POST <dm_url>/license & MIME that contains the license.
@param license The license to add to Grapes database
@return Response An acknowledgment:<br/>- 400 if the artifact is MIME is malformed<br/>- 500 if internal error<br/>- 201 if ok | [
"Handle",
"license",
"posts",
"when",
"the",
"server",
"got",
"a",
"request",
"POST",
"<dm_url",
">",
"/",
"license",
"&",
"MIME",
"that",
"contains",
"the",
"license",
"."
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/LicenseResource.java#L54-L79 |
Jasig/uPortal | uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/rest/permissions/PermissionsRESTController.java | PermissionsRESTController.getActivities | @PreAuthorize(
"hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))")
@RequestMapping(value = "/permissions/activities.json", method = RequestMethod.GET)
public ModelAndView getActivities(@RequestParam(value = "q", required = false) String query) {
if (StringUtils.isNotBlank(query)) {
query = query.toLowerCase();
}
List<IPermissionActivity> activities = new ArrayList<>();
Collection<IPermissionOwner> owners = permissionOwnerDao.getAllPermissionOwners();
for (IPermissionOwner owner : owners) {
for (IPermissionActivity activity : owner.getActivities()) {
if (StringUtils.isBlank(query)
|| activity.getName().toLowerCase().contains(query)) {
activities.add(activity);
}
}
}
Collections.sort(activities);
ModelAndView mv = new ModelAndView();
mv.addObject("activities", activities);
mv.setViewName("json");
return mv;
} | java | @PreAuthorize(
"hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))")
@RequestMapping(value = "/permissions/activities.json", method = RequestMethod.GET)
public ModelAndView getActivities(@RequestParam(value = "q", required = false) String query) {
if (StringUtils.isNotBlank(query)) {
query = query.toLowerCase();
}
List<IPermissionActivity> activities = new ArrayList<>();
Collection<IPermissionOwner> owners = permissionOwnerDao.getAllPermissionOwners();
for (IPermissionOwner owner : owners) {
for (IPermissionActivity activity : owner.getActivities()) {
if (StringUtils.isBlank(query)
|| activity.getName().toLowerCase().contains(query)) {
activities.add(activity);
}
}
}
Collections.sort(activities);
ModelAndView mv = new ModelAndView();
mv.addObject("activities", activities);
mv.setViewName("json");
return mv;
} | [
"@",
"PreAuthorize",
"(",
"\"hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))\"",
")",
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/permissions/activities.json\"",
",",
"method",
"=",
"Re... | Provide a list of all registered IPermissionActivities. If an optional search string is
provided, the returned list will be restricted to activities matching the query. | [
"Provide",
"a",
"list",
"of",
"all",
"registered",
"IPermissionActivities",
".",
"If",
"an",
"optional",
"search",
"string",
"is",
"provided",
"the",
"returned",
"list",
"will",
"be",
"restricted",
"to",
"activities",
"matching",
"the",
"query",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/rest/permissions/PermissionsRESTController.java#L149-L176 |
actframework/actframework | src/main/java/act/internal/util/AppDescriptor.java | AppDescriptor.of | public static AppDescriptor of(String appName, Class<?> entryClass) {
System.setProperty("osgl.version.suppress-var-found-warning", "true");
return of(appName, entryClass, Version.of(entryClass));
} | java | public static AppDescriptor of(String appName, Class<?> entryClass) {
System.setProperty("osgl.version.suppress-var-found-warning", "true");
return of(appName, entryClass, Version.of(entryClass));
} | [
"public",
"static",
"AppDescriptor",
"of",
"(",
"String",
"appName",
",",
"Class",
"<",
"?",
">",
"entryClass",
")",
"{",
"System",
".",
"setProperty",
"(",
"\"osgl.version.suppress-var-found-warning\"",
",",
"\"true\"",
")",
";",
"return",
"of",
"(",
"appName",... | Create an `AppDescriptor` with appName and entry class specified.
If `appName` is `null` or blank, it will try the following
approach to get app name:
1. check the {@link Version#getArtifactId() artifact id} and use it unless
2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
@param appName
the app name
@param entryClass
the entry class
@return
an `AppDescriptor` instance | [
"Create",
"an",
"AppDescriptor",
"with",
"appName",
"and",
"entry",
"class",
"specified",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppDescriptor.java#L196-L199 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java | ClassDescriptorConstraints.ensureNoTableInfoIfNoRepositoryInfo | private void ensureNoTableInfoIfNoRepositoryInfo(ClassDescriptorDef classDef, String checkLevel)
{
if (!classDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_GENERATE_REPOSITORY_INFO, true))
{
classDef.setProperty(PropertyHelper.OJB_PROPERTY_GENERATE_TABLE_INFO, "false");
}
} | java | private void ensureNoTableInfoIfNoRepositoryInfo(ClassDescriptorDef classDef, String checkLevel)
{
if (!classDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_GENERATE_REPOSITORY_INFO, true))
{
classDef.setProperty(PropertyHelper.OJB_PROPERTY_GENERATE_TABLE_INFO, "false");
}
} | [
"private",
"void",
"ensureNoTableInfoIfNoRepositoryInfo",
"(",
"ClassDescriptorDef",
"classDef",
",",
"String",
"checkLevel",
")",
"{",
"if",
"(",
"!",
"classDef",
".",
"getBooleanProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_GENERATE_REPOSITORY_INFO",
",",
"true",... | Ensures that generate-table-info is set to false if generate-repository-info is set to false.
@param classDef The class descriptor
@param checkLevel The current check level (this constraint is checked in all levels) | [
"Ensures",
"that",
"generate",
"-",
"table",
"-",
"info",
"is",
"set",
"to",
"false",
"if",
"generate",
"-",
"repository",
"-",
"info",
"is",
"set",
"to",
"false",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java#L66-L72 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.removeNodesAsync | public Observable<Void> removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions) {
return removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter, poolRemoveNodesOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolRemoveNodesHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, PoolRemoveNodesHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions) {
return removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter, poolRemoveNodesOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolRemoveNodesHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, PoolRemoveNodesHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"removeNodesAsync",
"(",
"String",
"poolId",
",",
"NodeRemoveParameter",
"nodeRemoveParameter",
",",
"PoolRemoveNodesOptions",
"poolRemoveNodesOptions",
")",
"{",
"return",
"removeNodesWithServiceResponseAsync",
"(",
"poolId",
",",
... | Removes compute nodes from the specified pool.
This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing.
@param poolId The ID of the pool from which you want to remove nodes.
@param nodeRemoveParameter The parameters for the request.
@param poolRemoveNodesOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Removes",
"compute",
"nodes",
"from",
"the",
"specified",
"pool",
".",
"This",
"operation",
"can",
"only",
"run",
"when",
"the",
"allocation",
"state",
"of",
"the",
"pool",
"is",
"steady",
".",
"When",
"this",
"operation",
"runs",
"the",
"allocation",
"stat... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L3539-L3546 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELResolver.java | ELResolver.convertToType | public Object convertToType(ELContext context, Object obj, Class<?> type) {
context.setPropertyResolved(false);
return null;
} | java | public Object convertToType(ELContext context, Object obj, Class<?> type) {
context.setPropertyResolved(false);
return null;
} | [
"public",
"Object",
"convertToType",
"(",
"ELContext",
"context",
",",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"context",
".",
"setPropertyResolved",
"(",
"false",
")",
";",
"return",
"null",
";",
"}"
] | Converts the given object to the given type. This default implementation
always returns <code>null</code>.
@param context The EL context for this evaluation
@param obj The object to convert
@param type The type to which the object should be converted
@return Always <code>null</code>
@since EL 3.0 | [
"Converts",
"the",
"given",
"object",
"to",
"the",
"given",
"type",
".",
"This",
"default",
"implementation",
"always",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELResolver.java#L138-L141 |
apereo/person-directory | person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java | RequestAttributeSourceFilter.addRequestHeaders | protected void addRequestHeaders(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) {
for (final Map.Entry<String, Set<String>> headerAttributeEntry : this.headerAttributeMapping.entrySet()) {
final String headerName = headerAttributeEntry.getKey();
final String value = httpServletRequest.getHeader(headerName);
if (value != null) {
for (final String attributeName : headerAttributeEntry.getValue()) {
attributes.put(attributeName,
headersToIgnoreSemicolons.contains(headerName) ?
list(value)
: splitOnSemiColonHandlingBackslashEscaping(value));
}
}
}
} | java | protected void addRequestHeaders(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) {
for (final Map.Entry<String, Set<String>> headerAttributeEntry : this.headerAttributeMapping.entrySet()) {
final String headerName = headerAttributeEntry.getKey();
final String value = httpServletRequest.getHeader(headerName);
if (value != null) {
for (final String attributeName : headerAttributeEntry.getValue()) {
attributes.put(attributeName,
headersToIgnoreSemicolons.contains(headerName) ?
list(value)
: splitOnSemiColonHandlingBackslashEscaping(value));
}
}
}
} | [
"protected",
"void",
"addRequestHeaders",
"(",
"final",
"HttpServletRequest",
"httpServletRequest",
",",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"Object",
">",
">",
"attributes",
")",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
","... | Add request headers to the attributes map
@param httpServletRequest Http Servlet Request
@param attributes Map of attributes to add additional attributes to from the Http Request | [
"Add",
"request",
"headers",
"to",
"the",
"attributes",
"map"
] | train | https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java#L458-L472 |
overturetool/overture | core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java | ProofObligation.makeRelContext | protected AForAllExp makeRelContext(ATypeDefinition node, AVariableExp... exps){
AForAllExp forall_exp = new AForAllExp();
forall_exp.setType(new ABooleanBasicType());
ATypeMultipleBind tmb = new ATypeMultipleBind();
List<PPattern> pats = new LinkedList<>();
for (AVariableExp exp : exps)
{
pats.add(AstFactory.newAIdentifierPattern(exp.getName().clone()));
}
tmb.setPlist(pats);
tmb.setType(node.getType().clone());
List<PMultipleBind> binds = new LinkedList<>();
binds.add(tmb);
forall_exp.setBindList(binds);
return forall_exp;
} | java | protected AForAllExp makeRelContext(ATypeDefinition node, AVariableExp... exps){
AForAllExp forall_exp = new AForAllExp();
forall_exp.setType(new ABooleanBasicType());
ATypeMultipleBind tmb = new ATypeMultipleBind();
List<PPattern> pats = new LinkedList<>();
for (AVariableExp exp : exps)
{
pats.add(AstFactory.newAIdentifierPattern(exp.getName().clone()));
}
tmb.setPlist(pats);
tmb.setType(node.getType().clone());
List<PMultipleBind> binds = new LinkedList<>();
binds.add(tmb);
forall_exp.setBindList(binds);
return forall_exp;
} | [
"protected",
"AForAllExp",
"makeRelContext",
"(",
"ATypeDefinition",
"node",
",",
"AVariableExp",
"...",
"exps",
")",
"{",
"AForAllExp",
"forall_exp",
"=",
"new",
"AForAllExp",
"(",
")",
";",
"forall_exp",
".",
"setType",
"(",
"new",
"ABooleanBasicType",
"(",
")... | Create the context (forall x,y,z...) for a Proof Obligation for
eq and ord relations. | [
"Create",
"the",
"context",
"(",
"forall",
"x",
"y",
"z",
"...",
")",
"for",
"a",
"Proof",
"Obligation",
"for",
"eq",
"and",
"ord",
"relations",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/pog/src/main/java/org/overture/pog/obligation/ProofObligation.java#L237-L254 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/MonitorService.java | MonitorService.deleteLabel | public MonitorService deleteLabel(String monitorId, Label label)
{
HTTP.DELETE(String.format("/v1/monitors/%s/labels/%s", monitorId, label.getKey()));
return this;
} | java | public MonitorService deleteLabel(String monitorId, Label label)
{
HTTP.DELETE(String.format("/v1/monitors/%s/labels/%s", monitorId, label.getKey()));
return this;
} | [
"public",
"MonitorService",
"deleteLabel",
"(",
"String",
"monitorId",
",",
"Label",
"label",
")",
"{",
"HTTP",
".",
"DELETE",
"(",
"String",
".",
"format",
"(",
"\"/v1/monitors/%s/labels/%s\"",
",",
"monitorId",
",",
"label",
".",
"getKey",
"(",
")",
")",
"... | Deletes the given label from the monitor with the given id.
@param monitorId The id of the monitor with the label
@param label The label to delete
@return This object | [
"Deletes",
"the",
"given",
"label",
"from",
"the",
"monitor",
"with",
"the",
"given",
"id",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/MonitorService.java#L220-L224 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/AuthorizationHeaderProvider.java | AuthorizationHeaderProvider.getAuthorizationHeader | public String getAuthorizationHeader(AdsSession adsSession, @Nullable String endpointUrl)
throws AuthenticationException {
if (adsSession instanceof OAuth2Compatible
&& ((OAuth2Compatible) adsSession).getOAuth2Credential() != null) {
return getOAuth2Header((OAuth2Compatible) adsSession);
} else {
throw new IllegalArgumentException(
"Session does not have any valid authentication mechanisms");
}
} | java | public String getAuthorizationHeader(AdsSession adsSession, @Nullable String endpointUrl)
throws AuthenticationException {
if (adsSession instanceof OAuth2Compatible
&& ((OAuth2Compatible) adsSession).getOAuth2Credential() != null) {
return getOAuth2Header((OAuth2Compatible) adsSession);
} else {
throw new IllegalArgumentException(
"Session does not have any valid authentication mechanisms");
}
} | [
"public",
"String",
"getAuthorizationHeader",
"(",
"AdsSession",
"adsSession",
",",
"@",
"Nullable",
"String",
"endpointUrl",
")",
"throws",
"AuthenticationException",
"{",
"if",
"(",
"adsSession",
"instanceof",
"OAuth2Compatible",
"&&",
"(",
"(",
"OAuth2Compatible",
... | Gets a header value that can be set to the {@code Authorization} HTTP
header. The endpoint URL can be {@code null} if it's not needed for the
authentication mechanism (i.e. OAuth2).
@param adsSession the session to pull authentication information from
@param endpointUrl the endpoint URL used for authentication mechanisms like
OAuth.
@return the authorization header
@throws AuthenticationException if the authorization header could not be
created
@throws IllegalArgumentException if no valid authentication information
exists within the session. | [
"Gets",
"a",
"header",
"value",
"that",
"can",
"be",
"set",
"to",
"the",
"{",
"@code",
"Authorization",
"}",
"HTTP",
"header",
".",
"The",
"endpoint",
"URL",
"can",
"be",
"{",
"@code",
"null",
"}",
"if",
"it",
"s",
"not",
"needed",
"for",
"the",
"aut... | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/AuthorizationHeaderProvider.java#L70-L79 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkLogicalConjunction | private Environment checkLogicalConjunction(Expr.LogicalAnd expr, boolean sign, Environment environment) {
Tuple<Expr> operands = expr.getOperands();
if (sign) {
for (int i = 0; i != operands.size(); ++i) {
environment = checkCondition(operands.get(i), sign, environment);
}
return environment;
} else {
Environment[] refinements = new Environment[operands.size()];
for (int i = 0; i != operands.size(); ++i) {
refinements[i] = checkCondition(operands.get(i), sign, environment);
// The clever bit. Recalculate assuming opposite sign.
environment = checkCondition(operands.get(i), !sign, environment);
}
// Done.
return FlowTypeUtils.union(refinements);
}
} | java | private Environment checkLogicalConjunction(Expr.LogicalAnd expr, boolean sign, Environment environment) {
Tuple<Expr> operands = expr.getOperands();
if (sign) {
for (int i = 0; i != operands.size(); ++i) {
environment = checkCondition(operands.get(i), sign, environment);
}
return environment;
} else {
Environment[] refinements = new Environment[operands.size()];
for (int i = 0; i != operands.size(); ++i) {
refinements[i] = checkCondition(operands.get(i), sign, environment);
// The clever bit. Recalculate assuming opposite sign.
environment = checkCondition(operands.get(i), !sign, environment);
}
// Done.
return FlowTypeUtils.union(refinements);
}
} | [
"private",
"Environment",
"checkLogicalConjunction",
"(",
"Expr",
".",
"LogicalAnd",
"expr",
",",
"boolean",
"sign",
",",
"Environment",
"environment",
")",
"{",
"Tuple",
"<",
"Expr",
">",
"operands",
"=",
"expr",
".",
"getOperands",
"(",
")",
";",
"if",
"("... | In this case, we are threading each environment as is through to the next
statement. For example, consider this example:
<pre>
function f(int|null x) -> (bool r):
return (x is int) && (x >= 0)
</pre>
The environment going into <code>x is int</code> will be
<code>{x->(int|null)}</code>. The environment coming out of this statement
will be <code>{x->int}</code> and this is just threaded directly into the
next statement <code>x > 0</code>
@param operands
@param sign
@param environment
@return | [
"In",
"this",
"case",
"we",
"are",
"threading",
"each",
"environment",
"as",
"is",
"through",
"to",
"the",
"next",
"statement",
".",
"For",
"example",
"consider",
"this",
"example",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L997-L1014 |
LAW-Unimi/BUbiNG | src/it/unimi/di/law/bubing/util/Util.java | Util.writeByteArray | public final static void writeByteArray(final byte[] a, final ObjectOutputStream s) throws IOException {
writeVByte(a.length, s);
s.write(a);
} | java | public final static void writeByteArray(final byte[] a, final ObjectOutputStream s) throws IOException {
writeVByte(a.length, s);
s.write(a);
} | [
"public",
"final",
"static",
"void",
"writeByteArray",
"(",
"final",
"byte",
"[",
"]",
"a",
",",
"final",
"ObjectOutputStream",
"s",
")",
"throws",
"IOException",
"{",
"writeVByte",
"(",
"a",
".",
"length",
",",
"s",
")",
";",
"s",
".",
"write",
"(",
"... | Writes a byte array prefixed by its length encoded using vByte.
@param a the array to be written.
@param s the stream where the array should be written. | [
"Writes",
"a",
"byte",
"array",
"prefixed",
"by",
"its",
"length",
"encoded",
"using",
"vByte",
"."
] | train | https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/Util.java#L167-L170 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java | FlowController.resolveAction | public String resolveAction( String actionName, Object form, HttpServletRequest request,
HttpServletResponse response )
throws Exception
{
ActionMapping mapping = ( ActionMapping ) getModuleConfig().findActionConfig( '/' + actionName );
if ( mapping == null )
{
InternalUtils.throwPageFlowException( new ActionNotFoundException( actionName, this, form ), request );
}
ActionForward fwd = getActionMethodForward( actionName, form, request, response, mapping );
if ( fwd instanceof Forward )
{
( ( Forward ) fwd ).initialize( mapping, this, request );
}
String path = fwd.getPath();
if ( fwd.getContextRelative() || FileUtils.isAbsoluteURI( path ) )
{
return path;
}
else
{
return getModulePath() + path;
}
} | java | public String resolveAction( String actionName, Object form, HttpServletRequest request,
HttpServletResponse response )
throws Exception
{
ActionMapping mapping = ( ActionMapping ) getModuleConfig().findActionConfig( '/' + actionName );
if ( mapping == null )
{
InternalUtils.throwPageFlowException( new ActionNotFoundException( actionName, this, form ), request );
}
ActionForward fwd = getActionMethodForward( actionName, form, request, response, mapping );
if ( fwd instanceof Forward )
{
( ( Forward ) fwd ).initialize( mapping, this, request );
}
String path = fwd.getPath();
if ( fwd.getContextRelative() || FileUtils.isAbsoluteURI( path ) )
{
return path;
}
else
{
return getModulePath() + path;
}
} | [
"public",
"String",
"resolveAction",
"(",
"String",
"actionName",
",",
"Object",
"form",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"Exception",
"{",
"ActionMapping",
"mapping",
"=",
"(",
"ActionMapping",
")",
"getMo... | Call an action and return the result URI.
@param actionName the name of the action to run.
@param form the form bean instance to pass to the action, or <code>null</code> if none should be passed.
@return the result webapp-relative URI, as a String.
@throws ActionNotFoundException when the given action does not exist in this FlowController.
@throws Exception if the action method throws an Exception. | [
"Call",
"an",
"action",
"and",
"return",
"the",
"result",
"URI",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1095-L1122 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java | RTreeIndexCoreExtension.getRTreeTableName | private String getRTreeTableName(String tableName, String geometryColumnName) {
String sqlName = GeoPackageProperties.getProperty(SQL_PROPERTY,
TABLE_PROPERTY);
String rTreeTableName = substituteSqlArguments(sqlName, tableName,
geometryColumnName, null, null);
return rTreeTableName;
} | java | private String getRTreeTableName(String tableName, String geometryColumnName) {
String sqlName = GeoPackageProperties.getProperty(SQL_PROPERTY,
TABLE_PROPERTY);
String rTreeTableName = substituteSqlArguments(sqlName, tableName,
geometryColumnName, null, null);
return rTreeTableName;
} | [
"private",
"String",
"getRTreeTableName",
"(",
"String",
"tableName",
",",
"String",
"geometryColumnName",
")",
"{",
"String",
"sqlName",
"=",
"GeoPackageProperties",
".",
"getProperty",
"(",
"SQL_PROPERTY",
",",
"TABLE_PROPERTY",
")",
";",
"String",
"rTreeTableName",... | Get the RTree Table name for the feature table and geometry column
@param tableName
feature table name
@param geometryColumnName
geometry column name
@return RTree table name | [
"Get",
"the",
"RTree",
"Table",
"name",
"for",
"the",
"feature",
"table",
"and",
"geometry",
"column"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java#L1115-L1121 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Specification.java | Specification.removeReference | public void removeReference(Reference reference) throws GreenPepperServerException
{
if(!references.contains(reference))
{
throw new GreenPepperServerException( GreenPepperServerErrorKey.REFERENCE_NOT_FOUND, "Reference not found");
}
references.remove(reference);
reference.setSpecification(null);
} | java | public void removeReference(Reference reference) throws GreenPepperServerException
{
if(!references.contains(reference))
{
throw new GreenPepperServerException( GreenPepperServerErrorKey.REFERENCE_NOT_FOUND, "Reference not found");
}
references.remove(reference);
reference.setSpecification(null);
} | [
"public",
"void",
"removeReference",
"(",
"Reference",
"reference",
")",
"throws",
"GreenPepperServerException",
"{",
"if",
"(",
"!",
"references",
".",
"contains",
"(",
"reference",
")",
")",
"{",
"throw",
"new",
"GreenPepperServerException",
"(",
"GreenPepperServe... | <p>removeReference.</p>
@param reference a {@link com.greenpepper.server.domain.Reference} object.
@throws com.greenpepper.server.GreenPepperServerException if any. | [
"<p",
">",
"removeReference",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Specification.java#L167-L176 |
banq/jdonframework | JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/HessianToJdonServlet.java | HessianToJdonServlet.service | @Override
public void service(final ServletRequest req, final ServletResponse resp) throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
final String beanName = request.getPathInfo().substring(1); // remove "/"
htorp.process(beanName, request, response);
} | java | @Override
public void service(final ServletRequest req, final ServletResponse resp) throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
final String beanName = request.getPathInfo().substring(1); // remove "/"
htorp.process(beanName, request, response);
} | [
"@",
"Override",
"public",
"void",
"service",
"(",
"final",
"ServletRequest",
"req",
",",
"final",
"ServletResponse",
"resp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"HttpServletRequest",
"request",
"=",
"(",
"HttpServletRequest",
")",
"req",
"... | Servlet to handle incoming Hessian requests and invoke HessianToJdonRequestProcessor.
@param req ServletRequest
@param resp ServletResponse
@throws javax.servlet.ServletException If errors occur
@throws java.io.IOException If IO errors occur | [
"Servlet",
"to",
"handle",
"incoming",
"Hessian",
"requests",
"and",
"invoke",
"HessianToJdonRequestProcessor",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/HessianToJdonServlet.java#L56-L63 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/MethodUtils.java | MethodUtils.invokeStaticMethod | public static Object invokeStaticMethod(Class<?> objectClass, String methodName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
if (args == null) {
args = EMPTY_OBJECT_ARRAY;
}
int arguments = args.length;
Class<?>[] paramTypes = new Class<?>[arguments];
for (int i = 0; i < arguments; i++) {
paramTypes[i] = args[i].getClass();
}
return invokeStaticMethod(objectClass, methodName, args, paramTypes);
} | java | public static Object invokeStaticMethod(Class<?> objectClass, String methodName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
if (args == null) {
args = EMPTY_OBJECT_ARRAY;
}
int arguments = args.length;
Class<?>[] paramTypes = new Class<?>[arguments];
for (int i = 0; i < arguments; i++) {
paramTypes[i] = args[i].getClass();
}
return invokeStaticMethod(objectClass, methodName, args, paramTypes);
} | [
"public",
"static",
"Object",
"invokeStaticMethod",
"(",
"Class",
"<",
"?",
">",
"objectClass",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{"... | <p>Invoke a named static method whose parameter type matches the object type.</p>
<p>The behaviour of this method is less deterministic
than {@link #invokeExactMethod(Object object,String methodName,Object[] args)}.
It loops through all methods with names that match
and then executes the first it finds with compatible parameters.</p>
<p>This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a {@code Boolean} class
would match a {@code boolean} primitive.</p>
<p> This is a convenient wrapper for
{@link #invokeStaticMethod(Class objectClass,String methodName,Object[] args,Class[] paramTypes)}.
</p>
@param objectClass invoke static method on this class
@param methodName get method with this name
@param args use these arguments - treat null as empty array
@return the value returned by the invoked method
@throws NoSuchMethodException if there is no such accessible method
@throws InvocationTargetException wraps an exception thrown by the method invoked
@throws IllegalAccessException if the requested method is not accessible via reflection | [
"<p",
">",
"Invoke",
"a",
"named",
"static",
"method",
"whose",
"parameter",
"type",
"matches",
"the",
"object",
"type",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L459-L470 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLIrreflexiveObjectPropertyAxiomImpl_CustomFieldSerializer.java | OWLIrreflexiveObjectPropertyAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLIrreflexiveObjectPropertyAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLIrreflexiveObjectPropertyAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLIrreflexiveObjectPropertyAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"... | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLIrreflexiveObjectPropertyAxiomImpl_CustomFieldSerializer.java#L74-L77 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java | CoverageDataCore.getSourceMinAndMax | private CoverageDataSourcePixel getSourceMinAndMax(float source,
int sourceFloor, float valueLocation) {
int min = sourceFloor;
int max = sourceFloor;
float offset;
if (source < valueLocation) {
min--;
offset = 1.0f - (valueLocation - source);
} else {
max++;
offset = source - valueLocation;
}
return new CoverageDataSourcePixel(source, min, max, offset);
} | java | private CoverageDataSourcePixel getSourceMinAndMax(float source,
int sourceFloor, float valueLocation) {
int min = sourceFloor;
int max = sourceFloor;
float offset;
if (source < valueLocation) {
min--;
offset = 1.0f - (valueLocation - source);
} else {
max++;
offset = source - valueLocation;
}
return new CoverageDataSourcePixel(source, min, max, offset);
} | [
"private",
"CoverageDataSourcePixel",
"getSourceMinAndMax",
"(",
"float",
"source",
",",
"int",
"sourceFloor",
",",
"float",
"valueLocation",
")",
"{",
"int",
"min",
"=",
"sourceFloor",
";",
"int",
"max",
"=",
"sourceFloor",
";",
"float",
"offset",
";",
"if",
... | Get the min, max, and offset of the source pixel
@param source
source pixel
@param sourceFloor
source floor value
@param valueLocation
value location
@return source pixel information | [
"Get",
"the",
"min",
"max",
"and",
"offset",
"of",
"the",
"source",
"pixel"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1038-L1053 |
Coveros/selenified | src/main/java/com/coveros/selenified/services/HTTP.java | HTTP.writeJsonDataRequest | private void writeJsonDataRequest(HttpURLConnection connection, Request request) {
try (OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream())) {
wr.write(request.getJsonPayload().toString());
wr.flush();
} catch (IOException e) {
log.error(e);
}
} | java | private void writeJsonDataRequest(HttpURLConnection connection, Request request) {
try (OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream())) {
wr.write(request.getJsonPayload().toString());
wr.flush();
} catch (IOException e) {
log.error(e);
}
} | [
"private",
"void",
"writeJsonDataRequest",
"(",
"HttpURLConnection",
"connection",
",",
"Request",
"request",
")",
"{",
"try",
"(",
"OutputStreamWriter",
"wr",
"=",
"new",
"OutputStreamWriter",
"(",
"connection",
".",
"getOutputStream",
"(",
")",
")",
")",
"{",
... | Pushes request data to the open http connection
@param connection - the open connection of the http call
@param request - the parameters to be passed to the endpoint for the service
call | [
"Pushes",
"request",
"data",
"to",
"the",
"open",
"http",
"connection"
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/services/HTTP.java#L343-L350 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java | PacketParserUtils.parseStanza | public static Stanza parseStanza(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws Exception {
ParserUtils.assertAtStartTag(parser);
final String name = parser.getName();
switch (name) {
case Message.ELEMENT:
return parseMessage(parser, outerXmlEnvironment);
case IQ.IQ_ELEMENT:
return parseIQ(parser, outerXmlEnvironment);
case Presence.ELEMENT:
return parsePresence(parser, outerXmlEnvironment);
default:
throw new IllegalArgumentException("Can only parse message, iq or presence, not " + name);
}
} | java | public static Stanza parseStanza(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws Exception {
ParserUtils.assertAtStartTag(parser);
final String name = parser.getName();
switch (name) {
case Message.ELEMENT:
return parseMessage(parser, outerXmlEnvironment);
case IQ.IQ_ELEMENT:
return parseIQ(parser, outerXmlEnvironment);
case Presence.ELEMENT:
return parsePresence(parser, outerXmlEnvironment);
default:
throw new IllegalArgumentException("Can only parse message, iq or presence, not " + name);
}
} | [
"public",
"static",
"Stanza",
"parseStanza",
"(",
"XmlPullParser",
"parser",
",",
"XmlEnvironment",
"outerXmlEnvironment",
")",
"throws",
"Exception",
"{",
"ParserUtils",
".",
"assertAtStartTag",
"(",
"parser",
")",
";",
"final",
"String",
"name",
"=",
"parser",
"... | Tries to parse and return either a Message, IQ or Presence stanza.
connection is optional and is used to return feature-not-implemented errors for unknown IQ stanzas.
@param parser
@param outerXmlEnvironment the outer XML environment (optional).
@return a stanza which is either a Message, IQ or Presence.
@throws Exception | [
"Tries",
"to",
"parse",
"and",
"return",
"either",
"a",
"Message",
"IQ",
"or",
"Presence",
"stanza",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L154-L167 |
jxnet/Jxnet | jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/HandlerConfigurer.java | HandlerConfigurer.decodeRawBuffer | public Packet decodeRawBuffer(long address, int length) {
return processPacket(Memories.wrap(address, length, memoryProperties.getCheckBounds()));
} | java | public Packet decodeRawBuffer(long address, int length) {
return processPacket(Memories.wrap(address, length, memoryProperties.getCheckBounds()));
} | [
"public",
"Packet",
"decodeRawBuffer",
"(",
"long",
"address",
",",
"int",
"length",
")",
"{",
"return",
"processPacket",
"(",
"Memories",
".",
"wrap",
"(",
"address",
",",
"length",
",",
"memoryProperties",
".",
"getCheckBounds",
"(",
")",
")",
")",
";",
... | Decode buffer.
@param address memory address.
@param length length.
@return returns {@link Packet}. | [
"Decode",
"buffer",
"."
] | train | https://github.com/jxnet/Jxnet/blob/3ef28eb83c149ff134df1841d12bcbea3d8fe163/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/HandlerConfigurer.java#L77-L79 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java | CPSpecificationOptionPersistenceImpl.findByUUID_G | @Override
public CPSpecificationOption findByUUID_G(String uuid, long groupId)
throws NoSuchCPSpecificationOptionException {
CPSpecificationOption cpSpecificationOption = fetchByUUID_G(uuid,
groupId);
if (cpSpecificationOption == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPSpecificationOptionException(msg.toString());
}
return cpSpecificationOption;
} | java | @Override
public CPSpecificationOption findByUUID_G(String uuid, long groupId)
throws NoSuchCPSpecificationOptionException {
CPSpecificationOption cpSpecificationOption = fetchByUUID_G(uuid,
groupId);
if (cpSpecificationOption == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPSpecificationOptionException(msg.toString());
}
return cpSpecificationOption;
} | [
"@",
"Override",
"public",
"CPSpecificationOption",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCPSpecificationOptionException",
"{",
"CPSpecificationOption",
"cpSpecificationOption",
"=",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupI... | Returns the cp specification option where uuid = ? and groupId = ? or throws a {@link NoSuchCPSpecificationOptionException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching cp specification option
@throws NoSuchCPSpecificationOptionException if a matching cp specification option could not be found | [
"Returns",
"the",
"cp",
"specification",
"option",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPSpecificationOptionException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java#L670-L697 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java | NotificationHubsInner.createOrUpdateAuthorizationRule | public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, SharedAccessAuthorizationRuleProperties properties) {
return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, properties).toBlocking().single().body();
} | java | public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, SharedAccessAuthorizationRuleProperties properties) {
return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, properties).toBlocking().single().body();
} | [
"public",
"SharedAccessAuthorizationRuleResourceInner",
"createOrUpdateAuthorizationRule",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
",",
"String",
"notificationHubName",
",",
"String",
"authorizationRuleName",
",",
"SharedAccessAuthorizationRuleProperties",... | Creates/Updates an authorization rule for a NotificationHub.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param notificationHubName The notification hub name.
@param authorizationRuleName Authorization Rule Name.
@param properties Properties of the Namespace AuthorizationRules.
@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 SharedAccessAuthorizationRuleResourceInner object if successful. | [
"Creates",
"/",
"Updates",
"an",
"authorization",
"rule",
"for",
"a",
"NotificationHub",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L901-L903 |
bazaarvoice/emodb | common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java | EmoUriComponent.decodePathSegment | public static void decodePathSegment(List<PathSegment> segments, String segment, boolean decode) {
int colon = segment.indexOf(';');
if (colon != -1) {
segments.add(new PathSegmentImpl(
(colon == 0) ? "" : segment.substring(0, colon),
decode,
decodeMatrix(segment, decode)));
} else {
segments.add(new PathSegmentImpl(
segment,
decode));
}
} | java | public static void decodePathSegment(List<PathSegment> segments, String segment, boolean decode) {
int colon = segment.indexOf(';');
if (colon != -1) {
segments.add(new PathSegmentImpl(
(colon == 0) ? "" : segment.substring(0, colon),
decode,
decodeMatrix(segment, decode)));
} else {
segments.add(new PathSegmentImpl(
segment,
decode));
}
} | [
"public",
"static",
"void",
"decodePathSegment",
"(",
"List",
"<",
"PathSegment",
">",
"segments",
",",
"String",
"segment",
",",
"boolean",
"decode",
")",
"{",
"int",
"colon",
"=",
"segment",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"colon",
... | Decode the path segment and add it to the list of path segments.
@param segments mutable list of path segments.
@param segment path segment to be decoded.
@param decode {@code true} if the path segment should be in a decoded form. | [
"Decode",
"the",
"path",
"segment",
"and",
"add",
"it",
"to",
"the",
"list",
"of",
"path",
"segments",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java#L648-L660 |
threerings/nenya | core/src/main/java/com/threerings/media/image/TransformedMirage.java | TransformedMirage.computeTransformedBounds | protected void computeTransformedBounds ()
{
int w = _base.getWidth();
int h = _base.getHeight();
Point[] points = new Point[] {
new Point(0, 0), new Point(w, 0), new Point(0, h), new Point(w, h) };
_transform.transform(points, 0, points, 0, 4);
int minX, minY, maxX, maxY;
minX = minY = Integer.MAX_VALUE;
maxX = maxY = Integer.MIN_VALUE;
for (int ii=0; ii < 4; ii++) {
minX = Math.min(minX, points[ii].x);
maxX = Math.max(maxX, points[ii].x);
minY = Math.min(minY, points[ii].y);
maxY = Math.max(maxY, points[ii].y);
}
_bounds = new Rectangle(minX, minY, maxX - minX, maxY - minY);
} | java | protected void computeTransformedBounds ()
{
int w = _base.getWidth();
int h = _base.getHeight();
Point[] points = new Point[] {
new Point(0, 0), new Point(w, 0), new Point(0, h), new Point(w, h) };
_transform.transform(points, 0, points, 0, 4);
int minX, minY, maxX, maxY;
minX = minY = Integer.MAX_VALUE;
maxX = maxY = Integer.MIN_VALUE;
for (int ii=0; ii < 4; ii++) {
minX = Math.min(minX, points[ii].x);
maxX = Math.max(maxX, points[ii].x);
minY = Math.min(minY, points[ii].y);
maxY = Math.max(maxY, points[ii].y);
}
_bounds = new Rectangle(minX, minY, maxX - minX, maxY - minY);
} | [
"protected",
"void",
"computeTransformedBounds",
"(",
")",
"{",
"int",
"w",
"=",
"_base",
".",
"getWidth",
"(",
")",
";",
"int",
"h",
"=",
"_base",
".",
"getHeight",
"(",
")",
";",
"Point",
"[",
"]",
"points",
"=",
"new",
"Point",
"[",
"]",
"{",
"n... | Compute the bounds of the base Mirage after it has been transformed. | [
"Compute",
"the",
"bounds",
"of",
"the",
"base",
"Mirage",
"after",
"it",
"has",
"been",
"transformed",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/TransformedMirage.java#L122-L140 |
kaazing/gateway | resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java | URIUtils.buildURIAsString | public static String buildURIAsString(String scheme, String userInfo,
String host, int port, String path, String query, String fragment) throws URISyntaxException {
URI helperURI;
try {
helperURI = new URI(scheme, userInfo, host, port, path, query, fragment);
} catch (URISyntaxException e) {
return NetworkInterfaceURI.buildURIToString(scheme, userInfo, host, port, path, query, fragment);
}
return helperURI.toString();
} | java | public static String buildURIAsString(String scheme, String userInfo,
String host, int port, String path, String query, String fragment) throws URISyntaxException {
URI helperURI;
try {
helperURI = new URI(scheme, userInfo, host, port, path, query, fragment);
} catch (URISyntaxException e) {
return NetworkInterfaceURI.buildURIToString(scheme, userInfo, host, port, path, query, fragment);
}
return helperURI.toString();
} | [
"public",
"static",
"String",
"buildURIAsString",
"(",
"String",
"scheme",
",",
"String",
"userInfo",
",",
"String",
"host",
",",
"int",
"port",
",",
"String",
"path",
",",
"String",
"query",
",",
"String",
"fragment",
")",
"throws",
"URISyntaxException",
"{",... | Helper method for building URI as String
@param scheme
@param userInfo
@param host
@param port
@param path
@param query
@param fragment
@return
@throws URISyntaxException | [
"Helper",
"method",
"for",
"building",
"URI",
"as",
"String"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java#L245-L254 |
FXMisc/WellBehavedFX | src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java | InputMapTemplate.installOverride | public static <S, N extends Node, E extends Event> void installOverride(InputMapTemplate<S, E> imt, S target, Function<? super S, ? extends N> getNode) {
Nodes.addInputMap(getNode.apply(target), imt.instantiate(target));
} | java | public static <S, N extends Node, E extends Event> void installOverride(InputMapTemplate<S, E> imt, S target, Function<? super S, ? extends N> getNode) {
Nodes.addInputMap(getNode.apply(target), imt.instantiate(target));
} | [
"public",
"static",
"<",
"S",
",",
"N",
"extends",
"Node",
",",
"E",
"extends",
"Event",
">",
"void",
"installOverride",
"(",
"InputMapTemplate",
"<",
"S",
",",
"E",
">",
"imt",
",",
"S",
"target",
",",
"Function",
"<",
"?",
"super",
"S",
",",
"?",
... | Instantiates the input map and installs it into the node via {@link Nodes#addInputMap(Node, InputMap)} | [
"Instantiates",
"the",
"input",
"map",
"and",
"installs",
"it",
"into",
"the",
"node",
"via",
"{"
] | train | https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java#L378-L380 |
pac4j/pac4j | pac4j-config/src/main/java/org/pac4j/config/ldaptive/LdaptiveAuthenticatorBuilder.java | LdaptiveAuthenticatorBuilder.newBlockingConnectionPool | public static ConnectionPool newBlockingConnectionPool(final AbstractLdapProperties l) {
final DefaultConnectionFactory bindCf = newConnectionFactory(l);
final PoolConfig pc = newPoolConfig(l);
final BlockingConnectionPool cp = new BlockingConnectionPool(pc, bindCf);
cp.setBlockWaitTime(newDuration(l.getBlockWaitTime()));
cp.setPoolConfig(pc);
final IdlePruneStrategy strategy = new IdlePruneStrategy();
strategy.setIdleTime(newDuration(l.getIdleTime()));
strategy.setPrunePeriod(newDuration(l.getPrunePeriod()));
cp.setPruneStrategy(strategy);
cp.setValidator(new SearchValidator());
cp.setFailFastInitialize(l.isFailFast());
if (CommonHelper.isNotBlank(l.getPoolPassivator())) {
final AbstractLdapProperties.LdapConnectionPoolPassivator pass =
AbstractLdapProperties.LdapConnectionPoolPassivator.valueOf(l.getPoolPassivator().toUpperCase());
switch (pass) {
case CLOSE:
cp.setPassivator(new ClosePassivator());
break;
case BIND:
LOGGER.debug("Creating a bind passivator instance for the connection pool");
final BindRequest bindRequest = new BindRequest();
bindRequest.setDn(l.getBindDn());
bindRequest.setCredential(new Credential(l.getBindCredential()));
cp.setPassivator(new BindPassivator(bindRequest));
break;
default:
break;
}
}
LOGGER.debug("Initializing ldap connection pool for {} and bindDn {}", l.getLdapUrl(), l.getBindDn());
cp.initialize();
return cp;
} | java | public static ConnectionPool newBlockingConnectionPool(final AbstractLdapProperties l) {
final DefaultConnectionFactory bindCf = newConnectionFactory(l);
final PoolConfig pc = newPoolConfig(l);
final BlockingConnectionPool cp = new BlockingConnectionPool(pc, bindCf);
cp.setBlockWaitTime(newDuration(l.getBlockWaitTime()));
cp.setPoolConfig(pc);
final IdlePruneStrategy strategy = new IdlePruneStrategy();
strategy.setIdleTime(newDuration(l.getIdleTime()));
strategy.setPrunePeriod(newDuration(l.getPrunePeriod()));
cp.setPruneStrategy(strategy);
cp.setValidator(new SearchValidator());
cp.setFailFastInitialize(l.isFailFast());
if (CommonHelper.isNotBlank(l.getPoolPassivator())) {
final AbstractLdapProperties.LdapConnectionPoolPassivator pass =
AbstractLdapProperties.LdapConnectionPoolPassivator.valueOf(l.getPoolPassivator().toUpperCase());
switch (pass) {
case CLOSE:
cp.setPassivator(new ClosePassivator());
break;
case BIND:
LOGGER.debug("Creating a bind passivator instance for the connection pool");
final BindRequest bindRequest = new BindRequest();
bindRequest.setDn(l.getBindDn());
bindRequest.setCredential(new Credential(l.getBindCredential()));
cp.setPassivator(new BindPassivator(bindRequest));
break;
default:
break;
}
}
LOGGER.debug("Initializing ldap connection pool for {} and bindDn {}", l.getLdapUrl(), l.getBindDn());
cp.initialize();
return cp;
} | [
"public",
"static",
"ConnectionPool",
"newBlockingConnectionPool",
"(",
"final",
"AbstractLdapProperties",
"l",
")",
"{",
"final",
"DefaultConnectionFactory",
"bindCf",
"=",
"newConnectionFactory",
"(",
"l",
")",
";",
"final",
"PoolConfig",
"pc",
"=",
"newPoolConfig",
... | New blocking connection pool connection pool.
@param l the l
@return the connection pool | [
"New",
"blocking",
"connection",
"pool",
"connection",
"pool",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-config/src/main/java/org/pac4j/config/ldaptive/LdaptiveAuthenticatorBuilder.java#L281-L319 |
synchronoss/cpo-api | cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java | CassandraCpoAdapter.executeObject | @Override
public <T> T executeObject(String name, T object) throws CpoException {
throw new UnsupportedOperationException("Execute Functions not supported in Cassandra");
} | java | @Override
public <T> T executeObject(String name, T object) throws CpoException {
throw new UnsupportedOperationException("Execute Functions not supported in Cassandra");
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"executeObject",
"(",
"String",
"name",
",",
"T",
"object",
")",
"throws",
"CpoException",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Execute Functions not supported in Cassandra\"",
")",
";",
"}"
] | Executes an Object whose metadata will call an executable within the datasource. It is assumed that the executable
object exists in the metadatasource. If the executable does not exist, an exception will be thrown.
<p/>
<pre>Example:
<code>
<p/>
class SomeObject so = new SomeObject();
class CpoAdapter cpo = null;
<p/>
try {
cpo = new CpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
<p/>
if (cpo!=null) {
so.setId(1);
so.setName("SomeName");
try{
cpo.executeObject("execNotifyProc",so);
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The filter name which tells the datasource which objects should be returned. The name also signifies
what data in the object will be populated.
@param object This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown.
This object is used to populate the IN arguments used to retrieve the collection of objects. This object defines
the object type that will be returned in the collection and contain the result set data or the OUT Parameters.
@return A result object populate with the OUT arguments
@throws CpoException if there are errors accessing the datasource | [
"Executes",
"an",
"Object",
"whose",
"metadata",
"will",
"call",
"an",
"executable",
"within",
"the",
"datasource",
".",
"It",
"is",
"assumed",
"that",
"the",
"executable",
"object",
"exists",
"in",
"the",
"metadatasource",
".",
"If",
"the",
"executable",
"doe... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L765-L768 |
apiman/apiman | gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/AbstractEngineFactory.java | AbstractEngineFactory.createEngine | @Override
public final IEngine createEngine() {
IPluginRegistry pluginRegistry = createPluginRegistry();
IDataEncrypter encrypter = createDataEncrypter(pluginRegistry);
CurrentDataEncrypter.instance = encrypter;
IRegistry registry = createRegistry(pluginRegistry, encrypter);
IComponentRegistry componentRegistry = createComponentRegistry(pluginRegistry);
IConnectorFactory cfactory = createConnectorFactory(pluginRegistry);
IPolicyFactory pfactory = createPolicyFactory(pluginRegistry);
IMetrics metrics = createMetrics(pluginRegistry);
IDelegateFactory logFactory = createLoggerFactory(pluginRegistry);
IApiRequestPathParser pathParser = createRequestPathParser(pluginRegistry);
List<IGatewayInitializer> initializers = createInitializers(pluginRegistry);
for (IGatewayInitializer initializer : initializers) {
initializer.initialize();
}
complete();
return new EngineImpl(registry, pluginRegistry, componentRegistry, cfactory, pfactory, metrics, logFactory, pathParser);
} | java | @Override
public final IEngine createEngine() {
IPluginRegistry pluginRegistry = createPluginRegistry();
IDataEncrypter encrypter = createDataEncrypter(pluginRegistry);
CurrentDataEncrypter.instance = encrypter;
IRegistry registry = createRegistry(pluginRegistry, encrypter);
IComponentRegistry componentRegistry = createComponentRegistry(pluginRegistry);
IConnectorFactory cfactory = createConnectorFactory(pluginRegistry);
IPolicyFactory pfactory = createPolicyFactory(pluginRegistry);
IMetrics metrics = createMetrics(pluginRegistry);
IDelegateFactory logFactory = createLoggerFactory(pluginRegistry);
IApiRequestPathParser pathParser = createRequestPathParser(pluginRegistry);
List<IGatewayInitializer> initializers = createInitializers(pluginRegistry);
for (IGatewayInitializer initializer : initializers) {
initializer.initialize();
}
complete();
return new EngineImpl(registry, pluginRegistry, componentRegistry, cfactory, pfactory, metrics, logFactory, pathParser);
} | [
"@",
"Override",
"public",
"final",
"IEngine",
"createEngine",
"(",
")",
"{",
"IPluginRegistry",
"pluginRegistry",
"=",
"createPluginRegistry",
"(",
")",
";",
"IDataEncrypter",
"encrypter",
"=",
"createDataEncrypter",
"(",
"pluginRegistry",
")",
";",
"CurrentDataEncry... | Call this to create a new engine. This method uses the engine
config singleton to create the engine. | [
"Call",
"this",
"to",
"create",
"a",
"new",
"engine",
".",
"This",
"method",
"uses",
"the",
"engine",
"config",
"singleton",
"to",
"create",
"the",
"engine",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/AbstractEngineFactory.java#L51-L71 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/CheckBoxMenuItemPainter.java | CheckBoxMenuItemPainter.paintCheckIconEnabledAndSelected | private void paintCheckIconEnabledAndSelected(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createCheckMark(0, 0, width, height);
g.setPaint(iconEnabledSelected);
g.fill(s);
} | java | private void paintCheckIconEnabledAndSelected(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createCheckMark(0, 0, width, height);
g.setPaint(iconEnabledSelected);
g.fill(s);
} | [
"private",
"void",
"paintCheckIconEnabledAndSelected",
"(",
"Graphics2D",
"g",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Shape",
"s",
"=",
"shapeGenerator",
".",
"createCheckMark",
"(",
"0",
",",
"0",
",",
"width",
",",
"height",
")",
";",
"g",... | Paint the check mark in enabled state.
@param g the Graphics2D context to paint with.
@param width the width.
@param height the height. | [
"Paint",
"the",
"check",
"mark",
"in",
"enabled",
"state",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/CheckBoxMenuItemPainter.java#L147-L151 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/CpcSketch.java | CpcSketch.updateHIP | private static void updateHIP(final CpcSketch sketch, final int rowCol) {
final int k = 1 << sketch.lgK;
final int col = rowCol & 63;
final double oneOverP = k / sketch.kxp;
sketch.hipEstAccum += oneOverP;
sketch.kxp -= invPow2(col + 1); // notice the "+1"
} | java | private static void updateHIP(final CpcSketch sketch, final int rowCol) {
final int k = 1 << sketch.lgK;
final int col = rowCol & 63;
final double oneOverP = k / sketch.kxp;
sketch.hipEstAccum += oneOverP;
sketch.kxp -= invPow2(col + 1); // notice the "+1"
} | [
"private",
"static",
"void",
"updateHIP",
"(",
"final",
"CpcSketch",
"sketch",
",",
"final",
"int",
"rowCol",
")",
"{",
"final",
"int",
"k",
"=",
"1",
"<<",
"sketch",
".",
"lgK",
";",
"final",
"int",
"col",
"=",
"rowCol",
"&",
"63",
";",
"final",
"do... | Call this whenever a new coupon has been collected.
@param sketch the given sketch
@param rowCol the given row / column | [
"Call",
"this",
"whenever",
"a",
"new",
"coupon",
"has",
"been",
"collected",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L559-L565 |
j256/ormlite-core | src/main/java/com/j256/ormlite/support/BaseConnectionSource.java | BaseConnectionSource.clearSpecial | protected boolean clearSpecial(DatabaseConnection connection, Logger logger) {
NestedConnection currentSaved = specialConnection.get();
boolean cleared = false;
if (connection == null) {
// ignored
} else if (currentSaved == null) {
logger.error("no connection has been saved when clear() called");
} else if (currentSaved.connection == connection) {
if (currentSaved.decrementAndGet() == 0) {
// we only clear the connection if nested counter is 0
specialConnection.set(null);
}
cleared = true;
} else {
logger.error("connection saved {} is not the one being cleared {}", currentSaved.connection, connection);
}
// release should then be called after clear
return cleared;
} | java | protected boolean clearSpecial(DatabaseConnection connection, Logger logger) {
NestedConnection currentSaved = specialConnection.get();
boolean cleared = false;
if (connection == null) {
// ignored
} else if (currentSaved == null) {
logger.error("no connection has been saved when clear() called");
} else if (currentSaved.connection == connection) {
if (currentSaved.decrementAndGet() == 0) {
// we only clear the connection if nested counter is 0
specialConnection.set(null);
}
cleared = true;
} else {
logger.error("connection saved {} is not the one being cleared {}", currentSaved.connection, connection);
}
// release should then be called after clear
return cleared;
} | [
"protected",
"boolean",
"clearSpecial",
"(",
"DatabaseConnection",
"connection",
",",
"Logger",
"logger",
")",
"{",
"NestedConnection",
"currentSaved",
"=",
"specialConnection",
".",
"get",
"(",
")",
";",
"boolean",
"cleared",
"=",
"false",
";",
"if",
"(",
"conn... | Clear the connection that was previously saved.
@return True if the connection argument had been saved. | [
"Clear",
"the",
"connection",
"that",
"was",
"previously",
"saved",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/support/BaseConnectionSource.java#L80-L98 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java | MapWithProtoValuesSubject.containsExactly | @CanIgnoreReturnValue
public Ordered containsExactly(@NullableDecl Object k0, @NullableDecl Object v0, Object... rest) {
return delegate().containsExactly(k0, v0, rest);
} | java | @CanIgnoreReturnValue
public Ordered containsExactly(@NullableDecl Object k0, @NullableDecl Object v0, Object... rest) {
return delegate().containsExactly(k0, v0, rest);
} | [
"@",
"CanIgnoreReturnValue",
"public",
"Ordered",
"containsExactly",
"(",
"@",
"NullableDecl",
"Object",
"k0",
",",
"@",
"NullableDecl",
"Object",
"v0",
",",
"Object",
"...",
"rest",
")",
"{",
"return",
"delegate",
"(",
")",
".",
"containsExactly",
"(",
"k0",
... | Fails if the map does not contain exactly the given set of key/value pairs.
<p><b>Warning:</b> the use of varargs means that we cannot guarantee an equal number of
key/value pairs at compile time. Please make sure you provide varargs in key/value pairs! | [
"Fails",
"if",
"the",
"map",
"does",
"not",
"contain",
"exactly",
"the",
"given",
"set",
"of",
"key",
"/",
"value",
"pairs",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java#L163-L166 |
kejunxia/AndroidMvc | extension/service-mediastore/src/main/java/com/shipdream/lib/android/mvc/service/internal/MediaStoreServiceImpl.java | MediaStoreServiceImpl.extractOneVideoFromCursor | protected VideoDTO extractOneVideoFromCursor(Cursor cursor) {
if(videoIdCol == -1) {
videoIdCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media._ID);
videoTitleCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.TITLE);
videoDisplayNameCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DISPLAY_NAME);
videoDescriptionCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DESCRIPTION);
videoBucketIdCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.BUCKET_ID);
videoBucketDisplayNameCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.BUCKET_DISPLAY_NAME);
videoDataCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
videoMimeCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE);
videoResolutionCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.RESOLUTION);
videoSizeCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.SIZE);
videoDateAddedCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATE_ADDED);
videoDateTakenCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATE_TAKEN);
videoDateModifyCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATE_MODIFIED);
videoLatitudeCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.LATITUDE);
videoLongitudeCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.LONGITUDE);
videoAlbumCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.ALBUM);
videoArtistCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.ARTIST);
}
VideoDTO video = new VideoDTO();
video.setId(cursor.getLong(videoIdCol));
video.setTitle(cursor.getString(videoTitleCol));
video.setDisplayName(cursor.getString(videoDisplayNameCol));
video.setDescription(cursor.getString(videoDescriptionCol));
video.setBucketId(cursor.getString(videoBucketIdCol));
video.setBucketDisplayName(cursor.getString(videoBucketDisplayNameCol));
video.setUri(cursor.getString(videoDataCol));
video.setMimeType(cursor.getString(videoMimeCol));
video.setSize(cursor.getLong(videoSizeCol));
video.setAddedDate(new Date(cursor.getLong(videoDateAddedCol)));
video.setTakenDate(new Date(cursor.getLong(videoDateTakenCol)));
video.setModifyDate(new Date(cursor.getLong(videoDateModifyCol)));
video.setLatitude(cursor.getDouble(videoLatitudeCol));
video.setLongitude(cursor.getDouble(videoLongitudeCol));
video.setAlbum(cursor.getString(videoAlbumCol));
video.setArtist(cursor.getString(videoArtistCol));
String resolution = cursor.getString(videoResolutionCol);
if (resolution != null) {
try {
String[] res = resolution.split("x");
int width = Integer.parseInt(res[0]);
int height = Integer.parseInt(res[1]);
video.setWidth(width);
video.setHeight(height);
} catch (Exception e) {
Log.w(TAG, String.format("Failed to parse resolution of video(id=%d, title=%s, displayName=%s)",
video.getId(), video.getTitle(), video.getDisplayName()), e);
}
}
return video;
} | java | protected VideoDTO extractOneVideoFromCursor(Cursor cursor) {
if(videoIdCol == -1) {
videoIdCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media._ID);
videoTitleCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.TITLE);
videoDisplayNameCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DISPLAY_NAME);
videoDescriptionCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DESCRIPTION);
videoBucketIdCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.BUCKET_ID);
videoBucketDisplayNameCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.BUCKET_DISPLAY_NAME);
videoDataCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
videoMimeCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE);
videoResolutionCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.RESOLUTION);
videoSizeCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.SIZE);
videoDateAddedCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATE_ADDED);
videoDateTakenCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATE_TAKEN);
videoDateModifyCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATE_MODIFIED);
videoLatitudeCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.LATITUDE);
videoLongitudeCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.LONGITUDE);
videoAlbumCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.ALBUM);
videoArtistCol = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.ARTIST);
}
VideoDTO video = new VideoDTO();
video.setId(cursor.getLong(videoIdCol));
video.setTitle(cursor.getString(videoTitleCol));
video.setDisplayName(cursor.getString(videoDisplayNameCol));
video.setDescription(cursor.getString(videoDescriptionCol));
video.setBucketId(cursor.getString(videoBucketIdCol));
video.setBucketDisplayName(cursor.getString(videoBucketDisplayNameCol));
video.setUri(cursor.getString(videoDataCol));
video.setMimeType(cursor.getString(videoMimeCol));
video.setSize(cursor.getLong(videoSizeCol));
video.setAddedDate(new Date(cursor.getLong(videoDateAddedCol)));
video.setTakenDate(new Date(cursor.getLong(videoDateTakenCol)));
video.setModifyDate(new Date(cursor.getLong(videoDateModifyCol)));
video.setLatitude(cursor.getDouble(videoLatitudeCol));
video.setLongitude(cursor.getDouble(videoLongitudeCol));
video.setAlbum(cursor.getString(videoAlbumCol));
video.setArtist(cursor.getString(videoArtistCol));
String resolution = cursor.getString(videoResolutionCol);
if (resolution != null) {
try {
String[] res = resolution.split("x");
int width = Integer.parseInt(res[0]);
int height = Integer.parseInt(res[1]);
video.setWidth(width);
video.setHeight(height);
} catch (Exception e) {
Log.w(TAG, String.format("Failed to parse resolution of video(id=%d, title=%s, displayName=%s)",
video.getId(), video.getTitle(), video.getDisplayName()), e);
}
}
return video;
} | [
"protected",
"VideoDTO",
"extractOneVideoFromCursor",
"(",
"Cursor",
"cursor",
")",
"{",
"if",
"(",
"videoIdCol",
"==",
"-",
"1",
")",
"{",
"videoIdCol",
"=",
"cursor",
".",
"getColumnIndexOrThrow",
"(",
"MediaStore",
".",
"Video",
".",
"Media",
".",
"_ID",
... | Extract one videoDTO from the given cursor from its current position
@param cursor
@return | [
"Extract",
"one",
"videoDTO",
"from",
"the",
"given",
"cursor",
"from",
"its",
"current",
"position"
] | train | https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/extension/service-mediastore/src/main/java/com/shipdream/lib/android/mvc/service/internal/MediaStoreServiceImpl.java#L464-L517 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/endpoint/healthcheck/HttpHealthCheckedEndpointGroup.java | HttpHealthCheckedEndpointGroup.of | @Deprecated
public static HttpHealthCheckedEndpointGroup of(EndpointGroup delegate,
String healthCheckPath,
Duration healthCheckRetryInterval) {
return of(ClientFactory.DEFAULT, delegate, healthCheckPath, healthCheckRetryInterval);
} | java | @Deprecated
public static HttpHealthCheckedEndpointGroup of(EndpointGroup delegate,
String healthCheckPath,
Duration healthCheckRetryInterval) {
return of(ClientFactory.DEFAULT, delegate, healthCheckPath, healthCheckRetryInterval);
} | [
"@",
"Deprecated",
"public",
"static",
"HttpHealthCheckedEndpointGroup",
"of",
"(",
"EndpointGroup",
"delegate",
",",
"String",
"healthCheckPath",
",",
"Duration",
"healthCheckRetryInterval",
")",
"{",
"return",
"of",
"(",
"ClientFactory",
".",
"DEFAULT",
",",
"delega... | Creates a new {@link HttpHealthCheckedEndpointGroup} instance.
@deprecated Use {@link HttpHealthCheckedEndpointGroupBuilder}. | [
"Creates",
"a",
"new",
"{",
"@link",
"HttpHealthCheckedEndpointGroup",
"}",
"instance",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/endpoint/healthcheck/HttpHealthCheckedEndpointGroup.java#L53-L58 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/BeatFinder.java | BeatFinder.deliverMasterYieldResponse | private void deliverMasterYieldResponse(int fromPlayer, boolean yielded) {
for (final MasterHandoffListener listener : getMasterHandoffListeners()) {
try {
listener.yieldResponse(fromPlayer, yielded);
} catch (Throwable t) {
logger.warn("Problem delivering master yield response to listener", t);
}
}
} | java | private void deliverMasterYieldResponse(int fromPlayer, boolean yielded) {
for (final MasterHandoffListener listener : getMasterHandoffListeners()) {
try {
listener.yieldResponse(fromPlayer, yielded);
} catch (Throwable t) {
logger.warn("Problem delivering master yield response to listener", t);
}
}
} | [
"private",
"void",
"deliverMasterYieldResponse",
"(",
"int",
"fromPlayer",
",",
"boolean",
"yielded",
")",
"{",
"for",
"(",
"final",
"MasterHandoffListener",
"listener",
":",
"getMasterHandoffListeners",
"(",
")",
")",
"{",
"try",
"{",
"listener",
".",
"yieldRespo... | Send a master handoff yield response to all registered listeners.
@param fromPlayer the device number that is responding to our request that it yield the tempo master role to us
@param yielded will be {@code true} if we should now be the tempo master | [
"Send",
"a",
"master",
"handoff",
"yield",
"response",
"to",
"all",
"registered",
"listeners",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/BeatFinder.java#L439-L447 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java | JsonUtil.getFloat | public static float getFloat(JsonObject object, String field) {
final JsonValue value = object.get(field);
throwExceptionIfNull(value, field);
return value.asFloat();
} | java | public static float getFloat(JsonObject object, String field) {
final JsonValue value = object.get(field);
throwExceptionIfNull(value, field);
return value.asFloat();
} | [
"public",
"static",
"float",
"getFloat",
"(",
"JsonObject",
"object",
",",
"String",
"field",
")",
"{",
"final",
"JsonValue",
"value",
"=",
"object",
".",
"get",
"(",
"field",
")",
";",
"throwExceptionIfNull",
"(",
"value",
",",
"field",
")",
";",
"return"... | Returns a field in a Json object as a float.
Throws IllegalArgumentException if the field value is null.
@param object the Json Object
@param field the field in the Json object to return
@return the Json field value as a float | [
"Returns",
"a",
"field",
"in",
"a",
"Json",
"object",
"as",
"a",
"float",
".",
"Throws",
"IllegalArgumentException",
"if",
"the",
"field",
"value",
"is",
"null",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L137-L141 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java | JsApiMessageImpl.getJmsUserPropertyMap | final JsMsgMap getJmsUserPropertyMap() {
if (jmsUserPropertyMap == null) {
List<String> keys = (List<String>) getApi().getField(JsApiAccess.JMSPROPERTY_NAME);
List<Object> values = (List<Object>) getApi().getField(JsApiAccess.JMSPROPERTY_VALUE);
jmsUserPropertyMap = new JsMsgMap(keys, values);
}
return jmsUserPropertyMap;
} | java | final JsMsgMap getJmsUserPropertyMap() {
if (jmsUserPropertyMap == null) {
List<String> keys = (List<String>) getApi().getField(JsApiAccess.JMSPROPERTY_NAME);
List<Object> values = (List<Object>) getApi().getField(JsApiAccess.JMSPROPERTY_VALUE);
jmsUserPropertyMap = new JsMsgMap(keys, values);
}
return jmsUserPropertyMap;
} | [
"final",
"JsMsgMap",
"getJmsUserPropertyMap",
"(",
")",
"{",
"if",
"(",
"jmsUserPropertyMap",
"==",
"null",
")",
"{",
"List",
"<",
"String",
">",
"keys",
"=",
"(",
"List",
"<",
"String",
">",
")",
"getApi",
"(",
")",
".",
"getField",
"(",
"JsApiAccess",
... | Helper method used by the main Message Property methods to obtain the
JMS-valid Property items in the form of a map.
<p>
The method has package level visibility as it is used by JsJmsMessageImpl
and JsSdoMessageimpl.
@return A JsMsgMap containing the Message Property name-value pairs. | [
"Helper",
"method",
"used",
"by",
"the",
"main",
"Message",
"Property",
"methods",
"to",
"obtain",
"the",
"JMS",
"-",
"valid",
"Property",
"items",
"in",
"the",
"form",
"of",
"a",
"map",
".",
"<p",
">",
"The",
"method",
"has",
"package",
"level",
"visibi... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L815-L822 |
dvasilen/Hive-XML-SerDe | src/main/java/com/ibm/spss/hive/serde2/xml/processor/java/JavaXmlProcessor.java | JavaXmlProcessor.populateMap | @SuppressWarnings({"unchecked", "rawtypes"})
private void populateMap(Map map, Node node) {
Map.Entry entry = getMapEntry(node);
if (entry != null) {
map.put(entry.getKey(), entry.getValue());
}
} | java | @SuppressWarnings({"unchecked", "rawtypes"})
private void populateMap(Map map, Node node) {
Map.Entry entry = getMapEntry(node);
if (entry != null) {
map.put(entry.getKey(), entry.getValue());
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"private",
"void",
"populateMap",
"(",
"Map",
"map",
",",
"Node",
"node",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"getMapEntry",
"(",
"node",
")",
";",
"if",
"(",
"... | Given the node populates the map
@param map
the map
@param node
the node | [
"Given",
"the",
"node",
"populates",
"the",
"map"
] | train | https://github.com/dvasilen/Hive-XML-SerDe/blob/2a7a184b2cfaeb63008529a9851cd72edb8025d9/src/main/java/com/ibm/spss/hive/serde2/xml/processor/java/JavaXmlProcessor.java#L385-L391 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java | GeneratedDUserDaoImpl.queryByState | public Iterable<DUser> queryByState(java.lang.Integer state) {
return queryByField(null, DUserMapper.Field.STATE.getFieldName(), state);
} | java | public Iterable<DUser> queryByState(java.lang.Integer state) {
return queryByField(null, DUserMapper.Field.STATE.getFieldName(), state);
} | [
"public",
"Iterable",
"<",
"DUser",
">",
"queryByState",
"(",
"java",
".",
"lang",
".",
"Integer",
"state",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DUserMapper",
".",
"Field",
".",
"STATE",
".",
"getFieldName",
"(",
")",
",",
"state",
")",... | query-by method for field state
@param state the specified attribute
@return an Iterable of DUsers for the specified state | [
"query",
"-",
"by",
"method",
"for",
"field",
"state"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L232-L234 |
tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/util/TypeConversionUtil.java | TypeConversionUtil.castToArray | public static <T> Object castToArray(final Class<T> type, final Object val) throws DevFailed {
Object result = null;
final Object array1D = val;
if (val == null || type.isAssignableFrom(val.getClass())) {
result = val;
} else {
LOGGER.debug("converting {} to {}", val.getClass().getCanonicalName(), type.getCanonicalName());
final Class<?> typeConv = Array.newInstance(type, 0).getClass();
final Transmorph transmorph = new Transmorph(creatConv());
try {
result = transmorph.convert(array1D, typeConv);
} catch (final ConverterException e) {
LOGGER.error("convertion error", e);
throw DevFailedUtils.newDevFailed(e);
}
}
return result;
} | java | public static <T> Object castToArray(final Class<T> type, final Object val) throws DevFailed {
Object result = null;
final Object array1D = val;
if (val == null || type.isAssignableFrom(val.getClass())) {
result = val;
} else {
LOGGER.debug("converting {} to {}", val.getClass().getCanonicalName(), type.getCanonicalName());
final Class<?> typeConv = Array.newInstance(type, 0).getClass();
final Transmorph transmorph = new Transmorph(creatConv());
try {
result = transmorph.convert(array1D, typeConv);
} catch (final ConverterException e) {
LOGGER.error("convertion error", e);
throw DevFailedUtils.newDevFailed(e);
}
}
return result;
} | [
"public",
"static",
"<",
"T",
">",
"Object",
"castToArray",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"Object",
"val",
")",
"throws",
"DevFailed",
"{",
"Object",
"result",
"=",
"null",
";",
"final",
"Object",
"array1D",
"=",
"val",
";... | Convert an array of primitives or Objects like double[][] or Double[] into the requested type. 2D array will be
converted to a 1D array
@param <T>
@param type
the componant type
@param val
@return
@throws DevFailed | [
"Convert",
"an",
"array",
"of",
"primitives",
"or",
"Objects",
"like",
"double",
"[]",
"[]",
"or",
"Double",
"[]",
"into",
"the",
"requested",
"type",
".",
"2D",
"array",
"will",
"be",
"converted",
"to",
"a",
"1D",
"array"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/util/TypeConversionUtil.java#L65-L82 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/MultiLineStringSerializer.java | MultiLineStringSerializer.writeShapeSpecificSerialization | @Override
public void writeShapeSpecificSerialization(MultiLineString value, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
jgen.writeFieldName( "type");
jgen.writeString( "MultiLineString");
jgen.writeArrayFieldStart( "coordinates");
// set beanproperty to null since we are not serializing a real property
JsonSerializer<Object> ser = provider.findValueSerializer(Double.class, null);
for (int i = 0; i < value.getNumGeometries(); i++) {
LineString ml = (LineString) value.getGeometryN(i);
jgen.writeStartArray();
for (int j = 0; j < ml.getNumPoints(); j++) {
Point point = ml.getPointN(j);
jgen.writeStartArray();
ser.serialize( point.getX(), jgen, provider);
ser.serialize( point.getY(), jgen, provider);
jgen.writeEndArray();
}
jgen.writeEndArray();
}
jgen.writeEndArray();
} | java | @Override
public void writeShapeSpecificSerialization(MultiLineString value, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
jgen.writeFieldName( "type");
jgen.writeString( "MultiLineString");
jgen.writeArrayFieldStart( "coordinates");
// set beanproperty to null since we are not serializing a real property
JsonSerializer<Object> ser = provider.findValueSerializer(Double.class, null);
for (int i = 0; i < value.getNumGeometries(); i++) {
LineString ml = (LineString) value.getGeometryN(i);
jgen.writeStartArray();
for (int j = 0; j < ml.getNumPoints(); j++) {
Point point = ml.getPointN(j);
jgen.writeStartArray();
ser.serialize( point.getX(), jgen, provider);
ser.serialize( point.getY(), jgen, provider);
jgen.writeEndArray();
}
jgen.writeEndArray();
}
jgen.writeEndArray();
} | [
"@",
"Override",
"public",
"void",
"writeShapeSpecificSerialization",
"(",
"MultiLineString",
"value",
",",
"JsonGenerator",
"jgen",
",",
"SerializerProvider",
"provider",
")",
"throws",
"IOException",
"{",
"jgen",
".",
"writeFieldName",
"(",
"\"type\"",
")",
";",
"... | Method that can be called to ask implementation to serialize values of type this serializer handles.
@param value Value to serialize; can not be null.
@param jgen Generator used to output resulting Json content
@param provider Provider that can be used to get serializers for serializing Objects value contains, if any.
@throws java.io.IOException If serialization failed. | [
"Method",
"that",
"can",
"be",
"called",
"to",
"ask",
"implementation",
"to",
"serialize",
"values",
"of",
"type",
"this",
"serializer",
"handles",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/MultiLineStringSerializer.java#L61-L82 |
alkacon/opencms-core | src/org/opencms/ui/apps/modules/CmsModuleApp.java | CmsModuleApp.openReport | public void openReport(String newState, A_CmsReportThread thread, String label) {
setReport(newState, thread);
m_labels.put(thread, label);
openSubView(newState, true);
} | java | public void openReport(String newState, A_CmsReportThread thread, String label) {
setReport(newState, thread);
m_labels.put(thread, label);
openSubView(newState, true);
} | [
"public",
"void",
"openReport",
"(",
"String",
"newState",
",",
"A_CmsReportThread",
"thread",
",",
"String",
"label",
")",
"{",
"setReport",
"(",
"newState",
",",
"thread",
")",
";",
"m_labels",
".",
"put",
"(",
"thread",
",",
"label",
")",
";",
"openSubV... | Changes to a new sub-view and stores a report to be displayed by that subview.<p<
@param newState the new state
@param thread the report thread which should be displayed in the sub view
@param label the label to display for the report | [
"Changes",
"to",
"a",
"new",
"sub",
"-",
"view",
"and",
"stores",
"a",
"report",
"to",
"be",
"displayed",
"by",
"that",
"subview",
".",
"<p<"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/modules/CmsModuleApp.java#L667-L672 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/ConcurrencyUtil.java | ConcurrencyUtil.setMax | public static <E> void setMax(E obj, AtomicLongFieldUpdater<E> updater, long value) {
for (; ; ) {
long current = updater.get(obj);
if (current >= value) {
return;
}
if (updater.compareAndSet(obj, current, value)) {
return;
}
}
} | java | public static <E> void setMax(E obj, AtomicLongFieldUpdater<E> updater, long value) {
for (; ; ) {
long current = updater.get(obj);
if (current >= value) {
return;
}
if (updater.compareAndSet(obj, current, value)) {
return;
}
}
} | [
"public",
"static",
"<",
"E",
">",
"void",
"setMax",
"(",
"E",
"obj",
",",
"AtomicLongFieldUpdater",
"<",
"E",
">",
"updater",
",",
"long",
"value",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"long",
"current",
"=",
"updater",
".",
"get",
"(",
"obj"... | Atomically sets the max value.
If the current value is larger than the provided value, the call is ignored.
So it will not happen that a smaller value will overwrite a larger value. | [
"Atomically",
"sets",
"the",
"max",
"value",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/ConcurrencyUtil.java#L56-L67 |
paypal/SeLion | client/src/main/java/com/paypal/selion/configuration/ListenerInfo.java | ListenerInfo.getBooleanValFromVMArg | static boolean getBooleanValFromVMArg(String vmArgValue, boolean defaultStateWhenNotDefined) {
String sysProperty = System.getProperty(vmArgValue);
boolean flag = defaultStateWhenNotDefined;
if ((sysProperty != null) && (!sysProperty.isEmpty())) {
flag = Boolean.parseBoolean(sysProperty);
}
return flag;
} | java | static boolean getBooleanValFromVMArg(String vmArgValue, boolean defaultStateWhenNotDefined) {
String sysProperty = System.getProperty(vmArgValue);
boolean flag = defaultStateWhenNotDefined;
if ((sysProperty != null) && (!sysProperty.isEmpty())) {
flag = Boolean.parseBoolean(sysProperty);
}
return flag;
} | [
"static",
"boolean",
"getBooleanValFromVMArg",
"(",
"String",
"vmArgValue",
",",
"boolean",
"defaultStateWhenNotDefined",
")",
"{",
"String",
"sysProperty",
"=",
"System",
".",
"getProperty",
"(",
"vmArgValue",
")",
";",
"boolean",
"flag",
"=",
"defaultStateWhenNotDef... | Returns boolean value of the JVM argument when defined, else returns the {@code defaultStateWhenNotDefined}.
@param vmArgValue
The VM argument name.
@param defaultStateWhenNotDefined
A boolean to indicate default state of the listener. | [
"Returns",
"boolean",
"value",
"of",
"the",
"JVM",
"argument",
"when",
"defined",
"else",
"returns",
"the",
"{",
"@code",
"defaultStateWhenNotDefined",
"}",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/configuration/ListenerInfo.java#L95-L102 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/Scenario3DPortrayal.java | Scenario3DPortrayal.situateDevice | public void situateDevice(Device d, double x, double y, double z) {
devices.setObjectLocation(d, new Double3D(x, y, z));
} | java | public void situateDevice(Device d, double x, double y, double z) {
devices.setObjectLocation(d, new Double3D(x, y, z));
} | [
"public",
"void",
"situateDevice",
"(",
"Device",
"d",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"devices",
".",
"setObjectLocation",
"(",
"d",
",",
"new",
"Double3D",
"(",
"x",
",",
"y",
",",
"z",
")",
")",
";",
"}"
] | To place a device in the simulation
@param d
@param x
@param y
@param z | [
"To",
"place",
"a",
"device",
"in",
"the",
"simulation"
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/Scenario3DPortrayal.java#L181-L183 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WFieldLayoutRenderer.java | WFieldLayoutRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WFieldLayout fieldLayout = (WFieldLayout) component;
XmlStringBuilder xml = renderContext.getWriter();
int labelWidth = fieldLayout.getLabelWidth();
String title = fieldLayout.getTitle();
xml.appendTagOpen("ui:fieldlayout");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", fieldLayout.isHidden(), "true");
xml.appendOptionalAttribute("labelWidth", labelWidth > 0, labelWidth);
xml.appendAttribute("layout", fieldLayout.getLayoutType());
xml.appendOptionalAttribute("title", title);
// Ordered layout
if (fieldLayout.isOrdered()) {
xml.appendAttribute("ordered", fieldLayout.getOrderedOffset());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(fieldLayout, renderContext);
// Paint Fields
paintChildren(fieldLayout, renderContext);
xml.appendEndTag("ui:fieldlayout");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WFieldLayout fieldLayout = (WFieldLayout) component;
XmlStringBuilder xml = renderContext.getWriter();
int labelWidth = fieldLayout.getLabelWidth();
String title = fieldLayout.getTitle();
xml.appendTagOpen("ui:fieldlayout");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", fieldLayout.isHidden(), "true");
xml.appendOptionalAttribute("labelWidth", labelWidth > 0, labelWidth);
xml.appendAttribute("layout", fieldLayout.getLayoutType());
xml.appendOptionalAttribute("title", title);
// Ordered layout
if (fieldLayout.isOrdered()) {
xml.appendAttribute("ordered", fieldLayout.getOrderedOffset());
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(fieldLayout, renderContext);
// Paint Fields
paintChildren(fieldLayout, renderContext);
xml.appendEndTag("ui:fieldlayout");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WFieldLayout",
"fieldLayout",
"=",
"(",
"WFieldLayout",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
... | Paints the given WFieldLayout.
@param component the WFieldLayout to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WFieldLayout",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WFieldLayoutRenderer.java#L23-L51 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.collectNested | public static List collectNested(Iterable self, Closure transform) {
return (List) collectNested(self, new ArrayList(), transform);
} | java | public static List collectNested(Iterable self, Closure transform) {
return (List) collectNested(self, new ArrayList(), transform);
} | [
"public",
"static",
"List",
"collectNested",
"(",
"Iterable",
"self",
",",
"Closure",
"transform",
")",
"{",
"return",
"(",
"List",
")",
"collectNested",
"(",
"self",
",",
"new",
"ArrayList",
"(",
")",
",",
"transform",
")",
";",
"}"
] | Recursively iterates through this Iterable transforming each non-Collection value
into a new value using the closure as a transformer. Returns a potentially nested
list of transformed values.
<pre class="groovyTestCase">
assert [2,[4,6],[8],[]] == [1,[2,3],[4],[]].collectNested { it * 2 }
</pre>
@param self an Iterable
@param transform the closure used to transform each item of the Iterable
@return the resultant list
@since 2.2.0 | [
"Recursively",
"iterates",
"through",
"this",
"Iterable",
"transforming",
"each",
"non",
"-",
"Collection",
"value",
"into",
"a",
"new",
"value",
"using",
"the",
"closure",
"as",
"a",
"transformer",
".",
"Returns",
"a",
"potentially",
"nested",
"list",
"of",
"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3703-L3705 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java | AbstractMySQLQuery.smallResult | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C smallResult() {
return addFlag(Position.AFTER_SELECT, SQL_SMALL_RESULT);
} | java | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C smallResult() {
return addFlag(Position.AFTER_SELECT, SQL_SMALL_RESULT);
} | [
"@",
"WithBridgeMethods",
"(",
"value",
"=",
"MySQLQuery",
".",
"class",
",",
"castRequired",
"=",
"true",
")",
"public",
"C",
"smallResult",
"(",
")",
"{",
"return",
"addFlag",
"(",
"Position",
".",
"AFTER_SELECT",
",",
"SQL_SMALL_RESULT",
")",
";",
"}"
] | For SQL_SMALL_RESULT, MySQL uses fast temporary tables to store the resulting table instead
of using sorting. This should not normally be needed.
@return the current object | [
"For",
"SQL_SMALL_RESULT",
"MySQL",
"uses",
"fast",
"temporary",
"tables",
"to",
"store",
"the",
"resulting",
"table",
"instead",
"of",
"using",
"sorting",
".",
"This",
"should",
"not",
"normally",
"be",
"needed",
"."
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java#L189-L192 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java | HexUtil.encodeColor | public static String encodeColor(Color color, String prefix) {
final StringBuffer builder = new StringBuffer(prefix);
String colorHex;
colorHex = Integer.toHexString(color.getRed());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
colorHex = Integer.toHexString(color.getGreen());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
colorHex = Integer.toHexString(color.getBlue());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
return builder.toString();
} | java | public static String encodeColor(Color color, String prefix) {
final StringBuffer builder = new StringBuffer(prefix);
String colorHex;
colorHex = Integer.toHexString(color.getRed());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
colorHex = Integer.toHexString(color.getGreen());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
colorHex = Integer.toHexString(color.getBlue());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
return builder.toString();
} | [
"public",
"static",
"String",
"encodeColor",
"(",
"Color",
"color",
",",
"String",
"prefix",
")",
"{",
"final",
"StringBuffer",
"builder",
"=",
"new",
"StringBuffer",
"(",
"prefix",
")",
";",
"String",
"colorHex",
";",
"colorHex",
"=",
"Integer",
".",
"toHex... | 将{@link Color}编码为Hex形式
@param color {@link Color}
@param prefix 前缀字符串,可以是#、0x等
@return Hex字符串
@since 3.0.8 | [
"将",
"{",
"@link",
"Color",
"}",
"编码为Hex形式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L222-L241 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/genia/Event.java | Event.setThemes_protein | public void setThemes_protein(int i, Protein v) {
if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_themes_protein == null)
jcasType.jcas.throwFeatMissing("themes_protein", "ch.epfl.bbp.uima.genia.Event");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_themes_protein), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_themes_protein), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setThemes_protein(int i, Protein v) {
if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_themes_protein == null)
jcasType.jcas.throwFeatMissing("themes_protein", "ch.epfl.bbp.uima.genia.Event");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_themes_protein), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_themes_protein), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setThemes_protein",
"(",
"int",
"i",
",",
"Protein",
"v",
")",
"{",
"if",
"(",
"Event_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Event_Type",
")",
"jcasType",
")",
".",
"casFeat_themes_protein",
"==",
"null",
")",
"jcasType",
".",
"jcas",... | indexed setter for themes_protein - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"themes_protein",
"-",
"sets",
"an",
"indexed",
"value",
"-"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/genia/Event.java#L141-L145 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ZoneMeta.java | ZoneMeta.getCustomTimeZone | public static SimpleTimeZone getCustomTimeZone(int offset) {
boolean negative = false;
int tmp = offset;
if (offset < 0) {
negative = true;
tmp = -offset;
}
int hour, min, sec;
if (ASSERT) {
Assert.assrt("millis!=0", tmp % 1000 != 0);
}
tmp /= 1000;
sec = tmp % 60;
tmp /= 60;
min = tmp % 60;
hour = tmp / 60;
// Note: No millisecond part included in TZID for now
String zid = formatCustomID(hour, min, sec, negative);
return new SimpleTimeZone(offset, zid);
} | java | public static SimpleTimeZone getCustomTimeZone(int offset) {
boolean negative = false;
int tmp = offset;
if (offset < 0) {
negative = true;
tmp = -offset;
}
int hour, min, sec;
if (ASSERT) {
Assert.assrt("millis!=0", tmp % 1000 != 0);
}
tmp /= 1000;
sec = tmp % 60;
tmp /= 60;
min = tmp % 60;
hour = tmp / 60;
// Note: No millisecond part included in TZID for now
String zid = formatCustomID(hour, min, sec, negative);
return new SimpleTimeZone(offset, zid);
} | [
"public",
"static",
"SimpleTimeZone",
"getCustomTimeZone",
"(",
"int",
"offset",
")",
"{",
"boolean",
"negative",
"=",
"false",
";",
"int",
"tmp",
"=",
"offset",
";",
"if",
"(",
"offset",
"<",
"0",
")",
"{",
"negative",
"=",
"true",
";",
"tmp",
"=",
"-... | Creates a custom zone for the offset
@param offset GMT offset in milliseconds
@return A custom TimeZone for the offset with normalized time zone id | [
"Creates",
"a",
"custom",
"zone",
"for",
"the",
"offset"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ZoneMeta.java#L775-L798 |
mikepenz/Crossfader | library/src/main/java/com/mikepenz/crossfader/Crossfader.java | Crossfader.setLeftMargin | protected void setLeftMargin(View view, int leftMargin) {
SlidingPaneLayout.LayoutParams lp = (SlidingPaneLayout.LayoutParams) view.getLayoutParams();
lp.leftMargin = leftMargin;
lp.rightMargin = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
lp.setMarginStart(leftMargin);
lp.setMarginEnd(0);
}
view.setLayoutParams(lp);
} | java | protected void setLeftMargin(View view, int leftMargin) {
SlidingPaneLayout.LayoutParams lp = (SlidingPaneLayout.LayoutParams) view.getLayoutParams();
lp.leftMargin = leftMargin;
lp.rightMargin = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
lp.setMarginStart(leftMargin);
lp.setMarginEnd(0);
}
view.setLayoutParams(lp);
} | [
"protected",
"void",
"setLeftMargin",
"(",
"View",
"view",
",",
"int",
"leftMargin",
")",
"{",
"SlidingPaneLayout",
".",
"LayoutParams",
"lp",
"=",
"(",
"SlidingPaneLayout",
".",
"LayoutParams",
")",
"view",
".",
"getLayoutParams",
"(",
")",
";",
"lp",
".",
... | define the left margin of the given view
@param view
@param leftMargin | [
"define",
"the",
"left",
"margin",
"of",
"the",
"given",
"view"
] | train | https://github.com/mikepenz/Crossfader/blob/b2e1ee461bc3bcdd897d83f0fad950663bdc73b4/library/src/main/java/com/mikepenz/crossfader/Crossfader.java#L393-L403 |
operasoftware/operaprestodriver | src/com/opera/core/systems/OperaDesktopDriver.java | OperaDesktopDriver.findWidgetByStringId | public QuickWidget findWidgetByStringId(QuickWidgetType type, int windowId, String stringId) {
String text = desktopUtils.getString(stringId, true);
return findWidgetByText(type, windowId, text);
} | java | public QuickWidget findWidgetByStringId(QuickWidgetType type, int windowId, String stringId) {
String text = desktopUtils.getString(stringId, true);
return findWidgetByText(type, windowId, text);
} | [
"public",
"QuickWidget",
"findWidgetByStringId",
"(",
"QuickWidgetType",
"type",
",",
"int",
"windowId",
",",
"String",
"stringId",
")",
"{",
"String",
"text",
"=",
"desktopUtils",
".",
"getString",
"(",
"stringId",
",",
"true",
")",
";",
"return",
"findWidgetBy... | Finds widget with the text specified by string id in the window with the given id.
@param windowId id of parent window
@param stringId string id of the widget
@return QuickWidget or null if no matching widget found | [
"Finds",
"widget",
"with",
"the",
"text",
"specified",
"by",
"string",
"id",
"in",
"the",
"window",
"with",
"the",
"given",
"id",
"."
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaDesktopDriver.java#L379-L383 |
intellimate/Izou | src/main/java/org/intellimate/izou/security/storage/SecureStorageImpl.java | SecureStorageImpl.createKeyStore | private KeyStore createKeyStore(String fileName, String password) {
File file = new File(fileName);
KeyStore keyStore = null;
try {
keyStore = KeyStore.getInstance("JCEKS");
if (file.exists()) {
keyStore.load(new FileInputStream(file), password.toCharArray());
} else {
keyStore.load(null, null);
keyStore.store(new FileOutputStream(fileName), password.toCharArray());
}
} catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException e) {
logger.error("Unable to create key store", e);
}
return keyStore;
} | java | private KeyStore createKeyStore(String fileName, String password) {
File file = new File(fileName);
KeyStore keyStore = null;
try {
keyStore = KeyStore.getInstance("JCEKS");
if (file.exists()) {
keyStore.load(new FileInputStream(file), password.toCharArray());
} else {
keyStore.load(null, null);
keyStore.store(new FileOutputStream(fileName), password.toCharArray());
}
} catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException e) {
logger.error("Unable to create key store", e);
}
return keyStore;
} | [
"private",
"KeyStore",
"createKeyStore",
"(",
"String",
"fileName",
",",
"String",
"password",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"KeyStore",
"keyStore",
"=",
"null",
";",
"try",
"{",
"keyStore",
"=",
"KeyStore",
".",
... | Creates a new keystore for the izou aes key
@param fileName the path to the keystore
@param password the password to use with the keystore
@return the newly created keystore | [
"Creates",
"a",
"new",
"keystore",
"for",
"the",
"izou",
"aes",
"key"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/storage/SecureStorageImpl.java#L241-L257 |
jmrozanec/cron-utils | src/main/java/com/cronutils/descriptor/DescriptionStrategy.java | DescriptionStrategy.describe | protected String describe(final Between between, final boolean and) {
return bundle.getString(EVERY) + " %s "
+ MessageFormat.format(bundle.getString("between_x_and_y"), nominalValue(between.getFrom()), nominalValue(between.getTo())) + WHITE_SPACE;
} | java | protected String describe(final Between between, final boolean and) {
return bundle.getString(EVERY) + " %s "
+ MessageFormat.format(bundle.getString("between_x_and_y"), nominalValue(between.getFrom()), nominalValue(between.getTo())) + WHITE_SPACE;
} | [
"protected",
"String",
"describe",
"(",
"final",
"Between",
"between",
",",
"final",
"boolean",
"and",
")",
"{",
"return",
"bundle",
".",
"getString",
"(",
"EVERY",
")",
"+",
"\" %s \"",
"+",
"MessageFormat",
".",
"format",
"(",
"bundle",
".",
"getString",
... | Provide a human readable description for Between instance.
@param between - Between
@return human readable description - String | [
"Provide",
"a",
"human",
"readable",
"description",
"for",
"Between",
"instance",
"."
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/DescriptionStrategy.java#L137-L140 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/Stripe.java | Stripe.createTokenSynchronous | public Token createTokenSynchronous(final Card card)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
CardException,
APIException {
return createTokenSynchronous(card, mDefaultPublishableKey);
} | java | public Token createTokenSynchronous(final Card card)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
CardException,
APIException {
return createTokenSynchronous(card, mDefaultPublishableKey);
} | [
"public",
"Token",
"createTokenSynchronous",
"(",
"final",
"Card",
"card",
")",
"throws",
"AuthenticationException",
",",
"InvalidRequestException",
",",
"APIConnectionException",
",",
"CardException",
",",
"APIException",
"{",
"return",
"createTokenSynchronous",
"(",
"ca... | Blocking method to create a {@link Token}. Do not call this on the UI thread or your app
will crash. This method uses the default publishable key for this {@link Stripe} instance.
@param card the {@link Card} to use for this token
@return a {@link Token} that can be used for this card
@throws AuthenticationException failure to properly authenticate yourself (check your key)
@throws InvalidRequestException your request has invalid parameters
@throws APIConnectionException failure to connect to Stripe's API
@throws CardException the card cannot be charged for some reason
@throws APIException any other type of problem (for instance, a temporary issue with
Stripe's servers | [
"Blocking",
"method",
"to",
"create",
"a",
"{",
"@link",
"Token",
"}",
".",
"Do",
"not",
"call",
"this",
"on",
"the",
"UI",
"thread",
"or",
"your",
"app",
"will",
"crash",
".",
"This",
"method",
"uses",
"the",
"default",
"publishable",
"key",
"for",
"t... | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/Stripe.java#L522-L529 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedinstallationTemplate/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedinstallationTemplate.java | ApiOvhDedicatedinstallationTemplate.templateName_GET | public OvhTemplates templateName_GET(String templateName) throws IOException {
String qPath = "/dedicated/installationTemplate/{templateName}";
StringBuilder sb = path(qPath, templateName);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhTemplates.class);
} | java | public OvhTemplates templateName_GET(String templateName) throws IOException {
String qPath = "/dedicated/installationTemplate/{templateName}";
StringBuilder sb = path(qPath, templateName);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhTemplates.class);
} | [
"public",
"OvhTemplates",
"templateName_GET",
"(",
"String",
"templateName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/installationTemplate/{templateName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"templateName",
")",... | Get this object properties
REST: GET /dedicated/installationTemplate/{templateName}
@param templateName [required] This template name | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedinstallationTemplate/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedinstallationTemplate.java#L29-L34 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java | URLRewriterService.registerURLRewriter | public static boolean registerURLRewriter( ServletRequest request, URLRewriter rewriter )
{
ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request );
if ( rewriters == null )
{
rewriters = new ArrayList/*< URLRewriter >*/();
rewriters.add( rewriter );
request.setAttribute( URL_REWRITERS_KEY, rewriters );
}
else
{
return addRewriter( rewriters, rewriter, rewriters.size() );
}
return true;
} | java | public static boolean registerURLRewriter( ServletRequest request, URLRewriter rewriter )
{
ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request );
if ( rewriters == null )
{
rewriters = new ArrayList/*< URLRewriter >*/();
rewriters.add( rewriter );
request.setAttribute( URL_REWRITERS_KEY, rewriters );
}
else
{
return addRewriter( rewriters, rewriter, rewriters.size() );
}
return true;
} | [
"public",
"static",
"boolean",
"registerURLRewriter",
"(",
"ServletRequest",
"request",
",",
"URLRewriter",
"rewriter",
")",
"{",
"ArrayList",
"/*< URLRewriter >*/",
"rewriters",
"=",
"getRewriters",
"(",
"request",
")",
";",
"if",
"(",
"rewriters",
"==",
"null",
... | Register a URLRewriter (add to a list) in the request. It will be added to the end
of a list of URLRewriter objects and will be used if {@link #rewriteURL} is called.
@param request the current ServletRequest.
@param rewriter the URLRewriter to register.
@return <code>false</code> if a URLRewriter has been registered
that does not allow other rewriters. Otherwise, <code>true</code>
if the URLRewriter was added to the chain or already exists in
the chain. | [
"Register",
"a",
"URLRewriter",
"(",
"add",
"to",
"a",
"list",
")",
"in",
"the",
"request",
".",
"It",
"will",
"be",
"added",
"to",
"the",
"end",
"of",
"a",
"list",
"of",
"URLRewriter",
"objects",
"and",
"will",
"be",
"used",
"if",
"{",
"@link",
"#re... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java#L183-L199 |
oehf/ipf-oht-atna | nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomainManager.java | SecurityDomainManager.registerURItoSecurityDomain | public void registerURItoSecurityDomain(URI uri, String name) throws URISyntaxException
{
if (uri == null) throw new IllegalArgumentException("URI parameter cannot be null");
if (! securityDomains.containsKey(name) ) throw new IllegalArgumentException("Security domain "+name+" is not a configured security domain.");
if (uriToSecurityDomain.containsKey(uri)) uriToSecurityDomain.remove(uri);
uriToSecurityDomain.put(formatKey(uri), name);
if (LOGGER.isDebugEnabled())
LOGGER.debug("Security domain "+name+" has been registered for URI "+uri.toString());
} | java | public void registerURItoSecurityDomain(URI uri, String name) throws URISyntaxException
{
if (uri == null) throw new IllegalArgumentException("URI parameter cannot be null");
if (! securityDomains.containsKey(name) ) throw new IllegalArgumentException("Security domain "+name+" is not a configured security domain.");
if (uriToSecurityDomain.containsKey(uri)) uriToSecurityDomain.remove(uri);
uriToSecurityDomain.put(formatKey(uri), name);
if (LOGGER.isDebugEnabled())
LOGGER.debug("Security domain "+name+" has been registered for URI "+uri.toString());
} | [
"public",
"void",
"registerURItoSecurityDomain",
"(",
"URI",
"uri",
",",
"String",
"name",
")",
"throws",
"URISyntaxException",
"{",
"if",
"(",
"uri",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"URI parameter cannot be null\"",
")",
";",
... | Registers the association of the given URI to the named security domain. Registration is only needed when a URI needs to use
a security domain other than the default domain.
<br>If the URI was previously registered with another domain that association is replaced with this new one.
@param uri URI to register, may not be null
@param name of SecurityDomain to associate
@throws URISyntaxException
@throws {@link IllegalArgumentException If the specified domain doesn't exist, or if the URI is null | [
"Registers",
"the",
"association",
"of",
"the",
"given",
"URI",
"to",
"the",
"named",
"security",
"domain",
".",
"Registration",
"is",
"only",
"needed",
"when",
"a",
"URI",
"needs",
"to",
"use",
"a",
"security",
"domain",
"other",
"than",
"the",
"default",
... | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomainManager.java#L117-L125 |
structr/structr | structr-core/src/main/java/org/structr/schema/compiler/ClassFileManager.java | ClassFileManager.getJavaFileForOutput | @Override
public JavaFileObject getJavaFileForOutput(final Location location, final String className, final Kind kind, final FileObject sibling) throws IOException {
JavaClassObject obj = new JavaClassObject(className, kind);
objects.put(className, obj);
return obj;
} | java | @Override
public JavaFileObject getJavaFileForOutput(final Location location, final String className, final Kind kind, final FileObject sibling) throws IOException {
JavaClassObject obj = new JavaClassObject(className, kind);
objects.put(className, obj);
return obj;
} | [
"@",
"Override",
"public",
"JavaFileObject",
"getJavaFileForOutput",
"(",
"final",
"Location",
"location",
",",
"final",
"String",
"className",
",",
"final",
"Kind",
"kind",
",",
"final",
"FileObject",
"sibling",
")",
"throws",
"IOException",
"{",
"JavaClassObject",... | Gives the compiler an instance of the JavaClassObject so that the
compiler can write the byte code into it.
@param location
@param className
@param kind
@param sibling
@return file object
@throws java.io.IOException | [
"Gives",
"the",
"compiler",
"an",
"instance",
"of",
"the",
"JavaClassObject",
"so",
"that",
"the",
"compiler",
"can",
"write",
"the",
"byte",
"code",
"into",
"it",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/compiler/ClassFileManager.java#L91-L99 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeBytes | public void writeBytes(final byte[] array, final int length, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
int i = length < 0 ? array.length - 1 : length - 1;
while (i >= 0) {
this.write(array[i--]);
}
} else {
this.write(array, 0, length < 0 ? array.length : length);
}
} | java | public void writeBytes(final byte[] array, final int length, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
int i = length < 0 ? array.length - 1 : length - 1;
while (i >= 0) {
this.write(array[i--]);
}
} else {
this.write(array, 0, length < 0 ? array.length : length);
}
} | [
"public",
"void",
"writeBytes",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"int",
"length",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"LITTLE_ENDIAN",
")",
"... | Write number of items from byte array into stream
@param array array, must not be null
@param length number of items to be written, if -1 then whole array
@param byteOrder order of bytes, if LITTLE_ENDIAN then array will be reversed
@throws IOException it will be thrown if any transport error
@see JBBPByteOrder#LITTLE_ENDIAN
@since 1.3.0 | [
"Write",
"number",
"of",
"items",
"from",
"byte",
"array",
"into",
"stream"
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L350-L359 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.allocateDataChannel | @SuppressWarnings("unused")
private void allocateDataChannel(int channelType, int channelIndex) {
switch (channelType) {
case NORMALS:
m_normals = ByteBuffer.allocateDirect(
m_numVertices * 3 * SIZEOF_FLOAT);
m_normals.order(ByteOrder.nativeOrder());
break;
case TANGENTS:
m_tangents = ByteBuffer.allocateDirect(
m_numVertices * 3 * SIZEOF_FLOAT);
m_tangents.order(ByteOrder.nativeOrder());
break;
case BITANGENTS:
m_bitangents = ByteBuffer.allocateDirect(
m_numVertices * 3 * SIZEOF_FLOAT);
m_bitangents.order(ByteOrder.nativeOrder());
break;
case COLORSET:
m_colorsets[channelIndex] = ByteBuffer.allocateDirect(
m_numVertices * 4 * SIZEOF_FLOAT);
m_colorsets[channelIndex].order(ByteOrder.nativeOrder());
break;
case TEXCOORDS_1D:
m_numUVComponents[channelIndex] = 1;
m_texcoords[channelIndex] = ByteBuffer.allocateDirect(
m_numVertices * 1 * SIZEOF_FLOAT);
m_texcoords[channelIndex].order(ByteOrder.nativeOrder());
break;
case TEXCOORDS_2D:
m_numUVComponents[channelIndex] = 2;
m_texcoords[channelIndex] = ByteBuffer.allocateDirect(
m_numVertices * 2 * SIZEOF_FLOAT);
m_texcoords[channelIndex].order(ByteOrder.nativeOrder());
break;
case TEXCOORDS_3D:
m_numUVComponents[channelIndex] = 3;
m_texcoords[channelIndex] = ByteBuffer.allocateDirect(
m_numVertices * 3 * SIZEOF_FLOAT);
m_texcoords[channelIndex].order(ByteOrder.nativeOrder());
break;
default:
throw new IllegalArgumentException("unsupported channel type");
}
} | java | @SuppressWarnings("unused")
private void allocateDataChannel(int channelType, int channelIndex) {
switch (channelType) {
case NORMALS:
m_normals = ByteBuffer.allocateDirect(
m_numVertices * 3 * SIZEOF_FLOAT);
m_normals.order(ByteOrder.nativeOrder());
break;
case TANGENTS:
m_tangents = ByteBuffer.allocateDirect(
m_numVertices * 3 * SIZEOF_FLOAT);
m_tangents.order(ByteOrder.nativeOrder());
break;
case BITANGENTS:
m_bitangents = ByteBuffer.allocateDirect(
m_numVertices * 3 * SIZEOF_FLOAT);
m_bitangents.order(ByteOrder.nativeOrder());
break;
case COLORSET:
m_colorsets[channelIndex] = ByteBuffer.allocateDirect(
m_numVertices * 4 * SIZEOF_FLOAT);
m_colorsets[channelIndex].order(ByteOrder.nativeOrder());
break;
case TEXCOORDS_1D:
m_numUVComponents[channelIndex] = 1;
m_texcoords[channelIndex] = ByteBuffer.allocateDirect(
m_numVertices * 1 * SIZEOF_FLOAT);
m_texcoords[channelIndex].order(ByteOrder.nativeOrder());
break;
case TEXCOORDS_2D:
m_numUVComponents[channelIndex] = 2;
m_texcoords[channelIndex] = ByteBuffer.allocateDirect(
m_numVertices * 2 * SIZEOF_FLOAT);
m_texcoords[channelIndex].order(ByteOrder.nativeOrder());
break;
case TEXCOORDS_3D:
m_numUVComponents[channelIndex] = 3;
m_texcoords[channelIndex] = ByteBuffer.allocateDirect(
m_numVertices * 3 * SIZEOF_FLOAT);
m_texcoords[channelIndex].order(ByteOrder.nativeOrder());
break;
default:
throw new IllegalArgumentException("unsupported channel type");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"void",
"allocateDataChannel",
"(",
"int",
"channelType",
",",
"int",
"channelIndex",
")",
"{",
"switch",
"(",
"channelType",
")",
"{",
"case",
"NORMALS",
":",
"m_normals",
"=",
"ByteBuffer",
".",
"al... | This method is used by JNI. Do not call or modify.<p>
Allocates a byte buffer for a vertex data channel
@param channelType the channel type
@param channelIndex sub-index, used for types that can have multiple
channels, such as texture coordinates | [
"This",
"method",
"is",
"used",
"by",
"JNI",
".",
"Do",
"not",
"call",
"or",
"modify",
".",
"<p",
">"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L1302-L1346 |
Gperez88/CalculatorInputView | calculatorInputView/src/main/java/com/gp89developers/calculatorinputview/widget/NumericEditText.java | NumericEditText.setDefaultNumericValue | public void setDefaultNumericValue(double defaultNumericValue, final String defaultNumericFormat) {
mDefaultText = String.format(defaultNumericFormat, defaultNumericValue);
if (hasCustomDecimalSeparator) {
// swap locale decimal separator with custom one for display
mDefaultText = StringUtils.replace(mDefaultText,
String.valueOf(DECIMAL_SEPARATOR), String.valueOf(mDecimalSeparator));
}
setTextInternal(mDefaultText);
} | java | public void setDefaultNumericValue(double defaultNumericValue, final String defaultNumericFormat) {
mDefaultText = String.format(defaultNumericFormat, defaultNumericValue);
if (hasCustomDecimalSeparator) {
// swap locale decimal separator with custom one for display
mDefaultText = StringUtils.replace(mDefaultText,
String.valueOf(DECIMAL_SEPARATOR), String.valueOf(mDecimalSeparator));
}
setTextInternal(mDefaultText);
} | [
"public",
"void",
"setDefaultNumericValue",
"(",
"double",
"defaultNumericValue",
",",
"final",
"String",
"defaultNumericFormat",
")",
"{",
"mDefaultText",
"=",
"String",
".",
"format",
"(",
"defaultNumericFormat",
",",
"defaultNumericValue",
")",
";",
"if",
"(",
"h... | Set default numeric value and how it should be displayed, this value will be used if
{@link #clear} is called
@param defaultNumericValue numeric value
@param defaultNumericFormat display format for numeric value | [
"Set",
"default",
"numeric",
"value",
"and",
"how",
"it",
"should",
"be",
"displayed",
"this",
"value",
"will",
"be",
"used",
"if",
"{",
"@link",
"#clear",
"}",
"is",
"called"
] | train | https://github.com/Gperez88/CalculatorInputView/blob/735029095fbcbd32d25cde65529061903f522a89/calculatorInputView/src/main/java/com/gp89developers/calculatorinputview/widget/NumericEditText.java#L121-L130 |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/ValueWriterLocator.java | ValueWriterLocator.findSerializationType | public final int findSerializationType(Class<?> raw)
{
if (raw == _prevClass) {
return _prevType;
}
if (raw == String.class) {
return SER_STRING;
}
ClassKey k = (_key == null) ? new ClassKey(raw, _features) : _key.with(raw, _features);
int type;
Integer I = _knownSerTypes.get(k);
if (I == null) {
type = _findPOJOSerializationType(raw);
_knownSerTypes.put(new ClassKey(raw, _features), Integer.valueOf(type));
} else {
type = I.intValue();
}
_prevType = type;
_prevClass = raw;
return type;
} | java | public final int findSerializationType(Class<?> raw)
{
if (raw == _prevClass) {
return _prevType;
}
if (raw == String.class) {
return SER_STRING;
}
ClassKey k = (_key == null) ? new ClassKey(raw, _features) : _key.with(raw, _features);
int type;
Integer I = _knownSerTypes.get(k);
if (I == null) {
type = _findPOJOSerializationType(raw);
_knownSerTypes.put(new ClassKey(raw, _features), Integer.valueOf(type));
} else {
type = I.intValue();
}
_prevType = type;
_prevClass = raw;
return type;
} | [
"public",
"final",
"int",
"findSerializationType",
"(",
"Class",
"<",
"?",
">",
"raw",
")",
"{",
"if",
"(",
"raw",
"==",
"_prevClass",
")",
"{",
"return",
"_prevType",
";",
"}",
"if",
"(",
"raw",
"==",
"String",
".",
"class",
")",
"{",
"return",
"SER... | The main lookup method used to find type identifier for
given raw class; including Bean types (if allowed). | [
"The",
"main",
"lookup",
"method",
"used",
"to",
"find",
"type",
"identifier",
"for",
"given",
"raw",
"class",
";",
"including",
"Bean",
"types",
"(",
"if",
"allowed",
")",
"."
] | train | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/ValueWriterLocator.java#L115-L137 |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java | JavaUtils.isAnnotationPresent | public static boolean isAnnotationPresent(final AnnotatedElement annotatedElement, final Class<?> annotationClass) {
return Stream.of(annotatedElement.getAnnotations()).map(Annotation::annotationType).map(Class::getName).anyMatch(n -> n.equals(annotationClass.getName()));
} | java | public static boolean isAnnotationPresent(final AnnotatedElement annotatedElement, final Class<?> annotationClass) {
return Stream.of(annotatedElement.getAnnotations()).map(Annotation::annotationType).map(Class::getName).anyMatch(n -> n.equals(annotationClass.getName()));
} | [
"public",
"static",
"boolean",
"isAnnotationPresent",
"(",
"final",
"AnnotatedElement",
"annotatedElement",
",",
"final",
"Class",
"<",
"?",
">",
"annotationClass",
")",
"{",
"return",
"Stream",
".",
"of",
"(",
"annotatedElement",
".",
"getAnnotations",
"(",
")",
... | Checks if the annotation is present on the annotated element.
<b>Note:</b> This step is necessary due to issues with external class loaders (e.g. Maven).
The classes may not be identical and are therefore compared by FQ class name. | [
"Checks",
"if",
"the",
"annotation",
"is",
"present",
"on",
"the",
"annotated",
"element",
".",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"This",
"step",
"is",
"necessary",
"due",
"to",
"issues",
"with",
"external",
"class",
"loaders",
"(",
"e",
".",... | train | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java#L78-L80 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_spam_ipSpamming_unblock_POST | public OvhSpamIp ip_spam_ipSpamming_unblock_POST(String ip, String ipSpamming) throws IOException {
String qPath = "/ip/{ip}/spam/{ipSpamming}/unblock";
StringBuilder sb = path(qPath, ip, ipSpamming);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhSpamIp.class);
} | java | public OvhSpamIp ip_spam_ipSpamming_unblock_POST(String ip, String ipSpamming) throws IOException {
String qPath = "/ip/{ip}/spam/{ipSpamming}/unblock";
StringBuilder sb = path(qPath, ip, ipSpamming);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhSpamIp.class);
} | [
"public",
"OvhSpamIp",
"ip_spam_ipSpamming_unblock_POST",
"(",
"String",
"ip",
",",
"String",
"ipSpamming",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/spam/{ipSpamming}/unblock\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",... | Release the ip from anti-spam system
REST: POST /ip/{ip}/spam/{ipSpamming}/unblock
@param ip [required]
@param ipSpamming [required] IP address which is sending spam | [
"Release",
"the",
"ip",
"from",
"anti",
"-",
"spam",
"system"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L210-L215 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.