repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.parsePathExpr | private void parsePathExpr() throws TTXPathException {
if (is(TokenType.SLASH, true)) {
// path expression starts from the root
mPipeBuilder.addStep(new DocumentNodeAxis(getTransaction()));
final TokenType type = mToken.getType();
if (type != TokenType.END && type != TokenType.COMMA) {
// all immediately following keywords or '*' are nametests, not
// operators
// leading-lone-slash constrain
parseRelativePathExpr();
}
} else if (is(TokenType.DESC_STEP, true)) {
// path expression starts from the root with a descendant-or-self
// step
mPipeBuilder.addStep(new DocumentNodeAxis(getTransaction()));
final AbsAxis mAxis = new DescendantAxis(getTransaction(), true);
mPipeBuilder.addStep(mAxis);
parseRelativePathExpr();
} else {
parseRelativePathExpr();
}
} | java | private void parsePathExpr() throws TTXPathException {
if (is(TokenType.SLASH, true)) {
// path expression starts from the root
mPipeBuilder.addStep(new DocumentNodeAxis(getTransaction()));
final TokenType type = mToken.getType();
if (type != TokenType.END && type != TokenType.COMMA) {
// all immediately following keywords or '*' are nametests, not
// operators
// leading-lone-slash constrain
parseRelativePathExpr();
}
} else if (is(TokenType.DESC_STEP, true)) {
// path expression starts from the root with a descendant-or-self
// step
mPipeBuilder.addStep(new DocumentNodeAxis(getTransaction()));
final AbsAxis mAxis = new DescendantAxis(getTransaction(), true);
mPipeBuilder.addStep(mAxis);
parseRelativePathExpr();
} else {
parseRelativePathExpr();
}
} | [
"private",
"void",
"parsePathExpr",
"(",
")",
"throws",
"TTXPathException",
"{",
"if",
"(",
"is",
"(",
"TokenType",
".",
"SLASH",
",",
"true",
")",
")",
"{",
"// path expression starts from the root",
"mPipeBuilder",
".",
"addStep",
"(",
"new",
"DocumentNodeAxis",... | Parses the the rule PathExpr according to the following production rule:
<p>
[25] PathExpr ::= ("/" RelativePathExpr?) | ("//" RelativePathExpr) | RelativePathExpr .
</p>
@throws TTXPathException | [
"Parses",
"the",
"the",
"rule",
"PathExpr",
"according",
"to",
"the",
"following",
"production",
"rule",
":",
"<p",
">",
"[",
"25",
"]",
"PathExpr",
"::",
"=",
"(",
"/",
"RelativePathExpr?",
")",
"|",
"(",
"//",
"RelativePathExpr",
")",
"|",
"RelativePathE... | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L683-L711 |
sahan/RoboZombie | robozombie/src/main/java/com/lonepulse/robozombie/executor/AsyncExecutionHandler.java | AsyncExecutionHandler.onError | @Override
public void onError(InvocationContext context, Exception error) {
AsyncHandler<Object> asyncHandler = getAsyncHandler(context);
if(asyncHandler != null) {
try {
asyncHandler.onError(error instanceof InvocationException?
(InvocationException)error :InvocationException.newInstance(context, error));
}
catch(Exception e) {
Log.e(getClass().getSimpleName(), "Callback \"onError\" aborted with an exception.", e);
}
}
} | java | @Override
public void onError(InvocationContext context, Exception error) {
AsyncHandler<Object> asyncHandler = getAsyncHandler(context);
if(asyncHandler != null) {
try {
asyncHandler.onError(error instanceof InvocationException?
(InvocationException)error :InvocationException.newInstance(context, error));
}
catch(Exception e) {
Log.e(getClass().getSimpleName(), "Callback \"onError\" aborted with an exception.", e);
}
}
} | [
"@",
"Override",
"public",
"void",
"onError",
"(",
"InvocationContext",
"context",
",",
"Exception",
"error",
")",
"{",
"AsyncHandler",
"<",
"Object",
">",
"asyncHandler",
"=",
"getAsyncHandler",
"(",
"context",
")",
";",
"if",
"(",
"asyncHandler",
"!=",
"null... | <p>If an {@link AsyncHandler} is defined, any exception which resulted in an error will be
available via the <i>onError</i> callback.</p>
<p>See {@link ExecutionHandler#onError(InvocationContext, Exception)}</p>
@param context
the {@link InvocationContext} with information on the proxy invocation
<br><br>
@param error
the exception which resulted in a request execution failure
<br><br>
@since 1.3.0 | [
"<p",
">",
"If",
"an",
"{",
"@link",
"AsyncHandler",
"}",
"is",
"defined",
"any",
"exception",
"which",
"resulted",
"in",
"an",
"error",
"will",
"be",
"available",
"via",
"the",
"<i",
">",
"onError<",
"/",
"i",
">",
"callback",
".",
"<",
"/",
"p",
">... | train | https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/com/lonepulse/robozombie/executor/AsyncExecutionHandler.java#L178-L195 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.newWriter | public static Writer newWriter(OutputStream stream, String charset) throws UnsupportedEncodingException {
return new OutputStreamWriter(stream, charset);
} | java | public static Writer newWriter(OutputStream stream, String charset) throws UnsupportedEncodingException {
return new OutputStreamWriter(stream, charset);
} | [
"public",
"static",
"Writer",
"newWriter",
"(",
"OutputStream",
"stream",
",",
"String",
"charset",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"new",
"OutputStreamWriter",
"(",
"stream",
",",
"charset",
")",
";",
"}"
] | Creates a writer for this stream using the given charset.
@param stream the stream which is used and then closed
@param charset the charset used
@return the newly created Writer
@throws UnsupportedEncodingException if an encoding exception occurs.
@since 2.2.0 | [
"Creates",
"a",
"writer",
"for",
"this",
"stream",
"using",
"the",
"given",
"charset",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1281-L1283 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/messaging/JMSManager.java | JMSManager.createDestination | public Destination createDestination(String name, DestinationType type)
throws MessagingException {
return this.createDestination(name, type, false, Session.AUTO_ACKNOWLEDGE);
} | java | public Destination createDestination(String name, DestinationType type)
throws MessagingException {
return this.createDestination(name, type, false, Session.AUTO_ACKNOWLEDGE);
} | [
"public",
"Destination",
"createDestination",
"(",
"String",
"name",
",",
"DestinationType",
"type",
")",
"throws",
"MessagingException",
"{",
"return",
"this",
".",
"createDestination",
"(",
"name",
",",
"type",
",",
"false",
",",
"Session",
".",
"AUTO_ACKNOWLEDG... | Creates a Destination. This is a convenience method which is the
same as calling:
<code>createDestination(name, type, false, Session.AUTO_ACKNOWLEDGE)</code> | [
"Creates",
"a",
"Destination",
".",
"This",
"is",
"a",
"convenience",
"method",
"which",
"is",
"the",
"same",
"as",
"calling",
":",
"<code",
">",
"createDestination",
"(",
"name",
"type",
"false",
"Session",
".",
"AUTO_ACKNOWLEDGE",
")",
"<",
"/",
"code",
... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/messaging/JMSManager.java#L168-L171 |
keyboardsurfer/Crouton | library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java | Crouton.make | public static Crouton make(Activity activity, View customView, ViewGroup viewGroup) {
return new Crouton(activity, customView, viewGroup);
} | java | public static Crouton make(Activity activity, View customView, ViewGroup viewGroup) {
return new Crouton(activity, customView, viewGroup);
} | [
"public",
"static",
"Crouton",
"make",
"(",
"Activity",
"activity",
",",
"View",
"customView",
",",
"ViewGroup",
"viewGroup",
")",
"{",
"return",
"new",
"Crouton",
"(",
"activity",
",",
"customView",
",",
"viewGroup",
")",
";",
"}"
] | Creates a {@link Crouton} with provided text-resource and style for a given
activity.
@param activity
The {@link Activity} that represents the context in which the Crouton should exist.
@param customView
The custom {@link View} to display
@param viewGroup
The {@link ViewGroup} that this {@link Crouton} should be added to.
@return The created {@link Crouton}. | [
"Creates",
"a",
"{",
"@link",
"Crouton",
"}",
"with",
"provided",
"text",
"-",
"resource",
"and",
"style",
"for",
"a",
"given",
"activity",
"."
] | train | https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java#L324-L326 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java | Contract.sameSize | public static void sameSize(final Collection<?> collection1, final Collection<?> collection2, final String collection1Name, final String collection2Name) {
notNull(collection1, collection1Name);
notNull(collection2, collection2Name);
if (collection1.size() != collection2.size()) {
throw new IllegalArgumentException("expecting " + maskNullArgument(collection1Name) + " to have the same size as " + maskNullArgument(collection2Name));
}
} | java | public static void sameSize(final Collection<?> collection1, final Collection<?> collection2, final String collection1Name, final String collection2Name) {
notNull(collection1, collection1Name);
notNull(collection2, collection2Name);
if (collection1.size() != collection2.size()) {
throw new IllegalArgumentException("expecting " + maskNullArgument(collection1Name) + " to have the same size as " + maskNullArgument(collection2Name));
}
} | [
"public",
"static",
"void",
"sameSize",
"(",
"final",
"Collection",
"<",
"?",
">",
"collection1",
",",
"final",
"Collection",
"<",
"?",
">",
"collection2",
",",
"final",
"String",
"collection1Name",
",",
"final",
"String",
"collection2Name",
")",
"{",
"notNull... | Checks that the collections have the same number of elements, otherwise throws an exception
@param collection1 the first collection
@param collection2 the second collection
@param collection1Name the name of the first collection
@param collection2Name the name of the second collection
@throws IllegalArgumentException if collection1 or collection2 are null or if the collections don't agree on the number of elements | [
"Checks",
"that",
"the",
"collections",
"have",
"the",
"same",
"number",
"of",
"elements",
"otherwise",
"throws",
"an",
"exception"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L51-L58 |
DataArt/CalculationEngine | calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/ConverterUtils.java | ConverterUtils.resolveCellValue | public static ICellValue resolveCellValue(org.apache.poi.ss.usermodel.CellValue cellval) {
if (cellval == null) { return CellValue.BLANK; }
switch (cellval.getCellType()) {
case CELL_TYPE_NUMERIC: { return CellValue.from(cellval.getNumberValue()); }
case CELL_TYPE_STRING: { return CellValue.from(cellval.getStringValue()); }
case CELL_TYPE_BOOLEAN: { return CellValue.from(cellval.getBooleanValue()); }
case CELL_TYPE_ERROR: { return CellValue.from(ErrorEval.valueOf(cellval.getErrorValue()).getErrorString()); }
case CELL_TYPE_BLANK: { return CellValue.BLANK; }
case CELL_TYPE_FORMULA: { throw new CalculationEngineException("Result of evaluation cannot be a formula."); }
default: { throw new CalculationEngineException(String.format("CellValue's tType %s is not supported.", cellval.getCellType())); }
}
} | java | public static ICellValue resolveCellValue(org.apache.poi.ss.usermodel.CellValue cellval) {
if (cellval == null) { return CellValue.BLANK; }
switch (cellval.getCellType()) {
case CELL_TYPE_NUMERIC: { return CellValue.from(cellval.getNumberValue()); }
case CELL_TYPE_STRING: { return CellValue.from(cellval.getStringValue()); }
case CELL_TYPE_BOOLEAN: { return CellValue.from(cellval.getBooleanValue()); }
case CELL_TYPE_ERROR: { return CellValue.from(ErrorEval.valueOf(cellval.getErrorValue()).getErrorString()); }
case CELL_TYPE_BLANK: { return CellValue.BLANK; }
case CELL_TYPE_FORMULA: { throw new CalculationEngineException("Result of evaluation cannot be a formula."); }
default: { throw new CalculationEngineException(String.format("CellValue's tType %s is not supported.", cellval.getCellType())); }
}
} | [
"public",
"static",
"ICellValue",
"resolveCellValue",
"(",
"org",
".",
"apache",
".",
"poi",
".",
"ss",
".",
"usermodel",
".",
"CellValue",
"cellval",
")",
"{",
"if",
"(",
"cellval",
"==",
"null",
")",
"{",
"return",
"CellValue",
".",
"BLANK",
";",
"}",
... | Returns the new {@link CellValue} from provided {@link org.apache.poi.ss.usermodel.CellValue}. | [
"Returns",
"the",
"new",
"{"
] | train | https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/ConverterUtils.java#L186-L198 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/routes/RouterImpl.java | RouterImpl.matchStandard | private Route matchStandard(HttpMethod httpMethod, String requestUri, ActionInvoker invoker) throws ClassLoadException {
// find potential routes
for (InternalRoute internalRoute : internalRoutes) {
if (internalRoute.matches(requestUri) ) {
Route deferred = deduceRoute(internalRoute, httpMethod, requestUri, invoker);
if (deferred != null) return deferred;
}
}
throw new ClassLoadException("A route for request " + requestUri + " could not be deduced");
} | java | private Route matchStandard(HttpMethod httpMethod, String requestUri, ActionInvoker invoker) throws ClassLoadException {
// find potential routes
for (InternalRoute internalRoute : internalRoutes) {
if (internalRoute.matches(requestUri) ) {
Route deferred = deduceRoute(internalRoute, httpMethod, requestUri, invoker);
if (deferred != null) return deferred;
}
}
throw new ClassLoadException("A route for request " + requestUri + " could not be deduced");
} | [
"private",
"Route",
"matchStandard",
"(",
"HttpMethod",
"httpMethod",
",",
"String",
"requestUri",
",",
"ActionInvoker",
"invoker",
")",
"throws",
"ClassLoadException",
"{",
"// find potential routes",
"for",
"(",
"InternalRoute",
"internalRoute",
":",
"internalRoutes",
... | Only to be used in DEV mode
@param httpMethod
@param requestUri
@param injector
@return
@throws ClassLoadException | [
"Only",
"to",
"be",
"used",
"in",
"DEV",
"mode"
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/routes/RouterImpl.java#L196-L205 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/GridTable.java | GridTable.findElement | public int findElement(Object bookmark, int iHandleType)
{
if (bookmark == null)
return -1;
int iTargetPosition = m_gridBuffer.findElement(bookmark, iHandleType);
if (iTargetPosition == -1)
iTargetPosition = m_gridList.findElement(bookmark, iHandleType);
return iTargetPosition; // Not found
} | java | public int findElement(Object bookmark, int iHandleType)
{
if (bookmark == null)
return -1;
int iTargetPosition = m_gridBuffer.findElement(bookmark, iHandleType);
if (iTargetPosition == -1)
iTargetPosition = m_gridList.findElement(bookmark, iHandleType);
return iTargetPosition; // Not found
} | [
"public",
"int",
"findElement",
"(",
"Object",
"bookmark",
",",
"int",
"iHandleType",
")",
"{",
"if",
"(",
"bookmark",
"==",
"null",
")",
"return",
"-",
"1",
";",
"int",
"iTargetPosition",
"=",
"m_gridBuffer",
".",
"findElement",
"(",
"bookmark",
",",
"iHa... | Find this bookmark in one of the lists.
@return int index in table; or -1 if not found.
@param bookmark java.lang.Object The bookmark to look for.
@param iHandleType The type of bookmark to look for. | [
"Find",
"this",
"bookmark",
"in",
"one",
"of",
"the",
"lists",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L458-L466 |
nmdp-bioinformatics/ngs | range/src/main/java/org/nmdp/ngs/range/Ranges.java | Ranges.isGreaterThan | public static <C extends Comparable> boolean isGreaterThan(final Range<C> range, final C value) {
checkNotNull(range);
checkNotNull(value);
if (!range.hasLowerBound()) {
return false;
}
if (range.lowerBoundType() == BoundType.OPEN && range.lowerEndpoint().equals(value)) {
return true;
}
return range.lowerEndpoint().compareTo(value) > 0;
} | java | public static <C extends Comparable> boolean isGreaterThan(final Range<C> range, final C value) {
checkNotNull(range);
checkNotNull(value);
if (!range.hasLowerBound()) {
return false;
}
if (range.lowerBoundType() == BoundType.OPEN && range.lowerEndpoint().equals(value)) {
return true;
}
return range.lowerEndpoint().compareTo(value) > 0;
} | [
"public",
"static",
"<",
"C",
"extends",
"Comparable",
">",
"boolean",
"isGreaterThan",
"(",
"final",
"Range",
"<",
"C",
">",
"range",
",",
"final",
"C",
"value",
")",
"{",
"checkNotNull",
"(",
"range",
")",
";",
"checkNotNull",
"(",
"value",
")",
";",
... | Return true if the specified range is strictly greater than the specified value.
@param <C> range endpoint type
@param range range, must not be null
@param value value, must not be null
@return true if the specified range is strictly greater than the specified value | [
"Return",
"true",
"if",
"the",
"specified",
"range",
"is",
"strictly",
"greater",
"than",
"the",
"specified",
"value",
"."
] | train | https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/range/src/main/java/org/nmdp/ngs/range/Ranges.java#L131-L142 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/lookup/SoftDictionary.java | SoftDictionary.put | public void put(String id,String string,Object value)
{
if (DEBUG && id!=null) System.out.println(id+":"+string+" => "+value);
put(id, new MyWrapper(string), value);
} | java | public void put(String id,String string,Object value)
{
if (DEBUG && id!=null) System.out.println(id+":"+string+" => "+value);
put(id, new MyWrapper(string), value);
} | [
"public",
"void",
"put",
"(",
"String",
"id",
",",
"String",
"string",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"DEBUG",
"&&",
"id",
"!=",
"null",
")",
"System",
".",
"out",
".",
"println",
"(",
"id",
"+",
"\":\"",
"+",
"string",
"+",
"\" => \"... | Insert a string into the dictionary.
<p>Id is a special tag used to handle 'leave one out'
lookups. If you do a lookup on a string with a non-null
id, you get the closest matches that do not have the same
id. | [
"Insert",
"a",
"string",
"into",
"the",
"dictionary",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/lookup/SoftDictionary.java#L144-L148 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ParallelMultiInstanceBehavior.java | ParallelMultiInstanceBehavior.createInstances | protected int createInstances(DelegateExecution execution) {
int nrOfInstances = resolveNrOfInstances(execution);
if (nrOfInstances < 0) {
throw new ActivitiIllegalArgumentException("Invalid number of instances: must be non-negative integer value" + ", but was " + nrOfInstances);
}
execution.setMultiInstanceRoot(true);
setLoopVariable(execution, NUMBER_OF_INSTANCES, nrOfInstances);
setLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES, 0);
setLoopVariable(execution, NUMBER_OF_ACTIVE_INSTANCES, nrOfInstances);
List<DelegateExecution> concurrentExecutions = new ArrayList<DelegateExecution>();
for (int loopCounter = 0; loopCounter < nrOfInstances; loopCounter++) {
DelegateExecution concurrentExecution = Context.getCommandContext().getExecutionEntityManager()
.createChildExecution((ExecutionEntity) execution);
concurrentExecution.setCurrentFlowElement(activity);
concurrentExecution.setActive(true);
concurrentExecution.setScope(false);
concurrentExecutions.add(concurrentExecution);
logLoopDetails(concurrentExecution, "initialized", loopCounter, 0, nrOfInstances, nrOfInstances);
}
// Before the activities are executed, all executions MUST be created up front
// Do not try to merge this loop with the previous one, as it will lead
// to bugs, due to possible child execution pruning.
for (int loopCounter = 0; loopCounter < nrOfInstances; loopCounter++) {
DelegateExecution concurrentExecution = concurrentExecutions.get(loopCounter);
// executions can be inactive, if instances are all automatics
// (no-waitstate) and completionCondition has been met in the meantime
if (concurrentExecution.isActive() && !concurrentExecution.isEnded() && concurrentExecution.getParent().isActive() && !concurrentExecution.getParent().isEnded()) {
setLoopVariable(concurrentExecution, getCollectionElementIndexVariable(), loopCounter);
executeOriginalBehavior(concurrentExecution, loopCounter);
}
}
// See ACT-1586: ExecutionQuery returns wrong results when using multi
// instance on a receive task The parent execution must be set to false, so it wouldn't show up in
// the execution query when using .activityId(something). Do not we cannot nullify the
// activityId (that would have been a better solution), as it would break boundary event behavior.
if (!concurrentExecutions.isEmpty()) {
ExecutionEntity executionEntity = (ExecutionEntity) execution;
executionEntity.setActive(false);
}
return nrOfInstances;
} | java | protected int createInstances(DelegateExecution execution) {
int nrOfInstances = resolveNrOfInstances(execution);
if (nrOfInstances < 0) {
throw new ActivitiIllegalArgumentException("Invalid number of instances: must be non-negative integer value" + ", but was " + nrOfInstances);
}
execution.setMultiInstanceRoot(true);
setLoopVariable(execution, NUMBER_OF_INSTANCES, nrOfInstances);
setLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES, 0);
setLoopVariable(execution, NUMBER_OF_ACTIVE_INSTANCES, nrOfInstances);
List<DelegateExecution> concurrentExecutions = new ArrayList<DelegateExecution>();
for (int loopCounter = 0; loopCounter < nrOfInstances; loopCounter++) {
DelegateExecution concurrentExecution = Context.getCommandContext().getExecutionEntityManager()
.createChildExecution((ExecutionEntity) execution);
concurrentExecution.setCurrentFlowElement(activity);
concurrentExecution.setActive(true);
concurrentExecution.setScope(false);
concurrentExecutions.add(concurrentExecution);
logLoopDetails(concurrentExecution, "initialized", loopCounter, 0, nrOfInstances, nrOfInstances);
}
// Before the activities are executed, all executions MUST be created up front
// Do not try to merge this loop with the previous one, as it will lead
// to bugs, due to possible child execution pruning.
for (int loopCounter = 0; loopCounter < nrOfInstances; loopCounter++) {
DelegateExecution concurrentExecution = concurrentExecutions.get(loopCounter);
// executions can be inactive, if instances are all automatics
// (no-waitstate) and completionCondition has been met in the meantime
if (concurrentExecution.isActive() && !concurrentExecution.isEnded() && concurrentExecution.getParent().isActive() && !concurrentExecution.getParent().isEnded()) {
setLoopVariable(concurrentExecution, getCollectionElementIndexVariable(), loopCounter);
executeOriginalBehavior(concurrentExecution, loopCounter);
}
}
// See ACT-1586: ExecutionQuery returns wrong results when using multi
// instance on a receive task The parent execution must be set to false, so it wouldn't show up in
// the execution query when using .activityId(something). Do not we cannot nullify the
// activityId (that would have been a better solution), as it would break boundary event behavior.
if (!concurrentExecutions.isEmpty()) {
ExecutionEntity executionEntity = (ExecutionEntity) execution;
executionEntity.setActive(false);
}
return nrOfInstances;
} | [
"protected",
"int",
"createInstances",
"(",
"DelegateExecution",
"execution",
")",
"{",
"int",
"nrOfInstances",
"=",
"resolveNrOfInstances",
"(",
"execution",
")",
";",
"if",
"(",
"nrOfInstances",
"<",
"0",
")",
"{",
"throw",
"new",
"ActivitiIllegalArgumentException... | Handles the parallel case of spawning the instances. Will create child executions accordingly for every instance needed. | [
"Handles",
"the",
"parallel",
"case",
"of",
"spawning",
"the",
"instances",
".",
"Will",
"create",
"child",
"executions",
"accordingly",
"for",
"every",
"instance",
"needed",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ParallelMultiInstanceBehavior.java#L52-L99 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/SplineColormap.java | SplineColormap.setKnotPosition | public void setKnotPosition(int n, int x) {
xKnots[n] = PixelUtils.clamp(x);
sortKnots();
rebuildGradient();
} | java | public void setKnotPosition(int n, int x) {
xKnots[n] = PixelUtils.clamp(x);
sortKnots();
rebuildGradient();
} | [
"public",
"void",
"setKnotPosition",
"(",
"int",
"n",
",",
"int",
"x",
")",
"{",
"xKnots",
"[",
"n",
"]",
"=",
"PixelUtils",
".",
"clamp",
"(",
"x",
")",
";",
"sortKnots",
"(",
")",
";",
"rebuildGradient",
"(",
")",
";",
"}"
] | Set a knot position.
@param n the knot index
@param x the knot position | [
"Set",
"a",
"knot",
"position",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/SplineColormap.java#L115-L119 |
mercadopago/dx-java | src/main/java/com/mercadopago/core/MPBase.java | MPBase.processMethodBulk | protected static MPResourceArray processMethodBulk(Class clazz, String methodName, HashMap<String, String> mapParams, Boolean useCache) throws MPException {
//Validates the method executed
if (!ALLOWED_BULK_METHODS.contains(methodName)) {
throw new MPException("Method \"" + methodName + "\" not allowed");
}
AnnotatedElement annotatedMethod = getAnnotatedMethod(clazz, methodName);
HashMap<String, Object> hashAnnotation = getRestInformation(annotatedMethod);
HttpMethod httpMethod = (HttpMethod)hashAnnotation.get("method");
String path = parsePath(hashAnnotation.get("path").toString(), mapParams, null);
int retries = Integer.valueOf(hashAnnotation.get("retries").toString());
int connectionTimeout = Integer.valueOf(hashAnnotation.get("connectionTimeout").toString());
int socketTimeout = Integer.valueOf(hashAnnotation.get("socketTimeout").toString());
PayloadType payloadType = (PayloadType) hashAnnotation.get("payloadType");
Collection<Header> colHeaders = getStandardHeaders();
MPApiResponse response = callApi(httpMethod, path, payloadType, null, colHeaders, retries, connectionTimeout, socketTimeout, useCache);
MPResourceArray resourceArray = new MPResourceArray();
if (response.getStatusCode() >= 200 &&
response.getStatusCode() < 300) {
resourceArray._resourceArray = fillArrayWithResponseData(clazz, response);
}
resourceArray.lastApiResponse = response;
return resourceArray;
} | java | protected static MPResourceArray processMethodBulk(Class clazz, String methodName, HashMap<String, String> mapParams, Boolean useCache) throws MPException {
//Validates the method executed
if (!ALLOWED_BULK_METHODS.contains(methodName)) {
throw new MPException("Method \"" + methodName + "\" not allowed");
}
AnnotatedElement annotatedMethod = getAnnotatedMethod(clazz, methodName);
HashMap<String, Object> hashAnnotation = getRestInformation(annotatedMethod);
HttpMethod httpMethod = (HttpMethod)hashAnnotation.get("method");
String path = parsePath(hashAnnotation.get("path").toString(), mapParams, null);
int retries = Integer.valueOf(hashAnnotation.get("retries").toString());
int connectionTimeout = Integer.valueOf(hashAnnotation.get("connectionTimeout").toString());
int socketTimeout = Integer.valueOf(hashAnnotation.get("socketTimeout").toString());
PayloadType payloadType = (PayloadType) hashAnnotation.get("payloadType");
Collection<Header> colHeaders = getStandardHeaders();
MPApiResponse response = callApi(httpMethod, path, payloadType, null, colHeaders, retries, connectionTimeout, socketTimeout, useCache);
MPResourceArray resourceArray = new MPResourceArray();
if (response.getStatusCode() >= 200 &&
response.getStatusCode() < 300) {
resourceArray._resourceArray = fillArrayWithResponseData(clazz, response);
}
resourceArray.lastApiResponse = response;
return resourceArray;
} | [
"protected",
"static",
"MPResourceArray",
"processMethodBulk",
"(",
"Class",
"clazz",
",",
"String",
"methodName",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"mapParams",
",",
"Boolean",
"useCache",
")",
"throws",
"MPException",
"{",
"//Validates the method ... | Process the method to call the api
@param clazz a MPBase extended class
@param methodName a String with the decorated method to be processed
@param mapParams a hashmap with the args passed in the call of the method
@param useCache a Boolean flag that indicates if the cache must be used
@return a resourse obj fill with the api response
@throws MPException | [
"Process",
"the",
"method",
"to",
"call",
"the",
"api"
] | train | https://github.com/mercadopago/dx-java/blob/9df65a6bfb4db0c1fddd7699a5b109643961b03f/src/main/java/com/mercadopago/core/MPBase.java#L254-L287 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/multibuffer/BufferNeeds.java | BufferNeeds.bestFactor | public static int bestFactor(long size, Transaction tx) {
int avail = tx.bufferMgr().available();
if (avail <= 1)
return 1;
long k = size;
double i = 1.0;
while (k > avail) {
i++;
k = (int) Math.ceil(size / i);
}
return (int) k;
} | java | public static int bestFactor(long size, Transaction tx) {
int avail = tx.bufferMgr().available();
if (avail <= 1)
return 1;
long k = size;
double i = 1.0;
while (k > avail) {
i++;
k = (int) Math.ceil(size / i);
}
return (int) k;
} | [
"public",
"static",
"int",
"bestFactor",
"(",
"long",
"size",
",",
"Transaction",
"tx",
")",
"{",
"int",
"avail",
"=",
"tx",
".",
"bufferMgr",
"(",
")",
".",
"available",
"(",
")",
";",
"if",
"(",
"avail",
"<=",
"1",
")",
"return",
"1",
";",
"long"... | This method considers the various factors of the specified output size
(in blocks), and returns the highest factor that is less than the number
of available buffers.
@param size
the size of the output file
@param tx
the tx to execute
@return the highest number less than the number of available buffers,
that is a factor of the plan's output size | [
"This",
"method",
"considers",
"the",
"various",
"factors",
"of",
"the",
"specified",
"output",
"size",
"(",
"in",
"blocks",
")",
"and",
"returns",
"the",
"highest",
"factor",
"that",
"is",
"less",
"than",
"the",
"number",
"of",
"available",
"buffers",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/multibuffer/BufferNeeds.java#L63-L74 |
VoltDB/voltdb | src/frontend/org/voltdb/planner/SubPlanAssembler.java | SubPlanAssembler.getAccessPlanForTable | protected static AbstractPlanNode getAccessPlanForTable(JoinNode tableNode) {
StmtTableScan tableScan = tableNode.getTableScan();
// Access path to access the data in the table (index/scan/etc).
AccessPath path = tableNode.m_currentAccessPath;
assert(path != null);
// if no index, it is a sequential scan
if (path.index == null) {
return getScanAccessPlanForTable(tableScan, path);
}
return getIndexAccessPlanForTable(tableScan, path);
} | java | protected static AbstractPlanNode getAccessPlanForTable(JoinNode tableNode) {
StmtTableScan tableScan = tableNode.getTableScan();
// Access path to access the data in the table (index/scan/etc).
AccessPath path = tableNode.m_currentAccessPath;
assert(path != null);
// if no index, it is a sequential scan
if (path.index == null) {
return getScanAccessPlanForTable(tableScan, path);
}
return getIndexAccessPlanForTable(tableScan, path);
} | [
"protected",
"static",
"AbstractPlanNode",
"getAccessPlanForTable",
"(",
"JoinNode",
"tableNode",
")",
"{",
"StmtTableScan",
"tableScan",
"=",
"tableNode",
".",
"getTableScan",
"(",
")",
";",
"// Access path to access the data in the table (index/scan/etc).",
"AccessPath",
"p... | Given an access path, build the single-site or distributed plan that will
assess the data from the table according to the path.
@param table The table to get data from.
@return The root of a plan graph to get the data. | [
"Given",
"an",
"access",
"path",
"build",
"the",
"single",
"-",
"site",
"or",
"distributed",
"plan",
"that",
"will",
"assess",
"the",
"data",
"from",
"the",
"table",
"according",
"to",
"the",
"path",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/SubPlanAssembler.java#L2150-L2161 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java | Aggregations.bigDecimalAvg | public static <Key, Value> Aggregation<Key, BigDecimal, BigDecimal> bigDecimalAvg() {
return new AggregationAdapter(new BigDecimalAvgAggregation<Key, Value>());
} | java | public static <Key, Value> Aggregation<Key, BigDecimal, BigDecimal> bigDecimalAvg() {
return new AggregationAdapter(new BigDecimalAvgAggregation<Key, Value>());
} | [
"public",
"static",
"<",
"Key",
",",
"Value",
">",
"Aggregation",
"<",
"Key",
",",
"BigDecimal",
",",
"BigDecimal",
">",
"bigDecimalAvg",
"(",
")",
"{",
"return",
"new",
"AggregationAdapter",
"(",
"new",
"BigDecimalAvgAggregation",
"<",
"Key",
",",
"Value",
... | Returns an aggregation to calculate the {@link java.math.BigDecimal} average
of all supplied values.<br/>
This aggregation is similar to: <pre>SELECT AVG(value) FROM x</pre>
@param <Key> the input key type
@param <Value> the supplied value type
@return the average over all supplied values | [
"Returns",
"an",
"aggregation",
"to",
"calculate",
"the",
"{",
"@link",
"java",
".",
"math",
".",
"BigDecimal",
"}",
"average",
"of",
"all",
"supplied",
"values",
".",
"<br",
"/",
">",
"This",
"aggregation",
"is",
"similar",
"to",
":",
"<pre",
">",
"SELE... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L247-L249 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/publisher/CopyEventSubmitterHelper.java | CopyEventSubmitterHelper.submitSuccessfulFilePublish | static void submitSuccessfulFilePublish(EventSubmitter eventSubmitter, CopyableFile cf, WorkUnitState workUnitState) {
String datasetUrn = workUnitState.getProp(SlaEventKeys.DATASET_URN_KEY);
String partition = workUnitState.getProp(SlaEventKeys.PARTITION_KEY);
String completenessPercentage = workUnitState.getProp(SlaEventKeys.COMPLETENESS_PERCENTAGE_KEY);
String recordCount = workUnitState.getProp(SlaEventKeys.RECORD_COUNT_KEY);
String previousPublishTimestamp = workUnitState.getProp(SlaEventKeys.PREVIOUS_PUBLISH_TS_IN_MILLI_SECS_KEY);
String dedupeStatus = workUnitState.getProp(SlaEventKeys.DEDUPE_STATUS_KEY);
SlaEventSubmitter.builder().eventSubmitter(eventSubmitter).eventName(FILE_PUBLISHED_EVENT_NAME)
.datasetUrn(datasetUrn).partition(partition).originTimestamp(Long.toString(cf.getOriginTimestamp()))
.upstreamTimestamp(Long.toString(cf.getUpstreamTimestamp())).completenessPercentage(completenessPercentage)
.recordCount(recordCount).previousPublishTimestamp(previousPublishTimestamp).dedupeStatus(dedupeStatus)
.additionalMetadata(TARGET_PATH, cf.getDestination().toString())
.additionalMetadata(SOURCE_PATH, cf.getOrigin().getPath().toString())
.additionalMetadata(SIZE_IN_BYTES, Long.toString(cf.getOrigin().getLen())).build().submit();
} | java | static void submitSuccessfulFilePublish(EventSubmitter eventSubmitter, CopyableFile cf, WorkUnitState workUnitState) {
String datasetUrn = workUnitState.getProp(SlaEventKeys.DATASET_URN_KEY);
String partition = workUnitState.getProp(SlaEventKeys.PARTITION_KEY);
String completenessPercentage = workUnitState.getProp(SlaEventKeys.COMPLETENESS_PERCENTAGE_KEY);
String recordCount = workUnitState.getProp(SlaEventKeys.RECORD_COUNT_KEY);
String previousPublishTimestamp = workUnitState.getProp(SlaEventKeys.PREVIOUS_PUBLISH_TS_IN_MILLI_SECS_KEY);
String dedupeStatus = workUnitState.getProp(SlaEventKeys.DEDUPE_STATUS_KEY);
SlaEventSubmitter.builder().eventSubmitter(eventSubmitter).eventName(FILE_PUBLISHED_EVENT_NAME)
.datasetUrn(datasetUrn).partition(partition).originTimestamp(Long.toString(cf.getOriginTimestamp()))
.upstreamTimestamp(Long.toString(cf.getUpstreamTimestamp())).completenessPercentage(completenessPercentage)
.recordCount(recordCount).previousPublishTimestamp(previousPublishTimestamp).dedupeStatus(dedupeStatus)
.additionalMetadata(TARGET_PATH, cf.getDestination().toString())
.additionalMetadata(SOURCE_PATH, cf.getOrigin().getPath().toString())
.additionalMetadata(SIZE_IN_BYTES, Long.toString(cf.getOrigin().getLen())).build().submit();
} | [
"static",
"void",
"submitSuccessfulFilePublish",
"(",
"EventSubmitter",
"eventSubmitter",
",",
"CopyableFile",
"cf",
",",
"WorkUnitState",
"workUnitState",
")",
"{",
"String",
"datasetUrn",
"=",
"workUnitState",
".",
"getProp",
"(",
"SlaEventKeys",
".",
"DATASET_URN_KEY... | Submit an sla event when a {@link org.apache.gobblin.data.management.copy.CopyableFile} is published. The <code>workUnitState</code> passed should have the
required {@link SlaEventKeys} set.
@see SlaEventSubmitter#submit()
@param eventSubmitter
@param workUnitState | [
"Submit",
"an",
"sla",
"event",
"when",
"a",
"{",
"@link",
"org",
".",
"apache",
".",
"gobblin",
".",
"data",
".",
"management",
".",
"copy",
".",
"CopyableFile",
"}",
"is",
"published",
".",
"The",
"<code",
">",
"workUnitState<",
"/",
"code",
">",
"pa... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/publisher/CopyEventSubmitterHelper.java#L68-L82 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/TileSheetsConfig.java | TileSheetsConfig.imports | public static TileSheetsConfig imports(Media configSheets)
{
final Xml nodeSheets = new Xml(configSheets);
final Xml nodeTileSize = nodeSheets.getChild(NODE_TILE_SIZE);
final int tileWidth = nodeTileSize.readInteger(ATT_TILE_WIDTH);
final int tileHeight = nodeTileSize.readInteger(ATT_TILE_HEIGHT);
final Collection<String> sheets = importSheets(nodeSheets);
return new TileSheetsConfig(tileWidth, tileHeight, sheets);
} | java | public static TileSheetsConfig imports(Media configSheets)
{
final Xml nodeSheets = new Xml(configSheets);
final Xml nodeTileSize = nodeSheets.getChild(NODE_TILE_SIZE);
final int tileWidth = nodeTileSize.readInteger(ATT_TILE_WIDTH);
final int tileHeight = nodeTileSize.readInteger(ATT_TILE_HEIGHT);
final Collection<String> sheets = importSheets(nodeSheets);
return new TileSheetsConfig(tileWidth, tileHeight, sheets);
} | [
"public",
"static",
"TileSheetsConfig",
"imports",
"(",
"Media",
"configSheets",
")",
"{",
"final",
"Xml",
"nodeSheets",
"=",
"new",
"Xml",
"(",
"configSheets",
")",
";",
"final",
"Xml",
"nodeTileSize",
"=",
"nodeSheets",
".",
"getChild",
"(",
"NODE_TILE_SIZE",
... | Import the sheets data from configuration.
@param configSheets The file that define the sheets configuration (must not be <code>null</code>).
@return The tile sheet configuration.
@throws LionEngineException If unable to read data. | [
"Import",
"the",
"sheets",
"data",
"from",
"configuration",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/TileSheetsConfig.java#L58-L69 |
onepf/OPFUtils | opfutils/src/main/java/org/onepf/opfutils/OPFChecks.java | OPFChecks.hasMetadata | public static boolean hasMetadata(@NonNull final Context context, @NonNull final String metadataKey) {
if (TextUtils.isEmpty(metadataKey)) {
throw new IllegalArgumentException("Meta data key can't be null or empty.");
}
try {
final PackageInfo info = context.getPackageManager()
.getPackageInfo(context.getPackageName(), PackageManager.GET_META_DATA);
final Bundle metaData = info.applicationInfo.metaData;
if (metaData != null && metaData.get(metadataKey) != null) {
return true;
}
} catch (PackageManager.NameNotFoundException e) {
//ignore
}
return false;
} | java | public static boolean hasMetadata(@NonNull final Context context, @NonNull final String metadataKey) {
if (TextUtils.isEmpty(metadataKey)) {
throw new IllegalArgumentException("Meta data key can't be null or empty.");
}
try {
final PackageInfo info = context.getPackageManager()
.getPackageInfo(context.getPackageName(), PackageManager.GET_META_DATA);
final Bundle metaData = info.applicationInfo.metaData;
if (metaData != null && metaData.get(metadataKey) != null) {
return true;
}
} catch (PackageManager.NameNotFoundException e) {
//ignore
}
return false;
} | [
"public",
"static",
"boolean",
"hasMetadata",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"NonNull",
"final",
"String",
"metadataKey",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"metadataKey",
")",
")",
"{",
"throw",
"new",
"I... | Checks if metadata is added in AndroidManifest.xml file.
@param context The instance of {@link android.content.Context}.
@param metadataKey The checked metadata key.
@return True if metadata is added, false otherwise. | [
"Checks",
"if",
"metadata",
"is",
"added",
"in",
"AndroidManifest",
".",
"xml",
"file",
"."
] | train | https://github.com/onepf/OPFUtils/blob/e30c2c64077c5d577c0cd7d3cead809d31f7dab1/opfutils/src/main/java/org/onepf/opfutils/OPFChecks.java#L150-L166 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java | BetterRecyclerAdapter.onItemClick | protected void onItemClick(View view, int position){
if(itemClickListener != null) itemClickListener.onItemClick(view, getItem(position), position);
} | java | protected void onItemClick(View view, int position){
if(itemClickListener != null) itemClickListener.onItemClick(view, getItem(position), position);
} | [
"protected",
"void",
"onItemClick",
"(",
"View",
"view",
",",
"int",
"position",
")",
"{",
"if",
"(",
"itemClickListener",
"!=",
"null",
")",
"itemClickListener",
".",
"onItemClick",
"(",
"view",
",",
"getItem",
"(",
"position",
")",
",",
"position",
")",
... | Call this to trigger the user set item click listener
@param view the view that was clicked
@param position the position that was clicked | [
"Call",
"this",
"to",
"trigger",
"the",
"user",
"set",
"item",
"click",
"listener"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L75-L77 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java | AbstractService.runTask | private <T> ServiceTask<T> runTask(final Wave sourceWave, final Method method, final Object[] parameterValues) {
// Allow to remove the pending task when the service is finished
sourceWave.addWaveListener(new ServiceTaskWaveListener());
// Create a new ServiceTask to handle this request and follow progression
final ServiceTaskBase<T> task = new ServiceTaskBase<>(this, method, parameterValues, sourceWave);
// Store the task into the pending map
this.pendingTasks.put(sourceWave.wUID(), task);
// Attach ServiceTask to the source wave
sourceWave.addDatas(WBuilder.waveData(JRebirthWaves.SERVICE_TASK, task));
// Bind Progress Property
if (sourceWave.containsNotNull(JRebirthWaves.PROGRESS_PROPERTY)) { // Check double call
bindProgressProperty(task, sourceWave.getData(JRebirthWaves.PROGRESS_PROPERTY).value());
}
// Bind ProgressBar
if (sourceWave.containsNotNull(JRebirthWaves.PROGRESS_BAR)) { // Check double call
bindProgressBar(task, sourceWave.getData(JRebirthWaves.PROGRESS_BAR).value());
}
// Bind Title
if (sourceWave.containsNotNull(JRebirthWaves.TASK_TITLE)) {
bindTitle(task, sourceWave.getData(JRebirthWaves.TASK_TITLE).value());
}
// Bind ProgressBar
if (sourceWave.containsNotNull(JRebirthWaves.TASK_MESSAGE)) {
bindMessage(task, sourceWave.getData(JRebirthWaves.TASK_MESSAGE).value());
}
// Call the task into the JRebirth Thread Pool
JRebirth.runIntoJTP(task);
return task;
} | java | private <T> ServiceTask<T> runTask(final Wave sourceWave, final Method method, final Object[] parameterValues) {
// Allow to remove the pending task when the service is finished
sourceWave.addWaveListener(new ServiceTaskWaveListener());
// Create a new ServiceTask to handle this request and follow progression
final ServiceTaskBase<T> task = new ServiceTaskBase<>(this, method, parameterValues, sourceWave);
// Store the task into the pending map
this.pendingTasks.put(sourceWave.wUID(), task);
// Attach ServiceTask to the source wave
sourceWave.addDatas(WBuilder.waveData(JRebirthWaves.SERVICE_TASK, task));
// Bind Progress Property
if (sourceWave.containsNotNull(JRebirthWaves.PROGRESS_PROPERTY)) { // Check double call
bindProgressProperty(task, sourceWave.getData(JRebirthWaves.PROGRESS_PROPERTY).value());
}
// Bind ProgressBar
if (sourceWave.containsNotNull(JRebirthWaves.PROGRESS_BAR)) { // Check double call
bindProgressBar(task, sourceWave.getData(JRebirthWaves.PROGRESS_BAR).value());
}
// Bind Title
if (sourceWave.containsNotNull(JRebirthWaves.TASK_TITLE)) {
bindTitle(task, sourceWave.getData(JRebirthWaves.TASK_TITLE).value());
}
// Bind ProgressBar
if (sourceWave.containsNotNull(JRebirthWaves.TASK_MESSAGE)) {
bindMessage(task, sourceWave.getData(JRebirthWaves.TASK_MESSAGE).value());
}
// Call the task into the JRebirth Thread Pool
JRebirth.runIntoJTP(task);
return task;
} | [
"private",
"<",
"T",
">",
"ServiceTask",
"<",
"T",
">",
"runTask",
"(",
"final",
"Wave",
"sourceWave",
",",
"final",
"Method",
"method",
",",
"final",
"Object",
"[",
"]",
"parameterValues",
")",
"{",
"// Allow to remove the pending task when the service is finished"... | Run the wave type method.
@param sourceWave the source wave
@param parameterValues values to pass to the method
@param method method to call
@param <T> the type of the returned type
@return the service task created | [
"Run",
"the",
"wave",
"type",
"method",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L140-L178 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/Level.java | Level.isInRange | public boolean isInRange(final Level minLevel, final Level maxLevel) {
return this.intLevel >= minLevel.intLevel && this.intLevel <= maxLevel.intLevel;
} | java | public boolean isInRange(final Level minLevel, final Level maxLevel) {
return this.intLevel >= minLevel.intLevel && this.intLevel <= maxLevel.intLevel;
} | [
"public",
"boolean",
"isInRange",
"(",
"final",
"Level",
"minLevel",
",",
"final",
"Level",
"maxLevel",
")",
"{",
"return",
"this",
".",
"intLevel",
">=",
"minLevel",
".",
"intLevel",
"&&",
"this",
".",
"intLevel",
"<=",
"maxLevel",
".",
"intLevel",
";",
"... | Compares this level against the levels passed as arguments and returns true if this level is in between the given
levels.
@param minLevel The minimum level to test.
@param maxLevel The maximum level to test.
@return True true if this level is in between the given levels
@since 2.4 | [
"Compares",
"this",
"level",
"against",
"the",
"levels",
"passed",
"as",
"arguments",
"and",
"returns",
"true",
"if",
"this",
"level",
"is",
"in",
"between",
"the",
"given",
"levels",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/Level.java#L154-L156 |
JetBrains/xodus | openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java | EnvironmentConfig.setTreeMaxPageSize | public EnvironmentConfig setTreeMaxPageSize(final int pageSize) throws InvalidSettingException {
if (pageSize < 16 || pageSize > 1024) {
throw new InvalidSettingException("Invalid tree page size: " + pageSize);
}
return setSetting(TREE_MAX_PAGE_SIZE, pageSize);
} | java | public EnvironmentConfig setTreeMaxPageSize(final int pageSize) throws InvalidSettingException {
if (pageSize < 16 || pageSize > 1024) {
throw new InvalidSettingException("Invalid tree page size: " + pageSize);
}
return setSetting(TREE_MAX_PAGE_SIZE, pageSize);
} | [
"public",
"EnvironmentConfig",
"setTreeMaxPageSize",
"(",
"final",
"int",
"pageSize",
")",
"throws",
"InvalidSettingException",
"{",
"if",
"(",
"pageSize",
"<",
"16",
"||",
"pageSize",
">",
"1024",
")",
"{",
"throw",
"new",
"InvalidSettingException",
"(",
"\"Inval... | Sets the maximum size of page of B+Tree. Default value is {@code 128}. Only sizes in the range [16..1024]
are accepted.
<p>Mutable at runtime: yes
@param pageSize maximum size of page of B+Tree
@return this {@code EnvironmentConfig} instance
@throws InvalidSettingException page size is not in the range [16..1024] | [
"Sets",
"the",
"maximum",
"size",
"of",
"page",
"of",
"B",
"+",
"Tree",
".",
"Default",
"value",
"is",
"{",
"@code",
"128",
"}",
".",
"Only",
"sizes",
"in",
"the",
"range",
"[",
"16",
"..",
"1024",
"]",
"are",
"accepted",
".",
"<p",
">",
"Mutable",... | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java#L1722-L1727 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java | MapComposedElement.addGroup | public int addGroup(double x, double y) {
int pointIndex;
if (this.pointCoordinates == null) {
this.pointCoordinates = new double[] {x, y};
this.partIndexes = null;
pointIndex = 0;
} else {
double[] pts = new double[this.pointCoordinates.length + 2];
System.arraycopy(this.pointCoordinates, 0, pts, 0, this.pointCoordinates.length);
pointIndex = pts.length - 2;
pts[pointIndex] = x;
pts[pointIndex + 1] = y;
final int groupCount = getGroupCount();
int[] grps = new int[groupCount];
if (this.partIndexes != null) {
System.arraycopy(this.partIndexes, 0, grps, 0, groupCount - 1);
}
grps[groupCount - 1] = pointIndex;
this.pointCoordinates = pts;
pts = null;
this.partIndexes = grps;
grps = null;
pointIndex /= 2;
}
fireShapeChanged();
fireElementChanged();
return pointIndex;
} | java | public int addGroup(double x, double y) {
int pointIndex;
if (this.pointCoordinates == null) {
this.pointCoordinates = new double[] {x, y};
this.partIndexes = null;
pointIndex = 0;
} else {
double[] pts = new double[this.pointCoordinates.length + 2];
System.arraycopy(this.pointCoordinates, 0, pts, 0, this.pointCoordinates.length);
pointIndex = pts.length - 2;
pts[pointIndex] = x;
pts[pointIndex + 1] = y;
final int groupCount = getGroupCount();
int[] grps = new int[groupCount];
if (this.partIndexes != null) {
System.arraycopy(this.partIndexes, 0, grps, 0, groupCount - 1);
}
grps[groupCount - 1] = pointIndex;
this.pointCoordinates = pts;
pts = null;
this.partIndexes = grps;
grps = null;
pointIndex /= 2;
}
fireShapeChanged();
fireElementChanged();
return pointIndex;
} | [
"public",
"int",
"addGroup",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"int",
"pointIndex",
";",
"if",
"(",
"this",
".",
"pointCoordinates",
"==",
"null",
")",
"{",
"this",
".",
"pointCoordinates",
"=",
"new",
"double",
"[",
"]",
"{",
"x",
",... | Add the specified point into a newgroup.
@param x x coordinate
@param y y coordinate
@return the index of the new point in this element. | [
"Add",
"the",
"specified",
"point",
"into",
"a",
"newgroup",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L663-L696 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java | JobTargetGroupsInner.getAsync | public Observable<JobTargetGroupInner> getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).map(new Func1<ServiceResponse<JobTargetGroupInner>, JobTargetGroupInner>() {
@Override
public JobTargetGroupInner call(ServiceResponse<JobTargetGroupInner> response) {
return response.body();
}
});
} | java | public Observable<JobTargetGroupInner> getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).map(new Func1<ServiceResponse<JobTargetGroupInner>, JobTargetGroupInner>() {
@Override
public JobTargetGroupInner call(ServiceResponse<JobTargetGroupInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobTargetGroupInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"String",
"targetGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupN... | Gets a target group.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param targetGroupName The name of the target group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobTargetGroupInner object | [
"Gets",
"a",
"target",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java#L259-L266 |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.isTargetOp | protected static boolean isTargetOp( TokenList.Token token , Symbol[] ops ) {
Symbol c = token.symbol;
for (int i = 0; i < ops.length; i++) {
if( c == ops[i])
return true;
}
return false;
} | java | protected static boolean isTargetOp( TokenList.Token token , Symbol[] ops ) {
Symbol c = token.symbol;
for (int i = 0; i < ops.length; i++) {
if( c == ops[i])
return true;
}
return false;
} | [
"protected",
"static",
"boolean",
"isTargetOp",
"(",
"TokenList",
".",
"Token",
"token",
",",
"Symbol",
"[",
"]",
"ops",
")",
"{",
"Symbol",
"c",
"=",
"token",
".",
"symbol",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ops",
".",
"length... | Checks to see if the token is in the list of allowed character operations. Used to apply order of operations
@param token Token being checked
@param ops List of allowed character operations
@return true for it being in the list and false for it not being in the list | [
"Checks",
"to",
"see",
"if",
"the",
"token",
"is",
"in",
"the",
"list",
"of",
"allowed",
"character",
"operations",
".",
"Used",
"to",
"apply",
"order",
"of",
"operations"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1596-L1603 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/states/Http2StateUtil.java | Http2StateUtil.createStream | private static synchronized void createStream(Http2Connection conn, int streamId) throws Http2Exception {
conn.local().createStream(streamId, false);
if (LOG.isDebugEnabled()) {
LOG.debug("Stream created streamId: {}", streamId);
}
} | java | private static synchronized void createStream(Http2Connection conn, int streamId) throws Http2Exception {
conn.local().createStream(streamId, false);
if (LOG.isDebugEnabled()) {
LOG.debug("Stream created streamId: {}", streamId);
}
} | [
"private",
"static",
"synchronized",
"void",
"createStream",
"(",
"Http2Connection",
"conn",
",",
"int",
"streamId",
")",
"throws",
"Http2Exception",
"{",
"conn",
".",
"local",
"(",
")",
".",
"createStream",
"(",
"streamId",
",",
"false",
")",
";",
"if",
"("... | Creates a stream with given stream id.
@param conn the HTTP2 connection
@param streamId the id of the stream
@throws Http2Exception if a protocol-related error occurred | [
"Creates",
"a",
"stream",
"with",
"given",
"stream",
"id",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/states/Http2StateUtil.java#L327-L332 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.translationRotateScaleInvert | public Matrix4d translationRotateScaleInvert(double tx, double ty, double tz,
double qx, double qy, double qz, double qw,
double sx, double sy, double sz) {
boolean one = Math.abs(sx) == 1.0 && Math.abs(sy) == 1.0 && Math.abs(sz) == 1.0;
if (one)
return translationRotateScale(tx, ty, tz, qx, qy, qz, qw, sx, sy, sz).invertOrthonormal(this);
double nqx = -qx, nqy = -qy, nqz = -qz;
double dqx = nqx + nqx;
double dqy = nqy + nqy;
double dqz = nqz + nqz;
double q00 = dqx * nqx;
double q11 = dqy * nqy;
double q22 = dqz * nqz;
double q01 = dqx * nqy;
double q02 = dqx * nqz;
double q03 = dqx * qw;
double q12 = dqy * nqz;
double q13 = dqy * qw;
double q23 = dqz * qw;
double isx = 1/sx, isy = 1/sy, isz = 1/sz;
m00 = isx * (1.0 - q11 - q22);
m01 = isy * (q01 + q23);
m02 = isz * (q02 - q13);
m03 = 0.0;
m10 = isx * (q01 - q23);
m11 = isy * (1.0 - q22 - q00);
m12 = isz * (q12 + q03);
m13 = 0.0;
m20 = isx * (q02 + q13);
m21 = isy * (q12 - q03);
m22 = isz * (1.0 - q11 - q00);
m23 = 0.0;
m30 = -m00 * tx - m10 * ty - m20 * tz;
m31 = -m01 * tx - m11 * ty - m21 * tz;
m32 = -m02 * tx - m12 * ty - m22 * tz;
m33 = 1.0;
properties = PROPERTY_AFFINE;
return this;
} | java | public Matrix4d translationRotateScaleInvert(double tx, double ty, double tz,
double qx, double qy, double qz, double qw,
double sx, double sy, double sz) {
boolean one = Math.abs(sx) == 1.0 && Math.abs(sy) == 1.0 && Math.abs(sz) == 1.0;
if (one)
return translationRotateScale(tx, ty, tz, qx, qy, qz, qw, sx, sy, sz).invertOrthonormal(this);
double nqx = -qx, nqy = -qy, nqz = -qz;
double dqx = nqx + nqx;
double dqy = nqy + nqy;
double dqz = nqz + nqz;
double q00 = dqx * nqx;
double q11 = dqy * nqy;
double q22 = dqz * nqz;
double q01 = dqx * nqy;
double q02 = dqx * nqz;
double q03 = dqx * qw;
double q12 = dqy * nqz;
double q13 = dqy * qw;
double q23 = dqz * qw;
double isx = 1/sx, isy = 1/sy, isz = 1/sz;
m00 = isx * (1.0 - q11 - q22);
m01 = isy * (q01 + q23);
m02 = isz * (q02 - q13);
m03 = 0.0;
m10 = isx * (q01 - q23);
m11 = isy * (1.0 - q22 - q00);
m12 = isz * (q12 + q03);
m13 = 0.0;
m20 = isx * (q02 + q13);
m21 = isy * (q12 - q03);
m22 = isz * (1.0 - q11 - q00);
m23 = 0.0;
m30 = -m00 * tx - m10 * ty - m20 * tz;
m31 = -m01 * tx - m11 * ty - m21 * tz;
m32 = -m02 * tx - m12 * ty - m22 * tz;
m33 = 1.0;
properties = PROPERTY_AFFINE;
return this;
} | [
"public",
"Matrix4d",
"translationRotateScaleInvert",
"(",
"double",
"tx",
",",
"double",
"ty",
",",
"double",
"tz",
",",
"double",
"qx",
",",
"double",
"qy",
",",
"double",
"qz",
",",
"double",
"qw",
",",
"double",
"sx",
",",
"double",
"sy",
",",
"doubl... | Set <code>this</code> matrix to <code>(T * R * S)<sup>-1</sup></code>, where <code>T</code> is a translation by the given <code>(tx, ty, tz)</code>,
<code>R</code> is a rotation transformation specified by the quaternion <code>(qx, qy, qz, qw)</code>, and <code>S</code> is a scaling transformation
which scales the three axes x, y and z by <code>(sx, sy, sz)</code>.
<p>
This method is equivalent to calling: <code>translationRotateScale(...).invert()</code>
@see #translationRotateScale(double, double, double, double, double, double, double, double, double, double)
@see #invert()
@param tx
the number of units by which to translate the x-component
@param ty
the number of units by which to translate the y-component
@param tz
the number of units by which to translate the z-component
@param qx
the x-coordinate of the vector part of the quaternion
@param qy
the y-coordinate of the vector part of the quaternion
@param qz
the z-coordinate of the vector part of the quaternion
@param qw
the scalar part of the quaternion
@param sx
the scaling factor for the x-axis
@param sy
the scaling factor for the y-axis
@param sz
the scaling factor for the z-axis
@return this | [
"Set",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"to",
"<code",
">",
"(",
"T",
"*",
"R",
"*",
"S",
")",
"<sup",
">",
"-",
"1<",
"/",
"sup",
">",
"<",
"/",
"code",
">",
"where",
"<code",
">",
"T<",
"/",
"code",
">",
"is",
"a",
"tran... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L7197-L7235 |
operasoftware/operaprestodriver | src/com/opera/core/systems/internal/WatirUtils.java | WatirUtils.copyDirAndFiles | public static boolean copyDirAndFiles(File source, File destination) {
logger.finest(String.format("WatirUtils::copyDirAndFiles(%s, %s)", source.getAbsolutePath(),
destination.getAbsolutePath()));
if (source.isDirectory()) {
String[] items;
items = source.list();
for (String item : items) {
File itemSource = new File(source.getPath(), item);
File itemDestination = new File(destination.getPath(), item);
boolean res = copyDirAndFiles(itemSource, itemDestination);
if (!res) {
logger.severe(String.format("Could not copy \"%s\" to \"%s\"",
itemSource.getPath(), itemDestination.getPath()));
return false;
}
}
} else {
try {
Files.createParentDirs(destination);
Files.copy(source, destination);
} catch (IOException e) {
logger.severe(
String.format("Could not copy files from \"%s\" to \"%s\"",
source.getPath(), destination.getPath()));
return false;
}
}
return true;
} | java | public static boolean copyDirAndFiles(File source, File destination) {
logger.finest(String.format("WatirUtils::copyDirAndFiles(%s, %s)", source.getAbsolutePath(),
destination.getAbsolutePath()));
if (source.isDirectory()) {
String[] items;
items = source.list();
for (String item : items) {
File itemSource = new File(source.getPath(), item);
File itemDestination = new File(destination.getPath(), item);
boolean res = copyDirAndFiles(itemSource, itemDestination);
if (!res) {
logger.severe(String.format("Could not copy \"%s\" to \"%s\"",
itemSource.getPath(), itemDestination.getPath()));
return false;
}
}
} else {
try {
Files.createParentDirs(destination);
Files.copy(source, destination);
} catch (IOException e) {
logger.severe(
String.format("Could not copy files from \"%s\" to \"%s\"",
source.getPath(), destination.getPath()));
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"copyDirAndFiles",
"(",
"File",
"source",
",",
"File",
"destination",
")",
"{",
"logger",
".",
"finest",
"(",
"String",
".",
"format",
"(",
"\"WatirUtils::copyDirAndFiles(%s, %s)\"",
",",
"source",
".",
"getAbsolutePath",
"(",
")",
... | Copies the whole disk directory/file structure starting from the source path to the destination
path.
@param source the source path, may designate either a file or a directory
@param destination the destination path | [
"Copies",
"the",
"whole",
"disk",
"directory",
"/",
"file",
"structure",
"starting",
"from",
"the",
"source",
"path",
"to",
"the",
"destination",
"path",
"."
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/internal/WatirUtils.java#L91-L121 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Section.java | Section.setNumbers | private void setNumbers(int number, ArrayList numbers) {
this.numbers = new ArrayList();
this.numbers.add(Integer.valueOf(number));
this.numbers.addAll(numbers);
} | java | private void setNumbers(int number, ArrayList numbers) {
this.numbers = new ArrayList();
this.numbers.add(Integer.valueOf(number));
this.numbers.addAll(numbers);
} | [
"private",
"void",
"setNumbers",
"(",
"int",
"number",
",",
"ArrayList",
"numbers",
")",
"{",
"this",
".",
"numbers",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"numbers",
".",
"add",
"(",
"Integer",
".",
"valueOf",
"(",
"number",
")",
")",
... | Sets the number of this section.
@param number the number of this section
@param numbers an <CODE>ArrayList</CODE>, containing the numbers of the Parent | [
"Sets",
"the",
"number",
"of",
"this",
"section",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Section.java#L670-L674 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java | ApacheHTTPClient.createURL | protected String createURL(HTTPRequest httpRequest,HTTPClientConfiguration configuration)
{
//init buffer
StringBuilder buffer=new StringBuilder(100);
//create URL
String resource=httpRequest.getResource();
this.appendBaseURL(buffer,resource,configuration);
String parameters=httpRequest.getParametersText();
this.appendParameters(buffer,parameters);
String url=buffer.toString();
return url;
} | java | protected String createURL(HTTPRequest httpRequest,HTTPClientConfiguration configuration)
{
//init buffer
StringBuilder buffer=new StringBuilder(100);
//create URL
String resource=httpRequest.getResource();
this.appendBaseURL(buffer,resource,configuration);
String parameters=httpRequest.getParametersText();
this.appendParameters(buffer,parameters);
String url=buffer.toString();
return url;
} | [
"protected",
"String",
"createURL",
"(",
"HTTPRequest",
"httpRequest",
",",
"HTTPClientConfiguration",
"configuration",
")",
"{",
"//init buffer",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"100",
")",
";",
"//create URL",
"String",
"resource",
"=",
... | This function creates the full URL from the provided values.
@param httpRequest
The HTTP request to send
@param configuration
HTTP client configuration
@return The full URL | [
"This",
"function",
"creates",
"the",
"full",
"URL",
"from",
"the",
"provided",
"values",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java#L232-L245 |
albfernandez/javadbf | src/main/java/com/linuxense/javadbf/DBFUtils.java | DBFUtils.readNumericStoredAsText | public static Number readNumericStoredAsText(DataInputStream dataInput, int length) throws IOException {
try {
byte t_float[] = new byte[length];
int readed = dataInput.read(t_float);
if (readed != length) {
throw new EOFException("failed to read:" + length + " bytes");
}
t_float = DBFUtils.removeSpaces(t_float);
t_float = DBFUtils.removeNullBytes(t_float);
if (t_float.length > 0 && DBFUtils.isPureAscii(t_float) && !DBFUtils.contains(t_float, (byte) '?') && !DBFUtils.contains(t_float, (byte) '*')) {
String aux = new String(t_float, StandardCharsets.US_ASCII).replace(',', '.');
if (".".equals(aux)) {
return BigDecimal.ZERO;
}
return new BigDecimal(aux);
} else {
return null;
}
} catch (NumberFormatException e) {
throw new DBFException("Failed to parse Float: " + e.getMessage(), e);
}
} | java | public static Number readNumericStoredAsText(DataInputStream dataInput, int length) throws IOException {
try {
byte t_float[] = new byte[length];
int readed = dataInput.read(t_float);
if (readed != length) {
throw new EOFException("failed to read:" + length + " bytes");
}
t_float = DBFUtils.removeSpaces(t_float);
t_float = DBFUtils.removeNullBytes(t_float);
if (t_float.length > 0 && DBFUtils.isPureAscii(t_float) && !DBFUtils.contains(t_float, (byte) '?') && !DBFUtils.contains(t_float, (byte) '*')) {
String aux = new String(t_float, StandardCharsets.US_ASCII).replace(',', '.');
if (".".equals(aux)) {
return BigDecimal.ZERO;
}
return new BigDecimal(aux);
} else {
return null;
}
} catch (NumberFormatException e) {
throw new DBFException("Failed to parse Float: " + e.getMessage(), e);
}
} | [
"public",
"static",
"Number",
"readNumericStoredAsText",
"(",
"DataInputStream",
"dataInput",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"try",
"{",
"byte",
"t_float",
"[",
"]",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"int",
"readed",
"=",... | Reads a number from a stream,
@param dataInput the stream data
@param length the legth of the number
@return The number as a Number (BigDecimal)
@throws IOException if an IO error happens
@throws EOFException if reached end of file before length bytes | [
"Reads",
"a",
"number",
"from",
"a",
"stream"
] | train | https://github.com/albfernandez/javadbf/blob/ac9867b46786cb055bce9323e2cf074365207693/src/main/java/com/linuxense/javadbf/DBFUtils.java#L62-L83 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/service/data/event/EventHandlerCache.java | EventHandlerCache.getPathExternalEvents | public static List<ExternalEvent> getPathExternalEvents(String bucket){
if (myPathCache.get(bucket) != null)
return myPathCache.get(bucket);
else if (bucket.indexOf('/') > 0) { // We could have a sub-path
return getPathExternalEvents(bucket.substring(0, bucket.lastIndexOf('/')));
}
return null;
} | java | public static List<ExternalEvent> getPathExternalEvents(String bucket){
if (myPathCache.get(bucket) != null)
return myPathCache.get(bucket);
else if (bucket.indexOf('/') > 0) { // We could have a sub-path
return getPathExternalEvents(bucket.substring(0, bucket.lastIndexOf('/')));
}
return null;
} | [
"public",
"static",
"List",
"<",
"ExternalEvent",
">",
"getPathExternalEvents",
"(",
"String",
"bucket",
")",
"{",
"if",
"(",
"myPathCache",
".",
"get",
"(",
"bucket",
")",
"!=",
"null",
")",
"return",
"myPathCache",
".",
"get",
"(",
"bucket",
")",
";",
... | returns the cached path-based external event
@param bucket
@return Cached Item | [
"returns",
"the",
"cached",
"path",
"-",
"based",
"external",
"event"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/service/data/event/EventHandlerCache.java#L78-L85 |
square/picasso | picasso/src/main/java/com/squareup/picasso3/Picasso.java | Picasso.cancelRequest | public void cancelRequest(@NonNull RemoteViews remoteViews, @IdRes int viewId) {
// checkMain() is called from cancelExistingRequest()
checkNotNull(remoteViews, "remoteViews == null");
cancelExistingRequest(new RemoteViewsAction.RemoteViewsTarget(remoteViews, viewId));
} | java | public void cancelRequest(@NonNull RemoteViews remoteViews, @IdRes int viewId) {
// checkMain() is called from cancelExistingRequest()
checkNotNull(remoteViews, "remoteViews == null");
cancelExistingRequest(new RemoteViewsAction.RemoteViewsTarget(remoteViews, viewId));
} | [
"public",
"void",
"cancelRequest",
"(",
"@",
"NonNull",
"RemoteViews",
"remoteViews",
",",
"@",
"IdRes",
"int",
"viewId",
")",
"{",
"// checkMain() is called from cancelExistingRequest()",
"checkNotNull",
"(",
"remoteViews",
",",
"\"remoteViews == null\"",
")",
";",
"ca... | Cancel any existing requests for the specified {@link RemoteViews} target with the given {@code
viewId}. | [
"Cancel",
"any",
"existing",
"requests",
"for",
"the",
"specified",
"{"
] | train | https://github.com/square/picasso/blob/89f55b76e3be2b65e5997b7698f782f16f8547e3/picasso/src/main/java/com/squareup/picasso3/Picasso.java#L230-L234 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java | AmazonSQSMessagingClientWrapper.createQueue | public CreateQueueResult createQueue(CreateQueueRequest createQueueRequest) throws JMSException {
try {
prepareRequest(createQueueRequest);
return amazonSQSClient.createQueue(createQueueRequest);
} catch (AmazonClientException e) {
throw handleException(e, "createQueue");
}
} | java | public CreateQueueResult createQueue(CreateQueueRequest createQueueRequest) throws JMSException {
try {
prepareRequest(createQueueRequest);
return amazonSQSClient.createQueue(createQueueRequest);
} catch (AmazonClientException e) {
throw handleException(e, "createQueue");
}
} | [
"public",
"CreateQueueResult",
"createQueue",
"(",
"CreateQueueRequest",
"createQueueRequest",
")",
"throws",
"JMSException",
"{",
"try",
"{",
"prepareRequest",
"(",
"createQueueRequest",
")",
";",
"return",
"amazonSQSClient",
".",
"createQueue",
"(",
"createQueueRequest"... | Calls <code>createQueue</code> to create the queue with the provided queue attributes
if any, and wraps <code>AmazonClientException</code>
@param createQueueRequest
Container for the necessary parameters to execute the
createQueue service method on AmazonSQS.
@return The response from the createQueue service method, as returned by
AmazonSQS. This call creates a new queue, or returns the URL of
an existing one.
@throws JMSException | [
"Calls",
"<code",
">",
"createQueue<",
"/",
"code",
">",
"to",
"create",
"the",
"queue",
"with",
"the",
"provided",
"queue",
"attributes",
"if",
"any",
"and",
"wraps",
"<code",
">",
"AmazonClientException<",
"/",
"code",
">"
] | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L326-L333 |
primefaces/primefaces | src/main/java/org/primefaces/util/WidgetBuilder.java | WidgetBuilder.selectorAttr | public WidgetBuilder selectorAttr(String name, String value) throws IOException {
if (value != null) {
ResponseWriter rw = context.getResponseWriter();
rw.write(",");
rw.write(name);
rw.write(":\"");
rw.write(ComponentUtils.escapeSelector(value));
rw.write("\"");
}
return this;
} | java | public WidgetBuilder selectorAttr(String name, String value) throws IOException {
if (value != null) {
ResponseWriter rw = context.getResponseWriter();
rw.write(",");
rw.write(name);
rw.write(":\"");
rw.write(ComponentUtils.escapeSelector(value));
rw.write("\"");
}
return this;
} | [
"public",
"WidgetBuilder",
"selectorAttr",
"(",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"ResponseWriter",
"rw",
"=",
"context",
".",
"getResponseWriter",
"(",
")",
";",
"rw",
... | This should only be used internally if the selector is directly used by jQuery on the client.
If PFS is used and specified by the user, {@link #attr(java.lang.String, java.lang.String)} should be used
as the users have to escape colons like @(myForm\:myId).
@param name
@param value
@return
@throws IOException | [
"This",
"should",
"only",
"be",
"used",
"internally",
"if",
"the",
"selector",
"is",
"directly",
"used",
"by",
"jQuery",
"on",
"the",
"client",
".",
"If",
"PFS",
"is",
"used",
"and",
"specified",
"by",
"the",
"user",
"{",
"@link",
"#attr",
"(",
"java",
... | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/WidgetBuilder.java#L128-L139 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.readXMLFragment | public static DocumentFragment readXMLFragment(String file, boolean skipRoot)
throws IOException, SAXException, ParserConfigurationException {
assert file != null : AssertMessages.notNullParameter();
try (FileInputStream fis = new FileInputStream(file)) {
return readXMLFragment(fis, skipRoot);
}
} | java | public static DocumentFragment readXMLFragment(String file, boolean skipRoot)
throws IOException, SAXException, ParserConfigurationException {
assert file != null : AssertMessages.notNullParameter();
try (FileInputStream fis = new FileInputStream(file)) {
return readXMLFragment(fis, skipRoot);
}
} | [
"public",
"static",
"DocumentFragment",
"readXMLFragment",
"(",
"String",
"file",
",",
"boolean",
"skipRoot",
")",
"throws",
"IOException",
",",
"SAXException",
",",
"ParserConfigurationException",
"{",
"assert",
"file",
"!=",
"null",
":",
"AssertMessages",
".",
"no... | Read an XML fragment from an XML file.
The XML file is well-formed. It means that the fragment will contains a single element: the root element
within the input file.
@param file is the file to read
@param skipRoot if {@code true} the root element itself is not part of the fragment, and the children
of the root element are directly added within the fragment.
@return the fragment from the {@code file}.
@throws IOException if the stream cannot be read.
@throws SAXException if the stream does not contains valid XML data.
@throws ParserConfigurationException if the parser cannot be configured. | [
"Read",
"an",
"XML",
"fragment",
"from",
"an",
"XML",
"file",
".",
"The",
"XML",
"file",
"is",
"well",
"-",
"formed",
".",
"It",
"means",
"that",
"the",
"fragment",
"will",
"contains",
"a",
"single",
"element",
":",
"the",
"root",
"element",
"within",
... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2118-L2124 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java | WebhooksInner.listAsync | public Observable<Page<WebhookInner>> listAsync(final String resourceGroupName, final String registryName) {
return listWithServiceResponseAsync(resourceGroupName, registryName)
.map(new Func1<ServiceResponse<Page<WebhookInner>>, Page<WebhookInner>>() {
@Override
public Page<WebhookInner> call(ServiceResponse<Page<WebhookInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<WebhookInner>> listAsync(final String resourceGroupName, final String registryName) {
return listWithServiceResponseAsync(resourceGroupName, registryName)
.map(new Func1<ServiceResponse<Page<WebhookInner>>, Page<WebhookInner>>() {
@Override
public Page<WebhookInner> call(ServiceResponse<Page<WebhookInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"WebhookInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"registryName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
"... | Lists all the webhooks for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<WebhookInner> object | [
"Lists",
"all",
"the",
"webhooks",
"for",
"the",
"specified",
"container",
"registry",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L791-L799 |
augustd/burp-suite-utils | src/main/java/com/codemagi/burp/Utils.java | Utils.urlEncode | public static String urlEncode(String input) {
try {
return URLEncoder.encode(input, "UTF-8");
} catch (UnsupportedEncodingException ex) {
throw new AssertionError("UTF-8 not supported", ex);
}
} | java | public static String urlEncode(String input) {
try {
return URLEncoder.encode(input, "UTF-8");
} catch (UnsupportedEncodingException ex) {
throw new AssertionError("UTF-8 not supported", ex);
}
} | [
"public",
"static",
"String",
"urlEncode",
"(",
"String",
"input",
")",
"{",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"input",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"ex",
")",
"{",
"throw",
"new",
"As... | URL encodes an input String using the UTF-8 character set
(IExtensionHelpers class uses LATIN-1)
@param input The String to encode
@return The URL-encoded String | [
"URL",
"encodes",
"an",
"input",
"String",
"using",
"the",
"UTF",
"-",
"8",
"character",
"set",
"(",
"IExtensionHelpers",
"class",
"uses",
"LATIN",
"-",
"1",
")"
] | train | https://github.com/augustd/burp-suite-utils/blob/5e34a6b9147f5705382f98049dd9e4f387b78629/src/main/java/com/codemagi/burp/Utils.java#L320-L326 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.createFulltextField | protected Field createFulltextField(String value, boolean store, boolean withOffsets)
{
return new Field(FieldNames.FULLTEXT, value, store ? Field.Store.YES : Field.Store.NO, Field.Index.ANALYZED,
withOffsets ? Field.TermVector.WITH_OFFSETS : Field.TermVector.NO);
} | java | protected Field createFulltextField(String value, boolean store, boolean withOffsets)
{
return new Field(FieldNames.FULLTEXT, value, store ? Field.Store.YES : Field.Store.NO, Field.Index.ANALYZED,
withOffsets ? Field.TermVector.WITH_OFFSETS : Field.TermVector.NO);
} | [
"protected",
"Field",
"createFulltextField",
"(",
"String",
"value",
",",
"boolean",
"store",
",",
"boolean",
"withOffsets",
")",
"{",
"return",
"new",
"Field",
"(",
"FieldNames",
".",
"FULLTEXT",
",",
"value",
",",
"store",
"?",
"Field",
".",
"Store",
".",
... | Creates a fulltext field for the string <code>value</code>.
@param value the string value.
@param store if the value of the field should be stored.
@param withOffsets if a term vector with offsets should be stored.
@return a lucene field. | [
"Creates",
"a",
"fulltext",
"field",
"for",
"the",
"string",
"<code",
">",
"value<",
"/",
"code",
">",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L907-L911 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java | AbstractModbusMaster.writeSingleRegister | public int writeSingleRegister(int unitId, int ref, Register register) throws ModbusException {
checkTransaction();
if (writeSingleRegisterRequest == null) {
writeSingleRegisterRequest = new WriteSingleRegisterRequest();
}
writeSingleRegisterRequest.setUnitID(unitId);
writeSingleRegisterRequest.setReference(ref);
writeSingleRegisterRequest.setRegister(register);
transaction.setRequest(writeSingleRegisterRequest);
transaction.execute();
return ((WriteSingleRegisterResponse) getAndCheckResponse()).getRegisterValue();
} | java | public int writeSingleRegister(int unitId, int ref, Register register) throws ModbusException {
checkTransaction();
if (writeSingleRegisterRequest == null) {
writeSingleRegisterRequest = new WriteSingleRegisterRequest();
}
writeSingleRegisterRequest.setUnitID(unitId);
writeSingleRegisterRequest.setReference(ref);
writeSingleRegisterRequest.setRegister(register);
transaction.setRequest(writeSingleRegisterRequest);
transaction.execute();
return ((WriteSingleRegisterResponse) getAndCheckResponse()).getRegisterValue();
} | [
"public",
"int",
"writeSingleRegister",
"(",
"int",
"unitId",
",",
"int",
"ref",
",",
"Register",
"register",
")",
"throws",
"ModbusException",
"{",
"checkTransaction",
"(",
")",
";",
"if",
"(",
"writeSingleRegisterRequest",
"==",
"null",
")",
"{",
"writeSingleR... | Writes a single register to the slave.
@param unitId the slave unit id.
@param ref the offset of the register to be written.
@param register a <tt>Register</tt> holding the value of the register
to be written.
@return the value of the register as returned from the slave.
@throws ModbusException if an I/O error, a slave exception or
a transaction error occurs. | [
"Writes",
"a",
"single",
"register",
"to",
"the",
"slave",
"."
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java#L254-L265 |
hsiafan/requests | src/main/java/net/dongliu/requests/Header.java | Header.of | public static Header of(String name, Object value) {
return new Header(requireNonNull(name), String.valueOf(requireNonNull(value)));
} | java | public static Header of(String name, Object value) {
return new Header(requireNonNull(name), String.valueOf(requireNonNull(value)));
} | [
"public",
"static",
"Header",
"of",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"Header",
"(",
"requireNonNull",
"(",
"name",
")",
",",
"String",
".",
"valueOf",
"(",
"requireNonNull",
"(",
"value",
")",
")",
")",
";",
"}"... | Create new header.
@param name header name
@param value header value
@return header | [
"Create",
"new",
"header",
"."
] | train | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/Header.java#L45-L47 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java | HashMap.put | public V put(K key, V value) {
return putVal(hash(key), key, value, false, true);
} | java | public V put(K key, V value) {
return putVal(hash(key), key, value, false, true);
} | [
"public",
"V",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"return",
"putVal",
"(",
"hash",
"(",
"key",
")",
",",
"key",
",",
"value",
",",
"false",
",",
"true",
")",
";",
"}"
] | Associates the specified value with the specified key in this map.
If the map previously contained a mapping for the key, the old
value is replaced.
@param key key with which the specified value is to be associated
@param value value to be associated with the specified key
@return the previous value associated with <tt>key</tt>, or
<tt>null</tt> if there was no mapping for <tt>key</tt>.
(A <tt>null</tt> return can also indicate that the map
previously associated <tt>null</tt> with <tt>key</tt>.) | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"this",
"map",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"key",
"the",
"old",
"value",
"is",
"replaced",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java#L616-L618 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRulePersistenceImpl.java | CPRulePersistenceImpl.filterFindByGroupId | @Override
public List<CPRule> filterFindByGroupId(long groupId, int start, int end) {
return filterFindByGroupId(groupId, start, end, null);
} | java | @Override
public List<CPRule> filterFindByGroupId(long groupId, int start, int end) {
return filterFindByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPRule",
">",
"filterFindByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"filterFindByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
... | Returns a range of all the cp rules that the user has permission to view where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPRuleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of cp rules
@param end the upper bound of the range of cp rules (not inclusive)
@return the range of matching cp rules that the user has permission to view | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"rules",
"that",
"the",
"user",
"has",
"permission",
"to",
"view",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRulePersistenceImpl.java#L554-L557 |
alkacon/opencms-core | src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBProjectId.java | CmsUpdateDBProjectId.dropColumn | private void dropColumn(CmsSetupDb dbCon, String tablename, String column) throws SQLException {
System.out.println(new Exception().getStackTrace()[0].toString());
if (dbCon.hasTableOrColumn(tablename, column)) {
String query = readQuery(QUERY_DROP_COLUMN);
Map<String, String> replacer = new HashMap<String, String>();
replacer.put(REPLACEMENT_TABLENAME, tablename);
replacer.put(REPLACEMENT_COLUMN, column);
dbCon.updateSqlStatement(query, replacer, null);
} else {
System.out.println("column " + column + " in table " + tablename + " does not exist");
}
} | java | private void dropColumn(CmsSetupDb dbCon, String tablename, String column) throws SQLException {
System.out.println(new Exception().getStackTrace()[0].toString());
if (dbCon.hasTableOrColumn(tablename, column)) {
String query = readQuery(QUERY_DROP_COLUMN);
Map<String, String> replacer = new HashMap<String, String>();
replacer.put(REPLACEMENT_TABLENAME, tablename);
replacer.put(REPLACEMENT_COLUMN, column);
dbCon.updateSqlStatement(query, replacer, null);
} else {
System.out.println("column " + column + " in table " + tablename + " does not exist");
}
} | [
"private",
"void",
"dropColumn",
"(",
"CmsSetupDb",
"dbCon",
",",
"String",
"tablename",
",",
"String",
"column",
")",
"throws",
"SQLException",
"{",
"System",
".",
"out",
".",
"println",
"(",
"new",
"Exception",
"(",
")",
".",
"getStackTrace",
"(",
")",
"... | Drops the column of the given table.<p>
@param dbCon the db connection interface
@param tablename the table in which the columns shall be dropped
@param column the column to drop
@throws SQLException if something goes wrong | [
"Drops",
"the",
"column",
"of",
"the",
"given",
"table",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBProjectId.java#L558-L570 |
jqm4gwt/jqm4gwt | library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMFlip.java | JQMFlip.setValue | @Override
public void setValue(String value, boolean fireEvents) {
int newIdx = value == null ? 0 : value.equals(getValue1()) ? 0
: value.equals(getValue2()) ? 1 : 0;
int oldIdx = getSelectedIndex();
String oldVal = fireEvents ? getValue() : null;
internVal = value;
if (oldIdx != newIdx) {
inSetValue = true;
try {
setSelectedIndex(newIdx);
} finally {
inSetValue = false;
}
}
if (fireEvents) {
boolean eq = internVal == oldVal || internVal != null && internVal.equals(oldVal);
if (!eq) ValueChangeEvent.fire(this, internVal);
}
} | java | @Override
public void setValue(String value, boolean fireEvents) {
int newIdx = value == null ? 0 : value.equals(getValue1()) ? 0
: value.equals(getValue2()) ? 1 : 0;
int oldIdx = getSelectedIndex();
String oldVal = fireEvents ? getValue() : null;
internVal = value;
if (oldIdx != newIdx) {
inSetValue = true;
try {
setSelectedIndex(newIdx);
} finally {
inSetValue = false;
}
}
if (fireEvents) {
boolean eq = internVal == oldVal || internVal != null && internVal.equals(oldVal);
if (!eq) ValueChangeEvent.fire(this, internVal);
}
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"String",
"value",
",",
"boolean",
"fireEvents",
")",
"{",
"int",
"newIdx",
"=",
"value",
"==",
"null",
"?",
"0",
":",
"value",
".",
"equals",
"(",
"getValue1",
"(",
")",
")",
"?",
"0",
":",
"value"... | Sets the currently selected value.
@param fireEvents - if false then ValueChangeEvent won't be raised (though ChangeEvent will be raised anyway). | [
"Sets",
"the",
"currently",
"selected",
"value",
"."
] | train | https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMFlip.java#L299-L319 |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java | VimGenerator2.appendCluster | protected IStyleAppendable appendCluster(IStyleAppendable it, String element0, String... elements) {
return appendCluster(it, true, element0, elements);
} | java | protected IStyleAppendable appendCluster(IStyleAppendable it, String element0, String... elements) {
return appendCluster(it, true, element0, elements);
} | [
"protected",
"IStyleAppendable",
"appendCluster",
"(",
"IStyleAppendable",
"it",
",",
"String",
"element0",
",",
"String",
"...",
"elements",
")",
"{",
"return",
"appendCluster",
"(",
"it",
",",
"true",
",",
"element0",
",",
"elements",
")",
";",
"}"
] | Append elements to the Vim top cluster.
@param it the receiver of the generated elements.
@param element0 the first element to add into the cluster.
@param elements the other elements to add into the cluster.
@return {@code it}. | [
"Append",
"elements",
"to",
"the",
"Vim",
"top",
"cluster",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L350-L352 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/writebehind/DefaultWriteBehindProcessor.java | DefaultWriteBehindProcessor.callHandler | private List<DelayedEntry> callHandler(Collection<DelayedEntry> delayedEntries,
StoreOperationType operationType) {
final int size = delayedEntries.size();
if (size == 0) {
return Collections.emptyList();
}
// if we want to write all store operations on a key into the MapStore, not same as write-coalescing, we don't call
// batch processing methods e.g., MapStore{#storeAll,#deleteAll}, instead we call methods which process single entries
// e.g. MapStore{#store,#delete}. This is because MapStore#storeAll requires a Map type in its signature and Map type
// can only contain one store operation type per key, so only last update on a key can be included when batching.
// Due to that limitation it is not possible to provide a correct no-write-coalescing write-behind behavior.
// Under that limitation of current MapStore interface, we are making a workaround and persisting all
// entries one by one for no-write-coalescing write-behind map-stores and as a result not doing batching
// when writeCoalescing is false.
if (size == 1 || !writeCoalescing) {
return processEntriesOneByOne(delayedEntries, operationType);
}
final DelayedEntry[] delayedEntriesArray = delayedEntries.toArray(new DelayedEntry[0]);
final Map<Object, DelayedEntry> batchMap = prepareBatchMap(delayedEntriesArray);
// if all batch is on same key, call single store.
if (batchMap.size() == 1) {
final DelayedEntry delayedEntry = delayedEntriesArray[delayedEntriesArray.length - 1];
return callSingleStoreWithListeners(delayedEntry, operationType);
}
final List<DelayedEntry> failedEntryList = callBatchStoreWithListeners(batchMap, operationType);
final List<DelayedEntry> failedTries = new ArrayList<>();
for (DelayedEntry entry : failedEntryList) {
final Collection<DelayedEntry> tmpFails = callSingleStoreWithListeners(entry, operationType);
failedTries.addAll(tmpFails);
}
return failedTries;
} | java | private List<DelayedEntry> callHandler(Collection<DelayedEntry> delayedEntries,
StoreOperationType operationType) {
final int size = delayedEntries.size();
if (size == 0) {
return Collections.emptyList();
}
// if we want to write all store operations on a key into the MapStore, not same as write-coalescing, we don't call
// batch processing methods e.g., MapStore{#storeAll,#deleteAll}, instead we call methods which process single entries
// e.g. MapStore{#store,#delete}. This is because MapStore#storeAll requires a Map type in its signature and Map type
// can only contain one store operation type per key, so only last update on a key can be included when batching.
// Due to that limitation it is not possible to provide a correct no-write-coalescing write-behind behavior.
// Under that limitation of current MapStore interface, we are making a workaround and persisting all
// entries one by one for no-write-coalescing write-behind map-stores and as a result not doing batching
// when writeCoalescing is false.
if (size == 1 || !writeCoalescing) {
return processEntriesOneByOne(delayedEntries, operationType);
}
final DelayedEntry[] delayedEntriesArray = delayedEntries.toArray(new DelayedEntry[0]);
final Map<Object, DelayedEntry> batchMap = prepareBatchMap(delayedEntriesArray);
// if all batch is on same key, call single store.
if (batchMap.size() == 1) {
final DelayedEntry delayedEntry = delayedEntriesArray[delayedEntriesArray.length - 1];
return callSingleStoreWithListeners(delayedEntry, operationType);
}
final List<DelayedEntry> failedEntryList = callBatchStoreWithListeners(batchMap, operationType);
final List<DelayedEntry> failedTries = new ArrayList<>();
for (DelayedEntry entry : failedEntryList) {
final Collection<DelayedEntry> tmpFails = callSingleStoreWithListeners(entry, operationType);
failedTries.addAll(tmpFails);
}
return failedTries;
} | [
"private",
"List",
"<",
"DelayedEntry",
">",
"callHandler",
"(",
"Collection",
"<",
"DelayedEntry",
">",
"delayedEntries",
",",
"StoreOperationType",
"operationType",
")",
"{",
"final",
"int",
"size",
"=",
"delayedEntries",
".",
"size",
"(",
")",
";",
"if",
"(... | Decides how entries should be passed to handlers.
It passes entries to handler's single or batch handling
methods.
@param delayedEntries sorted entries to be processed.
@return failed entry list if any. | [
"Decides",
"how",
"entries",
"should",
"be",
"passed",
"to",
"handlers",
".",
"It",
"passes",
"entries",
"to",
"handler",
"s",
"single",
"or",
"batch",
"handling",
"methods",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/writebehind/DefaultWriteBehindProcessor.java#L121-L153 |
Azure/azure-sdk-for-java | marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java | MarketplaceAgreementsInner.createAsync | public Observable<AgreementTermsInner> createAsync(String publisherId, String offerId, String planId, AgreementTermsInner parameters) {
return createWithServiceResponseAsync(publisherId, offerId, planId, parameters).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() {
@Override
public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) {
return response.body();
}
});
} | java | public Observable<AgreementTermsInner> createAsync(String publisherId, String offerId, String planId, AgreementTermsInner parameters) {
return createWithServiceResponseAsync(publisherId, offerId, planId, parameters).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() {
@Override
public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AgreementTermsInner",
">",
"createAsync",
"(",
"String",
"publisherId",
",",
"String",
"offerId",
",",
"String",
"planId",
",",
"AgreementTermsInner",
"parameters",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"publisherId",
... | Save marketplace terms.
@param publisherId Publisher identifier string of image being deployed.
@param offerId Offer identifier string of image being deployed.
@param planId Plan identifier string of image being deployed.
@param parameters Parameters supplied to the Create Marketplace Terms operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AgreementTermsInner object | [
"Save",
"marketplace",
"terms",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java#L223-L230 |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrDocumentXmlContent.java | CmsSolrDocumentXmlContent.extractXmlContent | public static CmsExtractionResult extractXmlContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsException {
return extractXmlContent(cms, resource, index, null);
} | java | public static CmsExtractionResult extractXmlContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsException {
return extractXmlContent(cms, resource, index, null);
} | [
"public",
"static",
"CmsExtractionResult",
"extractXmlContent",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"I_CmsSearchIndex",
"index",
")",
"throws",
"CmsException",
"{",
"return",
"extractXmlContent",
"(",
"cms",
",",
"resource",
",",
"index",
"... | Extracts the content of a single XML content resource.<p>
@param cms the cms context
@param resource the resource
@param index the used index
@return the extraction result
@throws CmsException in case reading or unmarshalling the content fails | [
"Extracts",
"the",
"content",
"of",
"a",
"single",
"XML",
"content",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrDocumentXmlContent.java#L354-L358 |
HsiangLeekwok/hlklib | hlklib/src/main/java/com/hlk/hlklib/etc/Cryptography.java | Cryptography.fileMessageDigest | private static String fileMessageDigest(String filePath, String algorithm) {
String result = null;
try {
result = new ComputeTask().exec(filePath, algorithm).get();
} catch (Exception e) {
e.printStackTrace();
}
return result;
} | java | private static String fileMessageDigest(String filePath, String algorithm) {
String result = null;
try {
result = new ComputeTask().exec(filePath, algorithm).get();
} catch (Exception e) {
e.printStackTrace();
}
return result;
} | [
"private",
"static",
"String",
"fileMessageDigest",
"(",
"String",
"filePath",
",",
"String",
"algorithm",
")",
"{",
"String",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"new",
"ComputeTask",
"(",
")",
".",
"exec",
"(",
"filePath",
",",
"algori... | 获取文件的指定信息
@param filePath 文件路径
@param algorithm 算法
@return 字符串 | [
"获取文件的指定信息"
] | train | https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/etc/Cryptography.java#L90-L99 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Path.java | Path.acceptVisitor | public void acceptVisitor(CFG cfg, PathVisitor visitor) {
if (getLength() > 0) {
BasicBlock startBlock = cfg.lookupBlockByLabel(getBlockIdAt(0));
acceptVisitorStartingFromLocation(cfg, visitor, startBlock, startBlock.getFirstInstruction());
}
} | java | public void acceptVisitor(CFG cfg, PathVisitor visitor) {
if (getLength() > 0) {
BasicBlock startBlock = cfg.lookupBlockByLabel(getBlockIdAt(0));
acceptVisitorStartingFromLocation(cfg, visitor, startBlock, startBlock.getFirstInstruction());
}
} | [
"public",
"void",
"acceptVisitor",
"(",
"CFG",
"cfg",
",",
"PathVisitor",
"visitor",
")",
"{",
"if",
"(",
"getLength",
"(",
")",
">",
"0",
")",
"{",
"BasicBlock",
"startBlock",
"=",
"cfg",
".",
"lookupBlockByLabel",
"(",
"getBlockIdAt",
"(",
"0",
")",
")... | Accept a PathVisitor.
@param cfg
the control flow graph
@param visitor
a PathVisitor | [
"Accept",
"a",
"PathVisitor",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Path.java#L134-L139 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/config/AtomTypeFactory.java | AtomTypeFactory.getInstance | public static AtomTypeFactory getInstance(String configFile, IChemObjectBuilder builder) {
if (tables == null) {
tables = new Hashtable<String, AtomTypeFactory>();
}
if (!(tables.containsKey(configFile))) {
tables.put(configFile, new AtomTypeFactory(configFile, builder));
}
return tables.get(configFile);
} | java | public static AtomTypeFactory getInstance(String configFile, IChemObjectBuilder builder) {
if (tables == null) {
tables = new Hashtable<String, AtomTypeFactory>();
}
if (!(tables.containsKey(configFile))) {
tables.put(configFile, new AtomTypeFactory(configFile, builder));
}
return tables.get(configFile);
} | [
"public",
"static",
"AtomTypeFactory",
"getInstance",
"(",
"String",
"configFile",
",",
"IChemObjectBuilder",
"builder",
")",
"{",
"if",
"(",
"tables",
"==",
"null",
")",
"{",
"tables",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"AtomTypeFactory",
">",
"(",
... | Method to create a specialized AtomTypeFactory. Available lists in CDK are:
<ul>
<li>org/openscience/cdk/config/data/jmol_atomtypes.txt
<li>org/openscience/cdk/config/data/mol2_atomtypes.xml
<li>org/openscience/cdk/config/data/structgen_atomtypes.xml
<li>org/openscience/cdk/config/data/mm2_atomtypes.xml
<li>org/openscience/cdk/config/data/mmff94_atomtypes.xml
<li>org/openscience/cdk/dict/data/cdk-atom-types.owl
<li>org/openscience/cdk/dict/data/sybyl-atom-types.owl
</ul>
@param configFile String the name of the data file
@param builder INewChemObjectBuilder used to make IChemObject instances
@return The AtomTypeFactory for the given data file | [
"Method",
"to",
"create",
"a",
"specialized",
"AtomTypeFactory",
".",
"Available",
"lists",
"in",
"CDK",
"are",
":",
"<ul",
">",
"<li",
">",
"org",
"/",
"openscience",
"/",
"cdk",
"/",
"config",
"/",
"data",
"/",
"jmol_atomtypes",
".",
"txt",
"<li",
">",... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/config/AtomTypeFactory.java#L160-L168 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/index/hash/HashIndex.java | HashIndex.getDataRecordId | @Override
public RecordId getDataRecordId() {
long blkNum = (Long) rf.getVal(SCHEMA_RID_BLOCK).asJavaVal();
int id = (Integer) rf.getVal(SCHEMA_RID_ID).asJavaVal();
return new RecordId(new BlockId(dataFileName, blkNum), id);
} | java | @Override
public RecordId getDataRecordId() {
long blkNum = (Long) rf.getVal(SCHEMA_RID_BLOCK).asJavaVal();
int id = (Integer) rf.getVal(SCHEMA_RID_ID).asJavaVal();
return new RecordId(new BlockId(dataFileName, blkNum), id);
} | [
"@",
"Override",
"public",
"RecordId",
"getDataRecordId",
"(",
")",
"{",
"long",
"blkNum",
"=",
"(",
"Long",
")",
"rf",
".",
"getVal",
"(",
"SCHEMA_RID_BLOCK",
")",
".",
"asJavaVal",
"(",
")",
";",
"int",
"id",
"=",
"(",
"Integer",
")",
"rf",
".",
"g... | Retrieves the data record ID from the current index record.
@see Index#getDataRecordId() | [
"Retrieves",
"the",
"data",
"record",
"ID",
"from",
"the",
"current",
"index",
"record",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/index/hash/HashIndex.java#L162-L167 |
sdl/Testy | src/main/java/com/sdl/selenium/extjs6/button/DownloadButton.java | DownloadButton.downloadFromMenu | public boolean downloadFromMenu(String name, String fileName) {
clickOnMenu(name);
return executor.download(fileName, 10000L);
} | java | public boolean downloadFromMenu(String name, String fileName) {
clickOnMenu(name);
return executor.download(fileName, 10000L);
} | [
"public",
"boolean",
"downloadFromMenu",
"(",
"String",
"name",
",",
"String",
"fileName",
")",
"{",
"clickOnMenu",
"(",
"name",
")",
";",
"return",
"executor",
".",
"download",
"(",
"fileName",
",",
"10000L",
")",
";",
"}"
] | if WebDriverConfig.isSilentDownload() is true, se face silentDownload, is is false se face download with AutoIT.
@param name e.g. TBX
@param fileName e.g. "TestSet.tmx"
@return true if the downloaded file is the same one that is meant to be downloaded, otherwise returns false. | [
"if",
"WebDriverConfig",
".",
"isSilentDownload",
"()",
"is",
"true",
"se",
"face",
"silentDownload",
"is",
"is",
"false",
"se",
"face",
"download",
"with",
"AutoIT",
"."
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/extjs6/button/DownloadButton.java#L47-L50 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.withOutputStream | public static Object withOutputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.OutputStream") Closure closure) throws IOException {
return IOGroovyMethods.withStream(newOutputStream(file), closure);
} | java | public static Object withOutputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.OutputStream") Closure closure) throws IOException {
return IOGroovyMethods.withStream(newOutputStream(file), closure);
} | [
"public",
"static",
"Object",
"withOutputStream",
"(",
"File",
"file",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.io.OutputStream\"",
")",
"Closure",
"closure",
")",
"throws",
"IOException",
"{",
"retur... | Creates a new OutputStream for this file and passes it into the closure.
This method ensures the stream is closed after the closure returns.
@param file a File
@param closure a closure
@return the value returned by the closure
@throws IOException if an IOException occurs.
@see IOGroovyMethods#withStream(java.io.OutputStream, groovy.lang.Closure)
@since 1.5.2 | [
"Creates",
"a",
"new",
"OutputStream",
"for",
"this",
"file",
"and",
"passes",
"it",
"into",
"the",
"closure",
".",
"This",
"method",
"ensures",
"the",
"stream",
"is",
"closed",
"after",
"the",
"closure",
"returns",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1827-L1829 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/util/Config.java | Config.getBooleanProperty | public static Boolean getBooleanProperty(String key, Boolean defaultValue) {
String value = getProperty(key);
if((null == value) || value.isEmpty() ) {
return (null == defaultValue) ? false : defaultValue;
}
if("null".equals(value.toLowerCase()) && (null != defaultValue) ) {
return defaultValue;
}
return Boolean.parseBoolean(value);
} | java | public static Boolean getBooleanProperty(String key, Boolean defaultValue) {
String value = getProperty(key);
if((null == value) || value.isEmpty() ) {
return (null == defaultValue) ? false : defaultValue;
}
if("null".equals(value.toLowerCase()) && (null != defaultValue) ) {
return defaultValue;
}
return Boolean.parseBoolean(value);
} | [
"public",
"static",
"Boolean",
"getBooleanProperty",
"(",
"String",
"key",
",",
"Boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"(",
"null",
"==",
"value",
")",
"||",
"value",
".",
"isEmpty",
"... | Returns boolean value for specified property and default value
@param key
@param defaultValue
@return | [
"Returns",
"boolean",
"value",
"for",
"specified",
"property",
"and",
"default",
"value"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/util/Config.java#L272-L281 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java | ContainerServicesInner.getByResourceGroup | public ContainerServiceInner getByResourceGroup(String resourceGroupName, String containerServiceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, containerServiceName).toBlocking().single().body();
} | java | public ContainerServiceInner getByResourceGroup(String resourceGroupName, String containerServiceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, containerServiceName).toBlocking().single().body();
} | [
"public",
"ContainerServiceInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerServiceName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerServiceName",
")",
".",
"toBlocking",
... | Gets the properties of the specified container service.
Gets the properties of the specified container service in the specified subscription and resource group. The operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters and agents.
@param resourceGroupName The name of the resource group.
@param containerServiceName The name of the container service in the specified subscription and resource group.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ContainerServiceInner object if successful. | [
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"container",
"service",
".",
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"container",
"service",
"in",
"the",
"specified",
"subscription",
"and",
"resource",
"group",
".",
"The",
"operation",
"ret... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java#L407-L409 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/LocaleUtils.java | LocaleUtils.createResourceFilesRegex | public static String createResourceFilesRegex(String fileName, String fileExtension) {
if (fileName == null) {
throw new IllegalArgumentException("Parameter fileName must not be null.");
}
if (fileExtension == null) {
throw new IllegalArgumentException("Parameter fileExtension must not be null.");
}
StringBuilder strBuilder = new StringBuilder(fileName.length() + LANGUAGE_LOCALE_REGEX.length()
+ COUNTRY_LOCALE_REGEX.length() + fileExtension.length() + 13);
strBuilder.append(Pattern.quote(fileName));
strBuilder.append("(?:_").append(LANGUAGE_LOCALE_REGEX);
strBuilder.append("(?:_").append(COUNTRY_LOCALE_REGEX).append(")?").append(")?");
strBuilder.append(Pattern.quote(fileExtension));
strBuilder.append('$');
return strBuilder.toString();
} | java | public static String createResourceFilesRegex(String fileName, String fileExtension) {
if (fileName == null) {
throw new IllegalArgumentException("Parameter fileName must not be null.");
}
if (fileExtension == null) {
throw new IllegalArgumentException("Parameter fileExtension must not be null.");
}
StringBuilder strBuilder = new StringBuilder(fileName.length() + LANGUAGE_LOCALE_REGEX.length()
+ COUNTRY_LOCALE_REGEX.length() + fileExtension.length() + 13);
strBuilder.append(Pattern.quote(fileName));
strBuilder.append("(?:_").append(LANGUAGE_LOCALE_REGEX);
strBuilder.append("(?:_").append(COUNTRY_LOCALE_REGEX).append(")?").append(")?");
strBuilder.append(Pattern.quote(fileExtension));
strBuilder.append('$');
return strBuilder.toString();
} | [
"public",
"static",
"String",
"createResourceFilesRegex",
"(",
"String",
"fileName",
",",
"String",
"fileExtension",
")",
"{",
"if",
"(",
"fileName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter fileName must not be null.\"",
"... | Returns a regular expression to match source and translated resource filenames with the given {@code fileName} and
{@code fileExtension}.
<p>
For example, with {@code fileName} as "Messages" and {@code fileExtension} as ".properties" the returned pattern would
match:
<ul>
<li>Messages.properties</li>
<li>Messages_en.properties</li>
<li>Messages_en_GB.properties</li>
</ul>
@param fileName the name of the resource files
@param fileExtension the extension of the resource files
@return the regular expression to match resource filenames
@throws IllegalArgumentException if the given {@code fileName} or {@code fileExtension} is {@code null}.
@see #createResourceFilesPattern(String, String)
@see #LANGUAGE_LOCALE_REGEX
@see #COUNTRY_LOCALE_REGEX
@since 2.4.0 | [
"Returns",
"a",
"regular",
"expression",
"to",
"match",
"source",
"and",
"translated",
"resource",
"filenames",
"with",
"the",
"given",
"{",
"@code",
"fileName",
"}",
"and",
"{",
"@code",
"fileExtension",
"}",
".",
"<p",
">",
"For",
"example",
"with",
"{",
... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/LocaleUtils.java#L301-L317 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/db/PersistentContext.java | PersistentContext.doInTransaction | public <T> T doInTransaction(final TxConfig config, final SpecificTxAction<T, C> action) {
return template.doInTransaction(config, action);
} | java | public <T> T doInTransaction(final TxConfig config, final SpecificTxAction<T, C> action) {
return template.doInTransaction(config, action);
} | [
"public",
"<",
"T",
">",
"T",
"doInTransaction",
"(",
"final",
"TxConfig",
"config",
",",
"final",
"SpecificTxAction",
"<",
"T",
",",
"C",
">",
"action",
")",
"{",
"return",
"template",
".",
"doInTransaction",
"(",
"config",
",",
"action",
")",
";",
"}"
... | Execute specific action within transaction.
@param config transaction config (ignored in case of ongoing transaction)
@param action action to execute within transaction (new or ongoing)
@param <T> expected return type
@return value produced by action
@see ru.vyarus.guice.persist.orient.db.transaction.template.SpecificTxTemplate | [
"Execute",
"specific",
"action",
"within",
"transaction",
"."
] | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/db/PersistentContext.java#L106-L108 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java | TransformersLogger.logAttributeWarning | public void logAttributeWarning(PathAddress address, ModelNode operation, String message, Set<String> attributes) {
messageQueue.add(new AttributeLogEntry(address, operation, message, attributes));
} | java | public void logAttributeWarning(PathAddress address, ModelNode operation, String message, Set<String> attributes) {
messageQueue.add(new AttributeLogEntry(address, operation, message, attributes));
} | [
"public",
"void",
"logAttributeWarning",
"(",
"PathAddress",
"address",
",",
"ModelNode",
"operation",
",",
"String",
"message",
",",
"Set",
"<",
"String",
">",
"attributes",
")",
"{",
"messageQueue",
".",
"add",
"(",
"new",
"AttributeLogEntry",
"(",
"address",
... | Log a warning for the given operation at the provided address for the given attributes, using the provided detail
message.
@param address where warning occurred
@param operation where which problem occurred
@param message custom error message to append
@param attributes attributes we that have problems about | [
"Log",
"a",
"warning",
"for",
"the",
"given",
"operation",
"at",
"the",
"provided",
"address",
"for",
"the",
"given",
"attributes",
"using",
"the",
"provided",
"detail",
"message",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L160-L162 |
kayemkim/milonga | src/main/java/com/skp/milonga/servlet/handler/AtmosHttpRequestHandler.java | AtmosHttpRequestHandler.setCookie | @SuppressWarnings("unchecked")
private void setCookie(NativeObject result, HttpServletResponse response) {
Map<String, String> cookieMap = ScriptableObject.getTypedProperty(
result, "cookie", Map.class);
if (cookieMap == null) {
return;
}
Iterator<Entry<String, String>> iterator = cookieMap.entrySet()
.iterator();
while (iterator.hasNext()) {
String name = iterator.next().getKey();
Cookie cookie = new Cookie(name, cookieMap.get(name));
response.addCookie(cookie);
}
} | java | @SuppressWarnings("unchecked")
private void setCookie(NativeObject result, HttpServletResponse response) {
Map<String, String> cookieMap = ScriptableObject.getTypedProperty(
result, "cookie", Map.class);
if (cookieMap == null) {
return;
}
Iterator<Entry<String, String>> iterator = cookieMap.entrySet()
.iterator();
while (iterator.hasNext()) {
String name = iterator.next().getKey();
Cookie cookie = new Cookie(name, cookieMap.get(name));
response.addCookie(cookie);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"setCookie",
"(",
"NativeObject",
"result",
",",
"HttpServletResponse",
"response",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"cookieMap",
"=",
"ScriptableObject",
".",
"getTypedPrope... | set cookie from result of handler to HttpServletResponse
@param result
return object of handler
@param response
HttpServletResponse | [
"set",
"cookie",
"from",
"result",
"of",
"handler",
"to",
"HttpServletResponse"
] | train | https://github.com/kayemkim/milonga/blob/b084095552995dc3998d7fe1fd71c06a3a378af2/src/main/java/com/skp/milonga/servlet/handler/AtmosHttpRequestHandler.java#L87-L102 |
facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerHistory.java | ServerHistory.cleanUpHistory | private void cleanUpHistory() {
long oldestAllowedTimestamp = System.currentTimeMillis() - historyLength;
int trashedNotifications = 0;
if (LOG.isDebugEnabled()) {
LOG.debug("History cleanup: Checking old notifications to remove from history list ...");
}
HistoryTreeEntry key = new HistoryTreeEntry(oldestAllowedTimestamp, 0, (byte)0);
int notificationsCount = 0;
historyLock.writeLock().lock();
try {
notificationsCount = orderedHistoryList.size();
LOG.warn("History cleanup: size of the history before cleanup: " + notificationsCount);
if (!historyLimitDisabled && notificationsCount > historyLimit) {
LOG.warn("History cleanup: Reached physical limit. Number of stored notifications: " +
notificationsCount + ". Clearing ...");
}
int index = Collections.binarySearch(orderedHistoryList, key, comparatorByTS);
int toDeleteByTS = index >= 0 ? index : - (index + 1);
int toDeleteByLimit = historyLimitDisabled ? 0 : notificationsCount - (int)historyLimit;
toDeleteByLimit = toDeleteByLimit > 0 ? toDeleteByLimit : 0;
int toDelete = Math.max(toDeleteByTS, toDeleteByLimit);
// Delete items which are too old
if (toDelete > 0) {
LOG.warn("History cleanup: number of the history to cleanup: " + toDelete);
for (int i = 0; i < toDelete; i++) {
orderedHistoryList.get(i).removeFromTree();
}
orderedHistoryList.subList(0, toDelete).clear();
if (toDeleteByLimit > toDeleteByTS) {
// If we delete a notification because we don't have space left
trashedNotifications ++;
}
notificationsCount = orderedHistoryList.size();
LOG.warn("History cleanup: size of the history after cleanup: " + notificationsCount);
// clean up history tree, remove the node that has no children and
// no notifications associated with them.
cleanUpHistoryTree(historyTree);
}
} finally {
historyLock.writeLock().unlock();
}
core.getMetrics().trashedHistoryNotifications.inc(trashedNotifications);
core.getMetrics().historySize.set(notificationsCount);
core.getMetrics().historyQueues.set(historyQueuesCount);
} | java | private void cleanUpHistory() {
long oldestAllowedTimestamp = System.currentTimeMillis() - historyLength;
int trashedNotifications = 0;
if (LOG.isDebugEnabled()) {
LOG.debug("History cleanup: Checking old notifications to remove from history list ...");
}
HistoryTreeEntry key = new HistoryTreeEntry(oldestAllowedTimestamp, 0, (byte)0);
int notificationsCount = 0;
historyLock.writeLock().lock();
try {
notificationsCount = orderedHistoryList.size();
LOG.warn("History cleanup: size of the history before cleanup: " + notificationsCount);
if (!historyLimitDisabled && notificationsCount > historyLimit) {
LOG.warn("History cleanup: Reached physical limit. Number of stored notifications: " +
notificationsCount + ". Clearing ...");
}
int index = Collections.binarySearch(orderedHistoryList, key, comparatorByTS);
int toDeleteByTS = index >= 0 ? index : - (index + 1);
int toDeleteByLimit = historyLimitDisabled ? 0 : notificationsCount - (int)historyLimit;
toDeleteByLimit = toDeleteByLimit > 0 ? toDeleteByLimit : 0;
int toDelete = Math.max(toDeleteByTS, toDeleteByLimit);
// Delete items which are too old
if (toDelete > 0) {
LOG.warn("History cleanup: number of the history to cleanup: " + toDelete);
for (int i = 0; i < toDelete; i++) {
orderedHistoryList.get(i).removeFromTree();
}
orderedHistoryList.subList(0, toDelete).clear();
if (toDeleteByLimit > toDeleteByTS) {
// If we delete a notification because we don't have space left
trashedNotifications ++;
}
notificationsCount = orderedHistoryList.size();
LOG.warn("History cleanup: size of the history after cleanup: " + notificationsCount);
// clean up history tree, remove the node that has no children and
// no notifications associated with them.
cleanUpHistoryTree(historyTree);
}
} finally {
historyLock.writeLock().unlock();
}
core.getMetrics().trashedHistoryNotifications.inc(trashedNotifications);
core.getMetrics().historySize.set(notificationsCount);
core.getMetrics().historyQueues.set(historyQueuesCount);
} | [
"private",
"void",
"cleanUpHistory",
"(",
")",
"{",
"long",
"oldestAllowedTimestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"historyLength",
";",
"int",
"trashedNotifications",
"=",
"0",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",... | Checks if there are notifications in our tree which are older than
historyLength. It removes does which are older. | [
"Checks",
"if",
"there",
"are",
"notifications",
"in",
"our",
"tree",
"which",
"are",
"older",
"than",
"historyLength",
".",
"It",
"removes",
"does",
"which",
"are",
"older",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerHistory.java#L142-L197 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java | DataXceiver.readBlockAccelerator | private void readBlockAccelerator(DataInputStream in,
VersionAndOpcode versionAndOpcode) throws IOException {
//
// Read in the header
//
int namespaceId = in.readInt();
long blockId = in.readLong();
long generationStamp = in.readLong();
long startOffset = in.readLong();
long length = in.readLong();
String clientName = Text.readString(in);
if (LOG.isDebugEnabled()) {
LOG.debug("readBlockAccelerator blkid = " + blockId +
" offset " + startOffset + " length " + length);
}
long startTime = System.currentTimeMillis();
Block block = new Block( blockId, 0 , generationStamp);
// TODO: support inline checksum
ReplicaToRead ri = datanode.data.getReplicaToRead(namespaceId, block);
File dataFile = datanode.data.getBlockFile(namespaceId, block);
long read = -1;
try {
if (ri.isInlineChecksum()) {
read = BlockInlineChecksumReader.readBlockAccelerator(s, ri, dataFile,
block, startOffset, length, datanode);
} else {
read = BlockWithChecksumFileReader.readBlockAccelerator(s, dataFile,
block, startOffset, length, datanode);
}
}
finally {
if (read != -1) {
long readDuration = System.currentTimeMillis() - startTime;
datanode.myMetrics.bytesReadLatency.inc(readDuration);
datanode.myMetrics.bytesRead.inc((int) read);
if (read > KB_RIGHT_SHIFT_MIN) {
datanode.myMetrics.bytesReadRate.inc(
(int) (read >> KB_RIGHT_SHIFT_BITS), readDuration);
}
datanode.myMetrics.blocksRead.inc();
}
}
} | java | private void readBlockAccelerator(DataInputStream in,
VersionAndOpcode versionAndOpcode) throws IOException {
//
// Read in the header
//
int namespaceId = in.readInt();
long blockId = in.readLong();
long generationStamp = in.readLong();
long startOffset = in.readLong();
long length = in.readLong();
String clientName = Text.readString(in);
if (LOG.isDebugEnabled()) {
LOG.debug("readBlockAccelerator blkid = " + blockId +
" offset " + startOffset + " length " + length);
}
long startTime = System.currentTimeMillis();
Block block = new Block( blockId, 0 , generationStamp);
// TODO: support inline checksum
ReplicaToRead ri = datanode.data.getReplicaToRead(namespaceId, block);
File dataFile = datanode.data.getBlockFile(namespaceId, block);
long read = -1;
try {
if (ri.isInlineChecksum()) {
read = BlockInlineChecksumReader.readBlockAccelerator(s, ri, dataFile,
block, startOffset, length, datanode);
} else {
read = BlockWithChecksumFileReader.readBlockAccelerator(s, dataFile,
block, startOffset, length, datanode);
}
}
finally {
if (read != -1) {
long readDuration = System.currentTimeMillis() - startTime;
datanode.myMetrics.bytesReadLatency.inc(readDuration);
datanode.myMetrics.bytesRead.inc((int) read);
if (read > KB_RIGHT_SHIFT_MIN) {
datanode.myMetrics.bytesReadRate.inc(
(int) (read >> KB_RIGHT_SHIFT_BITS), readDuration);
}
datanode.myMetrics.blocksRead.inc();
}
}
} | [
"private",
"void",
"readBlockAccelerator",
"(",
"DataInputStream",
"in",
",",
"VersionAndOpcode",
"versionAndOpcode",
")",
"throws",
"IOException",
"{",
"//",
"// Read in the header",
"//",
"int",
"namespaceId",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"long",
"b... | Read a block from the disk, the emphasis in on speed baby, speed!
The focus is to decrease the number of system calls issued to satisfy
this read request.
@param in The stream to read from
Input 4 bytes: namespace id
8 bytes: block id
8 bytes: genstamp
8 bytes: startOffset
8 bytes: length of data to read
n bytes: clientName as a string
Output 1 bytes: checksum type
4 bytes: bytes per checksum
-stream of checksum values for all data
-stream of data starting from the previous alignment of startOffset
with bytesPerChecksum
@throws IOException | [
"Read",
"a",
"block",
"from",
"the",
"disk",
"the",
"emphasis",
"in",
"on",
"speed",
"baby",
"speed!",
"The",
"focus",
"is",
"to",
"decrease",
"the",
"number",
"of",
"system",
"calls",
"issued",
"to",
"satisfy",
"this",
"read",
"request",
".",
"@param",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java#L1326-L1371 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java | JobControllerClient.getJob | public final Job getJob(String projectId, String region, String jobId) {
GetJobRequest request =
GetJobRequest.newBuilder()
.setProjectId(projectId)
.setRegion(region)
.setJobId(jobId)
.build();
return getJob(request);
} | java | public final Job getJob(String projectId, String region, String jobId) {
GetJobRequest request =
GetJobRequest.newBuilder()
.setProjectId(projectId)
.setRegion(region)
.setJobId(jobId)
.build();
return getJob(request);
} | [
"public",
"final",
"Job",
"getJob",
"(",
"String",
"projectId",
",",
"String",
"region",
",",
"String",
"jobId",
")",
"{",
"GetJobRequest",
"request",
"=",
"GetJobRequest",
".",
"newBuilder",
"(",
")",
".",
"setProjectId",
"(",
"projectId",
")",
".",
"setReg... | Gets the resource representation for a job in a project.
<p>Sample code:
<pre><code>
try (JobControllerClient jobControllerClient = JobControllerClient.create()) {
String projectId = "";
String region = "";
String jobId = "";
Job response = jobControllerClient.getJob(projectId, region, jobId);
}
</code></pre>
@param projectId Required. The ID of the Google Cloud Platform project that the job belongs to.
@param region Required. The Cloud Dataproc region in which to handle the request.
@param jobId Required. The job ID.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Gets",
"the",
"resource",
"representation",
"for",
"a",
"job",
"in",
"a",
"project",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java#L259-L268 |
cubedtear/aritzh | aritzh-core/src/main/java/io/github/aritzhack/aritzh/timing/Profiler.java | Profiler.getInstance | public static Profiler getInstance(String name, boolean verbose) {
if (Profiler.profilers.containsKey(name)) return Profiler.profilers.get(name);
else {
Profiler p = new Profiler(verbose);
Profiler.profilers.put(name, p);
return p;
}
} | java | public static Profiler getInstance(String name, boolean verbose) {
if (Profiler.profilers.containsKey(name)) return Profiler.profilers.get(name);
else {
Profiler p = new Profiler(verbose);
Profiler.profilers.put(name, p);
return p;
}
} | [
"public",
"static",
"Profiler",
"getInstance",
"(",
"String",
"name",
",",
"boolean",
"verbose",
")",
"{",
"if",
"(",
"Profiler",
".",
"profilers",
".",
"containsKey",
"(",
"name",
")",
")",
"return",
"Profiler",
".",
"profilers",
".",
"get",
"(",
"name",
... | Returns a specific instance of profiler, specifying verbosity
<br>
<p style="color: red">
NOTE: Verbosity is not guaranteed. since loggers are cached, if there was another
profiler with the specified name and it was not verbose, that instance will be
returned. To set the verbosity afterwards see {@link Profiler#setVerbose(boolean)}
</p>
@param name The name of the profiler
@param verbose Whether to print to {@link System#out} when ending a section
@return A profiler identified by the specified name. | [
"Returns",
"a",
"specific",
"instance",
"of",
"profiler",
"specifying",
"verbosity",
"<br",
">",
"<p",
"style",
"=",
"color",
":",
"red",
">",
"NOTE",
":",
"Verbosity",
"is",
"not",
"guaranteed",
".",
"since",
"loggers",
"are",
"cached",
"if",
"there",
"wa... | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/timing/Profiler.java#L87-L94 |
google/closure-compiler | src/com/google/javascript/jscomp/PolymerPassStaticUtils.java | PolymerPassStaticUtils.collectConstructorPropertyJsDoc | private static void collectConstructorPropertyJsDoc(Node node, Map<String, JSDocInfo> map) {
checkNotNull(node);
for (Node child : node.children()) {
if (child.isGetProp()
&& child.getFirstChild().isThis()
&& child.getSecondChild().isString()) {
// We found a "this.foo" expression. Map "foo" to its JSDoc.
map.put(child.getSecondChild().getString(), NodeUtil.getBestJSDocInfo(child));
} else {
// Recurse through every other kind of node, because properties are not necessarily declared
// at the top level of the constructor body; e.g. they could be declared as part of an
// assignment, or within an if statement. We're being overly loose here, e.g. we shouldn't
// traverse into a nested function where "this" doesn't refer to our prototype, but
// hopefully this is good enough for our purposes.
collectConstructorPropertyJsDoc(child, map);
}
}
} | java | private static void collectConstructorPropertyJsDoc(Node node, Map<String, JSDocInfo> map) {
checkNotNull(node);
for (Node child : node.children()) {
if (child.isGetProp()
&& child.getFirstChild().isThis()
&& child.getSecondChild().isString()) {
// We found a "this.foo" expression. Map "foo" to its JSDoc.
map.put(child.getSecondChild().getString(), NodeUtil.getBestJSDocInfo(child));
} else {
// Recurse through every other kind of node, because properties are not necessarily declared
// at the top level of the constructor body; e.g. they could be declared as part of an
// assignment, or within an if statement. We're being overly loose here, e.g. we shouldn't
// traverse into a nested function where "this" doesn't refer to our prototype, but
// hopefully this is good enough for our purposes.
collectConstructorPropertyJsDoc(child, map);
}
}
} | [
"private",
"static",
"void",
"collectConstructorPropertyJsDoc",
"(",
"Node",
"node",
",",
"Map",
"<",
"String",
",",
"JSDocInfo",
">",
"map",
")",
"{",
"checkNotNull",
"(",
"node",
")",
";",
"for",
"(",
"Node",
"child",
":",
"node",
".",
"children",
"(",
... | Find the properties that are initialized in the given constructor, and return a map from each
property name to its JSDoc.
@param node The constructor function node to traverse.
@param map The map from property name to JSDoc. | [
"Find",
"the",
"properties",
"that",
"are",
"initialized",
"in",
"the",
"given",
"constructor",
"and",
"return",
"a",
"map",
"from",
"each",
"property",
"name",
"to",
"its",
"JSDoc",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerPassStaticUtils.java#L184-L201 |
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.createOrUpdate | public CertificateInner createOrUpdate(String resourceGroupName, String name, CertificateInner certificateEnvelope) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, certificateEnvelope).toBlocking().single().body();
} | java | public CertificateInner createOrUpdate(String resourceGroupName, String name, CertificateInner certificateEnvelope) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, certificateEnvelope).toBlocking().single().body();
} | [
"public",
"CertificateInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"CertificateInner",
"certificateEnvelope",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"certificateE... | Create or update a certificate.
Create or update a certificate.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the certificate.
@param certificateEnvelope Details of certificate, if it exists already.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateInner object if successful. | [
"Create",
"or",
"update",
"a",
"certificate",
".",
"Create",
"or",
"update",
"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#L437-L439 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/HeapQuickSelectSketch.java | HeapQuickSelectSketch.setHashTableThreshold | static final int setHashTableThreshold(final int lgNomLongs, final int lgArrLongs) {
final double fraction = (lgArrLongs <= lgNomLongs) ? RESIZE_THRESHOLD : REBUILD_THRESHOLD;
return (int) Math.floor(fraction * (1 << lgArrLongs));
} | java | static final int setHashTableThreshold(final int lgNomLongs, final int lgArrLongs) {
final double fraction = (lgArrLongs <= lgNomLongs) ? RESIZE_THRESHOLD : REBUILD_THRESHOLD;
return (int) Math.floor(fraction * (1 << lgArrLongs));
} | [
"static",
"final",
"int",
"setHashTableThreshold",
"(",
"final",
"int",
"lgNomLongs",
",",
"final",
"int",
"lgArrLongs",
")",
"{",
"final",
"double",
"fraction",
"=",
"(",
"lgArrLongs",
"<=",
"lgNomLongs",
")",
"?",
"RESIZE_THRESHOLD",
":",
"REBUILD_THRESHOLD",
... | Returns the cardinality limit given the current size of the hash table array.
@param lgNomLongs <a href="{@docRoot}/resources/dictionary.html#lgNomLongs">See lgNomLongs</a>.
@param lgArrLongs <a href="{@docRoot}/resources/dictionary.html#lgArrLongs">See lgArrLongs</a>.
@return the hash table threshold | [
"Returns",
"the",
"cardinality",
"limit",
"given",
"the",
"current",
"size",
"of",
"the",
"hash",
"table",
"array",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapQuickSelectSketch.java#L298-L301 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/StringField.java | StringField.getSQLType | public String getSQLType(boolean bIncludeLength, Map<String, Object> properties)
{
String strType = (String)properties.get(DBSQLTypes.STRING);
if (strType == null)
strType = "VARCHAR"; // The default SQL Type
if (this.getMaxLength() < 127)
{
String strStart = (String)properties.get("LONGSTRINGSTART");
if (strStart != null)
{
int iStart = Integer.parseInt(strStart);
if (iStart < this.getMaxLength())
strType = (String)properties.get("LONGSTRING");
}
}
if (bIncludeLength)
strType += "(" + Integer.toString(this.getMaxLength()) + ")";
return strType;
} | java | public String getSQLType(boolean bIncludeLength, Map<String, Object> properties)
{
String strType = (String)properties.get(DBSQLTypes.STRING);
if (strType == null)
strType = "VARCHAR"; // The default SQL Type
if (this.getMaxLength() < 127)
{
String strStart = (String)properties.get("LONGSTRINGSTART");
if (strStart != null)
{
int iStart = Integer.parseInt(strStart);
if (iStart < this.getMaxLength())
strType = (String)properties.get("LONGSTRING");
}
}
if (bIncludeLength)
strType += "(" + Integer.toString(this.getMaxLength()) + ")";
return strType;
} | [
"public",
"String",
"getSQLType",
"(",
"boolean",
"bIncludeLength",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"strType",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"DBSQLTypes",
".",
"STRING",
")",
";",
... | Get the SQL type of this field.
Typically STRING, VARCHAR, or LONGSTRING if over 127 chars.
@param bIncludeLength Include the field length in this description.
@param properties Database properties to determine the SQL type. | [
"Get",
"the",
"SQL",
"type",
"of",
"this",
"field",
".",
"Typically",
"STRING",
"VARCHAR",
"or",
"LONGSTRING",
"if",
"over",
"127",
"chars",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/StringField.java#L101-L119 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jbatch.misc_fat/util/src/fat/util/JobWaiter.java | JobWaiter.waitForFinish | public JobExecution waitForFinish(long executionId) {
logger.fine("Entering waitForFinish for executionId = " + executionId);
JobExecution jobExecution = null;
long startTime = System.currentTimeMillis();
while (true) {
try {
logger.finer("Sleeping for " + POLL_INTERVAL);
long curTime = System.currentTimeMillis();
timeOutIfExpired(startTime, curTime);
Thread.sleep(POLL_INTERVAL);
logger.finer("Wake up, check for Finished.");
jobExecution = jobOp.getJobExecution(executionId);
if (isfinished(jobExecution)) {
break;
}
} catch (InterruptedException e) {
throw new RuntimeException("Aborting on interrupt", e);
}
}
return jobExecution;
} | java | public JobExecution waitForFinish(long executionId) {
logger.fine("Entering waitForFinish for executionId = " + executionId);
JobExecution jobExecution = null;
long startTime = System.currentTimeMillis();
while (true) {
try {
logger.finer("Sleeping for " + POLL_INTERVAL);
long curTime = System.currentTimeMillis();
timeOutIfExpired(startTime, curTime);
Thread.sleep(POLL_INTERVAL);
logger.finer("Wake up, check for Finished.");
jobExecution = jobOp.getJobExecution(executionId);
if (isfinished(jobExecution)) {
break;
}
} catch (InterruptedException e) {
throw new RuntimeException("Aborting on interrupt", e);
}
}
return jobExecution;
} | [
"public",
"JobExecution",
"waitForFinish",
"(",
"long",
"executionId",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Entering waitForFinish for executionId = \"",
"+",
"executionId",
")",
";",
"JobExecution",
"jobExecution",
"=",
"null",
";",
"long",
"startTime",
"=",
"S... | Wait for {@code JobWaiter#timeout} seconds for BOTH of:
1) BatchStatus to be one of: STOPPED ,FAILED , COMPLETED, ABANDONED
AND
2) exitStatus to be non-null
@return JobExecution | [
"Wait",
"for",
"{",
"@code",
"JobWaiter#timeout",
"}",
"seconds",
"for",
"BOTH",
"of",
":"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jbatch.misc_fat/util/src/fat/util/JobWaiter.java#L169-L191 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_GET | public net.minidev.ovh.api.dbaas.logs.OvhService serviceName_GET(String serviceName) throws IOException {
String qPath = "/dbaas/logs/{serviceName}";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.dbaas.logs.OvhService.class);
} | java | public net.minidev.ovh.api.dbaas.logs.OvhService serviceName_GET(String serviceName) throws IOException {
String qPath = "/dbaas/logs/{serviceName}";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.dbaas.logs.OvhService.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"dbaas",
".",
"logs",
".",
"OvhService",
"serviceName_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}\"",
";",
"StringBuilde... | Returns the service object of connected identity.
REST: GET /dbaas/logs/{serviceName}
@param serviceName [required] Service name | [
"Returns",
"the",
"service",
"object",
"of",
"connected",
"identity",
"."
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L996-L1001 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/source/workunit/Extract.java | Extract.addPrimaryKey | @Deprecated
public void addPrimaryKey(String... primaryKeyFieldName) {
StringBuilder sb = new StringBuilder(getProp(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY, ""));
Joiner.on(",").appendTo(sb, primaryKeyFieldName);
setProp(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY, sb.toString());
} | java | @Deprecated
public void addPrimaryKey(String... primaryKeyFieldName) {
StringBuilder sb = new StringBuilder(getProp(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY, ""));
Joiner.on(",").appendTo(sb, primaryKeyFieldName);
setProp(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY, sb.toString());
} | [
"@",
"Deprecated",
"public",
"void",
"addPrimaryKey",
"(",
"String",
"...",
"primaryKeyFieldName",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"getProp",
"(",
"ConfigurationKeys",
".",
"EXTRACT_PRIMARY_KEY_FIELDS_KEY",
",",
"\"\"",
")",
")",
... | Add more primary keys to the existing set of primary keys.
@param primaryKeyFieldName primary key names
@deprecated @deprecated It is recommended to add primary keys in {@code WorkUnit} instead of {@code Extract}. | [
"Add",
"more",
"primary",
"keys",
"to",
"the",
"existing",
"set",
"of",
"primary",
"keys",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/source/workunit/Extract.java#L247-L252 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java | AlgorithmId.get | public static AlgorithmId get(AlgorithmParameters algparams)
throws NoSuchAlgorithmException {
ObjectIdentifier oid;
String algname = algparams.getAlgorithm();
try {
oid = algOID(algname);
} catch (IOException ioe) {
throw new NoSuchAlgorithmException
("Invalid ObjectIdentifier " + algname);
}
if (oid == null) {
throw new NoSuchAlgorithmException
("unrecognized algorithm name: " + algname);
}
return new AlgorithmId(oid, algparams);
} | java | public static AlgorithmId get(AlgorithmParameters algparams)
throws NoSuchAlgorithmException {
ObjectIdentifier oid;
String algname = algparams.getAlgorithm();
try {
oid = algOID(algname);
} catch (IOException ioe) {
throw new NoSuchAlgorithmException
("Invalid ObjectIdentifier " + algname);
}
if (oid == null) {
throw new NoSuchAlgorithmException
("unrecognized algorithm name: " + algname);
}
return new AlgorithmId(oid, algparams);
} | [
"public",
"static",
"AlgorithmId",
"get",
"(",
"AlgorithmParameters",
"algparams",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"ObjectIdentifier",
"oid",
";",
"String",
"algname",
"=",
"algparams",
".",
"getAlgorithm",
"(",
")",
";",
"try",
"{",
"oid",
"=",
... | Returns one of the algorithm IDs most commonly associated
with this algorithm parameters.
@param algparams the associated algorithm parameters.
@exception NoSuchAlgorithmException on error. | [
"Returns",
"one",
"of",
"the",
"algorithm",
"IDs",
"most",
"commonly",
"associated",
"with",
"this",
"algorithm",
"parameters",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java#L438-L453 |
spring-projects/spring-social | spring-social-core/src/main/java/org/springframework/social/support/URIBuilder.java | URIBuilder.queryParam | public URIBuilder queryParam(String name, String value) {
parameters.add(name, value);
return this;
} | java | public URIBuilder queryParam(String name, String value) {
parameters.add(name, value);
return this;
} | [
"public",
"URIBuilder",
"queryParam",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"parameters",
".",
"add",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a query parameter to the URI
@param name the parameter name
@param value the parameter value
@return the URIBuilder | [
"Adds",
"a",
"query",
"parameter",
"to",
"the",
"URI"
] | train | https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-core/src/main/java/org/springframework/social/support/URIBuilder.java#L69-L72 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | HadoopUtils.sanitizePath | public static Path sanitizePath(Path path, String substitute) {
return new Path(sanitizePath(path.toString(), substitute));
} | java | public static Path sanitizePath(Path path, String substitute) {
return new Path(sanitizePath(path.toString(), substitute));
} | [
"public",
"static",
"Path",
"sanitizePath",
"(",
"Path",
"path",
",",
"String",
"substitute",
")",
"{",
"return",
"new",
"Path",
"(",
"sanitizePath",
"(",
"path",
".",
"toString",
"(",
")",
",",
"substitute",
")",
")",
";",
"}"
] | Remove illegal HDFS path characters from the given path. Illegal characters will be replaced
with the given substitute. | [
"Remove",
"illegal",
"HDFS",
"path",
"characters",
"from",
"the",
"given",
"path",
".",
"Illegal",
"characters",
"will",
"be",
"replaced",
"with",
"the",
"given",
"substitute",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L930-L932 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java | ManagementEnforcer.addNamedGroupingPolicy | public boolean addNamedGroupingPolicy(String ptype, List<String> params) {
boolean ruleAdded = addPolicy("g", ptype, params);
if (autoBuildRoleLinks) {
buildRoleLinks();
}
return ruleAdded;
} | java | public boolean addNamedGroupingPolicy(String ptype, List<String> params) {
boolean ruleAdded = addPolicy("g", ptype, params);
if (autoBuildRoleLinks) {
buildRoleLinks();
}
return ruleAdded;
} | [
"public",
"boolean",
"addNamedGroupingPolicy",
"(",
"String",
"ptype",
",",
"List",
"<",
"String",
">",
"params",
")",
"{",
"boolean",
"ruleAdded",
"=",
"addPolicy",
"(",
"\"g\"",
",",
"ptype",
",",
"params",
")",
";",
"if",
"(",
"autoBuildRoleLinks",
")",
... | addNamedGroupingPolicy adds a named role inheritance rule to the current policy.
If the rule already exists, the function returns false and the rule will not be added.
Otherwise the function returns true by adding the new rule.
@param ptype the policy type, can be "g", "g2", "g3", ..
@param params the "g" policy rule.
@return succeeds or not. | [
"addNamedGroupingPolicy",
"adds",
"a",
"named",
"role",
"inheritance",
"rule",
"to",
"the",
"current",
"policy",
".",
"If",
"the",
"rule",
"already",
"exists",
"the",
"function",
"returns",
"false",
"and",
"the",
"rule",
"will",
"not",
"be",
"added",
".",
"O... | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java#L448-L455 |
tango-controls/JTango | server/src/main/java/org/tango/server/events/EventTriggerFactory.java | EventTriggerFactory.createEventTrigger | public static IEventTrigger createEventTrigger(final EventType eventType, final AttributeImpl attribute)
throws DevFailed {
LOGGER.debug("create event trigger for attribute {} of type {}", attribute.getName(), eventType);
final EventProperties props = attribute.getProperties().getEventProp();
IEventTrigger eventTrigger;
switch (eventType) {
case PERIODIC_EVENT:
final long period = Long.parseLong(props.per_event.period);
eventTrigger = new PeriodicEventTrigger(period, attribute);
break;
case CHANGE_EVENT:
eventTrigger = new ChangeEventTrigger(attribute, props.ch_event.abs_change, props.ch_event.rel_change);
break;
case ARCHIVE_EVENT:
long periodA;
try {
// Check if specified and a number
periodA = Long.parseLong(props.arch_event.period);
} catch (final NumberFormatException e) {
periodA = -1;
}
eventTrigger = new ArchiveEventTrigger(periodA, props.arch_event.abs_change,
props.arch_event.rel_change, attribute);
break;
case ATT_CONF_EVENT:
case DATA_READY_EVENT:
case USER_EVENT:
case INTERFACE_CHANGE_EVENT:
case PIPE_EVENT:
default:
eventTrigger = new DefaultEventTrigger();
break;
}
return eventTrigger;
} | java | public static IEventTrigger createEventTrigger(final EventType eventType, final AttributeImpl attribute)
throws DevFailed {
LOGGER.debug("create event trigger for attribute {} of type {}", attribute.getName(), eventType);
final EventProperties props = attribute.getProperties().getEventProp();
IEventTrigger eventTrigger;
switch (eventType) {
case PERIODIC_EVENT:
final long period = Long.parseLong(props.per_event.period);
eventTrigger = new PeriodicEventTrigger(period, attribute);
break;
case CHANGE_EVENT:
eventTrigger = new ChangeEventTrigger(attribute, props.ch_event.abs_change, props.ch_event.rel_change);
break;
case ARCHIVE_EVENT:
long periodA;
try {
// Check if specified and a number
periodA = Long.parseLong(props.arch_event.period);
} catch (final NumberFormatException e) {
periodA = -1;
}
eventTrigger = new ArchiveEventTrigger(periodA, props.arch_event.abs_change,
props.arch_event.rel_change, attribute);
break;
case ATT_CONF_EVENT:
case DATA_READY_EVENT:
case USER_EVENT:
case INTERFACE_CHANGE_EVENT:
case PIPE_EVENT:
default:
eventTrigger = new DefaultEventTrigger();
break;
}
return eventTrigger;
} | [
"public",
"static",
"IEventTrigger",
"createEventTrigger",
"(",
"final",
"EventType",
"eventType",
",",
"final",
"AttributeImpl",
"attribute",
")",
"throws",
"DevFailed",
"{",
"LOGGER",
".",
"debug",
"(",
"\"create event trigger for attribute {} of type {}\"",
",",
"attri... | Create an {@link IEventTrigger}
@param eventType The event type
@param attribute The attribute that will send events
@return the created EventTrigger object
@throws DevFailed | [
"Create",
"an",
"{",
"@link",
"IEventTrigger",
"}"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/events/EventTriggerFactory.java#L51-L86 |
apache/groovy | subprojects/groovy-json/src/main/java/groovy/json/StringEscapeUtils.java | StringEscapeUtils.escapeJavaScript | public static void escapeJavaScript(Writer out, String str) throws IOException {
escapeJavaStyleString(out, str, true, true);
} | java | public static void escapeJavaScript(Writer out, String str) throws IOException {
escapeJavaStyleString(out, str, true, true);
} | [
"public",
"static",
"void",
"escapeJavaScript",
"(",
"Writer",
"out",
",",
"String",
"str",
")",
"throws",
"IOException",
"{",
"escapeJavaStyleString",
"(",
"out",
",",
"str",
",",
"true",
",",
"true",
")",
";",
"}"
] | Escapes the characters in a <code>String</code> using JavaScript String rules
to a <code>Writer</code>.
<p>
A <code>null</code> string input has no effect.
@see #escapeJavaScript(java.lang.String)
@param out Writer to write escaped string into
@param str String to escape values in, may be null
@throws IllegalArgumentException if the Writer is <code>null</code>
@throws IOException if error occurs on underlying Writer | [
"Escapes",
"the",
"characters",
"in",
"a",
"<code",
">",
"String<",
"/",
"code",
">",
"using",
"JavaScript",
"String",
"rules",
"to",
"a",
"<code",
">",
"Writer<",
"/",
"code",
">",
".",
"<p",
">",
"A",
"<code",
">",
"null<",
"/",
"code",
">",
"strin... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-json/src/main/java/groovy/json/StringEscapeUtils.java#L140-L142 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java | IndexUpdater.updateIndex | public static void updateIndex(String indexName,
List<FieldSort> fieldNames,
Database database,
SQLDatabaseQueue queue) throws QueryException {
IndexUpdater updater = new IndexUpdater(database, queue);
updater.updateIndex(indexName, fieldNames);
} | java | public static void updateIndex(String indexName,
List<FieldSort> fieldNames,
Database database,
SQLDatabaseQueue queue) throws QueryException {
IndexUpdater updater = new IndexUpdater(database, queue);
updater.updateIndex(indexName, fieldNames);
} | [
"public",
"static",
"void",
"updateIndex",
"(",
"String",
"indexName",
",",
"List",
"<",
"FieldSort",
">",
"fieldNames",
",",
"Database",
"database",
",",
"SQLDatabaseQueue",
"queue",
")",
"throws",
"QueryException",
"{",
"IndexUpdater",
"updater",
"=",
"new",
"... | Update a single index.
This index is assumed to already exist.
@param indexName Name of index to update
@param fieldNames List of field names in the sort format
@param database The local {@link Database}
@param queue The executor service queue
@return index update success status (true/false) | [
"Update",
"a",
"single",
"index",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java#L86-L93 |
RestComm/jain-slee.sip | examples/sip-wake-up/sbb/src/main/java/org/mobicents/slee/examples/wakeup/WakeUpSbb.java | WakeUpSbb.onTimerEvent | public void onTimerEvent(TimerEvent event, ActivityContextInterface aci) {
// detaching so the null AC is claimed after the event handling
aci.detach(sbbContext.getSbbLocalObject());
try {
DataSourceChildSbbLocalInterface child = (DataSourceChildSbbLocalInterface) getLocationChildRelation().create();
child.getBindings(getSender().getURI().toString());
} catch (Exception e) {
tracer.severe("failed to create sip registrar child sbb, to lookup the sender's contacts",e);
return;
}
} | java | public void onTimerEvent(TimerEvent event, ActivityContextInterface aci) {
// detaching so the null AC is claimed after the event handling
aci.detach(sbbContext.getSbbLocalObject());
try {
DataSourceChildSbbLocalInterface child = (DataSourceChildSbbLocalInterface) getLocationChildRelation().create();
child.getBindings(getSender().getURI().toString());
} catch (Exception e) {
tracer.severe("failed to create sip registrar child sbb, to lookup the sender's contacts",e);
return;
}
} | [
"public",
"void",
"onTimerEvent",
"(",
"TimerEvent",
"event",
",",
"ActivityContextInterface",
"aci",
")",
"{",
"// detaching so the null AC is claimed after the event handling",
"aci",
".",
"detach",
"(",
"sbbContext",
".",
"getSbbLocalObject",
"(",
")",
")",
";",
"try... | Event handler from the timer event, which signals that a message must be
sent back to the UA
@param event
@param aci | [
"Event",
"handler",
"from",
"the",
"timer",
"event",
"which",
"signals",
"that",
"a",
"message",
"must",
"be",
"sent",
"back",
"to",
"the",
"UA"
] | train | https://github.com/RestComm/jain-slee.sip/blob/2c173af0a760cb0ea13fe0ffa58c0f82b14731f9/examples/sip-wake-up/sbb/src/main/java/org/mobicents/slee/examples/wakeup/WakeUpSbb.java#L310-L320 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/DeepSubtypeAnalysis.java | DeepSubtypeAnalysis.deepInstanceOf | public static double deepInstanceOf(@DottedClassName String x, @DottedClassName String y) throws ClassNotFoundException {
return Analyze.deepInstanceOf(x, y);
} | java | public static double deepInstanceOf(@DottedClassName String x, @DottedClassName String y) throws ClassNotFoundException {
return Analyze.deepInstanceOf(x, y);
} | [
"public",
"static",
"double",
"deepInstanceOf",
"(",
"@",
"DottedClassName",
"String",
"x",
",",
"@",
"DottedClassName",
"String",
"y",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"Analyze",
".",
"deepInstanceOf",
"(",
"x",
",",
"y",
")",
";",
"}"
... | Given two JavaClasses, try to estimate the probability that an reference
of type x is also an instance of type y. Will return 0 only if it is
impossible and 1 only if it is guaranteed.
@param x
Known type of object
@param y
Type queried about
@return 0 - 1 value indicating probability | [
"Given",
"two",
"JavaClasses",
"try",
"to",
"estimate",
"the",
"probability",
"that",
"an",
"reference",
"of",
"type",
"x",
"is",
"also",
"an",
"instance",
"of",
"type",
"y",
".",
"Will",
"return",
"0",
"only",
"if",
"it",
"is",
"impossible",
"and",
"1",... | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/DeepSubtypeAnalysis.java#L290-L292 |
fernandospr/javapns-jdk16 | src/main/java/javapns/devices/implementations/basic/BasicDeviceFactory.java | BasicDeviceFactory.addDevice | public Device addDevice(String id, String token) throws DuplicateDeviceException, NullIdException, NullDeviceTokenException, Exception {
if ((id == null) || (id.trim().equals(""))) {
throw new NullIdException();
} else if ((token == null) || (token.trim().equals(""))) {
throw new NullDeviceTokenException();
} else {
if (!this.devices.containsKey(id)) {
token = token.trim().replace(" ", "");
BasicDevice device = new BasicDevice(id, token, new Timestamp(Calendar.getInstance().getTime().getTime()));
this.devices.put(id, device);
return device;
} else {
throw new DuplicateDeviceException();
}
}
} | java | public Device addDevice(String id, String token) throws DuplicateDeviceException, NullIdException, NullDeviceTokenException, Exception {
if ((id == null) || (id.trim().equals(""))) {
throw new NullIdException();
} else if ((token == null) || (token.trim().equals(""))) {
throw new NullDeviceTokenException();
} else {
if (!this.devices.containsKey(id)) {
token = token.trim().replace(" ", "");
BasicDevice device = new BasicDevice(id, token, new Timestamp(Calendar.getInstance().getTime().getTime()));
this.devices.put(id, device);
return device;
} else {
throw new DuplicateDeviceException();
}
}
} | [
"public",
"Device",
"addDevice",
"(",
"String",
"id",
",",
"String",
"token",
")",
"throws",
"DuplicateDeviceException",
",",
"NullIdException",
",",
"NullDeviceTokenException",
",",
"Exception",
"{",
"if",
"(",
"(",
"id",
"==",
"null",
")",
"||",
"(",
"id",
... | Add a device to the map
@param id The device id
@param token The device token
@throws DuplicateDeviceException
@throws NullIdException
@throws NullDeviceTokenException | [
"Add",
"a",
"device",
"to",
"the",
"map"
] | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/devices/implementations/basic/BasicDeviceFactory.java#L47-L62 |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/LocalCall.java | LocalCall.callAsync | public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(final SaltClient client, Target<?> target,
AuthMethod auth) {
return callAsync(client, target, auth, Optional.empty());
} | java | public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(final SaltClient client, Target<?> target,
AuthMethod auth) {
return callAsync(client, target, auth, Optional.empty());
} | [
"public",
"CompletionStage",
"<",
"Optional",
"<",
"LocalAsyncResult",
"<",
"R",
">",
">",
">",
"callAsync",
"(",
"final",
"SaltClient",
"client",
",",
"Target",
"<",
"?",
">",
"target",
",",
"AuthMethod",
"auth",
")",
"{",
"return",
"callAsync",
"(",
"cli... | Calls a execution module function on the given target asynchronously and
returns information about the scheduled job that can be used to query the result.
Authentication is done with the token therefore you have to login prior
to using this function.
@param client SaltClient instance
@param target the target for the function
@param auth authentication credentials to use
@return information about the scheduled job | [
"Calls",
"a",
"execution",
"module",
"function",
"on",
"the",
"given",
"target",
"asynchronously",
"and",
"returns",
"information",
"about",
"the",
"scheduled",
"job",
"that",
"can",
"be",
"used",
"to",
"query",
"the",
"result",
".",
"Authentication",
"is",
"d... | train | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L176-L179 |
google/closure-templates | java/src/com/google/template/soy/SoyFileSet.java | SoyFileSet.compileTemplates | public SoySauce compileTemplates(Map<String, Supplier<Object>> pluginInstances) {
resetErrorReporter();
disallowExternalCalls();
ServerCompilationPrimitives primitives = compileForServerRendering();
throwIfErrorsPresent();
SoySauce sauce = doCompileSoySauce(primitives, pluginInstances);
reportWarnings();
return sauce;
} | java | public SoySauce compileTemplates(Map<String, Supplier<Object>> pluginInstances) {
resetErrorReporter();
disallowExternalCalls();
ServerCompilationPrimitives primitives = compileForServerRendering();
throwIfErrorsPresent();
SoySauce sauce = doCompileSoySauce(primitives, pluginInstances);
reportWarnings();
return sauce;
} | [
"public",
"SoySauce",
"compileTemplates",
"(",
"Map",
"<",
"String",
",",
"Supplier",
"<",
"Object",
">",
">",
"pluginInstances",
")",
"{",
"resetErrorReporter",
"(",
")",
";",
"disallowExternalCalls",
"(",
")",
";",
"ServerCompilationPrimitives",
"primitives",
"=... | Compiles this Soy file set into a set of java classes implementing the {@link SoySauce}
interface.
<p>This is useful for implementing 'edit refresh' workflows. Most production usecases should
use the command line interface to 'ahead of time' compile templates to jar files and then use
{@code PrecompiledSoyModule} or {@code SoySauceBuilder} to get access to a {@link SoySauce}
object without invoking the compiler. This will allow applications to avoid invoking the soy
compiler at runtime which can be relatively slow.
@return A set of compiled templates
@throws SoyCompilationException If compilation fails. | [
"Compiles",
"this",
"Soy",
"file",
"set",
"into",
"a",
"set",
"of",
"java",
"classes",
"implementing",
"the",
"{",
"@link",
"SoySauce",
"}",
"interface",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/SoyFileSet.java#L789-L798 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3d.java | Sphere3d.setCenterProperties | public void setCenterProperties(DoubleProperty x, DoubleProperty y, DoubleProperty z) {
this.cxProperty = x;
this.cyProperty = y;
this.czProperty = z;
} | java | public void setCenterProperties(DoubleProperty x, DoubleProperty y, DoubleProperty z) {
this.cxProperty = x;
this.cyProperty = y;
this.czProperty = z;
} | [
"public",
"void",
"setCenterProperties",
"(",
"DoubleProperty",
"x",
",",
"DoubleProperty",
"y",
",",
"DoubleProperty",
"z",
")",
"{",
"this",
".",
"cxProperty",
"=",
"x",
";",
"this",
".",
"cyProperty",
"=",
"y",
";",
"this",
".",
"czProperty",
"=",
"z",
... | Set the center properties with the properties in parameter.
@param x
@param y
@param z | [
"Set",
"the",
"center",
"properties",
"with",
"the",
"properties",
"in",
"parameter",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3d.java#L238-L242 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.encodeQuery | public static String encodeQuery(String url, Charset charset) {
if (StrUtil.isEmpty(url)) {
return url;
}
if (null == charset) {
charset = CharsetUtil.defaultCharset();
}
return URLEncoder.QUERY.encode(url, charset);
} | java | public static String encodeQuery(String url, Charset charset) {
if (StrUtil.isEmpty(url)) {
return url;
}
if (null == charset) {
charset = CharsetUtil.defaultCharset();
}
return URLEncoder.QUERY.encode(url, charset);
} | [
"public",
"static",
"String",
"encodeQuery",
"(",
"String",
"url",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"url",
")",
")",
"{",
"return",
"url",
";",
"}",
"if",
"(",
"null",
"==",
"charset",
")",
"{",
"charset... | 编码字符为URL中查询语句<br>
将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。<br>
此方法用于POST请求中的请求体自动编码,转义大部分特殊字符
@param url 被编码内容
@param charset 编码
@return 编码后的字符
@since 4.4.1 | [
"编码字符为URL中查询语句<br",
">",
"将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。<br",
">",
"此方法用于POST请求中的请求体自动编码,转义大部分特殊字符"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L295-L303 |
Hygieia/Hygieia | api/src/main/java/com/capitalone/dashboard/service/DashboardRemoteServiceImpl.java | DashboardRemoteServiceImpl.requestToDashboard | private Dashboard requestToDashboard(DashboardRemoteRequest request) throws HygieiaException {
DashboardRemoteRequest.DashboardMetaData metaData = request.getMetaData();
Application application = new Application(metaData.getApplicationName(), new Component(metaData.getComponentName()));
String appName = null;
String serviceName = null;
if (!StringUtils.isEmpty(metaData.getBusinessApplication())) {
Cmdb app = cmdbRepository.findByConfigurationItemAndItemType(metaData.getBusinessApplication(), "component");
if (app == null) throw new HygieiaException("Invalid Business Application Name.", HygieiaException.BAD_DATA);
appName = app.getConfigurationItem();
}
if (!StringUtils.isEmpty(metaData.getBusinessService())) {
Cmdb service = cmdbRepository.findByConfigurationItemAndItemType(metaData.getBusinessService(), "app");
if (service == null) throw new HygieiaException("Invalid Business Service Name.", HygieiaException.BAD_DATA);
serviceName = service.getConfigurationItem();
}
List<String> activeWidgets = new ArrayList<>();
return new Dashboard(true, metaData.getTemplate(), metaData.getTitle(), application, metaData.getOwners(), DashboardType.fromString(metaData.getType()), serviceName, appName,activeWidgets, false, ScoreDisplayType.HEADER);
} | java | private Dashboard requestToDashboard(DashboardRemoteRequest request) throws HygieiaException {
DashboardRemoteRequest.DashboardMetaData metaData = request.getMetaData();
Application application = new Application(metaData.getApplicationName(), new Component(metaData.getComponentName()));
String appName = null;
String serviceName = null;
if (!StringUtils.isEmpty(metaData.getBusinessApplication())) {
Cmdb app = cmdbRepository.findByConfigurationItemAndItemType(metaData.getBusinessApplication(), "component");
if (app == null) throw new HygieiaException("Invalid Business Application Name.", HygieiaException.BAD_DATA);
appName = app.getConfigurationItem();
}
if (!StringUtils.isEmpty(metaData.getBusinessService())) {
Cmdb service = cmdbRepository.findByConfigurationItemAndItemType(metaData.getBusinessService(), "app");
if (service == null) throw new HygieiaException("Invalid Business Service Name.", HygieiaException.BAD_DATA);
serviceName = service.getConfigurationItem();
}
List<String> activeWidgets = new ArrayList<>();
return new Dashboard(true, metaData.getTemplate(), metaData.getTitle(), application, metaData.getOwners(), DashboardType.fromString(metaData.getType()), serviceName, appName,activeWidgets, false, ScoreDisplayType.HEADER);
} | [
"private",
"Dashboard",
"requestToDashboard",
"(",
"DashboardRemoteRequest",
"request",
")",
"throws",
"HygieiaException",
"{",
"DashboardRemoteRequest",
".",
"DashboardMetaData",
"metaData",
"=",
"request",
".",
"getMetaData",
"(",
")",
";",
"Application",
"application",... | Creates a Dashboard object from the request.
@param request
@return Dashboard
@throws HygieiaException | [
"Creates",
"a",
"Dashboard",
"object",
"from",
"the",
"request",
"."
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api/src/main/java/com/capitalone/dashboard/service/DashboardRemoteServiceImpl.java#L257-L274 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java | AgentSession.sendRoomInvitation | public void sendRoomInvitation(RoomInvitation.Type type, Jid invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final RoomInvitation invitation = new RoomInvitation(type, invitee, sessionID, reason);
IQ iq = new RoomInvitation.RoomInvitationIQ(invitation);
iq.setType(IQ.Type.set);
iq.setTo(workgroupJID);
iq.setFrom(connection.getUser());
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
} | java | public void sendRoomInvitation(RoomInvitation.Type type, Jid invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final RoomInvitation invitation = new RoomInvitation(type, invitee, sessionID, reason);
IQ iq = new RoomInvitation.RoomInvitationIQ(invitation);
iq.setType(IQ.Type.set);
iq.setTo(workgroupJID);
iq.setFrom(connection.getUser());
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
} | [
"public",
"void",
"sendRoomInvitation",
"(",
"RoomInvitation",
".",
"Type",
"type",
",",
"Jid",
"invitee",
",",
"String",
"sessionID",
",",
"String",
"reason",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"Inter... | Invites a user or agent to an existing session support. The provided invitee's JID can be of
a user, an agent, a queue or a workgroup. In the case of a queue or a workgroup the workgroup service
will decide the best agent to receive the invitation.<p>
This method will return either when the service returned an ACK of the request or if an error occurred
while requesting the invitation. After sending the ACK the service will send the invitation to the target
entity. When dealing with agents the common sequence of offer-response will be followed. However, when
sending an invitation to a user a standard MUC invitation will be sent.<p>
The agent or user that accepted the offer <b>MUST</b> join the room. Failing to do so will make
the invitation to fail. The inviter will eventually receive a message error indicating that the invitee
accepted the offer but failed to join the room.
Different situations may lead to a failed invitation. Possible cases are: 1) all agents rejected the
offer and there are no agents available, 2) the agent that accepted the offer failed to join the room or
2) the user that received the MUC invitation never replied or joined the room. In any of these cases
(or other failing cases) the inviter will get an error message with the failed notification.
@param type type of entity that will get the invitation.
@param invitee JID of entity that will get the invitation.
@param sessionID ID of the support session that the invitee is being invited.
@param reason the reason of the invitation.
@throws XMPPErrorException if the sender of the invitation is not an agent or the service failed to process
the request.
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Invites",
"a",
"user",
"or",
"agent",
"to",
"an",
"existing",
"session",
"support",
".",
"The",
"provided",
"invitee",
"s",
"JID",
"can",
"be",
"of",
"a",
"user",
"an",
"agent",
"a",
"queue",
"or",
"a",
"workgroup",
".",
"In",
"the",
"case",
"of",
"... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L1020-L1028 |
davidmoten/geo | geo-mem/src/main/java/com/github/davidmoten/geo/mem/Geomem.java | Geomem.createRegionFilter | @VisibleForTesting
Predicate<Info<T, R>> createRegionFilter(final double topLeftLat, final double topLeftLon,
final double bottomRightLat, final double bottomRightLon) {
return new Predicate<Info<T, R>>() {
@Override
public boolean apply(Info<T, R> info) {
return info.lat() >= bottomRightLat && info.lat() < topLeftLat
&& info.lon() > topLeftLon && info.lon() <= bottomRightLon;
}
};
} | java | @VisibleForTesting
Predicate<Info<T, R>> createRegionFilter(final double topLeftLat, final double topLeftLon,
final double bottomRightLat, final double bottomRightLon) {
return new Predicate<Info<T, R>>() {
@Override
public boolean apply(Info<T, R> info) {
return info.lat() >= bottomRightLat && info.lat() < topLeftLat
&& info.lon() > topLeftLon && info.lon() <= bottomRightLon;
}
};
} | [
"@",
"VisibleForTesting",
"Predicate",
"<",
"Info",
"<",
"T",
",",
"R",
">",
">",
"createRegionFilter",
"(",
"final",
"double",
"topLeftLat",
",",
"final",
"double",
"topLeftLon",
",",
"final",
"double",
"bottomRightLat",
",",
"final",
"double",
"bottomRightLon"... | Returns a {@link Predicate} that returns true if and only if a point is
within the bounding box, exclusive of the top (north) and left (west)
edges.
@param topLeftLat
latitude of top left point (north west)
@param topLeftLon
longitude of top left point (north west)
@param bottomRightLat
latitude of bottom right point (south east)
@param bottomRightLon
longitude of bottom right point (south east)
@return predicate | [
"Returns",
"a",
"{",
"@link",
"Predicate",
"}",
"that",
"returns",
"true",
"if",
"and",
"only",
"if",
"a",
"point",
"is",
"within",
"the",
"bounding",
"box",
"exclusive",
"of",
"the",
"top",
"(",
"north",
")",
"and",
"left",
"(",
"west",
")",
"edges",
... | train | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo-mem/src/main/java/com/github/davidmoten/geo/mem/Geomem.java#L119-L130 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java | ActionInterceptor.preInvoke | public void preInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
{
preAction( ( ActionInterceptorContext ) context, chain );
} | java | public void preInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
{
preAction( ( ActionInterceptorContext ) context, chain );
} | [
"public",
"void",
"preInvoke",
"(",
"InterceptorContext",
"context",
",",
"InterceptorChain",
"chain",
")",
"throws",
"InterceptorException",
"{",
"preAction",
"(",
"(",
"ActionInterceptorContext",
")",
"context",
",",
"chain",
")",
";",
"}"
] | Callback invoked before the action is processed. {@link #preAction} may be used instead. | [
"Callback",
"invoked",
"before",
"the",
"action",
"is",
"processed",
".",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java#L92-L95 |
aoindustries/semanticcms-core-model | src/main/java/com/semanticcms/core/model/PageRef.java | PageRef.setPath | public PageRef setPath(Path newPath) {
if(newPath.equals(path)) {
return this;
} else {
return new PageRef(bookRef, newPath);
}
} | java | public PageRef setPath(Path newPath) {
if(newPath.equals(path)) {
return this;
} else {
return new PageRef(bookRef, newPath);
}
} | [
"public",
"PageRef",
"setPath",
"(",
"Path",
"newPath",
")",
"{",
"if",
"(",
"newPath",
".",
"equals",
"(",
"path",
")",
")",
"{",
"return",
"this",
";",
"}",
"else",
"{",
"return",
"new",
"PageRef",
"(",
"bookRef",
",",
"newPath",
")",
";",
"}",
"... | Sets the path.
@return this object if path unchanged or a new object representing the new path | [
"Sets",
"the",
"path",
"."
] | train | https://github.com/aoindustries/semanticcms-core-model/blob/14bdbe3f3d69b2b337129c5b1afcaa9e87cb5624/src/main/java/com/semanticcms/core/model/PageRef.java#L79-L85 |
craftercms/commons | utilities/src/main/java/org/craftercms/commons/zip/ZipUtils.java | ZipUtils.unZipFiles | public static void unZipFiles(InputStream inputStream, File outputFolder) throws IOException {
ZipInputStream zis = new ZipInputStream(inputStream);
ZipEntry ze = zis.getNextEntry();
while (ze != null) {
File file = new File(outputFolder, ze.getName());
OutputStream os = new BufferedOutputStream(FileUtils.openOutputStream(file));
try {
IOUtils.copy(zis, os);
} finally {
IOUtils.closeQuietly(os);
}
zis.closeEntry();
ze = zis.getNextEntry();
}
} | java | public static void unZipFiles(InputStream inputStream, File outputFolder) throws IOException {
ZipInputStream zis = new ZipInputStream(inputStream);
ZipEntry ze = zis.getNextEntry();
while (ze != null) {
File file = new File(outputFolder, ze.getName());
OutputStream os = new BufferedOutputStream(FileUtils.openOutputStream(file));
try {
IOUtils.copy(zis, os);
} finally {
IOUtils.closeQuietly(os);
}
zis.closeEntry();
ze = zis.getNextEntry();
}
} | [
"public",
"static",
"void",
"unZipFiles",
"(",
"InputStream",
"inputStream",
",",
"File",
"outputFolder",
")",
"throws",
"IOException",
"{",
"ZipInputStream",
"zis",
"=",
"new",
"ZipInputStream",
"(",
"inputStream",
")",
";",
"ZipEntry",
"ze",
"=",
"zis",
".",
... | Unzips a zip from an input stream into an output folder.
@param inputStream the zip input stream
@param outputFolder the output folder where the files
@throws IOException | [
"Unzips",
"a",
"zip",
"from",
"an",
"input",
"stream",
"into",
"an",
"output",
"folder",
"."
] | train | https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/zip/ZipUtils.java#L91-L108 |
Jasig/uPortal | uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/localization/UserLocaleHelper.java | UserLocaleHelper.getLocales | public List<LocaleBean> getLocales(Locale currentLocale) {
List<LocaleBean> locales = new ArrayList<>();
// get the array of locales available from the portal
List<Locale> portalLocales = localeManagerFactory.getPortalLocales();
for (Locale locale : portalLocales) {
if (currentLocale != null) {
// if a current locale is available, display language names
// using the current locale
locales.add(new LocaleBean(locale, currentLocale));
} else {
locales.add(new LocaleBean(locale));
}
}
return locales;
} | java | public List<LocaleBean> getLocales(Locale currentLocale) {
List<LocaleBean> locales = new ArrayList<>();
// get the array of locales available from the portal
List<Locale> portalLocales = localeManagerFactory.getPortalLocales();
for (Locale locale : portalLocales) {
if (currentLocale != null) {
// if a current locale is available, display language names
// using the current locale
locales.add(new LocaleBean(locale, currentLocale));
} else {
locales.add(new LocaleBean(locale));
}
}
return locales;
} | [
"public",
"List",
"<",
"LocaleBean",
">",
"getLocales",
"(",
"Locale",
"currentLocale",
")",
"{",
"List",
"<",
"LocaleBean",
">",
"locales",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// get the array of locales available from the portal",
"List",
"<",
"Locale... | Return a list of LocaleBeans matching the currently available locales for the portal.
@param currentLocale
@return | [
"Return",
"a",
"list",
"of",
"LocaleBeans",
"matching",
"the",
"currently",
"available",
"locales",
"for",
"the",
"portal",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/localization/UserLocaleHelper.java#L77-L92 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/feature/associate/FactoryAssociation.java | FactoryAssociation.kdRandomForest | public static AssociateDescription<TupleDesc_F64> kdRandomForest( ConfigAssociateNearestNeighbor configNN ,
int dimension,
int maxNodesSearched ,
int numTrees ,
int numConsiderSplit ,
long randomSeed) {
NearestNeighbor nn = FactoryNearestNeighbor.kdRandomForest(
new KdTreeTuple_F64(dimension),
maxNodesSearched,numTrees,numConsiderSplit,randomSeed);
return associateNearestNeighbor(configNN,nn);
} | java | public static AssociateDescription<TupleDesc_F64> kdRandomForest( ConfigAssociateNearestNeighbor configNN ,
int dimension,
int maxNodesSearched ,
int numTrees ,
int numConsiderSplit ,
long randomSeed) {
NearestNeighbor nn = FactoryNearestNeighbor.kdRandomForest(
new KdTreeTuple_F64(dimension),
maxNodesSearched,numTrees,numConsiderSplit,randomSeed);
return associateNearestNeighbor(configNN,nn);
} | [
"public",
"static",
"AssociateDescription",
"<",
"TupleDesc_F64",
">",
"kdRandomForest",
"(",
"ConfigAssociateNearestNeighbor",
"configNN",
",",
"int",
"dimension",
",",
"int",
"maxNodesSearched",
",",
"int",
"numTrees",
",",
"int",
"numConsiderSplit",
",",
"long",
"r... | Approximate association using multiple random K-D trees (random forest) for descriptors with a high degree of
freedom, e.g. > 20
@see AssociateNearestNeighbor_ST
@see org.ddogleg.nn.wrap.KdForestBbfSearch
@param dimension Number of elements in the feature vector
@param maxNodesSearched Maximum number of nodes it will search. Controls speed and accuracy.
@param numTrees Number of trees that are considered. Try 10 and tune.
@param numConsiderSplit Number of nodes that are considered when generating a tree. Must be less than the
point's dimension. Try 5
@param randomSeed Seed used by random number generator
@return Association using approximate nearest neighbor | [
"Approximate",
"association",
"using",
"multiple",
"random",
"K",
"-",
"D",
"trees",
"(",
"random",
"forest",
")",
"for",
"descriptors",
"with",
"a",
"high",
"degree",
"of",
"freedom",
"e",
".",
"g",
".",
">",
";",
"20"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/associate/FactoryAssociation.java#L101-L112 |
apiman/apiman | gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/GatewayServlet.java | GatewayServlet.writeError | protected void writeError(final ApiRequest request, final HttpServletResponse resp, final Throwable error) {
getErrorWriter().write(request, error, new IApiClientResponse() {
@Override
public void write(StringBuffer buffer) {
write(buffer.toString());
}
@Override
public void write(StringBuilder builder) {
write(builder.toString());
}
@Override
public void write(String body) {
try {
resp.getOutputStream().write(body.getBytes("UTF-8")); //$NON-NLS-1$
resp.getOutputStream().flush();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* @see io.apiman.gateway.engine.IApiClientResponse#setStatusCode(int)
*/
@Override
public void setStatusCode(int code) {
resp.setStatus(code);
}
@Override
public void setHeader(String headerName, String headerValue) {
resp.setHeader(headerName, headerValue);
}
});
} | java | protected void writeError(final ApiRequest request, final HttpServletResponse resp, final Throwable error) {
getErrorWriter().write(request, error, new IApiClientResponse() {
@Override
public void write(StringBuffer buffer) {
write(buffer.toString());
}
@Override
public void write(StringBuilder builder) {
write(builder.toString());
}
@Override
public void write(String body) {
try {
resp.getOutputStream().write(body.getBytes("UTF-8")); //$NON-NLS-1$
resp.getOutputStream().flush();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* @see io.apiman.gateway.engine.IApiClientResponse#setStatusCode(int)
*/
@Override
public void setStatusCode(int code) {
resp.setStatus(code);
}
@Override
public void setHeader(String headerName, String headerValue) {
resp.setHeader(headerName, headerValue);
}
});
} | [
"protected",
"void",
"writeError",
"(",
"final",
"ApiRequest",
"request",
",",
"final",
"HttpServletResponse",
"resp",
",",
"final",
"Throwable",
"error",
")",
"{",
"getErrorWriter",
"(",
")",
".",
"write",
"(",
"request",
",",
"error",
",",
"new",
"IApiClient... | Writes an error to the servlet response object.
@param request
@param resp
@param error | [
"Writes",
"an",
"error",
"to",
"the",
"servlet",
"response",
"object",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/GatewayServlet.java#L349-L384 |
sarxos/webcam-capture | webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamMotionDetectorDefaultAlgorithm.java | WebcamMotionDetectorDefaultAlgorithm.isInDoNotEngageZone | private boolean isInDoNotEngageZone(final int x, final int y) {
for (final Rectangle zone : doNotEnganeZones) {
if (zone.contains(x, y)) {
return true;
}
}
return false;
} | java | private boolean isInDoNotEngageZone(final int x, final int y) {
for (final Rectangle zone : doNotEnganeZones) {
if (zone.contains(x, y)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"isInDoNotEngageZone",
"(",
"final",
"int",
"x",
",",
"final",
"int",
"y",
")",
"{",
"for",
"(",
"final",
"Rectangle",
"zone",
":",
"doNotEnganeZones",
")",
"{",
"if",
"(",
"zone",
".",
"contains",
"(",
"x",
",",
"y",
")",
")",
... | Return true if point identified by x and y coordinates is in one of the do-not-engage zones.
Return false otherwise.
@param x the x coordinate of a point
@param y the y coordinate of a point
@return True if point is in one of do-not-engage zones, false otherwise | [
"Return",
"true",
"if",
"point",
"identified",
"by",
"x",
"and",
"y",
"coordinates",
"is",
"in",
"one",
"of",
"the",
"do",
"-",
"not",
"-",
"engage",
"zones",
".",
"Return",
"false",
"otherwise",
"."
] | train | https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamMotionDetectorDefaultAlgorithm.java#L182-L189 |
fernandospr/javapns-jdk16 | src/main/java/javapns/Push.java | Push.payloads | public static PushedNotifications payloads(Object keystore, String password, boolean production, int numberOfThreads, Object payloadDevicePairs) throws Exception {
if (numberOfThreads <= 0) return sendPayloads(keystore, password, production, payloadDevicePairs);
AppleNotificationServer server = new AppleNotificationServerBasicImpl(keystore, password, production);
List<PayloadPerDevice> payloadPerDevicePairs = Devices.asPayloadsPerDevices(payloadDevicePairs);
NotificationThreads threads = new NotificationThreads(server, payloadPerDevicePairs, numberOfThreads);
threads.start();
try {
threads.waitForAllThreads(true);
} catch (InterruptedException e) {
}
return threads.getPushedNotifications();
} | java | public static PushedNotifications payloads(Object keystore, String password, boolean production, int numberOfThreads, Object payloadDevicePairs) throws Exception {
if (numberOfThreads <= 0) return sendPayloads(keystore, password, production, payloadDevicePairs);
AppleNotificationServer server = new AppleNotificationServerBasicImpl(keystore, password, production);
List<PayloadPerDevice> payloadPerDevicePairs = Devices.asPayloadsPerDevices(payloadDevicePairs);
NotificationThreads threads = new NotificationThreads(server, payloadPerDevicePairs, numberOfThreads);
threads.start();
try {
threads.waitForAllThreads(true);
} catch (InterruptedException e) {
}
return threads.getPushedNotifications();
} | [
"public",
"static",
"PushedNotifications",
"payloads",
"(",
"Object",
"keystore",
",",
"String",
"password",
",",
"boolean",
"production",
",",
"int",
"numberOfThreads",
",",
"Object",
"payloadDevicePairs",
")",
"throws",
"Exception",
"{",
"if",
"(",
"numberOfThread... | Push a different preformatted payload for each device using multiple simulatenous threads (and connections).
@param keystore a keystore containing your private key and the certificate signed by Apple ({@link java.io.File}, {@link java.io.InputStream}, byte[], {@link java.security.KeyStore} or {@link java.lang.String} for a file path)
@param password the keystore's password.
@param production true to use Apple's production servers, false to use the sandbox servers.
@param numberOfThreads the number of parallel threads to use to push the notifications
@param payloadDevicePairs a list or an array of PayloadPerDevice: {@link java.util.List}<{@link javapns.notification.PayloadPerDevice}>, {@link javapns.notification.PayloadPerDevice PayloadPerDevice[]} or {@link javapns.notification.PayloadPerDevice}
@return a list of pushed notifications, each with details on transmission results and error (if any)
@throws Exception thrown if any critical exception occurs | [
"Push",
"a",
"different",
"preformatted",
"payload",
"for",
"each",
"device",
"using",
"multiple",
"simulatenous",
"threads",
"(",
"and",
"connections",
")",
"."
] | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/Push.java#L266-L277 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATConsumer.java | CATConsumer.readSet | public void readSet(int requestNumber, SIMessageHandle[] msgHandles)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "readSet",
new Object[]{requestNumber, msgHandles});
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("PROTOCOL_ERROR_SICO2003", null,null)
);
FFDCFilter.processException(e, CLASS_NAME + ".readSet",
CommsConstants.CATCONSUMER_READSET_01,
this);
SibTr.error(tc, "PROTOCOL_ERROR_SICO2003", e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "readSet");
// Re-throw this exception so that the client will informed if required
throw e;
} | java | public void readSet(int requestNumber, SIMessageHandle[] msgHandles)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "readSet",
new Object[]{requestNumber, msgHandles});
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("PROTOCOL_ERROR_SICO2003", null,null)
);
FFDCFilter.processException(e, CLASS_NAME + ".readSet",
CommsConstants.CATCONSUMER_READSET_01,
this);
SibTr.error(tc, "PROTOCOL_ERROR_SICO2003", e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "readSet");
// Re-throw this exception so that the client will informed if required
throw e;
} | [
"public",
"void",
"readSet",
"(",
"int",
"requestNumber",
",",
"SIMessageHandle",
"[",
"]",
"msgHandles",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
... | This method should be handled by the appropriate subclass
@param requestNumber
@param msgIds | [
"This",
"method",
"should",
"be",
"handled",
"by",
"the",
"appropriate",
"subclass"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATConsumer.java#L491-L510 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.