repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/schema/program/esjp/ESJPCompiler.java
ESJPCompiler.readESJPPrograms
protected void readESJPPrograms() throws InstallationException { try { final QueryBuilder queryBldr = new QueryBuilder(this.esjpType); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute("Name"); multi.executeWithoutAccessCheck(); while (multi.next()) { final String name = multi.<String>getAttribute("Name"); final Long id = multi.getCurrentInstance().getId(); final String path = "/" + name.replaceAll("\\.", Matcher.quoteReplacement("/")) + JavaFileObject.Kind.SOURCE.extension; final URI uri; try { uri = new URI("efaps", null, path, null, null); } catch (final URISyntaxException e) { throw new InstallationException("Could not create an URI for " + path, e); } this.name2Source.put(name, new SourceObject(uri, name, id)); } } catch (final EFapsException e) { throw new InstallationException("Could not fetch the information about installed ESJP's", e); } }
java
protected void readESJPPrograms() throws InstallationException { try { final QueryBuilder queryBldr = new QueryBuilder(this.esjpType); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute("Name"); multi.executeWithoutAccessCheck(); while (multi.next()) { final String name = multi.<String>getAttribute("Name"); final Long id = multi.getCurrentInstance().getId(); final String path = "/" + name.replaceAll("\\.", Matcher.quoteReplacement("/")) + JavaFileObject.Kind.SOURCE.extension; final URI uri; try { uri = new URI("efaps", null, path, null, null); } catch (final URISyntaxException e) { throw new InstallationException("Could not create an URI for " + path, e); } this.name2Source.put(name, new SourceObject(uri, name, id)); } } catch (final EFapsException e) { throw new InstallationException("Could not fetch the information about installed ESJP's", e); } }
[ "protected", "void", "readESJPPrograms", "(", ")", "throws", "InstallationException", "{", "try", "{", "final", "QueryBuilder", "queryBldr", "=", "new", "QueryBuilder", "(", "this", ".", "esjpType", ")", ";", "final", "MultiPrintQuery", "multi", "=", "queryBldr", ...
All EJSP programs in the eFaps database are read and stored in the mapping {@link #name2Source} for further using. @see #name2Source @throws InstallationException if ESJP Java programs could not be read
[ "All", "EJSP", "programs", "in", "the", "eFaps", "database", "are", "read", "and", "stored", "in", "the", "mapping", "{", "@link", "#name2Source", "}", "for", "further", "using", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/program/esjp/ESJPCompiler.java#L246-L270
GoogleCloudPlatform/appengine-pipelines
java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java
PipelineManager.querySlotOrAbandonTask
private static Slot querySlotOrAbandonTask(Key key, boolean inflate) { try { return backEnd.querySlot(key, inflate); } catch (NoSuchObjectException e) { logger.log(Level.WARNING, "Cannot find the slot: " + key + ". Ignoring the task.", e); throw new AbandonTaskException(); } }
java
private static Slot querySlotOrAbandonTask(Key key, boolean inflate) { try { return backEnd.querySlot(key, inflate); } catch (NoSuchObjectException e) { logger.log(Level.WARNING, "Cannot find the slot: " + key + ". Ignoring the task.", e); throw new AbandonTaskException(); } }
[ "private", "static", "Slot", "querySlotOrAbandonTask", "(", "Key", "key", ",", "boolean", "inflate", ")", "{", "try", "{", "return", "backEnd", ".", "querySlot", "(", "key", ",", "inflate", ")", ";", "}", "catch", "(", "NoSuchObjectException", "e", ")", "{...
Queries the Slot with the given Key from the data store and if the Slot is not found then throws an {@link AbandonTaskException}. @param key The Key of the slot to fetch. @param inflate If this is {@code true} then the Barriers that are waiting on the Slot and the other Slots that those Barriers are waiting on will also be fetched from the data store and used to partially populate the graph of objects attached to the returned Slot. In particular: {@link Slot#getWaitingOnMeInflated()} will not return {@code null} and also that for each of the {@link Barrier Barriers} returned from that method {@link Barrier#getWaitingOnInflated()} will not return {@code null}. @return A {@code Slot}, possibly with a partially-inflated associated graph of objects. @throws AbandonTaskException If either the Slot or the associated Barriers and slots are not found in the data store.
[ "Queries", "the", "Slot", "with", "the", "given", "Key", "from", "the", "data", "store", "and", "if", "the", "Slot", "is", "not", "found", "then", "throws", "an", "{", "@link", "AbandonTaskException", "}", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L1214-L1221
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/LabelParameterVersionResult.java
LabelParameterVersionResult.getInvalidLabels
public java.util.List<String> getInvalidLabels() { if (invalidLabels == null) { invalidLabels = new com.amazonaws.internal.SdkInternalList<String>(); } return invalidLabels; }
java
public java.util.List<String> getInvalidLabels() { if (invalidLabels == null) { invalidLabels = new com.amazonaws.internal.SdkInternalList<String>(); } return invalidLabels; }
[ "public", "java", ".", "util", ".", "List", "<", "String", ">", "getInvalidLabels", "(", ")", "{", "if", "(", "invalidLabels", "==", "null", ")", "{", "invalidLabels", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<", "St...
<p> The label does not meet the requirements. For information about parameter label requirements, see <a href="http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-labels.html">Labeling Parameters</a> in the <i>AWS Systems Manager User Guide</i>. </p> @return The label does not meet the requirements. For information about parameter label requirements, see <a href="http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-labels.html">Labeling Parameters</a> in the <i>AWS Systems Manager User Guide</i>.
[ "<p", ">", "The", "label", "does", "not", "meet", "the", "requirements", ".", "For", "information", "about", "parameter", "label", "requirements", "see", "<a", "href", "=", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "systems",...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/LabelParameterVersionResult.java#L47-L52
alkacon/opencms-core
src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java
CmsGwtDialogExtension.openInfoDialog
public void openInfoDialog(CmsResource resource, String startTab) { getRpcProxy(I_CmsGwtDialogClientRpc.class).openInfoDialog(resource.getStructureId().toString(), startTab); }
java
public void openInfoDialog(CmsResource resource, String startTab) { getRpcProxy(I_CmsGwtDialogClientRpc.class).openInfoDialog(resource.getStructureId().toString(), startTab); }
[ "public", "void", "openInfoDialog", "(", "CmsResource", "resource", ",", "String", "startTab", ")", "{", "getRpcProxy", "(", "I_CmsGwtDialogClientRpc", ".", "class", ")", ".", "openInfoDialog", "(", "resource", ".", "getStructureId", "(", ")", ".", "toString", "...
Opens the resource info dialog.<p> @param resource the resource @param startTab the start tab id
[ "Opens", "the", "resource", "info", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java#L193-L196
csc19601128/Phynixx
phynixx/phynixx-xa/src/main/java/org/csc/phynixx/xa/PhynixxXAResource.java
PhynixxXAResource.conditionViolated
public void conditionViolated() { try { if (this.xaConnection != null) { XATransactionalBranch<C> transactionalBranch = this.xaConnection.toGlobalTransactionBranch(); if (transactionalBranch != null) { transactionalBranch.setRollbackOnly(true); } } if (LOG.isInfoEnabled()) { String logString = "PhynixxXAResource.expired :: XAResource " + this.getId() + " is expired (time out occurred) and all associated TX are rollbacked "; LOG.info(new ConditionViolatedLog(this.timeoutCondition, logString).toString()); } } finally { // no monitoring anymore setTimeOutActive(false); } }
java
public void conditionViolated() { try { if (this.xaConnection != null) { XATransactionalBranch<C> transactionalBranch = this.xaConnection.toGlobalTransactionBranch(); if (transactionalBranch != null) { transactionalBranch.setRollbackOnly(true); } } if (LOG.isInfoEnabled()) { String logString = "PhynixxXAResource.expired :: XAResource " + this.getId() + " is expired (time out occurred) and all associated TX are rollbacked "; LOG.info(new ConditionViolatedLog(this.timeoutCondition, logString).toString()); } } finally { // no monitoring anymore setTimeOutActive(false); } }
[ "public", "void", "conditionViolated", "(", ")", "{", "try", "{", "if", "(", "this", ".", "xaConnection", "!=", "null", ")", "{", "XATransactionalBranch", "<", "C", ">", "transactionalBranch", "=", "this", ".", "xaConnection", ".", "toGlobalTransactionBranch", ...
called when the current XAresource is expired (time out occurred) The current Impl. does nothing but marked the associated TX as rollback only The underlying core connection are not treated .... There are two different situation that have to be handled If the connection expires because of a long running method call the connection isn't treated and the XAResource is marked as rollback only. The rollback is done by the Transactionmanager. If the TX expires because the Transactionmanagers doesn't answer, the underlying connection is rolledback and the XAResource is marked as rollback only (N.B. rolling back the connection marks the XAResource as heuristically rolled back)
[ "called", "when", "the", "current", "XAresource", "is", "expired", "(", "time", "out", "occurred", ")", "The", "current", "Impl", ".", "does", "nothing", "but", "marked", "the", "associated", "TX", "as", "rollback", "only", "The", "underlying", "core", "conn...
train
https://github.com/csc19601128/Phynixx/blob/a26c03bc229a8882c647799834115bec6bdc0ac8/phynixx/phynixx-xa/src/main/java/org/csc/phynixx/xa/PhynixxXAResource.java#L117-L136
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java
AFPChainer.calAfpRmsd
protected static double calAfpRmsd(int afpn, int[] afpPositions, int listStart, AFPChain afpChain,Atom[] ca1, Atom[] ca2) { if (debug) System.out.println("XXX calling afp2res "+ afpn + " " + afpPositions.length); int focusResn = AFPTwister.afp2Res(afpChain,afpn, afpPositions, listStart); int[] focusRes1 = afpChain.getFocusRes1(); int[] focusRes2 = afpChain.getFocusRes2(); if (debug) System.out.println("XXX calculating calAfpRmsd: " + focusResn + " " + focusRes1.length + " " + focusRes2.length + " " + afpChain.getMinLen() + " " ); double rmsd = getRmsd(focusResn, focusRes1, focusRes2 , afpChain,ca1, ca2); return rmsd; }
java
protected static double calAfpRmsd(int afpn, int[] afpPositions, int listStart, AFPChain afpChain,Atom[] ca1, Atom[] ca2) { if (debug) System.out.println("XXX calling afp2res "+ afpn + " " + afpPositions.length); int focusResn = AFPTwister.afp2Res(afpChain,afpn, afpPositions, listStart); int[] focusRes1 = afpChain.getFocusRes1(); int[] focusRes2 = afpChain.getFocusRes2(); if (debug) System.out.println("XXX calculating calAfpRmsd: " + focusResn + " " + focusRes1.length + " " + focusRes2.length + " " + afpChain.getMinLen() + " " ); double rmsd = getRmsd(focusResn, focusRes1, focusRes2 , afpChain,ca1, ca2); return rmsd; }
[ "protected", "static", "double", "calAfpRmsd", "(", "int", "afpn", ",", "int", "[", "]", "afpPositions", ",", "int", "listStart", ",", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "{", "if", "(", "debug", "...
return the rmsd of the residues from the segments that form the given AFP list this value can be a measurement (1) for the connectivity of the AFPs @param afpn @param afpPositions the positions of AFPs to work on. @param listStart the starting position in the list of AFPs @param afpChain @param ca1 @param ca2 @return rmsd
[ "return", "the", "rmsd", "of", "the", "residues", "from", "the", "segments", "that", "form", "the", "given", "AFP", "list", "this", "value", "can", "be", "a", "measurement", "(", "1", ")", "for", "the", "connectivity", "of", "the", "AFPs" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L637-L655
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java
ApplicationUrl.renamePackageFileUrl
public static MozuUrl renamePackageFileUrl(String applicationKey, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/developer/packages/{applicationKey}/files_rename?responseFields={responseFields}"); formatter.formatUrl("applicationKey", applicationKey); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
java
public static MozuUrl renamePackageFileUrl(String applicationKey, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/developer/packages/{applicationKey}/files_rename?responseFields={responseFields}"); formatter.formatUrl("applicationKey", applicationKey); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
[ "public", "static", "MozuUrl", "renamePackageFileUrl", "(", "String", "applicationKey", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/developer/packages/{applicationKey}/files_rename?responseFields={respo...
Get Resource Url for RenamePackageFile @param applicationKey The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "RenamePackageFile" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java#L98-L104
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.removePathAndBlocks
void removePathAndBlocks(String src, List<BlockInfo> blocks) throws IOException { // No need for lock until we start accepting requests from clients. assert (!nameNode.isRpcServerRunning() || hasWriteLock()); leaseManager.removeLeaseWithPrefixPath(src); removeBlocks(blocks); }
java
void removePathAndBlocks(String src, List<BlockInfo> blocks) throws IOException { // No need for lock until we start accepting requests from clients. assert (!nameNode.isRpcServerRunning() || hasWriteLock()); leaseManager.removeLeaseWithPrefixPath(src); removeBlocks(blocks); }
[ "void", "removePathAndBlocks", "(", "String", "src", ",", "List", "<", "BlockInfo", ">", "blocks", ")", "throws", "IOException", "{", "// No need for lock until we start accepting requests from clients.", "assert", "(", "!", "nameNode", ".", "isRpcServerRunning", "(", "...
Remove the blocks from the given list. Also, remove the path. Add the blocks to invalidates, and set a flag that explicit ACK from DataNode is not required. This function should be used only for deleting entire files.
[ "Remove", "the", "blocks", "from", "the", "given", "list", ".", "Also", "remove", "the", "path", ".", "Add", "the", "blocks", "to", "invalidates", "and", "set", "a", "flag", "that", "explicit", "ACK", "from", "DataNode", "is", "not", "required", ".", "Th...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3891-L3896
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/GroupController.java
GroupController.editGroup
@RequestMapping(value = "group/{groupId}", method = RequestMethod.GET) public String editGroup(Model model, @PathVariable int groupId) throws Exception { model.addAttribute("groupName", pathOverrideService.getGroupNameFromId(groupId)); model.addAttribute("groupId", groupId); ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(pluginManager.getMethodsNotInGroup(groupId)); model.addAttribute("methodsNotInGroup", json); return "editGroup"; }
java
@RequestMapping(value = "group/{groupId}", method = RequestMethod.GET) public String editGroup(Model model, @PathVariable int groupId) throws Exception { model.addAttribute("groupName", pathOverrideService.getGroupNameFromId(groupId)); model.addAttribute("groupId", groupId); ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(pluginManager.getMethodsNotInGroup(groupId)); model.addAttribute("methodsNotInGroup", json); return "editGroup"; }
[ "@", "RequestMapping", "(", "value", "=", "\"group/{groupId}\"", ",", "method", "=", "RequestMethod", ".", "GET", ")", "public", "String", "editGroup", "(", "Model", "model", ",", "@", "PathVariable", "int", "groupId", ")", "throws", "Exception", "{", "model",...
Redirect to a edit group page @param model @param groupId @return @throws Exception
[ "Redirect", "to", "a", "edit", "group", "page" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/GroupController.java#L101-L112
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/shape/json/validators/ValidationContext.java
ValidationContext.addBadArraySizeError
public void addBadArraySizeError(final int expectedSize, final int actualSize) throws ValidationException { addError(StringFormatter.format(MessageConstants.MESSAGES.invalidArraySize(), expectedSize, actualSize)); }
java
public void addBadArraySizeError(final int expectedSize, final int actualSize) throws ValidationException { addError(StringFormatter.format(MessageConstants.MESSAGES.invalidArraySize(), expectedSize, actualSize)); }
[ "public", "void", "addBadArraySizeError", "(", "final", "int", "expectedSize", ",", "final", "int", "actualSize", ")", "throws", "ValidationException", "{", "addError", "(", "StringFormatter", ".", "format", "(", "MessageConstants", ".", "MESSAGES", ".", "invalidArr...
Calls {@link #addError(String)} with a message that indicates that an array has the wrong number of elements @param expectedSize @param actualSize @throws ValidationException
[ "Calls", "{", "@link", "#addError", "(", "String", ")", "}", "with", "a", "message", "that", "indicates", "that", "an", "array", "has", "the", "wrong", "number", "of", "elements" ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/json/validators/ValidationContext.java#L210-L213
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java
EqualityInference.rewriteExpressionAllowNonDeterministic
public Expression rewriteExpressionAllowNonDeterministic(Expression expression, Predicate<Symbol> symbolScope) { return rewriteExpression(expression, symbolScope, true); }
java
public Expression rewriteExpressionAllowNonDeterministic(Expression expression, Predicate<Symbol> symbolScope) { return rewriteExpression(expression, symbolScope, true); }
[ "public", "Expression", "rewriteExpressionAllowNonDeterministic", "(", "Expression", "expression", ",", "Predicate", "<", "Symbol", ">", "symbolScope", ")", "{", "return", "rewriteExpression", "(", "expression", ",", "symbolScope", ",", "true", ")", ";", "}" ]
Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope given the known equalities. Returns null if unsuccessful. This method allows rewriting non-deterministic expressions.
[ "Attempts", "to", "rewrite", "an", "Expression", "in", "terms", "of", "the", "symbols", "allowed", "by", "the", "symbol", "scope", "given", "the", "known", "equalities", ".", "Returns", "null", "if", "unsuccessful", ".", "This", "method", "allows", "rewriting"...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java#L110-L113
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/ValueNumberCache.java
ValueNumberCache.addOutputValues
public void addOutputValues(Entry entry, ValueNumber[] outputValueList) { ValueNumber[] old = entryToOutputMap.put(entry, outputValueList); if (old != null) { throw new IllegalStateException("overwriting output values for entry!"); } }
java
public void addOutputValues(Entry entry, ValueNumber[] outputValueList) { ValueNumber[] old = entryToOutputMap.put(entry, outputValueList); if (old != null) { throw new IllegalStateException("overwriting output values for entry!"); } }
[ "public", "void", "addOutputValues", "(", "Entry", "entry", ",", "ValueNumber", "[", "]", "outputValueList", ")", "{", "ValueNumber", "[", "]", "old", "=", "entryToOutputMap", ".", "put", "(", "entry", ",", "outputValueList", ")", ";", "if", "(", "old", "!...
Add output values for given entry. Assumes that lookupOutputValues() has determined that the entry is not in the cache. @param entry the entry @param outputValueList the list of output values produced by the entry's instruction and input values
[ "Add", "output", "values", "for", "given", "entry", ".", "Assumes", "that", "lookupOutputValues", "()", "has", "determined", "that", "the", "entry", "is", "not", "in", "the", "cache", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/ValueNumberCache.java#L141-L146
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/sa/StandardServiceAgentServer.java
StandardServiceAgentServer.handleTCPSrvRqst
protected void handleTCPSrvRqst(SrvRqst srvRqst, Socket socket) { // Match scopes if (!getScopes().weakMatch(srvRqst.getScopes())) { if (logger.isLoggable(Level.FINE)) logger.fine("ServiceAgent server " + this + " dropping message " + srvRqst + ": no scopes match among agent scopes " + getScopes() + " and message scopes " + srvRqst.getScopes()); return; } List<ServiceInfo> matchingServices = matchServices(srvRqst.getServiceType(), srvRqst.getLanguage(), srvRqst.getScopes(), srvRqst.getFilter()); if (logger.isLoggable(Level.FINE)) logger.fine("ServiceAgent server " + this + " returning " + matchingServices.size() + " services of type " + srvRqst.getServiceType()); tcpSrvRply.perform(socket, srvRqst, matchingServices); }
java
protected void handleTCPSrvRqst(SrvRqst srvRqst, Socket socket) { // Match scopes if (!getScopes().weakMatch(srvRqst.getScopes())) { if (logger.isLoggable(Level.FINE)) logger.fine("ServiceAgent server " + this + " dropping message " + srvRqst + ": no scopes match among agent scopes " + getScopes() + " and message scopes " + srvRqst.getScopes()); return; } List<ServiceInfo> matchingServices = matchServices(srvRqst.getServiceType(), srvRqst.getLanguage(), srvRqst.getScopes(), srvRqst.getFilter()); if (logger.isLoggable(Level.FINE)) logger.fine("ServiceAgent server " + this + " returning " + matchingServices.size() + " services of type " + srvRqst.getServiceType()); tcpSrvRply.perform(socket, srvRqst, matchingServices); }
[ "protected", "void", "handleTCPSrvRqst", "(", "SrvRqst", "srvRqst", ",", "Socket", "socket", ")", "{", "// Match scopes", "if", "(", "!", "getScopes", "(", ")", ".", "weakMatch", "(", "srvRqst", ".", "getScopes", "(", ")", ")", ")", "{", "if", "(", "logg...
Handles a unicast TCP SrvRqst message arrived to this service agent. <br /> This service agent will reply with a list of matching services. @param srvRqst the SrvRqst message to handle @param socket the socket connected to the client where to write the reply
[ "Handles", "a", "unicast", "TCP", "SrvRqst", "message", "arrived", "to", "this", "service", "agent", ".", "<br", "/", ">", "This", "service", "agent", "will", "reply", "with", "a", "list", "of", "matching", "services", "." ]
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/sa/StandardServiceAgentServer.java#L216-L230
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.getLocalizedResource
public String getLocalizedResource(String namespace, String resourceId) throws Exception { String resourceValue = ""; Class r = Class.forName(namespace + "$string"); Field f = r.getField(resourceId); resourceValue = getCurrentActivity().getResources().getString(f.getInt(f)); return resourceValue; }
java
public String getLocalizedResource(String namespace, String resourceId) throws Exception { String resourceValue = ""; Class r = Class.forName(namespace + "$string"); Field f = r.getField(resourceId); resourceValue = getCurrentActivity().getResources().getString(f.getInt(f)); return resourceValue; }
[ "public", "String", "getLocalizedResource", "(", "String", "namespace", ",", "String", "resourceId", ")", "throws", "Exception", "{", "String", "resourceValue", "=", "\"\"", ";", "Class", "r", "=", "Class", ".", "forName", "(", "namespace", "+", "\"$string\"", ...
Returns a string for a resourceId in the specified namespace @param namespace @param resourceId @return @throws Exception
[ "Returns", "a", "string", "for", "a", "resourceId", "in", "the", "specified", "namespace" ]
train
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L288-L296
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsXmlContentEditor.java
CmsXmlContentEditor.buildSubChoices
public String buildSubChoices() { String elementPath = getParamElementName(); // we have to add a choice element, first check if the element to add itself is part of a choice or not boolean choiceType = Boolean.valueOf(getParamChoiceType()).booleanValue(); I_CmsXmlSchemaType elemType = m_content.getContentDefinition().getSchemaType(elementPath); if (!choiceType || (elemType.isChoiceOption() && elemType.isChoiceType())) { // this is a choice option or a nested choice type to add, remove last element name from xpath elementPath = CmsXmlUtils.removeLastXpathElement(elementPath); } elementPath = CmsXmlUtils.concatXpath(elementPath, getParamChoiceElement()); return buildElementChoices(elementPath, choiceType, false).toString(); }
java
public String buildSubChoices() { String elementPath = getParamElementName(); // we have to add a choice element, first check if the element to add itself is part of a choice or not boolean choiceType = Boolean.valueOf(getParamChoiceType()).booleanValue(); I_CmsXmlSchemaType elemType = m_content.getContentDefinition().getSchemaType(elementPath); if (!choiceType || (elemType.isChoiceOption() && elemType.isChoiceType())) { // this is a choice option or a nested choice type to add, remove last element name from xpath elementPath = CmsXmlUtils.removeLastXpathElement(elementPath); } elementPath = CmsXmlUtils.concatXpath(elementPath, getParamChoiceElement()); return buildElementChoices(elementPath, choiceType, false).toString(); }
[ "public", "String", "buildSubChoices", "(", ")", "{", "String", "elementPath", "=", "getParamElementName", "(", ")", ";", "// we have to add a choice element, first check if the element to add itself is part of a choice or not", "boolean", "choiceType", "=", "Boolean", ".", "va...
Returns the available sub choices for a nested choice element.<p> @return the available sub choices for a nested choice element as JSON array string
[ "Returns", "the", "available", "sub", "choices", "for", "a", "nested", "choice", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsXmlContentEditor.java#L791-L804
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java
OmemoService.sendRatchetUpdate
private void sendRatchetUpdate(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException, InterruptedException, SmackException.NoResponseException, NoSuchAlgorithmException, SmackException.NotConnectedException, CryptoFailedException, CannotEstablishOmemoSessionException { OmemoManager manager = managerGuard.get(); OmemoElement ratchetUpdate = createRatchetUpdateElement(managerGuard, contactsDevice); Message m = new Message(); m.setTo(contactsDevice.getJid()); m.addExtension(ratchetUpdate); manager.getConnection().sendStanza(m); }
java
private void sendRatchetUpdate(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException, InterruptedException, SmackException.NoResponseException, NoSuchAlgorithmException, SmackException.NotConnectedException, CryptoFailedException, CannotEstablishOmemoSessionException { OmemoManager manager = managerGuard.get(); OmemoElement ratchetUpdate = createRatchetUpdateElement(managerGuard, contactsDevice); Message m = new Message(); m.setTo(contactsDevice.getJid()); m.addExtension(ratchetUpdate); manager.getConnection().sendStanza(m); }
[ "private", "void", "sendRatchetUpdate", "(", "OmemoManager", ".", "LoggedInOmemoManager", "managerGuard", ",", "OmemoDevice", "contactsDevice", ")", "throws", "CorruptedOmemoKeyException", ",", "InterruptedException", ",", "SmackException", ".", "NoResponseException", ",", ...
Send an empty OMEMO message to contactsDevice in order to forward the ratchet. @param managerGuard @param contactsDevice @throws CorruptedOmemoKeyException if our or their OMEMO key is corrupted. @throws InterruptedException @throws SmackException.NoResponseException @throws NoSuchAlgorithmException if AES encryption fails @throws SmackException.NotConnectedException @throws CryptoFailedException if encryption fails (should not happen though, but who knows...) @throws CannotEstablishOmemoSessionException if we cannot establish a session with contactsDevice.
[ "Send", "an", "empty", "OMEMO", "message", "to", "contactsDevice", "in", "order", "to", "forward", "the", "ratchet", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L1317-L1328
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ServerStateMachine.java
ServerStateMachine.sequenceCommand
private void sequenceCommand(long sequence, ServerSessionContext session, CompletableFuture<Result> future, ThreadContext context) { if (!log.isOpen()) { context.executor().execute(() -> future.completeExceptionally(new IllegalStateException("log closed"))); return; } Result result = session.getResult(sequence); if (result == null) { LOGGER.debug("Missing command result for {}:{}", session.id(), sequence); } context.executor().execute(() -> future.complete(result)); }
java
private void sequenceCommand(long sequence, ServerSessionContext session, CompletableFuture<Result> future, ThreadContext context) { if (!log.isOpen()) { context.executor().execute(() -> future.completeExceptionally(new IllegalStateException("log closed"))); return; } Result result = session.getResult(sequence); if (result == null) { LOGGER.debug("Missing command result for {}:{}", session.id(), sequence); } context.executor().execute(() -> future.complete(result)); }
[ "private", "void", "sequenceCommand", "(", "long", "sequence", ",", "ServerSessionContext", "session", ",", "CompletableFuture", "<", "Result", ">", "future", ",", "ThreadContext", "context", ")", "{", "if", "(", "!", "log", ".", "isOpen", "(", ")", ")", "{"...
Sequences a command according to the command sequence number.
[ "Sequences", "a", "command", "according", "to", "the", "command", "sequence", "number", "." ]
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerStateMachine.java#L817-L828
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java
Utils.getRequiredSystemProperty
public static String getRequiredSystemProperty(String propertyName, String errorMsgIfNotFound) { String propertyValue = System.getProperty(propertyName); if (propertyValue == null) { throw new RuntimeException(errorMsgIfNotFound); } return propertyValue; }
java
public static String getRequiredSystemProperty(String propertyName, String errorMsgIfNotFound) { String propertyValue = System.getProperty(propertyName); if (propertyValue == null) { throw new RuntimeException(errorMsgIfNotFound); } return propertyValue; }
[ "public", "static", "String", "getRequiredSystemProperty", "(", "String", "propertyName", ",", "String", "errorMsgIfNotFound", ")", "{", "String", "propertyValue", "=", "System", ".", "getProperty", "(", "propertyName", ")", ";", "if", "(", "propertyValue", "==", ...
Retrieve system property by name, failing if it's not found @param propertyName @param errorMsgIfNotFound @return Value of property if it exists
[ "Retrieve", "system", "property", "by", "name", "failing", "if", "it", "s", "not", "found" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java#L231-L237
gallandarakhneorg/afc
core/text/src/main/java/org/arakhne/afc/text/TextUtil.java
TextUtil.removeAccents
@Pure public static String removeAccents(String text) { final Map<Character, String> map = getAccentTranslationTable(); if ((map == null) || (map.isEmpty())) { return text; } return removeAccents(text, map); }
java
@Pure public static String removeAccents(String text) { final Map<Character, String> map = getAccentTranslationTable(); if ((map == null) || (map.isEmpty())) { return text; } return removeAccents(text, map); }
[ "@", "Pure", "public", "static", "String", "removeAccents", "(", "String", "text", ")", "{", "final", "Map", "<", "Character", ",", "String", ">", "map", "=", "getAccentTranslationTable", "(", ")", ";", "if", "(", "(", "map", "==", "null", ")", "||", "...
Remove the accents inside the specified string. @param text is the string into which the accents must be removed. @return the given string without the accents
[ "Remove", "the", "accents", "inside", "the", "specified", "string", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L563-L570
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java
ComputeNodesImpl.disableScheduling
public void disableScheduling(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions) { disableSchedulingWithServiceResponseAsync(poolId, nodeId, nodeDisableSchedulingOption, computeNodeDisableSchedulingOptions).toBlocking().single().body(); }
java
public void disableScheduling(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions) { disableSchedulingWithServiceResponseAsync(poolId, nodeId, nodeDisableSchedulingOption, computeNodeDisableSchedulingOptions).toBlocking().single().body(); }
[ "public", "void", "disableScheduling", "(", "String", "poolId", ",", "String", "nodeId", ",", "DisableComputeNodeSchedulingOption", "nodeDisableSchedulingOption", ",", "ComputeNodeDisableSchedulingOptions", "computeNodeDisableSchedulingOptions", ")", "{", "disableSchedulingWithServ...
Disables task scheduling on the specified compute node. You can disable task scheduling on a node only if its current scheduling state is enabled. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node on which you want to disable task scheduling. @param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion' @param computeNodeDisableSchedulingOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Disables", "task", "scheduling", "on", "the", "specified", "compute", "node", ".", "You", "can", "disable", "task", "scheduling", "on", "a", "node", "only", "if", "its", "current", "scheduling", "state", "is", "enabled", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L1599-L1601
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.serialClassInclude
private static boolean serialClassInclude(Utils utils, TypeElement te) { if (utils.isEnum(te)) { return false; } if (utils.isSerializable(te)) { if (!utils.getSerialTrees(te).isEmpty()) { return serialDocInclude(utils, te); } else if (utils.isPublic(te) || utils.isProtected(te)) { return true; } else { return false; } } return false; }
java
private static boolean serialClassInclude(Utils utils, TypeElement te) { if (utils.isEnum(te)) { return false; } if (utils.isSerializable(te)) { if (!utils.getSerialTrees(te).isEmpty()) { return serialDocInclude(utils, te); } else if (utils.isPublic(te) || utils.isProtected(te)) { return true; } else { return false; } } return false; }
[ "private", "static", "boolean", "serialClassInclude", "(", "Utils", "utils", ",", "TypeElement", "te", ")", "{", "if", "(", "utils", ".", "isEnum", "(", "te", ")", ")", "{", "return", "false", ";", "}", "if", "(", "utils", ".", "isSerializable", "(", "...
Returns true if the given TypeElement should be included in the serialized form. @param te the TypeElement object to check for serializability.
[ "Returns", "true", "if", "the", "given", "TypeElement", "should", "be", "included", "in", "the", "serialized", "form", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L570-L584
azkaban/azkaban
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
QuartzScheduler.isJobPaused
public synchronized boolean isJobPaused(final String jobName, final String groupName) throws SchedulerException { if (!ifJobExist(jobName, groupName)) { throw new SchedulerException(String.format("Job (job name %s, group name %s) doesn't " + "exist'", jobName, groupName)); } final JobKey jobKey = new JobKey(jobName, groupName); final JobDetail jobDetail = this.scheduler.getJobDetail(jobKey); final List<? extends Trigger> triggers = this.scheduler.getTriggersOfJob(jobDetail.getKey()); for (final Trigger trigger : triggers) { final TriggerState triggerState = this.scheduler.getTriggerState(trigger.getKey()); if (TriggerState.PAUSED.equals(triggerState)) { return true; } } return false; }
java
public synchronized boolean isJobPaused(final String jobName, final String groupName) throws SchedulerException { if (!ifJobExist(jobName, groupName)) { throw new SchedulerException(String.format("Job (job name %s, group name %s) doesn't " + "exist'", jobName, groupName)); } final JobKey jobKey = new JobKey(jobName, groupName); final JobDetail jobDetail = this.scheduler.getJobDetail(jobKey); final List<? extends Trigger> triggers = this.scheduler.getTriggersOfJob(jobDetail.getKey()); for (final Trigger trigger : triggers) { final TriggerState triggerState = this.scheduler.getTriggerState(trigger.getKey()); if (TriggerState.PAUSED.equals(triggerState)) { return true; } } return false; }
[ "public", "synchronized", "boolean", "isJobPaused", "(", "final", "String", "jobName", ",", "final", "String", "groupName", ")", "throws", "SchedulerException", "{", "if", "(", "!", "ifJobExist", "(", "jobName", ",", "groupName", ")", ")", "{", "throw", "new",...
Check if job is paused. @return true if job is paused, false otherwise.
[ "Check", "if", "job", "is", "paused", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java#L110-L126
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java
P3DatabaseReader.setFields
private void setFields(Map<String, FieldType> map, MapRow row, FieldContainer container) { if (row != null) { for (Map.Entry<String, FieldType> entry : map.entrySet()) { container.set(entry.getValue(), row.getObject(entry.getKey())); } } }
java
private void setFields(Map<String, FieldType> map, MapRow row, FieldContainer container) { if (row != null) { for (Map.Entry<String, FieldType> entry : map.entrySet()) { container.set(entry.getValue(), row.getObject(entry.getKey())); } } }
[ "private", "void", "setFields", "(", "Map", "<", "String", ",", "FieldType", ">", "map", ",", "MapRow", "row", ",", "FieldContainer", "container", ")", "{", "if", "(", "row", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ","...
Set the value of one or more fields based on the contents of a database row. @param map column to field map @param row database row @param container field container
[ "Set", "the", "value", "of", "one", "or", "more", "fields", "based", "on", "the", "contents", "of", "a", "database", "row", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L587-L596
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setCredentials
public void setCredentials(Element el, String username, String password, Credentials c) { if (c == null) return; if (c.getUsername() != null) el.setAttribute(username, c.getUsername()); if (c.getPassword() != null) el.setAttribute(password, c.getPassword()); }
java
public void setCredentials(Element el, String username, String password, Credentials c) { if (c == null) return; if (c.getUsername() != null) el.setAttribute(username, c.getUsername()); if (c.getPassword() != null) el.setAttribute(password, c.getPassword()); }
[ "public", "void", "setCredentials", "(", "Element", "el", ",", "String", "username", ",", "String", "password", ",", "Credentials", "c", ")", "{", "if", "(", "c", "==", "null", ")", "return", ";", "if", "(", "c", ".", "getUsername", "(", ")", "!=", "...
sets a Credentials to a XML Element @param el @param username @param password @param credentials
[ "sets", "a", "Credentials", "to", "a", "XML", "Element" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L427-L431
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_instancesState_GET
public ArrayList<OvhInstancesState> serviceName_instancesState_GET(String serviceName) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/instancesState"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
java
public ArrayList<OvhInstancesState> serviceName_instancesState_GET(String serviceName) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/instancesState"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
[ "public", "ArrayList", "<", "OvhInstancesState", ">", "serviceName_instancesState_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/instancesState\"", ";", "StringBuilder", "sb", "=", "path", "...
Get the effective state of your IPLB instances on IPLB servers REST: GET /ipLoadbalancing/{serviceName}/instancesState @param serviceName [required] The internal name of your IP load balancing @deprecated
[ "Get", "the", "effective", "state", "of", "your", "IPLB", "instances", "on", "IPLB", "servers" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L725-L730
trellis-ldp-archive/trellis-http
src/main/java/org/trellisldp/http/impl/BaseLdpHandler.java
BaseLdpHandler.checkDeleted
protected static void checkDeleted(final Resource res, final String identifier) { if (RdfUtils.isDeleted(res)) { throw new WebApplicationException(status(GONE) .links(MementoResource.getMementoLinks(identifier, res.getMementos()) .toArray(Link[]::new)).build()); } }
java
protected static void checkDeleted(final Resource res, final String identifier) { if (RdfUtils.isDeleted(res)) { throw new WebApplicationException(status(GONE) .links(MementoResource.getMementoLinks(identifier, res.getMementos()) .toArray(Link[]::new)).build()); } }
[ "protected", "static", "void", "checkDeleted", "(", "final", "Resource", "res", ",", "final", "String", "identifier", ")", "{", "if", "(", "RdfUtils", ".", "isDeleted", "(", "res", ")", ")", "{", "throw", "new", "WebApplicationException", "(", "status", "(",...
Check if this is a deleted resource, and if so return an appropriate response @param res the resource @param identifier the identifier @throws WebApplicationException a 410 Gone exception
[ "Check", "if", "this", "is", "a", "deleted", "resource", "and", "if", "so", "return", "an", "appropriate", "response" ]
train
https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/BaseLdpHandler.java#L89-L95
buschmais/jqa-core-framework
plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java
AbstractPluginRepository.getType
protected <T> Class<T> getType(String typeName) throws PluginRepositoryException { try { return (Class<T>) classLoader.loadClass(typeName.trim()); } catch (ClassNotFoundException | LinkageError e) { // Catching class loader related errors for logging a message which plugin class // actually caused the problem. throw new PluginRepositoryException("Cannot find or load class " + typeName, e); } }
java
protected <T> Class<T> getType(String typeName) throws PluginRepositoryException { try { return (Class<T>) classLoader.loadClass(typeName.trim()); } catch (ClassNotFoundException | LinkageError e) { // Catching class loader related errors for logging a message which plugin class // actually caused the problem. throw new PluginRepositoryException("Cannot find or load class " + typeName, e); } }
[ "protected", "<", "T", ">", "Class", "<", "T", ">", "getType", "(", "String", "typeName", ")", "throws", "PluginRepositoryException", "{", "try", "{", "return", "(", "Class", "<", "T", ">", ")", "classLoader", ".", "loadClass", "(", "typeName", ".", "tri...
Get the class for the given type name. @param typeName The type name. @param <T> The type name. @return The class. @throws PluginRepositoryException If the type could not be loaded.
[ "Get", "the", "class", "for", "the", "given", "type", "name", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java#L51-L59
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
HtmlTableRendererBase.encodeChildren
public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException { RendererUtils.checkParamValidity(facesContext, component, UIData.class); beforeBody(facesContext, (UIData) component); encodeInnerHtml(facesContext, component); afterBody(facesContext, (UIData) component); }
java
public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException { RendererUtils.checkParamValidity(facesContext, component, UIData.class); beforeBody(facesContext, (UIData) component); encodeInnerHtml(facesContext, component); afterBody(facesContext, (UIData) component); }
[ "public", "void", "encodeChildren", "(", "FacesContext", "facesContext", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "RendererUtils", ".", "checkParamValidity", "(", "facesContext", ",", "component", ",", "UIData", ".", "class", ")", ";", "...
Render the TBODY section of the html table. See also method encodeInnerHtml. @see javax.faces.render.Renderer#encodeChildren(FacesContext, UIComponent)
[ "Render", "the", "TBODY", "section", "of", "the", "html", "table", ".", "See", "also", "method", "encodeInnerHtml", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java#L202-L211
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/MapHelper.java
MapHelper.contentOfEquals
public boolean contentOfEquals(Map<String, Object> one, Object two) { if (one == null) { return two == null; } else { return one.equals(two); } }
java
public boolean contentOfEquals(Map<String, Object> one, Object two) { if (one == null) { return two == null; } else { return one.equals(two); } }
[ "public", "boolean", "contentOfEquals", "(", "Map", "<", "String", ",", "Object", ">", "one", ",", "Object", "two", ")", "{", "if", "(", "one", "==", "null", ")", "{", "return", "two", "==", "null", ";", "}", "else", "{", "return", "one", ".", "equ...
Determines whether map one's content matches two. @param one map the check content of. @param two other map to check. @return true if both maps are equal.
[ "Determines", "whether", "map", "one", "s", "content", "matches", "two", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/MapHelper.java#L151-L157
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/d/DoubleTuples.java
DoubleTuples.createSubTuple
static MutableDoubleTuple createSubTuple( MutableDoubleTuple parent, int fromIndex, int toIndex) { return new MutableSubDoubleTuple(parent, fromIndex, toIndex); }
java
static MutableDoubleTuple createSubTuple( MutableDoubleTuple parent, int fromIndex, int toIndex) { return new MutableSubDoubleTuple(parent, fromIndex, toIndex); }
[ "static", "MutableDoubleTuple", "createSubTuple", "(", "MutableDoubleTuple", "parent", ",", "int", "fromIndex", ",", "int", "toIndex", ")", "{", "return", "new", "MutableSubDoubleTuple", "(", "parent", ",", "fromIndex", ",", "toIndex", ")", ";", "}" ]
Creates a new tuple that is a <i>view</i> on the specified portion of the given parent. Changes in the parent will be visible in the returned tuple, and vice versa. @param parent The parent tuple @param fromIndex The start index in the parent, inclusive @param toIndex The end index in the parent, exclusive @throws NullPointerException If the given parent is <code>null</code> @throws IllegalArgumentException If the given indices are invalid. This is the case when <code>fromIndex &lt; 0</code>, <code>fromIndex &gt; toIndex</code>, or <code>toIndex &gt; {@link Tuple#getSize() parent.getSize()}</code>, @return The new tuple
[ "Creates", "a", "new", "tuple", "that", "is", "a", "<i", ">", "view<", "/", "i", ">", "on", "the", "specified", "portion", "of", "the", "given", "parent", ".", "Changes", "in", "the", "parent", "will", "be", "visible", "in", "the", "returned", "tuple",...
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/d/DoubleTuples.java#L248-L252
Harium/keel
src/main/java/jdt/triangulation/GridIndex.java
GridIndex.getCellOf
private Vector2i getCellOf(Point3D coordinate) { int xCell = (int) ((coordinate.x - indexRegion.minX()) / x_size); int yCell = (int) ((coordinate.y - indexRegion.minY()) / y_size); return new Vector2i(xCell, yCell); }
java
private Vector2i getCellOf(Point3D coordinate) { int xCell = (int) ((coordinate.x - indexRegion.minX()) / x_size); int yCell = (int) ((coordinate.y - indexRegion.minY()) / y_size); return new Vector2i(xCell, yCell); }
[ "private", "Vector2i", "getCellOf", "(", "Point3D", "coordinate", ")", "{", "int", "xCell", "=", "(", "int", ")", "(", "(", "coordinate", ".", "x", "-", "indexRegion", ".", "minX", "(", ")", ")", "/", "x_size", ")", ";", "int", "yCell", "=", "(", "...
Locates the grid cell point covering the given coordinate @param coordinate world coordinate to locate @return cell covering the coordinate
[ "Locates", "the", "grid", "cell", "point", "covering", "the", "given", "coordinate" ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/jdt/triangulation/GridIndex.java#L217-L221
apache/incubator-heron
storm-compatibility/src/java/org/apache/storm/task/GeneralTopologyContext.java
GeneralTopologyContext.getComponentOutputFields
public Fields getComponentOutputFields(String componentId, String streamId) { return new Fields(delegate.getComponentOutputFields(componentId, streamId)); }
java
public Fields getComponentOutputFields(String componentId, String streamId) { return new Fields(delegate.getComponentOutputFields(componentId, streamId)); }
[ "public", "Fields", "getComponentOutputFields", "(", "String", "componentId", ",", "String", "streamId", ")", "{", "return", "new", "Fields", "(", "delegate", ".", "getComponentOutputFields", "(", "componentId", ",", "streamId", ")", ")", ";", "}" ]
Gets the declared output fields for the specified component/stream.
[ "Gets", "the", "declared", "output", "fields", "for", "the", "specified", "component", "/", "stream", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/storm-compatibility/src/java/org/apache/storm/task/GeneralTopologyContext.java#L119-L121
googleads/googleads-java-lib
extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ConfigUtil.java
ConfigUtil.getIntConfigValue
public static int getIntConfigValue(String propertyName, int defaultValue) { String propertyValueStr = System.getProperty(propertyName, String.valueOf(defaultValue)); int propertyValue = defaultValue; try { propertyValue = Integer.parseInt(propertyValueStr); } catch (NumberFormatException e) { // Just swallow it, and propertyValue is still default. } return propertyValue >= 0 ? propertyValue : defaultValue; }
java
public static int getIntConfigValue(String propertyName, int defaultValue) { String propertyValueStr = System.getProperty(propertyName, String.valueOf(defaultValue)); int propertyValue = defaultValue; try { propertyValue = Integer.parseInt(propertyValueStr); } catch (NumberFormatException e) { // Just swallow it, and propertyValue is still default. } return propertyValue >= 0 ? propertyValue : defaultValue; }
[ "public", "static", "int", "getIntConfigValue", "(", "String", "propertyName", ",", "int", "defaultValue", ")", "{", "String", "propertyValueStr", "=", "System", ".", "getProperty", "(", "propertyName", ",", "String", ".", "valueOf", "(", "defaultValue", ")", ")...
Gets the specified system property's value as an integer. If the value is missing, cannot be parsed as an integer or is negative, returns {@code defaultValue}. @param propertyName the name of the system property. @param defaultValue the default value for the system property. @return the value of the system property as an int, if it's available and valid, else the {@code defaultValue}
[ "Gets", "the", "specified", "system", "property", "s", "value", "as", "an", "integer", ".", "If", "the", "value", "is", "missing", "cannot", "be", "parsed", "as", "an", "integer", "or", "is", "negative", "returns", "{", "@code", "defaultValue", "}", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ConfigUtil.java#L30-L40
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/commons/JSRInlinerAdapter.java
JSRInlinerAdapter.visitJumpInsn
@Override public void visitJumpInsn(final int opcode, final Label lbl) { super.visitJumpInsn(opcode, lbl); LabelNode ln = ((JumpInsnNode) instructions.getLast()).label; if (opcode == JSR && !subroutineHeads.containsKey(ln)) { subroutineHeads.put(ln, new BitSet()); } }
java
@Override public void visitJumpInsn(final int opcode, final Label lbl) { super.visitJumpInsn(opcode, lbl); LabelNode ln = ((JumpInsnNode) instructions.getLast()).label; if (opcode == JSR && !subroutineHeads.containsKey(ln)) { subroutineHeads.put(ln, new BitSet()); } }
[ "@", "Override", "public", "void", "visitJumpInsn", "(", "final", "int", "opcode", ",", "final", "Label", "lbl", ")", "{", "super", ".", "visitJumpInsn", "(", "opcode", ",", "lbl", ")", ";", "LabelNode", "ln", "=", "(", "(", "JumpInsnNode", ")", "instruc...
Detects a JSR instruction and sets a flag to indicate we will need to do inlining.
[ "Detects", "a", "JSR", "instruction", "and", "sets", "a", "flag", "to", "indicate", "we", "will", "need", "to", "do", "inlining", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/commons/JSRInlinerAdapter.java#L157-L164
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ClassUtils.java
ClassUtils.getPropertyClass
public static Class getPropertyClass(Class parentClass, String propertyName) throws IllegalArgumentException { if (parentClass == null) throw new IllegalArgumentException("theClass == null"); if (propertyName == null) throw new IllegalArgumentException("propertyName == null"); final Method getterMethod = getReadMethod(parentClass, propertyName); if (getterMethod != null) { return getterMethod.getReturnType(); } final Method setterMethod = getWriteMethod(parentClass, propertyName); if (setterMethod != null) { return setterMethod.getParameterTypes()[0]; } throw new IllegalArgumentException(propertyName + " is not a property of " + parentClass); }
java
public static Class getPropertyClass(Class parentClass, String propertyName) throws IllegalArgumentException { if (parentClass == null) throw new IllegalArgumentException("theClass == null"); if (propertyName == null) throw new IllegalArgumentException("propertyName == null"); final Method getterMethod = getReadMethod(parentClass, propertyName); if (getterMethod != null) { return getterMethod.getReturnType(); } final Method setterMethod = getWriteMethod(parentClass, propertyName); if (setterMethod != null) { return setterMethod.getParameterTypes()[0]; } throw new IllegalArgumentException(propertyName + " is not a property of " + parentClass); }
[ "public", "static", "Class", "getPropertyClass", "(", "Class", "parentClass", ",", "String", "propertyName", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parentClass", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"theClass == nu...
Returns the class of the property. <p /> For example, getPropertyClass(JFrame.class, "size") would return the java.awt.Dimension class. @param parentClass the class to look for the property in @param propertyName the name of the property @return the class of the property; never null @throws IllegalArgumentException if either argument is null @throws IllegalArgumentException <tt>propertyName</tt> is not a property of <tt>parentClass</tt>
[ "Returns", "the", "class", "of", "the", "property", ".", "<p", "/", ">" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ClassUtils.java#L462-L479
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/DefaultBeanContext.java
DefaultBeanContext.getBeansOfType
protected @Nonnull <T> Collection<T> getBeansOfType( @Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) { return getBeansOfTypeInternal(resolutionContext, beanType, qualifier); }
java
protected @Nonnull <T> Collection<T> getBeansOfType( @Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) { return getBeansOfTypeInternal(resolutionContext, beanType, qualifier); }
[ "protected", "@", "Nonnull", "<", "T", ">", "Collection", "<", "T", ">", "getBeansOfType", "(", "@", "Nullable", "BeanResolutionContext", "resolutionContext", ",", "@", "Nonnull", "Class", "<", "T", ">", "beanType", ",", "@", "Nullable", "Qualifier", "<", "T...
Get all beans of the given type and qualifier. @param resolutionContext The bean resolution context @param beanType The bean type @param qualifier The qualifier @param <T> The bean type parameter @return The found beans
[ "Get", "all", "beans", "of", "the", "given", "type", "and", "qualifier", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L866-L871
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/providers/GroupMembershipEvaluatorFactory.java
GroupMembershipEvaluatorFactory.getAttributeEvaluator
@Override public Evaluator getAttributeEvaluator(String name, String mode, String value) { return new GroupMembershipEvaluator(mode, name); }
java
@Override public Evaluator getAttributeEvaluator(String name, String mode, String value) { return new GroupMembershipEvaluator(mode, name); }
[ "@", "Override", "public", "Evaluator", "getAttributeEvaluator", "(", "String", "name", ",", "String", "mode", ",", "String", "value", ")", "{", "return", "new", "GroupMembershipEvaluator", "(", "mode", ",", "name", ")", ";", "}" ]
Returns an instance of an evaluator specific to this factory and the passed in values. Name should be a well known group name. Case is important. The mode should be "memberOf" for now. Other modes may be added in the future like, "deepMemberOf".
[ "Returns", "an", "instance", "of", "an", "evaluator", "specific", "to", "this", "factory", "and", "the", "passed", "in", "values", ".", "Name", "should", "be", "a", "well", "known", "group", "name", ".", "Case", "is", "important", ".", "The", "mode", "sh...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/providers/GroupMembershipEvaluatorFactory.java#L56-L59
signit-wesign/java-sdk
src/main/java/cn/signit/sdk/util/Case.java
Case.to
public static String to(String str, NamingStyle namingStyle) { NamingStyle ns = namingStyle; if (str == null) { return null; } if (ns == null) { ns = NamingStyle.CAMEL; } String formatStr; switch (ns) { case CAMEL: formatStr = toLowerCamel(str); break; case SNAKE: formatStr = toSnake(str); break; case PASCAL: formatStr = toPascal(str); break; case KEBAB: formatStr = toKebab(str); break; default: formatStr = toLowerCamel(str); break; } return formatStr; }
java
public static String to(String str, NamingStyle namingStyle) { NamingStyle ns = namingStyle; if (str == null) { return null; } if (ns == null) { ns = NamingStyle.CAMEL; } String formatStr; switch (ns) { case CAMEL: formatStr = toLowerCamel(str); break; case SNAKE: formatStr = toSnake(str); break; case PASCAL: formatStr = toPascal(str); break; case KEBAB: formatStr = toKebab(str); break; default: formatStr = toLowerCamel(str); break; } return formatStr; }
[ "public", "static", "String", "to", "(", "String", "str", ",", "NamingStyle", "namingStyle", ")", "{", "NamingStyle", "ns", "=", "namingStyle", ";", "if", "(", "str", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "ns", "==", "null", ...
指定具体命名风格来生成相应命名风格的字符串. @param str 待转换字符串. 若为null,则返回null. @param namingStyle 命名风格的枚举. 若namingStyle为null,CAMEL @return namingStyle命名风格的字符串 @author zhd @since 1.0.0
[ "指定具体命名风格来生成相应命名风格的字符串", "." ]
train
https://github.com/signit-wesign/java-sdk/blob/6f3196c9d444818a953396fdaa8ffed9794d9530/src/main/java/cn/signit/sdk/util/Case.java#L261-L288
kikinteractive/ice
ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java
MethodIdProxyFactory.getProxy
public static <C> C getProxy(final Class<C> configInterface) { return getProxy(configInterface, Optional.empty()); }
java
public static <C> C getProxy(final Class<C> configInterface) { return getProxy(configInterface, Optional.empty()); }
[ "public", "static", "<", "C", ">", "C", "getProxy", "(", "final", "Class", "<", "C", ">", "configInterface", ")", "{", "return", "getProxy", "(", "configInterface", ",", "Optional", ".", "empty", "(", ")", ")", ";", "}" ]
Produces a proxy impl of a configuration interface to identify methods called on it
[ "Produces", "a", "proxy", "impl", "of", "a", "configuration", "interface", "to", "identify", "methods", "called", "on", "it" ]
train
https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java#L42-L45
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java
CheerleaderPlayer.getInstance
private static CheerleaderPlayer getInstance(Context context, String clientId) { if (clientId == null) { throw new IllegalArgumentException("Sound cloud client id can't be null."); } if (sInstance == null || sInstance.mIsClosed) { sInstance = new CheerleaderPlayer(context.getApplicationContext(), clientId); } else { sInstance.mClientKey = clientId; } // reset destroy request each time an instance is requested. sInstance.mDestroyDelayed = false; return sInstance; }
java
private static CheerleaderPlayer getInstance(Context context, String clientId) { if (clientId == null) { throw new IllegalArgumentException("Sound cloud client id can't be null."); } if (sInstance == null || sInstance.mIsClosed) { sInstance = new CheerleaderPlayer(context.getApplicationContext(), clientId); } else { sInstance.mClientKey = clientId; } // reset destroy request each time an instance is requested. sInstance.mDestroyDelayed = false; return sInstance; }
[ "private", "static", "CheerleaderPlayer", "getInstance", "(", "Context", "context", ",", "String", "clientId", ")", "{", "if", "(", "clientId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Sound cloud client id can't be null.\"", ")", ...
Simple Sound cloud client initialized with a client id. @param context context used to instantiate internal components, no hard reference will be kept. @param clientId sound cloud client id. @return instance of {@link CheerleaderPlayer}
[ "Simple", "Sound", "cloud", "client", "initialized", "with", "a", "client", "id", "." ]
train
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java#L119-L131
lastaflute/lasta-di
src/main/java/org/lastaflute/di/util/LdiSrl.java
LdiSrl.indexOfFirst
public static IndexOfInfo indexOfFirst(final String str, final String... delimiters) { return doIndexOfFirst(false, str, delimiters); }
java
public static IndexOfInfo indexOfFirst(final String str, final String... delimiters) { return doIndexOfFirst(false, str, delimiters); }
[ "public", "static", "IndexOfInfo", "indexOfFirst", "(", "final", "String", "str", ",", "final", "String", "...", "delimiters", ")", "{", "return", "doIndexOfFirst", "(", "false", ",", "str", ",", "delimiters", ")", ";", "}" ]
Get the index of the first-found delimiter. <pre> indexOfFirst("foo.bar/baz.qux", ".", "/") returns the index of ".bar" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The information of index. (NullAllowed: if delimiter not found)
[ "Get", "the", "index", "of", "the", "first", "-", "found", "delimiter", ".", "<pre", ">", "indexOfFirst", "(", "foo", ".", "bar", "/", "baz", ".", "qux", ".", "/", ")", "returns", "the", "index", "of", ".", "bar", "<", "/", "pre", ">" ]
train
https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L379-L381
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static DefaultTableModel leftShift(DefaultTableModel self, Object row) { if (row == null) { // adds an empty row self.addRow((Object[]) null); return self; } self.addRow(buildRowData(self, row)); return self; }
java
public static DefaultTableModel leftShift(DefaultTableModel self, Object row) { if (row == null) { // adds an empty row self.addRow((Object[]) null); return self; } self.addRow(buildRowData(self, row)); return self; }
[ "public", "static", "DefaultTableModel", "leftShift", "(", "DefaultTableModel", "self", ",", "Object", "row", ")", "{", "if", "(", "row", "==", "null", ")", "{", "// adds an empty row", "self", ".", "addRow", "(", "(", "Object", "[", "]", ")", "null", ")",...
Overloads the left shift operator to provide an easy way to add rows to a DefaultTableModel. <p> if row.size &lt; model.size -&gt; row will be padded with nulls<br> if row.size &gt; model.size -&gt; additional columns will be discarded<br> @param self a DefaultTableModel @param row a row to be added to the model. @return same model, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "rows", "to", "a", "DefaultTableModel", ".", "<p", ">", "if", "row", ".", "size", "&lt", ";", "model", ".", "size", "-", "&gt", ";", "row", "will", "b...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L462-L470
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java
AbstractRouter.getReverseRouteFor
@Override public String getReverseRouteFor(String className, String method) { return getReverseRouteFor(className, method, null); }
java
@Override public String getReverseRouteFor(String className, String method) { return getReverseRouteFor(className, method, null); }
[ "@", "Override", "public", "String", "getReverseRouteFor", "(", "String", "className", ",", "String", "method", ")", "{", "return", "getReverseRouteFor", "(", "className", ",", "method", ",", "null", ")", ";", "}" ]
Gets the url of the route handled by the specified action method. The action does not takes parameters. This implementation delegates to {@link #getReverseRouteFor(String, String, java.util.Map)}. @param className the controller class @param method the controller method @return the url, {@literal null} if the action method is not found
[ "Gets", "the", "url", "of", "the", "route", "handled", "by", "the", "specified", "action", "method", ".", "The", "action", "does", "not", "takes", "parameters", ".", "This", "implementation", "delegates", "to", "{", "@link", "#getReverseRouteFor", "(", "String...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java#L101-L104
bazaarvoice/emodb
sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStreaming.java
DataStoreStreaming.updateAll
public static void updateAll(DataStore dataStore, Iterable<Update> updates) { updateAll(dataStore, updates.iterator(), ImmutableSet.<String>of()); }
java
public static void updateAll(DataStore dataStore, Iterable<Update> updates) { updateAll(dataStore, updates.iterator(), ImmutableSet.<String>of()); }
[ "public", "static", "void", "updateAll", "(", "DataStore", "dataStore", ",", "Iterable", "<", "Update", ">", "updates", ")", "{", "updateAll", "(", "dataStore", ",", "updates", ".", "iterator", "(", ")", ",", "ImmutableSet", ".", "<", "String", ">", "of", ...
Creates, updates or deletes zero or more pieces of content in the data store.
[ "Creates", "updates", "or", "deletes", "zero", "or", "more", "pieces", "of", "content", "in", "the", "data", "store", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStreaming.java#L135-L137
Impetus/Kundera
src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientFactory.java
DSClientFactory.getPolicy
private com.datastax.driver.core.policies.RetryPolicy getPolicy(RetryPolicy policy, Properties props) { com.datastax.driver.core.policies.RetryPolicy retryPolicy = null; String isLoggingRetry = (String) props.get("isLoggingRetry"); switch (policy) { case DowngradingConsistencyRetryPolicy: retryPolicy = DowngradingConsistencyRetryPolicy.INSTANCE; break; case FallthroughRetryPolicy: retryPolicy = FallthroughRetryPolicy.INSTANCE; break; case Custom: retryPolicy = getCustomRetryPolicy(props); break; default: break; } if (retryPolicy != null && Boolean.valueOf(isLoggingRetry)) { retryPolicy = new LoggingRetryPolicy(retryPolicy); } return retryPolicy; }
java
private com.datastax.driver.core.policies.RetryPolicy getPolicy(RetryPolicy policy, Properties props) { com.datastax.driver.core.policies.RetryPolicy retryPolicy = null; String isLoggingRetry = (String) props.get("isLoggingRetry"); switch (policy) { case DowngradingConsistencyRetryPolicy: retryPolicy = DowngradingConsistencyRetryPolicy.INSTANCE; break; case FallthroughRetryPolicy: retryPolicy = FallthroughRetryPolicy.INSTANCE; break; case Custom: retryPolicy = getCustomRetryPolicy(props); break; default: break; } if (retryPolicy != null && Boolean.valueOf(isLoggingRetry)) { retryPolicy = new LoggingRetryPolicy(retryPolicy); } return retryPolicy; }
[ "private", "com", ".", "datastax", ".", "driver", ".", "core", ".", "policies", ".", "RetryPolicy", "getPolicy", "(", "RetryPolicy", "policy", ",", "Properties", "props", ")", "{", "com", ".", "datastax", ".", "driver", ".", "core", ".", "policies", ".", ...
Gets the policy. @param policy the policy @param props the props @return the policy @throws Exception the exception
[ "Gets", "the", "policy", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientFactory.java#L709-L740
romannurik/muzei
muzei-api/src/main/java/com/google/android/apps/muzei/api/MuzeiArtSource.java
MuzeiArtSource.onStartCommand
@Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; mServiceHandler.sendMessage(msg); return mRedelivery ? START_REDELIVER_INTENT : START_NOT_STICKY; }
java
@Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; mServiceHandler.sendMessage(msg); return mRedelivery ? START_REDELIVER_INTENT : START_NOT_STICKY; }
[ "@", "Override", "public", "int", "onStartCommand", "(", "Intent", "intent", ",", "int", "flags", ",", "int", "startId", ")", "{", "super", ".", "onStartCommand", "(", "intent", ",", "flags", ",", "startId", ")", ";", "Message", "msg", "=", "mServiceHandle...
You should not override this method for your MuzeiArtSource. Instead, override {@link #onUpdate}, which Muzei calls when the MuzeiArtSource receives an update request. @see android.app.IntentService#onStartCommand
[ "You", "should", "not", "override", "this", "method", "for", "your", "MuzeiArtSource", ".", "Instead", "override", "{", "@link", "#onUpdate", "}", "which", "Muzei", "calls", "when", "the", "MuzeiArtSource", "receives", "an", "update", "request", "." ]
train
https://github.com/romannurik/muzei/blob/d00777a5fc59f34471be338c814ea85ddcbde304/muzei-api/src/main/java/com/google/android/apps/muzei/api/MuzeiArtSource.java#L356-L364
bmwcarit/joynr
java/core/clustercontroller/src/main/java/io/joynr/accesscontrol/AccessControlAlgorithm.java
AccessControlAlgorithm.getProviderPermission
public Permission getProviderPermission(@Nullable MasterAccessControlEntry master, @Nullable MasterAccessControlEntry mediator, @Nullable OwnerAccessControlEntry owner, TrustLevel trustLevel) { assert (false) : "Provider permission algorithm is not yet implemented!"; return getPermission(PermissionType.PROVIDER, master, mediator, owner, trustLevel); }
java
public Permission getProviderPermission(@Nullable MasterAccessControlEntry master, @Nullable MasterAccessControlEntry mediator, @Nullable OwnerAccessControlEntry owner, TrustLevel trustLevel) { assert (false) : "Provider permission algorithm is not yet implemented!"; return getPermission(PermissionType.PROVIDER, master, mediator, owner, trustLevel); }
[ "public", "Permission", "getProviderPermission", "(", "@", "Nullable", "MasterAccessControlEntry", "master", ",", "@", "Nullable", "MasterAccessControlEntry", "mediator", ",", "@", "Nullable", "OwnerAccessControlEntry", "owner", ",", "TrustLevel", "trustLevel", ")", "{", ...
Get the provider permission for given combination of control entries and with the given trust level. @param master The master access control entry @param mediator The mediator access control entry @param owner The owner access control entry @param trustLevel The trust level of the user sending the message @return provider permission
[ "Get", "the", "provider", "permission", "for", "given", "combination", "of", "control", "entries", "and", "with", "the", "given", "trust", "level", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/clustercontroller/src/main/java/io/joynr/accesscontrol/AccessControlAlgorithm.java#L59-L65
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java
ScenarioPortrayal.addScatterPlot
public void addScatterPlot(String scatterID, String xAxisLabel, String yAxisLabel) throws ShanksException { if (!this.timeCharts.containsKey(scatterID)) { ScatterPlotGenerator scatter = new ScatterPlotGenerator(); scatter.setTitle(scatterID); scatter.setXAxisLabel(xAxisLabel); scatter.setYAxisLabel(yAxisLabel); this.scatterPlots.put(scatterID, scatter); } else { throw new DuplicatedChartIDException(scatterID); } }
java
public void addScatterPlot(String scatterID, String xAxisLabel, String yAxisLabel) throws ShanksException { if (!this.timeCharts.containsKey(scatterID)) { ScatterPlotGenerator scatter = new ScatterPlotGenerator(); scatter.setTitle(scatterID); scatter.setXAxisLabel(xAxisLabel); scatter.setYAxisLabel(yAxisLabel); this.scatterPlots.put(scatterID, scatter); } else { throw new DuplicatedChartIDException(scatterID); } }
[ "public", "void", "addScatterPlot", "(", "String", "scatterID", ",", "String", "xAxisLabel", ",", "String", "yAxisLabel", ")", "throws", "ShanksException", "{", "if", "(", "!", "this", ".", "timeCharts", ".", "containsKey", "(", "scatterID", ")", ")", "{", "...
Add a ScatterPlot to the simulation @param scatterID - An ID for the ScatterPlot @param xAxisLabel - The name of the x axis @param yAxisLabel - The name of the y axis @throws ShanksException
[ "Add", "a", "ScatterPlot", "to", "the", "simulation" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L261-L271
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameterization/ListParameterization.java
ListParameterization.addParameter
public ListParameterization addParameter(String optionid, Object value) { optionid = optionid.startsWith(SerializedParameterization.OPTION_PREFIX) ? optionid.substring(SerializedParameterization.OPTION_PREFIX.length()) : optionid; parameters.add(new ParameterPair(optionid, value)); return this; }
java
public ListParameterization addParameter(String optionid, Object value) { optionid = optionid.startsWith(SerializedParameterization.OPTION_PREFIX) ? optionid.substring(SerializedParameterization.OPTION_PREFIX.length()) : optionid; parameters.add(new ParameterPair(optionid, value)); return this; }
[ "public", "ListParameterization", "addParameter", "(", "String", "optionid", ",", "Object", "value", ")", "{", "optionid", "=", "optionid", ".", "startsWith", "(", "SerializedParameterization", ".", "OPTION_PREFIX", ")", "?", "optionid", ".", "substring", "(", "Se...
Add a parameter to the parameter list @param optionid Option ID @param value Value @return this, for chaining
[ "Add", "a", "parameter", "to", "the", "parameter", "list" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameterization/ListParameterization.java#L123-L127
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java
AbstractJobLauncher.getJobLock
protected JobLock getJobLock(Properties properties, JobLockEventListener jobLockEventListener) throws JobLockException { return LegacyJobLockFactoryManager.getJobLock(properties, jobLockEventListener); }
java
protected JobLock getJobLock(Properties properties, JobLockEventListener jobLockEventListener) throws JobLockException { return LegacyJobLockFactoryManager.getJobLock(properties, jobLockEventListener); }
[ "protected", "JobLock", "getJobLock", "(", "Properties", "properties", ",", "JobLockEventListener", "jobLockEventListener", ")", "throws", "JobLockException", "{", "return", "LegacyJobLockFactoryManager", ".", "getJobLock", "(", "properties", ",", "jobLockEventListener", ")...
Get a {@link JobLock} to be used for the job. @param properties the job properties @param jobLockEventListener the listener for lock events. @return {@link JobLock} to be used for the job @throws JobLockException throw when the {@link JobLock} fails to initialize
[ "Get", "a", "{", "@link", "JobLock", "}", "to", "be", "used", "for", "the", "job", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java#L645-L648
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.WSG84_EL2
@Pure public static Point2d WSG84_EL2(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_2E_N, LAMBERT_2E_C, LAMBERT_2E_XS, LAMBERT_2E_YS); }
java
@Pure public static Point2d WSG84_EL2(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_2E_N, LAMBERT_2E_C, LAMBERT_2E_XS, LAMBERT_2E_YS); }
[ "@", "Pure", "public", "static", "Point2d", "WSG84_EL2", "(", "double", "lambda", ",", "double", "phi", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "WSG84_NTFLamdaPhi", "(", "lambda", ",", "phi", ")", ";", "return", "NTFLambdaPhi_NTFLambert", "(", "ntfL...
This function convert WSG84 GPS coordinate to extended France Lambert II coordinate. @param lambda in degrees. @param phi in degrees. @return the extended France Lambert II coordinates.
[ "This", "function", "convert", "WSG84", "GPS", "coordinate", "to", "extended", "France", "Lambert", "II", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1043-L1052
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/BasePrepareStatement.java
BasePrepareStatement.setTime
public void setTime(final int parameterIndex, final Time time, final Calendar cal) throws SQLException { if (time == null) { setNull(parameterIndex, ColumnType.TIME); return; } setParameter(parameterIndex, new TimeParameter(time, cal != null ? cal.getTimeZone() : TimeZone.getDefault(), useFractionalSeconds)); }
java
public void setTime(final int parameterIndex, final Time time, final Calendar cal) throws SQLException { if (time == null) { setNull(parameterIndex, ColumnType.TIME); return; } setParameter(parameterIndex, new TimeParameter(time, cal != null ? cal.getTimeZone() : TimeZone.getDefault(), useFractionalSeconds)); }
[ "public", "void", "setTime", "(", "final", "int", "parameterIndex", ",", "final", "Time", "time", ",", "final", "Calendar", "cal", ")", "throws", "SQLException", "{", "if", "(", "time", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "Column...
Sets the designated parameter to the given <code>java.sql.Time</code> value, using the given <code>Calendar</code> object. The driver uses the <code>Calendar</code> object to construct an SQL <code>TIME</code> value, which the driver then sends to the database. With a <code>Calendar</code> object, the driver can calculate the time taking into account a custom timezone. If no <code>Calendar</code> object is specified, the driver uses the default timezone, which is that of the virtual machine running the application. @param parameterIndex the first parameter is 1, the second is 2, ... @param time the parameter value @param cal the <code>Calendar</code> object the driver will use to construct the time @throws SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code>
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "<code", ">", "java", ".", "sql", ".", "Time<", "/", "code", ">", "value", "using", "the", "given", "<code", ">", "Calendar<", "/", "code", ">", "object", ".", "The", "driver", "uses", "th...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/BasePrepareStatement.java#L541-L550
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ClassPathUtils.java
ClassPathUtils.toFullyQualifiedPath
@GwtIncompatible("incompatible method") public static String toFullyQualifiedPath(final Package context, final String resourceName) { Validate.notNull(context, "Parameter '%s' must not be null!", "context" ); Validate.notNull(resourceName, "Parameter '%s' must not be null!", "resourceName"); return context.getName().replace('.', '/') + "/" + resourceName; }
java
@GwtIncompatible("incompatible method") public static String toFullyQualifiedPath(final Package context, final String resourceName) { Validate.notNull(context, "Parameter '%s' must not be null!", "context" ); Validate.notNull(resourceName, "Parameter '%s' must not be null!", "resourceName"); return context.getName().replace('.', '/') + "/" + resourceName; }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "String", "toFullyQualifiedPath", "(", "final", "Package", "context", ",", "final", "String", "resourceName", ")", "{", "Validate", ".", "notNull", "(", "context", ",", "\"Parameter '%s...
Returns the fully qualified path for the resource with name {@code resourceName} relative to the given context. <p>Note that this method does not check whether the resource actually exists. It only constructs the path. Null inputs are not allowed.</p> <pre> ClassPathUtils.toFullyQualifiedPath(StringUtils.class.getPackage(), "StringUtils.properties") = "org/apache/commons/lang3/StringUtils.properties" </pre> @param context The context for constructing the path. @param resourceName the resource name to construct the fully qualified path for. @return the fully qualified path of the resource with name {@code resourceName}. @throws java.lang.NullPointerException if either {@code context} or {@code resourceName} is null.
[ "Returns", "the", "fully", "qualified", "path", "for", "the", "resource", "with", "name", "{", "@code", "resourceName", "}", "relative", "to", "the", "given", "context", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassPathUtils.java#L129-L134
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java
CmsMessageBundleEditorTypes.showWarning
static void showWarning(final String caption, final String description) { Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true); warning.setDelayMsec(-1); warning.show(UI.getCurrent().getPage()); }
java
static void showWarning(final String caption, final String description) { Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true); warning.setDelayMsec(-1); warning.show(UI.getCurrent().getPage()); }
[ "static", "void", "showWarning", "(", "final", "String", "caption", ",", "final", "String", "description", ")", "{", "Notification", "warning", "=", "new", "Notification", "(", "caption", ",", "description", ",", "Type", ".", "WARNING_MESSAGE", ",", "true", ")...
Displays a localized warning. @param caption the caption of the warning. @param description the description of the warning.
[ "Displays", "a", "localized", "warning", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java#L1014-L1020
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/SQLParserFactory.java
SQLParserFactory.newInstance
public static SQLParser newInstance(final DatabaseType dbType, final EncryptRule encryptRule, final ShardingTableMetaData shardingTableMetaData, final String sql) { if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) { return new AntlrParsingEngine(dbType, sql, encryptRule, shardingTableMetaData); } throw new SQLParsingUnsupportedException(String.format("Can not support %s", dbType)); }
java
public static SQLParser newInstance(final DatabaseType dbType, final EncryptRule encryptRule, final ShardingTableMetaData shardingTableMetaData, final String sql) { if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) { return new AntlrParsingEngine(dbType, sql, encryptRule, shardingTableMetaData); } throw new SQLParsingUnsupportedException(String.format("Can not support %s", dbType)); }
[ "public", "static", "SQLParser", "newInstance", "(", "final", "DatabaseType", "dbType", ",", "final", "EncryptRule", "encryptRule", ",", "final", "ShardingTableMetaData", "shardingTableMetaData", ",", "final", "String", "sql", ")", "{", "if", "(", "DatabaseType", "....
Create Encrypt SQL parser. @param dbType db type @param encryptRule encrypt rule @param shardingTableMetaData sharding table meta data @param sql sql @return sql parser
[ "Create", "Encrypt", "SQL", "parser", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/SQLParserFactory.java#L125-L130
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java
DefaultURLTemplatesFactory.loadTemplates
private void loadTemplates( Element parent ) { // Load templates List templates = DomUtils.getChildElementsByName( parent, URL_TEMPLATE ); for ( int i = 0; i < templates.size(); i++ ) { Element template = ( Element ) templates.get( i ); String name = getElementText( template, NAME ); if ( name == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template name is missing." ); continue; } String value = getElementText( template, VALUE ); if ( value == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template value is missing for template " + name ); continue; } if ( _log.isDebugEnabled() ) { _log.debug( "[URLTemplate] " + name + " = " + value ); } URLTemplate urlTemplate = new URLTemplate( value, name ); if ( urlTemplate.verify( _knownTokens, _requiredTokens ) ) { _urlTemplates.addTemplate( name, urlTemplate ); } } }
java
private void loadTemplates( Element parent ) { // Load templates List templates = DomUtils.getChildElementsByName( parent, URL_TEMPLATE ); for ( int i = 0; i < templates.size(); i++ ) { Element template = ( Element ) templates.get( i ); String name = getElementText( template, NAME ); if ( name == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template name is missing." ); continue; } String value = getElementText( template, VALUE ); if ( value == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template value is missing for template " + name ); continue; } if ( _log.isDebugEnabled() ) { _log.debug( "[URLTemplate] " + name + " = " + value ); } URLTemplate urlTemplate = new URLTemplate( value, name ); if ( urlTemplate.verify( _knownTokens, _requiredTokens ) ) { _urlTemplates.addTemplate( name, urlTemplate ); } } }
[ "private", "void", "loadTemplates", "(", "Element", "parent", ")", "{", "// Load templates", "List", "templates", "=", "DomUtils", ".", "getChildElementsByName", "(", "parent", ",", "URL_TEMPLATE", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", ...
Loads the templates from a URL template config document. @param parent
[ "Loads", "the", "templates", "from", "a", "URL", "template", "config", "document", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java#L243-L277
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java
RequestUtil.checkSelector
public static boolean checkSelector(SlingHttpServletRequest request, String key) { String[] selectors = request.getRequestPathInfo().getSelectors(); for (String selector : selectors) { if (selector.equals(key)) { return true; } } return false; }
java
public static boolean checkSelector(SlingHttpServletRequest request, String key) { String[] selectors = request.getRequestPathInfo().getSelectors(); for (String selector : selectors) { if (selector.equals(key)) { return true; } } return false; }
[ "public", "static", "boolean", "checkSelector", "(", "SlingHttpServletRequest", "request", ",", "String", "key", ")", "{", "String", "[", "]", "selectors", "=", "request", ".", "getRequestPathInfo", "(", ")", ".", "getSelectors", "(", ")", ";", "for", "(", "...
Retrieves a key in the selectors and returns 'true' is the key is present. @param request the request object with the selector info @param key the selector key which is checked
[ "Retrieves", "a", "key", "in", "the", "selectors", "and", "returns", "true", "is", "the", "key", "is", "present", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java#L73-L81
talenguyen/PrettySharedPreferences
prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java
PrettySharedPreferences.getDoubleEditor
protected DoubleEditor getDoubleEditor(String key) { TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key); if (typeEditor == null) { typeEditor = new DoubleEditor(this, sharedPreferences, key); TYPE_EDITOR_MAP.put(key, typeEditor); } else if (!(typeEditor instanceof DoubleEditor)) { throw new IllegalArgumentException(String.format("key %s is already used for other type", key)); } return (DoubleEditor) typeEditor; }
java
protected DoubleEditor getDoubleEditor(String key) { TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key); if (typeEditor == null) { typeEditor = new DoubleEditor(this, sharedPreferences, key); TYPE_EDITOR_MAP.put(key, typeEditor); } else if (!(typeEditor instanceof DoubleEditor)) { throw new IllegalArgumentException(String.format("key %s is already used for other type", key)); } return (DoubleEditor) typeEditor; }
[ "protected", "DoubleEditor", "getDoubleEditor", "(", "String", "key", ")", "{", "TypeEditor", "typeEditor", "=", "TYPE_EDITOR_MAP", ".", "get", "(", "key", ")", ";", "if", "(", "typeEditor", "==", "null", ")", "{", "typeEditor", "=", "new", "DoubleEditor", "...
Call to get a {@link com.tale.prettysharedpreferences.DoubleEditor} object for the specific key. <code>NOTE:</code> There is a unique {@link com.tale.prettysharedpreferences.TypeEditor} object for a unique key. @param key The name of the preference. @return {@link com.tale.prettysharedpreferences.DoubleEditor} object to be store or retrieve a {@link java.lang.Double} value.
[ "Call", "to", "get", "a", "{" ]
train
https://github.com/talenguyen/PrettySharedPreferences/blob/b97edf86c8fa65be2165f2cd790545c78c971c22/prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java#L129-L139
jayantk/jklol
src/com/jayantkrish/jklol/util/Assignment.java
Assignment.mapVariables
public Assignment mapVariables(Map<Integer, Integer> varMap) { int[] newVarNums = new int[vars.length]; Object[] newValues = new Object[vars.length]; int numFilled = 0; for (int i = 0; i < vars.length; i++) { if (varMap.containsKey(vars[i])) { newVarNums[numFilled] = varMap.get(vars[i]); newValues[numFilled] = values[i]; numFilled++; } } if (numFilled < newVarNums.length) { newVarNums = Arrays.copyOf(newVarNums, numFilled); newValues = Arrays.copyOf(newValues, numFilled); } return Assignment.fromUnsortedArrays(newVarNums, newValues); }
java
public Assignment mapVariables(Map<Integer, Integer> varMap) { int[] newVarNums = new int[vars.length]; Object[] newValues = new Object[vars.length]; int numFilled = 0; for (int i = 0; i < vars.length; i++) { if (varMap.containsKey(vars[i])) { newVarNums[numFilled] = varMap.get(vars[i]); newValues[numFilled] = values[i]; numFilled++; } } if (numFilled < newVarNums.length) { newVarNums = Arrays.copyOf(newVarNums, numFilled); newValues = Arrays.copyOf(newValues, numFilled); } return Assignment.fromUnsortedArrays(newVarNums, newValues); }
[ "public", "Assignment", "mapVariables", "(", "Map", "<", "Integer", ",", "Integer", ">", "varMap", ")", "{", "int", "[", "]", "newVarNums", "=", "new", "int", "[", "vars", ".", "length", "]", ";", "Object", "[", "]", "newValues", "=", "new", "Object", ...
Return a new assignment where each var num has been replaced by its value in varMap.
[ "Return", "a", "new", "assignment", "where", "each", "var", "num", "has", "been", "replaced", "by", "its", "value", "in", "varMap", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/Assignment.java#L359-L377
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java
JGTProcessingRegion.snapToNextHigherInRegionResolution
public static Coordinate snapToNextHigherInRegionResolution( double x, double y, JGTProcessingRegion region ) { double minx = region.getRectangle().getBounds2D().getMinX(); double ewres = region.getWEResolution(); double xsnap = minx + (Math.ceil((x - minx) / ewres) * ewres); double miny = region.getRectangle().getBounds2D().getMinY(); double nsres = region.getNSResolution(); double ysnap = miny + (Math.ceil((y - miny) / nsres) * nsres); return new Coordinate(xsnap, ysnap); }
java
public static Coordinate snapToNextHigherInRegionResolution( double x, double y, JGTProcessingRegion region ) { double minx = region.getRectangle().getBounds2D().getMinX(); double ewres = region.getWEResolution(); double xsnap = minx + (Math.ceil((x - minx) / ewres) * ewres); double miny = region.getRectangle().getBounds2D().getMinY(); double nsres = region.getNSResolution(); double ysnap = miny + (Math.ceil((y - miny) / nsres) * nsres); return new Coordinate(xsnap, ysnap); }
[ "public", "static", "Coordinate", "snapToNextHigherInRegionResolution", "(", "double", "x", ",", "double", "y", ",", "JGTProcessingRegion", "region", ")", "{", "double", "minx", "=", "region", ".", "getRectangle", "(", ")", ".", "getBounds2D", "(", ")", ".", "...
Snaps a geographic point to be on the region grid. <p> Moves the point given by X and Y to be on the grid of the supplied region. </p> @param x the easting of the arbitrary point. @param y the northing of the arbitrary point. @param region the active window from which to take the grid. @return the snapped coordinate.
[ "Snaps", "a", "geographic", "point", "to", "be", "on", "the", "region", "grid", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java#L386-L398
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java
IOUtils.getPDBCharacter
public static String getPDBCharacter(boolean web, char c1, char c2, boolean similar, char c) { String s = String.valueOf(c); return getPDBString(web, c1, c2, similar, s, s, s, s); }
java
public static String getPDBCharacter(boolean web, char c1, char c2, boolean similar, char c) { String s = String.valueOf(c); return getPDBString(web, c1, c2, similar, s, s, s, s); }
[ "public", "static", "String", "getPDBCharacter", "(", "boolean", "web", ",", "char", "c1", ",", "char", "c2", ",", "boolean", "similar", ",", "char", "c", ")", "{", "String", "s", "=", "String", ".", "valueOf", "(", "c", ")", ";", "return", "getPDBStri...
Creates formatted String for a single character of PDB output @param web true for HTML display @param c1 character in first sequence @param c2 character in second sequence @param similar true if c1 and c2 are considered similar compounds @param c character to display @return formatted String
[ "Creates", "formatted", "String", "for", "a", "single", "character", "of", "PDB", "output" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java#L278-L281
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java
RegularPactTask.initOutputs
@SuppressWarnings("unchecked") public static <T> Collector<T> initOutputs(AbstractInvokable nepheleTask, ClassLoader cl, TaskConfig config, List<ChainedDriver<?, ?>> chainedTasksTarget, List<BufferWriter> eventualOutputs) throws Exception { final int numOutputs = config.getNumOutputs(); // check whether we got any chained tasks final int numChained = config.getNumberOfChainedStubs(); if (numChained > 0) { // got chained stubs. that means that this one may only have a single forward connection if (numOutputs != 1 || config.getOutputShipStrategy(0) != ShipStrategyType.FORWARD) { throw new RuntimeException("Plan Generation Bug: Found a chained stub that is not connected via an only forward connection."); } // instantiate each task @SuppressWarnings("rawtypes") Collector previous = null; for (int i = numChained - 1; i >= 0; --i) { // get the task first final ChainedDriver<?, ?> ct; try { Class<? extends ChainedDriver<?, ?>> ctc = config.getChainedTask(i); ct = ctc.newInstance(); } catch (Exception ex) { throw new RuntimeException("Could not instantiate chained task driver.", ex); } // get the configuration for the task final TaskConfig chainedStubConf = config.getChainedStubConfig(i); final String taskName = config.getChainedTaskName(i); if (i == numChained -1) { // last in chain, instantiate the output collector for this task previous = getOutputCollector(nepheleTask, chainedStubConf, cl, eventualOutputs, chainedStubConf.getNumOutputs()); } ct.setup(chainedStubConf, taskName, previous, nepheleTask, cl); chainedTasksTarget.add(0, ct); previous = ct; } // the collector of the first in the chain is the collector for the nephele task return (Collector<T>) previous; } // else // instantiate the output collector the default way from this configuration return getOutputCollector(nepheleTask , config, cl, eventualOutputs, numOutputs); }
java
@SuppressWarnings("unchecked") public static <T> Collector<T> initOutputs(AbstractInvokable nepheleTask, ClassLoader cl, TaskConfig config, List<ChainedDriver<?, ?>> chainedTasksTarget, List<BufferWriter> eventualOutputs) throws Exception { final int numOutputs = config.getNumOutputs(); // check whether we got any chained tasks final int numChained = config.getNumberOfChainedStubs(); if (numChained > 0) { // got chained stubs. that means that this one may only have a single forward connection if (numOutputs != 1 || config.getOutputShipStrategy(0) != ShipStrategyType.FORWARD) { throw new RuntimeException("Plan Generation Bug: Found a chained stub that is not connected via an only forward connection."); } // instantiate each task @SuppressWarnings("rawtypes") Collector previous = null; for (int i = numChained - 1; i >= 0; --i) { // get the task first final ChainedDriver<?, ?> ct; try { Class<? extends ChainedDriver<?, ?>> ctc = config.getChainedTask(i); ct = ctc.newInstance(); } catch (Exception ex) { throw new RuntimeException("Could not instantiate chained task driver.", ex); } // get the configuration for the task final TaskConfig chainedStubConf = config.getChainedStubConfig(i); final String taskName = config.getChainedTaskName(i); if (i == numChained -1) { // last in chain, instantiate the output collector for this task previous = getOutputCollector(nepheleTask, chainedStubConf, cl, eventualOutputs, chainedStubConf.getNumOutputs()); } ct.setup(chainedStubConf, taskName, previous, nepheleTask, cl); chainedTasksTarget.add(0, ct); previous = ct; } // the collector of the first in the chain is the collector for the nephele task return (Collector<T>) previous; } // else // instantiate the output collector the default way from this configuration return getOutputCollector(nepheleTask , config, cl, eventualOutputs, numOutputs); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Collector", "<", "T", ">", "initOutputs", "(", "AbstractInvokable", "nepheleTask", ",", "ClassLoader", "cl", ",", "TaskConfig", "config", ",", "List", "<", "ChainedDriver", ...
Creates a writer for each output. Creates an OutputCollector which forwards its input to all writers. The output collector applies the configured shipping strategy.
[ "Creates", "a", "writer", "for", "each", "output", ".", "Creates", "an", "OutputCollector", "which", "forwards", "its", "input", "to", "all", "writers", ".", "The", "output", "collector", "applies", "the", "configured", "shipping", "strategy", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java#L1314-L1365
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/SloppyMath.java
SloppyMath.intPow
public static double intPow(double b, int e) { double result = 1.0; double currPow = b; while (e > 0) { if ((e & 1) != 0) { result *= currPow; } currPow *= currPow; e >>= 1; } return result; }
java
public static double intPow(double b, int e) { double result = 1.0; double currPow = b; while (e > 0) { if ((e & 1) != 0) { result *= currPow; } currPow *= currPow; e >>= 1; } return result; }
[ "public", "static", "double", "intPow", "(", "double", "b", ",", "int", "e", ")", "{", "double", "result", "=", "1.0", ";", "double", "currPow", "=", "b", ";", "while", "(", "e", ">", "0", ")", "{", "if", "(", "(", "e", "&", "1", ")", "!=", "...
Exponentiation like we learned in grade school: multiply b by itself e times. Uses power of two trick. e must be nonnegative!!! no checking!!! @param b base @param e exponent @return b^e
[ "Exponentiation", "like", "we", "learned", "in", "grade", "school", ":", "multiply", "b", "by", "itself", "e", "times", ".", "Uses", "power", "of", "two", "trick", ".", "e", "must", "be", "nonnegative!!!", "no", "checking!!!" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/SloppyMath.java#L383-L394
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java
MDAG.replaceOrRegister
private void replaceOrRegister(MDAGNode originNode, String str) { char transitionLabelChar = str.charAt(0); MDAGNode relevantTargetNode = originNode.transition(transitionLabelChar); //If relevantTargetNode has transitions and there is at least one char left to process, recursively call //this on the next char in order to further processing down the _transition path corresponding to str if (relevantTargetNode.hasTransitions() && !str.substring(1).isEmpty()) replaceOrRegister(relevantTargetNode, str.substring(1)); ///// //Get the node representing the equivalence class that relevantTargetNode belongs to. MDAGNodes hash on the //transitions paths that can be traversed from them and nodes able to be reached from them; //nodes with the same equivalence classes will hash to the same bucket. MDAGNode equivalentNode = equivalenceClassMDAGNodeHashMap.get(relevantTargetNode); if (equivalentNode == null) //if there is no node with the same right language as relevantTargetNode equivalenceClassMDAGNodeHashMap.put(relevantTargetNode, relevantTargetNode); else if (equivalentNode != relevantTargetNode) //if there is another node with the same right language as relevantTargetNode, reassign the { //_transition between originNode and relevantTargetNode, to originNode and the node representing the equivalence class of interest relevantTargetNode.decrementTargetIncomingTransitionCounts(); transitionCount -= relevantTargetNode.getOutgoingTransitionCount(); //Since this method is recursive, the outgoing transitions of all of relevantTargetNode's child nodes have already been reassigned, //so we only need to decrement the _transition count by the relevantTargetNode's outgoing _transition count originNode.reassignOutgoingTransition(transitionLabelChar, relevantTargetNode, equivalentNode); } }
java
private void replaceOrRegister(MDAGNode originNode, String str) { char transitionLabelChar = str.charAt(0); MDAGNode relevantTargetNode = originNode.transition(transitionLabelChar); //If relevantTargetNode has transitions and there is at least one char left to process, recursively call //this on the next char in order to further processing down the _transition path corresponding to str if (relevantTargetNode.hasTransitions() && !str.substring(1).isEmpty()) replaceOrRegister(relevantTargetNode, str.substring(1)); ///// //Get the node representing the equivalence class that relevantTargetNode belongs to. MDAGNodes hash on the //transitions paths that can be traversed from them and nodes able to be reached from them; //nodes with the same equivalence classes will hash to the same bucket. MDAGNode equivalentNode = equivalenceClassMDAGNodeHashMap.get(relevantTargetNode); if (equivalentNode == null) //if there is no node with the same right language as relevantTargetNode equivalenceClassMDAGNodeHashMap.put(relevantTargetNode, relevantTargetNode); else if (equivalentNode != relevantTargetNode) //if there is another node with the same right language as relevantTargetNode, reassign the { //_transition between originNode and relevantTargetNode, to originNode and the node representing the equivalence class of interest relevantTargetNode.decrementTargetIncomingTransitionCounts(); transitionCount -= relevantTargetNode.getOutgoingTransitionCount(); //Since this method is recursive, the outgoing transitions of all of relevantTargetNode's child nodes have already been reassigned, //so we only need to decrement the _transition count by the relevantTargetNode's outgoing _transition count originNode.reassignOutgoingTransition(transitionLabelChar, relevantTargetNode, equivalentNode); } }
[ "private", "void", "replaceOrRegister", "(", "MDAGNode", "originNode", ",", "String", "str", ")", "{", "char", "transitionLabelChar", "=", "str", ".", "charAt", "(", "0", ")", ";", "MDAGNode", "relevantTargetNode", "=", "originNode", ".", "transition", "(", "t...
在从给定节点开始的一段路径上执行最小化<br> Performs minimization processing on a _transition path starting from a given node. <p/> This entails either replacing a node in the path with one that has an equivalent right language/equivalence class (defined as set of _transition paths that can be traversed and nodes able to be reached from it), or making it a representative of a right language/equivalence class if a such a node does not already exist. @param originNode the MDAGNode that the _transition path corresponding to str starts from @param str a String related to a _transition path
[ "在从给定节点开始的一段路径上执行最小化<br", ">", "Performs", "minimization", "processing", "on", "a", "_transition", "path", "starting", "from", "a", "given", "node", ".", "<p", "/", ">", "This", "entails", "either", "replacing", "a", "node", "in", "the", "path", "with", "one",...
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L539-L564
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java
ConditionalClause.evaluate
@Override public boolean evaluate(FieldManager fieldManager, IndentPrinter printer) { Comparable fieldValue = fieldManager.getValue(fieldName); for (ConditionalTest test : conditionalTests) { boolean result = test.operator.apply(fieldValue, test.parameter); printer.print("- %s => %b", test.operator.description(fieldManager.getDescription(fieldName), fieldValue, test.parameter), result); if (!result) { return false; } } return true; }
java
@Override public boolean evaluate(FieldManager fieldManager, IndentPrinter printer) { Comparable fieldValue = fieldManager.getValue(fieldName); for (ConditionalTest test : conditionalTests) { boolean result = test.operator.apply(fieldValue, test.parameter); printer.print("- %s => %b", test.operator.description(fieldManager.getDescription(fieldName), fieldValue, test.parameter), result); if (!result) { return false; } } return true; }
[ "@", "Override", "public", "boolean", "evaluate", "(", "FieldManager", "fieldManager", ",", "IndentPrinter", "printer", ")", "{", "Comparable", "fieldValue", "=", "fieldManager", ".", "getValue", "(", "fieldName", ")", ";", "for", "(", "ConditionalTest", "test", ...
The test in this conditional clause are implicitly ANDed together, so return false if any of them is false, and continue the loop for each test that is true; @return
[ "The", "test", "in", "this", "conditional", "clause", "are", "implicitly", "ANDed", "together", "so", "return", "false", "if", "any", "of", "them", "is", "false", "and", "continue", "the", "loop", "for", "each", "test", "that", "is", "true", ";" ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java#L66-L77
networknt/light-4j
service/src/main/java/com/networknt/service/SingletonServiceFactory.java
SingletonServiceFactory.handleSingletonClass
private static void handleSingletonClass(String key, String value) throws Exception { Object object = handleValue(value); if(key.contains(",")) { String[] interfaces = key.split(","); for (String anInterface : interfaces) { serviceMap.put(anInterface, object); } } else { serviceMap.put(key, object); } }
java
private static void handleSingletonClass(String key, String value) throws Exception { Object object = handleValue(value); if(key.contains(",")) { String[] interfaces = key.split(","); for (String anInterface : interfaces) { serviceMap.put(anInterface, object); } } else { serviceMap.put(key, object); } }
[ "private", "static", "void", "handleSingletonClass", "(", "String", "key", ",", "String", "value", ")", "throws", "Exception", "{", "Object", "object", "=", "handleValue", "(", "value", ")", ";", "if", "(", "key", ".", "contains", "(", "\",\"", ")", ")", ...
For each singleton definition, create object with the initializer class and method, and push it into the service map with the key of the class name. @param key String class name of the object that needs to be initialized @param value String class name of initializer class and method separated by "::" @throws Exception exception thrown from the object creation
[ "For", "each", "singleton", "definition", "create", "object", "with", "the", "initializer", "class", "and", "method", "and", "push", "it", "into", "the", "service", "map", "with", "the", "key", "of", "the", "class", "name", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L178-L188
sockeqwe/SwipeBack
library/src/com/hannesdorfmann/swipeback/Scroller.java
Scroller.startScroll
public void startScroll(int startX, int startY, int dx, int dy) { startScroll(startX, startY, dx, dy, DEFAULT_DURATION); }
java
public void startScroll(int startX, int startY, int dx, int dy) { startScroll(startX, startY, dx, dy, DEFAULT_DURATION); }
[ "public", "void", "startScroll", "(", "int", "startX", ",", "int", "startY", ",", "int", "dx", ",", "int", "dy", ")", "{", "startScroll", "(", "startX", ",", "startY", ",", "dx", ",", "dy", ",", "DEFAULT_DURATION", ")", ";", "}" ]
Start scrolling by providing a starting point and the distance to travel. The scroll will use the default value of 250 milliseconds for the duration. @param startX Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left. @param startY Starting vertical scroll offset in pixels. Positive numbers will scroll the content up. @param dx Horizontal distance to travel. Positive numbers will scroll the content to the left. @param dy Vertical distance to travel. Positive numbers will scroll the content up.
[ "Start", "scrolling", "by", "providing", "a", "starting", "point", "and", "the", "distance", "to", "travel", ".", "The", "scroll", "will", "use", "the", "default", "value", "of", "250", "milliseconds", "for", "the", "duration", "." ]
train
https://github.com/sockeqwe/SwipeBack/blob/09ed11f48e930ed47fd4f07ad1c786fc9fff3c48/library/src/com/hannesdorfmann/swipeback/Scroller.java#L315-L317
voldemort/voldemort
src/java/voldemort/store/StoreUtils.java
StoreUtils.getStoreDef
public static StoreDefinition getStoreDef(List<StoreDefinition> list, String name) { for(StoreDefinition def: list) if(def.getName().equals(name)) return def; return null; }
java
public static StoreDefinition getStoreDef(List<StoreDefinition> list, String name) { for(StoreDefinition def: list) if(def.getName().equals(name)) return def; return null; }
[ "public", "static", "StoreDefinition", "getStoreDef", "(", "List", "<", "StoreDefinition", ">", "list", ",", "String", "name", ")", "{", "for", "(", "StoreDefinition", "def", ":", "list", ")", "if", "(", "def", ".", "getName", "(", ")", ".", "equals", "(...
Get a store definition from the given list of store definitions @param list A list of store definitions @param name The name of the store @return The store definition
[ "Get", "a", "store", "definition", "from", "the", "given", "list", "of", "store", "definitions" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L210-L215
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/ClassGraphUtil.java
ClassGraphUtil.getSubclassInstances
public synchronized static <T> Set<T> getSubclassInstances(Class<T> parentClass, String... packageNames) { return getNonAbstractSubClasses(parentClass, packageNames).stream() .filter(subclass -> { if (Reflection.canInitiate(subclass)) { return true; } else { System.out.println(subclass + " can not be initiated, ignored."); return false; } }) .map(subclass -> { try { return subclass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); return null; } }).collect(Collectors.toSet()); }
java
public synchronized static <T> Set<T> getSubclassInstances(Class<T> parentClass, String... packageNames) { return getNonAbstractSubClasses(parentClass, packageNames).stream() .filter(subclass -> { if (Reflection.canInitiate(subclass)) { return true; } else { System.out.println(subclass + " can not be initiated, ignored."); return false; } }) .map(subclass -> { try { return subclass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); return null; } }).collect(Collectors.toSet()); }
[ "public", "synchronized", "static", "<", "T", ">", "Set", "<", "T", ">", "getSubclassInstances", "(", "Class", "<", "T", ">", "parentClass", ",", "String", "...", "packageNames", ")", "{", "return", "getNonAbstractSubClasses", "(", "parentClass", ",", "package...
search and create new instances of concrete subclasses, 1 for each. Note that we only initiate subclasses which are with default constructor, those without default constructors we judge them as canInitiate=false. @param parentClass parent class @param packageNames package name prefix @param <T> class generic type @return a set of subclass instances
[ "search", "and", "create", "new", "instances", "of", "concrete", "subclasses", "1", "for", "each", ".", "Note", "that", "we", "only", "initiate", "subclasses", "which", "are", "with", "default", "constructor", "those", "without", "default", "constructors", "we",...
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/ClassGraphUtil.java#L102-L120
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/ReferenceMap.java
ReferenceMap.put
public Object put(Object key, Object value) { if (key == null) throw new NullPointerException("null keys not allowed"); if (value == null) throw new NullPointerException("null values not allowed"); purge(); if (size + 1 > threshold) resize(); int hash = hashCode(key); int index = indexFor(hash); Entry entry = table[index]; while (entry != null) { if ((hash == entry.hash) && equals(key, entry.getKey())) { Object result = entry.getValue(); entry.setValue(value); return result; } entry = entry.next; } this.size++; modCount++; key = toReference(keyType, key, hash); value = toReference(valueType, value, hash); table[index] = new Entry(key, hash, value, table[index]); return null; }
java
public Object put(Object key, Object value) { if (key == null) throw new NullPointerException("null keys not allowed"); if (value == null) throw new NullPointerException("null values not allowed"); purge(); if (size + 1 > threshold) resize(); int hash = hashCode(key); int index = indexFor(hash); Entry entry = table[index]; while (entry != null) { if ((hash == entry.hash) && equals(key, entry.getKey())) { Object result = entry.getValue(); entry.setValue(value); return result; } entry = entry.next; } this.size++; modCount++; key = toReference(keyType, key, hash); value = toReference(valueType, value, hash); table[index] = new Entry(key, hash, value, table[index]); return null; }
[ "public", "Object", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "if", "(", "key", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"null keys not allowed\"", ")", ";", "if", "(", "value", "==", "null", ")", "throw", "n...
Associates the given key with the given value.<P> Neither the key nor the value may be null. @param key the key of the mapping @param value the value of the mapping @return the last value associated with that key, or null if no value was associated with the key @throws java.lang.NullPointerException if either the key or value is null
[ "Associates", "the", "given", "key", "with", "the", "given", "value", ".", "<P", ">", "Neither", "the", "key", "nor", "the", "value", "may", "be", "null", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ReferenceMap.java#L541-L568
OpenLiberty/open-liberty
dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java
SelfExtractor.determineTargetUserDirectory
public static File determineTargetUserDirectory(File wlpInstallDir) { File defaultUserDir = new File(wlpInstallDir, "usr"); File serverEnvFile = new File(wlpInstallDir, "etc/server.env"); if (serverEnvFile.exists()) { //server.env wins, so check it first Properties serverEnvProps = new Properties(); FileInputStream serverEnvStream = null; try { serverEnvStream = new FileInputStream(serverEnvFile); serverEnvProps.load(serverEnvStream); } catch (Exception e) { //Do nothing at the moment, and fall back to default dir. } finally { SelfExtractUtils.tryToClose(serverEnvStream); } String customUserDir = serverEnvProps.getProperty("WLP_USER_DIR"); if (customUserDir != null && !"".equals(customUserDir)) { return new File(customUserDir); } } else { //No server.env, environment variables take next precedence String envVarUserDir = System.getenv("WLP_USER_DIR"); if (envVarUserDir != null && !"".equals(envVarUserDir)) { return new File(envVarUserDir); } } //No server.env setting, or environment variable, so take default return defaultUserDir; }
java
public static File determineTargetUserDirectory(File wlpInstallDir) { File defaultUserDir = new File(wlpInstallDir, "usr"); File serverEnvFile = new File(wlpInstallDir, "etc/server.env"); if (serverEnvFile.exists()) { //server.env wins, so check it first Properties serverEnvProps = new Properties(); FileInputStream serverEnvStream = null; try { serverEnvStream = new FileInputStream(serverEnvFile); serverEnvProps.load(serverEnvStream); } catch (Exception e) { //Do nothing at the moment, and fall back to default dir. } finally { SelfExtractUtils.tryToClose(serverEnvStream); } String customUserDir = serverEnvProps.getProperty("WLP_USER_DIR"); if (customUserDir != null && !"".equals(customUserDir)) { return new File(customUserDir); } } else { //No server.env, environment variables take next precedence String envVarUserDir = System.getenv("WLP_USER_DIR"); if (envVarUserDir != null && !"".equals(envVarUserDir)) { return new File(envVarUserDir); } } //No server.env setting, or environment variable, so take default return defaultUserDir; }
[ "public", "static", "File", "determineTargetUserDirectory", "(", "File", "wlpInstallDir", ")", "{", "File", "defaultUserDir", "=", "new", "File", "(", "wlpInstallDir", ",", "\"usr\"", ")", ";", "File", "serverEnvFile", "=", "new", "File", "(", "wlpInstallDir", "...
Get the user directory, defaulting to <installDir>/usr if WLP_USER_DIR is not set in server.env. @param extractor @return
[ "Get", "the", "user", "directory", "defaulting", "to", "<installDir", ">", "/", "usr", "if", "WLP_USER_DIR", "is", "not", "set", "in", "server", ".", "env", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1041-L1069
alipay/sofa-rpc
extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java
BoltServerProcessor.clientTimeoutWhenSendResponse
private SofaRpcException clientTimeoutWhenSendResponse(String appName, String serviceName, String remoteAddress) { String errorMsg = LogCodes.getLog( LogCodes.ERROR_DISCARD_TIMEOUT_RESPONSE, serviceName, remoteAddress); if (LOGGER.isWarnEnabled(appName)) { LOGGER.warnWithApp(appName, errorMsg); } return new SofaRpcException(RpcErrorType.SERVER_UNDECLARED_ERROR, errorMsg); }
java
private SofaRpcException clientTimeoutWhenSendResponse(String appName, String serviceName, String remoteAddress) { String errorMsg = LogCodes.getLog( LogCodes.ERROR_DISCARD_TIMEOUT_RESPONSE, serviceName, remoteAddress); if (LOGGER.isWarnEnabled(appName)) { LOGGER.warnWithApp(appName, errorMsg); } return new SofaRpcException(RpcErrorType.SERVER_UNDECLARED_ERROR, errorMsg); }
[ "private", "SofaRpcException", "clientTimeoutWhenSendResponse", "(", "String", "appName", ",", "String", "serviceName", ",", "String", "remoteAddress", ")", "{", "String", "errorMsg", "=", "LogCodes", ".", "getLog", "(", "LogCodes", ".", "ERROR_DISCARD_TIMEOUT_RESPONSE"...
客户端已经超时了(例如在业务执行时间太长),丢弃这个返回值 @param appName 应用 @param serviceName 服务 @param remoteAddress 远程地址 @return 丢弃的异常
[ "客户端已经超时了(例如在业务执行时间太长),丢弃这个返回值" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java#L294-L301
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java
JsJmsMapMessageImpl.setFloat
public void setFloat(String name, float value) throws UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setFloat", new Float(value)); getBodyMap().put(name, new Float(value)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setFloat"); }
java
public void setFloat(String name, float value) throws UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setFloat", new Float(value)); getBodyMap().put(name, new Float(value)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setFloat"); }
[ "public", "void", "setFloat", "(", "String", "name", ",", "float", "value", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", ...
/* Set a float value with the given name, into the Map. Javadoc description supplied by JsJmsMessage interface.
[ "/", "*", "Set", "a", "float", "value", "with", "the", "given", "name", "into", "the", "Map", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java#L342-L346
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java
QueryBuilder.addParentIds
public QueryBuilder addParentIds(final Integer id1, final Integer... ids) { parentIds.add(id1); parentIds.addAll(Arrays.asList(ids)); return this; }
java
public QueryBuilder addParentIds(final Integer id1, final Integer... ids) { parentIds.add(id1); parentIds.addAll(Arrays.asList(ids)); return this; }
[ "public", "QueryBuilder", "addParentIds", "(", "final", "Integer", "id1", ",", "final", "Integer", "...", "ids", ")", "{", "parentIds", ".", "add", "(", "id1", ")", ";", "parentIds", ".", "addAll", "(", "Arrays", ".", "asList", "(", "ids", ")", ")", ";...
Add the provided parent IDs to the set of query constraints. @param id1 the first parent ID to add @param ids the subsequent parent IDs to add @return this
[ "Add", "the", "provided", "parent", "IDs", "to", "the", "set", "of", "query", "constraints", "." ]
train
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java#L288-L292
real-logic/agrona
agrona/src/main/java/org/agrona/PrintBufferUtil.java
PrintBufferUtil.hexDump
public static String hexDump(final DirectBuffer buffer, final int fromIndex, final int length) { return HexUtil.hexDump(buffer, fromIndex, length); }
java
public static String hexDump(final DirectBuffer buffer, final int fromIndex, final int length) { return HexUtil.hexDump(buffer, fromIndex, length); }
[ "public", "static", "String", "hexDump", "(", "final", "DirectBuffer", "buffer", ",", "final", "int", "fromIndex", ",", "final", "int", "length", ")", "{", "return", "HexUtil", ".", "hexDump", "(", "buffer", ",", "fromIndex", ",", "length", ")", ";", "}" ]
Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a> of the specified buffer's sub-region. @param buffer dumped buffer @param fromIndex where should we start to print @param length how much should we print @return hex dump in a string representation
[ "Returns", "a", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Hex_dump", ">", "hex", "dump<", "/", "a", ">", "of", "the", "specified", "buffer", "s", "sub", "-", "region", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/PrintBufferUtil.java#L72-L75
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/accumulators/AccumulatorRegistry.java
AccumulatorRegistry.getSnapshot
public AccumulatorSnapshot getSnapshot() { try { return new AccumulatorSnapshot(jobID, taskID, userAccumulators); } catch (Throwable e) { LOG.warn("Failed to serialize accumulators for task.", e); return null; } }
java
public AccumulatorSnapshot getSnapshot() { try { return new AccumulatorSnapshot(jobID, taskID, userAccumulators); } catch (Throwable e) { LOG.warn("Failed to serialize accumulators for task.", e); return null; } }
[ "public", "AccumulatorSnapshot", "getSnapshot", "(", ")", "{", "try", "{", "return", "new", "AccumulatorSnapshot", "(", "jobID", ",", "taskID", ",", "userAccumulators", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "LOG", ".", "warn", "(", "\"Fa...
Creates a snapshot of this accumulator registry. @return a serialized accumulator map
[ "Creates", "a", "snapshot", "of", "this", "accumulator", "registry", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/accumulators/AccumulatorRegistry.java#L55-L62
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/PDBPolymer.java
PDBPolymer.addAtom
@Override public void addAtom(IPDBAtom oAtom, IMonomer oMonomer, IStrand oStrand) { super.addAtom(oAtom, oMonomer, oStrand); if (!sequentialListOfMonomers.contains(oMonomer.getMonomerName())) sequentialListOfMonomers.add(oMonomer.getMonomerName()); }
java
@Override public void addAtom(IPDBAtom oAtom, IMonomer oMonomer, IStrand oStrand) { super.addAtom(oAtom, oMonomer, oStrand); if (!sequentialListOfMonomers.contains(oMonomer.getMonomerName())) sequentialListOfMonomers.add(oMonomer.getMonomerName()); }
[ "@", "Override", "public", "void", "addAtom", "(", "IPDBAtom", "oAtom", ",", "IMonomer", "oMonomer", ",", "IStrand", "oStrand", ")", "{", "super", ".", "addAtom", "(", "oAtom", ",", "oMonomer", ",", "oStrand", ")", ";", "if", "(", "!", "sequentialListOfMon...
Adds the IPDBAtom oAtom to a specified Monomer of a specified Strand. Additionally, it keeps record of the iCode. @param oAtom The IPDBAtom to add @param oMonomer The monomer the atom belongs to
[ "Adds", "the", "IPDBAtom", "oAtom", "to", "a", "specified", "Monomer", "of", "a", "specified", "Strand", ".", "Additionally", "it", "keeps", "record", "of", "the", "iCode", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/PDBPolymer.java#L106-L111
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformDetail.java
WaveformDetail.segmentColor
@SuppressWarnings("WeakerAccess") public Color segmentColor(final int segment, final int scale) { final ByteBuffer waveBytes = getData(); final int limit = getFrameCount(); if (isColor) { int red = 0; int green = 0; int blue = 0; for (int i = segment; (i < segment + scale) && (i < limit); i++) { int bits = getColorWaveformBits(waveBytes, segment); red += (bits >> 13) & 7; green += (bits >> 10) & 7; blue += (bits >> 7) & 7; } return new Color(red * 255 / (scale * 7), blue * 255 / (scale * 7), green * 255 / (scale * 7)); } int sum = 0; for (int i = segment; (i < segment + scale) && (i < limit); i++) { sum += (waveBytes.get(i) & 0xe0) >> 5; } return COLOR_MAP[sum / scale]; }
java
@SuppressWarnings("WeakerAccess") public Color segmentColor(final int segment, final int scale) { final ByteBuffer waveBytes = getData(); final int limit = getFrameCount(); if (isColor) { int red = 0; int green = 0; int blue = 0; for (int i = segment; (i < segment + scale) && (i < limit); i++) { int bits = getColorWaveformBits(waveBytes, segment); red += (bits >> 13) & 7; green += (bits >> 10) & 7; blue += (bits >> 7) & 7; } return new Color(red * 255 / (scale * 7), blue * 255 / (scale * 7), green * 255 / (scale * 7)); } int sum = 0; for (int i = segment; (i < segment + scale) && (i < limit); i++) { sum += (waveBytes.get(i) & 0xe0) >> 5; } return COLOR_MAP[sum / scale]; }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "Color", "segmentColor", "(", "final", "int", "segment", ",", "final", "int", "scale", ")", "{", "final", "ByteBuffer", "waveBytes", "=", "getData", "(", ")", ";", "final", "int", "limit", "=",...
Determine the color of the waveform given an index into it. If {@code scale} is larger than 1 we are zoomed out, so we determine an average color of {@code scale} segments starting with the specified one. @param segment the index of the first waveform byte to examine @param scale the number of wave segments being drawn as a single pixel column @return the color of the waveform at that segment, which may be based on an average of a number of values starting there, determined by the scale
[ "Determine", "the", "color", "of", "the", "waveform", "given", "an", "index", "into", "it", ".", "If", "{", "@code", "scale", "}", "is", "larger", "than", "1", "we", "are", "zoomed", "out", "so", "we", "determine", "an", "average", "color", "of", "{", ...
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetail.java#L250-L271
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/thread/ProcessRunnerTask.java
ProcessRunnerTask.runProcess
public void runProcess(BaseProcess job, Map<String,Object> properties) { job.init(this, null, properties); job.run(); job.free(); }
java
public void runProcess(BaseProcess job, Map<String,Object> properties) { job.init(this, null, properties); job.run(); job.free(); }
[ "public", "void", "runProcess", "(", "BaseProcess", "job", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "job", ".", "init", "(", "this", ",", "null", ",", "properties", ")", ";", "job", ".", "run", "(", ")", ";", "job", "....
Run this process. @param job The process to run. @param properties The properties to pass to this process.
[ "Run", "this", "process", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/ProcessRunnerTask.java#L149-L154
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendar.java
ProjectCalendar.getDaysInRange
private int getDaysInRange(Date startDate, Date endDate) { int result; Calendar cal = DateHelper.popCalendar(endDate); int endDateYear = cal.get(Calendar.YEAR); int endDateDayOfYear = cal.get(Calendar.DAY_OF_YEAR); cal.setTime(startDate); if (endDateYear == cal.get(Calendar.YEAR)) { result = (endDateDayOfYear - cal.get(Calendar.DAY_OF_YEAR)) + 1; } else { result = 0; do { result += (cal.getActualMaximum(Calendar.DAY_OF_YEAR) - cal.get(Calendar.DAY_OF_YEAR)) + 1; cal.roll(Calendar.YEAR, 1); cal.set(Calendar.DAY_OF_YEAR, 1); } while (cal.get(Calendar.YEAR) < endDateYear); result += endDateDayOfYear; } DateHelper.pushCalendar(cal); return result; }
java
private int getDaysInRange(Date startDate, Date endDate) { int result; Calendar cal = DateHelper.popCalendar(endDate); int endDateYear = cal.get(Calendar.YEAR); int endDateDayOfYear = cal.get(Calendar.DAY_OF_YEAR); cal.setTime(startDate); if (endDateYear == cal.get(Calendar.YEAR)) { result = (endDateDayOfYear - cal.get(Calendar.DAY_OF_YEAR)) + 1; } else { result = 0; do { result += (cal.getActualMaximum(Calendar.DAY_OF_YEAR) - cal.get(Calendar.DAY_OF_YEAR)) + 1; cal.roll(Calendar.YEAR, 1); cal.set(Calendar.DAY_OF_YEAR, 1); } while (cal.get(Calendar.YEAR) < endDateYear); result += endDateDayOfYear; } DateHelper.pushCalendar(cal); return result; }
[ "private", "int", "getDaysInRange", "(", "Date", "startDate", ",", "Date", "endDate", ")", "{", "int", "result", ";", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", "(", "endDate", ")", ";", "int", "endDateYear", "=", "cal", ".", "get", "(", "...
This method calculates the absolute number of days between two dates. Note that where two date objects are provided that fall on the same day, this method will return one not zero. Note also that this method assumes that the dates are passed in the correct order, i.e. startDate < endDate. @param startDate Start date @param endDate End date @return number of days in the date range
[ "This", "method", "calculates", "the", "absolute", "number", "of", "days", "between", "two", "dates", ".", "Note", "that", "where", "two", "date", "objects", "are", "provided", "that", "fall", "on", "the", "same", "day", "this", "method", "will", "return", ...
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L978-L1006
google/closure-templates
java/src/com/google/template/soy/soytree/MsgSubstUnitBaseVarNameUtils.java
MsgSubstUnitBaseVarNameUtils.genNaiveBaseNameForExpr
public static String genNaiveBaseNameForExpr(ExprNode exprNode, String fallbackBaseName) { if (exprNode instanceof VarRefNode) { return BaseUtils.convertToUpperUnderscore(((VarRefNode) exprNode).getName()); } else if (exprNode instanceof FieldAccessNode) { return BaseUtils.convertToUpperUnderscore(((FieldAccessNode) exprNode).getFieldName()); } else if (exprNode instanceof GlobalNode) { String globalName = ((GlobalNode) exprNode).getName(); return BaseUtils.convertToUpperUnderscore(BaseUtils.extractPartAfterLastDot(globalName)); } return fallbackBaseName; }
java
public static String genNaiveBaseNameForExpr(ExprNode exprNode, String fallbackBaseName) { if (exprNode instanceof VarRefNode) { return BaseUtils.convertToUpperUnderscore(((VarRefNode) exprNode).getName()); } else if (exprNode instanceof FieldAccessNode) { return BaseUtils.convertToUpperUnderscore(((FieldAccessNode) exprNode).getFieldName()); } else if (exprNode instanceof GlobalNode) { String globalName = ((GlobalNode) exprNode).getName(); return BaseUtils.convertToUpperUnderscore(BaseUtils.extractPartAfterLastDot(globalName)); } return fallbackBaseName; }
[ "public", "static", "String", "genNaiveBaseNameForExpr", "(", "ExprNode", "exprNode", ",", "String", "fallbackBaseName", ")", "{", "if", "(", "exprNode", "instanceof", "VarRefNode", ")", "{", "return", "BaseUtils", ".", "convertToUpperUnderscore", "(", "(", "(", "...
Helper function to generate a base placeholder (or plural/select var) name from an expression, using the naive algorithm. <p>If the expression is a data ref or global, then the last key (if any) is used as the base placeholder name. Otherwise, the fallback name is used. <p>Examples: <ul> <li>{@code $aaaBbb -> AAA_BBB} <li>{@code $aaa_bbb -> AAA_BBB} <li>{@code $aaa.bbb -> BBB} <li>{@code $ij.aaa -> AAA} <li>{@code aaa.BBB -> BBB} <li>{@code $aaa.0 -> fallback} <li>{@code $aaa[0] -> fallback} <li>{@code $aaa[0].bbb -> BBB} <li>{@code length($aaa) -> fallback} <li>{@code $aaa + 1 -> fallback} </ul> @param exprNode The root node for an expression. @param fallbackBaseName The fallback base name. @return The base placeholder (or plural/select var) name for the given expression.
[ "Helper", "function", "to", "generate", "a", "base", "placeholder", "(", "or", "plural", "/", "select", "var", ")", "name", "from", "an", "expression", "using", "the", "naive", "algorithm", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/MsgSubstUnitBaseVarNameUtils.java#L81-L92
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getMappedLdapGroup
@SuppressWarnings("unchecked") public MappedLdapGroup getMappedLdapGroup(final Team team, final String dn) { final Query query = pm.newQuery(MappedLdapGroup.class, "team == :team && dn == :dn"); final List<MappedLdapGroup> result = (List<MappedLdapGroup>) query.execute(team, dn); return Collections.isEmpty(result) ? null : result.get(0); }
java
@SuppressWarnings("unchecked") public MappedLdapGroup getMappedLdapGroup(final Team team, final String dn) { final Query query = pm.newQuery(MappedLdapGroup.class, "team == :team && dn == :dn"); final List<MappedLdapGroup> result = (List<MappedLdapGroup>) query.execute(team, dn); return Collections.isEmpty(result) ? null : result.get(0); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "MappedLdapGroup", "getMappedLdapGroup", "(", "final", "Team", "team", ",", "final", "String", "dn", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "MappedLdapGroup", ".", "cl...
Retrieves a MappedLdapGroup object for the specified Team and LDAP group. @param team a Team object @param dn a String representation of Distinguished Name @return a MappedLdapGroup if found, or null if no mapping exists @since 1.4.0
[ "Retrieves", "a", "MappedLdapGroup", "object", "for", "the", "specified", "Team", "and", "LDAP", "group", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L592-L597
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addComment
protected void addComment(Element element, Content contentTree) { List<? extends DocTree> tags; Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element)); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.block); if (utils.isDeprecated(element)) { div.addContent(span); tags = utils.getBlockTags(element, DocTree.Kind.DEPRECATED); if (!tags.isEmpty()) addInlineDeprecatedComment(element, tags.get(0), div); contentTree.addContent(div); } else { TypeElement encl = utils.getEnclosingTypeElement(element); while (encl != null) { if (utils.isDeprecated(encl)) { div.addContent(span); contentTree.addContent(div); break; } encl = utils.getEnclosingTypeElement(encl); } addSummaryComment(element, contentTree); } }
java
protected void addComment(Element element, Content contentTree) { List<? extends DocTree> tags; Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element)); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.block); if (utils.isDeprecated(element)) { div.addContent(span); tags = utils.getBlockTags(element, DocTree.Kind.DEPRECATED); if (!tags.isEmpty()) addInlineDeprecatedComment(element, tags.get(0), div); contentTree.addContent(div); } else { TypeElement encl = utils.getEnclosingTypeElement(element); while (encl != null) { if (utils.isDeprecated(encl)) { div.addContent(span); contentTree.addContent(div); break; } encl = utils.getEnclosingTypeElement(encl); } addSummaryComment(element, contentTree); } }
[ "protected", "void", "addComment", "(", "Element", "element", ",", "Content", "contentTree", ")", "{", "List", "<", "?", "extends", "DocTree", ">", "tags", ";", "Content", "span", "=", "HtmlTree", ".", "SPAN", "(", "HtmlStyle", ".", "deprecatedLabel", ",", ...
Add comment for each element in the index. If the element is deprecated and it has a @deprecated tag, use that comment. Else if the containing class for this element is deprecated, then add the word "Deprecated." at the start and then print the normal comment. @param element Index element @param contentTree the content tree to which the comment will be added
[ "Add", "comment", "for", "each", "element", "in", "the", "index", ".", "If", "the", "element", "is", "deprecated", "and", "it", "has", "a", "@deprecated", "tag", "use", "that", "comment", ".", "Else", "if", "the", "containing", "class", "for", "this", "e...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L363-L386
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/auth/profile/internal/BasicProfileConfigLoader.java
BasicProfileConfigLoader.loadProfiles
private AllProfiles loadProfiles(InputStream is) throws IOException { ProfilesConfigFileLoaderHelper helper = new ProfilesConfigFileLoaderHelper(); Map<String, Map<String, String>> allProfileProperties = helper .parseProfileProperties(new Scanner(is, StringUtils.UTF8.name())); // Convert the loaded property map to credential objects Map<String, BasicProfile> profilesByName = new LinkedHashMap<String, BasicProfile>(); for (Entry<String, Map<String, String>> entry : allProfileProperties.entrySet()) { String profileName = entry.getKey(); Map<String, String> properties = entry.getValue(); if (profileName.startsWith("profile ")) { LOG.warn( "Your profile name includes a 'profile ' prefix. This is considered part of the profile name in the " + "Java SDK, so you will need to include this prefix in your profile name when you reference this " + "profile from your Java code."); } assertParameterNotEmpty(profileName, "Unable to load properties from profile: Profile name is empty."); profilesByName.put(profileName, new BasicProfile(profileName, properties)); } return new AllProfiles(profilesByName); }
java
private AllProfiles loadProfiles(InputStream is) throws IOException { ProfilesConfigFileLoaderHelper helper = new ProfilesConfigFileLoaderHelper(); Map<String, Map<String, String>> allProfileProperties = helper .parseProfileProperties(new Scanner(is, StringUtils.UTF8.name())); // Convert the loaded property map to credential objects Map<String, BasicProfile> profilesByName = new LinkedHashMap<String, BasicProfile>(); for (Entry<String, Map<String, String>> entry : allProfileProperties.entrySet()) { String profileName = entry.getKey(); Map<String, String> properties = entry.getValue(); if (profileName.startsWith("profile ")) { LOG.warn( "Your profile name includes a 'profile ' prefix. This is considered part of the profile name in the " + "Java SDK, so you will need to include this prefix in your profile name when you reference this " + "profile from your Java code."); } assertParameterNotEmpty(profileName, "Unable to load properties from profile: Profile name is empty."); profilesByName.put(profileName, new BasicProfile(profileName, properties)); } return new AllProfiles(profilesByName); }
[ "private", "AllProfiles", "loadProfiles", "(", "InputStream", "is", ")", "throws", "IOException", "{", "ProfilesConfigFileLoaderHelper", "helper", "=", "new", "ProfilesConfigFileLoaderHelper", "(", ")", ";", "Map", "<", "String", ",", "Map", "<", "String", ",", "S...
Loads the credential profiles from the given input stream. @param is input stream from where the profile details are read.
[ "Loads", "the", "credential", "profiles", "from", "the", "given", "input", "stream", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/profile/internal/BasicProfileConfigLoader.java#L83-L108
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/version/Application.java
Application.getApplicationsFromClassPath
public static Map<String, Application> getApplicationsFromClassPath(final String _application, final List<String> _classpath) throws InstallationException { final Map<String, Application> appls = new HashMap<>(); try { final ClassLoader parent = Application.class.getClassLoader(); final List<URL> urls = new ArrayList<>(); for (final String pathElement : _classpath) { urls.add(new File(pathElement).toURI().toURL()); } final URLClassLoader cl = URLClassLoader.newInstance(urls.toArray(new URL[urls.size()]), parent); // get install application (read from all install xml files) final Enumeration<URL> urlEnum = cl.getResources("META-INF/efaps/install.xml"); while (urlEnum.hasMoreElements()) { // TODO: why class path? final URL url = urlEnum.nextElement(); final Application appl = Application.getApplication(url, new URL(url, "../../../"), _classpath); appls.put(appl.getApplication(), appl); } } catch (final IOException e) { throw new InstallationException("Could not access the install.xml file " + "(in path META-INF/efaps/ path of each eFaps install jar).", e); } return appls; }
java
public static Map<String, Application> getApplicationsFromClassPath(final String _application, final List<String> _classpath) throws InstallationException { final Map<String, Application> appls = new HashMap<>(); try { final ClassLoader parent = Application.class.getClassLoader(); final List<URL> urls = new ArrayList<>(); for (final String pathElement : _classpath) { urls.add(new File(pathElement).toURI().toURL()); } final URLClassLoader cl = URLClassLoader.newInstance(urls.toArray(new URL[urls.size()]), parent); // get install application (read from all install xml files) final Enumeration<URL> urlEnum = cl.getResources("META-INF/efaps/install.xml"); while (urlEnum.hasMoreElements()) { // TODO: why class path? final URL url = urlEnum.nextElement(); final Application appl = Application.getApplication(url, new URL(url, "../../../"), _classpath); appls.put(appl.getApplication(), appl); } } catch (final IOException e) { throw new InstallationException("Could not access the install.xml file " + "(in path META-INF/efaps/ path of each eFaps install jar).", e); } return appls; }
[ "public", "static", "Map", "<", "String", ",", "Application", ">", "getApplicationsFromClassPath", "(", "final", "String", "_application", ",", "final", "List", "<", "String", ">", "_classpath", ")", "throws", "InstallationException", "{", "final", "Map", "<", "...
Method to get all applications from the class path. @param _application searched application in the class path @param _classpath class path (list of the complete class path) @return List of applications @throws InstallationException if the install.xml file in the class path could not be accessed
[ "Method", "to", "get", "all", "applications", "from", "the", "class", "path", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/version/Application.java#L385-L410
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/MultiPageWidget.java
MultiPageWidget.getPageScrollable
public LayoutScroller.ScrollableList getPageScrollable() { return new LayoutScroller.ScrollableList() { @Override public int getScrollingItemsCount() { return MultiPageWidget.super.getScrollingItemsCount(); } @Override public float getViewPortWidth() { return MultiPageWidget.super.getViewPortWidth(); } @Override public float getViewPortHeight() { return MultiPageWidget.super.getViewPortHeight(); } @Override public float getViewPortDepth() { return MultiPageWidget.super.getViewPortDepth(); } @Override public boolean scrollToPosition(int pos, final LayoutScroller.OnScrollListener listener) { return MultiPageWidget.super.scrollToPosition(pos, listener); } @Override public boolean scrollByOffset(float xOffset, float yOffset, float zOffset, final LayoutScroller.OnScrollListener listener) { return MultiPageWidget.super.scrollByOffset(xOffset, yOffset, zOffset, listener); } @Override public void registerDataSetObserver(DataSetObserver observer) { MultiPageWidget.super.registerDataSetObserver(observer); } @Override public void unregisterDataSetObserver(DataSetObserver observer) { MultiPageWidget.super.unregisterDataSetObserver(observer); } @Override public int getCurrentPosition() { return MultiPageWidget.super.getCurrentPosition(); } }; }
java
public LayoutScroller.ScrollableList getPageScrollable() { return new LayoutScroller.ScrollableList() { @Override public int getScrollingItemsCount() { return MultiPageWidget.super.getScrollingItemsCount(); } @Override public float getViewPortWidth() { return MultiPageWidget.super.getViewPortWidth(); } @Override public float getViewPortHeight() { return MultiPageWidget.super.getViewPortHeight(); } @Override public float getViewPortDepth() { return MultiPageWidget.super.getViewPortDepth(); } @Override public boolean scrollToPosition(int pos, final LayoutScroller.OnScrollListener listener) { return MultiPageWidget.super.scrollToPosition(pos, listener); } @Override public boolean scrollByOffset(float xOffset, float yOffset, float zOffset, final LayoutScroller.OnScrollListener listener) { return MultiPageWidget.super.scrollByOffset(xOffset, yOffset, zOffset, listener); } @Override public void registerDataSetObserver(DataSetObserver observer) { MultiPageWidget.super.registerDataSetObserver(observer); } @Override public void unregisterDataSetObserver(DataSetObserver observer) { MultiPageWidget.super.unregisterDataSetObserver(observer); } @Override public int getCurrentPosition() { return MultiPageWidget.super.getCurrentPosition(); } }; }
[ "public", "LayoutScroller", ".", "ScrollableList", "getPageScrollable", "(", ")", "{", "return", "new", "LayoutScroller", ".", "ScrollableList", "(", ")", "{", "@", "Override", "public", "int", "getScrollingItemsCount", "(", ")", "{", "return", "MultiPageWidget", ...
Provides the scrollableList implementation for page scrolling @return {@link LayoutScroller.ScrollableList} implementation, passed to {@link LayoutScroller} for the processing the scrolling
[ "Provides", "the", "scrollableList", "implementation", "for", "page", "scrolling" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/MultiPageWidget.java#L376-L426
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java
ReUtil.replaceAll
public static String replaceAll(CharSequence str, String regex, Func1<Matcher, String> replaceFun) { return replaceAll(str, Pattern.compile(regex), replaceFun); }
java
public static String replaceAll(CharSequence str, String regex, Func1<Matcher, String> replaceFun) { return replaceAll(str, Pattern.compile(regex), replaceFun); }
[ "public", "static", "String", "replaceAll", "(", "CharSequence", "str", ",", "String", "regex", ",", "Func1", "<", "Matcher", ",", "String", ">", "replaceFun", ")", "{", "return", "replaceAll", "(", "str", ",", "Pattern", ".", "compile", "(", "regex", ")",...
替换所有正则匹配的文本,并使用自定义函数决定如何替换 @param str 要替换的字符串 @param regex 用于匹配的正则式 @param replaceFun 决定如何替换的函数 @return 替换后的文本 @since 4.2.2
[ "替换所有正则匹配的文本,并使用自定义函数决定如何替换" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L649-L651
opencb/biodata
biodata-formats/src/main/java/org/opencb/biodata/formats/variant/vcf4/VariantVcfFactory.java
VariantVcfFactory.shouldAddSampleToVariant
private boolean shouldAddSampleToVariant(String genotype, int alleleIdx) { if (genotype.contains(String.valueOf(alleleIdx))) { return true; } if (!genotype.contains("0") && !genotype.contains(".")) { return false; } String[] alleles = genotype.split("[/|]"); for (String allele : alleles) { if (!allele.equals("0") && !allele.equals(".")) { return false; } } return true; }
java
private boolean shouldAddSampleToVariant(String genotype, int alleleIdx) { if (genotype.contains(String.valueOf(alleleIdx))) { return true; } if (!genotype.contains("0") && !genotype.contains(".")) { return false; } String[] alleles = genotype.split("[/|]"); for (String allele : alleles) { if (!allele.equals("0") && !allele.equals(".")) { return false; } } return true; }
[ "private", "boolean", "shouldAddSampleToVariant", "(", "String", "genotype", ",", "int", "alleleIdx", ")", "{", "if", "(", "genotype", ".", "contains", "(", "String", ".", "valueOf", "(", "alleleIdx", ")", ")", ")", "{", "return", "true", ";", "}", "if", ...
Checks whether a sample should be included in a variant's list of samples. If current allele index is not found in the genotype and not all alleles are references/missing, then the sample must not be included. @param genotype The genotype @param alleleIdx The index of the allele @return If the sample should be associated to the variant
[ "Checks", "whether", "a", "sample", "should", "be", "included", "in", "a", "variant", "s", "list", "of", "samples", ".", "If", "current", "allele", "index", "is", "not", "found", "in", "the", "genotype", "and", "not", "all", "alleles", "are", "references",...
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-formats/src/main/java/org/opencb/biodata/formats/variant/vcf4/VariantVcfFactory.java#L160-L177
google/closure-compiler
src/com/google/javascript/jscomp/AbstractCommandLineRunner.java
AbstractCommandLineRunner.printManifestTo
@VisibleForTesting @GwtIncompatible("Unnecessary") void printManifestTo(Iterable<CompilerInput> inputs, Appendable out) throws IOException { for (CompilerInput input : inputs) { String rootRelativePath = rootRelativePathsMap.get(input.getName()); String displayName = rootRelativePath != null ? rootRelativePath : input.getName(); out.append(displayName); out.append("\n"); } }
java
@VisibleForTesting @GwtIncompatible("Unnecessary") void printManifestTo(Iterable<CompilerInput> inputs, Appendable out) throws IOException { for (CompilerInput input : inputs) { String rootRelativePath = rootRelativePathsMap.get(input.getName()); String displayName = rootRelativePath != null ? rootRelativePath : input.getName(); out.append(displayName); out.append("\n"); } }
[ "@", "VisibleForTesting", "@", "GwtIncompatible", "(", "\"Unnecessary\"", ")", "void", "printManifestTo", "(", "Iterable", "<", "CompilerInput", ">", "inputs", ",", "Appendable", "out", ")", "throws", "IOException", "{", "for", "(", "CompilerInput", "input", ":", ...
Prints a list of input names (using root-relative paths), delimited by newlines, to the manifest file.
[ "Prints", "a", "list", "of", "input", "names", "(", "using", "root", "-", "relative", "paths", ")", "delimited", "by", "newlines", "to", "the", "manifest", "file", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractCommandLineRunner.java#L2088-L2099
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/ERTrees.java
ERTrees.evaluateFeatureImportance
public <Type extends DataSet> OnLineStatistics[] evaluateFeatureImportance(DataSet<Type> data) { if(data instanceof ClassificationDataSet) return evaluateFeatureImportance(data, new MDI(ImpurityScore.ImpurityMeasure.GINI)); else return evaluateFeatureImportance(data, new ImportanceByUses()); }
java
public <Type extends DataSet> OnLineStatistics[] evaluateFeatureImportance(DataSet<Type> data) { if(data instanceof ClassificationDataSet) return evaluateFeatureImportance(data, new MDI(ImpurityScore.ImpurityMeasure.GINI)); else return evaluateFeatureImportance(data, new ImportanceByUses()); }
[ "public", "<", "Type", "extends", "DataSet", ">", "OnLineStatistics", "[", "]", "evaluateFeatureImportance", "(", "DataSet", "<", "Type", ">", "data", ")", "{", "if", "(", "data", "instanceof", "ClassificationDataSet", ")", "return", "evaluateFeatureImportance", "...
Measures the statistics of feature importance from the trees in this forest. For classification datasets, the {@link MDI} method with Gini impurity will be used. For others, the {@link ImportanceByUses} method will be used. This may change in the future. @param <Type> @param data the dataset to infer the feature importance from with respect to the current model. @return an array of statistics, which each index corresponds to a specific feature. Numeric features start from the zero index, categorical features start from the index equal to the number of numeric features.
[ "Measures", "the", "statistics", "of", "feature", "importance", "from", "the", "trees", "in", "this", "forest", ".", "For", "classification", "datasets", "the", "{", "@link", "MDI", "}", "method", "with", "Gini", "impurity", "will", "be", "used", ".", "For",...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/ERTrees.java#L97-L103
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/CertificatesInner.java
CertificatesInner.getByResourceGroupAsync
public Observable<CertificateInner> getByResourceGroupAsync(String resourceGroupName, String name) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() { @Override public CertificateInner call(ServiceResponse<CertificateInner> response) { return response.body(); } }); }
java
public Observable<CertificateInner> getByResourceGroupAsync(String resourceGroupName, String name) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() { @Override public CertificateInner call(ServiceResponse<CertificateInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CertificateInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "...
Get a certificate. Get a certificate. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the certificate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateInner object
[ "Get", "a", "certificate", ".", "Get", "a", "certificate", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/CertificatesInner.java#L373-L380
google/error-prone
check_api/src/main/java/com/google/errorprone/dataflow/ConstantPropagationAnalysis.java
ConstantPropagationAnalysis.numberValue
@Nullable public static Number numberValue(TreePath exprPath, Context context) { Constant val = DataFlow.expressionDataflow(exprPath, context, CONSTANT_PROPAGATION); if (val == null || !val.isConstant()) { return null; } return val.getValue(); }
java
@Nullable public static Number numberValue(TreePath exprPath, Context context) { Constant val = DataFlow.expressionDataflow(exprPath, context, CONSTANT_PROPAGATION); if (val == null || !val.isConstant()) { return null; } return val.getValue(); }
[ "@", "Nullable", "public", "static", "Number", "numberValue", "(", "TreePath", "exprPath", ",", "Context", "context", ")", "{", "Constant", "val", "=", "DataFlow", ".", "expressionDataflow", "(", "exprPath", ",", "context", ",", "CONSTANT_PROPAGATION", ")", ";",...
Returns the value of the leaf of {@code exprPath}, if it is determined to be a constant (always evaluates to the same numeric value), and null otherwise. Note that returning null does not necessarily mean the expression is *not* a constant.
[ "Returns", "the", "value", "of", "the", "leaf", "of", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/dataflow/ConstantPropagationAnalysis.java#L36-L43
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.getAsync
public Observable<VirtualMachineExtensionInner> getAsync(String resourceGroupName, String vmName, String vmExtensionName) { return getWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() { @Override public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineExtensionInner> getAsync(String resourceGroupName, String vmName, String vmExtensionName) { return getWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() { @Override public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineExtensionInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "String", "vmExtensionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ",", ...
The operation to get the extension. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine containing the extension. @param vmExtensionName The name of the virtual machine extension. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineExtensionInner object
[ "The", "operation", "to", "get", "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#L670-L677
stephenc/java-iso-tools
iso9660-writer/src/main/java/com/github/stephenc/javaisotools/rockridge/impl/RockRidgeConfig.java
RockRidgeConfig.addModeForPattern
public void addModeForPattern(String pattern, Integer mode) { System.out.println(String.format("*** Recording pattern \"%s\" with mode %o", pattern, mode)); patternToModeMap.put(pattern, mode); }
java
public void addModeForPattern(String pattern, Integer mode) { System.out.println(String.format("*** Recording pattern \"%s\" with mode %o", pattern, mode)); patternToModeMap.put(pattern, mode); }
[ "public", "void", "addModeForPattern", "(", "String", "pattern", ",", "Integer", "mode", ")", "{", "System", ".", "out", ".", "println", "(", "String", ".", "format", "(", "\"*** Recording pattern \\\"%s\\\" with mode %o\"", ",", "pattern", ",", "mode", ")", ")"...
Add a new mode for a specific file pattern. @param pattern the pattern to be matched @param mode the POSIX file mode for matching filenames
[ "Add", "a", "new", "mode", "for", "a", "specific", "file", "pattern", "." ]
train
https://github.com/stephenc/java-iso-tools/blob/828c50b02eb311a14dde0dab43462a0d0c9dfb06/iso9660-writer/src/main/java/com/github/stephenc/javaisotools/rockridge/impl/RockRidgeConfig.java#L95-L98
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_tcp_route_POST
public OvhRouteTcp serviceName_tcp_route_POST(String serviceName, OvhRouteTcpAction action, String displayName, Long frontendId, Long weight) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/route"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); addBody(o, "displayName", displayName); addBody(o, "frontendId", frontendId); addBody(o, "weight", weight); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRouteTcp.class); }
java
public OvhRouteTcp serviceName_tcp_route_POST(String serviceName, OvhRouteTcpAction action, String displayName, Long frontendId, Long weight) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/route"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); addBody(o, "displayName", displayName); addBody(o, "frontendId", frontendId); addBody(o, "weight", weight); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRouteTcp.class); }
[ "public", "OvhRouteTcp", "serviceName_tcp_route_POST", "(", "String", "serviceName", ",", "OvhRouteTcpAction", "action", ",", "String", "displayName", ",", "Long", "frontendId", ",", "Long", "weight", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip...
Add a new TCP route to your frontend REST: POST /ipLoadbalancing/{serviceName}/tcp/route @param weight [required] Route priority ([0..255]). 0 if null. Highest priority routes are evaluated last. Only the first matching route will trigger an action @param frontendId [required] Route traffic for this frontend @param action [required] Action triggered when all rules match @param displayName [required] Human readable name for your route, this field is for you @param serviceName [required] The internal name of your IP load balancing
[ "Add", "a", "new", "TCP", "route", "to", "your", "frontend" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1287-L1297
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/TypePoolInfoMap.java
TypePoolInfoMap.containsKey
public boolean containsKey(ResourceType type, PoolInfo poolInfo) { Map<PoolInfo, V> poolInfoMap = typePoolInfoMap.get(type); if (poolInfoMap == null) { return false; } return poolInfoMap.containsKey(poolInfo); }
java
public boolean containsKey(ResourceType type, PoolInfo poolInfo) { Map<PoolInfo, V> poolInfoMap = typePoolInfoMap.get(type); if (poolInfoMap == null) { return false; } return poolInfoMap.containsKey(poolInfo); }
[ "public", "boolean", "containsKey", "(", "ResourceType", "type", ",", "PoolInfo", "poolInfo", ")", "{", "Map", "<", "PoolInfo", ",", "V", ">", "poolInfoMap", "=", "typePoolInfoMap", ".", "get", "(", "type", ")", ";", "if", "(", "poolInfoMap", "==", "null",...
Is the value set with the appropriate keys? @param type Resource type @param poolInfo Pool info @return True if this map contains a mapping for the specified key, false otherwise
[ "Is", "the", "value", "set", "with", "the", "appropriate", "keys?" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/TypePoolInfoMap.java#L77-L83
beanshell/beanshell
src/main/java/bsh/classpath/ClassManagerImpl.java
ClassManagerImpl.defineClass
@Override public Class defineClass( String name, byte [] code ) { baseClassPath.setClassSource( name, new GeneratedClassSource( code ) ); try { reloadClasses( new String [] { name } ); } catch ( ClassPathException e ) { throw new bsh.InterpreterError("defineClass: "+e, e); } return classForName( name ); }
java
@Override public Class defineClass( String name, byte [] code ) { baseClassPath.setClassSource( name, new GeneratedClassSource( code ) ); try { reloadClasses( new String [] { name } ); } catch ( ClassPathException e ) { throw new bsh.InterpreterError("defineClass: "+e, e); } return classForName( name ); }
[ "@", "Override", "public", "Class", "defineClass", "(", "String", "name", ",", "byte", "[", "]", "code", ")", "{", "baseClassPath", ".", "setClassSource", "(", "name", ",", "new", "GeneratedClassSource", "(", "code", ")", ")", ";", "try", "{", "reloadClass...
/* Impl Notes: We add the bytecode source and the "reload" the class, which causes the BshClassLoader to be initialized and create a DiscreteFilesClassLoader for the bytecode. @exception ClassPathException can be thrown by reloadClasses
[ "/", "*", "Impl", "Notes", ":", "We", "add", "the", "bytecode", "source", "and", "the", "reload", "the", "class", "which", "causes", "the", "BshClassLoader", "to", "be", "initialized", "and", "create", "a", "DiscreteFilesClassLoader", "for", "the", "bytecode",...
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/classpath/ClassManagerImpl.java#L554-L564
alexvasilkov/GestureViews
library/src/main/java/com/alexvasilkov/gestures/animation/ViewPosition.java
ViewPosition.unpack
@SuppressWarnings("unused") // Public API public static ViewPosition unpack(String str) { String[] parts = TextUtils.split(str, SPLIT_PATTERN); if (parts.length != 4) { throw new IllegalArgumentException("Wrong ViewPosition string: " + str); } Rect view = Rect.unflattenFromString(parts[0]); Rect viewport = Rect.unflattenFromString(parts[1]); Rect visible = Rect.unflattenFromString(parts[2]); Rect image = Rect.unflattenFromString(parts[3]); if (view == null || viewport == null || image == null) { throw new IllegalArgumentException("Wrong ViewPosition string: " + str); } return new ViewPosition(view, viewport, visible, image); }
java
@SuppressWarnings("unused") // Public API public static ViewPosition unpack(String str) { String[] parts = TextUtils.split(str, SPLIT_PATTERN); if (parts.length != 4) { throw new IllegalArgumentException("Wrong ViewPosition string: " + str); } Rect view = Rect.unflattenFromString(parts[0]); Rect viewport = Rect.unflattenFromString(parts[1]); Rect visible = Rect.unflattenFromString(parts[2]); Rect image = Rect.unflattenFromString(parts[3]); if (view == null || viewport == null || image == null) { throw new IllegalArgumentException("Wrong ViewPosition string: " + str); } return new ViewPosition(view, viewport, visible, image); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "// Public API", "public", "static", "ViewPosition", "unpack", "(", "String", "str", ")", "{", "String", "[", "]", "parts", "=", "TextUtils", ".", "split", "(", "str", ",", "SPLIT_PATTERN", ")", ";", "if", "...
Restores ViewPosition from the string created by {@link #pack()} method. @param str Serialized position string @return De-serialized position
[ "Restores", "ViewPosition", "from", "the", "string", "created", "by", "{", "@link", "#pack", "()", "}", "method", "." ]
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/animation/ViewPosition.java#L197-L214
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AnalysisContext.java
AnalysisContext.lookupSystemClass
public static JavaClass lookupSystemClass(@Nonnull String className) throws ClassNotFoundException { // TODO: eventually we should move to our own thread-safe repository // implementation requireNonNull (className, "className is null"); if (originalRepository == null) { throw new IllegalStateException("originalRepository is null"); } JavaClass clazz = originalRepository.findClass(className); if(clazz != null){ return clazz; } // XXX workaround for system classes missing on Java 9 // Not sure if we BCEL update, but this seem to work in simple cases return AnalysisContext.currentAnalysisContext().lookupClass(className); }
java
public static JavaClass lookupSystemClass(@Nonnull String className) throws ClassNotFoundException { // TODO: eventually we should move to our own thread-safe repository // implementation requireNonNull (className, "className is null"); if (originalRepository == null) { throw new IllegalStateException("originalRepository is null"); } JavaClass clazz = originalRepository.findClass(className); if(clazz != null){ return clazz; } // XXX workaround for system classes missing on Java 9 // Not sure if we BCEL update, but this seem to work in simple cases return AnalysisContext.currentAnalysisContext().lookupClass(className); }
[ "public", "static", "JavaClass", "lookupSystemClass", "(", "@", "Nonnull", "String", "className", ")", "throws", "ClassNotFoundException", "{", "// TODO: eventually we should move to our own thread-safe repository", "// implementation", "requireNonNull", "(", "className", ",", ...
This is equivalent to Repository.lookupClass() or this.lookupClass(), except it uses the original Repository instead of the current one. This can be important because URLClassPathRepository objects are closed after an analysis, so JavaClass objects obtained from them are no good on subsequent runs. @param className the name of the class @return the JavaClass representing the class @throws ClassNotFoundException
[ "This", "is", "equivalent", "to", "Repository", ".", "lookupClass", "()", "or", "this", ".", "lookupClass", "()", "except", "it", "uses", "the", "original", "Repository", "instead", "of", "the", "current", "one", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AnalysisContext.java#L540-L555
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/CASH.java
CASH.buildDerivatorDB
private Database buildDerivatorDB(Relation<ParameterizationFunction> relation, DBIDs ids) { ProxyDatabase proxy = new ProxyDatabase(ids); int dim = dimensionality(relation); SimpleTypeInformation<DoubleVector> type = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); MaterializedRelation<DoubleVector> prep = new MaterializedRelation<>(type, ids); proxy.addRelation(prep); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { prep.insert(iter, DoubleVector.wrap(relation.get(iter).getColumnVector())); } return proxy; }
java
private Database buildDerivatorDB(Relation<ParameterizationFunction> relation, DBIDs ids) { ProxyDatabase proxy = new ProxyDatabase(ids); int dim = dimensionality(relation); SimpleTypeInformation<DoubleVector> type = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); MaterializedRelation<DoubleVector> prep = new MaterializedRelation<>(type, ids); proxy.addRelation(prep); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { prep.insert(iter, DoubleVector.wrap(relation.get(iter).getColumnVector())); } return proxy; }
[ "private", "Database", "buildDerivatorDB", "(", "Relation", "<", "ParameterizationFunction", ">", "relation", ",", "DBIDs", "ids", ")", "{", "ProxyDatabase", "proxy", "=", "new", "ProxyDatabase", "(", "ids", ")", ";", "int", "dim", "=", "dimensionality", "(", ...
Builds a database for the derivator consisting of the ids in the specified interval. @param relation the database storing the parameterization functions @param ids the ids to build the database from @return a database for the derivator consisting of the ids in the specified interval
[ "Builds", "a", "database", "for", "the", "derivator", "consisting", "of", "the", "ids", "in", "the", "specified", "interval", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/CASH.java#L719-L731