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 |
|---|---|---|---|---|---|---|---|---|---|---|
hageldave/ImagingKit | ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ArrayUtils.java | ArrayUtils.assertArraySize | public static void assertArraySize(int size, double[] array, Supplier<String> errmsg){
if(array.length != size){
throw new IllegalArgumentException(errmsg.get());
}
} | java | public static void assertArraySize(int size, double[] array, Supplier<String> errmsg){
if(array.length != size){
throw new IllegalArgumentException(errmsg.get());
}
} | [
"public",
"static",
"void",
"assertArraySize",
"(",
"int",
"size",
",",
"double",
"[",
"]",
"array",
",",
"Supplier",
"<",
"String",
">",
"errmsg",
")",
"{",
"if",
"(",
"array",
".",
"length",
"!=",
"size",
")",
"{",
"throw",
"new",
"IllegalArgumentExcep... | Throws an {@link IllegalArgumentException} is the specified array is not of specified size
@param size for array to have
@param array to check
@param errmsg generates message to put into exception | [
"Throws",
"an",
"{"
] | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ArrayUtils.java#L108-L112 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getCoinInstance | public static BtcFormat getCoinInstance(int minFractionPlaces, int... groups) {
return getInstance(COIN_SCALE, defaultLocale(), minFractionPlaces, boxAsList(groups));
} | java | public static BtcFormat getCoinInstance(int minFractionPlaces, int... groups) {
return getInstance(COIN_SCALE, defaultLocale(), minFractionPlaces, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getCoinInstance",
"(",
"int",
"minFractionPlaces",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"COIN_SCALE",
",",
"defaultLocale",
"(",
")",
",",
"minFractionPlaces",
",",
"boxAsList",
"(",
"groups",
")"... | Return a new coin-denominated formatter with the specified fraction-places. The
returned object will format and parse values according to the default locale, and will
format the fraction part of numbers with at least two decimal places. The sizes of
additional groups of decimal places can be specified by a variable number of
{@code int} arguments. Each optional decimal-place group will be applied only if
useful for expressing precision, and will be only partially applied if necessary to
avoid giving a place to fractional satoshis. | [
"Return",
"a",
"new",
"coin",
"-",
"denominated",
"formatter",
"with",
"the",
"specified",
"fraction",
"-",
"places",
".",
"The",
"returned",
"object",
"will",
"format",
"and",
"parse",
"values",
"according",
"to",
"the",
"default",
"locale",
"and",
"will",
... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L949-L951 |
elki-project/elki | elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mktab/MkTabTreeNode.java | MkTabTreeNode.integrityCheckParameters | @Override
protected void integrityCheckParameters(MkTabEntry parentEntry, MkTabTreeNode<O> parent, int index, AbstractMTree<O, MkTabTreeNode<O>, MkTabEntry, ?> mTree) {
super.integrityCheckParameters(parentEntry, parent, index, mTree);
// test knn distances
MkTabEntry entry = parent.getEntry(index);
double[] knnDistances = kNNDistances();
if(!Arrays.equals(entry.getKnnDistances(), knnDistances)) {
String soll = knnDistances.toString();
String ist = entry.getKnnDistances().toString();
throw new RuntimeException("Wrong knnDistances in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist);
}
} | java | @Override
protected void integrityCheckParameters(MkTabEntry parentEntry, MkTabTreeNode<O> parent, int index, AbstractMTree<O, MkTabTreeNode<O>, MkTabEntry, ?> mTree) {
super.integrityCheckParameters(parentEntry, parent, index, mTree);
// test knn distances
MkTabEntry entry = parent.getEntry(index);
double[] knnDistances = kNNDistances();
if(!Arrays.equals(entry.getKnnDistances(), knnDistances)) {
String soll = knnDistances.toString();
String ist = entry.getKnnDistances().toString();
throw new RuntimeException("Wrong knnDistances in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist);
}
} | [
"@",
"Override",
"protected",
"void",
"integrityCheckParameters",
"(",
"MkTabEntry",
"parentEntry",
",",
"MkTabTreeNode",
"<",
"O",
">",
"parent",
",",
"int",
"index",
",",
"AbstractMTree",
"<",
"O",
",",
"MkTabTreeNode",
"<",
"O",
">",
",",
"MkTabEntry",
",",... | Tests, if the parameters of the entry representing this node, are correctly
set. Subclasses may need to overwrite this method.
@param parent the parent holding the entry representing this node
@param index the index of the entry in the parents child array
@param mTree the underlying M-Tree | [
"Tests",
"if",
"the",
"parameters",
"of",
"the",
"entry",
"representing",
"this",
"node",
"are",
"correctly",
"set",
".",
"Subclasses",
"may",
"need",
"to",
"overwrite",
"this",
"method",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mktab/MkTabTreeNode.java#L97-L108 |
zackpollard/JavaTelegramBot-API | core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java | TelegramBot.answerInlineQuery | public boolean answerInlineQuery(String inlineQueryId, InlineQueryResponse inlineQueryResponse) {
if (inlineQueryId != null && inlineQueryResponse != null) {
HttpResponse<String> response;
JSONObject jsonResponse;
try {
MultipartBody requests = Unirest.post(getBotAPIUrl() + "answerInlineQuery")
.field("inline_query_id", inlineQueryId)
.field("results", GSON.toJson(inlineQueryResponse.getResults()))
.field("cache_time", inlineQueryResponse.getCacheTime())
.field("is_personal", inlineQueryResponse.isPersonal())
.field("next_offset", inlineQueryResponse.getNextOffset())
.field("switch_pm_text", inlineQueryResponse.getSwitchPmText())
.field("switch_pm_parameter", inlineQueryResponse.getSwitchPmParameter());
response = requests.asString();
jsonResponse = Utils.processResponse(response);
if (jsonResponse != null) {
if (jsonResponse.getBoolean("result")) return true;
}
} catch (UnirestException e) {
e.printStackTrace();
}
}
return false;
} | java | public boolean answerInlineQuery(String inlineQueryId, InlineQueryResponse inlineQueryResponse) {
if (inlineQueryId != null && inlineQueryResponse != null) {
HttpResponse<String> response;
JSONObject jsonResponse;
try {
MultipartBody requests = Unirest.post(getBotAPIUrl() + "answerInlineQuery")
.field("inline_query_id", inlineQueryId)
.field("results", GSON.toJson(inlineQueryResponse.getResults()))
.field("cache_time", inlineQueryResponse.getCacheTime())
.field("is_personal", inlineQueryResponse.isPersonal())
.field("next_offset", inlineQueryResponse.getNextOffset())
.field("switch_pm_text", inlineQueryResponse.getSwitchPmText())
.field("switch_pm_parameter", inlineQueryResponse.getSwitchPmParameter());
response = requests.asString();
jsonResponse = Utils.processResponse(response);
if (jsonResponse != null) {
if (jsonResponse.getBoolean("result")) return true;
}
} catch (UnirestException e) {
e.printStackTrace();
}
}
return false;
} | [
"public",
"boolean",
"answerInlineQuery",
"(",
"String",
"inlineQueryId",
",",
"InlineQueryResponse",
"inlineQueryResponse",
")",
"{",
"if",
"(",
"inlineQueryId",
"!=",
"null",
"&&",
"inlineQueryResponse",
"!=",
"null",
")",
"{",
"HttpResponse",
"<",
"String",
">",
... | This allows you to respond to an inline query with an InlineQueryResponse object
@param inlineQueryId The ID of the inline query you are responding to
@param inlineQueryResponse The InlineQueryResponse object that you want to send to the user
@return True if the response was sent successfully, otherwise False | [
"This",
"allows",
"you",
"to",
"respond",
"to",
"an",
"inline",
"query",
"with",
"an",
"InlineQueryResponse",
"object"
] | train | https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L935-L965 |
camunda/camunda-spin | dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonLogger.java | JacksonJsonLogger.unableToParseValue | public SpinJsonDataFormatException unableToParseValue(String expectedType, JsonNodeType type) {
return new SpinJsonDataFormatException(exceptionMessage("002", "Expected '{}', got '{}'", expectedType, type.toString()));
} | java | public SpinJsonDataFormatException unableToParseValue(String expectedType, JsonNodeType type) {
return new SpinJsonDataFormatException(exceptionMessage("002", "Expected '{}', got '{}'", expectedType, type.toString()));
} | [
"public",
"SpinJsonDataFormatException",
"unableToParseValue",
"(",
"String",
"expectedType",
",",
"JsonNodeType",
"type",
")",
"{",
"return",
"new",
"SpinJsonDataFormatException",
"(",
"exceptionMessage",
"(",
"\"002\"",
",",
"\"Expected '{}', got '{}'\"",
",",
"expectedTy... | Exception handler if we are unable to parse a json value into a java representation
@param expectedType Name of the expected Type
@param type Type of the json node
@return SpinJsonDataFormatException | [
"Exception",
"handler",
"if",
"we",
"are",
"unable",
"to",
"parse",
"a",
"json",
"value",
"into",
"a",
"java",
"representation"
] | train | https://github.com/camunda/camunda-spin/blob/cfe65161eb97fd5023a945cb97c47fbfe69e9fdd/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonLogger.java#L52-L54 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/XMLBuilder.java | XMLBuilder.startElement | public void startElement(String elemName, String attrName, String attrValue) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", attrName, "", "CDATA", attrValue);
writeStartElement(elemName, attrs);
m_tagStack.push(elemName);
} | java | public void startElement(String elemName, String attrName, String attrValue) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", attrName, "", "CDATA", attrValue);
writeStartElement(elemName, attrs);
m_tagStack.push(elemName);
} | [
"public",
"void",
"startElement",
"(",
"String",
"elemName",
",",
"String",
"attrName",
",",
"String",
"attrValue",
")",
"{",
"AttributesImpl",
"attrs",
"=",
"new",
"AttributesImpl",
"(",
")",
";",
"attrs",
".",
"addAttribute",
"(",
"\"\"",
",",
"attrName",
... | Start a new XML element using the given start tag and single attribute. | [
"Start",
"a",
"new",
"XML",
"element",
"using",
"the",
"given",
"start",
"tag",
"and",
"single",
"attribute",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/XMLBuilder.java#L73-L78 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.getObjects | public JSONObject getObjects(List<String> objectIDs) throws AlgoliaException {
return getObjects(objectIDs, null, RequestOptions.empty);
} | java | public JSONObject getObjects(List<String> objectIDs) throws AlgoliaException {
return getObjects(objectIDs, null, RequestOptions.empty);
} | [
"public",
"JSONObject",
"getObjects",
"(",
"List",
"<",
"String",
">",
"objectIDs",
")",
"throws",
"AlgoliaException",
"{",
"return",
"getObjects",
"(",
"objectIDs",
",",
"null",
",",
"RequestOptions",
".",
"empty",
")",
";",
"}"
] | Get several objects from this index
@param objectIDs the array of unique identifier of objects to retrieve | [
"Get",
"several",
"objects",
"from",
"this",
"index"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L281-L283 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.toDouble | public static final Function<String,Double> toDouble(final int scale, final RoundingMode roundingMode) {
return new ToDouble(scale, roundingMode);
} | java | public static final Function<String,Double> toDouble(final int scale, final RoundingMode roundingMode) {
return new ToDouble(scale, roundingMode);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"Double",
">",
"toDouble",
"(",
"final",
"int",
"scale",
",",
"final",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"new",
"ToDouble",
"(",
"scale",
",",
"roundingMode",
")",
";",
"}"
] | <p>
Converts a String into a Double, using the default configuration
for for decimal point and thousands separator and establishing the specified scale. Rounding
mode is used for setting the scale to the specified value.
The input string must be between
{@link Double#MIN_VALUE} and {@link Double#MAX_VALUE}
</p>
@param scale the desired scale for the resulting Double object
@param roundingMode the rounding mode to be used when setting the scale
@return the resulting Double object | [
"<p",
">",
"Converts",
"a",
"String",
"into",
"a",
"Double",
"using",
"the",
"default",
"configuration",
"for",
"for",
"decimal",
"point",
"and",
"thousands",
"separator",
"and",
"establishing",
"the",
"specified",
"scale",
".",
"Rounding",
"mode",
"is",
"used... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L482-L484 |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newRole | public Predicate.Role newRole(Predicate predicate, String semRole, Span<Term> span) {
String newId = idManager.getNextId(AnnotationType.ROLE);
Predicate.Role newRole = new Predicate.Role(newId, semRole, span);
return newRole;
} | java | public Predicate.Role newRole(Predicate predicate, String semRole, Span<Term> span) {
String newId = idManager.getNextId(AnnotationType.ROLE);
Predicate.Role newRole = new Predicate.Role(newId, semRole, span);
return newRole;
} | [
"public",
"Predicate",
".",
"Role",
"newRole",
"(",
"Predicate",
"predicate",
",",
"String",
"semRole",
",",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"ROLE",
")",
";",
... | Creates a new Role object. It assigns an appropriate ID to it. It uses the ID of the predicate to create a new ID for the role. It doesn't add the role to the predicate.
@param predicate the predicate which this role is part of
@param semRole semantic role
@param span span containing all the targets of the role
@return a new role. | [
"Creates",
"a",
"new",
"Role",
"object",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"It",
"uses",
"the",
"ID",
"of",
"the",
"predicate",
"to",
"create",
"a",
"new",
"ID",
"for",
"the",
"role",
".",
"It",
"doesn",
"t",
"add",
... | train | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1033-L1037 |
gallandarakhneorg/afc | advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/commands/PrintConfigCommand.java | PrintConfigCommand.generateJson | @SuppressWarnings("static-method")
protected String generateJson(Map<String, Object> map) throws JsonProcessingException {
final ObjectMapper mapper = new ObjectMapper();
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
} | java | @SuppressWarnings("static-method")
protected String generateJson(Map<String, Object> map) throws JsonProcessingException {
final ObjectMapper mapper = new ObjectMapper();
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"String",
"generateJson",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"throws",
"JsonProcessingException",
"{",
"final",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
... | Generate the Json representation of the given map.
@param map the map to print out.
@return the Json representation.
@throws JsonProcessingException when the Json cannot be processed. | [
"Generate",
"the",
"Json",
"representation",
"of",
"the",
"given",
"map",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/commands/PrintConfigCommand.java#L163-L167 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/astar/RoadAStar.java | RoadAStar.solve | public RoadPath solve(Point2D<?, ?> startPoint, RoadConnection endPoint, RoadNetwork network) {
assert network != null && startPoint != null && endPoint != null;
final RoadSegment startSegment = network.getNearestSegment(startPoint);
if (startSegment != null) {
final VirtualPoint start = new VirtualPoint(startPoint, startSegment);
return solve(start, endPoint);
}
return null;
} | java | public RoadPath solve(Point2D<?, ?> startPoint, RoadConnection endPoint, RoadNetwork network) {
assert network != null && startPoint != null && endPoint != null;
final RoadSegment startSegment = network.getNearestSegment(startPoint);
if (startSegment != null) {
final VirtualPoint start = new VirtualPoint(startPoint, startSegment);
return solve(start, endPoint);
}
return null;
} | [
"public",
"RoadPath",
"solve",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"startPoint",
",",
"RoadConnection",
"endPoint",
",",
"RoadNetwork",
"network",
")",
"{",
"assert",
"network",
"!=",
"null",
"&&",
"startPoint",
"!=",
"null",
"&&",
"endPoint",
"!=",
"... | Run the A* algorithm from the nearest segment to
<var>startPoint</var> to the nearest segment to
<var>endPoint</var>.
@param startPoint is the starting point.
@param endPoint is the point to reach.
@param network is the road network to explore.
@return the found path, or <code>null</code> if none found. | [
"Run",
"the",
"A",
"*",
"algorithm",
"from",
"the",
"nearest",
"segment",
"to",
"<var",
">",
"startPoint<",
"/",
"var",
">",
"to",
"the",
"nearest",
"segment",
"to",
"<var",
">",
"endPoint<",
"/",
"var",
">",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/astar/RoadAStar.java#L202-L210 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java | JMElasticsearchBulk.deleteBulkDocsAsync | public void deleteBulkDocsAsync(String index, String type) {
executeBulkRequestAsync(buildDeleteBulkRequestBuilder(
buildAllDeleteRequestBuilderList(index, type)));
} | java | public void deleteBulkDocsAsync(String index, String type) {
executeBulkRequestAsync(buildDeleteBulkRequestBuilder(
buildAllDeleteRequestBuilderList(index, type)));
} | [
"public",
"void",
"deleteBulkDocsAsync",
"(",
"String",
"index",
",",
"String",
"type",
")",
"{",
"executeBulkRequestAsync",
"(",
"buildDeleteBulkRequestBuilder",
"(",
"buildAllDeleteRequestBuilderList",
"(",
"index",
",",
"type",
")",
")",
")",
";",
"}"
] | Delete bulk docs async.
@param index the index
@param type the type | [
"Delete",
"bulk",
"docs",
"async",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L500-L503 |
moparisthebest/beehive | beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java | JdbcControlImpl.getConnectionFromDataSource | private Connection getConnectionFromDataSource(String jndiName,
Class<? extends JdbcControl.JndiContextFactory> jndiFactory)
throws SQLException
{
Connection con = null;
try {
JndiContextFactory jf = (JndiContextFactory) jndiFactory.newInstance();
Context jndiContext = jf.getContext();
_dataSource = (DataSource) jndiContext.lookup(jndiName);
con = _dataSource.getConnection();
} catch (IllegalAccessException iae) {
throw new ControlException("IllegalAccessException:", iae);
} catch (InstantiationException ie) {
throw new ControlException("InstantiationException:", ie);
} catch (NamingException ne) {
throw new ControlException("NamingException:", ne);
}
return con;
} | java | private Connection getConnectionFromDataSource(String jndiName,
Class<? extends JdbcControl.JndiContextFactory> jndiFactory)
throws SQLException
{
Connection con = null;
try {
JndiContextFactory jf = (JndiContextFactory) jndiFactory.newInstance();
Context jndiContext = jf.getContext();
_dataSource = (DataSource) jndiContext.lookup(jndiName);
con = _dataSource.getConnection();
} catch (IllegalAccessException iae) {
throw new ControlException("IllegalAccessException:", iae);
} catch (InstantiationException ie) {
throw new ControlException("InstantiationException:", ie);
} catch (NamingException ne) {
throw new ControlException("NamingException:", ne);
}
return con;
} | [
"private",
"Connection",
"getConnectionFromDataSource",
"(",
"String",
"jndiName",
",",
"Class",
"<",
"?",
"extends",
"JdbcControl",
".",
"JndiContextFactory",
">",
"jndiFactory",
")",
"throws",
"SQLException",
"{",
"Connection",
"con",
"=",
"null",
";",
"try",
"{... | Get a connection from a DataSource.
@param jndiName Specifed in the subclasse's ConnectionDataSource annotation
@param jndiFactory Specified in the subclasse's ConnectionDataSource Annotation.
@return null if a connection cannot be established
@throws SQLException | [
"Get",
"a",
"connection",
"from",
"a",
"DataSource",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java#L402-L421 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixVariableNameShadowing | @Fix(org.eclipse.xtext.xbase.validation.IssueCodes.VARIABLE_NAME_SHADOWING)
public void fixVariableNameShadowing(final Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
MemberRenameModification.accept(this, issue, acceptor);
} | java | @Fix(org.eclipse.xtext.xbase.validation.IssueCodes.VARIABLE_NAME_SHADOWING)
public void fixVariableNameShadowing(final Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
MemberRenameModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"org",
".",
"eclipse",
".",
"xtext",
".",
"xbase",
".",
"validation",
".",
"IssueCodes",
".",
"VARIABLE_NAME_SHADOWING",
")",
"public",
"void",
"fixVariableNameShadowing",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",... | Quick fix for "Variable name shadowing".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Variable",
"name",
"shadowing",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L739-L743 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java | ElementPlugin.executeAction | private void executeAction(PluginAction action, boolean async, Object data) {
if (hasListeners() || action == PluginAction.LOAD) {
PluginEvent event = new PluginEvent(this, action, data);
if (async) {
EventUtil.post(event);
} else {
onAction(event);
}
}
} | java | private void executeAction(PluginAction action, boolean async, Object data) {
if (hasListeners() || action == PluginAction.LOAD) {
PluginEvent event = new PluginEvent(this, action, data);
if (async) {
EventUtil.post(event);
} else {
onAction(event);
}
}
} | [
"private",
"void",
"executeAction",
"(",
"PluginAction",
"action",
",",
"boolean",
"async",
",",
"Object",
"data",
")",
"{",
"if",
"(",
"hasListeners",
"(",
")",
"||",
"action",
"==",
"PluginAction",
".",
"LOAD",
")",
"{",
"PluginEvent",
"event",
"=",
"new... | Notify all plugin callbacks of the specified action.
@param action Action to perform.
@param data Event-dependent data (may be null).
@param async If true, callbacks are done asynchronously. | [
"Notify",
"all",
"plugin",
"callbacks",
"of",
"the",
"specified",
"action",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java#L430-L440 |
mozilla/rhino | src/org/mozilla/javascript/NativeString.java | NativeString.get | @Override
public Object get(int index, Scriptable start) {
if (0 <= index && index < string.length()) {
return String.valueOf(string.charAt(index));
}
return super.get(index, start);
} | java | @Override
public Object get(int index, Scriptable start) {
if (0 <= index && index < string.length()) {
return String.valueOf(string.charAt(index));
}
return super.get(index, start);
} | [
"@",
"Override",
"public",
"Object",
"get",
"(",
"int",
"index",
",",
"Scriptable",
"start",
")",
"{",
"if",
"(",
"0",
"<=",
"index",
"&&",
"index",
"<",
"string",
".",
"length",
"(",
")",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"string",
... | /* Make array-style property lookup work for strings.
XXX is this ECMA? A version check is probably needed. In js too. | [
"/",
"*",
"Make",
"array",
"-",
"style",
"property",
"lookup",
"work",
"for",
"strings",
".",
"XXX",
"is",
"this",
"ECMA?",
"A",
"version",
"check",
"is",
"probably",
"needed",
".",
"In",
"js",
"too",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeString.java#L553-L559 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java | CacheProviderWrapper.addAlias | @Override
public void addAlias(Object key, Object[] aliasArray, boolean askPermission, boolean coordinate) {
final String methodName = "addAlias()";
if (this.featureSupport.isAliasSupported()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
}
} else {
Tr.error(tc, "DYNA1063E", new Object[] { methodName, cacheName, this.cacheProviderName });
}
return;
} | java | @Override
public void addAlias(Object key, Object[] aliasArray, boolean askPermission, boolean coordinate) {
final String methodName = "addAlias()";
if (this.featureSupport.isAliasSupported()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
}
} else {
Tr.error(tc, "DYNA1063E", new Object[] { methodName, cacheName, this.cacheProviderName });
}
return;
} | [
"@",
"Override",
"public",
"void",
"addAlias",
"(",
"Object",
"key",
",",
"Object",
"[",
"]",
"aliasArray",
",",
"boolean",
"askPermission",
",",
"boolean",
"coordinate",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"addAlias()\"",
";",
"if",
"(",
"this... | Adds an alias for the given key in the cache's mapping table. If the alias is already
associated with another key, it will be changed to associate with the new key.
@param key the key assoicated with alias
@param aliasArray the alias to use for lookups
@param askPermission True implies that execution must ask the coordinating CacheUnit for permission (No effect on CoreCache).
@param coordinate Indicates that the value should be set in other caches caching this value. (No effect on CoreCache) | [
"Adds",
"an",
"alias",
"for",
"the",
"given",
"key",
"in",
"the",
"cache",
"s",
"mapping",
"table",
".",
"If",
"the",
"alias",
"is",
"already",
"associated",
"with",
"another",
"key",
"it",
"will",
"be",
"changed",
"to",
"associate",
"with",
"the",
"new"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L695-L706 |
hawkular/hawkular-inventory | hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/filters/Related.java | Related.asTargetBy | public static Related asTargetBy(Relationships.WellKnown relationship) {
return new Related(null, relationship.name(), EntityRole.TARGET);
} | java | public static Related asTargetBy(Relationships.WellKnown relationship) {
return new Related(null, relationship.name(), EntityRole.TARGET);
} | [
"public",
"static",
"Related",
"asTargetBy",
"(",
"Relationships",
".",
"WellKnown",
"relationship",
")",
"{",
"return",
"new",
"Related",
"(",
"null",
",",
"relationship",
".",
"name",
"(",
")",
",",
"EntityRole",
".",
"TARGET",
")",
";",
"}"
] | Overloaded version of {@link #asTargetBy(String)} that uses the
{@link org.hawkular.inventory.api.Relationships.WellKnown} as the name of the relationship.
@param relationship the type of the relationship
@return a new "related" filter instance | [
"Overloaded",
"version",
"of",
"{",
"@link",
"#asTargetBy",
"(",
"String",
")",
"}",
"that",
"uses",
"the",
"{",
"@link",
"org",
".",
"hawkular",
".",
"inventory",
".",
"api",
".",
"Relationships",
".",
"WellKnown",
"}",
"as",
"the",
"name",
"of",
"the",... | train | https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/filters/Related.java#L134-L136 |
albfernandez/itext2 | src/main/java/com/lowagie/text/SimpleTable.java | SimpleTable.addElement | public void addElement(SimpleCell element) throws BadElementException {
if(!element.isCellgroup()) {
throw new BadElementException("You can't add cells to a table directly, add them to a row first.");
}
content.add(element);
} | java | public void addElement(SimpleCell element) throws BadElementException {
if(!element.isCellgroup()) {
throw new BadElementException("You can't add cells to a table directly, add them to a row first.");
}
content.add(element);
} | [
"public",
"void",
"addElement",
"(",
"SimpleCell",
"element",
")",
"throws",
"BadElementException",
"{",
"if",
"(",
"!",
"element",
".",
"isCellgroup",
"(",
")",
")",
"{",
"throw",
"new",
"BadElementException",
"(",
"\"You can't add cells to a table directly, add them... | Adds content to this object.
@param element
@throws BadElementException | [
"Adds",
"content",
"to",
"this",
"object",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/SimpleTable.java#L92-L97 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.createPattern | public PdfPatternPainter createPattern(float width, float height, Color color) {
return createPattern(width, height, width, height, color);
} | java | public PdfPatternPainter createPattern(float width, float height, Color color) {
return createPattern(width, height, width, height, color);
} | [
"public",
"PdfPatternPainter",
"createPattern",
"(",
"float",
"width",
",",
"float",
"height",
",",
"Color",
"color",
")",
"{",
"return",
"createPattern",
"(",
"width",
",",
"height",
",",
"width",
",",
"height",
",",
"color",
")",
";",
"}"
] | Create a new uncolored tiling pattern.
Variables xstep and ystep are set to the same values
of width and height.
@param width the width of the pattern
@param height the height of the pattern
@param color the default color. Can be <CODE>null</CODE>
@return the <CODE>PdfPatternPainter</CODE> where the pattern will be created | [
"Create",
"a",
"new",
"uncolored",
"tiling",
"pattern",
".",
"Variables",
"xstep",
"and",
"ystep",
"are",
"set",
"to",
"the",
"same",
"values",
"of",
"width",
"and",
"height",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1976-L1978 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/AdsServiceClientFactory.java | AdsServiceClientFactory.getServiceClient | public synchronized <T> T getServiceClient(S adsSession, Class<T> interfaceClass)
throws ServiceException {
adsServiceFactoryHelper.checkServiceClientPreconditions(adsSession, interfaceClass);
String version = adsServiceFactoryHelper.determineVersion(interfaceClass);
D adsServiceDescriptor =
adsServiceFactoryHelper.createServiceDescriptor(interfaceClass, version);
C adsServiceClient =
adsServiceFactoryHelper.createAdsServiceClient(adsServiceDescriptor, adsSession);
return createProxy(interfaceClass, adsServiceClient);
} | java | public synchronized <T> T getServiceClient(S adsSession, Class<T> interfaceClass)
throws ServiceException {
adsServiceFactoryHelper.checkServiceClientPreconditions(adsSession, interfaceClass);
String version = adsServiceFactoryHelper.determineVersion(interfaceClass);
D adsServiceDescriptor =
adsServiceFactoryHelper.createServiceDescriptor(interfaceClass, version);
C adsServiceClient =
adsServiceFactoryHelper.createAdsServiceClient(adsServiceDescriptor, adsSession);
return createProxy(interfaceClass, adsServiceClient);
} | [
"public",
"synchronized",
"<",
"T",
">",
"T",
"getServiceClient",
"(",
"S",
"adsSession",
",",
"Class",
"<",
"T",
">",
"interfaceClass",
")",
"throws",
"ServiceException",
"{",
"adsServiceFactoryHelper",
".",
"checkServiceClientPreconditions",
"(",
"adsSession",
","... | Gets a client given a session and the class of the desired stub interface.
@param <T> the service type
@param adsSession the session associated with the desired
client
@param interfaceClass the class type of the desired client
@return a client for the specified ads service
@throws ServiceException if the service client could not be created | [
"Gets",
"a",
"client",
"given",
"a",
"session",
"and",
"the",
"class",
"of",
"the",
"desired",
"stub",
"interface",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/AdsServiceClientFactory.java#L69-L78 |
tvesalainen/util | util/src/main/java/org/vesalainen/util/navi/Velocity.java | Velocity.getThere | public Date getThere(Date start, Distance distance)
{
TimeSpan timeSpan = getTimeSpan(distance);
return timeSpan.addDate(start);
} | java | public Date getThere(Date start, Distance distance)
{
TimeSpan timeSpan = getTimeSpan(distance);
return timeSpan.addDate(start);
} | [
"public",
"Date",
"getThere",
"(",
"Date",
"start",
",",
"Distance",
"distance",
")",
"{",
"TimeSpan",
"timeSpan",
"=",
"getTimeSpan",
"(",
"distance",
")",
";",
"return",
"timeSpan",
".",
"addDate",
"(",
"start",
")",
";",
"}"
] | Returns the time we are there if we started at start
@param start Starting time
@param distance Distance to meve
@return | [
"Returns",
"the",
"time",
"we",
"are",
"there",
"if",
"we",
"started",
"at",
"start"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Velocity.java#L74-L78 |
JOML-CI/JOML | src/org/joml/sampling/SpiralSampling.java | SpiralSampling.createEquiAngle | public void createEquiAngle(float radius, int numRotations, int numSamples, float jitter, Callback2d callback) {
float spacing = radius / numRotations;
for (int sample = 0; sample < numSamples; sample++) {
float angle = 2.0f * (float) Math.PI * (sample * numRotations) / numSamples;
float r = radius * sample / (numSamples - 1) + (rnd.nextFloat() * 2.0f - 1.0f) * spacing * jitter;
float x = (float) Math.sin_roquen_9(angle + 0.5f * (float) Math.PI) * r;
float y = (float) Math.sin_roquen_9(angle) * r;
callback.onNewSample(x, y);
}
} | java | public void createEquiAngle(float radius, int numRotations, int numSamples, float jitter, Callback2d callback) {
float spacing = radius / numRotations;
for (int sample = 0; sample < numSamples; sample++) {
float angle = 2.0f * (float) Math.PI * (sample * numRotations) / numSamples;
float r = radius * sample / (numSamples - 1) + (rnd.nextFloat() * 2.0f - 1.0f) * spacing * jitter;
float x = (float) Math.sin_roquen_9(angle + 0.5f * (float) Math.PI) * r;
float y = (float) Math.sin_roquen_9(angle) * r;
callback.onNewSample(x, y);
}
} | [
"public",
"void",
"createEquiAngle",
"(",
"float",
"radius",
",",
"int",
"numRotations",
",",
"int",
"numSamples",
",",
"float",
"jitter",
",",
"Callback2d",
"callback",
")",
"{",
"float",
"spacing",
"=",
"radius",
"/",
"numRotations",
";",
"for",
"(",
"int"... | Create <code>numSamples</code> number of samples on a spiral with maximum radius <code>radius</code> around the center using <code>numRotations</code> number of rotations
along the spiral, and call the given <code>callback</code> for each sample generated.
<p>
The generated sample points are distributed with equal angle differences around the spiral, so they concentrate towards the center.
<p>
Additionally, the radius of each sample point is jittered by the given <code>jitter</code> factor.
@param radius
the maximum radius of the spiral
@param numRotations
the number of rotations of the spiral
@param numSamples
the number of samples to generate
@param jitter
the factor by which the radius of each sample point is jittered. Possible values are <code>[0..1]</code>
@param callback
will be called for each sample generated | [
"Create",
"<code",
">",
"numSamples<",
"/",
"code",
">",
"number",
"of",
"samples",
"on",
"a",
"spiral",
"with",
"maximum",
"radius",
"<code",
">",
"radius<",
"/",
"code",
">",
"around",
"the",
"center",
"using",
"<code",
">",
"numRotations<",
"/",
"code",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/sampling/SpiralSampling.java#L90-L99 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java | MetadataFinder.requestPlaylistItemsFrom | public List<Message> requestPlaylistItemsFrom(final int player, final CdjStatus.TrackSourceSlot slot,
final int sortOrder, final int playlistOrFolderId,
final boolean folder)
throws Exception {
ConnectionManager.ClientTask<List<Message>> task = new ConnectionManager.ClientTask<List<Message>>() {
@Override
public List<Message> useClient(Client client) throws Exception {
return getPlaylistItems(slot, sortOrder, playlistOrFolderId, folder, client);
}
};
return ConnectionManager.getInstance().invokeWithClientSession(player, task, "requesting playlist information");
} | java | public List<Message> requestPlaylistItemsFrom(final int player, final CdjStatus.TrackSourceSlot slot,
final int sortOrder, final int playlistOrFolderId,
final boolean folder)
throws Exception {
ConnectionManager.ClientTask<List<Message>> task = new ConnectionManager.ClientTask<List<Message>>() {
@Override
public List<Message> useClient(Client client) throws Exception {
return getPlaylistItems(slot, sortOrder, playlistOrFolderId, folder, client);
}
};
return ConnectionManager.getInstance().invokeWithClientSession(player, task, "requesting playlist information");
} | [
"public",
"List",
"<",
"Message",
">",
"requestPlaylistItemsFrom",
"(",
"final",
"int",
"player",
",",
"final",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
",",
"final",
"int",
"sortOrder",
",",
"final",
"int",
"playlistOrFolderId",
",",
"final",
"boolean",
"fo... | Ask the specified player's dbserver for the playlist entries of the specified playlist (if {@code folder} is {@code false},
or the list of playlists and folders inside the specified playlist folder (if {@code folder} is {@code true}.
@param player the player number whose playlist entries are of interest
@param slot the slot in which the playlist can be found
@param sortOrder the order in which responses should be sorted, 0 for default, see Section 6.11.1 of the
<a href="https://github.com/Deep-Symmetry/dysentery/blob/master/doc/Analysis.pdf">Packet Analysis
document</a> for details
@param playlistOrFolderId the database ID of the desired playlist or folder
@param folder indicates whether we are asking for the contents of a folder or playlist
@return the items that are found in the specified playlist or folder; they will be tracks if we are asking
for a playlist, or playlists and folders if we are asking for a folder
@throws Exception if there is a problem obtaining the playlist information | [
"Ask",
"the",
"specified",
"player",
"s",
"dbserver",
"for",
"the",
"playlist",
"entries",
"of",
"the",
"specified",
"playlist",
"(",
"if",
"{",
"@code",
"folder",
"}",
"is",
"{",
"@code",
"false",
"}",
"or",
"the",
"list",
"of",
"playlists",
"and",
"fol... | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L294-L306 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/util/ValidationObjUtil.java | ValidationObjUtil.objectDeepCopyWithBlackList | public static <T> T objectDeepCopyWithBlackList(Object from, Class<T> toClass, String... blockFields) {
Object to = getNewInstance(toClass);
return objectDeepCopyWithBlackList(from, to, blockFields);
} | java | public static <T> T objectDeepCopyWithBlackList(Object from, Class<T> toClass, String... blockFields) {
Object to = getNewInstance(toClass);
return objectDeepCopyWithBlackList(from, to, blockFields);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"objectDeepCopyWithBlackList",
"(",
"Object",
"from",
",",
"Class",
"<",
"T",
">",
"toClass",
",",
"String",
"...",
"blockFields",
")",
"{",
"Object",
"to",
"=",
"getNewInstance",
"(",
"toClass",
")",
";",
"return",
... | Object deep copy with black list t.
@param <T> the type parameter
@param from the from
@param toClass the to class
@param blockFields the block fields
@return the t | [
"Object",
"deep",
"copy",
"with",
"black",
"list",
"t",
"."
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationObjUtil.java#L455-L458 |
google/closure-compiler | src/com/google/javascript/jscomp/AstFactory.java | AstFactory.createThisAliasDeclarationForFunction | Node createThisAliasDeclarationForFunction(String aliasName, Node functionNode) {
return createSingleConstNameDeclaration(
aliasName, createThis(getTypeOfThisForFunctionNode(functionNode)));
} | java | Node createThisAliasDeclarationForFunction(String aliasName, Node functionNode) {
return createSingleConstNameDeclaration(
aliasName, createThis(getTypeOfThisForFunctionNode(functionNode)));
} | [
"Node",
"createThisAliasDeclarationForFunction",
"(",
"String",
"aliasName",
",",
"Node",
"functionNode",
")",
"{",
"return",
"createSingleConstNameDeclaration",
"(",
"aliasName",
",",
"createThis",
"(",
"getTypeOfThisForFunctionNode",
"(",
"functionNode",
")",
")",
")",
... | Creates a statement declaring a const alias for "this" to be used in the given function node.
<p>e.g. `const aliasName = this;` | [
"Creates",
"a",
"statement",
"declaring",
"a",
"const",
"alias",
"for",
"this",
"to",
"be",
"used",
"in",
"the",
"given",
"function",
"node",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L322-L325 |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java | AbstractThrowEventBuilder.messageEventDefinition | public MessageEventDefinitionBuilder messageEventDefinition(String id) {
MessageEventDefinition messageEventDefinition = createEmptyMessageEventDefinition();
if (id != null) {
messageEventDefinition.setId(id);
}
element.getEventDefinitions().add(messageEventDefinition);
return new MessageEventDefinitionBuilder(modelInstance, messageEventDefinition);
} | java | public MessageEventDefinitionBuilder messageEventDefinition(String id) {
MessageEventDefinition messageEventDefinition = createEmptyMessageEventDefinition();
if (id != null) {
messageEventDefinition.setId(id);
}
element.getEventDefinitions().add(messageEventDefinition);
return new MessageEventDefinitionBuilder(modelInstance, messageEventDefinition);
} | [
"public",
"MessageEventDefinitionBuilder",
"messageEventDefinition",
"(",
"String",
"id",
")",
"{",
"MessageEventDefinition",
"messageEventDefinition",
"=",
"createEmptyMessageEventDefinition",
"(",
")",
";",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"messageEventDefinitio... | Creates an empty message event definition with the given id
and returns a builder for the message event definition.
@param id the id of the message event definition
@return the message event definition builder object | [
"Creates",
"an",
"empty",
"message",
"event",
"definition",
"with",
"the",
"given",
"id",
"and",
"returns",
"a",
"builder",
"for",
"the",
"message",
"event",
"definition",
"."
] | train | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java#L66-L74 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java | MeshGenerator.generateCrosshairs | public static void generateCrosshairs(TFloatList positions, TIntList indices, float length) {
/*
* \ |
* \|
* ----O-----
* |\
* | \
*/
length /= 2;
// Add the x axis line
addAll(positions, -length, 0, 0, length, 0, 0);
addAll(indices, 0, 1);
// Add the y axis line
addAll(positions, 0, -length, 0, 0, length, 0);
addAll(indices, 2, 3);
// Add the z axis line
addAll(positions, 0, 0, -length, 0, 0, length);
addAll(indices, 4, 5);
} | java | public static void generateCrosshairs(TFloatList positions, TIntList indices, float length) {
/*
* \ |
* \|
* ----O-----
* |\
* | \
*/
length /= 2;
// Add the x axis line
addAll(positions, -length, 0, 0, length, 0, 0);
addAll(indices, 0, 1);
// Add the y axis line
addAll(positions, 0, -length, 0, 0, length, 0);
addAll(indices, 2, 3);
// Add the z axis line
addAll(positions, 0, 0, -length, 0, 0, length);
addAll(indices, 4, 5);
} | [
"public",
"static",
"void",
"generateCrosshairs",
"(",
"TFloatList",
"positions",
",",
"TIntList",
"indices",
",",
"float",
"length",
")",
"{",
"/*\n * \\ |\n * \\|\n * ----O-----\n * |\\\n * | \\\n */",
"length",
"/=",
... | Generates a crosshairs shaped wireframe in 3D. The center is at the intersection point of the three lines.
@param positions Where to save the position information
@param indices Where to save the indices
@param length The length for the three lines | [
"Generates",
"a",
"crosshairs",
"shaped",
"wireframe",
"in",
"3D",
".",
"The",
"center",
"is",
"at",
"the",
"intersection",
"point",
"of",
"the",
"three",
"lines",
"."
] | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L504-L522 |
infinispan/infinispan | remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/LifecycleManager.java | LifecycleManager.cacheStarting | @Override
public void cacheStarting(ComponentRegistry cr, Configuration cfg, String cacheName) {
BasicComponentRegistry gcr = cr.getGlobalComponentRegistry().getComponent(BasicComponentRegistry.class);
InternalCacheRegistry icr = gcr.getComponent(InternalCacheRegistry.class).running();
if (!icr.isInternalCache(cacheName)) {
ProtobufMetadataManagerImpl protobufMetadataManager =
(ProtobufMetadataManagerImpl) gcr.getComponent(ProtobufMetadataManager.class).running();
protobufMetadataManager.addCacheDependency(cacheName);
SerializationContext serCtx = protobufMetadataManager.getSerializationContext();
RemoteQueryManager remoteQueryManager = buildQueryManager(cfg, serCtx, cr);
cr.registerComponent(remoteQueryManager, RemoteQueryManager.class);
}
} | java | @Override
public void cacheStarting(ComponentRegistry cr, Configuration cfg, String cacheName) {
BasicComponentRegistry gcr = cr.getGlobalComponentRegistry().getComponent(BasicComponentRegistry.class);
InternalCacheRegistry icr = gcr.getComponent(InternalCacheRegistry.class).running();
if (!icr.isInternalCache(cacheName)) {
ProtobufMetadataManagerImpl protobufMetadataManager =
(ProtobufMetadataManagerImpl) gcr.getComponent(ProtobufMetadataManager.class).running();
protobufMetadataManager.addCacheDependency(cacheName);
SerializationContext serCtx = protobufMetadataManager.getSerializationContext();
RemoteQueryManager remoteQueryManager = buildQueryManager(cfg, serCtx, cr);
cr.registerComponent(remoteQueryManager, RemoteQueryManager.class);
}
} | [
"@",
"Override",
"public",
"void",
"cacheStarting",
"(",
"ComponentRegistry",
"cr",
",",
"Configuration",
"cfg",
",",
"String",
"cacheName",
")",
"{",
"BasicComponentRegistry",
"gcr",
"=",
"cr",
".",
"getGlobalComponentRegistry",
"(",
")",
".",
"getComponent",
"("... | Registers the remote value wrapper interceptor in the cache before it gets started. | [
"Registers",
"the",
"remote",
"value",
"wrapper",
"interceptor",
"in",
"the",
"cache",
"before",
"it",
"gets",
"started",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/LifecycleManager.java#L167-L181 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsInner.java | TransparentDataEncryptionsInner.getAsync | public Observable<TransparentDataEncryptionInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<TransparentDataEncryptionInner>, TransparentDataEncryptionInner>() {
@Override
public TransparentDataEncryptionInner call(ServiceResponse<TransparentDataEncryptionInner> response) {
return response.body();
}
});
} | java | public Observable<TransparentDataEncryptionInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<TransparentDataEncryptionInner>, TransparentDataEncryptionInner>() {
@Override
public TransparentDataEncryptionInner call(ServiceResponse<TransparentDataEncryptionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TransparentDataEncryptionInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
... | Gets a database's transparent data encryption configuration.
@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 databaseName The name of the database for which the transparent data encryption applies.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TransparentDataEncryptionInner object | [
"Gets",
"a",
"database",
"s",
"transparent",
"data",
"encryption",
"configuration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsInner.java#L296-L303 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/demo/ImageRenderer.java | ImageRenderer.renderURL | public boolean renderURL(String urlstring, OutputStream out, Type type) throws IOException, SAXException
{
if (!urlstring.startsWith("http:") &&
!urlstring.startsWith("https:") &&
!urlstring.startsWith("ftp:") &&
!urlstring.startsWith("file:"))
urlstring = "http://" + urlstring;
//Open the network connection
DocumentSource docSource = new DefaultDocumentSource(urlstring);
//Parse the input document
DOMSource parser = new DefaultDOMSource(docSource);
Document doc = parser.parse();
//create the media specification
MediaSpec media = new MediaSpec(mediaType);
media.setDimensions(windowSize.width, windowSize.height);
media.setDeviceDimensions(windowSize.width, windowSize.height);
//Create the CSS analyzer
DOMAnalyzer da = new DOMAnalyzer(doc, docSource.getURL());
da.setMediaSpec(media);
da.attributesToStyles(); //convert the HTML presentation attributes to inline styles
da.addStyleSheet(null, CSSNorm.stdStyleSheet(), DOMAnalyzer.Origin.AGENT); //use the standard style sheet
da.addStyleSheet(null, CSSNorm.userStyleSheet(), DOMAnalyzer.Origin.AGENT); //use the additional style sheet
da.addStyleSheet(null, CSSNorm.formsStyleSheet(), DOMAnalyzer.Origin.AGENT); //render form fields using css
da.getStyleSheets(); //load the author style sheets
BrowserCanvas contentCanvas = new BrowserCanvas(da.getRoot(), da, docSource.getURL());
contentCanvas.setAutoMediaUpdate(false); //we have a correct media specification, do not update
contentCanvas.getConfig().setClipViewport(cropWindow);
contentCanvas.getConfig().setLoadImages(loadImages);
contentCanvas.getConfig().setLoadBackgroundImages(loadBackgroundImages);
if (type == Type.PNG)
{
contentCanvas.createLayout(windowSize);
ImageIO.write(contentCanvas.getImage(), "png", out);
}
else if (type == Type.SVG)
{
setDefaultFonts(contentCanvas.getConfig());
contentCanvas.createLayout(windowSize);
Writer w = new OutputStreamWriter(out, "utf-8");
writeSVG(contentCanvas.getViewport(), w);
w.close();
}
docSource.close();
return true;
} | java | public boolean renderURL(String urlstring, OutputStream out, Type type) throws IOException, SAXException
{
if (!urlstring.startsWith("http:") &&
!urlstring.startsWith("https:") &&
!urlstring.startsWith("ftp:") &&
!urlstring.startsWith("file:"))
urlstring = "http://" + urlstring;
//Open the network connection
DocumentSource docSource = new DefaultDocumentSource(urlstring);
//Parse the input document
DOMSource parser = new DefaultDOMSource(docSource);
Document doc = parser.parse();
//create the media specification
MediaSpec media = new MediaSpec(mediaType);
media.setDimensions(windowSize.width, windowSize.height);
media.setDeviceDimensions(windowSize.width, windowSize.height);
//Create the CSS analyzer
DOMAnalyzer da = new DOMAnalyzer(doc, docSource.getURL());
da.setMediaSpec(media);
da.attributesToStyles(); //convert the HTML presentation attributes to inline styles
da.addStyleSheet(null, CSSNorm.stdStyleSheet(), DOMAnalyzer.Origin.AGENT); //use the standard style sheet
da.addStyleSheet(null, CSSNorm.userStyleSheet(), DOMAnalyzer.Origin.AGENT); //use the additional style sheet
da.addStyleSheet(null, CSSNorm.formsStyleSheet(), DOMAnalyzer.Origin.AGENT); //render form fields using css
da.getStyleSheets(); //load the author style sheets
BrowserCanvas contentCanvas = new BrowserCanvas(da.getRoot(), da, docSource.getURL());
contentCanvas.setAutoMediaUpdate(false); //we have a correct media specification, do not update
contentCanvas.getConfig().setClipViewport(cropWindow);
contentCanvas.getConfig().setLoadImages(loadImages);
contentCanvas.getConfig().setLoadBackgroundImages(loadBackgroundImages);
if (type == Type.PNG)
{
contentCanvas.createLayout(windowSize);
ImageIO.write(contentCanvas.getImage(), "png", out);
}
else if (type == Type.SVG)
{
setDefaultFonts(contentCanvas.getConfig());
contentCanvas.createLayout(windowSize);
Writer w = new OutputStreamWriter(out, "utf-8");
writeSVG(contentCanvas.getViewport(), w);
w.close();
}
docSource.close();
return true;
} | [
"public",
"boolean",
"renderURL",
"(",
"String",
"urlstring",
",",
"OutputStream",
"out",
",",
"Type",
"type",
")",
"throws",
"IOException",
",",
"SAXException",
"{",
"if",
"(",
"!",
"urlstring",
".",
"startsWith",
"(",
"\"http:\"",
")",
"&&",
"!",
"urlstrin... | Renders the URL and prints the result to the specified output stream in the specified
format.
@param urlstring the source URL
@param out output stream
@param type output type
@return true in case of success, false otherwise
@throws SAXException | [
"Renders",
"the",
"URL",
"and",
"prints",
"the",
"result",
"to",
"the",
"specified",
"output",
"stream",
"in",
"the",
"specified",
"format",
"."
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/demo/ImageRenderer.java#L94-L146 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/appdev/PackageUrl.java | PackageUrl.getFileUrl | public static MozuUrl getFileUrl(String applicationKey, String fileName)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/appdev/filebasedpackage/packages/{applicationKey}?fileName={fileName}");
formatter.formatUrl("applicationKey", applicationKey);
formatter.formatUrl("fileName", fileName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | java | public static MozuUrl getFileUrl(String applicationKey, String fileName)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/appdev/filebasedpackage/packages/{applicationKey}?fileName={fileName}");
formatter.formatUrl("applicationKey", applicationKey);
formatter.formatUrl("fileName", fileName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getFileUrl",
"(",
"String",
"applicationKey",
",",
"String",
"fileName",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/appdev/filebasedpackage/packages/{applicationKey}?fileName={fileName}\"",
")",
";"... | Get Resource Url for GetFile
@param applicationKey The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
@param fileName
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetFile"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/appdev/PackageUrl.java#L22-L28 |
kiswanij/jk-util | src/main/java/com/jk/util/JK.java | JK.addToSystemConfig | public static void addToSystemConfig(String prefix, Properties prop) {
for (Entry<Object, Object> entry : prop.entrySet()) {
String key = prefix.concat(entry.getKey().toString());
String value = entry.getValue().toString();
System.setProperty(key, value);
}
} | java | public static void addToSystemConfig(String prefix, Properties prop) {
for (Entry<Object, Object> entry : prop.entrySet()) {
String key = prefix.concat(entry.getKey().toString());
String value = entry.getValue().toString();
System.setProperty(key, value);
}
} | [
"public",
"static",
"void",
"addToSystemConfig",
"(",
"String",
"prefix",
",",
"Properties",
"prop",
")",
"{",
"for",
"(",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"prop",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"pre... | Adds the to system config.
@param prefix the prefix
@param prop the prop | [
"Adds",
"the",
"to",
"system",
"config",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L414-L420 |
ontop/ontop | client/protege/src/main/java/it/unibz/inf/ontop/protege/core/OntopProtegeReasoner.java | OntopProtegeReasoner.getEmptyEntitiesChecker | public QuestOWLEmptyEntitiesChecker getEmptyEntitiesChecker() throws Exception {
OWLOntology rootOntology = getRootOntology();
Ontology mergeOntology = owlapiTranslator.translateAndClassify(rootOntology);
ClassifiedTBox tBox = mergeOntology.tbox();
return new QuestOWLEmptyEntitiesChecker(tBox, owlConnection);
} | java | public QuestOWLEmptyEntitiesChecker getEmptyEntitiesChecker() throws Exception {
OWLOntology rootOntology = getRootOntology();
Ontology mergeOntology = owlapiTranslator.translateAndClassify(rootOntology);
ClassifiedTBox tBox = mergeOntology.tbox();
return new QuestOWLEmptyEntitiesChecker(tBox, owlConnection);
} | [
"public",
"QuestOWLEmptyEntitiesChecker",
"getEmptyEntitiesChecker",
"(",
")",
"throws",
"Exception",
"{",
"OWLOntology",
"rootOntology",
"=",
"getRootOntology",
"(",
")",
";",
"Ontology",
"mergeOntology",
"=",
"owlapiTranslator",
".",
"translateAndClassify",
"(",
"rootOn... | Methods to get the empty concepts and roles in the ontology using the given mappings.
It generates SPARQL queries to check for entities.
@return QuestOWLEmptyEntitiesChecker class to get empty concepts and roles
@throws Exception | [
"Methods",
"to",
"get",
"the",
"empty",
"concepts",
"and",
"roles",
"in",
"the",
"ontology",
"using",
"the",
"given",
"mappings",
".",
"It",
"generates",
"SPARQL",
"queries",
"to",
"check",
"for",
"entities",
"."
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/client/protege/src/main/java/it/unibz/inf/ontop/protege/core/OntopProtegeReasoner.java#L328-L334 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.newTranslet | private void newTranslet(MethodType requestMethod, String requestName, TransletRule transletRule,
Translet parentTranslet) {
translet = new CoreTranslet(transletRule, this);
translet.setRequestName(requestName);
translet.setRequestMethod(requestMethod);
if (parentTranslet != null) {
translet.setProcessResult(parentTranslet.getProcessResult());
}
} | java | private void newTranslet(MethodType requestMethod, String requestName, TransletRule transletRule,
Translet parentTranslet) {
translet = new CoreTranslet(transletRule, this);
translet.setRequestName(requestName);
translet.setRequestMethod(requestMethod);
if (parentTranslet != null) {
translet.setProcessResult(parentTranslet.getProcessResult());
}
} | [
"private",
"void",
"newTranslet",
"(",
"MethodType",
"requestMethod",
",",
"String",
"requestName",
",",
"TransletRule",
"transletRule",
",",
"Translet",
"parentTranslet",
")",
"{",
"translet",
"=",
"new",
"CoreTranslet",
"(",
"transletRule",
",",
"this",
")",
";"... | Create a new {@code CoreTranslet} instance.
@param requestMethod the request method
@param requestName the request name
@param transletRule the translet rule
@param parentTranslet the process result that was created earlier | [
"Create",
"a",
"new",
"{",
"@code",
"CoreTranslet",
"}",
"instance",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L622-L630 |
unic/neba | core/src/main/java/io/neba/core/resourcemodels/mapping/FieldValueMappingCallback.java | FieldValueMappingCallback.postProcessResolvedValue | private Object postProcessResolvedValue(FieldData fieldData, Object value) {
// For convenience, NEBA guarantees that any mappable collection-typed field is never <code>null</code> but rather
// an empty collection, in case no non-<code>null</code> default value was provided and the field is not Lazy.
boolean preventNullCollection =
value == null &&
!fieldData.metaData.isLazy() &&
fieldData.metaData.isInstantiableCollectionType() &&
getField(fieldData) == null;
@SuppressWarnings("unchecked")
Object defaultValue = preventNullCollection ? instantiateCollectionType((Class<Collection>) fieldData.metaData.getType()) : null;
// Provide the custom mappers with the default value in case of empty collections for convenience
value = applyCustomMappings(fieldData, value == null ? defaultValue : value);
return value == null ? defaultValue : value;
} | java | private Object postProcessResolvedValue(FieldData fieldData, Object value) {
// For convenience, NEBA guarantees that any mappable collection-typed field is never <code>null</code> but rather
// an empty collection, in case no non-<code>null</code> default value was provided and the field is not Lazy.
boolean preventNullCollection =
value == null &&
!fieldData.metaData.isLazy() &&
fieldData.metaData.isInstantiableCollectionType() &&
getField(fieldData) == null;
@SuppressWarnings("unchecked")
Object defaultValue = preventNullCollection ? instantiateCollectionType((Class<Collection>) fieldData.metaData.getType()) : null;
// Provide the custom mappers with the default value in case of empty collections for convenience
value = applyCustomMappings(fieldData, value == null ? defaultValue : value);
return value == null ? defaultValue : value;
} | [
"private",
"Object",
"postProcessResolvedValue",
"(",
"FieldData",
"fieldData",
",",
"Object",
"value",
")",
"{",
"// For convenience, NEBA guarantees that any mappable collection-typed field is never <code>null</code> but rather",
"// an empty collection, in case no non-<code>null</code> de... | Implements the NEBA contracts for fields, for instance guarantees that collection-typed fields are never <code>null</code>. Applies
{@link AnnotatedFieldMapper custom field mappers}.
@param fieldData must not be <code>null</code>.
@param value can be <code>null</code>.
@return the post-processed value, can be <code>null</code>. | [
"Implements",
"the",
"NEBA",
"contracts",
"for",
"fields",
"for",
"instance",
"guarantees",
"that",
"collection",
"-",
"typed",
"fields",
"are",
"never",
"<code",
">",
"null<",
"/",
"code",
">",
".",
"Applies",
"{",
"@link",
"AnnotatedFieldMapper",
"custom",
"... | train | https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/resourcemodels/mapping/FieldValueMappingCallback.java#L154-L170 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java | base_resource.unset_request | private base_response unset_request(nitro_service service, options option, String args[]) throws Exception
{
String sessionid = service.get_sessionid();
String request = unset_string(service, sessionid, option, args);
return post_data(service,request);
} | java | private base_response unset_request(nitro_service service, options option, String args[]) throws Exception
{
String sessionid = service.get_sessionid();
String request = unset_string(service, sessionid, option, args);
return post_data(service,request);
} | [
"private",
"base_response",
"unset_request",
"(",
"nitro_service",
"service",
",",
"options",
"option",
",",
"String",
"args",
"[",
"]",
")",
"throws",
"Exception",
"{",
"String",
"sessionid",
"=",
"service",
".",
"get_sessionid",
"(",
")",
";",
"String",
"req... | Use this method to perform an Unset operation on netscaler resource.
@param service nitro_service object.
@param option options class object.
@param args string.
@return status of the operation performed.
@throws Exception | [
"Use",
"this",
"method",
"to",
"perform",
"an",
"Unset",
"operation",
"on",
"netscaler",
"resource",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L139-L144 |
google/closure-compiler | src/com/google/javascript/jscomp/DependencyOptions.java | DependencyOptions.pruneForEntryPoints | public static DependencyOptions pruneForEntryPoints(Iterable<ModuleIdentifier> entryPoints) {
checkState(
!Iterables.isEmpty(entryPoints), "DependencyMode.PRUNE requires at least one entry point");
return new AutoValue_DependencyOptions(DependencyMode.PRUNE, ImmutableList.copyOf(entryPoints));
} | java | public static DependencyOptions pruneForEntryPoints(Iterable<ModuleIdentifier> entryPoints) {
checkState(
!Iterables.isEmpty(entryPoints), "DependencyMode.PRUNE requires at least one entry point");
return new AutoValue_DependencyOptions(DependencyMode.PRUNE, ImmutableList.copyOf(entryPoints));
} | [
"public",
"static",
"DependencyOptions",
"pruneForEntryPoints",
"(",
"Iterable",
"<",
"ModuleIdentifier",
">",
"entryPoints",
")",
"{",
"checkState",
"(",
"!",
"Iterables",
".",
"isEmpty",
"(",
"entryPoints",
")",
",",
"\"DependencyMode.PRUNE requires at least one entry p... | Returns a {@link DependencyOptions} using the {@link DependencyMode#PRUNE} mode with the given
entry points. | [
"Returns",
"a",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DependencyOptions.java#L142-L146 |
paoding-code/paoding-rose | paoding-rose-web/src/main/java/net/paoding/rose/web/impl/thread/ModuleEngine.java | ModuleEngine.cleanupMultipart | protected void cleanupMultipart(Invocation inv) {
HttpServletRequest src = inv.getRequest();
while (src != null && !(src instanceof MultipartHttpServletRequest)
&& src instanceof HttpServletRequestWrapper) {
src = (HttpServletRequest) ((HttpServletRequestWrapper) src).getRequest();
}
if (src instanceof MultipartHttpServletRequest) {
final MultipartHttpServletRequest request = (MultipartHttpServletRequest) src;
MultipartCleanup multipartCleaner = inv.getMethod().getAnnotation(
MultipartCleanup.class);
if (multipartCleaner == null
|| multipartCleaner.after() == MultipartCleanup.After.CONTROLLER_INVOCATION) {
multipartResolver.cleanupMultipart(request);
} else {
inv.addAfterCompletion(new AfterCompletion() {
@Override
public void afterCompletion(Invocation inv, Throwable ex) throws Exception {
ModuleEngine.this.multipartResolver.cleanupMultipart(request);
}
});
}
}
} | java | protected void cleanupMultipart(Invocation inv) {
HttpServletRequest src = inv.getRequest();
while (src != null && !(src instanceof MultipartHttpServletRequest)
&& src instanceof HttpServletRequestWrapper) {
src = (HttpServletRequest) ((HttpServletRequestWrapper) src).getRequest();
}
if (src instanceof MultipartHttpServletRequest) {
final MultipartHttpServletRequest request = (MultipartHttpServletRequest) src;
MultipartCleanup multipartCleaner = inv.getMethod().getAnnotation(
MultipartCleanup.class);
if (multipartCleaner == null
|| multipartCleaner.after() == MultipartCleanup.After.CONTROLLER_INVOCATION) {
multipartResolver.cleanupMultipart(request);
} else {
inv.addAfterCompletion(new AfterCompletion() {
@Override
public void afterCompletion(Invocation inv, Throwable ex) throws Exception {
ModuleEngine.this.multipartResolver.cleanupMultipart(request);
}
});
}
}
} | [
"protected",
"void",
"cleanupMultipart",
"(",
"Invocation",
"inv",
")",
"{",
"HttpServletRequest",
"src",
"=",
"inv",
".",
"getRequest",
"(",
")",
";",
"while",
"(",
"src",
"!=",
"null",
"&&",
"!",
"(",
"src",
"instanceof",
"MultipartHttpServletRequest",
")",
... | Clean up any resources used by the given multipart request (if any).
@see MultipartResolver#cleanupMultipart | [
"Clean",
"up",
"any",
"resources",
"used",
"by",
"the",
"given",
"multipart",
"request",
"(",
"if",
"any",
")",
"."
] | train | https://github.com/paoding-code/paoding-rose/blob/8b512704174dd6cba95e544c7d6ab66105cb8ec4/paoding-rose-web/src/main/java/net/paoding/rose/web/impl/thread/ModuleEngine.java#L219-L243 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsListItem.java | CmsListItem.addDecoration | protected void addDecoration(Widget widget, int width, boolean first) {
m_decorationWidgets.add(widget);
m_decorationWidth += width;
} | java | protected void addDecoration(Widget widget, int width, boolean first) {
m_decorationWidgets.add(widget);
m_decorationWidth += width;
} | [
"protected",
"void",
"addDecoration",
"(",
"Widget",
"widget",
",",
"int",
"width",
",",
"boolean",
"first",
")",
"{",
"m_decorationWidgets",
".",
"add",
"(",
"widget",
")",
";",
"m_decorationWidth",
"+=",
"width",
";",
"}"
] | Helper method for adding a decoration widget and updating the decoration width accordingly.<p>
@param widget the decoration widget to add
@param width the intended width of the decoration widget
@param first if true, inserts the widget at the front of the decorations, else at the end. | [
"Helper",
"method",
"for",
"adding",
"a",
"decoration",
"widget",
"and",
"updating",
"the",
"decoration",
"width",
"accordingly",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItem.java#L585-L589 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CProductLocalServiceBaseImpl.java | CProductLocalServiceBaseImpl.fetchCProductByUuidAndGroupId | @Override
public CProduct fetchCProductByUuidAndGroupId(String uuid, long groupId) {
return cProductPersistence.fetchByUUID_G(uuid, groupId);
} | java | @Override
public CProduct fetchCProductByUuidAndGroupId(String uuid, long groupId) {
return cProductPersistence.fetchByUUID_G(uuid, groupId);
} | [
"@",
"Override",
"public",
"CProduct",
"fetchCProductByUuidAndGroupId",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"cProductPersistence",
".",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"}"
] | Returns the c product matching the UUID and group.
@param uuid the c product's UUID
@param groupId the primary key of the group
@return the matching c product, or <code>null</code> if a matching c product could not be found | [
"Returns",
"the",
"c",
"product",
"matching",
"the",
"UUID",
"and",
"group",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CProductLocalServiceBaseImpl.java#L250-L253 |
zxing/zxing | core/src/main/java/com/google/zxing/pdf417/decoder/PDF417ScanningDecoder.java | PDF417ScanningDecoder.correctErrors | private static int correctErrors(int[] codewords, int[] erasures, int numECCodewords) throws ChecksumException {
if (erasures != null &&
erasures.length > numECCodewords / 2 + MAX_ERRORS ||
numECCodewords < 0 ||
numECCodewords > MAX_EC_CODEWORDS) {
// Too many errors or EC Codewords is corrupted
throw ChecksumException.getChecksumInstance();
}
return errorCorrection.decode(codewords, numECCodewords, erasures);
} | java | private static int correctErrors(int[] codewords, int[] erasures, int numECCodewords) throws ChecksumException {
if (erasures != null &&
erasures.length > numECCodewords / 2 + MAX_ERRORS ||
numECCodewords < 0 ||
numECCodewords > MAX_EC_CODEWORDS) {
// Too many errors or EC Codewords is corrupted
throw ChecksumException.getChecksumInstance();
}
return errorCorrection.decode(codewords, numECCodewords, erasures);
} | [
"private",
"static",
"int",
"correctErrors",
"(",
"int",
"[",
"]",
"codewords",
",",
"int",
"[",
"]",
"erasures",
",",
"int",
"numECCodewords",
")",
"throws",
"ChecksumException",
"{",
"if",
"(",
"erasures",
"!=",
"null",
"&&",
"erasures",
".",
"length",
"... | <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
correct the errors in-place.</p>
@param codewords data and error correction codewords
@param erasures positions of any known erasures
@param numECCodewords number of error correction codewords that are available in codewords
@throws ChecksumException if error correction fails | [
"<p",
">",
"Given",
"data",
"and",
"error",
"-",
"correction",
"codewords",
"received",
"possibly",
"corrupted",
"by",
"errors",
"attempts",
"to",
"correct",
"the",
"errors",
"in",
"-",
"place",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/PDF417ScanningDecoder.java#L549-L558 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java | ObjectParameter.parseClassParameter | private Object parseClassParameter(final String serializedObject) {
Object res = null;
try {
res = Class.forName(serializedObject);
} catch (final ClassNotFoundException e) {
throw new CoreRuntimeException("Impossible to load class " + serializedObject, e);
}
return res;
} | java | private Object parseClassParameter(final String serializedObject) {
Object res = null;
try {
res = Class.forName(serializedObject);
} catch (final ClassNotFoundException e) {
throw new CoreRuntimeException("Impossible to load class " + serializedObject, e);
}
return res;
} | [
"private",
"Object",
"parseClassParameter",
"(",
"final",
"String",
"serializedObject",
")",
"{",
"Object",
"res",
"=",
"null",
";",
"try",
"{",
"res",
"=",
"Class",
".",
"forName",
"(",
"serializedObject",
")",
";",
"}",
"catch",
"(",
"final",
"ClassNotFoun... | Parse a class definition by calling Class.forName.
@param serializedObject the full class name
@return the class object | [
"Parse",
"a",
"class",
"definition",
"by",
"calling",
"Class",
".",
"forName",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ObjectParameter.java#L162-L170 |
google/error-prone | core/src/main/java/com/google/errorprone/refaster/UTemplater.java | UTemplater.createTemplate | public static Template<?> createTemplate(Context context, MethodTree decl) {
MethodSymbol declSym = ASTHelpers.getSymbol(decl);
ImmutableClassToInstanceMap<Annotation> annotations = UTemplater.annotationMap(declSym);
ImmutableMap<String, VarSymbol> freeExpressionVars = freeExpressionVariables(decl);
Context subContext = new SubContext(context);
final UTemplater templater = new UTemplater(freeExpressionVars, subContext);
ImmutableMap<String, UType> expressionVarTypes =
ImmutableMap.copyOf(
Maps.transformValues(
freeExpressionVars, (VarSymbol sym) -> templater.template(sym.type)));
UType genericType = templater.template(declSym.type);
List<UTypeVar> typeParameters;
UMethodType methodType;
if (genericType instanceof UForAll) {
UForAll forAllType = (UForAll) genericType;
typeParameters = forAllType.getTypeVars();
methodType = (UMethodType) forAllType.getQuantifiedType();
} else if (genericType instanceof UMethodType) {
typeParameters = ImmutableList.of();
methodType = (UMethodType) genericType;
} else {
throw new IllegalArgumentException(
"Expected genericType to be either a ForAll or a UMethodType, but was " + genericType);
}
List<? extends StatementTree> bodyStatements = decl.getBody().getStatements();
if (bodyStatements.size() == 1
&& Iterables.getOnlyElement(bodyStatements).getKind() == Kind.RETURN
&& context.get(REQUIRE_BLOCK_KEY) == null) {
ExpressionTree expression =
((ReturnTree) Iterables.getOnlyElement(bodyStatements)).getExpression();
return ExpressionTemplate.create(
annotations,
typeParameters,
expressionVarTypes,
templater.template(expression),
methodType.getReturnType());
} else {
List<UStatement> templateStatements = new ArrayList<>();
for (StatementTree statement : bodyStatements) {
templateStatements.add(templater.template(statement));
}
return BlockTemplate.create(
annotations, typeParameters, expressionVarTypes, templateStatements);
}
} | java | public static Template<?> createTemplate(Context context, MethodTree decl) {
MethodSymbol declSym = ASTHelpers.getSymbol(decl);
ImmutableClassToInstanceMap<Annotation> annotations = UTemplater.annotationMap(declSym);
ImmutableMap<String, VarSymbol> freeExpressionVars = freeExpressionVariables(decl);
Context subContext = new SubContext(context);
final UTemplater templater = new UTemplater(freeExpressionVars, subContext);
ImmutableMap<String, UType> expressionVarTypes =
ImmutableMap.copyOf(
Maps.transformValues(
freeExpressionVars, (VarSymbol sym) -> templater.template(sym.type)));
UType genericType = templater.template(declSym.type);
List<UTypeVar> typeParameters;
UMethodType methodType;
if (genericType instanceof UForAll) {
UForAll forAllType = (UForAll) genericType;
typeParameters = forAllType.getTypeVars();
methodType = (UMethodType) forAllType.getQuantifiedType();
} else if (genericType instanceof UMethodType) {
typeParameters = ImmutableList.of();
methodType = (UMethodType) genericType;
} else {
throw new IllegalArgumentException(
"Expected genericType to be either a ForAll or a UMethodType, but was " + genericType);
}
List<? extends StatementTree> bodyStatements = decl.getBody().getStatements();
if (bodyStatements.size() == 1
&& Iterables.getOnlyElement(bodyStatements).getKind() == Kind.RETURN
&& context.get(REQUIRE_BLOCK_KEY) == null) {
ExpressionTree expression =
((ReturnTree) Iterables.getOnlyElement(bodyStatements)).getExpression();
return ExpressionTemplate.create(
annotations,
typeParameters,
expressionVarTypes,
templater.template(expression),
methodType.getReturnType());
} else {
List<UStatement> templateStatements = new ArrayList<>();
for (StatementTree statement : bodyStatements) {
templateStatements.add(templater.template(statement));
}
return BlockTemplate.create(
annotations, typeParameters, expressionVarTypes, templateStatements);
}
} | [
"public",
"static",
"Template",
"<",
"?",
">",
"createTemplate",
"(",
"Context",
"context",
",",
"MethodTree",
"decl",
")",
"{",
"MethodSymbol",
"declSym",
"=",
"ASTHelpers",
".",
"getSymbol",
"(",
"decl",
")",
";",
"ImmutableClassToInstanceMap",
"<",
"Annotatio... | Returns a template based on a method. One-line methods starting with a {@code return} statement
are guessed to be expression templates, and all other methods are guessed to be block
templates. | [
"Returns",
"a",
"template",
"based",
"on",
"a",
"method",
".",
"One",
"-",
"line",
"methods",
"starting",
"with",
"a",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/refaster/UTemplater.java#L141-L187 |
b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optLong | public long optLong(int index, long defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
return val.longValue();
} | java | public long optLong(int index, long defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
return val.longValue();
} | [
"public",
"long",
"optLong",
"(",
"int",
"index",
",",
"long",
"defaultValue",
")",
"{",
"final",
"Number",
"val",
"=",
"this",
".",
"optNumber",
"(",
"index",
",",
"null",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"defaultValue",
... | Get the optional long value associated with an index. The defaultValue is
returned if there is no value for the index, or if the value is not a
number and cannot be converted to a number.
@param index
The index must be between 0 and length() - 1.
@param defaultValue
The default value.
@return The value. | [
"Get",
"the",
"optional",
"long",
"value",
"associated",
"with",
"an",
"index",
".",
"The",
"defaultValue",
"is",
"returned",
"if",
"there",
"is",
"no",
"value",
"for",
"the",
"index",
"or",
"if",
"the",
"value",
"is",
"not",
"a",
"number",
"and",
"canno... | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L784-L790 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.cut | public static void cut(InputStream srcStream, OutputStream destStream, Rectangle rectangle) {
cut(read(srcStream), destStream, rectangle);
} | java | public static void cut(InputStream srcStream, OutputStream destStream, Rectangle rectangle) {
cut(read(srcStream), destStream, rectangle);
} | [
"public",
"static",
"void",
"cut",
"(",
"InputStream",
"srcStream",
",",
"OutputStream",
"destStream",
",",
"Rectangle",
"rectangle",
")",
"{",
"cut",
"(",
"read",
"(",
"srcStream",
")",
",",
"destStream",
",",
"rectangle",
")",
";",
"}"
] | 图像切割(按指定起点坐标和宽高切割),此方法并不关闭流
@param srcStream 源图像流
@param destStream 切片后的图像输出流
@param rectangle 矩形对象,表示矩形区域的x,y,width,height
@since 3.1.0 | [
"图像切割",
"(",
"按指定起点坐标和宽高切割",
")",
",此方法并不关闭流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L268-L270 |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONGetter.java | JSONGetter.getStrEscaped | public String getStrEscaped(K key, String defaultValue) {
return JSONUtil.escape(getStr(key, defaultValue));
} | java | public String getStrEscaped(K key, String defaultValue) {
return JSONUtil.escape(getStr(key, defaultValue));
} | [
"public",
"String",
"getStrEscaped",
"(",
"K",
"key",
",",
"String",
"defaultValue",
")",
"{",
"return",
"JSONUtil",
".",
"escape",
"(",
"getStr",
"(",
"key",
",",
"defaultValue",
")",
")",
";",
"}"
] | 获取字符串类型值,并转义不可见字符,如'\n'换行符会被转义为字符串"\n"
@param key 键
@param defaultValue 默认值
@return 字符串类型值
@since 4.2.2 | [
"获取字符串类型值,并转义不可见字符,如",
"\\",
"n",
"换行符会被转义为字符串",
"\\",
"n"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONGetter.java#L43-L45 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/annotation/AuditAnnotationAttributes.java | AuditAnnotationAttributes.getTag | private String getTag(final Annotation[] annotations, final Method method) {
for (final Annotation annotation : annotations) {
if (annotation instanceof Audit) {
final Audit audit = (Audit) annotation;
return audit.tag();
}
}
return null;
} | java | private String getTag(final Annotation[] annotations, final Method method) {
for (final Annotation annotation : annotations) {
if (annotation instanceof Audit) {
final Audit audit = (Audit) annotation;
return audit.tag();
}
}
return null;
} | [
"private",
"String",
"getTag",
"(",
"final",
"Annotation",
"[",
"]",
"annotations",
",",
"final",
"Method",
"method",
")",
"{",
"for",
"(",
"final",
"Annotation",
"annotation",
":",
"annotations",
")",
"{",
"if",
"(",
"annotation",
"instanceof",
"Audit",
")"... | Gets the repository.
@param annotations the annotations
@param method the method
@return the repository | [
"Gets",
"the",
"repository",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/annotation/AuditAnnotationAttributes.java#L190-L198 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/print/AdvancedPageNumberEvents.java | AdvancedPageNumberEvents.onCloseDocument | @Override
public void onCloseDocument(final PdfWriter writer, final Document document) {
template.beginText();
template.setFontAndSize(bf, 8);
template.showText(String.valueOf(writer.getPageNumber() - 1));
template.endText();
} | java | @Override
public void onCloseDocument(final PdfWriter writer, final Document document) {
template.beginText();
template.setFontAndSize(bf, 8);
template.showText(String.valueOf(writer.getPageNumber() - 1));
template.endText();
} | [
"@",
"Override",
"public",
"void",
"onCloseDocument",
"(",
"final",
"PdfWriter",
"writer",
",",
"final",
"Document",
"document",
")",
"{",
"template",
".",
"beginText",
"(",
")",
";",
"template",
".",
"setFontAndSize",
"(",
"bf",
",",
"8",
")",
";",
"templ... | we override the onCloseDocument method.
@param writer
PdfWriter
@param document
Document | [
"we",
"override",
"the",
"onCloseDocument",
"method",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/AdvancedPageNumberEvents.java#L134-L140 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/AmountFormats.java | AmountFormats.iso8601 | public static String iso8601(Period period, Duration duration) {
Objects.requireNonNull(period, "period must not be null");
Objects.requireNonNull(duration, "duration must not be null");
if (period.isZero()) {
return duration.toString();
}
if (duration.isZero()) {
return period.toString();
}
return period.toString() + duration.toString().substring(1);
} | java | public static String iso8601(Period period, Duration duration) {
Objects.requireNonNull(period, "period must not be null");
Objects.requireNonNull(duration, "duration must not be null");
if (period.isZero()) {
return duration.toString();
}
if (duration.isZero()) {
return period.toString();
}
return period.toString() + duration.toString().substring(1);
} | [
"public",
"static",
"String",
"iso8601",
"(",
"Period",
"period",
",",
"Duration",
"duration",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"period",
",",
"\"period must not be null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"duration",
",",
"\"dur... | Formats a period and duration to a string in ISO-8601 format.
<p>
To obtain the ISO-8601 format of a {@code Period} or {@code Duration}
individually, simply call {@code toString()}.
See also {@link PeriodDuration}.
@param period the period to format
@param duration the duration to format
@return the ISO-8601 format for the period and duration | [
"Formats",
"a",
"period",
"and",
"duration",
"to",
"a",
"string",
"in",
"ISO",
"-",
"8601",
"format",
".",
"<p",
">",
"To",
"obtain",
"the",
"ISO",
"-",
"8601",
"format",
"of",
"a",
"{",
"@code",
"Period",
"}",
"or",
"{",
"@code",
"Duration",
"}",
... | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/AmountFormats.java#L149-L159 |
Comcast/jrugged | jrugged-core/src/main/java/org/fishwife/jrugged/ConstantFlowRegulator.java | ConstantFlowRegulator.invoke | public <T> T invoke(Runnable r, T result) throws Exception {
if (canProceed()) {
r.run();
return result;
}
else {
throw mapException(new FlowRateExceededException());
}
} | java | public <T> T invoke(Runnable r, T result) throws Exception {
if (canProceed()) {
r.run();
return result;
}
else {
throw mapException(new FlowRateExceededException());
}
} | [
"public",
"<",
"T",
">",
"T",
"invoke",
"(",
"Runnable",
"r",
",",
"T",
"result",
")",
"throws",
"Exception",
"{",
"if",
"(",
"canProceed",
"(",
")",
")",
"{",
"r",
".",
"run",
"(",
")",
";",
"return",
"result",
";",
"}",
"else",
"{",
"throw",
... | Wrap the given service call with the {@link ConstantFlowRegulator}
protection logic.
@param r the {@link Runnable} to attempt
@param result what to return after <code>r</code> succeeds
@return result
@throws FlowRateExceededException if the total requests per second
through the flow regulator exceeds the configured value
@throws Exception if <code>c</code> throws one during
execution | [
"Wrap",
"the",
"given",
"service",
"call",
"with",
"the",
"{",
"@link",
"ConstantFlowRegulator",
"}",
"protection",
"logic",
".",
"@param",
"r",
"the",
"{",
"@link",
"Runnable",
"}",
"to",
"attempt",
"@param",
"result",
"what",
"to",
"return",
"after",
"<cod... | train | https://github.com/Comcast/jrugged/blob/b6a5147c68ee733faf5616d49800abcbba67afe9/jrugged-core/src/main/java/org/fishwife/jrugged/ConstantFlowRegulator.java#L107-L115 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPTaxCategoryWrapper.java | CPTaxCategoryWrapper.getDescription | @Override
public String getDescription(String languageId, boolean useDefault) {
return _cpTaxCategory.getDescription(languageId, useDefault);
} | java | @Override
public String getDescription(String languageId, boolean useDefault) {
return _cpTaxCategory.getDescription(languageId, useDefault);
} | [
"@",
"Override",
"public",
"String",
"getDescription",
"(",
"String",
"languageId",
",",
"boolean",
"useDefault",
")",
"{",
"return",
"_cpTaxCategory",
".",
"getDescription",
"(",
"languageId",
",",
"useDefault",
")",
";",
"}"
] | Returns the localized description of this cp tax category in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@param useDefault whether to use the default language if no localization exists for the requested language
@return the localized description of this cp tax category | [
"Returns",
"the",
"localized",
"description",
"of",
"this",
"cp",
"tax",
"category",
"in",
"the",
"language",
"optionally",
"using",
"the",
"default",
"language",
"if",
"no",
"localization",
"exists",
"for",
"the",
"requested",
"language",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPTaxCategoryWrapper.java#L232-L235 |
kotcrab/vis-ui | ui/src/main/java/com/kotcrab/vis/ui/util/ColorUtils.java | ColorUtils.HSVtoRGB | public static Color HSVtoRGB (float h, float s, float v) {
Color c = new Color(1, 1, 1, 1);
HSVtoRGB(h, s, v, c);
return c;
} | java | public static Color HSVtoRGB (float h, float s, float v) {
Color c = new Color(1, 1, 1, 1);
HSVtoRGB(h, s, v, c);
return c;
} | [
"public",
"static",
"Color",
"HSVtoRGB",
"(",
"float",
"h",
",",
"float",
"s",
",",
"float",
"v",
")",
"{",
"Color",
"c",
"=",
"new",
"Color",
"(",
"1",
",",
"1",
",",
"1",
",",
"1",
")",
";",
"HSVtoRGB",
"(",
"h",
",",
"s",
",",
"v",
",",
... | Converts HSV color system to RGB
@param h hue 0-360
@param s saturation 0-100
@param v value 0-100
@return RGB values in LibGDX {@link Color} class | [
"Converts",
"HSV",
"color",
"system",
"to",
"RGB"
] | train | https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/ColorUtils.java#L49-L53 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java | AmazonSQSMessagingClientWrapper.deleteMessageBatch | public DeleteMessageBatchResult deleteMessageBatch(DeleteMessageBatchRequest deleteMessageBatchRequest) throws JMSException {
try {
prepareRequest(deleteMessageBatchRequest);
return amazonSQSClient.deleteMessageBatch(deleteMessageBatchRequest);
} catch (AmazonClientException e) {
throw handleException(e, "deleteMessageBatch");
}
} | java | public DeleteMessageBatchResult deleteMessageBatch(DeleteMessageBatchRequest deleteMessageBatchRequest) throws JMSException {
try {
prepareRequest(deleteMessageBatchRequest);
return amazonSQSClient.deleteMessageBatch(deleteMessageBatchRequest);
} catch (AmazonClientException e) {
throw handleException(e, "deleteMessageBatch");
}
} | [
"public",
"DeleteMessageBatchResult",
"deleteMessageBatch",
"(",
"DeleteMessageBatchRequest",
"deleteMessageBatchRequest",
")",
"throws",
"JMSException",
"{",
"try",
"{",
"prepareRequest",
"(",
"deleteMessageBatchRequest",
")",
";",
"return",
"amazonSQSClient",
".",
"deleteMe... | Calls <code>deleteMessageBatch</code> and wraps
<code>AmazonClientException</code>. This is used to acknowledge multiple
messages on client_acknowledge mode, so that they can be deleted from SQS
queue.
@param deleteMessageBatchRequest
Container for the necessary parameters to execute the
deleteMessageBatch service method on AmazonSQS. This is the
batch version of deleteMessage. Max batch size is 10.
@return The response from the deleteMessageBatch service method, as
returned by AmazonSQS
@throws JMSException | [
"Calls",
"<code",
">",
"deleteMessageBatch<",
"/",
"code",
">",
"and",
"wraps",
"<code",
">",
"AmazonClientException<",
"/",
"code",
">",
".",
"This",
"is",
"used",
"to",
"acknowledge",
"multiple",
"messages",
"on",
"client_acknowledge",
"mode",
"so",
"that",
... | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L179-L186 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spy1st | public static <T1, T2> BiPredicate<T1, T2> spy1st(BiPredicate<T1, T2> predicate, Box<T1> param1) {
return spy(predicate, Box.<Boolean>empty(), param1, Box.<T2>empty());
} | java | public static <T1, T2> BiPredicate<T1, T2> spy1st(BiPredicate<T1, T2> predicate, Box<T1> param1) {
return spy(predicate, Box.<Boolean>empty(), param1, Box.<T2>empty());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiPredicate",
"<",
"T1",
",",
"T2",
">",
"spy1st",
"(",
"BiPredicate",
"<",
"T1",
",",
"T2",
">",
"predicate",
",",
"Box",
"<",
"T1",
">",
"param1",
")",
"{",
"return",
"spy",
"(",
"predicate",
",",
... | Proxies a binary predicate spying for first parameter
@param <T1> the predicate first parameter type
@param <T2> the predicate second parameter type
@param predicate the predicate that will be spied
@param param1 a box that will be containing the first spied parameter
@return the proxied predicate | [
"Proxies",
"a",
"binary",
"predicate",
"spying",
"for",
"first",
"parameter"
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L469-L471 |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CountedCompleter.java | CountedCompleter.propagateCompletion | public final void propagateCompletion() {
CountedCompleter<?> a = this, s;
for (int c;;) {
if ((c = a.pending) == 0) {
if ((a = (s = a).completer) == null) {
s.quietlyComplete();
return;
}
} else if (U.compareAndSwapInt(a, PENDING, c, c - 1))
return;
}
} | java | public final void propagateCompletion() {
CountedCompleter<?> a = this, s;
for (int c;;) {
if ((c = a.pending) == 0) {
if ((a = (s = a).completer) == null) {
s.quietlyComplete();
return;
}
} else if (U.compareAndSwapInt(a, PENDING, c, c - 1))
return;
}
} | [
"public",
"final",
"void",
"propagateCompletion",
"(",
")",
"{",
"CountedCompleter",
"<",
"?",
">",
"a",
"=",
"this",
",",
"s",
";",
"for",
"(",
"int",
"c",
";",
";",
")",
"{",
"if",
"(",
"(",
"c",
"=",
"a",
".",
"pending",
")",
"==",
"0",
")",... | Equivalent to {@link #tryComplete} but does not invoke {@link #onCompletion(CountedCompleter)}
along the completion path: If the pending count is nonzero, decrements the count; otherwise,
similarly tries to complete this task's completer, if one exists, else marks this task as
complete. This method may be useful in cases where {@code onCompletion} should not, or need
not, be invoked for each completer in a computation. | [
"Equivalent",
"to",
"{"
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CountedCompleter.java#L567-L578 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java | CacheStatsModule.onInvalidate | public void onInvalidate(String template, int cause, int locality, int source) {
final String methodName = "onInvalidate()";
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " template=" + template + " cause=" + cause + " locality=" + locality
+ " source=" + source);
batchOnInvalidate(template, cause, locality, source, 1);
return;
} | java | public void onInvalidate(String template, int cause, int locality, int source) {
final String methodName = "onInvalidate()";
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " template=" + template + " cause=" + cause + " locality=" + locality
+ " source=" + source);
batchOnInvalidate(template, cause, locality, source, 1);
return;
} | [
"public",
"void",
"onInvalidate",
"(",
"String",
"template",
",",
"int",
"cause",
",",
"int",
"locality",
",",
"int",
"source",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"onInvalidate()\"",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")"... | /*
Updates statistics for all types of invalidations - timeout, LRU, explicit invalidations
@param template the template of the cache entry. The template cannot be null for Servlet cache.
@param cause the cause of invalidation
@param locality whether the invalidation occurred on disk, in memory, or neither
@param source whether the invalidation was generated internally or remotely
@param dels number of invalidations that occurred | [
"/",
"*",
"Updates",
"statistics",
"for",
"all",
"types",
"of",
"invalidations",
"-",
"timeout",
"LRU",
"explicit",
"invalidations"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java#L1002-L1009 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/SubGraphPredicate.java | SubGraphPredicate.getSubGraph | public SubGraph getSubGraph(SameDiff sd, DifferentialFunction rootFn){
Preconditions.checkState(matches(sd, rootFn), "Root function does not match predicate");
List<DifferentialFunction> childNodes = new ArrayList<>();
//Need to work out child nodes
if(!opInputSubgraphPredicates.isEmpty()){
for(Map.Entry<Integer,OpPredicate> entry : opInputSubgraphPredicates.entrySet()){
OpPredicate p2 = entry.getValue();
SDVariable arg = rootFn.arg(entry.getKey());
DifferentialFunction df = sd.getVariableOutputFunction(arg.getVarName());
if(df != null){
childNodes.add(df);
if(p2 instanceof SubGraphPredicate){
SubGraph sg = ((SubGraphPredicate) p2).getSubGraph(sd, df);
childNodes.addAll(sg.childNodes);
}
}
}
}
SubGraph sg = SubGraph.builder()
.sameDiff(sd)
.rootNode(rootFn)
.childNodes(childNodes)
.build();
return sg;
} | java | public SubGraph getSubGraph(SameDiff sd, DifferentialFunction rootFn){
Preconditions.checkState(matches(sd, rootFn), "Root function does not match predicate");
List<DifferentialFunction> childNodes = new ArrayList<>();
//Need to work out child nodes
if(!opInputSubgraphPredicates.isEmpty()){
for(Map.Entry<Integer,OpPredicate> entry : opInputSubgraphPredicates.entrySet()){
OpPredicate p2 = entry.getValue();
SDVariable arg = rootFn.arg(entry.getKey());
DifferentialFunction df = sd.getVariableOutputFunction(arg.getVarName());
if(df != null){
childNodes.add(df);
if(p2 instanceof SubGraphPredicate){
SubGraph sg = ((SubGraphPredicate) p2).getSubGraph(sd, df);
childNodes.addAll(sg.childNodes);
}
}
}
}
SubGraph sg = SubGraph.builder()
.sameDiff(sd)
.rootNode(rootFn)
.childNodes(childNodes)
.build();
return sg;
} | [
"public",
"SubGraph",
"getSubGraph",
"(",
"SameDiff",
"sd",
",",
"DifferentialFunction",
"rootFn",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"matches",
"(",
"sd",
",",
"rootFn",
")",
",",
"\"Root function does not match predicate\"",
")",
";",
"List",
"<"... | Get the SubGraph that matches the predicate
@param sd SameDiff instance the function belongs to
@param rootFn Function that defines the root of the subgraph
@return The subgraph that matches the predicate | [
"Get",
"the",
"SubGraph",
"that",
"matches",
"the",
"predicate"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/SubGraphPredicate.java#L97-L125 |
davetcc/tcMenu | tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/PluginFileDependency.java | PluginFileDependency.fileInTcMenu | public static PluginFileDependency fileInTcMenu(String file) {
return new PluginFileDependency(file, PackagingType.WITHIN_TCMENU, Map.of());
} | java | public static PluginFileDependency fileInTcMenu(String file) {
return new PluginFileDependency(file, PackagingType.WITHIN_TCMENU, Map.of());
} | [
"public",
"static",
"PluginFileDependency",
"fileInTcMenu",
"(",
"String",
"file",
")",
"{",
"return",
"new",
"PluginFileDependency",
"(",
"file",
",",
"PackagingType",
".",
"WITHIN_TCMENU",
",",
"Map",
".",
"of",
"(",
")",
")",
";",
"}"
] | Creates an instance of the class that indicates the file is within tcMenu itself. Don't use for
new plugins, prefer to package arduino code in the plugin or a new library.
@param file the file name
@return a new instance | [
"Creates",
"an",
"instance",
"of",
"the",
"class",
"that",
"indicates",
"the",
"file",
"is",
"within",
"tcMenu",
"itself",
".",
"Don",
"t",
"use",
"for",
"new",
"plugins",
"prefer",
"to",
"package",
"arduino",
"code",
"in",
"the",
"plugin",
"or",
"a",
"n... | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/PluginFileDependency.java#L89-L91 |
mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/ApiCallHelper.java | ApiCallHelper.getHeaderUserAgent | public static String getHeaderUserAgent(@Nullable String clientAppName) {
String osName = System.getProperty("os.name");
String osVersion = System.getProperty("os.version");
String osArch = System.getProperty("os.arch");
if (TextUtils.isEmpty(osName) || TextUtils.isEmpty(osVersion) || TextUtils.isEmpty(osArch)) {
return Constants.HEADER_USER_AGENT;
} else {
return getHeaderUserAgent(clientAppName, osName, osVersion, osArch);
}
} | java | public static String getHeaderUserAgent(@Nullable String clientAppName) {
String osName = System.getProperty("os.name");
String osVersion = System.getProperty("os.version");
String osArch = System.getProperty("os.arch");
if (TextUtils.isEmpty(osName) || TextUtils.isEmpty(osVersion) || TextUtils.isEmpty(osArch)) {
return Constants.HEADER_USER_AGENT;
} else {
return getHeaderUserAgent(clientAppName, osName, osVersion, osArch);
}
} | [
"public",
"static",
"String",
"getHeaderUserAgent",
"(",
"@",
"Nullable",
"String",
"clientAppName",
")",
"{",
"String",
"osName",
"=",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
";",
"String",
"osVersion",
"=",
"System",
".",
"getProperty",
"(",
"... | Computes a full user agent header of the form:
{@code MapboxJava/1.2.0 Mac OS X/10.11.5 (x86_64)}.
@param clientAppName Application Name
@return {@link String} representing the header user agent
@since 1.0.0 | [
"Computes",
"a",
"full",
"user",
"agent",
"header",
"of",
"the",
"form",
":",
"{",
"@code",
"MapboxJava",
"/",
"1",
".",
"2",
".",
"0",
"Mac",
"OS",
"X",
"/",
"10",
".",
"11",
".",
"5",
"(",
"x86_64",
")",
"}",
"."
] | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/ApiCallHelper.java#L30-L40 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/SimpleAuthenticator.java | SimpleAuthenticator.unregisterPasswordAuthentication | public PasswordAuthentication unregisterPasswordAuthentication(InetAddress pAddress, int pPort, String pProtocol, String pPrompt, String pScheme) {
return passwordAuthentications.remove(new AuthKey(pAddress, pPort, pProtocol, pPrompt, pScheme));
} | java | public PasswordAuthentication unregisterPasswordAuthentication(InetAddress pAddress, int pPort, String pProtocol, String pPrompt, String pScheme) {
return passwordAuthentications.remove(new AuthKey(pAddress, pPort, pProtocol, pPrompt, pScheme));
} | [
"public",
"PasswordAuthentication",
"unregisterPasswordAuthentication",
"(",
"InetAddress",
"pAddress",
",",
"int",
"pPort",
",",
"String",
"pProtocol",
",",
"String",
"pPrompt",
",",
"String",
"pScheme",
")",
"{",
"return",
"passwordAuthentications",
".",
"remove",
"... | Unregisters a PasswordAuthentication with a given net address. | [
"Unregisters",
"a",
"PasswordAuthentication",
"with",
"a",
"given",
"net",
"address",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/SimpleAuthenticator.java#L183-L185 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.fixLength | public static String fixLength(final String text, final int charsNum, final char paddingChar)
{
return fixLength(text, charsNum, paddingChar, false);
} | java | public static String fixLength(final String text, final int charsNum, final char paddingChar)
{
return fixLength(text, charsNum, paddingChar, false);
} | [
"public",
"static",
"String",
"fixLength",
"(",
"final",
"String",
"text",
",",
"final",
"int",
"charsNum",
",",
"final",
"char",
"paddingChar",
")",
"{",
"return",
"fixLength",
"(",
"text",
",",
"charsNum",
",",
"paddingChar",
",",
"false",
")",
";",
"}"
... | <p>
Pads or truncates a string to a specified length.
</p>
@param text
String to be fixed
@param charsNum
The fixed length in number of chars
@param paddingChar
The padding character
@return A fixed length string | [
"<p",
">",
"Pads",
"or",
"truncates",
"a",
"string",
"to",
"a",
"specified",
"length",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L802-L805 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Session.java | Session.openActiveSession | public static Session openActiveSession(Activity activity, boolean allowLoginUI,
StatusCallback callback) {
return openActiveSession(activity, allowLoginUI, new OpenRequest(activity).setCallback(callback));
} | java | public static Session openActiveSession(Activity activity, boolean allowLoginUI,
StatusCallback callback) {
return openActiveSession(activity, allowLoginUI, new OpenRequest(activity).setCallback(callback));
} | [
"public",
"static",
"Session",
"openActiveSession",
"(",
"Activity",
"activity",
",",
"boolean",
"allowLoginUI",
",",
"StatusCallback",
"callback",
")",
"{",
"return",
"openActiveSession",
"(",
"activity",
",",
"allowLoginUI",
",",
"new",
"OpenRequest",
"(",
"activi... | If allowLoginUI is true, this will create a new Session, make it active, and
open it. If the default token cache is not available, then this will request
basic permissions. If the default token cache is available and cached tokens
are loaded, this will use the cached token and associated permissions.
<p/>
If allowedLoginUI is false, this will only create the active session and open
it if it requires no user interaction (i.e. the token cache is available and
there are cached tokens).
@param activity The Activity that is opening the new Session.
@param allowLoginUI if false, only sets the active session and opens it if it
does not require user interaction
@param callback The {@link StatusCallback SessionStatusCallback} to
notify regarding Session state changes. May be null.
@return The new Session or null if one could not be created | [
"If",
"allowLoginUI",
"is",
"true",
"this",
"will",
"create",
"a",
"new",
"Session",
"make",
"it",
"active",
"and",
"open",
"it",
".",
"If",
"the",
"default",
"token",
"cache",
"is",
"not",
"available",
"then",
"this",
"will",
"request",
"basic",
"permissi... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Session.java#L1015-L1018 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java | XsdAsmInterfaces.sequenceMethod | private void sequenceMethod(Stream<XsdAbstractElement> xsdElements, String className, int interfaceIndex, String apiName, String groupName) {
pendingSequenceMethods.put(className, classWriter -> createSequence(classWriter, xsdElements, className, interfaceIndex, apiName, groupName));
} | java | private void sequenceMethod(Stream<XsdAbstractElement> xsdElements, String className, int interfaceIndex, String apiName, String groupName) {
pendingSequenceMethods.put(className, classWriter -> createSequence(classWriter, xsdElements, className, interfaceIndex, apiName, groupName));
} | [
"private",
"void",
"sequenceMethod",
"(",
"Stream",
"<",
"XsdAbstractElement",
">",
"xsdElements",
",",
"String",
"className",
",",
"int",
"interfaceIndex",
",",
"String",
"apiName",
",",
"String",
"groupName",
")",
"{",
"pendingSequenceMethods",
".",
"put",
"(",
... | Postpones the sequence method creation due to solution design.
@param xsdElements A {@link Stream} of {@link XsdElement}, ordered, that represent the sequence.
@param className The className of the element which contains this sequence.
@param interfaceIndex The current interfaceIndex that serves as a base to distinguish interface names.
@param apiName The name of the generated fluent interface.
@param groupName The groupName, that indicates if this sequence belongs to a group. | [
"Postpones",
"the",
"sequence",
"method",
"creation",
"due",
"to",
"solution",
"design",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L370-L372 |
hypercube1024/firefly | firefly-db/src/main/java/com/firefly/db/jdbc/helper/DefaultBeanProcessor.java | DefaultBeanProcessor.isCompatibleType | private boolean isCompatibleType(Object value, Class<?> type) {
// Do object check first, then primitives
if (value == null || type.isInstance(value) || matchesPrimitive(type, value.getClass())) {
return true;
}
return false;
} | java | private boolean isCompatibleType(Object value, Class<?> type) {
// Do object check first, then primitives
if (value == null || type.isInstance(value) || matchesPrimitive(type, value.getClass())) {
return true;
}
return false;
} | [
"private",
"boolean",
"isCompatibleType",
"(",
"Object",
"value",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"// Do object check first, then primitives",
"if",
"(",
"value",
"==",
"null",
"||",
"type",
".",
"isInstance",
"(",
"value",
")",
"||",
"matchesPr... | ResultSet.getObject() returns an Integer object for an INT column. The
setter method for the property might take an Integer or a primitive int.
This method returns true if the value can be successfully passed into
the setter method. Remember, Method.invoke() handles the unwrapping
of Integer into an int.
@param value The value to be passed into the setter method.
@param type The setter's parameter type (non-null)
@return boolean True if the value is compatible (null => true) | [
"ResultSet",
".",
"getObject",
"()",
"returns",
"an",
"Integer",
"object",
"for",
"an",
"INT",
"column",
".",
"The",
"setter",
"method",
"for",
"the",
"property",
"might",
"take",
"an",
"Integer",
"or",
"a",
"primitive",
"int",
".",
"This",
"method",
"retu... | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/jdbc/helper/DefaultBeanProcessor.java#L219-L227 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/ReturnActionViewRenderer.java | ReturnActionViewRenderer.renderView | public void renderView(ServletRequest request, ServletResponse response, ServletContext servletContext)
throws IOException
{
ResponseRenderAppender appender = new ResponseRenderAppender(response);
ScriptTag.State state = new ScriptTag.State();
ScriptTag br = (ScriptTag) TagRenderingBase.Factory.getRendering(TagRenderingBase.SCRIPT_TAG, request);
state.suppressComments = false;
br.doStartTag(appender, state);
appender.append(ScriptRequestState.getString("popupReturn_begin", null));
assert request instanceof HttpServletRequest : request.getClass().getName();
HttpServletRequest httpRequest = (HttpServletRequest) request;
if (_retrieveMap != null) {
for (Iterator/*<Map.Entry>*/ i = _retrieveMap.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
String fieldID = (String) entry.getKey();
String expressionToRetrieve = "${" + (String) entry.getValue() + '}';
try {
String value =
InternalExpressionUtils.evaluateMessage(expressionToRetrieve, null, httpRequest, servletContext);
String item =
ScriptRequestState.getString("popupReturn_item", new Object[]{fieldID, value});
appender.append(item);
}
catch (ELException e) {
_log.error("Error evaluating expression " + expressionToRetrieve, e);
}
}
}
appender.append(ScriptRequestState.getString("popupReturn_end", new Object[]{_callbackFunc}));
br.doEndTag(appender, false);
} | java | public void renderView(ServletRequest request, ServletResponse response, ServletContext servletContext)
throws IOException
{
ResponseRenderAppender appender = new ResponseRenderAppender(response);
ScriptTag.State state = new ScriptTag.State();
ScriptTag br = (ScriptTag) TagRenderingBase.Factory.getRendering(TagRenderingBase.SCRIPT_TAG, request);
state.suppressComments = false;
br.doStartTag(appender, state);
appender.append(ScriptRequestState.getString("popupReturn_begin", null));
assert request instanceof HttpServletRequest : request.getClass().getName();
HttpServletRequest httpRequest = (HttpServletRequest) request;
if (_retrieveMap != null) {
for (Iterator/*<Map.Entry>*/ i = _retrieveMap.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
String fieldID = (String) entry.getKey();
String expressionToRetrieve = "${" + (String) entry.getValue() + '}';
try {
String value =
InternalExpressionUtils.evaluateMessage(expressionToRetrieve, null, httpRequest, servletContext);
String item =
ScriptRequestState.getString("popupReturn_item", new Object[]{fieldID, value});
appender.append(item);
}
catch (ELException e) {
_log.error("Error evaluating expression " + expressionToRetrieve, e);
}
}
}
appender.append(ScriptRequestState.getString("popupReturn_end", new Object[]{_callbackFunc}));
br.doEndTag(appender, false);
} | [
"public",
"void",
"renderView",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"ServletContext",
"servletContext",
")",
"throws",
"IOException",
"{",
"ResponseRenderAppender",
"appender",
"=",
"new",
"ResponseRenderAppender",
"(",
"response",
... | Render the JavaScript for this framework response to a popup window.
The JavaScript passes a map of field values from the popup back to
a JavaScript routine on the originating page updating its form fields.
(See {@link org.apache.beehive.netui.tags.html.ConfigurePopup})
The javascript also closes the popup window. | [
"Render",
"the",
"JavaScript",
"for",
"this",
"framework",
"response",
"to",
"a",
"popup",
"window",
".",
"The",
"JavaScript",
"passes",
"a",
"map",
"of",
"field",
"values",
"from",
"the",
"popup",
"back",
"to",
"a",
"JavaScript",
"routine",
"on",
"the",
"... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/ReturnActionViewRenderer.java#L103-L136 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/map/OpenLongIntHashMap.java | OpenLongIntHashMap.put | public boolean put(long key, int value) {
int i = indexOfInsertion(key);
if (i<0) { //already contained
i = -i -1;
this.values[i]=value;
return false;
}
if (this.distinct > this.highWaterMark) {
int newCapacity = chooseGrowCapacity(this.distinct+1,this.minLoadFactor, this.maxLoadFactor);
rehash(newCapacity);
return put(key, value);
}
this.table[i]=key;
this.values[i]=value;
if (this.state[i]==FREE) this.freeEntries--;
this.state[i]=FULL;
this.distinct++;
if (this.freeEntries < 1) { //delta
int newCapacity = chooseGrowCapacity(this.distinct+1,this.minLoadFactor, this.maxLoadFactor);
rehash(newCapacity);
}
return true;
} | java | public boolean put(long key, int value) {
int i = indexOfInsertion(key);
if (i<0) { //already contained
i = -i -1;
this.values[i]=value;
return false;
}
if (this.distinct > this.highWaterMark) {
int newCapacity = chooseGrowCapacity(this.distinct+1,this.minLoadFactor, this.maxLoadFactor);
rehash(newCapacity);
return put(key, value);
}
this.table[i]=key;
this.values[i]=value;
if (this.state[i]==FREE) this.freeEntries--;
this.state[i]=FULL;
this.distinct++;
if (this.freeEntries < 1) { //delta
int newCapacity = chooseGrowCapacity(this.distinct+1,this.minLoadFactor, this.maxLoadFactor);
rehash(newCapacity);
}
return true;
} | [
"public",
"boolean",
"put",
"(",
"long",
"key",
",",
"int",
"value",
")",
"{",
"int",
"i",
"=",
"indexOfInsertion",
"(",
"key",
")",
";",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"//already contained\r",
"i",
"=",
"-",
"i",
"-",
"1",
";",
"this",
".",... | Associates the given key with the given value.
Replaces any old <tt>(key,someOtherValue)</tt> association, if existing.
@param key the key the value shall be associated with.
@param value the value to be associated.
@return <tt>true</tt> if the receiver did not already contain such a key;
<tt>false</tt> if the receiver did already contain such a key - the new value has now replaced the formerly associated value. | [
"Associates",
"the",
"given",
"key",
"with",
"the",
"given",
"value",
".",
"Replaces",
"any",
"old",
"<tt",
">",
"(",
"key",
"someOtherValue",
")",
"<",
"/",
"tt",
">",
"association",
"if",
"existing",
"."
] | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/OpenLongIntHashMap.java#L346-L372 |
paymill/paymill-java | src/main/java/com/paymill/services/PreauthorizationService.java | PreauthorizationService.createWithToken | public Preauthorization createWithToken( final String token, final Integer amount, final String currency, final String description ) {
ValidationUtils.validatesToken( token );
ValidationUtils.validatesAmount( amount );
ValidationUtils.validatesCurrency( currency );
ParameterMap<String, String> params = new ParameterMap<String, String>();
params.add( "token", token );
params.add( "amount", String.valueOf( amount ) );
params.add( "currency", currency );
params.add( "source", String.format( "%s-%s", PaymillContext.getProjectName(), PaymillContext.getProjectVersion() ) );
if( StringUtils.isNotBlank( description ) )
params.add( "description", description );
return RestfulUtils.create( PreauthorizationService.PATH, params, Preauthorization.class, super.httpClient );
} | java | public Preauthorization createWithToken( final String token, final Integer amount, final String currency, final String description ) {
ValidationUtils.validatesToken( token );
ValidationUtils.validatesAmount( amount );
ValidationUtils.validatesCurrency( currency );
ParameterMap<String, String> params = new ParameterMap<String, String>();
params.add( "token", token );
params.add( "amount", String.valueOf( amount ) );
params.add( "currency", currency );
params.add( "source", String.format( "%s-%s", PaymillContext.getProjectName(), PaymillContext.getProjectVersion() ) );
if( StringUtils.isNotBlank( description ) )
params.add( "description", description );
return RestfulUtils.create( PreauthorizationService.PATH, params, Preauthorization.class, super.httpClient );
} | [
"public",
"Preauthorization",
"createWithToken",
"(",
"final",
"String",
"token",
",",
"final",
"Integer",
"amount",
",",
"final",
"String",
"currency",
",",
"final",
"String",
"description",
")",
"{",
"ValidationUtils",
".",
"validatesToken",
"(",
"token",
")",
... | Creates Use either a token or an existing payment to Authorizes the given amount with the given token.
@param token
The identifier of a token.
@param amount
Amount (in cents) which will be charged.
@param currency
ISO 4217 formatted currency code.
@param description
A short description for the preauthorization.
@return {@link Transaction} object with the {@link Preauthorization} as sub object. | [
"Creates",
"Use",
"either",
"a",
"token",
"or",
"an",
"existing",
"payment",
"to",
"Authorizes",
"the",
"given",
"amount",
"with",
"the",
"given",
"token",
"."
] | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/PreauthorizationService.java#L125-L141 |
patka/cassandra-migration | cassandra-migration/src/main/java/org/cognitor/cassandra/migration/util/Ensure.java | Ensure.notNullOrEmpty | public static String notNullOrEmpty(String argument, String argumentName) {
if (argument == null || argument.trim().isEmpty()) {
throw new IllegalArgumentException("Argument " + argumentName + " must not be null or empty.");
}
return argument;
} | java | public static String notNullOrEmpty(String argument, String argumentName) {
if (argument == null || argument.trim().isEmpty()) {
throw new IllegalArgumentException("Argument " + argumentName + " must not be null or empty.");
}
return argument;
} | [
"public",
"static",
"String",
"notNullOrEmpty",
"(",
"String",
"argument",
",",
"String",
"argumentName",
")",
"{",
"if",
"(",
"argument",
"==",
"null",
"||",
"argument",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"Illegal... | Checks if the given String is null or contains only whitespaces.
The String is trimmed before the empty check.
@param argument the String to check for null or emptiness
@param argumentName the name of the argument to check.
This is used in the exception message.
@return the String that was given as argument
@throws IllegalArgumentException in case argument is null or empty | [
"Checks",
"if",
"the",
"given",
"String",
"is",
"null",
"or",
"contains",
"only",
"whitespaces",
".",
"The",
"String",
"is",
"trimmed",
"before",
"the",
"empty",
"check",
"."
] | train | https://github.com/patka/cassandra-migration/blob/c61840c23b17a18df704d136909c26ff46bd5c77/cassandra-migration/src/main/java/org/cognitor/cassandra/migration/util/Ensure.java#L38-L43 |
kaazing/gateway | resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java | URIUtils.modifyURIPort | public static String modifyURIPort(String uri, int newPort) {
try {
URI uriObj = new URI(uri);
return uriToString(URLUtils.modifyURIPort(uriObj, newPort));
}
catch (URISyntaxException e) {
try {
return (new NetworkInterfaceURI(uri)).modifyURIPort(newPort);
}
catch (IllegalArgumentException ne) {
throw new IllegalArgumentException(ne.getMessage(), ne);
}
}
} | java | public static String modifyURIPort(String uri, int newPort) {
try {
URI uriObj = new URI(uri);
return uriToString(URLUtils.modifyURIPort(uriObj, newPort));
}
catch (URISyntaxException e) {
try {
return (new NetworkInterfaceURI(uri)).modifyURIPort(newPort);
}
catch (IllegalArgumentException ne) {
throw new IllegalArgumentException(ne.getMessage(), ne);
}
}
} | [
"public",
"static",
"String",
"modifyURIPort",
"(",
"String",
"uri",
",",
"int",
"newPort",
")",
"{",
"try",
"{",
"URI",
"uriObj",
"=",
"new",
"URI",
"(",
"uri",
")",
";",
"return",
"uriToString",
"(",
"URLUtils",
".",
"modifyURIPort",
"(",
"uriObj",
","... | Helper method for modifying URI port
@param uri
@param newPort
@return | [
"Helper",
"method",
"for",
"modifying",
"URI",
"port"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java#L335-L348 |
apache/incubator-zipkin | zipkin/src/main/java/zipkin2/internal/HexCodec.java | HexCodec.lowerHexToUnsignedLong | public static long lowerHexToUnsignedLong(String lowerHex) {
int length = lowerHex.length();
if (length < 1 || length > 32) throw isntLowerHexLong(lowerHex);
// trim off any high bits
int beginIndex = length > 16 ? length - 16 : 0;
return lowerHexToUnsignedLong(lowerHex, beginIndex);
} | java | public static long lowerHexToUnsignedLong(String lowerHex) {
int length = lowerHex.length();
if (length < 1 || length > 32) throw isntLowerHexLong(lowerHex);
// trim off any high bits
int beginIndex = length > 16 ? length - 16 : 0;
return lowerHexToUnsignedLong(lowerHex, beginIndex);
} | [
"public",
"static",
"long",
"lowerHexToUnsignedLong",
"(",
"String",
"lowerHex",
")",
"{",
"int",
"length",
"=",
"lowerHex",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
"<",
"1",
"||",
"length",
">",
"32",
")",
"throw",
"isntLowerHexLong",
"(",
"l... | Parses a 1 to 32 character lower-hex string with no prefix into an unsigned long, tossing any
bits higher than 64. | [
"Parses",
"a",
"1",
"to",
"32",
"character",
"lower",
"-",
"hex",
"string",
"with",
"no",
"prefix",
"into",
"an",
"unsigned",
"long",
"tossing",
"any",
"bits",
"higher",
"than",
"64",
"."
] | train | https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/HexCodec.java#L25-L33 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.elementLessThan | public static BMatrixRMaj elementLessThan(DMatrixRMaj A , double value , BMatrixRMaj output )
{
if( output == null ) {
output = new BMatrixRMaj(A.numRows,A.numCols);
}
output.reshape(A.numRows, A.numCols);
int N = A.getNumElements();
for (int i = 0; i < N; i++) {
output.data[i] = A.data[i] < value;
}
return output;
} | java | public static BMatrixRMaj elementLessThan(DMatrixRMaj A , double value , BMatrixRMaj output )
{
if( output == null ) {
output = new BMatrixRMaj(A.numRows,A.numCols);
}
output.reshape(A.numRows, A.numCols);
int N = A.getNumElements();
for (int i = 0; i < N; i++) {
output.data[i] = A.data[i] < value;
}
return output;
} | [
"public",
"static",
"BMatrixRMaj",
"elementLessThan",
"(",
"DMatrixRMaj",
"A",
",",
"double",
"value",
",",
"BMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"BMatrixRMaj",
"(",
"A",
".",
"numRows",
",",
... | Applies the > operator to each element in A. Results are stored in a boolean matrix.
@param A Input matrx
@param value value each element is compared against
@param output (Optional) Storage for results. Can be null. Is reshaped.
@return Boolean matrix with results | [
"Applies",
"the",
">",
";",
"operator",
"to",
"each",
"element",
"in",
"A",
".",
"Results",
"are",
"stored",
"in",
"a",
"boolean",
"matrix",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2604-L2619 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexResponse.java | CmsFlexResponse.addToIncludeList | public void addToIncludeList(String target, Map<String, String[]> parameterMap, Map<String, Object> attributeMap) {
if (m_includeList == null) {
m_includeList = new ArrayList<String>(10);
m_includeListParameters = new ArrayList<Map<String, String[]>>(10);
m_includeListAttributes = new ArrayList<Map<String, Object>>(10);
}
// never cache some request attributes, e.g. the Flex controller
m_controller.removeUncacheableAttributes(attributeMap);
// only cache a copy of the JSP standard context bean
CmsJspStandardContextBean bean = (CmsJspStandardContextBean)attributeMap.get(
CmsJspStandardContextBean.ATTRIBUTE_NAME);
if (bean != null) {
attributeMap.put(CmsJspStandardContextBean.ATTRIBUTE_NAME, bean.createCopy());
}
m_includeListAttributes.add(attributeMap);
m_includeListParameters.add(parameterMap);
m_includeList.add(target);
} | java | public void addToIncludeList(String target, Map<String, String[]> parameterMap, Map<String, Object> attributeMap) {
if (m_includeList == null) {
m_includeList = new ArrayList<String>(10);
m_includeListParameters = new ArrayList<Map<String, String[]>>(10);
m_includeListAttributes = new ArrayList<Map<String, Object>>(10);
}
// never cache some request attributes, e.g. the Flex controller
m_controller.removeUncacheableAttributes(attributeMap);
// only cache a copy of the JSP standard context bean
CmsJspStandardContextBean bean = (CmsJspStandardContextBean)attributeMap.get(
CmsJspStandardContextBean.ATTRIBUTE_NAME);
if (bean != null) {
attributeMap.put(CmsJspStandardContextBean.ATTRIBUTE_NAME, bean.createCopy());
}
m_includeListAttributes.add(attributeMap);
m_includeListParameters.add(parameterMap);
m_includeList.add(target);
} | [
"public",
"void",
"addToIncludeList",
"(",
"String",
"target",
",",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"parameterMap",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributeMap",
")",
"{",
"if",
"(",
"m_includeList",
"==",
"null",
")"... | Adds an inclusion target to the list of include results.<p>
Should be used only in inclusion-scenarios
like the JSP cms:include tag processing.<p>
@param target the include target name to add
@param parameterMap the map of parameters given with the include command
@param attributeMap the map of attributes given with the include command | [
"Adds",
"an",
"inclusion",
"target",
"to",
"the",
"list",
"of",
"include",
"results",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexResponse.java#L498-L517 |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java | CompletableFuture.get | public T get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
long nanos = unit.toNanos(timeout);
Object r;
if ((r = result) == null)
r = timedGet(nanos);
return (T) reportGet(r);
} | java | public T get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
long nanos = unit.toNanos(timeout);
Object r;
if ((r = result) == null)
r = timedGet(nanos);
return (T) reportGet(r);
} | [
"public",
"T",
"get",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
",",
"TimeoutException",
"{",
"long",
"nanos",
"=",
"unit",
".",
"toNanos",
"(",
"timeout",
")",
";",
"Object",
"r",
";",... | Waits if necessary for at most the given time for this future to complete, and then returns its
result, if available.
@param timeout the maximum time to wait
@param unit the time unit of the timeout argument
@return the result value
@throws CancellationException if this future was cancelled
@throws ExecutionException if this future completed exceptionally
@throws InterruptedException if the current thread was interrupted while waiting
@throws TimeoutException if the wait timed out | [
"Waits",
"if",
"necessary",
"for",
"at",
"most",
"the",
"given",
"time",
"for",
"this",
"future",
"to",
"complete",
"and",
"then",
"returns",
"its",
"result",
"if",
"available",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L1367-L1374 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/mapreduce/MRJobLauncher.java | MRJobLauncher.calculateDestJarFile | private Path calculateDestJarFile(FileStatus status, Path jarFileDir) {
// SNAPSHOT jars should not be shared, as different jobs may be using different versions of it
Path baseDir = status.getPath().getName().contains("SNAPSHOT") ? this.unsharedJarsDir : jarFileDir;
// DistributedCache requires absolute path, so we need to use makeQualified.
return new Path(this.fs.makeQualified(baseDir), status.getPath().getName());
} | java | private Path calculateDestJarFile(FileStatus status, Path jarFileDir) {
// SNAPSHOT jars should not be shared, as different jobs may be using different versions of it
Path baseDir = status.getPath().getName().contains("SNAPSHOT") ? this.unsharedJarsDir : jarFileDir;
// DistributedCache requires absolute path, so we need to use makeQualified.
return new Path(this.fs.makeQualified(baseDir), status.getPath().getName());
} | [
"private",
"Path",
"calculateDestJarFile",
"(",
"FileStatus",
"status",
",",
"Path",
"jarFileDir",
")",
"{",
"// SNAPSHOT jars should not be shared, as different jobs may be using different versions of it",
"Path",
"baseDir",
"=",
"status",
".",
"getPath",
"(",
")",
".",
"g... | Calculate the target filePath of the jar file to be copied on HDFS,
given the {@link FileStatus} of a jarFile and the path of directory that contains jar. | [
"Calculate",
"the",
"target",
"filePath",
"of",
"the",
"jar",
"file",
"to",
"be",
"copied",
"on",
"HDFS",
"given",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/mapreduce/MRJobLauncher.java#L520-L525 |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.sameWeek | public static boolean sameWeek(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int week = cal.get(Calendar.WEEK_OF_YEAR);
cal.setTime(dateTwo);
int year2 = cal.get(Calendar.YEAR);
int week2 = cal.get(Calendar.WEEK_OF_YEAR);
return ( (year == year2) && (week == week2) );
} | java | public static boolean sameWeek(Date dateOne, Date dateTwo) {
if ((dateOne == null) || (dateTwo == null)) {
return false;
}
Calendar cal = Calendar.getInstance();
cal.setTime(dateOne);
int year = cal.get(Calendar.YEAR);
int week = cal.get(Calendar.WEEK_OF_YEAR);
cal.setTime(dateTwo);
int year2 = cal.get(Calendar.YEAR);
int week2 = cal.get(Calendar.WEEK_OF_YEAR);
return ( (year == year2) && (week == week2) );
} | [
"public",
"static",
"boolean",
"sameWeek",
"(",
"Date",
"dateOne",
",",
"Date",
"dateTwo",
")",
"{",
"if",
"(",
"(",
"dateOne",
"==",
"null",
")",
"||",
"(",
"dateTwo",
"==",
"null",
")",
")",
"{",
"return",
"false",
";",
"}",
"Calendar",
"cal",
"=",... | Test to see if two dates are in the same week
@param dateOne first date
@param dateTwo second date
@return true if the two dates are in the same week | [
"Test",
"to",
"see",
"if",
"two",
"dates",
"are",
"in",
"the",
"same",
"week"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L255-L270 |
DaGeRe/KoPeMe | kopeme-core/src/main/java/de/dagere/kopeme/PomProjectNameReader.java | PomProjectNameReader.foundPomXml | public boolean foundPomXml(final File directory, final int depth) {
LOG.debug("Directory: {}", directory);
if (depth == -1 || directory == null || !directory.isDirectory()) {
return false;
} else {
File[] pomFiles = directory.listFiles(new FileFilter() {
@Override
public boolean accept(final File pathname) {
return "pom.xml".equals(pathname.getName());
}
});
if (pomFiles.length == 1) {
pathToPomXml = pomFiles[0];
return true;
} else {
return foundPomXml(directory.getParentFile(), depth - 1);
}
}
} | java | public boolean foundPomXml(final File directory, final int depth) {
LOG.debug("Directory: {}", directory);
if (depth == -1 || directory == null || !directory.isDirectory()) {
return false;
} else {
File[] pomFiles = directory.listFiles(new FileFilter() {
@Override
public boolean accept(final File pathname) {
return "pom.xml".equals(pathname.getName());
}
});
if (pomFiles.length == 1) {
pathToPomXml = pomFiles[0];
return true;
} else {
return foundPomXml(directory.getParentFile(), depth - 1);
}
}
} | [
"public",
"boolean",
"foundPomXml",
"(",
"final",
"File",
"directory",
",",
"final",
"int",
"depth",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Directory: {}\"",
",",
"directory",
")",
";",
"if",
"(",
"depth",
"==",
"-",
"1",
"||",
"directory",
"==",
"null",... | Tries to find the pom recursively by going up in the directory tree.
@param directory The start folder where to search
@param depth how many times should we try to go up to find the pom?
@return a boolean denoting if the pom was found / side effect setting the pom file | [
"Tries",
"to",
"find",
"the",
"pom",
"recursively",
"by",
"going",
"up",
"in",
"the",
"directory",
"tree",
"."
] | train | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-core/src/main/java/de/dagere/kopeme/PomProjectNameReader.java#L39-L57 |
kiswanij/jk-util | src/main/java/com/jk/util/JKIOUtil.java | JKIOUtil.writeDataToTempFile | public static File writeDataToTempFile(final String data, final String ext) {
try {
final File file = createTempFile(ext);
final PrintWriter out = new PrintWriter(new FileOutputStream(file));
out.print(data);
// out.flush();
out.close();
// file.deleteOnExit();
return file;
} catch (IOException e) {
JKExceptionUtil.handle(e);
return null;
}
} | java | public static File writeDataToTempFile(final String data, final String ext) {
try {
final File file = createTempFile(ext);
final PrintWriter out = new PrintWriter(new FileOutputStream(file));
out.print(data);
// out.flush();
out.close();
// file.deleteOnExit();
return file;
} catch (IOException e) {
JKExceptionUtil.handle(e);
return null;
}
} | [
"public",
"static",
"File",
"writeDataToTempFile",
"(",
"final",
"String",
"data",
",",
"final",
"String",
"ext",
")",
"{",
"try",
"{",
"final",
"File",
"file",
"=",
"createTempFile",
"(",
"ext",
")",
";",
"final",
"PrintWriter",
"out",
"=",
"new",
"PrintW... | Write data to temp file.
@param data String
@param ext the ext
@return File | [
"Write",
"data",
"to",
"temp",
"file",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L464-L477 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.rotationTowards | public Matrix4x3f rotationTowards(Vector3fc dir, Vector3fc up) {
return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z());
} | java | public Matrix4x3f rotationTowards(Vector3fc dir, Vector3fc up) {
return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z());
} | [
"public",
"Matrix4x3f",
"rotationTowards",
"(",
"Vector3fc",
"dir",
",",
"Vector3fc",
"up",
")",
"{",
"return",
"rotationTowards",
"(",
"dir",
".",
"x",
"(",
")",
",",
"dir",
".",
"y",
"(",
")",
",",
"dir",
".",
"z",
"(",
")",
",",
"up",
".",
"x",
... | Set this matrix to a model transformation for a right-handed coordinate system,
that aligns the local <code>-z</code> axis with <code>dir</code>.
<p>
In order to apply the rotation transformation to a previous existing transformation,
use {@link #rotateTowards(float, float, float, float, float, float) rotateTowards}.
<p>
This method is equivalent to calling: <code>setLookAt(new Vector3f(), new Vector3f(dir).negate(), up).invert()</code>
@see #rotationTowards(Vector3fc, Vector3fc)
@see #rotateTowards(float, float, float, float, float, float)
@param dir
the direction to orient the local -z axis towards
@param up
the up vector
@return this | [
"Set",
"this",
"matrix",
"to",
"a",
"model",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"the",
"local",
"<code",
">",
"-",
"z<",
"/",
"code",
">",
"axis",
"with",
"<code",
">",
"dir<",
"/",
"code",
"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L8786-L8788 |
dhemery/hartley | src/main/java/com/dhemery/expressing/Expressive.java | Expressive.assertThat | public <S,V> void assertThat(S subject, Feature<? super S, V> feature, Ticker ticker, Matcher<? super V> criteria) {
assertThat(sampled(subject, feature), ticker, criteria);
} | java | public <S,V> void assertThat(S subject, Feature<? super S, V> feature, Ticker ticker, Matcher<? super V> criteria) {
assertThat(sampled(subject, feature), ticker, criteria);
} | [
"public",
"<",
"S",
",",
"V",
">",
"void",
"assertThat",
"(",
"S",
"subject",
",",
"Feature",
"<",
"?",
"super",
"S",
",",
"V",
">",
"feature",
",",
"Ticker",
"ticker",
",",
"Matcher",
"<",
"?",
"super",
"V",
">",
"criteria",
")",
"{",
"assertThat"... | Assert that a polled sample of the feature satisfies the criteria.
<p>Example:</p>
<pre>
{@code
Page searchResultsPage = ...;
Feature<Page,Boolean> resultCount() { ... }
Ticker withinTenSeconds = ...;
...
assertThat(searchResultsPage, resultCount(), withinTenSeconds, is(greaterThan(9)));
} | [
"Assert",
"that",
"a",
"polled",
"sample",
"of",
"the",
"feature",
"satisfies",
"the",
"criteria",
".",
"<p",
">",
"Example",
":",
"<",
"/",
"p",
">",
"<pre",
">",
"{",
"@code"
] | train | https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/Expressive.java#L95-L97 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.summarizeForManagementGroup | public SummarizeResultsInner summarizeForManagementGroup(String managementGroupName, QueryOptions queryOptions) {
return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body();
} | java | public SummarizeResultsInner summarizeForManagementGroup(String managementGroupName, QueryOptions queryOptions) {
return summarizeForManagementGroupWithServiceResponseAsync(managementGroupName, queryOptions).toBlocking().single().body();
} | [
"public",
"SummarizeResultsInner",
"summarizeForManagementGroup",
"(",
"String",
"managementGroupName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"summarizeForManagementGroupWithServiceResponseAsync",
"(",
"managementGroupName",
",",
"queryOptions",
")",
".",
"to... | Summarizes policy states for the resources under the management group.
@param managementGroupName Management group name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SummarizeResultsInner object if successful. | [
"Summarizes",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"management",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L417-L419 |
riversun/string-grabber | src/main/java/org/riversun/string_grabber/StringCropper.java | StringCropper.getRightOf | public String getRightOf(String srcStr, int charCount) {
String retVal = "";
if (isNotBlank(srcStr)) {
int length = srcStr.length();
if (charCount < length) {
retVal = srcStr.substring(length - charCount, length);
} else {
retVal = srcStr;
}
} else {
}
return retVal;
} | java | public String getRightOf(String srcStr, int charCount) {
String retVal = "";
if (isNotBlank(srcStr)) {
int length = srcStr.length();
if (charCount < length) {
retVal = srcStr.substring(length - charCount, length);
} else {
retVal = srcStr;
}
} else {
}
return retVal;
} | [
"public",
"String",
"getRightOf",
"(",
"String",
"srcStr",
",",
"int",
"charCount",
")",
"{",
"String",
"retVal",
"=",
"\"\"",
";",
"if",
"(",
"isNotBlank",
"(",
"srcStr",
")",
")",
"{",
"int",
"length",
"=",
"srcStr",
".",
"length",
"(",
")",
";",
"... | Returns the number of characters specified from right
@param srcStr
@param charCount
@return | [
"Returns",
"the",
"number",
"of",
"characters",
"specified",
"from",
"right"
] | train | https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringCropper.java#L467-L485 |
sockeqwe/sqlbrite-dao | dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java | Dao.rawQueryOnManyTables | protected QueryBuilder rawQueryOnManyTables(@Nullable final Iterable<String> tables,
@NonNull final String sql) {
return new QueryBuilder(tables, sql);
} | java | protected QueryBuilder rawQueryOnManyTables(@Nullable final Iterable<String> tables,
@NonNull final String sql) {
return new QueryBuilder(tables, sql);
} | [
"protected",
"QueryBuilder",
"rawQueryOnManyTables",
"(",
"@",
"Nullable",
"final",
"Iterable",
"<",
"String",
">",
"tables",
",",
"@",
"NonNull",
"final",
"String",
"sql",
")",
"{",
"return",
"new",
"QueryBuilder",
"(",
"tables",
",",
"sql",
")",
";",
"}"
] | Creates a raw query and enables auto updates for the given tables
@param tables The affected table. updates get triggered if the observed tables changes. Use
{@code null} or
{@link #rawQuery(String)} if you don't want to register for automatic updates
@param sql The sql query statement
@return Observable of this query | [
"Creates",
"a",
"raw",
"query",
"and",
"enables",
"auto",
"updates",
"for",
"the",
"given",
"tables"
] | train | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java#L169-L172 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.createHierarchicalEntityRole | public UUID createHierarchicalEntityRole(UUID appId, String versionId, UUID hEntityId, CreateHierarchicalEntityRoleOptionalParameter createHierarchicalEntityRoleOptionalParameter) {
return createHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, createHierarchicalEntityRoleOptionalParameter).toBlocking().single().body();
} | java | public UUID createHierarchicalEntityRole(UUID appId, String versionId, UUID hEntityId, CreateHierarchicalEntityRoleOptionalParameter createHierarchicalEntityRoleOptionalParameter) {
return createHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, createHierarchicalEntityRoleOptionalParameter).toBlocking().single().body();
} | [
"public",
"UUID",
"createHierarchicalEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
",",
"CreateHierarchicalEntityRoleOptionalParameter",
"createHierarchicalEntityRoleOptionalParameter",
")",
"{",
"return",
"createHierarchicalEntityRoleWi... | Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param createHierarchicalEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UUID object if successful. | [
"Create",
"an",
"entity",
"role",
"for",
"an",
"entity",
"in",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L9432-L9434 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/util/PairCounter.java | PairCounter.getCount | public int getCount(T x, T y) {
// REMINDER: check for indexing?
return counts.get(getIndex(x, y));
} | java | public int getCount(T x, T y) {
// REMINDER: check for indexing?
return counts.get(getIndex(x, y));
} | [
"public",
"int",
"getCount",
"(",
"T",
"x",
",",
"T",
"y",
")",
"{",
"// REMINDER: check for indexing?",
"return",
"counts",
".",
"get",
"(",
"getIndex",
"(",
"x",
",",
"y",
")",
")",
";",
"}"
] | Returns the number of times the specified pair of objects has been seen
by this counter. | [
"Returns",
"the",
"number",
"of",
"times",
"the",
"specified",
"pair",
"of",
"objects",
"has",
"been",
"seen",
"by",
"this",
"counter",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/PairCounter.java#L227-L230 |
lastaflute/lasta-thymeleaf | src/main/java/org/lastaflute/thymeleaf/expression/ClassificationExpressionObject.java | ClassificationExpressionObject.codeOf | public Classification codeOf(String classificationName, String code) {
assertArgumentNotNull("elementName", classificationName);
assertArgumentNotNull("code", code);
return findClassificationMeta(classificationName, () -> {
return "codeOf('" + classificationName + "', '" + code + "')";
}).codeOf(code);
} | java | public Classification codeOf(String classificationName, String code) {
assertArgumentNotNull("elementName", classificationName);
assertArgumentNotNull("code", code);
return findClassificationMeta(classificationName, () -> {
return "codeOf('" + classificationName + "', '" + code + "')";
}).codeOf(code);
} | [
"public",
"Classification",
"codeOf",
"(",
"String",
"classificationName",
",",
"String",
"code",
")",
"{",
"assertArgumentNotNull",
"(",
"\"elementName\"",
",",
"classificationName",
")",
";",
"assertArgumentNotNull",
"(",
"\"code\"",
",",
"code",
")",
";",
"return... | Get classification by code.
@param classificationName The name of classification. (NotNull)
@param code The code of classification to find. (NotNull)
@return The found instance of classification for the code. (NotNull: if not found, throws exception) | [
"Get",
"classification",
"by",
"code",
"."
] | train | https://github.com/lastaflute/lasta-thymeleaf/blob/d340a6e7eeddfcc9177052958c383fecd4a7fefa/src/main/java/org/lastaflute/thymeleaf/expression/ClassificationExpressionObject.java#L211-L217 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/HistoricTaskInstanceManager.java | HistoricTaskInstanceManager.deleteHistoricTaskInstancesByProcessInstanceIds | public void deleteHistoricTaskInstancesByProcessInstanceIds(List<String> processInstanceIds, boolean deleteVariableInstances) {
CommandContext commandContext = Context.getCommandContext();
if (deleteVariableInstances) {
getHistoricVariableInstanceManager().deleteHistoricVariableInstancesByTaskProcessInstanceIds(processInstanceIds);
}
getHistoricDetailManager()
.deleteHistoricDetailsByTaskProcessInstanceIds(processInstanceIds);
commandContext
.getCommentManager()
.deleteCommentsByTaskProcessInstanceIds(processInstanceIds);
getAttachmentManager()
.deleteAttachmentsByTaskProcessInstanceIds(processInstanceIds);
getHistoricIdentityLinkManager()
.deleteHistoricIdentityLinksLogByTaskProcessInstanceIds(processInstanceIds);
getDbEntityManager().deletePreserveOrder(HistoricTaskInstanceEntity.class, "deleteHistoricTaskInstanceByProcessInstanceIds", processInstanceIds);
} | java | public void deleteHistoricTaskInstancesByProcessInstanceIds(List<String> processInstanceIds, boolean deleteVariableInstances) {
CommandContext commandContext = Context.getCommandContext();
if (deleteVariableInstances) {
getHistoricVariableInstanceManager().deleteHistoricVariableInstancesByTaskProcessInstanceIds(processInstanceIds);
}
getHistoricDetailManager()
.deleteHistoricDetailsByTaskProcessInstanceIds(processInstanceIds);
commandContext
.getCommentManager()
.deleteCommentsByTaskProcessInstanceIds(processInstanceIds);
getAttachmentManager()
.deleteAttachmentsByTaskProcessInstanceIds(processInstanceIds);
getHistoricIdentityLinkManager()
.deleteHistoricIdentityLinksLogByTaskProcessInstanceIds(processInstanceIds);
getDbEntityManager().deletePreserveOrder(HistoricTaskInstanceEntity.class, "deleteHistoricTaskInstanceByProcessInstanceIds", processInstanceIds);
} | [
"public",
"void",
"deleteHistoricTaskInstancesByProcessInstanceIds",
"(",
"List",
"<",
"String",
">",
"processInstanceIds",
",",
"boolean",
"deleteVariableInstances",
")",
"{",
"CommandContext",
"commandContext",
"=",
"Context",
".",
"getCommandContext",
"(",
")",
";",
... | Deletes all data related with tasks, which belongs to specified process instance ids.
@param processInstanceIds
@param deleteVariableInstances when true, will also delete variable instances. Can be false when variable instances were deleted separately. | [
"Deletes",
"all",
"data",
"related",
"with",
"tasks",
"which",
"belongs",
"to",
"specified",
"process",
"instance",
"ids",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/HistoricTaskInstanceManager.java#L54-L76 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/LastaAction.java | LastaAction.forwardWith | protected HtmlResponse forwardWith(Class<?> actionType, UrlChain moreUrl_or_params) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("moreUrl_or_params", moreUrl_or_params);
return doForward(actionType, moreUrl_or_params);
} | java | protected HtmlResponse forwardWith(Class<?> actionType, UrlChain moreUrl_or_params) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("moreUrl_or_params", moreUrl_or_params);
return doForward(actionType, moreUrl_or_params);
} | [
"protected",
"HtmlResponse",
"forwardWith",
"(",
"Class",
"<",
"?",
">",
"actionType",
",",
"UrlChain",
"moreUrl_or_params",
")",
"{",
"assertArgumentNotNull",
"(",
"\"actionType\"",
",",
"actionType",
")",
";",
"assertArgumentNotNull",
"(",
"\"moreUrl_or_params\"",
"... | Forward to the action with the more URL parts and the the parameters on GET.
<pre>
<span style="color: #3F7E5E">// e.g. /member/edit/3/ *same as forwardById()</span>
return forwardWith(MemberEditAction.class, <span style="color: #FD4747">moreUrl</span>(memberId));
<span style="color: #3F7E5E">// e.g. /member/edit/?memberId=3 *same as forwardByParam()</span>
return forwardWith(MemberEditAction.class, <span style="color: #FD4747">params</span>("memberId", memberId));
<span style="color: #3F7E5E">// e.g. /member/edit/3/</span>
return forwardWith(MemberAction.class, <span style="color: #FD4747">moreUrl</span>("edit", memberId));
<span style="color: #3F7E5E">// e.g. /member/edit/3/#profile</span>
return forwardWith(MemberEditAction.class, <span style="color: #FD4747">moreUrl</span>(memberId).<span style="color: #FD4747">hash</span>("profile"));
<span style="color: #3F7E5E">// e.g. /member/edit/?memberId=3#profile</span>
return forwardWith(MemberEditAction.class, <span style="color: #FD4747">params</span>("memberId", memberId).<span style="color: #FD4747">hash</span>("profile"));
</pre>
@param actionType The class type of action that it forwards to. (NotNull)
@param moreUrl_or_params The chain of URL. (NotNull)
@return The HTML response for forward containing GET parameters. (NotNull) | [
"Forward",
"to",
"the",
"action",
"with",
"the",
"more",
"URL",
"parts",
"and",
"the",
"the",
"parameters",
"on",
"GET",
".",
"<pre",
">",
"<span",
"style",
"=",
"color",
":",
"#3F7E5E",
">",
"//",
"e",
".",
"g",
".",
"/",
"member",
"/",
"edit",
"/... | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/LastaAction.java#L463-L467 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java | ListManagementTermsImpl.deleteTerm | public String deleteTerm(String listId, String term, String language) {
return deleteTermWithServiceResponseAsync(listId, term, language).toBlocking().single().body();
} | java | public String deleteTerm(String listId, String term, String language) {
return deleteTermWithServiceResponseAsync(listId, term, language).toBlocking().single().body();
} | [
"public",
"String",
"deleteTerm",
"(",
"String",
"listId",
",",
"String",
"term",
",",
"String",
"language",
")",
"{",
"return",
"deleteTermWithServiceResponseAsync",
"(",
"listId",
",",
"term",
",",
"language",
")",
".",
"toBlocking",
"(",
")",
".",
"single",... | Deletes a term from the list with list Id equal to the list Id passed.
@param listId List Id of the image list.
@param term Term to be deleted
@param language Language of the terms.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the String object if successful. | [
"Deletes",
"a",
"term",
"from",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"the",
"list",
"Id",
"passed",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java#L180-L182 |
payneteasy/superfly | superfly-demo/src/main/java/com/payneteasy/superfly/demo/web/utils/CommonsHttpInvokerRequestExecutor.java | CommonsHttpInvokerRequestExecutor.validateResponse | protected void validateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod)
throws IOException {
if (postMethod.getStatusCode() >= 300) {
throw new HttpException(
"Did not receive successful HTTP response: status code = " + postMethod.getStatusCode() +
", status message = [" + postMethod.getStatusText() + "]");
}
} | java | protected void validateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod)
throws IOException {
if (postMethod.getStatusCode() >= 300) {
throw new HttpException(
"Did not receive successful HTTP response: status code = " + postMethod.getStatusCode() +
", status message = [" + postMethod.getStatusText() + "]");
}
} | [
"protected",
"void",
"validateResponse",
"(",
"HttpInvokerClientConfiguration",
"config",
",",
"PostMethod",
"postMethod",
")",
"throws",
"IOException",
"{",
"if",
"(",
"postMethod",
".",
"getStatusCode",
"(",
")",
">=",
"300",
")",
"{",
"throw",
"new",
"HttpExcep... | Validate the given response as contained in the PostMethod object,
throwing an exception if it does not correspond to a successful HTTP response.
<p>Default implementation rejects any HTTP status code beyond 2xx, to avoid
parsing the response body and trying to deserialize from a corrupted stream.
@param config the HTTP invoker configuration that specifies the target service
@param postMethod the executed PostMethod to validate
@throws IOException if validation failed
@see org.apache.commons.httpclient.methods.PostMethod#getStatusCode()
@see org.apache.commons.httpclient.HttpException | [
"Validate",
"the",
"given",
"response",
"as",
"contained",
"in",
"the",
"PostMethod",
"object",
"throwing",
"an",
"exception",
"if",
"it",
"does",
"not",
"correspond",
"to",
"a",
"successful",
"HTTP",
"response",
".",
"<p",
">",
"Default",
"implementation",
"r... | train | https://github.com/payneteasy/superfly/blob/4cad6d0f8e951a61f3c302c49b13a51d179076f8/superfly-demo/src/main/java/com/payneteasy/superfly/demo/web/utils/CommonsHttpInvokerRequestExecutor.java#L205-L213 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/RequestHandler.java | RequestHandler.addNode | public Observable<LifecycleState> addNode(final NetworkAddress hostname, final NetworkAddress alternate) {
Node node = nodeBy(hostname);
if (node != null) {
LOGGER.debug("Node {} already registered, skipping.", hostname);
return Observable.just(node.state());
}
return addNode(new CouchbaseNode(hostname, ctx, alternate));
} | java | public Observable<LifecycleState> addNode(final NetworkAddress hostname, final NetworkAddress alternate) {
Node node = nodeBy(hostname);
if (node != null) {
LOGGER.debug("Node {} already registered, skipping.", hostname);
return Observable.just(node.state());
}
return addNode(new CouchbaseNode(hostname, ctx, alternate));
} | [
"public",
"Observable",
"<",
"LifecycleState",
">",
"addNode",
"(",
"final",
"NetworkAddress",
"hostname",
",",
"final",
"NetworkAddress",
"alternate",
")",
"{",
"Node",
"node",
"=",
"nodeBy",
"(",
"hostname",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
... | Add a {@link Node} identified by its hostname.
@param hostname the hostname of the node.
@return the states of the node (most probably {@link LifecycleState#CONNECTED}). | [
"Add",
"a",
"{",
"@link",
"Node",
"}",
"identified",
"by",
"its",
"hostname",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L294-L301 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getBigInteger | public BigInteger getBigInteger() throws IOException {
if (tag != tag_Integer)
throw new IOException("DerValue.getBigInteger, not an int " + tag);
return buffer.getBigInteger(data.available(), false);
} | java | public BigInteger getBigInteger() throws IOException {
if (tag != tag_Integer)
throw new IOException("DerValue.getBigInteger, not an int " + tag);
return buffer.getBigInteger(data.available(), false);
} | [
"public",
"BigInteger",
"getBigInteger",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tag",
"!=",
"tag_Integer",
")",
"throw",
"new",
"IOException",
"(",
"\"DerValue.getBigInteger, not an int \"",
"+",
"tag",
")",
";",
"return",
"buffer",
".",
"getBigIntege... | Returns an ASN.1 INTEGER value as a BigInteger.
@return the integer held in this DER value as a BigInteger. | [
"Returns",
"an",
"ASN",
".",
"1",
"INTEGER",
"value",
"as",
"a",
"BigInteger",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L522-L526 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java | Log.logWarn | public static void logWarn(String message, Throwable t) {
logWarn(message + SEP + getMessage(t));
} | java | public static void logWarn(String message, Throwable t) {
logWarn(message + SEP + getMessage(t));
} | [
"public",
"static",
"void",
"logWarn",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"logWarn",
"(",
"message",
"+",
"SEP",
"+",
"getMessage",
"(",
"t",
")",
")",
";",
"}"
] | Warning logging with cause.
@param message message
@param t cause | [
"Warning",
"logging",
"with",
"cause",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java#L119-L121 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.headerFragment | public T headerFragment(Object model, Marshaller marshaller) {
StringResult result = new StringResult();
try {
marshaller.marshal(model, result);
} catch (XmlMappingException e) {
throw new CitrusRuntimeException("Failed to marshal object graph for message header data", e);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to marshal object graph for message header data", e);
}
return header(result.toString());
} | java | public T headerFragment(Object model, Marshaller marshaller) {
StringResult result = new StringResult();
try {
marshaller.marshal(model, result);
} catch (XmlMappingException e) {
throw new CitrusRuntimeException("Failed to marshal object graph for message header data", e);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to marshal object graph for message header data", e);
}
return header(result.toString());
} | [
"public",
"T",
"headerFragment",
"(",
"Object",
"model",
",",
"Marshaller",
"marshaller",
")",
"{",
"StringResult",
"result",
"=",
"new",
"StringResult",
"(",
")",
";",
"try",
"{",
"marshaller",
".",
"marshal",
"(",
"model",
",",
"result",
")",
";",
"}",
... | Expect this message header data as model object which is marshalled to a character sequence
using the default object to xml mapper before validation is performed.
@param model
@param marshaller
@return | [
"Expect",
"this",
"message",
"header",
"data",
"as",
"model",
"object",
"which",
"is",
"marshalled",
"to",
"a",
"character",
"sequence",
"using",
"the",
"default",
"object",
"to",
"xml",
"mapper",
"before",
"validation",
"is",
"performed",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L385-L397 |
dmfs/xmlobjects | src/org/dmfs/xmlobjects/serializer/XmlObjectSerializer.java | XmlObjectSerializer.useNamespace | public void useNamespace(SerializerContext serializerContext, String namespace)
{
if (namespace != null && namespace.length() > 0)
{
if (serializerContext.knownNamespaces == null)
{
serializerContext.knownNamespaces = new HashSet<String>(8);
}
serializerContext.knownNamespaces.add(namespace);
}
} | java | public void useNamespace(SerializerContext serializerContext, String namespace)
{
if (namespace != null && namespace.length() > 0)
{
if (serializerContext.knownNamespaces == null)
{
serializerContext.knownNamespaces = new HashSet<String>(8);
}
serializerContext.knownNamespaces.add(namespace);
}
} | [
"public",
"void",
"useNamespace",
"(",
"SerializerContext",
"serializerContext",
",",
"String",
"namespace",
")",
"{",
"if",
"(",
"namespace",
"!=",
"null",
"&&",
"namespace",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"serializerContext",
".",
... | Inform the serializer that the given namespace will be used. This allows the serializer to bind a prefix early.
@param namespace
The namespace that will be used. | [
"Inform",
"the",
"serializer",
"that",
"the",
"given",
"namespace",
"will",
"be",
"used",
".",
"This",
"allows",
"the",
"serializer",
"to",
"bind",
"a",
"prefix",
"early",
"."
] | train | https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/serializer/XmlObjectSerializer.java#L245-L255 |
jenkinsci/jenkins | core/src/main/java/hudson/diagnosis/OldDataMonitor.java | OldDataMonitor.doDiscard | @RequirePOST
public HttpResponse doDiscard(StaplerRequest req, StaplerResponse rsp) {
saveAndRemoveEntries( new Predicate<Map.Entry<SaveableReference,VersionRange>>() {
@Override
public boolean apply(Map.Entry<SaveableReference, VersionRange> entry) {
return entry.getValue().max == null;
}
});
return HttpResponses.forwardToPreviousPage();
} | java | @RequirePOST
public HttpResponse doDiscard(StaplerRequest req, StaplerResponse rsp) {
saveAndRemoveEntries( new Predicate<Map.Entry<SaveableReference,VersionRange>>() {
@Override
public boolean apply(Map.Entry<SaveableReference, VersionRange> entry) {
return entry.getValue().max == null;
}
});
return HttpResponses.forwardToPreviousPage();
} | [
"@",
"RequirePOST",
"public",
"HttpResponse",
"doDiscard",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"{",
"saveAndRemoveEntries",
"(",
"new",
"Predicate",
"<",
"Map",
".",
"Entry",
"<",
"SaveableReference",
",",
"VersionRange",
">",
">",
... | Save all files containing only unreadable data (no data upgrades), which discards this data.
Remove those items from the data map. | [
"Save",
"all",
"files",
"containing",
"only",
"unreadable",
"data",
"(",
"no",
"data",
"upgrades",
")",
"which",
"discards",
"this",
"data",
".",
"Remove",
"those",
"items",
"from",
"the",
"data",
"map",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/diagnosis/OldDataMonitor.java#L343-L353 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/InboundNatRulesInner.java | InboundNatRulesInner.getAsync | public Observable<InboundNatRuleInner> getAsync(String resourceGroupName, String loadBalancerName, String inboundNatRuleName, String expand) {
return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, inboundNatRuleName, expand).map(new Func1<ServiceResponse<InboundNatRuleInner>, InboundNatRuleInner>() {
@Override
public InboundNatRuleInner call(ServiceResponse<InboundNatRuleInner> response) {
return response.body();
}
});
} | java | public Observable<InboundNatRuleInner> getAsync(String resourceGroupName, String loadBalancerName, String inboundNatRuleName, String expand) {
return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, inboundNatRuleName, expand).map(new Func1<ServiceResponse<InboundNatRuleInner>, InboundNatRuleInner>() {
@Override
public InboundNatRuleInner call(ServiceResponse<InboundNatRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"InboundNatRuleInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"loadBalancerName",
",",
"String",
"inboundNatRuleName",
",",
"String",
"expand",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGro... | Gets the specified load balancer inbound nat rule.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@param inboundNatRuleName The name of the inbound nat rule.
@param expand Expands referenced resources.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the InboundNatRuleInner object | [
"Gets",
"the",
"specified",
"load",
"balancer",
"inbound",
"nat",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/InboundNatRulesInner.java#L506-L513 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendCloseBlocking | public static void sendCloseBlocking(final CloseMessage closeMessage, final WebSocketChannel wsChannel) throws IOException {
wsChannel.setCloseReason(closeMessage.getReason());
wsChannel.setCloseCode(closeMessage.getCode());
sendBlockingInternal(closeMessage.toByteBuffer(), WebSocketFrameType.CLOSE, wsChannel);
} | java | public static void sendCloseBlocking(final CloseMessage closeMessage, final WebSocketChannel wsChannel) throws IOException {
wsChannel.setCloseReason(closeMessage.getReason());
wsChannel.setCloseCode(closeMessage.getCode());
sendBlockingInternal(closeMessage.toByteBuffer(), WebSocketFrameType.CLOSE, wsChannel);
} | [
"public",
"static",
"void",
"sendCloseBlocking",
"(",
"final",
"CloseMessage",
"closeMessage",
",",
"final",
"WebSocketChannel",
"wsChannel",
")",
"throws",
"IOException",
"{",
"wsChannel",
".",
"setCloseReason",
"(",
"closeMessage",
".",
"getReason",
"(",
")",
")",... | Sends a complete close message, invoking the callback when complete
@param closeMessage the close message
@param wsChannel The web socket channel | [
"Sends",
"a",
"complete",
"close",
"message",
"invoking",
"the",
"callback",
"when",
"complete"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L865-L869 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsInner.java | VirtualMachineExtensionsInner.updateAsync | public Observable<VirtualMachineExtensionInner> updateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) {
return updateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() {
@Override
public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualMachineExtensionInner> updateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) {
return updateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() {
@Override
public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualMachineExtensionInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmName",
",",
"String",
"vmExtensionName",
",",
"VirtualMachineExtensionUpdate",
"extensionParameters",
")",
"{",
"return",
"updateWithServic... | The operation to update the extension.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine where the extension should be updated.
@param vmExtensionName The name of the virtual machine extension.
@param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"The",
"operation",
"to",
"update",
"the",
"extension",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsInner.java#L317-L324 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/java/Java.java | Java.emitCommentIndentN | private static void emitCommentIndentN(PrintWriter fp, String text, int indent, boolean type) {
synchronized (lock) {
String cc = type ? "/**" : "/*";
fp.println(cc);
String comment = emitCommentIndentNOnly(fp, text, indent);
fp.println(comment + "/");
}
} | java | private static void emitCommentIndentN(PrintWriter fp, String text, int indent, boolean type) {
synchronized (lock) {
String cc = type ? "/**" : "/*";
fp.println(cc);
String comment = emitCommentIndentNOnly(fp, text, indent);
fp.println(comment + "/");
}
} | [
"private",
"static",
"void",
"emitCommentIndentN",
"(",
"PrintWriter",
"fp",
",",
"String",
"text",
",",
"int",
"indent",
",",
"boolean",
"type",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"String",
"cc",
"=",
"type",
"?",
"\"/**\"",
":",
"\"/*\"",
... | Write a comment at some indentation level.
@param fp
@param text
@param indent
@param type | [
"Write",
"a",
"comment",
"at",
"some",
"indentation",
"level",
"."
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/java/Java.java#L101-L110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.