repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java
EventSubscriptions.removeSubscriber
public synchronized int removeSubscriber(String eventName, IGenericEvent<T> subscriber) { List<IGenericEvent<T>> subscribers = getSubscribers(eventName, false); if (subscribers != null) { subscribers.remove(subscriber); if (subscribers.isEmpty()) { subscriptions.remove(eventName); } return subscribers.size(); } return -1; }
java
public synchronized int removeSubscriber(String eventName, IGenericEvent<T> subscriber) { List<IGenericEvent<T>> subscribers = getSubscribers(eventName, false); if (subscribers != null) { subscribers.remove(subscriber); if (subscribers.isEmpty()) { subscriptions.remove(eventName); } return subscribers.size(); } return -1; }
[ "public", "synchronized", "int", "removeSubscriber", "(", "String", "eventName", ",", "IGenericEvent", "<", "T", ">", "subscriber", ")", "{", "List", "<", "IGenericEvent", "<", "T", ">>", "subscribers", "=", "getSubscribers", "(", "eventName", ",", "false", ")...
Removes a subscriber from the specified event. @param eventName Name of the event. @param subscriber Subscriber to remove. @return Count of subscribers after the operation, or -1 no subscriber list existed.
[ "Removes", "a", "subscriber", "from", "the", "specified", "event", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L69-L83
segmentio/analytics-android
analytics/src/main/java/com/segment/analytics/ValueMap.java
ValueMap.getBoolean
public boolean getBoolean(String key, boolean defaultValue) { Object value = get(key); if (value instanceof Boolean) { return (boolean) value; } else if (value instanceof String) { return Boolean.valueOf((String) value); } return defaultValue; }
java
public boolean getBoolean(String key, boolean defaultValue) { Object value = get(key); if (value instanceof Boolean) { return (boolean) value; } else if (value instanceof String) { return Boolean.valueOf((String) value); } return defaultValue; }
[ "public", "boolean", "getBoolean", "(", "String", "key", ",", "boolean", "defaultValue", ")", "{", "Object", "value", "=", "get", "(", "key", ")", ";", "if", "(", "value", "instanceof", "Boolean", ")", "{", "return", "(", "boolean", ")", "value", ";", ...
Returns the value mapped by {@code key} if it exists and is a boolean or can be coerced to a boolean. Returns {@code defaultValue} otherwise.
[ "Returns", "the", "value", "mapped", "by", "{" ]
train
https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/ValueMap.java#L278-L286
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.completeCallback
public void completeCallback(final Callback callback, final String error, final JsonNode result) { ObjectNode req = makeRequest("complete"); req.put("cbid", callback.getCbid()); req.put("err", error); req.set("result", result); this.runtime.requestResponse(req); }
java
public void completeCallback(final Callback callback, final String error, final JsonNode result) { ObjectNode req = makeRequest("complete"); req.put("cbid", callback.getCbid()); req.put("err", error); req.set("result", result); this.runtime.requestResponse(req); }
[ "public", "void", "completeCallback", "(", "final", "Callback", "callback", ",", "final", "String", "error", ",", "final", "JsonNode", "result", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"complete\"", ")", ";", "req", ".", "put", "(", "\"cbid...
Completes a callback. @param callback The callback to complete. @param error Error information (or null). @param result Result (or null).
[ "Completes", "a", "callback", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L249-L256
DavidPizarro/PinView
library/src/main/java/com/dpizarro/pinview/library/PinViewBaseHelper.java
PinViewBaseHelper.onTextChanged
@Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (findFocus() != null) { currentFocus = Integer.parseInt(findFocus().getTag().toString()); } if (count == 1 && s.length() == mNumberCharacters) { if (currentFocus == (mNumberPinBoxes - 1) || currentFocus == 0) { checkPinBoxesAvailableOrder(); } else { checkPinBoxesAvailable(); } } }
java
@Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (findFocus() != null) { currentFocus = Integer.parseInt(findFocus().getTag().toString()); } if (count == 1 && s.length() == mNumberCharacters) { if (currentFocus == (mNumberPinBoxes - 1) || currentFocus == 0) { checkPinBoxesAvailableOrder(); } else { checkPinBoxesAvailable(); } } }
[ "@", "Override", "public", "void", "onTextChanged", "(", "CharSequence", "s", ",", "int", "start", ",", "int", "before", ",", "int", "count", ")", "{", "if", "(", "findFocus", "(", ")", "!=", "null", ")", "{", "currentFocus", "=", "Integer", ".", "pars...
Check if you have written or have deleted (in the latter case, there would be to do nothing). If you have written, you have to move to the following free PinBox {@link EditText} or to do other action if there are no empty values.
[ "Check", "if", "you", "have", "written", "or", "have", "deleted", "(", "in", "the", "latter", "case", "there", "would", "be", "to", "do", "nothing", ")", ".", "If", "you", "have", "written", "you", "have", "to", "move", "to", "the", "following", "free"...
train
https://github.com/DavidPizarro/PinView/blob/b171a89694921475b5442585810b8475ef1cfe35/library/src/main/java/com/dpizarro/pinview/library/PinViewBaseHelper.java#L424-L439
pushtorefresh/storio
storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/operations/put/PutResult.java
PutResult.newInsertResult
@NonNull public static PutResult newInsertResult(@NonNull Uri insertedUri, @NonNull Uri affectedUri) { checkNotNull(insertedUri, "insertedUri must not be null"); return new PutResult(insertedUri, null, affectedUri); }
java
@NonNull public static PutResult newInsertResult(@NonNull Uri insertedUri, @NonNull Uri affectedUri) { checkNotNull(insertedUri, "insertedUri must not be null"); return new PutResult(insertedUri, null, affectedUri); }
[ "@", "NonNull", "public", "static", "PutResult", "newInsertResult", "(", "@", "NonNull", "Uri", "insertedUri", ",", "@", "NonNull", "Uri", "affectedUri", ")", "{", "checkNotNull", "(", "insertedUri", ",", "\"insertedUri must not be null\"", ")", ";", "return", "ne...
Creates {@link PutResult} for insert. @param insertedUri Uri of inserted row. @param affectedUri Uri that was affected by insert. @return new {@link PutResult} instance.
[ "Creates", "{", "@link", "PutResult", "}", "for", "insert", "." ]
train
https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/operations/put/PutResult.java#L42-L46
alkacon/opencms-core
src/org/opencms/configuration/CmsVfsConfiguration.java
CmsVfsConfiguration.getFileTranslator
public CmsResourceTranslator getFileTranslator() { String[] array = new String[0]; if (m_fileTranslationEnabled) { array = new String[m_fileTranslations.size()]; for (int i = 0; i < m_fileTranslations.size(); i++) { array[i] = m_fileTranslations.get(i); } } return new CmsResourceTranslator(array, true); }
java
public CmsResourceTranslator getFileTranslator() { String[] array = new String[0]; if (m_fileTranslationEnabled) { array = new String[m_fileTranslations.size()]; for (int i = 0; i < m_fileTranslations.size(); i++) { array[i] = m_fileTranslations.get(i); } } return new CmsResourceTranslator(array, true); }
[ "public", "CmsResourceTranslator", "getFileTranslator", "(", ")", "{", "String", "[", "]", "array", "=", "new", "String", "[", "0", "]", ";", "if", "(", "m_fileTranslationEnabled", ")", "{", "array", "=", "new", "String", "[", "m_fileTranslations", ".", "siz...
Returns the file resource translator that has been initialized with the configured file translation rules.<p> @return the file resource translator
[ "Returns", "the", "file", "resource", "translator", "that", "has", "been", "initialized", "with", "the", "configured", "file", "translation", "rules", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsVfsConfiguration.java#L808-L818
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/ServiceHandler.java
ServiceHandler.getClusterInfo
@Override public ClusterSummary getClusterInfo() throws TException { long start = System.nanoTime(); try { StormClusterState stormClusterState = data.getStormClusterState(); Map<String, Assignment> assignments = new HashMap<>(); // get TopologySummary List<TopologySummary> topologySummaries = NimbusUtils.getTopologySummary(stormClusterState, assignments); // all supervisors Map<String, SupervisorInfo> supervisorInfos = Cluster.get_all_SupervisorInfo(stormClusterState, null); // generate SupervisorSummaries List<SupervisorSummary> supervisorSummaries = NimbusUtils.mkSupervisorSummaries(supervisorInfos, assignments); NimbusSummary nimbusSummary = NimbusUtils.getNimbusSummary(stormClusterState, supervisorSummaries, data); return new ClusterSummary(nimbusSummary, supervisorSummaries, topologySummaries); } catch (TException e) { LOG.info("Failed to get ClusterSummary ", e); throw e; } catch (Exception e) { LOG.info("Failed to get ClusterSummary ", e); throw new TException(e); } finally { long end = System.nanoTime(); SimpleJStormMetric.updateNimbusHistogram("getClusterInfo", (end - start) / TimeUtils.NS_PER_US); } }
java
@Override public ClusterSummary getClusterInfo() throws TException { long start = System.nanoTime(); try { StormClusterState stormClusterState = data.getStormClusterState(); Map<String, Assignment> assignments = new HashMap<>(); // get TopologySummary List<TopologySummary> topologySummaries = NimbusUtils.getTopologySummary(stormClusterState, assignments); // all supervisors Map<String, SupervisorInfo> supervisorInfos = Cluster.get_all_SupervisorInfo(stormClusterState, null); // generate SupervisorSummaries List<SupervisorSummary> supervisorSummaries = NimbusUtils.mkSupervisorSummaries(supervisorInfos, assignments); NimbusSummary nimbusSummary = NimbusUtils.getNimbusSummary(stormClusterState, supervisorSummaries, data); return new ClusterSummary(nimbusSummary, supervisorSummaries, topologySummaries); } catch (TException e) { LOG.info("Failed to get ClusterSummary ", e); throw e; } catch (Exception e) { LOG.info("Failed to get ClusterSummary ", e); throw new TException(e); } finally { long end = System.nanoTime(); SimpleJStormMetric.updateNimbusHistogram("getClusterInfo", (end - start) / TimeUtils.NS_PER_US); } }
[ "@", "Override", "public", "ClusterSummary", "getClusterInfo", "(", ")", "throws", "TException", "{", "long", "start", "=", "System", ".", "nanoTime", "(", ")", ";", "try", "{", "StormClusterState", "stormClusterState", "=", "data", ".", "getStormClusterState", ...
get cluster's summary, it will contain SupervisorSummary and TopologySummary @return ClusterSummary
[ "get", "cluster", "s", "summary", "it", "will", "contain", "SupervisorSummary", "and", "TopologySummary" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/ServiceHandler.java#L951-L981
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.queryTransactionByID
public TransactionInfo queryTransactionByID(Peer peer, String txID, User userContext) throws ProposalException, InvalidArgumentException { return queryTransactionByID(Collections.singleton(peer), txID, userContext); }
java
public TransactionInfo queryTransactionByID(Peer peer, String txID, User userContext) throws ProposalException, InvalidArgumentException { return queryTransactionByID(Collections.singleton(peer), txID, userContext); }
[ "public", "TransactionInfo", "queryTransactionByID", "(", "Peer", "peer", ",", "String", "txID", ",", "User", "userContext", ")", "throws", "ProposalException", ",", "InvalidArgumentException", "{", "return", "queryTransactionByID", "(", "Collections", ".", "singleton",...
Query for a Fabric Transaction given its transactionID @param peer the peer to send the request to @param txID the ID of the transaction @param userContext the user context @return a {@link TransactionInfo} @throws ProposalException @throws InvalidArgumentException
[ "Query", "for", "a", "Fabric", "Transaction", "given", "its", "transactionID" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L3210-L3212
Dempsy/dempsy
dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/internal/MessageUtils.java
MessageUtils.unwindMessages
public static void unwindMessages(final Object message, final List<Object> messages) { if (message instanceof Iterable) { @SuppressWarnings("rawtypes") final Iterator it = ((Iterable) message).iterator(); while (it.hasNext()) unwindMessages(it.next(), messages); } else messages.add(message); }
java
public static void unwindMessages(final Object message, final List<Object> messages) { if (message instanceof Iterable) { @SuppressWarnings("rawtypes") final Iterator it = ((Iterable) message).iterator(); while (it.hasNext()) unwindMessages(it.next(), messages); } else messages.add(message); }
[ "public", "static", "void", "unwindMessages", "(", "final", "Object", "message", ",", "final", "List", "<", "Object", ">", "messages", ")", "{", "if", "(", "message", "instanceof", "Iterable", ")", "{", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "fin...
Return values from invoke's may be Iterables in which case there are many messages to be sent out.
[ "Return", "values", "from", "invoke", "s", "may", "be", "Iterables", "in", "which", "case", "there", "are", "many", "messages", "to", "be", "sent", "out", "." ]
train
https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/internal/MessageUtils.java#L25-L33
codegist/crest
core/src/main/java/org/codegist/crest/CRestBuilder.java
CRestBuilder.deserializeJsonWith
public CRestBuilder deserializeJsonWith(Class<? extends Deserializer> deserializer, Map<String, Object> config) { this.jsonDeserializer = deserializer; this.jsonDeserializerConfig.clear(); this.jsonDeserializerConfig.putAll(config); return this; }
java
public CRestBuilder deserializeJsonWith(Class<? extends Deserializer> deserializer, Map<String, Object> config) { this.jsonDeserializer = deserializer; this.jsonDeserializerConfig.clear(); this.jsonDeserializerConfig.putAll(config); return this; }
[ "public", "CRestBuilder", "deserializeJsonWith", "(", "Class", "<", "?", "extends", "Deserializer", ">", "deserializer", ",", "Map", "<", "String", ",", "Object", ">", "config", ")", "{", "this", ".", "jsonDeserializer", "=", "deserializer", ";", "this", ".", ...
<p>Overrides the default {@link org.codegist.crest.serializer.jackson.JacksonDeserializer} JSON deserializer with the given one</p> <p>By default, <b>CRest</b> will use this deserializer for the following response Content-Type:</p> <ul> <li>application/json</li> <li>application/javascript</li> <li>text/javascript</li> <li>text/json</li> </ul> @param deserializer deserializer to use for JSON response Content-Type requests @param config State that will be passed to the deserializer along with the CRestConfig object if the deserializer has declared a single argument constructor with CRestConfig parameter type @return current builder @see org.codegist.crest.serializer.jackson.JacksonDeserializer
[ "<p", ">", "Overrides", "the", "default", "{" ]
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L795-L800
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getHexEncoded
@Nonnull public static String getHexEncoded (@Nonnull final byte [] aInput) { ValueEnforcer.notNull (aInput, "Input"); return getHexEncoded (aInput, 0, aInput.length); }
java
@Nonnull public static String getHexEncoded (@Nonnull final byte [] aInput) { ValueEnforcer.notNull (aInput, "Input"); return getHexEncoded (aInput, 0, aInput.length); }
[ "@", "Nonnull", "public", "static", "String", "getHexEncoded", "(", "@", "Nonnull", "final", "byte", "[", "]", "aInput", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aInput", ",", "\"Input\"", ")", ";", "return", "getHexEncoded", "(", "aInput", ",", "0...
Convert a byte array to a hexadecimal encoded string. @param aInput The byte array to be converted to a String. May not be <code>null</code>. @return The String representation of the byte array.
[ "Convert", "a", "byte", "array", "to", "a", "hexadecimal", "encoded", "string", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L618-L624
undera/jmeter-plugins
infra/common/src/main/java/kg/apc/jmeter/JMeterPluginsUtils.java
JMeterPluginsUtils.getEnvDefault
public static String getEnvDefault(String propName, String defaultVal) { String ans = defaultVal; String value = System.getenv(propName); if (value != null) { ans = value.trim(); } else if (defaultVal != null) { ans = defaultVal.trim(); } return ans; }
java
public static String getEnvDefault(String propName, String defaultVal) { String ans = defaultVal; String value = System.getenv(propName); if (value != null) { ans = value.trim(); } else if (defaultVal != null) { ans = defaultVal.trim(); } return ans; }
[ "public", "static", "String", "getEnvDefault", "(", "String", "propName", ",", "String", "defaultVal", ")", "{", "String", "ans", "=", "defaultVal", ";", "String", "value", "=", "System", ".", "getenv", "(", "propName", ")", ";", "if", "(", "value", "!=", ...
Get a String value (environment) with default if not present. @param propName the name of the environment variable. @param defaultVal the default value. @return The PropDefault value
[ "Get", "a", "String", "value", "(", "environment", ")", "with", "default", "if", "not", "present", "." ]
train
https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/infra/common/src/main/java/kg/apc/jmeter/JMeterPluginsUtils.java#L425-L434
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypeReferenceBuilder.java
JvmTypeReferenceBuilder.typeRef
public JvmTypeReference typeRef(String typeName, JvmTypeReference... typeArgs) { JvmType type = references.findDeclaredType(typeName, context); if (type == null) { return createUnknownTypeReference(typeName); } return typeRef(type, typeArgs); }
java
public JvmTypeReference typeRef(String typeName, JvmTypeReference... typeArgs) { JvmType type = references.findDeclaredType(typeName, context); if (type == null) { return createUnknownTypeReference(typeName); } return typeRef(type, typeArgs); }
[ "public", "JvmTypeReference", "typeRef", "(", "String", "typeName", ",", "JvmTypeReference", "...", "typeArgs", ")", "{", "JvmType", "type", "=", "references", ".", "findDeclaredType", "(", "typeName", ",", "context", ")", ";", "if", "(", "type", "==", "null",...
Creates a new {@link JvmTypeReference} pointing to the given class and containing the given type arguments. @param typeName the name of the type the reference shall point to. @param typeArgs type arguments @return the newly created {@link JvmTypeReference}
[ "Creates", "a", "new", "{", "@link", "JvmTypeReference", "}", "pointing", "to", "the", "given", "class", "and", "containing", "the", "given", "type", "arguments", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypeReferenceBuilder.java#L87-L93
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.addHierarchicalEntityChild
public UUID addHierarchicalEntityChild(UUID appId, String versionId, UUID hEntityId, AddHierarchicalEntityChildOptionalParameter addHierarchicalEntityChildOptionalParameter) { return addHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, addHierarchicalEntityChildOptionalParameter).toBlocking().single().body(); }
java
public UUID addHierarchicalEntityChild(UUID appId, String versionId, UUID hEntityId, AddHierarchicalEntityChildOptionalParameter addHierarchicalEntityChildOptionalParameter) { return addHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, addHierarchicalEntityChildOptionalParameter).toBlocking().single().body(); }
[ "public", "UUID", "addHierarchicalEntityChild", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "hEntityId", ",", "AddHierarchicalEntityChildOptionalParameter", "addHierarchicalEntityChildOptionalParameter", ")", "{", "return", "addHierarchicalEntityChildWithServic...
Creates a single child in an existing hierarchical entity model. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @param addHierarchicalEntityChildOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the UUID object if successful.
[ "Creates", "a", "single", "child", "in", "an", "existing", "hierarchical", "entity", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6645-L6647
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java
PartitionedStepControllerImpl.receivedLastMessageForPartition
private boolean receivedLastMessageForPartition(PartitionReplyMsg msg, List<Integer> finishedPartitions) { switch (msg.getMsgType()) { case PARTITION_FINAL_STATUS: if (msg.getPartitionPlanConfig() != null) { partitionFinished(msg); finishedPartitions.add(msg.getPartitionPlanConfig().getPartitionNumber()); return true; } else { return false; } case PARTITION_THREAD_COMPLETE: partitionFinished(msg); finishedPartitions.add(msg.getPartitionPlanConfig().getPartitionNumber()); return true; default: return false; } }
java
private boolean receivedLastMessageForPartition(PartitionReplyMsg msg, List<Integer> finishedPartitions) { switch (msg.getMsgType()) { case PARTITION_FINAL_STATUS: if (msg.getPartitionPlanConfig() != null) { partitionFinished(msg); finishedPartitions.add(msg.getPartitionPlanConfig().getPartitionNumber()); return true; } else { return false; } case PARTITION_THREAD_COMPLETE: partitionFinished(msg); finishedPartitions.add(msg.getPartitionPlanConfig().getPartitionNumber()); return true; default: return false; } }
[ "private", "boolean", "receivedLastMessageForPartition", "(", "PartitionReplyMsg", "msg", ",", "List", "<", "Integer", ">", "finishedPartitions", ")", "{", "switch", "(", "msg", ".", "getMsgType", "(", ")", ")", "{", "case", "PARTITION_FINAL_STATUS", ":", "if", ...
/* Check if its the last message received for this partition We are still checking for THREAD_COMPLETE to maintain compatibility with 8.5.5.7, which sends FINAL_STATUS without a partitionNumber ,and THREAD_COMPLETE with a partitionNumber, although, now the executor does not send a THREAD_COMPLETE message, just a FINAL_STATUS message with a partitionNumber @returns true if no more messages for the partition is expected to be received @returns false if more messages are to be received for the partition
[ "/", "*", "Check", "if", "its", "the", "last", "message", "received", "for", "this", "partition" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L834-L853
authlete/authlete-java-common
src/main/java/com/authlete/common/util/TypedProperties.java
TypedProperties.getInt
public int getInt(Enum<?> key, int defaultValue) { if (key == null) { return defaultValue; } return getInt(key.name(), defaultValue); }
java
public int getInt(Enum<?> key, int defaultValue) { if (key == null) { return defaultValue; } return getInt(key.name(), defaultValue); }
[ "public", "int", "getInt", "(", "Enum", "<", "?", ">", "key", ",", "int", "defaultValue", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "return", "getInt", "(", "key", ".", "name", "(", ")", ",", "defaultVa...
Equivalent to {@link #getInt(String, int) getInt}{@code (key.name(), defaultValue)}. If {@code key} is null}, {@code defaultValue} is returned.
[ "Equivalent", "to", "{" ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L243-L251
tvesalainen/util
util/src/main/java/org/vesalainen/math/AbstractPoint.java
AbstractPoint.subtract
public static final Point subtract(Point p1, Point p2) { return new AbstractPoint(p1.getX() - p2.getX(), p1.getY() - p2.getY()); }
java
public static final Point subtract(Point p1, Point p2) { return new AbstractPoint(p1.getX() - p2.getX(), p1.getY() - p2.getY()); }
[ "public", "static", "final", "Point", "subtract", "(", "Point", "p1", ",", "Point", "p2", ")", "{", "return", "new", "AbstractPoint", "(", "p1", ".", "getX", "(", ")", "-", "p2", ".", "getX", "(", ")", ",", "p1", ".", "getY", "(", ")", "-", "p2",...
Returns a new Point(p1.x - p2.x, p1.y - p2.y) @param p1 @param p2 @return Returns a new Point(p1.x - p2.x, p1.y - p2.y)
[ "Returns", "a", "new", "Point", "(", "p1", ".", "x", "-", "p2", ".", "x", "p1", ".", "y", "-", "p2", ".", "y", ")" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractPoint.java#L129-L132
jglobus/JGlobus
gss/src/main/java/org/globus/gsi/gssapi/auth/HostOrSelfAuthorization.java
HostOrSelfAuthorization.authorize
public void authorize(GSSContext context, String host) throws AuthorizationException { logger.debug("Authorization: HOST/SELF"); try { GSSName expected = this.hostAuthz.getExpectedName(null, host); GSSName target = null; if (context.isInitiator()) { target = context.getTargName(); } else { target = context.getSrcName(); } if (!expected.equals(target)) { logger.debug("Host authorization failed. Expected " + expected + " target is " + target); if (!context.getSrcName().equals(context.getTargName())) { if (context.isInitiator()) { expected = context.getSrcName(); } else { expected = context.getTargName(); } generateAuthorizationException(expected, target); } } } catch (GSSException e) { throw new AuthorizationException("Authorization failure", e); } }
java
public void authorize(GSSContext context, String host) throws AuthorizationException { logger.debug("Authorization: HOST/SELF"); try { GSSName expected = this.hostAuthz.getExpectedName(null, host); GSSName target = null; if (context.isInitiator()) { target = context.getTargName(); } else { target = context.getSrcName(); } if (!expected.equals(target)) { logger.debug("Host authorization failed. Expected " + expected + " target is " + target); if (!context.getSrcName().equals(context.getTargName())) { if (context.isInitiator()) { expected = context.getSrcName(); } else { expected = context.getTargName(); } generateAuthorizationException(expected, target); } } } catch (GSSException e) { throw new AuthorizationException("Authorization failure", e); } }
[ "public", "void", "authorize", "(", "GSSContext", "context", ",", "String", "host", ")", "throws", "AuthorizationException", "{", "logger", ".", "debug", "(", "\"Authorization: HOST/SELF\"", ")", ";", "try", "{", "GSSName", "expected", "=", "this", ".", "hostAut...
Performs host authorization. If that fails, performs self authorization
[ "Performs", "host", "authorization", ".", "If", "that", "fails", "performs", "self", "authorization" ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/gsi/gssapi/auth/HostOrSelfAuthorization.java#L61-L92
lessthanoptimal/BoofCV
integration/boofcv-android/examples/video/app/src/main/java/org/boofcv/video/GradientActivity.java
GradientActivity.onCameraResolutionChange
@Override protected void onCameraResolutionChange( int width , int height, int sensorOrientation ) { super.onCameraResolutionChange(width, height,sensorOrientation); derivX.reshape(width, height); derivY.reshape(width, height); }
java
@Override protected void onCameraResolutionChange( int width , int height, int sensorOrientation ) { super.onCameraResolutionChange(width, height,sensorOrientation); derivX.reshape(width, height); derivY.reshape(width, height); }
[ "@", "Override", "protected", "void", "onCameraResolutionChange", "(", "int", "width", ",", "int", "height", ",", "int", "sensorOrientation", ")", "{", "super", ".", "onCameraResolutionChange", "(", "width", ",", "height", ",", "sensorOrientation", ")", ";", "de...
During camera initialization this function is called once after the resolution is known. This is a good function to override and predeclare data structres which are dependent on the video feeds resolution.
[ "During", "camera", "initialization", "this", "function", "is", "called", "once", "after", "the", "resolution", "is", "known", ".", "This", "is", "a", "good", "function", "to", "override", "and", "predeclare", "data", "structres", "which", "are", "dependent", ...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/examples/video/app/src/main/java/org/boofcv/video/GradientActivity.java#L121-L127
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java
ImageLoader.loadImage
public static BufferedImage loadImage(File file, int imageType){ BufferedImage img = loadImage(file); if(img.getType() != imageType){ img = BufferedImageFactory.get(img, imageType); } return img; }
java
public static BufferedImage loadImage(File file, int imageType){ BufferedImage img = loadImage(file); if(img.getType() != imageType){ img = BufferedImageFactory.get(img, imageType); } return img; }
[ "public", "static", "BufferedImage", "loadImage", "(", "File", "file", ",", "int", "imageType", ")", "{", "BufferedImage", "img", "=", "loadImage", "(", "file", ")", ";", "if", "(", "img", ".", "getType", "(", ")", "!=", "imageType", ")", "{", "img", "...
Tries to load Image from file and converts it to the desired image type if needed. <br> See {@link BufferedImage#BufferedImage(int, int, int)} for details on the available image types. @param file the image file @param imageType of the resulting BufferedImage @return loaded Image. @throws ImageLoaderException if no image could be loaded from the file. @since 1.0
[ "Tries", "to", "load", "Image", "from", "file", "and", "converts", "it", "to", "the", "desired", "image", "type", "if", "needed", ".", "<br", ">", "See", "{", "@link", "BufferedImage#BufferedImage", "(", "int", "int", "int", ")", "}", "for", "details", "...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java#L123-L129
elki-project/elki
addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java
XSplitter.add2MBR
private void add2MBR(int[] entrySorting, List<Heap<DoubleIntPair>> pqUB, List<Heap<DoubleIntPair>> pqLB, int index) { SpatialComparable currMBR = node.getEntry(entrySorting[index]); for(int d = 0; d < currMBR.getDimensionality(); d++) { double max = currMBR.getMax(d); pqUB.get(d).add(new DoubleIntPair(max, index)); double min = currMBR.getMin(d); pqLB.get(d).add(new DoubleIntPair(min, index)); } }
java
private void add2MBR(int[] entrySorting, List<Heap<DoubleIntPair>> pqUB, List<Heap<DoubleIntPair>> pqLB, int index) { SpatialComparable currMBR = node.getEntry(entrySorting[index]); for(int d = 0; d < currMBR.getDimensionality(); d++) { double max = currMBR.getMax(d); pqUB.get(d).add(new DoubleIntPair(max, index)); double min = currMBR.getMin(d); pqLB.get(d).add(new DoubleIntPair(min, index)); } }
[ "private", "void", "add2MBR", "(", "int", "[", "]", "entrySorting", ",", "List", "<", "Heap", "<", "DoubleIntPair", ">", ">", "pqUB", ",", "List", "<", "Heap", "<", "DoubleIntPair", ">", ">", "pqLB", ",", "int", "index", ")", "{", "SpatialComparable", ...
Adds the minimum and maximum bounds of the MBR of entry number <code>entrySorting[index]</code> to the dimension-wise upper and lower bound priority queues <code>pqUBFirst</code> and <code>pqLBFirst</code>. @param entrySorting a sorting providing the mapping of <code>index</code> to the entry to be added @param pqUB One priority queue for each dimension. They are sorted by upper bound in descending order and consist of entry indices in <code>entrySorting</code> for the entries belonging to <code>mbr</code>. @param pqLB One priority queue for each dimension. They are sorted by lower bound in ascending order and consist of entry indices in <code>entrySorting</code> for the entries belonging to <code>mbr</code>. @param index the index in the sorting referencing the entry to be added
[ "Adds", "the", "minimum", "and", "maximum", "bounds", "of", "the", "MBR", "of", "entry", "number", "<code", ">", "entrySorting", "[", "index", "]", "<", "/", "code", ">", "to", "the", "dimension", "-", "wise", "upper", "and", "lower", "bound", "priority"...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java#L302-L310
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.appendValueToSql
public static final void appendValueToSql(StringBuilder sql, Object value) { if (value == null) { sql.append("NULL"); } else if (value instanceof Boolean) { Boolean bool = (Boolean)value; if (bool) { sql.append('1'); } else { sql.append('0'); } } else { appendEscapedSQLString(sql, value.toString()); } }
java
public static final void appendValueToSql(StringBuilder sql, Object value) { if (value == null) { sql.append("NULL"); } else if (value instanceof Boolean) { Boolean bool = (Boolean)value; if (bool) { sql.append('1'); } else { sql.append('0'); } } else { appendEscapedSQLString(sql, value.toString()); } }
[ "public", "static", "final", "void", "appendValueToSql", "(", "StringBuilder", "sql", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "sql", ".", "append", "(", "\"NULL\"", ")", ";", "}", "else", "if", "(", "value", "insta...
Appends an Object to an SQL string with the proper escaping, etc.
[ "Appends", "an", "Object", "to", "an", "SQL", "string", "with", "the", "proper", "escaping", "etc", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L373-L386
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/sarl/actionprototype/DefaultActionPrototypeProvider.java
DefaultActionPrototypeProvider.createPrototype
protected InferredPrototype createPrototype(QualifiedActionName id, boolean isVarargs, FormalParameterProvider parameters) { assert parameters != null; final ActionParameterTypes key = new ActionParameterTypes(isVarargs, parameters.getFormalParameterCount()); final Map<ActionParameterTypes, List<InferredStandardParameter>> ip = buildSignaturesForArgDefaultValues( id.getDeclaringType(), key.toActionPrototype(id.getActionName()).toActionId(), parameters, key); final List<InferredStandardParameter> op = ip.remove(key); final InferredPrototype proto = new DefaultInferredPrototype( id, parameters, key, op, ip); final String containerID = id.getContainerID(); Map<String, Map<ActionParameterTypes, InferredPrototype>> c = this.prototypes.get(containerID); if (c == null) { c = new TreeMap<>(); this.prototypes.put(containerID, c); } Map<ActionParameterTypes, InferredPrototype> list = c.get(id.getActionName()); if (list == null) { list = new TreeMap<>(); c.put(id.getActionName(), list); } list.put(key, proto); return proto; }
java
protected InferredPrototype createPrototype(QualifiedActionName id, boolean isVarargs, FormalParameterProvider parameters) { assert parameters != null; final ActionParameterTypes key = new ActionParameterTypes(isVarargs, parameters.getFormalParameterCount()); final Map<ActionParameterTypes, List<InferredStandardParameter>> ip = buildSignaturesForArgDefaultValues( id.getDeclaringType(), key.toActionPrototype(id.getActionName()).toActionId(), parameters, key); final List<InferredStandardParameter> op = ip.remove(key); final InferredPrototype proto = new DefaultInferredPrototype( id, parameters, key, op, ip); final String containerID = id.getContainerID(); Map<String, Map<ActionParameterTypes, InferredPrototype>> c = this.prototypes.get(containerID); if (c == null) { c = new TreeMap<>(); this.prototypes.put(containerID, c); } Map<ActionParameterTypes, InferredPrototype> list = c.get(id.getActionName()); if (list == null) { list = new TreeMap<>(); c.put(id.getActionName(), list); } list.put(key, proto); return proto; }
[ "protected", "InferredPrototype", "createPrototype", "(", "QualifiedActionName", "id", ",", "boolean", "isVarargs", ",", "FormalParameterProvider", "parameters", ")", "{", "assert", "parameters", "!=", "null", ";", "final", "ActionParameterTypes", "key", "=", "new", "...
Build and replies the inferred action signature for the element with the given ID. This function creates the different signatures according to the definition, or not, of default values for the formal parameters. @param id identifier of the function. @param isVarargs indicates if the signature has a variatic parameter. @param parameters list of the formal parameters of the function. @return the signature or <code>null</code> if none.
[ "Build", "and", "replies", "the", "inferred", "action", "signature", "for", "the", "element", "with", "the", "given", "ID", ".", "This", "function", "creates", "the", "different", "signatures", "according", "to", "the", "definition", "or", "not", "of", "defaul...
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/sarl/actionprototype/DefaultActionPrototypeProvider.java#L239-L267
grails/grails-core
grails-encoder/src/main/groovy/org/grails/buffer/StringCharArrayAccessor.java
StringCharArrayAccessor.writeStringAsCharArray
static public void writeStringAsCharArray(Writer writer, String str, int off, int len) throws IOException { if (!enabled) { writeStringFallback(writer, str, off, len); return; } char[] value; int internalOffset=0; try { value = (char[])valueField.get(str); if(!jdk7_string) { internalOffset = offsetField.getInt(str); } } catch (Exception e) { handleError(e); writeStringFallback(writer, str, off, len); return; } writer.write(value, internalOffset + off, len); }
java
static public void writeStringAsCharArray(Writer writer, String str, int off, int len) throws IOException { if (!enabled) { writeStringFallback(writer, str, off, len); return; } char[] value; int internalOffset=0; try { value = (char[])valueField.get(str); if(!jdk7_string) { internalOffset = offsetField.getInt(str); } } catch (Exception e) { handleError(e); writeStringFallback(writer, str, off, len); return; } writer.write(value, internalOffset + off, len); }
[ "static", "public", "void", "writeStringAsCharArray", "(", "Writer", "writer", ",", "String", "str", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "if", "(", "!", "enabled", ")", "{", "writeStringFallback", "(", "writer", ",", "s...
Writes a portion of a string to a target java.io.Writer with direct access to the char[] of the java.lang.String @param writer target java.io.Writer for output @param str A String @param off Offset from which to start writing characters @param len Number of characters to write @throws IOException If an I/O error occurs
[ "Writes", "a", "portion", "of", "a", "string", "to", "a", "target", "java", ".", "io", ".", "Writer", "with", "direct", "access", "to", "the", "char", "[]", "of", "the", "java", ".", "lang", ".", "String" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-encoder/src/main/groovy/org/grails/buffer/StringCharArrayAccessor.java#L113-L133
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductUrl.java
ProductUrl.addProductInCatalogUrl
public static MozuUrl addProductInCatalogUrl(String productCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/ProductInCatalogs?responseFields={responseFields}"); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl addProductInCatalogUrl(String productCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/ProductInCatalogs?responseFields={responseFields}"); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "addProductInCatalogUrl", "(", "String", "productCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/products/{productCode}/ProductInCatalogs?responseFields={...
Get Resource Url for AddProductInCatalog @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "AddProductInCatalog" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductUrl.java#L102-L108
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRResourceVolume.java
GVRResourceVolume.openResource
public GVRAndroidResource openResource(String filePath) throws IOException { // Error tolerance: Remove initial '/' introduced by file::///filename // In this case, the path is interpreted as relative to defaultPath, // which is the root of the filesystem. if (filePath.startsWith(File.separator)) { filePath = filePath.substring(File.separator.length()); } filePath = adaptFilePath(filePath); String path; int resourceId; GVRAndroidResource resourceKey; switch (volumeType) { case ANDROID_ASSETS: // Resolve '..' and '.' path = getFullPath(defaultPath, filePath); path = new File(path).getCanonicalPath(); if (path.startsWith(File.separator)) { path = path.substring(1); } resourceKey = new GVRAndroidResource(gvrContext, path); break; case ANDROID_RESOURCE: path = FileNameUtils.getBaseName(filePath); resourceId = gvrContext.getContext().getResources().getIdentifier(path, "raw", gvrContext.getContext().getPackageName()); if (resourceId == 0) { throw new FileNotFoundException(filePath + " resource not found"); } resourceKey = new GVRAndroidResource(gvrContext, resourceId); break; case LINUX_FILESYSTEM: resourceKey = new GVRAndroidResource( getFullPath(defaultPath, filePath)); break; case ANDROID_SDCARD: String linuxPath = Environment.getExternalStorageDirectory() .getAbsolutePath(); resourceKey = new GVRAndroidResource( getFullPath(linuxPath, defaultPath, filePath)); break; case INPUT_STREAM: resourceKey = new GVRAndroidResource(getFullPath(defaultPath, filePath), volumeInputStream); break; case NETWORK: resourceKey = new GVRAndroidResource(gvrContext, getFullURL(defaultPath, filePath), enableUrlLocalCache); break; default: throw new IOException( String.format("Unrecognized volumeType %s", volumeType)); } return addResource(resourceKey); }
java
public GVRAndroidResource openResource(String filePath) throws IOException { // Error tolerance: Remove initial '/' introduced by file::///filename // In this case, the path is interpreted as relative to defaultPath, // which is the root of the filesystem. if (filePath.startsWith(File.separator)) { filePath = filePath.substring(File.separator.length()); } filePath = adaptFilePath(filePath); String path; int resourceId; GVRAndroidResource resourceKey; switch (volumeType) { case ANDROID_ASSETS: // Resolve '..' and '.' path = getFullPath(defaultPath, filePath); path = new File(path).getCanonicalPath(); if (path.startsWith(File.separator)) { path = path.substring(1); } resourceKey = new GVRAndroidResource(gvrContext, path); break; case ANDROID_RESOURCE: path = FileNameUtils.getBaseName(filePath); resourceId = gvrContext.getContext().getResources().getIdentifier(path, "raw", gvrContext.getContext().getPackageName()); if (resourceId == 0) { throw new FileNotFoundException(filePath + " resource not found"); } resourceKey = new GVRAndroidResource(gvrContext, resourceId); break; case LINUX_FILESYSTEM: resourceKey = new GVRAndroidResource( getFullPath(defaultPath, filePath)); break; case ANDROID_SDCARD: String linuxPath = Environment.getExternalStorageDirectory() .getAbsolutePath(); resourceKey = new GVRAndroidResource( getFullPath(linuxPath, defaultPath, filePath)); break; case INPUT_STREAM: resourceKey = new GVRAndroidResource(getFullPath(defaultPath, filePath), volumeInputStream); break; case NETWORK: resourceKey = new GVRAndroidResource(gvrContext, getFullURL(defaultPath, filePath), enableUrlLocalCache); break; default: throw new IOException( String.format("Unrecognized volumeType %s", volumeType)); } return addResource(resourceKey); }
[ "public", "GVRAndroidResource", "openResource", "(", "String", "filePath", ")", "throws", "IOException", "{", "// Error tolerance: Remove initial '/' introduced by file::///filename", "// In this case, the path is interpreted as relative to defaultPath,", "// which is the root of the filesys...
Opens a file from the volume. The filePath is relative to the defaultPath. @param filePath File path of the resource to open. @throws IOException
[ "Opens", "a", "file", "from", "the", "volume", ".", "The", "filePath", "is", "relative", "to", "the", "defaultPath", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRResourceVolume.java#L281-L340
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/response/serviceresult/FoxHttpServiceResultResponse.java
FoxHttpServiceResultResponse.getContent
public <T extends Serializable> T getContent(Class<T> contentClass) throws FoxHttpResponseException { return getContent(contentClass, false); }
java
public <T extends Serializable> T getContent(Class<T> contentClass) throws FoxHttpResponseException { return getContent(contentClass, false); }
[ "public", "<", "T", "extends", "Serializable", ">", "T", "getContent", "(", "Class", "<", "T", ">", "contentClass", ")", "throws", "FoxHttpResponseException", "{", "return", "getContent", "(", "contentClass", ",", "false", ")", ";", "}" ]
Get the content of the service result @param contentClass class of the return object @return deserialized content of the service result @throws FoxHttpResponseException Exception during the deserialization
[ "Get", "the", "content", "of", "the", "service", "result" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/response/serviceresult/FoxHttpServiceResultResponse.java#L188-L190
Ordinastie/MalisisCore
src/main/java/net/malisis/core/registry/ModEventRegistry.java
ModEventRegistry.registerCallback
public <T extends FMLEvent> void registerCallback(Class<T> clazz, IFMLEventCallback<T> consumer) { super.registerCallback(consumer, CallbackOption.of((FMLEventPredicate<T>) clazz::isInstance)); }
java
public <T extends FMLEvent> void registerCallback(Class<T> clazz, IFMLEventCallback<T> consumer) { super.registerCallback(consumer, CallbackOption.of((FMLEventPredicate<T>) clazz::isInstance)); }
[ "public", "<", "T", "extends", "FMLEvent", ">", "void", "registerCallback", "(", "Class", "<", "T", ">", "clazz", ",", "IFMLEventCallback", "<", "T", ">", "consumer", ")", "{", "super", ".", "registerCallback", "(", "consumer", ",", "CallbackOption", ".", ...
Registers a {@link IFMLEventCallback} that will be called when MalisisCore will reach the specified {@link FMLEvent}.<br> Note that the callbacks are propcessed during MalisisCore events and not the child mods. @param <T> the generic type @param clazz the clazz @param consumer the consumer
[ "Registers", "a", "{", "@link", "IFMLEventCallback", "}", "that", "will", "be", "called", "when", "MalisisCore", "will", "reach", "the", "specified", "{", "@link", "FMLEvent", "}", ".", "<br", ">", "Note", "that", "the", "callbacks", "are", "propcessed", "du...
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/registry/ModEventRegistry.java#L63-L66
WiQuery/wiquery
wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java
Options.putLiteral
public Options putLiteral(String key, String value) { putOption(key, new LiteralOption(value)); return this; }
java
public Options putLiteral(String key, String value) { putOption(key, new LiteralOption(value)); return this; }
[ "public", "Options", "putLiteral", "(", "String", "key", ",", "String", "value", ")", "{", "putOption", "(", "key", ",", "new", "LiteralOption", "(", "value", ")", ")", ";", "return", "this", ";", "}" ]
<p> Puts a {@link String} value as a JavaScript literal for the given name. <p> Note that the JavaScript resulting from this options will be <code>'value'</code> </p> </p> @param key the option name. @param value the {@link LiteralOption} value.
[ "<p", ">", "Puts", "a", "{", "@link", "String", "}", "value", "as", "a", "JavaScript", "literal", "for", "the", "given", "name", ".", "<p", ">", "Note", "that", "the", "JavaScript", "resulting", "from", "this", "options", "will", "be", "<code", ">", "v...
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java#L615-L619
google/gson
gson/src/main/java/com/google/gson/stream/JsonWriter.java
JsonWriter.open
private JsonWriter open(int empty, String openBracket) throws IOException { beforeValue(); push(empty); out.write(openBracket); return this; }
java
private JsonWriter open(int empty, String openBracket) throws IOException { beforeValue(); push(empty); out.write(openBracket); return this; }
[ "private", "JsonWriter", "open", "(", "int", "empty", ",", "String", "openBracket", ")", "throws", "IOException", "{", "beforeValue", "(", ")", ";", "push", "(", "empty", ")", ";", "out", ".", "write", "(", "openBracket", ")", ";", "return", "this", ";",...
Enters a new scope by appending any necessary whitespace and the given bracket.
[ "Enters", "a", "new", "scope", "by", "appending", "any", "necessary", "whitespace", "and", "the", "given", "bracket", "." ]
train
https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/stream/JsonWriter.java#L325-L330
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetrics.java
GobblinMetrics.getMeter
public Meter getMeter(String prefix, String... suffixes) { return this.metricContext.meter(MetricRegistry.name(prefix, suffixes)); }
java
public Meter getMeter(String prefix, String... suffixes) { return this.metricContext.meter(MetricRegistry.name(prefix, suffixes)); }
[ "public", "Meter", "getMeter", "(", "String", "prefix", ",", "String", "...", "suffixes", ")", "{", "return", "this", ".", "metricContext", ".", "meter", "(", "MetricRegistry", ".", "name", "(", "prefix", ",", "suffixes", ")", ")", ";", "}" ]
Get a {@link Meter} with the given name prefix and suffixes. @param prefix the given name prefix @param suffixes the given name suffixes @return a {@link Meter} with the given name prefix and suffixes
[ "Get", "a", "{", "@link", "Meter", "}", "with", "the", "given", "name", "prefix", "and", "suffixes", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetrics.java#L312-L314
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CciConnFactoryCodeGen.java
CciConnFactoryCodeGen.writeClassBody
@Override public void writeClassBody(Definition def, Writer out) throws IOException { out.write("public class " + getClassName(def) + " implements ConnectionFactory"); writeLeftCurlyBracket(out, 0); int indent = 1; writeWithIndent(out, indent, "private Reference reference;\n\n"); writeDefaultConstructor(def, out, indent); //constructor writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Default constructor\n"); writeWithIndent(out, indent, " * @param cxManager ConnectionManager\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getClassName(def) + "(ConnectionManager cxManager)"); writeLeftCurlyBracket(out, indent); writeRightCurlyBracket(out, indent); writeEol(out); writeConnection(def, out, indent); writeMetaData(def, out, indent); writeRecordFactory(def, out, indent); writeReference(def, out, indent); writeRightCurlyBracket(out, 0); }
java
@Override public void writeClassBody(Definition def, Writer out) throws IOException { out.write("public class " + getClassName(def) + " implements ConnectionFactory"); writeLeftCurlyBracket(out, 0); int indent = 1; writeWithIndent(out, indent, "private Reference reference;\n\n"); writeDefaultConstructor(def, out, indent); //constructor writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Default constructor\n"); writeWithIndent(out, indent, " * @param cxManager ConnectionManager\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getClassName(def) + "(ConnectionManager cxManager)"); writeLeftCurlyBracket(out, indent); writeRightCurlyBracket(out, indent); writeEol(out); writeConnection(def, out, indent); writeMetaData(def, out, indent); writeRecordFactory(def, out, indent); writeReference(def, out, indent); writeRightCurlyBracket(out, 0); }
[ "@", "Override", "public", "void", "writeClassBody", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "out", ".", "write", "(", "\"public class \"", "+", "getClassName", "(", "def", ")", "+", "\" implements ConnectionFactory\"", ...
Output class code @param def definition @param out Writer @throws IOException ioException
[ "Output", "class", "code" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CciConnFactoryCodeGen.java#L43-L71
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/FeatureTokens.java
FeatureTokens.setBeginnings
public void setBeginnings(int i, int v) { if (FeatureTokens_Type.featOkTst && ((FeatureTokens_Type)jcasType).casFeat_beginnings == null) jcasType.jcas.throwFeatMissing("beginnings", "ch.epfl.bbp.uima.types.FeatureTokens"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_beginnings), i); jcasType.ll_cas.ll_setIntArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_beginnings), i, v);}
java
public void setBeginnings(int i, int v) { if (FeatureTokens_Type.featOkTst && ((FeatureTokens_Type)jcasType).casFeat_beginnings == null) jcasType.jcas.throwFeatMissing("beginnings", "ch.epfl.bbp.uima.types.FeatureTokens"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_beginnings), i); jcasType.ll_cas.ll_setIntArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_beginnings), i, v);}
[ "public", "void", "setBeginnings", "(", "int", "i", ",", "int", "v", ")", "{", "if", "(", "FeatureTokens_Type", ".", "featOkTst", "&&", "(", "(", "FeatureTokens_Type", ")", "jcasType", ")", ".", "casFeat_beginnings", "==", "null", ")", "jcasType", ".", "jc...
indexed setter for beginnings - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "beginnings", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/FeatureTokens.java#L162-L166
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.tryClose
private static @Nullable Throwable tryClose(Object o, @Nullable Throwable outer) { if (o instanceof Closeable) { try { ((Closeable) o).close(); } catch (Throwable t) { if (outer == null) { return t; } outer.addSuppressed(t); return outer; } } return null; }
java
private static @Nullable Throwable tryClose(Object o, @Nullable Throwable outer) { if (o instanceof Closeable) { try { ((Closeable) o).close(); } catch (Throwable t) { if (outer == null) { return t; } outer.addSuppressed(t); return outer; } } return null; }
[ "private", "static", "@", "Nullable", "Throwable", "tryClose", "(", "Object", "o", ",", "@", "Nullable", "Throwable", "outer", ")", "{", "if", "(", "o", "instanceof", "Closeable", ")", "{", "try", "{", "(", "(", "Closeable", ")", "o", ")", ".", "close"...
Attempts to close the resource. If an error occurs and an outermost exception is set, then adds the error to the suppression list. @param o the resource to close if Closeable @param outer the outermost error, or null if unset @return the outermost error, or null if unset and successful
[ "Attempts", "to", "close", "the", "resource", ".", "If", "an", "error", "occurs", "and", "an", "outermost", "exception", "is", "set", "then", "adds", "the", "error", "to", "the", "suppression", "list", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L915-L928
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectProperties.java
ProjectProperties.getCachedCharValue
private char getCachedCharValue(FieldType field, char defaultValue) { Character c = (Character) getCachedValue(field); return c == null ? defaultValue : c.charValue(); }
java
private char getCachedCharValue(FieldType field, char defaultValue) { Character c = (Character) getCachedValue(field); return c == null ? defaultValue : c.charValue(); }
[ "private", "char", "getCachedCharValue", "(", "FieldType", "field", ",", "char", "defaultValue", ")", "{", "Character", "c", "=", "(", "Character", ")", "getCachedValue", "(", "field", ")", ";", "return", "c", "==", "null", "?", "defaultValue", ":", "c", "...
Handles retrieval of primitive char type. @param field required field @param defaultValue default value if field is missing @return char value
[ "Handles", "retrieval", "of", "primitive", "char", "type", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L2690-L2694
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java
SlotReference.getSlotReference
@SuppressWarnings("WeakerAccess") public static SlotReference getSlotReference(DataReference dataReference) { return getSlotReference(dataReference.player, dataReference.slot); }
java
@SuppressWarnings("WeakerAccess") public static SlotReference getSlotReference(DataReference dataReference) { return getSlotReference(dataReference.player, dataReference.slot); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "static", "SlotReference", "getSlotReference", "(", "DataReference", "dataReference", ")", "{", "return", "getSlotReference", "(", "dataReference", ".", "player", ",", "dataReference", ".", "slot", ")", ...
Get a unique reference to the media slot on the network from which the specified data was loaded. @param dataReference the data whose media slot is of interest @return the instance that will always represent the slot associated with the specified data
[ "Get", "a", "unique", "reference", "to", "the", "media", "slot", "on", "the", "network", "from", "which", "the", "specified", "data", "was", "loaded", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java#L78-L81
badamowicz/sonar-hla
sonar-hla/src/main/java/com/github/badamowicz/sonar/hla/impl/SonarHLAFactory.java
SonarHLAFactory.getExtractor
public static ISonarExtractor getExtractor(String hostURL, String userName, String password) { return new DefaultSonarExtractor(hostURL, userName, password); }
java
public static ISonarExtractor getExtractor(String hostURL, String userName, String password) { return new DefaultSonarExtractor(hostURL, userName, password); }
[ "public", "static", "ISonarExtractor", "getExtractor", "(", "String", "hostURL", ",", "String", "userName", ",", "String", "password", ")", "{", "return", "new", "DefaultSonarExtractor", "(", "hostURL", ",", "userName", ",", "password", ")", ";", "}" ]
Create an instance of an {@link ISonarExtractor} type. @param hostURL The host URL pointing to SonarQube. @param userName The user name. @param password The password for the given user. Beware that it will not be handled in a safe way. So better use a kind of technical user or, if possible, use {@link #getExtractor(String)} which does not require any credentials. @return A <b>new</b> instance of {@link ISonarExtractor}.
[ "Create", "an", "instance", "of", "an", "{", "@link", "ISonarExtractor", "}", "type", "." ]
train
https://github.com/badamowicz/sonar-hla/blob/21bd8a853d81966b47e96b518430abbc07ccd5f3/sonar-hla/src/main/java/com/github/badamowicz/sonar/hla/impl/SonarHLAFactory.java#L88-L91
OpenLiberty/open-liberty
dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java
JaxWsDDHelper.getPortComponentByEJBLink
static PortComponent getPortComponentByEJBLink(String ejbLink, Adaptable containerToAdapt) throws UnableToAdaptException { return getHighLevelElementByServiceImplBean(ejbLink, containerToAdapt, PortComponent.class, LinkType.EJB); }
java
static PortComponent getPortComponentByEJBLink(String ejbLink, Adaptable containerToAdapt) throws UnableToAdaptException { return getHighLevelElementByServiceImplBean(ejbLink, containerToAdapt, PortComponent.class, LinkType.EJB); }
[ "static", "PortComponent", "getPortComponentByEJBLink", "(", "String", "ejbLink", ",", "Adaptable", "containerToAdapt", ")", "throws", "UnableToAdaptException", "{", "return", "getHighLevelElementByServiceImplBean", "(", "ejbLink", ",", "containerToAdapt", ",", "PortComponent...
Get the PortComponent by ejb-link. @param ejbLink @param containerToAdapt @return @throws UnableToAdaptException
[ "Get", "the", "PortComponent", "by", "ejb", "-", "link", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L44-L46
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/ImageFileService.java
ImageFileService.saveImage
@PreAuthorize("isAuthenticated()") public E saveImage(MultipartFile file, boolean createThumbnail, Integer thumbnailTargetSize) throws Exception { InputStream is = null; ByteArrayInputStream bais = null; E imageToPersist = null; try { is = file.getInputStream(); byte[] imageByteArray = IOUtils.toByteArray(is); // create a new instance (generic) imageToPersist = getEntityClass().newInstance(); // create a thumbnail if requested if (createThumbnail) { byte[] thumbnail = scaleImage( imageByteArray, FilenameUtils.getExtension(file.getOriginalFilename()), thumbnailTargetSize); imageToPersist.setThumbnail(thumbnail); } // set binary image data imageToPersist.setFile(imageByteArray); // detect dimensions bais = new ByteArrayInputStream(imageByteArray); BufferedImage bimg = ImageIO.read(bais); // set basic image properties imageToPersist.setWidth(bimg.getWidth()); imageToPersist.setHeight(bimg.getHeight()); imageToPersist.setFileType(file.getContentType()); imageToPersist.setFileName(file.getOriginalFilename()); // persist the image dao.saveOrUpdate(imageToPersist); } catch (Exception e) { throw new Exception("Could not create the Image in DB: " + e.getMessage()); } finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(bais); } return imageToPersist; }
java
@PreAuthorize("isAuthenticated()") public E saveImage(MultipartFile file, boolean createThumbnail, Integer thumbnailTargetSize) throws Exception { InputStream is = null; ByteArrayInputStream bais = null; E imageToPersist = null; try { is = file.getInputStream(); byte[] imageByteArray = IOUtils.toByteArray(is); // create a new instance (generic) imageToPersist = getEntityClass().newInstance(); // create a thumbnail if requested if (createThumbnail) { byte[] thumbnail = scaleImage( imageByteArray, FilenameUtils.getExtension(file.getOriginalFilename()), thumbnailTargetSize); imageToPersist.setThumbnail(thumbnail); } // set binary image data imageToPersist.setFile(imageByteArray); // detect dimensions bais = new ByteArrayInputStream(imageByteArray); BufferedImage bimg = ImageIO.read(bais); // set basic image properties imageToPersist.setWidth(bimg.getWidth()); imageToPersist.setHeight(bimg.getHeight()); imageToPersist.setFileType(file.getContentType()); imageToPersist.setFileName(file.getOriginalFilename()); // persist the image dao.saveOrUpdate(imageToPersist); } catch (Exception e) { throw new Exception("Could not create the Image in DB: " + e.getMessage()); } finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(bais); } return imageToPersist; }
[ "@", "PreAuthorize", "(", "\"isAuthenticated()\"", ")", "public", "E", "saveImage", "(", "MultipartFile", "file", ",", "boolean", "createThumbnail", ",", "Integer", "thumbnailTargetSize", ")", "throws", "Exception", "{", "InputStream", "is", "=", "null", ";", "Byt...
Method persists a given Image as a bytearray in the database @param file @param createThumbnail @param thumbnailTargetSize @throws Exception
[ "Method", "persists", "a", "given", "Image", "as", "a", "bytearray", "in", "the", "database" ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/ImageFileService.java#L98-L148
btrplace/scheduler
api/src/main/java/org/btrplace/model/constraint/migration/Precedence.java
Precedence.newPrecedence
public static List<Precedence> newPrecedence(Collection<VM> vmsBefore, VM vmAfter) { return newPrecedence(vmsBefore, Collections.singleton(vmAfter)); }
java
public static List<Precedence> newPrecedence(Collection<VM> vmsBefore, VM vmAfter) { return newPrecedence(vmsBefore, Collections.singleton(vmAfter)); }
[ "public", "static", "List", "<", "Precedence", ">", "newPrecedence", "(", "Collection", "<", "VM", ">", "vmsBefore", ",", "VM", "vmAfter", ")", "{", "return", "newPrecedence", "(", "vmsBefore", ",", "Collections", ".", "singleton", "(", "vmAfter", ")", ")", ...
Instantiate discrete constraints to force a single VM to migrate after a set of VMs. @param vmsBefore the VMs to migrate before the other one {@see vmAfter} @param vmAfter the (single) VM to migrate after the others {@see vmsBefore} @return the associated list of constraints
[ "Instantiate", "discrete", "constraints", "to", "force", "a", "single", "VM", "to", "migrate", "after", "a", "set", "of", "VMs", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/constraint/migration/Precedence.java#L114-L116
metafacture/metafacture-core
metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/Iso646ByteBuffer.java
Iso646ByteBuffer.stringAt
String stringAt(final int fromIndex, final int length, final Charset charset) { return new String(byteArray, fromIndex, length, charset); }
java
String stringAt(final int fromIndex, final int length, final Charset charset) { return new String(byteArray, fromIndex, length, charset); }
[ "String", "stringAt", "(", "final", "int", "fromIndex", ",", "final", "int", "length", ",", "final", "Charset", "charset", ")", "{", "return", "new", "String", "(", "byteArray", ",", "fromIndex", ",", "length", ",", "charset", ")", ";", "}" ]
Returns a string containing the characters in the specified part of the record. @param fromIndex index of the first byte of the string. @param length number of bytes to include in the string. If zero an empty string is returned. @param charset used for decoding the byte sequence into characters. It is callers responsibility to make sure that the selected byte range contains a valid byte sequence when working with multi-byte encodings such as UTF-8. @return the string represented by the bytes in the given range
[ "Returns", "a", "string", "containing", "the", "characters", "in", "the", "specified", "part", "of", "the", "record", "." ]
train
https://github.com/metafacture/metafacture-core/blob/cb43933ec8eb01a4ddce4019c14b2415cc441918/metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/Iso646ByteBuffer.java#L138-L141
albfernandez/itext2
src/main/java/com/lowagie/text/Document.java
Document.addHeader
public boolean addHeader(String name, String content) { try { return add(new Header(name, content)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
java
public boolean addHeader(String name, String content) { try { return add(new Header(name, content)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
[ "public", "boolean", "addHeader", "(", "String", "name", ",", "String", "content", ")", "{", "try", "{", "return", "add", "(", "new", "Header", "(", "name", ",", "content", ")", ")", ";", "}", "catch", "(", "DocumentException", "de", ")", "{", "throw",...
Adds a user defined header to the document. @param name the name of the header @param content the content of the header @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
[ "Adds", "a", "user", "defined", "header", "to", "the", "document", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Document.java#L512-L518
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.requiredClassAttribute
public static Class requiredClassAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { return requiredClassAttribute(reader, null, localName); }
java
public static Class requiredClassAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { return requiredClassAttribute(reader, null, localName); }
[ "public", "static", "Class", "requiredClassAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ")", "throws", "XMLStreamException", "{", "return", "requiredClassAttribute", "(", "reader", ",", "null", ",", "localName", ")", ";...
Returns the value of an attribute as a Class. If the attribute is empty, this method throws an exception. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @return value of attribute as Class @throws XMLStreamException if attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "Class", ".", "If", "the", "attribute", "is", "empty", "this", "method", "throws", "an", "exception", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L1081-L1084
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java
CommonConfigUtils.getRequiredConfigAttribute
public String getRequiredConfigAttribute(Map<String, Object> props, String key) { return getRequiredConfigAttributeWithDefaultValueAndConfigId(props, key, null, null); }
java
public String getRequiredConfigAttribute(Map<String, Object> props, String key) { return getRequiredConfigAttributeWithDefaultValueAndConfigId(props, key, null, null); }
[ "public", "String", "getRequiredConfigAttribute", "(", "Map", "<", "String", ",", "Object", ">", "props", ",", "String", "key", ")", "{", "return", "getRequiredConfigAttributeWithDefaultValueAndConfigId", "(", "props", ",", "key", ",", "null", ",", "null", ")", ...
Returns the value for the configuration attribute matching the key provided. If the value does not exist or is empty, the resulting value will be {@code null} and an error message will be logged.
[ "Returns", "the", "value", "for", "the", "configuration", "attribute", "matching", "the", "key", "provided", ".", "If", "the", "value", "does", "not", "exist", "or", "is", "empty", "the", "resulting", "value", "will", "be", "{" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java#L52-L54
linkedin/dexmaker
dexmaker-mockito-inline-extended/src/main/java/com/android/dx/mockito/inline/StaticMockMethodAdvice.java
StaticMockMethodAdvice.getOrigin
@SuppressWarnings("unused") public Method getOrigin(Object ignored, String methodWithTypeAndSignature) throws Throwable { MethodDesc methodDesc = new MethodDesc(methodWithTypeAndSignature); Class clazz = getClassMethodWasCalledOn(methodDesc); if (clazz == null) { return null; } Object marker = classToMarker.get(clazz); if (!isMocked(marker)) { return null; } return Class.forName(methodDesc.className).getDeclaredMethod(methodDesc.methodName, methodDesc.methodParamTypes); }
java
@SuppressWarnings("unused") public Method getOrigin(Object ignored, String methodWithTypeAndSignature) throws Throwable { MethodDesc methodDesc = new MethodDesc(methodWithTypeAndSignature); Class clazz = getClassMethodWasCalledOn(methodDesc); if (clazz == null) { return null; } Object marker = classToMarker.get(clazz); if (!isMocked(marker)) { return null; } return Class.forName(methodDesc.className).getDeclaredMethod(methodDesc.methodName, methodDesc.methodParamTypes); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "Method", "getOrigin", "(", "Object", "ignored", ",", "String", "methodWithTypeAndSignature", ")", "throws", "Throwable", "{", "MethodDesc", "methodDesc", "=", "new", "MethodDesc", "(", "methodWithTypeAndSigna...
Get the method specified by {@code methodWithTypeAndSignature}. @param ignored @param methodWithTypeAndSignature the description of the method @return method {@code methodWithTypeAndSignature} refer to
[ "Get", "the", "method", "specified", "by", "{", "@code", "methodWithTypeAndSignature", "}", "." ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker-mockito-inline-extended/src/main/java/com/android/dx/mockito/inline/StaticMockMethodAdvice.java#L198-L214
openxc/openxc-android
library/src/main/java/com/openxc/interfaces/UriBasedVehicleInterfaceMixin.java
UriBasedVehicleInterfaceMixin.sameResource
public static boolean sameResource(URI uri, String otherResource) { try { return createUri(otherResource).equals(uri); } catch(DataSourceException e) { return false; } }
java
public static boolean sameResource(URI uri, String otherResource) { try { return createUri(otherResource).equals(uri); } catch(DataSourceException e) { return false; } }
[ "public", "static", "boolean", "sameResource", "(", "URI", "uri", ",", "String", "otherResource", ")", "{", "try", "{", "return", "createUri", "(", "otherResource", ")", ".", "equals", "(", "uri", ")", ";", "}", "catch", "(", "DataSourceException", "e", ")...
Determine if two URIs refer to the same resource. The function safely attempts to convert the otherResource parameter to a URI object before comparing. @return true if the address and port match the current in-use values.
[ "Determine", "if", "two", "URIs", "refer", "to", "the", "same", "resource", "." ]
train
https://github.com/openxc/openxc-android/blob/799adbdcd107a72fe89737bbf19c039dc2881665/library/src/main/java/com/openxc/interfaces/UriBasedVehicleInterfaceMixin.java#L26-L32
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setProperty
public Config setProperty(String name, String value) { properties.put(name, value); return this; }
java
public Config setProperty(String name, String value) { properties.put(name, value); return this; }
[ "public", "Config", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "properties", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets the value of a named property. @param name property name @param value value of the property @return this config instance @see <a href="http://docs.hazelcast.org/docs/latest/manual/html-single/index.html#system-properties"> Hazelcast System Properties</a>
[ "Sets", "the", "value", "of", "a", "named", "property", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L260-L263
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.openTagStyle
public static String openTagStyle(String tag, String style, String... content) { return openTag(tag, null, style, content); }
java
public static String openTagStyle(String tag, String style, String... content) { return openTag(tag, null, style, content); }
[ "public", "static", "String", "openTagStyle", "(", "String", "tag", ",", "String", "style", ",", "String", "...", "content", ")", "{", "return", "openTag", "(", "tag", ",", "null", ",", "style", ",", "content", ")", ";", "}" ]
Build a String containing a HTML opening tag with given CSS style attribute(s) and concatenates the given content. Content should contain no HTML, because it is prepared with {@link #htmlEncode(String)}. @param tag String name of HTML tag @param style style for tag (plain CSS) @param content content string @return HTML tag element as string
[ "Build", "a", "String", "containing", "a", "HTML", "opening", "tag", "with", "given", "CSS", "style", "attribute", "(", "s", ")", "and", "concatenates", "the", "given", "content", ".", "Content", "should", "contain", "no", "HTML", "because", "it", "is", "p...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L363-L365
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java
SharesInner.listByDataBoxEdgeDeviceAsync
public Observable<Page<ShareInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) { return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName) .map(new Func1<ServiceResponse<Page<ShareInner>>, Page<ShareInner>>() { @Override public Page<ShareInner> call(ServiceResponse<Page<ShareInner>> response) { return response.body(); } }); }
java
public Observable<Page<ShareInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) { return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName) .map(new Func1<ServiceResponse<Page<ShareInner>>, Page<ShareInner>>() { @Override public Page<ShareInner> call(ServiceResponse<Page<ShareInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ShareInner", ">", ">", "listByDataBoxEdgeDeviceAsync", "(", "final", "String", "deviceName", ",", "final", "String", "resourceGroupName", ")", "{", "return", "listByDataBoxEdgeDeviceWithServiceResponseAsync", "(", "deviceName", ...
Lists all the shares in a data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ShareInner&gt; object
[ "Lists", "all", "the", "shares", "in", "a", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java#L152-L160
google/closure-compiler
src/com/google/javascript/rhino/NominalTypeBuilder.java
NominalTypeBuilder.declareConstructorProperty
public void declareConstructorProperty(String name, JSType type, Node defSite) { constructor.defineDeclaredProperty(name, type, defSite); }
java
public void declareConstructorProperty(String name, JSType type, Node defSite) { constructor.defineDeclaredProperty(name, type, defSite); }
[ "public", "void", "declareConstructorProperty", "(", "String", "name", ",", "JSType", "type", ",", "Node", "defSite", ")", "{", "constructor", ".", "defineDeclaredProperty", "(", "name", ",", "type", ",", "defSite", ")", ";", "}" ]
Declares a static property on the nominal type's constructor.
[ "Declares", "a", "static", "property", "on", "the", "nominal", "type", "s", "constructor", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/NominalTypeBuilder.java#L80-L82
OpenLiberty/open-liberty
dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseHashMap.java
DatabaseHashMap.updateNukerTimeStamp
private void updateNukerTimeStamp(Connection nukerCon, String appName) throws SQLException { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[UPDATE_NUKER_TIME_STAMP], "appName=" + appName); } PreparedStatement ps = null; long now = System.currentTimeMillis(); try { ps = nukerCon.prepareStatement(asyncUpdate); setPSLong(ps, 1, now); ps.setString(2, appName); ps.setString(3, appName); ps.setString(4, appName); ps.executeUpdate(); } finally { if (ps != null) closeStatement(ps); } if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) { LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[UPDATE_NUKER_TIME_STAMP], "appName=" + appName); } }
java
private void updateNukerTimeStamp(Connection nukerCon, String appName) throws SQLException { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[UPDATE_NUKER_TIME_STAMP], "appName=" + appName); } PreparedStatement ps = null; long now = System.currentTimeMillis(); try { ps = nukerCon.prepareStatement(asyncUpdate); setPSLong(ps, 1, now); ps.setString(2, appName); ps.setString(3, appName); ps.setString(4, appName); ps.executeUpdate(); } finally { if (ps != null) closeStatement(ps); } if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) { LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[UPDATE_NUKER_TIME_STAMP], "appName=" + appName); } }
[ "private", "void", "updateNukerTimeStamp", "(", "Connection", "nukerCon", ",", "String", "appName", ")", "throws", "SQLException", "{", "if", "(", "com", ".", "ibm", ".", "websphere", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&...
/* updateNukerTimeStamp When running in a clustered environment, there could be multiple machines processing invalidation. This method updates the last time the invalidation was run. A server should not try to process invalidation if it was already done within the specified time interval for that app.
[ "/", "*", "updateNukerTimeStamp", "When", "running", "in", "a", "clustered", "environment", "there", "could", "be", "multiple", "machines", "processing", "invalidation", ".", "This", "method", "updates", "the", "last", "time", "the", "invalidation", "was", "run", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseHashMap.java#L3065-L3086
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/script/Script.java
Script.correctlySpends
@Deprecated public void correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey) throws ScriptException { correctlySpends(txContainingThis, scriptSigIndex, scriptPubKey, ALL_VERIFY_FLAGS); }
java
@Deprecated public void correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey) throws ScriptException { correctlySpends(txContainingThis, scriptSigIndex, scriptPubKey, ALL_VERIFY_FLAGS); }
[ "@", "Deprecated", "public", "void", "correctlySpends", "(", "Transaction", "txContainingThis", ",", "long", "scriptSigIndex", ",", "Script", "scriptPubKey", ")", "throws", "ScriptException", "{", "correctlySpends", "(", "txContainingThis", ",", "scriptSigIndex", ",", ...
Verifies that this script (interpreted as a scriptSig) correctly spends the given scriptPubKey, enabling all validation rules. @param txContainingThis The transaction in which this input scriptSig resides. Accessing txContainingThis from another thread while this method runs results in undefined behavior. @param scriptSigIndex The index in txContainingThis of the scriptSig (note: NOT the index of the scriptPubKey). @param scriptPubKey The connected scriptPubKey containing the conditions needed to claim the value. @deprecated Use {@link #correctlySpends(Transaction, int, TransactionWitness, Coin, Script, Set)} instead so that verification flags do not change as new verification options are added.
[ "Verifies", "that", "this", "script", "(", "interpreted", "as", "a", "scriptSig", ")", "correctly", "spends", "the", "given", "scriptPubKey", "enabling", "all", "validation", "rules", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L1560-L1564
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java
ElementKindVisitor6.visitTypeParameter
@Override public R visitTypeParameter(TypeParameterElement e, P p) { assert e.getKind() == TYPE_PARAMETER: "Bad kind on TypeParameterElement"; return defaultAction(e, p); }
java
@Override public R visitTypeParameter(TypeParameterElement e, P p) { assert e.getKind() == TYPE_PARAMETER: "Bad kind on TypeParameterElement"; return defaultAction(e, p); }
[ "@", "Override", "public", "R", "visitTypeParameter", "(", "TypeParameterElement", "e", ",", "P", "p", ")", "{", "assert", "e", ".", "getKind", "(", ")", "==", "TYPE_PARAMETER", ":", "\"Bad kind on TypeParameterElement\"", ";", "return", "defaultAction", "(", "e...
{@inheritDoc} The element argument has kind {@code TYPE_PARAMETER}. @param e {@inheritDoc} @param p {@inheritDoc} @return {@inheritDoc}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java#L406-L410
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/JobTracker.java
JobTracker.markCompletedTaskAttempt
void markCompletedTaskAttempt(String taskTracker, TaskAttemptID taskid) { // tracker --> taskid Set<TaskAttemptID> taskset = trackerToMarkedTasksMap.get(taskTracker); if (taskset == null) { taskset = new TreeSet<TaskAttemptID>(); trackerToMarkedTasksMap.put(taskTracker, taskset); } taskset.add(taskid); LOG.debug("Marked '" + taskid + "' from '" + taskTracker + "'"); }
java
void markCompletedTaskAttempt(String taskTracker, TaskAttemptID taskid) { // tracker --> taskid Set<TaskAttemptID> taskset = trackerToMarkedTasksMap.get(taskTracker); if (taskset == null) { taskset = new TreeSet<TaskAttemptID>(); trackerToMarkedTasksMap.put(taskTracker, taskset); } taskset.add(taskid); LOG.debug("Marked '" + taskid + "' from '" + taskTracker + "'"); }
[ "void", "markCompletedTaskAttempt", "(", "String", "taskTracker", ",", "TaskAttemptID", "taskid", ")", "{", "// tracker --> taskid", "Set", "<", "TaskAttemptID", ">", "taskset", "=", "trackerToMarkedTasksMap", ".", "get", "(", "taskTracker", ")", ";", "if", "(", "...
Mark a 'task' for removal later. This function assumes that the JobTracker is locked on entry. @param taskTracker the tasktracker at which the 'task' was running @param taskid completed (success/failure/killed) task
[ "Mark", "a", "task", "for", "removal", "later", ".", "This", "function", "assumes", "that", "the", "JobTracker", "is", "locked", "on", "entry", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L1782-L1792
JohnSnowLabs/spark-nlp
src/main/scala/com/johnsnowlabs/nlp/annotators/parser/typdep/DependencyPipe.java
DependencyPipe.createDictionaries
private void createDictionaries(String file, String conllFormat) throws IOException { long start = System.currentTimeMillis(); logger.debug("Creating dictionariesSet ... "); dictionariesSet.setCounters(); DependencyReader reader = DependencyReader.createDependencyReader(conllFormat); reader.startReading(file); DependencyInstance dependencyInstance = reader.nextInstance(); while (dependencyInstance != null) { //This loop sets values in dictionariesSet for later use dependencyInstance.setInstIds(dictionariesSet, coarseMap, conjWord); dependencyInstance = reader.nextInstance(); } reader.close(); dictionariesSet.closeCounters(); synFactory.setTokenStart(dictionariesSet.lookupIndex(POS, "#TOKEN_START#")); synFactory.setTokenEnd(dictionariesSet.lookupIndex(POS, "#TOKEN_END#")); synFactory.setTokenMid(dictionariesSet.lookupIndex(POS, "#TOKEN_MID#")); dictionariesSet.stopGrowth(DEP_LABEL); dictionariesSet.stopGrowth(POS); dictionariesSet.stopGrowth(WORD); synFactory.setWordNumBits(Utils.log2((long) dictionariesSet.getDictionarySize(WORD) + 1)); synFactory.setTagNumBits(Utils.log2((long) dictionariesSet.getDictionarySize(POS) + 1)); synFactory.setDepNumBits(Utils.log2((long) dictionariesSet.getDictionarySize(DEP_LABEL) + 1)); synFactory.setFlagBits(2*synFactory.getDepNumBits() + 4); types = new String[dictionariesSet.getDictionarySize(DEP_LABEL)]; Dictionary labelDict = dictionariesSet.getDictionary(DEP_LABEL); Object[] keys = labelDict.toArray(); for (Object key : keys) { int id = labelDict.lookupIndex(key); types[id - 1] = (String) key; } if(logger.isDebugEnabled()) { logger.debug(String.format("%d %d %n", NUM_WORD_FEAT_BITS, NUM_ARC_FEAT_BITS)); logger.debug(String.format("Lexical items: %d (%d bits)%n", dictionariesSet.getDictionarySize(WORD), synFactory.getWordNumBits())); logger.debug(String.format("Tag/label items: %d (%d bits) %d (%d bits)%n", dictionariesSet.getDictionarySize(POS), synFactory.getTagNumBits(), dictionariesSet.getDictionarySize(DEP_LABEL), synFactory.getDepNumBits())); logger.debug(String.format("Flag Bits: %d%n", synFactory.getFlagBits())); logger.debug(String.format("Creation took [%d ms]%n", System.currentTimeMillis() - start)); } }
java
private void createDictionaries(String file, String conllFormat) throws IOException { long start = System.currentTimeMillis(); logger.debug("Creating dictionariesSet ... "); dictionariesSet.setCounters(); DependencyReader reader = DependencyReader.createDependencyReader(conllFormat); reader.startReading(file); DependencyInstance dependencyInstance = reader.nextInstance(); while (dependencyInstance != null) { //This loop sets values in dictionariesSet for later use dependencyInstance.setInstIds(dictionariesSet, coarseMap, conjWord); dependencyInstance = reader.nextInstance(); } reader.close(); dictionariesSet.closeCounters(); synFactory.setTokenStart(dictionariesSet.lookupIndex(POS, "#TOKEN_START#")); synFactory.setTokenEnd(dictionariesSet.lookupIndex(POS, "#TOKEN_END#")); synFactory.setTokenMid(dictionariesSet.lookupIndex(POS, "#TOKEN_MID#")); dictionariesSet.stopGrowth(DEP_LABEL); dictionariesSet.stopGrowth(POS); dictionariesSet.stopGrowth(WORD); synFactory.setWordNumBits(Utils.log2((long) dictionariesSet.getDictionarySize(WORD) + 1)); synFactory.setTagNumBits(Utils.log2((long) dictionariesSet.getDictionarySize(POS) + 1)); synFactory.setDepNumBits(Utils.log2((long) dictionariesSet.getDictionarySize(DEP_LABEL) + 1)); synFactory.setFlagBits(2*synFactory.getDepNumBits() + 4); types = new String[dictionariesSet.getDictionarySize(DEP_LABEL)]; Dictionary labelDict = dictionariesSet.getDictionary(DEP_LABEL); Object[] keys = labelDict.toArray(); for (Object key : keys) { int id = labelDict.lookupIndex(key); types[id - 1] = (String) key; } if(logger.isDebugEnabled()) { logger.debug(String.format("%d %d %n", NUM_WORD_FEAT_BITS, NUM_ARC_FEAT_BITS)); logger.debug(String.format("Lexical items: %d (%d bits)%n", dictionariesSet.getDictionarySize(WORD), synFactory.getWordNumBits())); logger.debug(String.format("Tag/label items: %d (%d bits) %d (%d bits)%n", dictionariesSet.getDictionarySize(POS), synFactory.getTagNumBits(), dictionariesSet.getDictionarySize(DEP_LABEL), synFactory.getDepNumBits())); logger.debug(String.format("Flag Bits: %d%n", synFactory.getFlagBits())); logger.debug(String.format("Creation took [%d ms]%n", System.currentTimeMillis() - start)); } }
[ "private", "void", "createDictionaries", "(", "String", "file", ",", "String", "conllFormat", ")", "throws", "IOException", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "logger", ".", "debug", "(", "\"Creating dictionariesSet ... \...
*F Build dictionariesSet that maps word strings, POS strings, etc into corresponding integer IDs. This method is called before creating the feature alphabets and before training a dependency model. @param file file path of the training data
[ "*", "F", "Build", "dictionariesSet", "that", "maps", "word", "strings", "POS", "strings", "etc", "into", "corresponding", "integer", "IDs", ".", "This", "method", "is", "called", "before", "creating", "the", "feature", "alphabets", "and", "before", "training", ...
train
https://github.com/JohnSnowLabs/spark-nlp/blob/cf6c7a86e044b82f7690157c195f77874858bb00/src/main/scala/com/johnsnowlabs/nlp/annotators/parser/typdep/DependencyPipe.java#L120-L174
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/geometry/GeometryUtil.java
GeometryUtil.shiftContainer
public static double[] shiftContainer(IAtomContainer container, double[] bounds, double[] last, double gap) { assert bounds.length == 4; assert last.length == 4; final double boundsMinX = bounds[0]; final double boundsMinY = bounds[1]; final double boundsMaxX = bounds[2]; final double boundsMaxY = bounds[3]; final double lastMaxX = last[2]; // determine if the containers are overlapping if (lastMaxX + gap >= boundsMinX) { double xShift = lastMaxX + gap - boundsMinX; Vector2d shift = new Vector2d(xShift, 0.0); GeometryUtil.translate2D(container, shift); return new double[]{boundsMinX + xShift, boundsMinY, boundsMaxX + xShift, boundsMaxY}; } else { // the containers are not overlapping return bounds; } }
java
public static double[] shiftContainer(IAtomContainer container, double[] bounds, double[] last, double gap) { assert bounds.length == 4; assert last.length == 4; final double boundsMinX = bounds[0]; final double boundsMinY = bounds[1]; final double boundsMaxX = bounds[2]; final double boundsMaxY = bounds[3]; final double lastMaxX = last[2]; // determine if the containers are overlapping if (lastMaxX + gap >= boundsMinX) { double xShift = lastMaxX + gap - boundsMinX; Vector2d shift = new Vector2d(xShift, 0.0); GeometryUtil.translate2D(container, shift); return new double[]{boundsMinX + xShift, boundsMinY, boundsMaxX + xShift, boundsMaxY}; } else { // the containers are not overlapping return bounds; } }
[ "public", "static", "double", "[", "]", "shiftContainer", "(", "IAtomContainer", "container", ",", "double", "[", "]", "bounds", ",", "double", "[", "]", "last", ",", "double", "gap", ")", "{", "assert", "bounds", ".", "length", "==", "4", ";", "assert",...
Shift the container horizontally to the right to make its bounds not overlap with the other bounds. To avoid dependence on Java AWT, rectangles are described by arrays of double. Each rectangle is specified by {minX, minY, maxX, maxY}. @param container the {@link IAtomContainer} to shift to the right @param bounds the bounds of the {@link IAtomContainer} to shift @param last the bounds that is used as reference @param gap the gap between the two rectangles @return the rectangle of the {@link IAtomContainer} after the shift
[ "Shift", "the", "container", "horizontally", "to", "the", "right", "to", "make", "its", "bounds", "not", "overlap", "with", "the", "other", "bounds", ".", "To", "avoid", "dependence", "on", "Java", "AWT", "rectangles", "are", "described", "by", "arrays", "of...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/geometry/GeometryUtil.java#L1619-L1641
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java
CollectionExtensions.operator_remove
@Inline(value="$3.removeAll($1, $2)", imported=Iterables.class) public static <E> boolean operator_remove(Collection<E> collection, Collection<? extends E> newElements) { return removeAll(collection, newElements); }
java
@Inline(value="$3.removeAll($1, $2)", imported=Iterables.class) public static <E> boolean operator_remove(Collection<E> collection, Collection<? extends E> newElements) { return removeAll(collection, newElements); }
[ "@", "Inline", "(", "value", "=", "\"$3.removeAll($1, $2)\"", ",", "imported", "=", "Iterables", ".", "class", ")", "public", "static", "<", "E", ">", "boolean", "operator_remove", "(", "Collection", "<", "E", ">", "collection", ",", "Collection", "<", "?", ...
The operator mapping from {@code -=} to {@link #removeAll(Collection, Collection)}. Returns <code>true</code> if the collection changed due to this operation. @param collection the to-be-changed collection. May not be <code>null</code>. @param newElements elements to be removed from the collection. May not be <code>null</code> but may contain <code>null</code> elements if the the target collection supports <code>null</code> elements. @return <code>true</code> if the collection changed due to this operation. @see #removeAll(Collection, Collection) @since 2.4
[ "The", "operator", "mapping", "from", "{", "@code", "-", "=", "}", "to", "{", "@link", "#removeAll", "(", "Collection", "Collection", ")", "}", ".", "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "collection", "changed", "due", "to", ...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L100-L103
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.fireMouseClicked
private void fireMouseClicked(int button, int x, int y, int clickCount) { consumed = false; for (int i=0;i<mouseListeners.size();i++) { MouseListener listener = (MouseListener) mouseListeners.get(i); if (listener.isAcceptingInput()) { listener.mouseClicked(button, x, y, clickCount); if (consumed) { break; } } } }
java
private void fireMouseClicked(int button, int x, int y, int clickCount) { consumed = false; for (int i=0;i<mouseListeners.size();i++) { MouseListener listener = (MouseListener) mouseListeners.get(i); if (listener.isAcceptingInput()) { listener.mouseClicked(button, x, y, clickCount); if (consumed) { break; } } } }
[ "private", "void", "fireMouseClicked", "(", "int", "button", ",", "int", "x", ",", "int", "y", ",", "int", "clickCount", ")", "{", "consumed", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mouseListeners", ".", "size", "(", "...
Notify listeners that the mouse button has been clicked @param button The button that has been clicked @param x The location at which the button was clicked @param y The location at which the button was clicked @param clickCount The number of times the button was clicked (single or double click)
[ "Notify", "listeners", "that", "the", "mouse", "button", "has", "been", "clicked" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L1523-L1534
weld/core
impl/src/main/java/org/jboss/weld/bean/attributes/ExternalBeanAttributesFactory.java
ExternalBeanAttributesFactory.validateBeanAttributes
public static void validateBeanAttributes(BeanAttributes<?> attributes, BeanManager manager) { validateStereotypes(attributes, manager); validateQualifiers(attributes, manager); validateTypes(attributes, manager); validateScope(attributes, manager); }
java
public static void validateBeanAttributes(BeanAttributes<?> attributes, BeanManager manager) { validateStereotypes(attributes, manager); validateQualifiers(attributes, manager); validateTypes(attributes, manager); validateScope(attributes, manager); }
[ "public", "static", "void", "validateBeanAttributes", "(", "BeanAttributes", "<", "?", ">", "attributes", ",", "BeanManager", "manager", ")", "{", "validateStereotypes", "(", "attributes", ",", "manager", ")", ";", "validateQualifiers", "(", "attributes", ",", "ma...
Validates {@link BeanAttributes}. @param attributes {@link BeanAttributes} to validate
[ "Validates", "{" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/attributes/ExternalBeanAttributesFactory.java#L67-L72
baratine/baratine
web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java
RequestHttpBase.setFooter
public void setFooter(String key, String value) { Objects.requireNonNull(value); int i = 0; boolean hasFooter = false; for (i = _footerKeys.size() - 1; i >= 0; i--) { String oldKey = _footerKeys.get(i); if (oldKey.equalsIgnoreCase(key)) { if (hasFooter) { _footerKeys.remove(i); _footerValues.remove(i); } else { hasFooter = true; _footerValues.set(i, value); } } } if (! hasFooter) { _footerKeys.add(key); _footerValues.add(value); } }
java
public void setFooter(String key, String value) { Objects.requireNonNull(value); int i = 0; boolean hasFooter = false; for (i = _footerKeys.size() - 1; i >= 0; i--) { String oldKey = _footerKeys.get(i); if (oldKey.equalsIgnoreCase(key)) { if (hasFooter) { _footerKeys.remove(i); _footerValues.remove(i); } else { hasFooter = true; _footerValues.set(i, value); } } } if (! hasFooter) { _footerKeys.add(key); _footerValues.add(value); } }
[ "public", "void", "setFooter", "(", "String", "key", ",", "String", "value", ")", "{", "Objects", ".", "requireNonNull", "(", "value", ")", ";", "int", "i", "=", "0", ";", "boolean", "hasFooter", "=", "false", ";", "for", "(", "i", "=", "_footerKeys", ...
Sets a footer, replacing an already-existing footer @param key the header key to set. @param value the header value to set.
[ "Sets", "a", "footer", "replacing", "an", "already", "-", "existing", "footer" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java#L2214-L2241
threerings/narya
core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java
PresentsDObjectMgr.informObjectAvailable
protected static <T extends DObject> void informObjectAvailable (Subscriber<T> sub, T obj) { try { sub.objectAvailable(obj); } catch (Exception e) { log.warning("Subscriber choked during object available", "obj", StringUtil.safeToString(obj), "sub", sub, e); } }
java
protected static <T extends DObject> void informObjectAvailable (Subscriber<T> sub, T obj) { try { sub.objectAvailable(obj); } catch (Exception e) { log.warning("Subscriber choked during object available", "obj", StringUtil.safeToString(obj), "sub", sub, e); } }
[ "protected", "static", "<", "T", "extends", "DObject", ">", "void", "informObjectAvailable", "(", "Subscriber", "<", "T", ">", "sub", ",", "T", "obj", ")", "{", "try", "{", "sub", ".", "objectAvailable", "(", "obj", ")", ";", "}", "catch", "(", "Except...
Calls {@link Subscriber#objectAvailable} and catches and logs any exception thrown by the subscriber during the call.
[ "Calls", "{" ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java#L912-L920
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/action/ActionManager.java
ActionManager.addMenuItem
public JMenuItem addMenuItem(JMenu menu, String strCommand, ActionListener targetListener, KeyStroke keyStroke) { BaseAction action = new BaseAction(strCommand, targetListener); if (keyStroke != null) action.putValue(Action.ACCELERATOR_KEY, keyStroke); return this.addMenuItem(menu, strCommand, null); }
java
public JMenuItem addMenuItem(JMenu menu, String strCommand, ActionListener targetListener, KeyStroke keyStroke) { BaseAction action = new BaseAction(strCommand, targetListener); if (keyStroke != null) action.putValue(Action.ACCELERATOR_KEY, keyStroke); return this.addMenuItem(menu, strCommand, null); }
[ "public", "JMenuItem", "addMenuItem", "(", "JMenu", "menu", ",", "String", "strCommand", ",", "ActionListener", "targetListener", ",", "KeyStroke", "keyStroke", ")", "{", "BaseAction", "action", "=", "new", "BaseAction", "(", "strCommand", ",", "targetListener", "...
Add this button to this window. @param strIcon The command and Icon name. @param strLink The button name.
[ "Add", "this", "button", "to", "this", "window", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/action/ActionManager.java#L211-L217
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java
PlacesApi.getShapeHistory
public ShapeHistory getShapeHistory(String placeId, String woeId) throws JinxException { if (JinxUtils.isNullOrEmpty(placeId)) { JinxUtils.validateParams(woeId); } Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.places.getShapeHistory"); if (JinxUtils.isNullOrEmpty(placeId)) { params.put("woe_id", woeId); } else { params.put("place_id", placeId); } return jinx.flickrGet(params, ShapeHistory.class, false); }
java
public ShapeHistory getShapeHistory(String placeId, String woeId) throws JinxException { if (JinxUtils.isNullOrEmpty(placeId)) { JinxUtils.validateParams(woeId); } Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.places.getShapeHistory"); if (JinxUtils.isNullOrEmpty(placeId)) { params.put("woe_id", woeId); } else { params.put("place_id", placeId); } return jinx.flickrGet(params, ShapeHistory.class, false); }
[ "public", "ShapeHistory", "getShapeHistory", "(", "String", "placeId", ",", "String", "woeId", ")", "throws", "JinxException", "{", "if", "(", "JinxUtils", ".", "isNullOrEmpty", "(", "placeId", ")", ")", "{", "JinxUtils", ".", "validateParams", "(", "woeId", "...
Return an historical list of all the shape data generated for a Places or Where on Earth (WOE) ID. <p>Authentication</p> <p>This method does not require authentication.</p> @param placeId 4yya valid Flickr place id. @param woeId a Where On Earth (WOE) id. @return information about the specified place. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.places.getShapeHistory.html">flickr.places.getShapeHistory</a>
[ "Return", "an", "historical", "list", "of", "all", "the", "shape", "data", "generated", "for", "a", "Places", "or", "Where", "on", "Earth", "(", "WOE", ")", "ID", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java#L219-L231
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsResourceTypeConfig.java
CmsResourceTypeConfig.createNewElement
public CmsResource createNewElement(CmsObject userCms, CmsResource modelResource, String pageFolderRootPath) throws CmsException { checkOffline(userCms); checkInitialized(); CmsObject rootCms = rootCms(userCms); String folderPath = getFolderPath(userCms, pageFolderRootPath); CmsVfsUtil.createFolder(userCms, folderPath); String destination = CmsStringUtil.joinPaths(folderPath, getNamePattern(true)); String creationPath = OpenCms.getResourceManager().getNameGenerator().getNewFileName(rootCms, destination, 5); // set the content locale rootCms.getRequestContext().setAttribute( CmsRequestContext.ATTRIBUTE_NEW_RESOURCE_LOCALE, userCms.getRequestContext().getLocale()); if (modelResource != null) { // set the model resource rootCms.getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_MODEL, modelResource.getRootPath()); } CmsResource createdResource = rootCms.createResource( creationPath, getType(), null, new ArrayList<CmsProperty>(0)); if (modelResource != null) { // set the model resource CmsCategoryService.getInstance().copyCategories(rootCms, modelResource, creationPath); } try { rootCms.unlockResource(creationPath); } catch (CmsLockException e) { // probably the parent folder is locked LOG.info(e.getLocalizedMessage(), e); } return createdResource; }
java
public CmsResource createNewElement(CmsObject userCms, CmsResource modelResource, String pageFolderRootPath) throws CmsException { checkOffline(userCms); checkInitialized(); CmsObject rootCms = rootCms(userCms); String folderPath = getFolderPath(userCms, pageFolderRootPath); CmsVfsUtil.createFolder(userCms, folderPath); String destination = CmsStringUtil.joinPaths(folderPath, getNamePattern(true)); String creationPath = OpenCms.getResourceManager().getNameGenerator().getNewFileName(rootCms, destination, 5); // set the content locale rootCms.getRequestContext().setAttribute( CmsRequestContext.ATTRIBUTE_NEW_RESOURCE_LOCALE, userCms.getRequestContext().getLocale()); if (modelResource != null) { // set the model resource rootCms.getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_MODEL, modelResource.getRootPath()); } CmsResource createdResource = rootCms.createResource( creationPath, getType(), null, new ArrayList<CmsProperty>(0)); if (modelResource != null) { // set the model resource CmsCategoryService.getInstance().copyCategories(rootCms, modelResource, creationPath); } try { rootCms.unlockResource(creationPath); } catch (CmsLockException e) { // probably the parent folder is locked LOG.info(e.getLocalizedMessage(), e); } return createdResource; }
[ "public", "CmsResource", "createNewElement", "(", "CmsObject", "userCms", ",", "CmsResource", "modelResource", ",", "String", "pageFolderRootPath", ")", "throws", "CmsException", "{", "checkOffline", "(", "userCms", ")", ";", "checkInitialized", "(", ")", ";", "CmsO...
Creates a new element.<p> @param userCms the CMS context to use @param modelResource the model resource to use @param pageFolderRootPath the root path of the folder containing the current container page @return the created resource @throws CmsException if something goes wrong
[ "Creates", "a", "new", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L358-L392
nightcode/yaranga
core/src/org/nightcode/common/base/Splitter.java
Splitter.trim
public Splitter trim(char[] chars) { Matcher matcher = new CharsMatcher(chars); return new Splitter(pairSeparator, keyValueSeparator, matcher, matcher); }
java
public Splitter trim(char[] chars) { Matcher matcher = new CharsMatcher(chars); return new Splitter(pairSeparator, keyValueSeparator, matcher, matcher); }
[ "public", "Splitter", "trim", "(", "char", "[", "]", "chars", ")", "{", "Matcher", "matcher", "=", "new", "CharsMatcher", "(", "chars", ")", ";", "return", "new", "Splitter", "(", "pairSeparator", ",", "keyValueSeparator", ",", "matcher", ",", "matcher", "...
Returns a splitter that removes all leading or trailing characters matching the given characters from each returned key and value. @param chars characters @return a splitter with the desired configuration
[ "Returns", "a", "splitter", "that", "removes", "all", "leading", "or", "trailing", "characters", "matching", "the", "given", "characters", "from", "each", "returned", "key", "and", "value", "." ]
train
https://github.com/nightcode/yaranga/blob/f02cf8d8bcd365b6b1d55638938631a00e9ee808/core/src/org/nightcode/common/base/Splitter.java#L152-L155
aws/aws-sdk-java
aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/DescribeIdentityPoolResult.java
DescribeIdentityPoolResult.withIdentityPoolTags
public DescribeIdentityPoolResult withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) { setIdentityPoolTags(identityPoolTags); return this; }
java
public DescribeIdentityPoolResult withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) { setIdentityPoolTags(identityPoolTags); return this; }
[ "public", "DescribeIdentityPoolResult", "withIdentityPoolTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "identityPoolTags", ")", "{", "setIdentityPoolTags", "(", "identityPoolTags", ")", ";", "return", "this", ";", "}" ]
<p> The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. </p> @param identityPoolTags The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "that", "are", "assigned", "to", "the", "identity", "pool", ".", "A", "tag", "is", "a", "label", "that", "you", "can", "apply", "to", "identity", "pools", "to", "categorize", "and", "manage", "them", "in", "different", "ways", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/DescribeIdentityPoolResult.java#L569-L572
apache/incubator-atlas
common/src/main/java/org/apache/atlas/ha/HAConfiguration.java
HAConfiguration.getBoundAddressForId
public static String getBoundAddressForId(Configuration configuration, String serverId) { String hostPort = configuration.getString(ATLAS_SERVER_ADDRESS_PREFIX +serverId); boolean isSecure = configuration.getBoolean(SecurityProperties.TLS_ENABLED); String protocol = (isSecure) ? "https://" : "http://"; return protocol + hostPort; }
java
public static String getBoundAddressForId(Configuration configuration, String serverId) { String hostPort = configuration.getString(ATLAS_SERVER_ADDRESS_PREFIX +serverId); boolean isSecure = configuration.getBoolean(SecurityProperties.TLS_ENABLED); String protocol = (isSecure) ? "https://" : "http://"; return protocol + hostPort; }
[ "public", "static", "String", "getBoundAddressForId", "(", "Configuration", "configuration", ",", "String", "serverId", ")", "{", "String", "hostPort", "=", "configuration", ".", "getString", "(", "ATLAS_SERVER_ADDRESS_PREFIX", "+", "serverId", ")", ";", "boolean", ...
Get the web server address that a server instance with the passed ID is bound to. This method uses the property {@link SecurityProperties#TLS_ENABLED} to determine whether the URL is http or https. @param configuration underlying configuration @param serverId serverId whose host:port property is picked to build the web server address. @return
[ "Get", "the", "web", "server", "address", "that", "a", "server", "instance", "with", "the", "passed", "ID", "is", "bound", "to", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/common/src/main/java/org/apache/atlas/ha/HAConfiguration.java#L86-L91
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F64.java
EquirectangularTools_F64.equiToLatLon
public void equiToLatLon(double x , double y , GeoLL_F64 geo ) { geo.lon = (x/width - 0.5)*GrlConstants.PI2; geo.lat = (y/(height-1) - 0.5)*GrlConstants.PI; }
java
public void equiToLatLon(double x , double y , GeoLL_F64 geo ) { geo.lon = (x/width - 0.5)*GrlConstants.PI2; geo.lat = (y/(height-1) - 0.5)*GrlConstants.PI; }
[ "public", "void", "equiToLatLon", "(", "double", "x", ",", "double", "y", ",", "GeoLL_F64", "geo", ")", "{", "geo", ".", "lon", "=", "(", "x", "/", "width", "-", "0.5", ")", "*", "GrlConstants", ".", "PI2", ";", "geo", ".", "lat", "=", "(", "y", ...
Converts the equirectangular coordinate into a latitude and longitude @param x pixel coordinate in equirectangular image @param y pixel coordinate in equirectangular image @param geo (output)
[ "Converts", "the", "equirectangular", "coordinate", "into", "a", "latitude", "and", "longitude" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F64.java#L118-L121
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java
DrawerUIUtils.getPlaceHolder
public static Drawable getPlaceHolder(Context ctx) { return new IconicsDrawable(ctx, MaterialDrawerFont.Icon.mdf_person).colorRes(R.color.accent).backgroundColorRes(R.color.primary).sizeDp(56).paddingDp(16); }
java
public static Drawable getPlaceHolder(Context ctx) { return new IconicsDrawable(ctx, MaterialDrawerFont.Icon.mdf_person).colorRes(R.color.accent).backgroundColorRes(R.color.primary).sizeDp(56).paddingDp(16); }
[ "public", "static", "Drawable", "getPlaceHolder", "(", "Context", "ctx", ")", "{", "return", "new", "IconicsDrawable", "(", "ctx", ",", "MaterialDrawerFont", ".", "Icon", ".", "mdf_person", ")", ".", "colorRes", "(", "R", ".", "color", ".", "accent", ")", ...
helper method to get a person placeHolder drawable @param ctx @return
[ "helper", "method", "to", "get", "a", "person", "placeHolder", "drawable" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java#L194-L196
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFit.java
SplitMergeLineFit.process
public boolean process( List<Point2D_I32> list , GrowQueue_I32 vertexes ) { this.contour = list; this.minimumSideLengthPixel = minimumSideLength.computeI(contour.size()); splits.reset(); boolean result = _process(list); // remove reference so that it can be freed this.contour = null; vertexes.setTo(splits); return result; }
java
public boolean process( List<Point2D_I32> list , GrowQueue_I32 vertexes ) { this.contour = list; this.minimumSideLengthPixel = minimumSideLength.computeI(contour.size()); splits.reset(); boolean result = _process(list); // remove reference so that it can be freed this.contour = null; vertexes.setTo(splits); return result; }
[ "public", "boolean", "process", "(", "List", "<", "Point2D_I32", ">", "list", ",", "GrowQueue_I32", "vertexes", ")", "{", "this", ".", "contour", "=", "list", ";", "this", ".", "minimumSideLengthPixel", "=", "minimumSideLength", ".", "computeI", "(", "contour"...
Approximates the input list with a set of line segments @param list (Input) Ordered list of connected points. @param vertexes (Output) Indexes in the input list which are corners in the polyline @return true if it could fit a polygon to the points or false if not
[ "Approximates", "the", "input", "list", "with", "a", "set", "of", "line", "segments" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFit.java#L102-L113
attribyte/wpdb
src/main/java/org/attribyte/wp/db/DB.java
DB.clearPostTerms
public void clearPostTerms(final long postId, final String taxonomy) throws SQLException { List<TaxonomyTerm> terms = selectPostTerms(postId, taxonomy); for(TaxonomyTerm term : terms) { clearPostTerm(postId, term.id); } }
java
public void clearPostTerms(final long postId, final String taxonomy) throws SQLException { List<TaxonomyTerm> terms = selectPostTerms(postId, taxonomy); for(TaxonomyTerm term : terms) { clearPostTerm(postId, term.id); } }
[ "public", "void", "clearPostTerms", "(", "final", "long", "postId", ",", "final", "String", "taxonomy", ")", "throws", "SQLException", "{", "List", "<", "TaxonomyTerm", ">", "terms", "=", "selectPostTerms", "(", "postId", ",", "taxonomy", ")", ";", "for", "(...
Clears all terms associated with a post with a specified taxonomy. @param postId The post id. @param taxonomy The taxonomy. @throws SQLException on database error.
[ "Clears", "all", "terms", "associated", "with", "a", "post", "with", "a", "specified", "taxonomy", "." ]
train
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L2512-L2517
jfinal/jfinal
src/main/java/com/jfinal/captcha/CaptchaRender.java
CaptchaRender.validate
public static boolean validate(String captchaKey, String userInputString) { ICaptchaCache captchaCache = CaptchaManager.me().getCaptchaCache(); Captcha captcha = captchaCache.get(captchaKey); if (captcha != null && captcha.notExpired() && captcha.getValue().equalsIgnoreCase(userInputString)) { captchaCache.remove(captcha.getKey()); return true; } return false; }
java
public static boolean validate(String captchaKey, String userInputString) { ICaptchaCache captchaCache = CaptchaManager.me().getCaptchaCache(); Captcha captcha = captchaCache.get(captchaKey); if (captcha != null && captcha.notExpired() && captcha.getValue().equalsIgnoreCase(userInputString)) { captchaCache.remove(captcha.getKey()); return true; } return false; }
[ "public", "static", "boolean", "validate", "(", "String", "captchaKey", ",", "String", "userInputString", ")", "{", "ICaptchaCache", "captchaCache", "=", "CaptchaManager", ".", "me", "(", ")", ".", "getCaptchaCache", "(", ")", ";", "Captcha", "captcha", "=", "...
校验用户输入的验证码是否正确 @param captchaKey 验证码 key,在不支持 cookie 的情况下可通过传参给服务端 @param userInputString 用户输入的字符串 @return 验证通过返回 true, 否则返回 false
[ "校验用户输入的验证码是否正确" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/captcha/CaptchaRender.java#L233-L241
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/CheckBoxPainter.java
CheckBoxPainter.createCheckMark
private Shape createCheckMark(int x, int y, int size) { int markSize = (int) (size * SIZE_MULTIPLIER + 0.5); int markX = x + (int) (size * X_MULTIPLIER + 0.5); int markY = y + (int) (size * Y_MULTIPLIER + 0.5); return shapeGenerator.createCheckMark(markX, markY, markSize, markSize); }
java
private Shape createCheckMark(int x, int y, int size) { int markSize = (int) (size * SIZE_MULTIPLIER + 0.5); int markX = x + (int) (size * X_MULTIPLIER + 0.5); int markY = y + (int) (size * Y_MULTIPLIER + 0.5); return shapeGenerator.createCheckMark(markX, markY, markSize, markSize); }
[ "private", "Shape", "createCheckMark", "(", "int", "x", ",", "int", "y", ",", "int", "size", ")", "{", "int", "markSize", "=", "(", "int", ")", "(", "size", "*", "SIZE_MULTIPLIER", "+", "0.5", ")", ";", "int", "markX", "=", "x", "+", "(", "int", ...
Create the check mark shape. @param x the x coordinate of the upper-left corner of the check mark. @param y the y coordinate of the upper-left corner of the check mark. @param size the check mark size in pixels. @return the check mark shape.
[ "Create", "the", "check", "mark", "shape", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/CheckBoxPainter.java#L188-L194
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setEnterpriseDuration
public void setEnterpriseDuration(int index, Duration value) { set(selectField(TaskFieldLists.ENTERPRISE_DURATION, index), value); }
java
public void setEnterpriseDuration(int index, Duration value) { set(selectField(TaskFieldLists.ENTERPRISE_DURATION, index), value); }
[ "public", "void", "setEnterpriseDuration", "(", "int", "index", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "ENTERPRISE_DURATION", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise field value. @param index field index @param value field value
[ "Set", "an", "enterprise", "field", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L3881-L3884
primefaces-extensions/core
src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java
JavascriptVarBuilder.appendText
public JavascriptVarBuilder appendText(final String value, final boolean quoted) { if (quoted) { sb.append("\""); if (value != null) { sb.append(EscapeUtils.forJavaScript(value)); } sb.append("\""); } else if (value != null) { sb.append(value); } return this; }
java
public JavascriptVarBuilder appendText(final String value, final boolean quoted) { if (quoted) { sb.append("\""); if (value != null) { sb.append(EscapeUtils.forJavaScript(value)); } sb.append("\""); } else if (value != null) { sb.append(value); } return this; }
[ "public", "JavascriptVarBuilder", "appendText", "(", "final", "String", "value", ",", "final", "boolean", "quoted", ")", "{", "if", "(", "quoted", ")", "{", "sb", ".", "append", "(", "\"\\\"\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "sb...
Appends text to the var string @param value the value to append @param quoted if true, the value is quoted and escaped. @return this builder
[ "Appends", "text", "to", "the", "var", "string" ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java#L106-L118
irmen/Pyrolite
java/src/main/java/net/razorvine/pyro/Message.java
Message.from_header
public static Message from_header(byte[] header) { if(header==null || header.length!=HEADER_SIZE) throw new PyroException("header data size mismatch"); if(header[0]!='P'||header[1]!='Y'||header[2]!='R'||header[3]!='O') throw new PyroException("invalid message"); int version = ((header[4]&0xff) << 8)|(header[5]&0xff); if(version!=Config.PROTOCOL_VERSION) throw new PyroException("invalid protocol version: "+version); int msg_type = ((header[6]&0xff) << 8)|(header[7]&0xff); int flags = ((header[8]&0xff) << 8)|(header[9]&0xff); int seq = ((header[10]&0xff) << 8)|(header[11]&0xff); int data_size=header[12]&0xff; data_size<<=8; data_size|=header[13]&0xff; data_size<<=8; data_size|=header[14]&0xff; data_size<<=8; data_size|=header[15]&0xff; int serializer_id = ((header[16]&0xff) << 8)|(header[17]&0xff); int annotations_size = ((header[18]&0xff) <<8)|(header[19]&0xff); // byte 20 and 21 are reserved. int checksum = ((header[22]&0xff) << 8)|(header[23]&0xff); int actual_checksum = (msg_type+version+data_size+annotations_size+flags+serializer_id+seq+CHECKSUM_MAGIC)&0xffff; if(checksum!=actual_checksum) throw new PyroException("header checksum mismatch"); Message msg = new Message(msg_type, serializer_id, flags, seq); msg.data_size = data_size; msg.annotations_size = annotations_size; return msg; }
java
public static Message from_header(byte[] header) { if(header==null || header.length!=HEADER_SIZE) throw new PyroException("header data size mismatch"); if(header[0]!='P'||header[1]!='Y'||header[2]!='R'||header[3]!='O') throw new PyroException("invalid message"); int version = ((header[4]&0xff) << 8)|(header[5]&0xff); if(version!=Config.PROTOCOL_VERSION) throw new PyroException("invalid protocol version: "+version); int msg_type = ((header[6]&0xff) << 8)|(header[7]&0xff); int flags = ((header[8]&0xff) << 8)|(header[9]&0xff); int seq = ((header[10]&0xff) << 8)|(header[11]&0xff); int data_size=header[12]&0xff; data_size<<=8; data_size|=header[13]&0xff; data_size<<=8; data_size|=header[14]&0xff; data_size<<=8; data_size|=header[15]&0xff; int serializer_id = ((header[16]&0xff) << 8)|(header[17]&0xff); int annotations_size = ((header[18]&0xff) <<8)|(header[19]&0xff); // byte 20 and 21 are reserved. int checksum = ((header[22]&0xff) << 8)|(header[23]&0xff); int actual_checksum = (msg_type+version+data_size+annotations_size+flags+serializer_id+seq+CHECKSUM_MAGIC)&0xffff; if(checksum!=actual_checksum) throw new PyroException("header checksum mismatch"); Message msg = new Message(msg_type, serializer_id, flags, seq); msg.data_size = data_size; msg.annotations_size = annotations_size; return msg; }
[ "public", "static", "Message", "from_header", "(", "byte", "[", "]", "header", ")", "{", "if", "(", "header", "==", "null", "||", "header", ".", "length", "!=", "HEADER_SIZE", ")", "throw", "new", "PyroException", "(", "\"header data size mismatch\"", ")", "...
Parses a message header. Does not yet process the annotations chunks and message data.
[ "Parses", "a", "message", "header", ".", "Does", "not", "yet", "process", "the", "annotations", "chunks", "and", "message", "data", "." ]
train
https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pyro/Message.java#L209-L243
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.updateScope
public String updateScope(FullHttpRequest req, String scopeName) throws OAuthException { String contentType = (req.headers() != null) ? req.headers().get(HttpHeaderNames.CONTENT_TYPE) : null; // check Content-Type if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON)) { try { Scope scope = InputValidator.validate(req.content().toString(CharsetUtil.UTF_8), Scope.class); if (scope.validForUpdate()) { Scope foundScope = DBManagerFactory.getInstance().findScope(scopeName).blockingGet(); if (foundScope == null) { LOG.error("scope does not exist"); throw new OAuthException(SCOPE_NOT_EXIST, HttpResponseStatus.BAD_REQUEST); } else { setScopeEmptyValues(scope, foundScope); DBManagerFactory.getInstance().storeScope(scope); } } else { LOG.error("scope is not valid"); throw new OAuthException(MANDATORY_SCOPE_ERROR, HttpResponseStatus.BAD_REQUEST); } } catch (Exception e) { LOG.error("cannot handle scope request", e); throw new OAuthException(e, null, HttpResponseStatus.BAD_REQUEST); } } else { throw new OAuthException(ResponseBuilder.UNSUPPORTED_MEDIA_TYPE, HttpResponseStatus.BAD_REQUEST); } return SCOPE_UPDATED_OK_MESSAGE; }
java
public String updateScope(FullHttpRequest req, String scopeName) throws OAuthException { String contentType = (req.headers() != null) ? req.headers().get(HttpHeaderNames.CONTENT_TYPE) : null; // check Content-Type if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON)) { try { Scope scope = InputValidator.validate(req.content().toString(CharsetUtil.UTF_8), Scope.class); if (scope.validForUpdate()) { Scope foundScope = DBManagerFactory.getInstance().findScope(scopeName).blockingGet(); if (foundScope == null) { LOG.error("scope does not exist"); throw new OAuthException(SCOPE_NOT_EXIST, HttpResponseStatus.BAD_REQUEST); } else { setScopeEmptyValues(scope, foundScope); DBManagerFactory.getInstance().storeScope(scope); } } else { LOG.error("scope is not valid"); throw new OAuthException(MANDATORY_SCOPE_ERROR, HttpResponseStatus.BAD_REQUEST); } } catch (Exception e) { LOG.error("cannot handle scope request", e); throw new OAuthException(e, null, HttpResponseStatus.BAD_REQUEST); } } else { throw new OAuthException(ResponseBuilder.UNSUPPORTED_MEDIA_TYPE, HttpResponseStatus.BAD_REQUEST); } return SCOPE_UPDATED_OK_MESSAGE; }
[ "public", "String", "updateScope", "(", "FullHttpRequest", "req", ",", "String", "scopeName", ")", "throws", "OAuthException", "{", "String", "contentType", "=", "(", "req", ".", "headers", "(", ")", "!=", "null", ")", "?", "req", ".", "headers", "(", ")",...
Updates a scope. If the scope does not exists, returns an error. @param req http request @return String message that will be returned in the response
[ "Updates", "a", "scope", ".", "If", "the", "scope", "does", "not", "exists", "returns", "an", "error", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L216-L243
devnied/Bit-lib4j
src/main/java/fr/devnied/bitlib/BitUtils.java
BitUtils.setNextDate
public void setNextDate(final Date pValue, final String pPattern, final boolean pUseBcd) { // create date formatter SimpleDateFormat sdf = new SimpleDateFormat(pPattern); String value = sdf.format(pValue); if (pUseBcd) { setNextHexaString(value, value.length() * 4); } else { setNextString(value, value.length() * 8); } }
java
public void setNextDate(final Date pValue, final String pPattern, final boolean pUseBcd) { // create date formatter SimpleDateFormat sdf = new SimpleDateFormat(pPattern); String value = sdf.format(pValue); if (pUseBcd) { setNextHexaString(value, value.length() * 4); } else { setNextString(value, value.length() * 8); } }
[ "public", "void", "setNextDate", "(", "final", "Date", "pValue", ",", "final", "String", "pPattern", ",", "final", "boolean", "pUseBcd", ")", "{", "// create date formatter\r", "SimpleDateFormat", "sdf", "=", "new", "SimpleDateFormat", "(", "pPattern", ")", ";", ...
Method to write a date @param pValue the value to write @param pPattern the Date pattern @param pUseBcd write date as BCD (binary coded decimal)
[ "Method", "to", "write", "a", "date" ]
train
https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BitUtils.java#L536-L546
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.readString
public static String readString(URL url, String charset) throws IORuntimeException { if (url == null) { throw new NullPointerException("Empty url provided!"); } InputStream in = null; try { in = url.openStream(); return IoUtil.read(in, charset); } catch (IOException e) { throw new IORuntimeException(e); } finally { IoUtil.close(in); } }
java
public static String readString(URL url, String charset) throws IORuntimeException { if (url == null) { throw new NullPointerException("Empty url provided!"); } InputStream in = null; try { in = url.openStream(); return IoUtil.read(in, charset); } catch (IOException e) { throw new IORuntimeException(e); } finally { IoUtil.close(in); } }
[ "public", "static", "String", "readString", "(", "URL", "url", ",", "String", "charset", ")", "throws", "IORuntimeException", "{", "if", "(", "url", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Empty url provided!\"", ")", ";", "}", ...
读取文件内容 @param url 文件URL @param charset 字符集 @return 内容 @throws IORuntimeException IO异常
[ "读取文件内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2138-L2152
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/Convolution1DUtils.java
Convolution1DUtils.validateConvolutionModePadding
public static void validateConvolutionModePadding(ConvolutionMode mode, int padding) { if (mode == ConvolutionMode.Same) { boolean nullPadding = true; if (padding != 0) nullPadding = false; if (!nullPadding) throw new IllegalArgumentException("Padding cannot be used when using the `same' convolution mode"); } }
java
public static void validateConvolutionModePadding(ConvolutionMode mode, int padding) { if (mode == ConvolutionMode.Same) { boolean nullPadding = true; if (padding != 0) nullPadding = false; if (!nullPadding) throw new IllegalArgumentException("Padding cannot be used when using the `same' convolution mode"); } }
[ "public", "static", "void", "validateConvolutionModePadding", "(", "ConvolutionMode", "mode", ",", "int", "padding", ")", "{", "if", "(", "mode", "==", "ConvolutionMode", ".", "Same", ")", "{", "boolean", "nullPadding", "=", "true", ";", "if", "(", "padding", ...
Check that the convolution mode is consistent with the padding specification
[ "Check", "that", "the", "convolution", "mode", "is", "consistent", "with", "the", "padding", "specification" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/Convolution1DUtils.java#L181-L189
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GDiscreteFourierTransformOps.java
GDiscreteFourierTransformOps.multiplyComplex
public static void multiplyComplex( ImageInterleaved complexA , ImageInterleaved complexB , ImageInterleaved complexC ) { if( complexB instanceof InterleavedF32 ) { DiscreteFourierTransformOps.multiplyComplex((InterleavedF32) complexA, (InterleavedF32) complexB, (InterleavedF32) complexC); } else if( complexB instanceof InterleavedF64 ) { DiscreteFourierTransformOps.multiplyComplex((InterleavedF64) complexA, (InterleavedF64) complexB, (InterleavedF64) complexC); } else { throw new IllegalArgumentException("Unknown image type"); } }
java
public static void multiplyComplex( ImageInterleaved complexA , ImageInterleaved complexB , ImageInterleaved complexC ) { if( complexB instanceof InterleavedF32 ) { DiscreteFourierTransformOps.multiplyComplex((InterleavedF32) complexA, (InterleavedF32) complexB, (InterleavedF32) complexC); } else if( complexB instanceof InterleavedF64 ) { DiscreteFourierTransformOps.multiplyComplex((InterleavedF64) complexA, (InterleavedF64) complexB, (InterleavedF64) complexC); } else { throw new IllegalArgumentException("Unknown image type"); } }
[ "public", "static", "void", "multiplyComplex", "(", "ImageInterleaved", "complexA", ",", "ImageInterleaved", "complexB", ",", "ImageInterleaved", "complexC", ")", "{", "if", "(", "complexB", "instanceof", "InterleavedF32", ")", "{", "DiscreteFourierTransformOps", ".", ...
Performs element-wise complex multiplication between two complex images. @param complexA (Input) Complex image @param complexB (Input) Complex image @param complexC (Output) Complex image
[ "Performs", "element", "-", "wise", "complex", "multiplication", "between", "two", "complex", "images", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GDiscreteFourierTransformOps.java#L140-L148
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java
SslContextBuilder.forServer
public static SslContextBuilder forServer(PrivateKey key, X509Certificate... keyCertChain) { return new SslContextBuilder(true).keyManager(key, keyCertChain); }
java
public static SslContextBuilder forServer(PrivateKey key, X509Certificate... keyCertChain) { return new SslContextBuilder(true).keyManager(key, keyCertChain); }
[ "public", "static", "SslContextBuilder", "forServer", "(", "PrivateKey", "key", ",", "X509Certificate", "...", "keyCertChain", ")", "{", "return", "new", "SslContextBuilder", "(", "true", ")", ".", "keyManager", "(", "key", ",", "keyCertChain", ")", ";", "}" ]
Creates a builder for new server-side {@link SslContext}. @param key a PKCS#8 private key @param keyCertChain the X.509 certificate chain @see #keyManager(PrivateKey, X509Certificate[])
[ "Creates", "a", "builder", "for", "new", "server", "-", "side", "{", "@link", "SslContext", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L75-L77
samskivert/pythagoras
src/main/java/pythagoras/f/Quaternion.java
Quaternion.fromVectors
public Quaternion fromVectors (IVector3 from, IVector3 to) { float angle = from.angle(to); if (angle < MathUtil.EPSILON) { return set(IDENTITY); } if (angle <= FloatMath.PI - MathUtil.EPSILON) { return fromAngleAxis(angle, from.cross(to).normalizeLocal()); } // it's a 180 degree rotation; any axis orthogonal to the from vector will do Vector3 axis = new Vector3(0f, from.z(), -from.y()); float length = axis.length(); return fromAngleAxis(FloatMath.PI, length < MathUtil.EPSILON ? axis.set(-from.z(), 0f, from.x()).normalizeLocal() : axis.multLocal(1f / length)); }
java
public Quaternion fromVectors (IVector3 from, IVector3 to) { float angle = from.angle(to); if (angle < MathUtil.EPSILON) { return set(IDENTITY); } if (angle <= FloatMath.PI - MathUtil.EPSILON) { return fromAngleAxis(angle, from.cross(to).normalizeLocal()); } // it's a 180 degree rotation; any axis orthogonal to the from vector will do Vector3 axis = new Vector3(0f, from.z(), -from.y()); float length = axis.length(); return fromAngleAxis(FloatMath.PI, length < MathUtil.EPSILON ? axis.set(-from.z(), 0f, from.x()).normalizeLocal() : axis.multLocal(1f / length)); }
[ "public", "Quaternion", "fromVectors", "(", "IVector3", "from", ",", "IVector3", "to", ")", "{", "float", "angle", "=", "from", ".", "angle", "(", "to", ")", ";", "if", "(", "angle", "<", "MathUtil", ".", "EPSILON", ")", "{", "return", "set", "(", "I...
Sets this quaternion to the rotation of the first normalized vector onto the second. @return a reference to this quaternion, for chaining.
[ "Sets", "this", "quaternion", "to", "the", "rotation", "of", "the", "first", "normalized", "vector", "onto", "the", "second", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L90-L104
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.string2File
public static void string2File(final String string2write, final String nameOfFile) throws IOException { try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(nameOfFile))) { bufferedWriter.write(string2write); bufferedWriter.flush(); } }
java
public static void string2File(final String string2write, final String nameOfFile) throws IOException { try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(nameOfFile))) { bufferedWriter.write(string2write); bufferedWriter.flush(); } }
[ "public", "static", "void", "string2File", "(", "final", "String", "string2write", ",", "final", "String", "nameOfFile", ")", "throws", "IOException", "{", "try", "(", "BufferedWriter", "bufferedWriter", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(",...
The Method string2File() writes a String to the file. @param string2write The String to write into the file. @param nameOfFile The path to the file and name from the file from where we want to write the String. @throws IOException Signals that an I/O exception has occurred.
[ "The", "Method", "string2File", "()", "writes", "a", "String", "to", "the", "file", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L272-L280
looly/hutool
hutool-core/src/main/java/cn/hutool/core/codec/Rot.java
Rot.encode
public static String encode(String message, int offset, boolean isEnocdeNumber) { final int len = message.length(); final char[] chars = new char[len]; for (int i = 0; i < len; i++) { chars[i] = encodeChar(message.charAt(i), offset, isEnocdeNumber); } return new String(chars); }
java
public static String encode(String message, int offset, boolean isEnocdeNumber) { final int len = message.length(); final char[] chars = new char[len]; for (int i = 0; i < len; i++) { chars[i] = encodeChar(message.charAt(i), offset, isEnocdeNumber); } return new String(chars); }
[ "public", "static", "String", "encode", "(", "String", "message", ",", "int", "offset", ",", "boolean", "isEnocdeNumber", ")", "{", "final", "int", "len", "=", "message", ".", "length", "(", ")", ";", "final", "char", "[", "]", "chars", "=", "new", "ch...
RotN编码 @param message 被编码的消息 @param offset 位移,常用位移13 @param isEnocdeNumber 是否编码数字 @return 编码后的字符串
[ "RotN编码" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Rot.java#L48-L56
naver/android-utilset
UtilSet/src/com/navercorp/utilset/input/KeyboardUtils.java
KeyboardUtils.hideSoftKeyboard
public static void hideSoftKeyboard(Context context, View view) { InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
java
public static void hideSoftKeyboard(Context context, View view) { InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }
[ "public", "static", "void", "hideSoftKeyboard", "(", "Context", "context", ",", "View", "view", ")", "{", "InputMethodManager", "imm", "=", "(", "InputMethodManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "INPUT_METHOD_SERVICE", ")", ";", ...
Hides keypad @param context @param view View holding keypad control
[ "Hides", "keypad" ]
train
https://github.com/naver/android-utilset/blob/4af5f821466bc5bec4ea221ca6d87e0ac9b87e0b/UtilSet/src/com/navercorp/utilset/input/KeyboardUtils.java#L40-L44
molgenis/molgenis
molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationService.java
LocalizationService.addMissingMessageIds
@Transactional public void addMissingMessageIds(String namespace, Set<String> messageIDs) { Set<String> alreadyPresent = getExistingMessages(namespace, messageIDs) .map(L10nString::getMessageID) .collect(toCollection(TreeSet::new)); Set<String> toAdd = Sets.difference(messageIDs, alreadyPresent); if (!toAdd.isEmpty()) { Stream<L10nString> entities = toAdd .stream() .map(key -> l10nStringFactory.create(key).setMessageID(key)) .map(l -> l.setNamespace(namespace)); dataService.add(L10N_STRING, entities); LOG.debug("Added message IDs to namespace '{}' : {}.", namespace, messageIDs); } }
java
@Transactional public void addMissingMessageIds(String namespace, Set<String> messageIDs) { Set<String> alreadyPresent = getExistingMessages(namespace, messageIDs) .map(L10nString::getMessageID) .collect(toCollection(TreeSet::new)); Set<String> toAdd = Sets.difference(messageIDs, alreadyPresent); if (!toAdd.isEmpty()) { Stream<L10nString> entities = toAdd .stream() .map(key -> l10nStringFactory.create(key).setMessageID(key)) .map(l -> l.setNamespace(namespace)); dataService.add(L10N_STRING, entities); LOG.debug("Added message IDs to namespace '{}' : {}.", namespace, messageIDs); } }
[ "@", "Transactional", "public", "void", "addMissingMessageIds", "(", "String", "namespace", ",", "Set", "<", "String", ">", "messageIDs", ")", "{", "Set", "<", "String", ">", "alreadyPresent", "=", "getExistingMessages", "(", "namespace", ",", "messageIDs", ")",...
Adds Localization strings for missing messageIDs in a namespace. User needs write permission on the {@link L10nString} entity. @param namespace the namespace to which the missing messageIDs should be added @param messageIDs the missing messageIDs to add.
[ "Adds", "Localization", "strings", "for", "missing", "messageIDs", "in", "a", "namespace", ".", "User", "needs", "write", "permission", "on", "the", "{", "@link", "L10nString", "}", "entity", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationService.java#L108-L124
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java
DamVideoMediaMarkupBuilder.addSources
protected void addSources(Video video, Media media) { Asset asset = getDamAsset(media); if (asset == null) { return; } for (VideoProfile profile : getVideoProfiles()) { com.day.cq.dam.api.Rendition rendition = profile.getRendition(asset); if (rendition != null) { video.createSource() .setType(profile.getHtmlType()) .setSrc(urlHandler.get(rendition.getPath()).buildExternalResourceUrl(rendition.adaptTo(Resource.class))); } } }
java
protected void addSources(Video video, Media media) { Asset asset = getDamAsset(media); if (asset == null) { return; } for (VideoProfile profile : getVideoProfiles()) { com.day.cq.dam.api.Rendition rendition = profile.getRendition(asset); if (rendition != null) { video.createSource() .setType(profile.getHtmlType()) .setSrc(urlHandler.get(rendition.getPath()).buildExternalResourceUrl(rendition.adaptTo(Resource.class))); } } }
[ "protected", "void", "addSources", "(", "Video", "video", ",", "Media", "media", ")", "{", "Asset", "asset", "=", "getDamAsset", "(", "media", ")", ";", "if", "(", "asset", "==", "null", ")", "{", "return", ";", "}", "for", "(", "VideoProfile", "profil...
Add sources for HTML5 video player @param video Video @param media Media metadata
[ "Add", "sources", "for", "HTML5", "video", "player" ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java#L159-L173
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.andMoreThan
public ZealotKhala andMoreThan(String field, Object value) { return this.doNormal(ZealotConst.AND_PREFIX, field, value, ZealotConst.GT_SUFFIX, true); }
java
public ZealotKhala andMoreThan(String field, Object value) { return this.doNormal(ZealotConst.AND_PREFIX, field, value, ZealotConst.GT_SUFFIX, true); }
[ "public", "ZealotKhala", "andMoreThan", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "this", ".", "doNormal", "(", "ZealotConst", ".", "AND_PREFIX", ",", "field", ",", "value", ",", "ZealotConst", ".", "GT_SUFFIX", ",", "true", ")", ...
生成带" AND "前缀大于查询的SQL片段. @param field 数据库字段 @param value 值 @return ZealotKhala实例
[ "生成带", "AND", "前缀大于查询的SQL片段", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L669-L671
logic-ng/LogicNG
src/main/java/org/logicng/formulas/FormulaFactory.java
FormulaFactory.binaryOperator
public Formula binaryOperator(final FType type, final Formula left, final Formula right) { switch (type) { case IMPL: return this.implication(left, right); case EQUIV: return this.equivalence(left, right); default: throw new IllegalArgumentException("Cannot create a binary formula with operator: " + type); } }
java
public Formula binaryOperator(final FType type, final Formula left, final Formula right) { switch (type) { case IMPL: return this.implication(left, right); case EQUIV: return this.equivalence(left, right); default: throw new IllegalArgumentException("Cannot create a binary formula with operator: " + type); } }
[ "public", "Formula", "binaryOperator", "(", "final", "FType", "type", ",", "final", "Formula", "left", ",", "final", "Formula", "right", ")", "{", "switch", "(", "type", ")", "{", "case", "IMPL", ":", "return", "this", ".", "implication", "(", "left", ",...
Creates a new binary operator with a given type and two operands. @param type the type of the formula @param left the left-hand side operand @param right the right-hand side operand @return the newly generated formula @throws IllegalArgumentException if a wrong formula type is passed
[ "Creates", "a", "new", "binary", "operator", "with", "a", "given", "type", "and", "two", "operands", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L253-L262
google/closure-compiler
src/com/google/javascript/jscomp/deps/DefaultDependencyResolver.java
DefaultDependencyResolver.addDependency
private void addDependency(String symbol, Set<String> seen, List<String> list) throws ServiceException { DependencyInfo dependency = getDependencyInfo(symbol); if (dependency == null) { if (this.strictRequires) { throw new ServiceException("Unknown require of " + symbol); } } else if (!seen.containsAll(dependency.getProvides())) { seen.addAll(dependency.getProvides()); for (String require : dependency.getRequiredSymbols()) { addDependency(require, seen, list); } list.add(dependency.getPathRelativeToClosureBase()); } }
java
private void addDependency(String symbol, Set<String> seen, List<String> list) throws ServiceException { DependencyInfo dependency = getDependencyInfo(symbol); if (dependency == null) { if (this.strictRequires) { throw new ServiceException("Unknown require of " + symbol); } } else if (!seen.containsAll(dependency.getProvides())) { seen.addAll(dependency.getProvides()); for (String require : dependency.getRequiredSymbols()) { addDependency(require, seen, list); } list.add(dependency.getPathRelativeToClosureBase()); } }
[ "private", "void", "addDependency", "(", "String", "symbol", ",", "Set", "<", "String", ">", "seen", ",", "List", "<", "String", ">", "list", ")", "throws", "ServiceException", "{", "DependencyInfo", "dependency", "=", "getDependencyInfo", "(", "symbol", ")", ...
Adds all the transitive dependencies for a symbol to the provided list. The set is used to avoid adding dupes while keeping the correct order. NOTE: Use of a LinkedHashSet would require reversing the results to get correct dependency ordering.
[ "Adds", "all", "the", "transitive", "dependencies", "for", "a", "symbol", "to", "the", "provided", "list", ".", "The", "set", "is", "used", "to", "avoid", "adding", "dupes", "while", "keeping", "the", "correct", "order", ".", "NOTE", ":", "Use", "of", "a...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DefaultDependencyResolver.java#L125-L139
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsXmlGroupContainerFactory.java
CmsXmlGroupContainerFactory.setCache
private static void setCache(CmsObject cms, CmsXmlGroupContainer xmlGroupContainer, boolean keepEncoding) { if (xmlGroupContainer.getFile() instanceof I_CmsHistoryResource) { return; } boolean online = cms.getRequestContext().getCurrentProject().isOnlineProject(); getCache().setCacheGroupContainer( getCache().getCacheKey(xmlGroupContainer.getFile().getStructureId(), keepEncoding), xmlGroupContainer, online); }
java
private static void setCache(CmsObject cms, CmsXmlGroupContainer xmlGroupContainer, boolean keepEncoding) { if (xmlGroupContainer.getFile() instanceof I_CmsHistoryResource) { return; } boolean online = cms.getRequestContext().getCurrentProject().isOnlineProject(); getCache().setCacheGroupContainer( getCache().getCacheKey(xmlGroupContainer.getFile().getStructureId(), keepEncoding), xmlGroupContainer, online); }
[ "private", "static", "void", "setCache", "(", "CmsObject", "cms", ",", "CmsXmlGroupContainer", "xmlGroupContainer", ",", "boolean", "keepEncoding", ")", "{", "if", "(", "xmlGroupContainer", ".", "getFile", "(", ")", "instanceof", "I_CmsHistoryResource", ")", "{", ...
Stores the given group container in the cache.<p> @param cms the cms context @param xmlGroupContainer the group container to cache @param keepEncoding if the encoding was kept while unmarshalling
[ "Stores", "the", "given", "group", "container", "in", "the", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlGroupContainerFactory.java#L418-L428
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java
PlaybackService.seekTo
public static void seekTo(Context context, String clientId, int milli) { Intent intent = new Intent(context, PlaybackService.class); intent.setAction(ACTION_SEEK_TO); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID, clientId); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_TRACK_POSITION, milli); context.startService(intent); }
java
public static void seekTo(Context context, String clientId, int milli) { Intent intent = new Intent(context, PlaybackService.class); intent.setAction(ACTION_SEEK_TO); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID, clientId); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_TRACK_POSITION, milli); context.startService(intent); }
[ "public", "static", "void", "seekTo", "(", "Context", "context", ",", "String", "clientId", ",", "int", "milli", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "context", ",", "PlaybackService", ".", "class", ")", ";", "intent", ".", "setAction",...
Seek to the precise track position. <p/> The current playing state of the SoundCloud player will be kept. <p/> If playing it remains playing, if paused it remains paused. @param context context from which the service will be started. @param clientId SoundCloud api client id. @param milli time in milli of the position.
[ "Seek", "to", "the", "precise", "track", "position", ".", "<p", "/", ">", "The", "current", "playing", "state", "of", "the", "SoundCloud", "player", "will", "be", "kept", ".", "<p", "/", ">", "If", "playing", "it", "remains", "playing", "if", "paused", ...
train
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L354-L360
johnkil/Android-RobotoTextView
robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java
RobotoTypefaces.obtainTypeface
@NonNull public static Typeface obtainTypeface(@NonNull Context context, @NonNull TypedArray attrs) { if (attrs.hasValue(R.styleable.RobotoTextView_robotoTypeface)) { @RobotoTypeface int typefaceValue = attrs.getInt(R.styleable.RobotoTextView_robotoTypeface, TYPEFACE_ROBOTO_REGULAR); return obtainTypeface(context, typefaceValue); } else { @RobotoFontFamily int fontFamily = attrs.getInt(R.styleable.RobotoTextView_robotoFontFamily, FONT_FAMILY_ROBOTO); @RobotoTextWeight int textWeight = attrs.getInt(R.styleable.RobotoTextView_robotoTextWeight, TEXT_WEIGHT_NORMAL); @RobotoTextStyle int textStyle = attrs.getInt(R.styleable.RobotoTextView_robotoTextStyle, TEXT_STYLE_NORMAL); return obtainTypeface(context, fontFamily, textWeight, textStyle); } }
java
@NonNull public static Typeface obtainTypeface(@NonNull Context context, @NonNull TypedArray attrs) { if (attrs.hasValue(R.styleable.RobotoTextView_robotoTypeface)) { @RobotoTypeface int typefaceValue = attrs.getInt(R.styleable.RobotoTextView_robotoTypeface, TYPEFACE_ROBOTO_REGULAR); return obtainTypeface(context, typefaceValue); } else { @RobotoFontFamily int fontFamily = attrs.getInt(R.styleable.RobotoTextView_robotoFontFamily, FONT_FAMILY_ROBOTO); @RobotoTextWeight int textWeight = attrs.getInt(R.styleable.RobotoTextView_robotoTextWeight, TEXT_WEIGHT_NORMAL); @RobotoTextStyle int textStyle = attrs.getInt(R.styleable.RobotoTextView_robotoTextStyle, TEXT_STYLE_NORMAL); return obtainTypeface(context, fontFamily, textWeight, textStyle); } }
[ "@", "NonNull", "public", "static", "Typeface", "obtainTypeface", "(", "@", "NonNull", "Context", "context", ",", "@", "NonNull", "TypedArray", "attrs", ")", "{", "if", "(", "attrs", ".", "hasValue", "(", "R", ".", "styleable", ".", "RobotoTextView_robotoTypef...
Obtain typeface from attributes. @param context The Context the widget is running in, through which it can access the current theme, resources, etc. @param attrs The styled attribute values in this Context's theme. @return specify {@link Typeface}
[ "Obtain", "typeface", "from", "attributes", "." ]
train
https://github.com/johnkil/Android-RobotoTextView/blob/1341602f16c08057dddd193411e7dab96f963b77/robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java#L483-L494
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/DynamicArray.java
DynamicArray.set
public E set(int index, E element) { RangeCheck(index); E oldValue = (E) data[index]; data[index] = element; return oldValue; }
java
public E set(int index, E element) { RangeCheck(index); E oldValue = (E) data[index]; data[index] = element; return oldValue; }
[ "public", "E", "set", "(", "int", "index", ",", "E", "element", ")", "{", "RangeCheck", "(", "index", ")", ";", "E", "oldValue", "=", "(", "E", ")", "data", "[", "index", "]", ";", "data", "[", "index", "]", "=", "element", ";", "return", "oldVal...
Replaces the element at the specified position in this list with the specified element. @param index index of the element to replace @param element element to be stored at the specified position @return the element previously at the specified position @throws IndexOutOfBoundsException {@inheritDoc}
[ "Replaces", "the", "element", "at", "the", "specified", "position", "in", "this", "list", "with", "the", "specified", "element", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/DynamicArray.java#L267-L273
plaid/plaid-java
src/main/java/com/plaid/client/internal/Util.java
Util.notEmpty
public static void notEmpty(Map map, String name) { notNull(map, name); if (map.isEmpty()) { throw new IllegalArgumentException(name + " must not be empty"); } }
java
public static void notEmpty(Map map, String name) { notNull(map, name); if (map.isEmpty()) { throw new IllegalArgumentException(name + " must not be empty"); } }
[ "public", "static", "void", "notEmpty", "(", "Map", "map", ",", "String", "name", ")", "{", "notNull", "(", "map", ",", "name", ")", ";", "if", "(", "map", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "name", "...
Checks that a given map is not null and not empty. @param map The map to check @param name The name of the collection to use when raising an error. @throws IllegalArgumentException If the collection was null or empty.
[ "Checks", "that", "a", "given", "map", "is", "not", "null", "and", "not", "empty", "." ]
train
https://github.com/plaid/plaid-java/blob/360f1f8a5178fa0c3c2c2e07a58f8ccec5f33117/src/main/java/com/plaid/client/internal/Util.java#L60-L66
gotev/android-upload-service
uploadservice/src/main/java/net/gotev/uploadservice/UploadService.java
UploadService.holdForegroundNotification
protected synchronized boolean holdForegroundNotification(String uploadId, Notification notification) { if (!isExecuteInForeground()) return false; if (foregroundUploadId == null) { foregroundUploadId = uploadId; Logger.debug(TAG, uploadId + " now holds the foreground notification"); } if (uploadId.equals(foregroundUploadId)) { startForeground(UPLOAD_NOTIFICATION_BASE_ID, notification); return true; } return false; }
java
protected synchronized boolean holdForegroundNotification(String uploadId, Notification notification) { if (!isExecuteInForeground()) return false; if (foregroundUploadId == null) { foregroundUploadId = uploadId; Logger.debug(TAG, uploadId + " now holds the foreground notification"); } if (uploadId.equals(foregroundUploadId)) { startForeground(UPLOAD_NOTIFICATION_BASE_ID, notification); return true; } return false; }
[ "protected", "synchronized", "boolean", "holdForegroundNotification", "(", "String", "uploadId", ",", "Notification", "notification", ")", "{", "if", "(", "!", "isExecuteInForeground", "(", ")", ")", "return", "false", ";", "if", "(", "foregroundUploadId", "==", "...
Check if the task is currently the one shown in the foreground notification. @param uploadId ID of the upload @return true if the current upload task holds the foreground notification, otherwise false
[ "Check", "if", "the", "task", "is", "currently", "the", "one", "shown", "in", "the", "foreground", "notification", "." ]
train
https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/uploadservice/src/main/java/net/gotev/uploadservice/UploadService.java#L379-L393
JOML-CI/JOML
src/org/joml/Intersectiond.java
Intersectiond.intersectLineSegmentAar
public static int intersectLineSegmentAar(Vector2dc p0, Vector2dc p1, Vector2dc min, Vector2dc max, Vector2d result) { return intersectLineSegmentAar(p0.x(), p0.y(), p1.x(), p1.y(), min.x(), min.y(), max.x(), max.y(), result); }
java
public static int intersectLineSegmentAar(Vector2dc p0, Vector2dc p1, Vector2dc min, Vector2dc max, Vector2d result) { return intersectLineSegmentAar(p0.x(), p0.y(), p1.x(), p1.y(), min.x(), min.y(), max.x(), max.y(), result); }
[ "public", "static", "int", "intersectLineSegmentAar", "(", "Vector2dc", "p0", ",", "Vector2dc", "p1", ",", "Vector2dc", "min", ",", "Vector2dc", "max", ",", "Vector2d", "result", ")", "{", "return", "intersectLineSegmentAar", "(", "p0", ".", "x", "(", ")", "...
Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code> intersects the axis-aligned rectangle given as its minimum corner <code>min</code> and maximum corner <code>max</code>, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection into <code>result</code>. <p> This method also detects an intersection of a line segment whose either end point lies inside the axis-aligned rectangle. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a> #see {@link #intersectLineSegmentAar(double, double, double, double, double, double, double, double, Vector2d)} @param p0 the line segment's first end point @param p1 the line segment's second end point @param min the minimum corner of the axis-aligned rectangle @param max the maximum corner of the axis-aligned rectangle @param result a vector which will hold the values of the parameter <i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection @return {@link #INSIDE} if the line segment lies completely inside of the axis-aligned rectangle; or {@link #OUTSIDE} if the line segment lies completely outside of the axis-aligned rectangle; or {@link #ONE_INTERSECTION} if one of the end points of the line segment lies inside of the axis-aligned rectangle; or {@link #TWO_INTERSECTION} if the line segment intersects two edges of the axis-aligned rectangle
[ "Determine", "whether", "the", "undirected", "line", "segment", "with", "the", "end", "points", "<code", ">", "p0<", "/", "code", ">", "and", "<code", ">", "p1<", "/", "code", ">", "intersects", "the", "axis", "-", "aligned", "rectangle", "given", "as", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L4551-L4553
BeholderTAF/beholder-selenium
src/main/java/br/ufmg/dcc/saotome/beholder/selenium/WebElementAdapter.java
WebElementAdapter.findElements
@Override public List<WebElement> findElements(final By by) { return (List<WebElement>) (new StaleExceptionResolver<List<WebElement>>() { @Override public List<WebElement> execute(WebElement element) { List<WebElement> elements = new ArrayList<WebElement>(); // create // a // new // list // of // WebElements for (WebElement webElement : element.findElements(by)) { // encapsule the WebElements inside of a WebElementAdapter elements.add(new WebElementAdapter(webElement, thisObject, by, false)); }// end for return elements; }// end execute }).waitForElement(); }
java
@Override public List<WebElement> findElements(final By by) { return (List<WebElement>) (new StaleExceptionResolver<List<WebElement>>() { @Override public List<WebElement> execute(WebElement element) { List<WebElement> elements = new ArrayList<WebElement>(); // create // a // new // list // of // WebElements for (WebElement webElement : element.findElements(by)) { // encapsule the WebElements inside of a WebElementAdapter elements.add(new WebElementAdapter(webElement, thisObject, by, false)); }// end for return elements; }// end execute }).waitForElement(); }
[ "@", "Override", "public", "List", "<", "WebElement", ">", "findElements", "(", "final", "By", "by", ")", "{", "return", "(", "List", "<", "WebElement", ">", ")", "(", "new", "StaleExceptionResolver", "<", "List", "<", "WebElement", ">", ">", "(", ")", ...
{@inheritDoc} <p> The method using the elements matched by findElements must implement a catch for StaleElementReferenceException, because if a AJAX reloads one of the elements, the exceptions is not solved by WebElementAdapter.
[ "{" ]
train
https://github.com/BeholderTAF/beholder-selenium/blob/8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee/src/main/java/br/ufmg/dcc/saotome/beholder/selenium/WebElementAdapter.java#L252-L271
alkacon/opencms-core
src-modules/org/opencms/workplace/CmsLogin.java
CmsLogin.appendId
protected void appendId(StringBuffer html, String id) { html.append(" name=\""); html.append(id); html.append("\" id=\""); html.append(id); html.append("\" "); }
java
protected void appendId(StringBuffer html, String id) { html.append(" name=\""); html.append(id); html.append("\" id=\""); html.append(id); html.append("\" "); }
[ "protected", "void", "appendId", "(", "StringBuffer", "html", ",", "String", "id", ")", "{", "html", ".", "append", "(", "\" name=\\\"\"", ")", ";", "html", ".", "append", "(", "id", ")", ";", "html", ".", "append", "(", "\"\\\" id=\\\"\"", ")", ";", "...
Appends the HTML form name/id code for the given id to the given html.<p> @param html the html where to append the id to @param id the id to append
[ "Appends", "the", "HTML", "form", "name", "/", "id", "code", "for", "the", "given", "id", "to", "the", "given", "html", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsLogin.java#L1094-L1101