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 |
|---|---|---|---|---|---|---|---|---|---|---|
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/collections/IndexAliasMap.java | IndexAliasMap.addWithAlias | public Integer addWithAlias(String alias, V value) {
synchronized (dataList) {
dataList.add(value);
return aliasIndexMap.put(alias, dataList.size() - 1);
}
} | java | public Integer addWithAlias(String alias, V value) {
synchronized (dataList) {
dataList.add(value);
return aliasIndexMap.put(alias, dataList.size() - 1);
}
} | [
"public",
"Integer",
"addWithAlias",
"(",
"String",
"alias",
",",
"V",
"value",
")",
"{",
"synchronized",
"(",
"dataList",
")",
"{",
"dataList",
".",
"add",
"(",
"value",
")",
";",
"return",
"aliasIndexMap",
".",
"put",
"(",
"alias",
",",
"dataList",
"."... | Add with alias integer.
@param alias the alias
@param value the value
@return the integer | [
"Add",
"with",
"alias",
"integer",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/collections/IndexAliasMap.java#L73-L78 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java | TopicsInner.updateAsync | public Observable<TopicInner> updateAsync(String resourceGroupName, String topicName, Map<String, String> tags) {
return updateWithServiceResponseAsync(resourceGroupName, topicName, tags).map(new Func1<ServiceResponse<TopicInner>, TopicInner>() {
@Override
public TopicInner call(ServiceResponse<TopicInner> response) {
return response.body();
}
});
} | java | public Observable<TopicInner> updateAsync(String resourceGroupName, String topicName, Map<String, String> tags) {
return updateWithServiceResponseAsync(resourceGroupName, topicName, tags).map(new Func1<ServiceResponse<TopicInner>, TopicInner>() {
@Override
public TopicInner call(ServiceResponse<TopicInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TopicInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"topicName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",... | Update a topic.
Asynchronously updates a topic with the specified parameters.
@param resourceGroupName The name of the resource group within the user's subscription.
@param topicName Name of the topic
@param tags Tags of the resource
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Update",
"a",
"topic",
".",
"Asynchronously",
"updates",
"a",
"topic",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L666-L673 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/SerializerRegistry.java | SerializerRegistry.registerAbstract | public SerializerRegistry registerAbstract(Class<?> abstractType, int id, Class<? extends TypeSerializer> serializer) {
return registerAbstract(abstractType, id, new DefaultTypeSerializerFactory(serializer));
} | java | public SerializerRegistry registerAbstract(Class<?> abstractType, int id, Class<? extends TypeSerializer> serializer) {
return registerAbstract(abstractType, id, new DefaultTypeSerializerFactory(serializer));
} | [
"public",
"SerializerRegistry",
"registerAbstract",
"(",
"Class",
"<",
"?",
">",
"abstractType",
",",
"int",
"id",
",",
"Class",
"<",
"?",
"extends",
"TypeSerializer",
">",
"serializer",
")",
"{",
"return",
"registerAbstract",
"(",
"abstractType",
",",
"id",
"... | Registers the given class as an abstract serializer for the given abstract type.
@param abstractType The abstract type for which to register the serializer.
@param id The serializable type ID.
@param serializer The serializer class.
@return The serializer registry. | [
"Registers",
"the",
"given",
"class",
"as",
"an",
"abstract",
"serializer",
"for",
"the",
"given",
"abstract",
"type",
"."
] | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/SerializerRegistry.java#L231-L233 |
phax/ph-oton | ph-oton-core/src/main/java/com/helger/photon/core/uistate/UIStateRegistry.java | UIStateRegistry.registerState | @Nonnull
@SuppressFBWarnings ("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
public EChange registerState (@Nonnull @Nonempty final String sStateID, @Nonnull final IHasUIState aNewState)
{
ValueEnforcer.notEmpty (sStateID, "StateID");
ValueEnforcer.notNull (aNewState, "NewState");
final ObjectType aOT = aNewState.getObjectType ();
if (aOT == null)
throw new IllegalStateException ("Object has no typeID: " + aNewState);
return m_aRWLock.writeLocked ( () -> {
final Map <String, IHasUIState> aMap = m_aMap.computeIfAbsent (aOT, k -> new CommonsHashMap<> ());
if (LOGGER.isDebugEnabled () && aMap.containsKey (sStateID))
LOGGER.debug ("Overwriting " + aOT.getName () + " with ID " + sStateID + " with new object");
aMap.put (sStateID, aNewState);
return EChange.CHANGED;
});
} | java | @Nonnull
@SuppressFBWarnings ("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
public EChange registerState (@Nonnull @Nonempty final String sStateID, @Nonnull final IHasUIState aNewState)
{
ValueEnforcer.notEmpty (sStateID, "StateID");
ValueEnforcer.notNull (aNewState, "NewState");
final ObjectType aOT = aNewState.getObjectType ();
if (aOT == null)
throw new IllegalStateException ("Object has no typeID: " + aNewState);
return m_aRWLock.writeLocked ( () -> {
final Map <String, IHasUIState> aMap = m_aMap.computeIfAbsent (aOT, k -> new CommonsHashMap<> ());
if (LOGGER.isDebugEnabled () && aMap.containsKey (sStateID))
LOGGER.debug ("Overwriting " + aOT.getName () + " with ID " + sStateID + " with new object");
aMap.put (sStateID, aNewState);
return EChange.CHANGED;
});
} | [
"@",
"Nonnull",
"@",
"SuppressFBWarnings",
"(",
"\"RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE\"",
")",
"public",
"EChange",
"registerState",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sStateID",
",",
"@",
"Nonnull",
"final",
"IHasUIState",
"aNewState",
")... | Registers a new control for the passed tree ID
@param sStateID
the ID of the state in register. May neither be <code>null</code>
nor empty.
@param aNewState
The state to set. May not be <code>null</code>.
@return {@link EChange#CHANGED} if the control was registered<br>
{@link EChange#UNCHANGED} if an illegal argument was passed or a
control has already been registered for that ID | [
"Registers",
"a",
"new",
"control",
"for",
"the",
"passed",
"tree",
"ID"
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/uistate/UIStateRegistry.java#L156-L176 |
httpcache4j/httpcache4j | httpcache4j-api/src/main/java/org/codehaus/httpcache4j/Conditionals.java | Conditionals.ifUnModifiedSince | public Conditionals ifUnModifiedSince(LocalDateTime time) {
Preconditions.checkArgument(noneMatch.isEmpty(), String.format(ERROR_MESSAGE, HeaderConstants.IF_UNMODIFIED_SINCE, HeaderConstants.IF_NONE_MATCH));
Preconditions.checkArgument(!modifiedSince.isPresent(), String.format(ERROR_MESSAGE, HeaderConstants.IF_UNMODIFIED_SINCE, HeaderConstants.IF_MODIFIED_SINCE));
time = time.withNano(0);
return new Conditionals(match, empty(), Optional.empty(), Optional.of(time));
} | java | public Conditionals ifUnModifiedSince(LocalDateTime time) {
Preconditions.checkArgument(noneMatch.isEmpty(), String.format(ERROR_MESSAGE, HeaderConstants.IF_UNMODIFIED_SINCE, HeaderConstants.IF_NONE_MATCH));
Preconditions.checkArgument(!modifiedSince.isPresent(), String.format(ERROR_MESSAGE, HeaderConstants.IF_UNMODIFIED_SINCE, HeaderConstants.IF_MODIFIED_SINCE));
time = time.withNano(0);
return new Conditionals(match, empty(), Optional.empty(), Optional.of(time));
} | [
"public",
"Conditionals",
"ifUnModifiedSince",
"(",
"LocalDateTime",
"time",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"noneMatch",
".",
"isEmpty",
"(",
")",
",",
"String",
".",
"format",
"(",
"ERROR_MESSAGE",
",",
"HeaderConstants",
".",
"IF_UNMODIFIE... | You should use the server's time here. Otherwise you might get unexpected results.
The typical use case is:
<pre>
HTTPResponse response = ....
HTTPRequest request = createRequest();
request = request.conditionals(new Conditionals().ifUnModifiedSince(response.getLastModified());
</pre>
@param time the time to check.
@return the conditionals with the If-Unmodified-Since date set. | [
"You",
"should",
"use",
"the",
"server",
"s",
"time",
"here",
".",
"Otherwise",
"you",
"might",
"get",
"unexpected",
"results",
".",
"The",
"typical",
"use",
"case",
"is",
":"
] | train | https://github.com/httpcache4j/httpcache4j/blob/9c07ebd63cd104a99eb9e771f760f14efa4fe0f6/httpcache4j-api/src/main/java/org/codehaus/httpcache4j/Conditionals.java#L181-L186 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java | Utils.getValue | public static String getValue(Map<String,String> map, String key, String defaultValue) {
return map.containsKey( key ) ? map.get( key ) : defaultValue;
} | java | public static String getValue(Map<String,String> map, String key, String defaultValue) {
return map.containsKey( key ) ? map.get( key ) : defaultValue;
} | [
"public",
"static",
"String",
"getValue",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"return",
"map",
".",
"containsKey",
"(",
"key",
")",
"?",
"map",
".",
"get",
"(",
"key",
"... | Returns the value contained in a map of string if it exists using the key.
@param map a map of string
@param key a string
@param defaultValue the default value | [
"Returns",
"the",
"value",
"contained",
"in",
"a",
"map",
"of",
"string",
"if",
"it",
"exists",
"using",
"the",
"key",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L1285-L1287 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwxmlerrorpage.java | appfwxmlerrorpage.get | public static appfwxmlerrorpage get(nitro_service service, String name) throws Exception{
appfwxmlerrorpage obj = new appfwxmlerrorpage();
obj.set_name(name);
appfwxmlerrorpage response = (appfwxmlerrorpage) obj.get_resource(service);
return response;
} | java | public static appfwxmlerrorpage get(nitro_service service, String name) throws Exception{
appfwxmlerrorpage obj = new appfwxmlerrorpage();
obj.set_name(name);
appfwxmlerrorpage response = (appfwxmlerrorpage) obj.get_resource(service);
return response;
} | [
"public",
"static",
"appfwxmlerrorpage",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"appfwxmlerrorpage",
"obj",
"=",
"new",
"appfwxmlerrorpage",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
... | Use this API to fetch appfwxmlerrorpage resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appfwxmlerrorpage",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwxmlerrorpage.java#L134-L139 |
LableOrg/java-uniqueid | uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/SynchronizedGeneratorIdentity.java | SynchronizedGeneratorIdentity.basedOn | public static SynchronizedGeneratorIdentity basedOn(String quorum,
String znode,
Long claimDuration)
throws IOException {
ZooKeeperConnection zooKeeperConnection = new ZooKeeperConnection(quorum);
int clusterId = ClusterID.get(zooKeeperConnection.getActiveConnection(), znode);
Supplier<Duration> durationSupplier = () -> Duration.ofMillis(claimDuration);
return new SynchronizedGeneratorIdentity(zooKeeperConnection, znode, clusterId, durationSupplier);
} | java | public static SynchronizedGeneratorIdentity basedOn(String quorum,
String znode,
Long claimDuration)
throws IOException {
ZooKeeperConnection zooKeeperConnection = new ZooKeeperConnection(quorum);
int clusterId = ClusterID.get(zooKeeperConnection.getActiveConnection(), znode);
Supplier<Duration> durationSupplier = () -> Duration.ofMillis(claimDuration);
return new SynchronizedGeneratorIdentity(zooKeeperConnection, znode, clusterId, durationSupplier);
} | [
"public",
"static",
"SynchronizedGeneratorIdentity",
"basedOn",
"(",
"String",
"quorum",
",",
"String",
"znode",
",",
"Long",
"claimDuration",
")",
"throws",
"IOException",
"{",
"ZooKeeperConnection",
"zooKeeperConnection",
"=",
"new",
"ZooKeeperConnection",
"(",
"quoru... | Create a new {@link SynchronizedGeneratorIdentity} instance.
@param quorum Addresses of the ZooKeeper quorum (comma-separated).
@param znode Root znode of the ZooKeeper resource-pool.
@param claimDuration How long a claim to a generator-ID should be held, in milliseconds.
@return A {@link SynchronizedGeneratorIdentity} instance. | [
"Create",
"a",
"new",
"{",
"@link",
"SynchronizedGeneratorIdentity",
"}",
"instance",
"."
] | train | https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/SynchronizedGeneratorIdentity.java#L82-L91 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/connectionmanager/pool/IdleConnectionRemover.java | IdleConnectionRemover.registerPool | public void registerPool(ManagedConnectionPool mcp, long mcpInterval)
{
try
{
lock.lock();
synchronized (registeredPools)
{
registeredPools.put(new Key(System.identityHashCode(mcp), System.currentTimeMillis(), mcpInterval), mcp);
}
if (mcpInterval > 1 && mcpInterval / 2 < interval)
{
interval = interval / 2;
long maybeNext = System.currentTimeMillis() + interval;
if (next > maybeNext && maybeNext > 0)
{
next = maybeNext;
condition.signal();
}
}
}
finally
{
lock.unlock();
}
} | java | public void registerPool(ManagedConnectionPool mcp, long mcpInterval)
{
try
{
lock.lock();
synchronized (registeredPools)
{
registeredPools.put(new Key(System.identityHashCode(mcp), System.currentTimeMillis(), mcpInterval), mcp);
}
if (mcpInterval > 1 && mcpInterval / 2 < interval)
{
interval = interval / 2;
long maybeNext = System.currentTimeMillis() + interval;
if (next > maybeNext && maybeNext > 0)
{
next = maybeNext;
condition.signal();
}
}
}
finally
{
lock.unlock();
}
} | [
"public",
"void",
"registerPool",
"(",
"ManagedConnectionPool",
"mcp",
",",
"long",
"mcpInterval",
")",
"{",
"try",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"synchronized",
"(",
"registeredPools",
")",
"{",
"registeredPools",
".",
"put",
"(",
"new",
"Key",
... | Register pool for idle connection cleanup
@param mcp managed connection pool
@param mcpInterval validation interval | [
"Register",
"pool",
"for",
"idle",
"connection",
"cleanup"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/IdleConnectionRemover.java#L162-L188 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java | ConditionalCheck.notEquals | @Throws(IllegalEqualException.class)
public static void notEquals(final boolean condition, final boolean expected, final boolean check) {
if (condition) {
Check.notEquals(expected, check);
}
} | java | @Throws(IllegalEqualException.class)
public static void notEquals(final boolean condition, final boolean expected, final boolean check) {
if (condition) {
Check.notEquals(expected, check);
}
} | [
"@",
"Throws",
"(",
"IllegalEqualException",
".",
"class",
")",
"public",
"static",
"void",
"notEquals",
"(",
"final",
"boolean",
"condition",
",",
"final",
"boolean",
"expected",
",",
"final",
"boolean",
"check",
")",
"{",
"if",
"(",
"condition",
")",
"{",
... | Ensures that a passed boolean is not equal to another boolean. The comparison is made using
<code>expected == check</code>.
<p>
We recommend to use the overloaded method {@link ConditionalCheck#notEquals(condition,boolean, boolean, String)}
and pass as second argument the name of the parameter to enhance the exception message.
@param condition
condition must be {@code true}^ so that the check will be performed
@param expected
Expected value
@param check
boolean to be checked
@throws IllegalEqualException
if both argument values are not equal | [
"Ensures",
"that",
"a",
"passed",
"boolean",
"is",
"not",
"equal",
"to",
"another",
"boolean",
".",
"The",
"comparison",
"is",
"made",
"using",
"<code",
">",
"expected",
"==",
"check<",
"/",
"code",
">",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L1464-L1469 |
Clivern/Racter | src/main/java/com/clivern/racter/senders/templates/MessageTemplate.java | MessageTemplate.setAttachment | public void setAttachment(String type, String url, Boolean is_reusable)
{
this.message_attachment.put("type", type);
this.message_attachment.put("url", url);
this.message_attachment.put("is_reusable", String.valueOf(is_reusable));
} | java | public void setAttachment(String type, String url, Boolean is_reusable)
{
this.message_attachment.put("type", type);
this.message_attachment.put("url", url);
this.message_attachment.put("is_reusable", String.valueOf(is_reusable));
} | [
"public",
"void",
"setAttachment",
"(",
"String",
"type",
",",
"String",
"url",
",",
"Boolean",
"is_reusable",
")",
"{",
"this",
".",
"message_attachment",
".",
"put",
"(",
"\"type\"",
",",
"type",
")",
";",
"this",
".",
"message_attachment",
".",
"put",
"... | Set Attachment
@param type the attachment type
@param url the attachment url
@param is_reusable whether to be reusable or not | [
"Set",
"Attachment"
] | train | https://github.com/Clivern/Racter/blob/bbde02f0c2a8a80653ad6b1607376d8408acd71c/src/main/java/com/clivern/racter/senders/templates/MessageTemplate.java#L102-L107 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.createWriteAttributeRequest | public static ModelNode createWriteAttributeRequest(String attributeName, String attributeValue, Address address) {
final ModelNode op = createRequest(WRITE_ATTRIBUTE, address);
op.get(NAME).set(attributeName);
setPossibleExpression(op, VALUE, attributeValue);
return op;
} | java | public static ModelNode createWriteAttributeRequest(String attributeName, String attributeValue, Address address) {
final ModelNode op = createRequest(WRITE_ATTRIBUTE, address);
op.get(NAME).set(attributeName);
setPossibleExpression(op, VALUE, attributeValue);
return op;
} | [
"public",
"static",
"ModelNode",
"createWriteAttributeRequest",
"(",
"String",
"attributeName",
",",
"String",
"attributeValue",
",",
"Address",
"address",
")",
"{",
"final",
"ModelNode",
"op",
"=",
"createRequest",
"(",
"WRITE_ATTRIBUTE",
",",
"address",
")",
";",
... | Convienence method that allows you to create request that writes a single attribute's
string value to a resource.
@param attributeName the name of the attribute whose value is to be written
@param attributeValue the attribute value that is to be written
@param address identifies the resource
@return the request | [
"Convienence",
"method",
"that",
"allows",
"you",
"to",
"create",
"request",
"that",
"writes",
"a",
"single",
"attribute",
"s",
"string",
"value",
"to",
"a",
"resource",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L111-L116 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java | PassthroughResourcesImpl.getRequest | public String getRequest(String endpoint, HashMap<String, Object> parameters) throws SmartsheetException {
return passthroughRequest(HttpMethod.GET, endpoint, null, parameters);
} | java | public String getRequest(String endpoint, HashMap<String, Object> parameters) throws SmartsheetException {
return passthroughRequest(HttpMethod.GET, endpoint, null, parameters);
} | [
"public",
"String",
"getRequest",
"(",
"String",
"endpoint",
",",
"HashMap",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"throws",
"SmartsheetException",
"{",
"return",
"passthroughRequest",
"(",
"HttpMethod",
".",
"GET",
",",
"endpoint",
",",
"null",
... | Issue an HTTP GET request.
@param endpoint the API endpoint
@param parameters optional list of resource parameters
@return a JSON response string
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation | [
"Issue",
"an",
"HTTP",
"GET",
"request",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java#L60-L62 |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetColumn.java | SheetColumn.validateRequired | protected boolean validateRequired(final FacesContext context, final Object newValue) {
// If our value is valid, enforce the required property if present
if (isValid() && isRequired() && isEmpty(newValue)) {
final String requiredMessageStr = getRequiredMessage();
FacesMessage message;
if (null != requiredMessageStr) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
requiredMessageStr,
requiredMessageStr);
}
else {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
MESSAGE_REQUIRED,
MESSAGE_REQUIRED);
}
context.addMessage(getClientId(context), message);
final Sheet sheet = getSheet();
if (sheet != null) {
sheet.getInvalidUpdates().add(
new SheetInvalidUpdate(sheet.getRowKeyValue(context), sheet.getColumns().indexOf(this), this, newValue,
message.getDetail()));
}
setValid(false);
return false;
}
return true;
} | java | protected boolean validateRequired(final FacesContext context, final Object newValue) {
// If our value is valid, enforce the required property if present
if (isValid() && isRequired() && isEmpty(newValue)) {
final String requiredMessageStr = getRequiredMessage();
FacesMessage message;
if (null != requiredMessageStr) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
requiredMessageStr,
requiredMessageStr);
}
else {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
MESSAGE_REQUIRED,
MESSAGE_REQUIRED);
}
context.addMessage(getClientId(context), message);
final Sheet sheet = getSheet();
if (sheet != null) {
sheet.getInvalidUpdates().add(
new SheetInvalidUpdate(sheet.getRowKeyValue(context), sheet.getColumns().indexOf(this), this, newValue,
message.getDetail()));
}
setValid(false);
return false;
}
return true;
} | [
"protected",
"boolean",
"validateRequired",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Object",
"newValue",
")",
"{",
"// If our value is valid, enforce the required property if present",
"if",
"(",
"isValid",
"(",
")",
"&&",
"isRequired",
"(",
")",
"&&",
... | Validates the value against the required flags on this column.
@param context the FacesContext
@param newValue the new value for this column
@return true if passes validation, otherwise valse | [
"Validates",
"the",
"value",
"against",
"the",
"required",
"flags",
"on",
"this",
"column",
"."
] | train | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetColumn.java#L674-L700 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java | CPDefinitionOptionValueRelPersistenceImpl.removeByUUID_G | @Override
public CPDefinitionOptionValueRel removeByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionOptionValueRelException {
CPDefinitionOptionValueRel cpDefinitionOptionValueRel = findByUUID_G(uuid,
groupId);
return remove(cpDefinitionOptionValueRel);
} | java | @Override
public CPDefinitionOptionValueRel removeByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionOptionValueRelException {
CPDefinitionOptionValueRel cpDefinitionOptionValueRel = findByUUID_G(uuid,
groupId);
return remove(cpDefinitionOptionValueRel);
} | [
"@",
"Override",
"public",
"CPDefinitionOptionValueRel",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCPDefinitionOptionValueRelException",
"{",
"CPDefinitionOptionValueRel",
"cpDefinitionOptionValueRel",
"=",
"findByUUID_G",
"(",
"uu... | Removes the cp definition option value rel where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the cp definition option value rel that was removed | [
"Removes",
"the",
"cp",
"definition",
"option",
"value",
"rel",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java#L823-L830 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/base64/Base64.java | Base64.encodeBytes | @Nonnull
public static String encodeBytes (@Nonnull final byte [] source, final int options) throws IOException
{
return encodeBytes (source, 0, source.length, options);
} | java | @Nonnull
public static String encodeBytes (@Nonnull final byte [] source, final int options) throws IOException
{
return encodeBytes (source, 0, source.length, options);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"encodeBytes",
"(",
"@",
"Nonnull",
"final",
"byte",
"[",
"]",
"source",
",",
"final",
"int",
"options",
")",
"throws",
"IOException",
"{",
"return",
"encodeBytes",
"(",
"source",
",",
"0",
",",
"source",
".",
... | Encodes a byte array into Base64 notation.
<p>
Example options:
<pre>
GZIP: gzip-compresses object before encoding it.
DO_BREAK_LINES: break lines at 76 characters
Note: Technically, this makes your encoding non-compliant.
</pre>
<p>
Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
<p>
Example:
<code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
<p>
As of v 2.3, if there is an error with the GZIP stream, the method will
throw an IOException. <b>This is new to v2.3!</b> In earlier versions, it
just returned a null value, but in retrospect that's a pretty poor way to
handle it.
</p>
@param source
The data to convert
@param options
Specified options
@return The Base64-encoded data as a String
@see Base64#GZIP
@see Base64#DO_BREAK_LINES
@throws IOException
if there is an error
@throws NullPointerException
if source array is null
@since 2.0 | [
"Encodes",
"a",
"byte",
"array",
"into",
"Base64",
"notation",
".",
"<p",
">",
"Example",
"options",
":"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L1699-L1703 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/utils/JStormUtils.java | JStormUtils.launchProcess | @Deprecated
public static ByteArrayOutputStream launchProcess(
String command, final Map environment, final String workDir,
ExecuteResultHandler resultHandler) throws IOException {
String[] cmdlist = command.split(" ");
CommandLine cmd = new CommandLine(cmdlist[0]);
for (String cmdItem : cmdlist) {
if (!StringUtils.isBlank(cmdItem)) {
cmd.addArgument(cmdItem);
}
}
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
if (!StringUtils.isBlank(workDir)) {
executor.setWorkingDirectory(new File(workDir));
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
PumpStreamHandler streamHandler = new PumpStreamHandler(out, out);
executor.setStreamHandler(streamHandler);
try {
if (resultHandler == null) {
executor.execute(cmd, environment);
} else {
executor.execute(cmd, environment, resultHandler);
}
} catch (ExecuteException ignored) {
}
return out;
} | java | @Deprecated
public static ByteArrayOutputStream launchProcess(
String command, final Map environment, final String workDir,
ExecuteResultHandler resultHandler) throws IOException {
String[] cmdlist = command.split(" ");
CommandLine cmd = new CommandLine(cmdlist[0]);
for (String cmdItem : cmdlist) {
if (!StringUtils.isBlank(cmdItem)) {
cmd.addArgument(cmdItem);
}
}
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
if (!StringUtils.isBlank(workDir)) {
executor.setWorkingDirectory(new File(workDir));
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
PumpStreamHandler streamHandler = new PumpStreamHandler(out, out);
executor.setStreamHandler(streamHandler);
try {
if (resultHandler == null) {
executor.execute(cmd, environment);
} else {
executor.execute(cmd, environment, resultHandler);
}
} catch (ExecuteException ignored) {
}
return out;
} | [
"@",
"Deprecated",
"public",
"static",
"ByteArrayOutputStream",
"launchProcess",
"(",
"String",
"command",
",",
"final",
"Map",
"environment",
",",
"final",
"String",
"workDir",
",",
"ExecuteResultHandler",
"resultHandler",
")",
"throws",
"IOException",
"{",
"String",... | If it is backend, please set resultHandler, such as DefaultExecuteResultHandler
If it is frontend, ByteArrayOutputStream.toString will return the calling result
<p>
This function will ignore whether the command is successfully executed or not
@param command command to be executed
@param environment env vars
@param workDir working directory
@param resultHandler exec result handler
@return output stream
@throws IOException | [
"If",
"it",
"is",
"backend",
"please",
"set",
"resultHandler",
"such",
"as",
"DefaultExecuteResultHandler",
"If",
"it",
"is",
"frontend",
"ByteArrayOutputStream",
".",
"toString",
"will",
"return",
"the",
"calling",
"result",
"<p",
">",
"This",
"function",
"will",... | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/utils/JStormUtils.java#L636-L673 |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/output/PangoolMultipleOutputs.java | PangoolMultipleOutputs.checkNamedOutputName | private static void checkNamedOutputName(JobContext job, String namedOutput, boolean alreadyDefined) {
validateOutputName(namedOutput);
List<String> definedChannels = getNamedOutputsList(job);
if(alreadyDefined && definedChannels.contains(namedOutput)) {
throw new IllegalArgumentException("Named output '" + namedOutput + "' already alreadyDefined");
} else if(!alreadyDefined && !definedChannels.contains(namedOutput)) {
throw new IllegalArgumentException("Named output '" + namedOutput + "' not defined");
}
} | java | private static void checkNamedOutputName(JobContext job, String namedOutput, boolean alreadyDefined) {
validateOutputName(namedOutput);
List<String> definedChannels = getNamedOutputsList(job);
if(alreadyDefined && definedChannels.contains(namedOutput)) {
throw new IllegalArgumentException("Named output '" + namedOutput + "' already alreadyDefined");
} else if(!alreadyDefined && !definedChannels.contains(namedOutput)) {
throw new IllegalArgumentException("Named output '" + namedOutput + "' not defined");
}
} | [
"private",
"static",
"void",
"checkNamedOutputName",
"(",
"JobContext",
"job",
",",
"String",
"namedOutput",
",",
"boolean",
"alreadyDefined",
")",
"{",
"validateOutputName",
"(",
"namedOutput",
")",
";",
"List",
"<",
"String",
">",
"definedChannels",
"=",
"getNam... | Checks if a named output name is valid.
@param namedOutput
named output Name
@throws IllegalArgumentException
if the output name is not valid. | [
"Checks",
"if",
"a",
"named",
"output",
"name",
"is",
"valid",
"."
] | train | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/output/PangoolMultipleOutputs.java#L134-L142 |
Impetus/Kundera | examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/AppRunner.java | AppRunner.onDestroyDBResources | private static void onDestroyDBResources(EntityManagerFactory emf,EntityManager em) {
if(emf != null)
{
emf.close();
}
if(em != null)
{
em.close();
}
} | java | private static void onDestroyDBResources(EntityManagerFactory emf,EntityManager em) {
if(emf != null)
{
emf.close();
}
if(em != null)
{
em.close();
}
} | [
"private",
"static",
"void",
"onDestroyDBResources",
"(",
"EntityManagerFactory",
"emf",
",",
"EntityManager",
"em",
")",
"{",
"if",
"(",
"emf",
"!=",
"null",
")",
"{",
"emf",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"em",
"!=",
"null",
")",
"{",
... | After successful processing close entity manager and it's factory instance.
@param emf entity manager factory instance.
@param em entity manager instance | [
"After",
"successful",
"processing",
"close",
"entity",
"manager",
"and",
"it",
"s",
"factory",
"instance",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/AppRunner.java#L119-L129 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/request/JmxWriteRequest.java | JmxWriteRequest.newCreator | static RequestCreator<JmxWriteRequest> newCreator() {
return new RequestCreator<JmxWriteRequest>() {
/** {@inheritDoc} */
public JmxWriteRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException {
return new JmxWriteRequest(
pStack.pop(), // object name
pStack.pop(), // attribute name
StringToObjectConverter.convertSpecialStringTags(pStack.pop()), // value
prepareExtraArgs(pStack), // path
pParams);
}
/** {@inheritDoc} */
public JmxWriteRequest create(Map<String, ?> requestMap, ProcessingParameters pParams)
throws MalformedObjectNameException {
return new JmxWriteRequest(requestMap,pParams);
}
};
} | java | static RequestCreator<JmxWriteRequest> newCreator() {
return new RequestCreator<JmxWriteRequest>() {
/** {@inheritDoc} */
public JmxWriteRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException {
return new JmxWriteRequest(
pStack.pop(), // object name
pStack.pop(), // attribute name
StringToObjectConverter.convertSpecialStringTags(pStack.pop()), // value
prepareExtraArgs(pStack), // path
pParams);
}
/** {@inheritDoc} */
public JmxWriteRequest create(Map<String, ?> requestMap, ProcessingParameters pParams)
throws MalformedObjectNameException {
return new JmxWriteRequest(requestMap,pParams);
}
};
} | [
"static",
"RequestCreator",
"<",
"JmxWriteRequest",
">",
"newCreator",
"(",
")",
"{",
"return",
"new",
"RequestCreator",
"<",
"JmxWriteRequest",
">",
"(",
")",
"{",
"/** {@inheritDoc} */",
"public",
"JmxWriteRequest",
"create",
"(",
"Stack",
"<",
"String",
">",
... | Creator for {@link JmxWriteRequest}s
@return the creator implementation | [
"Creator",
"for",
"{",
"@link",
"JmxWriteRequest",
"}",
"s"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/request/JmxWriteRequest.java#L123-L141 |
arxanchain/java-common | src/main/java/com/arxanfintech/common/crypto/core/ECIESCoder.java | ECIESCoder.encryptSimple | public static byte[] encryptSimple(ECPoint pub, byte[] plaintext) throws IOException, InvalidCipherTextException {
ArxanIESEngine iesEngine = new ArxanIESEngine(
new ECDHBasicAgreement(),
new MGF1BytesGeneratorExt(new SHA1Digest(), 1),
new HMac(new SHA1Digest()),
new SHA1Digest(),
null);
IESParameters p = new IESParameters(null, null, KEY_SIZE);
ParametersWithIV parametersWithIV = new ParametersWithIV(p, new byte[0]);
iesEngine.setHashMacKey(false);
ECKeyPairGenerator eGen = new ECKeyPairGenerator();
SecureRandom random = new SecureRandom();
KeyGenerationParameters gParam = new ECKeyGenerationParameters(CURVE, random);
eGen.init(gParam);
// AsymmetricCipherKeyPairGenerator testGen = new AsymmetricCipherKeyPairGenerator() {
// ECKey priv = ECKey.fromPrivate(Hex.decode("d0b043b4c5d657670778242d82d68a29d25d7d711127d17b8e299f156dad361a"));
//
// @Override
// public void init(KeyGenerationParameters keyGenerationParameters) {
// }
//
// @Override
// public AsymmetricCipherKeyPair generateKeyPair() {
// return new AsymmetricCipherKeyPair(new ECPublicKeyParameters(priv.getPubKeyPoint(), CURVE),
// new ECPrivateKeyParameters(priv.getPrivKey(), CURVE));
// }
// };
EphemeralKeyPairGenerator ephemeralKeyPairGenerator =
new EphemeralKeyPairGenerator(/*testGen*/eGen, new ECIESPublicKeyEncoder());
iesEngine.init(new ECPublicKeyParameters(pub, CURVE), parametersWithIV, ephemeralKeyPairGenerator);
return iesEngine.processBlock(plaintext, 0, plaintext.length);
} | java | public static byte[] encryptSimple(ECPoint pub, byte[] plaintext) throws IOException, InvalidCipherTextException {
ArxanIESEngine iesEngine = new ArxanIESEngine(
new ECDHBasicAgreement(),
new MGF1BytesGeneratorExt(new SHA1Digest(), 1),
new HMac(new SHA1Digest()),
new SHA1Digest(),
null);
IESParameters p = new IESParameters(null, null, KEY_SIZE);
ParametersWithIV parametersWithIV = new ParametersWithIV(p, new byte[0]);
iesEngine.setHashMacKey(false);
ECKeyPairGenerator eGen = new ECKeyPairGenerator();
SecureRandom random = new SecureRandom();
KeyGenerationParameters gParam = new ECKeyGenerationParameters(CURVE, random);
eGen.init(gParam);
// AsymmetricCipherKeyPairGenerator testGen = new AsymmetricCipherKeyPairGenerator() {
// ECKey priv = ECKey.fromPrivate(Hex.decode("d0b043b4c5d657670778242d82d68a29d25d7d711127d17b8e299f156dad361a"));
//
// @Override
// public void init(KeyGenerationParameters keyGenerationParameters) {
// }
//
// @Override
// public AsymmetricCipherKeyPair generateKeyPair() {
// return new AsymmetricCipherKeyPair(new ECPublicKeyParameters(priv.getPubKeyPoint(), CURVE),
// new ECPrivateKeyParameters(priv.getPrivKey(), CURVE));
// }
// };
EphemeralKeyPairGenerator ephemeralKeyPairGenerator =
new EphemeralKeyPairGenerator(/*testGen*/eGen, new ECIESPublicKeyEncoder());
iesEngine.init(new ECPublicKeyParameters(pub, CURVE), parametersWithIV, ephemeralKeyPairGenerator);
return iesEngine.processBlock(plaintext, 0, plaintext.length);
} | [
"public",
"static",
"byte",
"[",
"]",
"encryptSimple",
"(",
"ECPoint",
"pub",
",",
"byte",
"[",
"]",
"plaintext",
")",
"throws",
"IOException",
",",
"InvalidCipherTextException",
"{",
"ArxanIESEngine",
"iesEngine",
"=",
"new",
"ArxanIESEngine",
"(",
"new",
"ECDH... | Encryption equivalent to the Crypto++ default ECIES ECP settings:
DL_KeyAgreementAlgorithm: DL_KeyAgreementAlgorithm_DH struct ECPPoint,struct EnumToType enum CofactorMultiplicationOption,0
DL_KeyDerivationAlgorithm: DL_KeyDerivationAlgorithm_P1363 struct ECPPoint,0,class P1363_KDF2 class SHA1
DL_SymmetricEncryptionAlgorithm: DL_EncryptionAlgorithm_Xor class HMAC class SHA1,0
DL_PrivateKey: DL_Key ECPPoint
DL_PrivateKey_EC class ECP
Used for Whisper V3
@param pub
pub
@param plaintext
plaintext
@return byte[] encryptSimple
@throws IOException
IOException
@throws InvalidCipherTextException
InvalidCipherTextException | [
"Encryption",
"equivalent",
"to",
"the",
"Crypto",
"++",
"default",
"ECIES",
"ECP",
"settings",
":"
] | train | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECIESCoder.java#L195-L233 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/TextSimilarity.java | TextSimilarity.oliverSimilarity | public static double oliverSimilarity(String text1, String text2) {
preprocessDocument(text1);
preprocessDocument(text2);
String smallerDoc=text1;
String biggerDoc=text2;
if(text1.length()>text2.length()) {
smallerDoc=text2;
biggerDoc=text1;
}
double p=PHPSimilarText.similarityPercentage(smallerDoc, biggerDoc);
p/=100.0;
return p;
} | java | public static double oliverSimilarity(String text1, String text2) {
preprocessDocument(text1);
preprocessDocument(text2);
String smallerDoc=text1;
String biggerDoc=text2;
if(text1.length()>text2.length()) {
smallerDoc=text2;
biggerDoc=text1;
}
double p=PHPSimilarText.similarityPercentage(smallerDoc, biggerDoc);
p/=100.0;
return p;
} | [
"public",
"static",
"double",
"oliverSimilarity",
"(",
"String",
"text1",
",",
"String",
"text2",
")",
"{",
"preprocessDocument",
"(",
"text1",
")",
";",
"preprocessDocument",
"(",
"text2",
")",
";",
"String",
"smallerDoc",
"=",
"text1",
";",
"String",
"bigger... | This calculates the similarity between two strings as described in Programming
Classics: Implementing the World's Best Algorithms by Oliver (ISBN 0-131-00413-1).
@param text1
@param text2
@return | [
"This",
"calculates",
"the",
"similarity",
"between",
"two",
"strings",
"as",
"described",
"in",
"Programming",
"Classics",
":",
"Implementing",
"the",
"World",
"s",
"Best",
"Algorithms",
"by",
"Oliver",
"(",
"ISBN",
"0",
"-",
"131",
"-",
"00413",
"-",
"1",
... | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/TextSimilarity.java#L44-L59 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/autodiff/Tensor.java | Tensor.addTensor | public void addTensor(Tensor addend, int dim, int idx) {
checkSameAlgebra(this, addend);
DimIter yIter = new DimIter(addend.getDims());
while (yIter.hasNext()) {
int[] yIdx = yIter.next();
int[] xIdx = IntArrays.insertEntry(yIdx, dim, idx);
this.add(xIdx, addend.get(yIdx));
}
} | java | public void addTensor(Tensor addend, int dim, int idx) {
checkSameAlgebra(this, addend);
DimIter yIter = new DimIter(addend.getDims());
while (yIter.hasNext()) {
int[] yIdx = yIter.next();
int[] xIdx = IntArrays.insertEntry(yIdx, dim, idx);
this.add(xIdx, addend.get(yIdx));
}
} | [
"public",
"void",
"addTensor",
"(",
"Tensor",
"addend",
",",
"int",
"dim",
",",
"int",
"idx",
")",
"{",
"checkSameAlgebra",
"(",
"this",
",",
"addend",
")",
";",
"DimIter",
"yIter",
"=",
"new",
"DimIter",
"(",
"addend",
".",
"getDims",
"(",
")",
")",
... | Adds a smaller tensor to this one, inserting it at a specified dimension
and index. This can be thought of as selecting the sub-tensor of this tensor adding the
smaller tensor to it.
This is the larger tensor (i.e. the augend).
@param addend The smaller tensor (i.e. the addend)
@param dim The dimension which will be treated as fixed on the larger tensor.
@param idx The index at which that dimension will be fixed. | [
"Adds",
"a",
"smaller",
"tensor",
"to",
"this",
"one",
"inserting",
"it",
"at",
"a",
"specified",
"dimension",
"and",
"index",
".",
"This",
"can",
"be",
"thought",
"of",
"as",
"selecting",
"the",
"sub",
"-",
"tensor",
"of",
"this",
"tensor",
"adding",
"t... | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/autodiff/Tensor.java#L539-L547 |
GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java | MaterialPathAnimator.reverseAnimate | public static void reverseAnimate(Element sourceElement, Element targetElement, Functions.Func reverseCallback) {
MaterialPathAnimator animator = new MaterialPathAnimator();
animator.setSourceElement(sourceElement);
animator.setTargetElement(targetElement);
animator.setReverseCallback(reverseCallback);
animator.reverseAnimate();
} | java | public static void reverseAnimate(Element sourceElement, Element targetElement, Functions.Func reverseCallback) {
MaterialPathAnimator animator = new MaterialPathAnimator();
animator.setSourceElement(sourceElement);
animator.setTargetElement(targetElement);
animator.setReverseCallback(reverseCallback);
animator.reverseAnimate();
} | [
"public",
"static",
"void",
"reverseAnimate",
"(",
"Element",
"sourceElement",
",",
"Element",
"targetElement",
",",
"Functions",
".",
"Func",
"reverseCallback",
")",
"{",
"MaterialPathAnimator",
"animator",
"=",
"new",
"MaterialPathAnimator",
"(",
")",
";",
"animat... | Helper method to reverse animate the source element to target element with reverse callback
@param sourceElement Source element to apply the Path Animator
@param targetElement Target element to apply the Path Animator
@param reverseCallback The reverse callback method to be called when the path animator is applied | [
"Helper",
"method",
"to",
"reverse",
"animate",
"the",
"source",
"element",
"to",
"target",
"element",
"with",
"reverse",
"callback"
] | train | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L245-L251 |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/AgreementRestEntity.java | AgreementRestEntity.createAgreement | @POST
public Response createAgreement(@Context UriInfo uriInfo, AgreementParam agrementParam) throws NotFoundException, ConflictException, InternalException{
logger.debug("StartOf createAgreement - Insert /agreements");
String id, location = null;
try{
AgreementHelperE agreementRestHelper = getAgreementHelper();
id = agreementRestHelper.createAgreement(agrementParam.getAgreement(), agrementParam.getOriginalSerialzedAgreement());
location = buildResourceLocation(uriInfo.getAbsolutePath().toString() ,id);
logger.debug("EndOf createAgreement");
} catch (DBMissingHelperException e) {
logger.info("createAgreement ConflictException"+ e.getMessage());
throw new ConflictException(e.getMessage());
} catch (DBExistsHelperException e) {
logger.info("createAgreement ConflictException"+ e.getMessage());
throw new ConflictException(e.getMessage());
} catch (InternalHelperException e) {
logger.info("createAgreement InternalException", e);
throw new InternalException(e.getMessage());
} catch (ParserHelperException e) {
logger.info("createAgreement InternalException", e);
throw new InternalException(e.getMessage());
}
logger.debug("EndOf createAgreement");
return buildResponsePOST(
HttpStatus.CREATED,
createMessage(HttpStatus.CREATED, id,
"The agreement has been stored successfully in the SLA Repository Database. It has location "+location), location);
} | java | @POST
public Response createAgreement(@Context UriInfo uriInfo, AgreementParam agrementParam) throws NotFoundException, ConflictException, InternalException{
logger.debug("StartOf createAgreement - Insert /agreements");
String id, location = null;
try{
AgreementHelperE agreementRestHelper = getAgreementHelper();
id = agreementRestHelper.createAgreement(agrementParam.getAgreement(), agrementParam.getOriginalSerialzedAgreement());
location = buildResourceLocation(uriInfo.getAbsolutePath().toString() ,id);
logger.debug("EndOf createAgreement");
} catch (DBMissingHelperException e) {
logger.info("createAgreement ConflictException"+ e.getMessage());
throw new ConflictException(e.getMessage());
} catch (DBExistsHelperException e) {
logger.info("createAgreement ConflictException"+ e.getMessage());
throw new ConflictException(e.getMessage());
} catch (InternalHelperException e) {
logger.info("createAgreement InternalException", e);
throw new InternalException(e.getMessage());
} catch (ParserHelperException e) {
logger.info("createAgreement InternalException", e);
throw new InternalException(e.getMessage());
}
logger.debug("EndOf createAgreement");
return buildResponsePOST(
HttpStatus.CREATED,
createMessage(HttpStatus.CREATED, id,
"The agreement has been stored successfully in the SLA Repository Database. It has location "+location), location);
} | [
"@",
"POST",
"public",
"Response",
"createAgreement",
"(",
"@",
"Context",
"UriInfo",
"uriInfo",
",",
"AgreementParam",
"agrementParam",
")",
"throws",
"NotFoundException",
",",
"ConflictException",
",",
"InternalException",
"{",
"logger",
".",
"debug",
"(",
"\"Star... | Creates a new agreement
<pre>
POST /agreements
Request:
POST /agreements HTTP/1.1
Accept: application/xml
Response:
HTTP/1.1 201 Created
Content-type: application/xml
Location: http://.../agreements/$uuid
{@code
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message code="201" message= "The agreement has been stored successfully in the SLA Repository Database"/>
}
</pre>
Example:
<li>curl -H "Content-type: application/xml" -d@agreement02.xml
localhost:8080/sla-service/agreements -X POST</li>
@return XML information with the different details of the agreement
@throws NotFoundException
@throws ConflictException
@throws InternalException | [
"Creates",
"a",
"new",
"agreement"
] | train | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/AgreementRestEntity.java#L311-L338 |
ludovicianul/selenium-on-steroids | src/main/java/com/insidecoding/sos/io/FileUtils.java | FileUtils.getNumberOfRows | public int getNumberOfRows(final String fileName, final String sheetName)
throws IOException {
LOG.info("Getting the number of rows from:" + fileName + " sheet: "
+ sheetName);
Workbook workbook = getWorkbook(fileName);
Sheet sheets = workbook.getSheet(sheetName);
return sheets.getPhysicalNumberOfRows();
} | java | public int getNumberOfRows(final String fileName, final String sheetName)
throws IOException {
LOG.info("Getting the number of rows from:" + fileName + " sheet: "
+ sheetName);
Workbook workbook = getWorkbook(fileName);
Sheet sheets = workbook.getSheet(sheetName);
return sheets.getPhysicalNumberOfRows();
} | [
"public",
"int",
"getNumberOfRows",
"(",
"final",
"String",
"fileName",
",",
"final",
"String",
"sheetName",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"\"Getting the number of rows from:\"",
"+",
"fileName",
"+",
"\" sheet: \"",
"+",
"sheetName",
... | Gets the number of rows populated within the supplied file and sheet
name.
@param fileName
the name of the file
@param sheetName
the sheet name
@return the number of rows
@throws IOException
if something goes wrong while reading the file | [
"Gets",
"the",
"number",
"of",
"rows",
"populated",
"within",
"the",
"supplied",
"file",
"and",
"sheet",
"name",
"."
] | train | https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/io/FileUtils.java#L490-L497 |
liferay/com-liferay-commerce | commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java | CommerceWishListItemPersistenceImpl.findAll | @Override
public List<CommerceWishListItem> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceWishListItem> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceWishListItem",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce wish list items.
@return the commerce wish list items | [
"Returns",
"all",
"the",
"commerce",
"wish",
"list",
"items",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java#L3834-L3837 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java | LongExtensions.operator_lessEqualsThan | @Pure
@Inline(value="($1 <= $2)", constantExpression=true)
public static boolean operator_lessEqualsThan(long a, double b) {
return a <= b;
} | java | @Pure
@Inline(value="($1 <= $2)", constantExpression=true)
public static boolean operator_lessEqualsThan(long a, double b) {
return a <= b;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"($1 <= $2)\"",
",",
"constantExpression",
"=",
"true",
")",
"public",
"static",
"boolean",
"operator_lessEqualsThan",
"(",
"long",
"a",
",",
"double",
"b",
")",
"{",
"return",
"a",
"<=",
"b",
";",
"}"
] | The binary <code>lessEqualsThan</code> operator. This is the equivalent to the Java <code><=</code> operator.
@param a a long.
@param b a double.
@return <code>a<=b</code>
@since 2.3 | [
"The",
"binary",
"<code",
">",
"lessEqualsThan<",
"/",
"code",
">",
"operator",
".",
"This",
"is",
"the",
"equivalent",
"to",
"the",
"Java",
"<code",
">",
"<",
";",
"=",
"<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java#L334-L338 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/RoundedColorDrawable.java | RoundedColorDrawable.setBorder | @Override
public void setBorder(int color, float width) {
if (mBorderColor != color) {
mBorderColor = color;
invalidateSelf();
}
if (mBorderWidth != width) {
mBorderWidth = width;
updatePath();
invalidateSelf();
}
} | java | @Override
public void setBorder(int color, float width) {
if (mBorderColor != color) {
mBorderColor = color;
invalidateSelf();
}
if (mBorderWidth != width) {
mBorderWidth = width;
updatePath();
invalidateSelf();
}
} | [
"@",
"Override",
"public",
"void",
"setBorder",
"(",
"int",
"color",
",",
"float",
"width",
")",
"{",
"if",
"(",
"mBorderColor",
"!=",
"color",
")",
"{",
"mBorderColor",
"=",
"color",
";",
"invalidateSelf",
"(",
")",
";",
"}",
"if",
"(",
"mBorderWidth",
... | Sets the border
@param color of the border
@param width of the border | [
"Sets",
"the",
"border"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/RoundedColorDrawable.java#L184-L196 |
yestech/yesepisodic | src/main/java/org/yestech/episodic/DefaultEpisodicService.java | DefaultEpisodicService.generateSignature | protected String generateSignature(String secret, Map<String, String> map) {
return sha256Hex(buildSignatureString(secret, map));
} | java | protected String generateSignature(String secret, Map<String, String> map) {
return sha256Hex(buildSignatureString(secret, map));
} | [
"protected",
"String",
"generateSignature",
"(",
"String",
"secret",
",",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"return",
"sha256Hex",
"(",
"buildSignatureString",
"(",
"secret",
",",
"map",
")",
")",
";",
"}"
] | Generates a signature with the algorithm specified by episodic:
<p/>
API Signature Generation
<ol>
<li> All API requests must include a signature parameter. The signature is generated performing the following steps.
<li> Concatenate all query parameters except the API Key in the format "name=value" in alphabetical order by parameter name. There should not be an ampersand or any separator between "name=value" pairs.
<li> Append the string from step 1 to the Secret Key so that you have [Secret Key][String from step 1] (ex. 77c062e551279b0a0b8bc69f9709f33bexpires=1229046347show_id=13).
<li>Generate the SHA-256 hash value for the string resulting from steps 1 and 2.
<ol>
@param secret The secret key provided by episodic.
@param map A map of the parameters to be sent to.
@return The signature needed for an episodic request. | [
"Generates",
"a",
"signature",
"with",
"the",
"algorithm",
"specified",
"by",
"episodic",
":",
"<p",
"/",
">",
"API",
"Signature",
"Generation",
"<ol",
">",
"<li",
">",
"All",
"API",
"requests",
"must",
"include",
"a",
"signature",
"parameter",
".",
"The",
... | train | https://github.com/yestech/yesepisodic/blob/ed9699443871a44d51e149f32769b4d84cded63d/src/main/java/org/yestech/episodic/DefaultEpisodicService.java#L276-L278 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/dataconversion/EncodingUtils.java | EncodingUtils.fromStorage | public static Object fromStorage(Object stored, Encoder encoder, Wrapper wrapper) {
if (encoder == null || wrapper == null) {
throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!");
}
if (stored == null) return null;
return encoder.fromStorage(wrapper.unwrap(stored));
} | java | public static Object fromStorage(Object stored, Encoder encoder, Wrapper wrapper) {
if (encoder == null || wrapper == null) {
throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!");
}
if (stored == null) return null;
return encoder.fromStorage(wrapper.unwrap(stored));
} | [
"public",
"static",
"Object",
"fromStorage",
"(",
"Object",
"stored",
",",
"Encoder",
"encoder",
",",
"Wrapper",
"wrapper",
")",
"{",
"if",
"(",
"encoder",
"==",
"null",
"||",
"wrapper",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"("... | Decode object from storage format.
@param stored Object in the storage format.
@param encoder the {@link Encoder} used for data conversion.
@param wrapper the {@link Wrapper} used to decorate the converted data.
@return Object decoded and unwrapped. | [
"Decode",
"object",
"from",
"storage",
"format",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/dataconversion/EncodingUtils.java#L22-L28 |
skyscreamer/JSONassert | src/main/java/org/skyscreamer/jsonassert/JSONAssert.java | JSONAssert.assertEquals | public static void assertEquals(JSONArray expected, JSONArray actual, JSONCompareMode compareMode)
throws JSONException {
assertEquals("", expected, actual, compareMode);
} | java | public static void assertEquals(JSONArray expected, JSONArray actual, JSONCompareMode compareMode)
throws JSONException {
assertEquals("", expected, actual, compareMode);
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"JSONArray",
"expected",
",",
"JSONArray",
"actual",
",",
"JSONCompareMode",
"compareMode",
")",
"throws",
"JSONException",
"{",
"assertEquals",
"(",
"\"\"",
",",
"expected",
",",
"actual",
",",
"compareMode",
")",
... | Asserts that the JSONArray provided matches the expected JSONArray. If it isn't it throws an
{@link AssertionError}.
@param expected Expected JSONArray
@param actual JSONArray to compare
@param compareMode Specifies which comparison mode to use
@throws JSONException JSON parsing error | [
"Asserts",
"that",
"the",
"JSONArray",
"provided",
"matches",
"the",
"expected",
"JSONArray",
".",
"If",
"it",
"isn",
"t",
"it",
"throws",
"an",
"{",
"@link",
"AssertionError",
"}",
"."
] | train | https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L707-L710 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.stateIsTrue | @Throws(IllegalStateOfArgumentException.class)
public static void stateIsTrue(final boolean expression, @Nonnull final String description) {
if (!expression) {
throw new IllegalStateOfArgumentException(description);
}
} | java | @Throws(IllegalStateOfArgumentException.class)
public static void stateIsTrue(final boolean expression, @Nonnull final String description) {
if (!expression) {
throw new IllegalStateOfArgumentException(description);
}
} | [
"@",
"Throws",
"(",
"IllegalStateOfArgumentException",
".",
"class",
")",
"public",
"static",
"void",
"stateIsTrue",
"(",
"final",
"boolean",
"expression",
",",
"@",
"Nonnull",
"final",
"String",
"description",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",... | Ensures that a given state is {@code true}.
@param expression
an expression that must be {@code true} to indicate a valid state
@param description
will be used in the error message to describe why the arguments caused an invalid state
@throws IllegalStateOfArgumentException
if the given arguments caused an invalid state | [
"Ensures",
"that",
"a",
"given",
"state",
"is",
"{",
"@code",
"true",
"}",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L3308-L3313 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java | LabAccountsInner.updateAsync | public Observable<LabAccountInner> updateAsync(String resourceGroupName, String labAccountName, LabAccountFragment labAccount) {
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labAccount).map(new Func1<ServiceResponse<LabAccountInner>, LabAccountInner>() {
@Override
public LabAccountInner call(ServiceResponse<LabAccountInner> response) {
return response.body();
}
});
} | java | public Observable<LabAccountInner> updateAsync(String resourceGroupName, String labAccountName, LabAccountFragment labAccount) {
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labAccount).map(new Func1<ServiceResponse<LabAccountInner>, LabAccountInner>() {
@Override
public LabAccountInner call(ServiceResponse<LabAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LabAccountInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"LabAccountFragment",
"labAccount",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccou... | Modify properties of lab accounts.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labAccount Represents a lab account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LabAccountInner object | [
"Modify",
"properties",
"of",
"lab",
"accounts",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java#L1052-L1059 |
zaproxy/zaproxy | src/org/apache/commons/httpclient/HttpMethodBase.java | HttpMethodBase.addRequestHeaders | protected void addRequestHeaders(HttpState state, HttpConnection conn)
throws IOException, HttpException {
LOG.trace("enter HttpMethodBase.addRequestHeaders(HttpState, "
+ "HttpConnection)");
addHostRequestHeader(state, conn);
addCookieRequestHeader(state, conn);
addProxyConnectionHeader(state, conn);
} | java | protected void addRequestHeaders(HttpState state, HttpConnection conn)
throws IOException, HttpException {
LOG.trace("enter HttpMethodBase.addRequestHeaders(HttpState, "
+ "HttpConnection)");
addHostRequestHeader(state, conn);
addCookieRequestHeader(state, conn);
addProxyConnectionHeader(state, conn);
} | [
"protected",
"void",
"addRequestHeaders",
"(",
"HttpState",
"state",
",",
"HttpConnection",
"conn",
")",
"throws",
"IOException",
",",
"HttpException",
"{",
"LOG",
".",
"trace",
"(",
"\"enter HttpMethodBase.addRequestHeaders(HttpState, \"",
"+",
"\"HttpConnection)\"",
")"... | Generates all the required request {@link Header header}s
to be submitted via the given {@link HttpConnection connection}.
<p>
This implementation adds <tt>User-Agent</tt>, <tt>Host</tt>,
<tt>Cookie</tt>, <tt>Authorization</tt>, <tt>Proxy-Authorization</tt>
and <tt>Proxy-Connection</tt> headers, when appropriate.
</p>
<p>
Subclasses may want to override this method to to add additional
headers, and may choose to invoke this implementation (via
<tt>super</tt>) to add the "standard" headers.
</p>
@param state the {@link HttpState state} information associated with this method
@param conn the {@link HttpConnection connection} used to execute
this HTTP method
@throws IOException if an I/O (transport) error occurs. Some transport exceptions
can be recovered from.
@throws HttpException if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.
@see #writeRequestHeaders | [
"Generates",
"all",
"the",
"required",
"request",
"{",
"@link",
"Header",
"header",
"}",
"s",
"to",
"be",
"submitted",
"via",
"the",
"given",
"{",
"@link",
"HttpConnection",
"connection",
"}",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/HttpMethodBase.java#L1550-L1558 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/products/SwapAnnuity.java | SwapAnnuity.getSwapAnnuity | public static double getSwapAnnuity(Schedule schedule, DiscountCurve discountCurve) {
double evaluationTime = 0.0; // Consider only payment time > 0
return getSwapAnnuity(evaluationTime, schedule, discountCurve, null);
} | java | public static double getSwapAnnuity(Schedule schedule, DiscountCurve discountCurve) {
double evaluationTime = 0.0; // Consider only payment time > 0
return getSwapAnnuity(evaluationTime, schedule, discountCurve, null);
} | [
"public",
"static",
"double",
"getSwapAnnuity",
"(",
"Schedule",
"schedule",
",",
"DiscountCurve",
"discountCurve",
")",
"{",
"double",
"evaluationTime",
"=",
"0.0",
";",
"// Consider only payment time > 0",
"return",
"getSwapAnnuity",
"(",
"evaluationTime",
",",
"sched... | Function to calculate an (idealized) swap annuity for a given schedule and discount curve.
Note: This method will consider evaluationTime being 0, see {@link net.finmath.marketdata.products.SwapAnnuity#getSwapAnnuity(double, Schedule, DiscountCurve, AnalyticModel)}.
@param schedule The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period.
@param discountCurve The discount curve.
@return The swap annuity. | [
"Function",
"to",
"calculate",
"an",
"(",
"idealized",
")",
"swap",
"annuity",
"for",
"a",
"given",
"schedule",
"and",
"discount",
"curve",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/products/SwapAnnuity.java#L83-L86 |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/AbstractJaxbMojo.java | AbstractJaxbMojo.getEpisodeFile | protected File getEpisodeFile(final String episodeFileName) throws MojoExecutionException {
// Get the execution ID
final String executionID = getExecution() != null && getExecution().getExecutionId() != null
? getExecution().getExecutionId()
: null;
final String effectiveEpisodeFileName = episodeFileName == null
? (executionID == null ? STANDARD_EPISODE_FILENAME : "episode_" + executionID)
: episodeFileName;
if (effectiveEpisodeFileName.isEmpty()) {
throw new MojoExecutionException("Cannot handle null or empty JAXB Episode filename. "
+ "Check 'episodeFileName' configuration property.");
}
// Find or create the episode directory.
final Path episodePath;
final File generatedJaxbEpisodeDirectory;
try {
final Path path = Paths.get(getOutputDirectory().getAbsolutePath(), "META-INF", "JAXB");
episodePath = java.nio.file.Files.createDirectories(path);
generatedJaxbEpisodeDirectory = episodePath.toFile();
if (getLog().isInfoEnabled()) {
getLog().info("Created EpisodePath [" + episodePath.toString() + "]: " +
(generatedJaxbEpisodeDirectory.exists() && generatedJaxbEpisodeDirectory.isDirectory()));
}
} catch (IOException e) {
throw new MojoExecutionException("Could not create output directory.", e);
}
if (!generatedJaxbEpisodeDirectory.exists() || !generatedJaxbEpisodeDirectory.isDirectory()) {
throw new MojoExecutionException("Could not create directory [" + episodePath.toString() + "]");
}
// Is there already an episode file here?
File episodeFile = new File(generatedJaxbEpisodeDirectory, effectiveEpisodeFileName + ".xjb");
final AtomicInteger index = new AtomicInteger(1);
while (episodeFile.exists()) {
episodeFile = new File(generatedJaxbEpisodeDirectory,
effectiveEpisodeFileName + "_" + index.getAndIncrement() + ".xjb");
}
// Add the (generated) outputDirectory to the Resources.
final Resource outputDirectoryResource = new Resource();
outputDirectoryResource.setDirectory(getOutputDirectory().getAbsolutePath());
outputDirectoryResource.setIncludes(Collections.singletonList("**/" + episodeFile.getName()));
this.addResource(outputDirectoryResource);
// All Done.
return episodeFile;
} | java | protected File getEpisodeFile(final String episodeFileName) throws MojoExecutionException {
// Get the execution ID
final String executionID = getExecution() != null && getExecution().getExecutionId() != null
? getExecution().getExecutionId()
: null;
final String effectiveEpisodeFileName = episodeFileName == null
? (executionID == null ? STANDARD_EPISODE_FILENAME : "episode_" + executionID)
: episodeFileName;
if (effectiveEpisodeFileName.isEmpty()) {
throw new MojoExecutionException("Cannot handle null or empty JAXB Episode filename. "
+ "Check 'episodeFileName' configuration property.");
}
// Find or create the episode directory.
final Path episodePath;
final File generatedJaxbEpisodeDirectory;
try {
final Path path = Paths.get(getOutputDirectory().getAbsolutePath(), "META-INF", "JAXB");
episodePath = java.nio.file.Files.createDirectories(path);
generatedJaxbEpisodeDirectory = episodePath.toFile();
if (getLog().isInfoEnabled()) {
getLog().info("Created EpisodePath [" + episodePath.toString() + "]: " +
(generatedJaxbEpisodeDirectory.exists() && generatedJaxbEpisodeDirectory.isDirectory()));
}
} catch (IOException e) {
throw new MojoExecutionException("Could not create output directory.", e);
}
if (!generatedJaxbEpisodeDirectory.exists() || !generatedJaxbEpisodeDirectory.isDirectory()) {
throw new MojoExecutionException("Could not create directory [" + episodePath.toString() + "]");
}
// Is there already an episode file here?
File episodeFile = new File(generatedJaxbEpisodeDirectory, effectiveEpisodeFileName + ".xjb");
final AtomicInteger index = new AtomicInteger(1);
while (episodeFile.exists()) {
episodeFile = new File(generatedJaxbEpisodeDirectory,
effectiveEpisodeFileName + "_" + index.getAndIncrement() + ".xjb");
}
// Add the (generated) outputDirectory to the Resources.
final Resource outputDirectoryResource = new Resource();
outputDirectoryResource.setDirectory(getOutputDirectory().getAbsolutePath());
outputDirectoryResource.setIncludes(Collections.singletonList("**/" + episodeFile.getName()));
this.addResource(outputDirectoryResource);
// All Done.
return episodeFile;
} | [
"protected",
"File",
"getEpisodeFile",
"(",
"final",
"String",
"episodeFileName",
")",
"throws",
"MojoExecutionException",
"{",
"// Get the execution ID",
"final",
"String",
"executionID",
"=",
"getExecution",
"(",
")",
"!=",
"null",
"&&",
"getExecution",
"(",
")",
... | Retrieves a File to the JAXB Episode (which is normally written during the XJC process).
Moreover, ensures that the parent directory of that File is created, to enable writing the File.
@param episodeFileName {@code null} to indicate that the standard episode file name ("sun-jaxb.episode")
should be used, and otherwise a non-empty name which should be used
as the episode file name.
@return A non-null File where the JAXB episode file should be written.
@throws MojoExecutionException if the parent directory of the episode file could not be created. | [
"Retrieves",
"a",
"File",
"to",
"the",
"JAXB",
"Episode",
"(",
"which",
"is",
"normally",
"written",
"during",
"the",
"XJC",
"process",
")",
".",
"Moreover",
"ensures",
"that",
"the",
"parent",
"directory",
"of",
"that",
"File",
"is",
"created",
"to",
"ena... | train | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/AbstractJaxbMojo.java#L522-L574 |
bramp/unsafe | unsafe-unroller/src/main/java/net/bramp/unsafe/UnrolledUnsafeCopierBuilder.java | UnrolledUnsafeCopierBuilder.build | public UnsafeCopier build(Unsafe unsafe)
throws IllegalAccessException, InstantiationException, NoSuchMethodException,
InvocationTargetException {
checkArgument(offset >= 0, "Offset must be set");
checkArgument(length >= 0, "Length must be set");
checkNotNull(unsafe);
Class<?> dynamicType = new ByteBuddy()
.subclass(UnsafeCopier.class)
.method(named("copy"))
.intercept(new CopierImplementation(offset, length)).make()
.load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER)
.getLoaded();
return (UnsafeCopier) dynamicType.getDeclaredConstructor(Unsafe.class).newInstance(unsafe);
} | java | public UnsafeCopier build(Unsafe unsafe)
throws IllegalAccessException, InstantiationException, NoSuchMethodException,
InvocationTargetException {
checkArgument(offset >= 0, "Offset must be set");
checkArgument(length >= 0, "Length must be set");
checkNotNull(unsafe);
Class<?> dynamicType = new ByteBuddy()
.subclass(UnsafeCopier.class)
.method(named("copy"))
.intercept(new CopierImplementation(offset, length)).make()
.load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER)
.getLoaded();
return (UnsafeCopier) dynamicType.getDeclaredConstructor(Unsafe.class).newInstance(unsafe);
} | [
"public",
"UnsafeCopier",
"build",
"(",
"Unsafe",
"unsafe",
")",
"throws",
"IllegalAccessException",
",",
"InstantiationException",
",",
"NoSuchMethodException",
",",
"InvocationTargetException",
"{",
"checkArgument",
"(",
"offset",
">=",
"0",
",",
"\"Offset must be set\"... | Constructs a new Copier using the passed in Unsafe instance
@param unsafe The sun.misc.Unsafe instance this copier uses
@return The new UnsageCopier built with the specific parameters
@throws IllegalAccessException
@throws InstantiationException
@throws NoSuchMethodException
@throws InvocationTargetException
@throws IllegalArgumentException if any argument is invalid | [
"Constructs",
"a",
"new",
"Copier",
"using",
"the",
"passed",
"in",
"Unsafe",
"instance"
] | train | https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-unroller/src/main/java/net/bramp/unsafe/UnrolledUnsafeCopierBuilder.java#L76-L92 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java | CrossTabColorShema.setColorForTotal | public void setColorForTotal(int row, int column, Color color){
int mapC = (colors.length-1) - column;
int mapR = (colors[0].length-1) - row;
colors[mapC][mapR]=color;
} | java | public void setColorForTotal(int row, int column, Color color){
int mapC = (colors.length-1) - column;
int mapR = (colors[0].length-1) - row;
colors[mapC][mapR]=color;
} | [
"public",
"void",
"setColorForTotal",
"(",
"int",
"row",
",",
"int",
"column",
",",
"Color",
"color",
")",
"{",
"int",
"mapC",
"=",
"(",
"colors",
".",
"length",
"-",
"1",
")",
"-",
"column",
";",
"int",
"mapR",
"=",
"(",
"colors",
"[",
"0",
"]",
... | Sets the color for the big total between the column and row
@param row row index (starting from 1)
@param column column index (starting from 1)
@param color | [
"Sets",
"the",
"color",
"for",
"the",
"big",
"total",
"between",
"the",
"column",
"and",
"row"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java#L103-L107 |
EdwardRaff/JSAT | JSAT/src/jsat/datatransform/WhitenedPCA.java | WhitenedPCA.getSVD | private SingularValueDecomposition getSVD(DataSet dataSet)
{
Matrix cov = covarianceMatrix(meanVector(dataSet), dataSet);
for(int i = 0; i < cov.rows(); i++)//force it to be symmetric
for(int j = 0; j < i; j++)
cov.set(j, i, cov.get(i, j));
EigenValueDecomposition evd = new EigenValueDecomposition(cov);
//Sort form largest to smallest
evd.sortByEigenValue(new Comparator<Double>()
{
@Override
public int compare(Double o1, Double o2)
{
return -Double.compare(o1, o2);
}
});
return new SingularValueDecomposition(evd.getVRaw(), evd.getVRaw(), evd.getRealEigenvalues());
} | java | private SingularValueDecomposition getSVD(DataSet dataSet)
{
Matrix cov = covarianceMatrix(meanVector(dataSet), dataSet);
for(int i = 0; i < cov.rows(); i++)//force it to be symmetric
for(int j = 0; j < i; j++)
cov.set(j, i, cov.get(i, j));
EigenValueDecomposition evd = new EigenValueDecomposition(cov);
//Sort form largest to smallest
evd.sortByEigenValue(new Comparator<Double>()
{
@Override
public int compare(Double o1, Double o2)
{
return -Double.compare(o1, o2);
}
});
return new SingularValueDecomposition(evd.getVRaw(), evd.getVRaw(), evd.getRealEigenvalues());
} | [
"private",
"SingularValueDecomposition",
"getSVD",
"(",
"DataSet",
"dataSet",
")",
"{",
"Matrix",
"cov",
"=",
"covarianceMatrix",
"(",
"meanVector",
"(",
"dataSet",
")",
",",
"dataSet",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cov",
".... | Gets a SVD for the covariance matrix of the data set
@param dataSet the data set in question
@return the SVD for the covariance | [
"Gets",
"a",
"SVD",
"for",
"the",
"covariance",
"matrix",
"of",
"the",
"data",
"set"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/WhitenedPCA.java#L159-L176 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.getSensitiveWordList | public SensitiveWordListResult getSensitiveWordList(int start, int count)
throws APIConnectionException, APIRequestException {
return _sensitiveWordClient.getSensitiveWordList(start, count);
} | java | public SensitiveWordListResult getSensitiveWordList(int start, int count)
throws APIConnectionException, APIRequestException {
return _sensitiveWordClient.getSensitiveWordList(start, count);
} | [
"public",
"SensitiveWordListResult",
"getSensitiveWordList",
"(",
"int",
"start",
",",
"int",
"count",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_sensitiveWordClient",
".",
"getSensitiveWordList",
"(",
"start",
",",
"count",
")... | Get sensitive word list
@param start the begin of the list
@param count the count of the list
@return SensitiveWordListResult
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"sensitive",
"word",
"list"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L745-L748 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java | AppServiceCertificateOrdersInner.getCertificate | public AppServiceCertificateResourceInner getCertificate(String resourceGroupName, String certificateOrderName, String name) {
return getCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name).toBlocking().single().body();
} | java | public AppServiceCertificateResourceInner getCertificate(String resourceGroupName, String certificateOrderName, String name) {
return getCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name).toBlocking().single().body();
} | [
"public",
"AppServiceCertificateResourceInner",
"getCertificate",
"(",
"String",
"resourceGroupName",
",",
"String",
"certificateOrderName",
",",
"String",
"name",
")",
"{",
"return",
"getCertificateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"certificateOrderName... | Get the certificate associated with a certificate order.
Get the certificate associated with a certificate order.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param certificateOrderName Name of the certificate order.
@param name Name of the certificate.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppServiceCertificateResourceInner object if successful. | [
"Get",
"the",
"certificate",
"associated",
"with",
"a",
"certificate",
"order",
".",
"Get",
"the",
"certificate",
"associated",
"with",
"a",
"certificate",
"order",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1091-L1093 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java | OpenShiftManagedClustersInner.beginUpdateTags | public OpenShiftManagedClusterInner beginUpdateTags(String resourceGroupName, String resourceName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | java | public OpenShiftManagedClusterInner beginUpdateTags(String resourceGroupName, String resourceName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | [
"public",
"OpenShiftManagedClusterInner",
"beginUpdateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"beginUpdateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"toBlocking",
"(",
")",
... | Updates tags on an OpenShift managed cluster.
Updates an OpenShift managed cluster with the specified tags.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the OpenShift managed cluster resource.
@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 OpenShiftManagedClusterInner object if successful. | [
"Updates",
"tags",
"on",
"an",
"OpenShift",
"managed",
"cluster",
".",
"Updates",
"an",
"OpenShift",
"managed",
"cluster",
"with",
"the",
"specified",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java#L770-L772 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/ssl/SSLHandlerFactory.java | SSLHandlerFactory.buildClientSSLEngine | public SSLEngine buildClientSSLEngine(String host, int port) {
SSLEngine engine = sslContext.createSSLEngine(host, port);
engine.setUseClientMode(true);
return addCommonConfigs(engine);
} | java | public SSLEngine buildClientSSLEngine(String host, int port) {
SSLEngine engine = sslContext.createSSLEngine(host, port);
engine.setUseClientMode(true);
return addCommonConfigs(engine);
} | [
"public",
"SSLEngine",
"buildClientSSLEngine",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"SSLEngine",
"engine",
"=",
"sslContext",
".",
"createSSLEngine",
"(",
"host",
",",
"port",
")",
";",
"engine",
".",
"setUseClientMode",
"(",
"true",
")",
";"... | Build ssl engine for client side.
@param host peer host
@param port peer port
@return client ssl engine | [
"Build",
"ssl",
"engine",
"for",
"client",
"side",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/ssl/SSLHandlerFactory.java#L217-L221 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java | XpathUtils.asNode | public static Node asNode(String nodeName, Node node, XPath xpath)
throws XPathExpressionException {
if (node == null) return null;
return (Node) xpath.evaluate(nodeName, node, XPathConstants.NODE);
} | java | public static Node asNode(String nodeName, Node node, XPath xpath)
throws XPathExpressionException {
if (node == null) return null;
return (Node) xpath.evaluate(nodeName, node, XPathConstants.NODE);
} | [
"public",
"static",
"Node",
"asNode",
"(",
"String",
"nodeName",
",",
"Node",
"node",
",",
"XPath",
"xpath",
")",
"throws",
"XPathExpressionException",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"Node",
")",
"xpath",
... | Same as {@link #asNode(String, Node)} but allows an xpath to be
passed in explicitly for reuse. | [
"Same",
"as",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L552-L556 |
jbundle/jbundle | base/message/service/src/main/java/org/jbundle/base/message/service/BaseServiceMessageTransport.java | BaseServiceMessageTransport.createExternalMessage | public ExternalMessage createExternalMessage(BaseMessage message, Object rawData)
{
ExternalMessage externalTrxMessageOut = super.createExternalMessage(message, rawData);
if (externalTrxMessageOut == null)
{
if (MessageTypeModel.MESSAGE_IN.equalsIgnoreCase((String)message.get(TrxMessageHeader.MESSAGE_PROCESS_TYPE)))
externalTrxMessageOut = new ServiceTrxMessageIn(message, rawData);
else
externalTrxMessageOut = new ServiceTrxMessageOut(message, rawData);
}
return externalTrxMessageOut;
} | java | public ExternalMessage createExternalMessage(BaseMessage message, Object rawData)
{
ExternalMessage externalTrxMessageOut = super.createExternalMessage(message, rawData);
if (externalTrxMessageOut == null)
{
if (MessageTypeModel.MESSAGE_IN.equalsIgnoreCase((String)message.get(TrxMessageHeader.MESSAGE_PROCESS_TYPE)))
externalTrxMessageOut = new ServiceTrxMessageIn(message, rawData);
else
externalTrxMessageOut = new ServiceTrxMessageOut(message, rawData);
}
return externalTrxMessageOut;
} | [
"public",
"ExternalMessage",
"createExternalMessage",
"(",
"BaseMessage",
"message",
",",
"Object",
"rawData",
")",
"{",
"ExternalMessage",
"externalTrxMessageOut",
"=",
"super",
".",
"createExternalMessage",
"(",
"message",
",",
"rawData",
")",
";",
"if",
"(",
"ext... | Get the external message container for this Internal message.
Typically, the overriding class supplies a default format for the transport type.
<br/>NOTE: The message header from the internal message is copies, but not the message itself.
@param The internalTrxMessage that I will convert to this external format.
@return The (empty) External message. | [
"Get",
"the",
"external",
"message",
"container",
"for",
"this",
"Internal",
"message",
".",
"Typically",
"the",
"overriding",
"class",
"supplies",
"a",
"default",
"format",
"for",
"the",
"transport",
"type",
".",
"<br",
"/",
">",
"NOTE",
":",
"The",
"messag... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/service/src/main/java/org/jbundle/base/message/service/BaseServiceMessageTransport.java#L127-L138 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/http/HttpRequestHandler.java | HttpRequestHandler.handlePostRequest | public JSONAware handlePostRequest(String pUri, InputStream pInputStream, String pEncoding, Map<String, String[]> pParameterMap)
throws IOException {
if (backendManager.isDebug()) {
logHandler.debug("URI: " + pUri);
}
Object jsonRequest = extractJsonRequest(pInputStream,pEncoding);
if (jsonRequest instanceof JSONArray) {
List<JmxRequest> jmxRequests = JmxRequestFactory.createPostRequests((List) jsonRequest,getProcessingParameter(pParameterMap));
JSONArray responseList = new JSONArray();
for (JmxRequest jmxReq : jmxRequests) {
if (backendManager.isDebug()) {
logHandler.debug("Request: " + jmxReq.toString());
}
// Call handler and retrieve return value
JSONObject resp = executeRequest(jmxReq);
responseList.add(resp);
}
return responseList;
} else if (jsonRequest instanceof JSONObject) {
JmxRequest jmxReq = JmxRequestFactory.createPostRequest((Map<String, ?>) jsonRequest,getProcessingParameter(pParameterMap));
return executeRequest(jmxReq);
} else {
throw new IllegalArgumentException("Invalid JSON Request " + jsonRequest);
}
} | java | public JSONAware handlePostRequest(String pUri, InputStream pInputStream, String pEncoding, Map<String, String[]> pParameterMap)
throws IOException {
if (backendManager.isDebug()) {
logHandler.debug("URI: " + pUri);
}
Object jsonRequest = extractJsonRequest(pInputStream,pEncoding);
if (jsonRequest instanceof JSONArray) {
List<JmxRequest> jmxRequests = JmxRequestFactory.createPostRequests((List) jsonRequest,getProcessingParameter(pParameterMap));
JSONArray responseList = new JSONArray();
for (JmxRequest jmxReq : jmxRequests) {
if (backendManager.isDebug()) {
logHandler.debug("Request: " + jmxReq.toString());
}
// Call handler and retrieve return value
JSONObject resp = executeRequest(jmxReq);
responseList.add(resp);
}
return responseList;
} else if (jsonRequest instanceof JSONObject) {
JmxRequest jmxReq = JmxRequestFactory.createPostRequest((Map<String, ?>) jsonRequest,getProcessingParameter(pParameterMap));
return executeRequest(jmxReq);
} else {
throw new IllegalArgumentException("Invalid JSON Request " + jsonRequest);
}
} | [
"public",
"JSONAware",
"handlePostRequest",
"(",
"String",
"pUri",
",",
"InputStream",
"pInputStream",
",",
"String",
"pEncoding",
",",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"pParameterMap",
")",
"throws",
"IOException",
"{",
"if",
"(",
"backendM... | Handle the input stream as given by a POST request
@param pUri URI leading to this request
@param pInputStream input stream of the post request
@param pEncoding optional encoding for the stream. If null, the default encoding is used
@param pParameterMap additional processing parameters
@return the JSON object containing the json results for one or more {@link JmxRequest} contained
within the answer.
@throws IOException if reading from the input stream fails | [
"Handle",
"the",
"input",
"stream",
"as",
"given",
"by",
"a",
"POST",
"request"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/http/HttpRequestHandler.java#L115-L141 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/NodeLocatorHelper.java | NodeLocatorHelper.activeNodeForId | public InetAddress activeNodeForId(final String id) {
BucketConfig config = bucketConfig.get();
if (config instanceof CouchbaseBucketConfig) {
return nodeForIdOnCouchbaseBucket(id, (CouchbaseBucketConfig) config);
} else if (config instanceof MemcachedBucketConfig) {
return nodeForIdOnMemcachedBucket(id, (MemcachedBucketConfig) config);
} else {
throw new UnsupportedOperationException("Bucket type not supported: " + config.getClass().getName());
}
} | java | public InetAddress activeNodeForId(final String id) {
BucketConfig config = bucketConfig.get();
if (config instanceof CouchbaseBucketConfig) {
return nodeForIdOnCouchbaseBucket(id, (CouchbaseBucketConfig) config);
} else if (config instanceof MemcachedBucketConfig) {
return nodeForIdOnMemcachedBucket(id, (MemcachedBucketConfig) config);
} else {
throw new UnsupportedOperationException("Bucket type not supported: " + config.getClass().getName());
}
} | [
"public",
"InetAddress",
"activeNodeForId",
"(",
"final",
"String",
"id",
")",
"{",
"BucketConfig",
"config",
"=",
"bucketConfig",
".",
"get",
"(",
")",
";",
"if",
"(",
"config",
"instanceof",
"CouchbaseBucketConfig",
")",
"{",
"return",
"nodeForIdOnCouchbaseBucke... | Returns the target active node {@link InetAddress} for a given document ID on the bucket.
@param id the document id to convert.
@return the node for the given document id. | [
"Returns",
"the",
"target",
"active",
"node",
"{",
"@link",
"InetAddress",
"}",
"for",
"a",
"given",
"document",
"ID",
"on",
"the",
"bucket",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/NodeLocatorHelper.java#L101-L111 |
geomajas/geomajas-project-server | plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HsqlGeometryUserType.java | HsqlGeometryUserType.convert2JTS | public Geometry convert2JTS(Object object) {
if (object == null) {
return null;
}
String data = (String) object;
int srid = Integer.parseInt(data.substring(0, data.indexOf("|")));
Geometry geom;
try {
WKTReader reader = new WKTReader();
geom = reader.read(data.substring(data.indexOf("|") + 1));
} catch (Exception e) { // NOSONAR
throw new RuntimeException("Couldn't parse incoming wkt geometry.", e);
}
geom.setSRID(srid);
return geom;
} | java | public Geometry convert2JTS(Object object) {
if (object == null) {
return null;
}
String data = (String) object;
int srid = Integer.parseInt(data.substring(0, data.indexOf("|")));
Geometry geom;
try {
WKTReader reader = new WKTReader();
geom = reader.read(data.substring(data.indexOf("|") + 1));
} catch (Exception e) { // NOSONAR
throw new RuntimeException("Couldn't parse incoming wkt geometry.", e);
}
geom.setSRID(srid);
return geom;
} | [
"public",
"Geometry",
"convert2JTS",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"data",
"=",
"(",
"String",
")",
"object",
";",
"int",
"srid",
"=",
"Integer",
".",
"parseInt",
... | Converts the native geometry object to a JTS <code>Geometry</code>.
@param object
native database geometry object (depends on the JDBC spatial
extension of the database)
@return JTS geometry corresponding to geomObj. | [
"Converts",
"the",
"native",
"geometry",
"object",
"to",
"a",
"JTS",
"<code",
">",
"Geometry<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HsqlGeometryUserType.java#L45-L60 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaEventElapsedTime | public static int cudaEventElapsedTime(float ms[], cudaEvent_t start, cudaEvent_t end)
{
return checkResult(cudaEventElapsedTimeNative(ms, start, end));
} | java | public static int cudaEventElapsedTime(float ms[], cudaEvent_t start, cudaEvent_t end)
{
return checkResult(cudaEventElapsedTimeNative(ms, start, end));
} | [
"public",
"static",
"int",
"cudaEventElapsedTime",
"(",
"float",
"ms",
"[",
"]",
",",
"cudaEvent_t",
"start",
",",
"cudaEvent_t",
"end",
")",
"{",
"return",
"checkResult",
"(",
"cudaEventElapsedTimeNative",
"(",
"ms",
",",
"start",
",",
"end",
")",
")",
";",... | Computes the elapsed time between events.
<pre>
cudaError_t cudaEventElapsedTime (
float* ms,
cudaEvent_t start,
cudaEvent_t end )
</pre>
<div>
<p>Computes the elapsed time between events.
Computes the elapsed time between two events (in milliseconds with a
resolution
of around 0.5 microseconds).
</p>
<p>If either event was last recorded in a
non-NULL stream, the resulting time may be greater than expected (even
if both used
the same stream handle). This happens
because the cudaEventRecord() operation takes place asynchronously and
there is no guarantee that the measured latency is actually just
between the two
events. Any number of other different
stream operations could execute in between the two measured events,
thus altering the
timing in a significant way.
</p>
<p>If cudaEventRecord() has not been called
on either event, then cudaErrorInvalidResourceHandle is returned. If
cudaEventRecord() has been called on both events but one or both of
them has not yet been completed (that is, cudaEventQuery() would return
cudaErrorNotReady on at least one of the events), cudaErrorNotReady is
returned. If either event was created with the cudaEventDisableTiming
flag, then this function will return cudaErrorInvalidResourceHandle.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param ms Time between start and end in ms
@param start Starting event
@param end Ending event
@return cudaSuccess, cudaErrorNotReady, cudaErrorInvalidValue,
cudaErrorInitializationError, cudaErrorInvalidResourceHandle,
cudaErrorLaunchFailure
@see JCuda#cudaEventCreate
@see JCuda#cudaEventCreateWithFlags
@see JCuda#cudaEventQuery
@see JCuda#cudaEventSynchronize
@see JCuda#cudaEventDestroy
@see JCuda#cudaEventRecord | [
"Computes",
"the",
"elapsed",
"time",
"between",
"events",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L7300-L7303 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsFormatterConfiguration.java | CmsFormatterConfiguration.matchFormatter | public static boolean matchFormatter(I_CmsFormatterBean formatter, Set<String> types, int width) {
if (formatter.isMatchAll()) {
return true;
}
if (formatter.isTypeFormatter()) {
return !Sets.intersection(types, formatter.getContainerTypes()).isEmpty();
} else {
return (width == MATCH_ALL_CONTAINER_WIDTH)
|| ((formatter.getMinWidth() <= width) && (width <= formatter.getMaxWidth()));
}
} | java | public static boolean matchFormatter(I_CmsFormatterBean formatter, Set<String> types, int width) {
if (formatter.isMatchAll()) {
return true;
}
if (formatter.isTypeFormatter()) {
return !Sets.intersection(types, formatter.getContainerTypes()).isEmpty();
} else {
return (width == MATCH_ALL_CONTAINER_WIDTH)
|| ((formatter.getMinWidth() <= width) && (width <= formatter.getMaxWidth()));
}
} | [
"public",
"static",
"boolean",
"matchFormatter",
"(",
"I_CmsFormatterBean",
"formatter",
",",
"Set",
"<",
"String",
">",
"types",
",",
"int",
"width",
")",
"{",
"if",
"(",
"formatter",
".",
"isMatchAll",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"i... | Checks whether the given formatter bean matches the container types, width and nested flag.<p>
@param formatter the formatter bean
@param types the container types
@param width the container width
@return <code>true</code> in case the formatter matches | [
"Checks",
"whether",
"the",
"given",
"formatter",
"bean",
"matches",
"the",
"container",
"types",
"width",
"and",
"nested",
"flag",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsFormatterConfiguration.java#L249-L260 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/StringUtils.java | StringUtils.join | @SuppressWarnings("rawtypes")
public static String join(final Collection coll, final String delim) {
final StringBuilder buff = new StringBuilder(256);
Iterator iter;
if ((coll == null) || coll.isEmpty()) {
return "";
}
iter = coll.iterator();
while (iter.hasNext()) {
buff.append(iter.next().toString());
if (iter.hasNext()) {
buff.append(delim);
}
}
return buff.toString();
} | java | @SuppressWarnings("rawtypes")
public static String join(final Collection coll, final String delim) {
final StringBuilder buff = new StringBuilder(256);
Iterator iter;
if ((coll == null) || coll.isEmpty()) {
return "";
}
iter = coll.iterator();
while (iter.hasNext()) {
buff.append(iter.next().toString());
if (iter.hasNext()) {
buff.append(delim);
}
}
return buff.toString();
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"String",
"join",
"(",
"final",
"Collection",
"coll",
",",
"final",
"String",
"delim",
")",
"{",
"final",
"StringBuilder",
"buff",
"=",
"new",
"StringBuilder",
"(",
"256",
")",
";",
"Iter... | Assemble all elements in collection to a string.
@param coll -
java.util.List
@param delim -
Description of the Parameter
@return java.lang.String | [
"Assemble",
"all",
"elements",
"in",
"collection",
"to",
"a",
"string",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L42-L61 |
spotbugs/spotbugs | eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/BugResolution.java | BugResolution.isApplicable | public boolean isApplicable(IMarker marker) {
ASTVisitor prescanVisitor = getApplicabilityVisitor();
if (prescanVisitor instanceof ApplicabilityVisitor) { //this has an implicit null check
return findApplicability(prescanVisitor, marker);
}
return true;
} | java | public boolean isApplicable(IMarker marker) {
ASTVisitor prescanVisitor = getApplicabilityVisitor();
if (prescanVisitor instanceof ApplicabilityVisitor) { //this has an implicit null check
return findApplicability(prescanVisitor, marker);
}
return true;
} | [
"public",
"boolean",
"isApplicable",
"(",
"IMarker",
"marker",
")",
"{",
"ASTVisitor",
"prescanVisitor",
"=",
"getApplicabilityVisitor",
"(",
")",
";",
"if",
"(",
"prescanVisitor",
"instanceof",
"ApplicabilityVisitor",
")",
"{",
"//this has an implicit null check",
"ret... | If getApplicabilityVisitor() is overwritten, this checks
to see if this resolution applies to the code at the given marker.
@param marker
@return true if this resolution should be visible to the user at the given marker | [
"If",
"getApplicabilityVisitor",
"()",
"is",
"overwritten",
"this",
"checks",
"to",
"see",
"if",
"this",
"resolution",
"applies",
"to",
"the",
"code",
"at",
"the",
"given",
"marker",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/BugResolution.java#L493-L499 |
Cornutum/tcases | tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputJson.java | SystemInputJson.asFunctionInputDef | private static FunctionInputDef asFunctionInputDef( String functionName, JsonObject json)
{
FunctionInputDef functionInputDef;
try
{
functionInputDef = new FunctionInputDef( validIdentifier( functionName));
// Get function annotations
Optional.ofNullable( json.getJsonObject( HAS_KEY))
.ifPresent( has -> has.keySet().stream().forEach( key -> functionInputDef.setAnnotation( key, has.getString( key))));
// Get function variables.
json.keySet().stream()
.filter( key -> !key.equals( HAS_KEY))
.forEach( varType -> getVarDefs( varType, json.getJsonObject( varType)).forEach( varDef -> functionInputDef.addVarDef( varDef)));
if( functionInputDef.getVarTypes().length == 0)
{
throw new SystemInputException( String.format( "No variables defined for function=%s", functionName));
}
SystemInputs.getPropertiesUndefined( functionInputDef)
.entrySet().stream()
.findFirst()
.ifPresent( undefined -> {
String property = undefined.getKey();
IConditional ref = undefined.getValue().stream().findFirst().orElse( null);
throw new SystemInputException
( String.format
( "Property=%s is undefined, but referenced by %s",
property,
SystemInputs.getReferenceName( ref)));
});
}
catch( SystemInputException e)
{
throw new SystemInputException( String.format( "Error defining function=%s", functionName), e);
}
return functionInputDef;
} | java | private static FunctionInputDef asFunctionInputDef( String functionName, JsonObject json)
{
FunctionInputDef functionInputDef;
try
{
functionInputDef = new FunctionInputDef( validIdentifier( functionName));
// Get function annotations
Optional.ofNullable( json.getJsonObject( HAS_KEY))
.ifPresent( has -> has.keySet().stream().forEach( key -> functionInputDef.setAnnotation( key, has.getString( key))));
// Get function variables.
json.keySet().stream()
.filter( key -> !key.equals( HAS_KEY))
.forEach( varType -> getVarDefs( varType, json.getJsonObject( varType)).forEach( varDef -> functionInputDef.addVarDef( varDef)));
if( functionInputDef.getVarTypes().length == 0)
{
throw new SystemInputException( String.format( "No variables defined for function=%s", functionName));
}
SystemInputs.getPropertiesUndefined( functionInputDef)
.entrySet().stream()
.findFirst()
.ifPresent( undefined -> {
String property = undefined.getKey();
IConditional ref = undefined.getValue().stream().findFirst().orElse( null);
throw new SystemInputException
( String.format
( "Property=%s is undefined, but referenced by %s",
property,
SystemInputs.getReferenceName( ref)));
});
}
catch( SystemInputException e)
{
throw new SystemInputException( String.format( "Error defining function=%s", functionName), e);
}
return functionInputDef;
} | [
"private",
"static",
"FunctionInputDef",
"asFunctionInputDef",
"(",
"String",
"functionName",
",",
"JsonObject",
"json",
")",
"{",
"FunctionInputDef",
"functionInputDef",
";",
"try",
"{",
"functionInputDef",
"=",
"new",
"FunctionInputDef",
"(",
"validIdentifier",
"(",
... | Returns the FunctionInputDef represented by the given JSON object. | [
"Returns",
"the",
"FunctionInputDef",
"represented",
"by",
"the",
"given",
"JSON",
"object",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputJson.java#L203-L245 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/values/ValueElement.java | ValueElement.toFloat | public JcNumber toFloat() {
JcNumber ret = new JcNumber(null, this,
new FunctionInstance(FUNCTION.Common.TOFLOAT, 1));
QueryRecorder.recordInvocationConditional(this, "toFloat", ret);
return ret;
} | java | public JcNumber toFloat() {
JcNumber ret = new JcNumber(null, this,
new FunctionInstance(FUNCTION.Common.TOFLOAT, 1));
QueryRecorder.recordInvocationConditional(this, "toFloat", ret);
return ret;
} | [
"public",
"JcNumber",
"toFloat",
"(",
")",
"{",
"JcNumber",
"ret",
"=",
"new",
"JcNumber",
"(",
"null",
",",
"this",
",",
"new",
"FunctionInstance",
"(",
"FUNCTION",
".",
"Common",
".",
"TOFLOAT",
",",
"1",
")",
")",
";",
"QueryRecorder",
".",
"recordInv... | <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>convert the argument to a float, return a <b>JcNumber</b>, if the conversion fails return NULL</i></div>
<br/> | [
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"24px",
";",
"color",
":",
"red",
">",
"<b",
">",
"<i",
">",
"<u",
">",
"JCYPHER<",
"/",
"u",
">",
"<",
"/",
"i",
">",
"<",
"/",
"b",
">",
"<",
"/",
"div",
">",
"<div",
... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/ValueElement.java#L72-L77 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java | SymmetryAxes.updateAxis | public void updateAxis(Integer index, Matrix4d newAxis){
axes.get(index).setOperator(newAxis);
} | java | public void updateAxis(Integer index, Matrix4d newAxis){
axes.get(index).setOperator(newAxis);
} | [
"public",
"void",
"updateAxis",
"(",
"Integer",
"index",
",",
"Matrix4d",
"newAxis",
")",
"{",
"axes",
".",
"get",
"(",
"index",
")",
".",
"setOperator",
"(",
"newAxis",
")",
";",
"}"
] | Updates an axis of symmetry, after the superposition changed.
@param index old axis index
@param newAxis | [
"Updates",
"an",
"axis",
"of",
"symmetry",
"after",
"the",
"superposition",
"changed",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java#L252-L254 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductPropertyUrl.java | ProductPropertyUrl.deletePropertyUrl | public static MozuUrl deletePropertyUrl(String attributeFQN, String productCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Properties/{attributeFQN}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("productCode", productCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deletePropertyUrl(String attributeFQN, String productCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Properties/{attributeFQN}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("productCode", productCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deletePropertyUrl",
"(",
"String",
"attributeFQN",
",",
"String",
"productCode",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/products/{productCode}/Properties/{attributeFQN}\"",
")",
";... | Get Resource Url for DeleteProperty
@param attributeFQN Fully qualified name for an attribute.
@param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteProperty"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductPropertyUrl.java#L170-L176 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.biPredicate | public static <T, U> BiPredicate<T, U> biPredicate(CheckedBiPredicate<T, U> predicate, Consumer<Throwable> handler) {
return (t, u) -> {
try {
return predicate.test(t, u);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static <T, U> BiPredicate<T, U> biPredicate(CheckedBiPredicate<T, U> predicate, Consumer<Throwable> handler) {
return (t, u) -> {
try {
return predicate.test(t, u);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"<",
"T",
",",
"U",
">",
"BiPredicate",
"<",
"T",
",",
"U",
">",
"biPredicate",
"(",
"CheckedBiPredicate",
"<",
"T",
",",
"U",
">",
"predicate",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"(",
"t",
",",... | Wrap a {@link CheckedBiPredicate} in a {@link BiPredicate} with a custom handler for checked exceptions. | [
"Wrap",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L447-L458 |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Question.java | Question.deriveNs | public Result<NsDAO.Data> deriveNs(AuthzTrans trans, String child) {
Result<List<NsDAO.Data>> r = nsDAO.read(trans, child);
if (r.isOKhasData()) {
return Result.ok(r.value.get(0));
} else {
int dot = child == null ? -1 : child.lastIndexOf('.');
if (dot < 0) {
return Result.err(Status.ERR_NsNotFound,
"No Namespace for [%s]", child);
} else {
return deriveNs(trans, child.substring(0, dot));
}
}
} | java | public Result<NsDAO.Data> deriveNs(AuthzTrans trans, String child) {
Result<List<NsDAO.Data>> r = nsDAO.read(trans, child);
if (r.isOKhasData()) {
return Result.ok(r.value.get(0));
} else {
int dot = child == null ? -1 : child.lastIndexOf('.');
if (dot < 0) {
return Result.err(Status.ERR_NsNotFound,
"No Namespace for [%s]", child);
} else {
return deriveNs(trans, child.substring(0, dot));
}
}
} | [
"public",
"Result",
"<",
"NsDAO",
".",
"Data",
">",
"deriveNs",
"(",
"AuthzTrans",
"trans",
",",
"String",
"child",
")",
"{",
"Result",
"<",
"List",
"<",
"NsDAO",
".",
"Data",
">>",
"r",
"=",
"nsDAO",
".",
"read",
"(",
"trans",
",",
"child",
")",
"... | Derive NS
Given a Child Namespace, figure out what the best Namespace parent is.
For instance, if in the NS table, the parent "com.att" exists, but not
"com.att.child" or "com.att.a.b.c", then passing in either
"com.att.child" or "com.att.a.b.c" will return "com.att"
Uses recursive search on Cached DAO data
@param trans
@param child
@return | [
"Derive",
"NS"
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Question.java#L341-L355 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerRpcClient.java | CircuitBreakerRpcClient.newDecorator | public static Function<Client<RpcRequest, RpcResponse>, CircuitBreakerRpcClient>
newDecorator(CircuitBreakerMapping mapping, CircuitBreakerStrategyWithContent<RpcResponse> strategy) {
return delegate -> new CircuitBreakerRpcClient(delegate, mapping, strategy);
} | java | public static Function<Client<RpcRequest, RpcResponse>, CircuitBreakerRpcClient>
newDecorator(CircuitBreakerMapping mapping, CircuitBreakerStrategyWithContent<RpcResponse> strategy) {
return delegate -> new CircuitBreakerRpcClient(delegate, mapping, strategy);
} | [
"public",
"static",
"Function",
"<",
"Client",
"<",
"RpcRequest",
",",
"RpcResponse",
">",
",",
"CircuitBreakerRpcClient",
">",
"newDecorator",
"(",
"CircuitBreakerMapping",
"mapping",
",",
"CircuitBreakerStrategyWithContent",
"<",
"RpcResponse",
">",
"strategy",
")",
... | Creates a new decorator with the specified {@link CircuitBreakerMapping} and
{@link CircuitBreakerStrategy}.
<p>Since {@link CircuitBreaker} is a unit of failure detection, don't reuse the same instance for
unrelated services. | [
"Creates",
"a",
"new",
"decorator",
"with",
"the",
"specified",
"{",
"@link",
"CircuitBreakerMapping",
"}",
"and",
"{",
"@link",
"CircuitBreakerStrategy",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerRpcClient.java#L54-L57 |
abel533/Mapper | core/src/main/java/tk/mybatis/mapper/util/OGNL.java | OGNL.checkExampleEntityClass | public static boolean checkExampleEntityClass(Object parameter, String entityFullName) {
if (parameter != null && parameter instanceof Example && StringUtil.isNotEmpty(entityFullName)) {
Example example = (Example) parameter;
Class<?> entityClass = example.getEntityClass();
if (!entityClass.getCanonicalName().equals(entityFullName)) {
throw new MapperException("当前 Example 方法对应实体为:" + entityFullName
+ ", 但是参数 Example 中的 entityClass 为:" + entityClass.getCanonicalName());
}
}
return true;
} | java | public static boolean checkExampleEntityClass(Object parameter, String entityFullName) {
if (parameter != null && parameter instanceof Example && StringUtil.isNotEmpty(entityFullName)) {
Example example = (Example) parameter;
Class<?> entityClass = example.getEntityClass();
if (!entityClass.getCanonicalName().equals(entityFullName)) {
throw new MapperException("当前 Example 方法对应实体为:" + entityFullName
+ ", 但是参数 Example 中的 entityClass 为:" + entityClass.getCanonicalName());
}
}
return true;
} | [
"public",
"static",
"boolean",
"checkExampleEntityClass",
"(",
"Object",
"parameter",
",",
"String",
"entityFullName",
")",
"{",
"if",
"(",
"parameter",
"!=",
"null",
"&&",
"parameter",
"instanceof",
"Example",
"&&",
"StringUtil",
".",
"isNotEmpty",
"(",
"entityFu... | 校验通用 Example 的 entityClass 和当前方法是否匹配
@param parameter
@param entityFullName
@return | [
"校验通用",
"Example",
"的",
"entityClass",
"和当前方法是否匹配"
] | train | https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/util/OGNL.java#L54-L64 |
lecho/hellocharts-android | hellocharts-library/src/lecho/lib/hellocharts/view/PieChartView.java | PieChartView.setChartRotation | public void setChartRotation(int rotation, boolean isAnimated) {
if (isAnimated) {
rotationAnimator.cancelAnimation();
rotationAnimator.startAnimation(pieChartRenderer.getChartRotation(), rotation);
} else {
pieChartRenderer.setChartRotation(rotation);
}
ViewCompat.postInvalidateOnAnimation(this);
} | java | public void setChartRotation(int rotation, boolean isAnimated) {
if (isAnimated) {
rotationAnimator.cancelAnimation();
rotationAnimator.startAnimation(pieChartRenderer.getChartRotation(), rotation);
} else {
pieChartRenderer.setChartRotation(rotation);
}
ViewCompat.postInvalidateOnAnimation(this);
} | [
"public",
"void",
"setChartRotation",
"(",
"int",
"rotation",
",",
"boolean",
"isAnimated",
")",
"{",
"if",
"(",
"isAnimated",
")",
"{",
"rotationAnimator",
".",
"cancelAnimation",
"(",
")",
";",
"rotationAnimator",
".",
"startAnimation",
"(",
"pieChartRenderer",
... | Set pie chart rotation. Don't confuse with {@link View#getRotation()}.
@param rotation
@see #getChartRotation() | [
"Set",
"pie",
"chart",
"rotation",
".",
"Don",
"t",
"confuse",
"with",
"{",
"@link",
"View#getRotation",
"()",
"}",
"."
] | train | https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/view/PieChartView.java#L141-L149 |
f2prateek/rx-preferences | rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java | RxSharedPreferences.getLong | @CheckResult @NonNull
public Preference<Long> getLong(@NonNull String key) {
return getLong(key, DEFAULT_LONG);
} | java | @CheckResult @NonNull
public Preference<Long> getLong(@NonNull String key) {
return getLong(key, DEFAULT_LONG);
} | [
"@",
"CheckResult",
"@",
"NonNull",
"public",
"Preference",
"<",
"Long",
">",
"getLong",
"(",
"@",
"NonNull",
"String",
"key",
")",
"{",
"return",
"getLong",
"(",
"key",
",",
"DEFAULT_LONG",
")",
";",
"}"
] | Create a long preference for {@code key}. Default is {@code 0}. | [
"Create",
"a",
"long",
"preference",
"for",
"{"
] | train | https://github.com/f2prateek/rx-preferences/blob/e338b4e6cee9c0c7b850be86ab41ed7b39a3637e/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java#L114-L117 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java | CommerceOrderPersistenceImpl.removeByU_LtC_O | @Override
public void removeByU_LtC_O(long userId, Date createDate, int orderStatus) {
for (CommerceOrder commerceOrder : findByU_LtC_O(userId, createDate,
orderStatus, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceOrder);
}
} | java | @Override
public void removeByU_LtC_O(long userId, Date createDate, int orderStatus) {
for (CommerceOrder commerceOrder : findByU_LtC_O(userId, createDate,
orderStatus, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceOrder);
}
} | [
"@",
"Override",
"public",
"void",
"removeByU_LtC_O",
"(",
"long",
"userId",
",",
"Date",
"createDate",
",",
"int",
"orderStatus",
")",
"{",
"for",
"(",
"CommerceOrder",
"commerceOrder",
":",
"findByU_LtC_O",
"(",
"userId",
",",
"createDate",
",",
"orderStatus",... | Removes all the commerce orders where userId = ? and createDate < ? and orderStatus = ? from the database.
@param userId the user ID
@param createDate the create date
@param orderStatus the order status | [
"Removes",
"all",
"the",
"commerce",
"orders",
"where",
"userId",
"=",
"?",
";",
"and",
"createDate",
"<",
";",
"?",
";",
"and",
"orderStatus",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L5771-L5777 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/chrono/PaxDate.java | PaxDate.plusYears | @Override
PaxDate plusYears(long yearsToAdd) {
if (yearsToAdd == 0) {
return this;
}
int newYear = YEAR.checkValidIntValue(getProlepticYear() + yearsToAdd);
// Retain actual month (not index) in the case where a leap month is to be inserted.
if (month == MONTHS_IN_YEAR && !isLeapYear() && PaxChronology.INSTANCE.isLeapYear(newYear)) {
return of(newYear, MONTHS_IN_YEAR + 1, getDayOfMonth());
}
// Otherwise, one of the following is true:
// 1 - Before the leap month, nothing to do (most common)
// 2 - Both source and destination in leap-month, nothing to do
// 3 - Both source and destination after leap month in leap year, nothing to do
// 4 - Source in leap month, but destination year not leap. Retain month index, preserving day-of-year.
// 5 - Source after leap month, but destination year not leap. Move month index back.
return resolvePreviousValid(newYear, month, day);
} | java | @Override
PaxDate plusYears(long yearsToAdd) {
if (yearsToAdd == 0) {
return this;
}
int newYear = YEAR.checkValidIntValue(getProlepticYear() + yearsToAdd);
// Retain actual month (not index) in the case where a leap month is to be inserted.
if (month == MONTHS_IN_YEAR && !isLeapYear() && PaxChronology.INSTANCE.isLeapYear(newYear)) {
return of(newYear, MONTHS_IN_YEAR + 1, getDayOfMonth());
}
// Otherwise, one of the following is true:
// 1 - Before the leap month, nothing to do (most common)
// 2 - Both source and destination in leap-month, nothing to do
// 3 - Both source and destination after leap month in leap year, nothing to do
// 4 - Source in leap month, but destination year not leap. Retain month index, preserving day-of-year.
// 5 - Source after leap month, but destination year not leap. Move month index back.
return resolvePreviousValid(newYear, month, day);
} | [
"@",
"Override",
"PaxDate",
"plusYears",
"(",
"long",
"yearsToAdd",
")",
"{",
"if",
"(",
"yearsToAdd",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"int",
"newYear",
"=",
"YEAR",
".",
"checkValidIntValue",
"(",
"getProlepticYear",
"(",
")",
"+",
"yea... | Returns a copy of this {@code PaxDate} with the specified period in years added.
<p>
This method adds the specified amount to the years field in two steps:
<ol>
<li>Add the input years to the year field</li>
<li>If necessary, shift the index to account for the inserted/deleted leap-month.</li>
</ol>
<p>
In the Pax Calendar, the month of December is 13 in non-leap-years, and 14 in leap years.
Shifting the index of the month thus means the month would still be the same.
<p>
In the case of moving from the inserted leap-month (destination year is non-leap), the month index is retained.
This has the effect of retaining the same day-of-year.
<p>
This instance is immutable and unaffected by this method call.
@param yearsToAdd the years to add, may be negative
@return a {@code PaxDate} based on this date with the years added, not null
@throws DateTimeException if the result exceeds the supported date range | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"PaxDate",
"}",
"with",
"the",
"specified",
"period",
"in",
"years",
"added",
".",
"<p",
">",
"This",
"method",
"adds",
"the",
"specified",
"amount",
"to",
"the",
"years",
"field",
"in",
"two",
"steps",... | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/PaxDate.java#L560-L577 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/log/LogManager.java | LogManager.removeWriter | public void removeWriter(String logService, LogWriter writer)
{
if (logService != null && logService.length() > 0) {
final LogService l = (LogService) loggers.get(logService);
if (l != null)
l.removeWriter(writer);
}
else
synchronized (loggers) {
if (writers.remove(writer))
for (final Iterator i = loggers.values().iterator(); i.hasNext();)
((LogService) i.next()).removeWriter(writer);
}
} | java | public void removeWriter(String logService, LogWriter writer)
{
if (logService != null && logService.length() > 0) {
final LogService l = (LogService) loggers.get(logService);
if (l != null)
l.removeWriter(writer);
}
else
synchronized (loggers) {
if (writers.remove(writer))
for (final Iterator i = loggers.values().iterator(); i.hasNext();)
((LogService) i.next()).removeWriter(writer);
}
} | [
"public",
"void",
"removeWriter",
"(",
"String",
"logService",
",",
"LogWriter",
"writer",
")",
"{",
"if",
"(",
"logService",
"!=",
"null",
"&&",
"logService",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"final",
"LogService",
"l",
"=",
"(",
"LogService... | Removes a log writer, either global or from a particular <code>logService</code>.
<p>
Note that for a writer to be removed global, it had to be added global before.
@param logService name of the log service of which the writer will be removed; to
remove the writer global, use an empty string or <code>null</code>
@param writer log writer to remove
@see LogService#removeWriter(LogWriter) | [
"Removes",
"a",
"log",
"writer",
"either",
"global",
"or",
"from",
"a",
"particular",
"<code",
">",
"logService<",
"/",
"code",
">",
".",
"<p",
">",
"Note",
"that",
"for",
"a",
"writer",
"to",
"be",
"removed",
"global",
"it",
"had",
"to",
"be",
"added"... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/log/LogManager.java#L207-L220 |
calimero-project/calimero-core | src/tuwien/auto/calimero/xml/XmlInputFactory.java | XmlInputFactory.createXMLReader | public XmlReader createXMLReader(final String baseUri) throws KNXMLException
{
final XmlResolver res = new XmlResolver();
final InputStream is = (InputStream) res.resolveEntity(null, null, baseUri, null);
return create(res, is);
} | java | public XmlReader createXMLReader(final String baseUri) throws KNXMLException
{
final XmlResolver res = new XmlResolver();
final InputStream is = (InputStream) res.resolveEntity(null, null, baseUri, null);
return create(res, is);
} | [
"public",
"XmlReader",
"createXMLReader",
"(",
"final",
"String",
"baseUri",
")",
"throws",
"KNXMLException",
"{",
"final",
"XmlResolver",
"res",
"=",
"new",
"XmlResolver",
"(",
")",
";",
"final",
"InputStream",
"is",
"=",
"(",
"InputStream",
")",
"res",
".",
... | Creates a {@link XmlReader} to read the XML resource located by the specified identifier.
<p>
On closing the created XML reader, the {@link Reader} set as input for the XML reader will
get closed as well.
@param baseUri location identifier of the XML resource
@return XML reader
@throws KNXMLException if creation of the reader failed or XML resource can't be resolved | [
"Creates",
"a",
"{",
"@link",
"XmlReader",
"}",
"to",
"read",
"the",
"XML",
"resource",
"located",
"by",
"the",
"specified",
"identifier",
".",
"<p",
">",
"On",
"closing",
"the",
"created",
"XML",
"reader",
"the",
"{",
"@link",
"Reader",
"}",
"set",
"as"... | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/xml/XmlInputFactory.java#L86-L91 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java | PoolGroupManager.getPoolInfo | public static PoolInfo getPoolInfo(
Session session) {
PoolInfo poolInfo = session.getPoolInfo();
// If there is no explicit pool info set, take user name.
if (poolInfo == null || poolInfo.getPoolName().equals("")) {
poolInfo = new PoolInfo(DEFAULT_POOL_GROUP, session.getUserId());
}
if (!PoolInfo.isLegalPoolInfo(poolInfo)) {
LOG.warn("Illegal pool info :" + poolInfo +
" from session " + session.getSessionId());
return DEFAULT_POOL_INFO;
}
return poolInfo;
} | java | public static PoolInfo getPoolInfo(
Session session) {
PoolInfo poolInfo = session.getPoolInfo();
// If there is no explicit pool info set, take user name.
if (poolInfo == null || poolInfo.getPoolName().equals("")) {
poolInfo = new PoolInfo(DEFAULT_POOL_GROUP, session.getUserId());
}
if (!PoolInfo.isLegalPoolInfo(poolInfo)) {
LOG.warn("Illegal pool info :" + poolInfo +
" from session " + session.getSessionId());
return DEFAULT_POOL_INFO;
}
return poolInfo;
} | [
"public",
"static",
"PoolInfo",
"getPoolInfo",
"(",
"Session",
"session",
")",
"{",
"PoolInfo",
"poolInfo",
"=",
"session",
".",
"getPoolInfo",
"(",
")",
";",
"// If there is no explicit pool info set, take user name.",
"if",
"(",
"poolInfo",
"==",
"null",
"||",
"po... | Get the pool name for a given session, using the default pool
information if the name is illegal. Redirection should happen prior to
this.
@param session the session to get the pool name for
@return the pool info that the session is running in | [
"Get",
"the",
"pool",
"name",
"for",
"a",
"given",
"session",
"using",
"the",
"default",
"pool",
"information",
"if",
"the",
"name",
"is",
"illegal",
".",
"Redirection",
"should",
"happen",
"prior",
"to",
"this",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolGroupManager.java#L211-L226 |
apache/groovy | src/main/groovy/groovy/lang/ExpandoMetaClass.java | ExpandoMetaClass.invokeMethod | public Object invokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass) {
if (invokeMethodMethod != null) {
MetaClassHelper.unwrap(originalArguments);
return invokeMethodMethod.invoke(object, new Object[]{methodName, originalArguments});
}
return super.invokeMethod(sender, object, methodName, originalArguments, isCallToSuper, fromInsideClass);
} | java | public Object invokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass) {
if (invokeMethodMethod != null) {
MetaClassHelper.unwrap(originalArguments);
return invokeMethodMethod.invoke(object, new Object[]{methodName, originalArguments});
}
return super.invokeMethod(sender, object, methodName, originalArguments, isCallToSuper, fromInsideClass);
} | [
"public",
"Object",
"invokeMethod",
"(",
"Class",
"sender",
",",
"Object",
"object",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"originalArguments",
",",
"boolean",
"isCallToSuper",
",",
"boolean",
"fromInsideClass",
")",
"{",
"if",
"(",
"invokeMethod... | Overrides default implementation just in case invokeMethod has been overridden by ExpandoMetaClass
@see groovy.lang.MetaClassImpl#invokeMethod(Class, Object, String, Object[], boolean, boolean) | [
"Overrides",
"default",
"implementation",
"just",
"in",
"case",
"invokeMethod",
"has",
"been",
"overridden",
"by",
"ExpandoMetaClass"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ExpandoMetaClass.java#L1120-L1126 |
aws/aws-sdk-java | jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java | JmesPathEvaluationVisitor.visit | @Override
public JsonNode visit(JmesPathSubExpression subExpression, JsonNode input) throws InvalidTypeException {
JsonNode prelimnaryResult = subExpression.getExpressions().get(0).accept(this, input);
for (int i = 1; i < subExpression.getExpressions().size(); i++) {
prelimnaryResult = subExpression.getExpressions().get(i).accept(this, prelimnaryResult);
}
return prelimnaryResult;
} | java | @Override
public JsonNode visit(JmesPathSubExpression subExpression, JsonNode input) throws InvalidTypeException {
JsonNode prelimnaryResult = subExpression.getExpressions().get(0).accept(this, input);
for (int i = 1; i < subExpression.getExpressions().size(); i++) {
prelimnaryResult = subExpression.getExpressions().get(i).accept(this, prelimnaryResult);
}
return prelimnaryResult;
} | [
"@",
"Override",
"public",
"JsonNode",
"visit",
"(",
"JmesPathSubExpression",
"subExpression",
",",
"JsonNode",
"input",
")",
"throws",
"InvalidTypeException",
"{",
"JsonNode",
"prelimnaryResult",
"=",
"subExpression",
".",
"getExpressions",
"(",
")",
".",
"get",
"(... | Evaluates a subexpression by evaluating the expression on
the left with the original JSON document and then evaluating
the expression on the right with the result of the left
expression evaluation.
@param subExpression JmesPath subexpression type
@param input Input json node against which evaluation is done
@return Result of the subexpression evaluation
@throws InvalidTypeException | [
"Evaluates",
"a",
"subexpression",
"by",
"evaluating",
"the",
"expression",
"on",
"the",
"left",
"with",
"the",
"original",
"JSON",
"document",
"and",
"then",
"evaluating",
"the",
"expression",
"on",
"the",
"right",
"with",
"the",
"result",
"of",
"the",
"left"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java#L39-L46 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java | ZonedDateTime.withEarlierOffsetAtOverlap | @Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
if (trans != null && trans.isOverlap()) {
ZoneOffset earlierOffset = trans.getOffsetBefore();
if (earlierOffset.equals(offset) == false) {
return new ZonedDateTime(dateTime, earlierOffset, zone);
}
}
return this;
} | java | @Override
public ZonedDateTime withEarlierOffsetAtOverlap() {
ZoneOffsetTransition trans = getZone().getRules().getTransition(dateTime);
if (trans != null && trans.isOverlap()) {
ZoneOffset earlierOffset = trans.getOffsetBefore();
if (earlierOffset.equals(offset) == false) {
return new ZonedDateTime(dateTime, earlierOffset, zone);
}
}
return this;
} | [
"@",
"Override",
"public",
"ZonedDateTime",
"withEarlierOffsetAtOverlap",
"(",
")",
"{",
"ZoneOffsetTransition",
"trans",
"=",
"getZone",
"(",
")",
".",
"getRules",
"(",
")",
".",
"getTransition",
"(",
"dateTime",
")",
";",
"if",
"(",
"trans",
"!=",
"null",
... | Returns a copy of this date-time changing the zone offset to the
earlier of the two valid offsets at a local time-line overlap.
<p>
This method only has any effect when the local time-line overlaps, such as
at an autumn daylight savings cutover. In this scenario, there are two
valid offsets for the local date-time. Calling this method will return
a zoned date-time with the earlier of the two selected.
<p>
If this method is called when it is not an overlap, {@code this}
is returned.
<p>
This instance is immutable and unaffected by this method call.
@return a {@code ZonedDateTime} based on this date-time with the earlier offset, not null | [
"Returns",
"a",
"copy",
"of",
"this",
"date",
"-",
"time",
"changing",
"the",
"zone",
"offset",
"to",
"the",
"earlier",
"of",
"the",
"two",
"valid",
"offsets",
"at",
"a",
"local",
"time",
"-",
"line",
"overlap",
".",
"<p",
">",
"This",
"method",
"only"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java#L883-L893 |
OpenBEL/openbel-framework | org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseOneApplication.java | PhaseOneApplication.stage7 | private boolean stage7(final ProtoNetwork pn, final Document doc) {
beginStage(PHASE1_STAGE7_HDR, "7", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
bldr.append("Saving proto-network for ");
bldr.append(doc.getName());
stageOutput(bldr.toString());
long t1 = currentTimeMillis();
String dir = artifactPath.getAbsolutePath();
final String path = asPath(dir, nextUniqueFolderName());
File pnpathname = new File(path);
boolean success = true;
try {
p1.stage7Saving(pn, pnpathname);
if (withDebug()) {
TextProtoNetworkExternalizer textExternalizer =
new TextProtoNetworkExternalizer();
textExternalizer.writeProtoNetwork(pn,
pnpathname.getAbsolutePath());
}
} catch (ProtoNetworkError e) {
success = false;
error("failed to save proto-network");
e.printStackTrace();
}
long t2 = currentTimeMillis();
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return success;
} | java | private boolean stage7(final ProtoNetwork pn, final Document doc) {
beginStage(PHASE1_STAGE7_HDR, "7", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
bldr.append("Saving proto-network for ");
bldr.append(doc.getName());
stageOutput(bldr.toString());
long t1 = currentTimeMillis();
String dir = artifactPath.getAbsolutePath();
final String path = asPath(dir, nextUniqueFolderName());
File pnpathname = new File(path);
boolean success = true;
try {
p1.stage7Saving(pn, pnpathname);
if (withDebug()) {
TextProtoNetworkExternalizer textExternalizer =
new TextProtoNetworkExternalizer();
textExternalizer.writeProtoNetwork(pn,
pnpathname.getAbsolutePath());
}
} catch (ProtoNetworkError e) {
success = false;
error("failed to save proto-network");
e.printStackTrace();
}
long t2 = currentTimeMillis();
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return success;
} | [
"private",
"boolean",
"stage7",
"(",
"final",
"ProtoNetwork",
"pn",
",",
"final",
"Document",
"doc",
")",
"{",
"beginStage",
"(",
"PHASE1_STAGE7_HDR",
",",
"\"7\"",
",",
"NUM_PHASES",
")",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"("... | Stage seven saving of proto-network.
@param pn Proto-network
@param doc {@link Document}, the document
@return boolean true if success, false otherwise | [
"Stage",
"seven",
"saving",
"of",
"proto",
"-",
"network",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseOneApplication.java#L600-L636 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java | JaxbUtils.unmarshal | public static <T> T unmarshal(Class<T> cl, InputStream s) throws JAXBException {
return unmarshal(cl, new StreamSource(s));
} | java | public static <T> T unmarshal(Class<T> cl, InputStream s) throws JAXBException {
return unmarshal(cl, new StreamSource(s));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"InputStream",
"s",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshal",
"(",
"cl",
",",
"new",
"StreamSource",
"(",
"s",
")",
")",
";",
"}"
] | Convert the contents of an InputStream to an object of a given class.
@param cl Type of object
@param s InputStream to be read
@return Object of the given type | [
"Convert",
"the",
"contents",
"of",
"an",
"InputStream",
"to",
"an",
"object",
"of",
"a",
"given",
"class",
"."
] | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L275-L277 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java | BasicModMixer.mixChannelIntoBuffers | private void mixChannelIntoBuffers(final int[] leftBuffer, final int[] rightBuffer, final int startIndex, final int endIndex, final ChannelMemory actMemo)
{
for (int i=startIndex; i<endIndex; i++)
{
// Retrieve the Sampledata for this point (interpolated, if necessary)
long sample = actMemo.currentSample.getInterpolatedSample(doISP, actMemo.currentSamplePos, actMemo.currentTuningPos);
// Resonance Filters
if (actMemo.filterOn) sample = doResonance(actMemo, sample);
// Volume Ramping (deClick) Left!
long volL = actMemo.actRampVolLeft;
if ((actMemo.deltaVolLeft>0 && volL>actMemo.actVolumeLeft) ||
(actMemo.deltaVolLeft<0 && volL<actMemo.actVolumeLeft))
{
volL = actMemo.actRampVolLeft = actMemo.actVolumeLeft;
actMemo.deltaVolLeft = 0;
}
else
{
actMemo.actRampVolLeft += actMemo.deltaVolLeft;
}
// Volume Ramping (deClick) Right!
long volR = actMemo.actRampVolRight;
if ((actMemo.deltaVolRight>0 && volR>actMemo.actVolumeRight) ||
(actMemo.deltaVolRight<0 && volR<actMemo.actVolumeRight))
{
volR = actMemo.actRampVolRight = actMemo.actVolumeRight;
actMemo.deltaVolRight = 0;
}
else
{
actMemo.actRampVolRight += actMemo.deltaVolRight;
}
// Fit into volume for the two channels
leftBuffer[i] += (int)((sample * volL) >> Helpers.MAXVOLUMESHIFT);
rightBuffer[i]+= (int)((sample * volR) >> Helpers.MAXVOLUMESHIFT);
// Now fit the loops of the current Sample
fitIntoLoops(actMemo);
if (actMemo.instrumentFinished) break;
}
} | java | private void mixChannelIntoBuffers(final int[] leftBuffer, final int[] rightBuffer, final int startIndex, final int endIndex, final ChannelMemory actMemo)
{
for (int i=startIndex; i<endIndex; i++)
{
// Retrieve the Sampledata for this point (interpolated, if necessary)
long sample = actMemo.currentSample.getInterpolatedSample(doISP, actMemo.currentSamplePos, actMemo.currentTuningPos);
// Resonance Filters
if (actMemo.filterOn) sample = doResonance(actMemo, sample);
// Volume Ramping (deClick) Left!
long volL = actMemo.actRampVolLeft;
if ((actMemo.deltaVolLeft>0 && volL>actMemo.actVolumeLeft) ||
(actMemo.deltaVolLeft<0 && volL<actMemo.actVolumeLeft))
{
volL = actMemo.actRampVolLeft = actMemo.actVolumeLeft;
actMemo.deltaVolLeft = 0;
}
else
{
actMemo.actRampVolLeft += actMemo.deltaVolLeft;
}
// Volume Ramping (deClick) Right!
long volR = actMemo.actRampVolRight;
if ((actMemo.deltaVolRight>0 && volR>actMemo.actVolumeRight) ||
(actMemo.deltaVolRight<0 && volR<actMemo.actVolumeRight))
{
volR = actMemo.actRampVolRight = actMemo.actVolumeRight;
actMemo.deltaVolRight = 0;
}
else
{
actMemo.actRampVolRight += actMemo.deltaVolRight;
}
// Fit into volume for the two channels
leftBuffer[i] += (int)((sample * volL) >> Helpers.MAXVOLUMESHIFT);
rightBuffer[i]+= (int)((sample * volR) >> Helpers.MAXVOLUMESHIFT);
// Now fit the loops of the current Sample
fitIntoLoops(actMemo);
if (actMemo.instrumentFinished) break;
}
} | [
"private",
"void",
"mixChannelIntoBuffers",
"(",
"final",
"int",
"[",
"]",
"leftBuffer",
",",
"final",
"int",
"[",
"]",
"rightBuffer",
",",
"final",
"int",
"startIndex",
",",
"final",
"int",
"endIndex",
",",
"final",
"ChannelMemory",
"actMemo",
")",
"{",
"fo... | Fill the buffers with channel data
@since 18.06.2006
@param leftBuffer
@param rightBuffer
@param startIndex
@param amount
@param actMemo | [
"Fill",
"the",
"buffers",
"with",
"channel",
"data"
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L1240-L1283 |
EdwardRaff/JSAT | JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java | OnlineLDAsvi.setKappa | public void setKappa(double kappa)
{
if(kappa < 0.5 || kappa > 1.0 || Double.isNaN(kappa))
throw new IllegalArgumentException("Kapp must be in [0.5, 1], not " + kappa);
this.kappa = kappa;
} | java | public void setKappa(double kappa)
{
if(kappa < 0.5 || kappa > 1.0 || Double.isNaN(kappa))
throw new IllegalArgumentException("Kapp must be in [0.5, 1], not " + kappa);
this.kappa = kappa;
} | [
"public",
"void",
"setKappa",
"(",
"double",
"kappa",
")",
"{",
"if",
"(",
"kappa",
"<",
"0.5",
"||",
"kappa",
">",
"1.0",
"||",
"Double",
".",
"isNaN",
"(",
"kappa",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Kapp must be in [0.5, 1], not... | The "forgetfulness" factor in the learning rate. Larger values increase
the rate at which old information is "forgotten"
@param kappa the forgetfulness factor in [0.5, 1] | [
"The",
"forgetfulness",
"factor",
"in",
"the",
"learning",
"rate",
".",
"Larger",
"values",
"increase",
"the",
"rate",
"at",
"which",
"old",
"information",
"is",
"forgotten"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java#L331-L336 |
yidongnan/grpc-spring-boot-starter | grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/channelfactory/AbstractChannelFactory.java | AbstractChannelFactory.configureSecurity | protected void configureSecurity(final T builder, final String name) {
final GrpcChannelProperties properties = getPropertiesFor(name);
final Security security = properties.getSecurity();
if (properties.getNegotiationType() != NegotiationType.TLS // non-default
|| isNonNullAndNonBlank(security.getAuthorityOverride())
|| isNonNullAndNonBlank(security.getCertificateChainPath())
|| isNonNullAndNonBlank(security.getPrivateKeyPath())
|| isNonNullAndNonBlank(security.getTrustCertCollectionPath())) {
throw new IllegalStateException(
"Security is configured but this implementation does not support security!");
}
} | java | protected void configureSecurity(final T builder, final String name) {
final GrpcChannelProperties properties = getPropertiesFor(name);
final Security security = properties.getSecurity();
if (properties.getNegotiationType() != NegotiationType.TLS // non-default
|| isNonNullAndNonBlank(security.getAuthorityOverride())
|| isNonNullAndNonBlank(security.getCertificateChainPath())
|| isNonNullAndNonBlank(security.getPrivateKeyPath())
|| isNonNullAndNonBlank(security.getTrustCertCollectionPath())) {
throw new IllegalStateException(
"Security is configured but this implementation does not support security!");
}
} | [
"protected",
"void",
"configureSecurity",
"(",
"final",
"T",
"builder",
",",
"final",
"String",
"name",
")",
"{",
"final",
"GrpcChannelProperties",
"properties",
"=",
"getPropertiesFor",
"(",
"name",
")",
";",
"final",
"Security",
"security",
"=",
"properties",
... | Configures the security options that should be used by the channel.
@param builder The channel builder to configure.
@param name The name of the client to configure. | [
"Configures",
"the",
"security",
"options",
"that",
"should",
"be",
"used",
"by",
"the",
"channel",
"."
] | train | https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/channelfactory/AbstractChannelFactory.java#L183-L195 |
VoltDB/voltdb | src/frontend/org/voltcore/utils/CoreUtils.java | CoreUtils.getCachedSingleThreadExecutor | public static ListeningExecutorService getCachedSingleThreadExecutor(String name, long keepAlive) {
return MoreExecutors.listeningDecorator(new ThreadPoolExecutor(
0,
1,
keepAlive,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(),
CoreUtils.getThreadFactory(null, name, SMALL_STACK_SIZE, false, null)));
} | java | public static ListeningExecutorService getCachedSingleThreadExecutor(String name, long keepAlive) {
return MoreExecutors.listeningDecorator(new ThreadPoolExecutor(
0,
1,
keepAlive,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(),
CoreUtils.getThreadFactory(null, name, SMALL_STACK_SIZE, false, null)));
} | [
"public",
"static",
"ListeningExecutorService",
"getCachedSingleThreadExecutor",
"(",
"String",
"name",
",",
"long",
"keepAlive",
")",
"{",
"return",
"MoreExecutors",
".",
"listeningDecorator",
"(",
"new",
"ThreadPoolExecutor",
"(",
"0",
",",
"1",
",",
"keepAlive",
... | Get a single thread executor that caches its thread meaning that the thread will terminate
after keepAlive milliseconds. A new thread will be created the next time a task arrives and that will be kept
around for keepAlive milliseconds. On creation no thread is allocated, the first task creates a thread.
Uses LinkedTransferQueue to accept tasks and has a small stack. | [
"Get",
"a",
"single",
"thread",
"executor",
"that",
"caches",
"its",
"thread",
"meaning",
"that",
"the",
"thread",
"will",
"terminate",
"after",
"keepAlive",
"milliseconds",
".",
"A",
"new",
"thread",
"will",
"be",
"created",
"the",
"next",
"time",
"a",
"tas... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/utils/CoreUtils.java#L429-L437 |
Netflix/netflix-graph | src/main/java/com/netflix/nfgraph/NFGraph.java | NFGraph.getConnectionSet | public OrdinalSet getConnectionSet(String nodeType, int ordinal, String propertyName) {
return getConnectionSet(0, nodeType, ordinal, propertyName);
} | java | public OrdinalSet getConnectionSet(String nodeType, int ordinal, String propertyName) {
return getConnectionSet(0, nodeType, ordinal, propertyName);
} | [
"public",
"OrdinalSet",
"getConnectionSet",
"(",
"String",
"nodeType",
",",
"int",
"ordinal",
",",
"String",
"propertyName",
")",
"{",
"return",
"getConnectionSet",
"(",
"0",
",",
"nodeType",
",",
"ordinal",
",",
"propertyName",
")",
";",
"}"
] | Retrieve an {@link OrdinalSet} over all connected ordinals, given the type and ordinal of the originating node, and the property by which this node is connected.
@return an {@link OrdinalSet} over all connected ordinals | [
"Retrieve",
"an",
"{",
"@link",
"OrdinalSet",
"}",
"over",
"all",
"connected",
"ordinals",
"given",
"the",
"type",
"and",
"ordinal",
"of",
"the",
"originating",
"node",
"and",
"the",
"property",
"by",
"which",
"this",
"node",
"is",
"connected",
"."
] | train | https://github.com/Netflix/netflix-graph/blob/ee129252a08a9f51dd296d6fca2f0b28b7be284e/src/main/java/com/netflix/nfgraph/NFGraph.java#L144-L146 |
spring-cloud/spring-cloud-sleuth | spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java | TracingChannelInterceptor.addTags | void addTags(Message<?> message, SpanCustomizer result, MessageChannel channel) {
// TODO topic etc
if (channel != null) {
result.tag("channel", messageChannelName(channel));
}
} | java | void addTags(Message<?> message, SpanCustomizer result, MessageChannel channel) {
// TODO topic etc
if (channel != null) {
result.tag("channel", messageChannelName(channel));
}
} | [
"void",
"addTags",
"(",
"Message",
"<",
"?",
">",
"message",
",",
"SpanCustomizer",
"result",
",",
"MessageChannel",
"channel",
")",
"{",
"// TODO topic etc",
"if",
"(",
"channel",
"!=",
"null",
")",
"{",
"result",
".",
"tag",
"(",
"\"channel\"",
",",
"mes... | When an upstream context was not present, lookup keys are unlikely added.
@param message a message to append tags to
@param result span to customize
@param channel channel to which a message was sent | [
"When",
"an",
"upstream",
"context",
"was",
"not",
"present",
"lookup",
"keys",
"are",
"unlikely",
"added",
"."
] | train | https://github.com/spring-cloud/spring-cloud-sleuth/blob/f29c05fb8fba33e23aa21bb13aeb13ab8d27b485/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java#L353-L358 |
mangstadt/biweekly | src/main/java/biweekly/io/scribe/property/RecurrencePropertyScribe.java | RecurrencePropertyScribe.integerValueOf | private static Integer integerValueOf(String value) {
try {
return Integer.valueOf(value);
} catch (NumberFormatException e) {
throw new CannotParseException(40, value);
}
} | java | private static Integer integerValueOf(String value) {
try {
return Integer.valueOf(value);
} catch (NumberFormatException e) {
throw new CannotParseException(40, value);
}
} | [
"private",
"static",
"Integer",
"integerValueOf",
"(",
"String",
"value",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"valueOf",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"throw",
"new",
"CannotParseException",
"(... | Same as {@link Integer#valueOf(String)}, but throws a
{@link CannotParseException} when it fails.
@param value the string to parse
@return the parse integer
@throws CannotParseException if the string cannot be parsed | [
"Same",
"as",
"{"
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/scribe/property/RecurrencePropertyScribe.java#L550-L556 |
mangstadt/biweekly | src/main/java/biweekly/component/Observance.java | Observance.setDateStart | public DateStart setDateStart(DateTimeComponents rawComponents) {
return setDateStart((rawComponents == null) ? null : new ICalDate(rawComponents, true));
} | java | public DateStart setDateStart(DateTimeComponents rawComponents) {
return setDateStart((rawComponents == null) ? null : new ICalDate(rawComponents, true));
} | [
"public",
"DateStart",
"setDateStart",
"(",
"DateTimeComponents",
"rawComponents",
")",
"{",
"return",
"setDateStart",
"(",
"(",
"rawComponents",
"==",
"null",
")",
"?",
"null",
":",
"new",
"ICalDate",
"(",
"rawComponents",
",",
"true",
")",
")",
";",
"}"
] | Sets the date that the timezone observance starts.
@param rawComponents the start date or null to remove
@return the property that was created
@see <a href="http://tools.ietf.org/html/rfc5545#page-97">RFC 5545
p.97-8</a>
@see <a href="http://tools.ietf.org/html/rfc2445#page-93">RFC 2445
p.93-4</a> | [
"Sets",
"the",
"date",
"that",
"the",
"timezone",
"observance",
"starts",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/Observance.java#L121-L123 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java | EJSHome.createRemoteBusinessObject | public Object createRemoteBusinessObject(int interfaceIndex, ManagedObjectContext context)
throws RemoteException,
CreateException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "createRemoteBusinessObject: " + interfaceIndex); // d367572.7
Object result;
EJSWrapperCommon commonWrapper = createBusinessObjectWrappers(context);
result = commonWrapper.getRemoteBusinessObject(interfaceIndex);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc,
"createRemoteBusinessObject returning: " + Util.identity(result)); // d367572.7
return result;
} | java | public Object createRemoteBusinessObject(int interfaceIndex, ManagedObjectContext context)
throws RemoteException,
CreateException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "createRemoteBusinessObject: " + interfaceIndex); // d367572.7
Object result;
EJSWrapperCommon commonWrapper = createBusinessObjectWrappers(context);
result = commonWrapper.getRemoteBusinessObject(interfaceIndex);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc,
"createRemoteBusinessObject returning: " + Util.identity(result)); // d367572.7
return result;
} | [
"public",
"Object",
"createRemoteBusinessObject",
"(",
"int",
"interfaceIndex",
",",
"ManagedObjectContext",
"context",
")",
"throws",
"RemoteException",
",",
"CreateException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
... | Method to create a remote business reference object. Once the index
of the interface is found, it is then passed through the EJSWrapperCommon
for the rest of the logic.
@param interfaceIndex the remote business interface index
@param context the context for creating the object, or null | [
"Method",
"to",
"create",
"a",
"remote",
"business",
"reference",
"object",
".",
"Once",
"the",
"index",
"of",
"the",
"interface",
"is",
"found",
"it",
"is",
"then",
"passed",
"through",
"the",
"EJSWrapperCommon",
"for",
"the",
"rest",
"of",
"the",
"logic",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java#L1660-L1679 |
wcm-io/wcm-io-sling | commons/src/main/java/io/wcm/sling/commons/resource/ImmutableValueMap.java | ImmutableValueMap.of | public static @NotNull ImmutableValueMap of(
@NotNull String k1, @NotNull Object v1,
@NotNull String k2, @NotNull Object v2,
@NotNull String k3, @NotNull Object v3) {
return new ImmutableValueMap(ImmutableMap.<String, Object>of(k1, v1, k2, v2, k3, v3));
} | java | public static @NotNull ImmutableValueMap of(
@NotNull String k1, @NotNull Object v1,
@NotNull String k2, @NotNull Object v2,
@NotNull String k3, @NotNull Object v3) {
return new ImmutableValueMap(ImmutableMap.<String, Object>of(k1, v1, k2, v2, k3, v3));
} | [
"public",
"static",
"@",
"NotNull",
"ImmutableValueMap",
"of",
"(",
"@",
"NotNull",
"String",
"k1",
",",
"@",
"NotNull",
"Object",
"v1",
",",
"@",
"NotNull",
"String",
"k2",
",",
"@",
"NotNull",
"Object",
"v2",
",",
"@",
"NotNull",
"String",
"k3",
",",
... | Returns an immutable map containing the given entries, in order.
@param k1 Key 1
@param v1 Value 1
@param k2 Key 2
@param v2 Value 2
@param k3 Key 3
@param v3 Value 3
@return ImmutableValueMap
@throws IllegalArgumentException if duplicate keys are provided | [
"Returns",
"an",
"immutable",
"map",
"containing",
"the",
"given",
"entries",
"in",
"order",
"."
] | train | https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/resource/ImmutableValueMap.java#L222-L227 |
marklogic/java-client-api | marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/datamovement/MoveDataBetweenMarklogicDBs.java | MoveDataBetweenMarklogicDBs.installTransform | private void installTransform(DatabaseClient client) {
// this transform seeks orders associated with a single customer
// record and injects the orders into the customer record
String transform =
"function transform_function(context, params, content) { " +
" var uri = context.uri; " +
" var customer = content.toObject(); " +
" var orders = cts.search(cts.andQuery([" +
" cts.collectionQuery('orders'), " +
" cts.jsonPropertyValueQuery('customerid', customer.id)" +
" ])); " +
" if ( fn.count(orders) > 0 ) { " +
" customer.orders = new Array(); " +
" for (let order of orders) { " +
" var customerOrder = order.toObject(); " +
" delete customerOrder.customerid; " +
" customer.orders.push(customerOrder); " +
" } " +
" } " +
" return customer; " +
"}; " +
"exports.transform = transform_function";
ServerConfigurationManager confMgr = client.newServerConfigManager();
TransformExtensionsManager transformMgr = confMgr.newTransformExtensionsManager();
transformMgr.writeJavascriptTransformAs(transformName, transform);
} | java | private void installTransform(DatabaseClient client) {
// this transform seeks orders associated with a single customer
// record and injects the orders into the customer record
String transform =
"function transform_function(context, params, content) { " +
" var uri = context.uri; " +
" var customer = content.toObject(); " +
" var orders = cts.search(cts.andQuery([" +
" cts.collectionQuery('orders'), " +
" cts.jsonPropertyValueQuery('customerid', customer.id)" +
" ])); " +
" if ( fn.count(orders) > 0 ) { " +
" customer.orders = new Array(); " +
" for (let order of orders) { " +
" var customerOrder = order.toObject(); " +
" delete customerOrder.customerid; " +
" customer.orders.push(customerOrder); " +
" } " +
" } " +
" return customer; " +
"}; " +
"exports.transform = transform_function";
ServerConfigurationManager confMgr = client.newServerConfigManager();
TransformExtensionsManager transformMgr = confMgr.newTransformExtensionsManager();
transformMgr.writeJavascriptTransformAs(transformName, transform);
} | [
"private",
"void",
"installTransform",
"(",
"DatabaseClient",
"client",
")",
"{",
"// this transform seeks orders associated with a single customer",
"// record and injects the orders into the customer record",
"String",
"transform",
"=",
"\"function transform_function(context, params, con... | /*
Install the transform on the server which would find all the orders made by
the customer and append all the orders information to the corresponding
customer document. | [
"/",
"*",
"Install",
"the",
"transform",
"on",
"the",
"server",
"which",
"would",
"find",
"all",
"the",
"orders",
"made",
"by",
"the",
"customer",
"and",
"append",
"all",
"the",
"orders",
"information",
"to",
"the",
"corresponding",
"customer",
"document",
"... | train | https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/datamovement/MoveDataBetweenMarklogicDBs.java#L183-L208 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuDeviceGetLuid | public static int cuDeviceGetLuid(byte luid[], int deviceNodeMask[], CUdevice dev)
{
return checkResult(cuDeviceGetLuidNative(luid, deviceNodeMask, dev));
} | java | public static int cuDeviceGetLuid(byte luid[], int deviceNodeMask[], CUdevice dev)
{
return checkResult(cuDeviceGetLuidNative(luid, deviceNodeMask, dev));
} | [
"public",
"static",
"int",
"cuDeviceGetLuid",
"(",
"byte",
"luid",
"[",
"]",
",",
"int",
"deviceNodeMask",
"[",
"]",
",",
"CUdevice",
"dev",
")",
"{",
"return",
"checkResult",
"(",
"cuDeviceGetLuidNative",
"(",
"luid",
",",
"deviceNodeMask",
",",
"dev",
")",... | Return an LUID and device node mask for the device.
Return identifying information (\p luid and \p deviceNodeMask) to allow
matching device with graphics APIs.
@param luid - Returned LUID
@param deviceNodeMask - Returned device node mask
@param dev - Device to get identifier string for
@return CUDA_SUCCESS,
CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_VALUE,
CUDA_ERROR_INVALID_DEVICE
@see JCudaDriver#cuDeviceGetAttribute
JCudaDriver#cuDeviceGetCount
JCudaDriver#cuDeviceGetName
JCudaDriver#cuDeviceGet
JCudaDriver#cuDeviceTotalMem
JCudaDriver#cudaGetDeviceProperties | [
"Return",
"an",
"LUID",
"and",
"device",
"node",
"mask",
"for",
"the",
"device",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L712-L715 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.client/src/com/ibm/ws/security/client/internal/authentication/ClientAuthenticationService.java | ClientAuthenticationService.createBasicAuthSubject | protected Subject createBasicAuthSubject(AuthenticationData authenticationData, Subject subject) throws WSLoginFailedException, CredentialException {
Subject basicAuthSubject = subject != null ? subject : new Subject();
String loginRealm = (String) authenticationData.get(AuthenticationData.REALM);
String username = (String) authenticationData.get(AuthenticationData.USERNAME);
String password = getPassword((char[]) authenticationData.get(AuthenticationData.PASSWORD));
if (username == null || username.isEmpty() || password == null || password.isEmpty()) {
throw new WSLoginFailedException(TraceNLS.getFormattedMessage(
this.getClass(),
TraceConstants.MESSAGE_BUNDLE,
"JAAS_LOGIN_MISSING_CREDENTIALS",
new Object[] {},
"CWWKS1171E: The login on the client application failed because the user name or password is null. Ensure the CallbackHandler implementation is gathering the necessary credentials."));
}
CredentialsService credentialsService = credentialsServiceRef.getServiceWithException();
credentialsService.setBasicAuthCredential(basicAuthSubject, loginRealm, username, password);
Principal principal = new WSPrincipal(username, null, WSPrincipal.AUTH_METHOD_BASIC);
basicAuthSubject.getPrincipals().add(principal);
return basicAuthSubject;
} | java | protected Subject createBasicAuthSubject(AuthenticationData authenticationData, Subject subject) throws WSLoginFailedException, CredentialException {
Subject basicAuthSubject = subject != null ? subject : new Subject();
String loginRealm = (String) authenticationData.get(AuthenticationData.REALM);
String username = (String) authenticationData.get(AuthenticationData.USERNAME);
String password = getPassword((char[]) authenticationData.get(AuthenticationData.PASSWORD));
if (username == null || username.isEmpty() || password == null || password.isEmpty()) {
throw new WSLoginFailedException(TraceNLS.getFormattedMessage(
this.getClass(),
TraceConstants.MESSAGE_BUNDLE,
"JAAS_LOGIN_MISSING_CREDENTIALS",
new Object[] {},
"CWWKS1171E: The login on the client application failed because the user name or password is null. Ensure the CallbackHandler implementation is gathering the necessary credentials."));
}
CredentialsService credentialsService = credentialsServiceRef.getServiceWithException();
credentialsService.setBasicAuthCredential(basicAuthSubject, loginRealm, username, password);
Principal principal = new WSPrincipal(username, null, WSPrincipal.AUTH_METHOD_BASIC);
basicAuthSubject.getPrincipals().add(principal);
return basicAuthSubject;
} | [
"protected",
"Subject",
"createBasicAuthSubject",
"(",
"AuthenticationData",
"authenticationData",
",",
"Subject",
"subject",
")",
"throws",
"WSLoginFailedException",
",",
"CredentialException",
"{",
"Subject",
"basicAuthSubject",
"=",
"subject",
"!=",
"null",
"?",
"subje... | Create the basic auth subject using the given authentication data
@param authenticationData the user, password and realm to create the subject
@param subject the partial subject, can be null
@return a basic auth subject that has not been authenticated yet
@throws WSLoginFailedException if the user or password are <null> or empty
@throws CredentialException if there was a problem creating the WSCredential | [
"Create",
"the",
"basic",
"auth",
"subject",
"using",
"the",
"given",
"authentication",
"data"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.client/src/com/ibm/ws/security/client/internal/authentication/ClientAuthenticationService.java#L126-L145 |
GwtMaterialDesign/gwt-material-table | src/main/java/gwt/material/design/client/ui/table/cell/Column.java | Column.setStyleProperty | public final void setStyleProperty(StyleName styleName, String value) {
if(styleProps == null) {
styleProps = new HashMap<>();
}
styleProps.put(styleName, value);
} | java | public final void setStyleProperty(StyleName styleName, String value) {
if(styleProps == null) {
styleProps = new HashMap<>();
}
styleProps.put(styleName, value);
} | [
"public",
"final",
"void",
"setStyleProperty",
"(",
"StyleName",
"styleName",
",",
"String",
"value",
")",
"{",
"if",
"(",
"styleProps",
"==",
"null",
")",
"{",
"styleProps",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"styleProps",
".",
"put",
"(",... | Set a style property using its name as the key. Please ensure the style name and value
are appropriately configured or it may result in unexpected behavior.
@param styleName the style name as seen here {@link Style#STYLE_Z_INDEX} for example.
@param value the string value required for the given style property. | [
"Set",
"a",
"style",
"property",
"using",
"its",
"name",
"as",
"the",
"key",
".",
"Please",
"ensure",
"the",
"style",
"name",
"and",
"value",
"are",
"appropriately",
"configured",
"or",
"it",
"may",
"result",
"in",
"unexpected",
"behavior",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/cell/Column.java#L277-L282 |
rometools/rome | rome-propono/src/main/java/com/rometools/propono/atom/client/ClientCollection.java | ClientCollection.getEntry | public ClientEntry getEntry(final String uri) throws ProponoException {
final GetMethod method = new GetMethod(uri);
authStrategy.addAuthentication(httpClient, method);
try {
httpClient.executeMethod(method);
if (method.getStatusCode() != 200) {
throw new ProponoException("ERROR HTTP status code=" + method.getStatusCode());
}
final Entry romeEntry = Atom10Parser.parseEntry(new InputStreamReader(method.getResponseBodyAsStream()), uri, Locale.US);
if (!romeEntry.isMediaEntry()) {
return new ClientEntry(service, this, romeEntry, false);
} else {
return new ClientMediaEntry(service, this, romeEntry, false);
}
} catch (final Exception e) {
throw new ProponoException("ERROR: getting or parsing entry/media, HTTP code: ", e);
} finally {
method.releaseConnection();
}
} | java | public ClientEntry getEntry(final String uri) throws ProponoException {
final GetMethod method = new GetMethod(uri);
authStrategy.addAuthentication(httpClient, method);
try {
httpClient.executeMethod(method);
if (method.getStatusCode() != 200) {
throw new ProponoException("ERROR HTTP status code=" + method.getStatusCode());
}
final Entry romeEntry = Atom10Parser.parseEntry(new InputStreamReader(method.getResponseBodyAsStream()), uri, Locale.US);
if (!romeEntry.isMediaEntry()) {
return new ClientEntry(service, this, romeEntry, false);
} else {
return new ClientMediaEntry(service, this, romeEntry, false);
}
} catch (final Exception e) {
throw new ProponoException("ERROR: getting or parsing entry/media, HTTP code: ", e);
} finally {
method.releaseConnection();
}
} | [
"public",
"ClientEntry",
"getEntry",
"(",
"final",
"String",
"uri",
")",
"throws",
"ProponoException",
"{",
"final",
"GetMethod",
"method",
"=",
"new",
"GetMethod",
"(",
"uri",
")",
";",
"authStrategy",
".",
"addAuthentication",
"(",
"httpClient",
",",
"method",... | Get full entry specified by entry edit URI. Note that entry may or may not be associated with
this collection.
@return ClientEntry or ClientMediaEntry specified by URI. | [
"Get",
"full",
"entry",
"specified",
"by",
"entry",
"edit",
"URI",
".",
"Note",
"that",
"entry",
"may",
"or",
"may",
"not",
"be",
"associated",
"with",
"this",
"collection",
"."
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/client/ClientCollection.java#L100-L119 |
konvergeio/cofoja | src/main/java/com/google/java/contract/core/apt/ContractJavaFileManager.java | ContractJavaFileManager.setLocation | @Requires("location != null")
public void setLocation(Location location, List<? extends File> path)
throws IOException {
fileManager.setLocation(location, path);
} | java | @Requires("location != null")
public void setLocation(Location location, List<? extends File> path)
throws IOException {
fileManager.setLocation(location, path);
} | [
"@",
"Requires",
"(",
"\"location != null\"",
")",
"public",
"void",
"setLocation",
"(",
"Location",
"location",
",",
"List",
"<",
"?",
"extends",
"File",
">",
"path",
")",
"throws",
"IOException",
"{",
"fileManager",
".",
"setLocation",
"(",
"location",
",",
... | Sets the list of paths associated with {@code location}.
@param location the affected location
@param path a list of paths, or {@code null} to reset to default | [
"Sets",
"the",
"list",
"of",
"paths",
"associated",
"with",
"{",
"@code",
"location",
"}",
"."
] | train | https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/apt/ContractJavaFileManager.java#L121-L125 |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java | AbstractSubclassFactory.overrideEquals | protected boolean overrideEquals(MethodBodyCreator creator) {
Method equals = null;
ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
try {
equals = data.getMethod("equals", Boolean.TYPE, Object.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
return overrideMethod(equals, MethodIdentifier.getIdentifierForMethod(equals), creator);
} | java | protected boolean overrideEquals(MethodBodyCreator creator) {
Method equals = null;
ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
try {
equals = data.getMethod("equals", Boolean.TYPE, Object.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
return overrideMethod(equals, MethodIdentifier.getIdentifierForMethod(equals), creator);
} | [
"protected",
"boolean",
"overrideEquals",
"(",
"MethodBodyCreator",
"creator",
")",
"{",
"Method",
"equals",
"=",
"null",
";",
"ClassMetadataSource",
"data",
"=",
"reflectionMetadataSource",
".",
"getClassMetadata",
"(",
"Object",
".",
"class",
")",
";",
"try",
"{... | Override the equals method using the given {@link MethodBodyCreator}.
@param creator the method body creator to use
@return true if the method was not already overridden | [
"Override",
"the",
"equals",
"method",
"using",
"the",
"given",
"{",
"@link",
"MethodBodyCreator",
"}",
"."
] | train | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java#L246-L255 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/util/JMSServices.java | JMSServices.getQueue | public Queue getQueue(Session session, String commonName) throws ServiceLocatorException {
Queue queue = (Queue) queueCache.get(commonName);
if (queue == null) {
try {
String name = namingProvider.qualifyJmsQueueName(commonName);
queue = jmsProvider.getQueue(session, namingProvider, name);
if (queue != null)
queueCache.put(commonName, queue);
}
catch (Exception ex) {
throw new ServiceLocatorException(-1, ex.getMessage(), ex);
}
}
return queue;
} | java | public Queue getQueue(Session session, String commonName) throws ServiceLocatorException {
Queue queue = (Queue) queueCache.get(commonName);
if (queue == null) {
try {
String name = namingProvider.qualifyJmsQueueName(commonName);
queue = jmsProvider.getQueue(session, namingProvider, name);
if (queue != null)
queueCache.put(commonName, queue);
}
catch (Exception ex) {
throw new ServiceLocatorException(-1, ex.getMessage(), ex);
}
}
return queue;
} | [
"public",
"Queue",
"getQueue",
"(",
"Session",
"session",
",",
"String",
"commonName",
")",
"throws",
"ServiceLocatorException",
"{",
"Queue",
"queue",
"=",
"(",
"Queue",
")",
"queueCache",
".",
"get",
"(",
"commonName",
")",
";",
"if",
"(",
"queue",
"==",
... | Uses the container-specific qualifier to look up a JMS queue.
@param commonName
the vendor-neutral logical queue name
@return javax.jms.Queue | [
"Uses",
"the",
"container",
"-",
"specific",
"qualifier",
"to",
"look",
"up",
"a",
"JMS",
"queue",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/JMSServices.java#L221-L235 |
dnsjava/dnsjava | org/xbill/DNS/Record.java | Record.newRecord | public static Record
newRecord(Name name, int type, int dclass, long ttl, byte [] data) {
return newRecord(name, type, dclass, ttl, data.length, data);
} | java | public static Record
newRecord(Name name, int type, int dclass, long ttl, byte [] data) {
return newRecord(name, type, dclass, ttl, data.length, data);
} | [
"public",
"static",
"Record",
"newRecord",
"(",
"Name",
"name",
",",
"int",
"type",
",",
"int",
"dclass",
",",
"long",
"ttl",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"return",
"newRecord",
"(",
"name",
",",
"type",
",",
"dclass",
",",
"ttl",
",",
... | Creates a new record, with the given parameters.
@param name The owner name of the record.
@param type The record's type.
@param dclass The record's class.
@param ttl The record's time to live.
@param data The complete rdata of the record, in uncompressed DNS wire
format. | [
"Creates",
"a",
"new",
"record",
"with",
"the",
"given",
"parameters",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Record.java#L137-L140 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java | CPOptionPersistenceImpl.fetchByC_ERC | @Override
public CPOption fetchByC_ERC(long companyId, String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | java | @Override
public CPOption fetchByC_ERC(long companyId, String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | [
"@",
"Override",
"public",
"CPOption",
"fetchByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"{",
"return",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
",",
"true",
")",
";",
"}"
] | Returns the cp option where companyId = ? and externalReferenceCode = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching cp option, or <code>null</code> if a matching cp option could not be found | [
"Returns",
"the",
"cp",
"option",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L2274-L2277 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/Keyspace.java | Keyspace.clearSnapshot | public static void clearSnapshot(String snapshotName, String keyspace)
{
List<File> snapshotDirs = Directories.getKSChildDirectories(keyspace);
Directories.clearSnapshot(snapshotName, snapshotDirs);
} | java | public static void clearSnapshot(String snapshotName, String keyspace)
{
List<File> snapshotDirs = Directories.getKSChildDirectories(keyspace);
Directories.clearSnapshot(snapshotName, snapshotDirs);
} | [
"public",
"static",
"void",
"clearSnapshot",
"(",
"String",
"snapshotName",
",",
"String",
"keyspace",
")",
"{",
"List",
"<",
"File",
">",
"snapshotDirs",
"=",
"Directories",
".",
"getKSChildDirectories",
"(",
"keyspace",
")",
";",
"Directories",
".",
"clearSnap... | Clear all the snapshots for a given keyspace.
@param snapshotName the user supplied snapshot name. It empty or null,
all the snapshots will be cleaned | [
"Clear",
"all",
"the",
"snapshots",
"for",
"a",
"given",
"keyspace",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Keyspace.java#L250-L254 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_exchangeAccount_services_domain_GET | public OvhExchangeAccountService packName_exchangeAccount_services_domain_GET(String packName, String domain) throws IOException {
String qPath = "/pack/xdsl/{packName}/exchangeAccount/services/{domain}";
StringBuilder sb = path(qPath, packName, domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhExchangeAccountService.class);
} | java | public OvhExchangeAccountService packName_exchangeAccount_services_domain_GET(String packName, String domain) throws IOException {
String qPath = "/pack/xdsl/{packName}/exchangeAccount/services/{domain}";
StringBuilder sb = path(qPath, packName, domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhExchangeAccountService.class);
} | [
"public",
"OvhExchangeAccountService",
"packName_exchangeAccount_services_domain_GET",
"(",
"String",
"packName",
",",
"String",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/exchangeAccount/services/{domain}\"",
";",
"StringBuilder... | Get this object properties
REST: GET /pack/xdsl/{packName}/exchangeAccount/services/{domain}
@param packName [required] The internal name of your pack
@param domain [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L675-L680 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/FormatUtilities.java | FormatUtilities.getFormattedDateTime | static public String getFormattedDateTime(long dt, TimeZone tz, String country)
{
return getFormattedDateTime(dt, DATETIME_FORMAT, tz, country, 0L);
} | java | static public String getFormattedDateTime(long dt, TimeZone tz, String country)
{
return getFormattedDateTime(dt, DATETIME_FORMAT, tz, country, 0L);
} | [
"static",
"public",
"String",
"getFormattedDateTime",
"(",
"long",
"dt",
",",
"TimeZone",
"tz",
",",
"String",
"country",
")",
"{",
"return",
"getFormattedDateTime",
"(",
"dt",
",",
"DATETIME_FORMAT",
",",
"tz",
",",
"country",
",",
"0L",
")",
";",
"}"
] | Returns the given date formatted as "dd-MM-yyyy HH:mm:ss" in the given timezone and country.
@param dt The date to be formatted
@param tz The timezone associated with the date
@param country The country associated with the date
@return The given date formatted as "dd-MM-yyyy HH:mm:ss" in the given timezone and country | [
"Returns",
"the",
"given",
"date",
"formatted",
"as",
"dd",
"-",
"MM",
"-",
"yyyy",
"HH",
":",
"mm",
":",
"ss",
"in",
"the",
"given",
"timezone",
"and",
"country",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/FormatUtilities.java#L180-L183 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.dropWhile | public static <T> T[] dropWhile(T[] self, @ClosureParams(FirstParam.Component.class) Closure<?> condition) {
int num = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
while (num < self.length) {
if (bcw.call(self[num])) {
num += 1;
} else {
break;
}
}
return drop(self, num);
} | java | public static <T> T[] dropWhile(T[] self, @ClosureParams(FirstParam.Component.class) Closure<?> condition) {
int num = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
while (num < self.length) {
if (bcw.call(self[num])) {
num += 1;
} else {
break;
}
}
return drop(self, num);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"dropWhile",
"(",
"T",
"[",
"]",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"Component",
".",
"class",
")",
"Closure",
"<",
"?",
">",
"condition",
")",
"{",
"int",
"num",
"=",
"0",
... | Create a suffix of the given array by dropping as many elements as possible from the
front of the original array such that calling the given closure condition evaluates to
true when passed each of the dropped elements.
<pre class="groovyTestCase">
def nums = [ 1, 3, 2 ] as Integer[]
assert nums.dropWhile{ it {@code <=} 3 } == [ ] as Integer[]
assert nums.dropWhile{ it {@code <} 3 } == [ 3, 2 ] as Integer[]
assert nums.dropWhile{ it != 2 } == [ 2 ] as Integer[]
assert nums.dropWhile{ it == 0 } == [ 1, 3, 2 ] as Integer[]
</pre>
@param self the original array
@param condition the closure that must evaluate to true to
continue dropping elements
@return the shortest suffix of the given array such that the given closure condition
evaluates to true for each element dropped from the front of the array
@since 1.8.7 | [
"Create",
"a",
"suffix",
"of",
"the",
"given",
"array",
"by",
"dropping",
"as",
"many",
"elements",
"as",
"possible",
"from",
"the",
"front",
"of",
"the",
"original",
"array",
"such",
"that",
"calling",
"the",
"given",
"closure",
"condition",
"evaluates",
"t... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L11206-L11217 |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Capacities.java | Capacities.createSkillDelegator | @Pure
public static <C extends Capacity> C createSkillDelegator(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller)
throws Exception {
final String name = capacity.getName() + CAPACITY_WRAPPER_NAME;
final Class<?> type = Class.forName(name, true, capacity.getClassLoader());
final Constructor<?> cons = type.getDeclaredConstructor(capacity, AgentTrait.class);
return capacity.cast(cons.newInstance(originalSkill, capacityCaller));
} | java | @Pure
public static <C extends Capacity> C createSkillDelegator(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller)
throws Exception {
final String name = capacity.getName() + CAPACITY_WRAPPER_NAME;
final Class<?> type = Class.forName(name, true, capacity.getClassLoader());
final Constructor<?> cons = type.getDeclaredConstructor(capacity, AgentTrait.class);
return capacity.cast(cons.newInstance(originalSkill, capacityCaller));
} | [
"@",
"Pure",
"public",
"static",
"<",
"C",
"extends",
"Capacity",
">",
"C",
"createSkillDelegator",
"(",
"Skill",
"originalSkill",
",",
"Class",
"<",
"C",
">",
"capacity",
",",
"AgentTrait",
"capacityCaller",
")",
"throws",
"Exception",
"{",
"final",
"String",... | Create a delegator for the given skill.
<p>The delegator is wrapping the original skill in order to set the value of the caller
that will be replied by {@link #getCaller()}. The associated caller is given as argument.
<p>The delegator is an instance of an specific inner type, sub-type of {@link Capacity.ContextAwareCapacityWrapper},
which is declared in the given {@code capacity}.
<p>This function fails if the delegator instance cannot be created due to inner type not found, invalid constructor signature,
run-time exception when creating the instance.
This functions assumes that the name of the definition type is the same as {@link Capacity.ContextAwareCapacityWrapper},
and this definition extends the delegator definition of the first super type of the {@code capacity}, and implements
all the super types of the {@code capacity}. The expected constructor for this inner type has the same
signature as the one of {@link Capacity.ContextAwareCapacityWrapper}.
<p>The function {@link #createSkillDelegatorIfPossible(Skill, Class, AgentTrait)} is a similar function than this
function, except that it does not fail when the delegator instance cannot be created. In this last case,
the function {@link #createSkillDelegatorIfPossible(Skill, Class, AgentTrait)} reply the original skill itself.
@param <C> the type of the capacity.
@param originalSkill the skill to delegate to after ensure the capacity caller is correctly set.
@param capacity the capacity that contains the definition of the delegator.
@param capacityCaller the caller of the capacity functions.
@return the delegator.
@throws Exception if the delegator cannot be created.
@see #createSkillDelegatorIfPossible(Skill, Class, AgentTrait) | [
"Create",
"a",
"delegator",
"for",
"the",
"given",
"skill",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Capacities.java#L87-L94 |
lightblue-platform/lightblue-client | core/src/main/java/com/redhat/lightblue/client/request/DataBulkRequest.java | DataBulkRequest.insertAfter | public DataBulkRequest insertAfter(CRUDRequest request, CRUDRequest after) {
this.requests.add(requests.indexOf(after) + 1, request);
return this;
} | java | public DataBulkRequest insertAfter(CRUDRequest request, CRUDRequest after) {
this.requests.add(requests.indexOf(after) + 1, request);
return this;
} | [
"public",
"DataBulkRequest",
"insertAfter",
"(",
"CRUDRequest",
"request",
",",
"CRUDRequest",
"after",
")",
"{",
"this",
".",
"requests",
".",
"add",
"(",
"requests",
".",
"indexOf",
"(",
"after",
")",
"+",
"1",
",",
"request",
")",
";",
"return",
"this",... | Inserts a request after another specified request. This guarantees that
the first request parameter will be executed, sequentially, after the
second request parameter. It does not guarantee consecutive execution.
@param request
@param after
@return | [
"Inserts",
"a",
"request",
"after",
"another",
"specified",
"request",
".",
"This",
"guarantees",
"that",
"the",
"first",
"request",
"parameter",
"will",
"be",
"executed",
"sequentially",
"after",
"the",
"second",
"request",
"parameter",
".",
"It",
"does",
"not"... | train | https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/request/DataBulkRequest.java#L99-L102 |
awslabs/jsii | packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java | JsiiClient.setPropertyValue | public void setPropertyValue(final JsiiObjectRef objRef, final String property, final JsonNode value) {
ObjectNode req = makeRequest("set", objRef);
req.put("property", property);
req.set("value", value);
this.runtime.requestResponse(req);
} | java | public void setPropertyValue(final JsiiObjectRef objRef, final String property, final JsonNode value) {
ObjectNode req = makeRequest("set", objRef);
req.put("property", property);
req.set("value", value);
this.runtime.requestResponse(req);
} | [
"public",
"void",
"setPropertyValue",
"(",
"final",
"JsiiObjectRef",
"objRef",
",",
"final",
"String",
"property",
",",
"final",
"JsonNode",
"value",
")",
"{",
"ObjectNode",
"req",
"=",
"makeRequest",
"(",
"\"set\"",
",",
"objRef",
")",
";",
"req",
".",
"put... | Sets a value for a property in a remote object.
@param objRef The remote object reference.
@param property The name of the property.
@param value The new property value. | [
"Sets",
"a",
"value",
"for",
"a",
"property",
"in",
"a",
"remote",
"object",
"."
] | train | https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L122-L128 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.