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 |
|---|---|---|---|---|---|---|---|---|---|---|
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java | RedisJobStore.replaceTrigger | @Override
public boolean replaceTrigger(final TriggerKey triggerKey, final OperableTrigger newTrigger) throws JobPersistenceException {
return doWithLock(new LockCallback<Boolean>() {
@Override
public Boolean doWithLock(JedisCommands jedis) throws JobPersistenceException {
try {
return storage.replaceTrigger(triggerKey, newTrigger, jedis);
} catch (ClassNotFoundException e) {
throw new JobPersistenceException(e.getMessage(), e);
}
}
}, "Could not remove trigger.");
} | java | @Override
public boolean replaceTrigger(final TriggerKey triggerKey, final OperableTrigger newTrigger) throws JobPersistenceException {
return doWithLock(new LockCallback<Boolean>() {
@Override
public Boolean doWithLock(JedisCommands jedis) throws JobPersistenceException {
try {
return storage.replaceTrigger(triggerKey, newTrigger, jedis);
} catch (ClassNotFoundException e) {
throw new JobPersistenceException(e.getMessage(), e);
}
}
}, "Could not remove trigger.");
} | [
"@",
"Override",
"public",
"boolean",
"replaceTrigger",
"(",
"final",
"TriggerKey",
"triggerKey",
",",
"final",
"OperableTrigger",
"newTrigger",
")",
"throws",
"JobPersistenceException",
"{",
"return",
"doWithLock",
"(",
"new",
"LockCallback",
"<",
"Boolean",
">",
"... | Remove (delete) the <code>{@link org.quartz.Trigger}</code> with the
given key, and store the new given one - which must be associated
with the same job.
@param triggerKey the key of the trigger to be replaced
@param newTrigger The new <code>Trigger</code> to be stored.
@return <code>true</code> if a <code>Trigger</code> with the given
name & group was found and removed from the store. | [
"Remove",
"(",
"delete",
")",
"the",
"<code",
">",
"{",
"@link",
"org",
".",
"quartz",
".",
"Trigger",
"}",
"<",
"/",
"code",
">",
"with",
"the",
"given",
"key",
"and",
"store",
"the",
"new",
"given",
"one",
"-",
"which",
"must",
"be",
"associated",
... | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java#L466-L478 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java | ServiceEndpointPolicyDefinitionsInner.beginCreateOrUpdateAsync | public Observable<ServiceEndpointPolicyDefinitionInner> beginCreateOrUpdateAsync(String resourceGroupName, String serviceEndpointPolicyName, String serviceEndpointPolicyDefinitionName, ServiceEndpointPolicyDefinitionInner serviceEndpointPolicyDefinitions) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, serviceEndpointPolicyDefinitions).map(new Func1<ServiceResponse<ServiceEndpointPolicyDefinitionInner>, ServiceEndpointPolicyDefinitionInner>() {
@Override
public ServiceEndpointPolicyDefinitionInner call(ServiceResponse<ServiceEndpointPolicyDefinitionInner> response) {
return response.body();
}
});
} | java | public Observable<ServiceEndpointPolicyDefinitionInner> beginCreateOrUpdateAsync(String resourceGroupName, String serviceEndpointPolicyName, String serviceEndpointPolicyDefinitionName, ServiceEndpointPolicyDefinitionInner serviceEndpointPolicyDefinitions) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, serviceEndpointPolicyDefinitions).map(new Func1<ServiceResponse<ServiceEndpointPolicyDefinitionInner>, ServiceEndpointPolicyDefinitionInner>() {
@Override
public ServiceEndpointPolicyDefinitionInner call(ServiceResponse<ServiceEndpointPolicyDefinitionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServiceEndpointPolicyDefinitionInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serviceEndpointPolicyName",
",",
"String",
"serviceEndpointPolicyDefinitionName",
",",
"ServiceEndpointPolicyDefinitionInner",
"... | Creates or updates a service endpoint policy definition in the specified service endpoint policy.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy.
@param serviceEndpointPolicyDefinitionName The name of the service endpoint policy definition name.
@param serviceEndpointPolicyDefinitions Parameters supplied to the create or update service endpoint policy operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServiceEndpointPolicyDefinitionInner object | [
"Creates",
"or",
"updates",
"a",
"service",
"endpoint",
"policy",
"definition",
"in",
"the",
"specified",
"service",
"endpoint",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java#L473-L480 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java | MercatorProjection.pixelXToTileXWithScaleFactor | public static int pixelXToTileXWithScaleFactor(double pixelX, double scaleFactor, int tileSize) {
return (int) Math.min(Math.max(pixelX / tileSize, 0), scaleFactor - 1);
} | java | public static int pixelXToTileXWithScaleFactor(double pixelX, double scaleFactor, int tileSize) {
return (int) Math.min(Math.max(pixelX / tileSize, 0), scaleFactor - 1);
} | [
"public",
"static",
"int",
"pixelXToTileXWithScaleFactor",
"(",
"double",
"pixelX",
",",
"double",
"scaleFactor",
",",
"int",
"tileSize",
")",
"{",
"return",
"(",
"int",
")",
"Math",
".",
"min",
"(",
"Math",
".",
"max",
"(",
"pixelX",
"/",
"tileSize",
",",... | Converts a pixel X coordinate to the tile X number.
@param pixelX the pixel X coordinate that should be converted.
@param scaleFactor the scale factor at which the coordinate should be converted.
@return the tile X number. | [
"Converts",
"a",
"pixel",
"X",
"coordinate",
"to",
"the",
"tile",
"X",
"number",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L367-L369 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java | SqlBuilderHelper.validate | static boolean validate(String value, List<JQLPlaceHolder> placeHolders, int pos) {
return placeHolders.get(pos).value.equals(value);
} | java | static boolean validate(String value, List<JQLPlaceHolder> placeHolders, int pos) {
return placeHolders.get(pos).value.equals(value);
} | [
"static",
"boolean",
"validate",
"(",
"String",
"value",
",",
"List",
"<",
"JQLPlaceHolder",
">",
"placeHolders",
",",
"int",
"pos",
")",
"{",
"return",
"placeHolders",
".",
"get",
"(",
"pos",
")",
".",
"value",
".",
"equals",
"(",
"value",
")",
";",
"... | look for variable name in place holders defined through path of content
provider.
@param value
the value
@param placeHolders
the place holders
@param pos
the pos
@return <code>true</code> if we found it path | [
"look",
"for",
"variable",
"name",
"in",
"place",
"holders",
"defined",
"through",
"path",
"of",
"content",
"provider",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java#L153-L155 |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsDynamicFunctionBeanWrapper.java | CmsDynamicFunctionBeanWrapper.getParameters | public Map<String, String> getParameters() {
if (m_functionBean == null) {
return Collections.emptyMap();
}
Format format = m_functionBean.getMainFormat();
CmsDynamicFunctionFormatWrapper wrapper = new CmsDynamicFunctionFormatWrapper(m_cms, format);
return wrapper.getParameters();
} | java | public Map<String, String> getParameters() {
if (m_functionBean == null) {
return Collections.emptyMap();
}
Format format = m_functionBean.getMainFormat();
CmsDynamicFunctionFormatWrapper wrapper = new CmsDynamicFunctionFormatWrapper(m_cms, format);
return wrapper.getParameters();
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getParameters",
"(",
")",
"{",
"if",
"(",
"m_functionBean",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"}",
"Format",
"format",
"=",
"m_functionBean",
".",
"getMai... | Gets the parameters of the wrapped dynamic function bean's main format.<p>
@return the map of parameters | [
"Gets",
"the",
"parameters",
"of",
"the",
"wrapped",
"dynamic",
"function",
"bean",
"s",
"main",
"format",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsDynamicFunctionBeanWrapper.java#L132-L140 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.beginVerifyIPFlow | public VerificationIPFlowResultInner beginVerifyIPFlow(String resourceGroupName, String networkWatcherName, VerificationIPFlowParameters parameters) {
return beginVerifyIPFlowWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body();
} | java | public VerificationIPFlowResultInner beginVerifyIPFlow(String resourceGroupName, String networkWatcherName, VerificationIPFlowParameters parameters) {
return beginVerifyIPFlowWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body();
} | [
"public",
"VerificationIPFlowResultInner",
"beginVerifyIPFlow",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"VerificationIPFlowParameters",
"parameters",
")",
"{",
"return",
"beginVerifyIPFlowWithServiceResponseAsync",
"(",
"resourceGroupName",
"... | Verify IP flow from the specified VM to a location given the currently configured NSG rules.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@param parameters Parameters that define the IP flow to be verified.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VerificationIPFlowResultInner object if successful. | [
"Verify",
"IP",
"flow",
"from",
"the",
"specified",
"VM",
"to",
"a",
"location",
"given",
"the",
"currently",
"configured",
"NSG",
"rules",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1033-L1035 |
Hygieia/Hygieia | collectors/feature/versionone/src/main/java/com/capitalone/dashboard/collector/BaseClient.java | BaseClient.getQuery | public String getQuery(String changeDatePara, String queryName) {
ST st = (new STGroupDir(featureSettings.getQueryFolder(), '$', '$')).getInstanceOf(queryName);
st.add("changeDate", changeDatePara);
return st.render();
} | java | public String getQuery(String changeDatePara, String queryName) {
ST st = (new STGroupDir(featureSettings.getQueryFolder(), '$', '$')).getInstanceOf(queryName);
st.add("changeDate", changeDatePara);
return st.render();
} | [
"public",
"String",
"getQuery",
"(",
"String",
"changeDatePara",
",",
"String",
"queryName",
")",
"{",
"ST",
"st",
"=",
"(",
"new",
"STGroupDir",
"(",
"featureSettings",
".",
"getQueryFolder",
"(",
")",
",",
"'",
"'",
",",
"'",
"'",
")",
")",
".",
"get... | Retrieves source system queries based on the query name (without the file
type) and a specified change date parameter.
@param changeDatePara
The change date specified from which to pull data with a given
query template.
@param queryName
The source system query name (without the file type).
@return A given source system query, in String format. | [
"Retrieves",
"source",
"system",
"queries",
"based",
"on",
"the",
"query",
"name",
"(",
"without",
"the",
"file",
"type",
")",
"and",
"a",
"specified",
"change",
"date",
"parameter",
"."
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/feature/versionone/src/main/java/com/capitalone/dashboard/collector/BaseClient.java#L130-L134 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jEntityQueries.java | BaseNeo4jEntityQueries.initMultiGetEntitiesQuery | private static String initMultiGetEntitiesQuery(EntityKeyMetadata entityKeyMetadata, boolean includeEmbedded) {
StringBuilder queryBuilder = new StringBuilder( "MATCH " );
queryBuilder.append( "(" );
queryBuilder.append( ENTITY_ALIAS );
queryBuilder.append( ":" );
queryBuilder.append( ENTITY );
queryBuilder.append( ":" );
appendLabel( entityKeyMetadata, queryBuilder );
queryBuilder.append( ") " );
queryBuilder.append( " WHERE " );
if ( entityKeyMetadata.getColumnNames().length == 1 ) {
queryBuilder.append( ENTITY_ALIAS );
queryBuilder.append( "." );
escapeIdentifier( queryBuilder, entityKeyMetadata.getColumnNames()[0] );
queryBuilder.append( " IN {0}" );
appendGetEmbeddedNodesIfNeeded( includeEmbedded, queryBuilder );
}
return queryBuilder.toString();
} | java | private static String initMultiGetEntitiesQuery(EntityKeyMetadata entityKeyMetadata, boolean includeEmbedded) {
StringBuilder queryBuilder = new StringBuilder( "MATCH " );
queryBuilder.append( "(" );
queryBuilder.append( ENTITY_ALIAS );
queryBuilder.append( ":" );
queryBuilder.append( ENTITY );
queryBuilder.append( ":" );
appendLabel( entityKeyMetadata, queryBuilder );
queryBuilder.append( ") " );
queryBuilder.append( " WHERE " );
if ( entityKeyMetadata.getColumnNames().length == 1 ) {
queryBuilder.append( ENTITY_ALIAS );
queryBuilder.append( "." );
escapeIdentifier( queryBuilder, entityKeyMetadata.getColumnNames()[0] );
queryBuilder.append( " IN {0}" );
appendGetEmbeddedNodesIfNeeded( includeEmbedded, queryBuilder );
}
return queryBuilder.toString();
} | [
"private",
"static",
"String",
"initMultiGetEntitiesQuery",
"(",
"EntityKeyMetadata",
"entityKeyMetadata",
",",
"boolean",
"includeEmbedded",
")",
"{",
"StringBuilder",
"queryBuilder",
"=",
"new",
"StringBuilder",
"(",
"\"MATCH \"",
")",
";",
"queryBuilder",
".",
"appen... | /*
This method will initialize the query string for a multi get.
The query is different in the two scenarios:
1) the id is mapped on a single property:
MATCH (n:ENTITY:table)
WHERE n.id IN {0}
RETURN n
2) id is mapped on multiple columns:
MATCH (n:ENTITY:table)
WHERE
In this case the query depends on how many id we are retrieving and it will be completed later | [
"/",
"*",
"This",
"method",
"will",
"initialize",
"the",
"query",
"string",
"for",
"a",
"multi",
"get",
".",
"The",
"query",
"is",
"different",
"in",
"the",
"two",
"scenarios",
":",
"1",
")",
"the",
"id",
"is",
"mapped",
"on",
"a",
"single",
"property"... | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jEntityQueries.java#L165-L183 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_orderableFilerProfiles_GET | public ArrayList<OvhProfile> serviceName_datacenter_datacenterId_orderableFilerProfiles_GET(String serviceName, Long datacenterId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableFilerProfiles";
StringBuilder sb = path(qPath, serviceName, datacenterId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public ArrayList<OvhProfile> serviceName_datacenter_datacenterId_orderableFilerProfiles_GET(String serviceName, Long datacenterId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableFilerProfiles";
StringBuilder sb = path(qPath, serviceName, datacenterId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"ArrayList",
"<",
"OvhProfile",
">",
"serviceName_datacenter_datacenterId_orderableFilerProfiles_GET",
"(",
"String",
"serviceName",
",",
"Long",
"datacenterId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/datacenter/{da... | List available filers in a given Private Cloud Datacenter
REST: GET /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableFilerProfiles
@param serviceName [required] Domain of the service
@param datacenterId [required] | [
"List",
"available",
"filers",
"in",
"a",
"given",
"Private",
"Cloud",
"Datacenter"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1739-L1744 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageutils/BitmapUtil.java | BitmapUtil.getSizeInByteForBitmap | public static int getSizeInByteForBitmap(int width, int height, Bitmap.Config bitmapConfig) {
return width * height * getPixelSizeForBitmapConfig(bitmapConfig);
} | java | public static int getSizeInByteForBitmap(int width, int height, Bitmap.Config bitmapConfig) {
return width * height * getPixelSizeForBitmapConfig(bitmapConfig);
} | [
"public",
"static",
"int",
"getSizeInByteForBitmap",
"(",
"int",
"width",
",",
"int",
"height",
",",
"Bitmap",
".",
"Config",
"bitmapConfig",
")",
"{",
"return",
"width",
"*",
"height",
"*",
"getPixelSizeForBitmapConfig",
"(",
"bitmapConfig",
")",
";",
"}"
] | Returns the size in byte of an image with specific size
and {@link android.graphics.Bitmap.Config}
@param width the width of the image
@param height the height of the image
@param bitmapConfig the {@link android.graphics.Bitmap.Config} for which the size in byte
will be returned
@return | [
"Returns",
"the",
"size",
"in",
"byte",
"of",
"an",
"image",
"with",
"specific",
"size",
"and",
"{"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageutils/BitmapUtil.java#L189-L191 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/util/TrustEverythingSSLTrustManager.java | TrustEverythingSSLTrustManager.getTrustingSSLSocketFactory | public synchronized static SSLSocketFactory getTrustingSSLSocketFactory() {
if (socketFactory != null) return socketFactory;
TrustManager[] trustManagers = new TrustManager[] { new TrustEverythingSSLTrustManager() };
SSLContext sc;
try {
sc = SSLContext.getInstance("SSL");
sc.init(null, trustManagers, null);
} catch (GeneralSecurityException e) {
throw new RuntimeException("This is a BUG in Selenium; please report it", e);
}
socketFactory = sc.getSocketFactory();
return socketFactory;
} | java | public synchronized static SSLSocketFactory getTrustingSSLSocketFactory() {
if (socketFactory != null) return socketFactory;
TrustManager[] trustManagers = new TrustManager[] { new TrustEverythingSSLTrustManager() };
SSLContext sc;
try {
sc = SSLContext.getInstance("SSL");
sc.init(null, trustManagers, null);
} catch (GeneralSecurityException e) {
throw new RuntimeException("This is a BUG in Selenium; please report it", e);
}
socketFactory = sc.getSocketFactory();
return socketFactory;
} | [
"public",
"synchronized",
"static",
"SSLSocketFactory",
"getTrustingSSLSocketFactory",
"(",
")",
"{",
"if",
"(",
"socketFactory",
"!=",
"null",
")",
"return",
"socketFactory",
";",
"TrustManager",
"[",
"]",
"trustManagers",
"=",
"new",
"TrustManager",
"[",
"]",
"{... | Returns an SSLSocketFactory that will trust all SSL certificates; this is suitable for passing to
HttpsURLConnection, either to its instance method setSSLSocketFactory, or to its static method
setDefaultSSLSocketFactory.
@see javax.net.ssl.HttpsURLConnection#setSSLSocketFactory(SSLSocketFactory)
@see javax.net.ssl.HttpsURLConnection#setDefaultSSLSocketFactory(SSLSocketFactory)
@return SSLSocketFactory suitable for passing to HttpsUrlConnection | [
"Returns",
"an",
"SSLSocketFactory",
"that",
"will",
"trust",
"all",
"SSL",
"certificates",
";",
"this",
"is",
"suitable",
"for",
"passing",
"to",
"HttpsURLConnection",
"either",
"to",
"its",
"instance",
"method",
"setSSLSocketFactory",
"or",
"to",
"its",
"static"... | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/util/TrustEverythingSSLTrustManager.java#L31-L43 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.addUniform | public static void addUniform(InterleavedS32 input, Random rand , int min , int max) {
int range = max-min;
int[] data = input.data;
int length = input.width*input.numBands;
for (int y = 0; y < input.height; y++) {
int index = input.getStartIndex() + y * input.getStride();
int indexEnd = index+length;
while( index < indexEnd ) {
int value = (data[index] ) + rand.nextInt(range)+min;
data[index++] = value;
}
}
} | java | public static void addUniform(InterleavedS32 input, Random rand , int min , int max) {
int range = max-min;
int[] data = input.data;
int length = input.width*input.numBands;
for (int y = 0; y < input.height; y++) {
int index = input.getStartIndex() + y * input.getStride();
int indexEnd = index+length;
while( index < indexEnd ) {
int value = (data[index] ) + rand.nextInt(range)+min;
data[index++] = value;
}
}
} | [
"public",
"static",
"void",
"addUniform",
"(",
"InterleavedS32",
"input",
",",
"Random",
"rand",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"int",
"range",
"=",
"max",
"-",
"min",
";",
"int",
"[",
"]",
"data",
"=",
"input",
".",
"data",
";",
"... | Adds uniform i.i.d noise to each pixel in the image. Noise range is min ≤ X < max. | [
"Adds",
"uniform",
"i",
".",
"i",
".",
"d",
"noise",
"to",
"each",
"pixel",
"in",
"the",
"image",
".",
"Noise",
"range",
"is",
"min",
"&le",
";",
"X",
"<",
";",
"max",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L3644-L3659 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getCoinInstance | public static BtcFormat getCoinInstance(Locale locale, int scale, int... groups) {
return getInstance(COIN_SCALE, locale, scale, boxAsList(groups));
} | java | public static BtcFormat getCoinInstance(Locale locale, int scale, int... groups) {
return getInstance(COIN_SCALE, locale, scale, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getCoinInstance",
"(",
"Locale",
"locale",
",",
"int",
"scale",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"COIN_SCALE",
",",
"locale",
",",
"scale",
",",
"boxAsList",
"(",
"groups",
")",
")",
";"... | Return a newly-constructed instance for the given locale that will format
values in terms of bitcoins, with the given minimum number of fractional
decimal places. Optionally, repeating integer arguments can be passed, each
indicating the size of an additional group of fractional decimal places to be
used as necessary to avoid rounding, to a limiting precision of satoshis. | [
"Return",
"a",
"newly",
"-",
"constructed",
"instance",
"for",
"the",
"given",
"locale",
"that",
"will",
"format",
"values",
"in",
"terms",
"of",
"bitcoins",
"with",
"the",
"given",
"minimum",
"number",
"of",
"fractional",
"decimal",
"places",
".",
"Optionally... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L968-L970 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java | Tree.setAttribute | public void setAttribute(String name, String value, String facet)
throws JspException
{
// validate the name attribute, in the case of an error simply return.
if (name == null || name.length() <= 0) {
String s = Bundle.getString("Tags_AttributeNameNotSet");
registerTagError(s, null);
return;
}
// it's not legal to set the id or name attributes this way
if (name != null && (name.equals("netui:treeName"))) {
String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name});
registerTagError(s, null);
return;
}
_divState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, name, value);
} | java | public void setAttribute(String name, String value, String facet)
throws JspException
{
// validate the name attribute, in the case of an error simply return.
if (name == null || name.length() <= 0) {
String s = Bundle.getString("Tags_AttributeNameNotSet");
registerTagError(s, null);
return;
}
// it's not legal to set the id or name attributes this way
if (name != null && (name.equals("netui:treeName"))) {
String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name});
registerTagError(s, null);
return;
}
_divState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, name, value);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"String",
"value",
",",
"String",
"facet",
")",
"throws",
"JspException",
"{",
"// validate the name attribute, in the case of an error simply return.",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
... | Set an attribute value on the implementing class. The <code>name</code> represents
the name of the attribute. The <code>value</code> represents the value and may contains
an expression. The <code>facet</code> is optional and may be used by complex types to
target the attribute to a sub part of the generated markup. This method may result in errors
being generated.
@param name The name of the attribute. This value may not be null or the empty string.
@param value The value of the attribute. This may contain an expression.
@param facet The name of a facet to which the attribute will be applied. This is optional.
@throws javax.servlet.jsp.JspException A JspException may be thrown if there is an error setting the attribute. | [
"Set",
"an",
"attribute",
"value",
"on",
"the",
"implementing",
"class",
".",
"The",
"<code",
">",
"name<",
"/",
"code",
">",
"represents",
"the",
"name",
"of",
"the",
"attribute",
".",
"The",
"<code",
">",
"value<",
"/",
"code",
">",
"represents",
"the"... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java#L694-L711 |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/ImportSet.java | ImportSet.duplicateAndMunge | public void duplicateAndMunge (String pattern, String... replace)
{
Pattern pat = makePattern(pattern);
HashSet<String> toMunge = Sets.newHashSet();
for (String name : _imports) {
if (pat.matcher(name).matches()) {
toMunge.add(name);
}
}
for (String name : toMunge) {
String newname = name;
for (int ii = 0; ii < replace.length; ii += 2) {
newname = newname.replace(replace[ii], replace[ii + 1]);
}
_imports.add(newname);
}
} | java | public void duplicateAndMunge (String pattern, String... replace)
{
Pattern pat = makePattern(pattern);
HashSet<String> toMunge = Sets.newHashSet();
for (String name : _imports) {
if (pat.matcher(name).matches()) {
toMunge.add(name);
}
}
for (String name : toMunge) {
String newname = name;
for (int ii = 0; ii < replace.length; ii += 2) {
newname = newname.replace(replace[ii], replace[ii + 1]);
}
_imports.add(newname);
}
} | [
"public",
"void",
"duplicateAndMunge",
"(",
"String",
"pattern",
",",
"String",
"...",
"replace",
")",
"{",
"Pattern",
"pat",
"=",
"makePattern",
"(",
"pattern",
")",
";",
"HashSet",
"<",
"String",
">",
"toMunge",
"=",
"Sets",
".",
"newHashSet",
"(",
")",
... | Adds a new munged import for each existing import that matches a pattern. The new entry is
a copy of the old entry but modified according to the given find/replace pairs (see
description above).
@param pattern to qualify imports to duplicate
@param replace pairs to find/replace on the new import | [
"Adds",
"a",
"new",
"munged",
"import",
"for",
"each",
"existing",
"import",
"that",
"matches",
"a",
"pattern",
".",
"The",
"new",
"entry",
"is",
"a",
"copy",
"of",
"the",
"old",
"entry",
"but",
"modified",
"according",
"to",
"the",
"given",
"find",
"/",... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/ImportSet.java#L319-L335 |
alkacon/opencms-core | src/org/opencms/importexport/CmsImportVersion10.java | CmsImportVersion10.addXmlDigesterRules | public void addXmlDigesterRules(Digester digester) {
// first accounts
String xpath = CmsImportExportManager.N_EXPORT + "/" + N_ACCOUNTS + "/" + N_ORGUNITS + "/" + N_ORGUNIT + "/";
addAccountsOrgunitRules(digester, xpath);
addAccountsGroupRules(digester, xpath);
addAccountsUserRules(digester, xpath);
digester.addCallMethod(
CmsImportExportManager.N_EXPORT + "/" + N_ACCOUNTS + "/" + N_ORGUNITS + "/" + N_ORGUNIT,
"setMembership");
// then resources
// When encountering opening files tag, initialize some fields which keep track of multiple resources' data
digester.addRule(CmsImportExportManager.N_EXPORT + "/" + N_FILES, new Rule() {
@SuppressWarnings("synthetic-access")
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
m_indexToStructureId = new HashMap<>();
m_relationData = ArrayListMultimap.create();
}
});
digester.addRule(CmsImportExportManager.N_EXPORT + "/" + N_FILES + "/" + N_FILE, new Rule() {
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
m_importACEs = true;
m_resourceBuilder = new CmsResourceBuilder();
m_resourceBuilder.setDateLastModified(DATE_LAST_MODIFICATION_UNSPECIFIED);
m_resourceBuilder.setDateReleased(CmsResource.DATE_RELEASED_DEFAULT);
m_resourceBuilder.setDateExpired(CmsResource.DATE_EXPIRED_DEFAULT);
m_resourceBuilder.setDateCreated(DATE_CREATED_UNSPECIFIED);
m_resourceBuilder.setUserCreated(CmsUUID.getNullUUID());
m_relationsForResource = new ArrayList<>();
m_hasStructureId = false;
m_hasDateLastModified = false;
}
});
xpath = CmsImportExportManager.N_EXPORT + "/" + N_FILES + "/" + N_FILE + "/";
addResourceAttributesRules(digester, xpath);
digester.addCallMethod(xpath, "importResourceAll");
addResourcePropertyRules(digester, xpath);
addResourceRelationRules(digester, xpath);
addResourceAceRules(digester, xpath);
digester.addCallMethod(CmsImportExportManager.N_EXPORT + "/" + N_FILES, "importRelations");
digester.addCallMethod(CmsImportExportManager.N_EXPORT + "/" + N_FILES, "rewriteParseables");
// and now the organizational unit resources
digester.addCallMethod(CmsImportExportManager.N_EXPORT + "/" + N_FILES, "associateOrgUnitResources");
// then projects
xpath = CmsImportExportManager.N_EXPORT + "/" + N_PROJECTS + "/" + N_PROJECT + "/";
addProjectRules(digester, xpath);
} | java | public void addXmlDigesterRules(Digester digester) {
// first accounts
String xpath = CmsImportExportManager.N_EXPORT + "/" + N_ACCOUNTS + "/" + N_ORGUNITS + "/" + N_ORGUNIT + "/";
addAccountsOrgunitRules(digester, xpath);
addAccountsGroupRules(digester, xpath);
addAccountsUserRules(digester, xpath);
digester.addCallMethod(
CmsImportExportManager.N_EXPORT + "/" + N_ACCOUNTS + "/" + N_ORGUNITS + "/" + N_ORGUNIT,
"setMembership");
// then resources
// When encountering opening files tag, initialize some fields which keep track of multiple resources' data
digester.addRule(CmsImportExportManager.N_EXPORT + "/" + N_FILES, new Rule() {
@SuppressWarnings("synthetic-access")
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
m_indexToStructureId = new HashMap<>();
m_relationData = ArrayListMultimap.create();
}
});
digester.addRule(CmsImportExportManager.N_EXPORT + "/" + N_FILES + "/" + N_FILE, new Rule() {
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
m_importACEs = true;
m_resourceBuilder = new CmsResourceBuilder();
m_resourceBuilder.setDateLastModified(DATE_LAST_MODIFICATION_UNSPECIFIED);
m_resourceBuilder.setDateReleased(CmsResource.DATE_RELEASED_DEFAULT);
m_resourceBuilder.setDateExpired(CmsResource.DATE_EXPIRED_DEFAULT);
m_resourceBuilder.setDateCreated(DATE_CREATED_UNSPECIFIED);
m_resourceBuilder.setUserCreated(CmsUUID.getNullUUID());
m_relationsForResource = new ArrayList<>();
m_hasStructureId = false;
m_hasDateLastModified = false;
}
});
xpath = CmsImportExportManager.N_EXPORT + "/" + N_FILES + "/" + N_FILE + "/";
addResourceAttributesRules(digester, xpath);
digester.addCallMethod(xpath, "importResourceAll");
addResourcePropertyRules(digester, xpath);
addResourceRelationRules(digester, xpath);
addResourceAceRules(digester, xpath);
digester.addCallMethod(CmsImportExportManager.N_EXPORT + "/" + N_FILES, "importRelations");
digester.addCallMethod(CmsImportExportManager.N_EXPORT + "/" + N_FILES, "rewriteParseables");
// and now the organizational unit resources
digester.addCallMethod(CmsImportExportManager.N_EXPORT + "/" + N_FILES, "associateOrgUnitResources");
// then projects
xpath = CmsImportExportManager.N_EXPORT + "/" + N_PROJECTS + "/" + N_PROJECT + "/";
addProjectRules(digester, xpath);
} | [
"public",
"void",
"addXmlDigesterRules",
"(",
"Digester",
"digester",
")",
"{",
"// first accounts",
"String",
"xpath",
"=",
"CmsImportExportManager",
".",
"N_EXPORT",
"+",
"\"/\"",
"+",
"N_ACCOUNTS",
"+",
"\"/\"",
"+",
"N_ORGUNITS",
"+",
"\"/\"",
"+",
"N_ORGUNIT"... | Adds the XML digester rules for a single import file.<p>
@param digester the digester to add the rules to | [
"Adds",
"the",
"XML",
"digester",
"rules",
"for",
"a",
"single",
"import",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion10.java#L856-L916 |
haifengl/smile | core/src/main/java/smile/validation/Validation.java | Validation.cv | public static <T> double cv(int k, ClassifierTrainer<T> trainer, T[] x, int[] y, ClassificationMeasure measure) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold cross validation: " + k);
}
int n = x.length;
int[] predictions = new int[n];
CrossValidation cv = new CrossValidation(n, k);
for (int i = 0; i < k; i++) {
T[] trainx = Math.slice(x, cv.train[i]);
int[] trainy = Math.slice(y, cv.train[i]);
Classifier<T> classifier = trainer.train(trainx, trainy);
for (int j : cv.test[i]) {
predictions[j] = classifier.predict(x[j]);
}
}
return measure.measure(y, predictions);
} | java | public static <T> double cv(int k, ClassifierTrainer<T> trainer, T[] x, int[] y, ClassificationMeasure measure) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold cross validation: " + k);
}
int n = x.length;
int[] predictions = new int[n];
CrossValidation cv = new CrossValidation(n, k);
for (int i = 0; i < k; i++) {
T[] trainx = Math.slice(x, cv.train[i]);
int[] trainy = Math.slice(y, cv.train[i]);
Classifier<T> classifier = trainer.train(trainx, trainy);
for (int j : cv.test[i]) {
predictions[j] = classifier.predict(x[j]);
}
}
return measure.measure(y, predictions);
} | [
"public",
"static",
"<",
"T",
">",
"double",
"cv",
"(",
"int",
"k",
",",
"ClassifierTrainer",
"<",
"T",
">",
"trainer",
",",
"T",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
",",
"ClassificationMeasure",
"measure",
")",
"{",
"if",
"(",
"k",
"<",
"2... | Cross validation of a classification model.
@param <T> the data type of input objects.
@param k k-fold cross validation.
@param trainer a classifier trainer that is properly parameterized.
@param x the test data set.
@param y the test data labels.
@param measure the performance measure of classification.
@return the test results with the same size of order of measures | [
"Cross",
"validation",
"of",
"a",
"classification",
"model",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/validation/Validation.java#L410-L431 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CameraPlaneProjection.java | CameraPlaneProjection.planeToPixel | public boolean planeToPixel( double pointX , double pointY , Point2D_F64 pixel ) {
// convert it into a 3D coordinate and transform into camera reference frame
plain3D.set(-pointY, 0, pointX);
SePointOps_F64.transform(planeToCamera, plain3D, camera3D);
// if it's behind the camera it can't be seen
if( camera3D.z <= 0 )
return false;
// normalized image coordinates and convert into pixels
double normX = camera3D.x / camera3D.z;
double normY = camera3D.y / camera3D.z;
normToPixel.compute(normX,normY,pixel);
return true;
} | java | public boolean planeToPixel( double pointX , double pointY , Point2D_F64 pixel ) {
// convert it into a 3D coordinate and transform into camera reference frame
plain3D.set(-pointY, 0, pointX);
SePointOps_F64.transform(planeToCamera, plain3D, camera3D);
// if it's behind the camera it can't be seen
if( camera3D.z <= 0 )
return false;
// normalized image coordinates and convert into pixels
double normX = camera3D.x / camera3D.z;
double normY = camera3D.y / camera3D.z;
normToPixel.compute(normX,normY,pixel);
return true;
} | [
"public",
"boolean",
"planeToPixel",
"(",
"double",
"pointX",
",",
"double",
"pointY",
",",
"Point2D_F64",
"pixel",
")",
"{",
"// convert it into a 3D coordinate and transform into camera reference frame",
"plain3D",
".",
"set",
"(",
"-",
"pointY",
",",
"0",
",",
"poi... | Given a point on the plane find the pixel in the image.
@param pointX (input) Point on the plane, x-axis
@param pointY (input) Point on the plane, y-axis
@param pixel (output) Pixel in the image
@return true if the point is in front of the camera. False if not. | [
"Given",
"a",
"point",
"on",
"the",
"plane",
"find",
"the",
"pixel",
"in",
"the",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CameraPlaneProjection.java#L105-L120 |
pebble/pebble-android-sdk | PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java | PebbleKit.registerPebbleDisconnectedReceiver | public static BroadcastReceiver registerPebbleDisconnectedReceiver(final Context context,
final BroadcastReceiver receiver) {
return registerBroadcastReceiverInternal(context, INTENT_PEBBLE_DISCONNECTED, receiver);
} | java | public static BroadcastReceiver registerPebbleDisconnectedReceiver(final Context context,
final BroadcastReceiver receiver) {
return registerBroadcastReceiverInternal(context, INTENT_PEBBLE_DISCONNECTED, receiver);
} | [
"public",
"static",
"BroadcastReceiver",
"registerPebbleDisconnectedReceiver",
"(",
"final",
"Context",
"context",
",",
"final",
"BroadcastReceiver",
"receiver",
")",
"{",
"return",
"registerBroadcastReceiverInternal",
"(",
"context",
",",
"INTENT_PEBBLE_DISCONNECTED",
",",
... | A convenience function to assist in programatically registering a broadcast receiver for the 'DISCONNECTED'
intent.
Go avoid leaking memory, activities registering BroadcastReceivers <em>must</em> unregister them in the
Activity's {@link android.app.Activity#onPause()} method.
@param context
The context in which to register the BroadcastReceiver.
@param receiver
The receiver to be registered.
@return The registered receiver.
@see Constants#INTENT_PEBBLE_DISCONNECTED | [
"A",
"convenience",
"function",
"to",
"assist",
"in",
"programatically",
"registering",
"a",
"broadcast",
"receiver",
"for",
"the",
"DISCONNECTED",
"intent",
"."
] | train | https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java#L406-L409 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java | CDKMCS.getCommonSymbol | private static String getCommonSymbol(IBond bondA, IBond bondB) {
String symbol = "";
if (bondA.contains(bondB.getBegin())) {
symbol = bondB.getBegin().getSymbol();
} else if (bondA.contains(bondB.getEnd())) {
symbol = bondB.getEnd().getSymbol();
}
return symbol;
} | java | private static String getCommonSymbol(IBond bondA, IBond bondB) {
String symbol = "";
if (bondA.contains(bondB.getBegin())) {
symbol = bondB.getBegin().getSymbol();
} else if (bondA.contains(bondB.getEnd())) {
symbol = bondB.getEnd().getSymbol();
}
return symbol;
} | [
"private",
"static",
"String",
"getCommonSymbol",
"(",
"IBond",
"bondA",
",",
"IBond",
"bondB",
")",
"{",
"String",
"symbol",
"=",
"\"\"",
";",
"if",
"(",
"bondA",
".",
"contains",
"(",
"bondB",
".",
"getBegin",
"(",
")",
")",
")",
"{",
"symbol",
"=",
... | Determines if 2 bondA1 have 1 atom in common and returns the common symbol
@param atom first bondA1
@param bondB second bondA1
@return the symbol of the common atom or "" if
the 2 bonds have no common atom | [
"Determines",
"if",
"2",
"bondA1",
"have",
"1",
"atom",
"in",
"common",
"and",
"returns",
"the",
"common",
"symbol"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java#L920-L930 |
aws/aws-sdk-java | aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/SubscribeRequest.java | SubscribeRequest.withAttributes | public SubscribeRequest withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public SubscribeRequest withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"SubscribeRequest",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map of attributes with their corresponding values.
</p>
<p>
The following lists the names, descriptions, and values of the special request parameters that the
<code>SetTopicAttributes</code> action uses:
</p>
<ul>
<li>
<p>
<code>DeliveryPolicy</code> – The policy that defines how Amazon SNS retries failed deliveries to HTTP/S
endpoints.
</p>
</li>
<li>
<p>
<code>FilterPolicy</code> – The simple JSON object that lets your subscriber receive only a subset of messages,
rather than receiving every message published to the topic.
</p>
</li>
<li>
<p>
<code>RawMessageDelivery</code> – When set to <code>true</code>, enables raw message delivery to Amazon SQS or
HTTP/S endpoints. This eliminates the need for the endpoints to process JSON formatting, which is otherwise
created for Amazon SNS metadata.
</p>
</li>
</ul>
@param attributes
A map of attributes with their corresponding values.</p>
<p>
The following lists the names, descriptions, and values of the special request parameters that the
<code>SetTopicAttributes</code> action uses:
</p>
<ul>
<li>
<p>
<code>DeliveryPolicy</code> – The policy that defines how Amazon SNS retries failed deliveries to HTTP/S
endpoints.
</p>
</li>
<li>
<p>
<code>FilterPolicy</code> – The simple JSON object that lets your subscriber receive only a subset of
messages, rather than receiving every message published to the topic.
</p>
</li>
<li>
<p>
<code>RawMessageDelivery</code> – When set to <code>true</code>, enables raw message delivery to Amazon
SQS or HTTP/S endpoints. This eliminates the need for the endpoints to process JSON formatting, which is
otherwise created for Amazon SNS metadata.
</p>
</li>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"of",
"attributes",
"with",
"their",
"corresponding",
"values",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"following",
"lists",
"the",
"names",
"descriptions",
"and",
"values",
"of",
"the",
"special",
"request",
"parameters",
"that"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/SubscribeRequest.java#L1095-L1098 |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.addEntry | public Jar addEntry(Path path, InputStream is) throws IOException {
return addEntry(path != null ? path.toString() : "", is);
} | java | public Jar addEntry(Path path, InputStream is) throws IOException {
return addEntry(path != null ? path.toString() : "", is);
} | [
"public",
"Jar",
"addEntry",
"(",
"Path",
"path",
",",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"return",
"addEntry",
"(",
"path",
"!=",
"null",
"?",
"path",
".",
"toString",
"(",
")",
":",
"\"\"",
",",
"is",
")",
";",
"}"
] | Adds an entry to this JAR.
@param path the entry's path within the JAR
@param is the entry's content
@return {@code this} | [
"Adds",
"an",
"entry",
"to",
"this",
"JAR",
"."
] | train | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L321-L323 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.setWorldClip | public void setWorldClip(float x, float y, float width, float height) {
predraw();
worldClipRecord = new Rectangle(x, y, width, height);
GL.glEnable(SGL.GL_CLIP_PLANE0);
worldClip.put(1).put(0).put(0).put(-x).flip();
GL.glClipPlane(SGL.GL_CLIP_PLANE0, worldClip);
GL.glEnable(SGL.GL_CLIP_PLANE1);
worldClip.put(-1).put(0).put(0).put(x + width).flip();
GL.glClipPlane(SGL.GL_CLIP_PLANE1, worldClip);
GL.glEnable(SGL.GL_CLIP_PLANE2);
worldClip.put(0).put(1).put(0).put(-y).flip();
GL.glClipPlane(SGL.GL_CLIP_PLANE2, worldClip);
GL.glEnable(SGL.GL_CLIP_PLANE3);
worldClip.put(0).put(-1).put(0).put(y + height).flip();
GL.glClipPlane(SGL.GL_CLIP_PLANE3, worldClip);
postdraw();
} | java | public void setWorldClip(float x, float y, float width, float height) {
predraw();
worldClipRecord = new Rectangle(x, y, width, height);
GL.glEnable(SGL.GL_CLIP_PLANE0);
worldClip.put(1).put(0).put(0).put(-x).flip();
GL.glClipPlane(SGL.GL_CLIP_PLANE0, worldClip);
GL.glEnable(SGL.GL_CLIP_PLANE1);
worldClip.put(-1).put(0).put(0).put(x + width).flip();
GL.glClipPlane(SGL.GL_CLIP_PLANE1, worldClip);
GL.glEnable(SGL.GL_CLIP_PLANE2);
worldClip.put(0).put(1).put(0).put(-y).flip();
GL.glClipPlane(SGL.GL_CLIP_PLANE2, worldClip);
GL.glEnable(SGL.GL_CLIP_PLANE3);
worldClip.put(0).put(-1).put(0).put(y + height).flip();
GL.glClipPlane(SGL.GL_CLIP_PLANE3, worldClip);
postdraw();
} | [
"public",
"void",
"setWorldClip",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"width",
",",
"float",
"height",
")",
"{",
"predraw",
"(",
")",
";",
"worldClipRecord",
"=",
"new",
"Rectangle",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
")... | Set clipping that controls which areas of the world will be drawn to.
Note that world clip is different from standard screen clip in that it's
defined in the space of the current world coordinate - i.e. it's affected
by translate, rotate, scale etc.
@param x
The x coordinate of the top left corner of the allowed area
@param y
The y coordinate of the top left corner of the allowed area
@param width
The width of the allowed area
@param height
The height of the allowed area | [
"Set",
"clipping",
"that",
"controls",
"which",
"areas",
"of",
"the",
"world",
"will",
"be",
"drawn",
"to",
".",
"Note",
"that",
"world",
"clip",
"is",
"different",
"from",
"standard",
"screen",
"clip",
"in",
"that",
"it",
"s",
"defined",
"in",
"the",
"s... | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L720-L738 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/tabs/Tabs.java | Tabs.parseInteger | private int parseInteger(String value, int defaultValue)
{
try
{
return Integer.parseInt(value);
}
catch (NumberFormatException e)
{
return defaultValue;
}
} | java | private int parseInteger(String value, int defaultValue)
{
try
{
return Integer.parseInt(value);
}
catch (NumberFormatException e)
{
return defaultValue;
}
} | [
"private",
"int",
"parseInteger",
"(",
"String",
"value",
",",
"int",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"return",
"defaultValue",
"... | Parses an integer.
@param value
The value to parse.
@return The parsed integer. | [
"Parses",
"an",
"integer",
"."
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/tabs/Tabs.java#L278-L288 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java | FieldUtils.readDeclaredField | public static Object readDeclaredField(final Object target, final String fieldName) throws IllegalAccessException {
return readDeclaredField(target, fieldName, false);
} | java | public static Object readDeclaredField(final Object target, final String fieldName) throws IllegalAccessException {
return readDeclaredField(target, fieldName, false);
} | [
"public",
"static",
"Object",
"readDeclaredField",
"(",
"final",
"Object",
"target",
",",
"final",
"String",
"fieldName",
")",
"throws",
"IllegalAccessException",
"{",
"return",
"readDeclaredField",
"(",
"target",
",",
"fieldName",
",",
"false",
")",
";",
"}"
] | Reads the named {@code public} {@link Field}. Only the class of the specified object will be considered.
@param target
the object to reflect, must not be {@code null}
@param fieldName
the field name to obtain
@return the value of the field
@throws IllegalArgumentException
if {@code target} is {@code null}, or the field name is blank or empty or could not be found
@throws IllegalAccessException
if the named field is not {@code public} | [
"Reads",
"the",
"named",
"{",
"@code",
"public",
"}",
"{",
"@link",
"Field",
"}",
".",
"Only",
"the",
"class",
"of",
"the",
"specified",
"object",
"will",
"be",
"considered",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java#L488-L490 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java | PgResultSet.readLongValue | private long readLongValue(byte[] bytes, int oid, long minVal, long maxVal, String targetType)
throws PSQLException {
long val;
// currently implemented binary encoded fields
switch (oid) {
case Oid.INT2:
val = ByteConverter.int2(bytes, 0);
break;
case Oid.INT4:
val = ByteConverter.int4(bytes, 0);
break;
case Oid.INT8:
val = ByteConverter.int8(bytes, 0);
break;
case Oid.FLOAT4:
val = (long) ByteConverter.float4(bytes, 0);
break;
case Oid.FLOAT8:
val = (long) ByteConverter.float8(bytes, 0);
break;
default:
throw new PSQLException(
GT.tr("Cannot convert the column of type {0} to requested type {1}.",
Oid.toString(oid), targetType),
PSQLState.DATA_TYPE_MISMATCH);
}
if (val < minVal || val > maxVal) {
throw new PSQLException(GT.tr("Bad value for type {0} : {1}", targetType, val),
PSQLState.NUMERIC_VALUE_OUT_OF_RANGE);
}
return val;
} | java | private long readLongValue(byte[] bytes, int oid, long minVal, long maxVal, String targetType)
throws PSQLException {
long val;
// currently implemented binary encoded fields
switch (oid) {
case Oid.INT2:
val = ByteConverter.int2(bytes, 0);
break;
case Oid.INT4:
val = ByteConverter.int4(bytes, 0);
break;
case Oid.INT8:
val = ByteConverter.int8(bytes, 0);
break;
case Oid.FLOAT4:
val = (long) ByteConverter.float4(bytes, 0);
break;
case Oid.FLOAT8:
val = (long) ByteConverter.float8(bytes, 0);
break;
default:
throw new PSQLException(
GT.tr("Cannot convert the column of type {0} to requested type {1}.",
Oid.toString(oid), targetType),
PSQLState.DATA_TYPE_MISMATCH);
}
if (val < minVal || val > maxVal) {
throw new PSQLException(GT.tr("Bad value for type {0} : {1}", targetType, val),
PSQLState.NUMERIC_VALUE_OUT_OF_RANGE);
}
return val;
} | [
"private",
"long",
"readLongValue",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"oid",
",",
"long",
"minVal",
",",
"long",
"maxVal",
",",
"String",
"targetType",
")",
"throws",
"PSQLException",
"{",
"long",
"val",
";",
"// currently implemented binary encoded fi... | <p>Converts any numeric binary field to long value.</p>
<p>This method is used by getByte,getShort,getInt and getLong. It must support a subset of the
following java types that use Binary encoding. (fields that use text encoding use a different
code path).
<code>byte,short,int,long,float,double,BigDecimal,boolean,string</code>.
</p>
@param bytes The bytes of the numeric field.
@param oid The oid of the field.
@param minVal the minimum value allowed.
@param maxVal the maximum value allowed.
@param targetType The target type. Used for error reporting.
@return The value as long.
@throws PSQLException If the field type is not supported numeric type or if the value is out of
range. | [
"<p",
">",
"Converts",
"any",
"numeric",
"binary",
"field",
"to",
"long",
"value",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L2990-L3021 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Base.java | Base.withDb | public static <T> T withDb(String driver, String url, String user, String password, Supplier<T> supplier) {
return new DB(DB.DEFAULT_NAME).withDb(driver, url, user, password, supplier);
} | java | public static <T> T withDb(String driver, String url, String user, String password, Supplier<T> supplier) {
return new DB(DB.DEFAULT_NAME).withDb(driver, url, user, password, supplier);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withDb",
"(",
"String",
"driver",
",",
"String",
"url",
",",
"String",
"user",
",",
"String",
"password",
",",
"Supplier",
"<",
"T",
">",
"supplier",
")",
"{",
"return",
"new",
"DB",
"(",
"DB",
".",
"DEFAULT_N... | Same as {@link DB#withDb(String, String, String, String, Supplier)}, but with db name {@link DB#DEFAULT_NAME}. | [
"Same",
"as",
"{"
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L422-L424 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java | ZooKeeperMasterModel.addDeploymentGroup | @Override
public void addDeploymentGroup(final DeploymentGroup deploymentGroup)
throws DeploymentGroupExistsException {
log.info("adding deployment-group: {}", deploymentGroup);
final ZooKeeperClient client = provider.get("addDeploymentGroup");
try {
try {
client.ensurePath(Paths.configDeploymentGroups());
client.ensurePath(Paths.statusDeploymentGroups());
client.transaction(
create(Paths.configDeploymentGroup(deploymentGroup.getName()), deploymentGroup),
create(Paths.statusDeploymentGroup(deploymentGroup.getName())),
create(Paths.statusDeploymentGroupHosts(deploymentGroup.getName()),
Json.asBytesUnchecked(emptyList())),
create(Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()),
Json.asBytesUnchecked(emptyList()))
);
} catch (final NodeExistsException e) {
throw new DeploymentGroupExistsException(deploymentGroup.getName());
}
} catch (final KeeperException e) {
throw new HeliosRuntimeException("adding deployment-group " + deploymentGroup + " failed", e);
}
} | java | @Override
public void addDeploymentGroup(final DeploymentGroup deploymentGroup)
throws DeploymentGroupExistsException {
log.info("adding deployment-group: {}", deploymentGroup);
final ZooKeeperClient client = provider.get("addDeploymentGroup");
try {
try {
client.ensurePath(Paths.configDeploymentGroups());
client.ensurePath(Paths.statusDeploymentGroups());
client.transaction(
create(Paths.configDeploymentGroup(deploymentGroup.getName()), deploymentGroup),
create(Paths.statusDeploymentGroup(deploymentGroup.getName())),
create(Paths.statusDeploymentGroupHosts(deploymentGroup.getName()),
Json.asBytesUnchecked(emptyList())),
create(Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()),
Json.asBytesUnchecked(emptyList()))
);
} catch (final NodeExistsException e) {
throw new DeploymentGroupExistsException(deploymentGroup.getName());
}
} catch (final KeeperException e) {
throw new HeliosRuntimeException("adding deployment-group " + deploymentGroup + " failed", e);
}
} | [
"@",
"Override",
"public",
"void",
"addDeploymentGroup",
"(",
"final",
"DeploymentGroup",
"deploymentGroup",
")",
"throws",
"DeploymentGroupExistsException",
"{",
"log",
".",
"info",
"(",
"\"adding deployment-group: {}\"",
",",
"deploymentGroup",
")",
";",
"final",
"Zoo... | Create a deployment group.
<p>If successful, the following ZK nodes will be created:
<ul>
<li>/config/deployment-groups/[group-name]</li>
<li>/status/deployment-groups/[group-name]</li>
<li>/status/deployment-groups/[group-name]/hosts</li>
</ul>
These nodes are guaranteed to exist until the DG is removed.
<p>If the operation fails no ZK nodes will be created. If any of the nodes above already exist
the operation will fail.
@throws DeploymentGroupExistsException If a DG with the same name already exists. | [
"Create",
"a",
"deployment",
"group",
"."
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L356-L380 |
beanshell/beanshell | src/main/java/bsh/NameSpace.java | NameSpace.getMethod | public BshMethod getMethod(final String name, final Class<?>[] sig)
throws UtilEvalError {
return this.getMethod(name, sig, false/* declaredOnly */);
} | java | public BshMethod getMethod(final String name, final Class<?>[] sig)
throws UtilEvalError {
return this.getMethod(name, sig, false/* declaredOnly */);
} | [
"public",
"BshMethod",
"getMethod",
"(",
"final",
"String",
"name",
",",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"sig",
")",
"throws",
"UtilEvalError",
"{",
"return",
"this",
".",
"getMethod",
"(",
"name",
",",
"sig",
",",
"false",
"/* declaredOnly */",... | Gets the method.
@param name the name
@param sig the sig
@return the method
@throws UtilEvalError the util eval error
@see #getMethod(String, Class [], boolean)
@see #getMethod(String, Class []) | [
"Gets",
"the",
"method",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/NameSpace.java#L748-L751 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.getTVInfo | public TVInfo getTVInfo(int tvID, String language, String... appendToResponse) throws MovieDbException {
return tmdbTv.getTVInfo(tvID, language, appendToResponse);
} | java | public TVInfo getTVInfo(int tvID, String language, String... appendToResponse) throws MovieDbException {
return tmdbTv.getTVInfo(tvID, language, appendToResponse);
} | [
"public",
"TVInfo",
"getTVInfo",
"(",
"int",
"tvID",
",",
"String",
"language",
",",
"String",
"...",
"appendToResponse",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbTv",
".",
"getTVInfo",
"(",
"tvID",
",",
"language",
",",
"appendToResponse",
")",
... | Get the primary information about a TV series by id.
@param tvID tvID
@param language language
@param appendToResponse appendToResponse
@return
@throws com.omertron.themoviedbapi.MovieDbException | [
"Get",
"the",
"primary",
"information",
"about",
"a",
"TV",
"series",
"by",
"id",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1435-L1437 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java | GoogleCloudStorageImpl.copyInternal | private void copyInternal(
BatchHelper batchHelper,
final KeySetView<IOException, Boolean> innerExceptions,
final String srcBucketName, final String srcObjectName,
final String dstBucketName, final String dstObjectName)
throws IOException {
Storage.Objects.Copy copyObject =
configureRequest(
gcs.objects().copy(srcBucketName, srcObjectName, dstBucketName, dstObjectName, null),
srcBucketName);
batchHelper.queue(
copyObject,
new JsonBatchCallback<StorageObject>() {
@Override
public void onSuccess(StorageObject copyResponse, HttpHeaders responseHeaders) {
String srcString = StorageResourceId.createReadableString(srcBucketName, srcObjectName);
String dstString = StorageResourceId.createReadableString(dstBucketName, dstObjectName);
logger.atFine().log("Successfully copied %s to %s", srcString, dstString);
}
@Override
public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
onCopyFailure(innerExceptions, e, srcBucketName, srcObjectName);
}
});
} | java | private void copyInternal(
BatchHelper batchHelper,
final KeySetView<IOException, Boolean> innerExceptions,
final String srcBucketName, final String srcObjectName,
final String dstBucketName, final String dstObjectName)
throws IOException {
Storage.Objects.Copy copyObject =
configureRequest(
gcs.objects().copy(srcBucketName, srcObjectName, dstBucketName, dstObjectName, null),
srcBucketName);
batchHelper.queue(
copyObject,
new JsonBatchCallback<StorageObject>() {
@Override
public void onSuccess(StorageObject copyResponse, HttpHeaders responseHeaders) {
String srcString = StorageResourceId.createReadableString(srcBucketName, srcObjectName);
String dstString = StorageResourceId.createReadableString(dstBucketName, dstObjectName);
logger.atFine().log("Successfully copied %s to %s", srcString, dstString);
}
@Override
public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
onCopyFailure(innerExceptions, e, srcBucketName, srcObjectName);
}
});
} | [
"private",
"void",
"copyInternal",
"(",
"BatchHelper",
"batchHelper",
",",
"final",
"KeySetView",
"<",
"IOException",
",",
"Boolean",
">",
"innerExceptions",
",",
"final",
"String",
"srcBucketName",
",",
"final",
"String",
"srcObjectName",
",",
"final",
"String",
... | Performs copy operation using GCS Copy requests
@see GoogleCloudStorage#copy(String, List, String, List) | [
"Performs",
"copy",
"operation",
"using",
"GCS",
"Copy",
"requests"
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java#L976-L1002 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.setEnterpriseCost | public void setEnterpriseCost(int index, Number value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_COST, index), value);
} | java | public void setEnterpriseCost(int index, Number value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_COST, index), value);
} | [
"public",
"void",
"setEnterpriseCost",
"(",
"int",
"index",
",",
"Number",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"ENTERPRISE_COST",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set an enterprise cost value.
@param index cost index (1-30)
@param value cost value | [
"Set",
"an",
"enterprise",
"cost",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1694-L1697 |
larsga/Duke | duke-core/src/main/java/no/priv/garshol/duke/utils/StringUtils.java | StringUtils.replaceAnyOf | public static String replaceAnyOf(String value, String chars,
char replacement) {
char[] tmp = new char[value.length()];
int pos = 0;
for (int ix = 0; ix < tmp.length; ix++) {
char ch = value.charAt(ix);
if (chars.indexOf(ch) != -1)
tmp[pos++] = replacement;
else
tmp[pos++] = ch;
}
return new String(tmp, 0, tmp.length);
} | java | public static String replaceAnyOf(String value, String chars,
char replacement) {
char[] tmp = new char[value.length()];
int pos = 0;
for (int ix = 0; ix < tmp.length; ix++) {
char ch = value.charAt(ix);
if (chars.indexOf(ch) != -1)
tmp[pos++] = replacement;
else
tmp[pos++] = ch;
}
return new String(tmp, 0, tmp.length);
} | [
"public",
"static",
"String",
"replaceAnyOf",
"(",
"String",
"value",
",",
"String",
"chars",
",",
"char",
"replacement",
")",
"{",
"char",
"[",
"]",
"tmp",
"=",
"new",
"char",
"[",
"value",
".",
"length",
"(",
")",
"]",
";",
"int",
"pos",
"=",
"0",
... | Replaces all characters in the second parameter found in the first
parameter with the final character.
@param value the string to replace characters in
@param chars the characters to replace
@param replacement the character to insert as replacement | [
"Replaces",
"all",
"characters",
"in",
"the",
"second",
"parameter",
"found",
"in",
"the",
"first",
"parameter",
"with",
"the",
"final",
"character",
"."
] | train | https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-core/src/main/java/no/priv/garshol/duke/utils/StringUtils.java#L13-L25 |
kmi/iserve | iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java | AbstractMatcher.listMatchesOfType | @Override
public Table<URI, URI, MatchResult> listMatchesOfType(Set<URI> origins, MatchType type) {
return listMatchesWithinRange(origins, type, type);
} | java | @Override
public Table<URI, URI, MatchResult> listMatchesOfType(Set<URI> origins, MatchType type) {
return listMatchesWithinRange(origins, type, type);
} | [
"@",
"Override",
"public",
"Table",
"<",
"URI",
",",
"URI",
",",
"MatchResult",
">",
"listMatchesOfType",
"(",
"Set",
"<",
"URI",
">",
"origins",
",",
"MatchType",
"type",
")",
"{",
"return",
"listMatchesWithinRange",
"(",
"origins",
",",
"type",
",",
"typ... | Obtains all the matching resources that have a precise MatchType with the URIs of {@code origin}.
@param origins URIs to match
@param type the MatchType we want to obtain
@return a {@link com.google.common.collect.Table} with the result of the matching indexed by origin URI and then destination URI. | [
"Obtains",
"all",
"the",
"matching",
"resources",
"that",
"have",
"a",
"precise",
"MatchType",
"with",
"the",
"URIs",
"of",
"{",
"@code",
"origin",
"}",
"."
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java#L169-L172 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.v2GetMessageList | public MessageListResult v2GetMessageList(int count, String begin_time, String end_time)
throws APIConnectionException, APIRequestException {
return _reportClient.v2GetMessageList(count, begin_time, end_time);
} | java | public MessageListResult v2GetMessageList(int count, String begin_time, String end_time)
throws APIConnectionException, APIRequestException {
return _reportClient.v2GetMessageList(count, begin_time, end_time);
} | [
"public",
"MessageListResult",
"v2GetMessageList",
"(",
"int",
"count",
",",
"String",
"begin_time",
",",
"String",
"end_time",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_reportClient",
".",
"v2GetMessageList",
"(",
"count",
... | Get message list from history, messages will store 60 days.
@param count Necessary parameter. The count of the message list.
@param begin_time Necessary parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss'
@param end_time Necessary parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss'
@return MessageListResult
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"message",
"list",
"from",
"history",
"messages",
"will",
"store",
"60",
"days",
"."
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L948-L951 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java | SimpleCompareFileExtensions.compareFilesByExtension | public static boolean compareFilesByExtension(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, false, true, true, true, true)
.getFileExtensionEquality();
} | java | public static boolean compareFilesByExtension(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, false, true, true, true, true)
.getFileExtensionEquality();
} | [
"public",
"static",
"boolean",
"compareFilesByExtension",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"{",
"return",
"CompareFileExtensions",
".",
"compareFiles",
"(",
"sourceFile",
",",
"fileToCompare",
",",
"true",
",",
"false",... | Compare files by extension.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the extension are equal, otherwise false. | [
"Compare",
"files",
"by",
"extension",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L147-L152 |
op4j/op4j | src/main/java/org/op4j/functions/Call.java | Call.bigDecimal | public static Function<Object,BigDecimal> bigDecimal(final String methodName, final Object... optionalParameters) {
return methodForBigDecimal(methodName, optionalParameters);
} | java | public static Function<Object,BigDecimal> bigDecimal(final String methodName, final Object... optionalParameters) {
return methodForBigDecimal(methodName, optionalParameters);
} | [
"public",
"static",
"Function",
"<",
"Object",
",",
"BigDecimal",
">",
"bigDecimal",
"(",
"final",
"String",
"methodName",
",",
"final",
"Object",
"...",
"optionalParameters",
")",
"{",
"return",
"methodForBigDecimal",
"(",
"methodName",
",",
"optionalParameters",
... | <p>
Abbreviation for {{@link #methodForBigDecimal(String, Object...)}.
</p>
@since 1.1
@param methodName the name of the method
@param optionalParameters the (optional) parameters of the method.
@return the result of the method execution | [
"<p",
">",
"Abbreviation",
"for",
"{{",
"@link",
"#methodForBigDecimal",
"(",
"String",
"Object",
"...",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/Call.java#L178-L180 |
wonderpush/wonderpush-android-sdk | sdk/src/main/java/com/wonderpush/sdk/WonderPushView.java | WonderPushView.setResource | public void setResource(String resource, RequestParams params) {
if (null == resource) {
WonderPush.logError("null resource provided to WonderPushView");
return;
}
mInitialResource = resource;
mInitialRequestParams = params;
mIsPreloading = false;
if (null == params)
params = new RequestParams();
WonderPushRequestParamsDecorator.decorate(resource, params);
String url = String.format(Locale.getDefault(), "%s?%s",
WonderPushUriHelper.getNonSecureAbsoluteUrl(resource),
params.getURLEncodedString());
mWebView.loadUrl(url);
} | java | public void setResource(String resource, RequestParams params) {
if (null == resource) {
WonderPush.logError("null resource provided to WonderPushView");
return;
}
mInitialResource = resource;
mInitialRequestParams = params;
mIsPreloading = false;
if (null == params)
params = new RequestParams();
WonderPushRequestParamsDecorator.decorate(resource, params);
String url = String.format(Locale.getDefault(), "%s?%s",
WonderPushUriHelper.getNonSecureAbsoluteUrl(resource),
params.getURLEncodedString());
mWebView.loadUrl(url);
} | [
"public",
"void",
"setResource",
"(",
"String",
"resource",
",",
"RequestParams",
"params",
")",
"{",
"if",
"(",
"null",
"==",
"resource",
")",
"{",
"WonderPush",
".",
"logError",
"(",
"\"null resource provided to WonderPushView\"",
")",
";",
"return",
";",
"}",... | Sets the resource for the web content displayed in this WonderPushView's WebView. | [
"Sets",
"the",
"resource",
"for",
"the",
"web",
"content",
"displayed",
"in",
"this",
"WonderPushView",
"s",
"WebView",
"."
] | train | https://github.com/wonderpush/wonderpush-android-sdk/blob/ba0a1568f705cdd6206639bfab1e5cf529084b59/sdk/src/main/java/com/wonderpush/sdk/WonderPushView.java#L261-L278 |
Wikidata/Wikidata-Toolkit | wdtk-client/src/main/java/org/wikidata/wdtk/client/SchemaUsageAnalyzer.java | SchemaUsageAnalyzer.getNumId | private Integer getNumId(String idString, boolean isUri) {
String numString;
if (isUri) {
if (!idString.startsWith("http://www.wikidata.org/entity/")) {
return 0;
}
numString = idString.substring("http://www.wikidata.org/entity/Q"
.length());
} else {
numString = idString.substring(1);
}
return Integer.parseInt(numString);
} | java | private Integer getNumId(String idString, boolean isUri) {
String numString;
if (isUri) {
if (!idString.startsWith("http://www.wikidata.org/entity/")) {
return 0;
}
numString = idString.substring("http://www.wikidata.org/entity/Q"
.length());
} else {
numString = idString.substring(1);
}
return Integer.parseInt(numString);
} | [
"private",
"Integer",
"getNumId",
"(",
"String",
"idString",
",",
"boolean",
"isUri",
")",
"{",
"String",
"numString",
";",
"if",
"(",
"isUri",
")",
"{",
"if",
"(",
"!",
"idString",
".",
"startsWith",
"(",
"\"http://www.wikidata.org/entity/\"",
")",
")",
"{"... | Extracts a numeric id from a string, which can be either a Wikidata
entity URI or a short entity or property id.
@param idString
@param isUri
@return numeric id, or 0 if there was an error | [
"Extracts",
"a",
"numeric",
"id",
"from",
"a",
"string",
"which",
"can",
"be",
"either",
"a",
"Wikidata",
"entity",
"URI",
"or",
"a",
"short",
"entity",
"or",
"property",
"id",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-client/src/main/java/org/wikidata/wdtk/client/SchemaUsageAnalyzer.java#L705-L717 |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthValueMatcher.java | DayOfMonthValueMatcher.isLastDayOfMonth | private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear) {
if (isLeapYear && month == 2) {
return value == 29;
} else {
return value == LAST_DAYS[month - 1];
}
} | java | private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear) {
if (isLeapYear && month == 2) {
return value == 29;
} else {
return value == LAST_DAYS[month - 1];
}
} | [
"private",
"static",
"boolean",
"isLastDayOfMonth",
"(",
"int",
"value",
",",
"int",
"month",
",",
"boolean",
"isLeapYear",
")",
"{",
"if",
"(",
"isLeapYear",
"&&",
"month",
"==",
"2",
")",
"{",
"return",
"value",
"==",
"29",
";",
"}",
"else",
"{",
"re... | 是否为本月最后一天,规则如下:
<pre>
1、闰年2月匹配是否为29
2、其它月份是否匹配最后一天的日期(可能为30或者31)
</pre>
@param value 被检查的值
@param month 月份
@param isLeapYear 是否闰年
@return 是否为本月最后一天 | [
"是否为本月最后一天,规则如下:",
"<pre",
">",
"1、闰年2月匹配是否为29",
"2、其它月份是否匹配最后一天的日期(可能为30或者31)",
"<",
"/",
"pre",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthValueMatcher.java#L51-L57 |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java | GenericCollectionTypeResolver.getCollectionFieldType | public static Class<?> getCollectionFieldType(Field collectionField, int nestingLevel) {
return getGenericFieldType(collectionField, Collection.class, 0, null, nestingLevel);
} | java | public static Class<?> getCollectionFieldType(Field collectionField, int nestingLevel) {
return getGenericFieldType(collectionField, Collection.class, 0, null, nestingLevel);
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getCollectionFieldType",
"(",
"Field",
"collectionField",
",",
"int",
"nestingLevel",
")",
"{",
"return",
"getGenericFieldType",
"(",
"collectionField",
",",
"Collection",
".",
"class",
",",
"0",
",",
"null",
",",
"... | Determine the generic element type of the given Collection field.
@param collectionField the collection field to introspect
@param nestingLevel the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)
@return the generic type, or {@code null} if none | [
"Determine",
"the",
"generic",
"element",
"type",
"of",
"the",
"given",
"Collection",
"field",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L90-L92 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/widget/FacebookFragment.java | FacebookFragment.onActivityResult | @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
sessionTracker.getSession().onActivityResult(this.getActivity(), requestCode, resultCode, data);
} | java | @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
sessionTracker.getSession().onActivityResult(this.getActivity(), requestCode, resultCode, data);
} | [
"@",
"Override",
"public",
"void",
"onActivityResult",
"(",
"int",
"requestCode",
",",
"int",
"resultCode",
",",
"Intent",
"data",
")",
"{",
"super",
".",
"onActivityResult",
"(",
"requestCode",
",",
"resultCode",
",",
"data",
")",
";",
"sessionTracker",
".",
... | Called when the activity that was launched exits. This method manages session
information when a session is opened. If this method is overridden in subclasses,
be sure to call {@code super.onActivityResult(...)} first. | [
"Called",
"when",
"the",
"activity",
"that",
"was",
"launched",
"exits",
".",
"This",
"method",
"manages",
"session",
"information",
"when",
"a",
"session",
"is",
"opened",
".",
"If",
"this",
"method",
"is",
"overridden",
"in",
"subclasses",
"be",
"sure",
"t... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/widget/FacebookFragment.java#L57-L61 |
calimero-project/calimero-core | src/tuwien/auto/calimero/serial/usb/UsbConnection.java | UsbConnection.fireFrameReceived | private void fireFrameReceived(final KnxTunnelEmi emiType, final byte[] frame) throws KNXFormatException
{
logger.debug("received {} frame {}", emiType, DataUnitBuilder.toHex(frame, ""));
final FrameEvent fe = emiType == KnxTunnelEmi.CEmi
? new FrameEvent(this, CEMIFactory.create(frame, 0, frame.length)) : new FrameEvent(this, frame);
listeners.fire(l -> l.frameReceived(fe));
} | java | private void fireFrameReceived(final KnxTunnelEmi emiType, final byte[] frame) throws KNXFormatException
{
logger.debug("received {} frame {}", emiType, DataUnitBuilder.toHex(frame, ""));
final FrameEvent fe = emiType == KnxTunnelEmi.CEmi
? new FrameEvent(this, CEMIFactory.create(frame, 0, frame.length)) : new FrameEvent(this, frame);
listeners.fire(l -> l.frameReceived(fe));
} | [
"private",
"void",
"fireFrameReceived",
"(",
"final",
"KnxTunnelEmi",
"emiType",
",",
"final",
"byte",
"[",
"]",
"frame",
")",
"throws",
"KNXFormatException",
"{",
"logger",
".",
"debug",
"(",
"\"received {} frame {}\"",
",",
"emiType",
",",
"DataUnitBuilder",
"."... | Fires a frame received event ({@link KNXListener#frameReceived(FrameEvent)}) for the supplied EMI
<code>frame</code>.
@param frame the EMI1/EMI2/cEMI L-data frame to generate the event for
@throws KNXFormatException on error creating cEMI message | [
"Fires",
"a",
"frame",
"received",
"event",
"(",
"{",
"@link",
"KNXListener#frameReceived",
"(",
"FrameEvent",
")",
"}",
")",
"for",
"the",
"supplied",
"EMI",
"<code",
">",
"frame<",
"/",
"code",
">",
"."
] | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/serial/usb/UsbConnection.java#L804-L810 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/gsi/trustmanager/X509ProxyCertPathValidator.java | X509ProxyCertPathValidator.engineValidate | @SuppressWarnings("unchecked")
public CertPathValidatorResult engineValidate(CertPath certPath, CertPathParameters params)
throws CertPathValidatorException, InvalidAlgorithmParameterException {
if (certPath == null) {
throw new IllegalArgumentException(
"Certificate path cannot be null");
}
List list = certPath.getCertificates();
if (list.size() < 1) {
throw new IllegalArgumentException(
"Certificate path cannot be empty");
}
parseParameters(params);
// find the root trust anchor. Validate signatures and see if the
// chain ends in one of the trust root certificates
CertPath trustedCertPath = TrustedCertPathFinder.findTrustedCertPath(this.keyStore, certPath);
// rest of the validation
return validate(trustedCertPath);
} | java | @SuppressWarnings("unchecked")
public CertPathValidatorResult engineValidate(CertPath certPath, CertPathParameters params)
throws CertPathValidatorException, InvalidAlgorithmParameterException {
if (certPath == null) {
throw new IllegalArgumentException(
"Certificate path cannot be null");
}
List list = certPath.getCertificates();
if (list.size() < 1) {
throw new IllegalArgumentException(
"Certificate path cannot be empty");
}
parseParameters(params);
// find the root trust anchor. Validate signatures and see if the
// chain ends in one of the trust root certificates
CertPath trustedCertPath = TrustedCertPathFinder.findTrustedCertPath(this.keyStore, certPath);
// rest of the validation
return validate(trustedCertPath);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"CertPathValidatorResult",
"engineValidate",
"(",
"CertPath",
"certPath",
",",
"CertPathParameters",
"params",
")",
"throws",
"CertPathValidatorException",
",",
"InvalidAlgorithmParameterException",
"{",
"if",
"(... | Validates the specified certification path using the specified algorithm parameter set.
<p>
The <code>CertPath</code> specified must be of a type that is supported by the validation algorithm, otherwise
an <code>InvalidAlgorithmParameterException</code> will be thrown. For example, a <code>CertPathValidator</code>
that implements the PKIX algorithm validates <code>CertPath</code> objects of type X.509.
@param certPath the <code>CertPath</code> to be validated
@param params the algorithm parameters
@return the result of the validation algorithm
@throws java.security.cert.CertPathValidatorException
if the <code>CertPath</code> does not validate
@throws java.security.InvalidAlgorithmParameterException
if the specified parameters or the type of the
specified <code>CertPath</code> are inappropriate for this <code>CertPathValidator</code> | [
"Validates",
"the",
"specified",
"certification",
"path",
"using",
"the",
"specified",
"algorithm",
"parameter",
"set",
".",
"<p",
">",
"The",
"<code",
">",
"CertPath<",
"/",
"code",
">",
"specified",
"must",
"be",
"of",
"a",
"type",
"that",
"is",
"supported... | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/trustmanager/X509ProxyCertPathValidator.java#L89-L112 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java | ListIterate.reverseForEachWithIndex | public static <T> void reverseForEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
{
if (!list.isEmpty())
{
ListIterate.forEachWithIndex(list, list.size() - 1, 0, objectIntProcedure);
}
} | java | public static <T> void reverseForEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
{
if (!list.isEmpty())
{
ListIterate.forEachWithIndex(list, list.size() - 1, 0, objectIntProcedure);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"reverseForEachWithIndex",
"(",
"List",
"<",
"T",
">",
"list",
",",
"ObjectIntProcedure",
"<",
"?",
"super",
"T",
">",
"objectIntProcedure",
")",
"{",
"if",
"(",
"!",
"list",
".",
"isEmpty",
"(",
")",
")",
"{"... | Iterates over the List in reverse order executing the Procedure for each element. The index passed into the ObjectIntProcedure is the actual index of the
range. | [
"Iterates",
"over",
"the",
"List",
"in",
"reverse",
"order",
"executing",
"the",
"Procedure",
"for",
"each",
"element",
".",
"The",
"index",
"passed",
"into",
"the",
"ObjectIntProcedure",
"is",
"the",
"actual",
"index",
"of",
"the",
"range",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java#L680-L686 |
apache/groovy | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.setBytes | public static void setBytes(Path self, byte[] bytes) throws IOException {
IOGroovyMethods.setBytes(Files.newOutputStream(self), bytes);
} | java | public static void setBytes(Path self, byte[] bytes) throws IOException {
IOGroovyMethods.setBytes(Files.newOutputStream(self), bytes);
} | [
"public",
"static",
"void",
"setBytes",
"(",
"Path",
"self",
",",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
"{",
"IOGroovyMethods",
".",
"setBytes",
"(",
"Files",
".",
"newOutputStream",
"(",
"self",
")",
",",
"bytes",
")",
";",
"}"
] | Write the bytes from the byte array to the Path.
@param self the file to write to
@param bytes the byte[] to write to the file
@throws java.io.IOException if an IOException occurs.
@since 2.3.0 | [
"Write",
"the",
"bytes",
"from",
"the",
"byte",
"array",
"to",
"the",
"Path",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L416-L418 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newInitializationException | public static InitializationException newInitializationException(String message, Object... args) {
return newInitializationException(null, message, args);
} | java | public static InitializationException newInitializationException(String message, Object... args) {
return newInitializationException(null, message, args);
} | [
"public",
"static",
"InitializationException",
"newInitializationException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newInitializationException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link InitializationException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link InitializationException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link InitializationException} with the given {@link String message}.
@see #newInitializationException(Throwable, String, Object...)
@see org.cp.elements.lang.InitializationException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"InitializationException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L439-L441 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java | DifferentialFunction.rarg | public SDVariable rarg() {
val args = args();
if(args == null || args.length != 2)
throw new ND4JIllegalStateException("In order to use this function, the number of arguments for this function must be 2.");
return args[1];
} | java | public SDVariable rarg() {
val args = args();
if(args == null || args.length != 2)
throw new ND4JIllegalStateException("In order to use this function, the number of arguments for this function must be 2.");
return args[1];
} | [
"public",
"SDVariable",
"rarg",
"(",
")",
"{",
"val",
"args",
"=",
"args",
"(",
")",
";",
"if",
"(",
"args",
"==",
"null",
"||",
"args",
".",
"length",
"!=",
"2",
")",
"throw",
"new",
"ND4JIllegalStateException",
"(",
"\"In order to use this function, the nu... | The right argument for this function.
Note that this assumes that there are 2 args for this
function, if 2 are not set, it throws an
{@link ND4JIllegalStateException}
@return | [
"The",
"right",
"argument",
"for",
"this",
"function",
".",
"Note",
"that",
"this",
"assumes",
"that",
"there",
"are",
"2",
"args",
"for",
"this",
"function",
"if",
"2",
"are",
"not",
"set",
"it",
"throws",
"an",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java#L756-L761 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.isRotationFromAxisY | protected boolean isRotationFromAxisY(PointTrack t, Vector3D_F64 pointing) {
VoTrack p = t.getCookie();
// remove rotations not along x-z plane
double normXZ = Math.sqrt(pointing.x * pointing.x + pointing.z * pointing.z);
pointingAdj.set(pointing.x / normXZ, p.pointingY, pointing.z / normXZ);
// Put pointing vector back into camera frame
GeometryMath_F64.multTran(cameraToPlane.getR(), pointingAdj, pointingAdj);
// compute normalized image coordinates
n.x = pointingAdj.x / pointingAdj.z;
n.y = pointingAdj.y / pointingAdj.z;
// compute pixel of projected point
normToPixel.compute(n.x, n.y, pixel);
// compute error
double error = pixel.distance2(t);
return error < thresholdPixelError * thresholdPixelError;
} | java | protected boolean isRotationFromAxisY(PointTrack t, Vector3D_F64 pointing) {
VoTrack p = t.getCookie();
// remove rotations not along x-z plane
double normXZ = Math.sqrt(pointing.x * pointing.x + pointing.z * pointing.z);
pointingAdj.set(pointing.x / normXZ, p.pointingY, pointing.z / normXZ);
// Put pointing vector back into camera frame
GeometryMath_F64.multTran(cameraToPlane.getR(), pointingAdj, pointingAdj);
// compute normalized image coordinates
n.x = pointingAdj.x / pointingAdj.z;
n.y = pointingAdj.y / pointingAdj.z;
// compute pixel of projected point
normToPixel.compute(n.x, n.y, pixel);
// compute error
double error = pixel.distance2(t);
return error < thresholdPixelError * thresholdPixelError;
} | [
"protected",
"boolean",
"isRotationFromAxisY",
"(",
"PointTrack",
"t",
",",
"Vector3D_F64",
"pointing",
")",
"{",
"VoTrack",
"p",
"=",
"t",
".",
"getCookie",
"(",
")",
";",
"// remove rotations not along x-z plane",
"double",
"normXZ",
"=",
"Math",
".",
"sqrt",
... | Checks for motion which can't be caused by rotations along the y-axis alone. This is done by adjusting the
pointing vector in the plane reference frame such that it has the same y component as when the track was spawned
and that the x-z components are normalized to one, to ensure consistent units. That pointing vector is then
projected back into the image and a pixel difference computed.
@param pointing Pointing vector of observation in plane reference frame | [
"Checks",
"for",
"motion",
"which",
"can",
"t",
"be",
"caused",
"by",
"rotations",
"along",
"the",
"y",
"-",
"axis",
"alone",
".",
"This",
"is",
"done",
"by",
"adjusting",
"the",
"pointing",
"vector",
"in",
"the",
"plane",
"reference",
"frame",
"such",
"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L390-L411 |
aws/aws-sdk-java | aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetOpenIdTokenForDeveloperIdentityRequest.java | GetOpenIdTokenForDeveloperIdentityRequest.withLogins | public GetOpenIdTokenForDeveloperIdentityRequest withLogins(java.util.Map<String, String> logins) {
setLogins(logins);
return this;
} | java | public GetOpenIdTokenForDeveloperIdentityRequest withLogins(java.util.Map<String, String> logins) {
setLogins(logins);
return this;
} | [
"public",
"GetOpenIdTokenForDeveloperIdentityRequest",
"withLogins",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"logins",
")",
"{",
"setLogins",
"(",
"logins",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A set of optional name-value pairs that map provider names to provider tokens. Each name-value pair represents a
user from a public provider or developer provider. If the user is from a developer provider, the name-value pair
will follow the syntax <code>"developer_provider_name": "developer_user_identifier"</code>. The developer
provider is the "domain" by which Cognito will refer to your users; you provided this domain while
creating/updating the identity pool. The developer user identifier is an identifier from your backend that
uniquely identifies a user. When you create an identity pool, you can specify the supported logins.
</p>
@param logins
A set of optional name-value pairs that map provider names to provider tokens. Each name-value pair
represents a user from a public provider or developer provider. If the user is from a developer provider,
the name-value pair will follow the syntax
<code>"developer_provider_name": "developer_user_identifier"</code>. The developer provider is the
"domain" by which Cognito will refer to your users; you provided this domain while creating/updating the
identity pool. The developer user identifier is an identifier from your backend that uniquely identifies a
user. When you create an identity pool, you can specify the supported logins.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"set",
"of",
"optional",
"name",
"-",
"value",
"pairs",
"that",
"map",
"provider",
"names",
"to",
"provider",
"tokens",
".",
"Each",
"name",
"-",
"value",
"pair",
"represents",
"a",
"user",
"from",
"a",
"public",
"provider",
"or",
"develo... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetOpenIdTokenForDeveloperIdentityRequest.java#L214-L217 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/XMLCharacterRecognizer.java | XMLCharacterRecognizer.isWhiteSpace | public static boolean isWhiteSpace(char ch[], int start, int length)
{
int end = start + length;
for (int s = start; s < end; s++)
{
if (!isWhiteSpace(ch[s]))
return false;
}
return true;
} | java | public static boolean isWhiteSpace(char ch[], int start, int length)
{
int end = start + length;
for (int s = start; s < end; s++)
{
if (!isWhiteSpace(ch[s]))
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isWhiteSpace",
"(",
"char",
"ch",
"[",
"]",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"int",
"end",
"=",
"start",
"+",
"length",
";",
"for",
"(",
"int",
"s",
"=",
"start",
";",
"s",
"<",
"end",
";",
"s",... | Tell if the string is whitespace.
@param ch Character array to check as XML whitespace.
@param start Start index of characters in the array
@param length Number of characters in the array
@return True if the characters in the array are
XML whitespace; otherwise, false. | [
"Tell",
"if",
"the",
"string",
"is",
"whitespace",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/XMLCharacterRecognizer.java#L52-L64 |
Netflix/astyanax | astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeColumnEntityMapper.java | CompositeColumnEntityMapper.fillColumnMutation | public void fillColumnMutation(ColumnListMutation<ByteBuffer> clm, Object entity) {
try {
ByteBuffer columnName = toColumnName(entity);
ByteBuffer value = valueMapper.toByteBuffer(entity);
clm.putColumn(columnName, value);
} catch(Exception e) {
throw new PersistenceException("failed to fill mutation batch", e);
}
} | java | public void fillColumnMutation(ColumnListMutation<ByteBuffer> clm, Object entity) {
try {
ByteBuffer columnName = toColumnName(entity);
ByteBuffer value = valueMapper.toByteBuffer(entity);
clm.putColumn(columnName, value);
} catch(Exception e) {
throw new PersistenceException("failed to fill mutation batch", e);
}
} | [
"public",
"void",
"fillColumnMutation",
"(",
"ColumnListMutation",
"<",
"ByteBuffer",
">",
"clm",
",",
"Object",
"entity",
")",
"{",
"try",
"{",
"ByteBuffer",
"columnName",
"=",
"toColumnName",
"(",
"entity",
")",
";",
"ByteBuffer",
"value",
"=",
"valueMapper",
... | Add a column based on the provided entity
@param clm
@param entity | [
"Add",
"a",
"column",
"based",
"on",
"the",
"provided",
"entity"
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeColumnEntityMapper.java#L138-L147 |
fernandospr/java-wns | src/main/java/ar/com/fernandospr/wns/WnsService.java | WnsService.pushRaw | public List<WnsNotificationResponse> pushRaw(List<String> channelUris, WnsRaw raw) throws WnsException {
return this.pushRaw(channelUris, null, raw);
} | java | public List<WnsNotificationResponse> pushRaw(List<String> channelUris, WnsRaw raw) throws WnsException {
return this.pushRaw(channelUris, null, raw);
} | [
"public",
"List",
"<",
"WnsNotificationResponse",
">",
"pushRaw",
"(",
"List",
"<",
"String",
">",
"channelUris",
",",
"WnsRaw",
"raw",
")",
"throws",
"WnsException",
"{",
"return",
"this",
".",
"pushRaw",
"(",
"channelUris",
",",
"null",
",",
"raw",
")",
... | Pushes a raw message to channelUris
@param channelUris
@param raw which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsRawBuilder}
@return list of WnsNotificationResponse for each channelUri, please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a>
@throws WnsException when authentication fails | [
"Pushes",
"a",
"raw",
"message",
"to",
"channelUris"
] | train | https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L237-L239 |
aws/aws-sdk-java | aws-java-sdk-config/src/main/java/com/amazonaws/services/config/model/RemediationConfiguration.java | RemediationConfiguration.withParameters | public RemediationConfiguration withParameters(java.util.Map<String, RemediationParameterValue> parameters) {
setParameters(parameters);
return this;
} | java | public RemediationConfiguration withParameters(java.util.Map<String, RemediationParameterValue> parameters) {
setParameters(parameters);
return this;
} | [
"public",
"RemediationConfiguration",
"withParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"RemediationParameterValue",
">",
"parameters",
")",
"{",
"setParameters",
"(",
"parameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
An object of the RemediationParameterValue.
</p>
@param parameters
An object of the RemediationParameterValue.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"An",
"object",
"of",
"the",
"RemediationParameterValue",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-config/src/main/java/com/amazonaws/services/config/model/RemediationConfiguration.java#L283-L286 |
NessComputing/components-ness-pg | src/main/java/com/nesscomputing/db/postgres/embedded/EmbeddedPostgreSQLController.java | EmbeddedPostgreSQLController.getTweakedConfig | public Config getTweakedConfig(Config config, String dbModuleName)
{
return Config.getOverriddenConfig(config,
new MapConfiguration(getConfigurationTweak(dbModuleName)));
} | java | public Config getTweakedConfig(Config config, String dbModuleName)
{
return Config.getOverriddenConfig(config,
new MapConfiguration(getConfigurationTweak(dbModuleName)));
} | [
"public",
"Config",
"getTweakedConfig",
"(",
"Config",
"config",
",",
"String",
"dbModuleName",
")",
"{",
"return",
"Config",
".",
"getOverriddenConfig",
"(",
"config",
",",
"new",
"MapConfiguration",
"(",
"getConfigurationTweak",
"(",
"dbModuleName",
")",
")",
")... | Override a {@link Config} to set <code>ness.db.[db-name].uri</code> to a unique
database in the cluster. | [
"Override",
"a",
"{"
] | train | https://github.com/NessComputing/components-ness-pg/blob/e983d6075645ea1bf51cc5fc16901e5aab0f5c70/src/main/java/com/nesscomputing/db/postgres/embedded/EmbeddedPostgreSQLController.java#L111-L115 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/ServiceRefObjectFactory.java | ServiceRefObjectFactory.getInstance | private Object getInstance(TransientWebServiceRefInfo tInfo, WebServiceRefInfo wsrInfo) throws Exception {
Object instance = null;
// First, obtain an instance of the JAX-WS Service class.
Service svc = null;
List<WebServiceFeature> originalWsFeatureList = LibertyProviderImpl.getWebServiceFeatures();
WebServiceRefInfo originalWebServiceRefInfo = LibertyProviderImpl.getWebServiceRefInfo();
try {
//Check @MTOM @RespectBinding @Addressing
//set web service features to ThreadLocal
final List<WebServiceFeature> wsFeatureList =
wsrInfo.getWSFeatureForSEIClass(wsrInfo.getServiceRefTypeClassName());
LibertyProviderImpl.setWebServiceRefInfo(wsrInfo);
LibertyProviderImpl.setWebServiceFeatures(wsFeatureList);
svc = getServiceInstance(tInfo, wsrInfo);
} finally {
LibertyProviderImpl.setWebServiceFeatures(originalWsFeatureList);
LibertyProviderImpl.setWebServiceRefInfo(originalWebServiceRefInfo);
}
// Set handlerResolver
svc.setHandlerResolver(new JaxWsClientHandlerResolver(tInfo.getWebServiceRefInfo(), tInfo.getClientMetaData()));
// Next, retrieve the "type" class, which corresponds to the service-ref-type attribute.
// If the "typeClass" is *not* the default (Object.class) *and* it's also not a subclass of the Service class,
// then we have a situation where the user wants to do a port-type injection.
// In that case, we need to call Service.getPort() on the service instance we just obtained above.
Class<?> typeClass = tInfo.getServiceRefTypeClass();
if (typeClass != null && !typeClass.getName().equals(Object.class.getName()) && !Service.class.isAssignableFrom(typeClass)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Creating a port instance based on class: " + tInfo.getServiceRefTypeClass().getName());
}
instance = svc.getPort(typeClass);
} else {// Otherwise, this was just a normal Service-type injection so we'll return the service.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Service instance created based on class: " + svc.getClass().getName());
}
instance = svc;
}
return instance;
} | java | private Object getInstance(TransientWebServiceRefInfo tInfo, WebServiceRefInfo wsrInfo) throws Exception {
Object instance = null;
// First, obtain an instance of the JAX-WS Service class.
Service svc = null;
List<WebServiceFeature> originalWsFeatureList = LibertyProviderImpl.getWebServiceFeatures();
WebServiceRefInfo originalWebServiceRefInfo = LibertyProviderImpl.getWebServiceRefInfo();
try {
//Check @MTOM @RespectBinding @Addressing
//set web service features to ThreadLocal
final List<WebServiceFeature> wsFeatureList =
wsrInfo.getWSFeatureForSEIClass(wsrInfo.getServiceRefTypeClassName());
LibertyProviderImpl.setWebServiceRefInfo(wsrInfo);
LibertyProviderImpl.setWebServiceFeatures(wsFeatureList);
svc = getServiceInstance(tInfo, wsrInfo);
} finally {
LibertyProviderImpl.setWebServiceFeatures(originalWsFeatureList);
LibertyProviderImpl.setWebServiceRefInfo(originalWebServiceRefInfo);
}
// Set handlerResolver
svc.setHandlerResolver(new JaxWsClientHandlerResolver(tInfo.getWebServiceRefInfo(), tInfo.getClientMetaData()));
// Next, retrieve the "type" class, which corresponds to the service-ref-type attribute.
// If the "typeClass" is *not* the default (Object.class) *and* it's also not a subclass of the Service class,
// then we have a situation where the user wants to do a port-type injection.
// In that case, we need to call Service.getPort() on the service instance we just obtained above.
Class<?> typeClass = tInfo.getServiceRefTypeClass();
if (typeClass != null && !typeClass.getName().equals(Object.class.getName()) && !Service.class.isAssignableFrom(typeClass)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Creating a port instance based on class: " + tInfo.getServiceRefTypeClass().getName());
}
instance = svc.getPort(typeClass);
} else {// Otherwise, this was just a normal Service-type injection so we'll return the service.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Service instance created based on class: " + svc.getClass().getName());
}
instance = svc;
}
return instance;
} | [
"private",
"Object",
"getInstance",
"(",
"TransientWebServiceRefInfo",
"tInfo",
",",
"WebServiceRefInfo",
"wsrInfo",
")",
"throws",
"Exception",
"{",
"Object",
"instance",
"=",
"null",
";",
"// First, obtain an instance of the JAX-WS Service class.",
"Service",
"svc",
"=",
... | This method will create an instance of a JAX-WS service ref, using the metadata supplied in the WebServiceRefInfo
object. | [
"This",
"method",
"will",
"create",
"an",
"instance",
"of",
"a",
"JAX",
"-",
"WS",
"service",
"ref",
"using",
"the",
"metadata",
"supplied",
"in",
"the",
"WebServiceRefInfo",
"object",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/ServiceRefObjectFactory.java#L176-L222 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java | Util.generateLabelPattern | public static String generateLabelPattern(String var, String labelVar) {
return new StringBuilder()
.append("?").append(var).append(" ")
.append(sparqlWrapUri(RDFS.label.getURI())).append(" ")
.append("?").append(labelVar).append(". ")
.toString();
} | java | public static String generateLabelPattern(String var, String labelVar) {
return new StringBuilder()
.append("?").append(var).append(" ")
.append(sparqlWrapUri(RDFS.label.getURI())).append(" ")
.append("?").append(labelVar).append(". ")
.toString();
} | [
"public",
"static",
"String",
"generateLabelPattern",
"(",
"String",
"var",
",",
"String",
"labelVar",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"\"?\"",
")",
".",
"append",
"(",
"var",
")",
".",
"append",
"(",
"\" \"",
")... | Generate a pattern for binding to a label
@param var the name of the variable
@param labelVar the name of the label varible
@return | [
"Generate",
"a",
"pattern",
"for",
"binding",
"to",
"a",
"label"
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L203-L209 |
google/truth | core/src/main/java/com/google/common/truth/MultimapSubject.java | MultimapSubject.containsAtLeastEntriesIn | @CanIgnoreReturnValue
public Ordered containsAtLeastEntriesIn(Multimap<?, ?> expectedMultimap) {
checkNotNull(expectedMultimap, "expectedMultimap");
ListMultimap<?, ?> missing = difference(expectedMultimap, actual());
// TODO(kak): Possible enhancement: Include "[1 copy]" if the element does appear in
// the subject but not enough times. Similarly for unexpected extra items.
if (!missing.isEmpty()) {
failWithBadResults(
"contains at least",
annotateEmptyStringsMultimap(expectedMultimap),
"is missing",
countDuplicatesMultimap(annotateEmptyStringsMultimap(missing)));
return ALREADY_FAILED;
}
return new MultimapInOrder("contains at least", expectedMultimap);
} | java | @CanIgnoreReturnValue
public Ordered containsAtLeastEntriesIn(Multimap<?, ?> expectedMultimap) {
checkNotNull(expectedMultimap, "expectedMultimap");
ListMultimap<?, ?> missing = difference(expectedMultimap, actual());
// TODO(kak): Possible enhancement: Include "[1 copy]" if the element does appear in
// the subject but not enough times. Similarly for unexpected extra items.
if (!missing.isEmpty()) {
failWithBadResults(
"contains at least",
annotateEmptyStringsMultimap(expectedMultimap),
"is missing",
countDuplicatesMultimap(annotateEmptyStringsMultimap(missing)));
return ALREADY_FAILED;
}
return new MultimapInOrder("contains at least", expectedMultimap);
} | [
"@",
"CanIgnoreReturnValue",
"public",
"Ordered",
"containsAtLeastEntriesIn",
"(",
"Multimap",
"<",
"?",
",",
"?",
">",
"expectedMultimap",
")",
"{",
"checkNotNull",
"(",
"expectedMultimap",
",",
"\"expectedMultimap\"",
")",
";",
"ListMultimap",
"<",
"?",
",",
"?"... | Fails if the {@link Multimap} does not contain at least the entries in the argument {@link
Multimap}.
<p>A subsequent call to {@link Ordered#inOrder} may be made if the caller wishes to verify that
the entries are present in the same order as given. That is, the keys are present in the given
order in the key set, and the values for each key are present in the given order order in the
value collections. | [
"Fails",
"if",
"the",
"{",
"@link",
"Multimap",
"}",
"does",
"not",
"contain",
"at",
"least",
"the",
"entries",
"in",
"the",
"argument",
"{",
"@link",
"Multimap",
"}",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/MultimapSubject.java#L265-L282 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/common/NumberGenerator.java | NumberGenerator.getNextVal | public String getNextVal(final Object... _args)
throws EFapsException
{
final Object[] args = new Object[_args.length + 1];
try {
final long val = Context.getDbType().nextSequence(Context.getThreadContext().getConnectionResource(),
getDBName());
args[0] = val;
} catch (final SQLException e) {
throw new EFapsException(NumberGenerator.class, " getNextVal()", e);
}
for (int i = 0; i < _args.length; i++) {
args[i + 1] = _args[i];
}
final Locale local = Context.getThreadContext().getLocale();
final Formatter formatter = new Formatter(local);
formatter.format(this.format, args);
final String ret = formatter.toString();
formatter.close();
return ret;
} | java | public String getNextVal(final Object... _args)
throws EFapsException
{
final Object[] args = new Object[_args.length + 1];
try {
final long val = Context.getDbType().nextSequence(Context.getThreadContext().getConnectionResource(),
getDBName());
args[0] = val;
} catch (final SQLException e) {
throw new EFapsException(NumberGenerator.class, " getNextVal()", e);
}
for (int i = 0; i < _args.length; i++) {
args[i + 1] = _args[i];
}
final Locale local = Context.getThreadContext().getLocale();
final Formatter formatter = new Formatter(local);
formatter.format(this.format, args);
final String ret = formatter.toString();
formatter.close();
return ret;
} | [
"public",
"String",
"getNextVal",
"(",
"final",
"Object",
"...",
"_args",
")",
"throws",
"EFapsException",
"{",
"final",
"Object",
"[",
"]",
"args",
"=",
"new",
"Object",
"[",
"_args",
".",
"length",
"+",
"1",
"]",
";",
"try",
"{",
"final",
"long",
"va... | Method to get the next value for this sequence. Including additional
format information. To get the long value use {@link #getNextValAsLong()}
@param _args arguments for the formatter
@return next value for this sequence
@throws EFapsException on error | [
"Method",
"to",
"get",
"the",
"next",
"value",
"for",
"this",
"sequence",
".",
"Including",
"additional",
"format",
"information",
".",
"To",
"get",
"the",
"long",
"value",
"use",
"{",
"@link",
"#getNextValAsLong",
"()",
"}"
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/common/NumberGenerator.java#L194-L214 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.toFile | public static void toFile(VelocityEngine ve, String templateFileName, VelocityContext context, String destPath) {
toFile(ve.getTemplate(templateFileName), context, destPath);
} | java | public static void toFile(VelocityEngine ve, String templateFileName, VelocityContext context, String destPath) {
toFile(ve.getTemplate(templateFileName), context, destPath);
} | [
"public",
"static",
"void",
"toFile",
"(",
"VelocityEngine",
"ve",
",",
"String",
"templateFileName",
",",
"VelocityContext",
"context",
",",
"String",
"destPath",
")",
"{",
"toFile",
"(",
"ve",
".",
"getTemplate",
"(",
"templateFileName",
")",
",",
"context",
... | 生成文件
@param ve 模板引擎
@param templateFileName 模板文件名
@param context 上下文
@param destPath 目标路径(绝对) | [
"生成文件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L141-L143 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java | XsdAsmInterfaces.getNextTypeName | private String getNextTypeName(String className, String groupName, String sequenceName, boolean isLast){
if (isLast)
return groupName == null ? className + "Complete" : className;
else
return className + firstToUpper(sequenceName);
} | java | private String getNextTypeName(String className, String groupName, String sequenceName, boolean isLast){
if (isLast)
return groupName == null ? className + "Complete" : className;
else
return className + firstToUpper(sequenceName);
} | [
"private",
"String",
"getNextTypeName",
"(",
"String",
"className",
",",
"String",
"groupName",
",",
"String",
"sequenceName",
",",
"boolean",
"isLast",
")",
"{",
"if",
"(",
"isLast",
")",
"return",
"groupName",
"==",
"null",
"?",
"className",
"+",
"\"Complete... | Obtains the name of the next type of the sequence.
@param className The name of the class which contains the sequence.
@param groupName The groupName of this sequence, if any.
@param sequenceName The sequence name.
@param isLast Indication if the next type will be the last of the sequence.
@return The next sequence type name. | [
"Obtains",
"the",
"name",
"of",
"the",
"next",
"type",
"of",
"the",
"sequence",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L466-L471 |
liferay/com-liferay-commerce | commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java | CommerceUserSegmentEntryPersistenceImpl.filterFindByGroupId | @Override
public List<CommerceUserSegmentEntry> filterFindByGroupId(long groupId,
int start, int end) {
return filterFindByGroupId(groupId, start, end, null);
} | java | @Override
public List<CommerceUserSegmentEntry> filterFindByGroupId(long groupId,
int start, int end) {
return filterFindByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceUserSegmentEntry",
">",
"filterFindByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"filterFindByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
... | Returns a range of all the commerce user segment entries that the user has permission to view where groupId = ?.
<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 CommerceUserSegmentEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of commerce user segment entries
@param end the upper bound of the range of commerce user segment entries (not inclusive)
@return the range of matching commerce user segment entries that the user has permission to view | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"user",
"segment",
"entries",
"that",
"the",
"user",
"has",
"permission",
"to",
"view",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java#L569-L573 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateEnded.java | JingleSessionStateEnded.processJingle | @Override
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) {
IQ response;
response = session.createJingleError(jingle, JingleError.MALFORMED_STANZA);
return response;
} | java | @Override
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) {
IQ response;
response = session.createJingleError(jingle, JingleError.MALFORMED_STANZA);
return response;
} | [
"@",
"Override",
"public",
"IQ",
"processJingle",
"(",
"JingleSession",
"session",
",",
"Jingle",
"jingle",
",",
"JingleActionEnum",
"action",
")",
"{",
"IQ",
"response",
";",
"response",
"=",
"session",
".",
"createJingleError",
"(",
"jingle",
",",
"JingleError... | Pretty much nothing is valid for receiving once we've ended the session. | [
"Pretty",
"much",
"nothing",
"is",
"valid",
"for",
"receiving",
"once",
"we",
"ve",
"ended",
"the",
"session",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateEnded.java#L69-L76 |
Azure/azure-sdk-for-java | authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java | RoleAssignmentsInner.getAsync | public Observable<RoleAssignmentInner> getAsync(String scope, String roleAssignmentName) {
return getWithServiceResponseAsync(scope, roleAssignmentName).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) {
return response.body();
}
});
} | java | public Observable<RoleAssignmentInner> getAsync(String scope, String roleAssignmentName) {
return getWithServiceResponseAsync(scope, roleAssignmentName).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RoleAssignmentInner",
">",
"getAsync",
"(",
"String",
"scope",
",",
"String",
"roleAssignmentName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"scope",
",",
"roleAssignmentName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",... | Get the specified role assignment.
@param scope The scope of the role assignment.
@param roleAssignmentName The name of the role assignment to get.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RoleAssignmentInner object | [
"Get",
"the",
"specified",
"role",
"assignment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java#L859-L866 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/BaseFlowToJobSpecCompiler.java | BaseFlowToJobSpecCompiler.jobSpecGenerator | protected JobSpec jobSpecGenerator(FlowSpec flowSpec) {
JobSpec jobSpec;
JobSpec.Builder jobSpecBuilder = JobSpec.builder(jobSpecURIGenerator(flowSpec))
.withConfig(flowSpec.getConfig())
.withDescription(flowSpec.getDescription())
.withVersion(flowSpec.getVersion());
if (flowSpec.getTemplateURIs().isPresent() && templateCatalog.isPresent()) {
// Only first template uri will be honored for Identity
jobSpecBuilder = jobSpecBuilder.withTemplate(flowSpec.getTemplateURIs().get().iterator().next());
try {
jobSpec = new ResolvedJobSpec(jobSpecBuilder.build(), templateCatalog.get());
log.info("Resolved JobSpec properties are: " + jobSpec.getConfigAsProperties());
} catch (SpecNotFoundException | JobTemplate.TemplateException e) {
throw new RuntimeException("Could not resolve template in JobSpec from TemplateCatalog", e);
}
} else {
jobSpec = jobSpecBuilder.build();
log.info("Unresolved JobSpec properties are: " + jobSpec.getConfigAsProperties());
}
// Remove schedule
jobSpec.setConfig(jobSpec.getConfig().withoutPath(ConfigurationKeys.JOB_SCHEDULE_KEY));
// Add job.name and job.group
if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_NAME_KEY)) {
jobSpec.setConfig(jobSpec.getConfig()
.withValue(ConfigurationKeys.JOB_NAME_KEY, flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_NAME_KEY)));
}
if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_GROUP_KEY)) {
jobSpec.setConfig(jobSpec.getConfig()
.withValue(ConfigurationKeys.JOB_GROUP_KEY, flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_GROUP_KEY)));
}
// Add flow execution id for this compilation
long flowExecutionId = FlowUtils.getOrCreateFlowExecutionId(flowSpec);
jobSpec.setConfig(jobSpec.getConfig().withValue(ConfigurationKeys.FLOW_EXECUTION_ID_KEY,
ConfigValueFactory.fromAnyRef(flowExecutionId)));
// Reset properties in Spec from Config
jobSpec.setConfigAsProperties(ConfigUtils.configToProperties(jobSpec.getConfig()));
return jobSpec;
} | java | protected JobSpec jobSpecGenerator(FlowSpec flowSpec) {
JobSpec jobSpec;
JobSpec.Builder jobSpecBuilder = JobSpec.builder(jobSpecURIGenerator(flowSpec))
.withConfig(flowSpec.getConfig())
.withDescription(flowSpec.getDescription())
.withVersion(flowSpec.getVersion());
if (flowSpec.getTemplateURIs().isPresent() && templateCatalog.isPresent()) {
// Only first template uri will be honored for Identity
jobSpecBuilder = jobSpecBuilder.withTemplate(flowSpec.getTemplateURIs().get().iterator().next());
try {
jobSpec = new ResolvedJobSpec(jobSpecBuilder.build(), templateCatalog.get());
log.info("Resolved JobSpec properties are: " + jobSpec.getConfigAsProperties());
} catch (SpecNotFoundException | JobTemplate.TemplateException e) {
throw new RuntimeException("Could not resolve template in JobSpec from TemplateCatalog", e);
}
} else {
jobSpec = jobSpecBuilder.build();
log.info("Unresolved JobSpec properties are: " + jobSpec.getConfigAsProperties());
}
// Remove schedule
jobSpec.setConfig(jobSpec.getConfig().withoutPath(ConfigurationKeys.JOB_SCHEDULE_KEY));
// Add job.name and job.group
if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_NAME_KEY)) {
jobSpec.setConfig(jobSpec.getConfig()
.withValue(ConfigurationKeys.JOB_NAME_KEY, flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_NAME_KEY)));
}
if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_GROUP_KEY)) {
jobSpec.setConfig(jobSpec.getConfig()
.withValue(ConfigurationKeys.JOB_GROUP_KEY, flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_GROUP_KEY)));
}
// Add flow execution id for this compilation
long flowExecutionId = FlowUtils.getOrCreateFlowExecutionId(flowSpec);
jobSpec.setConfig(jobSpec.getConfig().withValue(ConfigurationKeys.FLOW_EXECUTION_ID_KEY,
ConfigValueFactory.fromAnyRef(flowExecutionId)));
// Reset properties in Spec from Config
jobSpec.setConfigAsProperties(ConfigUtils.configToProperties(jobSpec.getConfig()));
return jobSpec;
} | [
"protected",
"JobSpec",
"jobSpecGenerator",
"(",
"FlowSpec",
"flowSpec",
")",
"{",
"JobSpec",
"jobSpec",
";",
"JobSpec",
".",
"Builder",
"jobSpecBuilder",
"=",
"JobSpec",
".",
"builder",
"(",
"jobSpecURIGenerator",
"(",
"flowSpec",
")",
")",
".",
"withConfig",
"... | Naive implementation of generating jobSpec, which fetch the first available template,
in an exemplified single-hop FlowCompiler implementation.
@param flowSpec
@return | [
"Naive",
"implementation",
"of",
"generating",
"jobSpec",
"which",
"fetch",
"the",
"first",
"available",
"template",
"in",
"an",
"exemplified",
"single",
"-",
"hop",
"FlowCompiler",
"implementation",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/BaseFlowToJobSpecCompiler.java#L229-L271 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java | JobExecutionsInner.beginCreateOrUpdateAsync | public Observable<JobExecutionInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1<ServiceResponse<JobExecutionInner>, JobExecutionInner>() {
@Override
public JobExecutionInner call(ServiceResponse<JobExecutionInner> response) {
return response.body();
}
});
} | java | public Observable<JobExecutionInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1<ServiceResponse<JobExecutionInner>, JobExecutionInner>() {
@Override
public JobExecutionInner call(ServiceResponse<JobExecutionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobExecutionInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"String",
"jobName",
",",
"UUID",
"jobExecutionId",
")",
"{",
"return",
"beginCreate... | Creates or updatess a job execution.
@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.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@param jobExecutionId The job execution id to create the job execution under.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobExecutionInner object | [
"Creates",
"or",
"updatess",
"a",
"job",
"execution",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L1247-L1254 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/DocumentTranslator.java | DocumentTranslator.getParentKey | public NodeKey getParentKey( Document document,
String primaryWorkspaceKey,
String secondaryWorkspaceKey ) {
Object value = document.get(PARENT);
return keyFrom(value, primaryWorkspaceKey, secondaryWorkspaceKey);
} | java | public NodeKey getParentKey( Document document,
String primaryWorkspaceKey,
String secondaryWorkspaceKey ) {
Object value = document.get(PARENT);
return keyFrom(value, primaryWorkspaceKey, secondaryWorkspaceKey);
} | [
"public",
"NodeKey",
"getParentKey",
"(",
"Document",
"document",
",",
"String",
"primaryWorkspaceKey",
",",
"String",
"secondaryWorkspaceKey",
")",
"{",
"Object",
"value",
"=",
"document",
".",
"get",
"(",
"PARENT",
")",
";",
"return",
"keyFrom",
"(",
"value",
... | Obtain the preferred {@link NodeKey key} for the parent of this node. Because a node can be used in more than once place,
it may technically have more than one parent. Therefore, in such cases this method prefers the parent that is in the
{@code primaryWorkspaceKey} and, if there is no such parent, the parent that is in the {@code secondaryWorkspaceKey}.
@param document the document for the node; may not be null
@param primaryWorkspaceKey the key for the workspace in which the parent should preferably exist; may be null
@param secondaryWorkspaceKey the key for the workspace in which the parent should exist if not in the primary workspace;
may be null
@return the key representing the preferred parent, or null if the document contains no parent reference or if the parent
reference(s) do not have the specified workspace keys | [
"Obtain",
"the",
"preferred",
"{",
"@link",
"NodeKey",
"key",
"}",
"for",
"the",
"parent",
"of",
"this",
"node",
".",
"Because",
"a",
"node",
"can",
"be",
"used",
"in",
"more",
"than",
"once",
"place",
"it",
"may",
"technically",
"have",
"more",
"than",
... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/DocumentTranslator.java#L165-L170 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/apple/PropertyListSerialization.java | PropertyListSerialization.serializeList | private static void serializeList(final List list, final ContentHandler handler) throws SAXException {
final AttributesImpl attributes = new AttributesImpl();
handler.startElement(null, "array", "array", attributes);
for (final Object aList : list) {
serializeObject(aList, handler);
}
handler.endElement(null, "array", "array");
} | java | private static void serializeList(final List list, final ContentHandler handler) throws SAXException {
final AttributesImpl attributes = new AttributesImpl();
handler.startElement(null, "array", "array", attributes);
for (final Object aList : list) {
serializeObject(aList, handler);
}
handler.endElement(null, "array", "array");
} | [
"private",
"static",
"void",
"serializeList",
"(",
"final",
"List",
"list",
",",
"final",
"ContentHandler",
"handler",
")",
"throws",
"SAXException",
"{",
"final",
"AttributesImpl",
"attributes",
"=",
"new",
"AttributesImpl",
"(",
")",
";",
"handler",
".",
"star... | Serialize a list as an array element.
@param list
list to serialize.
@param handler
destination of serialization events.
@throws SAXException
if exception during serialization. | [
"Serialize",
"a",
"list",
"as",
"an",
"array",
"element",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/PropertyListSerialization.java#L145-L152 |
graknlabs/grakn | server/src/graql/reasoner/atom/Atom.java | Atom.getMultiUnifier | public MultiUnifier getMultiUnifier(Atom parentAtom, UnifierComparison unifierType) {
//NB only for relations we can have non-unique unifiers
Unifier unifier = this.getUnifier(parentAtom, unifierType);
return unifier != null ? new MultiUnifierImpl(unifier) : MultiUnifierImpl.nonExistent();
} | java | public MultiUnifier getMultiUnifier(Atom parentAtom, UnifierComparison unifierType) {
//NB only for relations we can have non-unique unifiers
Unifier unifier = this.getUnifier(parentAtom, unifierType);
return unifier != null ? new MultiUnifierImpl(unifier) : MultiUnifierImpl.nonExistent();
} | [
"public",
"MultiUnifier",
"getMultiUnifier",
"(",
"Atom",
"parentAtom",
",",
"UnifierComparison",
"unifierType",
")",
"{",
"//NB only for relations we can have non-unique unifiers",
"Unifier",
"unifier",
"=",
"this",
".",
"getUnifier",
"(",
"parentAtom",
",",
"unifierType",... | find the (multi) unifier with parent atom
@param parentAtom atom to be unified with
@param unifierType type of unifier to be computed
@return multiunifier | [
"find",
"the",
"(",
"multi",
")",
"unifier",
"with",
"parent",
"atom"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/atom/Atom.java#L452-L456 |
liuyukuai/commons | commons-core/src/main/java/com/itxiaoer/commons/core/util/NumUtils.java | NumUtils.intVal | public static int intVal(String val, int defaultValue) {
try {
return NumberUtils.createNumber(val).intValue();
} catch (Exception e) {
log.warn("intVal(String, int) throw {}, return defaultValue = {}", e, defaultValue);
return defaultValue;
}
} | java | public static int intVal(String val, int defaultValue) {
try {
return NumberUtils.createNumber(val).intValue();
} catch (Exception e) {
log.warn("intVal(String, int) throw {}, return defaultValue = {}", e, defaultValue);
return defaultValue;
}
} | [
"public",
"static",
"int",
"intVal",
"(",
"String",
"val",
",",
"int",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"NumberUtils",
".",
"createNumber",
"(",
"val",
")",
".",
"intValue",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
... | 转换为int类型数据
@param val 需要转换的值
@param defaultValue 默认值
@return int | [
"转换为int类型数据"
] | train | https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/util/NumUtils.java#L40-L47 |
policeman-tools/forbidden-apis | src/main/java/de/thetaphi/forbiddenapis/Checker.java | Checker.addClassToCheck | public void addClassToCheck(final InputStream in, String name) throws IOException {
final ClassReader reader;
try {
reader = AsmUtils.readAndPatchClass(in);
} catch (IllegalArgumentException iae) {
// unfortunately the ASM IAE has no message, so add good info!
throw new IllegalArgumentException(String.format(Locale.ENGLISH,
"The class file format of '%s' is too recent to be parsed by ASM.", name));
} finally {
in.close();
}
final String binaryName = Type.getObjectType(reader.getClassName()).getClassName();
classesToCheck.put(binaryName, new ClassSignature(reader, false, true));
} | java | public void addClassToCheck(final InputStream in, String name) throws IOException {
final ClassReader reader;
try {
reader = AsmUtils.readAndPatchClass(in);
} catch (IllegalArgumentException iae) {
// unfortunately the ASM IAE has no message, so add good info!
throw new IllegalArgumentException(String.format(Locale.ENGLISH,
"The class file format of '%s' is too recent to be parsed by ASM.", name));
} finally {
in.close();
}
final String binaryName = Type.getObjectType(reader.getClassName()).getClassName();
classesToCheck.put(binaryName, new ClassSignature(reader, false, true));
} | [
"public",
"void",
"addClassToCheck",
"(",
"final",
"InputStream",
"in",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"final",
"ClassReader",
"reader",
";",
"try",
"{",
"reader",
"=",
"AsmUtils",
".",
"readAndPatchClass",
"(",
"in",
")",
";",
"}"... | Parses and adds a class from the given stream to the list of classes to check. Closes the stream when parsed (on Exception, too)! Does not log anything. | [
"Parses",
"and",
"adds",
"a",
"class",
"from",
"the",
"given",
"stream",
"to",
"the",
"list",
"of",
"classes",
"to",
"check",
".",
"Closes",
"the",
"stream",
"when",
"parsed",
"(",
"on",
"Exception",
"too",
")",
"!",
"Does",
"not",
"log",
"anything",
"... | train | https://github.com/policeman-tools/forbidden-apis/blob/df5f00c6bb779875ec6bae967f7cec96670b27d9/src/main/java/de/thetaphi/forbiddenapis/Checker.java#L349-L362 |
box/box-java-sdk | src/main/java/com/box/sdk/MetadataTemplate.java | MetadataTemplate.getMetadataTemplateByID | public static MetadataTemplate getMetadataTemplateByID(BoxAPIConnection api, String templateID) {
URL url = METADATA_TEMPLATE_BY_ID_URL_TEMPLATE.build(api.getBaseURL(), templateID);
BoxAPIRequest request = new BoxAPIRequest(api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new MetadataTemplate(response.getJSON());
} | java | public static MetadataTemplate getMetadataTemplateByID(BoxAPIConnection api, String templateID) {
URL url = METADATA_TEMPLATE_BY_ID_URL_TEMPLATE.build(api.getBaseURL(), templateID);
BoxAPIRequest request = new BoxAPIRequest(api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new MetadataTemplate(response.getJSON());
} | [
"public",
"static",
"MetadataTemplate",
"getMetadataTemplateByID",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"templateID",
")",
"{",
"URL",
"url",
"=",
"METADATA_TEMPLATE_BY_ID_URL_TEMPLATE",
".",
"build",
"(",
"api",
".",
"getBaseURL",
"(",
")",
",",
"template... | Geta the specified metadata template by its ID.
@param api the API connection to be used.
@param templateID the ID of the template to get.
@return the metadata template object. | [
"Geta",
"the",
"specified",
"metadata",
"template",
"by",
"its",
"ID",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/MetadataTemplate.java#L460-L466 |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/common/util/PersistenceUtils.java | PersistenceUtils.saveAll | public static void saveAll(final Object obj, final PersistenceStoreType storeType) {
try {
File file = new File(persistenceStorePath + File.separator + storeType);
// create necessary parent directories on file system
File directory = file.getParentFile();
if (null != directory && !directory.exists()) {
directory.mkdirs();
}
log.info("aws-mock: saving to {}", file.getAbsolutePath());
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file, false));
out.writeObject(obj);
out.close();
} catch (FileNotFoundException e) {
log.error("FileNotFoundException caught during saving object to file: {}",
e.getMessage());
} catch (IOException e) {
log.error("IOException caught during saving object to file: {}", e.getMessage());
}
} | java | public static void saveAll(final Object obj, final PersistenceStoreType storeType) {
try {
File file = new File(persistenceStorePath + File.separator + storeType);
// create necessary parent directories on file system
File directory = file.getParentFile();
if (null != directory && !directory.exists()) {
directory.mkdirs();
}
log.info("aws-mock: saving to {}", file.getAbsolutePath());
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file, false));
out.writeObject(obj);
out.close();
} catch (FileNotFoundException e) {
log.error("FileNotFoundException caught during saving object to file: {}",
e.getMessage());
} catch (IOException e) {
log.error("IOException caught during saving object to file: {}", e.getMessage());
}
} | [
"public",
"static",
"void",
"saveAll",
"(",
"final",
"Object",
"obj",
",",
"final",
"PersistenceStoreType",
"storeType",
")",
"{",
"try",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"persistenceStorePath",
"+",
"File",
".",
"separator",
"+",
"storeType",
"... | Save object to the binary file defined as filename in property "persistence.store.file".
@param obj the object to save, which should be serializable
@param storeType the store type | [
"Save",
"object",
"to",
"the",
"binary",
"file",
"defined",
"as",
"filename",
"in",
"property",
"persistence",
".",
"store",
".",
"file",
"."
] | train | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/common/util/PersistenceUtils.java#L132-L156 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/block/DefaultBlockMaster.java | DefaultBlockMaster.generateBlockInfo | @GuardedBy("masterBlockInfo")
private Optional<BlockInfo> generateBlockInfo(long blockId) throws UnavailableException {
if (mSafeModeManager.isInSafeMode()) {
throw new UnavailableException(ExceptionMessage.MASTER_IN_SAFEMODE.getMessage());
}
BlockMeta block;
List<BlockLocation> blockLocations;
try (LockResource lr = lockBlock(blockId)) {
Optional<BlockMeta> blockOpt = mBlockStore.getBlock(blockId);
if (!blockOpt.isPresent()) {
return Optional.empty();
}
block = blockOpt.get();
blockLocations = new ArrayList<>(mBlockStore.getLocations(blockId));
}
// Sort the block locations by their alias ordinal in the master storage tier mapping
Collections.sort(blockLocations,
Comparator.comparingInt(o -> mGlobalStorageTierAssoc.getOrdinal(o.getTier())));
List<alluxio.wire.BlockLocation> locations = new ArrayList<>();
for (BlockLocation location : blockLocations) {
MasterWorkerInfo workerInfo =
mWorkers.getFirstByField(ID_INDEX, location.getWorkerId());
if (workerInfo != null) {
// worker metadata is intentionally not locked here because:
// - it would be an incorrect order (correct order is lock worker first, then block)
// - only uses getters of final variables
locations.add(new alluxio.wire.BlockLocation().setWorkerId(location.getWorkerId())
.setWorkerAddress(workerInfo.getWorkerAddress())
.setTierAlias(location.getTier()));
}
}
return Optional.of(
new BlockInfo().setBlockId(blockId).setLength(block.getLength()).setLocations(locations));
} | java | @GuardedBy("masterBlockInfo")
private Optional<BlockInfo> generateBlockInfo(long blockId) throws UnavailableException {
if (mSafeModeManager.isInSafeMode()) {
throw new UnavailableException(ExceptionMessage.MASTER_IN_SAFEMODE.getMessage());
}
BlockMeta block;
List<BlockLocation> blockLocations;
try (LockResource lr = lockBlock(blockId)) {
Optional<BlockMeta> blockOpt = mBlockStore.getBlock(blockId);
if (!blockOpt.isPresent()) {
return Optional.empty();
}
block = blockOpt.get();
blockLocations = new ArrayList<>(mBlockStore.getLocations(blockId));
}
// Sort the block locations by their alias ordinal in the master storage tier mapping
Collections.sort(blockLocations,
Comparator.comparingInt(o -> mGlobalStorageTierAssoc.getOrdinal(o.getTier())));
List<alluxio.wire.BlockLocation> locations = new ArrayList<>();
for (BlockLocation location : blockLocations) {
MasterWorkerInfo workerInfo =
mWorkers.getFirstByField(ID_INDEX, location.getWorkerId());
if (workerInfo != null) {
// worker metadata is intentionally not locked here because:
// - it would be an incorrect order (correct order is lock worker first, then block)
// - only uses getters of final variables
locations.add(new alluxio.wire.BlockLocation().setWorkerId(location.getWorkerId())
.setWorkerAddress(workerInfo.getWorkerAddress())
.setTierAlias(location.getTier()));
}
}
return Optional.of(
new BlockInfo().setBlockId(blockId).setLength(block.getLength()).setLocations(locations));
} | [
"@",
"GuardedBy",
"(",
"\"masterBlockInfo\"",
")",
"private",
"Optional",
"<",
"BlockInfo",
">",
"generateBlockInfo",
"(",
"long",
"blockId",
")",
"throws",
"UnavailableException",
"{",
"if",
"(",
"mSafeModeManager",
".",
"isInSafeMode",
"(",
")",
")",
"{",
"thr... | Generates block info, including worker locations, for a block id.
@param blockId a block id
@return optional block info, empty if the block does not exist | [
"Generates",
"block",
"info",
"including",
"worker",
"locations",
"for",
"a",
"block",
"id",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/block/DefaultBlockMaster.java#L971-L1007 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.beginGetVpnclientIpsecParameters | public VpnClientIPsecParametersInner beginGetVpnclientIpsecParameters(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body();
} | java | public VpnClientIPsecParametersInner beginGetVpnclientIpsecParameters(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body();
} | [
"public",
"VpnClientIPsecParametersInner",
"beginGetVpnclientIpsecParameters",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"beginGetVpnclientIpsecParametersWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetwor... | The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The virtual network gateway name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VpnClientIPsecParametersInner object if successful. | [
"The",
"Get",
"VpnclientIpsecParameters",
"operation",
"retrieves",
"information",
"about",
"the",
"vpnclient",
"ipsec",
"policy",
"for",
"P2S",
"client",
"of",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"through",
"Network",
"re... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2893-L2895 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/windows/AnalysisJobBuilderWindowImpl.java | AnalysisJobBuilderWindowImpl.setDatastore | @Override
public void setDatastore(final Datastore datastore, final boolean expandTree) {
final DatastoreConnection con;
if (datastore == null) {
con = null;
} else {
con = datastore.openConnection();
}
_datastore = datastore;
if (_datastoreConnection != null) {
_datastoreConnection.close();
}
_analysisJobBuilder.setDatastore(datastore);
_datastoreConnection = con;
if (datastore == null) {
_analysisJobBuilder.reset();
changePanel(AnalysisWindowPanelType.WELCOME);
} else {
changePanel(AnalysisWindowPanelType.EDITING_CONTEXT);
addTableToSource(con);
}
setSchemaTree(datastore, expandTree, con);
updateStatusLabel();
_graph.refresh();
} | java | @Override
public void setDatastore(final Datastore datastore, final boolean expandTree) {
final DatastoreConnection con;
if (datastore == null) {
con = null;
} else {
con = datastore.openConnection();
}
_datastore = datastore;
if (_datastoreConnection != null) {
_datastoreConnection.close();
}
_analysisJobBuilder.setDatastore(datastore);
_datastoreConnection = con;
if (datastore == null) {
_analysisJobBuilder.reset();
changePanel(AnalysisWindowPanelType.WELCOME);
} else {
changePanel(AnalysisWindowPanelType.EDITING_CONTEXT);
addTableToSource(con);
}
setSchemaTree(datastore, expandTree, con);
updateStatusLabel();
_graph.refresh();
} | [
"@",
"Override",
"public",
"void",
"setDatastore",
"(",
"final",
"Datastore",
"datastore",
",",
"final",
"boolean",
"expandTree",
")",
"{",
"final",
"DatastoreConnection",
"con",
";",
"if",
"(",
"datastore",
"==",
"null",
")",
"{",
"con",
"=",
"null",
";",
... | Initializes the window to use a particular datastore in the schema tree.
@param datastore
@param expandTree
true if the datastore tree should be initially expanded. | [
"Initializes",
"the",
"window",
"to",
"use",
"a",
"particular",
"datastore",
"in",
"the",
"schema",
"tree",
"."
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/windows/AnalysisJobBuilderWindowImpl.java#L443-L470 |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/alias/AliasElasticsearchUpdater.java | AliasElasticsearchUpdater.createAlias | @Deprecated
public static void createAlias(Client client, String alias, String index) throws Exception {
logger.trace("createAlias({},{})", alias, index);
AcknowledgedResponse response = client.admin().indices().prepareAliases().addAlias(index, alias).get();
if (!response.isAcknowledged()) throw new Exception("Could not define alias [" + alias + "] for index [" + index + "].");
logger.trace("/createAlias({},{})", alias, index);
} | java | @Deprecated
public static void createAlias(Client client, String alias, String index) throws Exception {
logger.trace("createAlias({},{})", alias, index);
AcknowledgedResponse response = client.admin().indices().prepareAliases().addAlias(index, alias).get();
if (!response.isAcknowledged()) throw new Exception("Could not define alias [" + alias + "] for index [" + index + "].");
logger.trace("/createAlias({},{})", alias, index);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"createAlias",
"(",
"Client",
"client",
",",
"String",
"alias",
",",
"String",
"index",
")",
"throws",
"Exception",
"{",
"logger",
".",
"trace",
"(",
"\"createAlias({},{})\"",
",",
"alias",
",",
"index",
")",
";... | Create an alias if needed
@param client Client to use
@param alias Alias name
@param index Index name
@throws Exception When alias can not be set | [
"Create",
"an",
"alias",
"if",
"needed"
] | train | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/alias/AliasElasticsearchUpdater.java#L41-L47 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toShort | public static Short toShort(Object o, Short defaultValue) {
if (o instanceof Short) return (Short) o;
if (defaultValue != null) return Short.valueOf(toShortValue(o, defaultValue.shortValue()));
short res = toShortValue(o, Short.MIN_VALUE);
if (res == Short.MIN_VALUE) return defaultValue;
return Short.valueOf(res);
} | java | public static Short toShort(Object o, Short defaultValue) {
if (o instanceof Short) return (Short) o;
if (defaultValue != null) return Short.valueOf(toShortValue(o, defaultValue.shortValue()));
short res = toShortValue(o, Short.MIN_VALUE);
if (res == Short.MIN_VALUE) return defaultValue;
return Short.valueOf(res);
} | [
"public",
"static",
"Short",
"toShort",
"(",
"Object",
"o",
",",
"Short",
"defaultValue",
")",
"{",
"if",
"(",
"o",
"instanceof",
"Short",
")",
"return",
"(",
"Short",
")",
"o",
";",
"if",
"(",
"defaultValue",
"!=",
"null",
")",
"return",
"Short",
".",... | cast a Object to a Byte Object(reference type)
@param o Object to cast
@param defaultValue
@return casted Byte Object | [
"cast",
"a",
"Object",
"to",
"a",
"Byte",
"Object",
"(",
"reference",
"type",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L1849-L1855 |
moleculer-java/moleculer-java | src/main/java/services/moleculer/ServiceBroker.java | ServiceBroker.getAction | public Action getAction(String actionName, String nodeID) {
return serviceRegistry.getAction(actionName, nodeID);
} | java | public Action getAction(String actionName, String nodeID) {
return serviceRegistry.getAction(actionName, nodeID);
} | [
"public",
"Action",
"getAction",
"(",
"String",
"actionName",
",",
"String",
"nodeID",
")",
"{",
"return",
"serviceRegistry",
".",
"getAction",
"(",
"actionName",
",",
"nodeID",
")",
";",
"}"
] | Returns an action by name and nodeID.
@param actionName
name of the action (in "service.action" syntax, eg.
"math.add")
@param nodeID
node identifier where the service is located
@return local or remote action container | [
"Returns",
"an",
"action",
"by",
"name",
"and",
"nodeID",
"."
] | train | https://github.com/moleculer-java/moleculer-java/blob/27575c44b9ecacc17c4456ceacf5d1851abf1cc4/src/main/java/services/moleculer/ServiceBroker.java#L702-L704 |
finmath/finmath-lib | src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java | ForwardCurve.createForwardCurveFromForwards | public static ForwardCurve createForwardCurveFromForwards(String name, double[] times, double[] givenForwards, double paymentOffset) {
ForwardCurve forwardCurve = new ForwardCurve(name, paymentOffset, InterpolationEntityForward.FORWARD, null);
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
double fixingTime = times[timeIndex];
boolean isParameter = (fixingTime > 0);
forwardCurve.addForward(null, fixingTime, givenForwards[timeIndex], isParameter);
}
return forwardCurve;
} | java | public static ForwardCurve createForwardCurveFromForwards(String name, double[] times, double[] givenForwards, double paymentOffset) {
ForwardCurve forwardCurve = new ForwardCurve(name, paymentOffset, InterpolationEntityForward.FORWARD, null);
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
double fixingTime = times[timeIndex];
boolean isParameter = (fixingTime > 0);
forwardCurve.addForward(null, fixingTime, givenForwards[timeIndex], isParameter);
}
return forwardCurve;
} | [
"public",
"static",
"ForwardCurve",
"createForwardCurveFromForwards",
"(",
"String",
"name",
",",
"double",
"[",
"]",
"times",
",",
"double",
"[",
"]",
"givenForwards",
",",
"double",
"paymentOffset",
")",
"{",
"ForwardCurve",
"forwardCurve",
"=",
"new",
"ForwardC... | Create a forward curve from given times and given forwards.
@param name The name of this curve.
@param times A vector of given time points.
@param givenForwards A vector of given forwards (corresponding to the given time points).
@param paymentOffset The maturity of the underlying index modeled by this curve.
@return A new ForwardCurve object. | [
"Create",
"a",
"forward",
"curve",
"from",
"given",
"times",
"and",
"given",
"forwards",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java#L227-L237 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/CollisionConfig.java | CollisionConfig.exports | public static void exports(Xml root, Collision collision)
{
Check.notNull(root);
Check.notNull(collision);
final Xml node = root.createChild(NODE_COLLISION);
node.writeString(ATT_NAME, collision.getName());
node.writeInteger(ATT_OFFSETX, collision.getOffsetX());
node.writeInteger(ATT_OFFSETY, collision.getOffsetY());
node.writeInteger(ATT_WIDTH, collision.getWidth());
node.writeInteger(ATT_HEIGHT, collision.getHeight());
node.writeBoolean(ATT_MIRROR, collision.hasMirror());
} | java | public static void exports(Xml root, Collision collision)
{
Check.notNull(root);
Check.notNull(collision);
final Xml node = root.createChild(NODE_COLLISION);
node.writeString(ATT_NAME, collision.getName());
node.writeInteger(ATT_OFFSETX, collision.getOffsetX());
node.writeInteger(ATT_OFFSETY, collision.getOffsetY());
node.writeInteger(ATT_WIDTH, collision.getWidth());
node.writeInteger(ATT_HEIGHT, collision.getHeight());
node.writeBoolean(ATT_MIRROR, collision.hasMirror());
} | [
"public",
"static",
"void",
"exports",
"(",
"Xml",
"root",
",",
"Collision",
"collision",
")",
"{",
"Check",
".",
"notNull",
"(",
"root",
")",
";",
"Check",
".",
"notNull",
"(",
"collision",
")",
";",
"final",
"Xml",
"node",
"=",
"root",
".",
"createCh... | Create an XML node from a collision.
@param root The node root (must not be <code>null</code>).
@param collision The collision reference (must not be <code>null</code>). | [
"Create",
"an",
"XML",
"node",
"from",
"a",
"collision",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/CollisionConfig.java#L109-L121 |
zsoltk/overpasser | library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java | OverpassFilterQuery.tagMultiple | public OverpassFilterQuery tagMultiple(String name, Set<String> values) {
builder.multipleValues(name, values);
return this;
} | java | public OverpassFilterQuery tagMultiple(String name, Set<String> values) {
builder.multipleValues(name, values);
return this;
} | [
"public",
"OverpassFilterQuery",
"tagMultiple",
"(",
"String",
"name",
",",
"Set",
"<",
"String",
">",
"values",
")",
"{",
"builder",
".",
"multipleValues",
"(",
"name",
",",
"values",
")",
";",
"return",
"this",
";",
"}"
] | Adds a <i>["name"~{value1}|{value2}|{value3}|...|{valueN}]</i> filter tag to the current query
to add a filter matching for any of the given values.
@param name the filter name
@param values the filter value
@return the current query object | [
"Adds",
"a",
"<i",
">",
"[",
"name",
"~",
"{",
"value1",
"}",
"|",
"{",
"value2",
"}",
"|",
"{",
"value3",
"}",
"|",
"...",
"|",
"{",
"valueN",
"}",
"]",
"<",
"/",
"i",
">",
"filter",
"tag",
"to",
"the",
"current",
"query",
"to",
"add",
"a",
... | train | https://github.com/zsoltk/overpasser/blob/0464d3844e75c5f9393d2458d3a3aedf3e40f30d/library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java#L163-L167 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.updateProjectMember | public GitlabProjectMember updateProjectMember(Integer projectId, Integer userId, GitlabAccessLevel accessLevel, String expiresAt) throws IOException {
Query query = new Query()
.appendIf("access_level", accessLevel)
.appendIf("expires_at", expiresAt);
String tailUrl = GitlabProject.URL + "/" + projectId + GitlabProjectMember.URL + "/" + userId + query.toString();
return retrieve().method(PUT).to(tailUrl, GitlabProjectMember.class);
} | java | public GitlabProjectMember updateProjectMember(Integer projectId, Integer userId, GitlabAccessLevel accessLevel, String expiresAt) throws IOException {
Query query = new Query()
.appendIf("access_level", accessLevel)
.appendIf("expires_at", expiresAt);
String tailUrl = GitlabProject.URL + "/" + projectId + GitlabProjectMember.URL + "/" + userId + query.toString();
return retrieve().method(PUT).to(tailUrl, GitlabProjectMember.class);
} | [
"public",
"GitlabProjectMember",
"updateProjectMember",
"(",
"Integer",
"projectId",
",",
"Integer",
"userId",
",",
"GitlabAccessLevel",
"accessLevel",
",",
"String",
"expiresAt",
")",
"throws",
"IOException",
"{",
"Query",
"query",
"=",
"new",
"Query",
"(",
")",
... | Updates a project member.
@param projectId the project id
@param userId the user id
@param accessLevel the updated access level for the specified user
@param expiresAt the date at which the user's membership expires at in the form YEAR-MONTH-DAY
@return GitLabProjectMember with updated access level on success
@throws IOException on Gitlab API call error | [
"Updates",
"a",
"project",
"member",
"."
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3096-L3102 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesInner.java | DatabaseTableAuditingPoliciesInner.getAsync | public Observable<DatabaseTableAuditingPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseTableAuditingPolicyInner>, DatabaseTableAuditingPolicyInner>() {
@Override
public DatabaseTableAuditingPolicyInner call(ServiceResponse<DatabaseTableAuditingPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseTableAuditingPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseTableAuditingPolicyInner>, DatabaseTableAuditingPolicyInner>() {
@Override
public DatabaseTableAuditingPolicyInner call(ServiceResponse<DatabaseTableAuditingPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseTableAuditingPolicyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName"... | Gets a database's table auditing policy. Table auditing is deprecated, use blob auditing instead.
@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.
@param databaseName The name of the database for which the table audit policy is defined.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseTableAuditingPolicyInner object | [
"Gets",
"a",
"database",
"s",
"table",
"auditing",
"policy",
".",
"Table",
"auditing",
"is",
"deprecated",
"use",
"blob",
"auditing",
"instead",
"."
] | 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/DatabaseTableAuditingPoliciesInner.java#L109-L116 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/Preconditions.java | Preconditions.checkAsyncBackupCount | public static int checkAsyncBackupCount(int currentBackupCount, int newAsyncBackupCount) {
if (currentBackupCount < 0) {
throw new IllegalArgumentException("backup-count can't be smaller than 0");
}
if (newAsyncBackupCount < 0) {
throw new IllegalArgumentException("async-backup-count can't be smaller than 0");
}
if (newAsyncBackupCount > MAX_BACKUP_COUNT) {
throw new IllegalArgumentException("async-backup-count can't be larger than than " + MAX_BACKUP_COUNT);
}
if (currentBackupCount + newAsyncBackupCount > MAX_BACKUP_COUNT) {
throw new IllegalArgumentException("the sum of backup-count and async-backup-count can't be larger than than "
+ MAX_BACKUP_COUNT);
}
return newAsyncBackupCount;
} | java | public static int checkAsyncBackupCount(int currentBackupCount, int newAsyncBackupCount) {
if (currentBackupCount < 0) {
throw new IllegalArgumentException("backup-count can't be smaller than 0");
}
if (newAsyncBackupCount < 0) {
throw new IllegalArgumentException("async-backup-count can't be smaller than 0");
}
if (newAsyncBackupCount > MAX_BACKUP_COUNT) {
throw new IllegalArgumentException("async-backup-count can't be larger than than " + MAX_BACKUP_COUNT);
}
if (currentBackupCount + newAsyncBackupCount > MAX_BACKUP_COUNT) {
throw new IllegalArgumentException("the sum of backup-count and async-backup-count can't be larger than than "
+ MAX_BACKUP_COUNT);
}
return newAsyncBackupCount;
} | [
"public",
"static",
"int",
"checkAsyncBackupCount",
"(",
"int",
"currentBackupCount",
",",
"int",
"newAsyncBackupCount",
")",
"{",
"if",
"(",
"currentBackupCount",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"backup-count can't be smaller than... | Tests if the newAsyncBackupCount count is valid.
@param currentBackupCount the current number of backups
@param newAsyncBackupCount the new number of async backups
@return the newAsyncBackupCount
@throws java.lang.IllegalArgumentException if asyncBackupCount is smaller than 0, or larger than the maximum
number of backups. | [
"Tests",
"if",
"the",
"newAsyncBackupCount",
"count",
"is",
"valid",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/Preconditions.java#L242-L261 |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.toLineString | public static Geometry toLineString(Coordinate c1, Coordinate c2) {
Geometry lineString = new Geometry(Geometry.LINE_STRING, 0, -1);
lineString.setCoordinates(new Coordinate[] { (Coordinate) c1.clone(), (Coordinate) c2.clone() });
return lineString;
} | java | public static Geometry toLineString(Coordinate c1, Coordinate c2) {
Geometry lineString = new Geometry(Geometry.LINE_STRING, 0, -1);
lineString.setCoordinates(new Coordinate[] { (Coordinate) c1.clone(), (Coordinate) c2.clone() });
return lineString;
} | [
"public",
"static",
"Geometry",
"toLineString",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
")",
"{",
"Geometry",
"lineString",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"LINE_STRING",
",",
"0",
",",
"-",
"1",
")",
";",
"lineString",
".",
"setCoo... | Create a new linestring based on the specified coordinates.
@param c1 first coordinate
@param c2 second coordinate
@return the linestring
@since 1.2.0 | [
"Create",
"a",
"new",
"linestring",
"based",
"on",
"the",
"specified",
"coordinates",
"."
] | train | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L163-L167 |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java | StencilOperands.lessThanOrEqual | public boolean lessThanOrEqual(Object left, Object right) {
if (left == right) {
return true;
}
else if (left == null || right == null) {
return false;
}
else {
return compare(left, right, "<=") <= 0;
}
} | java | public boolean lessThanOrEqual(Object left, Object right) {
if (left == right) {
return true;
}
else if (left == null || right == null) {
return false;
}
else {
return compare(left, right, "<=") <= 0;
}
} | [
"public",
"boolean",
"lessThanOrEqual",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"{",
"if",
"(",
"left",
"==",
"right",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"left",
"==",
"null",
"||",
"right",
"==",
"null",
")",
"{",
... | Test if left <= right.
@param left
first value
@param right
second value
@return test result. | [
"Test",
"if",
"left",
"<",
"=",
"right",
"."
] | train | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java#L851-L861 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseDoWhileStatement | private Stmt parseDoWhileStatement(EnclosingScope scope) {
int start = index;
match(Do);
match(Colon);
int end = index;
matchEndLine();
// match the block
Stmt.Block blk = parseBlock(scope, true);
// match while and condition
match(While);
Expr condition = parseLogicalExpression(scope, false);
// Parse the loop invariants
Tuple<Expr> invariant = parseInvariant(scope,Where);
matchEndLine();
return annotateSourceLocation(new Stmt.DoWhile(condition, invariant, new Tuple<>(), blk), start, end-1);
} | java | private Stmt parseDoWhileStatement(EnclosingScope scope) {
int start = index;
match(Do);
match(Colon);
int end = index;
matchEndLine();
// match the block
Stmt.Block blk = parseBlock(scope, true);
// match while and condition
match(While);
Expr condition = parseLogicalExpression(scope, false);
// Parse the loop invariants
Tuple<Expr> invariant = parseInvariant(scope,Where);
matchEndLine();
return annotateSourceLocation(new Stmt.DoWhile(condition, invariant, new Tuple<>(), blk), start, end-1);
} | [
"private",
"Stmt",
"parseDoWhileStatement",
"(",
"EnclosingScope",
"scope",
")",
"{",
"int",
"start",
"=",
"index",
";",
"match",
"(",
"Do",
")",
";",
"match",
"(",
"Colon",
")",
";",
"int",
"end",
"=",
"index",
";",
"matchEndLine",
"(",
")",
";",
"// ... | Parse a do-while statement, which has the form:
<pre>
DoWhileStmt ::= "do" ':' NewLine Block "where" Expr ("where" Expr)*
</pre>
@see wyc.lang.Stmt.DoWhile
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@return
@author David J. Pearce | [
"Parse",
"a",
"do",
"-",
"while",
"statement",
"which",
"has",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1064-L1079 |
gresrun/jesque | src/main/java/net/greghaines/jesque/worker/MapBasedJobFactory.java | MapBasedJobFactory.addJobType | public void addJobType(final String jobName, final Class<?> jobType) {
checkJobType(jobName, jobType);
this.jobTypes.put(jobName, jobType);
} | java | public void addJobType(final String jobName, final Class<?> jobType) {
checkJobType(jobName, jobType);
this.jobTypes.put(jobName, jobType);
} | [
"public",
"void",
"addJobType",
"(",
"final",
"String",
"jobName",
",",
"final",
"Class",
"<",
"?",
">",
"jobType",
")",
"{",
"checkJobType",
"(",
"jobName",
",",
"jobType",
")",
";",
"this",
".",
"jobTypes",
".",
"put",
"(",
"jobName",
",",
"jobType",
... | Allow the given job type to be executed.
@param jobName the job name as seen
@param jobType the job type to allow | [
"Allow",
"the",
"given",
"job",
"type",
"to",
"be",
"executed",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/worker/MapBasedJobFactory.java#L65-L68 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckAccessControls.java | CheckAccessControls.checkPrivateNameConvention | private Visibility checkPrivateNameConvention(Visibility v, Node name) {
if (isPrivateByConvention(name.getString())) {
if (v != Visibility.PRIVATE && v != Visibility.INHERITED) {
compiler.report(JSError.make(name, CONVENTION_MISMATCH));
}
return Visibility.PRIVATE;
}
return v;
} | java | private Visibility checkPrivateNameConvention(Visibility v, Node name) {
if (isPrivateByConvention(name.getString())) {
if (v != Visibility.PRIVATE && v != Visibility.INHERITED) {
compiler.report(JSError.make(name, CONVENTION_MISMATCH));
}
return Visibility.PRIVATE;
}
return v;
} | [
"private",
"Visibility",
"checkPrivateNameConvention",
"(",
"Visibility",
"v",
",",
"Node",
"name",
")",
"{",
"if",
"(",
"isPrivateByConvention",
"(",
"name",
".",
"getString",
"(",
")",
")",
")",
"{",
"if",
"(",
"v",
"!=",
"Visibility",
".",
"PRIVATE",
"&... | Returns the effective visibility of the given name, reporting an error
if there is a contradiction in the various sources of visibility
(example: a variable with a trailing underscore that is declared
{@code @public}). | [
"Returns",
"the",
"effective",
"visibility",
"of",
"the",
"given",
"name",
"reporting",
"an",
"error",
"if",
"there",
"is",
"a",
"contradiction",
"in",
"the",
"various",
"sources",
"of",
"visibility",
"(",
"example",
":",
"a",
"variable",
"with",
"a",
"trail... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckAccessControls.java#L599-L607 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/IntervalRegistry.java | IntervalRegistry.createInterval | private Interval createInterval(String aName, int aLength) {
if (aName.equals("1m")){
System.out.println("CREATE INTERVAL 1M CALLED ");
new RuntimeException().fillInStackTrace().printStackTrace();
}
IntervalImpl interval = new IntervalImpl(obtainNextUniqueId(), aName, aLength);
if (aLength!=-1)
updateTriggerService.addUpdateable(interval, aLength);
intervalsById.put(interval.getId(), interval);
intervalsByName.put(interval.getName(), interval);
for (IntervalRegistryListener listener : registryListeners) {
listener.intervalCreated(interval);
}
//add new listener to each interval to store update timestamps
interval.addSecondaryIntervalListener(new IIntervalListener() {
@Override
public void intervalUpdated(Interval aCaller) {
intervalUpdateTimestamp.put(aCaller.getName(), System.currentTimeMillis());
}
});
return interval;
} | java | private Interval createInterval(String aName, int aLength) {
if (aName.equals("1m")){
System.out.println("CREATE INTERVAL 1M CALLED ");
new RuntimeException().fillInStackTrace().printStackTrace();
}
IntervalImpl interval = new IntervalImpl(obtainNextUniqueId(), aName, aLength);
if (aLength!=-1)
updateTriggerService.addUpdateable(interval, aLength);
intervalsById.put(interval.getId(), interval);
intervalsByName.put(interval.getName(), interval);
for (IntervalRegistryListener listener : registryListeners) {
listener.intervalCreated(interval);
}
//add new listener to each interval to store update timestamps
interval.addSecondaryIntervalListener(new IIntervalListener() {
@Override
public void intervalUpdated(Interval aCaller) {
intervalUpdateTimestamp.put(aCaller.getName(), System.currentTimeMillis());
}
});
return interval;
} | [
"private",
"Interval",
"createInterval",
"(",
"String",
"aName",
",",
"int",
"aLength",
")",
"{",
"if",
"(",
"aName",
".",
"equals",
"(",
"\"1m\"",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"CREATE INTERVAL 1M CALLED \"",
")",
";",
"new",... | This method creates a new Interval with the given name and length.
@param aName the name of the new Interval
@param aLength the length of the Interval in seconds
@return the new Interval | [
"This",
"method",
"creates",
"a",
"new",
"Interval",
"with",
"the",
"given",
"name",
"and",
"length",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/IntervalRegistry.java#L182-L206 |
ppicas/custom-typeface | library/src/main/java/cat/ppicas/customtypeface/CustomTypeface.java | CustomTypeface.registerTypeface | public void registerTypeface(String typefaceName, AssetManager assets, String filePath) {
Typeface typeface = Typeface.createFromAsset(assets, filePath);
mTypefaces.put(typefaceName, typeface);
} | java | public void registerTypeface(String typefaceName, AssetManager assets, String filePath) {
Typeface typeface = Typeface.createFromAsset(assets, filePath);
mTypefaces.put(typefaceName, typeface);
} | [
"public",
"void",
"registerTypeface",
"(",
"String",
"typefaceName",
",",
"AssetManager",
"assets",
",",
"String",
"filePath",
")",
"{",
"Typeface",
"typeface",
"=",
"Typeface",
".",
"createFromAsset",
"(",
"assets",
",",
"filePath",
")",
";",
"mTypefaces",
".",... | This is a shortcut to let {@code CustomTypeface} create directly a {@link Typeface}
for you. This will create the Typeface from a file located in the assets directory.
For more information see the {@link #registerTypeface(String, Typeface)} method.
@param typefaceName a name that will identify this {@code Typeface}
@param assets a instance of {@link AssetManager}
@param filePath a path to a TTF file located inside the assets folder
@see #registerTypeface(String, Typeface) | [
"This",
"is",
"a",
"shortcut",
"to",
"let",
"{",
"@code",
"CustomTypeface",
"}",
"create",
"directly",
"a",
"{",
"@link",
"Typeface",
"}",
"for",
"you",
".",
"This",
"will",
"create",
"the",
"Typeface",
"from",
"a",
"file",
"located",
"in",
"the",
"asset... | train | https://github.com/ppicas/custom-typeface/blob/3a2a68cc8584a72076c545a8b7c9f741f6002241/library/src/main/java/cat/ppicas/customtypeface/CustomTypeface.java#L255-L258 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java | DatabaseBlobAuditingPoliciesInner.getAsync | public Observable<DatabaseBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseBlobAuditingPolicyInner>, DatabaseBlobAuditingPolicyInner>() {
@Override
public DatabaseBlobAuditingPolicyInner call(ServiceResponse<DatabaseBlobAuditingPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseBlobAuditingPolicyInner>, DatabaseBlobAuditingPolicyInner>() {
@Override
public DatabaseBlobAuditingPolicyInner call(ServiceResponse<DatabaseBlobAuditingPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseBlobAuditingPolicyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",... | Gets a database's blob auditing policy.
@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.
@param databaseName The name of the database.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseBlobAuditingPolicyInner object | [
"Gets",
"a",
"database",
"s",
"blob",
"auditing",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java#L105-L112 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/passport/AbstractHBCIPassport.java | AbstractHBCIPassport.getLowlevelJobRestrictions | public Map<String, String> getLowlevelJobRestrictions(String gvname) {
if (gvname == null || gvname.length() == 0)
throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXCMSG_EMPTY_JOBNAME"));
String version = getSupportedLowlevelJobs().get(gvname);
if (version == null)
throw new HBCI_Exception("*** lowlevel job " + gvname + " not supported");
return getJobRestrictions(gvname, version);
} | java | public Map<String, String> getLowlevelJobRestrictions(String gvname) {
if (gvname == null || gvname.length() == 0)
throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXCMSG_EMPTY_JOBNAME"));
String version = getSupportedLowlevelJobs().get(gvname);
if (version == null)
throw new HBCI_Exception("*** lowlevel job " + gvname + " not supported");
return getJobRestrictions(gvname, version);
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getLowlevelJobRestrictions",
"(",
"String",
"gvname",
")",
"{",
"if",
"(",
"gvname",
"==",
"null",
"||",
"gvname",
".",
"length",
"(",
")",
"==",
"0",
")",
"throw",
"new",
"InvalidArgumentException",
"("... | <p>Gibt für einen Job alle bekannten Einschränkungen zurück, die bei
der Ausführung des jeweiligen Jobs zu beachten sind. Diese Daten werden aus den
Bankparameterdaten des aktuellen Passports extrahiert. Sie können von einer HBCI-Anwendung
benutzt werden, um gleich entsprechende Restriktionen bei der Eingabe von
Geschäftsvorfalldaten zu erzwingen (z.B. die maximale Anzahl von Verwendungszweckzeilen,
ob das Ändern von terminierten Überweisungen erlaubt ist usw.).</p>
<p>Die einzelnen Einträge des zurückgegebenen Properties-Objektes enthalten als Key die
Bezeichnung einer Restriktion (z.B. "<code>maxusage</code>"), als Value wird der
entsprechende Wert eingestellt. Die Bedeutung der einzelnen Restriktionen ist zur Zeit
nur der HBCI-Spezifikation zu entnehmen. In späteren Programmversionen werden entsprechende
Dokumentationen zur internen HBCI-Beschreibung hinzugefügt, so dass dafür eine Abfrageschnittstelle
implementiert werden kann.</p>
<p>I.d.R. werden mehrere Versionen eines Geschäftsvorfalles von der Bank
angeboten. Diese Methode ermittelt automatisch die "richtige" Versionsnummer
für die Ermittlung der GV-Restriktionen aus den BPD (und zwar die selbe,
die <em>HBCI4Java</em> beim Erzeugen eines Jobs benutzt). </p>
<p>Siehe dazu auch {@link AbstractHBCIJob#getJobRestrictions()}.</p>
@param gvname Lowlevel-Name des Geschäftsvorfalles, für den die Restriktionen
ermittelt werden sollen
@return Properties-Objekt mit den einzelnen Restriktionen | [
"<p",
">",
"Gibt",
"für",
"einen",
"Job",
"alle",
"bekannten",
"Einschränkungen",
"zurück",
"die",
"bei",
"der",
"Ausführung",
"des",
"jeweiligen",
"Jobs",
"zu",
"beachten",
"sind",
".",
"Diese",
"Daten",
"werden",
"aus",
"den",
"Bankparameterdaten",
"des",
"a... | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/passport/AbstractHBCIPassport.java#L550-L559 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/SubnetworkInfo.java | SubnetworkInfo.newBuilder | public static Builder newBuilder(SubnetworkId subnetworkId, NetworkId network, String ipRange) {
return new BuilderImpl(subnetworkId, network, ipRange);
} | java | public static Builder newBuilder(SubnetworkId subnetworkId, NetworkId network, String ipRange) {
return new BuilderImpl(subnetworkId, network, ipRange);
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"SubnetworkId",
"subnetworkId",
",",
"NetworkId",
"network",
",",
"String",
"ipRange",
")",
"{",
"return",
"new",
"BuilderImpl",
"(",
"subnetworkId",
",",
"network",
",",
"ipRange",
")",
";",
"}"
] | Returns a builder for a {@code SubnetworkInfo} object given the identity of the subnetwork, the
identity of the network this subnetwork belongs to and the range of IPv4 addresses owned by
this subnetwork. {@code ipRange} must be a CIDR specification, for example: {@code
192.168.0.0/16}.
@see <a href="https://wikipedia.org/wiki/Classless_Inter-Domain_Routing">CIDR</a> | [
"Returns",
"a",
"builder",
"for",
"a",
"{",
"@code",
"SubnetworkInfo",
"}",
"object",
"given",
"the",
"identity",
"of",
"the",
"subnetwork",
"the",
"identity",
"of",
"the",
"network",
"this",
"subnetwork",
"belongs",
"to",
"and",
"the",
"range",
"of",
"IPv4"... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/SubnetworkInfo.java#L319-L321 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/SurfaceConfig.java | SurfaceConfig.imports | public static SurfaceConfig imports(Xml root)
{
Check.notNull(root);
final Xml node = root.getChild(NODE_SURFACE);
final String surface = node.readString(ATT_IMAGE);
final String icon = node.readString(null, ATT_ICON);
return new SurfaceConfig(surface, icon);
} | java | public static SurfaceConfig imports(Xml root)
{
Check.notNull(root);
final Xml node = root.getChild(NODE_SURFACE);
final String surface = node.readString(ATT_IMAGE);
final String icon = node.readString(null, ATT_ICON);
return new SurfaceConfig(surface, icon);
} | [
"public",
"static",
"SurfaceConfig",
"imports",
"(",
"Xml",
"root",
")",
"{",
"Check",
".",
"notNull",
"(",
"root",
")",
";",
"final",
"Xml",
"node",
"=",
"root",
".",
"getChild",
"(",
"NODE_SURFACE",
")",
";",
"final",
"String",
"surface",
"=",
"node",
... | Create the surface data from node.
@param root The root reference (must not be <code>null</code>).
@return The surface data.
@throws LionEngineException If unable to read node. | [
"Create",
"the",
"surface",
"data",
"from",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/SurfaceConfig.java#L65-L74 |
mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/utilities/SubItemUtil.java | SubItemUtil.selectItem | @Deprecated
@SuppressWarnings("unchecked")
public static boolean selectItem(final FastAdapter adapter, final long identifier, final boolean select) {
Triple<Boolean, IItem, Integer> res = adapter.recursive(new AdapterPredicate() {
@Override
public boolean apply(@NonNull IAdapter lastParentAdapter, int lastParentPosition, @NonNull IItem item, int position) {
if (item.getIdentifier() == identifier) {
if (position != -1) {
SelectExtension extension = (SelectExtension) adapter.getExtension(SelectExtension.class);
if (extension != null) {
if (select) {
extension.select(position);
} else {
extension.deselect(position);
}
}
} else {
item.withSetSelected(select);
}
return true;
}
return false;
}
}, true);
return res.first;
} | java | @Deprecated
@SuppressWarnings("unchecked")
public static boolean selectItem(final FastAdapter adapter, final long identifier, final boolean select) {
Triple<Boolean, IItem, Integer> res = adapter.recursive(new AdapterPredicate() {
@Override
public boolean apply(@NonNull IAdapter lastParentAdapter, int lastParentPosition, @NonNull IItem item, int position) {
if (item.getIdentifier() == identifier) {
if (position != -1) {
SelectExtension extension = (SelectExtension) adapter.getExtension(SelectExtension.class);
if (extension != null) {
if (select) {
extension.select(position);
} else {
extension.deselect(position);
}
}
} else {
item.withSetSelected(select);
}
return true;
}
return false;
}
}, true);
return res.first;
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"boolean",
"selectItem",
"(",
"final",
"FastAdapter",
"adapter",
",",
"final",
"long",
"identifier",
",",
"final",
"boolean",
"select",
")",
"{",
"Triple",
"<",
"Boolean",... | select or unselect an item with the given identifier
This will not handle the `only one selected` case. Please deselect all items first for this requirement.
@param adapter the adapter instance
@param identifier the identifier of the item to select / deselect
@param select the new selected state of the sub items
@deprecated See {@link SelectExtension#selectByIdentifier(long, boolean, boolean)} ()} ()} | [
"select",
"or",
"unselect",
"an",
"item",
"with",
"the",
"given",
"identifier",
"This",
"will",
"not",
"handle",
"the",
"only",
"one",
"selected",
"case",
".",
"Please",
"deselect",
"all",
"items",
"first",
"for",
"this",
"requirement",
"."
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/utilities/SubItemUtil.java#L267-L292 |
playn/playn | core/src/playn/core/TextFormat.java | TextFormat.withFont | public TextFormat withFont(String name, Font.Style style, float size) {
return withFont(new Font(name, style, size));
} | java | public TextFormat withFont(String name, Font.Style style, float size) {
return withFont(new Font(name, style, size));
} | [
"public",
"TextFormat",
"withFont",
"(",
"String",
"name",
",",
"Font",
".",
"Style",
"style",
",",
"float",
"size",
")",
"{",
"return",
"withFont",
"(",
"new",
"Font",
"(",
"name",
",",
"style",
",",
"size",
")",
")",
";",
"}"
] | Returns a clone of this text format with the font configured as specified. | [
"Returns",
"a",
"clone",
"of",
"this",
"text",
"format",
"with",
"the",
"font",
"configured",
"as",
"specified",
"."
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/TextFormat.java#L51-L53 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/ServerLock.java | ServerLock.createServerRunningMarkerFile | public static void createServerRunningMarkerFile(BootstrapConfig bootConfig) {
File serverWorkArea = bootConfig.getWorkareaFile(null);
File serverRunningMarkerFile = null;
try {
serverRunningMarkerFile = new File(serverWorkArea, BootstrapConstants.SERVER_RUNNING_FILE);
serverRunningMarkerFile.deleteOnExit();
boolean newFile = serverRunningMarkerFile.createNewFile();
if (!newFile)
bootConfig.forceCleanStart();
} catch (IOException e) {
throw new LaunchException("Can not create or write to server running marker file, check file permissions", MessageFormat.format(BootstrapConstants.messages.getString("error.serverDirPermission"),
serverRunningMarkerFile.getAbsolutePath()), e);
}
} | java | public static void createServerRunningMarkerFile(BootstrapConfig bootConfig) {
File serverWorkArea = bootConfig.getWorkareaFile(null);
File serverRunningMarkerFile = null;
try {
serverRunningMarkerFile = new File(serverWorkArea, BootstrapConstants.SERVER_RUNNING_FILE);
serverRunningMarkerFile.deleteOnExit();
boolean newFile = serverRunningMarkerFile.createNewFile();
if (!newFile)
bootConfig.forceCleanStart();
} catch (IOException e) {
throw new LaunchException("Can not create or write to server running marker file, check file permissions", MessageFormat.format(BootstrapConstants.messages.getString("error.serverDirPermission"),
serverRunningMarkerFile.getAbsolutePath()), e);
}
} | [
"public",
"static",
"void",
"createServerRunningMarkerFile",
"(",
"BootstrapConfig",
"bootConfig",
")",
"{",
"File",
"serverWorkArea",
"=",
"bootConfig",
".",
"getWorkareaFile",
"(",
"null",
")",
";",
"File",
"serverRunningMarkerFile",
"=",
"null",
";",
"try",
"{",
... | Create a marker file when the server is running to determine if the JVM terminated normally.
This file is deleted automatically when the JVM exits normally, on a normal server stop.
If the marker file already exists when the server is starting, it assumes the JVM abended or
the JVM process was forcefully terminated. In this case, we mark the bootstrap properties to
do a full clean of the workarea, to remove any possible corruption that might have occurred
as a result of the JVM abend.
The other existing files such as .sLock and .sCommand weren't not reused for this purpose
because they each had ties in to other code and scripts that have expections on them that
the server running marker file could not work with (such as slock is always expected to
exist)
This utlilty relies on the server lock already being obtained (for synchronization) and that
a server workspace clean is done after it is executed.
This method also expects the server directory and workarea directories exists. The server lock
file creation will ensure those things will exist. | [
"Create",
"a",
"marker",
"file",
"when",
"the",
"server",
"is",
"running",
"to",
"determine",
"if",
"the",
"JVM",
"terminated",
"normally",
".",
"This",
"file",
"is",
"deleted",
"automatically",
"when",
"the",
"JVM",
"exits",
"normally",
"on",
"a",
"normal",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/ServerLock.java#L590-L603 |
alkacon/opencms-core | src/org/opencms/xml/page/CmsXmlPage.java | CmsXmlPage.removeValue | public void removeValue(String name, Locale locale) {
I_CmsXmlContentValue value = removeBookmark(CmsXmlUtils.createXpath(name, 1), locale);
if (value != null) {
Element element = value.getElement();
element.detach();
}
} | java | public void removeValue(String name, Locale locale) {
I_CmsXmlContentValue value = removeBookmark(CmsXmlUtils.createXpath(name, 1), locale);
if (value != null) {
Element element = value.getElement();
element.detach();
}
} | [
"public",
"void",
"removeValue",
"(",
"String",
"name",
",",
"Locale",
"locale",
")",
"{",
"I_CmsXmlContentValue",
"value",
"=",
"removeBookmark",
"(",
"CmsXmlUtils",
".",
"createXpath",
"(",
"name",
",",
"1",
")",
",",
"locale",
")",
";",
"if",
"(",
"valu... | Removes an existing value with the given name and locale
from this XML document.<p>
@param name the name of the value
@param locale the locale of the value | [
"Removes",
"an",
"existing",
"value",
"with",
"the",
"given",
"name",
"and",
"locale",
"from",
"this",
"XML",
"document",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/page/CmsXmlPage.java#L351-L358 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.