repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
Stratio/stratio-cassandra
src/java/org/apache/cassandra/cli/CliClient.java
CliClient.columnNameAsBytes
private ByteBuffer columnNameAsBytes(String column, CfDef columnFamilyDef) { String comparatorClass = columnFamilyDef.comparator_type; return getBytesAccordingToType(column, getFormatType(comparatorClass)); }
java
private ByteBuffer columnNameAsBytes(String column, CfDef columnFamilyDef) { String comparatorClass = columnFamilyDef.comparator_type; return getBytesAccordingToType(column, getFormatType(comparatorClass)); }
[ "private", "ByteBuffer", "columnNameAsBytes", "(", "String", "column", ",", "CfDef", "columnFamilyDef", ")", "{", "String", "comparatorClass", "=", "columnFamilyDef", ".", "comparator_type", ";", "return", "getBytesAccordingToType", "(", "column", ",", "getFormatType", ...
Converts column name into byte[] according to comparator type @param column - column name from parser @param columnFamilyDef - column family from parser @return ByteBuffer bytes - into which column name was converted according to comparator type
[ "Converts", "column", "name", "into", "byte", "[]", "according", "to", "comparator", "type" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2583-L2587
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/application/impl/metadata/ProcessesXmlParse.java
ProcessesXmlParse.parseRootElement
@Override protected void parseRootElement() { List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>(); List<ProcessArchiveXml> processArchives = new ArrayList<ProcessArchiveXml>(); for (Element element : rootElement.elements()) { if(PROCESS_ENGINE.equals(element.getTagName())) { parseProcessEngine(element, processEngines); } else if(PROCESS_ARCHIVE.equals(element.getTagName())) { parseProcessArchive(element, processArchives); } } processesXml = new ProcessesXmlImpl(processEngines, processArchives); }
java
@Override protected void parseRootElement() { List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>(); List<ProcessArchiveXml> processArchives = new ArrayList<ProcessArchiveXml>(); for (Element element : rootElement.elements()) { if(PROCESS_ENGINE.equals(element.getTagName())) { parseProcessEngine(element, processEngines); } else if(PROCESS_ARCHIVE.equals(element.getTagName())) { parseProcessArchive(element, processArchives); } } processesXml = new ProcessesXmlImpl(processEngines, processArchives); }
[ "@", "Override", "protected", "void", "parseRootElement", "(", ")", "{", "List", "<", "ProcessEngineXml", ">", "processEngines", "=", "new", "ArrayList", "<", "ProcessEngineXml", ">", "(", ")", ";", "List", "<", "ProcessArchiveXml", ">", "processArchives", "=", ...
we know this is a <code>&lt;process-application ... /&gt;</code> structure.
[ "we", "know", "this", "is", "a", "<code", ">", "&lt", ";", "process", "-", "application", "...", "/", "&gt", ";", "<", "/", "code", ">", "structure", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/application/impl/metadata/ProcessesXmlParse.java#L67-L87
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/PageSourceSaver.java
PageSourceSaver.savePageSource
public String savePageSource(String fileName) { List<WebElement> framesWithFakeSources = new ArrayList<>(2); Map<String, String> sourceReplacements = new HashMap<>(); List<WebElement> frames = getFrames(); for (WebElement frame : frames) { String newLocation = saveFrameSource(frame); if (newLocation != null) { String fullUrlOfFrame = frame.getAttribute("src"); if (StringUtils.isEmpty(fullUrlOfFrame)) { framesWithFakeSources.add(frame); fullUrlOfFrame = "anonymousFrame" + frames.indexOf(frame); addFakeSourceAttr(frame, fullUrlOfFrame); } addSourceReplacementsForFrame(sourceReplacements, newLocation, fullUrlOfFrame); } } String source = getCurrentFrameSource(sourceReplacements); if (!framesWithFakeSources.isEmpty()) { // replace fake_src by src source = source.replace(" " + FAKE_SRC_ATTR + "=", " src="); removeFakeSourceAttr(framesWithFakeSources); } return saveSourceAsPageSource(fileName, source); }
java
public String savePageSource(String fileName) { List<WebElement> framesWithFakeSources = new ArrayList<>(2); Map<String, String> sourceReplacements = new HashMap<>(); List<WebElement> frames = getFrames(); for (WebElement frame : frames) { String newLocation = saveFrameSource(frame); if (newLocation != null) { String fullUrlOfFrame = frame.getAttribute("src"); if (StringUtils.isEmpty(fullUrlOfFrame)) { framesWithFakeSources.add(frame); fullUrlOfFrame = "anonymousFrame" + frames.indexOf(frame); addFakeSourceAttr(frame, fullUrlOfFrame); } addSourceReplacementsForFrame(sourceReplacements, newLocation, fullUrlOfFrame); } } String source = getCurrentFrameSource(sourceReplacements); if (!framesWithFakeSources.isEmpty()) { // replace fake_src by src source = source.replace(" " + FAKE_SRC_ATTR + "=", " src="); removeFakeSourceAttr(framesWithFakeSources); } return saveSourceAsPageSource(fileName, source); }
[ "public", "String", "savePageSource", "(", "String", "fileName", ")", "{", "List", "<", "WebElement", ">", "framesWithFakeSources", "=", "new", "ArrayList", "<>", "(", "2", ")", ";", "Map", "<", "String", ",", "String", ">", "sourceReplacements", "=", "new",...
Saves current page's source, as new file. @param fileName filename to use for saved page. @return wiki Url, if file was created inside wiki's files dir, absolute filename otherwise.
[ "Saves", "current", "page", "s", "source", "as", "new", "file", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/PageSourceSaver.java#L46-L70
Jasig/resource-server
resource-server-core/src/main/java/org/jasig/resource/aggr/ResourcesAggregatorImpl.java
ResourcesAggregatorImpl.willAggregateWith
protected boolean willAggregateWith(Js first, Js second) { Validate.notNull(first, "Js cannot be null"); Validate.notNull(second, "Js cannot be null"); // never aggregate absolutes if(this.resourcesDao.isAbsolute(first) || this.resourcesDao.isAbsolute(second)) { return false; } return new EqualsBuilder() .append(first.getConditional(), second.getConditional()) .isEquals(); }
java
protected boolean willAggregateWith(Js first, Js second) { Validate.notNull(first, "Js cannot be null"); Validate.notNull(second, "Js cannot be null"); // never aggregate absolutes if(this.resourcesDao.isAbsolute(first) || this.resourcesDao.isAbsolute(second)) { return false; } return new EqualsBuilder() .append(first.getConditional(), second.getConditional()) .isEquals(); }
[ "protected", "boolean", "willAggregateWith", "(", "Js", "first", ",", "Js", "second", ")", "{", "Validate", ".", "notNull", "(", "first", ",", "\"Js cannot be null\"", ")", ";", "Validate", ".", "notNull", "(", "second", ",", "\"Js cannot be null\"", ")", ";",...
Similar to the {@link #equals(Object)} method, this will return true if this object and the argument are "aggregatable". 2 {@link Js} objects are aggregatable if and only if: <ol> <li>Neither object returns true for {@link #isAbsolute()}</li> <li>The values of their "conditional" properties are equivalent</li> </ol> The last rule mentioned above uses {@link FilenameUtils#getFullPath(String)} to compare each object's value. In short, the final file name in the value's path need not be equal, but the rest of the path in the value must be equal. @param other @return
[ "Similar", "to", "the", "{", "@link", "#equals", "(", "Object", ")", "}", "method", "this", "will", "return", "true", "if", "this", "object", "and", "the", "argument", "are", "aggregatable", "." ]
train
https://github.com/Jasig/resource-server/blob/13375f716777ec3c99ae9917f672881d4aa32df3/resource-server-core/src/main/java/org/jasig/resource/aggr/ResourcesAggregatorImpl.java#L512-L524
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyValue.java
GeographyValue.add
@Deprecated public GeographyValue add(GeographyPointValue offset) { List<List<GeographyPointValue>> newLoops = new ArrayList<>(); for (List<XYZPoint> oneLoop : m_loops) { List<GeographyPointValue> loop = new ArrayList<>(); for (XYZPoint p : oneLoop) { loop.add(p.toGeographyPointValue().add(offset)); } loop.add(oneLoop.get(0).toGeographyPointValue().add(offset)); newLoops.add(loop); } return new GeographyValue(newLoops, true); }
java
@Deprecated public GeographyValue add(GeographyPointValue offset) { List<List<GeographyPointValue>> newLoops = new ArrayList<>(); for (List<XYZPoint> oneLoop : m_loops) { List<GeographyPointValue> loop = new ArrayList<>(); for (XYZPoint p : oneLoop) { loop.add(p.toGeographyPointValue().add(offset)); } loop.add(oneLoop.get(0).toGeographyPointValue().add(offset)); newLoops.add(loop); } return new GeographyValue(newLoops, true); }
[ "@", "Deprecated", "public", "GeographyValue", "add", "(", "GeographyPointValue", "offset", ")", "{", "List", "<", "List", "<", "GeographyPointValue", ">>", "newLoops", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "List", "<", "XYZPoint", ">", ...
Create a new GeographyValue which is offset from this one by the given point. The latitude and longitude values stay in range because we are using the normalizing operations in GeographyPointValue. @param offset The point by which to translate vertices in this @return The resulting GeographyValue.
[ "Create", "a", "new", "GeographyValue", "which", "is", "offset", "from", "this", "one", "by", "the", "given", "point", ".", "The", "latitude", "and", "longitude", "values", "stay", "in", "range", "because", "we", "are", "using", "the", "normalizing", "operat...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyValue.java#L788-L800
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/SendMessageAction.java
SendMessageAction.createMessage
protected Message createMessage(TestContext context, String messageType) { if (dataDictionary != null) { messageBuilder.setDataDictionary(dataDictionary); } return messageBuilder.buildMessageContent(context, messageType, MessageDirection.OUTBOUND); }
java
protected Message createMessage(TestContext context, String messageType) { if (dataDictionary != null) { messageBuilder.setDataDictionary(dataDictionary); } return messageBuilder.buildMessageContent(context, messageType, MessageDirection.OUTBOUND); }
[ "protected", "Message", "createMessage", "(", "TestContext", "context", ",", "String", "messageType", ")", "{", "if", "(", "dataDictionary", "!=", "null", ")", "{", "messageBuilder", ".", "setDataDictionary", "(", "dataDictionary", ")", ";", "}", "return", "mess...
Create message to be sent. @param context @param messageType @return
[ "Create", "message", "to", "be", "sent", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/SendMessageAction.java#L158-L164
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/kernelized/OSKL.java
OSKL.setG
public void setG(double G) { if(G < 1 || Double.isInfinite(G) || Double.isNaN(G)) throw new IllegalArgumentException("G must be in [1, Infinity), not " + G); this.G = G; }
java
public void setG(double G) { if(G < 1 || Double.isInfinite(G) || Double.isNaN(G)) throw new IllegalArgumentException("G must be in [1, Infinity), not " + G); this.G = G; }
[ "public", "void", "setG", "(", "double", "G", ")", "{", "if", "(", "G", "<", "1", "||", "Double", ".", "isInfinite", "(", "G", ")", "||", "Double", ".", "isNaN", "(", "G", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"G must be in [1, I...
Sets the sparsification parameter G. Increasing G reduces the number of updates to the model, which increases sparsity but may reduce accuracy. Decreasing G increases the update rate reducing sparsity. The original paper tests values of G &isin; {1, 2, 4, 10} @param G the sparsification parameter in [1, &infin;)
[ "Sets", "the", "sparsification", "parameter", "G", ".", "Increasing", "G", "reduces", "the", "number", "of", "updates", "to", "the", "model", "which", "increases", "sparsity", "but", "may", "reduce", "accuracy", ".", "Decreasing", "G", "increases", "the", "upd...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/kernelized/OSKL.java#L194-L199
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ProtectionPoliciesInner.java
ProtectionPoliciesInner.createOrUpdateAsync
public Observable<ProtectionPolicyResourceInner> createOrUpdateAsync(String vaultName, String resourceGroupName, String policyName, ProtectionPolicyResourceInner resourceProtectionPolicy) { return createOrUpdateWithServiceResponseAsync(vaultName, resourceGroupName, policyName, resourceProtectionPolicy).map(new Func1<ServiceResponse<ProtectionPolicyResourceInner>, ProtectionPolicyResourceInner>() { @Override public ProtectionPolicyResourceInner call(ServiceResponse<ProtectionPolicyResourceInner> response) { return response.body(); } }); }
java
public Observable<ProtectionPolicyResourceInner> createOrUpdateAsync(String vaultName, String resourceGroupName, String policyName, ProtectionPolicyResourceInner resourceProtectionPolicy) { return createOrUpdateWithServiceResponseAsync(vaultName, resourceGroupName, policyName, resourceProtectionPolicy).map(new Func1<ServiceResponse<ProtectionPolicyResourceInner>, ProtectionPolicyResourceInner>() { @Override public ProtectionPolicyResourceInner call(ServiceResponse<ProtectionPolicyResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProtectionPolicyResourceInner", ">", "createOrUpdateAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "policyName", ",", "ProtectionPolicyResourceInner", "resourceProtectionPolicy", ")", "{", "return", "crea...
Creates or modifies a backup policy. This is an asynchronous operation. Use the GetPolicyOperationResult API to Get the operation status. @param vaultName The name of the Recovery Services vault. @param resourceGroupName The name of the resource group associated with the Recovery Services vault. @param policyName The backup policy to be created. @param resourceProtectionPolicy The resource backup policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProtectionPolicyResourceInner object
[ "Creates", "or", "modifies", "a", "backup", "policy", ".", "This", "is", "an", "asynchronous", "operation", ".", "Use", "the", "GetPolicyOperationResult", "API", "to", "Get", "the", "operation", "status", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ProtectionPoliciesInner.java#L211-L218
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java
ClassUtility.getFieldValue
public static Object getFieldValue(final Field field, final Object instance) throws CoreRuntimeException { Object value = null; try { // store current visibility final boolean accessible = field.isAccessible(); // let it accessible anyway field.setAccessible(true); // Call this method with right parameters value = field.get(instance); // Reset default visibility field.setAccessible(accessible); } catch (IllegalAccessException | IllegalArgumentException e) { throw new CoreRuntimeException(e); } return value; }
java
public static Object getFieldValue(final Field field, final Object instance) throws CoreRuntimeException { Object value = null; try { // store current visibility final boolean accessible = field.isAccessible(); // let it accessible anyway field.setAccessible(true); // Call this method with right parameters value = field.get(instance); // Reset default visibility field.setAccessible(accessible); } catch (IllegalAccessException | IllegalArgumentException e) { throw new CoreRuntimeException(e); } return value; }
[ "public", "static", "Object", "getFieldValue", "(", "final", "Field", "field", ",", "final", "Object", "instance", ")", "throws", "CoreRuntimeException", "{", "Object", "value", "=", "null", ";", "try", "{", "// store current visibility", "final", "boolean", "acce...
Retrieve an object field even if it has a private or protected visibility. @param field the field to update @param instance the object instance that hold this field @return value the value stored into this field @throws CoreException if the new value cannot be set
[ "Retrieve", "an", "object", "field", "even", "if", "it", "has", "a", "private", "or", "protected", "visibility", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java#L582-L601
Impetus/Kundera
src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java
HibernateClient.populateEnhanceEntities
private List<EnhanceEntity> populateEnhanceEntities(EntityMetadata m, List<String> relationNames, List result) { List<EnhanceEntity> ls = null; if (!result.isEmpty()) { ls = new ArrayList<EnhanceEntity>(result.size()); for (Object o : result) { EnhanceEntity entity = null; if (!o.getClass().isAssignableFrom(EnhanceEntity.class)) { entity = new EnhanceEntity(o, PropertyAccessorHelper.getId(o, m), null); } else { entity = (EnhanceEntity) o; } ls.add(entity); } } return ls; }
java
private List<EnhanceEntity> populateEnhanceEntities(EntityMetadata m, List<String> relationNames, List result) { List<EnhanceEntity> ls = null; if (!result.isEmpty()) { ls = new ArrayList<EnhanceEntity>(result.size()); for (Object o : result) { EnhanceEntity entity = null; if (!o.getClass().isAssignableFrom(EnhanceEntity.class)) { entity = new EnhanceEntity(o, PropertyAccessorHelper.getId(o, m), null); } else { entity = (EnhanceEntity) o; } ls.add(entity); } } return ls; }
[ "private", "List", "<", "EnhanceEntity", ">", "populateEnhanceEntities", "(", "EntityMetadata", "m", ",", "List", "<", "String", ">", "relationNames", ",", "List", "result", ")", "{", "List", "<", "EnhanceEntity", ">", "ls", "=", "null", ";", "if", "(", "!...
Populate enhance entities. @param m the m @param relationNames the relation names @param result the result @return the list
[ "Populate", "enhance", "entities", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java#L908-L930
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java
ScriptContext.chooseRandom
@Cmd public String chooseRandom(final String propertyKey, final List<String> randomValues) { Randomizable<String> choice = new RandomCollection<>(random, randomValues); String currentValue = choice.get(); if (log.isDebugEnabled()) { log.debug("Chosen value: " + currentValue); } currentValue = resolveProperty(currentValue); config.put(propertyKey, currentValue); if (log.isDebugEnabled()) { log.debug("... value for '{}' was set to {}", propertyKey, currentValue); } return currentValue; }
java
@Cmd public String chooseRandom(final String propertyKey, final List<String> randomValues) { Randomizable<String> choice = new RandomCollection<>(random, randomValues); String currentValue = choice.get(); if (log.isDebugEnabled()) { log.debug("Chosen value: " + currentValue); } currentValue = resolveProperty(currentValue); config.put(propertyKey, currentValue); if (log.isDebugEnabled()) { log.debug("... value for '{}' was set to {}", propertyKey, currentValue); } return currentValue; }
[ "@", "Cmd", "public", "String", "chooseRandom", "(", "final", "String", "propertyKey", ",", "final", "List", "<", "String", ">", "randomValues", ")", "{", "Randomizable", "<", "String", ">", "choice", "=", "new", "RandomCollection", "<>", "(", "random", ",",...
Randomly selects an item from a list of Strings. List items may contain placeholder tokens. The result is stored in the configuration under the specified key and also returned by this method. @param propertyKey the property key under which to store the result @param randomValues the list of strings @return a randomly chosen string from the list
[ "Randomly", "selects", "an", "item", "from", "a", "list", "of", "Strings", ".", "List", "items", "may", "contain", "placeholder", "tokens", ".", "The", "result", "is", "stored", "in", "the", "configuration", "under", "the", "specified", "key", "and", "also",...
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java#L227-L240
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java
WarUtils.addContextParam
public static void addContextParam(Document doc, Element root) { Element ctxParam = doc.createElement("context-param"); Element paramName = doc.createElement("param-name"); paramName.appendChild(doc.createTextNode("shiroConfigLocations")); ctxParam.appendChild(paramName); Element paramValue = doc.createElement("param-value"); paramValue.appendChild(doc.createTextNode("file:" + new File(System .getProperty("com.meltmedia.cadmium.contentRoot"), "shiro.ini") .getAbsoluteFile().getAbsolutePath())); ctxParam.appendChild(paramValue); addRelativeTo(root, ctxParam, "listener", false); }
java
public static void addContextParam(Document doc, Element root) { Element ctxParam = doc.createElement("context-param"); Element paramName = doc.createElement("param-name"); paramName.appendChild(doc.createTextNode("shiroConfigLocations")); ctxParam.appendChild(paramName); Element paramValue = doc.createElement("param-value"); paramValue.appendChild(doc.createTextNode("file:" + new File(System .getProperty("com.meltmedia.cadmium.contentRoot"), "shiro.ini") .getAbsoluteFile().getAbsolutePath())); ctxParam.appendChild(paramValue); addRelativeTo(root, ctxParam, "listener", false); }
[ "public", "static", "void", "addContextParam", "(", "Document", "doc", ",", "Element", "root", ")", "{", "Element", "ctxParam", "=", "doc", ".", "createElement", "(", "\"context-param\"", ")", ";", "Element", "paramName", "=", "doc", ".", "createElement", "(",...
Adds a context parameter to a web.xml file to override where the shiro config location is to be loaded from. The location loaded from will be represented by the "com.meltmedia.cadmium.contentRoot" system property. @param doc The xml DOM document to create the new xml elements with. @param root The xml Element node to add the context param to.
[ "Adds", "a", "context", "parameter", "to", "a", "web", ".", "xml", "file", "to", "override", "where", "the", "shiro", "config", "location", "is", "to", "be", "loaded", "from", ".", "The", "location", "loaded", "from", "will", "be", "represented", "by", "...
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L277-L289
jboss/jboss-el-api_spec
src/main/java/javax/el/ELProcessor.java
ELProcessor.setValue
public void setValue(String expression, Object value) { ValueExpression exp = factory.createValueExpression( elManager.getELContext(), bracket(expression), Object.class); exp.setValue(elManager.getELContext(), value); }
java
public void setValue(String expression, Object value) { ValueExpression exp = factory.createValueExpression( elManager.getELContext(), bracket(expression), Object.class); exp.setValue(elManager.getELContext(), value); }
[ "public", "void", "setValue", "(", "String", "expression", ",", "Object", "value", ")", "{", "ValueExpression", "exp", "=", "factory", ".", "createValueExpression", "(", "elManager", ".", "getELContext", "(", ")", ",", "bracket", "(", "expression", ")", ",", ...
Sets an expression with a new value. The target expression is evaluated, up to the last property resolution, and the resultant (base, property) pair is set to the provided value. @param expression The target expression @param value The new value to set. @throws PropertyNotFoundException if one of the property resolutions failed because a specified variable or property does not exist or is not readable. @throws PropertyNotWritableException if the final variable or property resolution failed because the specified variable or property is not writable. @throws ELException if an exception was thrown while attempting to set the property or variable. The thrown exception must be included as the cause property of this exception, if available.
[ "Sets", "an", "expression", "with", "a", "new", "value", ".", "The", "target", "expression", "is", "evaluated", "up", "to", "the", "last", "property", "resolution", "and", "the", "resultant", "(", "base", "property", ")", "pair", "is", "set", "to", "the", ...
train
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELProcessor.java#L150-L155
Stratio/deep-spark
deep-mongodb/src/main/java/com/stratio/deep/mongodb/extractor/MongoNativeExtractor.java
MongoNativeExtractor.getChunks
private DBCursor getChunks(DBCollection collection) { DB config = collection.getDB().getSisterDB("config"); DBCollection configChunks = config.getCollection("chunks"); return configChunks.find(new BasicDBObject("ns", collection.getFullName())); }
java
private DBCursor getChunks(DBCollection collection) { DB config = collection.getDB().getSisterDB("config"); DBCollection configChunks = config.getCollection("chunks"); return configChunks.find(new BasicDBObject("ns", collection.getFullName())); }
[ "private", "DBCursor", "getChunks", "(", "DBCollection", "collection", ")", "{", "DB", "config", "=", "collection", ".", "getDB", "(", ")", ".", "getSisterDB", "(", "\"config\"", ")", ";", "DBCollection", "configChunks", "=", "config", ".", "getCollection", "(...
Gets chunks. @param collection the collection @return the chunks
[ "Gets", "chunks", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-mongodb/src/main/java/com/stratio/deep/mongodb/extractor/MongoNativeExtractor.java#L177-L181
tvesalainen/util
util/src/main/java/org/vesalainen/math/Sets.java
Sets.cartesianProduct
public static final <A,B> Set<OrderedPair<A,B>> cartesianProduct(Set<A> a, Set<B> b) { Set<OrderedPair<A,B>> set = new HashSet<>(); for (A t : a) { for (B v : b) { set.add(new OrderedPair(t, v)); } } return set; }
java
public static final <A,B> Set<OrderedPair<A,B>> cartesianProduct(Set<A> a, Set<B> b) { Set<OrderedPair<A,B>> set = new HashSet<>(); for (A t : a) { for (B v : b) { set.add(new OrderedPair(t, v)); } } return set; }
[ "public", "static", "final", "<", "A", ",", "B", ">", "Set", "<", "OrderedPair", "<", "A", ",", "B", ">", ">", "cartesianProduct", "(", "Set", "<", "A", ">", "a", ",", "Set", "<", "B", ">", "b", ")", "{", "Set", "<", "OrderedPair", "<", "A", ...
Cartesian product of A and B, denoted A × B, is the set whose members are all possible ordered pairs (a, b) where a is a member of A and b is a member of B. @param <A> @param <B> @param a @param b @return
[ "Cartesian", "product", "of", "A", "and", "B", "denoted", "A", "×", "B", "is", "the", "set", "whose", "members", "are", "all", "possible", "ordered", "pairs", "(", "a", "b", ")", "where", "a", "is", "a", "member", "of", "A", "and", "b", "is", "a", ...
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Sets.java#L180-L191
devnied/EMV-NFC-Paycard-Enrollment
library/src/main/java/com/github/devnied/emvnfccard/parser/apdu/impl/DataFactory.java
DataFactory.getFloat
private static Float getFloat(final AnnotationData pAnnotation, final BitUtils pBit) { Float ret = null; if (BCD_FORMAT.equals(pAnnotation.getFormat())) { ret = Float.parseFloat(pBit.getNextHexaString(pAnnotation.getSize())); } else { ret = (float) getInteger(pAnnotation, pBit); } return ret; }
java
private static Float getFloat(final AnnotationData pAnnotation, final BitUtils pBit) { Float ret = null; if (BCD_FORMAT.equals(pAnnotation.getFormat())) { ret = Float.parseFloat(pBit.getNextHexaString(pAnnotation.getSize())); } else { ret = (float) getInteger(pAnnotation, pBit); } return ret; }
[ "private", "static", "Float", "getFloat", "(", "final", "AnnotationData", "pAnnotation", ",", "final", "BitUtils", "pBit", ")", "{", "Float", "ret", "=", "null", ";", "if", "(", "BCD_FORMAT", ".", "equals", "(", "pAnnotation", ".", "getFormat", "(", ")", "...
Method use to get float @param pAnnotation annotation @param pBit bit utils @return
[ "Method", "use", "to", "get", "float" ]
train
https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/apdu/impl/DataFactory.java#L172-L182
VoltDB/voltdb
src/frontend/org/voltdb/DefaultProcedureManager.java
DefaultProcedureManager.generateCrudExpressionColumns
private static void generateCrudExpressionColumns(Table table, StringBuilder sb) { boolean first = true; // Sort the catalog table columns by column order. ArrayList<Column> tableColumns = new ArrayList<Column>(table.getColumns().size()); for (Column c : table.getColumns()) { tableColumns.add(c); } Collections.sort(tableColumns, new TableColumnComparator()); for (Column c : tableColumns) { if (!first) sb.append(", "); first = false; sb.append(c.getName() + " = ?"); } }
java
private static void generateCrudExpressionColumns(Table table, StringBuilder sb) { boolean first = true; // Sort the catalog table columns by column order. ArrayList<Column> tableColumns = new ArrayList<Column>(table.getColumns().size()); for (Column c : table.getColumns()) { tableColumns.add(c); } Collections.sort(tableColumns, new TableColumnComparator()); for (Column c : tableColumns) { if (!first) sb.append(", "); first = false; sb.append(c.getName() + " = ?"); } }
[ "private", "static", "void", "generateCrudExpressionColumns", "(", "Table", "table", ",", "StringBuilder", "sb", ")", "{", "boolean", "first", "=", "true", ";", "// Sort the catalog table columns by column order.", "ArrayList", "<", "Column", ">", "tableColumns", "=", ...
Helper to generate a full col1 = ?, col2 = ?... clause. @param table @param sb
[ "Helper", "to", "generate", "a", "full", "col1", "=", "?", "col2", "=", "?", "...", "clause", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/DefaultProcedureManager.java#L282-L297
geomajas/geomajas-project-geometry
core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java
GeometryIndexService.getSiblingCount
public int getSiblingCount(Geometry geometry, GeometryIndex index) { if (index.hasChild() && geometry.getGeometries() != null && geometry.getGeometries().length > index.getValue()) { return getSiblingCount(geometry.getGeometries()[index.getValue()], index.getChild()); } switch (index.getType()) { case TYPE_VERTEX: return geometry.getCoordinates() != null ? geometry.getCoordinates().length : 0; case TYPE_EDGE: if (Geometry.LINE_STRING.equals(geometry.getGeometryType())) { int count = geometry.getCoordinates() != null ? geometry.getCoordinates().length - 1 : 0; if (count < 0) { count = 0; } return count; } else if (Geometry.LINEAR_RING.equals(geometry.getGeometryType())) { return geometry.getCoordinates() != null ? geometry.getCoordinates().length : 0; } return 0; case TYPE_GEOMETRY: default: return geometry.getGeometries() != null ? geometry.getGeometries().length : 0; } }
java
public int getSiblingCount(Geometry geometry, GeometryIndex index) { if (index.hasChild() && geometry.getGeometries() != null && geometry.getGeometries().length > index.getValue()) { return getSiblingCount(geometry.getGeometries()[index.getValue()], index.getChild()); } switch (index.getType()) { case TYPE_VERTEX: return geometry.getCoordinates() != null ? geometry.getCoordinates().length : 0; case TYPE_EDGE: if (Geometry.LINE_STRING.equals(geometry.getGeometryType())) { int count = geometry.getCoordinates() != null ? geometry.getCoordinates().length - 1 : 0; if (count < 0) { count = 0; } return count; } else if (Geometry.LINEAR_RING.equals(geometry.getGeometryType())) { return geometry.getCoordinates() != null ? geometry.getCoordinates().length : 0; } return 0; case TYPE_GEOMETRY: default: return geometry.getGeometries() != null ? geometry.getGeometries().length : 0; } }
[ "public", "int", "getSiblingCount", "(", "Geometry", "geometry", ",", "GeometryIndex", "index", ")", "{", "if", "(", "index", ".", "hasChild", "(", ")", "&&", "geometry", ".", "getGeometries", "(", ")", "!=", "null", "&&", "geometry", ".", "getGeometries", ...
Given a certain index, how many indices of the same type can be found within the given geometry. This count includes the given index.<br> For example, if the index points to a vertex on a LinearRing within a polygon, then this will return the amount of vertices on that LinearRing. @param geometry The geometry to look into. @param index The index to take as example (can be of any type). @return Returns the total amount of siblings.
[ "Given", "a", "certain", "index", "how", "many", "indices", "of", "the", "same", "type", "can", "be", "found", "within", "the", "given", "geometry", ".", "This", "count", "includes", "the", "given", "index", ".", "<br", ">", "For", "example", "if", "the"...
train
https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java#L536-L559
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/transport/netty/StartStreamHandler.java
StartStreamHandler.channelActive
@Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { String terseUri = "/pools/default/bs/" + bucket; FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, terseUri); request.headers().add(HttpHeaders.Names.ACCEPT, "application/json"); addHttpBasicAuth(ctx, request); ctx.writeAndFlush(request); }
java
@Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { String terseUri = "/pools/default/bs/" + bucket; FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, terseUri); request.headers().add(HttpHeaders.Names.ACCEPT, "application/json"); addHttpBasicAuth(ctx, request); ctx.writeAndFlush(request); }
[ "@", "Override", "public", "void", "channelActive", "(", "final", "ChannelHandlerContext", "ctx", ")", "throws", "Exception", "{", "String", "terseUri", "=", "\"/pools/default/bs/\"", "+", "bucket", ";", "FullHttpRequest", "request", "=", "new", "DefaultFullHttpReques...
Once the channel is active, start to send the HTTP request to begin chunking.
[ "Once", "the", "channel", "is", "active", "start", "to", "send", "the", "HTTP", "request", "to", "begin", "chunking", "." ]
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/transport/netty/StartStreamHandler.java#L54-L61
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java
ChineseCalendar.newMoonNear
private int newMoonNear(int days, boolean after) { astro.setTime(daysToMillis(days)); long newMoon = astro.getMoonTime(CalendarAstronomer.NEW_MOON, after); return millisToDays(newMoon); }
java
private int newMoonNear(int days, boolean after) { astro.setTime(daysToMillis(days)); long newMoon = astro.getMoonTime(CalendarAstronomer.NEW_MOON, after); return millisToDays(newMoon); }
[ "private", "int", "newMoonNear", "(", "int", "days", ",", "boolean", "after", ")", "{", "astro", ".", "setTime", "(", "daysToMillis", "(", "days", ")", ")", ";", "long", "newMoon", "=", "astro", ".", "getMoonTime", "(", "CalendarAstronomer", ".", "NEW_MOON...
Return the closest new moon to the given date, searching either forward or backward in time. @param days days after January 1, 1970 0:00 Asia/Shanghai @param after if true, search for a new moon on or after the given date; otherwise, search for a new moon before it @return days after January 1, 1970 0:00 Asia/Shanghai of the nearest new moon after or before <code>days</code>
[ "Return", "the", "closest", "new", "moon", "to", "the", "given", "date", "searching", "either", "forward", "or", "backward", "in", "time", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L712-L718
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java
CopyDither.getPoint2D
public final Point2D getPoint2D(Point2D pSrcPt, Point2D pDstPt) { // Create new Point, if needed if (pDstPt == null) { pDstPt = new Point2D.Float(); } // Copy location pDstPt.setLocation(pSrcPt.getX(), pSrcPt.getY()); // Return dest return pDstPt; }
java
public final Point2D getPoint2D(Point2D pSrcPt, Point2D pDstPt) { // Create new Point, if needed if (pDstPt == null) { pDstPt = new Point2D.Float(); } // Copy location pDstPt.setLocation(pSrcPt.getX(), pSrcPt.getY()); // Return dest return pDstPt; }
[ "public", "final", "Point2D", "getPoint2D", "(", "Point2D", "pSrcPt", ",", "Point2D", "pDstPt", ")", "{", "// Create new Point, if needed\r", "if", "(", "pDstPt", "==", "null", ")", "{", "pDstPt", "=", "new", "Point2D", ".", "Float", "(", ")", ";", "}", "/...
Returns the location of the destination point given a point in the source. If {@code dstPt} is not {@code null}, it will be used to hold the return value. Since this is not a geometric operation, the {@code srcPt} will equal the {@code dstPt}. @param pSrcPt a {@code Point2D} that represents a point in the source image @param pDstPt a {@code Point2D}that represents the location in the destination @return the {@code Point2D} in the destination that corresponds to the specified point in the source.
[ "Returns", "the", "location", "of", "the", "destination", "point", "given", "a", "point", "in", "the", "source", ".", "If", "{" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java#L147-L158
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
ScopeImpl.dupUnshared
public WriteableScope dupUnshared(Symbol newOwner) { if (shared > 0) { //The nested Scopes might have already added something to the table, so all items //that don't originate in this Scope or any of its outer Scopes need to be cleared: Set<Scope> acceptScopes = Collections.newSetFromMap(new IdentityHashMap<>()); ScopeImpl c = this; while (c != null) { acceptScopes.add(c); c = c.next; } int n = 0; Entry[] oldTable = this.table; Entry[] newTable = new Entry[this.table.length]; for (int i = 0; i < oldTable.length; i++) { Entry e = oldTable[i]; while (e != null && e != sentinel && !acceptScopes.contains(e.scope)) { e = e.shadowed; } if (e != null) { n++; newTable[i] = e; } } return new ScopeImpl(this, newOwner, newTable, n); } else { return new ScopeImpl(this, newOwner, this.table.clone(), this.nelems); } }
java
public WriteableScope dupUnshared(Symbol newOwner) { if (shared > 0) { //The nested Scopes might have already added something to the table, so all items //that don't originate in this Scope or any of its outer Scopes need to be cleared: Set<Scope> acceptScopes = Collections.newSetFromMap(new IdentityHashMap<>()); ScopeImpl c = this; while (c != null) { acceptScopes.add(c); c = c.next; } int n = 0; Entry[] oldTable = this.table; Entry[] newTable = new Entry[this.table.length]; for (int i = 0; i < oldTable.length; i++) { Entry e = oldTable[i]; while (e != null && e != sentinel && !acceptScopes.contains(e.scope)) { e = e.shadowed; } if (e != null) { n++; newTable[i] = e; } } return new ScopeImpl(this, newOwner, newTable, n); } else { return new ScopeImpl(this, newOwner, this.table.clone(), this.nelems); } }
[ "public", "WriteableScope", "dupUnshared", "(", "Symbol", "newOwner", ")", "{", "if", "(", "shared", ">", "0", ")", "{", "//The nested Scopes might have already added something to the table, so all items", "//that don't originate in this Scope or any of its outer Scopes need to be cl...
Construct a fresh scope within this scope, with new owner, with a new hash table, whose contents initially are those of the table of its outer scope.
[ "Construct", "a", "fresh", "scope", "within", "this", "scope", "with", "new", "owner", "with", "a", "new", "hash", "table", "whose", "contents", "initially", "are", "those", "of", "the", "table", "of", "its", "outer", "scope", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L352-L379
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/headerfooter/RtfHeaderFooterGroup.java
RtfHeaderFooterGroup.setHasFacingPages
public void setHasFacingPages() { if(this.mode == MODE_SINGLE) { this.mode = MODE_MULTIPLE; this.headerLeft = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES); this.headerLeft.setType(this.type); this.headerRight = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES); this.headerRight.setType(this.type); this.headerAll = null; } else if(this.mode == MODE_MULTIPLE) { if(this.headerLeft == null && this.headerAll != null) { this.headerLeft = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES); this.headerLeft.setType(this.type); } if(this.headerRight == null && this.headerAll != null) { this.headerRight = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES); this.headerRight.setType(this.type); } this.headerAll = null; } }
java
public void setHasFacingPages() { if(this.mode == MODE_SINGLE) { this.mode = MODE_MULTIPLE; this.headerLeft = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES); this.headerLeft.setType(this.type); this.headerRight = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES); this.headerRight.setType(this.type); this.headerAll = null; } else if(this.mode == MODE_MULTIPLE) { if(this.headerLeft == null && this.headerAll != null) { this.headerLeft = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES); this.headerLeft.setType(this.type); } if(this.headerRight == null && this.headerAll != null) { this.headerRight = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES); this.headerRight.setType(this.type); } this.headerAll = null; } }
[ "public", "void", "setHasFacingPages", "(", ")", "{", "if", "(", "this", ".", "mode", "==", "MODE_SINGLE", ")", "{", "this", ".", "mode", "=", "MODE_MULTIPLE", ";", "this", ".", "headerLeft", "=", "new", "RtfHeaderFooter", "(", "this", ".", "document", "...
Set that this RtfHeaderFooterGroup should have facing pages. If only a header / footer for all pages exists, then it will be copied to the left and right pages as well.
[ "Set", "that", "this", "RtfHeaderFooterGroup", "should", "have", "facing", "pages", ".", "If", "only", "a", "header", "/", "footer", "for", "all", "pages", "exists", "then", "it", "will", "be", "copied", "to", "the", "left", "and", "right", "pages", "as", ...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/headerfooter/RtfHeaderFooterGroup.java#L310-L329
looly/hutool
hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java
NetUtil.isInRange
public static boolean isInRange(String ip, String cidr) { String[] ips = StrUtil.splitToArray(ip, '.'); int ipAddr = (Integer.parseInt(ips[0]) << 24) | (Integer.parseInt(ips[1]) << 16) | (Integer.parseInt(ips[2]) << 8) | Integer.parseInt(ips[3]); int type = Integer.parseInt(cidr.replaceAll(".*/", "")); int mask = 0xFFFFFFFF << (32 - type); String cidrIp = cidr.replaceAll("/.*", ""); String[] cidrIps = cidrIp.split("\\."); int cidrIpAddr = (Integer.parseInt(cidrIps[0]) << 24) | (Integer.parseInt(cidrIps[1]) << 16) | (Integer.parseInt(cidrIps[2]) << 8) | Integer.parseInt(cidrIps[3]); return (ipAddr & mask) == (cidrIpAddr & mask); }
java
public static boolean isInRange(String ip, String cidr) { String[] ips = StrUtil.splitToArray(ip, '.'); int ipAddr = (Integer.parseInt(ips[0]) << 24) | (Integer.parseInt(ips[1]) << 16) | (Integer.parseInt(ips[2]) << 8) | Integer.parseInt(ips[3]); int type = Integer.parseInt(cidr.replaceAll(".*/", "")); int mask = 0xFFFFFFFF << (32 - type); String cidrIp = cidr.replaceAll("/.*", ""); String[] cidrIps = cidrIp.split("\\."); int cidrIpAddr = (Integer.parseInt(cidrIps[0]) << 24) | (Integer.parseInt(cidrIps[1]) << 16) | (Integer.parseInt(cidrIps[2]) << 8) | Integer.parseInt(cidrIps[3]); return (ipAddr & mask) == (cidrIpAddr & mask); }
[ "public", "static", "boolean", "isInRange", "(", "String", "ip", ",", "String", "cidr", ")", "{", "String", "[", "]", "ips", "=", "StrUtil", ".", "splitToArray", "(", "ip", ",", "'", "'", ")", ";", "int", "ipAddr", "=", "(", "Integer", ".", "parseInt...
是否在CIDR规则配置范围内<br> 方法来自:【成都】小邓 @param ip 需要验证的IP @param cidr CIDR规则 @return 是否在范围内 @since 4.0.6
[ "是否在CIDR规则配置范围内<br", ">", "方法来自:【成都】小邓" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L526-L535
twilio/twilio-java
src/main/java/com/twilio/rest/wireless/v1/sim/DataSessionReader.java
DataSessionReader.previousPage
@Override public Page<DataSession> previousPage(final Page<DataSession> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.WIRELESS.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<DataSession> previousPage(final Page<DataSession> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.WIRELESS.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "DataSession", ">", "previousPage", "(", "final", "Page", "<", "DataSession", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET...
Retrieve the previous page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Previous Page
[ "Retrieve", "the", "previous", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/wireless/v1/sim/DataSessionReader.java#L136-L147
jboss-integration/fuse-bxms-integ
switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java
KnowledgeExchangeHandler.getString
protected String getString(Exchange exchange, Message message, String name) { Object value = getObject(exchange, message, name); if (value instanceof String) { return (String)value; } else if (value != null) { return String.valueOf(value); } return null; }
java
protected String getString(Exchange exchange, Message message, String name) { Object value = getObject(exchange, message, name); if (value instanceof String) { return (String)value; } else if (value != null) { return String.valueOf(value); } return null; }
[ "protected", "String", "getString", "(", "Exchange", "exchange", ",", "Message", "message", ",", "String", "name", ")", "{", "Object", "value", "=", "getObject", "(", "exchange", ",", "message", ",", "name", ")", ";", "if", "(", "value", "instanceof", "Str...
Gets a String context property. @param exchange the exchange @param message the message @param name the name @return the property
[ "Gets", "a", "String", "context", "property", "." ]
train
https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java#L238-L246
Red5/red5-websocket
src/main/java/org/red5/net/websocket/WebSocketScopeManager.java
WebSocketScopeManager.addListener
public void addListener(IWebSocketDataListener listener, String path) { log.trace("addListener: {}", listener); WebSocketScope scope = getScope(path); if (scope != null) { scope.addListener(listener); } else { log.info("Scope not found for path: {}", path); } }
java
public void addListener(IWebSocketDataListener listener, String path) { log.trace("addListener: {}", listener); WebSocketScope scope = getScope(path); if (scope != null) { scope.addListener(listener); } else { log.info("Scope not found for path: {}", path); } }
[ "public", "void", "addListener", "(", "IWebSocketDataListener", "listener", ",", "String", "path", ")", "{", "log", ".", "trace", "(", "\"addListener: {}\"", ",", "listener", ")", ";", "WebSocketScope", "scope", "=", "getScope", "(", "path", ")", ";", "if", ...
Add the listener on scope via its path. @param listener IWebSocketDataListener @param path
[ "Add", "the", "listener", "on", "scope", "via", "its", "path", "." ]
train
https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L212-L220
geomajas/geomajas-project-geometry
core/src/main/java/org/geomajas/geometry/Geometry.java
Geometry.cloneRecursively
private Geometry cloneRecursively(Geometry geometry) { Geometry clone = new Geometry(geometry.geometryType, geometry.srid, geometry.precision); if (geometry.getGeometries() != null) { Geometry[] geometryClones = new Geometry[geometry.getGeometries().length]; for (int i = 0; i < geometry.getGeometries().length; i++) { geometryClones[i] = cloneRecursively(geometry.getGeometries()[i]); } clone.setGeometries(geometryClones); } if (geometry.getCoordinates() != null) { Coordinate[] coordinateClones = new Coordinate[geometry.getCoordinates().length]; for (int i = 0; i < geometry.getCoordinates().length; i++) { coordinateClones[i] = (Coordinate) geometry.getCoordinates()[i].clone(); } clone.setCoordinates(coordinateClones); } return clone; }
java
private Geometry cloneRecursively(Geometry geometry) { Geometry clone = new Geometry(geometry.geometryType, geometry.srid, geometry.precision); if (geometry.getGeometries() != null) { Geometry[] geometryClones = new Geometry[geometry.getGeometries().length]; for (int i = 0; i < geometry.getGeometries().length; i++) { geometryClones[i] = cloneRecursively(geometry.getGeometries()[i]); } clone.setGeometries(geometryClones); } if (geometry.getCoordinates() != null) { Coordinate[] coordinateClones = new Coordinate[geometry.getCoordinates().length]; for (int i = 0; i < geometry.getCoordinates().length; i++) { coordinateClones[i] = (Coordinate) geometry.getCoordinates()[i].clone(); } clone.setCoordinates(coordinateClones); } return clone; }
[ "private", "Geometry", "cloneRecursively", "(", "Geometry", "geometry", ")", "{", "Geometry", "clone", "=", "new", "Geometry", "(", "geometry", ".", "geometryType", ",", "geometry", ".", "srid", ",", "geometry", ".", "precision", ")", ";", "if", "(", "geomet...
Recursive cloning of geometries. @param geometry The geometry to clone. @return The cloned geometry.
[ "Recursive", "cloning", "of", "geometries", "." ]
train
https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/Geometry.java#L241-L258
Ordinastie/MalisisCore
src/main/java/net/malisis/core/asm/AsmUtils.java
AsmUtils.changeMethodAccess
public static Method changeMethodAccess(Class<?> clazz, String methodName, String srgName, boolean silenced, Class<?>... params) { try { Method m = clazz.getDeclaredMethod(MalisisCore.isObfEnv ? srgName : methodName, params); m.setAccessible(true); return m; } catch (ReflectiveOperationException e) { MalisisCore.log.error("Could not change access for method " + clazz.getSimpleName() + "." + (MalisisCore.isObfEnv ? srgName : methodName), e); } return null; }
java
public static Method changeMethodAccess(Class<?> clazz, String methodName, String srgName, boolean silenced, Class<?>... params) { try { Method m = clazz.getDeclaredMethod(MalisisCore.isObfEnv ? srgName : methodName, params); m.setAccessible(true); return m; } catch (ReflectiveOperationException e) { MalisisCore.log.error("Could not change access for method " + clazz.getSimpleName() + "." + (MalisisCore.isObfEnv ? srgName : methodName), e); } return null; }
[ "public", "static", "Method", "changeMethodAccess", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "String", "srgName", ",", "boolean", "silenced", ",", "Class", "<", "?", ">", "...", "params", ")", "{", "try", "{", "Method", "m"...
Changes the access level for the specified method for a class. @param clazz the clazz @param methodName the field name @param srgName the srg name @param silenced the silenced @param params the params @return the field
[ "Changes", "the", "access", "level", "for", "the", "specified", "method", "for", "a", "class", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L424-L439
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleryField.java
CmsGalleryField.setValue
protected void setValue(String value, boolean fireEvent) { m_textbox.setValue(value); updateUploadTarget(CmsResource.getFolderPath(value)); updateResourceInfo(value); m_previousValue = value; if (fireEvent) { fireChange(true); } }
java
protected void setValue(String value, boolean fireEvent) { m_textbox.setValue(value); updateUploadTarget(CmsResource.getFolderPath(value)); updateResourceInfo(value); m_previousValue = value; if (fireEvent) { fireChange(true); } }
[ "protected", "void", "setValue", "(", "String", "value", ",", "boolean", "fireEvent", ")", "{", "m_textbox", ".", "setValue", "(", "value", ")", ";", "updateUploadTarget", "(", "CmsResource", ".", "getFolderPath", "(", "value", ")", ")", ";", "updateResourceIn...
Sets the widget value.<p> @param value the value to set @param fireEvent if the change event should be fired
[ "Sets", "the", "widget", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleryField.java#L603-L612
aicer/hibiscus-http-client
src/main/java/org/aicer/hibiscus/http/client/HttpClient.java
HttpClient.addNameValuePair
public final HttpClient addNameValuePair(final String param, final Double value) { return addNameValuePair(param, value.toString()); }
java
public final HttpClient addNameValuePair(final String param, final Double value) { return addNameValuePair(param, value.toString()); }
[ "public", "final", "HttpClient", "addNameValuePair", "(", "final", "String", "param", ",", "final", "Double", "value", ")", "{", "return", "addNameValuePair", "(", "param", ",", "value", ".", "toString", "(", ")", ")", ";", "}" ]
Used by Entity-Enclosing HTTP Requests to send Name-Value pairs in the body of the request @param param Name of Parameter @param value Value of Parameter @return
[ "Used", "by", "Entity", "-", "Enclosing", "HTTP", "Requests", "to", "send", "Name", "-", "Value", "pairs", "in", "the", "body", "of", "the", "request" ]
train
https://github.com/aicer/hibiscus-http-client/blob/a037e3cf8d4bb862d38a55a090778736a48d67cc/src/main/java/org/aicer/hibiscus/http/client/HttpClient.java#L280-L282
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/CountStatisticImpl.java
CountStatisticImpl.set
public void set(long count, long startTime, long lastSampleTime) { this.count = count; this.startTime = startTime; this.lastSampleTime = lastSampleTime; }
java
public void set(long count, long startTime, long lastSampleTime) { this.count = count; this.startTime = startTime; this.lastSampleTime = lastSampleTime; }
[ "public", "void", "set", "(", "long", "count", ",", "long", "startTime", ",", "long", "lastSampleTime", ")", "{", "this", ".", "count", "=", "count", ";", "this", ".", "startTime", "=", "startTime", ";", "this", ".", "lastSampleTime", "=", "lastSampleTime"...
/* Non-Synchronizable: counter is "replaced" with the input value. Caller should synchronize.
[ "/", "*", "Non", "-", "Synchronizable", ":", "counter", "is", "replaced", "with", "the", "input", "value", ".", "Caller", "should", "synchronize", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/CountStatisticImpl.java#L72-L76
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.listNextAsync
public ServiceFuture<List<CloudPool>> listNextAsync(final String nextPageLink, final ServiceFuture<List<CloudPool>> serviceFuture, final ListOperationCallback<CloudPool> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, null); } }, serviceCallback); }
java
public ServiceFuture<List<CloudPool>> listNextAsync(final String nextPageLink, final ServiceFuture<List<CloudPool>> serviceFuture, final ListOperationCallback<CloudPool> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudPool>, PoolListHeaders>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, null); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "CloudPool", ">", ">", "listNextAsync", "(", "final", "String", "nextPageLink", ",", "final", "ServiceFuture", "<", "List", "<", "CloudPool", ">", ">", "serviceFuture", ",", "final", "ListOperationCallback", "<", "Clo...
Lists all of the pools in the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @param serviceFuture the ServiceFuture object tracking the Retrofit calls @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Lists", "all", "of", "the", "pools", "in", "the", "specified", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L3922-L3932
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/RingSetManipulator.java
RingSetManipulator.getHeaviestRing
public static IRing getHeaviestRing(IRingSet ringSet, IBond bond) { IRingSet rings = ringSet.getRings(bond); IRing ring = null; int maxOrderSum = 0; for (Object ring1 : rings.atomContainers()) { if (maxOrderSum < ((IRing) ring1).getBondOrderSum()) { ring = (IRing) ring1; maxOrderSum = ring.getBondOrderSum(); } } return ring; }
java
public static IRing getHeaviestRing(IRingSet ringSet, IBond bond) { IRingSet rings = ringSet.getRings(bond); IRing ring = null; int maxOrderSum = 0; for (Object ring1 : rings.atomContainers()) { if (maxOrderSum < ((IRing) ring1).getBondOrderSum()) { ring = (IRing) ring1; maxOrderSum = ring.getBondOrderSum(); } } return ring; }
[ "public", "static", "IRing", "getHeaviestRing", "(", "IRingSet", "ringSet", ",", "IBond", "bond", ")", "{", "IRingSet", "rings", "=", "ringSet", ".", "getRings", "(", "bond", ")", ";", "IRing", "ring", "=", "null", ";", "int", "maxOrderSum", "=", "0", ";...
We define the heaviest ring as the one with the highest number of double bonds. Needed for example for the placement of in-ring double bonds. @param ringSet The collection of rings @param bond A bond which must be contained by the heaviest ring @return The ring with the higest number of double bonds connected to a given bond
[ "We", "define", "the", "heaviest", "ring", "as", "the", "one", "with", "the", "highest", "number", "of", "double", "bonds", ".", "Needed", "for", "example", "for", "the", "placement", "of", "in", "-", "ring", "double", "bonds", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/RingSetManipulator.java#L143-L154
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java
AbstractSegment3F.intersectsLineLine
@Pure public static boolean intersectsLineLine( double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4) { double s = computeLineLineIntersectionFactor(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4); return !Double.isNaN(s); }
java
@Pure public static boolean intersectsLineLine( double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4) { double s = computeLineLineIntersectionFactor(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4); return !Double.isNaN(s); }
[ "@", "Pure", "public", "static", "boolean", "intersectsLineLine", "(", "double", "x1", ",", "double", "y1", ",", "double", "z1", ",", "double", "x2", ",", "double", "y2", ",", "double", "z2", ",", "double", "x3", ",", "double", "y3", ",", "double", "z3...
Replies if two lines are intersecting. @param x1 is the first point of the first line. @param y1 is the first point of the first line. @param z1 is the first point of the first line. @param x2 is the second point of the first line. @param y2 is the second point of the first line. @param z2 is the second point of the first line. @param x3 is the first point of the second line. @param y3 is the first point of the second line. @param z3 is the first point of the second line. @param x4 is the second point of the second line. @param y4 is the second point of the second line. @param z4 is the second point of the second line. @return <code>true</code> if the two shapes are intersecting; otherwise <code>false</code> @see "http://mathworld.wolfram.com/Line-LineIntersection.html"
[ "Replies", "if", "two", "lines", "are", "intersecting", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L517-L525
resilience4j/resilience4j
resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/RateLimiterExports.java
RateLimiterExports.ofSupplier
public static RateLimiterExports ofSupplier(String prefix, Supplier<Iterable<RateLimiter>> rateLimitersSupplier) { return new RateLimiterExports(prefix, rateLimitersSupplier); }
java
public static RateLimiterExports ofSupplier(String prefix, Supplier<Iterable<RateLimiter>> rateLimitersSupplier) { return new RateLimiterExports(prefix, rateLimitersSupplier); }
[ "public", "static", "RateLimiterExports", "ofSupplier", "(", "String", "prefix", ",", "Supplier", "<", "Iterable", "<", "RateLimiter", ">", ">", "rateLimitersSupplier", ")", "{", "return", "new", "RateLimiterExports", "(", "prefix", ",", "rateLimitersSupplier", ")",...
Creates a new instance of {@link RateLimiterExports} with specified metrics names prefix and {@link Supplier} of rate limiters @param prefix the prefix of metrics names @param rateLimitersSupplier the supplier of rate limiters
[ "Creates", "a", "new", "instance", "of", "{", "@link", "RateLimiterExports", "}", "with", "specified", "metrics", "names", "prefix", "and", "{", "@link", "Supplier", "}", "of", "rate", "limiters" ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/RateLimiterExports.java#L54-L56
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.getEventAsFuture
public FutureAPIResponse getEventAsFuture(String eid) throws IOException { Request request = (new RequestBuilder("GET")) .setUrl(apiUrl + "/events/" + eid + ".json?accessKey=" + accessKey) .build(); return new FutureAPIResponse(client.executeRequest(request, getHandler())); }
java
public FutureAPIResponse getEventAsFuture(String eid) throws IOException { Request request = (new RequestBuilder("GET")) .setUrl(apiUrl + "/events/" + eid + ".json?accessKey=" + accessKey) .build(); return new FutureAPIResponse(client.executeRequest(request, getHandler())); }
[ "public", "FutureAPIResponse", "getEventAsFuture", "(", "String", "eid", ")", "throws", "IOException", "{", "Request", "request", "=", "(", "new", "RequestBuilder", "(", "\"GET\"", ")", ")", ".", "setUrl", "(", "apiUrl", "+", "\"/events/\"", "+", "eid", "+", ...
Sends an asynchronous get event request to the API. @param eid ID of the event to get
[ "Sends", "an", "asynchronous", "get", "event", "request", "to", "the", "API", "." ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L234-L239
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java
MultiLayerNetwork.f1Score
@Override public double f1Score(INDArray input, INDArray labels) { feedForward(input); setLabels(labels); Evaluation eval = new Evaluation(); eval.eval(labels, output(input)); return eval.f1(); }
java
@Override public double f1Score(INDArray input, INDArray labels) { feedForward(input); setLabels(labels); Evaluation eval = new Evaluation(); eval.eval(labels, output(input)); return eval.f1(); }
[ "@", "Override", "public", "double", "f1Score", "(", "INDArray", "input", ",", "INDArray", "labels", ")", "{", "feedForward", "(", "input", ")", ";", "setLabels", "(", "labels", ")", ";", "Evaluation", "eval", "=", "new", "Evaluation", "(", ")", ";", "ev...
Perform inference and then calculate the F1 score of the output(input) vs. the labels. @param input the input to perform inference with @param labels the true labels @return the score for the given input,label pairs
[ "Perform", "inference", "and", "then", "calculate", "the", "F1", "score", "of", "the", "output", "(", "input", ")", "vs", ".", "the", "labels", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java#L2440-L2447
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_retrieveInfo_POST
public OvhAsyncTask<OvhModemInfo> serviceName_modem_retrieveInfo_POST(String serviceName) throws IOException { String qPath = "/xdsl/{serviceName}/modem/retrieveInfo"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, t16); }
java
public OvhAsyncTask<OvhModemInfo> serviceName_modem_retrieveInfo_POST(String serviceName) throws IOException { String qPath = "/xdsl/{serviceName}/modem/retrieveInfo"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, t16); }
[ "public", "OvhAsyncTask", "<", "OvhModemInfo", ">", "serviceName_modem_retrieveInfo_POST", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/retrieveInfo\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
get general Modem information REST: POST /xdsl/{serviceName}/modem/retrieveInfo @param serviceName [required] The internal name of your XDSL offer
[ "get", "general", "Modem", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L833-L838
jMetal/jMetal
jmetal-exec/src/main/java/org/uma/jmetal/experiment/NSGAIIStudy.java
NSGAIIStudy.configureAlgorithmList
static List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> configureAlgorithmList( List<ExperimentProblem<DoubleSolution>> problemList) { List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> algorithms = new ArrayList<>(); for (int run = 0; run < INDEPENDENT_RUNS; run++) { for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 5), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 10.0), 100) .setMaxEvaluations(25000) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, "NSGAIIa", problemList.get(i),run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 20.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0), 100) .setMaxEvaluations(25000) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, "NSGAIIb", problemList.get(i),run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<>(problemList.get(i).getProblem(), new SBXCrossover(1.0, 40.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 40.0), 10) .setMaxEvaluations(25000) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, "NSGAIIc", problemList.get(i),run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<>(problemList.get(i).getProblem(), new SBXCrossover(1.0, 80.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 80.0), 100) .setMaxEvaluations(25000) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, "NSGAIId", problemList.get(i),run)); } } return algorithms; }
java
static List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> configureAlgorithmList( List<ExperimentProblem<DoubleSolution>> problemList) { List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> algorithms = new ArrayList<>(); for (int run = 0; run < INDEPENDENT_RUNS; run++) { for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 5), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 10.0), 100) .setMaxEvaluations(25000) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, "NSGAIIa", problemList.get(i),run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 20.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0), 100) .setMaxEvaluations(25000) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, "NSGAIIb", problemList.get(i),run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<>(problemList.get(i).getProblem(), new SBXCrossover(1.0, 40.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 40.0), 10) .setMaxEvaluations(25000) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, "NSGAIIc", problemList.get(i),run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<>(problemList.get(i).getProblem(), new SBXCrossover(1.0, 80.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 80.0), 100) .setMaxEvaluations(25000) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, "NSGAIId", problemList.get(i),run)); } } return algorithms; }
[ "static", "List", "<", "ExperimentAlgorithm", "<", "DoubleSolution", ",", "List", "<", "DoubleSolution", ">", ">", ">", "configureAlgorithmList", "(", "List", "<", "ExperimentProblem", "<", "DoubleSolution", ">", ">", "problemList", ")", "{", "List", "<", "Exper...
The algorithm list is composed of pairs {@link Algorithm} + {@link Problem} which form part of a {@link ExperimentAlgorithm}, which is a decorator for class {@link Algorithm}. The {@link ExperimentAlgorithm} has an optional tag component, that can be set as it is shown in this example, where four variants of a same algorithm are defined.
[ "The", "algorithm", "list", "is", "composed", "of", "pairs", "{" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-exec/src/main/java/org/uma/jmetal/experiment/NSGAIIStudy.java#L96-L142
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/AttributeRepositoryDecorator.java
AttributeRepositoryDecorator.updateAttributeInBackend
private void updateAttributeInBackend(Attribute attr, Attribute updatedAttr) { MetaDataService meta = dataService.getMeta(); meta.getConcreteChildren(attr.getEntity()) .forEach( entityType -> meta.getBackend(entityType).updateAttribute(entityType, attr, updatedAttr)); }
java
private void updateAttributeInBackend(Attribute attr, Attribute updatedAttr) { MetaDataService meta = dataService.getMeta(); meta.getConcreteChildren(attr.getEntity()) .forEach( entityType -> meta.getBackend(entityType).updateAttribute(entityType, attr, updatedAttr)); }
[ "private", "void", "updateAttributeInBackend", "(", "Attribute", "attr", ",", "Attribute", "updatedAttr", ")", "{", "MetaDataService", "meta", "=", "dataService", ".", "getMeta", "(", ")", ";", "meta", ".", "getConcreteChildren", "(", "attr", ".", "getEntity", "...
Updates an attribute's representation in the backend for each concrete {@link EntityType} that has the {@link Attribute}. @param attr current version of the attribute @param updatedAttr new version of the attribute
[ "Updates", "an", "attribute", "s", "representation", "in", "the", "backend", "for", "each", "concrete", "{", "@link", "EntityType", "}", "that", "has", "the", "{", "@link", "Attribute", "}", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/AttributeRepositoryDecorator.java#L51-L57
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsInner.java
VirtualMachineExtensionsInner.beginCreateOrUpdateAsync
public Observable<VirtualMachineExtensionInner> beginCreateOrUpdateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionInner extensionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() { @Override public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineExtensionInner> beginCreateOrUpdateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionInner extensionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() { @Override public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineExtensionInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "String", "vmExtensionName", ",", "VirtualMachineExtensionInner", "extensionParameters", ")", "{", "return", "begi...
The operation to create or update the extension. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine where the extension should be created or updated. @param vmExtensionName The name of the virtual machine extension. @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineExtensionInner object
[ "The", "operation", "to", "create", "or", "update", "the", "extension", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsInner.java#L215-L222
lecho/hellocharts-android
hellocharts-library/src/lecho/lib/hellocharts/computator/ChartComputator.java
ChartComputator.setViewportTopLeft
public void setViewportTopLeft(float left, float top) { /** * Constrains within the scroll range. The scroll range is simply the viewport extremes (AXIS_X_MAX, * etc.) minus * the viewport size. For example, if the extrema were 0 and 10, and the viewport size was 2, the scroll range * would be 0 to 8. */ final float curWidth = currentViewport.width(); final float curHeight = currentViewport.height(); left = Math.max(maxViewport.left, Math.min(left, maxViewport.right - curWidth)); top = Math.max(maxViewport.bottom + curHeight, Math.min(top, maxViewport.top)); constrainViewport(left, top, left + curWidth, top - curHeight); }
java
public void setViewportTopLeft(float left, float top) { /** * Constrains within the scroll range. The scroll range is simply the viewport extremes (AXIS_X_MAX, * etc.) minus * the viewport size. For example, if the extrema were 0 and 10, and the viewport size was 2, the scroll range * would be 0 to 8. */ final float curWidth = currentViewport.width(); final float curHeight = currentViewport.height(); left = Math.max(maxViewport.left, Math.min(left, maxViewport.right - curWidth)); top = Math.max(maxViewport.bottom + curHeight, Math.min(top, maxViewport.top)); constrainViewport(left, top, left + curWidth, top - curHeight); }
[ "public", "void", "setViewportTopLeft", "(", "float", "left", ",", "float", "top", ")", "{", "/**\n * Constrains within the scroll range. The scroll range is simply the viewport extremes (AXIS_X_MAX,\n * etc.) minus\n * the viewport size. For example, if the extrema wer...
Sets the current viewport (defined by {@link #currentViewport}) to the given X and Y positions.
[ "Sets", "the", "current", "viewport", "(", "defined", "by", "{" ]
train
https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/computator/ChartComputator.java#L116-L130
schallee/alib4j
servlet/src/main/java/net/darkmist/alib/servlet/ServletUtil.java
ServletUtil.getServletParameter
public static String getServletParameter(HttpServlet servlet, String name, Set<GetOpts> opts, String defaultValue) { return getServletParameter((ServletConfig)servlet, name, opts, defaultValue); }
java
public static String getServletParameter(HttpServlet servlet, String name, Set<GetOpts> opts, String defaultValue) { return getServletParameter((ServletConfig)servlet, name, opts, defaultValue); }
[ "public", "static", "String", "getServletParameter", "(", "HttpServlet", "servlet", ",", "String", "name", ",", "Set", "<", "GetOpts", ">", "opts", ",", "String", "defaultValue", ")", "{", "return", "getServletParameter", "(", "(", "ServletConfig", ")", "servlet...
/* getServletParameter(HttpServlet...) HttpServlet implements ServletConfig as well as Servlet...
[ "/", "*", "getServletParameter", "(", "HttpServlet", "...", ")", "HttpServlet", "implements", "ServletConfig", "as", "well", "as", "Servlet", "..." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/servlet/src/main/java/net/darkmist/alib/servlet/ServletUtil.java#L181-L184
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteClient.java
RouteClient.insertRoute
@BetaApi public final Operation insertRoute(ProjectName project, Route routeResource) { InsertRouteHttpRequest request = InsertRouteHttpRequest.newBuilder() .setProject(project == null ? null : project.toString()) .setRouteResource(routeResource) .build(); return insertRoute(request); }
java
@BetaApi public final Operation insertRoute(ProjectName project, Route routeResource) { InsertRouteHttpRequest request = InsertRouteHttpRequest.newBuilder() .setProject(project == null ? null : project.toString()) .setRouteResource(routeResource) .build(); return insertRoute(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertRoute", "(", "ProjectName", "project", ",", "Route", "routeResource", ")", "{", "InsertRouteHttpRequest", "request", "=", "InsertRouteHttpRequest", ".", "newBuilder", "(", ")", ".", "setProject", "(", "project",...
Creates a Route resource in the specified project using the data included in the request. <p>Sample code: <pre><code> try (RouteClient routeClient = RouteClient.create()) { ProjectName project = ProjectName.of("[PROJECT]"); Route routeResource = Route.newBuilder().build(); Operation response = routeClient.insertRoute(project, routeResource); } </code></pre> @param project Project ID for this request. @param routeResource Represents a Route resource. A route specifies how certain packets should be handled by the network. Routes are associated with instances by tags and the set of routes for a particular instance is called its routing table. <p>For each packet leaving an instance, the system searches that instance's routing table for a single best matching route. Routes match packets by destination IP address, preferring smaller or more specific ranges over larger ones. If there is a tie, the system selects the route with the smallest priority value. If there is still a tie, it uses the layer three and four packet headers to select just one of the remaining matching routes. The packet is then forwarded as specified by the nextHop field of the winning route - either to another instance destination, an instance gateway, or a Google Compute Engine-operated gateway. <p>Packets that do not match any route in the sending instance's routing table are dropped. (== resource_for beta.routes ==) (== resource_for v1.routes ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "Route", "resource", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteClient.java#L378-L387
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/processor/JavaGeneratingProcessor.java
JavaGeneratingProcessor.generateFromStringTemplate
public void generateFromStringTemplate(TypeDef model, String[] parameters, String content) throws IOException { TypeDef newModel = createTypeFromTemplate(model, parameters, content); if (processingEnv.getElementUtils().getTypeElement(newModel.getFullyQualifiedName()) != null) { System.err.println("Skipping: " + newModel.getFullyQualifiedName()+ ". Class already exists."); return; } if (classExists(newModel)) { System.err.println("Skipping: " + newModel.getFullyQualifiedName()+ ". Class already exists."); return; } generateFromStringTemplate(model, parameters, processingEnv.getFiler().createSourceFile(newModel.getFullyQualifiedName()), content); }
java
public void generateFromStringTemplate(TypeDef model, String[] parameters, String content) throws IOException { TypeDef newModel = createTypeFromTemplate(model, parameters, content); if (processingEnv.getElementUtils().getTypeElement(newModel.getFullyQualifiedName()) != null) { System.err.println("Skipping: " + newModel.getFullyQualifiedName()+ ". Class already exists."); return; } if (classExists(newModel)) { System.err.println("Skipping: " + newModel.getFullyQualifiedName()+ ". Class already exists."); return; } generateFromStringTemplate(model, parameters, processingEnv.getFiler().createSourceFile(newModel.getFullyQualifiedName()), content); }
[ "public", "void", "generateFromStringTemplate", "(", "TypeDef", "model", ",", "String", "[", "]", "parameters", ",", "String", "content", ")", "throws", "IOException", "{", "TypeDef", "newModel", "=", "createTypeFromTemplate", "(", "model", ",", "parameters", ",",...
Generates a source file from the specified {@link io.sundr.codegen.model.TypeDef}. @param model The model of the class to generate. @param content The template to use. @throws IOException If it fails to create the source file.
[ "Generates", "a", "source", "file", "from", "the", "specified", "{", "@link", "io", ".", "sundr", ".", "codegen", ".", "model", ".", "TypeDef", "}", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/processor/JavaGeneratingProcessor.java#L86-L97
Whiley/WhileyCompiler
src/main/java/wyil/transform/VerificationConditionGenerator.java
VerificationConditionGenerator.translateAsUnknown
private Expr translateAsUnknown(WyilFile.Expr expr, LocalEnvironment environment) { // What we're doing here is creating a completely fresh variable to // represent the return value. This is basically saying the return value // could be anything, and we don't care what. String name = "r" + Integer.toString(expr.getIndex()); WyalFile.Type type = convert(expr.getType(), expr); WyalFile.VariableDeclaration vf = allocate( new WyalFile.VariableDeclaration(type, new WyalFile.Identifier(name)), null); // environment = environment.write(expr.getIndex()); // WyalFile.VariableDeclaration r = environment.read(expr.getIndex()); return new Expr.VariableAccess(vf); // throw new IllegalArgumentException("Implement me"); }
java
private Expr translateAsUnknown(WyilFile.Expr expr, LocalEnvironment environment) { // What we're doing here is creating a completely fresh variable to // represent the return value. This is basically saying the return value // could be anything, and we don't care what. String name = "r" + Integer.toString(expr.getIndex()); WyalFile.Type type = convert(expr.getType(), expr); WyalFile.VariableDeclaration vf = allocate( new WyalFile.VariableDeclaration(type, new WyalFile.Identifier(name)), null); // environment = environment.write(expr.getIndex()); // WyalFile.VariableDeclaration r = environment.read(expr.getIndex()); return new Expr.VariableAccess(vf); // throw new IllegalArgumentException("Implement me"); }
[ "private", "Expr", "translateAsUnknown", "(", "WyilFile", ".", "Expr", "expr", ",", "LocalEnvironment", "environment", ")", "{", "// What we're doing here is creating a completely fresh variable to", "// represent the return value. This is basically saying the return value", "// could ...
Translating as unknown basically means we're not representing the operation in question at the verification level. This could be something that we'll implement in the future, or maybe not. @param expr @param environment @return
[ "Translating", "as", "unknown", "basically", "means", "we", "re", "not", "representing", "the", "operation", "in", "question", "at", "the", "verification", "level", ".", "This", "could", "be", "something", "that", "we", "ll", "implement", "in", "the", "future"...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1639-L1651
infinispan/infinispan
core/src/main/java/org/infinispan/cache/impl/SimpleCacheImpl.java
SimpleCacheImpl.getValue
private V getValue(InternalCacheEntry<K, V> entry) { return isNull(entry) ? null : entry.getValue(); }
java
private V getValue(InternalCacheEntry<K, V> entry) { return isNull(entry) ? null : entry.getValue(); }
[ "private", "V", "getValue", "(", "InternalCacheEntry", "<", "K", ",", "V", ">", "entry", ")", "{", "return", "isNull", "(", "entry", ")", "?", "null", ":", "entry", ".", "getValue", "(", ")", ";", "}" ]
This method can be called only from dataContainer.compute()'s action!
[ "This", "method", "can", "be", "called", "only", "from", "dataContainer", ".", "compute", "()", "s", "action!" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/cache/impl/SimpleCacheImpl.java#L1616-L1618
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
AnnotationTypeRequiredMemberBuilder.buildMemberComments
public void buildMemberComments(XMLNode node, Content annotationDocTree) { if(! configuration.nocomment){ writer.addComments((MemberDoc) members.get(currentMemberIndex), annotationDocTree); } }
java
public void buildMemberComments(XMLNode node, Content annotationDocTree) { if(! configuration.nocomment){ writer.addComments((MemberDoc) members.get(currentMemberIndex), annotationDocTree); } }
[ "public", "void", "buildMemberComments", "(", "XMLNode", "node", ",", "Content", "annotationDocTree", ")", "{", "if", "(", "!", "configuration", ".", "nocomment", ")", "{", "writer", ".", "addComments", "(", "(", "MemberDoc", ")", "members", ".", "get", "(",...
Build the comments for the member. Do nothing if {@link Configuration#nocomment} is set to true. @param node the XML element that specifies which components to document @param annotationDocTree the content tree to which the documentation will be added
[ "Build", "the", "comments", "for", "the", "member", ".", "Do", "nothing", "if", "{", "@link", "Configuration#nocomment", "}", "is", "set", "to", "true", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java#L214-L219
wcm-io/wcm-io-caconfig
compat/src/main/java/io/wcm/config/core/persistence/impl/MapUtil.java
MapUtil.traceOutput
public static String traceOutput(Map<String, Object> properties) { SortedSet<String> propertyNames = new TreeSet<>(properties.keySet()); StringBuilder sb = new StringBuilder(); sb.append("{"); Iterator<String> propertyNameIterator = propertyNames.iterator(); while (propertyNameIterator.hasNext()) { String propertyName = propertyNameIterator.next(); sb.append(propertyName).append(": "); appendValue(sb, properties.get(propertyName)); if (propertyNameIterator.hasNext()) { sb.append(", "); } } sb.append("}"); return sb.toString(); }
java
public static String traceOutput(Map<String, Object> properties) { SortedSet<String> propertyNames = new TreeSet<>(properties.keySet()); StringBuilder sb = new StringBuilder(); sb.append("{"); Iterator<String> propertyNameIterator = propertyNames.iterator(); while (propertyNameIterator.hasNext()) { String propertyName = propertyNameIterator.next(); sb.append(propertyName).append(": "); appendValue(sb, properties.get(propertyName)); if (propertyNameIterator.hasNext()) { sb.append(", "); } } sb.append("}"); return sb.toString(); }
[ "public", "static", "String", "traceOutput", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "SortedSet", "<", "String", ">", "propertyNames", "=", "new", "TreeSet", "<>", "(", "properties", ".", "keySet", "(", ")", ")", ";", "Stri...
Produce trace output for properties map. @param properties Properties @return Debug output
[ "Produce", "trace", "output", "for", "properties", "map", "." ]
train
https://github.com/wcm-io/wcm-io-caconfig/blob/48592eadb0b62a09eec555cedfae7e00b213f6ed/compat/src/main/java/io/wcm/config/core/persistence/impl/MapUtil.java#L39-L54
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_udp_farm_farmId_DELETE
public void serviceName_udp_farm_farmId_DELETE(String serviceName, Long farmId) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void serviceName_udp_farm_farmId_DELETE(String serviceName, Long farmId) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "serviceName_udp_farm_farmId_DELETE", "(", "String", "serviceName", ",", "Long", "farmId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/udp/farm/{farmId}\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
Delete an UDP Farm REST: DELETE /ipLoadbalancing/{serviceName}/udp/farm/{farmId} @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm API beta
[ "Delete", "an", "UDP", "Farm" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L927-L931
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/ExecutionGraphCache.java
ExecutionGraphCache.getExecutionGraph
public CompletableFuture<AccessExecutionGraph> getExecutionGraph(JobID jobId, RestfulGateway restfulGateway) { return getExecutionGraphInternal(jobId, restfulGateway).thenApply(Function.identity()); }
java
public CompletableFuture<AccessExecutionGraph> getExecutionGraph(JobID jobId, RestfulGateway restfulGateway) { return getExecutionGraphInternal(jobId, restfulGateway).thenApply(Function.identity()); }
[ "public", "CompletableFuture", "<", "AccessExecutionGraph", ">", "getExecutionGraph", "(", "JobID", "jobId", ",", "RestfulGateway", "restfulGateway", ")", "{", "return", "getExecutionGraphInternal", "(", "jobId", ",", "restfulGateway", ")", ".", "thenApply", "(", "Fun...
Gets the {@link AccessExecutionGraph} for the given {@link JobID} and caches it. The {@link AccessExecutionGraph} will be requested again after the refresh interval has passed or if the graph could not be retrieved from the given gateway. @param jobId identifying the {@link ArchivedExecutionGraph} to get @param restfulGateway to request the {@link ArchivedExecutionGraph} from @return Future containing the requested {@link ArchivedExecutionGraph}
[ "Gets", "the", "{", "@link", "AccessExecutionGraph", "}", "for", "the", "given", "{", "@link", "JobID", "}", "and", "caches", "it", ".", "The", "{", "@link", "AccessExecutionGraph", "}", "will", "be", "requested", "again", "after", "the", "refresh", "interva...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/ExecutionGraphCache.java#L83-L85
iipc/webarchive-commons
src/main/java/org/archive/util/FileUtils.java
FileUtils.getRegexFileFilter
public static IOFileFilter getRegexFileFilter(String regex) { // Inner class defining the RegexFileFilter class RegexFileFilter implements IOFileFilter { Pattern pattern; protected RegexFileFilter(String re) { pattern = Pattern.compile(re); } public boolean accept(File pathname) { return pattern.matcher(pathname.getName()).matches(); } public boolean accept(File dir, String name) { return accept(new File(dir,name)); } } return new RegexFileFilter(regex); }
java
public static IOFileFilter getRegexFileFilter(String regex) { // Inner class defining the RegexFileFilter class RegexFileFilter implements IOFileFilter { Pattern pattern; protected RegexFileFilter(String re) { pattern = Pattern.compile(re); } public boolean accept(File pathname) { return pattern.matcher(pathname.getName()).matches(); } public boolean accept(File dir, String name) { return accept(new File(dir,name)); } } return new RegexFileFilter(regex); }
[ "public", "static", "IOFileFilter", "getRegexFileFilter", "(", "String", "regex", ")", "{", "// Inner class defining the RegexFileFilter", "class", "RegexFileFilter", "implements", "IOFileFilter", "{", "Pattern", "pattern", ";", "protected", "RegexFileFilter", "(", "String"...
Get a @link java.io.FileFilter that filters files based on a regular expression. @param regex the regular expression the files must match. @return the newly created filter.
[ "Get", "a", "@link", "java", ".", "io", ".", "FileFilter", "that", "filters", "files", "based", "on", "a", "regular", "expression", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/FileUtils.java#L235-L254
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeValueWithDefault
@Pure public static String getAttributeValueWithDefault(Node document, String defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeValueWithDefault(document, true, defaultValue, path); }
java
@Pure public static String getAttributeValueWithDefault(Node document, String defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeValueWithDefault(document, true, defaultValue, path); }
[ "@", "Pure", "public", "static", "String", "getAttributeValueWithDefault", "(", "Node", "document", ",", "String", "defaultValue", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0...
Replies the value that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. @param document is the XML document to explore. @param defaultValue is the default value to reply if no attribute value was found. @param path is the list of and ended by the attribute's name. @return the value of the specified attribute or <code>null</code> if it was node found in the document
[ "Replies", "the", "value", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1292-L1296
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java
AmazonS3Client.getAcl
private AccessControlList getAcl(String bucketName, String key, String versionId, boolean isRequesterPays, AmazonWebServiceRequest originalRequest) { if (originalRequest == null) originalRequest = new GenericBucketRequest(bucketName); Request<AmazonWebServiceRequest> request = createRequest(bucketName, key, originalRequest, HttpMethodName.GET); if (bucketName != null && key != null) { request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetObjectAcl"); } else if (bucketName != null) { request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetBucketAcl"); } request.addParameter("acl", null); if (versionId != null) { request.addParameter("versionId", versionId); } populateRequesterPaysHeader(request, isRequesterPays); @SuppressWarnings("unchecked") ResponseHeaderHandlerChain<AccessControlList> responseHandler = new ResponseHeaderHandlerChain<AccessControlList>( new Unmarshallers.AccessControlListUnmarshaller(), new S3RequesterChargedHeaderHandler<AccessControlList>()); return invoke(request, responseHandler, bucketName, key); }
java
private AccessControlList getAcl(String bucketName, String key, String versionId, boolean isRequesterPays, AmazonWebServiceRequest originalRequest) { if (originalRequest == null) originalRequest = new GenericBucketRequest(bucketName); Request<AmazonWebServiceRequest> request = createRequest(bucketName, key, originalRequest, HttpMethodName.GET); if (bucketName != null && key != null) { request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetObjectAcl"); } else if (bucketName != null) { request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetBucketAcl"); } request.addParameter("acl", null); if (versionId != null) { request.addParameter("versionId", versionId); } populateRequesterPaysHeader(request, isRequesterPays); @SuppressWarnings("unchecked") ResponseHeaderHandlerChain<AccessControlList> responseHandler = new ResponseHeaderHandlerChain<AccessControlList>( new Unmarshallers.AccessControlListUnmarshaller(), new S3RequesterChargedHeaderHandler<AccessControlList>()); return invoke(request, responseHandler, bucketName, key); }
[ "private", "AccessControlList", "getAcl", "(", "String", "bucketName", ",", "String", "key", ",", "String", "versionId", ",", "boolean", "isRequesterPays", ",", "AmazonWebServiceRequest", "originalRequest", ")", "{", "if", "(", "originalRequest", "==", "null", ")", ...
<p> Gets the Amazon S3 {@link AccessControlList} (ACL) for the specified resource. (bucket if only the bucketName parameter is specified, otherwise the object with the specified key in the bucket). </p> @param bucketName The name of the bucket whose ACL should be returned if the key parameter is not specified, otherwise the bucket containing the specified key. @param key The object key whose ACL should be retrieve. If not specified, the bucket's ACL is returned. @param versionId The version ID of the object version whose ACL is being retrieved. @param originalRequest The original, user facing request object. @return The S3 ACL for the specified resource.
[ "<p", ">", "Gets", "the", "Amazon", "S3", "{", "@link", "AccessControlList", "}", "(", "ACL", ")", "for", "the", "specified", "resource", ".", "(", "bucket", "if", "only", "the", "bucketName", "parameter", "is", "specified", "otherwise", "the", "object", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L3864-L3888
grycap/coreutils
coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/Http2Client.java
Http2Client.asyncPostBytes
public void asyncPostBytes(final String url, final String mediaType, final Supplier<byte[]> supplier, final Callback callback) { final String url2 = requireNonNull(trimToNull(url), "A non-empty URL expected"); final String mediaType2 = requireNonNull(trimToNull(mediaType), "A non-empty media type expected"); requireNonNull(supplier, "A valid supplier expected"); requireNonNull(callback, "A valid callback expected"); // prepare request final Request request = new Request.Builder().url(url2).post(new RequestBody() { @Override public MediaType contentType() { return MediaType.parse(mediaType2 + "; charset=utf-8"); } @Override public void writeTo(final BufferedSink sink) throws IOException { sink.write(supplier.get()); } }).build(); // submit request client.newCall(request).enqueue(callback); }
java
public void asyncPostBytes(final String url, final String mediaType, final Supplier<byte[]> supplier, final Callback callback) { final String url2 = requireNonNull(trimToNull(url), "A non-empty URL expected"); final String mediaType2 = requireNonNull(trimToNull(mediaType), "A non-empty media type expected"); requireNonNull(supplier, "A valid supplier expected"); requireNonNull(callback, "A valid callback expected"); // prepare request final Request request = new Request.Builder().url(url2).post(new RequestBody() { @Override public MediaType contentType() { return MediaType.parse(mediaType2 + "; charset=utf-8"); } @Override public void writeTo(final BufferedSink sink) throws IOException { sink.write(supplier.get()); } }).build(); // submit request client.newCall(request).enqueue(callback); }
[ "public", "void", "asyncPostBytes", "(", "final", "String", "url", ",", "final", "String", "mediaType", ",", "final", "Supplier", "<", "byte", "[", "]", ">", "supplier", ",", "final", "Callback", "callback", ")", "{", "final", "String", "url2", "=", "requi...
Posts the content of a buffer of bytes to a server via a HTTP POST request. @param url - URL target of this request @param mediaType - Content-Type header for this request @param supplier - supplies the content of this request @param callback - is called back when the response is readable
[ "Posts", "the", "content", "of", "a", "buffer", "of", "bytes", "to", "a", "server", "via", "a", "HTTP", "POST", "request", "." ]
train
https://github.com/grycap/coreutils/blob/e6db61dc50b49ea7276c0c29c7401204681a10c2/coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/Http2Client.java#L126-L144
ManfredTremmel/gwt-bean-validators
gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/apache/commons/beanutils/BeanUtils.java
BeanUtils.getProperty
public static String getProperty(final Object pbean, final String pname) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { return Objects.toString(PropertyUtils.getProperty(pbean, pname), null); }
java
public static String getProperty(final Object pbean, final String pname) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { return Objects.toString(PropertyUtils.getProperty(pbean, pname), null); }
[ "public", "static", "String", "getProperty", "(", "final", "Object", "pbean", ",", "final", "String", "pname", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", ",", "NoSuchMethodException", "{", "return", "Objects", ".", "toString", "(", "P...
<p> Return the value of the specified property of the specified bean, no matter which property reference format is used, as a String. </p> <p> For more details see <code>BeanUtilsBean</code>. </p> @param pbean Bean whose property is to be extracted @param pname Possibly indexed and/or nested name of the property to be extracted @return The property's value, converted to a String @exception IllegalAccessException if the caller does not have access to the property accessor method @exception InvocationTargetException if the property accessor method throws an exception @exception NoSuchMethodException if an accessor method for this property cannot be found
[ "<p", ">", "Return", "the", "value", "of", "the", "specified", "property", "of", "the", "specified", "bean", "no", "matter", "which", "property", "reference", "format", "is", "used", "as", "a", "String", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/apache/commons/beanutils/BeanUtils.java#L47-L51
springfox/springfox
springfox-core/src/main/java/springfox/documentation/builders/ResponseMessageBuilder.java
ResponseMessageBuilder.headersWithDescription
public ResponseMessageBuilder headersWithDescription(Map<String, Header> headers) { this.headers.putAll(nullToEmptyMap(headers)); return this; }
java
public ResponseMessageBuilder headersWithDescription(Map<String, Header> headers) { this.headers.putAll(nullToEmptyMap(headers)); return this; }
[ "public", "ResponseMessageBuilder", "headersWithDescription", "(", "Map", "<", "String", ",", "Header", ">", "headers", ")", "{", "this", ".", "headers", ".", "putAll", "(", "nullToEmptyMap", "(", "headers", ")", ")", ";", "return", "this", ";", "}" ]
Updates the response headers @param headers headers with description @return this @since 2.5.0
[ "Updates", "the", "response", "headers" ]
train
https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-core/src/main/java/springfox/documentation/builders/ResponseMessageBuilder.java#L123-L126
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getSecretsAsync
public Observable<Page<SecretItem>> getSecretsAsync(final String vaultBaseUrl, final Integer maxresults) { return getSecretsWithServiceResponseAsync(vaultBaseUrl, maxresults) .map(new Func1<ServiceResponse<Page<SecretItem>>, Page<SecretItem>>() { @Override public Page<SecretItem> call(ServiceResponse<Page<SecretItem>> response) { return response.body(); } }); }
java
public Observable<Page<SecretItem>> getSecretsAsync(final String vaultBaseUrl, final Integer maxresults) { return getSecretsWithServiceResponseAsync(vaultBaseUrl, maxresults) .map(new Func1<ServiceResponse<Page<SecretItem>>, Page<SecretItem>>() { @Override public Page<SecretItem> call(ServiceResponse<Page<SecretItem>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "SecretItem", ">", ">", "getSecretsAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "Integer", "maxresults", ")", "{", "return", "getSecretsWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "maxresults", ")",...
List secrets in a specified key vault. The Get Secrets operation is applicable to the entire vault. However, only the base secret identifier and its attributes are provided in the response. Individual secret versions are not listed in the response. This operation requires the secrets/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param maxresults Maximum number of results to return in a page. If not specified, the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SecretItem&gt; object
[ "List", "secrets", "in", "a", "specified", "key", "vault", ".", "The", "Get", "Secrets", "operation", "is", "applicable", "to", "the", "entire", "vault", ".", "However", "only", "the", "base", "secret", "identifier", "and", "its", "attributes", "are", "provi...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4075-L4083
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.getTitleFromApptentivePush
public static String getTitleFromApptentivePush(Map<String, String> data) { try { if (!ApptentiveInternal.checkRegistered()) { return null; } if (data == null) { return null; } return data.get(ApptentiveInternal.TITLE_DEFAULT); } catch (Exception e) { ApptentiveLog.e(PUSH, e, "Exception while getting title from Apptentive push"); logException(e); } return null; }
java
public static String getTitleFromApptentivePush(Map<String, String> data) { try { if (!ApptentiveInternal.checkRegistered()) { return null; } if (data == null) { return null; } return data.get(ApptentiveInternal.TITLE_DEFAULT); } catch (Exception e) { ApptentiveLog.e(PUSH, e, "Exception while getting title from Apptentive push"); logException(e); } return null; }
[ "public", "static", "String", "getTitleFromApptentivePush", "(", "Map", "<", "String", ",", "String", ">", "data", ")", "{", "try", "{", "if", "(", "!", "ApptentiveInternal", ".", "checkRegistered", "(", ")", ")", "{", "return", "null", ";", "}", "if", "...
Use this method in your push receiver to get the notification title you can use to construct a {@link android.app.Notification} object. @param data A {@link Map}&lt;{@link String},{@link String}&gt; containing the Apptentive Push data. Pass in what you receive in the the Service or BroadcastReceiver that is used by your chosen push provider. @return a String value, or null.
[ "Use", "this", "method", "in", "your", "push", "receiver", "to", "get", "the", "notification", "title", "you", "can", "use", "to", "construct", "a", "{", "@link", "android", ".", "app", ".", "Notification", "}", "object", "." ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L805-L819
wisdom-framework/wisdom
core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java
ConfigurationImpl.getDoubleOrDie
@Override public Double getDoubleOrDie(String key) { Double value = getDouble(key); if (value == null) { throw new IllegalArgumentException(String.format(ERROR_KEYNOTFOUND, key)); } else { return value; } }
java
@Override public Double getDoubleOrDie(String key) { Double value = getDouble(key); if (value == null) { throw new IllegalArgumentException(String.format(ERROR_KEYNOTFOUND, key)); } else { return value; } }
[ "@", "Override", "public", "Double", "getDoubleOrDie", "(", "String", "key", ")", "{", "Double", "value", "=", "getDouble", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", ...
The "die" method forces this key to be set. Otherwise a runtime exception will be thrown. @param key the key used in the configuration file. @return the Double or a RuntimeException will be thrown.
[ "The", "die", "method", "forces", "this", "key", "to", "be", "set", ".", "Otherwise", "a", "runtime", "exception", "will", "be", "thrown", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L310-L318
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java
SlotManager.handleFailedSlotRequest
private void handleFailedSlotRequest(SlotID slotId, AllocationID allocationId, Throwable cause) { PendingSlotRequest pendingSlotRequest = pendingSlotRequests.get(allocationId); LOG.debug("Slot request with allocation id {} failed for slot {}.", allocationId, slotId, cause); if (null != pendingSlotRequest) { pendingSlotRequest.setRequestFuture(null); try { internalRequestSlot(pendingSlotRequest); } catch (ResourceManagerException e) { pendingSlotRequests.remove(allocationId); resourceActions.notifyAllocationFailure( pendingSlotRequest.getJobId(), allocationId, e); } } else { LOG.debug("There was not pending slot request with allocation id {}. Probably the request has been fulfilled or cancelled.", allocationId); } }
java
private void handleFailedSlotRequest(SlotID slotId, AllocationID allocationId, Throwable cause) { PendingSlotRequest pendingSlotRequest = pendingSlotRequests.get(allocationId); LOG.debug("Slot request with allocation id {} failed for slot {}.", allocationId, slotId, cause); if (null != pendingSlotRequest) { pendingSlotRequest.setRequestFuture(null); try { internalRequestSlot(pendingSlotRequest); } catch (ResourceManagerException e) { pendingSlotRequests.remove(allocationId); resourceActions.notifyAllocationFailure( pendingSlotRequest.getJobId(), allocationId, e); } } else { LOG.debug("There was not pending slot request with allocation id {}. Probably the request has been fulfilled or cancelled.", allocationId); } }
[ "private", "void", "handleFailedSlotRequest", "(", "SlotID", "slotId", ",", "AllocationID", "allocationId", ",", "Throwable", "cause", ")", "{", "PendingSlotRequest", "pendingSlotRequest", "=", "pendingSlotRequests", ".", "get", "(", "allocationId", ")", ";", "LOG", ...
Handles a failed slot request. The slot manager tries to find a new slot fulfilling the resource requirements for the failed slot request. @param slotId identifying the slot which was assigned to the slot request before @param allocationId identifying the failed slot request @param cause of the failure
[ "Handles", "a", "failed", "slot", "request", ".", "The", "slot", "manager", "tries", "to", "find", "a", "new", "slot", "fulfilling", "the", "resource", "requirements", "for", "the", "failed", "slot", "request", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L949-L970
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_runtime_id_PUT
public void serviceName_runtime_id_PUT(String serviceName, Long id, OvhRuntime body) throws IOException { String qPath = "/hosting/web/{serviceName}/runtime/{id}"; StringBuilder sb = path(qPath, serviceName, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_runtime_id_PUT(String serviceName, Long id, OvhRuntime body) throws IOException { String qPath = "/hosting/web/{serviceName}/runtime/{id}"; StringBuilder sb = path(qPath, serviceName, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_runtime_id_PUT", "(", "String", "serviceName", ",", "Long", "id", ",", "OvhRuntime", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/runtime/{id}\"", ";", "StringBuilder", "sb", "=", "path...
Alter this object properties REST: PUT /hosting/web/{serviceName}/runtime/{id} @param body [required] New object properties @param serviceName [required] The internal name of your hosting @param id [required] The runtime configuration ID
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L324-L328
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/EJBWrapper.java
EJBWrapper.addDefaultEqualsMethod
private static void addDefaultEqualsMethod(ClassWriter cw, String implClassName) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, INDENT + "adding method : equals (Ljava/lang/Object;)Z"); // ----------------------------------------------------------------------- // public boolean equals(Object other) // { // ----------------------------------------------------------------------- final String desc = "(Ljava/lang/Object;)Z"; MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "equals", desc, null, null); GeneratorAdapter mg = new GeneratorAdapter(mv, ACC_PUBLIC, "equals", desc); mg.visitCode(); // ----------------------------------------------------------------------- // return this == other; // ----------------------------------------------------------------------- mg.loadThis(); mg.loadArg(0); Label not_equal = new Label(); mv.visitJumpInsn(IF_ACMPNE, not_equal); mg.visitInsn(ICONST_1); mg.returnValue(); mg.visitLabel(not_equal); mg.visitInsn(ICONST_0); mg.returnValue(); // ----------------------------------------------------------------------- // } // ----------------------------------------------------------------------- mg.endMethod(); mg.visitEnd(); }
java
private static void addDefaultEqualsMethod(ClassWriter cw, String implClassName) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, INDENT + "adding method : equals (Ljava/lang/Object;)Z"); // ----------------------------------------------------------------------- // public boolean equals(Object other) // { // ----------------------------------------------------------------------- final String desc = "(Ljava/lang/Object;)Z"; MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "equals", desc, null, null); GeneratorAdapter mg = new GeneratorAdapter(mv, ACC_PUBLIC, "equals", desc); mg.visitCode(); // ----------------------------------------------------------------------- // return this == other; // ----------------------------------------------------------------------- mg.loadThis(); mg.loadArg(0); Label not_equal = new Label(); mv.visitJumpInsn(IF_ACMPNE, not_equal); mg.visitInsn(ICONST_1); mg.returnValue(); mg.visitLabel(not_equal); mg.visitInsn(ICONST_0); mg.returnValue(); // ----------------------------------------------------------------------- // } // ----------------------------------------------------------------------- mg.endMethod(); mg.visitEnd(); }
[ "private", "static", "void", "addDefaultEqualsMethod", "(", "ClassWriter", "cw", ",", "String", "implClassName", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", ...
Adds the default definition for the Object.equals method. @param cw ASM ClassWriter to add the method to. @param implClassName name of the wrapper class being generated.
[ "Adds", "the", "default", "definition", "for", "the", "Object", ".", "equals", "method", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/EJBWrapper.java#L631-L664
threerings/narya
core/src/main/java/com/threerings/bureau/server/BureauRegistry.java
BureauRegistry.setLauncher
public void setLauncher (String bureauType, Launcher launcher, int timeout) { if (_launchers.get(bureauType) != null) { log.warning("Launcher for type already exists", "type", bureauType); return; } _launchers.put(bureauType, new LauncherEntry(launcher, timeout)); }
java
public void setLauncher (String bureauType, Launcher launcher, int timeout) { if (_launchers.get(bureauType) != null) { log.warning("Launcher for type already exists", "type", bureauType); return; } _launchers.put(bureauType, new LauncherEntry(launcher, timeout)); }
[ "public", "void", "setLauncher", "(", "String", "bureauType", ",", "Launcher", "launcher", ",", "int", "timeout", ")", "{", "if", "(", "_launchers", ".", "get", "(", "bureauType", ")", "!=", "null", ")", "{", "log", ".", "warning", "(", "\"Launcher for typ...
Registers a launcher for a given type. When an agent is started and no bureaus are running, the <code>bureauType</code> is used to determine the <code>Launcher</code> instance to call. If the launched bureau does not connect within the given number of milliseconds, it will be logged as an error and future attempts to launch the bureau will invoke the <code>launch</code> method again. @param bureauType the type of bureau that will be launched @param launcher the launcher to be used for bureaus of <code>bureauType</code> @param timeout milliseconds to wait for the bureau or 0 to wait forever
[ "Registers", "a", "launcher", "for", "a", "given", "type", ".", "When", "an", "agent", "is", "started", "and", "no", "bureaus", "are", "running", "the", "<code", ">", "bureauType<", "/", "code", ">", "is", "used", "to", "determine", "the", "<code", ">", ...
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/bureau/server/BureauRegistry.java#L231-L239
kuali/ojb-1.0.4
src/ejb/org/apache/ojb/ejb/pb/PersonArticleManagerPBBean.java
PersonArticleManagerPBBean.storeUsingNestedPB
public void storeUsingNestedPB(List articles, List persons) { PersistenceBroker broker = pbf.defaultPersistenceBroker(); try { // do something with broker Query q = new QueryByCriteria(PersonVO.class); broker.getCollectionByQuery(q); // System.out.println("## broker1: con=" + broker.serviceConnectionManager().getConnection()); //now use nested bean call // System.out.println("####### DO nested bean call"); ArticleManagerPBLocal am = getArticleManager(); am.storeArticles(articles); // System.out.println("####### END nested bean call"); // do more with broker // System.out.println("## broker1: now store objects"); storeObjects(broker, persons); // System.out.println("## broker1: end store, con=" + broker.serviceConnectionManager().getConnection()); } // catch(LookupException e) // { // throw new EJBException(e); // } finally { // System.out.println("## close broker1 now"); if(broker != null) broker.close(); } }
java
public void storeUsingNestedPB(List articles, List persons) { PersistenceBroker broker = pbf.defaultPersistenceBroker(); try { // do something with broker Query q = new QueryByCriteria(PersonVO.class); broker.getCollectionByQuery(q); // System.out.println("## broker1: con=" + broker.serviceConnectionManager().getConnection()); //now use nested bean call // System.out.println("####### DO nested bean call"); ArticleManagerPBLocal am = getArticleManager(); am.storeArticles(articles); // System.out.println("####### END nested bean call"); // do more with broker // System.out.println("## broker1: now store objects"); storeObjects(broker, persons); // System.out.println("## broker1: end store, con=" + broker.serviceConnectionManager().getConnection()); } // catch(LookupException e) // { // throw new EJBException(e); // } finally { // System.out.println("## close broker1 now"); if(broker != null) broker.close(); } }
[ "public", "void", "storeUsingNestedPB", "(", "List", "articles", ",", "List", "persons", ")", "{", "PersistenceBroker", "broker", "=", "pbf", ".", "defaultPersistenceBroker", "(", ")", ";", "try", "{", "// do something with broker\r", "Query", "q", "=", "new", "...
Stores article and persons using other beans. @ejb:interface-method
[ "Stores", "article", "and", "persons", "using", "other", "beans", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/ejb/org/apache/ojb/ejb/pb/PersonArticleManagerPBBean.java#L105-L133
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.getAvailableSites
public List<CmsSite> getAvailableSites(CmsObject cms, boolean workplaceMode, boolean showShared, String ouFqn) { return getAvailableSites(cms, workplaceMode, showShared, ouFqn, null); }
java
public List<CmsSite> getAvailableSites(CmsObject cms, boolean workplaceMode, boolean showShared, String ouFqn) { return getAvailableSites(cms, workplaceMode, showShared, ouFqn, null); }
[ "public", "List", "<", "CmsSite", ">", "getAvailableSites", "(", "CmsObject", "cms", ",", "boolean", "workplaceMode", ",", "boolean", "showShared", ",", "String", "ouFqn", ")", "{", "return", "getAvailableSites", "(", "cms", ",", "workplaceMode", ",", "showShare...
Returns a list of all {@link CmsSite} instances that are compatible to the given organizational unit.<p> @param cms the current OpenCms user context @param workplaceMode if true, the root and current site is included for the admin user and the view permission is required to see the site root @param showShared if the shared folder should be shown @param ouFqn the organizational unit @return a list of all site available for the current user
[ "Returns", "a", "list", "of", "all", "{", "@link", "CmsSite", "}", "instances", "that", "are", "compatible", "to", "the", "given", "organizational", "unit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L574-L577
google/error-prone
check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java
ASTHelpers.getAnnotation
@Nullable @Deprecated @SuppressWarnings("deprecation") public static <T extends Annotation> T getAnnotation(Symbol sym, Class<T> annotationClass) { return sym == null ? null : sym.getAnnotation(annotationClass); }
java
@Nullable @Deprecated @SuppressWarnings("deprecation") public static <T extends Annotation> T getAnnotation(Symbol sym, Class<T> annotationClass) { return sym == null ? null : sym.getAnnotation(annotationClass); }
[ "@", "Nullable", "@", "Deprecated", "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "<", "T", "extends", "Annotation", ">", "T", "getAnnotation", "(", "Symbol", "sym", ",", "Class", "<", "T", ">", "annotationClass", ")", "{", "retur...
Retrieves an annotation, considering annotation inheritance. @deprecated If {@code annotationClass} contains a member that is a {@code Class} or an array of them, attempting to access that member from the Error Prone checker code will result in a runtime exception. Instead, operate on {@code sym.getAnnotationMirrors()} to meta-syntactically inspect the annotation.
[ "Retrieves", "an", "annotation", "considering", "annotation", "inheritance", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L784-L789
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/strategies/split/MSTSplit.java
MSTSplit.thresholdLength
private static double thresholdLength(double[][] matrix, int[] edges) { double[] lengths = new double[edges.length >> 1]; for(int i = 0, e = edges.length - 1; i < e; i += 2) { lengths[i >> 1] = matrix[edges[i]][edges[i + 1]]; } Arrays.sort(lengths); final int pos = (lengths.length >> 1); // 50% return lengths[pos]; }
java
private static double thresholdLength(double[][] matrix, int[] edges) { double[] lengths = new double[edges.length >> 1]; for(int i = 0, e = edges.length - 1; i < e; i += 2) { lengths[i >> 1] = matrix[edges[i]][edges[i + 1]]; } Arrays.sort(lengths); final int pos = (lengths.length >> 1); // 50% return lengths[pos]; }
[ "private", "static", "double", "thresholdLength", "(", "double", "[", "]", "[", "]", "matrix", ",", "int", "[", "]", "edges", ")", "{", "double", "[", "]", "lengths", "=", "new", "double", "[", "edges", ".", "length", ">>", "1", "]", ";", "for", "(...
Choose the threshold length of edges to consider omittig. @param matrix Distance matrix @param edges Edges @return Distance threshold
[ "Choose", "the", "threshold", "length", "of", "edges", "to", "consider", "omittig", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/strategies/split/MSTSplit.java#L165-L173
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/storage/StorageScopeFile.java
StorageScopeFile.getFolderName
public static String getFolderName(String name, String cfid, boolean addExtension) { if (addExtension) return getFolderName(name, cfid, false) + ".scpt"; if (!StringUtil.isEmpty(name)) name = encode(name);// StringUtil.toVariableName(StringUtil.toLowerCase(name)); else name = "__empty__"; return name + "/" + cfid.substring(0, 2) + "/" + cfid.substring(2); }
java
public static String getFolderName(String name, String cfid, boolean addExtension) { if (addExtension) return getFolderName(name, cfid, false) + ".scpt"; if (!StringUtil.isEmpty(name)) name = encode(name);// StringUtil.toVariableName(StringUtil.toLowerCase(name)); else name = "__empty__"; return name + "/" + cfid.substring(0, 2) + "/" + cfid.substring(2); }
[ "public", "static", "String", "getFolderName", "(", "String", "name", ",", "String", "cfid", ",", "boolean", "addExtension", ")", "{", "if", "(", "addExtension", ")", "return", "getFolderName", "(", "name", ",", "cfid", ",", "false", ")", "+", "\".scpt\"", ...
return a folder name that match given input @param name @param cfid @param addExtension @return
[ "return", "a", "folder", "name", "that", "match", "given", "input" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/storage/StorageScopeFile.java#L164-L169
rometools/rome
rome-fetcher/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java
AbstractFeedFetcher.handleErrorCodes
protected void handleErrorCodes(final int responseCode) throws FetcherException { // Handle 2xx codes as OK, so ignore them here // 3xx codes are handled by the HttpURLConnection class if (responseCode == 403) { // Authentication is required throwAuthenticationError(responseCode); } else if (responseCode >= 400 && responseCode < 500) { throw4XXError(responseCode); } else if (responseCode >= 500 && responseCode < 600) { throw new FetcherException(responseCode, "The server encounted an error. HTTP Response code was:" + responseCode); } }
java
protected void handleErrorCodes(final int responseCode) throws FetcherException { // Handle 2xx codes as OK, so ignore them here // 3xx codes are handled by the HttpURLConnection class if (responseCode == 403) { // Authentication is required throwAuthenticationError(responseCode); } else if (responseCode >= 400 && responseCode < 500) { throw4XXError(responseCode); } else if (responseCode >= 500 && responseCode < 600) { throw new FetcherException(responseCode, "The server encounted an error. HTTP Response code was:" + responseCode); } }
[ "protected", "void", "handleErrorCodes", "(", "final", "int", "responseCode", ")", "throws", "FetcherException", "{", "// Handle 2xx codes as OK, so ignore them here", "// 3xx codes are handled by the HttpURLConnection class", "if", "(", "responseCode", "==", "403", ")", "{", ...
<p> Handles HTTP error codes. </p> @param responseCode the HTTP response code @throws FetcherException if response code is in the range 400 to 599 inclusive
[ "<p", ">", "Handles", "HTTP", "error", "codes", ".", "<", "/", "p", ">" ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-fetcher/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java#L175-L186
meertensinstituut/mtas
src/main/java/mtas/codec/util/collector/MtasDataCollector.java
MtasDataCollector.sortedAndUnique
private boolean sortedAndUnique(String[] keyList, int size) throws IOException { if (!closed) { for (int i = 1; i < size; i++) { if (keyList[(i - 1)].compareTo(keyList[i]) >= 0) { return false; } } return true; } else { throw new IOException("already closed"); } }
java
private boolean sortedAndUnique(String[] keyList, int size) throws IOException { if (!closed) { for (int i = 1; i < size; i++) { if (keyList[(i - 1)].compareTo(keyList[i]) >= 0) { return false; } } return true; } else { throw new IOException("already closed"); } }
[ "private", "boolean", "sortedAndUnique", "(", "String", "[", "]", "keyList", ",", "int", "size", ")", "throws", "IOException", "{", "if", "(", "!", "closed", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<", "size", ";", "i", "++", ")", ...
Sorted and unique. @param keyList the key list @param size the size @return true, if successful @throws IOException Signals that an I/O exception has occurred.
[ "Sorted", "and", "unique", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/collector/MtasDataCollector.java#L1041-L1053
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java
FlatFileUtils.trimRight
public static String trimRight( String string, char c ) { for( int i = string.length(); i > 0; --i ) { char charAt = string.charAt( i - 1 ); if( charAt != c && charAt != ' ' && charAt != '\t' && charAt != '\n' && charAt != '\r' ) { return i == string.length() ? string : string.substring( 0, i ); } } return ""; }
java
public static String trimRight( String string, char c ) { for( int i = string.length(); i > 0; --i ) { char charAt = string.charAt( i - 1 ); if( charAt != c && charAt != ' ' && charAt != '\t' && charAt != '\n' && charAt != '\r' ) { return i == string.length() ? string : string.substring( 0, i ); } } return ""; }
[ "public", "static", "String", "trimRight", "(", "String", "string", ",", "char", "c", ")", "{", "for", "(", "int", "i", "=", "string", ".", "length", "(", ")", ";", "i", ">", "0", ";", "--", "i", ")", "{", "char", "charAt", "=", "string", ".", ...
Removes all whitespace characters and instances of the given character from the end of the string.
[ "Removes", "all", "whitespace", "characters", "and", "instances", "of", "the", "given", "character", "from", "the", "end", "of", "the", "string", "." ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L123-L140
kikinteractive/ice
ice/src/main/java/com/kik/config/ice/ConfigSystem.java
ConfigSystem.overrideModule
public static <C> Module overrideModule( final Class<C> configInterface, final Named name, final OverrideConsumer<C> overrideConsumer) { return overrideModule(configInterface, Optional.of(name), overrideConsumer); }
java
public static <C> Module overrideModule( final Class<C> configInterface, final Named name, final OverrideConsumer<C> overrideConsumer) { return overrideModule(configInterface, Optional.of(name), overrideConsumer); }
[ "public", "static", "<", "C", ">", "Module", "overrideModule", "(", "final", "Class", "<", "C", ">", "configInterface", ",", "final", "Named", "name", ",", "final", "OverrideConsumer", "<", "C", ">", "overrideConsumer", ")", "{", "return", "overrideModule", ...
Generates a Guice Module for use with Injector creation. The module created is intended to be used in a <code>Modules.override</code> manner, to produce overrides for static configuration. @param configInterface The configuration interface type for which values are to be overridden @param name Named annotation to provide an arbitrary scope for the configuration interface. Needs to match the corresponding name used in the ConfigModule being overridden @param overrideConsumer a lambda which is given an instance of {@link OverrideModule} which can be used to build type-safe overrides @param <C> The configuration interface type @return a module to install in your Guice Injector positioned to override an earlier module created via {@link #configModule(Class, Named)}
[ "Generates", "a", "Guice", "Module", "for", "use", "with", "Injector", "creation", ".", "The", "module", "created", "is", "intended", "to", "be", "used", "in", "a", "<code", ">", "Modules", ".", "override<", "/", "code", ">", "manner", "to", "produce", "...
train
https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/ConfigSystem.java#L189-L195
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java
JobStepsInner.getAsync
public Observable<JobStepInner> getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).map(new Func1<ServiceResponse<JobStepInner>, JobStepInner>() { @Override public JobStepInner call(ServiceResponse<JobStepInner> response) { return response.body(); } }); }
java
public Observable<JobStepInner> getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).map(new Func1<ServiceResponse<JobStepInner>, JobStepInner>() { @Override public JobStepInner call(ServiceResponse<JobStepInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobStepInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "jobName", ",", "String", "stepName", ")", "{", "return", "getWithServiceResponseAsync", "(",...
Gets a job step in a job's current version. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param jobAgentName The name of the job agent. @param jobName The name of the job. @param stepName The name of the job step. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobStepInner object
[ "Gets", "a", "job", "step", "in", "a", "job", "s", "current", "version", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java#L536-L543
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java
AsyncDispatcher.deliverAsyncEvent
void deliverAsyncEvent(final EntryEvent<K,V> _event) { if (asyncListenerByType.get(_event.getEventType()).isEmpty()) { return; } List<Listener<K,V>> _listeners = new ArrayList<Listener<K, V>>(asyncListenerByType.get(_event.getEventType())); if (_listeners.isEmpty()) { return; } K key = _event.getKey(); synchronized (getLockObject(key)) { Queue<EntryEvent<K,V>> q = keyQueue.get(key); if (q != null) { q.add(_event); return; } q = new LinkedList<EntryEvent<K, V>>(); keyQueue.put(key, q); } runAllListenersInParallel(_event, _listeners); }
java
void deliverAsyncEvent(final EntryEvent<K,V> _event) { if (asyncListenerByType.get(_event.getEventType()).isEmpty()) { return; } List<Listener<K,V>> _listeners = new ArrayList<Listener<K, V>>(asyncListenerByType.get(_event.getEventType())); if (_listeners.isEmpty()) { return; } K key = _event.getKey(); synchronized (getLockObject(key)) { Queue<EntryEvent<K,V>> q = keyQueue.get(key); if (q != null) { q.add(_event); return; } q = new LinkedList<EntryEvent<K, V>>(); keyQueue.put(key, q); } runAllListenersInParallel(_event, _listeners); }
[ "void", "deliverAsyncEvent", "(", "final", "EntryEvent", "<", "K", ",", "V", ">", "_event", ")", "{", "if", "(", "asyncListenerByType", ".", "get", "(", "_event", ".", "getEventType", "(", ")", ")", ".", "isEmpty", "(", ")", ")", "{", "return", ";", ...
If listeners are registered for this event type, run the listeners or queue the event, if already something is happening for this key.
[ "If", "listeners", "are", "registered", "for", "this", "event", "type", "run", "the", "listeners", "or", "queue", "the", "event", "if", "already", "something", "is", "happening", "for", "this", "key", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/event/AsyncDispatcher.java#L118-L138
HubSpot/Singularity
SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java
SingularityClient.getRequestGroups
public Collection<SingularityRequestGroup> getRequestGroups() { final Function<String, String> requestUri = (host) -> String.format(REQUEST_GROUPS_FORMAT, getApiBase(host)); return getCollection(requestUri, "request groups", REQUEST_GROUP_COLLECTION); }
java
public Collection<SingularityRequestGroup> getRequestGroups() { final Function<String, String> requestUri = (host) -> String.format(REQUEST_GROUPS_FORMAT, getApiBase(host)); return getCollection(requestUri, "request groups", REQUEST_GROUP_COLLECTION); }
[ "public", "Collection", "<", "SingularityRequestGroup", ">", "getRequestGroups", "(", ")", "{", "final", "Function", "<", "String", ",", "String", ">", "requestUri", "=", "(", "host", ")", "-", ">", "String", ".", "format", "(", "REQUEST_GROUPS_FORMAT", ",", ...
Retrieve the list of request groups @return A collection of {@link SingularityRequestGroup}
[ "Retrieve", "the", "list", "of", "request", "groups" ]
train
https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L1388-L1392
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java
RoaringBitmap.isHammingSimilar
public boolean isHammingSimilar(RoaringBitmap other, int tolerance) { final int size1 = highLowContainer.size(); final int size2 = other.highLowContainer.size(); int pos1 = 0; int pos2 = 0; int budget = tolerance; while(budget >= 0 && pos1 < size1 && pos2 < size2) { final short key1 = this.highLowContainer.getKeyAtIndex(pos1); final short key2 = other.highLowContainer.getKeyAtIndex(pos2); Container left = highLowContainer.getContainerAtIndex(pos1); Container right = other.highLowContainer.getContainerAtIndex(pos2); if(key1 == key2) { budget -= left.xorCardinality(right); ++pos1; ++pos2; } else if(Util.compareUnsigned(key1, key2) < 0) { budget -= left.getCardinality(); ++pos1; } else { budget -= right.getCardinality(); ++pos2; } } while(budget >= 0 && pos1 < size1) { Container container = highLowContainer.getContainerAtIndex(pos1++); budget -= container.getCardinality(); } while(budget >= 0 && pos2 < size2) { Container container = other.highLowContainer.getContainerAtIndex(pos2++); budget -= container.getCardinality(); } return budget >= 0; }
java
public boolean isHammingSimilar(RoaringBitmap other, int tolerance) { final int size1 = highLowContainer.size(); final int size2 = other.highLowContainer.size(); int pos1 = 0; int pos2 = 0; int budget = tolerance; while(budget >= 0 && pos1 < size1 && pos2 < size2) { final short key1 = this.highLowContainer.getKeyAtIndex(pos1); final short key2 = other.highLowContainer.getKeyAtIndex(pos2); Container left = highLowContainer.getContainerAtIndex(pos1); Container right = other.highLowContainer.getContainerAtIndex(pos2); if(key1 == key2) { budget -= left.xorCardinality(right); ++pos1; ++pos2; } else if(Util.compareUnsigned(key1, key2) < 0) { budget -= left.getCardinality(); ++pos1; } else { budget -= right.getCardinality(); ++pos2; } } while(budget >= 0 && pos1 < size1) { Container container = highLowContainer.getContainerAtIndex(pos1++); budget -= container.getCardinality(); } while(budget >= 0 && pos2 < size2) { Container container = other.highLowContainer.getContainerAtIndex(pos2++); budget -= container.getCardinality(); } return budget >= 0; }
[ "public", "boolean", "isHammingSimilar", "(", "RoaringBitmap", "other", ",", "int", "tolerance", ")", "{", "final", "int", "size1", "=", "highLowContainer", ".", "size", "(", ")", ";", "final", "int", "size2", "=", "other", ".", "highLowContainer", ".", "siz...
Returns true if the other bitmap has no more than tolerance bits differing from this bitmap. The other may be transformed into a bitmap equal to this bitmap in no more than tolerance bit flips if this method returns true. @param other the bitmap to compare to @param tolerance the maximum number of bits that may differ @return true if the number of differing bits is smaller than tolerance
[ "Returns", "true", "if", "the", "other", "bitmap", "has", "no", "more", "than", "tolerance", "bits", "differing", "from", "this", "bitmap", ".", "The", "other", "may", "be", "transformed", "into", "a", "bitmap", "equal", "to", "this", "bitmap", "in", "no",...
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java#L1515-L1547
hawkular/hawkular-apm
client/opentracing/src/main/java/org/hawkular/apm/client/opentracing/TraceContext.java
TraceContext.initTraceState
public void initTraceState(Map<String, Object> state) { Object traceId = state.get(Constants.HAWKULAR_APM_TRACEID); Object transaction = state.get(Constants.HAWKULAR_APM_TXN); Object level = state.get(Constants.HAWKULAR_APM_LEVEL); if (traceId != null) { setTraceId(traceId.toString()); } else { log.severe("Trace id has not been propagated"); } if (transaction != null) { setTransaction(transaction.toString()); } if (level != null) { setReportingLevel(ReportingLevel.valueOf(level.toString())); } }
java
public void initTraceState(Map<String, Object> state) { Object traceId = state.get(Constants.HAWKULAR_APM_TRACEID); Object transaction = state.get(Constants.HAWKULAR_APM_TXN); Object level = state.get(Constants.HAWKULAR_APM_LEVEL); if (traceId != null) { setTraceId(traceId.toString()); } else { log.severe("Trace id has not been propagated"); } if (transaction != null) { setTransaction(transaction.toString()); } if (level != null) { setReportingLevel(ReportingLevel.valueOf(level.toString())); } }
[ "public", "void", "initTraceState", "(", "Map", "<", "String", ",", "Object", ">", "state", ")", "{", "Object", "traceId", "=", "state", ".", "get", "(", "Constants", ".", "HAWKULAR_APM_TRACEID", ")", ";", "Object", "transaction", "=", "state", ".", "get",...
Initialise the trace state from the supplied state. @param state The propagated state
[ "Initialise", "the", "trace", "state", "from", "the", "supplied", "state", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/opentracing/src/main/java/org/hawkular/apm/client/opentracing/TraceContext.java#L211-L226
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java
MessageSetImpl.getMessagesBeforeUntil
public static CompletableFuture<MessageSet> getMessagesBeforeUntil( TextChannel channel, Predicate<Message> condition, long before) { return getMessagesUntil(channel, condition, before, -1); }
java
public static CompletableFuture<MessageSet> getMessagesBeforeUntil( TextChannel channel, Predicate<Message> condition, long before) { return getMessagesUntil(channel, condition, before, -1); }
[ "public", "static", "CompletableFuture", "<", "MessageSet", ">", "getMessagesBeforeUntil", "(", "TextChannel", "channel", ",", "Predicate", "<", "Message", ">", "condition", ",", "long", "before", ")", "{", "return", "getMessagesUntil", "(", "channel", ",", "condi...
Gets messages in the given channel before a given message in any channel until one that meets the given condition is found. If no message matches the condition, an empty set is returned. @param channel The channel of the messages. @param condition The abort condition for when to stop retrieving messages. @param before Get messages before the message with this id. @return The messages. @see #getMessagesBeforeAsStream(TextChannel, long)
[ "Gets", "messages", "in", "the", "given", "channel", "before", "a", "given", "message", "in", "any", "channel", "until", "one", "that", "meets", "the", "given", "condition", "is", "found", ".", "If", "no", "message", "matches", "the", "condition", "an", "e...
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java#L331-L334
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/Database.java
Database.findOptionalDouble
public @NotNull OptionalDouble findOptionalDouble(@NotNull @SQL String sql, Object... args) { return findOptionalDouble(SqlQuery.query(sql, args)); }
java
public @NotNull OptionalDouble findOptionalDouble(@NotNull @SQL String sql, Object... args) { return findOptionalDouble(SqlQuery.query(sql, args)); }
[ "public", "@", "NotNull", "OptionalDouble", "findOptionalDouble", "(", "@", "NotNull", "@", "SQL", "String", "sql", ",", "Object", "...", "args", ")", "{", "return", "findOptionalDouble", "(", "SqlQuery", ".", "query", "(", "sql", ",", "args", ")", ")", ";...
Finds a unique result from database, converting the database row to double using default mechanisms. Returns empty if there are no results or if single null result is returned. @throws NonUniqueResultException if there are multiple result rows
[ "Finds", "a", "unique", "result", "from", "database", "converting", "the", "database", "row", "to", "double", "using", "default", "mechanisms", ".", "Returns", "empty", "if", "there", "are", "no", "results", "or", "if", "single", "null", "result", "is", "ret...
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L454-L456
google/auto
service/processor/src/main/java/com/google/auto/service/processor/ServicesFiles.java
ServicesFiles.readServiceFile
static Set<String> readServiceFile(InputStream input) throws IOException { HashSet<String> serviceClasses = new HashSet<String>(); Closer closer = Closer.create(); try { // TODO(gak): use CharStreams BufferedReader r = closer.register(new BufferedReader(new InputStreamReader(input, UTF_8))); String line; while ((line = r.readLine()) != null) { int commentStart = line.indexOf('#'); if (commentStart >= 0) { line = line.substring(0, commentStart); } line = line.trim(); if (!line.isEmpty()) { serviceClasses.add(line); } } return serviceClasses; } catch (Throwable t) { throw closer.rethrow(t); } finally { closer.close(); } }
java
static Set<String> readServiceFile(InputStream input) throws IOException { HashSet<String> serviceClasses = new HashSet<String>(); Closer closer = Closer.create(); try { // TODO(gak): use CharStreams BufferedReader r = closer.register(new BufferedReader(new InputStreamReader(input, UTF_8))); String line; while ((line = r.readLine()) != null) { int commentStart = line.indexOf('#'); if (commentStart >= 0) { line = line.substring(0, commentStart); } line = line.trim(); if (!line.isEmpty()) { serviceClasses.add(line); } } return serviceClasses; } catch (Throwable t) { throw closer.rethrow(t); } finally { closer.close(); } }
[ "static", "Set", "<", "String", ">", "readServiceFile", "(", "InputStream", "input", ")", "throws", "IOException", "{", "HashSet", "<", "String", ">", "serviceClasses", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "Closer", "closer", "=", "Clo...
Reads the set of service classes from a service file. @param input not {@code null}. Closed after use. @return a not {@code null Set} of service class names. @throws IOException
[ "Reads", "the", "set", "of", "service", "classes", "from", "a", "service", "file", "." ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/service/processor/src/main/java/com/google/auto/service/processor/ServicesFiles.java#L58-L81
iron-io/iron_mq_java
src/main/java/io/iron/ironmq/Queue.java
Queue.deleteMessage
public void deleteMessage(String id, String reservationId) throws IOException { deleteMessage(id, reservationId, null); }
java
public void deleteMessage(String id, String reservationId) throws IOException { deleteMessage(id, reservationId, null); }
[ "public", "void", "deleteMessage", "(", "String", "id", ",", "String", "reservationId", ")", "throws", "IOException", "{", "deleteMessage", "(", "id", ",", "reservationId", ",", "null", ")", ";", "}" ]
Deletes a Message from the queue. @param id The ID of the message to delete. @param reservationId Reservation Id of the message. Reserved message could not be deleted without reservation Id. @throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK. @throws java.io.IOException If there is an error accessing the IronMQ server.
[ "Deletes", "a", "Message", "from", "the", "queue", "." ]
train
https://github.com/iron-io/iron_mq_java/blob/62d6a86545ca7ef31b7b4797aae0c5b31394a507/src/main/java/io/iron/ironmq/Queue.java#L281-L283
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/PairtreeFactory.java
PairtreeFactory.getPrefixedPairtree
public Pairtree getPrefixedPairtree(final String aPrefix, final String aBucket, final String aBucketPath, final String aAccessKey, final String aSecretKey) { return new S3Pairtree(aPrefix, myVertx, aBucket, aBucketPath, aAccessKey, aSecretKey); }
java
public Pairtree getPrefixedPairtree(final String aPrefix, final String aBucket, final String aBucketPath, final String aAccessKey, final String aSecretKey) { return new S3Pairtree(aPrefix, myVertx, aBucket, aBucketPath, aAccessKey, aSecretKey); }
[ "public", "Pairtree", "getPrefixedPairtree", "(", "final", "String", "aPrefix", ",", "final", "String", "aBucket", ",", "final", "String", "aBucketPath", ",", "final", "String", "aAccessKey", ",", "final", "String", "aSecretKey", ")", "{", "return", "new", "S3Pa...
Creates a Pairtree, with the supplied prefix, using the supplied S3 bucket and internal bucket path. @param aPrefix A Pairtree prefix @param aBucket An S3 bucket @param aBucketPath A path in the S3 bucket to the Pairtree root @param aAccessKey An AWS access key @param aSecretKey An AWS secret key @return A Pairtree
[ "Creates", "a", "Pairtree", "with", "the", "supplied", "prefix", "using", "the", "supplied", "S3", "bucket", "and", "internal", "bucket", "path", "." ]
train
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/PairtreeFactory.java#L274-L277
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/PerplexityAffinityMatrixBuilder.java
PerplexityAffinityMatrixBuilder.estimateInitialBeta
protected static double estimateInitialBeta(double[] dist_i, double perplexity) { double sum = 0.; for(double d : dist_i) { double d2 = d * d; sum += d2 < Double.POSITIVE_INFINITY ? d2 : 0.; } return sum > 0 && sum < Double.POSITIVE_INFINITY ? .5 / sum * perplexity * (dist_i.length - 1.) : 1.; }
java
protected static double estimateInitialBeta(double[] dist_i, double perplexity) { double sum = 0.; for(double d : dist_i) { double d2 = d * d; sum += d2 < Double.POSITIVE_INFINITY ? d2 : 0.; } return sum > 0 && sum < Double.POSITIVE_INFINITY ? .5 / sum * perplexity * (dist_i.length - 1.) : 1.; }
[ "protected", "static", "double", "estimateInitialBeta", "(", "double", "[", "]", "dist_i", ",", "double", "perplexity", ")", "{", "double", "sum", "=", "0.", ";", "for", "(", "double", "d", ":", "dist_i", ")", "{", "double", "d2", "=", "d", "*", "d", ...
Estimate beta from the distances in a row. This lacks a mathematical argument, but is a handcrafted heuristic to avoid numerical problems. The average distance is usually too large, so we scale the average distance by 2*N/perplexity. Then estimate beta as 1/x. @param dist_i Distances @param perplexity Desired perplexity @return Estimated beta.
[ "Estimate", "beta", "from", "the", "distances", "in", "a", "row", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/PerplexityAffinityMatrixBuilder.java#L206-L213
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/XPathContext.java
XPathContext.add1OrIncrement
private static int add1OrIncrement(String name, Map<String, Integer> map) { Integer old = map.get(name); int index = old == null ? 1 : old.intValue() + 1; map.put(name, Integer.valueOf(index)); return index; }
java
private static int add1OrIncrement(String name, Map<String, Integer> map) { Integer old = map.get(name); int index = old == null ? 1 : old.intValue() + 1; map.put(name, Integer.valueOf(index)); return index; }
[ "private", "static", "int", "add1OrIncrement", "(", "String", "name", ",", "Map", "<", "String", ",", "Integer", ">", "map", ")", "{", "Integer", "old", "=", "map", ".", "get", "(", "name", ")", ";", "int", "index", "=", "old", "==", "null", "?", "...
Increments the value name maps to or adds 1 as value if name isn't present inside the map. @return the new mapping for name
[ "Increments", "the", "value", "name", "maps", "to", "or", "adds", "1", "as", "value", "if", "name", "isn", "t", "present", "inside", "the", "map", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/XPathContext.java#L260-L265
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java
JarWriter.writeLoaderClasses
@Override public void writeLoaderClasses(String loaderJarResourceName) throws IOException { URL loaderJar = getClass().getClassLoader().getResource(loaderJarResourceName); try (JarInputStream inputStream = new JarInputStream( new BufferedInputStream(loaderJar.openStream()))) { JarEntry entry; while ((entry = inputStream.getNextJarEntry()) != null) { if (entry.getName().endsWith(".class")) { writeEntry(new JarArchiveEntry(entry), new InputStreamEntryWriter(inputStream, false)); } } } }
java
@Override public void writeLoaderClasses(String loaderJarResourceName) throws IOException { URL loaderJar = getClass().getClassLoader().getResource(loaderJarResourceName); try (JarInputStream inputStream = new JarInputStream( new BufferedInputStream(loaderJar.openStream()))) { JarEntry entry; while ((entry = inputStream.getNextJarEntry()) != null) { if (entry.getName().endsWith(".class")) { writeEntry(new JarArchiveEntry(entry), new InputStreamEntryWriter(inputStream, false)); } } } }
[ "@", "Override", "public", "void", "writeLoaderClasses", "(", "String", "loaderJarResourceName", ")", "throws", "IOException", "{", "URL", "loaderJar", "=", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "getResource", "(", "loaderJarResourceName", ")...
Write the required spring-boot-loader classes to the JAR. @param loaderJarResourceName the name of the resource containing the loader classes to be written @throws IOException if the classes cannot be written
[ "Write", "the", "required", "spring", "-", "boot", "-", "loader", "classes", "to", "the", "JAR", "." ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java#L222-L235
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/tsv/TSVDriverFunction.java
TSVDriverFunction.exportFromResultSet
public void exportFromResultSet(Connection connection, ResultSet res, File fileName, ProgressVisitor progress, String encoding) throws SQLException { Csv csv = new Csv(); String csvOptions = "charset=UTF-8 fieldSeparator=\t fieldDelimiter=\t"; if (encoding != null) { csvOptions = String.format("charset=%s fieldSeparator=\t fieldDelimiter=\t", encoding); } csv.setOptions(csvOptions); csv.write(fileName.getPath(), res, null); }
java
public void exportFromResultSet(Connection connection, ResultSet res, File fileName, ProgressVisitor progress, String encoding) throws SQLException { Csv csv = new Csv(); String csvOptions = "charset=UTF-8 fieldSeparator=\t fieldDelimiter=\t"; if (encoding != null) { csvOptions = String.format("charset=%s fieldSeparator=\t fieldDelimiter=\t", encoding); } csv.setOptions(csvOptions); csv.write(fileName.getPath(), res, null); }
[ "public", "void", "exportFromResultSet", "(", "Connection", "connection", ",", "ResultSet", "res", ",", "File", "fileName", ",", "ProgressVisitor", "progress", ",", "String", "encoding", ")", "throws", "SQLException", "{", "Csv", "csv", "=", "new", "Csv", "(", ...
Export a resultset to a TSV file @param connection @param res @param fileName @param progress @param encoding @throws java.sql.SQLException
[ "Export", "a", "resultset", "to", "a", "TSV", "file" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/tsv/TSVDriverFunction.java#L152-L160
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/TempDir.java
TempDir.getFile
public File getFile(String relativePath) throws IOException { if (!open.get()) { throw VFSMessages.MESSAGES.tempDirectoryClosed(); } return new File(root, relativePath); }
java
public File getFile(String relativePath) throws IOException { if (!open.get()) { throw VFSMessages.MESSAGES.tempDirectoryClosed(); } return new File(root, relativePath); }
[ "public", "File", "getFile", "(", "String", "relativePath", ")", "throws", "IOException", "{", "if", "(", "!", "open", ".", "get", "(", ")", ")", "{", "throw", "VFSMessages", ".", "MESSAGES", ".", "tempDirectoryClosed", "(", ")", ";", "}", "return", "new...
Get the {@code File} for a relative path. The returned file is only valid as long as the tempdir exists. @param relativePath the relative path @return the corresponding file @throws IOException if the directory was closed at the time of this invocation
[ "Get", "the", "{", "@code", "File", "}", "for", "a", "relative", "path", ".", "The", "returned", "file", "is", "only", "valid", "as", "long", "as", "the", "tempdir", "exists", "." ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/TempDir.java#L65-L70
aws/aws-sdk-java
jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java
JmesPathEvaluationVisitor.visit
@Override public JsonNode visit(JmesPathProjection jmesPathProjection, JsonNode input) throws InvalidTypeException { JsonNode lhsResult = jmesPathProjection.getLhsExpr().accept(this, input); if (lhsResult.isArray()) { Iterator<JsonNode> elements = lhsResult.elements(); ArrayNode projectedArrayNode = ObjectMapperSingleton.getObjectMapper().createArrayNode(); while (elements.hasNext()) { JsonNode projectedElement = jmesPathProjection.getProjectionExpr().accept(this, elements.next()); if (projectedElement != null) { projectedArrayNode.add(projectedElement); } } return projectedArrayNode; } return NullNode.getInstance(); }
java
@Override public JsonNode visit(JmesPathProjection jmesPathProjection, JsonNode input) throws InvalidTypeException { JsonNode lhsResult = jmesPathProjection.getLhsExpr().accept(this, input); if (lhsResult.isArray()) { Iterator<JsonNode> elements = lhsResult.elements(); ArrayNode projectedArrayNode = ObjectMapperSingleton.getObjectMapper().createArrayNode(); while (elements.hasNext()) { JsonNode projectedElement = jmesPathProjection.getProjectionExpr().accept(this, elements.next()); if (projectedElement != null) { projectedArrayNode.add(projectedElement); } } return projectedArrayNode; } return NullNode.getInstance(); }
[ "@", "Override", "public", "JsonNode", "visit", "(", "JmesPathProjection", "jmesPathProjection", ",", "JsonNode", "input", ")", "throws", "InvalidTypeException", "{", "JsonNode", "lhsResult", "=", "jmesPathProjection", ".", "getLhsExpr", "(", ")", ".", "accept", "("...
Evaluates a list projection expression in two steps. The left hand side (LHS) creates a JSON array of initial values. The right hand side (RHS) of a projection is the expression to project for each element in the JSON array created by the left hand side. @param jmesPathProjection JmesPath list projection type @param input Input json node against which evaluation is done @return Result of the projection evaluation @throws InvalidTypeException
[ "Evaluates", "a", "list", "projection", "expression", "in", "two", "steps", ".", "The", "left", "hand", "side", "(", "LHS", ")", "creates", "a", "JSON", "array", "of", "initial", "values", ".", "The", "right", "hand", "side", "(", "RHS", ")", "of", "a"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java#L78-L93
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.transferApp
public void transferApp(String appName, String to) { connection.execute(new SharingTransfer(appName, to), apiKey); }
java
public void transferApp(String appName, String to) { connection.execute(new SharingTransfer(appName, to), apiKey); }
[ "public", "void", "transferApp", "(", "String", "appName", ",", "String", "to", ")", "{", "connection", ".", "execute", "(", "new", "SharingTransfer", "(", "appName", ",", "to", ")", ",", "apiKey", ")", ";", "}" ]
Transfer the ownership of an application to another user. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param to Username of the person to transfer the app to. This is usually in the form of "user@company.com".
[ "Transfer", "the", "ownership", "of", "an", "application", "to", "another", "user", "." ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L347-L349
Joe0/Feather
src/main/java/com/joepritzel/feather/strategy/publish/Sequential.java
Sequential.predicateApplies
private boolean predicateApplies(Subscriber<?> s, Object message) { if (s instanceof PredicatedSubscriber && !((PredicatedSubscriber<?>) s).appliesO(message)) { return false; } return true; }
java
private boolean predicateApplies(Subscriber<?> s, Object message) { if (s instanceof PredicatedSubscriber && !((PredicatedSubscriber<?>) s).appliesO(message)) { return false; } return true; }
[ "private", "boolean", "predicateApplies", "(", "Subscriber", "<", "?", ">", "s", ",", "Object", "message", ")", "{", "if", "(", "s", "instanceof", "PredicatedSubscriber", "&&", "!", "(", "(", "PredicatedSubscriber", "<", "?", ">", ")", "s", ")", ".", "ap...
Checks to see if the subscriber is a predicated subscriber, and if it applies. @param s - The subscriber to check. @param message - The message to check. @return If the subscriber is not predicated or it is and applies, then it returns true. If it's a predicated subscriber, and it doesn't apply, then it returns false.
[ "Checks", "to", "see", "if", "the", "subscriber", "is", "a", "predicated", "subscriber", "and", "if", "it", "applies", "." ]
train
https://github.com/Joe0/Feather/blob/d17b1bc38326b8b86f1068898a59c8a34678d499/src/main/java/com/joepritzel/feather/strategy/publish/Sequential.java#L111-L117
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java
NetUtil.getInputStreamHttpPost
public static InputStream getInputStreamHttpPost(String pURL, Map pPostData, Properties pProperties, boolean pFollowRedirects, int pTimeout) throws IOException { pProperties = pProperties != null ? pProperties : new Properties(); //URL url = getURLAndRegisterPassword(pURL); URL url = getURLAndSetAuthorization(pURL, pProperties); //unregisterPassword(url); return getInputStreamHttpPost(url, pPostData, pProperties, pFollowRedirects, pTimeout); }
java
public static InputStream getInputStreamHttpPost(String pURL, Map pPostData, Properties pProperties, boolean pFollowRedirects, int pTimeout) throws IOException { pProperties = pProperties != null ? pProperties : new Properties(); //URL url = getURLAndRegisterPassword(pURL); URL url = getURLAndSetAuthorization(pURL, pProperties); //unregisterPassword(url); return getInputStreamHttpPost(url, pPostData, pProperties, pFollowRedirects, pTimeout); }
[ "public", "static", "InputStream", "getInputStreamHttpPost", "(", "String", "pURL", ",", "Map", "pPostData", ",", "Properties", "pProperties", ",", "boolean", "pFollowRedirects", ",", "int", "pTimeout", ")", "throws", "IOException", "{", "pProperties", "=", "pProper...
Gets the InputStream from a given URL, with the given timeout. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout. Supports basic HTTP authentication, using a URL string similar to most browsers. <P/> <SMALL>Implementation note: If the timeout parameter is greater than 0, this method uses my own implementation of java.net.HttpURLConnection, that uses plain sockets, to create an HTTP connection to the given URL. The {@code read} methods called on the returned InputStream, will block only for the specified timeout. If the timeout expires, a java.io.InterruptedIOException is raised. This might happen BEFORE OR AFTER this method returns, as the HTTP headers will be read and parsed from the InputStream before this method returns, while further read operations on the returned InputStream might be performed at a later stage. <BR/> </SMALL> @param pURL the URL to get. @param pPostData the post data. @param pProperties the request header properties. @param pFollowRedirects specifying wether redirects should be followed. @param pTimeout the specified timeout, in milliseconds. @return an input stream that reads from the socket connection, created from the given URL. @throws MalformedURLException if the url parameter specifies an unknown protocol, or does not form a valid URL. @throws UnknownHostException if the IP address for the given URL cannot be resolved. @throws FileNotFoundException if there is no file at the given URL. @throws IOException if an error occurs during transfer.
[ "Gets", "the", "InputStream", "from", "a", "given", "URL", "with", "the", "given", "timeout", ".", "The", "timeout", "must", "be", ">", "0", ".", "A", "timeout", "of", "zero", "is", "interpreted", "as", "an", "infinite", "timeout", ".", "Supports", "basi...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java#L757-L767
looly/hutool
hutool-db/src/main/java/cn/hutool/db/Entity.java
Entity.getStr
public String getStr(String field, Charset charset) { final Object obj = get(field); if (obj instanceof Clob) { return SqlUtil.clobToStr((Clob) obj); } else if (obj instanceof Blob) { return SqlUtil.blobToStr((Blob) obj, charset); } else if (obj instanceof RowId) { final RowId rowId = (RowId) obj; return StrUtil.str(rowId.getBytes(), charset); } return super.getStr(field); }
java
public String getStr(String field, Charset charset) { final Object obj = get(field); if (obj instanceof Clob) { return SqlUtil.clobToStr((Clob) obj); } else if (obj instanceof Blob) { return SqlUtil.blobToStr((Blob) obj, charset); } else if (obj instanceof RowId) { final RowId rowId = (RowId) obj; return StrUtil.str(rowId.getBytes(), charset); } return super.getStr(field); }
[ "public", "String", "getStr", "(", "String", "field", ",", "Charset", "charset", ")", "{", "final", "Object", "obj", "=", "get", "(", "field", ")", ";", "if", "(", "obj", "instanceof", "Clob", ")", "{", "return", "SqlUtil", ".", "clobToStr", "(", "(", ...
获得字符串值<br> 支持Clob、Blob、RowId @param field 字段名 @param charset 编码 @return 字段对应值 @since 3.0.6
[ "获得字符串值<br", ">", "支持Clob、Blob、RowId" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Entity.java#L333-L344
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java
ControlBean.getControlService
protected Object getControlService(Class serviceClass, Object selector) throws TooManyListenersException { // // Get the associated context object, then use it to locate the (parent) bean context. // Services are always provided by the parent context. // ControlBeanContext cbc = getControlBeanContext(); BeanContext bc = cbc.getBeanContext(); if (bc == null || !(bc instanceof BeanContextServices)) throw new ControlException("Can't locate service context: " + bc); // // Call getService on the parent context, using this bean as the requestor and the // associated peer context instance as the child and event listener parameters. // return ((BeanContextServices)bc).getService(cbc, this, serviceClass, selector, cbc); }
java
protected Object getControlService(Class serviceClass, Object selector) throws TooManyListenersException { // // Get the associated context object, then use it to locate the (parent) bean context. // Services are always provided by the parent context. // ControlBeanContext cbc = getControlBeanContext(); BeanContext bc = cbc.getBeanContext(); if (bc == null || !(bc instanceof BeanContextServices)) throw new ControlException("Can't locate service context: " + bc); // // Call getService on the parent context, using this bean as the requestor and the // associated peer context instance as the child and event listener parameters. // return ((BeanContextServices)bc).getService(cbc, this, serviceClass, selector, cbc); }
[ "protected", "Object", "getControlService", "(", "Class", "serviceClass", ",", "Object", "selector", ")", "throws", "TooManyListenersException", "{", "//", "// Get the associated context object, then use it to locate the (parent) bean context.", "// Services are always provided by the ...
Locates and obtains a context service from the BeanContextServices instance supporting this bean. The base design for the BeanContextServicesSupport is that it will delegate up to peers in a nesting context, so a nested control bean will look 'up' to find a service provider.
[ "Locates", "and", "obtains", "a", "context", "service", "from", "the", "BeanContextServices", "instance", "supporting", "this", "bean", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L615-L633
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.addModificationObserver
public void addModificationObserver (String path, ModificationObserver obs) { ObservedResource resource = _observed.get(path); if (resource == null) { File file = getResourceFile(path); if (file == null) { return; // only resource files will ever be modified } _observed.put(path, resource = new ObservedResource(file)); } resource.observers.add(obs); }
java
public void addModificationObserver (String path, ModificationObserver obs) { ObservedResource resource = _observed.get(path); if (resource == null) { File file = getResourceFile(path); if (file == null) { return; // only resource files will ever be modified } _observed.put(path, resource = new ObservedResource(file)); } resource.observers.add(obs); }
[ "public", "void", "addModificationObserver", "(", "String", "path", ",", "ModificationObserver", "obs", ")", "{", "ObservedResource", "resource", "=", "_observed", ".", "get", "(", "path", ")", ";", "if", "(", "resource", "==", "null", ")", "{", "File", "fil...
Adds a modification observer for the specified resource. Note that only a weak reference to the observer will be retained, and thus this will not prevent the observer from being garbage-collected.
[ "Adds", "a", "modification", "observer", "for", "the", "specified", "resource", ".", "Note", "that", "only", "a", "weak", "reference", "to", "the", "observer", "will", "be", "retained", "and", "thus", "this", "will", "not", "prevent", "the", "observer", "fro...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L727-L738
Stratio/stratio-cassandra
src/java/org/apache/cassandra/cli/CliClient.java
CliClient.updateColumnMetaData
private void updateColumnMetaData(CfDef columnFamily, ByteBuffer columnName, String validationClass) { ColumnDef column = getColumnDefByName(columnFamily, columnName); if (column != null) { // if validation class is the same - no need to modify it if (column.getValidation_class().equals(validationClass)) return; // updating column definition with new validation_class column.setValidation_class(validationClass); } else { List<ColumnDef> columnMetaData = new ArrayList<ColumnDef>(columnFamily.getColumn_metadata()); columnMetaData.add(new ColumnDef(columnName, validationClass)); columnFamily.setColumn_metadata(columnMetaData); } }
java
private void updateColumnMetaData(CfDef columnFamily, ByteBuffer columnName, String validationClass) { ColumnDef column = getColumnDefByName(columnFamily, columnName); if (column != null) { // if validation class is the same - no need to modify it if (column.getValidation_class().equals(validationClass)) return; // updating column definition with new validation_class column.setValidation_class(validationClass); } else { List<ColumnDef> columnMetaData = new ArrayList<ColumnDef>(columnFamily.getColumn_metadata()); columnMetaData.add(new ColumnDef(columnName, validationClass)); columnFamily.setColumn_metadata(columnMetaData); } }
[ "private", "void", "updateColumnMetaData", "(", "CfDef", "columnFamily", ",", "ByteBuffer", "columnName", ",", "String", "validationClass", ")", "{", "ColumnDef", "column", "=", "getColumnDefByName", "(", "columnFamily", ",", "columnName", ")", ";", "if", "(", "co...
Used to locally update column family definition with new column metadata @param columnFamily - CfDef record @param columnName - column name represented as byte[] @param validationClass - value validation class
[ "Used", "to", "locally", "update", "column", "family", "definition", "with", "new", "column", "metadata" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2850-L2869
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/launchable/LauncherConfig.java
LauncherConfig.imports
public static LauncherConfig imports(Xml node) { Check.notNull(node); final Collection<Xml> children = node.getChildren(LaunchableConfig.NODE_LAUNCHABLE); final Collection<LaunchableConfig> launchables = new ArrayList<>(children.size()); for (final Xml launchable : children) { launchables.add(LaunchableConfig.imports(launchable)); } final int level = node.readInteger(0, ATT_RATE); final int rate = node.readInteger(ATT_RATE); return new LauncherConfig(level, rate, launchables); }
java
public static LauncherConfig imports(Xml node) { Check.notNull(node); final Collection<Xml> children = node.getChildren(LaunchableConfig.NODE_LAUNCHABLE); final Collection<LaunchableConfig> launchables = new ArrayList<>(children.size()); for (final Xml launchable : children) { launchables.add(LaunchableConfig.imports(launchable)); } final int level = node.readInteger(0, ATT_RATE); final int rate = node.readInteger(ATT_RATE); return new LauncherConfig(level, rate, launchables); }
[ "public", "static", "LauncherConfig", "imports", "(", "Xml", "node", ")", "{", "Check", ".", "notNull", "(", "node", ")", ";", "final", "Collection", "<", "Xml", ">", "children", "=", "node", ".", "getChildren", "(", "LaunchableConfig", ".", "NODE_LAUNCHABLE...
Import the launcher data from node. @param node The node reference (must not be <code>null</code>). @return The launcher data. @throws LionEngineException If unable to read node.
[ "Import", "the", "launcher", "data", "from", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/launchable/LauncherConfig.java#L78-L94
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/IOUtil.java
IOUtil.initFullEnumMap
public static <T extends Enum<T> & HeaderKey> Map<T, StandardField> initFullEnumMap( Class<T> clazz) { Map<T, StandardField> map = new EnumMap<>(clazz); // loop through all values of the Enum type and add a dummy field for (T key : clazz.getEnumConstants()) { // TODO init correct description string StandardField dummy = new StandardField(key, "not set", 0L, 0L, 0L); map.put(key, dummy); } assert map != null; return map; }
java
public static <T extends Enum<T> & HeaderKey> Map<T, StandardField> initFullEnumMap( Class<T> clazz) { Map<T, StandardField> map = new EnumMap<>(clazz); // loop through all values of the Enum type and add a dummy field for (T key : clazz.getEnumConstants()) { // TODO init correct description string StandardField dummy = new StandardField(key, "not set", 0L, 0L, 0L); map.put(key, dummy); } assert map != null; return map; }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", "&", "HeaderKey", ">", "Map", "<", "T", ",", "StandardField", ">", "initFullEnumMap", "(", "Class", "<", "T", ">", "clazz", ")", "{", "Map", "<", "T", ",", "StandardField", ">", "map", ...
Initialized a map containing all keys of the Enum T as map-key and default StandardFields as map-value. <p> Ensures that no null value is returned. @return the fully initialized map
[ "Initialized", "a", "map", "containing", "all", "keys", "of", "the", "Enum", "T", "as", "map", "-", "key", "and", "default", "StandardFields", "as", "map", "-", "value", ".", "<p", ">", "Ensures", "that", "no", "null", "value", "is", "returned", "." ]
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/IOUtil.java#L338-L349
HubSpot/Singularity
SingularityService/src/main/java/com/hubspot/singularity/mesos/SingularityMesosSchedulerClient.java
SingularityMesosSchedulerClient.subscribe
public void subscribe(URI mesosMasterURI, SingularityMesosScheduler scheduler) throws URISyntaxException { FrameworkInfo frameworkInfo = buildFrameworkInfo(); if (mesosMasterURI == null || mesosMasterURI.getScheme().contains("zk")) { throw new IllegalArgumentException(String.format("Must use master address for http api (e.g. http://localhost:5050/api/v1/scheduler) was %s", mesosMasterURI)); } if (openStream == null || openStream.isUnsubscribed()) { // Do we get here ever? if (subscriberThread != null) { subscriberThread.interrupt(); } subscriberThread = new Thread() { public void run() { try { connect(mesosMasterURI, frameworkInfo, scheduler); } catch (RuntimeException|URISyntaxException e) { LOG.error("Could not connect: ", e); scheduler.onConnectException(e); } } }; subscriberThread.start(); } }
java
public void subscribe(URI mesosMasterURI, SingularityMesosScheduler scheduler) throws URISyntaxException { FrameworkInfo frameworkInfo = buildFrameworkInfo(); if (mesosMasterURI == null || mesosMasterURI.getScheme().contains("zk")) { throw new IllegalArgumentException(String.format("Must use master address for http api (e.g. http://localhost:5050/api/v1/scheduler) was %s", mesosMasterURI)); } if (openStream == null || openStream.isUnsubscribed()) { // Do we get here ever? if (subscriberThread != null) { subscriberThread.interrupt(); } subscriberThread = new Thread() { public void run() { try { connect(mesosMasterURI, frameworkInfo, scheduler); } catch (RuntimeException|URISyntaxException e) { LOG.error("Could not connect: ", e); scheduler.onConnectException(e); } } }; subscriberThread.start(); } }
[ "public", "void", "subscribe", "(", "URI", "mesosMasterURI", ",", "SingularityMesosScheduler", "scheduler", ")", "throws", "URISyntaxException", "{", "FrameworkInfo", "frameworkInfo", "=", "buildFrameworkInfo", "(", ")", ";", "if", "(", "mesosMasterURI", "==", "null",...
The first call to mesos, needed to setup connection properly and identify a framework. @throws URISyntaxException if the URL provided was not a syntactically correct URL.
[ "The", "first", "call", "to", "mesos", "needed", "to", "setup", "connection", "properly", "and", "identify", "a", "framework", "." ]
train
https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityService/src/main/java/com/hubspot/singularity/mesos/SingularityMesosSchedulerClient.java#L84-L112