repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java | ObjectArrayList.isSortedFromTo | public boolean isSortedFromTo(int from, int to) {
if (size==0) return true;
checkRangeFromTo(from, to, size);
Object[] theElements = elements;
for (int i=from+1; i<=to; i++ ) {
if (((Comparable)theElements[i]).compareTo((Comparable) theElements[i-1]) < 0) return false;
}
return true;
} | java | public boolean isSortedFromTo(int from, int to) {
if (size==0) return true;
checkRangeFromTo(from, to, size);
Object[] theElements = elements;
for (int i=from+1; i<=to; i++ ) {
if (((Comparable)theElements[i]).compareTo((Comparable) theElements[i-1]) < 0) return false;
}
return true;
} | [
"public",
"boolean",
"isSortedFromTo",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"true",
";",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
")",
";",
"Object",
"[",
"]",
"theElements",
"="... | Determines whether the receiver is sorted ascending, according to the <i>natural ordering</i> of its
elements. All elements in this range must implement the
<tt>Comparable</tt> interface. Furthermore, all elements in this range
must be <i>mutually comparable</i> (that is, <tt>e1.compareTo(e2)</tt>
must not throw a <tt>ClassCastException</tt> for any elements
<tt>e1</tt> and <tt>e2</tt> in the array).<p>
@param from the index of the first element (inclusive) to be sorted.
@param to the index of the last element (inclusive) to be sorted.
@return <tt>true</tt> if the receiver is sorted ascending, <tt>false</tt> otherwise.
@exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>). | [
"Determines",
"whether",
"the",
"receiver",
"is",
"sorted",
"ascending",
"according",
"to",
"the",
"<i",
">",
"natural",
"ordering<",
"/",
"i",
">",
"of",
"its",
"elements",
".",
"All",
"elements",
"in",
"this",
"range",
"must",
"implement",
"the",
"<tt",
... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java#L472-L481 |
rnorth/visible-assertions | src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java | VisibleAssertions.assertNotNull | public static void assertNotNull(String message, Object o) {
if (o != null) {
pass(message);
} else {
fail(message, null);
}
} | java | public static void assertNotNull(String message, Object o) {
if (o != null) {
pass(message);
} else {
fail(message, null);
}
} | [
"public",
"static",
"void",
"assertNotNull",
"(",
"String",
"message",
",",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"pass",
"(",
"message",
")",
";",
"}",
"else",
"{",
"fail",
"(",
"message",
",",
"null",
")",
";",
"}",
"... | Assert that a value is not null.
<p>
If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown.
@param message message to display alongside the assertion outcome
@param o value to test | [
"Assert",
"that",
"a",
"value",
"is",
"not",
"null",
".",
"<p",
">",
"If",
"the",
"assertion",
"passes",
"a",
"green",
"tick",
"will",
"be",
"shown",
".",
"If",
"the",
"assertion",
"fails",
"a",
"red",
"cross",
"will",
"be",
"shown",
"."
] | train | https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L295-L301 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.processChange | protected void processChange(String propertyName, Object oldValue, Object newValue) {
processChange(propertyName, oldValue, newValue, null);
} | java | protected void processChange(String propertyName, Object oldValue, Object newValue) {
processChange(propertyName, oldValue, newValue, null);
} | [
"protected",
"void",
"processChange",
"(",
"String",
"propertyName",
",",
"Object",
"oldValue",
",",
"Object",
"newValue",
")",
"{",
"processChange",
"(",
"propertyName",
",",
"oldValue",
",",
"newValue",
",",
"null",
")",
";",
"}"
] | Processes the change in state to the particular property of this Bean. A PropertyChangeEvent is created
to notify all listeners of the state change. First, VetoableChangeListeners are notified of the pending change
in order to validate the change and veto any undesired change to the specified property. Next, the state change
is effected followed by notification of all PropertyChangeListeners. Finally, a change event is sent to all
ChangeListeners notifying them this Bean has been changed.
This particular implementation uses property-to-field mapping and reflection to change the state of this Bean.
Subclasses are allowed to create a mapping of property names to actual fields of this particular Bean by calling
the mapPropertyNameToFieldName method. However, if no such mapping exists, then the field name is derived from
the name of the specified property. Essentially, the field name is expected to be the same as the property name.
@param propertyName a String value specifying the name of the property on this Bean that is being changed.
@param oldValue an Object containing the old value of the specified property.
@param newValue an Object containing the new value for the specified property.
@throws IllegalPropertyValueException if the property change violates a constraint imposed by one of the
VetoableChangeListeners listening to property change events on this Bean.
@see #processChange(String, Object, Object, org.cp.elements.beans.AbstractBean.StateChangeCallback) | [
"Processes",
"the",
"change",
"in",
"state",
"to",
"the",
"particular",
"property",
"of",
"this",
"Bean",
".",
"A",
"PropertyChangeEvent",
"is",
"created",
"to",
"notify",
"all",
"listeners",
"of",
"the",
"state",
"change",
".",
"First",
"VetoableChangeListeners... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L642-L644 |
cloudendpoints/endpoints-management-java | endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java | PathTemplate.matchFromFullName | @Nullable
public ImmutableMap<String, String> matchFromFullName(String path) {
return match(path, true);
} | java | @Nullable
public ImmutableMap<String, String> matchFromFullName(String path) {
return match(path, true);
} | [
"@",
"Nullable",
"public",
"ImmutableMap",
"<",
"String",
",",
"String",
">",
"matchFromFullName",
"(",
"String",
"path",
")",
"{",
"return",
"match",
"(",
"path",
",",
"true",
")",
";",
"}"
] | Matches the path, where the first segment is interpreted as the host name regardless of whether
it starts with '//' or not. Example: <pre>
assert template("{name=shelves/*}").matchFromFullName("somewhere.io/shelves/s1")
.equals(ImmutableMap.of(HOSTNAME_VAR, "somewhere.io", "name", "shelves/s1"));
</pre> | [
"Matches",
"the",
"path",
"where",
"the",
"first",
"segment",
"is",
"interpreted",
"as",
"the",
"host",
"name",
"regardless",
"of",
"whether",
"it",
"starts",
"with",
"//",
"or",
"not",
".",
"Example",
":",
"<pre",
">",
"assert",
"template",
"(",
"{",
"n... | train | https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java#L459-L462 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | HadoopUtils.deletePath | public static void deletePath(FileSystem fs, Path f, boolean recursive) throws IOException {
if (fs.exists(f) && !fs.delete(f, recursive)) {
throw new IOException("Failed to delete: " + f);
}
} | java | public static void deletePath(FileSystem fs, Path f, boolean recursive) throws IOException {
if (fs.exists(f) && !fs.delete(f, recursive)) {
throw new IOException("Failed to delete: " + f);
}
} | [
"public",
"static",
"void",
"deletePath",
"(",
"FileSystem",
"fs",
",",
"Path",
"f",
",",
"boolean",
"recursive",
")",
"throws",
"IOException",
"{",
"if",
"(",
"fs",
".",
"exists",
"(",
"f",
")",
"&&",
"!",
"fs",
".",
"delete",
"(",
"f",
",",
"recurs... | A wrapper around {@link FileSystem#delete(Path, boolean)} which throws {@link IOException} if the given
{@link Path} exists, and {@link FileSystem#delete(Path, boolean)} returns False. | [
"A",
"wrapper",
"around",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L147-L151 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java | ExpressRouteConnectionsInner.beginDelete | public void beginDelete(String resourceGroupName, String expressRouteGatewayName, String connectionName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String expressRouteGatewayName, String connectionName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"String",
"connectionName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRouteGatewayName",
",",
"connectionName",
... | Deletes a connection to a ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@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 | [
"Deletes",
"a",
"connection",
"to",
"a",
"ExpressRoute",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L440-L442 |
derari/cthul | xml/src/main/java/org/cthul/resolve/RRequest.java | RRequest.expandSystemId | protected String expandSystemId(String baseId, String systemId) {
if (baseId == null || baseId.isEmpty()) return systemId;
if (systemId == null || systemId.isEmpty()) return baseId;
try {
return new URI(baseId).resolve(new URI(systemId)).toASCIIString();
//
// int lastSep = baseId.lastIndexOf('/');
// return baseId.substring(0, lastSep+1) + systemId;
// return baseId.substring(0, lastSep+1) + systemId;
} catch (URISyntaxException ex) {
throw new ResolvingException(toString(), ex);
}
} | java | protected String expandSystemId(String baseId, String systemId) {
if (baseId == null || baseId.isEmpty()) return systemId;
if (systemId == null || systemId.isEmpty()) return baseId;
try {
return new URI(baseId).resolve(new URI(systemId)).toASCIIString();
//
// int lastSep = baseId.lastIndexOf('/');
// return baseId.substring(0, lastSep+1) + systemId;
// return baseId.substring(0, lastSep+1) + systemId;
} catch (URISyntaxException ex) {
throw new ResolvingException(toString(), ex);
}
} | [
"protected",
"String",
"expandSystemId",
"(",
"String",
"baseId",
",",
"String",
"systemId",
")",
"{",
"if",
"(",
"baseId",
"==",
"null",
"||",
"baseId",
".",
"isEmpty",
"(",
")",
")",
"return",
"systemId",
";",
"if",
"(",
"systemId",
"==",
"null",
"||",... | Calculates the schema file location.
@param baseId
@param systemId
@return schema file path | [
"Calculates",
"the",
"schema",
"file",
"location",
"."
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/xml/src/main/java/org/cthul/resolve/RRequest.java#L117-L129 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java | QueryParameters.updateDirection | public QueryParameters updateDirection(String key, Direction direction) {
this.direction.put(processKey(key), direction);
return this;
} | java | public QueryParameters updateDirection(String key, Direction direction) {
this.direction.put(processKey(key), direction);
return this;
} | [
"public",
"QueryParameters",
"updateDirection",
"(",
"String",
"key",
",",
"Direction",
"direction",
")",
"{",
"this",
".",
"direction",
".",
"put",
"(",
"processKey",
"(",
"key",
")",
",",
"direction",
")",
";",
"return",
"this",
";",
"}"
] | Updates direction of specified key
@param key Key
@param direction Direction
@return this instance of QueryParameters | [
"Updates",
"direction",
"of",
"specified",
"key"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java#L301-L305 |
jtrfp/javamod | src/main/java/de/quippy/mp3/decoder/Decoder.java | Decoder.decodeFrame | public Obuffer decodeFrame(Header header, Bitstream stream)
throws DecoderException
{
try
{
if (!initialized)
{
initialize(header);
}
int layer = header.layer();
output.clear_buffer();
FrameDecoder decoder = retrieveDecoder(header, stream, layer);
decoder.decodeFrame();
output.write_buffer(1);
}
catch (RuntimeException ex)
{
// UUPS - this frame seems to be corrupt - let's continue to the next one
}
return output;
} | java | public Obuffer decodeFrame(Header header, Bitstream stream)
throws DecoderException
{
try
{
if (!initialized)
{
initialize(header);
}
int layer = header.layer();
output.clear_buffer();
FrameDecoder decoder = retrieveDecoder(header, stream, layer);
decoder.decodeFrame();
output.write_buffer(1);
}
catch (RuntimeException ex)
{
// UUPS - this frame seems to be corrupt - let's continue to the next one
}
return output;
} | [
"public",
"Obuffer",
"decodeFrame",
"(",
"Header",
"header",
",",
"Bitstream",
"stream",
")",
"throws",
"DecoderException",
"{",
"try",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"initialize",
"(",
"header",
")",
";",
"}",
"int",
"layer",
"=",
"header",... | Decodes one frame from an MPEG audio bitstream.
@param header The header describing the frame to decode.
@param bitstream The bistream that provides the bits for the body of the frame.
@return A SampleBuffer containing the decoded samples. | [
"Decodes",
"one",
"frame",
"from",
"an",
"MPEG",
"audio",
"bitstream",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/Decoder.java#L133-L159 |
op4j/op4j | src/main/java/org/op4j/functions/Call.java | Call.listOf | public static <R> Function<Object,List<R>> listOf(final Type<R> resultType, final String methodName, final Object... optionalParameters) {
return methodForListOf(resultType, methodName, optionalParameters);
} | java | public static <R> Function<Object,List<R>> listOf(final Type<R> resultType, final String methodName, final Object... optionalParameters) {
return methodForListOf(resultType, methodName, optionalParameters);
} | [
"public",
"static",
"<",
"R",
">",
"Function",
"<",
"Object",
",",
"List",
"<",
"R",
">",
">",
"listOf",
"(",
"final",
"Type",
"<",
"R",
">",
"resultType",
",",
"final",
"String",
"methodName",
",",
"final",
"Object",
"...",
"optionalParameters",
")",
... | <p>
Abbreviation for {{@link #methodForListOf(Type, String, Object...)}.
</p>
@since 1.1
@param methodName the name of the method
@param optionalParameters the (optional) parameters of the method.
@return the result of the method execution | [
"<p",
">",
"Abbreviation",
"for",
"{{",
"@link",
"#methodForListOf",
"(",
"Type",
"String",
"Object",
"...",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/Call.java#L644-L646 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.getAbsoluteParent | public static String getAbsoluteParent(String path, int level)
{
int idx = 0;
int len = path.length();
while (level >= 0 && idx < len)
{
idx = path.indexOf('/', idx + 1);
if (idx < 0)
{
idx = len;
}
level--;
}
return level >= 0 ? "" : path.substring(0, idx);
} | java | public static String getAbsoluteParent(String path, int level)
{
int idx = 0;
int len = path.length();
while (level >= 0 && idx < len)
{
idx = path.indexOf('/', idx + 1);
if (idx < 0)
{
idx = len;
}
level--;
}
return level >= 0 ? "" : path.substring(0, idx);
} | [
"public",
"static",
"String",
"getAbsoluteParent",
"(",
"String",
"path",
",",
"int",
"level",
")",
"{",
"int",
"idx",
"=",
"0",
";",
"int",
"len",
"=",
"path",
".",
"length",
"(",
")",
";",
"while",
"(",
"level",
">=",
"0",
"&&",
"idx",
"<",
"len"... | Returns the n<sup>th</sup> absolute parent of the path, where n=level.
<p>
Example:<br>
<code>
Text.getAbsoluteParent("/foo/bar/test", 1) == "/foo/bar"
</code>
@param path
the path of the page
@param level
the level of the parent
@return String absolute parent | [
"Returns",
"the",
"n<sup",
">",
"th<",
"/",
"sup",
">",
"absolute",
"parent",
"of",
"the",
"path",
"where",
"n",
"=",
"level",
".",
"<p",
">",
"Example",
":",
"<br",
">",
"<code",
">",
"Text",
".",
"getAbsoluteParent",
"(",
"/",
"foo",
"/",
"bar",
... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L811-L825 |
mirage-sql/mirage | src/main/java/com/miragesql/miragesql/SqlExecutor.java | SqlExecutor.executeUpdateSql | public int executeUpdateSql(String sql, PropertyDesc[] propDescs, Object entity){
PreparedStatement stmt = null;
ResultSet rs = null;
try {
Connection conn = connectionProvider.getConnection();
if (logger.isDebugEnabled()) {
printSql(sql);
printParameters(propDescs);
}
if(entity != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){
stmt = conn.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS);
} else {
stmt = conn.prepareStatement(sql);
}
setParameters(stmt, propDescs, entity);
int result = stmt.executeUpdate();
// Sets GenerationType.IDENTITY properties value.
if(entity != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){
rs = stmt.getGeneratedKeys();
fillIdentityPrimaryKeys(entity, rs);
}
return result;
} catch(SQLException ex){
throw new SQLRuntimeException(ex);
} finally {
JdbcUtil.close(rs);
JdbcUtil.close(stmt);
}
} | java | public int executeUpdateSql(String sql, PropertyDesc[] propDescs, Object entity){
PreparedStatement stmt = null;
ResultSet rs = null;
try {
Connection conn = connectionProvider.getConnection();
if (logger.isDebugEnabled()) {
printSql(sql);
printParameters(propDescs);
}
if(entity != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){
stmt = conn.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS);
} else {
stmt = conn.prepareStatement(sql);
}
setParameters(stmt, propDescs, entity);
int result = stmt.executeUpdate();
// Sets GenerationType.IDENTITY properties value.
if(entity != null && dialect.supportsGenerationType(GenerationType.IDENTITY)){
rs = stmt.getGeneratedKeys();
fillIdentityPrimaryKeys(entity, rs);
}
return result;
} catch(SQLException ex){
throw new SQLRuntimeException(ex);
} finally {
JdbcUtil.close(rs);
JdbcUtil.close(stmt);
}
} | [
"public",
"int",
"executeUpdateSql",
"(",
"String",
"sql",
",",
"PropertyDesc",
"[",
"]",
"propDescs",
",",
"Object",
"entity",
")",
"{",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"ResultSet",
"rs",
"=",
"null",
";",
"try",
"{",
"Connection",
"conn",
... | Executes an update SQL.
@param sql the update SQL to execute
@param propDescs the array of parameters
@param entity the entity object in insertion, otherwise null
@return the number of updated rows
@throws SQLRuntimeException if a database access error occurs | [
"Executes",
"an",
"update",
"SQL",
"."
] | train | https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/SqlExecutor.java#L274-L309 |
TakahikoKawasaki/nv-bluetooth | src/main/java/com/neovisionaries/bluetooth/ble/advertising/ADPayloadParser.java | ADPayloadParser.registerManufacturerSpecificBuilder | public void registerManufacturerSpecificBuilder(int companyId, ADManufacturerSpecificBuilder builder)
{
if (companyId < 0 || 0xFFFF < companyId)
{
String message = String.format("'companyId' is out of the valid range: %d", companyId);
throw new IllegalArgumentException(message);
}
if (builder == null)
{
return;
}
// Use the company ID as the key for the builder.
Integer key = Integer.valueOf(companyId);
// Get the existing list of builders for the company ID.
List<ADManufacturerSpecificBuilder> builders = mMSBuilders.get(key);
// If no builder has been registered for the company ID yet.
if (builders == null)
{
builders = new ArrayList<ADManufacturerSpecificBuilder>();
mMSBuilders.put(key, builders);
}
// Register the builder at the beginning of the builder list.
builders.add(0, builder);
} | java | public void registerManufacturerSpecificBuilder(int companyId, ADManufacturerSpecificBuilder builder)
{
if (companyId < 0 || 0xFFFF < companyId)
{
String message = String.format("'companyId' is out of the valid range: %d", companyId);
throw new IllegalArgumentException(message);
}
if (builder == null)
{
return;
}
// Use the company ID as the key for the builder.
Integer key = Integer.valueOf(companyId);
// Get the existing list of builders for the company ID.
List<ADManufacturerSpecificBuilder> builders = mMSBuilders.get(key);
// If no builder has been registered for the company ID yet.
if (builders == null)
{
builders = new ArrayList<ADManufacturerSpecificBuilder>();
mMSBuilders.put(key, builders);
}
// Register the builder at the beginning of the builder list.
builders.add(0, builder);
} | [
"public",
"void",
"registerManufacturerSpecificBuilder",
"(",
"int",
"companyId",
",",
"ADManufacturerSpecificBuilder",
"builder",
")",
"{",
"if",
"(",
"companyId",
"<",
"0",
"||",
"0xFFFF",
"<",
"companyId",
")",
"{",
"String",
"message",
"=",
"String",
".",
"f... | Register a builder for the company ID. The given builder is added
at the beginning of the list of the builders for the company ID.
@param companyId
Company ID. The value must be in the range from 0 to 0xFFFF.
@param builder
A builder. | [
"Register",
"a",
"builder",
"for",
"the",
"company",
"ID",
".",
"The",
"given",
"builder",
"is",
"added",
"at",
"the",
"beginning",
"of",
"the",
"list",
"of",
"the",
"builders",
"for",
"the",
"company",
"ID",
"."
] | train | https://github.com/TakahikoKawasaki/nv-bluetooth/blob/ef0099e941cd377571398615ea5e18cfc84cadd3/src/main/java/com/neovisionaries/bluetooth/ble/advertising/ADPayloadParser.java#L193-L221 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getInternalState | @SuppressWarnings("unchecked")
public static <T> T getInternalState(Object object, String fieldName, Class<?> where) {
if (object == null || fieldName == null || fieldName.equals("") || fieldName.startsWith(" ")) {
throw new IllegalArgumentException("object, field name, and \"where\" must not be empty or null.");
}
Field field = null;
try {
field = where.getDeclaredField(fieldName);
field.setAccessible(true);
return (T) field.get(object);
} catch (NoSuchFieldException e) {
throw new FieldNotFoundException("Field '" + fieldName + "' was not found in class " + where.getName()
+ ".");
} catch (Exception e) {
throw new RuntimeException("Internal error: Failed to get field in method getInternalState.", e);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T getInternalState(Object object, String fieldName, Class<?> where) {
if (object == null || fieldName == null || fieldName.equals("") || fieldName.startsWith(" ")) {
throw new IllegalArgumentException("object, field name, and \"where\" must not be empty or null.");
}
Field field = null;
try {
field = where.getDeclaredField(fieldName);
field.setAccessible(true);
return (T) field.get(object);
} catch (NoSuchFieldException e) {
throw new FieldNotFoundException("Field '" + fieldName + "' was not found in class " + where.getName()
+ ".");
} catch (Exception e) {
throw new RuntimeException("Internal error: Failed to get field in method getInternalState.", e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getInternalState",
"(",
"Object",
"object",
",",
"String",
"fieldName",
",",
"Class",
"<",
"?",
">",
"where",
")",
"{",
"if",
"(",
"object",
"==",
"null",
"||",
... | Get the value of a field using reflection. Use this method when you need
to specify in which class the field is declared. This might be useful
when you have mocked the instance you are trying to access. Use this
method to avoid casting.
@param <T> the expected type of the field
@param object the object to modify
@param fieldName the name of the field
@param where which class the field is defined
@return the internal state | [
"Get",
"the",
"value",
"of",
"a",
"field",
"using",
"reflection",
".",
"Use",
"this",
"method",
"when",
"you",
"need",
"to",
"specify",
"in",
"which",
"class",
"the",
"field",
"is",
"declared",
".",
"This",
"might",
"be",
"useful",
"when",
"you",
"have",... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L612-L629 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java | Postconditions.checkPostconditionsL | public static long checkPostconditionsL(
final long value,
final ContractLongConditionType... conditions)
throws PostconditionViolationException
{
final Violations violations = innerCheckAllLong(value, conditions);
if (violations != null) {
throw failed(null, Long.valueOf(value), violations);
}
return value;
} | java | public static long checkPostconditionsL(
final long value,
final ContractLongConditionType... conditions)
throws PostconditionViolationException
{
final Violations violations = innerCheckAllLong(value, conditions);
if (violations != null) {
throw failed(null, Long.valueOf(value), violations);
}
return value;
} | [
"public",
"static",
"long",
"checkPostconditionsL",
"(",
"final",
"long",
"value",
",",
"final",
"ContractLongConditionType",
"...",
"conditions",
")",
"throws",
"PostconditionViolationException",
"{",
"final",
"Violations",
"violations",
"=",
"innerCheckAllLong",
"(",
... | A {@code long} specialized version of {@link #checkPostconditions(Object,
ContractConditionType[])}
@param value The value
@param conditions The conditions the value must obey
@return value
@throws PostconditionViolationException If any of the conditions are false | [
"A",
"{",
"@code",
"long",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkPostconditions",
"(",
"Object",
"ContractConditionType",
"[]",
")",
"}"
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L122-L132 |
mlhartme/sushi | src/main/java/net/oneandone/sushi/fs/file/FileNode.java | FileNode.deleteTree | @Override
public FileNode deleteTree() throws DeleteException, NodeNotFoundException {
if (!exists()) {
throw new NodeNotFoundException(this);
}
try {
doDeleteTree(path);
} catch (IOException e) {
throw new DeleteException(this, e);
}
return this;
} | java | @Override
public FileNode deleteTree() throws DeleteException, NodeNotFoundException {
if (!exists()) {
throw new NodeNotFoundException(this);
}
try {
doDeleteTree(path);
} catch (IOException e) {
throw new DeleteException(this, e);
}
return this;
} | [
"@",
"Override",
"public",
"FileNode",
"deleteTree",
"(",
")",
"throws",
"DeleteException",
",",
"NodeNotFoundException",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"NodeNotFoundException",
"(",
"this",
")",
";",
"}",
"try",
"{",
"d... | Deletes a file or directory. Directories are deleted recursively. Handles Links. | [
"Deletes",
"a",
"file",
"or",
"directory",
".",
"Directories",
"are",
"deleted",
"recursively",
".",
"Handles",
"Links",
"."
] | train | https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/file/FileNode.java#L411-L422 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/MultiLineString.java | MultiLineString.fromLineStrings | public static MultiLineString fromLineStrings(@NonNull List<LineString> lineStrings,
@Nullable BoundingBox bbox) {
List<List<Point>> coordinates = new ArrayList<>(lineStrings.size());
for (LineString lineString : lineStrings) {
coordinates.add(lineString.coordinates());
}
return new MultiLineString(TYPE, bbox, coordinates);
} | java | public static MultiLineString fromLineStrings(@NonNull List<LineString> lineStrings,
@Nullable BoundingBox bbox) {
List<List<Point>> coordinates = new ArrayList<>(lineStrings.size());
for (LineString lineString : lineStrings) {
coordinates.add(lineString.coordinates());
}
return new MultiLineString(TYPE, bbox, coordinates);
} | [
"public",
"static",
"MultiLineString",
"fromLineStrings",
"(",
"@",
"NonNull",
"List",
"<",
"LineString",
">",
"lineStrings",
",",
"@",
"Nullable",
"BoundingBox",
"bbox",
")",
"{",
"List",
"<",
"List",
"<",
"Point",
">>",
"coordinates",
"=",
"new",
"ArrayList"... | Create a new instance of this class by defining a list of {@link LineString} objects and
passing that list in as a parameter in this method. The LineStrings should comply with the
GeoJson specifications described in the documentation. Optionally, pass in an instance of a
{@link BoundingBox} which better describes this MultiLineString.
@param lineStrings a list of LineStrings which make up this MultiLineString
@param bbox optionally include a bbox definition
@return a new instance of this class defined by the values passed inside this static factory
method
@since 3.0.0 | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"defining",
"a",
"list",
"of",
"{",
"@link",
"LineString",
"}",
"objects",
"and",
"passing",
"that",
"list",
"in",
"as",
"a",
"parameter",
"in",
"this",
"method",
".",
"The",
"LineStrings",
"... | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/MultiLineString.java#L111-L118 |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.stringify | public String stringify(JsonNode json) {
try {
return mapper().writerWithDefaultPrettyPrinter().writeValueAsString(json);
} catch (JsonProcessingException e) {
throw new RuntimeException("Cannot stringify the input json node", e);
}
} | java | public String stringify(JsonNode json) {
try {
return mapper().writerWithDefaultPrettyPrinter().writeValueAsString(json);
} catch (JsonProcessingException e) {
throw new RuntimeException("Cannot stringify the input json node", e);
}
} | [
"public",
"String",
"stringify",
"(",
"JsonNode",
"json",
")",
"{",
"try",
"{",
"return",
"mapper",
"(",
")",
".",
"writerWithDefaultPrettyPrinter",
"(",
")",
".",
"writeValueAsString",
"(",
"json",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"e",
... | Converts a JsonNode to its string representation.
This implementation use a `pretty printer`.
@param json the json node
@return the String representation of the given Json Object
@throws java.lang.RuntimeException if the String form cannot be created | [
"Converts",
"a",
"JsonNode",
"to",
"its",
"string",
"representation",
".",
"This",
"implementation",
"use",
"a",
"pretty",
"printer",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L209-L215 |
ZuInnoTe/hadoopcryptoledger | inputformat/src/main/java/org/zuinnote/hadoop/bitcoin/format/common/BitcoinBlockReader.java | BitcoinBlockReader.parseTransactionOutputs | public List<BitcoinTransactionOutput> parseTransactionOutputs(ByteBuffer rawByteBuffer, long noOfTransactionOutputs) {
ArrayList<BitcoinTransactionOutput> currentTransactionOutput = new ArrayList<>((int)(noOfTransactionOutputs));
for (int i=0;i<noOfTransactionOutputs;i++) {
// read value
byte[] currentTransactionOutputValueArray = new byte[8];
rawByteBuffer.get(currentTransactionOutputValueArray);
BigInteger currentTransactionOutputValue = new BigInteger(1,EthereumUtil.reverseByteArray(currentTransactionOutputValueArray));
// read outScript length (Potential Internal Exceed Java Type)
byte[] currentTransactionTxOutScriptLengthVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer);
long currentTransactionTxOutScriptSize=BitcoinUtil.getVarInt(currentTransactionTxOutScriptLengthVarInt);
int currentTransactionTxOutScriptSizeInt=(int)(currentTransactionTxOutScriptSize);
// read outScript
byte[] currentTransactionOutScript=new byte[currentTransactionTxOutScriptSizeInt];
rawByteBuffer.get(currentTransactionOutScript,0,currentTransactionTxOutScriptSizeInt);
currentTransactionOutput.add(new BitcoinTransactionOutput(currentTransactionOutputValue,currentTransactionTxOutScriptLengthVarInt,currentTransactionOutScript));
}
return currentTransactionOutput;
} | java | public List<BitcoinTransactionOutput> parseTransactionOutputs(ByteBuffer rawByteBuffer, long noOfTransactionOutputs) {
ArrayList<BitcoinTransactionOutput> currentTransactionOutput = new ArrayList<>((int)(noOfTransactionOutputs));
for (int i=0;i<noOfTransactionOutputs;i++) {
// read value
byte[] currentTransactionOutputValueArray = new byte[8];
rawByteBuffer.get(currentTransactionOutputValueArray);
BigInteger currentTransactionOutputValue = new BigInteger(1,EthereumUtil.reverseByteArray(currentTransactionOutputValueArray));
// read outScript length (Potential Internal Exceed Java Type)
byte[] currentTransactionTxOutScriptLengthVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer);
long currentTransactionTxOutScriptSize=BitcoinUtil.getVarInt(currentTransactionTxOutScriptLengthVarInt);
int currentTransactionTxOutScriptSizeInt=(int)(currentTransactionTxOutScriptSize);
// read outScript
byte[] currentTransactionOutScript=new byte[currentTransactionTxOutScriptSizeInt];
rawByteBuffer.get(currentTransactionOutScript,0,currentTransactionTxOutScriptSizeInt);
currentTransactionOutput.add(new BitcoinTransactionOutput(currentTransactionOutputValue,currentTransactionTxOutScriptLengthVarInt,currentTransactionOutScript));
}
return currentTransactionOutput;
} | [
"public",
"List",
"<",
"BitcoinTransactionOutput",
">",
"parseTransactionOutputs",
"(",
"ByteBuffer",
"rawByteBuffer",
",",
"long",
"noOfTransactionOutputs",
")",
"{",
"ArrayList",
"<",
"BitcoinTransactionOutput",
">",
"currentTransactionOutput",
"=",
"new",
"ArrayList",
... | /*
Parses the Bitcoin transaction outputs in a byte buffer.
@param rawByteBuffer ByteBuffer from which the transaction outputs have to be parsed
@param noOfTransactionInputs Number of expected transaction outputs
@return Array of transactions | [
"/",
"*",
"Parses",
"the",
"Bitcoin",
"transaction",
"outputs",
"in",
"a",
"byte",
"buffer",
"."
] | train | https://github.com/ZuInnoTe/hadoopcryptoledger/blob/5c9bfb61dd1a82374cd0de8413a7c66391ee4414/inputformat/src/main/java/org/zuinnote/hadoop/bitcoin/format/common/BitcoinBlockReader.java#L406-L424 |
galenframework/galen | galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java | PageSpec.setObjects | public void setObjects(Map<String, Locator> objects) {
this.objects.clear();
if (objects != null) {
this.objects.putAll(objects);
}
} | java | public void setObjects(Map<String, Locator> objects) {
this.objects.clear();
if (objects != null) {
this.objects.putAll(objects);
}
} | [
"public",
"void",
"setObjects",
"(",
"Map",
"<",
"String",
",",
"Locator",
">",
"objects",
")",
"{",
"this",
".",
"objects",
".",
"clear",
"(",
")",
";",
"if",
"(",
"objects",
"!=",
"null",
")",
"{",
"this",
".",
"objects",
".",
"putAll",
"(",
"obj... | Clears current objects list and sets new object list
@param objects | [
"Clears",
"current",
"objects",
"list",
"and",
"sets",
"new",
"object",
"list"
] | train | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L52-L57 |
pushtorefresh/storio | storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/operations/put/PutResult.java | PutResult.newUpdateResult | @NonNull
public static PutResult newUpdateResult(int numberOfRowsUpdated, @NonNull Uri affectedUri) {
return new PutResult(null, numberOfRowsUpdated, affectedUri);
} | java | @NonNull
public static PutResult newUpdateResult(int numberOfRowsUpdated, @NonNull Uri affectedUri) {
return new PutResult(null, numberOfRowsUpdated, affectedUri);
} | [
"@",
"NonNull",
"public",
"static",
"PutResult",
"newUpdateResult",
"(",
"int",
"numberOfRowsUpdated",
",",
"@",
"NonNull",
"Uri",
"affectedUri",
")",
"{",
"return",
"new",
"PutResult",
"(",
"null",
",",
"numberOfRowsUpdated",
",",
"affectedUri",
")",
";",
"}"
] | Creates {@link PutResult} for update.
@param numberOfRowsUpdated number of rows that were updated, must be {@code >= 0}.
@param affectedUri Uri that was affected by update.
@return new {@link PutResult} instance. | [
"Creates",
"{",
"@link",
"PutResult",
"}",
"for",
"update",
"."
] | train | https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/operations/put/PutResult.java#L55-L58 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java | EventServiceSegment.addRegistration | public boolean addRegistration(String topic, Registration registration) {
Collection<Registration> registrations = getRegistrations(topic, true);
if (registrations.add(registration)) {
registrationIdMap.put(registration.getId(), registration);
pingNotifiableEventListener(topic, registration, true);
return true;
}
return false;
} | java | public boolean addRegistration(String topic, Registration registration) {
Collection<Registration> registrations = getRegistrations(topic, true);
if (registrations.add(registration)) {
registrationIdMap.put(registration.getId(), registration);
pingNotifiableEventListener(topic, registration, true);
return true;
}
return false;
} | [
"public",
"boolean",
"addRegistration",
"(",
"String",
"topic",
",",
"Registration",
"registration",
")",
"{",
"Collection",
"<",
"Registration",
">",
"registrations",
"=",
"getRegistrations",
"(",
"topic",
",",
"true",
")",
";",
"if",
"(",
"registrations",
".",... | Adds a registration for the {@code topic} and notifies the listener and service of the listener
registration. Returns if the registration was added. The registration might not be added
if an equal instance is already registered.
@param topic the event topic
@param registration the listener registration
@return if the registration is added | [
"Adds",
"a",
"registration",
"for",
"the",
"{",
"@code",
"topic",
"}",
"and",
"notifies",
"the",
"listener",
"and",
"service",
"of",
"the",
"listener",
"registration",
".",
"Returns",
"if",
"the",
"registration",
"was",
"added",
".",
"The",
"registration",
"... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java#L153-L161 |
landawn/AbacusUtil | src/com/landawn/abacus/util/stream/Stream.java | Stream.parallelConcat | public static <T> Stream<T> parallelConcat(final Collection<? extends Stream<? extends T>> c, final int readThreadNum) {
return parallelConcat(c, readThreadNum, calculateQueueSize(c.size()));
} | java | public static <T> Stream<T> parallelConcat(final Collection<? extends Stream<? extends T>> c, final int readThreadNum) {
return parallelConcat(c, readThreadNum, calculateQueueSize(c.size()));
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"parallelConcat",
"(",
"final",
"Collection",
"<",
"?",
"extends",
"Stream",
"<",
"?",
"extends",
"T",
">",
">",
"c",
",",
"final",
"int",
"readThreadNum",
")",
"{",
"return",
"parallelConcat",
... | Put the stream in try-catch to stop the back-end reading thread if error happens
<br />
<code>
try (Stream<Integer> stream = Stream.parallelConcat(a,b, ...)) {
stream.forEach(N::println);
}
</code>
@param c
@param readThreadNum
@return | [
"Put",
"the",
"stream",
"in",
"try",
"-",
"catch",
"to",
"stop",
"the",
"back",
"-",
"end",
"reading",
"thread",
"if",
"error",
"happens",
"<br",
"/",
">",
"<code",
">",
"try",
"(",
"Stream<Integer",
">",
"stream",
"=",
"Stream",
".",
"parallelConcat",
... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Stream.java#L4255-L4257 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/validate/Schema.java | Schema.performTypeValidation | protected void performTypeValidation(String path, Object type, Object value, List<ValidationResult> results) {
// If type it not defined then skip
if (type == null)
return;
// Perform validation against schema
if (type instanceof Schema) {
Schema schema = (Schema) type;
schema.performValidation(path, value, results);
return;
}
// If value is null then skip
value = ObjectReader.getValue(value);
if (value == null)
return;
String name = path != null ? path : "value";
Class<?> valueType = value.getClass();
// Match types
if (TypeMatcher.matchType(type, valueType))
return;
// Generate type mismatch error
results.add(new ValidationResult(path, ValidationResultType.Error, "TYPE_MISMATCH",
name + " type must be " + type + " but found " + valueType, type, valueType));
} | java | protected void performTypeValidation(String path, Object type, Object value, List<ValidationResult> results) {
// If type it not defined then skip
if (type == null)
return;
// Perform validation against schema
if (type instanceof Schema) {
Schema schema = (Schema) type;
schema.performValidation(path, value, results);
return;
}
// If value is null then skip
value = ObjectReader.getValue(value);
if (value == null)
return;
String name = path != null ? path : "value";
Class<?> valueType = value.getClass();
// Match types
if (TypeMatcher.matchType(type, valueType))
return;
// Generate type mismatch error
results.add(new ValidationResult(path, ValidationResultType.Error, "TYPE_MISMATCH",
name + " type must be " + type + " but found " + valueType, type, valueType));
} | [
"protected",
"void",
"performTypeValidation",
"(",
"String",
"path",
",",
"Object",
"type",
",",
"Object",
"value",
",",
"List",
"<",
"ValidationResult",
">",
"results",
")",
"{",
"// If type it not defined then skip",
"if",
"(",
"type",
"==",
"null",
")",
"retu... | Validates a given value to match specified type. The type can be defined as a
Schema, type, a type name or TypeCode When type is a Schema, it executes
validation recursively against that Schema.
@param path a dot notation path to the value.
@param type a type to match the value type
@param value a value to be validated.
@param results a list with validation results to add new results.
@see #performValidation(String, Object, List) | [
"Validates",
"a",
"given",
"value",
"to",
"match",
"specified",
"type",
".",
"The",
"type",
"can",
"be",
"defined",
"as",
"a",
"Schema",
"type",
"a",
"type",
"name",
"or",
"TypeCode",
"When",
"type",
"is",
"a",
"Schema",
"it",
"executes",
"validation",
"... | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/validate/Schema.java#L162-L189 |
orbisgis/h2gis | h2gis-network/src/main/java/org/h2gis/network/functions/GraphCreator.java | GraphCreator.setEdgeWeight | private void setEdgeWeight(E edge, final double weight) throws SQLException {
if (edge != null && weightColumnIndex != -1) {
edge.setWeight(weight);
}
} | java | private void setEdgeWeight(E edge, final double weight) throws SQLException {
if (edge != null && weightColumnIndex != -1) {
edge.setWeight(weight);
}
} | [
"private",
"void",
"setEdgeWeight",
"(",
"E",
"edge",
",",
"final",
"double",
"weight",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"edge",
"!=",
"null",
"&&",
"weightColumnIndex",
"!=",
"-",
"1",
")",
"{",
"edge",
".",
"setWeight",
"(",
"weight",
")"... | Set this edge's weight to the weight contained in the current row.
@param edge Edge
@throws SQLException If the weight cannot be retrieved | [
"Set",
"this",
"edge",
"s",
"weight",
"to",
"the",
"weight",
"contained",
"in",
"the",
"current",
"row",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-network/src/main/java/org/h2gis/network/functions/GraphCreator.java#L278-L282 |
ical4j/ical4j | src/main/java/net/fortuna/ical4j/transform/recurrence/AbstractDateExpansionRule.java | AbstractDateExpansionRule.getCalendarInstance | protected Calendar getCalendarInstance(final Date date, final boolean lenient) {
Calendar cal = Dates.getCalendarInstance(date);
// A week should have at least 4 days to be considered as such per RFC5545
cal.setMinimalDaysInFirstWeek(4);
cal.setFirstDayOfWeek(calendarWeekStartDay);
cal.setLenient(lenient);
cal.setTime(date);
return cal;
} | java | protected Calendar getCalendarInstance(final Date date, final boolean lenient) {
Calendar cal = Dates.getCalendarInstance(date);
// A week should have at least 4 days to be considered as such per RFC5545
cal.setMinimalDaysInFirstWeek(4);
cal.setFirstDayOfWeek(calendarWeekStartDay);
cal.setLenient(lenient);
cal.setTime(date);
return cal;
} | [
"protected",
"Calendar",
"getCalendarInstance",
"(",
"final",
"Date",
"date",
",",
"final",
"boolean",
"lenient",
")",
"{",
"Calendar",
"cal",
"=",
"Dates",
".",
"getCalendarInstance",
"(",
"date",
")",
";",
"// A week should have at least 4 days to be considered as suc... | Construct a Calendar object and sets the time.
@param date
@param lenient
@return | [
"Construct",
"a",
"Calendar",
"object",
"and",
"sets",
"the",
"time",
"."
] | train | https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/transform/recurrence/AbstractDateExpansionRule.java#L110-L119 |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/traverson/Traverson.java | Traverson.followLink | public Traverson followLink(final String rel,
final Predicate<Link> predicate) {
return followLink(rel, predicate, emptyMap());
} | java | public Traverson followLink(final String rel,
final Predicate<Link> predicate) {
return followLink(rel, predicate, emptyMap());
} | [
"public",
"Traverson",
"followLink",
"(",
"final",
"String",
"rel",
",",
"final",
"Predicate",
"<",
"Link",
">",
"predicate",
")",
"{",
"return",
"followLink",
"(",
"rel",
",",
"predicate",
",",
"emptyMap",
"(",
")",
")",
";",
"}"
] | Follow the first {@link Link} of the current resource that is matching the link-relation type and
the {@link LinkPredicates predicate}.
<p>
Other than {@link #follow(String, Predicate)}, this method will ignore possibly embedded resources
with the same link-relation type. Only if the link is missing, the embedded resource is
used.
</p>
@param rel the link-relation type of the followed link
@param predicate the predicate used to select the link to follow
@return this
@since 2.0.0 | [
"Follow",
"the",
"first",
"{",
"@link",
"Link",
"}",
"of",
"the",
"current",
"resource",
"that",
"is",
"matching",
"the",
"link",
"-",
"relation",
"type",
"and",
"the",
"{",
"@link",
"LinkPredicates",
"predicate",
"}",
".",
"<p",
">",
"Other",
"than",
"{... | train | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/traverson/Traverson.java#L408-L411 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.variableDeclarator | JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc) {
return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc);
} | java | JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc) {
return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc);
} | [
"JCVariableDecl",
"variableDeclarator",
"(",
"JCModifiers",
"mods",
",",
"JCExpression",
"type",
",",
"boolean",
"reqInit",
",",
"Comment",
"dc",
")",
"{",
"return",
"variableDeclaratorRest",
"(",
"token",
".",
"pos",
",",
"mods",
",",
"type",
",",
"ident",
"(... | VariableDeclarator = Ident VariableDeclaratorRest
ConstantDeclarator = Ident ConstantDeclaratorRest | [
"VariableDeclarator",
"=",
"Ident",
"VariableDeclaratorRest",
"ConstantDeclarator",
"=",
"Ident",
"ConstantDeclaratorRest"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3007-L3009 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/localization/MessageInterpolator.java | MessageInterpolator.interpolate | public String interpolate(final String message, final Map<String, ?> vars, boolean recursive,
final MessageResolver messageResolver) {
return parse(message, vars, recursive, messageResolver);
} | java | public String interpolate(final String message, final Map<String, ?> vars, boolean recursive,
final MessageResolver messageResolver) {
return parse(message, vars, recursive, messageResolver);
} | [
"public",
"String",
"interpolate",
"(",
"final",
"String",
"message",
",",
"final",
"Map",
"<",
"String",
",",
"?",
">",
"vars",
",",
"boolean",
"recursive",
",",
"final",
"MessageResolver",
"messageResolver",
")",
"{",
"return",
"parse",
"(",
"message",
","... | メッセージを引数varsで指定した変数で補完する。
<p>{@link MessageResolver}を指定した場合、メッセージ中の変数をメッセージコードとして解決します。
@param message 対象のメッセージ。
@param vars メッセージ中の変数に対する値のマップ。
@param recursive 変換したメッセージに対しても再帰的に処理するかどうか
@param messageResolver メッセージを解決するクラス。nullの場合、指定しないと同じ意味になります。
@return 補完したメッセージ。 | [
"メッセージを引数varsで指定した変数で補完する。",
"<p",
">",
"{",
"@link",
"MessageResolver",
"}",
"を指定した場合、メッセージ中の変数をメッセージコードとして解決します。"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/localization/MessageInterpolator.java#L100-L103 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.pack | public static void pack(File sourceDir, OutputStream os) {
pack(sourceDir, os, IdentityNameMapper.INSTANCE, DEFAULT_COMPRESSION_LEVEL);
} | java | public static void pack(File sourceDir, OutputStream os) {
pack(sourceDir, os, IdentityNameMapper.INSTANCE, DEFAULT_COMPRESSION_LEVEL);
} | [
"public",
"static",
"void",
"pack",
"(",
"File",
"sourceDir",
",",
"OutputStream",
"os",
")",
"{",
"pack",
"(",
"sourceDir",
",",
"os",
",",
"IdentityNameMapper",
".",
"INSTANCE",
",",
"DEFAULT_COMPRESSION_LEVEL",
")",
";",
"}"
] | Compresses the given directory and all of its sub-directories into the passed in
stream. It is the responsibility of the caller to close the passed in
stream properly.
@param sourceDir
root directory.
@param os
output stream (will be buffered in this method).
@since 1.10 | [
"Compresses",
"the",
"given",
"directory",
"and",
"all",
"of",
"its",
"sub",
"-",
"directories",
"into",
"the",
"passed",
"in",
"stream",
".",
"It",
"is",
"the",
"responsibility",
"of",
"the",
"caller",
"to",
"close",
"the",
"passed",
"in",
"stream",
"prop... | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1634-L1636 |
find-sec-bugs/find-sec-bugs | findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/common/InterfaceUtils.java | InterfaceUtils.isSubtype | public static boolean isSubtype(String className, String... superClasses) {
for(String potentialSuperClass : superClasses) {
try {
if(Hierarchy.isSubtype(className, potentialSuperClass)) {
return true;
}
} catch (ClassNotFoundException e) {
AnalysisContext.reportMissingClass(e);
}
}
return false;
} | java | public static boolean isSubtype(String className, String... superClasses) {
for(String potentialSuperClass : superClasses) {
try {
if(Hierarchy.isSubtype(className, potentialSuperClass)) {
return true;
}
} catch (ClassNotFoundException e) {
AnalysisContext.reportMissingClass(e);
}
}
return false;
} | [
"public",
"static",
"boolean",
"isSubtype",
"(",
"String",
"className",
",",
"String",
"...",
"superClasses",
")",
"{",
"for",
"(",
"String",
"potentialSuperClass",
":",
"superClasses",
")",
"{",
"try",
"{",
"if",
"(",
"Hierarchy",
".",
"isSubtype",
"(",
"cl... | Test if the given class is a subtype of ONE of the super classes given.
<br/>
The following test that the class is a subclass of Hashtable.
<pre>
boolean isHashtable = InterfaceUtils.isSubtype( classThatCouldBeAHashTable, "java.util.Hashtable");
</pre>
@param className Class to test
@param superClasses If classes extends or implements those classes
@return | [
"Test",
"if",
"the",
"given",
"class",
"is",
"a",
"subtype",
"of",
"ONE",
"of",
"the",
"super",
"classes",
"given",
".",
"<br",
"/",
">",
"The",
"following",
"test",
"that",
"the",
"class",
"is",
"a",
"subclass",
"of",
"Hashtable",
".",
"<pre",
">",
... | train | https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/common/InterfaceUtils.java#L54-L65 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | ExceptionUtils.getStackFrameList | @GwtIncompatible("incompatible method")
static List<String> getStackFrameList(final Throwable t) {
final String stackTrace = getStackTrace(t);
final String linebreak = System.lineSeparator();
final StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
final List<String> list = new ArrayList<>();
boolean traceStarted = false;
while (frames.hasMoreTokens()) {
final String token = frames.nextToken();
// Determine if the line starts with <whitespace>at
final int at = token.indexOf("at");
if (at != -1 && token.substring(0, at).trim().isEmpty()) {
traceStarted = true;
list.add(token);
} else if (traceStarted) {
break;
}
}
return list;
} | java | @GwtIncompatible("incompatible method")
static List<String> getStackFrameList(final Throwable t) {
final String stackTrace = getStackTrace(t);
final String linebreak = System.lineSeparator();
final StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
final List<String> list = new ArrayList<>();
boolean traceStarted = false;
while (frames.hasMoreTokens()) {
final String token = frames.nextToken();
// Determine if the line starts with <whitespace>at
final int at = token.indexOf("at");
if (at != -1 && token.substring(0, at).trim().isEmpty()) {
traceStarted = true;
list.add(token);
} else if (traceStarted) {
break;
}
}
return list;
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"static",
"List",
"<",
"String",
">",
"getStackFrameList",
"(",
"final",
"Throwable",
"t",
")",
"{",
"final",
"String",
"stackTrace",
"=",
"getStackTrace",
"(",
"t",
")",
";",
"final",
"String",
"lin... | <p>Produces a <code>List</code> of stack frames - the message
is not included. Only the trace of the specified exception is
returned, any caused by trace is stripped.</p>
<p>This works in most cases - it will only fail if the exception
message contains a line that starts with:
<code>" at".</code></p>
@param t is any throwable
@return List of stack frames | [
"<p",
">",
"Produces",
"a",
"<code",
">",
"List<",
"/",
"code",
">",
"of",
"stack",
"frames",
"-",
"the",
"message",
"is",
"not",
"included",
".",
"Only",
"the",
"trace",
"of",
"the",
"specified",
"exception",
"is",
"returned",
"any",
"caused",
"by",
"... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java#L656-L675 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadBitmapOptimized | public static Bitmap loadBitmapOptimized(Uri uri, Context context) throws ImageLoadException {
return loadBitmapOptimized(uri, context, MAX_PIXELS);
} | java | public static Bitmap loadBitmapOptimized(Uri uri, Context context) throws ImageLoadException {
return loadBitmapOptimized(uri, context, MAX_PIXELS);
} | [
"public",
"static",
"Bitmap",
"loadBitmapOptimized",
"(",
"Uri",
"uri",
",",
"Context",
"context",
")",
"throws",
"ImageLoadException",
"{",
"return",
"loadBitmapOptimized",
"(",
"uri",
",",
"context",
",",
"MAX_PIXELS",
")",
";",
"}"
] | Loading bitmap with optimized loaded size less than 1.4 MPX
@param uri content uri for bitmap
@param context Application Context
@return loaded bitmap (always not null)
@throws ImageLoadException if it is unable to load file | [
"Loading",
"bitmap",
"with",
"optimized",
"loaded",
"size",
"less",
"than",
"1",
".",
"4",
"MPX"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L97-L99 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java | StyleUtil.createFill | public static FillInfo createFill(String color, float opacity) {
FillInfo fillInfo = new FillInfo();
if (color != null) {
fillInfo.getCssParameterList().add(createCssParameter("fill", color));
}
fillInfo.getCssParameterList().add(createCssParameter("fill-opacity", opacity));
return fillInfo;
} | java | public static FillInfo createFill(String color, float opacity) {
FillInfo fillInfo = new FillInfo();
if (color != null) {
fillInfo.getCssParameterList().add(createCssParameter("fill", color));
}
fillInfo.getCssParameterList().add(createCssParameter("fill-opacity", opacity));
return fillInfo;
} | [
"public",
"static",
"FillInfo",
"createFill",
"(",
"String",
"color",
",",
"float",
"opacity",
")",
"{",
"FillInfo",
"fillInfo",
"=",
"new",
"FillInfo",
"(",
")",
";",
"if",
"(",
"color",
"!=",
"null",
")",
"{",
"fillInfo",
".",
"getCssParameterList",
"(",... | Creates a fill with the specified CSS parameters.
@param color the color
@param opacity the opacity
@return the fill | [
"Creates",
"a",
"fill",
"with",
"the",
"specified",
"CSS",
"parameters",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L227-L234 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/Slice.java | Slice.setByte | public void setByte(int index, int value)
{
checkPositionIndexes(index, index + SIZE_OF_BYTE, this.length);
index += offset;
data[index] = (byte) value;
} | java | public void setByte(int index, int value)
{
checkPositionIndexes(index, index + SIZE_OF_BYTE, this.length);
index += offset;
data[index] = (byte) value;
} | [
"public",
"void",
"setByte",
"(",
"int",
"index",
",",
"int",
"value",
")",
"{",
"checkPositionIndexes",
"(",
"index",
",",
"index",
"+",
"SIZE_OF_BYTE",
",",
"this",
".",
"length",
")",
";",
"index",
"+=",
"offset",
";",
"data",
"[",
"index",
"]",
"="... | Sets the specified byte at the specified absolute {@code index} in this
buffer. The 24 high-order bits of the specified value are ignored.
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
{@code index + 1} is greater than {@code this.capacity} | [
"Sets",
"the",
"specified",
"byte",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"in",
"this",
"buffer",
".",
"The",
"24",
"high",
"-",
"order",
"bits",
"of",
"the",
"specified",
"value",
"are",
"ignored",
"."
] | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L347-L352 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java | FileOperations.deleteFileFromTask | public void deleteFileFromTask(String jobId, String taskId, String fileName, Boolean recursive, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
FileDeleteFromTaskOptions options = new FileDeleteFromTaskOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().files().deleteFromTask(jobId, taskId, fileName, recursive, options);
} | java | public void deleteFileFromTask(String jobId, String taskId, String fileName, Boolean recursive, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
FileDeleteFromTaskOptions options = new FileDeleteFromTaskOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().files().deleteFromTask(jobId, taskId, fileName, recursive, options);
} | [
"public",
"void",
"deleteFileFromTask",
"(",
"String",
"jobId",
",",
"String",
"taskId",
",",
"String",
"fileName",
",",
"Boolean",
"recursive",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOEx... | Deletes the specified file from the specified task's directory on its compute node.
@param jobId The ID of the job containing the task.
@param taskId The ID of the task.
@param fileName The name of the file to delete.
@param recursive If the file-path parameter represents a directory instead of a file, you can set the recursive parameter to true to delete the directory and all of the files and subdirectories in it. If recursive is false or null, then the directory must be empty or deletion will fail.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Deletes",
"the",
"specified",
"file",
"from",
"the",
"specified",
"task",
"s",
"directory",
"on",
"its",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L200-L206 |
groupon/odo | client/src/main/java/com/groupon/odo/client/PathValueClient.java | PathValueClient.removeCustomResponse | public boolean removeCustomResponse(String pathValue, String requestType) {
try {
JSONObject path = getPathFromEndpoint(pathValue, requestType);
if (path == null) {
return false;
}
String pathId = path.getString("pathId");
return resetResponseOverride(pathId);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | java | public boolean removeCustomResponse(String pathValue, String requestType) {
try {
JSONObject path = getPathFromEndpoint(pathValue, requestType);
if (path == null) {
return false;
}
String pathId = path.getString("pathId");
return resetResponseOverride(pathId);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | [
"public",
"boolean",
"removeCustomResponse",
"(",
"String",
"pathValue",
",",
"String",
"requestType",
")",
"{",
"try",
"{",
"JSONObject",
"path",
"=",
"getPathFromEndpoint",
"(",
"pathValue",
",",
"requestType",
")",
";",
"if",
"(",
"path",
"==",
"null",
")",... | Remove any overrides for an endpoint
@param pathValue path (endpoint) value
@param requestType path request type. "GET", "POST", etc
@return true if success, false otherwise | [
"Remove",
"any",
"overrides",
"for",
"an",
"endpoint"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/PathValueClient.java#L103-L115 |
grails/grails-core | grails-core/src/main/groovy/org/grails/spring/context/support/PluginAwareResourceBundleMessageSource.java | PluginAwareResourceBundleMessageSource.resolveCodeWithoutArgumentsFromPlugins | protected String resolveCodeWithoutArgumentsFromPlugins(String code, Locale locale) {
if (pluginCacheMillis < 0) {
PropertiesHolder propHolder = getMergedPluginProperties(locale);
String result = propHolder.getProperty(code);
if (result != null) {
return result;
}
}
else {
String result = findCodeInBinaryPlugins(code, locale);
if (result != null) return result;
}
return null;
} | java | protected String resolveCodeWithoutArgumentsFromPlugins(String code, Locale locale) {
if (pluginCacheMillis < 0) {
PropertiesHolder propHolder = getMergedPluginProperties(locale);
String result = propHolder.getProperty(code);
if (result != null) {
return result;
}
}
else {
String result = findCodeInBinaryPlugins(code, locale);
if (result != null) return result;
}
return null;
} | [
"protected",
"String",
"resolveCodeWithoutArgumentsFromPlugins",
"(",
"String",
"code",
",",
"Locale",
"locale",
")",
"{",
"if",
"(",
"pluginCacheMillis",
"<",
"0",
")",
"{",
"PropertiesHolder",
"propHolder",
"=",
"getMergedPluginProperties",
"(",
"locale",
")",
";"... | Attempts to resolve a String for the code from the list of plugin base names
@param code The code
@param locale The locale
@return a MessageFormat | [
"Attempts",
"to",
"resolve",
"a",
"String",
"for",
"the",
"code",
"from",
"the",
"list",
"of",
"plugin",
"base",
"names"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/spring/context/support/PluginAwareResourceBundleMessageSource.java#L195-L209 |
PuyallupFoursquare/ccb-api-client-java | src/main/java/com/p4square/ccbapi/serializer/FormBuilder.java | FormBuilder.appendField | public void appendField(final String key, final String value) {
if (builder.length() > 0) {
builder.append("&");
}
try {
builder.append(key).append("=").append(URLEncoder.encode(value, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new AssertionError("UTF-8 encoding should always be available.");
}
} | java | public void appendField(final String key, final String value) {
if (builder.length() > 0) {
builder.append("&");
}
try {
builder.append(key).append("=").append(URLEncoder.encode(value, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new AssertionError("UTF-8 encoding should always be available.");
}
} | [
"public",
"void",
"appendField",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"builder",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"builder",
".",
"append",
"(",
"\"&\"",
")",
";",
"}",
"try",
"{",
"builde... | Append a field to the form.
@param key The form key, which must be URLEncoded before calling this method.
@param value The value associated with the key. The value will be URLEncoded by this method. | [
"Append",
"a",
"field",
"to",
"the",
"form",
"."
] | train | https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/serializer/FormBuilder.java#L61-L71 |
javalite/activejdbc | javalite-common/src/main/java/org/javalite/common/Convert.java | Convert.toInteger | public static Integer toInteger(Object value) {
if (value == null) {
return null;
} else if (value instanceof Integer) {
return (Integer) value;
} else if (value instanceof Number) {
return ((Number) value).intValue();
} else {
try {
return Integer.valueOf(value.toString().trim());
} catch (NumberFormatException e) {
throw new ConversionException("failed to convert: '" + value + "' to Integer", e);
}
}
} | java | public static Integer toInteger(Object value) {
if (value == null) {
return null;
} else if (value instanceof Integer) {
return (Integer) value;
} else if (value instanceof Number) {
return ((Number) value).intValue();
} else {
try {
return Integer.valueOf(value.toString().trim());
} catch (NumberFormatException e) {
throw new ConversionException("failed to convert: '" + value + "' to Integer", e);
}
}
} | [
"public",
"static",
"Integer",
"toInteger",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Integer",
")",
"{",
"return",
"(",
"Integer",
")",
"value",... | Converts value to Integer if it can. If value is a Integer, it is returned, if it is a Number, it is
promoted to Integer and then returned, in all other cases, it converts the value to String,
then tries to parse Integer from it.
@param value value to be converted to Integer.
@return value converted to Integer. | [
"Converts",
"value",
"to",
"Integer",
"if",
"it",
"can",
".",
"If",
"value",
"is",
"a",
"Integer",
"it",
"is",
"returned",
"if",
"it",
"is",
"a",
"Number",
"it",
"is",
"promoted",
"to",
"Integer",
"and",
"then",
"returned",
"in",
"all",
"other",
"cases... | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L373-L387 |
jglobus/JGlobus | axis/src/main/java/org/globus/axis/transport/HTTPUtils.java | HTTPUtils.setCloseConnection | public static void setCloseConnection(Stub stub, boolean close) {
Hashtable headers = getRequestHeaders(stub);
if (close) {
headers.put(HTTPConstants.HEADER_CONNECTION,
HTTPConstants.HEADER_CONNECTION_CLOSE);
} else {
headers.remove(HTTPConstants.HEADER_CONNECTION);
}
} | java | public static void setCloseConnection(Stub stub, boolean close) {
Hashtable headers = getRequestHeaders(stub);
if (close) {
headers.put(HTTPConstants.HEADER_CONNECTION,
HTTPConstants.HEADER_CONNECTION_CLOSE);
} else {
headers.remove(HTTPConstants.HEADER_CONNECTION);
}
} | [
"public",
"static",
"void",
"setCloseConnection",
"(",
"Stub",
"stub",
",",
"boolean",
"close",
")",
"{",
"Hashtable",
"headers",
"=",
"getRequestHeaders",
"(",
"stub",
")",
";",
"if",
"(",
"close",
")",
"{",
"headers",
".",
"put",
"(",
"HTTPConstants",
".... | Sets on option on the stub to close the connection
after receiving the reply (connection will not
be reused).
@param stub The stub to set the property on
@param close If true, connection close will be requested. Otherwise
connection close will not be requested. | [
"Sets",
"on",
"option",
"on",
"the",
"stub",
"to",
"close",
"the",
"connection",
"after",
"receiving",
"the",
"reply",
"(",
"connection",
"will",
"not",
"be",
"reused",
")",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/axis/src/main/java/org/globus/axis/transport/HTTPUtils.java#L51-L59 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.fundamentalToEssential | public static DMatrixRMaj fundamentalToEssential( DMatrixRMaj F , DMatrixRMaj K , @Nullable DMatrixRMaj outputE ) {
if( outputE == null )
outputE = new DMatrixRMaj(3,3);
PerspectiveOps.multTranA(K,F,K,outputE);
// this is unlikely to be a perfect essential matrix. reduce the error by enforcing essential constraints
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(true,true,false);
svd.decompose(outputE);
DMatrixRMaj U = svd.getU(null,false);
DMatrixRMaj W = svd.getW(null);
DMatrixRMaj V = svd.getV(null,false);
// settings value of singular values to be [1,1,0]. The first two singular values just need to be equal
// for it to be an essential matrix
SingularOps_DDRM.descendingOrder(U,false,W,V,false);
W.set(0,0,1);
W.set(1,1,1);
W.set(2,2,0);
PerspectiveOps.multTranC(U,W,V,outputE);
return outputE;
} | java | public static DMatrixRMaj fundamentalToEssential( DMatrixRMaj F , DMatrixRMaj K , @Nullable DMatrixRMaj outputE ) {
if( outputE == null )
outputE = new DMatrixRMaj(3,3);
PerspectiveOps.multTranA(K,F,K,outputE);
// this is unlikely to be a perfect essential matrix. reduce the error by enforcing essential constraints
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(true,true,false);
svd.decompose(outputE);
DMatrixRMaj U = svd.getU(null,false);
DMatrixRMaj W = svd.getW(null);
DMatrixRMaj V = svd.getV(null,false);
// settings value of singular values to be [1,1,0]. The first two singular values just need to be equal
// for it to be an essential matrix
SingularOps_DDRM.descendingOrder(U,false,W,V,false);
W.set(0,0,1);
W.set(1,1,1);
W.set(2,2,0);
PerspectiveOps.multTranC(U,W,V,outputE);
return outputE;
} | [
"public",
"static",
"DMatrixRMaj",
"fundamentalToEssential",
"(",
"DMatrixRMaj",
"F",
",",
"DMatrixRMaj",
"K",
",",
"@",
"Nullable",
"DMatrixRMaj",
"outputE",
")",
"{",
"if",
"(",
"outputE",
"==",
"null",
")",
"outputE",
"=",
"new",
"DMatrixRMaj",
"(",
"3",
... | Given the calibration matrix, convert the fundamental matrix into an essential matrix. E = K'*F*k. The
singular values of the resulting E matrix are forced to be [1,1,0]
@param F (Input) Fundamental matrix. 3x3
@param K (Input) Calibration matrix (3x3)
@param outputE (Output) Found essential matrix
@return Essential matrix | [
"Given",
"the",
"calibration",
"matrix",
"convert",
"the",
"fundamental",
"matrix",
"into",
"an",
"essential",
"matrix",
".",
"E",
"=",
"K",
"*",
"F",
"*",
"k",
".",
"The",
"singular",
"values",
"of",
"the",
"resulting",
"E",
"matrix",
"are",
"forced",
"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L946-L970 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/connectionmanager/ConnectionManagerFactory.java | ConnectionManagerFactory.createConnectionManager | public static ConnectionManager createConnectionManager(TransactionSupportEnum tse,
ManagedConnectionFactory mcf,
CachedConnectionManager ccm,
ConnectionManagerConfiguration cmc,
TransactionIntegration ti)
{
if (tse == TransactionSupportEnum.NoTransaction)
{
return new NoTransactionConnectionManager(mcf, ccm, cmc);
}
else if (tse == TransactionSupportEnum.LocalTransaction)
{
return new LocalTransactionConnectionManager(mcf, ccm, cmc, ti);
}
else
{
return new XATransactionConnectionManager(mcf, ccm, cmc, ti);
}
} | java | public static ConnectionManager createConnectionManager(TransactionSupportEnum tse,
ManagedConnectionFactory mcf,
CachedConnectionManager ccm,
ConnectionManagerConfiguration cmc,
TransactionIntegration ti)
{
if (tse == TransactionSupportEnum.NoTransaction)
{
return new NoTransactionConnectionManager(mcf, ccm, cmc);
}
else if (tse == TransactionSupportEnum.LocalTransaction)
{
return new LocalTransactionConnectionManager(mcf, ccm, cmc, ti);
}
else
{
return new XATransactionConnectionManager(mcf, ccm, cmc, ti);
}
} | [
"public",
"static",
"ConnectionManager",
"createConnectionManager",
"(",
"TransactionSupportEnum",
"tse",
",",
"ManagedConnectionFactory",
"mcf",
",",
"CachedConnectionManager",
"ccm",
",",
"ConnectionManagerConfiguration",
"cmc",
",",
"TransactionIntegration",
"ti",
")",
"{"... | Create a connection manager
@param tse The transaction support level
@param mcf The managed connection factory
@param ccm The cached connection manager
@param cmc The connection manager configuration
@param ti The transaction integration
@return The connection manager | [
"Create",
"a",
"connection",
"manager"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/ConnectionManagerFactory.java#L53-L71 |
jblas-project/jblas | src/main/java/org/jblas/util/SanityChecks.java | SanityChecks.checkEigenvalues | public static void checkEigenvalues() {
DoubleMatrix A = new DoubleMatrix(new double[][]{
{3.0, 2.0, 0.0},
{2.0, 3.0, 2.0},
{0.0, 2.0, 3.0}
});
DoubleMatrix E = new DoubleMatrix(3, 1);
NativeBlas.dsyev('N', 'U', 3, A.data, 0, 3, E.data, 0);
check("checking existence of dsyev...", true);
} | java | public static void checkEigenvalues() {
DoubleMatrix A = new DoubleMatrix(new double[][]{
{3.0, 2.0, 0.0},
{2.0, 3.0, 2.0},
{0.0, 2.0, 3.0}
});
DoubleMatrix E = new DoubleMatrix(3, 1);
NativeBlas.dsyev('N', 'U', 3, A.data, 0, 3, E.data, 0);
check("checking existence of dsyev...", true);
} | [
"public",
"static",
"void",
"checkEigenvalues",
"(",
")",
"{",
"DoubleMatrix",
"A",
"=",
"new",
"DoubleMatrix",
"(",
"new",
"double",
"[",
"]",
"[",
"]",
"{",
"{",
"3.0",
",",
"2.0",
",",
"0.0",
"}",
",",
"{",
"2.0",
",",
"3.0",
",",
"2.0",
"}",
... | Compute eigenvalues. This is a routine not in ATLAS, but in the original
LAPACK. | [
"Compute",
"eigenvalues",
".",
"This",
"is",
"a",
"routine",
"not",
"in",
"ATLAS",
"but",
"in",
"the",
"original",
"LAPACK",
"."
] | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/SanityChecks.java#L115-L126 |
Jasig/uPortal | uPortal-web/src/main/java/org/apereo/portal/url/PortalUrlProviderImpl.java | PortalUrlProviderImpl.verifyPortletWindowId | protected String verifyPortletWindowId(
HttpServletRequest request, IPortletWindowId portletWindowId) {
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
final IPortletWindow portletWindow =
this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
final IPortletWindowId delegationParentWindowId = portletWindow.getDelegationParentId();
if (delegationParentWindowId != null) {
return verifyPortletWindowId(request, delegationParentWindowId);
}
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
final String channelSubscribeId = portletEntity.getLayoutNodeId();
final IUserLayoutNodeDescription node = userLayoutManager.getNode(channelSubscribeId);
if (node == null) {
throw new IllegalArgumentException(
"No layout node exists for id "
+ channelSubscribeId
+ " of window "
+ portletWindowId);
}
return node.getId();
} | java | protected String verifyPortletWindowId(
HttpServletRequest request, IPortletWindowId portletWindowId) {
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
final IPortletWindow portletWindow =
this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
final IPortletWindowId delegationParentWindowId = portletWindow.getDelegationParentId();
if (delegationParentWindowId != null) {
return verifyPortletWindowId(request, delegationParentWindowId);
}
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
final String channelSubscribeId = portletEntity.getLayoutNodeId();
final IUserLayoutNodeDescription node = userLayoutManager.getNode(channelSubscribeId);
if (node == null) {
throw new IllegalArgumentException(
"No layout node exists for id "
+ channelSubscribeId
+ " of window "
+ portletWindowId);
}
return node.getId();
} | [
"protected",
"String",
"verifyPortletWindowId",
"(",
"HttpServletRequest",
"request",
",",
"IPortletWindowId",
"portletWindowId",
")",
"{",
"final",
"IUserInstance",
"userInstance",
"=",
"this",
".",
"userInstanceManager",
".",
"getUserInstance",
"(",
"request",
")",
";... | Verify the requested portlet window corresponds to a node in the user's layout and return the
corresponding layout node id | [
"Verify",
"the",
"requested",
"portlet",
"window",
"corresponds",
"to",
"a",
"node",
"in",
"the",
"user",
"s",
"layout",
"and",
"return",
"the",
"corresponding",
"layout",
"node",
"id"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-web/src/main/java/org/apereo/portal/url/PortalUrlProviderImpl.java#L216-L241 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java | SlotManager.removeSlotRequestFromSlot | private void removeSlotRequestFromSlot(SlotID slotId, AllocationID allocationId) {
TaskManagerSlot taskManagerSlot = slots.get(slotId);
if (null != taskManagerSlot) {
if (taskManagerSlot.getState() == TaskManagerSlot.State.PENDING && Objects.equals(allocationId, taskManagerSlot.getAssignedSlotRequest().getAllocationId())) {
TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.get(taskManagerSlot.getInstanceId());
if (taskManagerRegistration == null) {
throw new IllegalStateException("Trying to remove slot request from slot for which there is no TaskManager " + taskManagerSlot.getInstanceId() + " is registered.");
}
// clear the pending slot request
taskManagerSlot.clearPendingSlotRequest();
updateSlotState(taskManagerSlot, taskManagerRegistration, null, null);
} else {
LOG.debug("Ignore slot request removal for slot {}.", slotId);
}
} else {
LOG.debug("There was no slot with {} registered. Probably this slot has been already freed.", slotId);
}
} | java | private void removeSlotRequestFromSlot(SlotID slotId, AllocationID allocationId) {
TaskManagerSlot taskManagerSlot = slots.get(slotId);
if (null != taskManagerSlot) {
if (taskManagerSlot.getState() == TaskManagerSlot.State.PENDING && Objects.equals(allocationId, taskManagerSlot.getAssignedSlotRequest().getAllocationId())) {
TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.get(taskManagerSlot.getInstanceId());
if (taskManagerRegistration == null) {
throw new IllegalStateException("Trying to remove slot request from slot for which there is no TaskManager " + taskManagerSlot.getInstanceId() + " is registered.");
}
// clear the pending slot request
taskManagerSlot.clearPendingSlotRequest();
updateSlotState(taskManagerSlot, taskManagerRegistration, null, null);
} else {
LOG.debug("Ignore slot request removal for slot {}.", slotId);
}
} else {
LOG.debug("There was no slot with {} registered. Probably this slot has been already freed.", slotId);
}
} | [
"private",
"void",
"removeSlotRequestFromSlot",
"(",
"SlotID",
"slotId",
",",
"AllocationID",
"allocationId",
")",
"{",
"TaskManagerSlot",
"taskManagerSlot",
"=",
"slots",
".",
"get",
"(",
"slotId",
")",
";",
"if",
"(",
"null",
"!=",
"taskManagerSlot",
")",
"{",... | Removes a pending slot request identified by the given allocation id from a slot identified
by the given slot id.
@param slotId identifying the slot
@param allocationId identifying the presumable assigned pending slot request | [
"Removes",
"a",
"pending",
"slot",
"request",
"identified",
"by",
"the",
"given",
"allocation",
"id",
"from",
"a",
"slot",
"identified",
"by",
"the",
"given",
"slot",
"id",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L917-L939 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/storage/StorageFacade.java | StorageFacade.registerProvider | public static void registerProvider( String providerName, Class<? extends StorageProvider> providerClass )
{
if ( PROVIDERS.containsKey( providerName ) ) {
throw new IllegalArgumentException( "A provider already exists with the name " + providerName );
}
PROVIDERS.put( providerName, providerClass );
LOGGER.debug( "Registering new provider: {}", providerClass.getSimpleName() );
} | java | public static void registerProvider( String providerName, Class<? extends StorageProvider> providerClass )
{
if ( PROVIDERS.containsKey( providerName ) ) {
throw new IllegalArgumentException( "A provider already exists with the name " + providerName );
}
PROVIDERS.put( providerName, providerClass );
LOGGER.debug( "Registering new provider: {}", providerClass.getSimpleName() );
} | [
"public",
"static",
"void",
"registerProvider",
"(",
"String",
"providerName",
",",
"Class",
"<",
"?",
"extends",
"StorageProvider",
">",
"providerClass",
")",
"{",
"if",
"(",
"PROVIDERS",
".",
"containsKey",
"(",
"providerName",
")",
")",
"{",
"throw",
"new",... | Register a new {@link StorageProvider}
@param providerName The name to use with the provider
@param providerClass The provider class | [
"Register",
"a",
"new",
"{",
"@link",
"StorageProvider",
"}"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/storage/StorageFacade.java#L63-L70 |
google/closure-templates | java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java | PyExprUtils.convertMapToOrderedDict | public static PyExpr convertMapToOrderedDict(Map<PyExpr, PyExpr> dict) {
List<String> values = new ArrayList<>();
for (Map.Entry<PyExpr, PyExpr> entry : dict.entrySet()) {
values.add("(" + entry.getKey().getText() + ", " + entry.getValue().getText() + ")");
}
Joiner joiner = Joiner.on(", ");
return new PyExpr("collections.OrderedDict([" + joiner.join(values) + "])", Integer.MAX_VALUE);
} | java | public static PyExpr convertMapToOrderedDict(Map<PyExpr, PyExpr> dict) {
List<String> values = new ArrayList<>();
for (Map.Entry<PyExpr, PyExpr> entry : dict.entrySet()) {
values.add("(" + entry.getKey().getText() + ", " + entry.getValue().getText() + ")");
}
Joiner joiner = Joiner.on(", ");
return new PyExpr("collections.OrderedDict([" + joiner.join(values) + "])", Integer.MAX_VALUE);
} | [
"public",
"static",
"PyExpr",
"convertMapToOrderedDict",
"(",
"Map",
"<",
"PyExpr",
",",
"PyExpr",
">",
"dict",
")",
"{",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"PyExpr"... | Convert a java Map to valid PyExpr as dict.
@param dict A Map to be converted to PyExpr as a dictionary, both key and value should be
PyExpr. | [
"Convert",
"a",
"java",
"Map",
"to",
"valid",
"PyExpr",
"as",
"dict",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java#L222-L231 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/AABBUtils.java | AABBUtils.getCollisionBoundingBoxes | public static AxisAlignedBB[] getCollisionBoundingBoxes(World world, Block block, BlockPos pos)
{
return getCollisionBoundingBoxes(world, new MBlockState(pos, block), false);
} | java | public static AxisAlignedBB[] getCollisionBoundingBoxes(World world, Block block, BlockPos pos)
{
return getCollisionBoundingBoxes(world, new MBlockState(pos, block), false);
} | [
"public",
"static",
"AxisAlignedBB",
"[",
"]",
"getCollisionBoundingBoxes",
"(",
"World",
"world",
",",
"Block",
"block",
",",
"BlockPos",
"pos",
")",
"{",
"return",
"getCollisionBoundingBoxes",
"(",
"world",
",",
"new",
"MBlockState",
"(",
"pos",
",",
"block",
... | Gets the collision {@link AxisAlignedBB} for the {@link Block} as the {@link BlockPos} coordinates.
@param world the world
@param block the block
@param pos the pos
@return the collision bounding boxes | [
"Gets",
"the",
"collision",
"{",
"@link",
"AxisAlignedBB",
"}",
"for",
"the",
"{",
"@link",
"Block",
"}",
"as",
"the",
"{",
"@link",
"BlockPos",
"}",
"coordinates",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/AABBUtils.java#L405-L408 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Short | public JBBPOut Short(final String str, final JBBPBitOrder bitOrder) throws IOException {
assertNotEnded();
if (this.processCommands) {
final boolean msb0 = bitOrder == JBBPBitOrder.MSB0;
for (int i = 0; i < str.length(); i++) {
short value = (short) str.charAt(i);
if (msb0) {
value = (short) JBBPFieldShort.reverseBits(value);
}
_writeShort(value);
}
}
return this;
} | java | public JBBPOut Short(final String str, final JBBPBitOrder bitOrder) throws IOException {
assertNotEnded();
if (this.processCommands) {
final boolean msb0 = bitOrder == JBBPBitOrder.MSB0;
for (int i = 0; i < str.length(); i++) {
short value = (short) str.charAt(i);
if (msb0) {
value = (short) JBBPFieldShort.reverseBits(value);
}
_writeShort(value);
}
}
return this;
} | [
"public",
"JBBPOut",
"Short",
"(",
"final",
"String",
"str",
",",
"final",
"JBBPBitOrder",
"bitOrder",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"final",
"boolean",
"msb0",
"=",
... | Write codes of chars as 16 bit values into the stream.
@param str the string which chars will be written, must not be null
@param bitOrder the bit outOrder
@return the DSL session
@throws IOException it will be thrown for transport errors
@since 1.1 | [
"Write",
"codes",
"of",
"chars",
"as",
"16",
"bit",
"values",
"into",
"the",
"stream",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L686-L699 |
Impetus/Kundera | src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/ethereum/KunderaWeb3jClient.java | KunderaWeb3jClient.getBlock | public EthBlock getBlock(BigInteger number, boolean includeTransactions)
{
try
{
return web3j.ethGetBlockByNumber(DefaultBlockParameter.valueOf(number), includeTransactions).send();
}
catch (IOException ex)
{
LOGGER.error("Not able to find block" + number + ". ", ex);
throw new KunderaException("Not able to find block" + number + ". ", ex);
}
} | java | public EthBlock getBlock(BigInteger number, boolean includeTransactions)
{
try
{
return web3j.ethGetBlockByNumber(DefaultBlockParameter.valueOf(number), includeTransactions).send();
}
catch (IOException ex)
{
LOGGER.error("Not able to find block" + number + ". ", ex);
throw new KunderaException("Not able to find block" + number + ". ", ex);
}
} | [
"public",
"EthBlock",
"getBlock",
"(",
"BigInteger",
"number",
",",
"boolean",
"includeTransactions",
")",
"{",
"try",
"{",
"return",
"web3j",
".",
"ethGetBlockByNumber",
"(",
"DefaultBlockParameter",
".",
"valueOf",
"(",
"number",
")",
",",
"includeTransactions",
... | Gets the block.
@param number
the number
@param includeTransactions
the include transactions
@return the block | [
"Gets",
"the",
"block",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/ethereum/KunderaWeb3jClient.java#L167-L178 |
santhosh-tekuri/jlibs | xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java | TransformerUtil.newTransformer | public static Transformer newTransformer(Source source, boolean omitXMLDeclaration, int indentAmount, String encoding) throws TransformerConfigurationException{
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = source!=null ? factory.newTransformer(source) : factory.newTransformer();
return setOutputProperties(transformer, omitXMLDeclaration, indentAmount, encoding);
} | java | public static Transformer newTransformer(Source source, boolean omitXMLDeclaration, int indentAmount, String encoding) throws TransformerConfigurationException{
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = source!=null ? factory.newTransformer(source) : factory.newTransformer();
return setOutputProperties(transformer, omitXMLDeclaration, indentAmount, encoding);
} | [
"public",
"static",
"Transformer",
"newTransformer",
"(",
"Source",
"source",
",",
"boolean",
"omitXMLDeclaration",
",",
"int",
"indentAmount",
",",
"String",
"encoding",
")",
"throws",
"TransformerConfigurationException",
"{",
"TransformerFactory",
"factory",
"=",
"Tra... | Creates Transformer
@param source source of xsl document, use null for identity transformer
@param omitXMLDeclaration omit xml declaration or not
@param indentAmount the number fo spaces used for indentation.
use <=0, in case you dont want indentation
@param encoding required encoding. use null to don't set any encoding
@return the same transformer which is passed as argument | [
"Creates",
"Transformer"
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java#L70-L74 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/slave/ModbusSlaveFactory.java | ModbusSlaveFactory.createTCPSlave | public static synchronized ModbusSlave createTCPSlave(int port, int poolSize, boolean useRtuOverTcp) throws ModbusException {
return ModbusSlaveFactory.createTCPSlave(null, port, poolSize, useRtuOverTcp);
} | java | public static synchronized ModbusSlave createTCPSlave(int port, int poolSize, boolean useRtuOverTcp) throws ModbusException {
return ModbusSlaveFactory.createTCPSlave(null, port, poolSize, useRtuOverTcp);
} | [
"public",
"static",
"synchronized",
"ModbusSlave",
"createTCPSlave",
"(",
"int",
"port",
",",
"int",
"poolSize",
",",
"boolean",
"useRtuOverTcp",
")",
"throws",
"ModbusException",
"{",
"return",
"ModbusSlaveFactory",
".",
"createTCPSlave",
"(",
"null",
",",
"port",
... | Creates a TCP modbus slave or returns the one already allocated to this port
@param port Port to listen on
@param poolSize Pool size of listener threads
@param useRtuOverTcp True if the RTU protocol should be used over TCP
@return new or existing TCP modbus slave associated with the port
@throws ModbusException If a problem occurs e.g. port already in use | [
"Creates",
"a",
"TCP",
"modbus",
"slave",
"or",
"returns",
"the",
"one",
"already",
"allocated",
"to",
"this",
"port"
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/slave/ModbusSlaveFactory.java#L66-L68 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/templates/config/SiteConfigurationReader.java | SiteConfigurationReader.decorateLocalResourceLinks | private final void decorateLocalResourceLinks(final SiteConfiguration.Tag[] links, final String prefix, final Path root) {
if (links == null) return;
for(SiteConfiguration.Tag link : links) {
if (isLocal(link.url)) {
link.url = deploymentInfo.translateIntoContextPath( toAddOrNotToAddModified(link.url, prefix, root) );
}
}
} | java | private final void decorateLocalResourceLinks(final SiteConfiguration.Tag[] links, final String prefix, final Path root) {
if (links == null) return;
for(SiteConfiguration.Tag link : links) {
if (isLocal(link.url)) {
link.url = deploymentInfo.translateIntoContextPath( toAddOrNotToAddModified(link.url, prefix, root) );
}
}
} | [
"private",
"final",
"void",
"decorateLocalResourceLinks",
"(",
"final",
"SiteConfiguration",
".",
"Tag",
"[",
"]",
"links",
",",
"final",
"String",
"prefix",
",",
"final",
"Path",
"root",
")",
"{",
"if",
"(",
"links",
"==",
"null",
")",
"return",
";",
"for... | Prefixes local resources with css/ or js/.
"Local" is defined by not starting with 'http.*' or 'ftp.*'
Adds a version query param to local resources.
The <code>version</code> is currently just an epoch | [
"Prefixes",
"local",
"resources",
"with",
"css",
"/",
"or",
"js",
"/",
".",
"Local",
"is",
"defined",
"by",
"not",
"starting",
"with",
"http",
".",
"*",
"or",
"ftp",
".",
"*"
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/templates/config/SiteConfigurationReader.java#L239-L247 |
logic-ng/LogicNG | src/main/java/org/logicng/datastructures/ubtrees/UBTree.java | UBTree.firstSubset | public SortedSet<T> firstSubset(SortedSet<T> set) {
if (this.rootNodes.isEmpty() || set == null || set.isEmpty()) {
return null;
}
return firstSubset(set, this.rootNodes);
} | java | public SortedSet<T> firstSubset(SortedSet<T> set) {
if (this.rootNodes.isEmpty() || set == null || set.isEmpty()) {
return null;
}
return firstSubset(set, this.rootNodes);
} | [
"public",
"SortedSet",
"<",
"T",
">",
"firstSubset",
"(",
"SortedSet",
"<",
"T",
">",
"set",
")",
"{",
"if",
"(",
"this",
".",
"rootNodes",
".",
"isEmpty",
"(",
")",
"||",
"set",
"==",
"null",
"||",
"set",
".",
"isEmpty",
"(",
")",
")",
"{",
"ret... | Returns the first subset of a given set in this UBTree.
@param set the set to search for
@return the first subset which is found for the given set or {@code null} if there is none | [
"Returns",
"the",
"first",
"subset",
"of",
"a",
"given",
"set",
"in",
"this",
"UBTree",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/ubtrees/UBTree.java#L54-L59 |
grails/grails-core | grails-core/src/main/groovy/org/grails/spring/context/support/ReloadableResourceBundleMessageSource.java | ReloadableResourceBundleMessageSource.getProperties | @SuppressWarnings("rawtypes")
protected PropertiesHolder getProperties(final String filename, final Resource resource) {
return CacheEntry.getValue(cachedProperties, filename, fileCacheMillis, new Callable<PropertiesHolder>() {
@Override
public PropertiesHolder call() throws Exception {
return new PropertiesHolder(filename, resource);
}
}, new Callable<CacheEntry>() {
@Override
public CacheEntry call() throws Exception {
return new PropertiesHolderCacheEntry();
}
}, true, null);
} | java | @SuppressWarnings("rawtypes")
protected PropertiesHolder getProperties(final String filename, final Resource resource) {
return CacheEntry.getValue(cachedProperties, filename, fileCacheMillis, new Callable<PropertiesHolder>() {
@Override
public PropertiesHolder call() throws Exception {
return new PropertiesHolder(filename, resource);
}
}, new Callable<CacheEntry>() {
@Override
public CacheEntry call() throws Exception {
return new PropertiesHolderCacheEntry();
}
}, true, null);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"protected",
"PropertiesHolder",
"getProperties",
"(",
"final",
"String",
"filename",
",",
"final",
"Resource",
"resource",
")",
"{",
"return",
"CacheEntry",
".",
"getValue",
"(",
"cachedProperties",
",",
"filename"... | Get a PropertiesHolder for the given filename, either from the
cache or freshly loaded.
@param filename the bundle filename (basename + Locale)
@return the current PropertiesHolder for the bundle | [
"Get",
"a",
"PropertiesHolder",
"for",
"the",
"given",
"filename",
"either",
"from",
"the",
"cache",
"or",
"freshly",
"loaded",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/spring/context/support/ReloadableResourceBundleMessageSource.java#L488-L501 |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/RestService.java | RestService.toEntity | public Entity toEntity(final EntityType meta, final Map<String, Object> request) {
final Entity entity = entityManager.create(meta, POPULATE);
for (Attribute attr : meta.getAtomicAttributes()) {
if (attr.getExpression() == null) {
String paramName = attr.getName();
if (request.containsKey(paramName)) {
final Object paramValue = request.get(paramName);
Attribute idAttribute = meta.getIdAttribute();
Object idValue = request.get(idAttribute.getName());
final Object value = this.toEntityValue(attr, paramValue, idValue);
entity.set(attr.getName(), value);
}
}
}
return entity;
} | java | public Entity toEntity(final EntityType meta, final Map<String, Object> request) {
final Entity entity = entityManager.create(meta, POPULATE);
for (Attribute attr : meta.getAtomicAttributes()) {
if (attr.getExpression() == null) {
String paramName = attr.getName();
if (request.containsKey(paramName)) {
final Object paramValue = request.get(paramName);
Attribute idAttribute = meta.getIdAttribute();
Object idValue = request.get(idAttribute.getName());
final Object value = this.toEntityValue(attr, paramValue, idValue);
entity.set(attr.getName(), value);
}
}
}
return entity;
} | [
"public",
"Entity",
"toEntity",
"(",
"final",
"EntityType",
"meta",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"request",
")",
"{",
"final",
"Entity",
"entity",
"=",
"entityManager",
".",
"create",
"(",
"meta",
",",
"POPULATE",
")",
";",
"fo... | Creates a new entity based from a HttpServletRequest. For file attributes persists the file in
the file store and persist a file meta data entity.
@param meta entity meta data
@param request HTTP request parameters
@return entity created from HTTP request parameters | [
"Creates",
"a",
"new",
"entity",
"based",
"from",
"a",
"HttpServletRequest",
".",
"For",
"file",
"attributes",
"persists",
"the",
"file",
"in",
"the",
"file",
"store",
"and",
"persist",
"a",
"file",
"meta",
"data",
"entity",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/RestService.java#L85-L102 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPPUtility.java | MPPUtility.getGUID | public static final UUID getGUID(byte[] data, int offset)
{
UUID result = null;
if (data != null && data.length > 15)
{
long long1 = 0;
long1 |= ((long) (data[offset + 3] & 0xFF)) << 56;
long1 |= ((long) (data[offset + 2] & 0xFF)) << 48;
long1 |= ((long) (data[offset + 1] & 0xFF)) << 40;
long1 |= ((long) (data[offset + 0] & 0xFF)) << 32;
long1 |= ((long) (data[offset + 5] & 0xFF)) << 24;
long1 |= ((long) (data[offset + 4] & 0xFF)) << 16;
long1 |= ((long) (data[offset + 7] & 0xFF)) << 8;
long1 |= ((long) (data[offset + 6] & 0xFF)) << 0;
long long2 = 0;
long2 |= ((long) (data[offset + 8] & 0xFF)) << 56;
long2 |= ((long) (data[offset + 9] & 0xFF)) << 48;
long2 |= ((long) (data[offset + 10] & 0xFF)) << 40;
long2 |= ((long) (data[offset + 11] & 0xFF)) << 32;
long2 |= ((long) (data[offset + 12] & 0xFF)) << 24;
long2 |= ((long) (data[offset + 13] & 0xFF)) << 16;
long2 |= ((long) (data[offset + 14] & 0xFF)) << 8;
long2 |= ((long) (data[offset + 15] & 0xFF)) << 0;
result = new UUID(long1, long2);
}
return result;
} | java | public static final UUID getGUID(byte[] data, int offset)
{
UUID result = null;
if (data != null && data.length > 15)
{
long long1 = 0;
long1 |= ((long) (data[offset + 3] & 0xFF)) << 56;
long1 |= ((long) (data[offset + 2] & 0xFF)) << 48;
long1 |= ((long) (data[offset + 1] & 0xFF)) << 40;
long1 |= ((long) (data[offset + 0] & 0xFF)) << 32;
long1 |= ((long) (data[offset + 5] & 0xFF)) << 24;
long1 |= ((long) (data[offset + 4] & 0xFF)) << 16;
long1 |= ((long) (data[offset + 7] & 0xFF)) << 8;
long1 |= ((long) (data[offset + 6] & 0xFF)) << 0;
long long2 = 0;
long2 |= ((long) (data[offset + 8] & 0xFF)) << 56;
long2 |= ((long) (data[offset + 9] & 0xFF)) << 48;
long2 |= ((long) (data[offset + 10] & 0xFF)) << 40;
long2 |= ((long) (data[offset + 11] & 0xFF)) << 32;
long2 |= ((long) (data[offset + 12] & 0xFF)) << 24;
long2 |= ((long) (data[offset + 13] & 0xFF)) << 16;
long2 |= ((long) (data[offset + 14] & 0xFF)) << 8;
long2 |= ((long) (data[offset + 15] & 0xFF)) << 0;
result = new UUID(long1, long2);
}
return result;
} | [
"public",
"static",
"final",
"UUID",
"getGUID",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"{",
"UUID",
"result",
"=",
"null",
";",
"if",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"length",
">",
"15",
")",
"{",
"long",
"long1",
... | Reads a UUID/GUID from a data block.
@param data data block
@param offset offset into the data block
@return UUID instance | [
"Reads",
"a",
"UUID",
"/",
"GUID",
"from",
"a",
"data",
"block",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L273-L301 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cli/CliClient.java | CliClient.convertValueByFunction | private ByteBuffer convertValueByFunction(Tree functionCall, CfDef columnFamily, ByteBuffer columnName)
{
return convertValueByFunction(functionCall, columnFamily, columnName, false);
} | java | private ByteBuffer convertValueByFunction(Tree functionCall, CfDef columnFamily, ByteBuffer columnName)
{
return convertValueByFunction(functionCall, columnFamily, columnName, false);
} | [
"private",
"ByteBuffer",
"convertValueByFunction",
"(",
"Tree",
"functionCall",
",",
"CfDef",
"columnFamily",
",",
"ByteBuffer",
"columnName",
")",
"{",
"return",
"convertValueByFunction",
"(",
"functionCall",
",",
"columnFamily",
",",
"columnName",
",",
"false",
")",... | Used to convert value (function argument, string) into byte[]
calls convertValueByFunction method with "withUpdate" set to false
@param functionCall - tree representing function call ^(FUNCTION_CALL function_name value)
@param columnFamily - column family definition (CfDef)
@param columnName - also updates column family metadata for given column
@return byte[] - string value as byte[] | [
"Used",
"to",
"convert",
"value",
"(",
"function",
"argument",
"string",
")",
"into",
"byte",
"[]",
"calls",
"convertValueByFunction",
"method",
"with",
"withUpdate",
"set",
"to",
"false"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2759-L2762 |
konmik/solid | collections/src/main/java/solid/collectors/ToSparseArray.java | ToSparseArray.toSparseArray | public static <T> Func1<Iterable<T>, SparseArray<T>> toSparseArray(Func1<T, Integer> itemToKey) {
return toSparseArray(itemToKey, 10);
} | java | public static <T> Func1<Iterable<T>, SparseArray<T>> toSparseArray(Func1<T, Integer> itemToKey) {
return toSparseArray(itemToKey, 10);
} | [
"public",
"static",
"<",
"T",
">",
"Func1",
"<",
"Iterable",
"<",
"T",
">",
",",
"SparseArray",
"<",
"T",
">",
">",
"toSparseArray",
"(",
"Func1",
"<",
"T",
",",
"Integer",
">",
"itemToKey",
")",
"{",
"return",
"toSparseArray",
"(",
"itemToKey",
",",
... | Returns a method that can be used with {@link solid.stream.Stream#collect(Func1)}
to convert a stream into a {@link SparseArray}.
@param <T> a type of stream items.
@param itemToKey a method that should return a key for an item.
@return a method that converts an iterable into a {@link SparseArray}. | [
"Returns",
"a",
"method",
"that",
"can",
"be",
"used",
"with",
"{",
"@link",
"solid",
".",
"stream",
".",
"Stream#collect",
"(",
"Func1",
")",
"}",
"to",
"convert",
"a",
"stream",
"into",
"a",
"{",
"@link",
"SparseArray",
"}",
"."
] | train | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/collections/src/main/java/solid/collectors/ToSparseArray.java#L17-L19 |
alkacon/opencms-core | src/org/opencms/relations/CmsCategoryService.java | CmsCategoryService.localizeCategory | public CmsCategory localizeCategory(CmsObject cms, CmsCategory category, Locale locale) {
try {
CmsUUID id = category.getId();
CmsResource categoryRes = cms.readResource(id, CmsResourceFilter.IGNORE_EXPIRATION);
String title = cms.readPropertyObject(
categoryRes,
CmsPropertyDefinition.PROPERTY_TITLE,
false,
locale).getValue();
String description = cms.readPropertyObject(
categoryRes,
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
false,
locale).getValue();
return new CmsCategory(category, title, description);
} catch (Exception e) {
LOG.error("Could not read localized category: " + e.getLocalizedMessage(), e);
return category;
}
} | java | public CmsCategory localizeCategory(CmsObject cms, CmsCategory category, Locale locale) {
try {
CmsUUID id = category.getId();
CmsResource categoryRes = cms.readResource(id, CmsResourceFilter.IGNORE_EXPIRATION);
String title = cms.readPropertyObject(
categoryRes,
CmsPropertyDefinition.PROPERTY_TITLE,
false,
locale).getValue();
String description = cms.readPropertyObject(
categoryRes,
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
false,
locale).getValue();
return new CmsCategory(category, title, description);
} catch (Exception e) {
LOG.error("Could not read localized category: " + e.getLocalizedMessage(), e);
return category;
}
} | [
"public",
"CmsCategory",
"localizeCategory",
"(",
"CmsObject",
"cms",
",",
"CmsCategory",
"category",
",",
"Locale",
"locale",
")",
"{",
"try",
"{",
"CmsUUID",
"id",
"=",
"category",
".",
"getId",
"(",
")",
";",
"CmsResource",
"categoryRes",
"=",
"cms",
".",... | Localizes a single category by reading its locale-specific properties for title and description, if possible.<p>
@param cms the CMS context to use for reading resources
@param category the category to localize
@param locale the locale to use
@return the localized category | [
"Localizes",
"a",
"single",
"category",
"by",
"reading",
"its",
"locale",
"-",
"specific",
"properties",
"for",
"title",
"and",
"description",
"if",
"possible",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L399-L419 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java | ExpressRoutePortsInner.beginCreateOrUpdate | public ExpressRoutePortInner beginCreateOrUpdate(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).toBlocking().single().body();
} | java | public ExpressRoutePortInner beginCreateOrUpdate(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).toBlocking().single().body();
} | [
"public",
"ExpressRoutePortInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRoutePortName",
",",
"ExpressRoutePortInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"ex... | Creates or updates the specified ExpressRoutePort resource.
@param resourceGroupName The name of the resource group.
@param expressRoutePortName The name of the ExpressRoutePort resource.
@param parameters Parameters supplied to the create ExpressRoutePort operation.
@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 ExpressRoutePortInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"specified",
"ExpressRoutePort",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java#L437-L439 |
drewnoakes/metadata-extractor | Source/com/drew/metadata/Directory.java | Directory.setString | @java.lang.SuppressWarnings({ "ConstantConditions" })
public void setString(int tagType, @NotNull String value)
{
if (value == null)
throw new NullPointerException("cannot set a null String");
setObject(tagType, value);
} | java | @java.lang.SuppressWarnings({ "ConstantConditions" })
public void setString(int tagType, @NotNull String value)
{
if (value == null)
throw new NullPointerException("cannot set a null String");
setObject(tagType, value);
} | [
"@",
"java",
".",
"lang",
".",
"SuppressWarnings",
"(",
"{",
"\"ConstantConditions\"",
"}",
")",
"public",
"void",
"setString",
"(",
"int",
"tagType",
",",
"@",
"NotNull",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"throw",
"new"... | Sets a <code>String</code> value for the specified tag.
@param tagType the tag's value as an int
@param value the value for the specified tag as a String | [
"Sets",
"a",
"<code",
">",
"String<",
"/",
"code",
">",
"value",
"for",
"the",
"specified",
"tag",
"."
] | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/Directory.java#L283-L289 |
infinispan/infinispan | core/src/main/java/org/infinispan/container/offheap/OffHeapEntryFactoryImpl.java | OffHeapEntryFactoryImpl.equalsKey | @Override
public boolean equalsKey(long address, WrappedBytes wrappedBytes) {
// 16 bytes for eviction if needed (optional)
// 8 bytes for linked pointer
int headerOffset = evictionEnabled ? 24 : 8;
byte type = MEMORY.getByte(address, headerOffset);
headerOffset++;
// First if hashCode doesn't match then the key can't be equal
int hashCode = wrappedBytes.hashCode();
if (hashCode != MEMORY.getInt(address, headerOffset)) {
return false;
}
headerOffset += 4;
// If the length of the key is not the same it can't match either!
int keyLength = MEMORY.getInt(address, headerOffset);
if (keyLength != wrappedBytes.getLength()) {
return false;
}
headerOffset += 4;
if (requiresMetadataSize(type)) {
headerOffset += 4;
}
// This is for the value size which we don't need to read
headerOffset += 4;
// Finally read each byte individually so we don't have to copy them into a byte[]
for (int i = 0; i < keyLength; i++) {
byte b = MEMORY.getByte(address, headerOffset + i);
if (b != wrappedBytes.getByte(i))
return false;
}
return true;
} | java | @Override
public boolean equalsKey(long address, WrappedBytes wrappedBytes) {
// 16 bytes for eviction if needed (optional)
// 8 bytes for linked pointer
int headerOffset = evictionEnabled ? 24 : 8;
byte type = MEMORY.getByte(address, headerOffset);
headerOffset++;
// First if hashCode doesn't match then the key can't be equal
int hashCode = wrappedBytes.hashCode();
if (hashCode != MEMORY.getInt(address, headerOffset)) {
return false;
}
headerOffset += 4;
// If the length of the key is not the same it can't match either!
int keyLength = MEMORY.getInt(address, headerOffset);
if (keyLength != wrappedBytes.getLength()) {
return false;
}
headerOffset += 4;
if (requiresMetadataSize(type)) {
headerOffset += 4;
}
// This is for the value size which we don't need to read
headerOffset += 4;
// Finally read each byte individually so we don't have to copy them into a byte[]
for (int i = 0; i < keyLength; i++) {
byte b = MEMORY.getByte(address, headerOffset + i);
if (b != wrappedBytes.getByte(i))
return false;
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"equalsKey",
"(",
"long",
"address",
",",
"WrappedBytes",
"wrappedBytes",
")",
"{",
"// 16 bytes for eviction if needed (optional)",
"// 8 bytes for linked pointer",
"int",
"headerOffset",
"=",
"evictionEnabled",
"?",
"24",
":",
"8",
... | Assumes the address points to the entry excluding the pointer reference at the beginning
@param address the address of an entry to read
@param wrappedBytes the key to check if it equals
@return whether the key and address are equal | [
"Assumes",
"the",
"address",
"points",
"to",
"the",
"entry",
"excluding",
"the",
"pointer",
"reference",
"at",
"the",
"beginning"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/container/offheap/OffHeapEntryFactoryImpl.java#L367-L399 |
VoltDB/voltdb | src/frontend/org/voltdb/largequery/LargeBlockTask.java | LargeBlockTask.getLoadTask | public static LargeBlockTask getLoadTask(BlockId blockId, ByteBuffer block) {
return new LargeBlockTask() {
@Override
public LargeBlockResponse call() throws Exception {
Exception theException = null;
try {
LargeBlockManager.getInstance().loadBlock(blockId, block);
}
catch (Exception exc) {
theException = exc;
}
return new LargeBlockResponse(theException);
}
};
} | java | public static LargeBlockTask getLoadTask(BlockId blockId, ByteBuffer block) {
return new LargeBlockTask() {
@Override
public LargeBlockResponse call() throws Exception {
Exception theException = null;
try {
LargeBlockManager.getInstance().loadBlock(blockId, block);
}
catch (Exception exc) {
theException = exc;
}
return new LargeBlockResponse(theException);
}
};
} | [
"public",
"static",
"LargeBlockTask",
"getLoadTask",
"(",
"BlockId",
"blockId",
",",
"ByteBuffer",
"block",
")",
"{",
"return",
"new",
"LargeBlockTask",
"(",
")",
"{",
"@",
"Override",
"public",
"LargeBlockResponse",
"call",
"(",
")",
"throws",
"Exception",
"{",... | Get a new "load" task
@param blockId The block id of the block to load
@param block A ByteBuffer to write data intox
@return An instance of LargeBlockTask that will load a block | [
"Get",
"a",
"new",
"load",
"task"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/largequery/LargeBlockTask.java#L83-L98 |
mailin-api/sendinblue-java-mvn | src/main/java/com/sendinblue/Sendinblue.java | Sendinblue.update_child_account | public String update_child_account(Object data) {
Gson gson = new Gson();
String json = gson.toJson(data);
return put("account", json);
} | java | public String update_child_account(Object data) {
Gson gson = new Gson();
String json = gson.toJson(data);
return put("account", json);
} | [
"public",
"String",
"update_child_account",
"(",
"Object",
"data",
")",
"{",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"String",
"json",
"=",
"gson",
".",
"toJson",
"(",
"data",
")",
";",
"return",
"put",
"(",
"\"account\"",
",",
"json",
")",
... | /*
Update Child Account.
@param {Object} data contains json objects as a key value pair from HashMap.
@options data {String} auth_key: 16 character authorization key of Reseller child to be modified [Mandatory]
@options data {String} company_org: Name of Reseller child’s company [Optional]
@options data {String} first_name: First name of Reseller child [Optional]
@options data {String} last_name: Last name of Reseller child [Optional]
@options data {String} password: Password of Reseller child to login [Optional]
@options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use commas to separate multiple IPs [Optional]
@options data {Array} disassociate_ip: Disassociate dedicated IPs from reseller child. You can use commas to separate multiple IPs [Optional] | [
"/",
"*",
"Update",
"Child",
"Account",
"."
] | train | https://github.com/mailin-api/sendinblue-java-mvn/blob/3a186b004003450f18d619aa084adc8d75086183/src/main/java/com/sendinblue/Sendinblue.java#L212-L216 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/layout/LayoutExtensions.java | LayoutExtensions.addComponent | public static void addComponent(final GridBagLayout gbl, final GridBagConstraints gbc,
final int gridx, final int gridy, final Component component, final Container panelToAdd)
{
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(5, 5, 5, 5);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbl.setConstraints(component, gbc);
panelToAdd.add(component);
} | java | public static void addComponent(final GridBagLayout gbl, final GridBagConstraints gbc,
final int gridx, final int gridy, final Component component, final Container panelToAdd)
{
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(5, 5, 5, 5);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbl.setConstraints(component, gbc);
panelToAdd.add(component);
} | [
"public",
"static",
"void",
"addComponent",
"(",
"final",
"GridBagLayout",
"gbl",
",",
"final",
"GridBagConstraints",
"gbc",
",",
"final",
"int",
"gridx",
",",
"final",
"int",
"gridy",
",",
"final",
"Component",
"component",
",",
"final",
"Container",
"panelToAd... | Adds the component.
@param gbl
the gbl
@param gbc
the gbc
@param gridx
the gridx
@param gridy
the gridy
@param component
the component
@param panelToAdd
the panel to add | [
"Adds",
"the",
"component",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/layout/LayoutExtensions.java#L91-L101 |
JoeKerouac/utils | src/main/java/com/joe/utils/serialize/json/JsonParser.java | JsonParser.readAsObject | @SuppressWarnings("unchecked")
public <T> T readAsObject(String content, Class<T> type) {
Assert.notNull(type);
try {
if (StringUtils.isEmpty(content)) {
log.debug("content为空,返回null", content, type);
return null;
} else if (type.equals(String.class)) {
return (T) content;
}
return MAPPER.readValue(content, type);
} catch (Exception e) {
log.error("json解析失败,失败原因:", e);
return null;
}
} | java | @SuppressWarnings("unchecked")
public <T> T readAsObject(String content, Class<T> type) {
Assert.notNull(type);
try {
if (StringUtils.isEmpty(content)) {
log.debug("content为空,返回null", content, type);
return null;
} else if (type.equals(String.class)) {
return (T) content;
}
return MAPPER.readValue(content, type);
} catch (Exception e) {
log.error("json解析失败,失败原因:", e);
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"readAsObject",
"(",
"String",
"content",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"Assert",
".",
"notNull",
"(",
"type",
")",
";",
"try",
"{",
"if",
"(",
"String... | 解析json
@param content json字符串
@param type json解析后对应的实体类型
@param <T> 实体类型的实际类型
@return 解析失败将返回null | [
"解析json"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/serialize/json/JsonParser.java#L114-L129 |
dita-ot/dita-ot | src/main/java/org/dita/dost/writer/ValidationFilter.java | ValidationFilter.validateReference | private AttributesImpl validateReference(final String attrName, final Attributes atts, final AttributesImpl modified) {
AttributesImpl res = modified;
final String href = atts.getValue(attrName);
if (href != null) {
try {
new URI(href);
} catch (final URISyntaxException e) {
switch (processingMode) {
case STRICT:
throw new RuntimeException(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ": " + e.getMessage(), e);
case SKIP:
logger.error(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ", using invalid value.");
break;
case LAX:
try {
final URI uri = new URI(URLUtils.clean(href.trim()));
if (res == null) {
res = new AttributesImpl(atts);
}
res.setValue(res.getIndex(attrName), uri.toASCIIString());
logger.error(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ", using '" + uri.toASCIIString() + "'.");
} catch (final URISyntaxException e1) {
logger.error(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ", using invalid value.");
}
break;
}
}
}
return res;
} | java | private AttributesImpl validateReference(final String attrName, final Attributes atts, final AttributesImpl modified) {
AttributesImpl res = modified;
final String href = atts.getValue(attrName);
if (href != null) {
try {
new URI(href);
} catch (final URISyntaxException e) {
switch (processingMode) {
case STRICT:
throw new RuntimeException(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ": " + e.getMessage(), e);
case SKIP:
logger.error(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ", using invalid value.");
break;
case LAX:
try {
final URI uri = new URI(URLUtils.clean(href.trim()));
if (res == null) {
res = new AttributesImpl(atts);
}
res.setValue(res.getIndex(attrName), uri.toASCIIString());
logger.error(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ", using '" + uri.toASCIIString() + "'.");
} catch (final URISyntaxException e1) {
logger.error(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ", using invalid value.");
}
break;
}
}
}
return res;
} | [
"private",
"AttributesImpl",
"validateReference",
"(",
"final",
"String",
"attrName",
",",
"final",
"Attributes",
"atts",
",",
"final",
"AttributesImpl",
"modified",
")",
"{",
"AttributesImpl",
"res",
"=",
"modified",
";",
"final",
"String",
"href",
"=",
"atts",
... | Validate and fix {@code href} or {@code conref} attribute for URI validity.
@return modified attributes, {@code null} if there have been no changes | [
"Validate",
"and",
"fix",
"{",
"@code",
"href",
"}",
"or",
"{",
"@code",
"conref",
"}",
"attribute",
"for",
"URI",
"validity",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/ValidationFilter.java#L183-L212 |
haifengl/smile | core/src/main/java/smile/clustering/PartitionClustering.java | PartitionClustering.squaredDistance | static double squaredDistance(double[] x, double[] y) {
int n = x.length;
int m = 0;
double dist = 0.0;
for (int i = 0; i < n; i++) {
if (!Double.isNaN(x[i]) && !Double.isNaN(y[i])) {
m++;
double d = x[i] - y[i];
dist += d * d;
}
}
if (m == 0) {
dist = Double.MAX_VALUE;
} else {
dist = n * dist / m;
}
return dist;
} | java | static double squaredDistance(double[] x, double[] y) {
int n = x.length;
int m = 0;
double dist = 0.0;
for (int i = 0; i < n; i++) {
if (!Double.isNaN(x[i]) && !Double.isNaN(y[i])) {
m++;
double d = x[i] - y[i];
dist += d * d;
}
}
if (m == 0) {
dist = Double.MAX_VALUE;
} else {
dist = n * dist / m;
}
return dist;
} | [
"static",
"double",
"squaredDistance",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"int",
"n",
"=",
"x",
".",
"length",
";",
"int",
"m",
"=",
"0",
";",
"double",
"dist",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
... | Squared Euclidean distance with handling missing values (represented as NaN). | [
"Squared",
"Euclidean",
"distance",
"with",
"handling",
"missing",
"values",
"(",
"represented",
"as",
"NaN",
")",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/PartitionClustering.java#L67-L87 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java | GVRCameraRig.setFloat | public void setFloat(String key, float value) {
checkStringNotNullOrEmpty("key", key);
checkFloatNotNaNOrInfinity("value", value);
NativeCameraRig.setFloat(getNative(), key, value);
} | java | public void setFloat(String key, float value) {
checkStringNotNullOrEmpty("key", key);
checkFloatNotNaNOrInfinity("value", value);
NativeCameraRig.setFloat(getNative(), key, value);
} | [
"public",
"void",
"setFloat",
"(",
"String",
"key",
",",
"float",
"value",
")",
"{",
"checkStringNotNullOrEmpty",
"(",
"\"key\"",
",",
"key",
")",
";",
"checkFloatNotNaNOrInfinity",
"(",
"\"value\"",
",",
"value",
")",
";",
"NativeCameraRig",
".",
"setFloat",
... | Map {@code value} to {@code key}.
@param key
Key to map {@code value} to.
@param value
The {@code float} value to map. | [
"Map",
"{",
"@code",
"value",
"}",
"to",
"{",
"@code",
"key",
"}",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java#L223-L227 |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CepOperator.java | CepOperator.processEvent | private void processEvent(NFAState nfaState, IN event, long timestamp) throws Exception {
try (SharedBufferAccessor<IN> sharedBufferAccessor = partialMatches.getAccessor()) {
Collection<Map<String, List<IN>>> patterns =
nfa.process(sharedBufferAccessor, nfaState, event, timestamp, afterMatchSkipStrategy, cepTimerService);
processMatchedSequences(patterns, timestamp);
}
} | java | private void processEvent(NFAState nfaState, IN event, long timestamp) throws Exception {
try (SharedBufferAccessor<IN> sharedBufferAccessor = partialMatches.getAccessor()) {
Collection<Map<String, List<IN>>> patterns =
nfa.process(sharedBufferAccessor, nfaState, event, timestamp, afterMatchSkipStrategy, cepTimerService);
processMatchedSequences(patterns, timestamp);
}
} | [
"private",
"void",
"processEvent",
"(",
"NFAState",
"nfaState",
",",
"IN",
"event",
",",
"long",
"timestamp",
")",
"throws",
"Exception",
"{",
"try",
"(",
"SharedBufferAccessor",
"<",
"IN",
">",
"sharedBufferAccessor",
"=",
"partialMatches",
".",
"getAccessor",
... | Process the given event by giving it to the NFA and outputting the produced set of matched
event sequences.
@param nfaState Our NFAState object
@param event The current event to be processed
@param timestamp The timestamp of the event | [
"Process",
"the",
"given",
"event",
"by",
"giving",
"it",
"to",
"the",
"NFA",
"and",
"outputting",
"the",
"produced",
"set",
"of",
"matched",
"event",
"sequences",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CepOperator.java#L422-L428 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java | AnnotationUtils.getAnnotation | public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
Method resolvedMethod = BridgeMethodResolver.findBridgedMethod(method);
return getAnnotation((AnnotatedElement) resolvedMethod, annotationType);
} | java | public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
Method resolvedMethod = BridgeMethodResolver.findBridgedMethod(method);
return getAnnotation((AnnotatedElement) resolvedMethod, annotationType);
} | [
"public",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getAnnotation",
"(",
"Method",
"method",
",",
"Class",
"<",
"A",
">",
"annotationType",
")",
"{",
"Method",
"resolvedMethod",
"=",
"BridgeMethodResolver",
".",
"findBridgedMethod",
"(",
"method",
... | Get a single {@link Annotation} of {@code annotationType} from the supplied {@link Method}.
<p>Correctly handles bridge {@link Method Methods} generated by the compiler.
@param method the method to look for annotations on
@param annotationType the annotation type to look for
@return the annotations found | [
"Get",
"a",
"single",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L169-L172 |
google/closure-compiler | src/com/google/javascript/jscomp/AstFactory.java | AstFactory.createObjectDotAssignCall | Node createObjectDotAssignCall(Scope scope, JSType returnType, Node... args) {
Node objAssign = createQName(scope, "Object.assign");
Node result = createCall(objAssign, args);
if (isAddingTypes()) {
// Make a unique function type that returns the exact type we've inferred it to be.
// Object.assign in the externs just returns !Object, which loses type information.
JSType objAssignType =
registry.createFunctionTypeWithVarArgs(
returnType,
registry.getNativeType(JSTypeNative.OBJECT_TYPE),
registry.createUnionType(JSTypeNative.OBJECT_TYPE, JSTypeNative.NULL_TYPE));
objAssign.setJSType(objAssignType);
result.setJSType(returnType);
}
return result;
} | java | Node createObjectDotAssignCall(Scope scope, JSType returnType, Node... args) {
Node objAssign = createQName(scope, "Object.assign");
Node result = createCall(objAssign, args);
if (isAddingTypes()) {
// Make a unique function type that returns the exact type we've inferred it to be.
// Object.assign in the externs just returns !Object, which loses type information.
JSType objAssignType =
registry.createFunctionTypeWithVarArgs(
returnType,
registry.getNativeType(JSTypeNative.OBJECT_TYPE),
registry.createUnionType(JSTypeNative.OBJECT_TYPE, JSTypeNative.NULL_TYPE));
objAssign.setJSType(objAssignType);
result.setJSType(returnType);
}
return result;
} | [
"Node",
"createObjectDotAssignCall",
"(",
"Scope",
"scope",
",",
"JSType",
"returnType",
",",
"Node",
"...",
"args",
")",
"{",
"Node",
"objAssign",
"=",
"createQName",
"(",
"scope",
",",
"\"Object.assign\"",
")",
";",
"Node",
"result",
"=",
"createCall",
"(",
... | Creates a call to Object.assign that returns the specified type.
<p>Object.assign returns !Object in the externs, which can lose type information if the actual
type is known. | [
"Creates",
"a",
"call",
"to",
"Object",
".",
"assign",
"that",
"returns",
"the",
"specified",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L572-L589 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.createImageTagsWithServiceResponseAsync | public Observable<ServiceResponse<ImageTagCreateSummary>> createImageTagsWithServiceResponseAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final List<ImageTagCreateEntry> tags = createImageTagsOptionalParameter != null ? createImageTagsOptionalParameter.tags() : null;
return createImageTagsWithServiceResponseAsync(projectId, tags);
} | java | public Observable<ServiceResponse<ImageTagCreateSummary>> createImageTagsWithServiceResponseAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final List<ImageTagCreateEntry> tags = createImageTagsOptionalParameter != null ? createImageTagsOptionalParameter.tags() : null;
return createImageTagsWithServiceResponseAsync(projectId, tags);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"ImageTagCreateSummary",
">",
">",
"createImageTagsWithServiceResponseAsync",
"(",
"UUID",
"projectId",
",",
"CreateImageTagsOptionalParameter",
"createImageTagsOptionalParameter",
")",
"{",
"if",
"(",
"projectId",
"==",
... | Associate a set of images with a set of tags.
@param projectId The project id
@param createImageTagsOptionalParameter 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 ImageTagCreateSummary object | [
"Associate",
"a",
"set",
"of",
"images",
"with",
"a",
"set",
"of",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3641-L3651 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ReflectionUtil.java | ReflectionUtil.forEachField | public static void forEachField( final Object object, Class<?> clazz, final FieldPredicate predicate, final FieldAction action ) {
forEachSuperClass( clazz, new ClassAction() {
@Override
public void act( Class<?> clazz ) throws Exception {
for( Field field : clazz.getDeclaredFields() ) {
if( predicate.isTrue( field ) ) {
action.act( object, field );
}
}
}
} );
} | java | public static void forEachField( final Object object, Class<?> clazz, final FieldPredicate predicate, final FieldAction action ) {
forEachSuperClass( clazz, new ClassAction() {
@Override
public void act( Class<?> clazz ) throws Exception {
for( Field field : clazz.getDeclaredFields() ) {
if( predicate.isTrue( field ) ) {
action.act( object, field );
}
}
}
} );
} | [
"public",
"static",
"void",
"forEachField",
"(",
"final",
"Object",
"object",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"FieldPredicate",
"predicate",
",",
"final",
"FieldAction",
"action",
")",
"{",
"forEachSuperClass",
"(",
"clazz",
",",
"new",
"... | Iterates over all fields of the given class and all its super classes
and calls action.act() for the fields that are annotated with the given annotation. | [
"Iterates",
"over",
"all",
"fields",
"of",
"the",
"given",
"class",
"and",
"all",
"its",
"super",
"classes",
"and",
"calls",
"action",
".",
"act",
"()",
"for",
"the",
"fields",
"that",
"are",
"annotated",
"with",
"the",
"given",
"annotation",
"."
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ReflectionUtil.java#L30-L41 |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java | LiveReloadServer.createConnection | protected Connection createConnection(Socket socket, InputStream inputStream,
OutputStream outputStream) throws IOException {
return new Connection(socket, inputStream, outputStream);
} | java | protected Connection createConnection(Socket socket, InputStream inputStream,
OutputStream outputStream) throws IOException {
return new Connection(socket, inputStream, outputStream);
} | [
"protected",
"Connection",
"createConnection",
"(",
"Socket",
"socket",
",",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"return",
"new",
"Connection",
"(",
"socket",
",",
"inputStream",
",",
"outputStream",
... | Factory method used to create the {@link Connection}.
@param socket the source socket
@param inputStream the socket input stream
@param outputStream the socket output stream
@return a connection
@throws IOException in case of I/O errors | [
"Factory",
"method",
"used",
"to",
"create",
"the",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java#L236-L239 |
aspnet/SignalR | clients/java/signalr/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java | HttpHubConnectionBuilder.withHeader | public HttpHubConnectionBuilder withHeader(String name, String value) {
if (headers == null) {
this.headers = new HashMap<>();
}
this.headers.put(name, value);
return this;
} | java | public HttpHubConnectionBuilder withHeader(String name, String value) {
if (headers == null) {
this.headers = new HashMap<>();
}
this.headers.put(name, value);
return this;
} | [
"public",
"HttpHubConnectionBuilder",
"withHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"headers",
"==",
"null",
")",
"{",
"this",
".",
"headers",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"this",
".",
"headers",
... | Sets a single header for the {@link HubConnection} to send.
@param name The name of the header to set.
@param value The value of the header to be set.
@return This instance of the HttpHubConnectionBuilder. | [
"Sets",
"a",
"single",
"header",
"for",
"the",
"{",
"@link",
"HubConnection",
"}",
"to",
"send",
"."
] | train | https://github.com/aspnet/SignalR/blob/8c6ed160d84f58ce8edf06a1c74221ddc8983ee9/clients/java/signalr/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java#L101-L107 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/refer/DependencyResolver.java | DependencyResolver.getOneRequired | public Object getOneRequired(String name) throws ReferenceException {
Object locator = find(name);
if (locator == null)
throw new ReferenceException(null, name);
return _references.getOneRequired(locator);
} | java | public Object getOneRequired(String name) throws ReferenceException {
Object locator = find(name);
if (locator == null)
throw new ReferenceException(null, name);
return _references.getOneRequired(locator);
} | [
"public",
"Object",
"getOneRequired",
"(",
"String",
"name",
")",
"throws",
"ReferenceException",
"{",
"Object",
"locator",
"=",
"find",
"(",
"name",
")",
";",
"if",
"(",
"locator",
"==",
"null",
")",
"throw",
"new",
"ReferenceException",
"(",
"null",
",",
... | Gets one required dependency by its name. At least one dependency must
present. If the dependency was found it throws a ReferenceException
@param name the dependency name to locate.
@return a dependency reference
@throws ReferenceException if dependency was not found. | [
"Gets",
"one",
"required",
"dependency",
"by",
"its",
"name",
".",
"At",
"least",
"one",
"dependency",
"must",
"present",
".",
"If",
"the",
"dependency",
"was",
"found",
"it",
"throws",
"a",
"ReferenceException"
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/DependencyResolver.java#L253-L259 |
asciidoctor/asciidoctorj | asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/internal/JRubyProcessor.java | JRubyProcessor.parseContent | @Override
public void parseContent(StructuralNode parent, List<String> lines) {
Ruby runtime = JRubyRuntimeContext.get(parent);
Parser parser = new Parser(runtime, parent, ReaderImpl.createReader(runtime, lines));
StructuralNode nextBlock = parser.nextBlock();
while (nextBlock != null) {
parent.append(nextBlock);
nextBlock = parser.nextBlock();
}
} | java | @Override
public void parseContent(StructuralNode parent, List<String> lines) {
Ruby runtime = JRubyRuntimeContext.get(parent);
Parser parser = new Parser(runtime, parent, ReaderImpl.createReader(runtime, lines));
StructuralNode nextBlock = parser.nextBlock();
while (nextBlock != null) {
parent.append(nextBlock);
nextBlock = parser.nextBlock();
}
} | [
"@",
"Override",
"public",
"void",
"parseContent",
"(",
"StructuralNode",
"parent",
",",
"List",
"<",
"String",
">",
"lines",
")",
"{",
"Ruby",
"runtime",
"=",
"JRubyRuntimeContext",
".",
"get",
"(",
"parent",
")",
";",
"Parser",
"parser",
"=",
"new",
"Par... | Parses the given raw asciidoctor content, parses it and appends it as children to the given parent block.
<p>The following example will add two paragraphs with the role {@code newcontent} to all top
level sections of a document:
<pre>
<verbatim>
Asciidoctor asciidoctor = ...
asciidoctor.javaExtensionRegistry().treeprocessor(new Treeprocessor() {
DocumentRuby process(DocumentRuby document) {
for (AbstractBlock block: document.getBlocks()) {
if (block instanceof Section) {
parseContent(block, Arrays.asList(new String[]{
"[newcontent]",
"This is new content"
"",
"[newcontent]",
"This is also new content"}));
}
}
}
});
</verbatim>
</pre>
@param parent The block to which the parsed content should be added as children.
@param lines Raw asciidoctor content | [
"Parses",
"the",
"given",
"raw",
"asciidoctor",
"content",
"parses",
"it",
"and",
"appends",
"it",
"as",
"children",
"to",
"the",
"given",
"parent",
"block",
".",
"<p",
">",
"The",
"following",
"example",
"will",
"add",
"two",
"paragraphs",
"with",
"the",
... | train | https://github.com/asciidoctor/asciidoctorj/blob/e348c9a12b54c33fea7b05d70224c007e2ee75a9/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/internal/JRubyProcessor.java#L335-L345 |
xcesco/kripton | kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteUpdateTaskHelper.java | SQLiteUpdateTaskHelper.executeSQL | public static void executeSQL(final SQLiteDatabase database, Context context, int rawResourceId) {
String[] c = IOUtils.readTextFile(context, rawResourceId).split(";");
List<String> commands = Arrays.asList(c);
executeSQL(database, commands);
} | java | public static void executeSQL(final SQLiteDatabase database, Context context, int rawResourceId) {
String[] c = IOUtils.readTextFile(context, rawResourceId).split(";");
List<String> commands = Arrays.asList(c);
executeSQL(database, commands);
} | [
"public",
"static",
"void",
"executeSQL",
"(",
"final",
"SQLiteDatabase",
"database",
",",
"Context",
"context",
",",
"int",
"rawResourceId",
")",
"{",
"String",
"[",
"]",
"c",
"=",
"IOUtils",
".",
"readTextFile",
"(",
"context",
",",
"rawResourceId",
")",
"... | Execute SQL.
@param database
the database
@param context
the context
@param rawResourceId
the raw resource id | [
"Execute",
"SQL",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteUpdateTaskHelper.java#L232-L236 |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.mkManhattanNormAccumulator | public static VectorAccumulator mkManhattanNormAccumulator() {
return new VectorAccumulator() {
private double result = 0.0;
@Override
public void update(int i, double value) {
result += Math.abs(value);
}
@Override
public double accumulate() {
double value = result;
result = 0.0;
return value;
}
};
} | java | public static VectorAccumulator mkManhattanNormAccumulator() {
return new VectorAccumulator() {
private double result = 0.0;
@Override
public void update(int i, double value) {
result += Math.abs(value);
}
@Override
public double accumulate() {
double value = result;
result = 0.0;
return value;
}
};
} | [
"public",
"static",
"VectorAccumulator",
"mkManhattanNormAccumulator",
"(",
")",
"{",
"return",
"new",
"VectorAccumulator",
"(",
")",
"{",
"private",
"double",
"result",
"=",
"0.0",
";",
"@",
"Override",
"public",
"void",
"update",
"(",
"int",
"i",
",",
"doubl... | Makes a Manhattan norm accumulator that allows to use
{@link org.la4j.Vector#fold(org.la4j.vector.functor.VectorAccumulator)} method for norm calculation.
@return a Manhattan norm accumulator | [
"Makes",
"a",
"Manhattan",
"norm",
"accumulator",
"that",
"allows",
"to",
"use",
"{",
"@link",
"org",
".",
"la4j",
".",
"Vector#fold",
"(",
"org",
".",
"la4j",
".",
"vector",
".",
"functor",
".",
"VectorAccumulator",
")",
"}",
"method",
"for",
"norm",
"c... | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L353-L369 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/cellprocessor/constraint/ForbidSubStr.java | ForbidSubStr.execute | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
final String stringValue = value.toString();
for( String forbidden : forbiddenSubStrings ) {
if( stringValue.contains(forbidden) ) {
throw new SuperCsvConstraintViolationException(String.format(
"'%s' contains the forbidden substring '%s'", value, forbidden), context, this);
}
}
return next.execute(value, context);
} | java | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
final String stringValue = value.toString();
for( String forbidden : forbiddenSubStrings ) {
if( stringValue.contains(forbidden) ) {
throw new SuperCsvConstraintViolationException(String.format(
"'%s' contains the forbidden substring '%s'", value, forbidden), context, this);
}
}
return next.execute(value, context);
} | [
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"validateInputNotNull",
"(",
"value",
",",
"context",
")",
";",
"final",
"String",
"stringValue",
"=",
"value",
".",
"toString",
"(",
")",
";",
... | {@inheritDoc}
@throws SuperCsvCellProcessorException
if value is null
@throws SuperCsvConstraintViolationException
if value is in the forbidden list | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/ForbidSubStr.java#L201-L214 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/Triangle.java | Triangle.setPoints | public Triangle setPoints(final Point2D a, final Point2D b, final Point2D c)
{
return setPoint2DArray(new Point2DArray(a, b, c));
} | java | public Triangle setPoints(final Point2D a, final Point2D b, final Point2D c)
{
return setPoint2DArray(new Point2DArray(a, b, c));
} | [
"public",
"Triangle",
"setPoints",
"(",
"final",
"Point2D",
"a",
",",
"final",
"Point2D",
"b",
",",
"final",
"Point2D",
"c",
")",
"{",
"return",
"setPoint2DArray",
"(",
"new",
"Point2DArray",
"(",
"a",
",",
"b",
",",
"c",
")",
")",
";",
"}"
] | Sets this triangles points.
@param 3 points {@link Point2D}
@return this Triangle | [
"Sets",
"this",
"triangles",
"points",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Triangle.java#L150-L153 |
alkacon/opencms-core | src/org/opencms/notification/CmsPublishNotification.java | CmsPublishNotification.appendList | private void appendList(StringBuffer buffer, List<Object> list) {
Iterator<Object> iter = list.iterator();
while (iter.hasNext()) {
Object entry = iter.next();
buffer.append(entry).append("<br/>\n");
}
} | java | private void appendList(StringBuffer buffer, List<Object> list) {
Iterator<Object> iter = list.iterator();
while (iter.hasNext()) {
Object entry = iter.next();
buffer.append(entry).append("<br/>\n");
}
} | [
"private",
"void",
"appendList",
"(",
"StringBuffer",
"buffer",
",",
"List",
"<",
"Object",
">",
"list",
")",
"{",
"Iterator",
"<",
"Object",
">",
"iter",
"=",
"list",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")... | Appends the contents of a list to the buffer with every entry in a new line.<p>
@param buffer The buffer were the entries of the list will be appended.
@param list The list with the entries to append to the buffer. | [
"Appends",
"the",
"contents",
"of",
"a",
"list",
"to",
"the",
"buffer",
"with",
"every",
"entry",
"in",
"a",
"new",
"line",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/notification/CmsPublishNotification.java#L112-L119 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/decoder/DefaultImageDecoder.java | DefaultImageDecoder.decodeGif | public CloseableImage decodeGif(
final EncodedImage encodedImage,
final int length,
final QualityInfo qualityInfo,
final ImageDecodeOptions options) {
if (!options.forceStaticImage && mAnimatedGifDecoder != null) {
return mAnimatedGifDecoder.decode(encodedImage, length, qualityInfo, options);
}
return decodeStaticImage(encodedImage, options);
} | java | public CloseableImage decodeGif(
final EncodedImage encodedImage,
final int length,
final QualityInfo qualityInfo,
final ImageDecodeOptions options) {
if (!options.forceStaticImage && mAnimatedGifDecoder != null) {
return mAnimatedGifDecoder.decode(encodedImage, length, qualityInfo, options);
}
return decodeStaticImage(encodedImage, options);
} | [
"public",
"CloseableImage",
"decodeGif",
"(",
"final",
"EncodedImage",
"encodedImage",
",",
"final",
"int",
"length",
",",
"final",
"QualityInfo",
"qualityInfo",
",",
"final",
"ImageDecodeOptions",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"forceStaticI... | Decodes gif into CloseableImage.
@param encodedImage input image (encoded bytes plus meta data)
@return a CloseableImage | [
"Decodes",
"gif",
"into",
"CloseableImage",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/decoder/DefaultImageDecoder.java#L130-L139 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_account_accountName_migrate_destinationServiceName_GET | public OvhMigrationService domain_account_accountName_migrate_destinationServiceName_GET(String domain, String accountName, String destinationServiceName) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}";
StringBuilder sb = path(qPath, domain, accountName, destinationServiceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhMigrationService.class);
} | java | public OvhMigrationService domain_account_accountName_migrate_destinationServiceName_GET(String domain, String accountName, String destinationServiceName) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}";
StringBuilder sb = path(qPath, domain, accountName, destinationServiceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhMigrationService.class);
} | [
"public",
"OvhMigrationService",
"domain_account_accountName_migrate_destinationServiceName_GET",
"(",
"String",
"domain",
",",
"String",
"accountName",
",",
"String",
"destinationServiceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}... | Get this object properties
REST: GET /email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}
@param domain [required] Name of your domain name
@param accountName [required] Name of account
@param destinationServiceName [required] Service name allowed as migration destination
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L449-L454 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CopyOnWriteArrayList.java | CopyOnWriteArrayList.removeOrRetain | private int removeOrRetain(Collection<?> collection, boolean retain, int from, int to) {
for (int i = from; i < to; i++) {
if (collection.contains(elements[i]) == retain) {
continue;
}
/*
* We've encountered an element that must be removed! Create a new
* array and copy in the surviving elements one by one.
*/
Object[] newElements = new Object[elements.length - 1];
System.arraycopy(elements, 0, newElements, 0, i);
int newSize = i;
for (int j = i + 1; j < to; j++) {
if (collection.contains(elements[j]) == retain) {
newElements[newSize++] = elements[j];
}
}
/*
* Copy the elements after 'to'. This is only useful for sub lists,
* where 'to' will be less than elements.length.
*/
System.arraycopy(elements, to, newElements, newSize, elements.length - to);
newSize += (elements.length - to);
if (newSize < newElements.length) {
newElements = Arrays.copyOfRange(newElements, 0, newSize); // trim to size
}
int removed = elements.length - newElements.length;
elements = newElements;
return removed;
}
// we made it all the way through the loop without making any changes
return 0;
} | java | private int removeOrRetain(Collection<?> collection, boolean retain, int from, int to) {
for (int i = from; i < to; i++) {
if (collection.contains(elements[i]) == retain) {
continue;
}
/*
* We've encountered an element that must be removed! Create a new
* array and copy in the surviving elements one by one.
*/
Object[] newElements = new Object[elements.length - 1];
System.arraycopy(elements, 0, newElements, 0, i);
int newSize = i;
for (int j = i + 1; j < to; j++) {
if (collection.contains(elements[j]) == retain) {
newElements[newSize++] = elements[j];
}
}
/*
* Copy the elements after 'to'. This is only useful for sub lists,
* where 'to' will be less than elements.length.
*/
System.arraycopy(elements, to, newElements, newSize, elements.length - to);
newSize += (elements.length - to);
if (newSize < newElements.length) {
newElements = Arrays.copyOfRange(newElements, 0, newSize); // trim to size
}
int removed = elements.length - newElements.length;
elements = newElements;
return removed;
}
// we made it all the way through the loop without making any changes
return 0;
} | [
"private",
"int",
"removeOrRetain",
"(",
"Collection",
"<",
"?",
">",
"collection",
",",
"boolean",
"retain",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"from",
";",
"i",
"<",
"to",
";",
"i",
"++",
")",
"{",
"if"... | Removes or retains the elements in {@code collection}. Returns the number
of elements removed. | [
"Removes",
"or",
"retains",
"the",
"elements",
"in",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CopyOnWriteArrayList.java#L435-L471 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCConnection.java | JDBCConnection.onStartEscapeSequence | private int onStartEscapeSequence(String sql, StringBuffer sb,
int i) throws SQLException {
sb.setCharAt(i++, ' ');
i = StringUtil.skipSpaces(sql, i);
if (sql.regionMatches(true, i, "fn ", 0, 3)
|| sql.regionMatches(true, i, "oj ", 0, 3)
|| sql.regionMatches(true, i, "ts ", 0, 3)) {
sb.setCharAt(i++, ' ');
sb.setCharAt(i++, ' ');
} else if (sql.regionMatches(true, i, "d ", 0, 2)
|| sql.regionMatches(true, i, "t ", 0, 2)) {
sb.setCharAt(i++, ' ');
} else if (sql.regionMatches(true, i, "call ", 0, 5)) {
i += 4;
} else if (sql.regionMatches(true, i, "?= call ", 0, 8)) {
sb.setCharAt(i++, ' ');
sb.setCharAt(i++, ' ');
i += 5;
} else if (sql.regionMatches(true, i, "escape ", 0, 7)) {
i += 6;
} else {
i--;
throw Util.sqlException(
Error.error(
ErrorCode.JDBC_CONNECTION_NATIVE_SQL, sql.substring(i)));
}
return i;
} | java | private int onStartEscapeSequence(String sql, StringBuffer sb,
int i) throws SQLException {
sb.setCharAt(i++, ' ');
i = StringUtil.skipSpaces(sql, i);
if (sql.regionMatches(true, i, "fn ", 0, 3)
|| sql.regionMatches(true, i, "oj ", 0, 3)
|| sql.regionMatches(true, i, "ts ", 0, 3)) {
sb.setCharAt(i++, ' ');
sb.setCharAt(i++, ' ');
} else if (sql.regionMatches(true, i, "d ", 0, 2)
|| sql.regionMatches(true, i, "t ", 0, 2)) {
sb.setCharAt(i++, ' ');
} else if (sql.regionMatches(true, i, "call ", 0, 5)) {
i += 4;
} else if (sql.regionMatches(true, i, "?= call ", 0, 8)) {
sb.setCharAt(i++, ' ');
sb.setCharAt(i++, ' ');
i += 5;
} else if (sql.regionMatches(true, i, "escape ", 0, 7)) {
i += 6;
} else {
i--;
throw Util.sqlException(
Error.error(
ErrorCode.JDBC_CONNECTION_NATIVE_SQL, sql.substring(i)));
}
return i;
} | [
"private",
"int",
"onStartEscapeSequence",
"(",
"String",
"sql",
",",
"StringBuffer",
"sb",
",",
"int",
"i",
")",
"throws",
"SQLException",
"{",
"sb",
".",
"setCharAt",
"(",
"i",
"++",
",",
"'",
"'",
")",
";",
"i",
"=",
"StringUtil",
".",
"skipSpaces",
... | is called from within nativeSQL when the start of an JDBC escape sequence is encountered | [
"is",
"called",
"from",
"within",
"nativeSQL",
"when",
"the",
"start",
"of",
"an",
"JDBC",
"escape",
"sequence",
"is",
"encountered"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCConnection.java#L3470-L3503 |
beanshell/beanshell | src/main/java/bsh/Types.java | Types.isJavaAssignable | static boolean isJavaAssignable( Class lhsType, Class rhsType ) {
return isJavaBaseAssignable( lhsType, rhsType )
|| isJavaBoxTypesAssignable( lhsType, rhsType );
} | java | static boolean isJavaAssignable( Class lhsType, Class rhsType ) {
return isJavaBaseAssignable( lhsType, rhsType )
|| isJavaBoxTypesAssignable( lhsType, rhsType );
} | [
"static",
"boolean",
"isJavaAssignable",
"(",
"Class",
"lhsType",
",",
"Class",
"rhsType",
")",
"{",
"return",
"isJavaBaseAssignable",
"(",
"lhsType",
",",
"rhsType",
")",
"||",
"isJavaBoxTypesAssignable",
"(",
"lhsType",
",",
"rhsType",
")",
";",
"}"
] | Test if a conversion of the rhsType type to the lhsType type is legal via
standard Java assignment conversion rules (i.e. without a cast).
The rules include Java 5 autoboxing/unboxing.
<p/>
For Java primitive TYPE classes this method takes primitive promotion
into account. The ordinary Class.isAssignableFrom() does not take
primitive promotion conversions into account. Note that Java allows
additional assignments without a cast in combination with variable
declarations and array allocations. Those are handled elsewhere
(maybe should be here with a flag?)
<p/>
This class accepts a null rhsType type indicating that the rhsType was the
value Primitive.NULL and allows it to be assigned to any reference lhsType
type (non primitive).
<p/>
Note that the getAssignableForm() method is the primary bsh method for
checking assignability. It adds additional bsh conversions, etc.
@see #isBshAssignable( Class, Class )
@param lhsType assigning from rhsType to lhsType
@param rhsType assigning from rhsType to lhsType | [
"Test",
"if",
"a",
"conversion",
"of",
"the",
"rhsType",
"type",
"to",
"the",
"lhsType",
"type",
"is",
"legal",
"via",
"standard",
"Java",
"assignment",
"conversion",
"rules",
"(",
"i",
".",
"e",
".",
"without",
"a",
"cast",
")",
".",
"The",
"rules",
"... | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Types.java#L288-L291 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java | PyExpressionGenerator._generate | @SuppressWarnings("static-method")
protected XExpression _generate(XNullLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) {
appendReturnIfExpectedReturnedExpression(it, context);
it.append("None"); //$NON-NLS-1$
return literal;
} | java | @SuppressWarnings("static-method")
protected XExpression _generate(XNullLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) {
appendReturnIfExpectedReturnedExpression(it, context);
it.append("None"); //$NON-NLS-1$
return literal;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"XExpression",
"_generate",
"(",
"XNullLiteral",
"literal",
",",
"IAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"appendReturnIfExpectedReturnedExpression",
"(",
"it",
",... | Generate the given object.
@param literal the null literal.
@param it the target for the generated content.
@param context the context.
@return the literal. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L798-L803 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/spi/MoneyUtils.java | MoneyUtils.getBigDecimal | public static BigDecimal getBigDecimal(Number num, MonetaryContext moneyContext) {
BigDecimal bd = getBigDecimal(num);
if (moneyContext!=null) {
MathContext mc = getMathContext(moneyContext, RoundingMode.HALF_EVEN);
bd = new BigDecimal(bd.toString(), mc);
if (moneyContext.getMaxScale() > 0) {
LOG.fine(String.format("Got Max Scale %s", moneyContext.getMaxScale()));
bd = bd.setScale(moneyContext.getMaxScale(), mc.getRoundingMode());
}
}
return bd;
} | java | public static BigDecimal getBigDecimal(Number num, MonetaryContext moneyContext) {
BigDecimal bd = getBigDecimal(num);
if (moneyContext!=null) {
MathContext mc = getMathContext(moneyContext, RoundingMode.HALF_EVEN);
bd = new BigDecimal(bd.toString(), mc);
if (moneyContext.getMaxScale() > 0) {
LOG.fine(String.format("Got Max Scale %s", moneyContext.getMaxScale()));
bd = bd.setScale(moneyContext.getMaxScale(), mc.getRoundingMode());
}
}
return bd;
} | [
"public",
"static",
"BigDecimal",
"getBigDecimal",
"(",
"Number",
"num",
",",
"MonetaryContext",
"moneyContext",
")",
"{",
"BigDecimal",
"bd",
"=",
"getBigDecimal",
"(",
"num",
")",
";",
"if",
"(",
"moneyContext",
"!=",
"null",
")",
"{",
"MathContext",
"mc",
... | Creates a {@link BigDecimal} from the given {@link Number} doing the
valid conversion depending the type given, if a {@link MonetaryContext}
is given, it is applied to the number returned.
@param num the number type
@return the corresponding {@link BigDecimal} | [
"Creates",
"a",
"{",
"@link",
"BigDecimal",
"}",
"from",
"the",
"given",
"{",
"@link",
"Number",
"}",
"doing",
"the",
"valid",
"conversion",
"depending",
"the",
"type",
"given",
"if",
"a",
"{",
"@link",
"MonetaryContext",
"}",
"is",
"given",
"it",
"is",
... | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/MoneyUtils.java#L96-L107 |
Alexey1Gavrilov/ExpectIt | expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java | Matchers.eof | public static Matcher<Result> eof() {
return new Matcher<Result>() {
@Override
public Result matches(String input, boolean isEof) {
return isEof ? success(input, input, "") : failure(input, false);
}
@Override
public String toString() {
return "eof";
}
};
} | java | public static Matcher<Result> eof() {
return new Matcher<Result>() {
@Override
public Result matches(String input, boolean isEof) {
return isEof ? success(input, input, "") : failure(input, false);
}
@Override
public String toString() {
return "eof";
}
};
} | [
"public",
"static",
"Matcher",
"<",
"Result",
">",
"eof",
"(",
")",
"{",
"return",
"new",
"Matcher",
"<",
"Result",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Result",
"matches",
"(",
"String",
"input",
",",
"boolean",
"isEof",
")",
"{",
"return",... | Creates a matcher that matches if input reaches the end of stream.
<p/>
If succeeded, the {@link net.sf.expectit.Result#getBefore()} will return the entire input
buffer, and
the {@link net.sf.expectit.Result#group()} returns an empty string.
@return the matcher | [
"Creates",
"a",
"matcher",
"that",
"matches",
"if",
"input",
"reaches",
"the",
"end",
"of",
"stream",
".",
"<p",
"/",
">",
"If",
"succeeded",
"the",
"{",
"@link",
"net",
".",
"sf",
".",
"expectit",
".",
"Result#getBefore",
"()",
"}",
"will",
"return",
... | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java#L206-L218 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Camera.java | Camera.setView | public void setView(int x, int y, int width, int height, int screenHeight)
{
this.x = x;
this.y = y;
this.width = UtilMath.clamp(width, 0, Integer.MAX_VALUE);
this.height = UtilMath.clamp(height, 0, Integer.MAX_VALUE);
this.screenHeight = screenHeight;
} | java | public void setView(int x, int y, int width, int height, int screenHeight)
{
this.x = x;
this.y = y;
this.width = UtilMath.clamp(width, 0, Integer.MAX_VALUE);
this.height = UtilMath.clamp(height, 0, Integer.MAX_VALUE);
this.screenHeight = screenHeight;
} | [
"public",
"void",
"setView",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
",",
"int",
"screenHeight",
")",
"{",
"this",
".",
"x",
"=",
"x",
";",
"this",
".",
"y",
"=",
"y",
";",
"this",
".",
"width",
"=",
"UtilMa... | Define the rendering area. Useful to apply an offset during rendering, in order to avoid hiding part.
<p>
For example:
</p>
<ul>
<li>If the view set is <code>(0, 0, 320, 240)</code>, and the tile size is <code>16</code>, then
<code>20</code> horizontal tiles and <code>15</code> vertical tiles will be rendered from <code>0, 0</code>
(screen top-left).</li>
<li>If the view set is <code>(64, 64, 240, 160)</code>, and the tile size is <code>16</code>, then
<code>15</code> horizontal tiles and <code>10</code> vertical tiles will be rendered from <code>64, 64</code>
(screen top-left).</li>
</ul>
<p>
It is also compatible with object rendering (by using an {@link com.b3dgs.lionengine.game.feature.Handler}). The
object which is outside the camera view will not be rendered. This avoid useless rendering.
</p>
<p>
Note: The rendering view is from the camera location. So <code>x</code> and <code>y</code> are an offset from
this location.
</p>
@param x The horizontal offset.
@param y The vertical offset.
@param width The rendering width (positive value).
@param height The rendering height (positive value).
@param screenHeight The screen height. | [
"Define",
"the",
"rendering",
"area",
".",
"Useful",
"to",
"apply",
"an",
"offset",
"during",
"rendering",
"in",
"order",
"to",
"avoid",
"hiding",
"part",
".",
"<p",
">",
"For",
"example",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"If",
"the",... | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Camera.java#L216-L223 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java | GVRAssetLoader.loadTexture | public GVRTexture loadTexture(GVRAndroidResource resource,
GVRTextureParameters textureParameters)
{
GVRTexture texture = new GVRTexture(mContext, textureParameters);
TextureRequest request = new TextureRequest(resource, texture);
GVRAsynchronousResourceLoader.loadTexture(mContext, mTextureCache,
request, resource, DEFAULT_PRIORITY, GVRCompressedImage.BALANCED);
return texture;
} | java | public GVRTexture loadTexture(GVRAndroidResource resource,
GVRTextureParameters textureParameters)
{
GVRTexture texture = new GVRTexture(mContext, textureParameters);
TextureRequest request = new TextureRequest(resource, texture);
GVRAsynchronousResourceLoader.loadTexture(mContext, mTextureCache,
request, resource, DEFAULT_PRIORITY, GVRCompressedImage.BALANCED);
return texture;
} | [
"public",
"GVRTexture",
"loadTexture",
"(",
"GVRAndroidResource",
"resource",
",",
"GVRTextureParameters",
"textureParameters",
")",
"{",
"GVRTexture",
"texture",
"=",
"new",
"GVRTexture",
"(",
"mContext",
",",
"textureParameters",
")",
";",
"TextureRequest",
"request",... | Loads file placed in the assets folder, as a {@link GVRBitmapImage}
with the user provided texture parameters.
The bitmap is loaded asynchronously.
<p>
This method automatically scales large images to fit the GPU's
restrictions and to avoid {@linkplain OutOfMemoryError out of memory
errors.}
@param resource
A stream containing a bitmap texture. The
{@link GVRAndroidResource} class has six constructors to
handle a wide variety of Android resource types. Taking a
{@code GVRAndroidResource} here eliminates six overloads.
@param textureParameters
The texture parameter object which has all the values that
were provided by the user for texture enhancement. The
{@link GVRTextureParameters} class has methods to set all the
texture filters and wrap states. If this parameter is nullo,
default texture parameters are used.
@return The file as a texture, or {@code null} if the file can not be
decoded into a Bitmap.
@see GVRAssetLoader#getDefaultTextureParameters | [
"Loads",
"file",
"placed",
"in",
"the",
"assets",
"folder",
"as",
"a",
"{",
"@link",
"GVRBitmapImage",
"}",
"with",
"the",
"user",
"provided",
"texture",
"parameters",
".",
"The",
"bitmap",
"is",
"loaded",
"asynchronously",
".",
"<p",
">",
"This",
"method",
... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java#L658-L666 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.beginUpdate | public DataMigrationServiceInner beginUpdate(String groupName, String serviceName, DataMigrationServiceInner parameters) {
return beginUpdateWithServiceResponseAsync(groupName, serviceName, parameters).toBlocking().single().body();
} | java | public DataMigrationServiceInner beginUpdate(String groupName, String serviceName, DataMigrationServiceInner parameters) {
return beginUpdateWithServiceResponseAsync(groupName, serviceName, parameters).toBlocking().single().body();
} | [
"public",
"DataMigrationServiceInner",
"beginUpdate",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
",",
"DataMigrationServiceInner",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
",",
"parameters"... | Create or update DMS Service Instance.
The services resource is the top-level resource that represents the Data Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy").
@param groupName Name of the resource group
@param serviceName Name of the service
@param parameters Information about the service
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DataMigrationServiceInner object if successful. | [
"Create",
"or",
"update",
"DMS",
"Service",
"Instance",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"The",
"PATCH",
"method",
"updates",
"an",
"existing",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L842-L844 |
belaban/JGroups | src/org/jgroups/util/Bits.java | Bits.writeString | public static void writeString(String s, ByteBuffer buf) {
buf.put((byte)(s != null? 1 : 0));
if(s != null) {
byte[] bytes=s.getBytes();
writeInt(bytes.length, buf);
buf.put(bytes);
}
} | java | public static void writeString(String s, ByteBuffer buf) {
buf.put((byte)(s != null? 1 : 0));
if(s != null) {
byte[] bytes=s.getBytes();
writeInt(bytes.length, buf);
buf.put(bytes);
}
} | [
"public",
"static",
"void",
"writeString",
"(",
"String",
"s",
",",
"ByteBuffer",
"buf",
")",
"{",
"buf",
".",
"put",
"(",
"(",
"byte",
")",
"(",
"s",
"!=",
"null",
"?",
"1",
":",
"0",
")",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"b... | Writes a string to buf. The length of the string is written first, followed by the chars (as single-byte values).
Multi-byte values are truncated: only the lower byte of each multi-byte char is written, similar to
{@link DataOutput#writeChars(String)}.
@param s the string
@param buf the buffer | [
"Writes",
"a",
"string",
"to",
"buf",
".",
"The",
"length",
"of",
"the",
"string",
"is",
"written",
"first",
"followed",
"by",
"the",
"chars",
"(",
"as",
"single",
"-",
"byte",
"values",
")",
".",
"Multi",
"-",
"byte",
"values",
"are",
"truncated",
":"... | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L600-L607 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java | PoiWorkSheet.createTitleCells | public void createTitleCells(double width, String... strs) {
for (String s : strs) {
this.createTitleCell(s, width);
}
} | java | public void createTitleCells(double width, String... strs) {
for (String s : strs) {
this.createTitleCell(s, width);
}
} | [
"public",
"void",
"createTitleCells",
"(",
"double",
"width",
",",
"String",
"...",
"strs",
")",
"{",
"for",
"(",
"String",
"s",
":",
"strs",
")",
"{",
"this",
".",
"createTitleCell",
"(",
"s",
",",
"width",
")",
";",
"}",
"}"
] | Create title cells.
@param width the width
@param strs the strs | [
"Create",
"title",
"cells",
"."
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java#L121-L125 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserRte.java | AbstractGpxParserRte.initialise | public void initialise(XMLReader reader, AbstractGpxParserDefault parent) {
setReader(reader);
setParent(parent);
setContentBuffer(parent.getContentBuffer());
setRtePreparedStmt(parent.getRtePreparedStmt());
setRteptPreparedStmt(parent.getRteptPreparedStmt());
setElementNames(parent.getElementNames());
setCurrentLine(parent.getCurrentLine());
setRteList(new ArrayList<Coordinate>());
} | java | public void initialise(XMLReader reader, AbstractGpxParserDefault parent) {
setReader(reader);
setParent(parent);
setContentBuffer(parent.getContentBuffer());
setRtePreparedStmt(parent.getRtePreparedStmt());
setRteptPreparedStmt(parent.getRteptPreparedStmt());
setElementNames(parent.getElementNames());
setCurrentLine(parent.getCurrentLine());
setRteList(new ArrayList<Coordinate>());
} | [
"public",
"void",
"initialise",
"(",
"XMLReader",
"reader",
",",
"AbstractGpxParserDefault",
"parent",
")",
"{",
"setReader",
"(",
"reader",
")",
";",
"setParent",
"(",
"parent",
")",
";",
"setContentBuffer",
"(",
"parent",
".",
"getContentBuffer",
"(",
")",
"... | Create a new specific parser. It has in memory the default parser, the
contentBuffer, the elementNames, the currentLine and the rteID.
@param reader The XMLReader used in the default class
@param parent The parser used in the default class | [
"Create",
"a",
"new",
"specific",
"parser",
".",
"It",
"has",
"in",
"memory",
"the",
"default",
"parser",
"the",
"contentBuffer",
"the",
"elementNames",
"the",
"currentLine",
"and",
"the",
"rteID",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserRte.java#L58-L67 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/BatchOperation.java | BatchOperation.addQuery | public void addQuery(String query, String bId) {
BatchItemRequest batchItemRequest = new BatchItemRequest();
batchItemRequest.setBId(bId);
batchItemRequest.setQuery(query);
batchItemRequests.add(batchItemRequest);
bIds.add(bId);
} | java | public void addQuery(String query, String bId) {
BatchItemRequest batchItemRequest = new BatchItemRequest();
batchItemRequest.setBId(bId);
batchItemRequest.setQuery(query);
batchItemRequests.add(batchItemRequest);
bIds.add(bId);
} | [
"public",
"void",
"addQuery",
"(",
"String",
"query",
",",
"String",
"bId",
")",
"{",
"BatchItemRequest",
"batchItemRequest",
"=",
"new",
"BatchItemRequest",
"(",
")",
";",
"batchItemRequest",
".",
"setBId",
"(",
"bId",
")",
";",
"batchItemRequest",
".",
"setQ... | Method to add the query batch operation to batchItemRequest
@param query the query
@param bId the batch Id | [
"Method",
"to",
"add",
"the",
"query",
"batch",
"operation",
"to",
"batchItemRequest"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/BatchOperation.java#L112-L120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.