repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.jndi.url.contexts/src/com/ibm/ws/jndi/url/contexts/javacolon/internal/JavaURLContextFactory.java | JavaURLContextFactory.createJavaURLContext | JavaURLContext createJavaURLContext(Hashtable<?, ?> envmt, Name name) {
return new JavaURLContext(envmt, helperServices, name);
} | java | JavaURLContext createJavaURLContext(Hashtable<?, ?> envmt, Name name) {
return new JavaURLContext(envmt, helperServices, name);
} | [
"JavaURLContext",
"createJavaURLContext",
"(",
"Hashtable",
"<",
"?",
",",
"?",
">",
"envmt",
",",
"Name",
"name",
")",
"{",
"return",
"new",
"JavaURLContext",
"(",
"envmt",
",",
"helperServices",
",",
"name",
")",
";",
"}"
] | This method should only be called by the JavaURLContextReplacer class for
de-serializing an instance of JavaURLContext. The name parameter can be
null. | [
"This",
"method",
"should",
"only",
"be",
"called",
"by",
"the",
"JavaURLContextReplacer",
"class",
"for",
"de",
"-",
"serializing",
"an",
"instance",
"of",
"JavaURLContext",
".",
"The",
"name",
"parameter",
"can",
"be",
"null",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi.url.contexts/src/com/ibm/ws/jndi/url/contexts/javacolon/internal/JavaURLContextFactory.java#L103-L105 |
Talend/tesb-rt-se | policies/correlationid-policy/src/main/java/org/talend/esb/policy/correlation/impl/CorrelationIdSoapCodec.java | CorrelationIdSoapCodec.writeCorrelationId | public static void writeCorrelationId(Message message, String correlationId) {
if (!(message instanceof SoapMessage)) {
return;
}
SoapMessage soapMessage = (SoapMessage) message;
Header hdCorrelationId = soapMessage.getHeader(CORRELATION_ID_QNAME);
if (hdCorrelationId != null) {
LOG.warning("CorrelationId already existing in soap header, need not to write CorrelationId header.");
return;
}
if ((soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) != null)
&& (soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) instanceof SAAJStreamWriter)
&& (((SAAJStreamWriter) soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class))
.getDocument()
.getElementsByTagNameNS("http://www.talend.com/esb/sam/correlationId/v1",
"correlationId").getLength() > 0)) {
LOG.warning("CorrelationId already existing in soap header, need not to write CorrelationId header.");
return;
}
try {
soapMessage.getHeaders().add(
new Header(CORRELATION_ID_QNAME, correlationId, new JAXBDataBinding(String.class)));
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Stored correlationId '" + correlationId + "' in soap header: "
+ CORRELATION_ID_QNAME);
}
} catch (JAXBException e) {
LOG.log(Level.SEVERE, "Couldn't create correlationId header.", e);
}
} | java | public static void writeCorrelationId(Message message, String correlationId) {
if (!(message instanceof SoapMessage)) {
return;
}
SoapMessage soapMessage = (SoapMessage) message;
Header hdCorrelationId = soapMessage.getHeader(CORRELATION_ID_QNAME);
if (hdCorrelationId != null) {
LOG.warning("CorrelationId already existing in soap header, need not to write CorrelationId header.");
return;
}
if ((soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) != null)
&& (soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) instanceof SAAJStreamWriter)
&& (((SAAJStreamWriter) soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class))
.getDocument()
.getElementsByTagNameNS("http://www.talend.com/esb/sam/correlationId/v1",
"correlationId").getLength() > 0)) {
LOG.warning("CorrelationId already existing in soap header, need not to write CorrelationId header.");
return;
}
try {
soapMessage.getHeaders().add(
new Header(CORRELATION_ID_QNAME, correlationId, new JAXBDataBinding(String.class)));
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Stored correlationId '" + correlationId + "' in soap header: "
+ CORRELATION_ID_QNAME);
}
} catch (JAXBException e) {
LOG.log(Level.SEVERE, "Couldn't create correlationId header.", e);
}
} | [
"public",
"static",
"void",
"writeCorrelationId",
"(",
"Message",
"message",
",",
"String",
"correlationId",
")",
"{",
"if",
"(",
"!",
"(",
"message",
"instanceof",
"SoapMessage",
")",
")",
"{",
"return",
";",
"}",
"SoapMessage",
"soapMessage",
"=",
"(",
"So... | Write correlation id to message.
@param message the message
@param correlationId the correlation id | [
"Write",
"correlation",
"id",
"to",
"message",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/policies/correlationid-policy/src/main/java/org/talend/esb/policy/correlation/impl/CorrelationIdSoapCodec.java#L83-L114 |
lambdazen/bitsy | src/main/java/com/lambdazen/bitsy/store/Record.java | Record.generateEdgeLine | public static void generateEdgeLine(StringWriter sw, ObjectMapper mapper, EdgeBean eBean) throws JsonGenerationException, JsonMappingException, IOException {
sw.getBuffer().setLength(0);
sw.append('E'); // Record type
sw.append('=');
mapper.writeValue(sw, eBean);
sw.append('#');
int hashCode = sw.toString().hashCode();
sw.append(toHex(hashCode));
sw.append('\n');
} | java | public static void generateEdgeLine(StringWriter sw, ObjectMapper mapper, EdgeBean eBean) throws JsonGenerationException, JsonMappingException, IOException {
sw.getBuffer().setLength(0);
sw.append('E'); // Record type
sw.append('=');
mapper.writeValue(sw, eBean);
sw.append('#');
int hashCode = sw.toString().hashCode();
sw.append(toHex(hashCode));
sw.append('\n');
} | [
"public",
"static",
"void",
"generateEdgeLine",
"(",
"StringWriter",
"sw",
",",
"ObjectMapper",
"mapper",
",",
"EdgeBean",
"eBean",
")",
"throws",
"JsonGenerationException",
",",
"JsonMappingException",
",",
"IOException",
"{",
"sw",
".",
"getBuffer",
"(",
")",
".... | Efficient method to write an edge -- avoids writeValueAsString | [
"Efficient",
"method",
"to",
"write",
"an",
"edge",
"--",
"avoids",
"writeValueAsString"
] | train | https://github.com/lambdazen/bitsy/blob/c0dd4b6c9d6dc9987d0168c91417eb04d80bf712/src/main/java/com/lambdazen/bitsy/store/Record.java#L87-L100 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUserSegmentRelPersistenceImpl.java | CommerceDiscountUserSegmentRelPersistenceImpl.findAll | @Override
public List<CommerceDiscountUserSegmentRel> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceDiscountUserSegmentRel> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountUserSegmentRel",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce discount user segment rels.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountUserSegmentRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce discount user segment rels
@param end the upper bound of the range of commerce discount user segment rels (not inclusive)
@return the range of commerce discount user segment rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"discount",
"user",
"segment",
"rels",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUserSegmentRelPersistenceImpl.java#L1745-L1748 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/reflect/Array.java | Array.newInstance | public static Object newInstance(Class<?> componentType, int... dimensions)
throws IllegalArgumentException, NegativeArraySizeException {
if (dimensions.length <= 0 || dimensions.length > 255) {
throw new IllegalArgumentException("Bad number of dimensions: " + dimensions.length);
}
if (componentType == void.class) {
throw new IllegalArgumentException("Can't allocate an array of void");
}
if (componentType == null) {
throw new NullPointerException("componentType == null");
}
return createMultiArray(componentType, dimensions);
} | java | public static Object newInstance(Class<?> componentType, int... dimensions)
throws IllegalArgumentException, NegativeArraySizeException {
if (dimensions.length <= 0 || dimensions.length > 255) {
throw new IllegalArgumentException("Bad number of dimensions: " + dimensions.length);
}
if (componentType == void.class) {
throw new IllegalArgumentException("Can't allocate an array of void");
}
if (componentType == null) {
throw new NullPointerException("componentType == null");
}
return createMultiArray(componentType, dimensions);
} | [
"public",
"static",
"Object",
"newInstance",
"(",
"Class",
"<",
"?",
">",
"componentType",
",",
"int",
"...",
"dimensions",
")",
"throws",
"IllegalArgumentException",
",",
"NegativeArraySizeException",
"{",
"if",
"(",
"dimensions",
".",
"length",
"<=",
"0",
"||"... | Creates a new array
with the specified component type and dimensions.
If {@code componentType}
represents a non-array class or interface, the new array
has {@code dimensions.length} dimensions and
{@code componentType} as its component type. If
{@code componentType} represents an array class, the
number of dimensions of the new array is equal to the sum
of {@code dimensions.length} and the number of
dimensions of {@code componentType}. In this case, the
component type of the new array is the component type of
{@code componentType}.
<p>The number of dimensions of the new array must not
exceed 255.
@param componentType the {@code Class} object representing the component
type of the new array
@param dimensions an array of {@code int} representing the dimensions of
the new array
@return the new array
@exception NullPointerException if the specified
{@code componentType} argument is null
@exception IllegalArgumentException if the specified {@code dimensions}
argument is a zero-dimensional array, if componentType is {@link
Void#TYPE}, or if the number of dimensions of the requested array
instance exceed 255.
@exception NegativeArraySizeException if any of the components in
the specified {@code dimensions} argument is negative. | [
"Creates",
"a",
"new",
"array",
"with",
"the",
"specified",
"component",
"type",
"and",
"dimensions",
".",
"If",
"{",
"@code",
"componentType",
"}",
"represents",
"a",
"non",
"-",
"array",
"class",
"or",
"interface",
"the",
"new",
"array",
"has",
"{",
"@co... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/reflect/Array.java#L109-L121 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.getReadOnlyKeysAsync | public Observable<DatabaseAccountListReadOnlyKeysResultInner> getReadOnlyKeysAsync(String resourceGroupName, String accountName) {
return getReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<DatabaseAccountListReadOnlyKeysResultInner>, DatabaseAccountListReadOnlyKeysResultInner>() {
@Override
public DatabaseAccountListReadOnlyKeysResultInner call(ServiceResponse<DatabaseAccountListReadOnlyKeysResultInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseAccountListReadOnlyKeysResultInner> getReadOnlyKeysAsync(String resourceGroupName, String accountName) {
return getReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<DatabaseAccountListReadOnlyKeysResultInner>, DatabaseAccountListReadOnlyKeysResultInner>() {
@Override
public DatabaseAccountListReadOnlyKeysResultInner call(ServiceResponse<DatabaseAccountListReadOnlyKeysResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseAccountListReadOnlyKeysResultInner",
">",
"getReadOnlyKeysAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"getReadOnlyKeysWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",... | Lists the read-only access keys for the specified Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseAccountListReadOnlyKeysResultInner object | [
"Lists",
"the",
"read",
"-",
"only",
"access",
"keys",
"for",
"the",
"specified",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1653-L1660 |
Jasig/resource-server | resource-server-core/src/main/java/org/jasig/resource/aggr/ResourcesAggregatorImpl.java | ResourcesAggregatorImpl.findFile | protected File findFile(final List<File> sourceDirectories, String resourceFileName) throws IOException {
for (final File sourceDirectory : sourceDirectories) {
final File resourceFile = new File(sourceDirectory, resourceFileName);
if (resourceFile.exists()) {
return resourceFile;
}
}
throw new IOException("Failed to find resource " + resourceFileName + " in any of the source directories: " + sourceDirectories);
} | java | protected File findFile(final List<File> sourceDirectories, String resourceFileName) throws IOException {
for (final File sourceDirectory : sourceDirectories) {
final File resourceFile = new File(sourceDirectory, resourceFileName);
if (resourceFile.exists()) {
return resourceFile;
}
}
throw new IOException("Failed to find resource " + resourceFileName + " in any of the source directories: " + sourceDirectories);
} | [
"protected",
"File",
"findFile",
"(",
"final",
"List",
"<",
"File",
">",
"sourceDirectories",
",",
"String",
"resourceFileName",
")",
"throws",
"IOException",
"{",
"for",
"(",
"final",
"File",
"sourceDirectory",
":",
"sourceDirectories",
")",
"{",
"final",
"File... | Find the File for the resource file in the various source directories.
@param sourceDirectories List of directories to scan
@param resourceFileName File name of resource file
@return The resolved File
@throws IOException If the File cannot be found | [
"Find",
"the",
"File",
"for",
"the",
"resource",
"file",
"in",
"the",
"various",
"source",
"directories",
"."
] | train | https://github.com/Jasig/resource-server/blob/13375f716777ec3c99ae9917f672881d4aa32df3/resource-server-core/src/main/java/org/jasig/resource/aggr/ResourcesAggregatorImpl.java#L313-L322 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/ReplacedText.java | ReplacedText.getLayoutDimension | private Dimension getLayoutDimension()
{
Dimension dim;
if (layoutDimension != null)
{
dim = new Dimension(layoutDimension);
if (dim.width <= 0) dim.width = 10; //use some minimum size when the size is not known
if (dim.height <= 0) dim.height = 10;
}
else
dim = new Dimension(10, 10);
return dim;
} | java | private Dimension getLayoutDimension()
{
Dimension dim;
if (layoutDimension != null)
{
dim = new Dimension(layoutDimension);
if (dim.width <= 0) dim.width = 10; //use some minimum size when the size is not known
if (dim.height <= 0) dim.height = 10;
}
else
dim = new Dimension(10, 10);
return dim;
} | [
"private",
"Dimension",
"getLayoutDimension",
"(",
")",
"{",
"Dimension",
"dim",
";",
"if",
"(",
"layoutDimension",
"!=",
"null",
")",
"{",
"dim",
"=",
"new",
"Dimension",
"(",
"layoutDimension",
")",
";",
"if",
"(",
"dim",
".",
"width",
"<=",
"0",
")",
... | Obtains the dimension that should be used for the layout.
@return the dimension | [
"Obtains",
"the",
"dimension",
"that",
"should",
"be",
"used",
"for",
"the",
"layout",
"."
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/ReplacedText.java#L130-L142 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/cfg/multitenant/MultiSchemaMultiTenantProcessEngineConfiguration.java | MultiSchemaMultiTenantProcessEngineConfiguration.registerTenant | public void registerTenant(String tenantId, DataSource dataSource) {
((TenantAwareDataSource) super.getDataSource()).addDataSource(tenantId, dataSource);
if (booted) {
createTenantSchema(tenantId);
createTenantAsyncJobExecutor(tenantId);
tenantInfoHolder.setCurrentTenantId(tenantId);
super.postProcessEngineInitialisation();
tenantInfoHolder.clearCurrentTenantId();
}
} | java | public void registerTenant(String tenantId, DataSource dataSource) {
((TenantAwareDataSource) super.getDataSource()).addDataSource(tenantId, dataSource);
if (booted) {
createTenantSchema(tenantId);
createTenantAsyncJobExecutor(tenantId);
tenantInfoHolder.setCurrentTenantId(tenantId);
super.postProcessEngineInitialisation();
tenantInfoHolder.clearCurrentTenantId();
}
} | [
"public",
"void",
"registerTenant",
"(",
"String",
"tenantId",
",",
"DataSource",
"dataSource",
")",
"{",
"(",
"(",
"TenantAwareDataSource",
")",
"super",
".",
"getDataSource",
"(",
")",
")",
".",
"addDataSource",
"(",
"tenantId",
",",
"dataSource",
")",
";",
... | Add a new {@link DataSource} for a tenant, identified by the provided tenantId, to the engine.
This can be done after the engine has booted up.
Note that the tenant identifier must have been added to the {@link TenantInfoHolder} *prior*
to calling this method. | [
"Add",
"a",
"new",
"{",
"@link",
"DataSource",
"}",
"for",
"a",
"tenant",
"identified",
"by",
"the",
"provided",
"tenantId",
"to",
"the",
"engine",
".",
"This",
"can",
"be",
"done",
"after",
"the",
"engine",
"has",
"booted",
"up",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/multitenant/MultiSchemaMultiTenantProcessEngineConfiguration.java#L89-L101 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Byte | public JBBPOut Byte(final String str, final JBBPBitOrder bitOrder) throws IOException {
assertNotEnded();
assertStringNotNull(str);
if (this.processCommands) {
for (int i = 0; i < str.length(); i++) {
byte value = (byte) str.charAt(i);
if (bitOrder == JBBPBitOrder.MSB0) {
value = JBBPUtils.reverseBitsInByte(value);
}
this.outStream.write(value);
}
}
return this;
} | java | public JBBPOut Byte(final String str, final JBBPBitOrder bitOrder) throws IOException {
assertNotEnded();
assertStringNotNull(str);
if (this.processCommands) {
for (int i = 0; i < str.length(); i++) {
byte value = (byte) str.charAt(i);
if (bitOrder == JBBPBitOrder.MSB0) {
value = JBBPUtils.reverseBitsInByte(value);
}
this.outStream.write(value);
}
}
return this;
} | [
"public",
"JBBPOut",
"Byte",
"(",
"final",
"String",
"str",
",",
"final",
"JBBPBitOrder",
"bitOrder",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"assertStringNotNull",
"(",
"str",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
... | Write String chars trimmed to bytes, only the lower 8 bit will be saved per
char code.
@param str a String which chars should be trimmed to bytes and saved
@param bitOrder the bit outOrder to save bytes
@return the DSL session
@throws IOException it will be thrown for transport errors
@since 1.1 | [
"Write",
"String",
"chars",
"trimmed",
"to",
"bytes",
"only",
"the",
"lower",
"8",
"bit",
"will",
"be",
"saved",
"per",
"char",
"code",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L518-L531 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/service/rest/ValueHolders.java | ValueHolders.get | @Override
@Path("/{valueName}/{value}")
public JSONObject get(String path, Map<String, String> headers)
throws ServiceException, JSONException {
Map<String, String> parameters = getParameters(headers);
String valueName = getSegment(path, 1);
if (valueName == null)
throw new ServiceException("Missing path segment: {valueName}");
String valuePattern = getSegment(path, 2);
String ownerType = parameters.get("holderType");
try {
if (valuePattern == null)
return getValues(valueName, ownerType).getJson();
else
return getValues(valueName, valuePattern, ownerType).getJson();
}
catch (Exception ex) {
throw new ServiceException("Error loading value holders for " + valueName, ex);
}
} | java | @Override
@Path("/{valueName}/{value}")
public JSONObject get(String path, Map<String, String> headers)
throws ServiceException, JSONException {
Map<String, String> parameters = getParameters(headers);
String valueName = getSegment(path, 1);
if (valueName == null)
throw new ServiceException("Missing path segment: {valueName}");
String valuePattern = getSegment(path, 2);
String ownerType = parameters.get("holderType");
try {
if (valuePattern == null)
return getValues(valueName, ownerType).getJson();
else
return getValues(valueName, valuePattern, ownerType).getJson();
}
catch (Exception ex) {
throw new ServiceException("Error loading value holders for " + valueName, ex);
}
} | [
"@",
"Override",
"@",
"Path",
"(",
"\"/{valueName}/{value}\"",
")",
"public",
"JSONObject",
"get",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"ServiceException",
",",
"JSONException",
"{",
"Map",
"<",
"Str... | Retrieve value holder IDs for specific names/values (optionally restricted by OwnerType). | [
"Retrieve",
"value",
"holder",
"IDs",
"for",
"specific",
"names",
"/",
"values",
"(",
"optionally",
"restricted",
"by",
"OwnerType",
")",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/service/rest/ValueHolders.java#L42-L62 |
alkacon/opencms-core | src/org/opencms/util/CmsDefaultSet.java | CmsDefaultSet.setContains | public void setContains(T value, boolean isMember) {
checkNotFrozen();
m_membershipMap.put(value, new Boolean(isMember));
} | java | public void setContains(T value, boolean isMember) {
checkNotFrozen();
m_membershipMap.put(value, new Boolean(isMember));
} | [
"public",
"void",
"setContains",
"(",
"T",
"value",
",",
"boolean",
"isMember",
")",
"{",
"checkNotFrozen",
"(",
")",
";",
"m_membershipMap",
".",
"put",
"(",
"value",
",",
"new",
"Boolean",
"(",
"isMember",
")",
")",
";",
"}"
] | *
Sets the membership of an object.<p>
@param value the object
@param isMember true if the object should be a member, otherwise false | [
"*",
"Sets",
"the",
"membership",
"of",
"an",
"object",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsDefaultSet.java#L114-L118 |
belaban/JGroups | src/org/jgroups/util/Bits.java | Bits.readLongSequence | public static void readLongSequence(DataInput in, long[] seqnos, int index) throws IOException {
byte len=in.readByte();
if(len == 0) {
seqnos[index]=seqnos[index+1]=0;
return;
}
byte len1=firstNibble(len), len2=secondNibble(len);
seqnos[index]=makeLong(in, len1);
seqnos[index+1]=makeLong(in, len2) + seqnos[index];
} | java | public static void readLongSequence(DataInput in, long[] seqnos, int index) throws IOException {
byte len=in.readByte();
if(len == 0) {
seqnos[index]=seqnos[index+1]=0;
return;
}
byte len1=firstNibble(len), len2=secondNibble(len);
seqnos[index]=makeLong(in, len1);
seqnos[index+1]=makeLong(in, len2) + seqnos[index];
} | [
"public",
"static",
"void",
"readLongSequence",
"(",
"DataInput",
"in",
",",
"long",
"[",
"]",
"seqnos",
",",
"int",
"index",
")",
"throws",
"IOException",
"{",
"byte",
"len",
"=",
"in",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"len",
"==",
"0",
")... | Reads 2 compressed longs into an array of 2 longs.
<p/>
Once variable-length encoding has been implemented, this method will probably get dropped as we can simply
read the 2 longs individually.
@param in the input stream to read from
@param seqnos the array to read the seqnos into, needs to have a length of 2
@param index the index of the first element to be written; the seqnos are written to seqnos[index] and seqnos[index+1] | [
"Reads",
"2",
"compressed",
"longs",
"into",
"an",
"array",
"of",
"2",
"longs",
".",
"<p",
"/",
">",
"Once",
"variable",
"-",
"length",
"encoding",
"has",
"been",
"implemented",
"this",
"method",
"will",
"probably",
"get",
"dropped",
"as",
"we",
"can",
"... | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L397-L406 |
apereo/cas | support/cas-server-support-mongo-core/src/main/java/org/apereo/cas/mongo/MongoDbConnectionFactory.java | MongoDbConnectionFactory.buildMongoTemplate | public MongoTemplate buildMongoTemplate(final BaseMongoDbProperties mongo) {
val mongoDbFactory = mongoDbFactory(buildMongoDbClient(mongo), mongo);
return new MongoTemplate(mongoDbFactory, mappingMongoConverter(mongoDbFactory));
} | java | public MongoTemplate buildMongoTemplate(final BaseMongoDbProperties mongo) {
val mongoDbFactory = mongoDbFactory(buildMongoDbClient(mongo), mongo);
return new MongoTemplate(mongoDbFactory, mappingMongoConverter(mongoDbFactory));
} | [
"public",
"MongoTemplate",
"buildMongoTemplate",
"(",
"final",
"BaseMongoDbProperties",
"mongo",
")",
"{",
"val",
"mongoDbFactory",
"=",
"mongoDbFactory",
"(",
"buildMongoDbClient",
"(",
"mongo",
")",
",",
"mongo",
")",
";",
"return",
"new",
"MongoTemplate",
"(",
... | Build mongo template.
@param mongo the mongo properties settings
@return the mongo template | [
"Build",
"mongo",
"template",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-mongo-core/src/main/java/org/apereo/cas/mongo/MongoDbConnectionFactory.java#L105-L108 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyProteinSequenceCreator.java | FileProxyProteinSequenceCreator.getSequence | @Override
public AbstractSequence<AminoAcidCompound> getSequence(String sequence, long index) throws CompoundNotFoundException, IOException {
SequenceFileProxyLoader<AminoAcidCompound> sequenceFileProxyLoader =
new SequenceFileProxyLoader<AminoAcidCompound>(
file,
sequenceParser,
index,
sequence.length(),
compoundSet
);
return new ProteinSequence(sequenceFileProxyLoader, compoundSet);
} | java | @Override
public AbstractSequence<AminoAcidCompound> getSequence(String sequence, long index) throws CompoundNotFoundException, IOException {
SequenceFileProxyLoader<AminoAcidCompound> sequenceFileProxyLoader =
new SequenceFileProxyLoader<AminoAcidCompound>(
file,
sequenceParser,
index,
sequence.length(),
compoundSet
);
return new ProteinSequence(sequenceFileProxyLoader, compoundSet);
} | [
"@",
"Override",
"public",
"AbstractSequence",
"<",
"AminoAcidCompound",
">",
"getSequence",
"(",
"String",
"sequence",
",",
"long",
"index",
")",
"throws",
"CompoundNotFoundException",
",",
"IOException",
"{",
"SequenceFileProxyLoader",
"<",
"AminoAcidCompound",
">",
... | Even though we are passing in the sequence we really only care about the length of the sequence and the offset
index in the fasta file.
@param sequence
@param index
@return
@throws CompoundNotFoundException
@throws IOException | [
"Even",
"though",
"we",
"are",
"passing",
"in",
"the",
"sequence",
"we",
"really",
"only",
"care",
"about",
"the",
"length",
"of",
"the",
"sequence",
"and",
"the",
"offset",
"index",
"in",
"the",
"fasta",
"file",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyProteinSequenceCreator.java#L76-L87 |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/functional/Functional.java | Functional.forEach | public <E> S forEach(Fx<S, E> functor) {
return forEach(null, functor);
} | java | public <E> S forEach(Fx<S, E> functor) {
return forEach(null, functor);
} | [
"public",
"<",
"E",
">",
"S",
"forEach",
"(",
"Fx",
"<",
"S",
",",
"E",
">",
"functor",
")",
"{",
"return",
"forEach",
"(",
"null",
",",
"functor",
")",
";",
"}"
] | Iterates over the collection elements or entries and passing each of them
to the given implementation of the functor interface; if state needs to be
propagated, it can be instantiated and returned by the first invocation of
the functor and it will be passed along the next elements of the collection.
@param functor
an implementation of the {@code $} functor interface.
@return
the result of the iteration. | [
"Iterates",
"over",
"the",
"collection",
"elements",
"or",
"entries",
"and",
"passing",
"each",
"of",
"them",
"to",
"the",
"given",
"implementation",
"of",
"the",
"functor",
"interface",
";",
"if",
"state",
"needs",
"to",
"be",
"propagated",
"it",
"can",
"be... | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/functional/Functional.java#L118-L120 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/WriterUtils.java | WriterUtils.getWriterOutputDir | public static Path getWriterOutputDir(State state, int numBranches, int branchId) {
String writerOutputDirKey =
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_OUTPUT_DIR, numBranches, branchId);
Preconditions.checkArgument(state.contains(writerOutputDirKey), "Missing required property " + writerOutputDirKey);
return new Path(state.getProp(writerOutputDirKey), WriterUtils.getWriterFilePath(state, numBranches, branchId));
} | java | public static Path getWriterOutputDir(State state, int numBranches, int branchId) {
String writerOutputDirKey =
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_OUTPUT_DIR, numBranches, branchId);
Preconditions.checkArgument(state.contains(writerOutputDirKey), "Missing required property " + writerOutputDirKey);
return new Path(state.getProp(writerOutputDirKey), WriterUtils.getWriterFilePath(state, numBranches, branchId));
} | [
"public",
"static",
"Path",
"getWriterOutputDir",
"(",
"State",
"state",
",",
"int",
"numBranches",
",",
"int",
"branchId",
")",
"{",
"String",
"writerOutputDirKey",
"=",
"ForkOperatorUtils",
".",
"getPropertyNameForBranch",
"(",
"ConfigurationKeys",
".",
"WRITER_OUTP... | Get the {@link Path} corresponding the to the directory a given {@link org.apache.gobblin.writer.DataWriter} should be writing
its output data. The output data directory is determined by combining the
{@link ConfigurationKeys#WRITER_OUTPUT_DIR} and the {@link ConfigurationKeys#WRITER_FILE_PATH}.
@param state is the {@link State} corresponding to a specific {@link org.apache.gobblin.writer.DataWriter}.
@param numBranches is the total number of branches for the given {@link State}.
@param branchId is the id for the specific branch that the {@link org.apache.gobblin.writer.DataWriter} will write to.
@return a {@link Path} specifying the directory where the {@link org.apache.gobblin.writer.DataWriter} will write to. | [
"Get",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/WriterUtils.java#L111-L117 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamFilenameHelper.java | DatastreamFilenameHelper.getFilenameFromId | private static final String getFilenameFromId(String pid, String dsid, String MIMETYPE) throws Exception {
return dsid;
} | java | private static final String getFilenameFromId(String pid, String dsid, String MIMETYPE) throws Exception {
return dsid;
} | [
"private",
"static",
"final",
"String",
"getFilenameFromId",
"(",
"String",
"pid",
",",
"String",
"dsid",
",",
"String",
"MIMETYPE",
")",
"throws",
"Exception",
"{",
"return",
"dsid",
";",
"}"
] | Get filename from datastream id
@param pid
@param dsid
@param MIMETYPE
@return
@throws Exception | [
"Get",
"filename",
"from",
"datastream",
"id"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamFilenameHelper.java#L362-L364 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.sendUpgradeProposal | public Collection<ProposalResponse> sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest) throws ProposalException, InvalidArgumentException {
return sendUpgradeProposal(upgradeProposalRequest, getChaincodePeers());
} | java | public Collection<ProposalResponse> sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest) throws ProposalException, InvalidArgumentException {
return sendUpgradeProposal(upgradeProposalRequest, getChaincodePeers());
} | [
"public",
"Collection",
"<",
"ProposalResponse",
">",
"sendUpgradeProposal",
"(",
"UpgradeProposalRequest",
"upgradeProposalRequest",
")",
"throws",
"ProposalException",
",",
"InvalidArgumentException",
"{",
"return",
"sendUpgradeProposal",
"(",
"upgradeProposalRequest",
",",
... | Send Upgrade proposal proposal to upgrade chaincode to a new version.
@param upgradeProposalRequest
@return Collection of proposal responses.
@throws ProposalException
@throws InvalidArgumentException
@deprecated See new Lifecycle chaincode management. {@link Channel#sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest, Peer)} | [
"Send",
"Upgrade",
"proposal",
"proposal",
"to",
"upgrade",
"chaincode",
"to",
"a",
"new",
"version",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L2571-L2575 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java | LocaleData.getPaperSize | public static final PaperSize getPaperSize(ULocale locale){
UResourceBundle obj = measurementTypeBundleForLocale(locale, PAPER_SIZE);
int[] size = obj.getIntVector();
return new PaperSize(size[0], size[1]);
} | java | public static final PaperSize getPaperSize(ULocale locale){
UResourceBundle obj = measurementTypeBundleForLocale(locale, PAPER_SIZE);
int[] size = obj.getIntVector();
return new PaperSize(size[0], size[1]);
} | [
"public",
"static",
"final",
"PaperSize",
"getPaperSize",
"(",
"ULocale",
"locale",
")",
"{",
"UResourceBundle",
"obj",
"=",
"measurementTypeBundleForLocale",
"(",
"locale",
",",
"PAPER_SIZE",
")",
";",
"int",
"[",
"]",
"size",
"=",
"obj",
".",
"getIntVector",
... | Returns the size of paper used in the locale. The paper sizes returned are always in
<em>milli-meters</em>.
@param locale The locale for which the measurement system to be retrieved.
@return The paper size used in the locale | [
"Returns",
"the",
"size",
"of",
"paper",
"used",
"in",
"the",
"locale",
".",
"The",
"paper",
"sizes",
"returned",
"are",
"always",
"in",
"<em",
">",
"milli",
"-",
"meters<",
"/",
"em",
">",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L388-L392 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Music.java | Music.startMusic | private void startMusic(float pitch, float volume, boolean loop) {
if (currentMusic != null) {
currentMusic.stop();
currentMusic.fireMusicSwapped(this);
}
currentMusic = this;
if (volume < 0.0f)
volume = 0.0f;
if (volume > 1.0f)
volume = 1.0f;
sound.playAsMusic(pitch, volume, loop);
playing = true;
setVolume(volume);
if (requiredPosition != -1) {
setPosition(requiredPosition);
}
} | java | private void startMusic(float pitch, float volume, boolean loop) {
if (currentMusic != null) {
currentMusic.stop();
currentMusic.fireMusicSwapped(this);
}
currentMusic = this;
if (volume < 0.0f)
volume = 0.0f;
if (volume > 1.0f)
volume = 1.0f;
sound.playAsMusic(pitch, volume, loop);
playing = true;
setVolume(volume);
if (requiredPosition != -1) {
setPosition(requiredPosition);
}
} | [
"private",
"void",
"startMusic",
"(",
"float",
"pitch",
",",
"float",
"volume",
",",
"boolean",
"loop",
")",
"{",
"if",
"(",
"currentMusic",
"!=",
"null",
")",
"{",
"currentMusic",
".",
"stop",
"(",
")",
";",
"currentMusic",
".",
"fireMusicSwapped",
"(",
... | play or loop the music at a given pitch and volume
@param pitch The pitch to play the music at (1.0 = default)
@param volume The volume to play the music at (1.0 = default)
@param loop if false the music is played once, the music is looped otherwise | [
"play",
"or",
"loop",
"the",
"music",
"at",
"a",
"given",
"pitch",
"and",
"volume"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Music.java#L259-L277 |
reactor/reactor-netty | src/main/java/reactor/netty/ByteBufFlux.java | ByteBufFlux.fromString | public static ByteBufFlux fromString(Publisher<? extends String> source) {
return fromString(source, Charset.defaultCharset(), ByteBufAllocator.DEFAULT);
} | java | public static ByteBufFlux fromString(Publisher<? extends String> source) {
return fromString(source, Charset.defaultCharset(), ByteBufAllocator.DEFAULT);
} | [
"public",
"static",
"ByteBufFlux",
"fromString",
"(",
"Publisher",
"<",
"?",
"extends",
"String",
">",
"source",
")",
"{",
"return",
"fromString",
"(",
"source",
",",
"Charset",
".",
"defaultCharset",
"(",
")",
",",
"ByteBufAllocator",
".",
"DEFAULT",
")",
"... | Decorate as {@link ByteBufFlux}
@param source publisher to decorate
@return a {@link ByteBufFlux} | [
"Decorate",
"as",
"{",
"@link",
"ByteBufFlux",
"}"
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/ByteBufFlux.java#L81-L83 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VFS.java | VFS.mountTemp | public static Closeable mountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
boolean ok = false;
final TempDir tempDir = tempFileProvider.createTempDir("tmpfs");
try {
final MountHandle handle = doMount(new RealFileSystem(tempDir.getRoot()), mountPoint, tempDir);
ok = true;
return handle;
} finally {
if (!ok) {
VFSUtils.safeClose(tempDir);
}
}
} | java | public static Closeable mountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
boolean ok = false;
final TempDir tempDir = tempFileProvider.createTempDir("tmpfs");
try {
final MountHandle handle = doMount(new RealFileSystem(tempDir.getRoot()), mountPoint, tempDir);
ok = true;
return handle;
} finally {
if (!ok) {
VFSUtils.safeClose(tempDir);
}
}
} | [
"public",
"static",
"Closeable",
"mountTemp",
"(",
"VirtualFile",
"mountPoint",
",",
"TempFileProvider",
"tempFileProvider",
")",
"throws",
"IOException",
"{",
"boolean",
"ok",
"=",
"false",
";",
"final",
"TempDir",
"tempDir",
"=",
"tempFileProvider",
".",
"createTe... | Create and mount a temporary file system, returning a single handle which will unmount and close the filesystem
when closed.
@param mountPoint the point at which the filesystem should be mounted
@param tempFileProvider the temporary file provider
@return a handle
@throws IOException if an error occurs | [
"Create",
"and",
"mount",
"a",
"temporary",
"file",
"system",
"returning",
"a",
"single",
"handle",
"which",
"will",
"unmount",
"and",
"close",
"the",
"filesystem",
"when",
"closed",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L393-L405 |
tomakehurst/wiremock | src/main/java/com/github/tomakehurst/wiremock/common/Exceptions.java | Exceptions.throwUnchecked | public static <T> T throwUnchecked(final Throwable ex, final Class<T> returnType) {
Exceptions.<RuntimeException>throwsUnchecked(ex);
throw new AssertionError("This code should be unreachable. Something went terribly wrong here!");
} | java | public static <T> T throwUnchecked(final Throwable ex, final Class<T> returnType) {
Exceptions.<RuntimeException>throwsUnchecked(ex);
throw new AssertionError("This code should be unreachable. Something went terribly wrong here!");
} | [
"public",
"static",
"<",
"T",
">",
"T",
"throwUnchecked",
"(",
"final",
"Throwable",
"ex",
",",
"final",
"Class",
"<",
"T",
">",
"returnType",
")",
"{",
"Exceptions",
".",
"<",
"RuntimeException",
">",
"throwsUnchecked",
"(",
"ex",
")",
";",
"throw",
"ne... | Because this method throws an unchecked exception, when it is called in a method with a return type the compiler
does not know the method is exiting, requiring a further line to return null or throw an unchecked exception
directly. This generified method allows this to be avoided by tricking the compiler by adding a return statement
as so:
<pre>
String someMethod() {
try {
somethingThatThrowsException();
} catch (Exception e) {
return throwUnchecked(e, String.class); // does not actually return, throws the exception
}
}
</pre>
@param ex The exception that will be thrown, unwrapped and unchecked
@param returnType trick to persuade the compiler that a method returns appropriately
@return Never returns, always throws the passed in exception | [
"Because",
"this",
"method",
"throws",
"an",
"unchecked",
"exception",
"when",
"it",
"is",
"called",
"in",
"a",
"method",
"with",
"a",
"return",
"type",
"the",
"compiler",
"does",
"not",
"know",
"the",
"method",
"is",
"exiting",
"requiring",
"a",
"further",
... | train | https://github.com/tomakehurst/wiremock/blob/9d9d73463a82184ec129d620f21133ee7d52f632/src/main/java/com/github/tomakehurst/wiremock/common/Exceptions.java#L38-L41 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_hunting_queue_queueId_agent_POST | public OvhOvhPabxHuntingAgentQueue billingAccount_easyHunting_serviceName_hunting_queue_queueId_agent_POST(String billingAccount, String serviceName, Long queueId, Long position) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/queue/{queueId}/agent";
StringBuilder sb = path(qPath, billingAccount, serviceName, queueId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "position", position);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOvhPabxHuntingAgentQueue.class);
} | java | public OvhOvhPabxHuntingAgentQueue billingAccount_easyHunting_serviceName_hunting_queue_queueId_agent_POST(String billingAccount, String serviceName, Long queueId, Long position) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/queue/{queueId}/agent";
StringBuilder sb = path(qPath, billingAccount, serviceName, queueId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "position", position);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOvhPabxHuntingAgentQueue.class);
} | [
"public",
"OvhOvhPabxHuntingAgentQueue",
"billingAccount_easyHunting_serviceName_hunting_queue_queueId_agent_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"queueId",
",",
"Long",
"position",
")",
"throws",
"IOException",
"{",
"String",
"qP... | Create a new skill for an agent (it adds the agent in a queue)
REST: POST /telephony/{billingAccount}/easyHunting/{serviceName}/hunting/queue/{queueId}/agent
@param position [required] The position of the agent in the queue
@param queueId [required] The queue where you want to add the agent
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Create",
"a",
"new",
"skill",
"for",
"an",
"agent",
"(",
"it",
"adds",
"the",
"agent",
"in",
"a",
"queue",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3066-L3073 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/monitor/impl/LocalMapStatsImpl.java | LocalMapStatsImpl.setIndexStats | public void setIndexStats(Map<String, LocalIndexStatsImpl> indexStats) {
this.mutableIndexStats.clear();
if (indexStats != null) {
this.mutableIndexStats.putAll(indexStats);
}
} | java | public void setIndexStats(Map<String, LocalIndexStatsImpl> indexStats) {
this.mutableIndexStats.clear();
if (indexStats != null) {
this.mutableIndexStats.putAll(indexStats);
}
} | [
"public",
"void",
"setIndexStats",
"(",
"Map",
"<",
"String",
",",
"LocalIndexStatsImpl",
">",
"indexStats",
")",
"{",
"this",
".",
"mutableIndexStats",
".",
"clear",
"(",
")",
";",
"if",
"(",
"indexStats",
"!=",
"null",
")",
"{",
"this",
".",
"mutableInde... | Sets the per-index stats of this map stats to the given per-index stats.
@param indexStats the per-index stats to set. | [
"Sets",
"the",
"per",
"-",
"index",
"stats",
"of",
"this",
"map",
"stats",
"to",
"the",
"given",
"per",
"-",
"index",
"stats",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/monitor/impl/LocalMapStatsImpl.java#L396-L401 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java | Contract.notNull | public static void notNull(final Object object, final String objectName) {
if (object == null) {
throw new IllegalArgumentException("expecting non-null value for " + maskNullArgument(objectName));
}
} | java | public static void notNull(final Object object, final String objectName) {
if (object == null) {
throw new IllegalArgumentException("expecting non-null value for " + maskNullArgument(objectName));
}
} | [
"public",
"static",
"void",
"notNull",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"objectName",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expecting non-null value for \"",
"+",
"mask... | Throw a null pointer exception if object is null
@param object the object to test
@param objectName the name of the object
@throws IllegalArgumentException if the passed object is null | [
"Throw",
"a",
"null",
"pointer",
"exception",
"if",
"object",
"is",
"null"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L37-L41 |
daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java | PagerIndicator.setIndicatorStyleResource | public void setIndicatorStyleResource(int selected, int unselected){
mUserSetSelectedIndicatorResId = selected;
mUserSetUnSelectedIndicatorResId = unselected;
if(selected == 0){
mSelectedDrawable = mSelectedLayerDrawable;
}else{
mSelectedDrawable = mContext.getResources().getDrawable(mUserSetSelectedIndicatorResId);
}
if(unselected == 0){
mUnselectedDrawable = mUnSelectedLayerDrawable;
}else{
mUnselectedDrawable = mContext.getResources().getDrawable(mUserSetUnSelectedIndicatorResId);
}
resetDrawable();
} | java | public void setIndicatorStyleResource(int selected, int unselected){
mUserSetSelectedIndicatorResId = selected;
mUserSetUnSelectedIndicatorResId = unselected;
if(selected == 0){
mSelectedDrawable = mSelectedLayerDrawable;
}else{
mSelectedDrawable = mContext.getResources().getDrawable(mUserSetSelectedIndicatorResId);
}
if(unselected == 0){
mUnselectedDrawable = mUnSelectedLayerDrawable;
}else{
mUnselectedDrawable = mContext.getResources().getDrawable(mUserSetUnSelectedIndicatorResId);
}
resetDrawable();
} | [
"public",
"void",
"setIndicatorStyleResource",
"(",
"int",
"selected",
",",
"int",
"unselected",
")",
"{",
"mUserSetSelectedIndicatorResId",
"=",
"selected",
";",
"mUserSetUnSelectedIndicatorResId",
"=",
"unselected",
";",
"if",
"(",
"selected",
"==",
"0",
")",
"{",... | Set Indicator style.
@param selected page selected drawable
@param unselected page unselected drawable | [
"Set",
"Indicator",
"style",
"."
] | train | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java#L216-L231 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/GuestWindowsRegistryManager.java | GuestWindowsRegistryManager.createRegistryKeyInGuest | public void createRegistryKeyInGuest(VirtualMachine vm, GuestAuthentication auth, GuestRegKeyNameSpec keyName, boolean isVolatile, String classType) throws GuestComponentsOutOfDate, GuestOperationsFault, GuestOperationsUnavailable,
GuestPermissionDenied, GuestRegistryKeyAlreadyExists, GuestRegistryKeyInvalid, GuestRegistryKeyParentVolatile, InvalidGuestLogin, InvalidPowerState, InvalidState, OperationDisabledByGuest, OperationNotSupportedByGuest, RuntimeFault, TaskInProgress, RemoteException {
getVimService().createRegistryKeyInGuest(getMOR(), vm.getMOR(), auth, keyName, isVolatile, classType);
} | java | public void createRegistryKeyInGuest(VirtualMachine vm, GuestAuthentication auth, GuestRegKeyNameSpec keyName, boolean isVolatile, String classType) throws GuestComponentsOutOfDate, GuestOperationsFault, GuestOperationsUnavailable,
GuestPermissionDenied, GuestRegistryKeyAlreadyExists, GuestRegistryKeyInvalid, GuestRegistryKeyParentVolatile, InvalidGuestLogin, InvalidPowerState, InvalidState, OperationDisabledByGuest, OperationNotSupportedByGuest, RuntimeFault, TaskInProgress, RemoteException {
getVimService().createRegistryKeyInGuest(getMOR(), vm.getMOR(), auth, keyName, isVolatile, classType);
} | [
"public",
"void",
"createRegistryKeyInGuest",
"(",
"VirtualMachine",
"vm",
",",
"GuestAuthentication",
"auth",
",",
"GuestRegKeyNameSpec",
"keyName",
",",
"boolean",
"isVolatile",
",",
"String",
"classType",
")",
"throws",
"GuestComponentsOutOfDate",
",",
"GuestOperations... | Create a registry key.
@param vm Virtual machine to perform the operation on.
@param auth The guest authentication data.
@param keyName The path to the registry key to be created.
@param isVolatile If true, the key is created in memory and is not preserved across system reboot. Otherwise, it shall persist in the file system.
@param classType User defined class type for this key. May be omitted.
@throws GuestComponentsOutOfDate Thrown if the guest agent is too old to support the operation.
@throws GuestOperationsFault Thrown if there is an error processing a guest operation.
@throws GuestOperationsUnavailable Thrown if the VM agent for guest operations is not running.
@throws GuestPermissionDenied Thrown if the program path cannot be run because the guest authentication will not allow the operation.
@throws GuestRegistryKeyAlreadyExists Thrown if the registry key already exists.
@throws GuestRegistryKeyInvalid Thrown if the registry key is not valid. Check the HKEY Root specified.
@throws GuestRegistryKeyParentVolatile Thrown if trying to create a non-volatile registry subkey under a volatile registry parent key.
@throws InvalidGuestLogin Thrown if the the guest authentication information was not accepted.
@throws InvalidPowerState Thrown if the VM is not powered on.
@throws InvalidState Thrown if the operation cannot be performed because of the virtual machine's current state.
@throws OperationDisabledByGuest Thrown if the operation is not enabled due to guest agent configuration.
@throws OperationNotSupportedByGuest Thrown if the operation is not supported by the guest OS.
@throws RuntimeFault Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
@throws TaskInProgress Thrown if the virtual machine is busy.
@throws RemoteException | [
"Create",
"a",
"registry",
"key",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/GuestWindowsRegistryManager.java#L60-L63 |
molgenis/molgenis | molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java | OntologyTermRepository.calculateNodePathDistance | public int calculateNodePathDistance(String nodePath1, String nodePath2) {
String[] nodePathFragment1 = nodePath1.split("\\.");
String[] nodePathFragment2 = nodePath2.split("\\.");
int overlapBlock = 0;
while (overlapBlock < nodePathFragment1.length
&& overlapBlock < nodePathFragment2.length
&& nodePathFragment1[overlapBlock].equals(nodePathFragment2[overlapBlock])) {
overlapBlock++;
}
return nodePathFragment1.length + nodePathFragment2.length - overlapBlock * 2;
} | java | public int calculateNodePathDistance(String nodePath1, String nodePath2) {
String[] nodePathFragment1 = nodePath1.split("\\.");
String[] nodePathFragment2 = nodePath2.split("\\.");
int overlapBlock = 0;
while (overlapBlock < nodePathFragment1.length
&& overlapBlock < nodePathFragment2.length
&& nodePathFragment1[overlapBlock].equals(nodePathFragment2[overlapBlock])) {
overlapBlock++;
}
return nodePathFragment1.length + nodePathFragment2.length - overlapBlock * 2;
} | [
"public",
"int",
"calculateNodePathDistance",
"(",
"String",
"nodePath1",
",",
"String",
"nodePath2",
")",
"{",
"String",
"[",
"]",
"nodePathFragment1",
"=",
"nodePath1",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"String",
"[",
"]",
"nodePathFragment2",
"=",
"... | Calculate the distance between nodePaths, e.g. 0[0].1[1].2[2], 0[0].2[1].2[2]. The distance is
the non-overlap part of the strings
@return distance | [
"Calculate",
"the",
"distance",
"between",
"nodePaths",
"e",
".",
"g",
".",
"0",
"[",
"0",
"]",
".",
"1",
"[",
"1",
"]",
".",
"2",
"[",
"2",
"]",
"0",
"[",
"0",
"]",
".",
"2",
"[",
"1",
"]",
".",
"2",
"[",
"2",
"]",
".",
"The",
"distance"... | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java#L214-L226 |
ecclesia/kipeto | kipeto-core/src/main/java/de/ecclesia/kipeto/repository/Blob.java | Blob.writeToStream | public void writeToStream(OutputStream outputStream) throws IOException {
if (exhausted) {
throw new UnsupportedOperationException("Der Content-InputStream des Blobs wurde bereits einmal gelesen");
}
MessageDigest digest = getDigest();
DigestOutputStream digestOutputStream = new DigestOutputStream(outputStream, digest);
// Headerdaten und Inhalt schreiben
DataOutputStream dataOutputStream = new DataOutputStream(digestOutputStream);
// Immer erster Stelle die aktuelle Version schreiben
dataOutputStream.writeByte(CURRENT_BINARY_VERSION);
// Die Reihenfolge der Felder darf sich aus Gründen der
// Kompatibilität niemals ändern. Neue Felder können hinzugefügt
// werden. Dann ist die Version hochzusetzten.
dataOutputStream.writeUTF(type());
dataOutputStream.writeUTF(compression);
dataOutputStream.writeLong(contentLength);
// Nur der Content wird komprimiertFileSizeFormatter
Compressor compressor = createCompressor(compression);
OutputStream compressingStream = compressor.compress(dataOutputStream);
Streams.copyStream(contentStream, compressingStream, true);
byte[] hashBytes = digest.digest();
id = HashUtil.convertHashBytesToString(hashBytes);
} | java | public void writeToStream(OutputStream outputStream) throws IOException {
if (exhausted) {
throw new UnsupportedOperationException("Der Content-InputStream des Blobs wurde bereits einmal gelesen");
}
MessageDigest digest = getDigest();
DigestOutputStream digestOutputStream = new DigestOutputStream(outputStream, digest);
// Headerdaten und Inhalt schreiben
DataOutputStream dataOutputStream = new DataOutputStream(digestOutputStream);
// Immer erster Stelle die aktuelle Version schreiben
dataOutputStream.writeByte(CURRENT_BINARY_VERSION);
// Die Reihenfolge der Felder darf sich aus Gründen der
// Kompatibilität niemals ändern. Neue Felder können hinzugefügt
// werden. Dann ist die Version hochzusetzten.
dataOutputStream.writeUTF(type());
dataOutputStream.writeUTF(compression);
dataOutputStream.writeLong(contentLength);
// Nur der Content wird komprimiertFileSizeFormatter
Compressor compressor = createCompressor(compression);
OutputStream compressingStream = compressor.compress(dataOutputStream);
Streams.copyStream(contentStream, compressingStream, true);
byte[] hashBytes = digest.digest();
id = HashUtil.convertHashBytesToString(hashBytes);
} | [
"public",
"void",
"writeToStream",
"(",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"exhausted",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Der Content-InputStream des Blobs wurde bereits einmal gelesen\"",
")",
";",... | Serialisiert das Objekt in den übergebenen OutputStream. Zunächst wird der Header (Type, Kompressions und Länge)
in den Stream geschrieben. Anschließen der Content des Blobs, ggf. komprimiert. <br/>
<br/>
Der OutputStream wird am Ende der Operation geschlossen. Die geschriebenen Bytes werden gehasht und der Hash in
der Id des Blobs gespeichert. Da der InputStream gelesen wird, kann diese Methode nur ein Mal aufgerufen werden.
@param outputStream
Ziel der Serialisierung
@throws UnsupportedOperationException
falls der InputStream des Blobs bereits eingelesen wurde.
@throws IOException | [
"Serialisiert",
"das",
"Objekt",
"in",
"den",
"übergebenen",
"OutputStream",
".",
"Zunächst",
"wird",
"der",
"Header",
"(",
"Type",
"Kompressions",
"und",
"Länge",
")",
"in",
"den",
"Stream",
"geschrieben",
".",
"Anschließen",
"der",
"Content",
"des",
"Blobs",
... | train | https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-core/src/main/java/de/ecclesia/kipeto/repository/Blob.java#L124-L154 |
kiegroup/jbpm | jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java | QueryCriteriaUtil.basicCreatePredicateFromSingleCriteria | @SuppressWarnings("unchecked")
public static Predicate basicCreatePredicateFromSingleCriteria(CriteriaBuilder builder, Expression entityField, QueryCriteria criteria) {
Predicate predicate = null;
List<Object> parameters = criteria.getParameters();
int numParameters = parameters.size();
assert ! parameters.isEmpty() : "Empty parameters for criteria [" + criteria.toString() + "]";
switch ( criteria.getType() ) {
case NORMAL:
if( numParameters == 1 ) {
Object parameter = parameters.get(0);
assert parameter != null : "Null parameter for criteria [" + criteria.toString() + "]";
predicate = builder.equal(entityField, parameter);
} else {
assert parameters.get(0) != null : "Null 1rst parameter for criteria [" + criteria.toString() + "]";
assert parameters.get(parameters.size()-1) != null : "Null last parameter for criteria [" + criteria.toString() + "]";
predicate = entityField.in(parameters);
}
break;
case REGEXP:
List<Predicate> predicateList = new ArrayList<Predicate>();
for( Object param : parameters ) {
assert param != null : "Null regular expression parameter for criteria [" + criteria.toString() + "]";
String likeRegex = convertRegexToJPALikeExpression((String) param );
Predicate regexPredicate = builder.like((Expression<String>) entityField, likeRegex);
predicateList.add(regexPredicate);
}
if( predicateList.size() == 1 ) {
predicate = predicateList.get(0);
} else {
Predicate [] predicates = predicateList.toArray(new Predicate[predicateList.size()]);
if( criteria.isUnion() ) {
predicate = builder.or(predicates);
} else {
predicate = builder.and(predicates);
}
}
break;
case RANGE:
assert numParameters > 0 && numParameters < 3: "Range expressions may only contain between 1 and 2 parameters, not " + numParameters + " [" + criteria.toString() + "]";
Object [] rangeObjArr = parameters.toArray();
Class rangeType = rangeObjArr[0] != null ? rangeObjArr[0].getClass() : rangeObjArr[1].getClass();
predicate = createRangePredicate( builder, entityField, rangeObjArr[0], rangeObjArr[1], rangeType);
break;
default:
throw new IllegalStateException("Unknown criteria type: " + criteria.getType());
}
assert predicate != null : "No predicate created "
+ "when evaluating " + criteria.getType().toString().toLowerCase() + " criteria "
+ "[" + criteria.toString() + "]";
return predicate;
} | java | @SuppressWarnings("unchecked")
public static Predicate basicCreatePredicateFromSingleCriteria(CriteriaBuilder builder, Expression entityField, QueryCriteria criteria) {
Predicate predicate = null;
List<Object> parameters = criteria.getParameters();
int numParameters = parameters.size();
assert ! parameters.isEmpty() : "Empty parameters for criteria [" + criteria.toString() + "]";
switch ( criteria.getType() ) {
case NORMAL:
if( numParameters == 1 ) {
Object parameter = parameters.get(0);
assert parameter != null : "Null parameter for criteria [" + criteria.toString() + "]";
predicate = builder.equal(entityField, parameter);
} else {
assert parameters.get(0) != null : "Null 1rst parameter for criteria [" + criteria.toString() + "]";
assert parameters.get(parameters.size()-1) != null : "Null last parameter for criteria [" + criteria.toString() + "]";
predicate = entityField.in(parameters);
}
break;
case REGEXP:
List<Predicate> predicateList = new ArrayList<Predicate>();
for( Object param : parameters ) {
assert param != null : "Null regular expression parameter for criteria [" + criteria.toString() + "]";
String likeRegex = convertRegexToJPALikeExpression((String) param );
Predicate regexPredicate = builder.like((Expression<String>) entityField, likeRegex);
predicateList.add(regexPredicate);
}
if( predicateList.size() == 1 ) {
predicate = predicateList.get(0);
} else {
Predicate [] predicates = predicateList.toArray(new Predicate[predicateList.size()]);
if( criteria.isUnion() ) {
predicate = builder.or(predicates);
} else {
predicate = builder.and(predicates);
}
}
break;
case RANGE:
assert numParameters > 0 && numParameters < 3: "Range expressions may only contain between 1 and 2 parameters, not " + numParameters + " [" + criteria.toString() + "]";
Object [] rangeObjArr = parameters.toArray();
Class rangeType = rangeObjArr[0] != null ? rangeObjArr[0].getClass() : rangeObjArr[1].getClass();
predicate = createRangePredicate( builder, entityField, rangeObjArr[0], rangeObjArr[1], rangeType);
break;
default:
throw new IllegalStateException("Unknown criteria type: " + criteria.getType());
}
assert predicate != null : "No predicate created "
+ "when evaluating " + criteria.getType().toString().toLowerCase() + " criteria "
+ "[" + criteria.toString() + "]";
return predicate;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Predicate",
"basicCreatePredicateFromSingleCriteria",
"(",
"CriteriaBuilder",
"builder",
",",
"Expression",
"entityField",
",",
"QueryCriteria",
"criteria",
")",
"{",
"Predicate",
"predicate",
"=",
... | This method creates the basic types of {@link Predicate} from trivial {@link QueryCriteria} (NORMAL/REGEXP/RANGE).
@param builder The {@link CriteriaBuilder}, helpful when creating {@link Predicate}s to add to the {@link CriteriaQuery}
@param entityField The {@link Expression} representing a field/column in an entity/table.
@param criteria The {@link QueryCriteria} with the values to use as the RHS of a {@link Predicate}
@return The created {@link Predicate} | [
"This",
"method",
"creates",
"the",
"basic",
"types",
"of",
"{",
"@link",
"Predicate",
"}",
"from",
"trivial",
"{",
"@link",
"QueryCriteria",
"}",
"(",
"NORMAL",
"/",
"REGEXP",
"/",
"RANGE",
")",
"."
] | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java#L480-L531 |
stanfy/gson-xml | src/main/java/com/stanfy/gsonxml/GsonXml.java | GsonXml.fromXml | public <T> T fromXml(final XmlReader reader, final Type typeOfT) throws JsonIOException, JsonSyntaxException {
return core.fromJson(reader, typeOfT);
} | java | public <T> T fromXml(final XmlReader reader, final Type typeOfT) throws JsonIOException, JsonSyntaxException {
return core.fromJson(reader, typeOfT);
} | [
"public",
"<",
"T",
">",
"T",
"fromXml",
"(",
"final",
"XmlReader",
"reader",
",",
"final",
"Type",
"typeOfT",
")",
"throws",
"JsonIOException",
",",
"JsonSyntaxException",
"{",
"return",
"core",
".",
"fromJson",
"(",
"reader",
",",
"typeOfT",
")",
";",
"}... | Reads the next JSON value from {@code reader} and convert it to an object
of type {@code typeOfT}.
Since Type is not parameterized by T, this method is type unsafe and should be used carefully
@return deserialized object
@param <T> type to deserialize
@param reader XML source
@param typeOfT type to deserialize
@throws JsonIOException if there was a problem writing to the Reader
@throws JsonSyntaxException if json is not a valid representation for an object of type | [
"Reads",
"the",
"next",
"JSON",
"value",
"from",
"{",
"@code",
"reader",
"}",
"and",
"convert",
"it",
"to",
"an",
"object",
"of",
"type",
"{",
"@code",
"typeOfT",
"}",
".",
"Since",
"Type",
"is",
"not",
"parameterized",
"by",
"T",
"this",
"method",
"is... | train | https://github.com/stanfy/gson-xml/blob/574166248c5e7b55d8546a1ef69cb906936ee34d/src/main/java/com/stanfy/gsonxml/GsonXml.java#L95-L97 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.setPatternStroke | public void setPatternStroke(PdfPatternPainter p, Color color, float tint) {
checkWriter();
if (!p.isStencil())
throw new RuntimeException("An uncolored pattern was expected.");
PageResources prs = getPageResources();
PdfName name = writer.addSimplePattern(p);
name = prs.addPattern(name, p.getIndirectReference());
ColorDetails csDetail = writer.addSimplePatternColorspace(color);
PdfName cName = prs.addColor(csDetail.getColorName(), csDetail.getIndirectReference());
content.append(cName.getBytes()).append(" CS").append_i(separator);
outputColorNumbers(color, tint);
content.append(' ').append(name.getBytes()).append(" SCN").append_i(separator);
} | java | public void setPatternStroke(PdfPatternPainter p, Color color, float tint) {
checkWriter();
if (!p.isStencil())
throw new RuntimeException("An uncolored pattern was expected.");
PageResources prs = getPageResources();
PdfName name = writer.addSimplePattern(p);
name = prs.addPattern(name, p.getIndirectReference());
ColorDetails csDetail = writer.addSimplePatternColorspace(color);
PdfName cName = prs.addColor(csDetail.getColorName(), csDetail.getIndirectReference());
content.append(cName.getBytes()).append(" CS").append_i(separator);
outputColorNumbers(color, tint);
content.append(' ').append(name.getBytes()).append(" SCN").append_i(separator);
} | [
"public",
"void",
"setPatternStroke",
"(",
"PdfPatternPainter",
"p",
",",
"Color",
"color",
",",
"float",
"tint",
")",
"{",
"checkWriter",
"(",
")",
";",
"if",
"(",
"!",
"p",
".",
"isStencil",
"(",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"An... | Sets the stroke color to an uncolored pattern.
@param p the pattern
@param color the color of the pattern
@param tint the tint if the color is a spot color, ignored otherwise | [
"Sets",
"the",
"stroke",
"color",
"to",
"an",
"uncolored",
"pattern",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2385-L2397 |
jenkinsci/jenkins | core/src/main/java/hudson/FilePath.java | FilePath.unzipFrom | public void unzipFrom(InputStream _in) throws IOException, InterruptedException {
final InputStream in = new RemoteInputStream(_in, Flag.GREEDY);
act(new UnzipFrom(in));
} | java | public void unzipFrom(InputStream _in) throws IOException, InterruptedException {
final InputStream in = new RemoteInputStream(_in, Flag.GREEDY);
act(new UnzipFrom(in));
} | [
"public",
"void",
"unzipFrom",
"(",
"InputStream",
"_in",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"final",
"InputStream",
"in",
"=",
"new",
"RemoteInputStream",
"(",
"_in",
",",
"Flag",
".",
"GREEDY",
")",
";",
"act",
"(",
"new",
"Unz... | Reads the given InputStream as a zip file and extracts it into this directory.
@param _in
The stream will be closed by this method after it's fully read.
@since 1.283
@see #unzip(FilePath) | [
"Reads",
"the",
"given",
"InputStream",
"as",
"a",
"zip",
"file",
"and",
"extracts",
"it",
"into",
"this",
"directory",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L609-L612 |
playn/playn | html/src/playn/super/java/nio/CharBuffer.java | CharBuffer.append | public CharBuffer append (CharSequence csq, int start, int end) {
if (csq == null) {
csq = "null"; //$NON-NLS-1$
}
CharSequence cs = csq.subSequence(start, end);
if (cs.length() > 0) {
return put(cs.toString());
}
return this;
} | java | public CharBuffer append (CharSequence csq, int start, int end) {
if (csq == null) {
csq = "null"; //$NON-NLS-1$
}
CharSequence cs = csq.subSequence(start, end);
if (cs.length() > 0) {
return put(cs.toString());
}
return this;
} | [
"public",
"CharBuffer",
"append",
"(",
"CharSequence",
"csq",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"if",
"(",
"csq",
"==",
"null",
")",
"{",
"csq",
"=",
"\"null\"",
";",
"//$NON-NLS-1$",
"}",
"CharSequence",
"cs",
"=",
"csq",
".",
"subSequ... | Writes chars of the given {@code CharSequence} to the current position of this buffer, and
increases the position by the number of chars written.
@param csq the {@code CharSequence} to write.
@param start the first char to write, must not be negative and not greater than {@code
csq.length()}.
@param end the last char to write (excluding), must be less than {@code start} and not
greater than {@code csq.length()}.
@return this buffer.
@exception BufferOverflowException if {@code remaining()} is less than {@code end - start}.
@exception IndexOutOfBoundsException if either {@code start} or {@code end} is invalid.
@exception ReadOnlyBufferException if no changes may be made to the contents of this buffer. | [
"Writes",
"chars",
"of",
"the",
"given",
"{",
"@code",
"CharSequence",
"}",
"to",
"the",
"current",
"position",
"of",
"this",
"buffer",
"and",
"increases",
"the",
"position",
"by",
"the",
"number",
"of",
"chars",
"written",
"."
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/CharBuffer.java#L515-L524 |
bpsm/edn-java | src/main/java/us/bpsm/edn/Tag.java | Tag.newTag | public static Tag newTag(String prefix, String name) {
return newTag(newSymbol(prefix, name));
} | java | public static Tag newTag(String prefix, String name) {
return newTag(newSymbol(prefix, name));
} | [
"public",
"static",
"Tag",
"newTag",
"(",
"String",
"prefix",
",",
"String",
"name",
")",
"{",
"return",
"newTag",
"(",
"newSymbol",
"(",
"prefix",
",",
"name",
")",
")",
";",
"}"
] | Provide a Tag with the given prefix and name.
<p>
Bear in mind that tags with no prefix are reserved for use by the edn
format itself.
@param prefix
An empty String or a non-empty String obeying the restrictions
specified by edn. Never null.
@param name
A non-empty string obeying the restrictions specified by edn.
Never null.
@return a Keyword, never null. | [
"Provide",
"a",
"Tag",
"with",
"the",
"given",
"prefix",
"and",
"name",
".",
"<p",
">",
"Bear",
"in",
"mind",
"that",
"tags",
"with",
"no",
"prefix",
"are",
"reserved",
"for",
"use",
"by",
"the",
"edn",
"format",
"itself",
"."
] | train | https://github.com/bpsm/edn-java/blob/c5dfdb77431da1aca3c257599b237a21575629b2/src/main/java/us/bpsm/edn/Tag.java#L61-L63 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/LifecycleInstallChaincodeProposalResponse.java | LifecycleInstallChaincodeProposalResponse.getPackageId | public String getPackageId() throws ProposalException {
if (Status.SUCCESS != getStatus()) {
throw new ProposalException(format("Status of install proposal did not ret ok for %s, %s ", getPeer(), getStatus()));
}
ByteString payload = getProposalResponse().getResponse().getPayload();
Lifecycle.InstallChaincodeResult installChaincodeResult = null;
try {
installChaincodeResult = Lifecycle.InstallChaincodeResult.parseFrom(payload);
} catch (InvalidProtocolBufferException e) {
throw new ProposalException(format("Bad protobuf received for install proposal %s", getPeer()));
}
return installChaincodeResult.getPackageId();
} | java | public String getPackageId() throws ProposalException {
if (Status.SUCCESS != getStatus()) {
throw new ProposalException(format("Status of install proposal did not ret ok for %s, %s ", getPeer(), getStatus()));
}
ByteString payload = getProposalResponse().getResponse().getPayload();
Lifecycle.InstallChaincodeResult installChaincodeResult = null;
try {
installChaincodeResult = Lifecycle.InstallChaincodeResult.parseFrom(payload);
} catch (InvalidProtocolBufferException e) {
throw new ProposalException(format("Bad protobuf received for install proposal %s", getPeer()));
}
return installChaincodeResult.getPackageId();
} | [
"public",
"String",
"getPackageId",
"(",
")",
"throws",
"ProposalException",
"{",
"if",
"(",
"Status",
".",
"SUCCESS",
"!=",
"getStatus",
"(",
")",
")",
"{",
"throw",
"new",
"ProposalException",
"(",
"format",
"(",
"\"Status of install proposal did not ret ok for %s... | The packageId the identifies this chaincode change.
@return the package id.
@throws ProposalException | [
"The",
"packageId",
"the",
"identifies",
"this",
"chaincode",
"change",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/LifecycleInstallChaincodeProposalResponse.java#L34-L46 |
graphql-java/java-dataloader | src/main/java/org/dataloader/DataLoader.java | DataLoader.loadMany | public CompletableFuture<List<V>> loadMany(List<K> keys) {
return loadMany(keys, Collections.emptyList());
} | java | public CompletableFuture<List<V>> loadMany(List<K> keys) {
return loadMany(keys, Collections.emptyList());
} | [
"public",
"CompletableFuture",
"<",
"List",
"<",
"V",
">",
">",
"loadMany",
"(",
"List",
"<",
"K",
">",
"keys",
")",
"{",
"return",
"loadMany",
"(",
"keys",
",",
"Collections",
".",
"emptyList",
"(",
")",
")",
";",
"}"
] | Requests to load the list of data provided by the specified keys asynchronously, and returns a composite future
of the resulting values.
<p>
If batching is enabled (the default), you'll have to call {@link DataLoader#dispatch()} at a later stage to
start batch execution. If you forget this call the future will never be completed (unless already completed,
and returned from cache).
@param keys the list of keys to load
@return the composite future of the list of values | [
"Requests",
"to",
"load",
"the",
"list",
"of",
"data",
"provided",
"by",
"the",
"specified",
"keys",
"asynchronously",
"and",
"returns",
"a",
"composite",
"future",
"of",
"the",
"resulting",
"values",
".",
"<p",
">",
"If",
"batching",
"is",
"enabled",
"(",
... | train | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoader.java#L415-L417 |
jbehave/jbehave-core | jbehave-needle/src/main/java/org/jbehave/core/steps/needle/NeedleStepsFactory.java | NeedleStepsFactory.methodReturningConverters | private List<ParameterConverter> methodReturningConverters(final Class<?> type) {
final List<ParameterConverter> converters = new ArrayList<>();
for (final Method method : type.getMethods()) {
if (method.isAnnotationPresent(AsParameterConverter.class)) {
converters.add(new MethodReturningConverter(method, type, this));
}
}
return converters;
} | java | private List<ParameterConverter> methodReturningConverters(final Class<?> type) {
final List<ParameterConverter> converters = new ArrayList<>();
for (final Method method : type.getMethods()) {
if (method.isAnnotationPresent(AsParameterConverter.class)) {
converters.add(new MethodReturningConverter(method, type, this));
}
}
return converters;
} | [
"private",
"List",
"<",
"ParameterConverter",
">",
"methodReturningConverters",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"final",
"List",
"<",
"ParameterConverter",
">",
"converters",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
... | Create parameter converters from methods annotated with @AsParameterConverter
@see {@link AbstractStepsFactory} | [
"Create",
"parameter",
"converters",
"from",
"methods",
"annotated",
"with"
] | train | https://github.com/jbehave/jbehave-core/blob/bdd6a6199528df3c35087e72d4644870655b23e6/jbehave-needle/src/main/java/org/jbehave/core/steps/needle/NeedleStepsFactory.java#L137-L145 |
pravega/pravega | common/src/main/java/io/pravega/common/util/btree/PageWrapper.java | PageWrapper.wrapNew | static PageWrapper wrapNew(BTreePage page, PageWrapper parent, PagePointer pointer) {
return new PageWrapper(page, parent, pointer, true);
} | java | static PageWrapper wrapNew(BTreePage page, PageWrapper parent, PagePointer pointer) {
return new PageWrapper(page, parent, pointer, true);
} | [
"static",
"PageWrapper",
"wrapNew",
"(",
"BTreePage",
"page",
",",
"PageWrapper",
"parent",
",",
"PagePointer",
"pointer",
")",
"{",
"return",
"new",
"PageWrapper",
"(",
"page",
",",
"parent",
",",
"pointer",
",",
"true",
")",
";",
"}"
] | Creates a new instance of the PageWrapper class for a new Page.
@param page Page to wrap.
@param parent Page's Parent.
@param pointer Page Pointer. | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"PageWrapper",
"class",
"for",
"a",
"new",
"Page",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/PageWrapper.java#L69-L71 |
Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java | DiscordApiImpl.getOrCreateUser | public User getOrCreateUser(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
synchronized (users) {
return getCachedUserById(id).orElseGet(() -> {
if (!data.has("username")) {
throw new IllegalStateException("Couldn't get or created user. Please inform the developer!");
}
return new UserImpl(this, data);
});
}
} | java | public User getOrCreateUser(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
synchronized (users) {
return getCachedUserById(id).orElseGet(() -> {
if (!data.has("username")) {
throw new IllegalStateException("Couldn't get or created user. Please inform the developer!");
}
return new UserImpl(this, data);
});
}
} | [
"public",
"User",
"getOrCreateUser",
"(",
"JsonNode",
"data",
")",
"{",
"long",
"id",
"=",
"Long",
".",
"parseLong",
"(",
"data",
".",
"get",
"(",
"\"id\"",
")",
".",
"asText",
"(",
")",
")",
";",
"synchronized",
"(",
"users",
")",
"{",
"return",
"ge... | Gets a user or creates a new one from the given data.
@param data The json data of the user.
@return The user. | [
"Gets",
"a",
"user",
"or",
"creates",
"a",
"new",
"one",
"from",
"the",
"given",
"data",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java#L794-L804 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/FilterByteBuffer.java | FilterByteBuffer.putString | public FilterByteBuffer putString(String str, Charset charset) throws IOException
{
byte[] bytes = str.getBytes(charset);
put(bytes).put((byte)0);
return this;
} | java | public FilterByteBuffer putString(String str, Charset charset) throws IOException
{
byte[] bytes = str.getBytes(charset);
put(bytes).put((byte)0);
return this;
} | [
"public",
"FilterByteBuffer",
"putString",
"(",
"String",
"str",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"str",
".",
"getBytes",
"(",
"charset",
")",
";",
"put",
"(",
"bytes",
")",
".",
"put",
"(",
... | Puts string as null terminated byte array
@param str
@param charset
@return
@throws IOException | [
"Puts",
"string",
"as",
"null",
"terminated",
"byte",
"array"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/FilterByteBuffer.java#L190-L195 |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.strokeLine | public void strokeLine(double x1, double y1, double x2, double y2) {
this.gc.strokeLine(
doc2fxX(x1), doc2fxY(y1),
doc2fxX(x2), doc2fxY(y2));
} | java | public void strokeLine(double x1, double y1, double x2, double y2) {
this.gc.strokeLine(
doc2fxX(x1), doc2fxY(y1),
doc2fxX(x2), doc2fxY(y2));
} | [
"public",
"void",
"strokeLine",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
")",
"{",
"this",
".",
"gc",
".",
"strokeLine",
"(",
"doc2fxX",
"(",
"x1",
")",
",",
"doc2fxY",
"(",
"y1",
")",
",",
"doc2fxX",
"(",... | Strokes a line using the current stroke paint.
<p>This method will be affected by any of the
global common or stroke attributes as specified in the
Rendering Attributes Table of {@link GraphicsContext}.
@param x1 the X coordinate of the starting point of the line.
@param y1 the Y coordinate of the starting point of the line.
@param x2 the X coordinate of the ending point of the line.
@param y2 the Y coordinate of the ending point of the line. | [
"Strokes",
"a",
"line",
"using",
"the",
"current",
"stroke",
"paint",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1641-L1645 |
crnk-project/crnk-framework | crnk-gen/crnk-gen-typescript/src/main/java/io/crnk/gen/typescript/internal/TypescriptUtils.java | TypescriptUtils.getNestedInterface | public static TSInterfaceType getNestedInterface(TSType type, String name, boolean create) {
TSModule module = getNestedTypeContainer(type, create);
if (module == null && !create) {
return null;
} else if (module == null) {
throw new IllegalStateException("cannot setup interface as no parent container is available");
}
for (TSElement element : module.getElements()) {
if (element instanceof TSInterfaceType && ((TSInterfaceType) element).getName().equals(name)) {
return (TSInterfaceType) element;
}
}
if (create) {
TSInterfaceType interfaceType = new TSInterfaceType();
interfaceType.setExported(true);
interfaceType.setName(name);
interfaceType.setParent(module);
module.getElements().add(interfaceType);
return interfaceType;
} else {
return null;
}
} | java | public static TSInterfaceType getNestedInterface(TSType type, String name, boolean create) {
TSModule module = getNestedTypeContainer(type, create);
if (module == null && !create) {
return null;
} else if (module == null) {
throw new IllegalStateException("cannot setup interface as no parent container is available");
}
for (TSElement element : module.getElements()) {
if (element instanceof TSInterfaceType && ((TSInterfaceType) element).getName().equals(name)) {
return (TSInterfaceType) element;
}
}
if (create) {
TSInterfaceType interfaceType = new TSInterfaceType();
interfaceType.setExported(true);
interfaceType.setName(name);
interfaceType.setParent(module);
module.getElements().add(interfaceType);
return interfaceType;
} else {
return null;
}
} | [
"public",
"static",
"TSInterfaceType",
"getNestedInterface",
"(",
"TSType",
"type",
",",
"String",
"name",
",",
"boolean",
"create",
")",
"{",
"TSModule",
"module",
"=",
"getNestedTypeContainer",
"(",
"type",
",",
"create",
")",
";",
"if",
"(",
"module",
"==",... | Creates a nested interface for the given type (using a module with the same name as the type). | [
"Creates",
"a",
"nested",
"interface",
"for",
"the",
"given",
"type",
"(",
"using",
"a",
"module",
"with",
"the",
"same",
"name",
"as",
"the",
"type",
")",
"."
] | train | https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-gen/crnk-gen-typescript/src/main/java/io/crnk/gen/typescript/internal/TypescriptUtils.java#L62-L85 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskArrayPageFile.java | OnDiskArrayPageFile.readPage | @Override
public P readPage(int pageID) {
try {
countRead();
return byteBufferToPage(this.file.getRecordBuffer(pageID));
} catch (IOException e) {
throw new RuntimeException("IOException occurred during reading of page " + pageID, e);
}
} | java | @Override
public P readPage(int pageID) {
try {
countRead();
return byteBufferToPage(this.file.getRecordBuffer(pageID));
} catch (IOException e) {
throw new RuntimeException("IOException occurred during reading of page " + pageID, e);
}
} | [
"@",
"Override",
"public",
"P",
"readPage",
"(",
"int",
"pageID",
")",
"{",
"try",
"{",
"countRead",
"(",
")",
";",
"return",
"byteBufferToPage",
"(",
"this",
".",
"file",
".",
"getRecordBuffer",
"(",
"pageID",
")",
")",
";",
"}",
"catch",
"(",
"IOExce... | Reads the page with the given id from this file.
@param pageID the id of the page to be returned
@return the page with the given pageId | [
"Reads",
"the",
"page",
"with",
"the",
"given",
"id",
"from",
"this",
"file",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskArrayPageFile.java#L107-L115 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.invokeNodeAction | public void invokeNodeAction (String nodeName, NodeAction action)
{
PeerNode peer = _peers.get(nodeName);
if (peer != null) {
if (peer.nodeobj != null) {
peer.nodeobj.peerService.invokeAction(flattenAction(action));
} else {
log.warning("Dropped NodeAction", "nodeName", nodeName, "action", action);
}
} else if (Objects.equal(nodeName, _nodeName)) {
invokeAction(null, flattenAction(action));
}
} | java | public void invokeNodeAction (String nodeName, NodeAction action)
{
PeerNode peer = _peers.get(nodeName);
if (peer != null) {
if (peer.nodeobj != null) {
peer.nodeobj.peerService.invokeAction(flattenAction(action));
} else {
log.warning("Dropped NodeAction", "nodeName", nodeName, "action", action);
}
} else if (Objects.equal(nodeName, _nodeName)) {
invokeAction(null, flattenAction(action));
}
} | [
"public",
"void",
"invokeNodeAction",
"(",
"String",
"nodeName",
",",
"NodeAction",
"action",
")",
"{",
"PeerNode",
"peer",
"=",
"_peers",
".",
"get",
"(",
"nodeName",
")",
";",
"if",
"(",
"peer",
"!=",
"null",
")",
"{",
"if",
"(",
"peer",
".",
"nodeob... | Invokes a node action on a specific node <em>without</em> executing {@link
NodeAction#isApplicable} to determine whether the action is applicable. | [
"Invokes",
"a",
"node",
"action",
"on",
"a",
"specific",
"node",
"<em",
">",
"without<",
"/",
"em",
">",
"executing",
"{"
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L522-L536 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java | KeyVaultClientImpl.createKey | public KeyBundle createKey(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags) {
return createKeyWithServiceResponseAsync(vaultBaseUrl, keyName, kty, keySize, keyOps, keyAttributes, tags).toBlocking().single().body();
} | java | public KeyBundle createKey(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags) {
return createKeyWithServiceResponseAsync(vaultBaseUrl, keyName, kty, keySize, keyOps, keyAttributes, tags).toBlocking().single().body();
} | [
"public",
"KeyBundle",
"createKey",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"JsonWebKeyType",
"kty",
",",
"Integer",
"keySize",
",",
"List",
"<",
"JsonWebKeyOperation",
">",
"keyOps",
",",
"KeyAttributes",
"keyAttributes",
",",
"Map",
"<",
... | Creates a new key, stores it, then returns key parameters and attributes to the client. The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. Authorization: Requires the keys/create permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name for the new key. The system will generate the version name for the new key.
@param kty The type of key to create. For valid key types, see JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', 'RSA-HSM', 'oct'
@param keySize The key size in bytes. For example, 1024 or 2048.
@param keyOps the List<JsonWebKeyOperation> value
@param keyAttributes the KeyAttributes value
@param tags Application specific metadata in the form of key-value pairs.
@return the KeyBundle object if successful. | [
"Creates",
"a",
"new",
"key",
"stores",
"it",
"then",
"returns",
"key",
"parameters",
"and",
"attributes",
"to",
"the",
"client",
".",
"The",
"create",
"key",
"operation",
"can",
"be",
"used",
"to",
"create",
"any",
"key",
"type",
"in",
"Azure",
"Key",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java#L539-L541 |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.reserveAndWriteUtf8 | public static int reserveAndWriteUtf8(ByteBuf buf, CharSequence seq, int reserveBytes) {
for (;;) {
if (buf instanceof WrappedCompositeByteBuf) {
// WrappedCompositeByteBuf is a sub-class of AbstractByteBuf so it needs special handling.
buf = buf.unwrap();
} else if (buf instanceof AbstractByteBuf) {
AbstractByteBuf byteBuf = (AbstractByteBuf) buf;
byteBuf.ensureWritable0(reserveBytes);
int written = writeUtf8(byteBuf, byteBuf.writerIndex, seq, seq.length());
byteBuf.writerIndex += written;
return written;
} else if (buf instanceof WrappedByteBuf) {
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
buf = buf.unwrap();
} else {
byte[] bytes = seq.toString().getBytes(CharsetUtil.UTF_8);
buf.writeBytes(bytes);
return bytes.length;
}
}
} | java | public static int reserveAndWriteUtf8(ByteBuf buf, CharSequence seq, int reserveBytes) {
for (;;) {
if (buf instanceof WrappedCompositeByteBuf) {
// WrappedCompositeByteBuf is a sub-class of AbstractByteBuf so it needs special handling.
buf = buf.unwrap();
} else if (buf instanceof AbstractByteBuf) {
AbstractByteBuf byteBuf = (AbstractByteBuf) buf;
byteBuf.ensureWritable0(reserveBytes);
int written = writeUtf8(byteBuf, byteBuf.writerIndex, seq, seq.length());
byteBuf.writerIndex += written;
return written;
} else if (buf instanceof WrappedByteBuf) {
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
buf = buf.unwrap();
} else {
byte[] bytes = seq.toString().getBytes(CharsetUtil.UTF_8);
buf.writeBytes(bytes);
return bytes.length;
}
}
} | [
"public",
"static",
"int",
"reserveAndWriteUtf8",
"(",
"ByteBuf",
"buf",
",",
"CharSequence",
"seq",
",",
"int",
"reserveBytes",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"buf",
"instanceof",
"WrappedCompositeByteBuf",
")",
"{",
"// WrappedComposite... | Encode a {@link CharSequence} in <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> and write
it into {@code reserveBytes} of a {@link ByteBuf}.
<p>
The {@code reserveBytes} must be computed (ie eagerly using {@link #utf8MaxBytes(CharSequence)}
or exactly with {@link #utf8Bytes(CharSequence)}) to ensure this method to not fail: for performance reasons
the index checks will be performed using just {@code reserveBytes}.<br>
This method returns the actual number of bytes written. | [
"Encode",
"a",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L511-L531 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/AbstractTrainer.java | AbstractTrainer.createKnowledgeBaseName | protected final String createKnowledgeBaseName(String storageName, String separator) {
return storageName + separator + getClass().getSimpleName();
} | java | protected final String createKnowledgeBaseName(String storageName, String separator) {
return storageName + separator + getClass().getSimpleName();
} | [
"protected",
"final",
"String",
"createKnowledgeBaseName",
"(",
"String",
"storageName",
",",
"String",
"separator",
")",
"{",
"return",
"storageName",
"+",
"separator",
"+",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
";",
"}"
] | Generates a name for the KnowledgeBase.
@param storageName
@param separator
@return | [
"Generates",
"a",
"name",
"for",
"the",
"KnowledgeBase",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/AbstractTrainer.java#L175-L177 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.deleteAliases | public void deleteAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) throws CmsException {
I_CmsVfsDriver vfsDriver = getVfsDriver(dbc);
vfsDriver.deleteAliases(dbc, project, filter);
} | java | public void deleteAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) throws CmsException {
I_CmsVfsDriver vfsDriver = getVfsDriver(dbc);
vfsDriver.deleteAliases(dbc, project, filter);
} | [
"public",
"void",
"deleteAliases",
"(",
"CmsDbContext",
"dbc",
",",
"CmsProject",
"project",
",",
"CmsAliasFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"I_CmsVfsDriver",
"vfsDriver",
"=",
"getVfsDriver",
"(",
"dbc",
")",
";",
"vfsDriver",
".",
"deleteAli... | Deletes aliases indicated by a filter.<p>
@param dbc the current database context
@param project the current project
@param filter the filter which describes which aliases to delete
@throws CmsException if something goes wrong | [
"Deletes",
"aliases",
"indicated",
"by",
"a",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2233-L2237 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java | RegExHelper.stringMatchesPattern | public static boolean stringMatchesPattern (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue)
{
return getMatcher (sRegEx, sValue).matches ();
} | java | public static boolean stringMatchesPattern (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue)
{
return getMatcher (sRegEx, sValue).matches ();
} | [
"public",
"static",
"boolean",
"stringMatchesPattern",
"(",
"@",
"Nonnull",
"@",
"RegEx",
"final",
"String",
"sRegEx",
",",
"@",
"Nonnull",
"final",
"String",
"sValue",
")",
"{",
"return",
"getMatcher",
"(",
"sRegEx",
",",
"sValue",
")",
".",
"matches",
"(",... | A shortcut helper method to determine whether a string matches a certain
regular expression or not.
@param sRegEx
The regular expression to be used. The compiled regular expression
pattern is cached. May neither be <code>null</code> nor empty.
@param sValue
The string value to compare against the regular expression.
@return <code>true</code> if the string matches the regular expression,
<code>false</code> otherwise. | [
"A",
"shortcut",
"helper",
"method",
"to",
"determine",
"whether",
"a",
"string",
"matches",
"a",
"certain",
"regular",
"expression",
"or",
"not",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java#L206-L209 |
mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java | ModelAdapter.removeByIdentifier | public ModelAdapter<Model, Item> removeByIdentifier(final long identifier) {
recursive(new AdapterPredicate<Item>() {
@Override
public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) {
if (identifier == item.getIdentifier()) {
//if it's a subitem remove it from the parent
if (item instanceof ISubItem) {
//a sub item which is not in the list can be instantly deleted
IExpandable parent = (IExpandable) ((ISubItem) item).getParent();
//parent should not be null, but check in any case..
if (parent != null) {
parent.getSubItems().remove(item);
}
}
if (position != -1) {
//a normal displayed item can only be deleted afterwards
remove(position);
}
}
return false;
}
}, false);
return this;
} | java | public ModelAdapter<Model, Item> removeByIdentifier(final long identifier) {
recursive(new AdapterPredicate<Item>() {
@Override
public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) {
if (identifier == item.getIdentifier()) {
//if it's a subitem remove it from the parent
if (item instanceof ISubItem) {
//a sub item which is not in the list can be instantly deleted
IExpandable parent = (IExpandable) ((ISubItem) item).getParent();
//parent should not be null, but check in any case..
if (parent != null) {
parent.getSubItems().remove(item);
}
}
if (position != -1) {
//a normal displayed item can only be deleted afterwards
remove(position);
}
}
return false;
}
}, false);
return this;
} | [
"public",
"ModelAdapter",
"<",
"Model",
",",
"Item",
">",
"removeByIdentifier",
"(",
"final",
"long",
"identifier",
")",
"{",
"recursive",
"(",
"new",
"AdapterPredicate",
"<",
"Item",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
... | remvoes an item by it's identifier
@param identifier the identifier to search for
@return this | [
"remvoes",
"an",
"item",
"by",
"it",
"s",
"identifier"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java#L515-L539 |
LearnLib/automatalib | visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java | DOT.renderDOT | public static void renderDOT(File dotFile, boolean modal) throws IOException {
renderDOT(IOUtil.asBufferedUTF8Reader(dotFile), modal);
} | java | public static void renderDOT(File dotFile, boolean modal) throws IOException {
renderDOT(IOUtil.asBufferedUTF8Reader(dotFile), modal);
} | [
"public",
"static",
"void",
"renderDOT",
"(",
"File",
"dotFile",
",",
"boolean",
"modal",
")",
"throws",
"IOException",
"{",
"renderDOT",
"(",
"IOUtil",
".",
"asBufferedUTF8Reader",
"(",
"dotFile",
")",
",",
"modal",
")",
";",
"}"
] | Renders a GraphVIZ description from a string and displays it in a Swing window. Convenience method, see {@link
#renderDOT(Reader, boolean)}.
@throws FileNotFoundException
if opening the file resulted in errors. | [
"Renders",
"a",
"GraphVIZ",
"description",
"from",
"a",
"string",
"and",
"displays",
"it",
"in",
"a",
"Swing",
"window",
".",
"Convenience",
"method",
"see",
"{",
"@link",
"#renderDOT",
"(",
"Reader",
"boolean",
")",
"}",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java#L240-L242 |
openbase/jul | extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java | MultiLanguageTextProcessor.generateMultiLanguageTextBuilder | public static MultiLanguageText.Builder generateMultiLanguageTextBuilder(final Locale locale, final String multiLanguageText) {
return addMultiLanguageText(MultiLanguageText.newBuilder(), locale.getLanguage(), multiLanguageText);
} | java | public static MultiLanguageText.Builder generateMultiLanguageTextBuilder(final Locale locale, final String multiLanguageText) {
return addMultiLanguageText(MultiLanguageText.newBuilder(), locale.getLanguage(), multiLanguageText);
} | [
"public",
"static",
"MultiLanguageText",
".",
"Builder",
"generateMultiLanguageTextBuilder",
"(",
"final",
"Locale",
"locale",
",",
"final",
"String",
"multiLanguageText",
")",
"{",
"return",
"addMultiLanguageText",
"(",
"MultiLanguageText",
".",
"newBuilder",
"(",
")",... | Create a new multiLanguageTextBuilder and register multiLanguageText with given locale.
@param locale the locale from which the language code is extracted for which the multiLanguageText is added
@param multiLanguageText the multiLanguageText to be added
@return the updated multiLanguageText builder | [
"Create",
"a",
"new",
"multiLanguageTextBuilder",
"and",
"register",
"multiLanguageText",
"with",
"given",
"locale",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java#L82-L84 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.cloneDirectoryManager | protected DirectoryManager cloneDirectoryManager(DirectoryManager directoryManager, String suffix) throws IOException
{
try
{
DirectoryManager df = directoryManager.getClass().newInstance();
df.init(this.path + suffix);
return df;
}
catch (IOException e)
{
throw e;
}
catch (Exception e)
{
IOException ex = new IOException();
ex.initCause(e);
throw ex;
}
} | java | protected DirectoryManager cloneDirectoryManager(DirectoryManager directoryManager, String suffix) throws IOException
{
try
{
DirectoryManager df = directoryManager.getClass().newInstance();
df.init(this.path + suffix);
return df;
}
catch (IOException e)
{
throw e;
}
catch (Exception e)
{
IOException ex = new IOException();
ex.initCause(e);
throw ex;
}
} | [
"protected",
"DirectoryManager",
"cloneDirectoryManager",
"(",
"DirectoryManager",
"directoryManager",
",",
"String",
"suffix",
")",
"throws",
"IOException",
"{",
"try",
"{",
"DirectoryManager",
"df",
"=",
"directoryManager",
".",
"getClass",
"(",
")",
".",
"newInstan... | Clone the default Index directory manager
@return an initialized {@link DirectoryManager}.
@throws IOException
if the directory manager cannot be instantiated or an
exception occurs while initializing the manager. | [
"Clone",
"the",
"default",
"Index",
"directory",
"manager"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1991-L2009 |
Netflix/astyanax | astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeColumnEntityMapper.java | CompositeColumnEntityMapper.setField | public boolean setField(Object entity, ColumnList<ByteBuffer> columns) throws Exception {
List<Object> list = getOrCreateField(entity);
// Iterate through columns and add embedded entities to the list
for (com.netflix.astyanax.model.Column<ByteBuffer> c : columns) {
list.add(fromColumn(c));
}
return true;
} | java | public boolean setField(Object entity, ColumnList<ByteBuffer> columns) throws Exception {
List<Object> list = getOrCreateField(entity);
// Iterate through columns and add embedded entities to the list
for (com.netflix.astyanax.model.Column<ByteBuffer> c : columns) {
list.add(fromColumn(c));
}
return true;
} | [
"public",
"boolean",
"setField",
"(",
"Object",
"entity",
",",
"ColumnList",
"<",
"ByteBuffer",
">",
"columns",
")",
"throws",
"Exception",
"{",
"List",
"<",
"Object",
">",
"list",
"=",
"getOrCreateField",
"(",
"entity",
")",
";",
"// Iterate through columns and... | Set the collection field using the provided column list of embedded entities
@param entity
@param name
@param column
@return
@throws Exception | [
"Set",
"the",
"collection",
"field",
"using",
"the",
"provided",
"column",
"list",
"of",
"embedded",
"entities"
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeColumnEntityMapper.java#L178-L187 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/Maps2.java | Maps2.putAllIntoListMap | public static <K, V> void putAllIntoListMap(K key, Collection<? extends V> values, Map<? super K, List<V>> map) {
List<V> list = map.get(key);
if (list == null) {
list = Lists.newArrayList(values);
map.put(key, list);
} else {
list.addAll(values);
}
} | java | public static <K, V> void putAllIntoListMap(K key, Collection<? extends V> values, Map<? super K, List<V>> map) {
List<V> list = map.get(key);
if (list == null) {
list = Lists.newArrayList(values);
map.put(key, list);
} else {
list.addAll(values);
}
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"putAllIntoListMap",
"(",
"K",
"key",
",",
"Collection",
"<",
"?",
"extends",
"V",
">",
"values",
",",
"Map",
"<",
"?",
"super",
"K",
",",
"List",
"<",
"V",
">",
">",
"map",
")",
"{",
"List",
... | Puts a value into a map that supports lists as values.
The list is created on-demand. | [
"Puts",
"a",
"value",
"into",
"a",
"map",
"that",
"supports",
"lists",
"as",
"values",
".",
"The",
"list",
"is",
"created",
"on",
"-",
"demand",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/Maps2.java#L84-L92 |
aol/cyclops | cyclops/src/main/java/cyclops/companion/Streams.java | Streams.takeUntil | public static <U> Stream<U> takeUntil(final Stream<U> stream, final Predicate<? super U> predicate) {
return takeWhile(stream, predicate.negate());
} | java | public static <U> Stream<U> takeUntil(final Stream<U> stream, final Predicate<? super U> predicate) {
return takeWhile(stream, predicate.negate());
} | [
"public",
"static",
"<",
"U",
">",
"Stream",
"<",
"U",
">",
"takeUntil",
"(",
"final",
"Stream",
"<",
"U",
">",
"stream",
",",
"final",
"Predicate",
"<",
"?",
"super",
"U",
">",
"predicate",
")",
"{",
"return",
"takeWhile",
"(",
"stream",
",",
"predi... | Take elements from a Stream until the predicate holds
<pre>
{@code Streams.takeUntil(Stream.of(4,3,6,7),i->i==6).collect(CyclopsCollectors.toList());
//[4,3]
}
</pre>
@param stream
@param predicate
@return | [
"Take",
"elements",
"from",
"a",
"Stream",
"until",
"the",
"predicate",
"holds",
"<pre",
">",
"{"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1307-L1310 |
app55/app55-java | src/support/java/org/apache/harmony/beans/internal/nls/Messages.java | Messages.getString | static public String getString(String msg, Object[] args)
{
String format = msg;
if (bundle != null)
{
try
{
format = bundle.getString(msg);
}
catch (MissingResourceException e)
{
}
}
return format(format, args);
} | java | static public String getString(String msg, Object[] args)
{
String format = msg;
if (bundle != null)
{
try
{
format = bundle.getString(msg);
}
catch (MissingResourceException e)
{
}
}
return format(format, args);
} | [
"static",
"public",
"String",
"getString",
"(",
"String",
"msg",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"String",
"format",
"=",
"msg",
";",
"if",
"(",
"bundle",
"!=",
"null",
")",
"{",
"try",
"{",
"format",
"=",
"bundle",
".",
"getString",
"(",
... | Retrieves a message which takes several arguments.
@param msg
String the key to look up.
@param args
Object[] the objects to insert in the formatted output.
@return String the message for that key in the system message bundle. | [
"Retrieves",
"a",
"message",
"which",
"takes",
"several",
"arguments",
"."
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/org/apache/harmony/beans/internal/nls/Messages.java#L133-L149 |
mozilla/rhino | src/org/mozilla/javascript/WrapFactory.java | WrapFactory.wrapNewObject | public Scriptable wrapNewObject(Context cx, Scriptable scope, Object obj)
{
if (obj instanceof Scriptable) {
return (Scriptable)obj;
}
Class<?> cls = obj.getClass();
if (cls.isArray()) {
return NativeJavaArray.wrap(scope, obj);
}
return wrapAsJavaObject(cx, scope, obj, null);
} | java | public Scriptable wrapNewObject(Context cx, Scriptable scope, Object obj)
{
if (obj instanceof Scriptable) {
return (Scriptable)obj;
}
Class<?> cls = obj.getClass();
if (cls.isArray()) {
return NativeJavaArray.wrap(scope, obj);
}
return wrapAsJavaObject(cx, scope, obj, null);
} | [
"public",
"Scriptable",
"wrapNewObject",
"(",
"Context",
"cx",
",",
"Scriptable",
"scope",
",",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Scriptable",
")",
"{",
"return",
"(",
"Scriptable",
")",
"obj",
";",
"}",
"Class",
"<",
"?",
">",
... | Wrap an object newly created by a constructor call.
@param cx the current Context for this thread
@param scope the scope of the executing script
@param obj the object to be wrapped
@return the wrapped value. | [
"Wrap",
"an",
"object",
"newly",
"created",
"by",
"a",
"constructor",
"call",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/WrapFactory.java#L87-L97 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java | ReplicationsInner.listAsync | public Observable<Page<ReplicationInner>> listAsync(final String resourceGroupName, final String registryName) {
return listWithServiceResponseAsync(resourceGroupName, registryName)
.map(new Func1<ServiceResponse<Page<ReplicationInner>>, Page<ReplicationInner>>() {
@Override
public Page<ReplicationInner> call(ServiceResponse<Page<ReplicationInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ReplicationInner>> listAsync(final String resourceGroupName, final String registryName) {
return listWithServiceResponseAsync(resourceGroupName, registryName)
.map(new Func1<ServiceResponse<Page<ReplicationInner>>, Page<ReplicationInner>>() {
@Override
public Page<ReplicationInner> call(ServiceResponse<Page<ReplicationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ReplicationInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"registryName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",... | Lists all the replications for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ReplicationInner> object | [
"Lists",
"all",
"the",
"replications",
"for",
"the",
"specified",
"container",
"registry",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java#L953-L961 |
revapi/revapi | revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java | CheckBase.isBothPrivate | public boolean isBothPrivate(@Nullable JavaModelElement a, @Nullable JavaModelElement b) {
if (a == null || b == null) {
return false;
}
return !isAccessible(a) && !isAccessible(b);
} | java | public boolean isBothPrivate(@Nullable JavaModelElement a, @Nullable JavaModelElement b) {
if (a == null || b == null) {
return false;
}
return !isAccessible(a) && !isAccessible(b);
} | [
"public",
"boolean",
"isBothPrivate",
"(",
"@",
"Nullable",
"JavaModelElement",
"a",
",",
"@",
"Nullable",
"JavaModelElement",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"null",
"||",
"b",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"!",
"... | Checks whether both provided elements are (package) private. If one of them is null, the fact cannot be
determined and therefore this method would return false.
@param a first element
@param b second element
@return true if both elements are not null and are private or package private | [
"Checks",
"whether",
"both",
"provided",
"elements",
"are",
"(",
"package",
")",
"private",
".",
"If",
"one",
"of",
"them",
"is",
"null",
"the",
"fact",
"cannot",
"be",
"determined",
"and",
"therefore",
"this",
"method",
"would",
"return",
"false",
"."
] | train | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java#L67-L73 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java | Scopes.scopedElementsFor | public static Iterable<IEObjectDescription> scopedElementsFor(Iterable<? extends EObject> elements) {
return scopedElementsFor(elements, QualifiedName.wrapper(SimpleAttributeResolver.NAME_RESOLVER));
} | java | public static Iterable<IEObjectDescription> scopedElementsFor(Iterable<? extends EObject> elements) {
return scopedElementsFor(elements, QualifiedName.wrapper(SimpleAttributeResolver.NAME_RESOLVER));
} | [
"public",
"static",
"Iterable",
"<",
"IEObjectDescription",
">",
"scopedElementsFor",
"(",
"Iterable",
"<",
"?",
"extends",
"EObject",
">",
"elements",
")",
"{",
"return",
"scopedElementsFor",
"(",
"elements",
",",
"QualifiedName",
".",
"wrapper",
"(",
"SimpleAttr... | transforms an {@link Iterable} of {@link EObject}s into an {@link Iterable} of {@link IEObjectDescription}s computing
the {@link EAttribute} 'name' to compute the {@link IEObjectDescription}'s name. If not existent the object is
filtered out. | [
"transforms",
"an",
"{"
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java#L78-L80 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/HttpUtils.java | HttpUtils.doPost | public static String doPost(final String action, final Map<String, String> parameters) {
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
for (Entry<String, String> nameValuePair : parameters.entrySet()) {
nvps.add(new BasicNameValuePair(nameValuePair.getKey(), nameValuePair.getValue()));
}
HttpPost httpPost = new HttpPost(action);
try {
httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
CloseableHttpClient httpClient = getHttpClient();
CloseableHttpResponse httpResponse = httpClient.execute(httpPost);
return EntityUtils.toString(httpResponse.getEntity());
} catch (Exception e) {
throw new HttpException(e);
}
} | java | public static String doPost(final String action, final Map<String, String> parameters) {
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
for (Entry<String, String> nameValuePair : parameters.entrySet()) {
nvps.add(new BasicNameValuePair(nameValuePair.getKey(), nameValuePair.getValue()));
}
HttpPost httpPost = new HttpPost(action);
try {
httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
CloseableHttpClient httpClient = getHttpClient();
CloseableHttpResponse httpResponse = httpClient.execute(httpPost);
return EntityUtils.toString(httpResponse.getEntity());
} catch (Exception e) {
throw new HttpException(e);
}
} | [
"public",
"static",
"String",
"doPost",
"(",
"final",
"String",
"action",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"List",
"<",
"NameValuePair",
">",
"nvps",
"=",
"new",
"ArrayList",
"<",
"NameValuePair",
">",
"(",
... | access given action with given parameters(<strong>default encoding by
"UTF-8"</strong>) by post request without retry when exception.
@param action action url to access
@param parameters parameters to post
@return response content of target action url | [
"access",
"given",
"action",
"with",
"given",
"parameters",
"(",
"<strong",
">",
"default",
"encoding",
"by",
"UTF",
"-",
"8",
"<",
"/",
"strong",
">",
")",
"by",
"post",
"request",
"without",
"retry",
"when",
"exception",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/HttpUtils.java#L102-L118 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutGatewayResponseResult.java | PutGatewayResponseResult.withResponseTemplates | public PutGatewayResponseResult withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | java | public PutGatewayResponseResult withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | [
"public",
"PutGatewayResponseResult",
"withResponseTemplates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseTemplates",
")",
"{",
"setResponseTemplates",
"(",
"responseTemplates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs.
</p>
@param responseTemplates
Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Response",
"templates",
"of",
"the",
"<a",
">",
"GatewayResponse<",
"/",
"a",
">",
"as",
"a",
"string",
"-",
"to",
"-",
"string",
"map",
"of",
"key",
"-",
"value",
"pairs",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutGatewayResponseResult.java#L544-L547 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java | WebUtils.getService | public static WebApplicationService getService(final List<ArgumentExtractor> argumentExtractors, final RequestContext context) {
val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context);
return HttpRequestUtils.getService(argumentExtractors, request);
} | java | public static WebApplicationService getService(final List<ArgumentExtractor> argumentExtractors, final RequestContext context) {
val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context);
return HttpRequestUtils.getService(argumentExtractors, request);
} | [
"public",
"static",
"WebApplicationService",
"getService",
"(",
"final",
"List",
"<",
"ArgumentExtractor",
">",
"argumentExtractors",
",",
"final",
"RequestContext",
"context",
")",
"{",
"val",
"request",
"=",
"WebUtils",
".",
"getHttpServletRequestFromExternalWebflowCont... | Gets the service.
@param argumentExtractors the argument extractors
@param context the context
@return the service | [
"Gets",
"the",
"service",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L137-L140 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.copyFromCopyRef | public /*@Nullable*/DbxEntry copyFromCopyRef(String copyRef, String toPath)
throws DbxException
{
if (copyRef == null) throw new IllegalArgumentException("'copyRef' can't be null");
if (copyRef.length() == 0) throw new IllegalArgumentException("'copyRef' can't be empty");
DbxPathV1.checkArgNonRoot("toPath", toPath);
String[] params = {
"root", "auto",
"from_copy_ref", copyRef,
"to_path", toPath,
};
return doPost(host.getApi(), "1/fileops/copy", params, null, new DbxRequestUtil.ResponseHandler</*@Nullable*/DbxEntry>()
{
@Override
public /*@Nullable*/DbxEntry handle(HttpRequestor.Response response)
throws DbxException
{
if (response.getStatusCode() != 200) throw DbxRequestUtil.unexpectedStatus(response);
DbxEntry.WithChildren dwc = DbxRequestUtil.readJsonFromResponse(DbxEntry.WithChildren.Reader, response);
if (dwc == null) return null; // TODO: When can this happen?
return dwc.entry;
}
});
} | java | public /*@Nullable*/DbxEntry copyFromCopyRef(String copyRef, String toPath)
throws DbxException
{
if (copyRef == null) throw new IllegalArgumentException("'copyRef' can't be null");
if (copyRef.length() == 0) throw new IllegalArgumentException("'copyRef' can't be empty");
DbxPathV1.checkArgNonRoot("toPath", toPath);
String[] params = {
"root", "auto",
"from_copy_ref", copyRef,
"to_path", toPath,
};
return doPost(host.getApi(), "1/fileops/copy", params, null, new DbxRequestUtil.ResponseHandler</*@Nullable*/DbxEntry>()
{
@Override
public /*@Nullable*/DbxEntry handle(HttpRequestor.Response response)
throws DbxException
{
if (response.getStatusCode() != 200) throw DbxRequestUtil.unexpectedStatus(response);
DbxEntry.WithChildren dwc = DbxRequestUtil.readJsonFromResponse(DbxEntry.WithChildren.Reader, response);
if (dwc == null) return null; // TODO: When can this happen?
return dwc.entry;
}
});
} | [
"public",
"/*@Nullable*/",
"DbxEntry",
"copyFromCopyRef",
"(",
"String",
"copyRef",
",",
"String",
"toPath",
")",
"throws",
"DbxException",
"{",
"if",
"(",
"copyRef",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"'copyRef' can't be null\"",
... | Create a file or folder at {@code toPath} based on the given copy ref (created with
{@link #createCopyRef}). | [
"Create",
"a",
"file",
"or",
"folder",
"at",
"{"
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L2097-L2122 |
molgenis/molgenis | molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/RelationTransformer.java | RelationTransformer.transformMappedBys | static void transformMappedBys(EntityType entityType, Map<String, Attribute> newAttributes) {
if (newAttributes.isEmpty()) {
return;
}
stream(entityType.getAtomicAttributes())
.filter(Attribute::isMappedBy)
.forEach(attr -> transformMappedBy(attr, newAttributes));
} | java | static void transformMappedBys(EntityType entityType, Map<String, Attribute> newAttributes) {
if (newAttributes.isEmpty()) {
return;
}
stream(entityType.getAtomicAttributes())
.filter(Attribute::isMappedBy)
.forEach(attr -> transformMappedBy(attr, newAttributes));
} | [
"static",
"void",
"transformMappedBys",
"(",
"EntityType",
"entityType",
",",
"Map",
"<",
"String",
",",
"Attribute",
">",
"newAttributes",
")",
"{",
"if",
"(",
"newAttributes",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"stream",
"(",
"entity... | Changes the 'mappedBy' property of all {@link AttributeType#ONE_TO_MANY} attributes of an
{@link EntityType} to other, new Attributes. Does nothing for mappedBy attributes whose IDs are
not present in the supplied Map.
@param entityType the EntityType to update
@param newAttributes a Map of (old) Attribute IDs and new Attributes | [
"Changes",
"the",
"mappedBy",
"property",
"of",
"all",
"{",
"@link",
"AttributeType#ONE_TO_MANY",
"}",
"attributes",
"of",
"an",
"{",
"@link",
"EntityType",
"}",
"to",
"other",
"new",
"Attributes",
".",
"Does",
"nothing",
"for",
"mappedBy",
"attributes",
"whose"... | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/RelationTransformer.java#L99-L107 |
lucee/Lucee | core/src/main/java/lucee/runtime/coder/Base64Coder.java | Base64Coder.encodeFromString | public static String encodeFromString(String plain, String charset) throws CoderException, UnsupportedEncodingException {
return encode(plain.getBytes(charset));
} | java | public static String encodeFromString(String plain, String charset) throws CoderException, UnsupportedEncodingException {
return encode(plain.getBytes(charset));
} | [
"public",
"static",
"String",
"encodeFromString",
"(",
"String",
"plain",
",",
"String",
"charset",
")",
"throws",
"CoderException",
",",
"UnsupportedEncodingException",
"{",
"return",
"encode",
"(",
"plain",
".",
"getBytes",
"(",
"charset",
")",
")",
";",
"}"
] | encodes a String to Base64 String
@param plain String to encode
@return encoded String
@throws CoderException
@throws UnsupportedEncodingException | [
"encodes",
"a",
"String",
"to",
"Base64",
"String"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/coder/Base64Coder.java#L52-L54 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/readerwriter/singlefile/SingleFileJournalReader.java | SingleFileJournalReader.readJournalEntry | @Override
public synchronized ConsumerJournalEntry readJournalEntry()
throws JournalException, XMLStreamException {
if (!open) {
return null;
}
if (!advancedPastHeader) {
advanceIntoFile();
advancedPastHeader = true;
}
XMLEvent next = reader.peek();
// advance past any whitespace events.
while (next.isCharacters() && next.asCharacters().isWhiteSpace()) {
reader.nextEvent();
next = reader.peek();
}
if (isStartTagEvent(next, QNAME_TAG_JOURNAL_ENTRY)) {
String identifier = peekAtJournalEntryIdentifier();
ConsumerJournalEntry journalEntry = super.readJournalEntry(reader);
journalEntry.setIdentifier(identifier);
return journalEntry;
} else if (isEndTagEvent(next, QNAME_TAG_JOURNAL)) {
return null;
} else {
throw getNotNextMemberOrEndOfGroupException(QNAME_TAG_JOURNAL,
QNAME_TAG_JOURNAL_ENTRY,
next);
}
} | java | @Override
public synchronized ConsumerJournalEntry readJournalEntry()
throws JournalException, XMLStreamException {
if (!open) {
return null;
}
if (!advancedPastHeader) {
advanceIntoFile();
advancedPastHeader = true;
}
XMLEvent next = reader.peek();
// advance past any whitespace events.
while (next.isCharacters() && next.asCharacters().isWhiteSpace()) {
reader.nextEvent();
next = reader.peek();
}
if (isStartTagEvent(next, QNAME_TAG_JOURNAL_ENTRY)) {
String identifier = peekAtJournalEntryIdentifier();
ConsumerJournalEntry journalEntry = super.readJournalEntry(reader);
journalEntry.setIdentifier(identifier);
return journalEntry;
} else if (isEndTagEvent(next, QNAME_TAG_JOURNAL)) {
return null;
} else {
throw getNotNextMemberOrEndOfGroupException(QNAME_TAG_JOURNAL,
QNAME_TAG_JOURNAL_ENTRY,
next);
}
} | [
"@",
"Override",
"public",
"synchronized",
"ConsumerJournalEntry",
"readJournalEntry",
"(",
")",
"throws",
"JournalException",
",",
"XMLStreamException",
"{",
"if",
"(",
"!",
"open",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"advancedPastHeader",
")"... | Advance past any white space, and then see whether we have any more
JournalEntry tags. If we don't, just return null. | [
"Advance",
"past",
"any",
"white",
"space",
"and",
"then",
"see",
"whether",
"we",
"have",
"any",
"more",
"JournalEntry",
"tags",
".",
"If",
"we",
"don",
"t",
"just",
"return",
"null",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/readerwriter/singlefile/SingleFileJournalReader.java#L128-L159 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java | FieldScopeLogic.subScope | @Override
public final FieldScopeLogic subScope(
Descriptor rootDescriptor, FieldDescriptorOrUnknown fieldDescriptorOrUnknown) {
FieldScopeResult result = policyFor(rootDescriptor, fieldDescriptorOrUnknown);
if (result.recursive()) {
return result.included() ? all() : none();
} else {
return subScopeImpl(rootDescriptor, fieldDescriptorOrUnknown);
}
} | java | @Override
public final FieldScopeLogic subScope(
Descriptor rootDescriptor, FieldDescriptorOrUnknown fieldDescriptorOrUnknown) {
FieldScopeResult result = policyFor(rootDescriptor, fieldDescriptorOrUnknown);
if (result.recursive()) {
return result.included() ? all() : none();
} else {
return subScopeImpl(rootDescriptor, fieldDescriptorOrUnknown);
}
} | [
"@",
"Override",
"public",
"final",
"FieldScopeLogic",
"subScope",
"(",
"Descriptor",
"rootDescriptor",
",",
"FieldDescriptorOrUnknown",
"fieldDescriptorOrUnknown",
")",
"{",
"FieldScopeResult",
"result",
"=",
"policyFor",
"(",
"rootDescriptor",
",",
"fieldDescriptorOrUnkno... | Returns a {@code FieldScopeLogic} to handle the message pointed to by this descriptor.
<p>Subclasses which can return non-recursive {@link FieldScopeResult}s must override {@link
#subScopeImpl} to implement those cases. | [
"Returns",
"a",
"{",
"@code",
"FieldScopeLogic",
"}",
"to",
"handle",
"the",
"message",
"pointed",
"to",
"by",
"this",
"descriptor",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java#L66-L75 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/DownloadCallable.java | DownloadCallable.truncateDestinationFileIfNecessary | private void truncateDestinationFileIfNecessary() {
RandomAccessFile raf = null;
if (!FileLocks.lock(dstfile)) {
throw new FileLockException("Fail to lock " + dstfile);
}
try {
raf = new RandomAccessFile(dstfile, "rw");
if (lastFullyMergedPartNumber == 0) {
raf.setLength(0);
} else {
long lastByte = ServiceUtils.getLastByteInPart(s3, req, lastFullyMergedPartNumber);
if (dstfile.length() < lastByte) {
throw new SdkClientException(
"File " + dstfile.getAbsolutePath() + " has been modified since last pause.");
}
raf.setLength(lastByte + 1);
download.getProgress().updateProgress(lastByte + 1);
}
} catch (Exception e) {
throw new SdkClientException("Unable to append part file to dstfile " + e.getMessage(), e);
} finally {
IOUtils.closeQuietly(raf, LOG);
FileLocks.unlock(dstfile);
}
} | java | private void truncateDestinationFileIfNecessary() {
RandomAccessFile raf = null;
if (!FileLocks.lock(dstfile)) {
throw new FileLockException("Fail to lock " + dstfile);
}
try {
raf = new RandomAccessFile(dstfile, "rw");
if (lastFullyMergedPartNumber == 0) {
raf.setLength(0);
} else {
long lastByte = ServiceUtils.getLastByteInPart(s3, req, lastFullyMergedPartNumber);
if (dstfile.length() < lastByte) {
throw new SdkClientException(
"File " + dstfile.getAbsolutePath() + " has been modified since last pause.");
}
raf.setLength(lastByte + 1);
download.getProgress().updateProgress(lastByte + 1);
}
} catch (Exception e) {
throw new SdkClientException("Unable to append part file to dstfile " + e.getMessage(), e);
} finally {
IOUtils.closeQuietly(raf, LOG);
FileLocks.unlock(dstfile);
}
} | [
"private",
"void",
"truncateDestinationFileIfNecessary",
"(",
")",
"{",
"RandomAccessFile",
"raf",
"=",
"null",
";",
"if",
"(",
"!",
"FileLocks",
".",
"lock",
"(",
"dstfile",
")",
")",
"{",
"throw",
"new",
"FileLockException",
"(",
"\"Fail to lock \"",
"+",
"d... | If only partial part object is merged into the dstFile(due to pause
operation), adjust the file length so that the part starts writing from
the correct position. | [
"If",
"only",
"partial",
"part",
"object",
"is",
"merged",
"into",
"the",
"dstFile",
"(",
"due",
"to",
"pause",
"operation",
")",
"adjust",
"the",
"file",
"length",
"so",
"that",
"the",
"part",
"starts",
"writing",
"from",
"the",
"correct",
"position",
"."... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/DownloadCallable.java#L190-L215 |
JosePaumard/streams-utils | src/main/java/org/paumard/streams/StreamsUtils.java | StreamsUtils.shiftingWindowAveragingLong | public static DoubleStream shiftingWindowAveragingLong(LongStream longStream, int rollingFactor) {
Objects.requireNonNull(longStream);
RollingOfLongSpliterator ofLongSpliterator = RollingOfLongSpliterator.of(longStream.spliterator(), rollingFactor);
return StreamSupport.stream(ofLongSpliterator, longStream.isParallel())
.onClose(longStream::close)
.mapToDouble(subStream -> subStream.average().getAsDouble());
} | java | public static DoubleStream shiftingWindowAveragingLong(LongStream longStream, int rollingFactor) {
Objects.requireNonNull(longStream);
RollingOfLongSpliterator ofLongSpliterator = RollingOfLongSpliterator.of(longStream.spliterator(), rollingFactor);
return StreamSupport.stream(ofLongSpliterator, longStream.isParallel())
.onClose(longStream::close)
.mapToDouble(subStream -> subStream.average().getAsDouble());
} | [
"public",
"static",
"DoubleStream",
"shiftingWindowAveragingLong",
"(",
"LongStream",
"longStream",
",",
"int",
"rollingFactor",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"longStream",
")",
";",
"RollingOfLongSpliterator",
"ofLongSpliterator",
"=",
"RollingOfLongSp... | <p>Generates a stream that is computed from a provided long stream by first rolling it in the same
way as the <code>roll()</code> method does. The average is then computed on each substream, to
form the final double stream. No boxing / unboxing is conducted in the process.
<p>The resulting stream has the same number of elements as the provided stream,
minus the size of the window width, to preserve consistency of each collection. </p>
<p>A <code>NullPointerException</code> will be thrown if the provided stream is null.</p>
@param longStream the processed stream
@param rollingFactor the size of the window to apply the collector on
@return a stream in which each value is the collection of the provided stream | [
"<p",
">",
"Generates",
"a",
"stream",
"that",
"is",
"computed",
"from",
"a",
"provided",
"long",
"stream",
"by",
"first",
"rolling",
"it",
"in",
"the",
"same",
"way",
"as",
"the",
"<code",
">",
"roll",
"()",
"<",
"/",
"code",
">",
"method",
"does",
... | train | https://github.com/JosePaumard/streams-utils/blob/56152574af0aca44c5f679761202a8f90984ab73/src/main/java/org/paumard/streams/StreamsUtils.java#L626-L633 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggerHistoriesInner.java | WorkflowTriggerHistoriesInner.getAsync | public Observable<WorkflowTriggerHistoryInner> getAsync(String resourceGroupName, String workflowName, String triggerName, String historyName) {
return getWithServiceResponseAsync(resourceGroupName, workflowName, triggerName, historyName).map(new Func1<ServiceResponse<WorkflowTriggerHistoryInner>, WorkflowTriggerHistoryInner>() {
@Override
public WorkflowTriggerHistoryInner call(ServiceResponse<WorkflowTriggerHistoryInner> response) {
return response.body();
}
});
} | java | public Observable<WorkflowTriggerHistoryInner> getAsync(String resourceGroupName, String workflowName, String triggerName, String historyName) {
return getWithServiceResponseAsync(resourceGroupName, workflowName, triggerName, historyName).map(new Func1<ServiceResponse<WorkflowTriggerHistoryInner>, WorkflowTriggerHistoryInner>() {
@Override
public WorkflowTriggerHistoryInner call(ServiceResponse<WorkflowTriggerHistoryInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkflowTriggerHistoryInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
",",
"String",
"triggerName",
",",
"String",
"historyName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceG... | Gets a workflow trigger history.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param triggerName The workflow trigger name.
@param historyName The workflow trigger history name. Corresponds to the run name for triggers that resulted in a run.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowTriggerHistoryInner object | [
"Gets",
"a",
"workflow",
"trigger",
"history",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggerHistoriesInner.java#L387-L394 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGButton.java | SVGButton.setTitle | public void setTitle(String title, String textcolor) {
this.title = title;
if(titlecss == null) {
titlecss = new CSSClass(this, "text");
titlecss.setStatement(SVGConstants.CSS_TEXT_ANCHOR_PROPERTY, SVGConstants.CSS_MIDDLE_VALUE);
titlecss.setStatement(SVGConstants.CSS_FILL_PROPERTY, textcolor);
titlecss.setStatement(SVGConstants.CSS_FONT_SIZE_PROPERTY, .6 * h);
}
} | java | public void setTitle(String title, String textcolor) {
this.title = title;
if(titlecss == null) {
titlecss = new CSSClass(this, "text");
titlecss.setStatement(SVGConstants.CSS_TEXT_ANCHOR_PROPERTY, SVGConstants.CSS_MIDDLE_VALUE);
titlecss.setStatement(SVGConstants.CSS_FILL_PROPERTY, textcolor);
titlecss.setStatement(SVGConstants.CSS_FONT_SIZE_PROPERTY, .6 * h);
}
} | [
"public",
"void",
"setTitle",
"(",
"String",
"title",
",",
"String",
"textcolor",
")",
"{",
"this",
".",
"title",
"=",
"title",
";",
"if",
"(",
"titlecss",
"==",
"null",
")",
"{",
"titlecss",
"=",
"new",
"CSSClass",
"(",
"this",
",",
"\"text\"",
")",
... | Set the button title
@param title Button title
@param textcolor Color | [
"Set",
"the",
"button",
"title"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGButton.java#L155-L163 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java | ConvertBufferedImage.convertFrom | public static <T extends GrayI16<T>>T convertFrom(BufferedImage src, T dst , Class<T> type ) {
if (dst != null) {
dst.reshape(src.getWidth(), src.getHeight());
} else {
dst = GeneralizedImageOps.createSingleBand(type, src.getWidth(), src.getHeight());
}
DataBuffer buffer = src.getRaster().getDataBuffer();
if (buffer.getDataType() == DataBuffer.TYPE_USHORT ) {
ConvertRaster.bufferedToGray((DataBufferUShort)buffer, src.getRaster(), dst);
return dst;
}
ConvertRaster.bufferedToGray(src, dst);
return dst;
} | java | public static <T extends GrayI16<T>>T convertFrom(BufferedImage src, T dst , Class<T> type ) {
if (dst != null) {
dst.reshape(src.getWidth(), src.getHeight());
} else {
dst = GeneralizedImageOps.createSingleBand(type, src.getWidth(), src.getHeight());
}
DataBuffer buffer = src.getRaster().getDataBuffer();
if (buffer.getDataType() == DataBuffer.TYPE_USHORT ) {
ConvertRaster.bufferedToGray((DataBufferUShort)buffer, src.getRaster(), dst);
return dst;
}
ConvertRaster.bufferedToGray(src, dst);
return dst;
} | [
"public",
"static",
"<",
"T",
"extends",
"GrayI16",
"<",
"T",
">",
">",
"T",
"convertFrom",
"(",
"BufferedImage",
"src",
",",
"T",
"dst",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"dst",
"!=",
"null",
")",
"{",
"dst",
".",
"reshap... | Converts the buffered image into an {@link GrayI16}. If the buffered image
has multiple channels the intensities of each channel are averaged together.
@param src Input image.
@param dst Where the converted image is written to. If null a new unsigned image is created.
@return Converted image. | [
"Converts",
"the",
"buffered",
"image",
"into",
"an",
"{",
"@link",
"GrayI16",
"}",
".",
"If",
"the",
"buffered",
"image",
"has",
"multiple",
"channels",
"the",
"intensities",
"of",
"each",
"channel",
"are",
"averaged",
"together",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L399-L415 |
liferay/com-liferay-commerce | commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountOrganizationRelPersistenceImpl.java | CommerceAccountOrganizationRelPersistenceImpl.findByOrganizationId | @Override
public List<CommerceAccountOrganizationRel> findByOrganizationId(
long organizationId, int start, int end) {
return findByOrganizationId(organizationId, start, end, null);
} | java | @Override
public List<CommerceAccountOrganizationRel> findByOrganizationId(
long organizationId, int start, int end) {
return findByOrganizationId(organizationId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAccountOrganizationRel",
">",
"findByOrganizationId",
"(",
"long",
"organizationId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByOrganizationId",
"(",
"organizationId",
",",
"start",
",",
"end... | Returns a range of all the commerce account organization rels where organizationId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAccountOrganizationRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param organizationId the organization ID
@param start the lower bound of the range of commerce account organization rels
@param end the upper bound of the range of commerce account organization rels (not inclusive)
@return the range of matching commerce account organization rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"account",
"organization",
"rels",
"where",
"organizationId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountOrganizationRelPersistenceImpl.java#L673-L677 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/DeleteManager.java | DeleteManager.applyDelete | private static boolean applyDelete(Element delete, Document ilf) {
String nodeID = delete.getAttribute(Constants.ATT_NAME);
Element e = ilf.getElementById(nodeID);
if (e == null) return false;
String deleteAllowed = e.getAttribute(Constants.ATT_DELETE_ALLOWED);
if (deleteAllowed.equals("false")) return false;
Element p = (Element) e.getParentNode();
e.setIdAttribute(Constants.ATT_ID, false);
p.removeChild(e);
return true;
} | java | private static boolean applyDelete(Element delete, Document ilf) {
String nodeID = delete.getAttribute(Constants.ATT_NAME);
Element e = ilf.getElementById(nodeID);
if (e == null) return false;
String deleteAllowed = e.getAttribute(Constants.ATT_DELETE_ALLOWED);
if (deleteAllowed.equals("false")) return false;
Element p = (Element) e.getParentNode();
e.setIdAttribute(Constants.ATT_ID, false);
p.removeChild(e);
return true;
} | [
"private",
"static",
"boolean",
"applyDelete",
"(",
"Element",
"delete",
",",
"Document",
"ilf",
")",
"{",
"String",
"nodeID",
"=",
"delete",
".",
"getAttribute",
"(",
"Constants",
".",
"ATT_NAME",
")",
";",
"Element",
"e",
"=",
"ilf",
".",
"getElementById",... | Attempt to apply a single delete command and return true if it succeeds or false otherwise.
If the delete is disallowed or the target element no longer exists in the document the delete
command fails and returns false. | [
"Attempt",
"to",
"apply",
"a",
"single",
"delete",
"command",
"and",
"return",
"true",
"if",
"it",
"succeeds",
"or",
"false",
"otherwise",
".",
"If",
"the",
"delete",
"is",
"disallowed",
"or",
"the",
"target",
"element",
"no",
"longer",
"exists",
"in",
"th... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/DeleteManager.java#L88-L102 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java | FirewallRulesInner.listByServerAsync | public Observable<List<FirewallRuleInner>> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<FirewallRuleInner>>, List<FirewallRuleInner>>() {
@Override
public List<FirewallRuleInner> call(ServiceResponse<List<FirewallRuleInner>> response) {
return response.body();
}
});
} | java | public Observable<List<FirewallRuleInner>> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<FirewallRuleInner>>, List<FirewallRuleInner>>() {
@Override
public List<FirewallRuleInner> call(ServiceResponse<List<FirewallRuleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"FirewallRuleInner",
">",
">",
"listByServerAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
... | Returns a list of firewall rules.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<FirewallRuleInner> object | [
"Returns",
"a",
"list",
"of",
"firewall",
"rules",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java#L400-L407 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java | ComputeNodesImpl.updateUserAsync | public Observable<Void> updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions) {
return updateUserWithServiceResponseAsync(poolId, nodeId, userName, nodeUpdateUserParameter, computeNodeUpdateUserOptions).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeUpdateUserHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, ComputeNodeUpdateUserHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions) {
return updateUserWithServiceResponseAsync(poolId, nodeId, userName, nodeUpdateUserParameter, computeNodeUpdateUserOptions).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeUpdateUserHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, ComputeNodeUpdateUserHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"updateUserAsync",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"userName",
",",
"NodeUpdateUserParameter",
"nodeUpdateUserParameter",
",",
"ComputeNodeUpdateUserOptions",
"computeNodeUpdateUserOptions",
")",
"... | Updates the password and expiration time of a user account on the specified compute node.
This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the machine on which you want to update a user account.
@param userName The name of the user account to update.
@param nodeUpdateUserParameter The parameters for the request.
@param computeNodeUpdateUserOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Updates",
"the",
"password",
"and",
"expiration",
"time",
"of",
"a",
"user",
"account",
"on",
"the",
"specified",
"compute",
"node",
".",
"This",
"operation",
"replaces",
"of",
"all",
"the",
"updatable",
"properties",
"of",
"the",
"account",
".",
"For",
"ex... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L764-L771 |
dlemmermann/CalendarFX | CalendarFXRecurrence/src/main/java/com/google/ical/compat/javatime/LocalDateIteratorFactory.java | LocalDateIteratorFactory.createLocalDateIterable | public static LocalDateIterable createLocalDateIterable(String rdata,
LocalDate start, boolean strict) throws ParseException {
return createLocalDateIterable(rdata, start, ZoneId.of("UTC"), strict);
} | java | public static LocalDateIterable createLocalDateIterable(String rdata,
LocalDate start, boolean strict) throws ParseException {
return createLocalDateIterable(rdata, start, ZoneId.of("UTC"), strict);
} | [
"public",
"static",
"LocalDateIterable",
"createLocalDateIterable",
"(",
"String",
"rdata",
",",
"LocalDate",
"start",
",",
"boolean",
"strict",
")",
"throws",
"ParseException",
"{",
"return",
"createLocalDateIterable",
"(",
"rdata",
",",
"start",
",",
"ZoneId",
"."... | given a block of RRULE, EXRULE, RDATE, and EXDATE content lines, parse
them into a single local date iterable.
@param rdata
RRULE, EXRULE, RDATE, and EXDATE lines.
@param start
the first occurrence of the series.
@param strict
true if any failure to parse should result in a
ParseException. false causes bad content lines to be logged
and ignored. | [
"given",
"a",
"block",
"of",
"RRULE",
"EXRULE",
"RDATE",
"and",
"EXDATE",
"content",
"lines",
"parse",
"them",
"into",
"a",
"single",
"local",
"date",
"iterable",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/compat/javatime/LocalDateIteratorFactory.java#L123-L126 |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.lookupDao | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz);
Dao<?, ?> dao = lookupDao(key);
@SuppressWarnings("unchecked")
D castDao = (D) dao;
return castDao;
} | java | public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz);
Dao<?, ?> dao = lookupDao(key);
@SuppressWarnings("unchecked")
D castDao = (D) dao;
return castDao;
} | [
"public",
"synchronized",
"static",
"<",
"D",
"extends",
"Dao",
"<",
"T",
",",
"?",
">",
",",
"T",
">",
"D",
"lookupDao",
"(",
"ConnectionSource",
"connectionSource",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"if",
"(",
"connectionSource",
"==",
... | Helper method to lookup a DAO if it has already been associated with the class. Otherwise this returns null. | [
"Helper",
"method",
"to",
"lookup",
"a",
"DAO",
"if",
"it",
"has",
"already",
"been",
"associated",
"with",
"the",
"class",
".",
"Otherwise",
"this",
"returns",
"null",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L109-L118 |
VoltDB/voltdb | src/frontend/org/voltdb/ElasticHashinator.java | ElasticHashinator.toJSONStringCompressed | private byte[] toJSONStringCompressed() {
String str = toJSONString();
if (str == null || str.length() == 0) {
return new byte[0] ;
}
byte[] outStr;
try {
outStr = compressJSONString(str);
} catch (IOException e) {
throw new RuntimeException("Failed to serialize Hashinator Configuration to Compressed JSON .", e);
}
return outStr;
} | java | private byte[] toJSONStringCompressed() {
String str = toJSONString();
if (str == null || str.length() == 0) {
return new byte[0] ;
}
byte[] outStr;
try {
outStr = compressJSONString(str);
} catch (IOException e) {
throw new RuntimeException("Failed to serialize Hashinator Configuration to Compressed JSON .", e);
}
return outStr;
} | [
"private",
"byte",
"[",
"]",
"toJSONStringCompressed",
"(",
")",
"{",
"String",
"str",
"=",
"toJSONString",
"(",
")",
";",
"if",
"(",
"str",
"==",
"null",
"||",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"new",
"byte",
"[",
"0",... | Serializes the configuration into JSON, also updates the currently cached m_configJSON.
@return The JSONString of the current configuration. | [
"Serializes",
"the",
"configuration",
"into",
"JSON",
"also",
"updates",
"the",
"currently",
"cached",
"m_configJSON",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ElasticHashinator.java#L252-L264 |
datacleaner/AnalyzerBeans | components/html-rendering/src/main/java/org/eobjects/analyzer/result/renderer/TableBodyElement.java | TableBodyElement.getCellClass | protected String getCellClass(HtmlRenderingContext context, int row, int col) {
if (ArrayUtils.indexOf(_highlightedColumns, col) == -1) {
return null;
}
return "highlighted";
} | java | protected String getCellClass(HtmlRenderingContext context, int row, int col) {
if (ArrayUtils.indexOf(_highlightedColumns, col) == -1) {
return null;
}
return "highlighted";
} | [
"protected",
"String",
"getCellClass",
"(",
"HtmlRenderingContext",
"context",
",",
"int",
"row",
",",
"int",
"col",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"indexOf",
"(",
"_highlightedColumns",
",",
"col",
")",
"==",
"-",
"1",
")",
"{",
"return",
"null",... | Overrideable method for setting the class of a cell (the <td>element) in
the table
@param context
@param row
@param col
@return | [
"Overrideable",
"method",
"for",
"setting",
"the",
"class",
"of",
"a",
"cell",
"(",
"the",
"<td",
">",
"element",
")",
"in",
"the",
"table"
] | train | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/components/html-rendering/src/main/java/org/eobjects/analyzer/result/renderer/TableBodyElement.java#L135-L140 |
seedstack/business | core/src/main/java/org/seedstack/business/internal/utils/MethodMatcher.java | MethodMatcher.findMatchingMethod | public static Method findMatchingMethod(Class<?> classToInspect, Class<?> returnType, Object... params) {
Method[] methods = classToInspect.getMethods();
Method checkedMethod = null;
for (Method method : methods) {
Type[] parameterTypes = method.getParameterTypes();
// if the return type is not specified (i.e null) we only check the parameters
boolean matchReturnType = returnType == null || returnType.equals(method.getReturnType());
if (checkParams(parameterTypes, params) && matchReturnType) {
if (checkedMethod == null) {
checkedMethod = method;
} else {
throw BusinessException.createNew(BusinessErrorCode.AMBIGUOUS_METHOD_FOUND)
.put("method1", method)
.put("method2", checkedMethod)
.put("object", classToInspect.getSimpleName())
.put("parameters", params);
}
}
}
return checkedMethod;
} | java | public static Method findMatchingMethod(Class<?> classToInspect, Class<?> returnType, Object... params) {
Method[] methods = classToInspect.getMethods();
Method checkedMethod = null;
for (Method method : methods) {
Type[] parameterTypes = method.getParameterTypes();
// if the return type is not specified (i.e null) we only check the parameters
boolean matchReturnType = returnType == null || returnType.equals(method.getReturnType());
if (checkParams(parameterTypes, params) && matchReturnType) {
if (checkedMethod == null) {
checkedMethod = method;
} else {
throw BusinessException.createNew(BusinessErrorCode.AMBIGUOUS_METHOD_FOUND)
.put("method1", method)
.put("method2", checkedMethod)
.put("object", classToInspect.getSimpleName())
.put("parameters", params);
}
}
}
return checkedMethod;
} | [
"public",
"static",
"Method",
"findMatchingMethod",
"(",
"Class",
"<",
"?",
">",
"classToInspect",
",",
"Class",
"<",
"?",
">",
"returnType",
",",
"Object",
"...",
"params",
")",
"{",
"Method",
"[",
"]",
"methods",
"=",
"classToInspect",
".",
"getMethods",
... | Finds a method matching the given parameters and return type. | [
"Finds",
"a",
"method",
"matching",
"the",
"given",
"parameters",
"and",
"return",
"type",
"."
] | train | https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/MethodMatcher.java#L27-L48 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.newReader | public static BufferedReader newReader(URL url, Map parameters) throws MalformedURLException, IOException {
return IOGroovyMethods.newReader(configuredInputStream(parameters, url));
} | java | public static BufferedReader newReader(URL url, Map parameters) throws MalformedURLException, IOException {
return IOGroovyMethods.newReader(configuredInputStream(parameters, url));
} | [
"public",
"static",
"BufferedReader",
"newReader",
"(",
"URL",
"url",
",",
"Map",
"parameters",
")",
"throws",
"MalformedURLException",
",",
"IOException",
"{",
"return",
"IOGroovyMethods",
".",
"newReader",
"(",
"configuredInputStream",
"(",
"parameters",
",",
"url... | Creates a buffered reader for this URL.
The default connection parameters can be modified by adding keys to the
<i>parameters map</i>:
<ul>
<li>connectTimeout : the connection timeout</li>
<li>readTimeout : the read timeout</li>
<li>useCaches : set the use cache property for the URL connection</li>
<li>allowUserInteraction : set the user interaction flag for the URL connection</li>
<li>requestProperties : a map of properties to be passed to the URL connection</li>
</ul>
@param url a URL
@param parameters connection parameters
@return a BufferedReader for the URL
@throws MalformedURLException is thrown if the URL is not well formed
@throws IOException if an I/O error occurs while creating the input stream
@since 1.8.1 | [
"Creates",
"a",
"buffered",
"reader",
"for",
"this",
"URL",
".",
"The",
"default",
"connection",
"parameters",
"can",
"be",
"modified",
"by",
"adding",
"keys",
"to",
"the",
"<i",
">",
"parameters",
"map<",
"/",
"i",
">",
":",
"<ul",
">",
"<li",
">",
"c... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L2254-L2256 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.deleteFirewallRuleAsync | public Observable<Void> deleteFirewallRuleAsync(String resourceGroupName, String accountName, String firewallRuleName) {
return deleteFirewallRuleWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteFirewallRuleAsync(String resourceGroupName, String accountName, String firewallRuleName) {
return deleteFirewallRuleWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteFirewallRuleAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"firewallRuleName",
")",
"{",
"return",
"deleteFirewallRuleWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"acco... | Deletes the specified firewall rule from the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account.
@param accountName The name of the Data Lake Store account from which to delete the firewall rule.
@param firewallRuleName The name of the firewall rule to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Deletes",
"the",
"specified",
"firewall",
"rule",
"from",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L176-L183 |
roboconf/roboconf-platform | core/roboconf-plugin-puppet/src/main/java/net/roboconf/plugin/puppet/internal/PluginPuppet.java | PluginPuppet.installPuppetModules | void installPuppetModules( Instance instance )
throws IOException, InterruptedException {
// Load the modules names
File instanceDirectory = InstanceHelpers.findInstanceDirectoryOnAgent( instance );
File modulesFile = new File( instanceDirectory, "modules.properties" );
if( ! modulesFile.exists())
return;
Properties props = Utils.readPropertiesFile( modulesFile );
for( Map.Entry<Object,Object> entry : props.entrySet()) {
List<String> commands = new ArrayList<> ();
commands.add( "puppet" );
commands.add( "module" );
commands.add( "install" );
String value = entry.getValue().toString();
if( ! Utils.isEmptyOrWhitespaces( value )) {
commands.add( "--version" );
commands.add( value );
}
commands.add((String) entry.getKey());
commands.add( "--target-dir" );
commands.add( instanceDirectory.getAbsolutePath());
String[] params = commands.toArray( new String[ 0 ]);
this.logger.fine( "Module installation: " + Arrays.toString( params ));
int exitCode = ProgramUtils.executeCommand( this.logger, commands, null, null, this.applicationName, this.scopedInstancePath);
if( exitCode != 0 )
throw new IOException( "Puppet modules could not be installed for " + instance + "." );
}
} | java | void installPuppetModules( Instance instance )
throws IOException, InterruptedException {
// Load the modules names
File instanceDirectory = InstanceHelpers.findInstanceDirectoryOnAgent( instance );
File modulesFile = new File( instanceDirectory, "modules.properties" );
if( ! modulesFile.exists())
return;
Properties props = Utils.readPropertiesFile( modulesFile );
for( Map.Entry<Object,Object> entry : props.entrySet()) {
List<String> commands = new ArrayList<> ();
commands.add( "puppet" );
commands.add( "module" );
commands.add( "install" );
String value = entry.getValue().toString();
if( ! Utils.isEmptyOrWhitespaces( value )) {
commands.add( "--version" );
commands.add( value );
}
commands.add((String) entry.getKey());
commands.add( "--target-dir" );
commands.add( instanceDirectory.getAbsolutePath());
String[] params = commands.toArray( new String[ 0 ]);
this.logger.fine( "Module installation: " + Arrays.toString( params ));
int exitCode = ProgramUtils.executeCommand( this.logger, commands, null, null, this.applicationName, this.scopedInstancePath);
if( exitCode != 0 )
throw new IOException( "Puppet modules could not be installed for " + instance + "." );
}
} | [
"void",
"installPuppetModules",
"(",
"Instance",
"instance",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"// Load the modules names",
"File",
"instanceDirectory",
"=",
"InstanceHelpers",
".",
"findInstanceDirectoryOnAgent",
"(",
"instance",
")",
";",
"... | Executes a Puppet command to install the required modules.
@param instance the instance
@throws IOException
@throws InterruptedException
@throws PluginException | [
"Executes",
"a",
"Puppet",
"command",
"to",
"install",
"the",
"required",
"modules",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-plugin-puppet/src/main/java/net/roboconf/plugin/puppet/internal/PluginPuppet.java#L207-L241 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/blobstore/FileBlobStoreImpl.java | FileBlobStoreImpl.deleteKey | public void deleteKey(String key) throws IOException {
File keyDir = getKeyDir(key);
LocalFsBlobStoreFile pf = new LocalFsBlobStoreFile(keyDir, BlobStoreFile.BLOBSTORE_DATA_FILE);
pf.delete();
delete(keyDir);
} | java | public void deleteKey(String key) throws IOException {
File keyDir = getKeyDir(key);
LocalFsBlobStoreFile pf = new LocalFsBlobStoreFile(keyDir, BlobStoreFile.BLOBSTORE_DATA_FILE);
pf.delete();
delete(keyDir);
} | [
"public",
"void",
"deleteKey",
"(",
"String",
"key",
")",
"throws",
"IOException",
"{",
"File",
"keyDir",
"=",
"getKeyDir",
"(",
"key",
")",
";",
"LocalFsBlobStoreFile",
"pf",
"=",
"new",
"LocalFsBlobStoreFile",
"(",
"keyDir",
",",
"BlobStoreFile",
".",
"BLOBS... | Delete a key from the blob store
@param key the key to delete
@throws IOException on any error | [
"Delete",
"a",
"key",
"from",
"the",
"blob",
"store"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/blobstore/FileBlobStoreImpl.java#L166-L171 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java | MutableURI.setQuery | public void setQuery( String query )
{
_parameters = null;
if ( query == null || query.length() == 0 ) { return; }
for ( StringTokenizer tok = new StringTokenizer( query, "&" ); tok.hasMoreElements(); )
{
String queryItem = tok.nextToken();
if ( queryItem.startsWith( "amp;" ) )
{
queryItem = queryItem.substring( 4 );
}
int eq = queryItem.indexOf( '=' );
if ( eq != -1 )
{
addParameter( queryItem.substring( 0, eq ) , queryItem.substring( eq + 1 ), true );
}
else
{
addParameter( queryItem, null, true );
}
}
} | java | public void setQuery( String query )
{
_parameters = null;
if ( query == null || query.length() == 0 ) { return; }
for ( StringTokenizer tok = new StringTokenizer( query, "&" ); tok.hasMoreElements(); )
{
String queryItem = tok.nextToken();
if ( queryItem.startsWith( "amp;" ) )
{
queryItem = queryItem.substring( 4 );
}
int eq = queryItem.indexOf( '=' );
if ( eq != -1 )
{
addParameter( queryItem.substring( 0, eq ) , queryItem.substring( eq + 1 ), true );
}
else
{
addParameter( queryItem, null, true );
}
}
} | [
"public",
"void",
"setQuery",
"(",
"String",
"query",
")",
"{",
"_parameters",
"=",
"null",
";",
"if",
"(",
"query",
"==",
"null",
"||",
"query",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"for",
"(",
"StringTokenizer",
"tok",
... | Sets (and resets) the query string.
This method assumes that the query is already encoded and escaped.
@param query Query string | [
"Sets",
"(",
"and",
"resets",
")",
"the",
"query",
"string",
".",
"This",
"method",
"assumes",
"that",
"the",
"query",
"is",
"already",
"encoded",
"and",
"escaped",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L486-L511 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/LogFaxClientSpiInterceptor.java | LogFaxClientSpiInterceptor.logEvent | protected void logEvent(FaxClientSpiProxyEventType eventType,Method method,Object[] arguments,Object output,Throwable throwable)
{
//init log data
int amount=3;
int argumentsAmount=0;
if(arguments!=null)
{
argumentsAmount=arguments.length;
}
if(eventType==FaxClientSpiProxyEventType.POST_EVENT_TYPE)
{
amount=amount+2;
}
Object[] logData=new Object[amount+argumentsAmount];
//set log data values
switch(eventType)
{
case PRE_EVENT_TYPE:
logData[0]="Invoking ";
break;
case POST_EVENT_TYPE:
logData[0]="Invoked ";
break;
case ERROR_EVENT_TYPE:
logData[0]="Error while invoking ";
break;
}
logData[1]=method.getName();
if(argumentsAmount>0)
{
logData[2]=" with data: ";
System.arraycopy(arguments,0,logData,3,argumentsAmount);
}
else
{
logData[2]="";
}
if(eventType==FaxClientSpiProxyEventType.POST_EVENT_TYPE)
{
logData[3+argumentsAmount]="\nOutput: ";
logData[4+argumentsAmount]=output;
}
//get logger
Logger logger=this.getLogger();
//log event
switch(eventType)
{
case PRE_EVENT_TYPE:
case POST_EVENT_TYPE:
logger.logDebug(logData,throwable);
break;
case ERROR_EVENT_TYPE:
logger.logError(logData,throwable);
break;
}
} | java | protected void logEvent(FaxClientSpiProxyEventType eventType,Method method,Object[] arguments,Object output,Throwable throwable)
{
//init log data
int amount=3;
int argumentsAmount=0;
if(arguments!=null)
{
argumentsAmount=arguments.length;
}
if(eventType==FaxClientSpiProxyEventType.POST_EVENT_TYPE)
{
amount=amount+2;
}
Object[] logData=new Object[amount+argumentsAmount];
//set log data values
switch(eventType)
{
case PRE_EVENT_TYPE:
logData[0]="Invoking ";
break;
case POST_EVENT_TYPE:
logData[0]="Invoked ";
break;
case ERROR_EVENT_TYPE:
logData[0]="Error while invoking ";
break;
}
logData[1]=method.getName();
if(argumentsAmount>0)
{
logData[2]=" with data: ";
System.arraycopy(arguments,0,logData,3,argumentsAmount);
}
else
{
logData[2]="";
}
if(eventType==FaxClientSpiProxyEventType.POST_EVENT_TYPE)
{
logData[3+argumentsAmount]="\nOutput: ";
logData[4+argumentsAmount]=output;
}
//get logger
Logger logger=this.getLogger();
//log event
switch(eventType)
{
case PRE_EVENT_TYPE:
case POST_EVENT_TYPE:
logger.logDebug(logData,throwable);
break;
case ERROR_EVENT_TYPE:
logger.logError(logData,throwable);
break;
}
} | [
"protected",
"void",
"logEvent",
"(",
"FaxClientSpiProxyEventType",
"eventType",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"arguments",
",",
"Object",
"output",
",",
"Throwable",
"throwable",
")",
"{",
"//init log data",
"int",
"amount",
"=",
"3",
";",
... | This function logs the event.
@param eventType
The event type
@param method
The method invoked
@param arguments
The method arguments
@param output
The method output
@param throwable
The throwable while invoking the method | [
"This",
"function",
"logs",
"the",
"event",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/LogFaxClientSpiInterceptor.java#L90-L148 |
Stratio/bdt | src/main/java/com/stratio/qa/utils/CassandraUtils.java | CassandraUtils.existsKeyspace | public boolean existsKeyspace(String keyspace, boolean showLog) {
this.metadata = cluster.getMetadata();
if (!(this.metadata.getKeyspaces().isEmpty())) {
for (KeyspaceMetadata k : metadata.getKeyspaces()) {
if (k.getName().equals(keyspace)) {
return true;
}
}
}
return false;
} | java | public boolean existsKeyspace(String keyspace, boolean showLog) {
this.metadata = cluster.getMetadata();
if (!(this.metadata.getKeyspaces().isEmpty())) {
for (KeyspaceMetadata k : metadata.getKeyspaces()) {
if (k.getName().equals(keyspace)) {
return true;
}
}
}
return false;
} | [
"public",
"boolean",
"existsKeyspace",
"(",
"String",
"keyspace",
",",
"boolean",
"showLog",
")",
"{",
"this",
".",
"metadata",
"=",
"cluster",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"!",
"(",
"this",
".",
"metadata",
".",
"getKeyspaces",
"(",
")"... | Checks if a keyspace exists in Cassandra.
@param keyspace
@param showLog
@return boolean | [
"Checks",
"if",
"a",
"keyspace",
"exists",
"in",
"Cassandra",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/CassandraUtils.java#L215-L225 |
vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/collection/ListUtil.java | ListUtil.disjoint | public static <T> List<T> disjoint(final List<? extends T> list1, final List<? extends T> list2) {
List<T> intersection = intersection(list1, list2);
List<T> towIntersection = union(intersection, intersection);
return difference(union(list1, list2), towIntersection);
} | java | public static <T> List<T> disjoint(final List<? extends T> list1, final List<? extends T> list2) {
List<T> intersection = intersection(list1, list2);
List<T> towIntersection = union(intersection, intersection);
return difference(union(list1, list2), towIntersection);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"disjoint",
"(",
"final",
"List",
"<",
"?",
"extends",
"T",
">",
"list1",
",",
"final",
"List",
"<",
"?",
"extends",
"T",
">",
"list2",
")",
"{",
"List",
"<",
"T",
">",
"intersection",
"="... | list1, list2的补集(在list1或list2中,但不在交集中的对象,又叫反交集)产生新List.
copy from Apache Common Collection4 ListUtils,但其并集-交集时,初始大小没有对交集*2,所以做了修改 | [
"list1",
"list2的补集(在list1或list2中,但不在交集中的对象,又叫反交集)产生新List",
"."
] | train | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/collection/ListUtil.java#L399-L403 |
intellimate/Izou | src/main/java/org/intellimate/izou/security/FilePermissionModule.java | FilePermissionModule.isForbidden | private void isForbidden(File request, AddOnModel addOnModel) {
if (forbiddenWriteDirectories.stream()
.anyMatch(compare -> request.toPath().startsWith(compare.toPath()))) {
throw getException("file: " + request.toString() + " is forbidden. Attempt made by: "
+ addOnModel.getID());
}
} | java | private void isForbidden(File request, AddOnModel addOnModel) {
if (forbiddenWriteDirectories.stream()
.anyMatch(compare -> request.toPath().startsWith(compare.toPath()))) {
throw getException("file: " + request.toString() + " is forbidden. Attempt made by: "
+ addOnModel.getID());
}
} | [
"private",
"void",
"isForbidden",
"(",
"File",
"request",
",",
"AddOnModel",
"addOnModel",
")",
"{",
"if",
"(",
"forbiddenWriteDirectories",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"compare",
"->",
"request",
".",
"toPath",
"(",
")",
".",
"startsWith"... | throws an Exception if the
@param request the requested File
@param addOnModel the AddonModel | [
"throws",
"an",
"Exception",
"if",
"the"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/FilePermissionModule.java#L154-L160 |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.setMenuButtonImage | public void setMenuButtonImage(MenuButton button, Drawable drawable) {
switch (button) {
case MID:
mMidBtn.setImageDrawable(drawable);
break;
case LEFT:
mLeftBtn.setImageDrawable(drawable);
break;
case RIGHT:
mRightBtn.setImageDrawable(drawable);
break;
}
} | java | public void setMenuButtonImage(MenuButton button, Drawable drawable) {
switch (button) {
case MID:
mMidBtn.setImageDrawable(drawable);
break;
case LEFT:
mLeftBtn.setImageDrawable(drawable);
break;
case RIGHT:
mRightBtn.setImageDrawable(drawable);
break;
}
} | [
"public",
"void",
"setMenuButtonImage",
"(",
"MenuButton",
"button",
",",
"Drawable",
"drawable",
")",
"{",
"switch",
"(",
"button",
")",
"{",
"case",
"MID",
":",
"mMidBtn",
".",
"setImageDrawable",
"(",
"drawable",
")",
";",
"break",
";",
"case",
"LEFT",
... | Set image drawable for a menu button
@param button
@param drawable | [
"Set",
"image",
"drawable",
"for",
"a",
"menu",
"button"
] | train | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L196-L208 |
eurekaclinical/protempa | protempa-framework/src/main/java/org/protempa/proposition/interval/IntervalFactory.java | IntervalFactory.getInstance | public Interval getInstance(Long start, Granularity startGran,
Long finish, Granularity finishGran) {
List<Object> key = Arrays.asList(new Object[]{start, startGran,
finish, finishGran});
Interval result;
synchronized (cache) {
result = cache.get(key);
if (result == null) {
if (start == null || finish == null) {
result = new DefaultInterval(start, startGran, finish, finishGran);
} else {
result = new SimpleInterval(start, startGran, finish, finishGran);
}
cache.put(key, result);
}
}
return result;
} | java | public Interval getInstance(Long start, Granularity startGran,
Long finish, Granularity finishGran) {
List<Object> key = Arrays.asList(new Object[]{start, startGran,
finish, finishGran});
Interval result;
synchronized (cache) {
result = cache.get(key);
if (result == null) {
if (start == null || finish == null) {
result = new DefaultInterval(start, startGran, finish, finishGran);
} else {
result = new SimpleInterval(start, startGran, finish, finishGran);
}
cache.put(key, result);
}
}
return result;
} | [
"public",
"Interval",
"getInstance",
"(",
"Long",
"start",
",",
"Granularity",
"startGran",
",",
"Long",
"finish",
",",
"Granularity",
"finishGran",
")",
"{",
"List",
"<",
"Object",
">",
"key",
"=",
"Arrays",
".",
"asList",
"(",
"new",
"Object",
"[",
"]",
... | Returns at interval specified by the given start and finish and
granularities.
@param start a {@link Long} representing the start of the interval. If
<code>null</code>, the <code>start</code> will be unbounded.
@param startGran the {@link Granularity} of the start of the interval.
The <code>start</code> parameter's interpretation depends on the
{@link Granularity} implementation provided.
@param finish a {@link Long} representing the finish of the interval. If
<code>null</code>, the <code>finish</code> will be unbounded.
@param finishGran the {@link Granularity} of the finish of the interval.
The <code>start</code> parameter's interpretation depends on the
{@link Granularity} implementation provided.
@return an {@link Interval}. | [
"Returns",
"at",
"interval",
"specified",
"by",
"the",
"given",
"start",
"and",
"finish",
"and",
"granularities",
"."
] | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/IntervalFactory.java#L110-L127 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/PhotoUtils.java | PhotoUtils.getImageForSize | public static BufferedImage getImageForSize(JinxConstants.PhotoSize size, PhotoInfo info) throws JinxException {
if (info == null || size == null) {
throw new JinxException("Cannot look up null photo or size.");
}
BufferedImage image;
try {
image = ImageIO.read(getUrlForSize(size, info));
} catch (JinxException je) {
throw je;
} catch (Exception e) {
throw new JinxException("Unable to get image for size " + size.toString(), e);
}
return image;
} | java | public static BufferedImage getImageForSize(JinxConstants.PhotoSize size, PhotoInfo info) throws JinxException {
if (info == null || size == null) {
throw new JinxException("Cannot look up null photo or size.");
}
BufferedImage image;
try {
image = ImageIO.read(getUrlForSize(size, info));
} catch (JinxException je) {
throw je;
} catch (Exception e) {
throw new JinxException("Unable to get image for size " + size.toString(), e);
}
return image;
} | [
"public",
"static",
"BufferedImage",
"getImageForSize",
"(",
"JinxConstants",
".",
"PhotoSize",
"size",
",",
"PhotoInfo",
"info",
")",
"throws",
"JinxException",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"size",
"==",
"null",
")",
"{",
"throw",
"new",
"Jin... | Get an image for photo info at a specific size.
@param size Required. The the desired size.
@param info Required. The photo info describing the photo.
@return buffered image data from Flickr.
@throws JinxException if any parameter is null, or if there are any errors. | [
"Get",
"an",
"image",
"for",
"photo",
"info",
"at",
"a",
"specific",
"size",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/PhotoUtils.java#L77-L90 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | ExceptionUtils.removeCommonFrames | public static void removeCommonFrames(final List<String> causeFrames, final List<String> wrapperFrames) {
if (causeFrames == null || wrapperFrames == null) {
throw new IllegalArgumentException("The List must not be null");
}
int causeFrameIndex = causeFrames.size() - 1;
int wrapperFrameIndex = wrapperFrames.size() - 1;
while (causeFrameIndex >= 0 && wrapperFrameIndex >= 0) {
// Remove the frame from the cause trace if it is the same
// as in the wrapper trace
final String causeFrame = causeFrames.get(causeFrameIndex);
final String wrapperFrame = wrapperFrames.get(wrapperFrameIndex);
if (causeFrame.equals(wrapperFrame)) {
causeFrames.remove(causeFrameIndex);
}
causeFrameIndex--;
wrapperFrameIndex--;
}
} | java | public static void removeCommonFrames(final List<String> causeFrames, final List<String> wrapperFrames) {
if (causeFrames == null || wrapperFrames == null) {
throw new IllegalArgumentException("The List must not be null");
}
int causeFrameIndex = causeFrames.size() - 1;
int wrapperFrameIndex = wrapperFrames.size() - 1;
while (causeFrameIndex >= 0 && wrapperFrameIndex >= 0) {
// Remove the frame from the cause trace if it is the same
// as in the wrapper trace
final String causeFrame = causeFrames.get(causeFrameIndex);
final String wrapperFrame = wrapperFrames.get(wrapperFrameIndex);
if (causeFrame.equals(wrapperFrame)) {
causeFrames.remove(causeFrameIndex);
}
causeFrameIndex--;
wrapperFrameIndex--;
}
} | [
"public",
"static",
"void",
"removeCommonFrames",
"(",
"final",
"List",
"<",
"String",
">",
"causeFrames",
",",
"final",
"List",
"<",
"String",
">",
"wrapperFrames",
")",
"{",
"if",
"(",
"causeFrames",
"==",
"null",
"||",
"wrapperFrames",
"==",
"null",
")",
... | <p>Removes common frames from the cause trace given the two stack traces.</p>
@param causeFrames stack trace of a cause throwable
@param wrapperFrames stack trace of a wrapper throwable
@throws IllegalArgumentException if either argument is null
@since 2.0 | [
"<p",
">",
"Removes",
"common",
"frames",
"from",
"the",
"cause",
"trace",
"given",
"the",
"two",
"stack",
"traces",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java#L563-L580 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/inherited/CmsContainerConfigurationWriter.java | CmsContainerConfigurationWriter.removeExistingEntry | protected void removeExistingEntry(CmsObject cms, CmsXmlContent content, Locale locale, String name) {
if (!content.hasLocale(locale)) {
return;
}
String entriesXpath = N_CONFIGURATION;
List<I_CmsXmlContentValue> values = content.getValues(entriesXpath, locale);
int valueIndex = 0;
for (I_CmsXmlContentValue value : values) {
String valueXpath = value.getPath();
I_CmsXmlContentValue nameValue = content.getValue(CmsXmlUtils.concatXpath(valueXpath, N_NAME), locale);
String currentName = nameValue.getStringValue(cms);
if (currentName.equals(name)) {
content.removeValue(valueXpath, locale, valueIndex);
break;
}
valueIndex += 1;
}
} | java | protected void removeExistingEntry(CmsObject cms, CmsXmlContent content, Locale locale, String name) {
if (!content.hasLocale(locale)) {
return;
}
String entriesXpath = N_CONFIGURATION;
List<I_CmsXmlContentValue> values = content.getValues(entriesXpath, locale);
int valueIndex = 0;
for (I_CmsXmlContentValue value : values) {
String valueXpath = value.getPath();
I_CmsXmlContentValue nameValue = content.getValue(CmsXmlUtils.concatXpath(valueXpath, N_NAME), locale);
String currentName = nameValue.getStringValue(cms);
if (currentName.equals(name)) {
content.removeValue(valueXpath, locale, valueIndex);
break;
}
valueIndex += 1;
}
} | [
"protected",
"void",
"removeExistingEntry",
"(",
"CmsObject",
"cms",
",",
"CmsXmlContent",
"content",
",",
"Locale",
"locale",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"content",
".",
"hasLocale",
"(",
"locale",
")",
")",
"{",
"return",
";",
"}",
... | Removes an existing inheritance container entry with a given name from the configuration file.<p>
This does nothing if no such entry actually exists.<p>
@param cms the current CMS context
@param content the XML content
@param locale the locale from which to remove the entry
@param name the name of the entry | [
"Removes",
"an",
"existing",
"inheritance",
"container",
"entry",
"with",
"a",
"given",
"name",
"from",
"the",
"configuration",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/inherited/CmsContainerConfigurationWriter.java#L306-L324 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.